MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

The host adapter driver provide adapter for polling/interrupt/freertos mode.

Data Structures

struct  sdmmchost_detect_card_t
 sd card detect More...
 
struct  sdmmchost_pwr_card_t
 card power control More...
 
struct  sdmmchost_card_int_t
 card interrupt application callback More...
 
struct  sdmmchost_card_switch_voltage_func_t
 card switch voltage function collection More...
 
struct  sdmmhostcard_usr_param_t
 card user parameter, user can define the parameter according the board, card capability More...
 

Macros

#define FSL_SDMMC_HOST_ADAPTER_VERSION   (MAKE_VERSION(2U, 2U, 14U)) /*2.2.14*/
 Middleware adapter version. More...
 
#define SDMMCHOST_NOT_SUPPORT   0U
 use this define to indicate the host not support feature
 
#define SDMMCHOST_SUPPORT   1U
 use this define to indicate the host support feature
 
#define kSDMMCHOST_DATABUSWIDTH1BIT   kUSDHC_DataBusWidth1Bit
 1-bit mode
 
#define kSDMMCHOST_DATABUSWIDTH4BIT   kUSDHC_DataBusWidth4Bit
 4-bit mode
 
#define kSDMMCHOST_DATABUSWIDTH8BIT   kUSDHC_DataBusWidth8Bit
 8-bit mode
 
#define SDMMCHOST_STANDARD_TUNING_START   (10U)
 standard tuning start point
 
#define SDMMCHOST_TUINIG_STEP   (2U)
 standard tuning step
 
#define SDMMCHOST_RETUNING_TIMER_COUNT   (0U)
 Re-tuning timer.
 
#define USDHC_READ_BURST_LEN   (8U)
 number of words USDHC read in a single burst
 
#define USDHC_WRITE_BURST_LEN   (8U)
 number of words USDHC write in a single burst
 
#define USDHC_DATA_TIMEOUT   (0xFU)
 data timeout counter value
 

Typedefs

typedef void(* sdmmchost_cd_callback_t )(bool isInserted, void *userData)
 card detect callback definition
 
typedef void(* sdmmchost_pwr_t )(void)
 card power control function pointer
 
typedef void(* sdmmchost_card_int_callback_t )(void *userData)
 card interrupt function pointer
 
typedef void(* sdmmchost_card_switch_voltage_t )(void)
 card switch voltage function pointer
 
typedef sdmmhostcard_usr_param_t sdcard_usr_param_t
 @ brief specifiy card user parameter name
 

Enumerations

enum  _host_capability
 USDHC host capability.
 
enum  _sdmmchost_endian_mode {
  kSDMMCHOST_EndianModeBig = 0U,
  kSDMMCHOST_EndianModeHalfWordBig = 1U,
  kSDMMCHOST_EndianModeLittle = 2U
}
 host Endian mode corresponding to driver define More...
 
enum  sdmmchost_detect_card_type_t {
  kSDMMCHOST_DetectCardByGpioCD,
  kSDMMCHOST_DetectCardByHostCD,
  kSDMMCHOST_DetectCardByHostDATA3
}
 sd card detect type More...
 

adaptor function

static status_t SDMMCHOST_NotSupport (void *parameter)
 host not support function, this function is used for host not support feature More...
 
status_t SDMMCHOST_WaitCardDetectStatus (SDMMCHOST_TYPE *hostBase, const sdmmchost_detect_card_t *cd, bool waitCardStatus)
 Detect card insert, only need for SD cases. More...
 
bool SDMMCHOST_IsCardPresent (void)
 check card is present or not. More...
 
status_t SDMMCHOST_Init (SDMMCHOST_CONFIG *host, void *userData)
 Init host controller. More...
 
void SDMMCHOST_Reset (SDMMCHOST_TYPE *base)
 reset host controller. More...
 
void SDMMCHOST_ErrorRecovery (SDMMCHOST_TYPE *base)
 host controller error recovery. More...
 
void SDMMCHOST_Deinit (void *host)
 Deinit host controller. More...
 
void SDMMCHOST_PowerOffCard (SDMMCHOST_TYPE *base, const sdmmchost_pwr_card_t *pwr)
 host power off card function. More...
 
void SDMMCHOST_PowerOnCard (SDMMCHOST_TYPE *base, const sdmmchost_pwr_card_t *pwr)
 host power on card function. More...
 
void SDMMCHOST_Delay (uint32_t milliseconds)
 SDMMC host delay function. More...
 
status_t SDMMCHOST_ReceiveTuningBlock (SDMMCHOST_TYPE *base, uint32_t tuningCmd, uint32_t *revBuf, uint32_t size)
 SDMMC host receive tuning block. More...
 

Data Structure Documentation

struct sdmmchost_detect_card_t

Data Fields

sdmmchost_detect_card_type_t cdType
 card detect type
 
uint32_t cdTimeOut_ms
 
                  card detect timeout which allow 0 - 0xFFFFFFF, value 0 will return immediately, value

0xFFFFFFFF will block until card is insert

 
sdmmchost_cd_callback_t cardInserted
 card inserted callback which is meaningful for interrupt case
 
sdmmchost_cd_callback_t cardRemoved
 card removed callback which is meaningful for interrupt case
 
void * userData
 user data
 
struct sdmmchost_pwr_card_t

Data Fields

sdmmchost_pwr_t powerOn
 power on function pointer
 
uint32_t powerOnDelay_ms
 power on delay
 
sdmmchost_pwr_t powerOff
 power off function pointer
 
uint32_t powerOffDelay_ms
 power off delay
 
struct sdmmchost_card_int_t

Data Fields

void * userData
 user data
 
sdmmchost_card_int_callback_t cardInterrupt
 card int call back
 
struct sdmmchost_card_switch_voltage_func_t

Data Fields

sdmmchost_card_switch_voltage_t cardSignalLine1V8
 switch to 1.8v function pointer
 
sdmmchost_card_switch_voltage_t cardSignalLine3V3
 switch to 3.3V function pointer
 
struct sdmmhostcard_usr_param_t

Data Fields

const sdmmchost_detect_card_tcd
 card detect type
 
const sdmmchost_pwr_card_tpwr
 power control configuration
 
const sdmmchost_card_int_tcardInt
 call back function for card interrupt
 
const
sdmmchost_card_switch_voltage_func_t
cardVoltage
 card voltage switch function
 

Macro Definition Documentation

#define FSL_SDMMC_HOST_ADAPTER_VERSION   (MAKE_VERSION(2U, 2U, 14U)) /*2.2.14*/

Enumeration Type Documentation

Enumerator
kSDMMCHOST_EndianModeBig 

Big endian mode.

kSDMMCHOST_EndianModeHalfWordBig 

Half word big endian mode.

kSDMMCHOST_EndianModeLittle 

Little endian mode.

Enumerator
kSDMMCHOST_DetectCardByGpioCD 

sd card detect by CD pin through GPIO

kSDMMCHOST_DetectCardByHostCD 

sd card detect by CD pin through host

kSDMMCHOST_DetectCardByHostDATA3 

sd card detect by DAT3 pin through host

Function Documentation

static status_t SDMMCHOST_NotSupport ( void *  parameter)
inlinestatic
Parameters
voidparameter ,used to avoid build warning
Return values
kStatus_Fail,hostdo not suppport
status_t SDMMCHOST_WaitCardDetectStatus ( SDMMCHOST_TYPE *  hostBase,
const sdmmchost_detect_card_t cd,
bool  waitCardStatus 
)
Parameters
basethe pointer to host base address
cdcard detect configuration
waitCardStatusstatus which user want to wait
Return values
kStatus_Successdetect card insert
kStatus_Failcard insert event fail
bool SDMMCHOST_IsCardPresent ( void  )
Return values
truecard is present
falsecard is not present
status_t SDMMCHOST_Init ( SDMMCHOST_CONFIG *  host,
void *  userData 
)
Parameters
hostthe pointer to host structure in card structure.
userDataspecific user data
Return values
kStatus_Successhost init success
kStatus_Failevent fail
void SDMMCHOST_Reset ( SDMMCHOST_TYPE *  base)
Parameters
hostbase address.
void SDMMCHOST_ErrorRecovery ( SDMMCHOST_TYPE *  base)
Parameters
hostbase address.
void SDMMCHOST_Deinit ( void *  host)
Parameters
hostthe pointer to host structure in card structure.
void SDMMCHOST_PowerOffCard ( SDMMCHOST_TYPE *  base,
const sdmmchost_pwr_card_t pwr 
)
Parameters
basehost base address.
pwrdepend on user define power configuration.
void SDMMCHOST_PowerOnCard ( SDMMCHOST_TYPE *  base,
const sdmmchost_pwr_card_t pwr 
)
Parameters
basehost base address.
pwrdepend on user define power configuration.
void SDMMCHOST_Delay ( uint32_t  milliseconds)
Parameters
millisecondsdelay counter.
status_t SDMMCHOST_ReceiveTuningBlock ( SDMMCHOST_TYPE *  base,
uint32_t  tuningCmd,
uint32_t *  revBuf,
uint32_t  size 
)
Parameters
basehost base address.
tuningCmd,tuningcmd.
revBufbuffer to receive data.
sizedata size to receive.