1 /* 2 * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 11 * Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the 14 * distribution. 15 * 16 * Neither the name of Texas Instruments Incorporated nor the names of 17 * its contributors may be used to endorse or promote products derived 18 * from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * 32 */ 33 //***************************************************************************** 34 // 35 // sdhost.h 36 // 37 // Defines and Macros for the SDHost. 38 // 39 //***************************************************************************** 40 41 #ifndef __SDHOST_H__ 42 #define __SDHOST_H__ 43 44 45 //***************************************************************************** 46 // 47 // If building with a C++ compiler, make all of the definitions in this header 48 // have a C binding. 49 // 50 //***************************************************************************** 51 #ifdef __cplusplus 52 extern "C" 53 //{ 54 #endif 55 56 57 //***************************************************************************** 58 // Values that can be passed to SDHostRespGet(). 59 //***************************************************************************** 60 #define SDHOST_RESP_10 0x00000003 61 #define SDHOST_RESP_32 0x00000002 62 #define SDHOST_RESP_54 0x00000001 63 #define SDHOST_RESP_76 0x00000000 64 65 66 //***************************************************************************** 67 // Values that can be passed to SDHostIntEnable(), SDHostIntDisable(), 68 // SDHostIntClear() ,and returned from SDHostIntStatus(). 69 //***************************************************************************** 70 #define SDHOST_INT_CC 0x00000001 71 #define SDHOST_INT_TC 0x00000002 72 #define SDHOST_INT_BWR 0x00000010 73 #define SDHOST_INT_BRR 0x00000020 74 #define SDHOST_INT_ERRI 0x00008000 75 #define SDHOST_INT_CTO 0x00010000 76 #define SDHOST_INT_CEB 0x00040000 77 #define SDHOST_INT_DTO 0x00100000 78 #define SDHOST_INT_DCRC 0x00200000 79 #define SDHOST_INT_DEB 0x00400000 80 #define SDHOST_INT_CERR 0x10000000 81 #define SDHOST_INT_BADA 0x20000000 82 #define SDHOST_INT_DMARD 0x40000000 83 #define SDHOST_INT_DMAWR 0x80000000 84 85 //***************************************************************************** 86 // Values that can be passed to SDHostCmdSend(). 87 //***************************************************************************** 88 #define SDHOST_CMD_0 0x00000000 89 #define SDHOST_CMD_1 0x01000000 90 #define SDHOST_CMD_2 0x02000000 91 #define SDHOST_CMD_3 0x03000000 92 #define SDHOST_CMD_4 0x04000000 93 #define SDHOST_CMD_5 0x05000000 94 #define SDHOST_CMD_6 0x06000000 95 #define SDHOST_CMD_7 0x07000000 96 #define SDHOST_CMD_8 0x08000000 97 #define SDHOST_CMD_9 0x09000000 98 #define SDHOST_CMD_10 0x0A000000 99 #define SDHOST_CMD_11 0x0B000000 100 #define SDHOST_CMD_12 0x0C000000 101 #define SDHOST_CMD_13 0x0D000000 102 #define SDHOST_CMD_14 0x0E000000 103 #define SDHOST_CMD_15 0x0F000000 104 #define SDHOST_CMD_16 0x10000000 105 #define SDHOST_CMD_17 0x11000000 106 #define SDHOST_CMD_18 0x12000000 107 #define SDHOST_CMD_19 0x13000000 108 #define SDHOST_CMD_20 0x14000000 109 #define SDHOST_CMD_21 0x15000000 110 #define SDHOST_CMD_22 0x16000000 111 #define SDHOST_CMD_23 0x17000000 112 #define SDHOST_CMD_24 0x18000000 113 #define SDHOST_CMD_25 0x19000000 114 #define SDHOST_CMD_26 0x1A000000 115 #define SDHOST_CMD_27 0x1B000000 116 #define SDHOST_CMD_28 0x1C000000 117 #define SDHOST_CMD_29 0x1D000000 118 #define SDHOST_CMD_30 0x1E000000 119 #define SDHOST_CMD_31 0x1F000000 120 #define SDHOST_CMD_32 0x20000000 121 #define SDHOST_CMD_33 0x21000000 122 #define SDHOST_CMD_34 0x22000000 123 #define SDHOST_CMD_35 0x23000000 124 #define SDHOST_CMD_36 0x24000000 125 #define SDHOST_CMD_37 0x25000000 126 #define SDHOST_CMD_38 0x26000000 127 #define SDHOST_CMD_39 0x27000000 128 #define SDHOST_CMD_40 0x28000000 129 #define SDHOST_CMD_41 0x29000000 130 #define SDHOST_CMD_42 0x2A000000 131 #define SDHOST_CMD_43 0x2B000000 132 #define SDHOST_CMD_44 0x2C000000 133 #define SDHOST_CMD_45 0x2D000000 134 #define SDHOST_CMD_46 0x2E000000 135 #define SDHOST_CMD_47 0x2F000000 136 #define SDHOST_CMD_48 0x30000000 137 #define SDHOST_CMD_49 0x31000000 138 #define SDHOST_CMD_50 0x32000000 139 #define SDHOST_CMD_51 0x33000000 140 #define SDHOST_CMD_52 0x34000000 141 #define SDHOST_CMD_53 0x35000000 142 #define SDHOST_CMD_54 0x36000000 143 #define SDHOST_CMD_55 0x37000000 144 #define SDHOST_CMD_56 0x38000000 145 #define SDHOST_CMD_57 0x39000000 146 #define SDHOST_CMD_58 0x3A000000 147 #define SDHOST_CMD_59 0x3B000000 148 #define SDHOST_CMD_60 0x3C000000 149 #define SDHOST_CMD_61 0x3D000000 150 #define SDHOST_CMD_62 0x3E000000 151 #define SDHOST_CMD_63 0x3F000000 152 153 //***************************************************************************** 154 // Values that can be logically ORed with ulCmd parameter for SDHostCmdSend(). 155 //***************************************************************************** 156 #define SDHOST_MULTI_BLK 0x00000022 157 #define SDHOST_DMA_EN 0x00000001 158 #define SDHOST_WR_CMD 0x00200000 159 #define SDHOST_RD_CMD 0x00200010 160 #define SDHOST_RESP_LEN_136 0x00010000 161 #define SDHOST_RESP_LEN_48 0x00020000 162 #define SDHOST_RESP_LEN_48B 0x00030000 163 164 165 //***************************************************************************** 166 // 167 // API Function prototypes 168 // 169 //***************************************************************************** 170 extern void SDHostCmdReset(unsigned long ulBase); 171 extern void SDHostInit(unsigned long ulBase); 172 extern long SDHostCmdSend(unsigned long ulBase,unsigned long ulCmd, 173 unsigned ulArg); 174 extern void SDHostIntRegister(unsigned long ulBase, void (*pfnHandler)(void)); 175 extern void SDHostIntUnregister(unsigned long ulBase); 176 extern void SDHostIntEnable(unsigned long ulBase,unsigned long ulIntFlags); 177 extern void SDHostIntDisable(unsigned long ulBase,unsigned long ulIntFlags); 178 extern unsigned long SDHostIntStatus(unsigned long ulBase); 179 extern void SDHostIntClear(unsigned long ulBase,unsigned long ulIntFlags); 180 extern void SDHostCardErrorMaskSet(unsigned long ulBase, 181 unsigned long ulErrMask); 182 extern unsigned long SDHostCardErrorMaskGet(unsigned long ulBase); 183 extern void SDHostSetExpClk(unsigned long ulBase, unsigned long ulSDHostClk, 184 unsigned long ulCardClk); 185 extern void SDHostRespGet(unsigned long ulBase, unsigned long ulRespnse[4]); 186 extern void SDHostBlockSizeSet(unsigned long ulBase, unsigned short ulBlkSize); 187 extern void SDHostBlockCountSet(unsigned long ulBase, 188 unsigned short ulBlkCount); 189 extern tBoolean SDHostDataNonBlockingWrite(unsigned long ulBase, 190 unsigned long ulData); 191 extern tBoolean SDHostDataNonBlockingRead(unsigned long ulBase, 192 unsigned long *pulData); 193 extern void SDHostDataWrite(unsigned long ulBase, unsigned long ulData); 194 extern void SDHostDataRead(unsigned long ulBase, unsigned long *ulData); 195 196 //***************************************************************************** 197 // 198 // Mark the end of the C bindings section for C++ compilers. 199 // 200 //***************************************************************************** 201 #ifdef __cplusplus 202 //} 203 #endif 204 205 #endif // __SDHOST_H__ 206