2 * Copyright © 2013 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 ao_sdcard_read_block(uint32_t block, uint8_t *data);
25 ao_sdcard_write_block(uint32_t block, uint8_t *data);
31 #define SDCARD_GO_IDLE_STATE 0
32 #define SDCARD_SEND_OP_COND 1
33 #define SDCARD_SEND_IF_COND 8
34 #define SDCARD_SEND_CSD 9
35 #define SDCARD_SEND_CID 10
36 #define SDCARD_SEND_STATUS 13
37 #define SDCARD_SET_BLOCKLEN 16
38 #define SDCARD_READ_BLOCK 17
39 #define SDCARD_WRITE_BLOCK 24
40 #define SDCARD_WRITE_MULTIPLE_BLOCK 25
41 #define SDCARD_ERASE_WR_BLK_START 32
42 #define SDCARD_ERASE_WR_BLK_END 33
43 #define SDCARD_ERASE 38
44 #define SDCARD_APP_CMD 55
45 #define SDCARD_READ_OCR 58
48 #define SDCARD_APP_SET_WR_BLK_ERASE_COUNT 23
49 #define SDCARD_APP_SEND_OP_COMD 41
52 #define SDCARD_STATUS_READY_STATE 0x00
53 #define SDCARD_STATUS_IDLE_STATE 0x01
54 #define SDCARD_STATUS_ERASE_RESET 0x02
55 #define SDCARD_STATUS_ILLEGAL_COMMAND 0x04
56 #define SDCARD_STATUS_COM_CRC_ERROR 0x08
57 #define SDCARD_STATUS_ERASE_SEQ_ERROR 0x10
58 #define SDCARD_STATUS_ADDRESS_ERROR 0x20
59 #define SDCARD_STATUS_PARAMETER_ERROR 0x40
60 #define SDCARD_STATUS_TIMEOUT 0xff
62 #define SDCARD_DATA_START_BLOCK 0xfe
63 #define SDCARD_STOP_TRAN_TOKEN 0xfd
64 #define SDCARD_WRITE_MULTIPLE_TOKEN 0xfc
65 #define SDCARD_DATA_RES_MASK 0x1f
66 #define SDCARD_DATA_RES_ACCEPTED 0x05
68 #define SDCARD_CMD_TIMEOUT AO_MS_TO_TICKS(20)
69 #define SDCARD_BUSY_TIMEOUT AO_MS_TO_TICKS(20)
70 #define SDCARD_BLOCK_TIMEOUT AO_MS_TO_TICKS(200)
71 #define SDCARD_IDLE_RETRY 10
72 #define SDCARD_OP_COND_RETRY 10
82 #endif /* _AO_SDCARD_H_ */