1 #include "asm/arch/sci_types.h"
3 #ifndef __SD_SDIO_20_H__
4 #define __SD_SDIO_20_H__
7 typedef struct CARD_PORT_TAG* CARD_SDIO_HANDLE;
9 /*****************************************************************************/
10 // Description: Get Card operation handle,after we get the handle ,we can get next operation way of card
13 // host_slot: slot number
18 /*****************************************************************************/
41 typedef enum CARD_EMMC_PARTITION_TPYE_TAG
52 }CARD_EMMC_PARTITION_TPYE;
54 PUBLIC uint32 Emmc_GetCapacity(CARD_EMMC_PARTITION_TPYE cardPartiton);
57 PUBLIC CARD_SDIO_HANDLE CARD_SDIO_Open(CARD_SDIO_SLOT_NO slotNo);
58 /*****************************************************************************/
59 // Description: close operation handle of card. afer we free it ,other application can operate on this card
62 // cardHandle: the handle returned by CARD_SDIO_Open
66 /*****************************************************************************/
67 PUBLIC void CARD_SDIO_Close(CARD_SDIO_HANDLE cardHandle);
68 /*****************************************************************************/
69 // Description: Turn on or turn off the card
72 // cardHandle: the handle returned by CARD_SDIO_Open
73 // switchCtl: TRUE, turn on the card ,FALSE, turn off the card
77 /*****************************************************************************/
78 PUBLIC void CARD_SDIO_PwrCtl(CARD_SDIO_HANDLE cardHandle,BOOLEAN switchCtl);
79 /*****************************************************************************/
80 // Description: Initialize card, change card from idle state to standy by state ,and get some information from card
83 // cardHandle: the handle returned by CARD_SDIO_Open
84 // speedmode: HighSpeed mode or normal speed mode
89 /*****************************************************************************/
90 PUBLIC BOOLEAN CARD_SDIO_InitCard(CARD_SDIO_HANDLE cardHandle, CARD_SPEED_MODE speedmode);
91 /*****************************************************************************/
92 // Description: Set block length of card. the data will be transmited in block unit
95 // cardHandle: the handle returned by CARD_SDIO_Open
96 // length: block length
101 /*****************************************************************************/
102 PUBLIC BOOLEAN CARD_SDIO_SetBlockLength(CARD_SDIO_HANDLE cardHandle,uint32 length);
103 /*****************************************************************************/
104 // Description: Read single block data from card , unit is block
107 // cardHandle: the handle returned by CARD_SDIO_Open
108 // BlockId: block number that you want to read
109 // buf : that data read from card will be stored in this place
114 /*****************************************************************************/
115 PUBLIC BOOLEAN CARD_SDIO_ReadSingleBlock(CARD_EMMC_PARTITION_TPYE cardPartiton, CARD_SDIO_HANDLE cardHandle,uint32 BlockId,uint8* buf);
116 /*****************************************************************************/
117 // Description: Read multi block data from card , unit is block
120 // cardHandle: the handle returned by CARD_SDIO_Open
121 // startBlock: start block number that you want to read
122 // num: the number of block you want to read
123 // buf : that data read from card will be stored in this place
128 /*****************************************************************************/
129 PUBLIC BOOLEAN CARD_SDIO_ReadMultiBlock(CARD_EMMC_PARTITION_TPYE cardPartiton, CARD_SDIO_HANDLE cardHandle,uint32 startBlock,uint32 num,uint8* buf);
130 /*****************************************************************************/
131 // Description: Wrtie single block data to card , unit is block
134 // cardHandle: the handle returned by CARD_SDIO_Open
135 // BlockId: block number that you want to write
136 // buf : that data to be writen to card is stored in this place
141 /*****************************************************************************/
142 PUBLIC BOOLEAN CARD_SDIO_WriteSingleBlock(CARD_EMMC_PARTITION_TPYE cardPartiton, CARD_SDIO_HANDLE cardHandle,uint32 BlockId,uint8* buf);
143 /*****************************************************************************/
144 // Description: Wrtie multi block data to card , unit is block
147 // cardHandle: the handle returned by CARD_SDIO_Open
148 // startBlock: start block number that you want to write
149 // num: the number of block you want to write
150 // buf : the data to be writen to card is stored in this place
155 /*****************************************************************************/
156 PUBLIC BOOLEAN CARD_SDIO_WriteMultiBlock(CARD_EMMC_PARTITION_TPYE cardPartiton, CARD_SDIO_HANDLE cardHandle,uint32 startBlock,uint32 num,uint8* buf);
157 /*****************************************************************************/
158 // Description: erase card
161 // cardHandle: the handle returned by CARD_SDIO_Open
162 // startBlock: start block number that you want to erase
163 // endBlock : end block number that you want to erase
168 /*****************************************************************************/
169 PUBLIC BOOLEAN CARD_SDIO_Erase(CARD_SDIO_HANDLE cardHandle,uint32 startBlock,uint32 endBlock);
170 /*****************************************************************************/
171 // Description: Get total block number of card ,block length is fix to 512 byte
174 // cardHandle: the handle returned by CARD_SDIO_Open
176 // uint32 value : total block num
178 /*****************************************************************************/
179 PUBLIC uint32 CARD_SDIO_GetCapacity(CARD_SDIO_HANDLE cardHandle);
181 PUBLIC BOOLEAN CARD_SDIO_EnterMcex(CARD_SDIO_HANDLE cardHandle,BOOLEAN* ifEnterMcex );
183 PUBLIC BOOLEAN CARD_SDIO_SendPsi(CARD_SDIO_HANDLE cardHandle,uint32 arg,uint8* buf);
185 PUBLIC BOOLEAN CARD_SDIO_ReadSecCmd(CARD_SDIO_HANDLE cardHandle,uint8* buf);
187 PUBLIC BOOLEAN CARD_SDIO_WriteSecCmd(CARD_SDIO_HANDLE cardHandle,uint8* buf);
189 PUBLIC BOOLEAN CARD_SDIO_CtlTrm(CARD_SDIO_HANDLE cardHandle);
191 PUBLIC BOOLEAN CARD_SDIO_ExitMcex(CARD_SDIO_HANDLE cardHandle);
193 PUBLIC BOOLEAN CARD_SDIO_IsEnterHighSpeed(CARD_SDIO_HANDLE cardHandle);
195 PUBLIC BOOLEAN Emmc_Init(void);
197 PUBLIC BOOLEAN Emmc_Write(CARD_EMMC_PARTITION_TPYE cardPartiton, uint32 startBlock,uint32 num,uint8* buf);
199 PUBLIC BOOLEAN Emmc_Erase(CARD_EMMC_PARTITION_TPYE cardPartiton, uint32 startBlock,uint32 num);
201 PUBLIC BOOLEAN Emmc_Read(CARD_EMMC_PARTITION_TPYE cardPartiton, uint32 startBlock,uint32 num,uint8* buf);
203 PUBLIC uint32 Emmc_GetCapacity(CARD_EMMC_PARTITION_TPYE cardPartiton);
205 PUBLIC void Emmc_DisSdClk();