Atmel ARM-Based Evaluation Kit AT91SAM9N12-EK AT91SAM9N12-EK Data Sheet

Product codes
AT91SAM9N12-EK
Page of 1104
571
SAM9N12/SAM9CN11/SAM9CN12 [DATASHEET]
11063K–ATARM–05-Nov-13
35.8.3 Read 
Operation
The following flowchart (
) shows how to read a single block with or without use of DMAC facilities. In this
example, a polling method is used to wait for the end of read. Similarly, the user can configure the Interrupt Enable
Register (HSMCI_IER) to trigger an interrupt at the end of read.
Figure 35-8.  Read Functional Flow Diagram
Notes: 1. It is assumed that this command has been correctly sent (see 
).
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)
Yes
Set the DMAEN bit
HSMCI_DMA |= DMAEN
Set the block length (in bytes)
HSMCI_BLKR |= (BlockLength << 16)
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?
Yes
RETURN
RETURN
Yes
No
No
No
Yes
No
Number of words to read = BlockLength/4
Reset the DMAEN bit
HSMCI_DMA &= ~DMAEN
Set the block length (in bytes)
HSMCI_BLKR  l= (BlockLength<<16)
Set the block count (if neccessary)
HSMCI_BLKR l= (BlockCount<<0)