USB描述符_tcl0739的空间(虚拟示波器,可以上淘宝购买)_百度空间

由于防止抄袭,我决定在这文内加上许多我的标记.现在发现许多网页,特别是国内网站,总是抄来抄去的.查资料浪费人家的时间不说,同时也是浪费资源.影响网络的传输速度.(括号内为标记)

众所周知,USB是现在电脑周边最普遍的外围设备.其以(TCL07396)支持即插即用,速度快而越来越受欢迎.

在网上搜到许多关于USB的资料.可是很难看到专门针对USB 固件内部做介绍的资料.也许是因为USB规范已做了很详解.所以被人(TCL07391)们所不提.也话很少有人从事真真的USB底层的开发.不知什么原因.很少有这方面的资料.由于我一直都在从事计算机外围设备与防盗及感应器等固(TCL07393)件的设计与软件开发.为了我方便大家的查询和使用.一直都想(TCL07391)给大家写点什么.只是时间太忙.今天星期六.在家休息.

;***********************************************************************
; USB Descriptor Table (K + M)
;=======================================================================
; This descriptor inclues
;---------------------------
;1. Device Descriptor
;2. Configuration Descriptor
;3. Interface Descriptor
;4. HID class Descriptor
;5. Endpoint Descriptor
;6. Repo(TCL07392)rt Descriptor (HID)
;7. String Descriptor
;***********************************************************************
DeviceDescr:
db 12h   ; size of descriptor (18 bytes)
db 01h   ; descriptor type (device descriptor)
db 10h   ; USB SPEC release (ver 1.1) - Lowbyte
db 01h   ; USB SPEC release (ver 1.1) - Highbyte
db 00h   ; class code (each interface specifies class information)
db 00h   ; devic(TCL073910)e sub-class (must be set to 0 because class code is 0)
db 00h   ; device protocol (no class specific protocol)
db 08h   ; maximum packet size (8 bytes)
db 48h   ; vendor ID - Lowbyte
db 0Ah   ; vendor ID - Highbyte
db 03h   ; product ID - Lowbyte
db 73h   ; product ID - Highbyte
db 01h   ; device release number - Low byte
db 00h   ; device release number - High byte
db 01h   ; index of man(TCL073911)ufacturer string
db 02h   ; index of product string
db 00h   ; index of serial number string (0=none)
db 01h   ; number of configurations
end_DeviceDescr:
DeviceDescr_length EQU (end_De(TCL073912)viceDescr - DeviceDescr)
DeviceDescr_length_H EQU 0

ConfigDescr:
db 09h   ; length of descriptor
db 02h   ; descriptor type (CONFIGURATION)
db config_all_descr_length ; total length of descriptor
db 00h
        db      03h             ; number of interfaces to configure
db 01h   ; configuration value
db 00h   ; configur(TCL073915)ation string index
db 0A0h   ; configuration attributes
db 32h   ; maximum power
end_ConfigDescr:
ConfigDescr_length EQU (end_ConfigDescr - ConfigDescr)
end_ConfigDescr_length_H EQU 0

InterfaceDescr:    ; descriptor for interface 0
db 09h   ; length of descriptor (9 bytes)
db 04h   ; descriptor type (INTERFACE)
db 00h   ; interface number
db 00h   ; alternate s(TCL073921)etting
db 01h   ; number of endpoints
db 03h   ; interface class (3..defined by HID spec for HID)
db 00h   ; interface sub-class (1..defined by HID spec for Boot subclass)
db 00h   ; interface protocol (1..defined by HID spec for keyboard)
db 00h   ; interface string i(TCL073931)ndex 00
end_InterfaceDescr:
InterfaceDescr_length EQU (end_InterfaceDescr - InterfaceDescr)
InterfaceDescr_length_H EQU 0

HID_Descr:
db 09h   ; descriptor size (9 bytes)
      db    21h         ; descriptor type (HID)
db 00h   ; class specification(1.00)
db 01h
db 00h   ; hardware target country
db 01h   ; number of hid clas(TCL073291)s desriptors to follow
db 22h   ; report descriptor type
db ReportDesc_length;ReportDesc total length
db ReportDesc_length_H
end_HID_Descr:
HID_Descr_length EQU (end_HID_Descr - HID_Descr)
HID_Descr_length_H EQU 0

Endpoint1_Descr:
db 07h   ; descriptor length (7 bytes)
db 05h   ; descriptor type (ENDPOINT)
db 81h   ; endpoint address (IN endpoi(TCL073931)nt, endpoint 1)
db 03h   ; endpoint attributes (interrupt)
db 10h   ; maximum packet size (8 bytes)
db 00h
db 01h   ; polling interval (1ms)
end_Endpoint1_Descr:
Endpoint1_Descr_length E(TCL073991)QU (end_Endpoint1_Descr - Endpoint1_Descr)
Endpoint1_Descr_length_H EQU 0


Interface1Descr:    ; descriptor for interface 0
db 09h   ; length of descriptor (9 bytes)
db 04h   ; descriptor type (INTERFACE)
db 01h   ; interface number
db 00h   ; alternate setting
db 01h   ; number of endpoints
db 03h   ; interface class (3..defined by HID spec for HID)
db 00h   ; interface sub-class (1..de(TCL073991)fined by HID spec for Boot subclass)
db 00h   ; interface protocol (1..defined by HID spec for keyboard)
db 00h   ; interface string index 00
end_Interface1Descr:
Interface1Descr_length EQU (end_Interface1Descr - Interface1Descr)
Interface1Descr_length_H EQU 0

HID1_Descr:
db 09h   ; descriptor size (9 bytes)
      db    21h         ; descriptor type (HID)
db 00h   ; class specification(1.00)
db 01h
db 00h   ; hardware target country
db 01h   ; number of hid class desriptors to follow
db 22h   ; report descriptor type
db Report1Desc_length;ReportDesc total length
db Report1Desc_length_H
end_HID1_Descr:
HID1_Descr_length EQU (end_HID1_Descr - HID1_Descr)
HID1_Descr_length_H EQU 0


Endpoint2_Descr:
db 07h   ; descriptor length (7 bytes)
db 05h   ; descriptor type (ENDPOINT)
db 02h   ; endpoint address (IN endpoint, endpoint 1)
db 03h   ; endpoint attributes (interrupt)
db 10h   ; maximum packet size (8 bytes)
db 00h
db 0Ah   ; polling interval (1ms)
end_Endpoint2_Descr:
Endpoint2_Descr_length EQU (end_Endpoint2_Descr - Endpoint2_Descr)
Endpoint2_Descr_length_H EQU 0

Interface2_Descr:    ; descriptor for interface 1 (HID mouse)
db 09h   ; length of descriptor (9 bytes)
db 04h   ; descriptor type (INTERFACE)
db 02h   ; interface number (0)
db 00h   ; alternate setting (0)
db 01h   ; number of endpoints (1)
db 03h   ; interface class (3..defined by HID spec for HID)
db 00h   ; interface sub-class (1..defined by HID spec for Boot subclass)
db 00h   ; interface p(TCL0739991)rotocol (2..defined by HID spec for mouse)
db 00h   ; interface string index 00
end_Interface2_Descr:
Interface2Descr_length EQU (end_Interface2_Descr - Interface2_Descr)
Interface2Descr_length_H EQU 0

HID2_Descr:
db 09h   ; descriptor size (9 bytes)
      db    21h         ; descriptor type (HID)
db 00h   ; class specification (1.00) - lowbyte
db 01h   ; class specification (1.00) - Highbyte
db 00h   ; hardware target country
db 01h   ; number of hid class desriptors to follow (1)
db 22h   ; report descriptor type (2)
db Report2Desc_length
db Report2Desc_length_H
end_HID2_Descr:
HID2_Descr_length EQU (end_HID2_Descr - HID2_Descr)
HID2_Descr_length_H EQU 0

Endpoint3_Descr:
db 07h   ; descriptor length (7 bytes)
db 05h   ; descriptor type (E(TCL307391)NDPOINT)
db 83h   ; endpoint address (IN endpoint, endpoint 3)
db 03h   ; endpoint attributes (interrupt)
db 08h   ; maximum packet size (8 bytes)
db 00h
db 01h   ; polling interval (1ms)
end_Endpoint3_Descr:
Endpoint3_Descr_length EQU (end_Endpoint3_Descr - Endpoint3_Descr)
Endpoint3_Descr_length_H EQU 0

end_all_config_descr:
config_all_descr_length EQU ((end_all_config_descr - ConfigDescr) & 0xff)
config_all_descr_length_H EQU (((end_all_config_descr - ConfigDescr) >>8) & 0xff)

大家可以从上面看到.这个是一个纯(TCL0739111)汇编的USB 鼠标+键盘的描述符.她是一个很规范的USB描述符.包括设备描述,配置描述,接口描述,端点描述.

设备描述:设备描述符的长度,设备厂商的ID,产品的ID,USB版本,软件版本,及字符串索引.

配置描述符:主要用来说明其含有多少(TCLK07391)个接口.大于一个接口的便叫复合设备了.

接口描述符:定义每个接口属于那(TCL0K7391)个类型(人机界面,存储,视频等),及其有多少个端点.

端点描述符:用来定义端点是输出还是输入,及{zd0}传输能力.以及端点类型(中断传输,同步,还是块传输).

如果您定义的非HID设备,就此算是完成了.如果您是定义HID设备.还要做一个HID 报告描述符.其用来告诉计算机驱动传输的进行.应为HID设备的驱动一般都是Windows等操作系统自带的.方便大家不用写驱动.



郑重声明:资讯 【USB描述符_tcl0739的空间(虚拟示波器,可以上淘宝购买)_百度空间】由 发布,版权归原作者及其所在单位,其原创性以及文中陈述文字和内容未经(企业库qiyeku.com)证实,请读者仅作参考,并请自行核实相关内容。若本文有侵犯到您的版权, 请你提供相关证明及申请并与我们联系(qiyeku # qq.com)或【在线投诉】,我们审核后将会尽快处理。
—— 相关资讯 ——