目录
摘要
关于USB的Class,对于学习USB协议的人,估计早就听到过此名词了。
而对于USB的Class的分类,此处先列出那个最基本的分类表:
表 4.1. USB Class表
| Base Class | Descriptor Usage | Description |
|---|---|---|
| 00h | Device | Use class information in the Interface Descriptors |
| 01h | Interface | Audio |
| 02h | Both | Communications and CDC Control |
| 03h | Interface | HID (Human Interface Device) |
| 05h | Interface | Physical |
| 06h | Interface | Image |
| 07h | Interface | Printer |
| 08h | Interface | Mass Storage |
| 09h | Device | Hub |
| 0Ah | Interface | CDC-Data |
| 0Bh | Interface | Smart Card |
| 0Dh | Interface | Content Security |
| 0Eh | Interface | Video |
| 0Fh | Interface | Personal Healthcare |
| DCh | Both | Diagnostic Device |
| E0h | Interface | Wireless Controller |
| EFh | Both | Miscellaneous |
| FEh | Interface | Application Specific |
| FFh | Both | Vendor Specific |
其实,看到表 4.1 “USB Class表”中的一堆的Class分类,一般人,都会晕的。
所以,就要简单解释一下,为何会有这么多USB的Class分类。
首先我们要知道,USB协议设计的目的,就是为了第 1.2 节 “为何要有USB”中所提到的,用单一的USB接口,取代之前种类繁多的各种其他接口。
而为了取代其他各种接口,那意味着就要实现,或者是支持,之前别的接口,所对应的各种功能。
因此,USB协议设计的时候,就是要把鼠标,键盘,大容量存储,图像等,这些之前是通过其他接口所实现的,各种的功能,都囊括进来。并且在协议中有对应的规范定义,支持这些功能。
因此,才有了如此多的各种USB的Clas,即分类,根据功能而分出的各种类别。不同的Class分类,用于实现对应的功能,适用于相应的设备。
比如我们常见的鼠标和键盘,都属于Class 3的HID,U盘属于Class 8的Mass Storage等。
而关于这些分类,每种分类都对应着哪些具体的应用和功能,感兴趣的可以去参考USB classes中的Overview of the various USB classes,该页面,相对形象地列出了各种Class所对应的应用。
再回到上述的表 4.1 “USB Class表”,其中的“Descriptor Usage”中的Interface,Device等,对应的是来自表 4.2 “USB Descriptor Type”
表 4.2. USB Descriptor Type
| Descriptor Type | Value |
|---|---|
| DEVICE | 1 |
| CONFIGURATION | 2 |
| STRING | 3 |
| INTERFACE | 4 |
| ENDPOINT | 5 |
| DEVICE_QUALIFIER | 6 |
| OTHER_SPEED_CONFIGURATION | 7 |
| INTERFACE_POWER | 8 |
而关于什么是Device,什么是Interface等内容,暂时先简述他们之间的关系:
Device ⇒ Configuration ⇒ Interface ⇒ Endpoint
更新详细内容,待以后有空再深入解释。