English
Language : 

AT32AP7000_1 Datasheet, PDF (677/973 Pages) ATMEL Corporation – AVR32 32-bit Microcontroller
AT32AP7000
32.6.6.6
This algorithm must not be used for isochronous transfer. In this case, the ping-pong mechanism
does not operate.
A Zero Length Packet can be sent by setting just the TX_PKTRDY flag in the EPTSETSTAx
register.
Bulk IN or Interrupt IN: Sending a Buffer Using DMA (Device to Host)
The USBA integrates a DMA host controller. This DMA controller can be used to transfer a buf-
fer from the memory to the DPR or from the DPR to the processor memory under the USBA
control. The DMA can be used for all transfer types except control transfer.
Example DMA configuration:
1. Program DMAADDRESSx with the address of the buffer that should be transfer.
2. Enable the interrupt of the DMA in IEN
3. Program DMACONTROLx:
– Size of buffer to send: size of the buffer to be sent to the host.
– END_B_EN: The endpoint can validate the packet (according to the values
programmed in the AUTO_VALID and SHRT_PCKT fields of EPTCTLx.) (See ”USBA
Endpoint Control Register” on page 722 and Figure 32-11. Autovalid with DMA)
– END_BUFFIT: generate an interrupt when the BUFF_COUNT in DMASTATUSx
reaches 0.
– CHANN_ENB: Run and stop at end of buffer
The auto-valid-bank mechanism allows the transfer of data (IN & OUT) without the intervention
of the CPU. This means that bank validation (set TX_PK_RDY or clear the RX_BK_RDY bit) is
done by hardware.
A transfer descriptor can be used. Instead of programming the register directly, a descriptor
should be programmed and the address of this descriptor is then given to DMANXTDSC to be
processed after setting the LDNXT_DSC field (Load Next Descriptor Now) in DMACONTROLx
register.
The structure that defines this transfer descriptor must be aligned.
Each buffer to be transferred must be described by a DMA Transfer descriptor (see ”USBA DMA
Channel Transfer Descriptor” on page 733). Transfer descriptors are chained. Before executing
transfer of the buffer, the USBA may fetch a new transfer descriptor from the memory address
pointed by the DMANXTDSCx register. Once the transfer is complete, the transfer status is
updated in the DMASTATUSx register.
To chain a new transfer descriptor with the current DMA transfer, the DMA channel must be
stopped. To do so, INTDIS_DMA and TX_BK_RDY may be set in the EPTCTLENBx register. It
is also possible for the application to wait for the completion of all transfers. In this case the
LDNXT_DSC field in the last transfer descriptor DMACONTROLx register must be set to 0 and
CHANN_ENB set to 1.
Then the application can chain a new transfer descriptor.
The INTDIS_DMA can be used to stop the current DMA transfer if an enabled interrupt is trig-
gered. This can be used to stop DMA transfers in case of errors.
The application can be notified at the end of any buffer transfer (ENB_BUFFIT bit in the DMA-
CONTROLx register).
32003M–AVR32–09/09
677