AM62Px MCU+ SDK  10.01.00

Introduction

This module contains APIs to program and use the MMCSD module. The APIs can be used by other drivers to get access to MMCSD and also by application to initiate data transfer operation.

Files

file  mmcsd/v0/mmcsd.h
 MMCSD Driver API/interface file.
 

Data Structures

struct  MMCSD_Params
 MMCSD instance attributes - used during init time. More...
 
struct  MMCSD_EmmcDeviceData
 eMMC device properties More...
 
struct  MMCSD_SdDeviceData
 SD device properties. More...
 
struct  MMCSD_Transaction
 MMCSD transaction. More...
 
struct  MMCSD_Attrs
 MMCSD instance attributes - used during init time. More...
 
struct  MMCSD_Object
 MMCSD driver object. More...
 
struct  MMCSD_Config
 
struct  MMCSD_TuningPassOrFailWindow
 

Functions

void MMCSD_init (void)
 This function initializes the MMCSD module. More...
 
void MMCSD_deinit (void)
 This function de-initializes the MMCSD module. More...
 
void MMCSD_Params_init (MMCSD_Params *mmcsdParams)
 Initialize data structure with defaults. More...
 
MMCSD_Handle MMCSD_open (uint32_t index, const MMCSD_Params *openParams)
 This function opens a given MMCSD peripheral. More...
 
void MMCSD_close (MMCSD_Handle handle)
 Function to close a MMCSD peripheral specified by the MMCSD handle. More...
 
MMCSD_Handle MMCSD_getHandle (uint32_t index)
 This function returns the handle of an open MMCSD Instance from the instance index. More...
 
int32_t MMCSD_read (MMCSD_Handle handle, uint8_t *buf, uint32_t startBlk, uint32_t numBlks)
 Function to perform block reads from the MMC/SD media. More...
 
int32_t MMCSD_write (MMCSD_Handle handle, uint8_t *buf, uint32_t startBlk, uint32_t numBlks)
 Function to perform block writes to the MMC/SD media. More...
 
uint32_t MMCSD_getBlockSize (MMCSD_Handle handle)
 This function returns the block size of the MMC/SD media connected to the MMCSD controller. More...
 
uint32_t MMCSD_getBlockCount (MMCSD_Handle handle)
 This function returns the block count of User Data Area of the MMC/SD media connected to the MMCSD controller. More...
 
uint32_t MMCSD_isHC (MMCSD_Handle handle)
 This function returns if the media connected is High Capacity (> 2GB in size) or not. More...
 
int32_t MMCSD_enableBootPartition (MMCSD_Handle handle, uint32_t partitionNum)
 This function enables the boot partition if the connected media is eMMC. More...
 
int32_t MMCSD_disableBootPartition (MMCSD_Handle handle)
 This function disables the boot partition if the connected media is eMMC. More...
 
uint32_t MMCSD_getInputClk (MMCSD_Handle handle)
 This function returns the input clk frequency MMCSD was programmed at. More...
 

Typedefs

typedef void * MMCSD_Handle
 

Macros

#define MMCSD_CARD_TYPE_SD   (0U)
 
#define MMCSD_CARD_TYPE_EMMC   (1U)
 
#define MMCSD_CARD_TYPE_MMC   (2U)
 
#define MMCSD_CARD_TYPE_NO_DEVICE   (3U)
 
#define MMCSD_BUS_WIDTH_4BIT   (0x4U)
 
#define MMCSD_BUS_WIDTH_8BIT   (0x8U)
 
#define MMCSD_BUS_WIDTH_1BIT   (0x1U)
 
#define MMCSD_TRANSPEED_25MBPS   (0x32U)
 
#define MMCSD_TRANSPEED_50MBPS   (0x5AU)
 
#define MMCSD_TRANSPEED_DEFAULT   (0x32U)
 
#define MMCSD_TRANSPEED_HS   (0x5AU)
 
#define MMCSD_TRANSPEED_SDR12   (0x32U)
 
#define MMCSD_TRANSPEED_SDR25   (0x5AU)
 
#define MMCSD_TRANSPEED_SDR50   (0xBU)
 
#define MMCSD_TRANSPEED_SDR104   (0x2BU)
 
#define MMCSD_TRANSPEED_DDR50   (0x3BU)
 
#define MMCSD_TRANSPEED_HS200   (0x2BU)
 
#define MMCSD_TRANSPEED_HS400   (0x4BU)
 
#define MMCSD_BUS_VOLT_1_8V   (0x5U) /* Embedded */
 
#define MMCSD_BUS_VOLT_3_0V   (0x6U) /* Typical */
 
#define MMCSD_BUS_VOLT_3_3V   (0x7U) /* Flattop */
 
#define MMCSD_CMD_TYPE_NORMAL   (0U)
 
#define MMCSD_CMD_TYPE_BUS_SUSPEND   (1U)
 
#define MMCSD_CMD_TYPE_FUNC_SEL   (2U)
 
#define MMCSD_CMD_TYPE_IO_ABORT   (3U)
 
#define MMCSD_CMD_RSP_TYPE_NORSP   (0U)
 
#define MMCSD_CMD_RSP_TYPE_L136   (1U)
 
#define MMCSD_CMD_RSP_TYPE_L48   (2U)
 
#define MMCSD_CMD_RSP_TYPE_L48_BUSY   (3U)
 
#define MMCSD_CMD_XFER_TYPE_WRITE   (0U)
 
#define MMCSD_CMD_XFER_TYPE_READ   (1U)
 
#define MMCSD_SUPPORT_MMC_DS   (0x01U) /* DS (Up to 26Mhz) */
 
#define MMCSD_SUPPORT_MMC_HS_SDR   (0x02U) /* HS (Up to 52Mhz) */
 
#define MMCSD_SUPPORT_MMC_HS_DDR   (0x04U) /* HS (Up to 52Mhz) */
 
#define MMCSD_SUPPORT_MMC_HS200   (0x08U) /* HS200 (Up to 200Mhz) */
 
#define MMCSD_SUPPORT_MMC_HS400   (0x10U) /* HS400 (Up to 400Mhz) */
 
#define MMCSD_SUPPORT_MMC_ALL   (0xFFU) /* All modes */
 
#define MMCSD_SUPPORT_SD_DS   (0x01U)
 
#define MMCSD_SUPPORT_SD_HS   (0x02U)
 
#define MMCSD_SUPPORT_SD_SDR50   (0x04U)
 
#define MMCSD_SUPPORT_SD_SDR104   (0x08U)
 
#define MMCSD_SUPPORT_SD_DDR50   (0x10U)
 
#define MMCSD_SUPPORT_SD_ALL   (0xFFU) /* All modes */
 
#define MMCSD_PHY_TYPE_HW_PHY   (0U)
 
#define MMCSD_PHY_TYPE_SW_PHY   (1U)
 
#define MMCSD_PHY_TYPE_NO_PHY   (2U)
 
#define MMCSD_PHY_TUNING_TYPE_AUTO   (0U)
 
#define MMCSD_PHY_TUNING_TYPE_MANUAL   (1U)
 
#define MMCSD_PHY_MODE_HS400   (1U)
 
#define MMCSD_PHY_MODE_HS200   (2U)
 
#define MMCSD_PHY_MODE_HSSDR50   (3U)
 
#define MMCSD_PHY_MODE_HSDDR50   (4U)
 
#define MMCSD_PHY_MODE_SDR104   (5U)
 
#define MMCSD_PHY_MODE_SDR50   (6U)
 
#define MMCSD_PHY_MODE_DDR50   (7U)
 
#define MMCSD_PHY_MODE_SDR25   (8U)
 
#define MMCSD_PHY_MODE_SDR12   (9U)
 
#define MMCSD_PHY_MODE_HS   (10U)
 
#define MMCSD_PHY_MODE_DS   (11U)
 
#define MMCSD_UHS_MODE_SDR12   (0U)
 
#define MMCSD_UHS_MODE_SDR25   (1U)
 
#define MMCSD_UHS_MODE_SDR50   (2U)
 
#define MMCSD_UHS_MODE_SDR104   (3U)
 
#define MMCSD_UHS_MODE_DDR50   (4U)
 
#define MMCSD_UHS_MODE_HS400   (5U)
 
#define MMCSD_UHS_MODE_UHS2   (7U)
 

Macro Definition Documentation

◆ MMCSD_CARD_TYPE_SD

#define MMCSD_CARD_TYPE_SD   (0U)

◆ MMCSD_CARD_TYPE_EMMC

#define MMCSD_CARD_TYPE_EMMC   (1U)

◆ MMCSD_CARD_TYPE_MMC

#define MMCSD_CARD_TYPE_MMC   (2U)

◆ MMCSD_CARD_TYPE_NO_DEVICE

#define MMCSD_CARD_TYPE_NO_DEVICE   (3U)

◆ MMCSD_BUS_WIDTH_4BIT

#define MMCSD_BUS_WIDTH_4BIT   (0x4U)

◆ MMCSD_BUS_WIDTH_8BIT

#define MMCSD_BUS_WIDTH_8BIT   (0x8U)

◆ MMCSD_BUS_WIDTH_1BIT

#define MMCSD_BUS_WIDTH_1BIT   (0x1U)

◆ MMCSD_TRANSPEED_25MBPS

#define MMCSD_TRANSPEED_25MBPS   (0x32U)

◆ MMCSD_TRANSPEED_50MBPS

#define MMCSD_TRANSPEED_50MBPS   (0x5AU)

◆ MMCSD_TRANSPEED_DEFAULT

#define MMCSD_TRANSPEED_DEFAULT   (0x32U)

◆ MMCSD_TRANSPEED_HS

#define MMCSD_TRANSPEED_HS   (0x5AU)

◆ MMCSD_TRANSPEED_SDR12

#define MMCSD_TRANSPEED_SDR12   (0x32U)

◆ MMCSD_TRANSPEED_SDR25

#define MMCSD_TRANSPEED_SDR25   (0x5AU)

◆ MMCSD_TRANSPEED_SDR50

#define MMCSD_TRANSPEED_SDR50   (0xBU)

◆ MMCSD_TRANSPEED_SDR104

#define MMCSD_TRANSPEED_SDR104   (0x2BU)

◆ MMCSD_TRANSPEED_DDR50

#define MMCSD_TRANSPEED_DDR50   (0x3BU)

◆ MMCSD_TRANSPEED_HS200

#define MMCSD_TRANSPEED_HS200   (0x2BU)

◆ MMCSD_TRANSPEED_HS400

#define MMCSD_TRANSPEED_HS400   (0x4BU)

◆ MMCSD_BUS_VOLT_1_8V

#define MMCSD_BUS_VOLT_1_8V   (0x5U) /* Embedded */

◆ MMCSD_BUS_VOLT_3_0V

#define MMCSD_BUS_VOLT_3_0V   (0x6U) /* Typical */

◆ MMCSD_BUS_VOLT_3_3V

#define MMCSD_BUS_VOLT_3_3V   (0x7U) /* Flattop */

◆ MMCSD_CMD_TYPE_NORMAL

#define MMCSD_CMD_TYPE_NORMAL   (0U)

◆ MMCSD_CMD_TYPE_BUS_SUSPEND

#define MMCSD_CMD_TYPE_BUS_SUSPEND   (1U)

◆ MMCSD_CMD_TYPE_FUNC_SEL

#define MMCSD_CMD_TYPE_FUNC_SEL   (2U)

◆ MMCSD_CMD_TYPE_IO_ABORT

#define MMCSD_CMD_TYPE_IO_ABORT   (3U)

◆ MMCSD_CMD_RSP_TYPE_NORSP

#define MMCSD_CMD_RSP_TYPE_NORSP   (0U)

◆ MMCSD_CMD_RSP_TYPE_L136

#define MMCSD_CMD_RSP_TYPE_L136   (1U)

◆ MMCSD_CMD_RSP_TYPE_L48

#define MMCSD_CMD_RSP_TYPE_L48   (2U)

◆ MMCSD_CMD_RSP_TYPE_L48_BUSY

#define MMCSD_CMD_RSP_TYPE_L48_BUSY   (3U)

◆ MMCSD_CMD_XFER_TYPE_WRITE

#define MMCSD_CMD_XFER_TYPE_WRITE   (0U)

◆ MMCSD_CMD_XFER_TYPE_READ

#define MMCSD_CMD_XFER_TYPE_READ   (1U)

◆ MMCSD_SUPPORT_MMC_DS

#define MMCSD_SUPPORT_MMC_DS   (0x01U) /* DS (Up to 26Mhz) */

◆ MMCSD_SUPPORT_MMC_HS_SDR

#define MMCSD_SUPPORT_MMC_HS_SDR   (0x02U) /* HS (Up to 52Mhz) */

◆ MMCSD_SUPPORT_MMC_HS_DDR

#define MMCSD_SUPPORT_MMC_HS_DDR   (0x04U) /* HS (Up to 52Mhz) */

◆ MMCSD_SUPPORT_MMC_HS200

#define MMCSD_SUPPORT_MMC_HS200   (0x08U) /* HS200 (Up to 200Mhz) */

◆ MMCSD_SUPPORT_MMC_HS400

#define MMCSD_SUPPORT_MMC_HS400   (0x10U) /* HS400 (Up to 400Mhz) */

◆ MMCSD_SUPPORT_MMC_ALL

#define MMCSD_SUPPORT_MMC_ALL   (0xFFU) /* All modes */

◆ MMCSD_SUPPORT_SD_DS

#define MMCSD_SUPPORT_SD_DS   (0x01U)

◆ MMCSD_SUPPORT_SD_HS

#define MMCSD_SUPPORT_SD_HS   (0x02U)

◆ MMCSD_SUPPORT_SD_SDR50

#define MMCSD_SUPPORT_SD_SDR50   (0x04U)

◆ MMCSD_SUPPORT_SD_SDR104

#define MMCSD_SUPPORT_SD_SDR104   (0x08U)

◆ MMCSD_SUPPORT_SD_DDR50

#define MMCSD_SUPPORT_SD_DDR50   (0x10U)

◆ MMCSD_SUPPORT_SD_ALL

#define MMCSD_SUPPORT_SD_ALL   (0xFFU) /* All modes */

◆ MMCSD_PHY_TYPE_HW_PHY

#define MMCSD_PHY_TYPE_HW_PHY   (0U)

◆ MMCSD_PHY_TYPE_SW_PHY

#define MMCSD_PHY_TYPE_SW_PHY   (1U)

◆ MMCSD_PHY_TYPE_NO_PHY

#define MMCSD_PHY_TYPE_NO_PHY   (2U)

◆ MMCSD_PHY_TUNING_TYPE_AUTO

#define MMCSD_PHY_TUNING_TYPE_AUTO   (0U)

◆ MMCSD_PHY_TUNING_TYPE_MANUAL

#define MMCSD_PHY_TUNING_TYPE_MANUAL   (1U)

◆ MMCSD_PHY_MODE_HS400

#define MMCSD_PHY_MODE_HS400   (1U)

◆ MMCSD_PHY_MODE_HS200

#define MMCSD_PHY_MODE_HS200   (2U)

◆ MMCSD_PHY_MODE_HSSDR50

#define MMCSD_PHY_MODE_HSSDR50   (3U)

◆ MMCSD_PHY_MODE_HSDDR50

#define MMCSD_PHY_MODE_HSDDR50   (4U)

◆ MMCSD_PHY_MODE_SDR104

#define MMCSD_PHY_MODE_SDR104   (5U)

◆ MMCSD_PHY_MODE_SDR50

#define MMCSD_PHY_MODE_SDR50   (6U)

◆ MMCSD_PHY_MODE_DDR50

#define MMCSD_PHY_MODE_DDR50   (7U)

◆ MMCSD_PHY_MODE_SDR25

#define MMCSD_PHY_MODE_SDR25   (8U)

◆ MMCSD_PHY_MODE_SDR12

#define MMCSD_PHY_MODE_SDR12   (9U)

◆ MMCSD_PHY_MODE_HS

#define MMCSD_PHY_MODE_HS   (10U)

◆ MMCSD_PHY_MODE_DS

#define MMCSD_PHY_MODE_DS   (11U)

◆ MMCSD_UHS_MODE_SDR12

#define MMCSD_UHS_MODE_SDR12   (0U)

◆ MMCSD_UHS_MODE_SDR25

#define MMCSD_UHS_MODE_SDR25   (1U)

◆ MMCSD_UHS_MODE_SDR50

#define MMCSD_UHS_MODE_SDR50   (2U)

◆ MMCSD_UHS_MODE_SDR104

#define MMCSD_UHS_MODE_SDR104   (3U)

◆ MMCSD_UHS_MODE_DDR50

#define MMCSD_UHS_MODE_DDR50   (4U)

◆ MMCSD_UHS_MODE_HS400

#define MMCSD_UHS_MODE_HS400   (5U)

◆ MMCSD_UHS_MODE_UHS2

#define MMCSD_UHS_MODE_UHS2   (7U)

Typedef Documentation

◆ MMCSD_Handle

typedef void* MMCSD_Handle

Function Documentation

◆ MMCSD_init()

void MMCSD_init ( void  )

This function initializes the MMCSD module.

◆ MMCSD_deinit()

void MMCSD_deinit ( void  )

This function de-initializes the MMCSD module.

◆ MMCSD_Params_init()

void MMCSD_Params_init ( MMCSD_Params mmcsdParams)

Initialize data structure with defaults.

Parameters
mmcsdParams[out] Initialized parameters

◆ MMCSD_open()

MMCSD_Handle MMCSD_open ( uint32_t  index,
const MMCSD_Params openParams 
)

This function opens a given MMCSD peripheral.

Precondition
MMCSD controller has been initialized using MMCSD_init()
Parameters
indexIndex of config to use in the MMCSD_Config array
openParamsPointer to parameters to open the driver with
Returns
A MMCSD_Handle on success or a NULL on an error or if it has been opened already
See also
MMCSD_init()
MMCSD_close()

◆ MMCSD_close()

void MMCSD_close ( MMCSD_Handle  handle)

Function to close a MMCSD peripheral specified by the MMCSD handle.

Precondition
MMCSD_open() has to be called first
Parameters
handleMMCSD_Handle returned from MMCSD_open()
See also
MMCSD_open()

◆ MMCSD_getHandle()

MMCSD_Handle MMCSD_getHandle ( uint32_t  index)

This function returns the handle of an open MMCSD Instance from the instance index.

Precondition
MMCSD controller has been opened using MMCSD_open()
Parameters
indexIndex of config to use in the MMCSD_Config array
Returns
An MMCSD_Handle if it has been opened already or NULL otherwise
See also
MMCSD_init()
MMCSD_open()

◆ MMCSD_read()

int32_t MMCSD_read ( MMCSD_Handle  handle,
uint8_t *  buf,
uint32_t  startBlk,
uint32_t  numBlks 
)

Function to perform block reads from the MMC/SD media.

Parameters
handleMMCSD_Handle returned from MMCSD_open()
bufPointer to a buffer to which the data is to be read into
startBlkBlock to start reading data from
numBlksNumber of blocks to read
Returns
SystemP_SUCCESS on successful read; else error on failure
See also
MMCSD_open

◆ MMCSD_write()

int32_t MMCSD_write ( MMCSD_Handle  handle,
uint8_t *  buf,
uint32_t  startBlk,
uint32_t  numBlks 
)

Function to perform block writes to the MMC/SD media.

Parameters
handleMMCSD_Handle returned from MMCSD_open()
bufPointer to a buffer to which the data is to be read into
startBlkBlock to start reading data from
numBlksNumber of blocks to read
Returns
SystemP_SUCCESS on successful read; else error on failure
See also
MMCSD_open

◆ MMCSD_getBlockSize()

uint32_t MMCSD_getBlockSize ( MMCSD_Handle  handle)

This function returns the block size of the MMC/SD media connected to the MMCSD controller.

Precondition
MMCSD controller has been opened using MMCSD_open()
Parameters
handleMMCSD_Handle returned from MMCSD_open()
Returns
Block size of the media
See also
MMCSD_init()
MMCSD_open()

◆ MMCSD_getBlockCount()

uint32_t MMCSD_getBlockCount ( MMCSD_Handle  handle)

This function returns the block count of User Data Area of the MMC/SD media connected to the MMCSD controller.

Precondition
MMCSD controller has been opened using MMCSD_open()
Parameters
handleMMCSD_Handle returned from MMCSD_open()
Returns
Block size of the media
See also
MMCSD_init()
MMCSD_open()

◆ MMCSD_isHC()

uint32_t MMCSD_isHC ( MMCSD_Handle  handle)

This function returns if the media connected is High Capacity (> 2GB in size) or not.

Precondition
MMCSD controller has been opened using MMCSD_open()
Parameters
handleMMCSD_Handle returned from MMCSD_open()
Returns
Block size of the media
See also
MMCSD_init()
MMCSD_open()

◆ MMCSD_enableBootPartition()

int32_t MMCSD_enableBootPartition ( MMCSD_Handle  handle,
uint32_t  partitionNum 
)

This function enables the boot partition if the connected media is eMMC.

Precondition
MMCSD controller has been opened using MMCSD_open()
Parameters
handleMMCSD_Handle returned from MMCSD_open()
partitionNumBoot partition to be enabled.
Returns
SystemP_SUCCESS on successful read; else error on failure
See also
MMCSD_init()
MMCSD_open()

◆ MMCSD_disableBootPartition()

int32_t MMCSD_disableBootPartition ( MMCSD_Handle  handle)

This function disables the boot partition if the connected media is eMMC.

Precondition
MMCSD controller has been opened using MMCSD_open()
Parameters
handleMMCSD_Handle returned from MMCSD_open()
Returns
SystemP_SUCCESS on successful read; else error on failure
See also
MMCSD_init()
MMCSD_open()

◆ MMCSD_getInputClk()

uint32_t MMCSD_getInputClk ( MMCSD_Handle  handle)

This function returns the input clk frequency MMCSD was programmed at.

Precondition
MMCSD controller has been opened using MMCSD_open()
Parameters
handleAn MMCSD_Handle returned from an MMCSD_open()
Returns
MMCSD CLK in Hertz

Variable Documentation

◆ gMmcsdConfig

MMCSD_Config gMmcsdConfig[]
extern

Externally defined driver configuration array.

◆ gMmcsdConfigNum

uint32_t gMmcsdConfigNum
extern

Externally defined driver configuration array size.