00001
00041 #ifndef MMC_PROTOCOL_H_INCLUDED
00042 #define MMC_PROTOCOL_H_INCLUDED
00043
00044
00045 #define SDMMC_F_OD 200000
00046
00047
00048
00049 #define SDMMC_GO_IDLE_STATE 0
00050 #define MMC_SEND_OP_COND 1
00051 #define SDMMC_ALL_SEND_CID 2
00052 #define SDMMC_SET_RELATIVE_ADDR 3
00053 #define SDMMC_SET_DSR 4
00054
00055 #define SDMMC_SWITCH_FUNC 6
00056 #define SDMMC_SELECT_DESELECT_CARD 7
00057 #define SD_SEND_IF_COND 8
00058 #define MMC_SEND_EXT_CSD 8
00059 #define SDMMC_SEND_CSD 9
00060 #define SDMMC_SEND_CID 10
00061 #define SDMMC_STOP_TRANSMISSION 12
00062 #define SDMMC_SEND_STATUS 13
00063 #define MMC_BUSTEST_R 14
00064 #define SDMMC_GO_INACTIVE_STATE 15
00065
00066
00067 #define MMC_READ_DAT_UNTIL_STOP 11
00068
00069
00070 #define SDMMC_SET_BLOCKLEN 16
00071 #define SDMMC_READ_SINGLE_BLOCK 17
00072 #define SDMMC_READ_MULTIPLE_BLOCK 18
00073
00074
00075 #define MMC_WRITE_DATA_UNTIL_STOP 20
00076
00077
00078
00079 #define MMC_SET_BLOCK_COUNT 23
00080 #define SDMMC_WRITE_BLOCK 24
00081 #define SDMMC_WRITE_MULTIPLE_BLOCK 25
00082 #define MMC_PROGRAM_CID 26
00083 #define SDMMC_PROGRAM_CSD 27
00084
00085
00086
00087
00088 #define SDMMC_SET_WRITE_PROT 28
00089 #define SDMMC_CLR_WRITE_PROT 29
00090 #define SDMMC_SEND_WRITE_PROT 30
00091
00092
00093
00094
00095 #define SDMMC_APP_CMD 55
00096 #define SDMMC_GEN_CMD 56
00097
00098
00099
00100
00101
00102
00103
00104 #define SD_SET_BUS_WIDTH 6
00105 #define SD_SEND_OP_COND 41
00106 #define SD_SEND_SCR 51
00107
00108
00109 #define SD_ARG_SET_BUS_WIDTH_4BIT 2
00110
00111
00115 #define SDMMC_OUT_OF_RANGE (1 << 31)
00116 #define SDMMC_ADDRESS_ERROR (1 << 30)
00117 #define SDMMC_BLOCK_LEN_ERROR (1 << 29)
00118 #define SDMMC_ERASE_SEQ_ERROR (1 << 28)
00119 #define SDMMC_ERASE_PARAM (1 << 27)
00120 #define SDMMC_WP_VIOLATION (1 << 26)
00121 #define SDMMC_CARD_IS_LOCKED (1 << 25)
00122 #define SDMMC_LOCK_UNLOCK_FAILED (1 << 24)
00123 #define SDMMC_COM_CRC_ERROR (1 << 23)
00124 #define SDMMC_ILLEGAL_COMMAND (1 << 22)
00125 #define SDMMC_CARD_ECC_FAILED (1 << 21)
00126 #define SDMMC_CC_ERROR (1 << 20)
00127 #define SDMMC_ERROR (1 << 19)
00128 #define MMC_UNDERRUN (1 << 18)
00129 #define MMC_OVERRUN (1 << 17)
00130 #define SDMMC_CSD_OVERWRITE (1 << 16)
00131 #define SDMMC_WP_ERASE_SKIP (1 << 15)
00132 #define SD_CARD_ECC_DISABLED (1 << 14)
00133 #define SDMMC_ERASE_RESET (1 << 13)
00134 #define SDMMC_CURRENT_STATE_MASK (15 << 9)
00135 #define SDMMC_CURRENT_STATE_IDLE (0 << 9)
00136 #define SDMMC_CURRENT_STATE_READY (1 << 9)
00137 #define SDMMC_CURRENT_STATE_IDENT (2 << 9)
00138 #define SDMMC_CURRENT_STATE_STBY (3 << 9)
00139 #define SDMMC_CURRENT_STATE_TRAN (4 << 9)
00140 #define SDMMC_CURRENT_STATE_DATA (5 << 9)
00141 #define SDMMC_CURRENT_STATE_RCV (6 << 9)
00142 #define SDMMC_CURRENT_STATE_PRG (7 << 9)
00143 #define SDMMC_CURRENT_STATE_DIS (8 << 9)
00144 #define MMC_CURRENT_STATE_BTST (9 << 9)
00145 #define SDMMC_READY_FOR_DATA (1 << 8)
00146 #define MMC_SWITCH_ERROR (1 << 7)
00147 #define SDMMC_CARD_STATUS_APP_CMD (1 << 5)
00148 #define SD_AKA_SEQ_ERROR (1 << 3)
00149
00153 #define SDMMC_RCA_MASK (0xffff << 16)
00154
00156 #define SDMMC_SWITCH_FUNC_MODE_CHECK (0 << 31)
00157 #define SDMMC_SWITCH_FUNC_MODE_SWITCH (1 << 31)
00158 #define SDMMC_SWITCH_FUNC_HIGH_SPEED (1 << 0)
00159 #define SDMMC_SWITCH_FUNC_G1_KEEP (0xf << 0)
00160 #define SDMMC_SWITCH_FUNC_G2_KEEP (0xf << 4)
00161 #define SDMMC_SWITCH_FUNC_G3_KEEP (0xf << 8)
00162 #define SDMMC_SWITCH_FUNC_G4_KEEP (0xf << 12)
00163 #define SDMMC_SWITCH_FUNC_G5_KEEP (0xf << 16)
00164 #define SDMMC_SWITCH_FUNC_G6_KEEP (0xf << 20)
00169 #define SD_IF_COND_V_27_33 (1 << 8)
00170 #define SD_IF_COND_CHECK_PATTERN 0xaa
00175 #define SDMMC_OCR_POWER_UP_DONE (1 << 31)
00176 #define SDMMC_OCR_CCS (1 << 30)
00177 #define SDMMC_OCR_V_32_33 (1 << 20)
00178 #define SDMMC_OCR_V_33_34 (1 << 21)
00179 #define SDMMC_OCR_LOW_VOLTAGE (1 << 7)
00184 #define SD_SCR0_VERSION_MASK (0xf << (60 - 32))
00185 #define SD_SCR0_VERSION_101_200 (0 << (60 - 32))
00186 #define SD_SCR0_SPEC_VERSION_MASK (0xf << (56 - 32))
00187 #define SD_SCR0_SPEC_VERSION_10_101 (0 << (56 - 32))
00188 #define SD_SCR0_SPEC_VERSION_110 (1 << (56 - 32))
00189 #define SD_SCR0_SPEC_VERSION_200 (2 << (56 - 32))
00190 #define SD_SCR0_BUS_WIDTH_1BIT_MASK (1 << (48 - 32))
00191 #define SD_SCR0_BUS_WIDTH_4BIT_MASK (1 << (48 - 32))
00193 #endif
00194