53 #if (!defined SD_MMC_HSMCI_MEM_CNT) || (SD_MMC_HSMCI_MEM_CNT == 0) 54 # warning SD_MMC_HSMCI_MEM_CNT must be defined in board.h file. 55 # define SD_MMC_HSMCI_MEM_CNT 1 57 #ifndef CONF_BOARD_SD_MMC_HSMCI 58 # warning CONF_BOARD_SD_MMC_HSMCI must be defined in conf_board.h file. 61 # if (SD_MMC_HSMCI_MEM_CNT > 2) 62 # warning Wrong define SD_MMC_HSMCI_MEM_CNT in board.h,\ 63 this part have 2 slots maximum on HSMCI. 66 # if (SD_MMC_HSMCI_MEM_CNT > 1) 67 # warning Wrong define SD_MMC_HSMCI_MEM_CNT in board.h,\ 68 this part have 1 slots maximum on HSMCI. 71 #ifndef SD_MMC_HSMCI_SLOT_0_SIZE 72 # warning SD_MMC_HSMCI_SLOT_0_SIZE must be defined in board.h. 73 # define SD_MMC_HSMCI_SLOT_0_SIZE 1 75 #if (SD_MMC_HSMCI_MEM_CNT > 2) 76 # ifndef SD_MMC_HSMCI_SLOT_1_SIZE 77 # warning SD_MMC_HSMCI_SLOT_1_SIZE must be defined in board.h. 78 # define SD_MMC_HSMCI_SLOT_1_SIZE 1 85 # define hsmci_debug(...) printf(__VA_ARGS__) 87 # define hsmci_debug(...) 90 #if (SAM3S || SAM4S || SAM4E) 92 #elif (SAM3U || SAM3XA) 95 # define DMA_HW_ID_HSMCI 0 96 # ifndef CONF_HSMCI_DMA_CHANNEL 97 # define CONF_HSMCI_DMA_CHANNEL 0 99 #elif (SAMV70 || SAMV71 || SAME70 || SAMS70) 102 # define XDMAC_HW_ID_HSMCI 0 103 # ifndef CONF_HSMCI_XDMAC_CHANNEL 104 # define CONF_HSMCI_XDMAC_CHANNEL DMA_CH_SD_CARD 107 # error Not supported device 128 uint32_t mr =
HSMCI->HSMCI_MR;
129 uint32_t dtor =
HSMCI->HSMCI_DTOR;
130 uint32_t sdcr =
HSMCI->HSMCI_SDCR;
131 uint32_t cstor =
HSMCI->HSMCI_CSTOR;
132 uint32_t cfg =
HSMCI->HSMCI_CFG;
134 HSMCI->HSMCI_MR = mr;
135 HSMCI->HSMCI_DTOR = dtor;
136 HSMCI->HSMCI_SDCR = sdcr;
137 HSMCI->HSMCI_CSTOR = cstor;
138 HSMCI->HSMCI_CFG = cfg;
139 #ifdef HSMCI_SR_DMADONE 140 HSMCI->HSMCI_DMA = 0;
142 #if (SAMV70 || SAMV71 || SAME70 || SAMS70) 143 #ifdef HSMCI_DMA_DMAEN 144 HSMCI->HSMCI_DMA = 0;
159 #if (SAM4E || SAMV70 || SAMV71 || SAME70 || SAMS70) 166 if ((speed * 2) < mck) {
167 div = (mck / speed) - 2;
193 if ((speed * 2) < mck) {
194 clkdiv = mck / (2 * speed);
195 rest = mck % (2 * speed);
218 uint32_t busy_wait = 0xFFFFFFFF;
222 sr =
HSMCI->HSMCI_SR;
223 if (busy_wait-- == 0) {
262 HSMCI->HSMCI_ARGR = arg;
264 HSMCI->HSMCI_CMDR = cmdr;
268 sr =
HSMCI->HSMCI_SR;
305 #ifdef HSMCI_SR_DMADONE 310 #if (SAMV70 || SAMV71 || SAME70 || SAMS70) 311 #ifdef HSMCI_DMA_DMAEN 335 #if (SD_MMC_HSMCI_MEM_CNT == 2) 337 return SD_MMC_HSMCI_SLOT_1_SIZE;
366 #if (SD_MMC_HSMCI_MEM_CNT == 2) 368 hsmci_slot = HSMCI_SDCR_SDCSEL_SLOTB;
391 HSMCI->HSMCI_SDCR = hsmci_slot | hsmci_bus_width;
405 HSMCI->HSMCI_ARGR = 0;
418 #ifdef HSMCI_SR_DMADONE 420 HSMCI->HSMCI_DMA = 0;
422 #ifdef HSMCI_MR_PDCMODE 424 HSMCI->HSMCI_MR &= ~HSMCI_MR_PDCMODE;
426 #if (SAMV70 || SAMV71 || SAME70 || SAMS70) 427 #ifdef HSMCI_DMA_DMAEN 429 HSMCI->HSMCI_DMA = 0;
432 HSMCI->HSMCI_BLKR = 0;
438 return HSMCI->HSMCI_RSPR[0];
443 uint32_t response_32;
445 for (uint8_t i = 0; i < 4; i++) {
446 response_32 =
HSMCI->HSMCI_RSPR[0];
447 *response = (response_32 >> 24) & 0xFF;
449 *response = (response_32 >> 16) & 0xFF;
451 *response = (response_32 >> 8) & 0xFF;
453 *response = (response_32 >> 0) & 0xFF;
462 #ifdef HSMCI_SR_DMADONE 468 HSMCI->HSMCI_DMA = 0;
472 #ifdef HSMCI_MR_PDCMODE 475 HSMCI->HSMCI_MR |= HSMCI_MR_PDCMODE;
478 HSMCI->HSMCI_MR &= ~HSMCI_MR_PDCMODE;
482 #if (SAMV70 || SAMV71 || SAME70 || SAMS70) 483 #ifdef HSMCI_DMA_DMAEN 489 HSMCI->HSMCI_DMA = 0;
498 if (block_size & 0x3) {
549 sr =
HSMCI->HSMCI_SR;
560 *value =
HSMCI->HSMCI_RDR;
569 sr =
HSMCI->HSMCI_SR;
589 sr =
HSMCI->HSMCI_SR;
609 sr =
HSMCI->HSMCI_SR;
622 #ifdef HSMCI_SR_DMADONE 625 uint32_t cfg, nb_data;
626 dma_transfer_descriptor_t desc;
630 transfert_byte = ((
HSMCI->HSMCI_MR &
HSMCI_MR_FBYTE) || (((uint32_t)dest & 0x3) > 0)) ? 1 : 0;
633 Assert(nb_data <= (transfert_byte ?
634 DMAC_CTRLA_BTSIZE_Msk >> DMAC_CTRLA_BTSIZE_Pos :
635 ((DMAC_CTRLA_BTSIZE_Msk >> DMAC_CTRLA_BTSIZE_Pos) * 4)));
645 dmac_channel_disable(DMAC, CONF_HSMCI_DMA_CHANNEL);
646 cfg = DMAC_CFG_SOD_ENABLE | DMAC_CFG_SRC_H2SEL |
647 DMAC_CFG_SRC_PER(DMA_HW_ID_HSMCI) |
648 DMAC_CFG_AHB_PROT(1) | DMAC_CFG_FIFOCFG_ALAP_CFG;
649 dmac_channel_set_configuration(DMAC, CONF_HSMCI_DMA_CHANNEL, cfg);
652 desc.ul_source_addr = (uint32_t)&(
HSMCI->HSMCI_RDR);
653 desc.ul_destination_addr = (uint32_t)dest;
654 if (transfert_byte) {
655 desc.ul_ctrlA = DMAC_CTRLA_BTSIZE(nb_data)
656 | DMAC_CTRLA_SRC_WIDTH_BYTE
657 | DMAC_CTRLA_DST_WIDTH_BYTE;
659 desc.ul_ctrlA = DMAC_CTRLA_BTSIZE(nb_data / 4)
660 | DMAC_CTRLA_SRC_WIDTH_WORD
661 | DMAC_CTRLA_DST_WIDTH_WORD;
663 desc.ul_ctrlB = DMAC_CTRLB_SRC_DSCR_FETCH_DISABLE
664 | DMAC_CTRLB_DST_DSCR_FETCH_DISABLE
665 | DMAC_CTRLB_FC_PER2MEM_DMA_FC
666 | DMAC_CTRLB_SRC_INCR_FIXED
667 | DMAC_CTRLB_DST_INCR_INCREMENTING
669 desc.ul_descriptor_addr = (uint32_t)
NULL;
670 dmac_channel_single_buf_transfer_init(DMAC, CONF_HSMCI_DMA_CHANNEL,
674 dmac_channel_enable(DMAC, CONF_HSMCI_DMA_CHANNEL);
685 sr =
HSMCI->HSMCI_SR;
692 dmac_channel_disable(DMAC, CONF_HSMCI_DMA_CHANNEL);
698 if (sr & HSMCI_SR_DMADONE) {
709 uint32_t cfg, nb_data;
710 dma_transfer_descriptor_t desc;
713 transfert_byte = ((
HSMCI->HSMCI_MR &
HSMCI_MR_FBYTE) || (((uint32_t)src & 0x3) > 0)) ? 1 : 0;
716 Assert(nb_data <= (transfert_byte ?
717 DMAC_CTRLA_BTSIZE_Msk >> DMAC_CTRLA_BTSIZE_Pos :
718 ((DMAC_CTRLA_BTSIZE_Msk >> DMAC_CTRLA_BTSIZE_Pos) * 4)));
728 Assert(!dmac_channel_is_enable(DMAC, CONF_HSMCI_DMA_CHANNEL));
729 cfg = DMAC_CFG_SOD_ENABLE | DMAC_CFG_DST_H2SEL |
730 DMAC_CFG_DST_PER(DMA_HW_ID_HSMCI) |
731 DMAC_CFG_AHB_PROT(1) | DMAC_CFG_FIFOCFG_ALAP_CFG;
732 dmac_channel_set_configuration(DMAC, CONF_HSMCI_DMA_CHANNEL, cfg);
735 desc.ul_source_addr = (uint32_t)src;
736 desc.ul_destination_addr = (uint32_t)&(
HSMCI->HSMCI_TDR);
737 if (transfert_byte) {
738 desc.ul_ctrlA = DMAC_CTRLA_BTSIZE(nb_data)
739 | DMAC_CTRLA_SRC_WIDTH_BYTE
740 | DMAC_CTRLA_DST_WIDTH_BYTE;
742 desc.ul_ctrlA = DMAC_CTRLA_BTSIZE(nb_data / 4)
743 | DMAC_CTRLA_SRC_WIDTH_WORD
744 | DMAC_CTRLA_DST_WIDTH_WORD;
746 desc.ul_ctrlB = DMAC_CTRLB_SRC_DSCR_FETCH_DISABLE
747 | DMAC_CTRLB_DST_DSCR_FETCH_DISABLE
748 | DMAC_CTRLB_FC_MEM2PER_DMA_FC
749 | DMAC_CTRLB_SRC_INCR_INCREMENTING
750 | DMAC_CTRLB_DST_INCR_FIXED
752 desc.ul_descriptor_addr = (uint32_t)
NULL;
753 dmac_channel_single_buf_transfer_init(DMAC, CONF_HSMCI_DMA_CHANNEL,
757 dmac_channel_enable(DMAC, CONF_HSMCI_DMA_CHANNEL);
768 sr =
HSMCI->HSMCI_SR;
775 dmac_channel_disable(DMAC, CONF_HSMCI_DMA_CHANNEL);
781 if (sr & HSMCI_SR_DMADONE) {
787 Assert(!dmac_channel_is_enable(DMAC, CONF_HSMCI_DMA_CHANNEL));
791 #endif // HSMCI_SR_DMADONE 793 #ifdef HSMCI_MR_PDCMODE 800 Assert(nb_data <= (PERIPH_RCR_RXCTR_Msk >> PERIPH_RCR_RXCTR_Pos));
803 if (((uint32_t)dest & 0x3) || (hsmci_block_size & 0x3)) {
810 HSMCI->HSMCI_RPR = (uint32_t)dest;
812 nb_data : nb_data / 4;
813 HSMCI->HSMCI_RNCR = 0;
815 HSMCI->HSMCI_PTCR = HSMCI_PTCR_RXTEN;
826 sr =
HSMCI->HSMCI_SR;
831 HSMCI->HSMCI_PTCR = HSMCI_PTCR_RXTDIS | HSMCI_PTCR_TXTDIS;
836 }
while (!(sr & HSMCI_SR_RXBUFF));
844 sr =
HSMCI->HSMCI_SR;
847 hsmci_debug(
"%s: PDC sr 0x%08x last transfer error\n\r",
862 Assert(nb_data <= (PERIPH_TCR_TXCTR_Msk >> PERIPH_TCR_TXCTR_Pos));
865 if (((uint32_t)src & 0x3) || (hsmci_block_size & 0x3)) {
872 HSMCI->HSMCI_TPR = (uint32_t)src;
874 nb_data : nb_data / 4;
875 HSMCI->HSMCI_TNCR = 0;
877 HSMCI->HSMCI_PTCR = HSMCI_PTCR_TXTEN;
889 sr =
HSMCI->HSMCI_SR;
896 HSMCI->HSMCI_PTCR = HSMCI_PTCR_RXTDIS | HSMCI_PTCR_TXTDIS;
899 }
while (!(sr & HSMCI_SR_TXBUFE));
908 sr =
HSMCI->HSMCI_SR;
911 hsmci_debug(
"%s: PDC sr 0x%08x last transfer error\n\r",
920 #endif // HSMCI_MR_PDCMODE 922 #if (SAMV70 || SAMV71 || SAME70 || SAMS70) 923 #ifdef HSMCI_DMA_DMAEN 936 if((uint32_t)dest & 3) {
964 p_cfg.
mbr_da = (uint32_t)dest;
978 sr =
HSMCI->HSMCI_SR;
1012 if((uint32_t)src & 3) {
1039 p_cfg.
mbr_sa = (uint32_t)src;
1054 sr =
HSMCI->HSMCI_SR;
1076 #endif // HSMCI_DMA_DMAEN #define HSMCI_MR_WRPROOF
(HSMCI_MR) Write Proof Enable
#define HSMCI_MR_CLKDIV(value)
#define XDMAC_CC_DSYNC_MEM2PER
(XDMAC_CC) Memory to Peripheral transfer
#define HSMCI_MR_CLKODD
(HSMCI_MR) Clock divider is odd
static void hsmci_set_speed(uint32_t speed, uint32_t mck)
Set speed of the HSMCI clock.
#define HSMCI_CMDR_RSPTYP_NORESP
(HSMCI_CMDR) No response
#define UNUSED(v)
Marking v as a unused parameter or value.
bool hsmci_adtc_start(sdmmc_cmd_def_t cmd, uint32_t arg, uint16_t block_size, uint16_t nb_block, bool access_block)
Send an ADTC command on the selected slot An ADTC (Addressed Data Transfer Commands) command is used ...
#define XDMAC_CC_DWIDTH_WORD
(XDMAC_CC) The data size is set to 32 bits
void hsmci_select_device(uint8_t slot, uint32_t clock, uint8_t bus_width, bool high_speed)
Select a slot and initialize it.
#define HSMCI_CMDR_RSPTYP_136_BIT
(HSMCI_CMDR) 136-bit response
#define ID_XDMAC
DMA (XDMAC)
#define HSMCI_BLKR_BCNT_Pos
SD/MMC protocol definitions.
#define HSMCI_SDCR_SDCBUS_8
(HSMCI_SDCR) 8 bits
#define XDMAC_CC_TYPE_PER_TRAN
(XDMAC_CC) Synchronized mode (Peripheral to Memory or Memory to Peripheral Transfer).
bool hsmci_read_word(uint32_t *value)
Read a word on the line.
static uint32_t hsmci_transfert_pos
Current position (byte) of the transfer started by hsmci_adtc_start()
#define HSMCI_CMDR_TRTYP_BYTE
(HSMCI_CMDR) SDIO Byte
#define HSMCI_SR_FIFOEMPTY
(HSMCI_SR) FIFO empty flag
#define XDMAC_CC_SAM_FIXED_AM
(XDMAC_CC) The address remains unchanged.
uint32_t hsmci_get_response(void)
Return the 32 bits response of the last command.
bool hsmci_wait_end_of_read_blocks(void)
Wait the end of transfer initiated by mci_start_read_blocks()
static void hsmci_reset(void)
Reset the HSMCI interface.
#define HSMCI_CMDR_TRTYP_STREAM
(HSMCI_CMDR) MMC Stream
#define HSMCI_SR_NOTBUSY
(HSMCI_SR) HSMCI Not Busy
#define HSMCI_CFG_HSMODE
(HSMCI_CFG) High Speed Mode
#define HSMCI_SR_RCRCE
(HSMCI_SR) Response CRC Error (cleared by writing in HSMCI_CMDR)
GeneratorWrapper< T > value(T &&value)
#define XDMAC
(XDMAC ) Base Address
#define CONF_HSMCI_XDMAC_CHANNEL
#define HSMCI_SR_DTOE
(HSMCI_SR) Data Time-out Error (cleared on read)
#define SDMMC_CMD_SINGLE_BLOCK
To signal a data transfer in single block mode.
#define HSMCI_CMDR_TRTYP_MULTIPLE
(HSMCI_CMDR) MMC/SD Card Multiple Block
#define HSMCI_CMDR_TRCMD_START_DATA
(HSMCI_CMDR) Start data transfer
#define HSMCI_CMDR_OPDCMD_OPENDRAIN
(HSMCI_CMDR) Open drain command.
#define SDMMC_CMD_OPENDRAIN
#define HSMCI_SR_UNRE
(HSMCI_SR) Underrun (if FERRCTRL = 1, cleared by writing in HSMCI_CMDR or cleared on read if FERRCTRL...
#define HSMCI_CSTOR_CSTOCYC(value)
uint32_t pmc_enable_periph_clk(uint32_t ul_id)
Enable the specified peripheral clock.
#define HSMCI_SDCR_SDCBUS_4
(HSMCI_SDCR) 4 bits
#define HSMCI_SR_CMDRDY
(HSMCI_SR) Command Ready (cleared by writing in HSMCI_CMDR)
#define HSMCI_SR_CSTOE
(HSMCI_SR) Completion Signal Time-out Error (cleared on read)
void hsmci_init(void)
Initializes the low level driver.
void hsmci_get_response_128(uint8_t *response)
Return the 128 bits response of the last command.
#define HSMCI_SDCR_SDCBUS_1
(HSMCI_SDCR) 1 bit
#define SDMMC_RESP_BUSY
Card may send busy.
static uint32_t xdmac_channel_get_interrupt_status(Xdmac *xdmac, uint32_t channel_num)
Get interrupt status for the relevant channel of given XDMA.
#define XDMAC_CC_DAM_FIXED_AM
(XDMAC_CC) The address remains unchanged.
#define HSMCI_CMDR_SPCMD_INIT
(HSMCI_CMDR) Initialization CMD: 74 clock cycles for initialization sequence.
#define HSMCI_CMDR_TRTYP_BLOCK
(HSMCI_CMDR) SDIO Block
#define HSMCI_DTOR_DTOMUL_1048576
(HSMCI_DTOR) DTOCYC x 1048576
#define HSMCI_CMDR_TRDIR_READ
(HSMCI_CMDR) Read.
#define HSMCI_CMDR_CMDNB(value)
#define HSMCI_MR_RDPROOF
(HSMCI_MR) Read Proof Enable
#define XDMAC_CC_DAM_INCREMENTED_AM
(XDMAC_CC) The addressing mode is incremented (the increment size is set to the data size)...
bool hsmci_start_write_blocks(const void *src, uint16_t nb_block)
Start a write blocks transfer on the line Note: The driver will use the DMA available to speed up the...
#define XDMAC_CC_SIF_AHB_IF1
(XDMAC_CC) The data is read through the system bus interface 1
#define SDMMC_RESP_CRC
Expect valid crc (MCI only)
bool hsmci_wait_end_of_write_blocks(void)
Wait the end of transfer initiated by mci_start_write_blocks()
#define XDMAC_CC_SIF_AHB_IF0
(XDMAC_CC) The data is read through the system bus interface 0
static uint32_t sysclk_get_peripheral_hz(void)
Retrieves the current rate in Hz of the peripheral clocks.
#define HSMCI_SR_RXRDY
(HSMCI_SR) Receiver Ready (cleared by reading HSMCI_RDR)
static void xdmac_channel_enable(Xdmac *xdmac, uint32_t channel_num)
enables the relevant channel of given XDMAC.
#define XDMAC_CC_DIF_AHB_IF0
(XDMAC_CC) The data is written through the system bus interface 0
static void xdmac_channel_disable(Xdmac *xdmac, uint32_t channel_num)
Disables the relevant channel of given XDMAC.
#define SDMMC_CMD_STREAM
To signal a data transfer in stream mode.
static uint16_t hsmci_nb_block
Total number of block requested by last hsmci_adtc_start()
bool hsmci_start_read_blocks(void *dest, uint16_t nb_block)
Start a read blocks transfer on the line Note: The driver will use the DMA available to speed up the ...
#define XDMAC_CC_DIF_AHB_IF1
(XDMAC_CC) The data is written though the system bus interface 1
void xdmac_configure_transfer(Xdmac *xdmac, uint32_t channel_num, xdmac_channel_config_t *cfg)
Configure DMA for a transfer.
#define HSMCI_SR_RTOE
(HSMCI_SR) Response Time-out Error (cleared by writing in HSMCI_CMDR)
#define HSMCI_SR_DCRCE
(HSMCI_SR) Data CRC Error (cleared on read)
#define HSMCI_CMDR_TRTYP_SINGLE
(HSMCI_CMDR) MMC/SD Card Single Block
void hsmci_deselect_device(uint8_t slot)
Deselect a slot.
#define HSMCI_CSTOR_CSTOMUL_1048576
(HSMCI_CSTOR) CSTOCYC x 1048576
#define HSMCI_DMA_DMAEN
(HSMCI_DMA) DMA Hardware Handshaking Enable
#define HSMCI
(HSMCI ) Base Address
#define XDMAC_CC_CSIZE_CHK_1
(XDMAC_CC) 1 data transferred
bool hsmci_is_high_speed_capable(void)
Return the high speed capability of the driver.
#define ID_HSMCI
Multimedia Card Interface (HSMCI)
#define HSMCI_CMDR_SPCMD_STD
(HSMCI_CMDR) Not a special CMD.
#define HSMCI_SR_RDIRE
(HSMCI_SR) Response Direction Error (cleared by writing in HSMCI_CMDR)
uint8_t hsmci_get_bus_width(uint8_t slot)
Return the maximum bus width of a slot.
#define HSMCI_CR_SWRST
(HSMCI_CR) Software Reset
#define HSMCI_MR_CLKDIV_Msk
(HSMCI_MR) Clock Divider
#define HSMCI_SR_RENDE
(HSMCI_SR) Response End Bit Error (cleared by writing in HSMCI_CMDR)
#define SDMMC_CMD_WRITE
To signal a data write operation.
#define XDMAC_CC_DSYNC_PER2MEM
(XDMAC_CC) Peripheral to Memory transfer
#define HSMCI_CFG_FIFOMODE
(HSMCI_CFG) HSMCI Internal FIFO control mode
#define HSMCI_CMDR_MAXLAT
(HSMCI_CMDR) Max Latency for Command to Response
uint32_t sdmmc_cmd_def_t
Value to define a SD/MMC/SDIO command.
#define HSMCI_CFG_FERRCTRL
(HSMCI_CFG) Flow Error flag reset control mode
#define SDMMC_RESP_PRESENT
Have response (MCI only)
static bool hsmci_send_cmd_execute(uint32_t cmdr, sdmmc_cmd_def_t cmd, uint32_t arg)
Send a command.
#define SDMMC_CMD_SDIO_BLOCK
To signal a SDIO tranfer in block mode.
#define HSMCI_CR_PWSEN
(HSMCI_CR) Power Save Mode Enable
bool hsmci_adtc_stop(sdmmc_cmd_def_t cmd, uint32_t arg)
Send a command to stop an ADTC command on the selected slot.
#define XDMAC_CIS_BIS
(XDMAC_CIS) End of Block Interrupt Status Bit
#define HSMCI_SR_RINDE
(HSMCI_SR) Response Index Error (cleared by writing in HSMCI_CMDR)
#define XDMAC_CC_PERID(value)
#define HSMCI_MR_PWSDIV_Msk
(HSMCI_MR) Power Saving Divider
static uint16_t hsmci_block_size
Size block requested by last hsmci_adtc_start()
bool hsmci_write_word(uint32_t value)
Write a word on the line.
#define SDMMC_CMD_SDIO_BYTE
To signal a SDIO tranfer in multi byte mode.
#define SDMMC_RESP_136
136 bit response (MCI only)
#define XDMAC_CC_SAM_INCREMENTED_AM
(XDMAC_CC) The addressing mode is incremented (the increment size is set to the data size)...
#define SD_MMC_HSMCI_SLOT_0_SIZE
#define HSMCI_CMDR_TRDIR_WRITE
(HSMCI_CMDR) Write.
#define HSMCI_SR_TXRDY
(HSMCI_SR) Transmit Ready (cleared by writing in HSMCI_TDR)
#define HSMCI_CMDR_RSPTYP_48_BIT
(HSMCI_CMDR) 48-bit response
Autogenerated API include file for the Atmel Software Framework (ASF)
#define HSMCI_CMDR_RSPTYP_R1B
(HSMCI_CMDR) R1b response type
#define HSMCI_SR_OVRE
(HSMCI_SR) Overrun (if FERRCTRL = 1, cleared by writing in HSMCI_CMDR or cleared on read if FERRCTRL ...
#define HSMCI_SR_DTIP
(HSMCI_SR) Data Transfer in Progress (cleared at the end of CRC16 calculation)
void hsmci_send_clock(void)
Send 74 clock cycles on the line of selected slot Note: It is required after card plug and before car...
#define HSMCI_CMDR_TRCMD_STOP_DATA
(HSMCI_CMDR) Stop data transfer
static bool hsmci_wait_busy(void)
Wait the end of busy signal on data line.
#define HSMCI_BLKR_BLKLEN_Pos
#define HSMCI_MR_FBYTE
(HSMCI_MR) Force Byte Transfer
#define HSMCI_SDCR_SDCSEL_SLOTA
(HSMCI_SDCR) Slot A is selected.
#define XDMAC_CC_MBSIZE_SINGLE
(XDMAC_CC) The memory burst size is set to one.
#define HSMCI_SR_XFRDONE
(HSMCI_SR) Transfer Done flag
#define Assert(expr)
This macro is used to test fatal errors.
bool hsmci_send_cmd(sdmmc_cmd_def_t cmd, uint32_t arg)
Send a command on the selected slot.
#define XDMAC_CC_DWIDTH_BYTE
(XDMAC_CC) The data size is set to 8 bits
#define SDMMC_CMD_MULTI_BLOCK
To signal a data transfer in multi block mode.
#define HSMCI_CR_MCIEN
(HSMCI_CR) Multi-Media Interface Enable
#define HSMCI_DTOR_DTOCYC(value)