![]() |
Synergy Software Package User's Manual
|
Driver for the SD/MMC Host Interface (SDHI). More...
Data Structures | |
| struct | sdmmc_instance_ctrl_t |
| struct | sdmmc_extended_cfg_t |
Enumerations | |
| enum | sdmmc_card_detect_t { SDMMC_CARD_DETECT_NONE, SDMMC_CARD_DETECT_CD } |
| enum | sdmmc_write_protect_t { SDMMC_WRITE_PROTECT_NONE, SDMMC_WRITE_PROTECT_WP } |
Functions | |
| ssp_err_t | R_SDMMC_Open (sdmmc_ctrl_t *const p_api_ctrl, sdmmc_cfg_t const *const p_cfg) |
| ssp_err_t | R_SDMMC_Close (sdmmc_ctrl_t *const p_api_ctrl) |
| ssp_err_t | R_SDMMC_Read (sdmmc_ctrl_t *const p_api_ctrl, uint8_t *const p_dest, uint32_t const start_sector, uint32_t const sector_count) |
| ssp_err_t | R_SDMMC_Write (sdmmc_ctrl_t *const p_api_ctrl, uint8_t const *const p_source, uint32_t const start_sector, uint32_t const sector_count) |
| ssp_err_t | R_SDMMC_Control (sdmmc_ctrl_t *const p_api_ctrl, ssp_command_t const command, void *p_data) |
| ssp_err_t | R_SDMMC_ReadIo (sdmmc_ctrl_t *const p_api_ctrl, uint8_t *const p_data, uint32_t const function, uint32_t const address) |
| ssp_err_t | R_SDMMC_WriteIo (sdmmc_ctrl_t *const p_api_ctrl, uint8_t *const p_data, uint32_t const function, uint32_t const address, sdmmc_io_write_mode_t const read_after_write) |
| ssp_err_t | R_SDMMC_ReadIoExt (sdmmc_ctrl_t *const p_api_ctrl, uint8_t *const p_dest, uint32_t const function, uint32_t const address, uint32_t *const count, sdmmc_io_transfer_mode_t transfer_mode, sdmmc_io_address_mode_t address_mode) |
| ssp_err_t | R_SDMMC_WriteIoExt (sdmmc_ctrl_t *const p_api_ctrl, uint8_t const *const p_source, uint32_t const function, uint32_t const address, uint32_t const count, sdmmc_io_transfer_mode_t transfer_mode, sdmmc_io_address_mode_t address_mode) |
| ssp_err_t | R_SDMMC_IoIntEnable (sdmmc_ctrl_t *const p_api_ctrl, bool enable) |
| ssp_err_t | R_SDMMC_VersionGet (ssp_version_t *const p_version) |
| ssp_err_t | R_SDMMC_InfoGet (sdmmc_ctrl_t *const p_api_ctrl, sdmmc_info_t *const p_info) |
| ssp_err_t | R_SDMMC_Erase (sdmmc_ctrl_t *const p_api_ctrl, uint32_t const start_sector, uint32_t const sector_count) |
Driver for the SD/MMC Host Interface (SDHI).
SD/MMC driver to access SD, eMMC, and SDIO devices.
| enum sdmmc_card_detect_t |
| ssp_err_t R_SDMMC_Close | ( | sdmmc_ctrl_t *const | p_api_ctrl | ) |
Closes an open SD/MMC device. Implements sdmmc_api_t::close().
| SSP_SUCCESS | Successful close. |
| SSP_ERR_ASSERTION | The parameter p_ctrl is NULL. |
| SSP_ERR_NOT_OPEN | Driver has not been initialized. |
Disable SDHI interrupts.
Close the transfer driver.
Turn on module stop bit (turn module off).
Release hardware lock.
| ssp_err_t R_SDMMC_Control | ( | sdmmc_ctrl_t *const | p_api_ctrl, |
| ssp_command_t const | command, | ||
| void * | p_data | ||
| ) |
Sends control commands to and receives the status of the SD/MMC device. Implements sdmmc_api_t::control().
| SSP_SUCCESS | Command executed successfully. |
| SSP_ERR_ASSERTION | Null Pointer. |
| SSP_ERR_INVALID_ARGUMENT | Command is invalid. |
| SSP_ERR_INVALID_SIZE | Block size not in valid range of 1-512 for SDIO or 512 only for SD cards and eMMC. |
Get the command status and return to called function.
| ssp_err_t R_SDMMC_Erase | ( | sdmmc_ctrl_t *const | p_api_ctrl, |
| uint32_t const | start_sector, | ||
| uint32_t const | sector_count | ||
| ) |
Erases sectors of an SD card or eMMC device. Implements sdmmc_api_t::erase().
This function blocks until erase is complete.
| SSP_SUCCESS | Erase operation requested. |
| SSP_ERR_ASSERTION | A required pointer is NULL. |
| SSP_ERR_NOT_OPEN | Driver has not been initialized. |
| SSP_ERR_CARD_NOT_READY | Card was unplugged. |
| SSP_ERR_TRANSFER_BUSY | Driver is busy with a previous operation. |
| SSP_ERR_WRITE_PROTECTED | SD card is Write Protected. |
| SSP_ERR_ERASE_FAILED | Erase operation unsuccessful. |
Send command to set start erase address (CMD35 for eMMC, CMD32 for SD).
Send command to set end erase address (CMD36 for eMMC, CMD33 for SD).
Send erase command (CMD38).
| ssp_err_t R_SDMMC_InfoGet | ( | sdmmc_ctrl_t *const | p_api_ctrl, |
| sdmmc_info_t *const | p_info | ||
| ) |
Provides information about the connected device and driver status. Implements sdmmc_api_t::infoGet().
| SSP_SUCCESS | Function executed successfully. |
| SSP_ERR_ASSERTION | Null Pointer. |
| SSP_ERR_NOT_OPEN | Driver has not been initialized. |
Copy information stored during open.
Check if the card is busy.
| ssp_err_t R_SDMMC_IoIntEnable | ( | sdmmc_ctrl_t *const | p_api_ctrl, |
| bool | enable | ||
| ) |
Enables or disables the SDIO Interrupt. Implements sdmmc_api_t::ioIntEnable().
| SSP_SUCCESS | Card enabled or disabled SDIO interrupts successfully. |
| SSP_ERR_ASSERTION | NULL pointer. |
| SSP_ERR_TRANSFER_BUSY | Driver is busy with a previous operation. |
Make sure the card is not busy.
Enable or disable interrupt.
| ssp_err_t R_SDMMC_Open | ( | sdmmc_ctrl_t *const | p_api_ctrl, |
| sdmmc_cfg_t const *const | p_cfg | ||
| ) |
Initializes the SDHI hardware and completes identification and configuration for the SD or eMMC device. This procedure requires several sequential commands. This API blocks until all identification and configuration commands are complete.
For SDIO, SDIO interrupts are enabled after card identification is complete. SDIO interrupts can be disabled using sdmmc_api_t::ioIntEnable().
Implements sdmmc_api_t::open().
| SSP_SUCCESS | Port is available and is now open for read/write/control access. |
| SSP_ERR_ASSERTION | Null Pointer or block size is not in the valid range of 1-512. |
| SSP_ERR_INVALID_ARGUMENT | Block size must be 512 bytes for SD cards and eMMC devices. It is configurable for SDIO only. |
| SSP_ERR_ALREADY_OPEN | Driver has already been opened with this instance of the control structure. |
| SSP_ERR_HW_LOCKED | The channel specified has already been opened. |
| SSP_ERR_CARD_INIT_FAILED | Hardware related failure occurred, with the MCU or with the card itself. |
| SSP_ERR_IRQ_BSP_DISABLED | Access interrupt is not enabled. |
| SSP_ERR_CARD_NOT_INSERTED | Card detection is enabled and no card is plugged in. |
Verify the requested hardware channel exists on the MCU.
Configure interrupts.
Acquire lock before changing vector table or p_ctrl.
Turn off module stop bit (turn module on).
Perform the identification procedure for SD card or eMMC device.
Configure bus clock, block size, and bus width.
Check to see if the card is write protected (SD cards only).
| ssp_err_t R_SDMMC_Read | ( | sdmmc_ctrl_t *const | p_api_ctrl, |
| uint8_t *const | p_dest, | ||
| uint32_t const | start_sector, | ||
| uint32_t const | sector_count | ||
| ) |
Reads data from an SD or eMMC device. Up to 0x10000 sectors can be read at a time. Implements sdmmc_api_t::read().
This function blocks until the command is sent and the response is received. A callback with the event SDMMC_EVENT_TRANSFER_COMPLETE is called when the read data is available.
| SSP_SUCCESS | Data read successfully. |
| SSP_ERR_ASSERTION | NULL pointer. |
| SSP_ERR_NOT_OPEN | Driver has not been initialized. |
| SSP_ERR_CARD_NOT_READY | Card was unplugged. |
| SSP_ERR_TRANSFER_BUSY | Driver is busy with a previous operation. |
| SSP_ERR_READ_FAILED | Read operation failed. |
Configure the transfer interface for reading.
Read data from SD or eMMC device.
| ssp_err_t R_SDMMC_ReadIo | ( | sdmmc_ctrl_t *const | p_api_ctrl, |
| uint8_t *const | p_data, | ||
| uint32_t const | function, | ||
| uint32_t const | address | ||
| ) |
The Read function reads a one byte register from an SDIO card. Implements sdmmc_api_t::readIo().
This function blocks until the command is sent and the response is received. p_data contains the register value read when this function returns.
| SSP_SUCCESS | Data read successfully. |
| SSP_ERR_ASSERTION | NULL pointer. |
| SSP_ERR_NOT_OPEN | Driver has not been initialized. |
| SSP_ERR_CARD_NOT_READY | Card was unplugged. |
| SSP_ERR_TRANSFER_BUSY | Driver is busy with a previous operation. |
| SSP_ERR_READ_FAILED | Read operation failed. |
Call SDMMC protocol read function
| ssp_err_t R_SDMMC_ReadIoExt | ( | sdmmc_ctrl_t *const | p_api_ctrl, |
| uint8_t *const | p_dest, | ||
| uint32_t const | function, | ||
| uint32_t const | address, | ||
| uint32_t *const | count, | ||
| sdmmc_io_transfer_mode_t | transfer_mode, | ||
| sdmmc_io_address_mode_t | address_mode | ||
| ) |
Reads data from an SDIO card function. Implements sdmmc_api_t::readIoExt().
This function blocks until the command is sent and the response is received. A callback with the event SDMMC_EVENT_TRANSFER_COMPLETE is called when the read data is available.
| SSP_SUCCESS | Data read successfully. |
| SSP_ERR_ASSERTION | NULL pointer, or count is not in the valid range of 1-512 for byte mode or 1-511 for block mode. |
| SSP_ERR_NOT_OPEN | Driver has not been initialized. |
| SSP_ERR_CARD_NOT_READY | Card was unplugged. |
| SSP_ERR_TRANSFER_BUSY | Driver is busy with a previous operation. |
| SSP_ERR_READ_FAILED | Read operation failed. |
Configure the transfer interface for reading.
Read data from SDIO device.
| ssp_err_t R_SDMMC_VersionGet | ( | ssp_version_t *const | p_version | ) |
Returns the version of the firmware and API. Implements sdmmc_api_t::versionGet().
| SSP_SUCCESS | Function executed successfully. |
| SSP_ERR_ASSERTION | Null Pointer. |
| ssp_err_t R_SDMMC_Write | ( | sdmmc_ctrl_t *const | p_api_ctrl, |
| uint8_t const *const | p_source, | ||
| uint32_t const | start_sector, | ||
| uint32_t const | sector_count | ||
| ) |
Writes data to an SD or eMMC device. Up to 0x10000 sectors can be written at a time. Implements sdmmc_api_t::write().
This function blocks until the command is sent and the response is received. A callback with the event SDMMC_EVENT_TRANSFER_COMPLETE is called when the all data has been written.
| SSP_SUCCESS | Card write finished successfully. |
| SSP_ERR_ASSERTION | Handle or Source address is NULL. |
| SSP_ERR_NOT_OPEN | Driver has not been initialized. |
| SSP_ERR_CARD_NOT_READY | Card was unplugged. |
| SSP_ERR_TRANSFER_BUSY | Driver is busy with a previous operation. |
| SSP_ERR_WRITE_PROTECTED | SD card is Write Protected. |
| SSP_ERR_WRITE_FAILED | Write operation failed. |
Configure the transfer interface for writing.
Call SDMMC protocol write function
Write data to SD or eMMC device.
| ssp_err_t R_SDMMC_WriteIo | ( | sdmmc_ctrl_t *const | p_api_ctrl, |
| uint8_t *const | p_data, | ||
| uint32_t const | function, | ||
| uint32_t const | address, | ||
| sdmmc_io_write_mode_t const | read_after_write | ||
| ) |
Writes a one byte register to an SDIO card. Implements sdmmc_api_t::writeIo().
This function blocks until the command is sent and the response is received. The register has been written when this function returns. If read_after_write is true, p_data contains the register value read when this function returns.
| SSP_SUCCESS | Card write finished successfully. |
| SSP_ERR_ASSERTION | Handle or Source address is NULL. |
| SSP_ERR_NOT_OPEN | Driver has not been initialized. |
| SSP_ERR_CARD_NOT_READY | Card was unplugged. |
| SSP_ERR_TRANSFER_BUSY | Driver is busy with a previous operation. |
| SSP_ERR_WRITE_FAILED | Write operation failed. |
Call SDMMC protocol write function with valid parameters
| ssp_err_t R_SDMMC_WriteIoExt | ( | sdmmc_ctrl_t *const | p_api_ctrl, |
| uint8_t const *const | p_source, | ||
| uint32_t const | function, | ||
| uint32_t const | address, | ||
| uint32_t const | count, | ||
| sdmmc_io_transfer_mode_t | transfer_mode, | ||
| sdmmc_io_address_mode_t | address_mode | ||
| ) |
Writes data to an SDIO card function. Implements sdmmc_api_t::writeIoExt().
This function blocks until the command is sent and the response is received. A callback with the event SDMMC_EVENT_TRANSFER_COMPLETE is called when the all data has been written.
| SSP_SUCCESS | Card write finished successfully. |
| SSP_ERR_ASSERTION | NULL pointer, or count is not in the valid range of 1-512 for byte mode or 1-511 for block mode. |
| SSP_ERR_NOT_OPEN | Driver has not been initialized. |
| SSP_ERR_CARD_NOT_READY | Card was unplugged. |
| SSP_ERR_TRANSFER_BUSY | Driver is busy with a previous operation. |
| SSP_ERR_WRITE_FAILED | Write operation failed. |
Configure the transfer interface for writing.
Write data to SDIO device.