![](/images/new-backgrounds/1171214/171214113x1.webp)
www.ti.com | USB Controller Host and Peripheral Modes Operation |
3.2.4.2.2Operation
The operation starts when the software writes to the FIFO and sets TXPKTRDY bit of HOST_TXCSR (bit 0). This triggers the controller to send an OUT token followed by the first data packet from the FIFO.
An interrupt is generated whenever a packet is sent and the software may use this interrupt to load the next packet into the FIFO and set the TXPKTRDY bit in the HOST_TXCSR register (bit 0) in the same way as for a Bulk Tx endpoint. As the interrupt could occur almost any time within a frame, depending on when the host has scheduled the transaction, this may result in irregular timing of FIFO load requests. If the data source for the endpoint is coming from some external hardware, it may be more convenient to wait until the end of each frame before loading the FIFO as this will minimize the requirement for additional buffering. This can be done by using the SOF_PULSE signal from the controller to trigger the loading of the next data packet. The SOF_PULSE is generated once per frame(/microframe). The interrupts may still be used to set the TXPKTRDY bit in HOST_TXCSR.
3.3DMA Operation
The DMA controller
The DMA controller has a concept of DMA packets which is different from the USB packets. A DMA packet can be (but not necessarily) of the same size as USB packet. Each DMA packet can comprise of one or multiple data buffers. Each DMA channel can process one or multiple chains of these DMA packets.
The controller supports two modes of DMA: transparent mode and RNDIS mode. Transparent mode will interrupt the CPU for every USB data packet, while RNDIS mode can service multiple USB packets with only a single CPU interrupt.
3.3.1DMA Transmit Operation
For transmit operation, the software has to program the DMA channel with a chain of transmit buffers.
3.3.1.1Transmit Buffer
A Transmit buffer is a contiguous block of memory used to store data for transmission. Each Tx buffer has a corresponding Tx buffer descriptor. Each Tx buffer can be linked together with other Tx buffers to make a DMA packet or a queue of DMA packets.
Transmit buffers are byte aligned structures located in processor’s main memory. Tx buffer size may vary from 1 to 65,535 bytes.
3.3.1.2CPPI Transmit Buffer Descriptor
Tx buffer descriptors provide information about a single corresponding Tx data buffer. Every Tx buffer has a single Tx buffer descriptor that stores the following information:
∙Pointer to the data buffer
∙Pointer to the next buffer descriptor in the queue
∙Buffer length and offset to the first valid byte of buffer data
∙Start of DMA packet (SOP) indicator
∙End of DMA packet (EOP) indicator
∙Ownership (only valid with SOP)
Universal Serial Bus (USB) Controller | 57 |