This driver interfaces the HSMCI module.
It will add functions for SD/MMC card reading, writing and management.
Modules | |
High Speed MultiMedia Card Interface | |
(HSMCI) implementation | |
Functions | |
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 for read/write access. More... | |
bool | hsmci_adtc_stop (sdmmc_cmd_def_t cmd, uint32_t arg) |
Send a command to stop an ADTC command on the selected slot. More... | |
void | hsmci_deselect_device (uint8_t slot) |
Deselect a slot. More... | |
uint8_t | hsmci_get_bus_width (uint8_t slot) |
Return the maximum bus width of a slot. More... | |
uint32_t | hsmci_get_response (void) |
Return the 32 bits response of the last command. More... | |
void | hsmci_get_response_128 (uint8_t *response) |
Return the 128 bits response of the last command. More... | |
void | hsmci_init (void) |
Initializes the low level driver. More... | |
bool | hsmci_is_high_speed_capable (void) |
Return the high speed capability of the driver. More... | |
bool | hsmci_read_word (uint32_t *value) |
Read a word on the line. More... | |
void | hsmci_select_device (uint8_t slot, uint32_t clock, uint8_t bus_width, bool high_speed) |
Select a slot and initialize it. More... | |
void | hsmci_send_clock (void) |
Send 74 clock cycles on the line of selected slot Note: It is required after card plug and before card install. More... | |
bool | hsmci_send_cmd (sdmmc_cmd_def_t cmd, uint32_t arg) |
Send a command on the selected slot. More... | |
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 transfer. More... | |
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 transfer. More... | |
bool | hsmci_wait_end_of_read_blocks (void) |
Wait the end of transfer initiated by mci_start_read_blocks() More... | |
bool | hsmci_wait_end_of_write_blocks (void) |
Wait the end of transfer initiated by mci_start_write_blocks() More... | |
bool | hsmci_write_word (uint32_t value) |
Write a word on the line. More... | |
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 for read/write access.
cmd | Command definition |
arg | Argument of the command |
block_size | Block size used for the transfer |
nb_block | Total number of block for this transfer |
access_block | if true, the x_read_blocks() and x_write_blocks() functions must be used after this function. If false, the mci_read_word() and mci_write_word() functions must be used after this function. |
References Assert, hsmci_block_size, hsmci_nb_block, hsmci_send_cmd_execute(), hsmci_transfert_pos, SDMMC_CMD_MULTI_BLOCK, SDMMC_CMD_SDIO_BLOCK, SDMMC_CMD_SDIO_BYTE, SDMMC_CMD_SINGLE_BLOCK, SDMMC_CMD_STREAM, and SDMMC_CMD_WRITE.
bool hsmci_adtc_stop | ( | sdmmc_cmd_def_t | cmd, |
uint32_t | arg | ||
) |
Send a command to stop an ADTC command on the selected slot.
cmd | Command definition |
arg | Argument of the command |
References hsmci_send_cmd_execute().
void hsmci_deselect_device | ( | uint8_t | slot | ) |
uint8_t hsmci_get_bus_width | ( | uint8_t | slot | ) |
Return the maximum bus width of a slot.
slot | Selected slot |
References SD_MMC_HSMCI_SLOT_0_SIZE.
uint32_t hsmci_get_response | ( | void | ) |
Return the 32 bits response of the last command.
void hsmci_get_response_128 | ( | uint8_t * | response | ) |
Return the 128 bits response of the last command.
response | Pointer on the array to fill with the 128 bits response |
Initializes the low level driver.
This enable the clock required and the hardware interface.
References pmc_enable_periph_clk().
Return the high speed capability of the driver.
bool hsmci_read_word | ( | uint32_t * | value | ) |
Read a word on the line.
value | Pointer on a word to fill |
References Assert, hsmci_block_size, hsmci_debug, hsmci_nb_block, hsmci_reset(), and hsmci_transfert_pos.
Select a slot and initialize it.
slot | Selected slot |
clock | Maximum clock to use (Hz) |
bus_width | Bus width to use (1, 4 or 8) |
high_speed | true, to enable high speed mode |
References Assert, hsmci_set_speed(), and sysclk_get_peripheral_hz().
Send 74 clock cycles on the line of selected slot Note: It is required after card plug and before card install.
bool hsmci_send_cmd | ( | sdmmc_cmd_def_t | cmd, |
uint32_t | arg | ||
) |
Send a command on the selected slot.
cmd | Command definition |
arg | Argument of the command |
References hsmci_send_cmd_execute().
Start a read blocks transfer on the line Note: The driver will use the DMA available to speed up the transfer.
dest | Pointer on the buffer to fill |
nb_block | Number of block to transfer |
Start a write blocks transfer on the line Note: The driver will use the DMA available to speed up the transfer.
src | Pointer on the buffer to send |
nb_block | Number of block to transfer |
Wait the end of transfer initiated by mci_start_read_blocks()
Wait the end of transfer initiated by mci_start_write_blocks()
bool hsmci_write_word | ( | uint32_t | value | ) |
Write a word on the line.
value | Word to send |
References Assert, hsmci_block_size, hsmci_debug, hsmci_nb_block, hsmci_reset(), and hsmci_transfert_pos.