Книга: Advanced PIC Microcontroller Projects in C
8.4.5 Endpoint Descriptors
8.4.5 Endpoint Descriptors
Table 8.13 shows the format of the endpoint descriptor.
bLength is the length of the device descriptor.
bDescriptorType is the descriptor type.
bEndpointAddress is the address of the endpoint.
bmAttributes specifies what type of endpoint it is.
wMaxPacketSize is the maximum packet size.
bInterval specifies how often the endpoint should be polled (in ms).
Table 8.13: Endpoint descriptor
Offset | Field | Size | Description |
---|---|---|---|
0 | bLength | 1 | Descriptor size in bytes |
1 | bDescriptorType | 1 | Endpoint (0x05) |
2 | bcdEndpointAddress | 1 | Endpoint address |
4 | bmAttributes | 1 | Type of endpoint |
5 | wMaxPacketSize | 2 | Max packet size |
6 | bInterval | 1 | Polling interval |
Table 8.14 shows an example endpoint descriptor for a mouse device. The length of the descriptor is 7 bytes (bLength=7), and the descriptor type is 0x05 (bDescriptorType=0x05). The endpoint address is 0x50 (bEndpointAddress=0x50). The endpoint is to be used as an interrupt endpoint (bmAttributes=0x03). The maximum packet size is set to 2 (wMaxPacketSize=0x02) to indicate that packets longer than 2 bytes will not be sent from the endpoint. The endpoint should be polled at least once every 20ms (bInterval=0x14).
Table 8.14: Example endpoint descriptor
Offset | Field | Size | Description |
---|---|---|---|
0 | bLength | 7 | Descriptor size in bytes |
1 | bDescriptorType | 0x05 | Endpoint (0x05) |
2 | bcdEndpointAddress | 0x50 | Endpoint address |
4 | bmAttributes | 0x03 | Interrupt type endpoint |
5 | wMaxPacketSize | 0x0002 | Max packet size is 2 |
6 | bInterval | 0x14 | Polling interval is 20ms |