NUC472_NUC442_BSP V3.03.004
The Board Support Package for NUC472/NUC442
Macros | Functions | Variables
Collaboration diagram for SD Exported Functions:

Macros

#define SD_ENABLE_INT(u32IntMask)
 Enable specified interrupt. More...
 
#define SD_DISABLE_INT(u32IntMask)
 Disable specified interrupt. More...
 
#define SD_GET_INT_FLAG(u32IntMask)
 Get specified interrupt flag/status. More...
 
#define SD_CLR_INT_FLAG(u32IntMask)
 Clear specified interrupt flag/status. More...
 
#define SD_IS_CARD_PRESENT(u32CardNum)
 Check SD Card inserted or removed. More...
 
#define SD_GET_CARD_CAPACITY(u32CardNum)
 Get SD Card capacity. More...
 
#define SD_BLOCK_SIZE   512
 

Functions

void SD_Open (uint32_t u32CardDetSrc)
 This function use to reset SD function and select card detection source and pin. More...
 
void SD_Probe (uint32_t u32CardNum)
 This function use to initial SD card. More...
 
uint32_t SD_Read (uint32_t u32CardNum, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_t u32SecCount)
 This function use to read data from SD card. More...
 
uint32_t SD_Write (uint32_t u32CardNum, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_t u32SecCount)
 This function use to write data to SD card. More...
 

Variables

uint32_t SD_info_t::CardType
 
uint32_t SD_info_t::RCA
 
uint8_t SD_info_t::IsCardInsert
 
struct disk_data_tdisk_data_t::next
 
unsigned int disk_data_t::totalSectorN
 
unsigned int disk_data_t::diskSize
 
int disk_data_t::sectorSize
 
char disk_data_t::vendor [STOR_STRING_LEN]
 
char disk_data_t::product [STOR_STRING_LEN]
 
char disk_data_t::serial [STOR_STRING_LEN]
 

Detailed Description

Macro Definition Documentation

◆ SD_BLOCK_SIZE

#define SD_BLOCK_SIZE   512

Definition at line 29 of file sd.c.

◆ SD_CLR_INT_FLAG

#define SD_CLR_INT_FLAG (   u32IntMask)

Clear specified interrupt flag/status.

Parameters
[in]u32IntMaskInterrupt type mask: SDH_INTSTS_BLKDIF_Msk / SDH_INTSTS_CRCIF_Msk / SDH_INTSTS_CDIF0_Msk / SDH_INTSTS_CDIF1_Msk / SDH_INTSTS_SDHOST0IF_Msk / SDH_INTSTS_SDHOST1IF_Msk / SDH_INTSTS_RTOIF_Msk / SDH_INTSTS_DINTOIF_Msk
Returns
None.

Definition at line 165 of file sd.h.

◆ SD_DISABLE_INT

#define SD_DISABLE_INT (   u32IntMask)

◆ SD_ENABLE_INT

#define SD_ENABLE_INT (   u32IntMask)

Enable specified interrupt.

Parameters
[in]u32IntMaskInterrupt type mask: SDH_INTEN_BLKDIEN_Msk / SDH_INTEN_CRCIEN_Msk / SDH_INTEN_CDIEN0_Msk / SDH_INTEN_CDIEN1_Msk / SDH_INTEN_CDSRC0_Msk / SDH_INTEN_CDSRC1_Msk / SDH_INTEN_RTOIEN_Msk / SDH_INTEN_DITOIEN_Msk / SDH_INTEN_WKIEN_Msk
Returns
None.

Definition at line 121 of file sd.h.

◆ SD_GET_CARD_CAPACITY

#define SD_GET_CARD_CAPACITY (   u32CardNum)

Get SD Card capacity.

Parameters
[in]u32CardNumSelect SD0 or SD1. ( SD_PORT0 / SD_PORT1)
Returns
SD Card capacity. (unit: KByte)

Definition at line 187 of file sd.h.

◆ SD_GET_INT_FLAG

#define SD_GET_INT_FLAG (   u32IntMask)

Get specified interrupt flag/status.

Parameters
[in]u32IntMaskInterrupt 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_CDIF0_Msk / SDH_INTSTS_CDIF1_Msk / SDH_INTSTS_SDHOST0IF_Msk / SDH_INTSTS_SDHOST1IF_Msk / SDH_INTSTS_RTOIF_Msk / SDH_INTSTS_DINTOIF_Msk / SDH_INTSTS_CDSTS0_Msk / SDH_INTSTS_CDSTS1_Msk / SDH_INTSTS_DAT1STS_Msk
Returns
0 = The specified interrupt is not happened. 1 = The specified interrupt is happened.

Definition at line 150 of file sd.h.

◆ SD_IS_CARD_PRESENT

#define SD_IS_CARD_PRESENT (   u32CardNum)

Check SD Card inserted or removed.

Parameters
[in]u32CardNumSelect SD0 or SD1. ( SD_PORT0 / SD_PORT1)
Returns
1: Card inserted. 0: Card removed.

Definition at line 177 of file sd.h.

Function Documentation

◆ SD_Open()

HIDDEN_SYMBOLS void SD_Open ( uint32_t  u32CardDetSrc)

This function use to reset SD function and select card detection source and pin.

Parameters
[in]u32CardDetSrcSelect card detection source from SD0 or SD1. ( SD_PORT0 / SD_PORT1)
And also select card detection pin from GPIO or DAT3 pin. ( CardDetect_From_GPIO / CardDetect_From_DAT3)
Returns
None

Definition at line 764 of file sd.c.

◆ SD_Probe()

void SD_Probe ( uint32_t  u32CardNum)

This function use to initial SD card.

Parameters
[in]u32CardNumSelect initial SD0 or SD1. ( SD_PORT0 / SD_PORT1)
Returns
None

Definition at line 837 of file sd.c.

◆ SD_Read()

uint32_t SD_Read ( uint32_t  u32CardNum,
uint8_t *  pu8BufAddr,
uint32_t  u32StartSec,
uint32_t  u32SecCount 
)

This function use to read data from SD card.

Parameters
[in]u32CardNumSelect card: SD0 or SD1. ( SD_PORT0 / SD_PORT1)
[out]pu8BufAddrThe buffer to receive the data from SD card.
[in]u32StartSecThe start read sector address.
[in]u32SecCountThe the read sector number of data
Returns
None

Definition at line 901 of file sd.c.

◆ SD_Write()

uint32_t SD_Write ( uint32_t  u32CardNum,
uint8_t *  pu8BufAddr,
uint32_t  u32StartSec,
uint32_t  u32SecCount 
)

This function use to write data to SD card.

Parameters
[in]u32CardNumSelect card: SD0 or SD1. ( SD_PORT0 / SD_PORT1)
[in]pu8BufAddrThe buffer to send the data to SD card.
[in]u32StartSecThe start write sector address.
[in]u32SecCountThe the write sector number of data.
Returns
SD_SELECT_ERROR : u32SecCount is zero.
SD_NO_SD_CARD : SD card be removed.
SD_CRC_ERROR : CRC error happen.
SD_CRC7_ERROR : CRC7 error happen.
Successful : Write data to SD card success.

Definition at line 1077 of file sd.c.

Variable Documentation

◆ CardType

uint32_t SD_info_t::CardType

SDHC, SD, or MMC

Definition at line 77 of file sd.h.

◆ diskSize

unsigned int disk_data_t::diskSize

disk size in Kbytes

Definition at line 89 of file sd.h.

◆ IsCardInsert

uint8_t SD_info_t::IsCardInsert

card insert state

Definition at line 79 of file sd.h.

◆ next

struct disk_data_t* disk_data_t::next

next device

Definition at line 85 of file sd.h.

◆ product

char disk_data_t::product[STOR_STRING_LEN]

*SD card product id

Definition at line 92 of file sd.h.

◆ RCA

uint32_t SD_info_t::RCA

relative card address

Definition at line 78 of file sd.h.

◆ sectorSize

int disk_data_t::sectorSize

sector size in bytes

Definition at line 90 of file sd.h.

◆ serial

char disk_data_t::serial[STOR_STRING_LEN]

SD card serial number

Definition at line 93 of file sd.h.

◆ totalSectorN

unsigned int disk_data_t::totalSectorN

total sector number

Definition at line 88 of file sd.h.

◆ vendor

char disk_data_t::vendor[STOR_STRING_LEN]

SD card vendor

Definition at line 91 of file sd.h.