CC3200 Peripheral Driver Library User's Guide  1.2.0
sdhost.h
1 //*****************************************************************************
2 //
3 // sdhost.h
4 //
5 // Defines and Macros for the SDHost.
6 //
7 // Copyright (C) 2014 Texas Instruments Incorporated - https://www.ti.com/
8 //
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions
12 // are met:
13 //
14 // Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the
20 // distribution.
21 //
22 // Neither the name of Texas Instruments Incorporated nor the names of
23 // its 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 __SDHOST_H__
41 #define __SDHOST_H__
42 
43 
44 //*****************************************************************************
45 //
46 // If building with a C++ compiler, make all of the definitions in this header
47 // have a C binding.
48 //
49 //*****************************************************************************
50 #ifdef __cplusplus
51 extern "C"
52 //{
53 #endif
54 
55 
56 //*****************************************************************************
57 // Values that can be passed to SDHostRespGet().
58 //*****************************************************************************
59 #define SDHOST_RESP_10 0x00000003
60 #define SDHOST_RESP_32 0x00000002
61 #define SDHOST_RESP_54 0x00000001
62 #define SDHOST_RESP_76 0x00000000
63 
64 
65 //*****************************************************************************
66 // Values that can be passed to SDHostIntEnable(), SDHostIntDisable(),
67 // SDHostIntClear() ,and returned from SDHostIntStatus().
68 //*****************************************************************************
69 #define SDHOST_INT_CC 0x00000001
70 #define SDHOST_INT_TC 0x00000002
71 #define SDHOST_INT_BWR 0x00000010
72 #define SDHOST_INT_BRR 0x00000020
73 #define SDHOST_INT_ERRI 0x00008000
74 #define SDHOST_INT_CTO 0x00010000
75 #define SDHOST_INT_CEB 0x00040000
76 #define SDHOST_INT_DTO 0x00100000
77 #define SDHOST_INT_DCRC 0x00200000
78 #define SDHOST_INT_DEB 0x00400000
79 #define SDHOST_INT_CERR 0x10000000
80 #define SDHOST_INT_BADA 0x20000000
81 #define SDHOST_INT_DMARD 0x40000000
82 #define SDHOST_INT_DMAWR 0x80000000
83 
84 //*****************************************************************************
85 // Values that can be passed to SDHostCmdSend().
86 //*****************************************************************************
87 #define SDHOST_CMD_0 0x00000000
88 #define SDHOST_CMD_1 0x01000000
89 #define SDHOST_CMD_2 0x02000000
90 #define SDHOST_CMD_3 0x03000000
91 #define SDHOST_CMD_4 0x04000000
92 #define SDHOST_CMD_5 0x05000000
93 #define SDHOST_CMD_6 0x06000000
94 #define SDHOST_CMD_7 0x07000000
95 #define SDHOST_CMD_8 0x08000000
96 #define SDHOST_CMD_9 0x09000000
97 #define SDHOST_CMD_10 0x0A000000
98 #define SDHOST_CMD_11 0x0B000000
99 #define SDHOST_CMD_12 0x0C000000
100 #define SDHOST_CMD_13 0x0D000000
101 #define SDHOST_CMD_14 0x0E000000
102 #define SDHOST_CMD_15 0x0F000000
103 #define SDHOST_CMD_16 0x10000000
104 #define SDHOST_CMD_17 0x11000000
105 #define SDHOST_CMD_18 0x12000000
106 #define SDHOST_CMD_19 0x13000000
107 #define SDHOST_CMD_20 0x14000000
108 #define SDHOST_CMD_21 0x15000000
109 #define SDHOST_CMD_22 0x16000000
110 #define SDHOST_CMD_23 0x17000000
111 #define SDHOST_CMD_24 0x18000000
112 #define SDHOST_CMD_25 0x19000000
113 #define SDHOST_CMD_26 0x1A000000
114 #define SDHOST_CMD_27 0x1B000000
115 #define SDHOST_CMD_28 0x1C000000
116 #define SDHOST_CMD_29 0x1D000000
117 #define SDHOST_CMD_30 0x1E000000
118 #define SDHOST_CMD_31 0x1F000000
119 #define SDHOST_CMD_32 0x20000000
120 #define SDHOST_CMD_33 0x21000000
121 #define SDHOST_CMD_34 0x22000000
122 #define SDHOST_CMD_35 0x23000000
123 #define SDHOST_CMD_36 0x24000000
124 #define SDHOST_CMD_37 0x25000000
125 #define SDHOST_CMD_38 0x26000000
126 #define SDHOST_CMD_39 0x27000000
127 #define SDHOST_CMD_40 0x28000000
128 #define SDHOST_CMD_41 0x29000000
129 #define SDHOST_CMD_42 0x2A000000
130 #define SDHOST_CMD_43 0x2B000000
131 #define SDHOST_CMD_44 0x2C000000
132 #define SDHOST_CMD_45 0x2D000000
133 #define SDHOST_CMD_46 0x2E000000
134 #define SDHOST_CMD_47 0x2F000000
135 #define SDHOST_CMD_48 0x30000000
136 #define SDHOST_CMD_49 0x31000000
137 #define SDHOST_CMD_50 0x32000000
138 #define SDHOST_CMD_51 0x33000000
139 #define SDHOST_CMD_52 0x34000000
140 #define SDHOST_CMD_53 0x35000000
141 #define SDHOST_CMD_54 0x36000000
142 #define SDHOST_CMD_55 0x37000000
143 #define SDHOST_CMD_56 0x38000000
144 #define SDHOST_CMD_57 0x39000000
145 #define SDHOST_CMD_58 0x3A000000
146 #define SDHOST_CMD_59 0x3B000000
147 #define SDHOST_CMD_60 0x3C000000
148 #define SDHOST_CMD_61 0x3D000000
149 #define SDHOST_CMD_62 0x3E000000
150 #define SDHOST_CMD_63 0x3F000000
151 
152 //*****************************************************************************
153 // Values that can be logically ORed with ulCmd parameter for SDHostCmdSend().
154 //*****************************************************************************
155 #define SDHOST_MULTI_BLK 0x00000022
156 #define SDHOST_DMA_EN 0x00000001
157 #define SDHOST_WR_CMD 0x00200000
158 #define SDHOST_RD_CMD 0x00200010
159 #define SDHOST_RESP_LEN_136 0x00010000
160 #define SDHOST_RESP_LEN_48 0x00020000
161 #define SDHOST_RESP_LEN_48B 0x00030000
162 
163 
164 //*****************************************************************************
165 //
166 // API Function prototypes
167 //
168 //*****************************************************************************
169 extern void SDHostCmdReset(unsigned long ulBase);
170 extern void SDHostInit(unsigned long ulBase);
171 extern long SDHostCmdSend(unsigned long ulBase,unsigned long ulCmd,
172  unsigned ulArg);
173 extern void SDHostIntRegister(unsigned long ulBase, void (*pfnHandler)(void));
174 extern void SDHostIntUnregister(unsigned long ulBase);
175 extern void SDHostIntEnable(unsigned long ulBase,unsigned long ulIntFlags);
176 extern void SDHostIntDisable(unsigned long ulBase,unsigned long ulIntFlags);
177 extern unsigned long SDHostIntStatus(unsigned long ulBase);
178 extern void SDHostIntClear(unsigned long ulBase,unsigned long ulIntFlags);
179 extern void SDHostCardErrorMaskSet(unsigned long ulBase,
180  unsigned long ulErrMask);
181 extern unsigned long SDHostCardErrorMaskGet(unsigned long ulBase);
182 extern void SDHostSetExpClk(unsigned long ulBase, unsigned long ulSDHostClk,
183  unsigned long ulCardClk);
184 extern void SDHostRespGet(unsigned long ulBase, unsigned long ulRespnse[4]);
185 extern void SDHostBlockSizeSet(unsigned long ulBase, unsigned short ulBlkSize);
186 extern void SDHostBlockCountSet(unsigned long ulBase,
187  unsigned short ulBlkCount);
188 extern tBoolean SDHostDataNonBlockingWrite(unsigned long ulBase,
189  unsigned long ulData);
190 extern tBoolean SDHostDataNonBlockingRead(unsigned long ulBase,
191  unsigned long *pulData);
192 extern void SDHostDataWrite(unsigned long ulBase, unsigned long ulData);
193 extern void SDHostDataRead(unsigned long ulBase, unsigned long *ulData);
194 
195 //*****************************************************************************
196 //
197 // Mark the end of the C bindings section for C++ compilers.
198 //
199 //*****************************************************************************
200 #ifdef __cplusplus
201 //}
202 #endif
203 
204 #endif // __SDHOST_H__
void SDHostBlockSizeSet(unsigned long ulBase, unsigned short ulBlkSize)
Definition: sdhost.c:700
void SDHostDataWrite(unsigned long ulBase, unsigned long ulData)
Definition: sdhost.c:260
void SDHostInit(unsigned long ulBase)
Definition: sdhost.c:68
void SDHostSetExpClk(unsigned long ulBase, unsigned long ulSDHostClk, unsigned long ulCardClk)
Definition: sdhost.c:620
void SDHostIntUnregister(unsigned long ulBase)
Definition: sdhost.c:402
unsigned long SDHostIntStatus(unsigned long ulBase)
Definition: sdhost.c:508
tBoolean SDHostDataNonBlockingRead(unsigned long ulBase, unsigned long *pulData)
Definition: sdhost.c:323
void SDHostIntEnable(unsigned long ulBase, unsigned long ulIntFlags)
Definition: sdhost.c:450
unsigned long SDHostCardErrorMaskGet(unsigned long ulBase)
Definition: sdhost.c:597
void SDHostIntClear(unsigned long ulBase, unsigned long ulIntFlags)
Definition: sdhost.c:544
void SDHostRespGet(unsigned long ulBase, unsigned long ulRespnse[4])
Definition: sdhost.c:671
void SDHostCardErrorMaskSet(unsigned long ulBase, unsigned long ulErrMask)
Definition: sdhost.c:575
void SDHostBlockCountSet(unsigned long ulBase, unsigned short ulBlkCount)
Definition: sdhost.c:723
tBoolean SDHostDataNonBlockingWrite(unsigned long ulBase, unsigned long ulData)
Definition: sdhost.c:218
long SDHostCmdSend(unsigned long ulBase, unsigned long ulCmd, unsigned ulArg)
Definition: sdhost.c:175
void SDHostIntDisable(unsigned long ulBase, unsigned long ulIntFlags)
Definition: sdhost.c:482
void SDHostIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
Definition: sdhost.c:371
void SDHostDataRead(unsigned long ulBase, unsigned long *ulData)
Definition: sdhost.c:292
void SDHostCmdReset(unsigned long ulBase)
Definition: sdhost.c:140