Datasheet
SAM9G45 [DATASHEET]
Atmel-6438O-ATARM-SAM9G45-Datasheet_08-Dec-15
774
Figure 35-8. Read Functional Flow Diagram
Notes: 1. It is assumed that this command has been correctly sent (see Figure 35-7).
2. This field is also accessible in the HSMCI Block Register (HSMCI_BLKR).
Read status register HSMCI_SR
Send SELECT/DESELECT_CARD
command
(1)
to select the card
Send SET_BLOCKLEN command
(1)
Read with DMAC
Number of words to read = 0 ?
Poll the bit
RXRDY = 0?
Read data = HSMCI_RDR
Number of words to read =
Number of words to read -1
Send READ_SINGLE_BLOCK
command
(1)
Ye s
Set the DMAEN bit
HSMCI_DMA |= DMAEN
Set the block length (in bytes)
HSMCI_BLKR |= (BlockLength << 16)
(2)
Configure the DMA channel X
DMAC_SADDRx = Data Address
DMAC_BTSIZE = BlockLength/4
DMACHEN[X] = TRUE
Send READ_SINGLE_BLOCK
command
(1)
Read status register HSMCI_SR
Poll the bit
XFRDONE = 0?
Ye s
RETURN
RETURN
Ye sNo
No
No
Ye s
No
Number of words to read = BlockLength/4
Reset the DMAEN bit
HSMCI_DMA &= ~DMAEN
Set the block length (in bytes)
HSMCI_MR l= (BlockLength<<16)
(2)
Set the block count (if neccessary)
HSMCI_BLKR l= (BlockCount<<0)