This module contains APIs to program and use the MMCSD LLD modules. The APIs can be used by other drivers to get access to MMCSD and also by application to initiate transaction operations.
The MMCSD LLD header file should be included in an application as follows:
Files | |
file | mmcsd_lld.h |
MMCSD LLD Driver API/interface file. | |
Data Structures | |
struct | MMCSD_EmmcDeviceData |
eMMC device properties More... | |
struct | MMCSD_SdDeviceData |
SD device properties. More... | |
struct | MMCSDLLD_Transaction |
MMCSDLLD Transaction. More... | |
struct | MMCSDLLD_InitObject |
MMCSD Driver Initialization Object. More... | |
struct | MMCSDLLD_Object |
MMCSD Driver Object. More... | |
Functions | |
int32_t | MMCSD_lld_init (MMCSDLLD_Handle handle) |
This API Initializes the MMCSD instance. More... | |
int32_t | MMCSD_lld_deInit (MMCSDLLD_Handle handle) |
This API De-Initializes the MMCSD instance. More... | |
uint32_t | MMCSD_lld_getBlockSize (MMCSDLLD_Handle handle) |
This function returns the block size of the MMC/SD media connected to the MMCSD controller. More... | |
int32_t | MMCSD_lld_write_SD_Poll (MMCSDLLD_Handle handle, uint8_t *buf, uint32_t startBlk, uint32_t numBlks) |
Function to perform block writes to the SD media in Polling Mode. More... | |
int32_t | MMCSD_lld_read_SD_Poll (MMCSDLLD_Handle handle, uint8_t *buf, uint32_t startBlk, uint32_t numBlks) |
Function to perform block reads from the SD media in Polling Mode. More... | |
int32_t | MMCSD_lld_write_MMC_Poll (MMCSDLLD_Handle handle, uint8_t *buf, uint32_t startBlk, uint32_t numBlks) |
Function to perform block writes to the MMC media in Polling Mode. More... | |
int32_t | MMCSD_lld_read_MMC_Poll (MMCSDLLD_Handle handle, uint8_t *buf, uint32_t startBlk, uint32_t numBlks) |
Function to perform block reads from the MMC media in Polling Mode. More... | |
int32_t | MMCSD_lld_write_SD_Intr (MMCSDLLD_Handle handle, uint8_t *buf, uint32_t startBlk, uint32_t numBlks) |
Function to perform block writes to the SD media in Interrupt Mode. More... | |
int32_t | MMCSD_lld_read_SD_Intr (MMCSDLLD_Handle handle, uint8_t *buf, uint32_t startBlk, uint32_t numBlks) |
Function to perform block reads from the SD media in Interrupt Mode. More... | |
int32_t | MMCSD_lld_write_MMC_Intr (MMCSDLLD_Handle handle, uint8_t *buf, uint32_t startBlk, uint32_t numBlks) |
Function to perform block writes to the MMC media in Interrupt Mode. More... | |
int32_t | MMCSD_lld_read_MMC_Intr (MMCSDLLD_Handle handle, uint8_t *buf, uint32_t startBlk, uint32_t numBlks) |
Function to perform block reads from the MMC media in Interrupt Mode. More... | |
int32_t | MMCSD_lld_change_Bus_Config_MMC (MMCSDLLD_Handle handle, uint32_t busSpeed, uint32_t busWidth) |
Function to reconfigure the bus Speed and Bus width of the bus for MMC. More... | |
int32_t | MMCSD_lld_change_Bus_Config_SD (MMCSDLLD_Handle handle, uint32_t busSpeed) |
Function to reconfigure the bus Speed and Bus width of the bus for MMC. More... | |
int32_t | MMCSD_lld_change_Tuning_Type (MMCSDLLD_Handle handle, uint32_t tuningType) |
Function to reconfigure the bus Speed and Bus width of the bus for MMC. More... | |
int32_t | MMCSD_lld_enableBootPartition (MMCSDLLD_Handle handle, uint32_t partitionNum) |
Function to enable the boot partition given the media is eMMC. More... | |
int32_t | MMCSD_lld_disableBootPartition (MMCSDLLD_Handle handle) |
This function disables the boot partition if the media is eMMC. More... | |
void | MMCSD_lld_Isr (void *args) |
This is the MMCSD Controller ISR and can be used as IRQ handler. More... | |
Typedefs | |
typedef uint32_t(* | MMCSD_Clock_getTicks) (void) |
The definition of a get System Tick function used by the MMCSD driver to keep track of time. More... | |
typedef uint32_t(* | MMCSD_Clock_usecToTicks) (uint64_t usecs) |
The definition of a micro seconds to ticks function used by the MMCSD driver to get ticks from microseconds. More... | |
typedef void(* | MMCSD_Clock_uSleep) (uint32_t usec) |
The definition of a sleep function used by the MMCSD driver for delay. More... | |
typedef void(* | MMCSD_lld_transferCompleteCallback) (void *args, int32_t xferStatus) |
The definition of a transfer completion callback function used by the MMCSD driver when used in Callback Mode. More... | |
typedef struct MMCSDLLD_InitObject * | MMCSDLLD_InitHandle |
typedef struct MMCSDLLD_Object * | MMCSDLLD_Handle |
Return status | |
#define | MMCSD_STS_SUCCESS ((int32_t) 0) |
Return status when the API execution was successful. More... | |
#define | MMCSD_STS_ERR ((int32_t)-1) |
Return status when the API execution was not successful due to a generic Error. More... | |
#define | MMCSD_STS_ERR_TIMEOUT ((int32_t)-2) |
Return status when the API execution was not successful due to a time out. More... | |
#define | MMCSD_STS_ERR_INVALID_PARAM ((int32_t)-3) |
Return status when the API execution failed due invalid parameters. More... | |
#define | MMCSD_STS_ERR_BUSY ((int32_t)-4) |
Return status when the API execution failed due to driver busy. More... | |
#define | MMCSD_STS_ERR_CARD_NOT_FOUND ((int32_t)-5) |
Return status when the API execution failed due to missing card. More... | |
#define | MMCSD_STS_ERR_CARD_UNUSEABLE ((int32_t)-6) |
Return status when the API execution failed due to unuseable card. More... | |
#define | MMCSD_STS_ERR_CARD_UNLOCK_FAIL ((int32_t)-7) |
Return status when the API execution failed due to card Unlock Failure. More... | |
Timeout values | |
#define | MMCSD_NO_WAIT ((uint32_t)0) |
Value to use when needing a timeout of zero or NO timeout, return immediately on resource not available. More... | |
#define | MMCSD_WAIT_FOREVER ((uint32_t)-1) |
Value to use when needing a timeout of infinity or wait forver until resource is available. More... | |
MMCSD Driver states | |
#define | MMCSD_STATE_RESET ((uint8_t) 0U) |
MMCSD driver is in Reset State prior to driver init and post driver deinit. More... | |
#define | MMCSD_STATE_IDLE ((uint8_t) 1U) |
MMCSD driver accepts runtime APIs only Ready State, otherwise return error. More... | |
#define | MMCSD_STATE_BUSY ((uint8_t) 2U) |
MMCSD driver is busy performing operation with peripherals, return error when APIs are invoked. More... | |
#define | MMCSD_STATE_ERROR ((uint8_t) 3U) |
MMCSD driver ran into error, returns error for all APIs other than deinit in this state. More... | |
MMCSD Transfer states | |
#define | MMCSD_XFER_IDLE_STATE ((uint8_t) 0U) |
XFER is in IDLE state. More... | |
#define | MMCSD_XFER_CMD_STATE ((uint8_t) 1U) |
XFER is in CMD state. More... | |
#define | MMCSD_XFER_WRITE_STATE ((uint8_t) 2U) |
XFER is in Write state. More... | |
#define | MMCSD_XFER_READ_STATE ((uint8_t) 3U) |
XFER is in Read state. More... | |
MACROS used to select one of the Card Slot Types. | |
#define | MMCSD_SLOT_TYPE_VAL_REMOVABLE ((uint8_t) 0x0U) |
#define | MMCSD_SLOT_TYPE_VAL_EMBEDDED ((uint8_t) 0x1U) |
#define | MMCSD_SLOT_TYPE_VAL_SHARED ((uint8_t) 0x2U) |
MACROS used to select one of the possible Card Types. | |
#define | MMCSD_CARD_TYPE_SD ((uint32_t) 0U) |
#define | MMCSD_CARD_TYPE_EMMC ((uint32_t) 2U) |
#define | MMCSD_CARD_TYPE_NO_DEVICE ((uint32_t) 3U) |
MACROS used to select one of the possible PHY Types. | |
#define | MMCSD_PHY_TYPE_HW_PHY ((uint32_t) 0U) |
#define | MMCSD_PHY_TYPE_SW_PHY ((uint32_t) 1U) |
#define | MMCSD_PHY_TYPE_NO_PHY ((uint32_t) 2U) |
MACROS used to select one of the possible Bus Widths. | |
#define | MMCSD_BUS_WIDTH_4BIT ((uint32_t) 0x4U) |
#define | MMCSD_BUS_WIDTH_8BIT ((uint32_t) 0x8U) |
#define | MMCSD_BUS_WIDTH_1BIT ((uint32_t) 0x1U) |
MACROS used to select one of the possible PHY tuning types. | |
#define | MMCSD_PHY_TUNING_TYPE_AUTO ((uint32_t) 0U) |
#define | MMCSD_PHY_TUNING_TYPE_MANUAL ((uint32_t) 1U) |
MACROS used to select one of the possible Speed Modes for SD Device. | |
#define | MMCSD_SD_MODE_HS ((uint32_t) 10U) |
#define | MMCSD_SD_MODE_DS ((uint32_t) 11U) |
#define | MMCSD_SD_MODE_SDR12 ((uint32_t) 12U) |
#define | MMCSD_SD_MODE_SDR25 ((uint32_t) 13U) |
#define | MMCSD_SD_MODE_SDR50 ((uint32_t) 14U) |
#define | MMCSD_SD_MODE_DDR50 ((uint32_t) 15U) |
#define | MMCSD_SD_MODE_SDR104 ((uint32_t) 16U) |
MACROS used to select one of the possible Speed Modes for EMMC Device. | |
#define | MMCSD_MMC_MODE_SDR25 ((uint32_t) 20U) |
#define | MMCSD_MMC_MODE_SDR50 ((uint32_t) 21U) |
#define | MMCSD_MMC_MODE_HS200 ((uint32_t) 23U) |
#define MMCSD_STS_SUCCESS ((int32_t) 0) |
Return status when the API execution was successful.
#define MMCSD_STS_ERR ((int32_t)-1) |
Return status when the API execution was not successful due to a generic Error.
#define MMCSD_STS_ERR_TIMEOUT ((int32_t)-2) |
Return status when the API execution was not successful due to a time out.
#define MMCSD_STS_ERR_INVALID_PARAM ((int32_t)-3) |
Return status when the API execution failed due invalid parameters.
#define MMCSD_STS_ERR_BUSY ((int32_t)-4) |
Return status when the API execution failed due to driver busy.
#define MMCSD_STS_ERR_CARD_NOT_FOUND ((int32_t)-5) |
Return status when the API execution failed due to missing card.
#define MMCSD_STS_ERR_CARD_UNUSEABLE ((int32_t)-6) |
Return status when the API execution failed due to unuseable card.
#define MMCSD_STS_ERR_CARD_UNLOCK_FAIL ((int32_t)-7) |
Return status when the API execution failed due to card Unlock Failure.
#define MMCSD_NO_WAIT ((uint32_t)0) |
Value to use when needing a timeout of zero or NO timeout, return immediately on resource not available.
#define MMCSD_WAIT_FOREVER ((uint32_t)-1) |
Value to use when needing a timeout of infinity or wait forver until resource is available.
#define MMCSD_STATE_RESET ((uint8_t) 0U) |
MMCSD driver is in Reset State prior to driver init and post driver deinit.
#define MMCSD_STATE_IDLE ((uint8_t) 1U) |
MMCSD driver accepts runtime APIs only Ready State, otherwise return error.
#define MMCSD_STATE_BUSY ((uint8_t) 2U) |
MMCSD driver is busy performing operation with peripherals, return error when APIs are invoked.
#define MMCSD_STATE_ERROR ((uint8_t) 3U) |
MMCSD driver ran into error, returns error for all APIs other than deinit in this state.
#define MMCSD_XFER_IDLE_STATE ((uint8_t) 0U) |
XFER is in IDLE state.
#define MMCSD_XFER_CMD_STATE ((uint8_t) 1U) |
XFER is in CMD state.
#define MMCSD_XFER_WRITE_STATE ((uint8_t) 2U) |
XFER is in Write state.
#define MMCSD_XFER_READ_STATE ((uint8_t) 3U) |
XFER is in Read state.
#define MMCSD_SLOT_TYPE_VAL_REMOVABLE ((uint8_t) 0x0U) |
#define MMCSD_SLOT_TYPE_VAL_EMBEDDED ((uint8_t) 0x1U) |
#define MMCSD_SLOT_TYPE_VAL_SHARED ((uint8_t) 0x2U) |
#define MMCSD_CARD_TYPE_SD ((uint32_t) 0U) |
#define MMCSD_CARD_TYPE_EMMC ((uint32_t) 2U) |
#define MMCSD_CARD_TYPE_NO_DEVICE ((uint32_t) 3U) |
#define MMCSD_PHY_TYPE_HW_PHY ((uint32_t) 0U) |
#define MMCSD_PHY_TYPE_SW_PHY ((uint32_t) 1U) |
#define MMCSD_PHY_TYPE_NO_PHY ((uint32_t) 2U) |
#define MMCSD_BUS_WIDTH_4BIT ((uint32_t) 0x4U) |
#define MMCSD_BUS_WIDTH_8BIT ((uint32_t) 0x8U) |
#define MMCSD_BUS_WIDTH_1BIT ((uint32_t) 0x1U) |
#define MMCSD_PHY_TUNING_TYPE_AUTO ((uint32_t) 0U) |
#define MMCSD_PHY_TUNING_TYPE_MANUAL ((uint32_t) 1U) |
#define MMCSD_SD_MODE_HS ((uint32_t) 10U) |
#define MMCSD_SD_MODE_DS ((uint32_t) 11U) |
#define MMCSD_SD_MODE_SDR12 ((uint32_t) 12U) |
#define MMCSD_SD_MODE_SDR25 ((uint32_t) 13U) |
#define MMCSD_SD_MODE_SDR50 ((uint32_t) 14U) |
#define MMCSD_SD_MODE_DDR50 ((uint32_t) 15U) |
#define MMCSD_SD_MODE_SDR104 ((uint32_t) 16U) |
#define MMCSD_MMC_MODE_SDR25 ((uint32_t) 20U) |
#define MMCSD_MMC_MODE_SDR50 ((uint32_t) 21U) |
#define MMCSD_MMC_MODE_HS200 ((uint32_t) 23U) |
typedef uint32_t(* MMCSD_Clock_getTicks) (void) |
The definition of a get System Tick function used by the MMCSD driver to keep track of time.
typedef uint32_t(* MMCSD_Clock_usecToTicks) (uint64_t usecs) |
The definition of a micro seconds to ticks function used by the MMCSD driver to get ticks from microseconds.
usecs | Micro Seconds |
typedef void(* MMCSD_Clock_uSleep) (uint32_t usec) |
The definition of a sleep function used by the MMCSD driver for delay.
usec | Micro Seconds |
typedef void(* MMCSD_lld_transferCompleteCallback) (void *args, int32_t xferStatus) |
The definition of a transfer completion callback function used by the MMCSD driver when used in Callback Mode.
args | Void Pointer |
xferStatus | Transfer Status |
typedef struct MMCSDLLD_InitObject * MMCSDLLD_InitHandle |
typedef struct MMCSDLLD_Object * MMCSDLLD_Handle |
int32_t MMCSD_lld_init | ( | MMCSDLLD_Handle | handle | ) |
This API Initializes the MMCSD instance.
handle | [IN] Handle to the MMCSD instance used. |
int32_t MMCSD_lld_deInit | ( | MMCSDLLD_Handle | handle | ) |
This API De-Initializes the MMCSD instance.
handle | [IN] Handle to the MMCSD instance used. |
uint32_t MMCSD_lld_getBlockSize | ( | MMCSDLLD_Handle | handle | ) |
This function returns the block size of the MMC/SD media connected to the MMCSD controller.
handle | [IN] Handle to the MMCSD instance used. |
int32_t MMCSD_lld_write_SD_Poll | ( | MMCSDLLD_Handle | handle, |
uint8_t * | buf, | ||
uint32_t | startBlk, | ||
uint32_t | numBlks | ||
) |
Function to perform block writes to the SD media in Polling Mode.
handle | [IN] Handle to the MMCSD instance used. |
buf | [IN] Pointer to buffer from which data is to be written from. |
startBlk | [IN] Block to start Writing data from. |
numBlks | [IN] Number of blocks to write. |
int32_t MMCSD_lld_read_SD_Poll | ( | MMCSDLLD_Handle | handle, |
uint8_t * | buf, | ||
uint32_t | startBlk, | ||
uint32_t | numBlks | ||
) |
Function to perform block reads from the SD media in Polling Mode.
handle | [IN] Handle to the MMCSD instance used. |
buf | [IN] Pointer to buffer to which data is to be read into. |
startBlk | [IN] Block to start reading data from. |
numBlks | [IN] Number of blocks to read. |
int32_t MMCSD_lld_write_MMC_Poll | ( | MMCSDLLD_Handle | handle, |
uint8_t * | buf, | ||
uint32_t | startBlk, | ||
uint32_t | numBlks | ||
) |
Function to perform block writes to the MMC media in Polling Mode.
handle | [IN] Handle to the MMCSD instance used. |
buf | [IN] Pointer to buffer from which data is to be written from. |
startBlk | [IN] Block to start Writing data from. |
numBlks | [IN] Number of blocks to write. |
int32_t MMCSD_lld_read_MMC_Poll | ( | MMCSDLLD_Handle | handle, |
uint8_t * | buf, | ||
uint32_t | startBlk, | ||
uint32_t | numBlks | ||
) |
Function to perform block reads from the MMC media in Polling Mode.
handle | [IN] Handle to the MMCSD instance used. |
buf | [IN] Pointer to buffer to which data is to be read into. |
startBlk | [IN] Block to start reading data from. |
numBlks | [IN] Number of blocks to read. |
int32_t MMCSD_lld_write_SD_Intr | ( | MMCSDLLD_Handle | handle, |
uint8_t * | buf, | ||
uint32_t | startBlk, | ||
uint32_t | numBlks | ||
) |
Function to perform block writes to the SD media in Interrupt Mode.
handle | [IN] Handle to the MMCSD instance used. |
buf | [IN] Pointer to buffer from which data is to be written from. |
startBlk | [IN] Block to start Writing data from. |
numBlks | [IN] Number of blocks to write. |
int32_t MMCSD_lld_read_SD_Intr | ( | MMCSDLLD_Handle | handle, |
uint8_t * | buf, | ||
uint32_t | startBlk, | ||
uint32_t | numBlks | ||
) |
Function to perform block reads from the SD media in Interrupt Mode.
handle | [IN] Handle to the MMCSD instance used. |
buf | [IN] Pointer to buffer to which data is to be read into. |
startBlk | [IN] Block to start reading data from. |
numBlks | [IN] Number of blocks to read. |
int32_t MMCSD_lld_write_MMC_Intr | ( | MMCSDLLD_Handle | handle, |
uint8_t * | buf, | ||
uint32_t | startBlk, | ||
uint32_t | numBlks | ||
) |
Function to perform block writes to the MMC media in Interrupt Mode.
handle | [IN] Handle to the MMCSD instance used. |
buf | [IN] Pointer to buffer from which data is to be written from. |
startBlk | [IN] Block to start Writing data from. |
numBlks | [IN] Number of blocks to write. |
int32_t MMCSD_lld_read_MMC_Intr | ( | MMCSDLLD_Handle | handle, |
uint8_t * | buf, | ||
uint32_t | startBlk, | ||
uint32_t | numBlks | ||
) |
Function to perform block reads from the MMC media in Interrupt Mode.
handle | [IN] Handle to the MMCSD instance used. |
buf | [IN] Pointer to buffer to which data is to be read into. |
startBlk | [IN] Block to start reading data from. |
numBlks | [IN] Number of blocks to read. |
int32_t MMCSD_lld_change_Bus_Config_MMC | ( | MMCSDLLD_Handle | handle, |
uint32_t | busSpeed, | ||
uint32_t | busWidth | ||
) |
Function to reconfigure the bus Speed and Bus width of the bus for MMC.
handle | [IN] Handle to the MMCSD instance used. |
busSpeed | [IN] Bus Speed to Configure. MMCSDSpeedModesEMMC |
busWidth | [IN] Bus Width to Configure. MMCSDBusWidth |
int32_t MMCSD_lld_change_Bus_Config_SD | ( | MMCSDLLD_Handle | handle, |
uint32_t | busSpeed | ||
) |
Function to reconfigure the bus Speed and Bus width of the bus for MMC.
handle | [IN] Handle to the MMCSD instance used. |
busSpeed | [IN] Bus Speed to Configure. MMCSDSpeedModesSD |
int32_t MMCSD_lld_change_Tuning_Type | ( | MMCSDLLD_Handle | handle, |
uint32_t | tuningType | ||
) |
Function to reconfigure the bus Speed and Bus width of the bus for MMC.
handle | [IN] Handle to the MMCSD instance used. |
tuningType | [IN] Tuning Type to Configure. MMCSDPhyTuningType |
int32_t MMCSD_lld_enableBootPartition | ( | MMCSDLLD_Handle | handle, |
uint32_t | partitionNum | ||
) |
Function to enable the boot partition given the media is eMMC.
handle | [IN] Handle to the MMCSD instance used. |
partitionNum | [IN] Boot partition to be enabled. |
int32_t MMCSD_lld_disableBootPartition | ( | MMCSDLLD_Handle | handle | ) |
This function disables the boot partition if the media is eMMC.
handle | [IN] Handle to the MMCSD instance used. |
void MMCSD_lld_Isr | ( | void * | args | ) |
This is the MMCSD Controller ISR and can be used as IRQ handler.
args | [IN] Argument to the ISR. |