This section describes the programming interface of the SDCH Peripheral driver. The SDHC driver configures the secure digital host controller and provides an easy way to operate the SDHC module.
SDHC Initialization
To initialize the SDHC module, call the SDHC_DRV_Init() function and pass in the configuration data structure.
This is an example code to initialize and configure the driver:
SDHC Issuing a request to the card
The SDHC driver provides a simple way to send commands to and retrieve response/data from the card.
This is a example to send the SD_SWITCH command to the card.
req.
argument &= ~((0xF) << (group * 4));
req.
flags = FSL_SDHC_REQ_FLAGS_DATA_READ;
&req,
FSL_SDCARD_REQUEST_TIMEOUT);)
{
}
else
{
}
This section describes the programming interface of the SDCH Peripheral Driver.
This function initializes the SDHC module according to the given initialization configuration structure including the clock frequency, bus width, and card detect callback.
- Parameters
-
instance | the specific instance index |
host | pointer to a place storing the sdhc_host_t structure |
config | initialization configuration data |
- Returns
- kStatus_SDHC_NoError if success
- Parameters
-
instance | the instance index of host controller |
- Returns
- kStatus_SDHC_NoError if success
This function checks if there's a card inserted in the SDHC.
- Parameters
-
instance | the instance index of host controller |
- Returns
- kStatus_SDHC_NoError on success
sdhc_status_t SDHC_DRV_ConfigClock |
( |
uint32_t |
instance, |
|
|
uint32_t |
clock |
|
) |
| |
- Parameters
-
instance | the instance index of host controller |
clock | the desired frequency to be set to controller |
- Returns
- kStatus_SDHC_NoError on success
- Parameters
-
instance | the instance index of host controller |
busWidth | the desired bus width to be set to controller |
- Returns
- kStatus_SDHC_NoError on success
This function issues the request to the card on a specific SDHC. The command is sent and is blocked as long as the response/data is sending back from the card.
- Parameters
-
instance | the instance index of host controller |
req | the pointer to the request |
timeoutInMs | timeout value in microseconds |
- Returns
- kStatus_SDHC_NoError on success
void SDHC_DRV_DoIrq |
( |
uint32_t |
instance | ) |
|
This function deals with IRQs on the given host controller.
- Parameters
-
instance | the instance index of host controller |