Texas Instruments TMS320DM357 manual Receive Abort Handling

Models: TMS320DM357

1 144
Download 144 pages 62.56 Kb
Page 67
Image 67

www.ti.com

USB Controller Host and Peripheral Modes Operation

3.3.2.6Receive Abort Handling

The DMA controller sets ‘Rx Abort’ bit used to identify Rx packets which were aborted due to lack of buffers. Software must take care to inspect any Rx SOP packet for this bit and ignore all the buffers in that packet as the packet is incomplete. Also, for aborted packets, the packet length may not match the data size in the buffers.

3.3.2.7RNDIS Mode and Transparent Mode Receive DMA Operation

Transparent Mode DMA operation is the default DMA mode (as described in previous section) where an interrupt is generated whenever a DMA packet is received. In the transparent mode, DMA packet size cannot be greater than USB MaxPktSize for the endpoint. This means, for receiving say n USB packets, the DMA controller should be programmed with a queue of minimum n DMA packets. RBUFCNTn register also needs to be written with value n. The number n should be greater than 3 as the RBUFCNTn register should have at least 3 packets for the Rx DMA to receive packets from the endpoint FIFO.

RNDIS mode DMA is used to receive DMA packets which are larger than USB MaxPktSize. This is accomplished by breaking the larger packet into smaller packets, not larger than USB MaxPktSize. This implies that multiple USB packets of MaxPktSize will be received and transferred together as a single large DMA packet and the DMA interrupt is generated only at the end of the complete reception of DMA packet. This mode of DMA is used for RNDIS type transfers over USB. The protocol defines the end of the complete transfer by receiving a short USB packet (smaller than USB MaxPktSize as mentioned in USB specification 2.0). If the DMA packet size is an exact multiple of USB MaxPktSize, the DMA controller waits for a zero byte packet at the end of complete transfer to signify the completion of the transfer.

RNDIS Mode DMA is supported only when USB MaxPktSize is an integral multiple of 64 bytes.

RNDIS Mode Setup

The setup of RNDIS mode DMA is similar to the default Transparent Mode as mentioned in the previous section. The following steps need to be taken for setting up RNDIS mode Rx DMA:

RNDIS mode requires that the associated MaxPkt Size and FIFO size must be integral multiples of 64 bytes.

After reset the software must write zeroes to all Rx DMA State registers (RCPPIDMASTATEW0, RCPPIDMASTATEW1, RCPPIDMASTATEW2, RCPPIDMASTATEW3, RCPPIDMASTATEW4, RCPPIDMASTATEW5 and RCPPIDMASTATEW6).

The software constructs receive queue in memory.

Enable DMA for the endpoint in the PERI_RXCSR or HOST_RXCSR by setting the DMAEN bit.

Enable the DMA ports by setting RCPPI_ENABLE bit of RCPPICR register.

Set RNDIS bit of CTRLR register for enabling RNDIS mode for all channels or set TXnEN bit of RNDISR register for specific DMA channel n.

Set the value in RBUFCNTn register (where n is the channel number) for the number of buffers available in the Rx queue. The minimum value should be 3 for the Rx DMA to start operation. The value in RBUFCNTn decrements as DMA controller consumes the buffers for reception.

Write the head of the queue descriptor pointer to the RCPPIDMASTATEW1 register to start the DMA.

The USB controller will send IN token and wait for the data on the bus. Once data is received, DMA controller will transfer the data in the Rx queue from the endpoint FIFO. Once a complete DMA packet is received, the interrupt associated with the DMA channel is asserted.

If the DMA packet size is exact multiple of USB MaxPktSize, a zero byte packet is expected and interrupt associated with the DMA channel is asserted when that zero byte packet is received.

If the DMA packet size is not exact multiple of USB MaxPktSize, the last USB packet received is a short packet and interrupt associated with the DMA channel is asserted.

An additional feature of automatically generating IN tokens is available. This feature is used in USB Host mode operation of the USB controller. This feature is functional in RNDIS mode DMA only. To automatically generate the IN tokens while receiving data, set the field RXn_AUTOREQ (where n is the channel number) of AUTOREQ register with binary 01. In this case, IN tokens will be generated and sent to the target USB peripheral device after every successfully received packet. No IN token will be generated after the End Of DMA Packet is reached. Rx DMA interrupt is generated after the complete reception.

SPRUGH3–November 2008

Universal Serial Bus (USB) Controller

67

Submit Documentation Feedback

Page 67
Image 67
Texas Instruments TMS320DM357 manual Receive Abort Handling, Rndis Mode and Transparent Mode Receive DMA Operation