Texas Instruments TMS320DM357 사용자 설명서

다운로드
페이지 144
www.ti.com
USB Controller Host and Peripheral Modes Operation
3.1.2.2.1
Setup
In configuring an Rx endpoint for Bulk OUT transactions, the RXMAXP register must be written with the
maximum packet size (in bytes) for the endpoint. This value should be the same as the wMaxPacketSize
field of the Standard Endpoint Descriptor for the endpoint. In addition, the relevant interrupt enable bit in
the INTRRXE register should be set (if an interrupt is required for this endpoint) and the PERI_RXCSR
register should be set as shown in
.
Table 3. PERI_RXCSR Register Bit Configuration for Bulk OUT Transactions
Bit Position
Bit Field Name
Configuration
Bit 14
ISO
Cleared to 0 to enable Bulk protocol
Bit 13
DMAEN
Set to 1 if a DMA request is required for this endpoint
Bit 12
DISNYET
Cleared to 0 to allow normal PING flow control. This will affect only high speed transactions.
Bit 11
DMAMODE
Always set this bit to 0
When the endpoint is first configured (following a SET_CONFIGURATION or SET_INTERFACE command
on Endpoint 0), the lower byte of PERI_RXCSR should be written to set the CLRDATATOG bit (bit 7).
This will ensure that the data toggle (which is handled automatically by the USB controller) starts in the
correct state.
Also if there are any data packets in the FIFO (indicated by the RXPKTRDY bit (bit 0 of PERI_RXCSR)
being set), they should be flushed by setting the FLUSHFIFO bit (bit 4 of PERI_RXCSR).
Note:
It may be necessary to set this bit twice in succession if double buffering is enabled.
3.1.2.2.2
Operation
When a data packet is received by a Bulk Rx endpoint, the RXPKTRDY bit (bit 0 of PERI_RXCSR) is set
and an interrupt is generated. The software should read the RXCOUNT register for the endpoint to
determine the size of the data packet. The data packet should be read from the FIFO, then the
RXPKTRDY bit should be cleared.
The packets received should not exceed the size specified in the RXMAXP register (as this should be the
value set in the wMaxPacketSize field of the endpoint descriptor sent to the host). When a block of data
larger than wMaxPacketSize needs to be sent to the function, it will be sent as multiple packets. All the
packets will be wMaxPacketSize in size, except the last packet which will contain the residue. The
software may use an application specific method of determining the total size of the block and hence when
the last packet has been received. Alternatively it may infer that the entire block has been received when it
receives a packet which is less than wMaxPacketSize in size. (If the total size of the data block is a
multiple of wMaxPacketSize, a null data packet will be sent after the data to signify that the transfer is
complete.)
In the general case, the application software will need to read each packet from the FIFO individually. If
large blocks of data are being transferred, the overhead of calling an interrupt service routine to unload
each packet can be avoided by using DMA.
SPRUGH3 – November 2008
Universal Serial Bus (USB) Controller
39