![]() |
M480 BSP V3.05.005
The Board Support Package for M480 Series
|
Macros | |
#define | SDH_ENABLE_INT(sdh, u32IntMask) |
Enable specified interrupt. More... | |
#define | SDH_DISABLE_INT(sdh, u32IntMask) |
Disable specified interrupt. More... | |
#define | SDH_GET_INT_FLAG(sdh, u32IntMask) |
Get specified interrupt flag/status. More... | |
#define | SDH_CLR_INT_FLAG(sdh, u32IntMask) |
Clear specified interrupt flag/status. More... | |
#define | SDH_IS_CARD_PRESENT(sdh) |
Check SD Card inserted or removed. More... | |
#define | SDH_GET_CARD_CAPACITY(sdh) |
Get SD Card capacity. More... | |
#define | SDH_BLOCK_SIZE 512ul |
Functions | |
void | SDH_Open (SDH_T *sdh, uint32_t u32CardDetSrc) |
This function use to reset SD function and select card detection source and pin. More... | |
uint32_t | SDH_Probe (SDH_T *sdh) |
This function use to initial SD card. More... | |
uint32_t | SDH_Read (SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_t u32SecCount) |
This function use to read data from SD card. More... | |
uint32_t | SDH_Write (SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_t u32SecCount) |
This function use to write data to SD card. More... | |
uint32_t | SDH_CardDetection (SDH_T *sdh) |
int32_t | SDH_Open_Disk (SDH_T *sdh, uint32_t u32CardDetSrc) |
void | SDH_Close_Disk (SDH_T *sdh) |
Variables | |
unsigned char | SDH_info_t::IsCardInsert |
unsigned char | SDH_info_t::R3Flag |
unsigned char | SDH_info_t::R7Flag |
unsigned char volatile | SDH_info_t::DataReadyFlag |
unsigned int | SDH_info_t::CardType |
unsigned int | SDH_info_t::RCA |
unsigned int | SDH_info_t::totalSectorN |
unsigned int | SDH_info_t::diskSize |
int | SDH_info_t::sectorSize |
unsigned char * | SDH_info_t::dmabuf |
HIDDEN_SYMBOLS
#define SDH_CLR_INT_FLAG | ( | sdh, | |
u32IntMask | |||
) |
Clear specified interrupt flag/status.
[in] | sdh | Select SDH0 or SDH1. |
[in] | u32IntMask | Interrupt type mask: SDH_INTSTS_BLKDIF_Msk / SDH_INTSTS_CRCIF_Msk / SDH_INTSTS_CDIF_Msk / SDH_INTSTS_RTOIF_Msk / SDH_INTSTS_DITOIF_Msk |
#define SDH_DISABLE_INT | ( | sdh, | |
u32IntMask | |||
) |
Disable specified interrupt.
[in] | sdh | Select SDH0 or SDH1. |
[in] | u32IntMask | Interrupt type mask: SDH_INTEN_BLKDIEN_Msk / SDH_INTEN_CRCIEN_Msk / SDH_INTEN_CDIEN_Msk / SDH_INTEN_RTOIEN_Msk / SDH_INTEN_DITOIEN_Msk / SDH_INTEN_WKIEN_Msk / SDH_INTEN_CDSRC_Msk / |
#define SDH_ENABLE_INT | ( | sdh, | |
u32IntMask | |||
) |
Enable specified interrupt.
[in] | sdh | Select SDH0 or SDH1. |
[in] | u32IntMask | Interrupt type mask: SDH_INTEN_BLKDIEN_Msk / SDH_INTEN_CRCIEN_Msk / SDH_INTEN_CDIEN_Msk / SDH_INTEN_CDSRC_Msk SDH_INTEN_RTOIEN_Msk / SDH_INTEN_DITOIEN_Msk / SDH_INTEN_WKIEN_Msk |
#define SDH_GET_CARD_CAPACITY | ( | sdh | ) |
#define SDH_GET_INT_FLAG | ( | sdh, | |
u32IntMask | |||
) |
Get specified interrupt flag/status.
[in] | sdh | Select SDH0 or SDH1. |
[in] | u32IntMask | Interrupt type mask: SDH_INTSTS_BLKDIF_Msk / SDH_INTSTS_CRCIF_Msk / SDH_INTSTS_CRC7_Msk / SDH_INTSTS_CRC16_Msk / SDH_INTSTS_CRCSTS_Msk / SDH_INTSTS_DAT0STS_Msk / SDH_INTSTS_CDIF_Msk SDH_INTSTS_RTOIF_Msk / SDH_INTSTS_DITOIF_Msk / SDH_INTSTS_CDSTS_Msk / SDH_INTSTS_DAT1STS_Msk |
#define SDH_IS_CARD_PRESENT | ( | sdh | ) |
uint32_t SDH_CardDetection | ( | SDH_T * | sdh | ) |
void SDH_Close_Disk | ( | SDH_T * | sdh | ) |
void SDH_Open | ( | SDH_T * | sdh, |
uint32_t | u32CardDetSrc | ||
) |
This function use to reset SD function and select card detection source and pin.
HIDDEN_SYMBOLS
[in] | sdh | Select SDH0 or SDH1. |
[in] | u32CardDetSrc | Select card detection pin from GPIO or DAT3 pin. ( CardDetect_From_GPIO / CardDetect_From_DAT3) |
int32_t SDH_Open_Disk | ( | SDH_T * | sdh, |
uint32_t | u32CardDetSrc | ||
) |
uint32_t SDH_Probe | ( | SDH_T * | sdh | ) |
This function use to initial SD card.
[in] | sdh | Select SDH0 or SDH1. |
SDH_ERR_DEVICE | unknown device. |
SDH_NO_SD_CARD | SD card be removed. |
SDH_CRC_ERROR | CRC error happen. |
SDH_CRC7_ERROR | CRC7 error happen. |
Successful | SD card initial success. |
This function is used to initial SD card. SD initial state needs 400KHz clock output, driver will use HIRC for SD initial clock source. And then switch back to the user's setting.
uint32_t SDH_Read | ( | SDH_T * | sdh, |
uint8_t * | pu8BufAddr, | ||
uint32_t | u32StartSec, | ||
uint32_t | u32SecCount | ||
) |
uint32_t SDH_Write | ( | SDH_T * | sdh, |
uint8_t * | pu8BufAddr, | ||
uint32_t | u32StartSec, | ||
uint32_t | u32SecCount | ||
) |
This function use to write data to SD card.
[in] | sdh | Select SDH0 or SDH1. |
[in] | pu8BufAddr | The buffer to send the data to SD card. |
[in] | u32StartSec | The start write sector address. |
[in] | u32SecCount | The the write sector number of data. |
SDH_SELECT_ERROR | u32SecCount is zero. |
SDH_NO_SD_CARD | SD card be removed. |
SDH_CRC_ERROR | CRC error happen. |
SDH_CRC7_ERROR | CRC7 error happen. |
Successful | Write data to SD card success. |