Table of Contents | ||||||
---|---|---|---|---|---|---|
|
...
The device synchronous receive operation is initiated by the calls: USBD_BulkRx()
, USBD_CtrlRx()
, and USBD_IntrRx()
. The shows an overview of the device synchronous receive operation. Figure - Device Synchronous Receive Diagram shows an overview of the device synchronous receive operation.
Anchor | ||||
---|---|---|---|---|
|
Panel | ||||
---|---|---|---|---|
| ||||
Panel | ||
---|---|---|
| ||
(1) The upper layer functions ( (2) In On DMA-based controllers, this device driver API is responsible for queuing a receive transfer. The queued receive transfer does not need to satisfy the whole requested transfer length in one single transaction. If multiple transfers are queued only the last queued transfer must be signaled to the USB device stack. This is required since the USB device stack iterates through the receive process until all requested data or a short packet has been received. This function must also return the maximum amount of bytes that will be received. Typically this value will be the lowest value between the maximum transfer size and the amount of bytes requested by the core. On FIFO-based controllers, this device driver API is responsible for enabling data to be received into the endpoint FIFO, including any related ISR’s. The function must return the maximum amount of bytes that will be received. Typically this value will be the lowest value between the FIFO size and the amount of bytes requested by the core. (3) While data is being received, the device synchronous receive operation waits on the device receive signal, during which the endpoint is unlocked. (4) The USB device controller triggers an interrupt request when it is finished receiving the data. This invokes the USB device driver interrupt service routine (ISR) handler, directly or indirectly, depending on the architecture. (5) Inside the USB device driver ISR handler, the type of interrupt request is determined to be a receive interrupt. (6) The device receive operation reaches the On DMA-based controllers, this device driver API is responsible for de-queuing the completed receive transfer and returning the amount of data received. In case the DMA-based controller requires the buffered data to be placed in a dedicated USB memory region, the buffered data must be transferred into the application buffer area. On FIFO-based controllers, this device driver API is responsible for reading the amount of data received by copying it into the application buffer area and returning the data back to its caller. (7) The device receive operation iterates through the process until the amount of data received matches the amount requested, or a short packet is received. The endpoint is unlocked. |
Device Asynchronous Receive
The device asynchronous receive operation is initiated by the calls: USBD_BulkRxAsync()
, USBD_IntrRxAsync()
and
. shows Figure - Device Asynchronous Receive Diagram shows an overview of the device asynchronous receive operation.USBD_IsocRxAsync()
Anchor | ||||
---|---|---|---|---|
|
Panel | ||||
---|---|---|---|---|
| ||||
Panel | ||
---|---|---|
| ||
(1) The upper layer functions ( (2) In On DMA-based controllers, this device driver API is responsible for queuing a receive transfer. The queued receive transfer does not need to satisfy the whole requested transfer length in one single transaction. If multiple transfers are queued only the last queued transfer must be signaled to the USB device stack. This is required since the USB device stack iterates through the receive process until all requested data or a short packet has been received. This function must also return the maximum amount of bytes that will be received. Typically this value will be the lowest value between the maximum transfer size and the amount of bytes requested by the core. On FIFO-based controllers, this device driver API is responsible for enabling data to be received into the endpoint FIFO, including any related ISR’s. The function must return the maximum amount of bytes that will be received. Typically this value will be the lowest value between the FIFO size and the amount of bytes requested by the core. In both cases, no more transfers can be queued on that endpoint if the maximum amount of bytes that can be received is lower than the amount requested by the application. For example, if the application wishes to receive 1000 bytes but that the driver can only receive up to 512 bytes per transfer, (3) The transfer is added to the endpoint transfer list, if possible. That is, the driver must be able to queue the transfer too, there must not be a synchronous transfer currently in progress on that same endpoint and there must not be a partial asynchronous transfer queued on that endpoint (see note #2). The call to (4) The USB device controller triggers an interrupt request when it is finished receiving the data. This invokes the USB device driver interrupt service routine (ISR) handler, directly or indirectly, depending on the architecture. (5) Inside the USB device driver ISR handler, the type of interrupt request is determined to be a receive interrupt. (6) The core task de-queues the core event indicating a completed transfer. (7) The core task invokes (8) The core task internally calls On DMA-based controllers, this device driver API is responsible for de-queuing the completed receive transfer and returning the amount of data received. In case the DMA-based controller requires the buffered data to be placed in a dedicated USB memory region, the buffered data must be transferred into the application buffer area. On FIFO-based controllers, this device driver API is responsible for reading the amount of data received by copying it into the application buffer area and returning the data back to its caller. (9) If the overall amount of data received is less than the amount requested and the current transfer is not a short packet, (10) The receive operation finishes when the amount of data received matches the amount requested, or a short packet is received. The endpoint is unlocked and the receive complete callback is invoked to notify the application about the completion of the process. |
Device Synchronous Transmit
The device synchronous transmit operation is initiated by the calls: USBD_BulkTx()
, USBD_CtrlTx()
, and USBD_IntrTx()
. shows Figure - Device Synchronous Transmit Diagram shows an overview of the device synchronous transmit operation.
Anchor | ||||
---|---|---|---|---|
|
Panel | ||||
---|---|---|---|---|
| ||||
Panel | ||
---|---|---|
| ||
(1) The upper layer functions ( (2) In On DMA-based controllers, this device driver API is responsible for preparing the transmit transfer/descriptor and returning the amount of data to transmit. In case the DMA-based controller requires the buffered data to be placed in a dedicated USB memory region, the contents of the application buffer area must be transferred into the dedicated memory region. On FIFO-based controllers, this device driver API is responsible for writing the amount of data to transfer into the FIFO and returning the amount of data to transmit. (3) The On DMA-based controllers, this device driver API is responsible for queuing the DMA transmit descriptor and enabling DMA transmit complete ISR’s. On FIFO-based controllers, this device driver API is responsible for enabling transmit complete ISR’s. (4) While data is being transmitted, the device synchronous transmit operation waits on the device transmit signal, during which the endpoint is unlocked. (5) The USB device controller triggers an interrupt request when it is finished transmitting the data. This invokes the USB device driver interrupt service routine (ISR) handler, directly or indirectly, depending on the architecture. (6) Inside the USB device driver ISR handler, the type of interrupt request is determined as a transmit interrupt. On DMA-based controllers, the transmit transfer is de-queued from a list of completed transfers. (7) The device transmit operation iterates through the process until the amount of data transmitted matches the requested amount. The endpoint is unlocked. |
Device Asynchronous Transmit
The device asynchronous transmit operation is initiated by the calls: USBD_BulkTxAsync()
, USBD_IntrTxAsync()
and USBD_IsocTxAsync()
. shows Figure - Device Asynchronous Transmit Diagram shows an overview of the device asynchronous transmit operation.
Anchor | ||||
---|---|---|---|---|
|
Panel | ||||
---|---|---|---|---|
| ||||
Panel | ||
---|---|---|
| ||
(1) The upper layer functions ( (2) In On DMA-based controllers, this device driver API is responsible for preparing the transmit transfer/descriptor and returning the amount of data to transmit. In case the DMA-based controller requires the buffered data to be placed in a dedicated USB memory region, the contents of the application buffer area must be transferred into the dedicated memory region. On FIFO-based controllers, this device driver API is responsible for writing the amount of data to transfer into the FIFO and returning the amount of data to transmit. In both cases, no more transfers can be queued on that endpoint if the maximum amount of bytes that can be transmitted is lower than the amount requested by the application. For example, if the application wishes to transmit 1000 bytes but that the driver can only transmit up to 512 bytes per transfer, (3) The On DMA-based controllers, this device driver API is responsible for queuing the DMA transmit descriptor and enabling DMA transmit complete ISR’s. On FIFO-based controllers, this device driver API is responsible for enabling transmit complete ISR’s. (4) The transfer is added to the endpoint transfer list, if possible. That is, the driver must be able to queue the transfer too, there must not be a synchronous transfer currently in progress on that same endpoint and there must not be a partial asynchronous transfer queued on that endpoint (see note #2). The call to (5) The USB device controller triggers an interrupt request when it is finished transmitting the data. This invokes the USB device driver interrupt service routine (ISR) handler, directly or indirectly, depending on the architecture. (6) Inside the USB device driver ISR handler, the type of interrupt request is determined as a transmit interrupt. On DMA-based controllers, the transmit transfer is de-queued from the list of completed transfers. (7) The core task de-queues the core event indicating a completed transfer. (8) The core task invokes (9) If the overall amount of data transmitted is less than the amount requested, (10) The device transmit operation finishes when the amount of data transmitted matches the amount requested. The endpoints is unlocked and the transmit complete callback is invoked to notify the application about the completion of the process. |
Device Set Address
The device set address operation is performed by the setup transfer handler when a SET_ADDRESS
request is received. shows Figure - Device Set Address Diagram shows an overview of the device set address operation.
Anchor | ||||
---|---|---|---|---|
|
Panel | ||||
---|---|---|---|---|
| ||||
Panel | ||
---|---|---|
| ||
(1) Once the arguments of the setup request are validated, (2) The setup request status stage is transmitted to acknowledge the address change. (3) After the status stage, the |