7 transfer without dma – Rainbow Electronics AT91CAP9S250A User Manual

Page 855

Advertising
background image

855

6264A–CAP–21-May-07

AT91CAP9S500A/AT91CAP9S250A

44.4.7

Transfer Without DMA

Important. If the DMA is not to be used, it is neccessary that it be disabled because otherwise it
can be enabled by previous versions of software without warning. If this should occur, the DMA
can process data before an interrupt without knowlege of the user.

The recommended means to disable DMA is as follows:

// Reset IP UDPHS

AT91C_BASE_UDPHS->UDPHS_CTRL &= ~AT91C_UDPHS_EN_UDPHS;

AT91C_BASE_UDPHS->UDPHS_CTRL |= AT91C_UDPHS_EN_UDPHS;

// With OR without DMA !!!

for( i=1; i<=((AT91C_BASE_UDPHS->UDPHS_IPFEATURES &

AT91C_UDPHS_DMA_CHANNEL_NBR)>>4); i++ ) {

// RESET endpoint canal DMA:

// DMA stop channel command

AT91C_BASE_UDPHS->UDPHS_DMA[i].UDPHS_DMACONTROL = 0; // STOP

command

// Disable endpoint

AT91C_BASE_UDPHS->UDPHS_EPT[i].UDPHS_EPTCTLDIS |= 0XFFFFFFFF;

// Reset endpoint config

AT91C_BASE_UDPHS->UDPHS_EPT[i].UDPHS_EPTCTLCFG = 0;

// Reset DMA channel (Buff count and Control field)

AT91C_BASE_UDPHS->UDPHS_DMA[i].UDPHS_DMACONTROL = 0x02; // NON

STOP command

// Reset DMA channel 0 (STOP)

AT91C_BASE_UDPHS->UDPHS_DMA[i].UDPHS_DMACONTROL = 0; // STOP

command

// Clear DMA channel status (read the register for clear it)

AT91C_BASE_UDPHS->UDPHS_DMA[i].UDPHS_DMASTATUS =

AT91C_BASE_UDPHS->UDPHS_DMA[i].UDPHS_DMASTATUS;

}

44.4.8

Handling Transactions with USB V2.0 Device Peripheral

44.4.8.1

Setup Transaction

The setup packet is valid in the DPR while RX_SETUP is set. Once RX_SETUP is cleared by
the application, the UDPHS accepts the next packets sent over the device endpoint.

When a valid setup packet is accepted by the UDPHS:

• the UDPHS device automatically acknowledges the setup packet (sends an ACK response)

• payload data is written in the endpoint

• sets the RX_SETUP interrupt

• the BYTE_COUNT field in the UDPHS_EPTSTAx register is updated

An endpoint interrupt is generated while RX_SETUP in the UDPHS_EPTSTAx register is not
cleared. This interrupt is carried out to the microcontroller if interrupts are enabled for this
endpoint.

Advertising