描述符——端点描述符

描述符定义

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

描述符实现

/**
 * @brief USB endpoint descriptor.
 */
typedef struct __attribute__ ((packed))
{
    
    
    uint8_t  bLength          ; /**< Size of this descriptor in bytes. */
    uint8_t  bDescriptorType  ; /**< ENDPOINT Descriptor Type. */

    uint8_t  bEndpointAddress ; /**< The address of the endpoint. */

    struct __attribute__ ((packed))
    {
    
    
        uint8_t xfer  : 2;        /**< Control, ISO, Bulk, Interrupt. */
        uint8_t sync  : 2;        /**< None, Asynchronous, Adaptive, Synchronous. */
        uint8_t usage : 2;        /**< Data, Feedback, Implicit feedback. */
        uint8_t       : 2;
    }bmAttributes;

    uint16_t wMaxPacketSize   ; /**< Bit 10..0 : max packet size, bit 12..11 additional transaction per highspeed micro-frame. */
    uint8_t  bInterval        ; /**< Polling interval, in frames or microframes depending on the operating speed. */
}usb_desc_endpoint_t;

描述符含义

field description
bLength 该描述符的长度。标准的 USB 端点描述符的长度为 7 字节。
bDescriptorType 描述符的类型,端点描述符的类型编码为 0x05。
bEndpointAddress 该端点地址。最高位 D7 为该端点的传输方向,1 为输入,0 为输出。D3-D0 为端点号。D6-D4保留,为 0。
bmAttributes 该端点的属性。
wMaxPacketSize 2 字节,该端点所支持的最大包长度,注意低字节在前。
bInterval 表示该端点的查询时间。对于中断端点,表示查询的帧间隔数。

猜你喜欢

转载自blog.csdn.net/tyustli/article/details/133232143