📄 csl_mmcsd.h
字号:
/** @mainpage MMC/SD/SDIO Host Controller** @section Introduction** @subsection xxx Purpose and Scope* The purpose of this document is to identify a set of common CSL APIs for the* MMC/SD/SDIO Host Controller Module across various devices. The CSL developer* is expected to refer to this document while designing APIs for these modules* . Some of the listed APIs may not be applicable to a given MMC/SD/SDIO Host* Controller Module. While in other cases this list of APIs may not be* sufficient to cover all the features of a particular MMC/SD/SDIO Host* Controller Module. The CSL developer should use his discretion in designing* new APIs or extending the existing ones to cover these.*** @subsection aaa Terms and Abbreviations* -# CSL: Chip Support Library* -# API: Application Programmer Interface* -# MMC: Multi Media Card* -# SD: Secure Digital* -# SDIO: Secure Digital Input/Output** @subsection References* -# CSL 3.x Technical Requirements Specifications Version 0.5, dated* May 14th, 2003* -# MMC/SD/SDIO Host Controller Specification Version 1.5, dated April* 1st, 2003: http://dspdesign.india.ti.com/twiki/pub/Trinity/MMCSDSDIOInterface/WMU_020_2_v1.5.pdf* -# The Multi Media Card System Specification Version 3.2, dated January,* 2002* -# SD Memory Card Specification, Part 1, Physical Layer Specification* Version 1.0, dated March, 2000* -# SD Memory Card Specification, Part E1, Secure Digital Input/Output* (SDIO) Card Specification Version 1.0, dated October, 2001* -# SD Memory Card Specification, Part 3, Security Specification Version* 1.0, dated February, 2000** @subsection Assumptions* The abbreviations MMCSD, mmcsd and Mmcsd have been used throughout this* document to refer to the MMC/SD/SDIO Host Controller Module*//** @file csl_mmcsd.h * * @brief Header file for functional layer of CSL * * Description * - The different enumerations, structure definitions * and function declarations * * Modification 1 * - modified on: 15/12/2003 * - reason: created the sources * * Modification 2 * - modified on: 17/12/2003 * - reason: created better documentation * * Modification 3 * - modified on: 12/02/2004 * - reason: modified according to review comments * * @date 15th Dec, 2003 * @author Sumant S. NaikKhanvte */#ifndef _CSL_MMCSD_H_#define _CSL_MMCSD_H_#ifdef __cplusplusextern "C" {#endif#include <csl.h>#include <cslr_mmcsd.h>/**************************************************************************\* MMCSD global macro declarations\**************************************************************************//**************************************************************************\* MMCSD global typedef declarations\**************************************************************************//** @brief Enumeration for control commands passed to @a CSL_mmcsdHwControl() * * This is the set of commands that are passed to the @a CSL_mmcsdHwControl() * with an optional argument type-casted to @a void* . The arguments to be * passed with each enumeration if any are specified next to the enumeration */typedef enum { /** reset the MMCSD : no argument */ CSL_MMCSD_CMD_RESET = 1, /** power down the MMCSD : no argument */ CSL_MMCSD_CMD_POWER_UP, /** power up the MMCSD : no argument */ CSL_MMCSD_CMD_POWER_DOWN, /** send the initialization sequence necessary at the start : no * argument */ CSL_MMCSD_CMD_INITSEQ_SEND, /** read from the data FIFO : argument : @a CSL_MmcsdData* */ CSL_MMCSD_CMD_READ, /** write into the data FIFO : argument : @a CSL_MmcsdData* */ CSL_MMCSD_CMD_WRITE, /** send command to the card : argument : @a CSL_MmcsdCmd* */ CSL_MMCSD_CMD_CMD_SEND, /** set the bus width : argument : @a CSL_MmcsdBusWidth* */ CSL_MMCSD_CMD_SD_BUSWIDTH_SET, /** set the size of blocks to transfer : argument : @a Uint16* */ CSL_MMCSD_CMD_BLKSIZE_SET, /** set the number of blocks to transfer : argument : @a Uint16* */ CSL_MMCSD_CMD_NUMBLKS_SET, /** initiate suspend in SDIO mode with following command : no argument */ CSL_MMCSD_CMD_SDIO_SR_SUSPEND, /** resume suspended function in SDIO mode with following command : no * argument */ CSL_MMCSD_CMD_SDIO_SR_RESUME, /** request read-wait in SDIO mode : no argument */ CSL_MMCSD_CMD_SDIO_RW_REQ, /** clear read-wait in SDIO mode : no argument */ CSL_MMCSD_CMD_SDIO_RW_CLEAR, /** Clear the interrupt status : argument : @a Uint16* */ CSL_MMCSD_CMD_EVT_CLEAR, /** Enable the interrupts : argument : @a Uint16* */ CSL_MMCSD_CMD_INT_ENABLE, /** Disable the interrupts : argument : @a Uint16* */ CSL_MMCSD_CMD_INT_DISABLE, /** Enable the dma : argument : @a Uint16* */ CSL_MMCSD_CMD_DMA_ENABLE, /** Disable the dma : argument : @a Uint16* */ CSL_MMCSD_CMD_DMA_DISABLE, /** stop action of core to generate events for data; for SR in SDIO mode * : no argument */ CSL_MMCSD_CMD_SDIO_CORE_STOP, /** enable the FIFO to be read back in case of SR in SDIO mode : no * argument */ CSL_MMCSD_CMD_SDIO_FIFO_SAVE} CSL_MmcsdHwControlCmd;/** @brief Enumeration for queries passed to @a CSL_mmcsdGetHwStatus() * * This is used to get the status of different operations or to get the * existing setup of MMCSD. The arguments to be passed with each enumeration * if any are specified next to the enumeration */typedef enum { /** get the revision number of MMC spec supported : no argument */ CSL_MMCSD_QUERY_REVISION = 1, /** get the status of MMCSD reset : no argument */ CSL_MMCSD_QUERY_RESET_STATUS, /** get the power status : argument : @a CSL_MmcsdPwrStat* */ CSL_MMCSD_QUERY_POWER_STATUS, /** get the command last sent : argument : @a CSL_MmcsdCmd* */ CSL_MMCSD_QUERY_CMDSENT, /** get the response to the command last sent : argument : * @a CSL_MmcsdResponse* */ CSL_MMCSD_QUERY_RESPONSE, /** get the bus width of the data bus : argument : @a CSL_MmcsdBusWidth* */ CSL_MMCSD_QUERY_SD_BUSWIDTH, /** get the number of blocks left to transmit : argument : @a Uint16* */ CSL_MMCSD_QUERY_NUMBLKS, /** get the interrupt status : argument : @a Uint16* */ CSL_MMCSD_QUERY_EVT_STATUS, /** get the interrupts enabled : argument : @a Uint16* */ CSL_MMCSD_QUERY_INT_ENABLED, /** get the dma channels enabled : argument : @a Uint16* */ CSL_MMCSD_QUERY_DMA_ENABLED} CSL_MmcsdHwStatusQuery;/** @brief Enumeration for revision of RTL */typedef enum { /** MMCSD revision 3.0 */ CSL_MMCSD_REVISION_3_0 = CSL_MMCSD_REV_REV_REV30, /** MMCSD revision 3.1 */ CSL_MMCSD_REVISION_3_1 = CSL_MMCSD_REV_REV_REV31, /** MMCSD revision 3.4 */ CSL_MMCSD_REVISION_3_4 = CSL_MMCSD_REV_REV_REV34} CSL_MmcsdRevision;/** @brief Enumeration for reset states */typedef enum { /** MMCSD is in reset */ CSL_MMCSD_RESETSTAT_IN = CSL_MMCSD_SYSS_SRST_ON, /** MMCSD is out of reset */ CSL_MMCSD_RESETSTAT_OUT = CSL_MMCSD_SYSS_SRST_DONE} CSL_MmcsdResetStat;/** @brief Enumeration for power states */typedef enum { /** MMCSD is powered up */ CSL_MMCSD_PWRSTAT_UP = CSL_MMCSD_CON_POWER_UP, /** MMCSD is powered down */ CSL_MMCSD_PWRSTAT_DN = CSL_MMCSD_CON_POWER_DOWN} CSL_MmcsdPwrStat;/** @brief Enumeration for MMCSD bus widths */typedef enum { /** Bus width of MMCSD is 1 */ CSL_MMCSD_BUSWIDTH_1BIT = CSL_MMCSD_CON_DW_ONEBIT, /** Bus width of MMCSD is 4 */ CSL_MMCSD_BUSWIDTH_4BIT = CSL_MMCSD_CON_DW_FOURBIT} CSL_MmcsdBusWidth;/** @brief Enumeration for MMCSD protocol commands * * This is the set of commands that are to be passed to the MMC, SD * or SDIO cards. Each member of the enumeration takes the value that * the @a CMD register takes for each of the commands. Each command is * available with it's subscript as well as with the name given in the * MMC/SD/SDIO specification. Some exceptions to this naming scheme are * multiple versions of the command by subscripts as necessitated by the * way the commands are implemented*/typedef enum { /** same as @a CSL_MMCSD_CMDTYPE_GO_IDLE_STATE */ CSL_MMCSD_CMDTYPE_CMD0 = (int) (CSL_FMKT(MMCSD_CMD_TYPE, BC) | CSL_FMKT(MMCSD_CMD_ODTO, PP) | CSL_FMK(MMCSD_CMD_INDX, 0)), /** resets all cards to idle state */ CSL_MMCSD_CMDTYPE_GO_IDLE_STATE = (int) (CSL_MMCSD_CMDTYPE_CMD0), /** same as @a CSL_MMCSD_CMDTYPE_SEND_OP_COND */ CSL_MMCSD_CMDTYPE_CMD1 = (int) (CSL_FMKT(MMCSD_CMD_TYPE, BCR) | CSL_FMKT(MMCSD_CMD_RSP, R3) | CSL_FMK(MMCSD_CMD_INDX, 1) | CSL_FMKT(MMCSD_CMD_ODTO, OD) | CSL_FMK(MMCSD_CMD_INDX, 1)), /** asks all cards in idle state to send their operation conditions * register contents in the response on the CMD line */ CSL_MMCSD_CMDTYPE_SEND_OP_COND = (int) (CSL_MMCSD_CMDTYPE_CMD1), /** same as @a CSL_MMCSD_CMDTYPE_ALL_SEND_CID */ CSL_MMCSD_CMDTYPE_CMD2 = (int) (CSL_FMKT(MMCSD_CMD_TYPE, BCR) | CSL_FMKT(MMCSD_CMD_RSP, R2) | CSL_FMKT(MMCSD_CMD_BUSY, NO) | CSL_FMKT(MMCSD_CMD_ODTO, OD) | CSL_FMK(MMCSD_CMD_INDX, 2)), /** asks all cards to send their CID numbers on the CMD line */ CSL_MMCSD_CMDTYPE_ALL_SEND_CID = (int) (CSL_MMCSD_CMDTYPE_CMD2), /** same as @a CSL_MMCSD_CMDTYPE_SD_ALL_SEND_CID */ CSL_MMCSD_CMDTYPE_SD_CMD2 = (int) (CSL_FMKT(MMCSD_CMD_TYPE, BCR) | CSL_FMKT(MMCSD_CMD_RSP, R2) | CSL_FMKT(MMCSD_CMD_BUSY, NO) | CSL_FMKT(MMCSD_CMD_ODTO, PP) | CSL_FMK(MMCSD_CMD_INDX, 2)), /** asks all cards to send their CID numbers on the CMD line */ CSL_MMCSD_CMDTYPE_SD_ALL_SEND_CID = (int) (CSL_MMCSD_CMDTYPE_SD_CMD2), /** same as @a CSL_MMCSD_CMDTYPE_SET_RELATIVE_ADDR */ CSL_MMCSD_CMDTYPE_CMD3 = (int) (CSL_FMKT(MMCSD_CMD_TYPE, AC) | CSL_FMKT(MMCSD_CMD_RSP, R1) | CSL_FMKT(MMCSD_CMD_BUSY, NO) | CSL_FMKT(MMCSD_CMD_ODTO, OD) | CSL_FMK(MMCSD_CMD_INDX, 3)), /** assigns relative address to the card */ CSL_MMCSD_CMDTYPE_SET_RELATIVE_ADDR = (int) (CSL_MMCSD_CMDTYPE_CMD3), /** same as @a CSL_MMCSD_CMDTYPE_SD_SET_RELATIVE_ADDR */ CSL_MMCSD_CMDTYPE_SD_CMD3 = (int) (CSL_FMKT(MMCSD_CMD_TYPE, BCR) | CSL_FMKT(MMCSD_CMD_RSP, R6) | CSL_FMKT(MMCSD_CMD_BUSY, NO) | CSL_FMKT(MMCSD_CMD_ODTO, PP) | CSL_FMK(MMCSD_CMD_INDX, 3)), /** assigns relative address to the card */ CSL_MMCSD_CMDTYPE_SD_SET_RELATIVE_ADDR = (int) (CSL_MMCSD_CMDTYPE_SD_CMD3), /** same as @a CSL_MMCSD_CMDTYPE_SET_DSR */ CSL_MMCSD_CMDTYPE_CMD4 = (int) (CSL_FMKT(MMCSD_CMD_TYPE, BC) | CSL_FMKT(MMCSD_CMD_ODTO, PP) | CSL_FMK(MMCSD_CMD_INDX, 4)), /** programs the DSR of all cards */ CSL_MMCSD_CMDTYPE_SET_DSR = (int) (CSL_MMCSD_CMDTYPE_CMD4), /** same as @a CSL_MMCSD_CMDTYPE_IO_SEND_OP_COND_CTO */ CSL_MMCSD_CMDTYPE_CMD5_CTO = (int) (CSL_FMKT(MMCSD_CMD_TYPE, BCR) | CSL_FMKT(MMCSD_CMD_RSP, R4) | CSL_FMKT(MMCSD_CMD_BUSY, NO) | CSL_FMKT(MMCSD_CMD_ODTO, CTO) | CSL_FMK(MMCSD_CMD_INDX, 5)), /** used to enquire the voltage range needed by the I/O card. * Timeout equals command timeout */ CSL_MMCSD_CMDTYPE_IO_SEND_OP_COND_CTO = (int) (CSL_MMCSD_CMDTYPE_CMD5_CTO), /** same as @a CSL_MMCSD_CMDTYPE_IO_SEND_OP_COND_DTO */ CSL_MMCSD_CMDTYPE_CMD5_DTO = (int) (CSL_FMKT(MMCSD_CMD_TYPE, BCR) | CSL_FMKT(MMCSD_CMD_RSP, R4) | CSL_FMKT(MMCSD_CMD_BUSY, NO) | CSL_FMKT(MMCSD_CMD_ODTO, DTO) | CSL_FMK(MMCSD_CMD_INDX, 5)), /** used to enquire the voltage range needed by the I/O card. * Timeout equals data timeout */ CSL_MMCSD_CMDTYPE_IO_SEND_OP_COND_DTO = (int) (CSL_MMCSD_CMDTYPE_CMD5_DTO), /** same as @a CSL_MMCSD_CMDTYPE_SD_SET_BUS_WIDTH */ CSL_MMCSD_CMDTYPE_SD_ACMD6 = (int) (CSL_FMKT(MMCSD_CMD_TYPE, AC) | CSL_FMKT(MMCSD_CMD_RSP, R1) | CSL_FMKT(MMCSD_CMD_BUSY, NO) | CSL_FMKT(MMCSD_CMD_ODTO, PP) | CSL_FMK(MMCSD_CMD_INDX, 6)), /** Defines the data bus width (
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -