0
|
1 |
/*
|
|
2 |
* sdiodrv.h
|
|
3 |
*
|
|
4 |
* Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.
|
|
5 |
* All rights reserved.
|
|
6 |
*
|
|
7 |
* This program and the accompanying materials are made available under the
|
|
8 |
* terms of the Eclipse Public License v1.0 or BSD License which accompanies
|
|
9 |
* this distribution. The Eclipse Public License is available at
|
|
10 |
* http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.
|
|
11 |
*
|
|
12 |
* Redistribution and use in source and binary forms, with or without
|
|
13 |
* modification, are permitted provided that the following conditions
|
|
14 |
* are met:
|
|
15 |
*
|
|
16 |
* * Redistributions of source code must retain the above copyright
|
|
17 |
* notice, this list of conditions and the following disclaimer.
|
|
18 |
* * Redistributions in binary form must reproduce the above copyright
|
|
19 |
* notice, this list of conditions and the following disclaimer in
|
|
20 |
* the documentation and/or other materials provided with the
|
|
21 |
* distribution.
|
|
22 |
* * Neither the name Texas Instruments nor the names of its
|
|
23 |
* contributors may be used to endorse or promote products derived
|
|
24 |
* from this software without specific prior written permission.
|
|
25 |
*
|
|
26 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
27 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
28 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
29 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
30 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
31 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
32 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
33 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
34 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
35 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
36 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
37 |
*/
|
|
38 |
|
|
39 |
|
|
40 |
#ifndef __OMAP2430_SDIODRV_API_H
|
|
41 |
#define __OMAP2430_SDIODRV_API_H
|
|
42 |
|
|
43 |
|
|
44 |
/* Card Common Control Registers (CCCR) */
|
|
45 |
|
|
46 |
#define CCCR_SDIO_REVISION 0x00
|
|
47 |
#define CCCR_SD_SPECIFICATION_REVISION 0x01
|
|
48 |
#define CCCR_IO_ENABLE 0x02
|
|
49 |
#define CCCR_IO_READY 0x03
|
|
50 |
#define CCCR_INT_ENABLE 0x04
|
|
51 |
#define CCCR_INT_PENDING 0x05
|
|
52 |
#define CCCR_IO_ABORT 0x06
|
|
53 |
#define CCCR_BUS_INTERFACE_CONTOROL 0x07
|
|
54 |
#define CCCR_CARD_CAPABILITY 0x08
|
|
55 |
#define CCCR_COMMON_CIS_POINTER 0x09 /*0x09-0x0B*/
|
|
56 |
#define CCCR_BUS_SUSPEND 0x0c
|
|
57 |
#define CCCR_FUNCTION_SELECT 0x0d
|
|
58 |
#define CCCR_EXEC_FLAGS 0x0e
|
|
59 |
#define CCCR_READY_FLAGS 0x0f
|
|
60 |
#define CCCR_FNO_BLOCK_SIZE 0x10 /*0x10-0x11*/
|
|
61 |
|
|
62 |
/* Pprotocol defined constants */
|
|
63 |
|
|
64 |
#define SD_IO_GO_IDLE_STATE 0
|
|
65 |
#define SD_IO_SEND_RELATIVE_ADDR 3
|
|
66 |
#define SDIO_CMD5 5
|
|
67 |
#define SD_IO_SELECT_CARD 7
|
|
68 |
#define SDIO_CMD52 52
|
|
69 |
#define SDIO_CMD53 53
|
|
70 |
#define SD_IO_SEND_OP_COND SDIO_CMD5
|
|
71 |
#define SD_IO_RW_DIRECT SDIO_CMD52
|
|
72 |
#define SD_IO_RW_EXTENDED SDIO_CMD53
|
|
73 |
#define SDIO_SHIFT(v,n) (v<<n)
|
|
74 |
#define SDIO_RWFLAG(v) (SDIO_SHIFT(v,31))
|
|
75 |
#define SDIO_FUNCN(v) (SDIO_SHIFT(v,28))
|
|
76 |
#define SDIO_RAWFLAG(v) (SDIO_SHIFT(v,27))
|
|
77 |
#define SDIO_BLKM(v) (SDIO_SHIFT(v,27))
|
|
78 |
#define SDIO_OPCODE(v) (SDIO_SHIFT(v,26))
|
|
79 |
#define SDIO_ADDRREG(v) (SDIO_SHIFT(v,9))
|
|
80 |
|
|
81 |
|
|
82 |
#define VDD_VOLTAGE_WINDOW 0xffffc0
|
|
83 |
|
|
84 |
#define MMC_RSP_NONE (0 << 0)
|
|
85 |
#define MMC_RSP_SHORT (1 << 0)
|
|
86 |
#define MMC_RSP_LONG (2 << 0)
|
|
87 |
#define MMC_RSP_MASK (3 << 0)
|
|
88 |
#define MMC_RSP_CRC (1 << 3)
|
|
89 |
#define MMC_RSP_BUSY (1 << 4)
|
|
90 |
|
|
91 |
#define MMC_RSP_R1 (MMC_RSP_SHORT|MMC_RSP_CRC)
|
|
92 |
#define MMC_RSP_R1B (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_BUSY)
|
|
93 |
#define MMC_RSP_R2 (MMC_RSP_LONG|MMC_RSP_CRC)
|
|
94 |
#define MMC_RSP_R3 (MMC_RSP_SHORT)
|
|
95 |
|
|
96 |
/* HSMMC controller bit definitions
|
|
97 |
* */
|
|
98 |
#define OMAP_HSMMC_CMD_NO_RESPONSE 0 << 0
|
|
99 |
#define OMAP_HSMMC_CMD_LONG_RESPONSE 1 << 0
|
|
100 |
#define OMAP_HSMMC_CMD_SHORT_RESPONSE 2 << 0
|
|
101 |
|
|
102 |
#define MMC_RSP_R4 OMAP_HSMMC_CMD_SHORT_RESPONSE
|
|
103 |
#define MMC_RSP_R5 OMAP_HSMMC_CMD_SHORT_RESPONSE
|
|
104 |
#define MMC_RSP_R6 OMAP_HSMMC_CMD_SHORT_RESPONSE
|
|
105 |
|
|
106 |
#define MMC_ERR_NONE 0
|
|
107 |
#define MMC_ERR_TIMEOUT 1
|
|
108 |
#define MMC_ERR_BADCRC 2
|
|
109 |
#define MMC_ERR_FIFO 3
|
|
110 |
#define MMC_ERR_FAILED 4
|
|
111 |
#define MMC_ERR_INVALID 5
|
|
112 |
|
|
113 |
|
|
114 |
/********************************************************************/
|
|
115 |
/* SDIO driver functions prototypes */
|
|
116 |
/********************************************************************/
|
|
117 |
|
|
118 |
//int sdioDrv_CheckHw ();
|
|
119 |
|
|
120 |
int sdioDrv_ConnectBus (void *fCbFunc, void *hCbArg, unsigned int uBlkSizeShift,unsigned int uSdioThreadPriority);
|
|
121 |
//int sdioDrv_ConnectBus (void *fCbFunc, void *hCbArg, unsigned int uBlkSizeShift);
|
|
122 |
int sdioDrv_DisconnectBus (void);
|
|
123 |
|
|
124 |
int sdioDrv_ExecuteCmd (unsigned int uCmd,
|
|
125 |
unsigned int uArg,
|
|
126 |
unsigned int uRespType,
|
|
127 |
void * pResponse,
|
|
128 |
unsigned int uLen);
|
|
129 |
|
|
130 |
int sdioDrv_ReadSync (unsigned int uFunc,
|
|
131 |
unsigned int uHwAddr,
|
|
132 |
void * pData,
|
|
133 |
unsigned int uLen,
|
|
134 |
unsigned int bFixedAddr,
|
|
135 |
unsigned int bMore);
|
|
136 |
|
|
137 |
int sdioDrv_ReadAsync (unsigned int uFunc,
|
|
138 |
unsigned int uHwAddr,
|
|
139 |
void * pData,
|
|
140 |
unsigned int uLen,
|
|
141 |
unsigned int bBlkMode,
|
|
142 |
unsigned int bFixedAddr,
|
|
143 |
unsigned int bMore);
|
|
144 |
|
|
145 |
int sdioDrv_WriteSync (unsigned int uFunc,
|
|
146 |
unsigned int uHwAddr,
|
|
147 |
void * pData,
|
|
148 |
unsigned int uLen,
|
|
149 |
unsigned int bFixedAddr,
|
|
150 |
unsigned int bMore);
|
|
151 |
|
|
152 |
int sdioDrv_WriteAsync (unsigned int uFunc,
|
|
153 |
unsigned int uHwAddr,
|
|
154 |
void * pData,
|
|
155 |
unsigned int uLen,
|
|
156 |
unsigned int bBlkMode,
|
|
157 |
unsigned int bFixedAddr,
|
|
158 |
unsigned int bMore);
|
|
159 |
|
|
160 |
int sdioDrv_ReadSyncBytes (unsigned int uFunc,
|
|
161 |
unsigned int uHwAddr,
|
|
162 |
unsigned char *pData,
|
|
163 |
unsigned int uLen,
|
|
164 |
unsigned int bMore);
|
|
165 |
|
|
166 |
int sdioDrv_WriteSyncBytes (unsigned int uFunc,
|
|
167 |
unsigned int uHwAddr,
|
|
168 |
unsigned char *pData,
|
|
169 |
unsigned int uLen,
|
|
170 |
unsigned int bMore);
|
|
171 |
|
|
172 |
|
|
173 |
|
|
174 |
#endif/* _OMAP2430_SDIODRV_H */
|