diff options
Diffstat (limited to 'firmware/export/sd.h')
-rw-r--r-- | firmware/export/sd.h | 78 |
1 files changed, 50 insertions, 28 deletions
diff --git a/firmware/export/sd.h b/firmware/export/sd.h index f2854423ec..c12546562e 100644 --- a/firmware/export/sd.h +++ b/firmware/export/sd.h | |||
@@ -72,34 +72,37 @@ int sd_num_drives(int first_drive); | |||
72 | #define SD_DIS 8 | 72 | #define SD_DIS 8 |
73 | 73 | ||
74 | /* SD Commands */ | 74 | /* SD Commands */ |
75 | #define SD_GO_IDLE_STATE 0 | 75 | #define SD_GO_IDLE_STATE 0 |
76 | #define SD_ALL_SEND_CID 2 | 76 | #define SD_ALL_SEND_CID 2 |
77 | #define SD_SEND_RELATIVE_ADDR 3 | 77 | #define SD_SEND_RELATIVE_ADDR 3 |
78 | #define SD_SET_DSR 4 | 78 | #define SD_SET_DSR 4 |
79 | #define SD_SWITCH_FUNC 6 | 79 | #define SD_SWITCH_FUNC 6 |
80 | #define SD_SET_BUS_WIDTH 6 /* acmd6 */ | 80 | #define SD_SET_BUS_WIDTH 6 /* acmd6 */ |
81 | #define SD_SELECT_CARD 7 | 81 | #define SD_SELECT_CARD 7 /* with card's rca */ |
82 | #define SD_DESELECT_CARD 7 | 82 | #define SD_DESELECT_CARD 7 /* with rca = 0 */ |
83 | #define SD_SEND_IF_COND 8 | 83 | #define SD_SEND_IF_COND 8 |
84 | #define SD_SEND_CSD 9 | 84 | #define SD_SEND_CSD 9 |
85 | #define SD_SEND_CID 10 | 85 | #define SD_SEND_CID 10 |
86 | #define SD_STOP_TRANSMISSION 12 | 86 | #define SD_STOP_TRANSMISSION 12 |
87 | #define SD_SEND_STATUS 13 | 87 | #define SD_SEND_STATUS 13 |
88 | #define SD_GO_INACTIVE_STATE 15 | 88 | #define SD_SD_STATUS 13 /* acmd13 */ |
89 | #define SD_SET_BLOCKLEN 16 | 89 | #define SD_GO_INACTIVE_STATE 15 |
90 | #define SD_READ_SINGLE_BLOCK 17 | 90 | #define SD_SET_BLOCKLEN 16 |
91 | #define SD_READ_MULTIPLE_BLOCK 18 | 91 | #define SD_READ_SINGLE_BLOCK 17 |
92 | #define SD_SEND_NUM_WR_BLOCKS 22 | 92 | #define SD_READ_MULTIPLE_BLOCK 18 |
93 | #define SD_WRITE_BLOCK 24 | 93 | #define SD_SEND_NUM_WR_BLOCKS 22 /* acmd22 */ |
94 | #define SD_WRITE_MULTIPLE_BLOCK 25 | 94 | #define SD_SET_WR_BLK_ERASE_COUNT 23 /* acmd23 */ |
95 | #define SD_ERASE_WR_BLK_START 32 | 95 | #define SD_WRITE_BLOCK 24 |
96 | #define SD_ERASE_WR_BLK_END 33 | 96 | #define SD_WRITE_MULTIPLE_BLOCK 25 |
97 | #define SD_ERASE 38 | 97 | #define SD_PROGRAM_CSD 27 |
98 | #define SD_APP_OP_COND 41 | 98 | #define SD_ERASE_WR_BLK_START 32 |
99 | #define SD_LOCK_UNLOCK 42 | 99 | #define SD_ERASE_WR_BLK_END 33 |
100 | #define SD_SET_CLR_CARD_DETECT 42 /* acmd42 */ | 100 | #define SD_ERASE 38 |
101 | #define SD_SEND_SCR 51 /* acmd51 */ | 101 | #define SD_APP_OP_COND 41 /* acmd41 */ |
102 | #define SD_APP_CMD 55 | 102 | #define SD_LOCK_UNLOCK 42 |
103 | #define SD_SET_CLR_CARD_DETECT 42 /* acmd42 */ | ||
104 | #define SD_SEND_SCR 51 /* acmd51 */ | ||
105 | #define SD_APP_CMD 55 | ||
103 | 106 | ||
104 | /* | 107 | /* |
105 | SD/MMC status in R1, for native mode (SPI bits are different) | 108 | SD/MMC status in R1, for native mode (SPI bits are different) |
@@ -144,4 +147,23 @@ int sd_num_drives(int first_drive); | |||
144 | /* SD OCR bits */ | 147 | /* SD OCR bits */ |
145 | #define SD_OCR_CARD_CAPACITY_STATUS (1 << 30) /* Card Capacity Status */ | 148 | #define SD_OCR_CARD_CAPACITY_STATUS (1 << 30) /* Card Capacity Status */ |
146 | 149 | ||
150 | /* All R1 Response flags that indicate Card error(vs MCI Controller error) */ | ||
151 | #define SD_R1_CARD_ERROR ( SD_R1_OUT_OF_RANGE \ | ||
152 | | SD_R1_ADDRESS_ERROR \ | ||
153 | | SD_R1_BLOCK_LEN_ERROR \ | ||
154 | | SD_R1_ERASE_SEQ_ERROR \ | ||
155 | | SD_R1_ERASE_PARAM \ | ||
156 | | SD_R1_WP_VIOLATION \ | ||
157 | | SD_R1_LOCK_UNLOCK_FAILED \ | ||
158 | | SD_R1_COM_CRC_ERROR \ | ||
159 | | SD_R1_ILLEGAL_COMMAND \ | ||
160 | | SD_R1_CARD_ECC_FAILED \ | ||
161 | | SD_R1_CC_ERROR \ | ||
162 | | SD_R1_ERROR \ | ||
163 | | SD_R1_UNDERRUN \ | ||
164 | | SD_R1_CSD_OVERWRITE \ | ||
165 | | SD_R1_WP_ERASE_SKIP \ | ||
166 | | SD_R1_AKE_SEQ_ERROR) | ||
167 | |||
168 | |||
147 | #endif | 169 | #endif |