| Kinetis SDK API Reference Manual 1.0.0-beta Freescale Semiconductor, Inc.

- Introduction
- Related Pages
- API Usage

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Typedefs | Enumerations
SDHC Data Types
Secured Digital Host Controller (SDHC)

The section describes the SDHC Data Types. More...

## Data Structures
struct | sdhc_card_t
| SDHC Card Structure. More...
struct | sdhc_user_config_t
| SDHC Initialization Configuration Structure. More...
struct | sdhc_host_config_t
| SDHC Configure Structure. More...
struct | sdhc_host_t
| SDHC Host Device Structure. More...
struct | sdhc_data_t
| SDHC Data Structure. More...
struct | sdhc_command_t
| SDHC Command Structure. More...
struct | sdhc_request_t
| SDHC Request Structure. More...

## Typedefs
typedef void(* | request_done )(struct SdhcHostDevice *host, struct SdhcRequest *req)
| SDHC Request Done Callback.

## Enumerations
enum | sdhc_card_type_t { kCardTypeUnknown = 1, kCardTypeSDSC, kCardTypeSDHC, kCardTypeSDXC, kCardTypeMMC }
enum | sdhc_status_t { kStatus_SDHC_NoError = 0, kStatus_SDHC_WaitTimeoutError, kStatus_SDHC_IoError, kStatus_SDHC_CmdIoError, kStatus_SDHC_DataIoError, kStatus_SDHC_InvalidParameter, kStatus_SDHC_RequestFailed, kStatus_SDHC_SwitchFailed, kStatus_SDHC_NotSupportYet, kStatus_SDHC_TimeoutError, kStatus_SDHC_CardNotSupport, kStatus_SDHC_CmdError, kStatus_SDHC_DataError, kStatus_SDHC_Failed, kStatus_SDHC_NoMedium }
enum | sdhc_power_mode_t { kSdhcPowerModeRunning = 0, kSdhcPowerModeSuspended, kSdhcPowerModeStopped }

## Data Structure Documentation

struct sdhc_card_t

Defines the card structure including the necessary fields to identify and describe the card.

### Data Fields
struct SdhcHostDevice * | host
| Associated host.
uint32_t | version
| Card version.
uint32_t | rca
| RCA.
sdhc_card_type_t | cardType
| Card type.
uint32_t | flags
| Flags.
uint32_t | caps
| Capability.
uint32_t | busMode
| Data width.
uint32_t | rawCid [4]
| Raw CID.
uint32_t | rawCsd [4]
| Raw CSD.
uint32_t | rawScr [2]
| Raw SCR.
uint8_t * | rawExtCsd
| Raw EXT_CSD.
uint32_t | capacity
| Card total size.

struct sdhc_user_config_t

Defines the configuration data structure to initialize the SDHC.

### Data Fields
uint32_t | clock
| Clock rate.
uint32_t | busWidth
| Data bus width.
void(* | card_detect_callback )(void *param)
| Card detect callback function.

struct sdhc_host_config_t

SDHC Configuration Data Structure

### Data Fields
uint32_t | clock
| Clock rate.
sdhc_power_mode_t | powerMode
| Power supply mode.
uint32_t | busWidth
| Data bus width.

struct sdhc_host_t

Defines the Host device structure which includes both the static and the runtime SDHC information.

### Data Fields
uint8_t | instance
| Host instance index.
uint32_t | specVer
| Host specification version.
uint32_t | vendorVer
| Host vendor version.
sdhc_hal_endian_t | endian
| Endian mode the host's working at.
IRQn_Type | irq
| IRQ number.
uint32_t | flags
| Host flags.
uint32_t | busWidth
| Current busWidth.
uint32_t | caps
| Host capability.
uint32_t | ocr
uint32_t | ocrSupported
| Supported OCR.
uint32_t | clock
| Current clock frequency.
sdhc_power_mode_t | powerMode
| Current power mode.
uint32_t | maxClock
| Maximum clock supported.
uint32_t | maxBlockSize
| Maximum block size supported.
struct SdhcHostConfig | config
| Host configuration.
struct SdhcRequest * | currentReq
| Associated request.
struct SdhcCommand * | currentCmd
| Associated command.
struct SdhcData * | currentData
| Associated data.
struct SdhcCard * | card
| Associated card.
sync_object_t | host_lock
| Sync object.

struct sdhc_data_t

Defines the SDHC data structure including the block size/count and flags.

### Data Fields
struct SdhcRequest * | req
| Associated request.
struct SdhcCommand * | cmd
| Associated command.
uint32_t | blockSize
| Block size.
uint32_t | blockCount
| Block count.
uint32_t | flags
| Data flags.
uint32_t | error
| Data error code.
uint32_t | bytesTransferred
| Transferred buffer.
uint32_t | length
| Data length.
uint32_t * | buffer
| Data buffer.

struct sdhc_command_t

Defines the SDHC command structure including the command index, argument, flags, and response.

### Data Fields
struct SdhcRequest * | req
| Associated request.
struct SdhcData * | data
| Data associated with request.
uint32_t | index
| Command index.
uint32_t | argument
| Command argument.
uint32_t | flags
| Command flags.
uint32_t | response [4]
| Response for this command.
uint32_t | error
| Command error code.

struct sdhc_request_t

Defines the SDHC request structure. In most cases, it includes the related command and data and callback upon its completion.

### Data Fields
struct SdhcCommand * | cmd
| Command associated with the request.
struct SdhcData * | data
| Data associated with request.
sync_object_t | done
| Sync object.
request_done | onDone
| Callback on request done.

## Enumeration Type Documentation

enum sdhc_card_type_t

Enumerator
kCardTypeUnknown | Unknown card type.
kCardTypeSDSC | SDSC card type.
kCardTypeSDHC | SDHC card type.
kCardTypeSDXC | SDXC card type.
kCardTypeMMC | MMC card type.

enum sdhc_status_t

Enumerator
kStatus_SDHC_NoError | SDHC no error.
kStatus_SDHC_WaitTimeoutError | SDHC wait timeout error.
kStatus_SDHC_IoError | SDHC general IO error.
kStatus_SDHC_CmdIoError | SDHC CMD I/O error.
kStatus_SDHC_DataIoError | SDHC data I/O error.
kStatus_SDHC_InvalidParameter | SDHC invalid parameter.
kStatus_SDHC_RequestFailed | SDHC request failed.
kStatus_SDHC_SwitchFailed | SDHC switch failed.
kStatus_SDHC_NotSupportYet | SDHC not support.
kStatus_SDHC_TimeoutError | SDHC timeout error.
kStatus_SDHC_CardNotSupport | SDHC card does not support.
kStatus_SDHC_CmdError | SDHC CMD error.
kStatus_SDHC_DataError | SDHC data error.
kStatus_SDHC_Failed | SDHC general failed.
kStatus_SDHC_NoMedium | SDHC no medium error.

enum sdhc_power_mode_t

Enumerator
kSdhcPowerModeRunning | SDHC is running.
kSdhcPowerModeSuspended | SDHC is suspended.
kSdhcPowerModeStopped | SDHC is stopped.