Each endpoint specified in an interface descriptor has an endpoint descriptor. Endpoint zero never has a descriptor because every device must support endpoint zero, the device descriptor contains the maximum packet size, and the USB specification defines everything else about the endpoint.
Table 3-4 shows the fields in the descriptors. Here are more details about the fields and how they’re used in a mass-storage device:
bLength. The number of bytes in the descriptor. Always 07h.
bDescriptorType. The constant ENDPOINT (05h).
bEndpointAddress. The endpoint number and direction. Bits 0..3 are the endpoint number, which can be any value from 1 to 15 supported by the device’s hardware. Bit 7 is the direction: Out = 0, In = 1 Bits 6..4 are unused and must be zero. For example, an interface could use endpoint 1 OUT (01h) and endpoint 1 IN (81h), or endpoint 2 OUT (02h) and endpoint 3 in (83h).
bmAttributes. Bits 1..0 specify the type of transfer the endpoint supports. Bits 7..2 are zero. For bulk transfers, set to 02h.
wMaxPacketSize. The value in bits 10..0 is the maximum number of data bytes the endpoint can transfer in a transaction. The allowed values vary with the device speed and type of transfer. A full-speed bulk endpoint can have a maximum packet size of 08h, 10h, 20h, or 40h bytes. For best performance, use 40h. If a full-speed bulk endpoint’s wMaxPacketSize is less than 40h, some host controllers schedule no more than one transaction per frame. For high speed, the maximum packet size must be 200h. Bits 15..11 are zero for bulk endpoints.
bInterval. The host ignores this value for full-speed bulk endpoints and high-speed bulk IN endpoints. For high-speed bulk OUT endpoints, the value indicates the endpoint’s maximum NAK rate. This value is relevant when the device has received data and has returned ACK, and the host has more data to send. By returning ACK, the device is saying that it expects to be able to accept the next transaction’s data. (Otherwise the device would return NYET.) If the next data packet arrives and for some reason the device can’t accept the packet, the endpoint returns NAK. The bInterval value says that the endpoint expects to return NAK no more than once in each period
specified by bInterval. The value can range from 0 to 255 microframes. A value of zero means the endpoint doesn’t ever expect to return NAK immediately after an ACK.
Table 3-4: A bulk-only mass storage device must have two endpoint descriptors.