description of USB class,subclass and protocol

USB Class Codes                     November 17, 2009


USB defines class code information that is used to identify a device’s functionality and to nominally load a device driver based on that functionality. The information is contained in three bytes with the names Base Class, SubClass, and Protocol. (Note that ‘Base Class’ is used in this description to identify the first byte of the Class Code triple. That terminology is not used in the USB Specification). There are two places on a device where class code information can be placed.One place is in the Device Descriptor, and the other is in Interface Descriptors. Some defined class codes are allowed to be used only in a Device Descriptor, others can be used in both Device and Interface Descriptors, and some can only be used in Interface Descriptors. The table below shows the currently defined set of  Base Class values, what the generic usage is, and where that Base Class can be used (either Device or Interface Descriptors or both).

 

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


Base Class 00h (Device)

This base class is defined to be used in Device Descriptors to indicate that class information should be determined from the Interface Descriptors in the device. There is one class code definition in this base class.  All other values are reserved.

 

This value is also used in Interface Descriptors to indicate a null class code triple.

 

Base Class

SubClass

Protocol

Meaning

00h

00h

00h

Use class code info from Interface Descriptors

 


Base Class 01h (Audio)

This base class is defined for Audio capable devices that conform to the Audio Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values. Values outside of that defined spec are reserved. These class codes may only be used in Interface Descriptors.

 

Base Class

SubClass

Protocol

Meaning

01h

xxh

xxh

Audio device

 

 

Base Class 02h (Communications and CDC Control)

 

This base class is defined for devices that conform to the Communications Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values. Values outside of that defined spec are reserved.  Note that the Communication Device Class spec requires some class code values (triples) to be used in Device Descriptors and some to be used in Interface Descriptors.

 

Base Class

SubClass

Protocol

Meaning

02h

xxh

xxh

Communication device class

 

Base Class 03h (HID – Human Interface Device)

This base class is defined for devices that conform to the HID Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values.   Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

 

Base Class

SubClass

Protocol

Meaning

03h

xxh

xxh

HID device class

 

Base Class 05h (Physical)

This base class is defined for devices that conform to the Physical Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values.  Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

 

Base Class

SubClass

Protocol

Meaning

05h

xxh

xxh

Physical device class

 

 

Base Class 06h (Still Imaging)

This base class is defined for devices that conform to the Imaging Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values.   Values outside of that defined spec are reserved.

 

Base Class

SubClass

Protocol

Meaning

06h

01h

01h

Still Imaging device

 

 

Base Class 07h (Printer)

This base class is defined for devices that conform to the Printer Device Class Specification found on the USB-IF website.  That specification defines the usable set of SubClass and Protocol values.  Values outside of that defined spec are reserved.  These class codes can only be used in Interface Descriptors.

 

Base Class

SubClass

Protocol

Meaning

07h

xxh

xxh

Printer device

 

 

Base Class 08h (Mass Storage)

This base class is defined for devices that conform to the Mass Storage Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values. Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

 

Base Class

SubClass

Protocol

Meaning

08h

xxh

xxh

Mass Storage device

 

 

Base Class 09h (Hub)

This base class is defined for devices that are USB hubs and conform to the definition in the USB specification.  That specification defines the complete triples as shown below.  All other values are reserved.  These class codes can only be used in Device Descriptors.

 

Base Class

SubClass

Protocol

Meaning

09h

00h

00h

Full speed Hub

01h

Hi-speed hub with single TT

02h

Hi-speed hub with multiple TTs

 

 

Base Class 0Ah (CDC-Data)

This base class is defined for devices that conform to the Communications Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values.Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

 

Base Class

SubClass

Protocol

Meaning

0Ah

xxh

xxh

CDC data device

 

 

Base Class 0Bh (Smart Card)

This base class is defined for devices that conform to the Smart Card Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values.Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

 

Base Class

SubClass

Protocol

Meaning

0Bh

xxh

xxh

Smart Card device

 

 

Base Class 0Dh (Content Security)

This base class is defined for devices that conform to the Content Security Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values. Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

 

Base Class

SubClass

Protocol

Meaning

0Dh

00h

00h

Content Security device

 

 

Base Class 0Eh (Video)

This base class is defined for devices that conform to the Video Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values. Values outside of that defined spec are reserved. These class codes can only be used in Interface Descriptors.

 

Base Class

SubClass

Protocol

Meaning

0Eh

xxh

xxh

Video device

 

 

Base Class 0Fh (Personal Healthcare)

This base class is defined for devices that conform to the Personal Healthcare Device Class Specification found on the USB-IF website. That specification defines the usable set of SubClass and Protocol values. Values outside of that defined spec are reserved. These class codes should only be used in Interface Descriptors.

 

Base Class

SubClass

Protocol

Meaning

0Fh

xxh

xxh

Personal Healthcare device

 

 

Base Class DCh (Diagnostic Device)

This base class is defined for devices that diagnostic devices. There is currently only one value defined. All other values are reserved. This class code can be used in Device or Interface Descriptors.

 

Base Class

SubClass

Protocol

Meaning

DCh

01h

01h

USB2 Compliance Device.  Definition for this device can be found at http://www.intel.com/technology/usb/spec.htm

 

USB Class Codes                    

November 17, 2009

USB defines class code information that is used to identify a device’s functionality and to nominally load a device driver based on that functionality. The information is contained in three bytes with the names Base Class, SubClass, and Protocol. (Note that ‘Base Class’ is used in this description to identify the first byte of the Class Code triple. That terminology is not used in the USB Specification). There are two places on a device where class code information can be placed.One place is in the Device Descriptor, and the other is in Interface Descriptors. Some defined class codes are allowed to be used only in a Device Descriptor, others can be used in both Device and Interface Descriptors, and some can only be used in Interface Descriptors. The table below shows the currently defined set of  Base Class values, what the generic usage is, and where that Base Class can be used (either Device or Interface Descriptors or both).

 

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


在USB标准子类中,有一类称之为CDC类,可以实现虚拟串口通信的协议,而且由于大部分的操作系统(Windows和Linux)都带有支持CDC类的设备驱动程序,可以自动识别CDC类的设备,免去了写专用设备驱动的负担,简化了设备驱动的安装。

          USB的CDC类是USB通信设备类(Communication Device Class)的简称。CDC类是USB组织定义的一类专门给各种通信设备(电信通信设备和中速网络通信设备)使用的USB子类。根据CDC类所针对通信设备的不同,CDC类又被分成以下不同的模型:USB传统纯电话业务(POTS)模型,USB ISDN模型和USB网络模型。其中,USB传统纯电话业务模型,有可分为直接线控制模型(Direct Line Control Model)、抽象控制模型(Abstract Control Model)和USB电话模型(USB Telephone Model),如图1所示。本文所讨论的虚拟串口就属于USB传统纯电话业务模型下的抽象控制模型。

通常一个CDC类又由两个接口子类组成通信接口类(Communication Interface Class)和数据接口类(Data Interface Class)。笔者主要通过通信接口类对设备进行管理和控制,而通过数据接口类传送数据。这两个接口子类占有不同数量和类型的终端点(Endpoints),如图2所示。对于前面所述的不同CDC类模型,其所对应的接口的终端点需求也是不同的。

          抽象控制模型对终端点的需求,通信接口类需要一个控制终端点(Control Endpoint)和一个可选的中断(Interrupt)型终端点,数据接口子类需要一个方向为输入(IN)的周期性(Isochronous)型终端点和一个方向为输出(OUT)的周期性型终端点。

          其中控制终端点主要用于USB设备的枚举和虚拟串口的波特率和数据类型(数据位数、停止位和起始位)设置的通信。interrupt in端点是device 向host通知自己的serial state changed 。输出方向的非同步终端点用于主机(Host)向从设备(Slave)发送数据,相当于传统物理串口中的TXD线(如果从单片机的角度看),输入方向的非同步终端点用于从设备向主机发送数据,相当于传统物理串口中的RXD线。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值