Atmel Evaluation Kit AT91SAM9M10-G45-EK AT91SAM9M10-G45-EK Hoja De Datos

Los códigos de productos
AT91SAM9M10-G45-EK
Descargar
Página de 1361
 681
SAM9M10 [DATASHEET]
6355F–ATARM–12-Mar-13
 
35.8.5
WRITE_SINGLE_BLOCK  Operation  using  DMA  Controller
1.
Wait until the current command execution has successfully terminated.
a.
Check that CMDRDY and NOTBUSY fields are asserted in HSMCI_SR
2.
Program the block length in the card. This value defines the value 
block_length.
3.
Program the block length in the HSMCI configuration register with 
block_length
value.
4.
Program HSMCI_DMA register with the following fields:
– OFFSET field with 
dma_offset.
– CHKSIZE is user defined and set according to DMAC_DCSIZE.
– DMAEN is set to true to enable DMA hardware handshaking in the HSMCI. This bit was previously set 
to false.
5.
Issue a WRITE_SINGLE_BLOCK command writing HSMCI_ARG then HSMCI_CMDR.
6.
Program the DMA Controller.
a.
Read the channel Register to choose an available (disabled) channel.
b.
Clear any pending interrupts on the channel from the previous DMAC transfer by reading the 
DMAC_EBCISR register.
c.
Program the channel registers.
d.
The DMAC_SADDRx register for channel x must be set to the location of the source data. When the 
first data location is not word aligned, the two LSB bits define the temporary value called 
dma_offset.
 
The two LSB bits of DMAC_SADDRx must be set to 0.
e.
The DMAC_DADDRx register for channel x must be set with the starting address of the HSMCI_FIFO 
address.
f.
Program DMAC_CTRLAx register of channel x with the following field’s values:
–DST_WIDTH is set to WORD.
–SRC_WIDTH is set to WORD.
–DCSIZE must be set according to the value of HSMCI_DMA, CHKSIZE field.
–BTSIZE is programmed with 
CEILING((block_length + dma_offset) / 4),
where the ceiling function is 
the function that returns the smallest integer not less than x.
g.
Program DMAC_CTRLBx register for channel x with the following field’s values:
–DST_INCR is set to INCR, the 
block_length
value must not be larger than the HSMCI_FIFO 
aperture.
–SRC_INCR is set to INCR.
–FC field is programmed with memory to peripheral flow control mode.
–both DST_DSCR and SRC_DSCR are set to 1 (descriptor fetch is disabled).
–DIF and SIF are set with their respective layer ID. If SIF is different from DIF, the DMA controller is 
able to prefetch data and write HSMCI simultaneously.
h.
Program DMAC_CFGx register for channel x with the following field’s values:
–FIFOCFG defines the watermark of the DMAC channel FIFO.
–DST_H2SEL is set to true to enable hardware handshaking on the destination.
–DST_PER is programmed with the hardware handshaking ID of the targeted HSMCI Host 
Controller.
i.
Enable Channel x, writing one to DMAC_CHER[x]. The DMAC is ready and waiting for request.
7.
Wait for XFRDONE in HSMCI_SR register.