Datasheet

777
SAM9G45 [DATASHEET]
Atmel-6438O-ATARM-SAM9G45-Datasheet_08-Dec-15
Figure 35-10. Read Multiple Block and Write Multiple Block
Notes: 1. It is assumed that this command has been correctly sent (see Figure 35-7).
2. Handle errors reported in HSMCI_SR.
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.
Send SELECT/DESELECT_CARD
command
(1)
to select the card
Send SET_BLOCKLEN command
(1)
Set the block length
HSMCI_MR |= (BlockLength << 16)
Set the DMAEN bit
HSMCI_DMA |= DMAEN
Configure the HDMA channel X
DMAC_SADDRx and DMAC_DADDRx
DMAC_BTSIZE = BlockLength/4
Send WRITE_MULTIPLE_BLOCK or
READ_MULTIPLE_BLOCK command
(1)
Read status register DMAC_EBCISR
and Poll Bit CBTC[X]
New Buffer ?
(2)
No
DMAC_CHEN[X] = TRUE
Poll the bit
XFRDONE = 1
No
RETURN
Ye s
Send STOP_TRANSMISSION
command
(1)
Ye s
Read status register HSMCI_SR
and Poll Bit FIFOEMPTY