Patch from David Gustafsson: break out SPI functions and fix bug in capacity

calculation.

Removed expensive modulo operations from sd_read and sd_write because the block size is now a variable. (nvt)
This commit is contained in:
nvt-se 2009-11-03 15:21:43 +00:00
parent 9b801b59c7
commit 9b4cd05e1f
4 changed files with 89 additions and 64 deletions

View file

@ -51,17 +51,18 @@
#define SD_INIT_ERROR_NO_CARD -1
#define SD_INIT_ERROR_ARCH -2
#define SD_INIT_ERROR_NO_IF_COND -3
#define SD_INIT_ERROR_NO_BLOCK_SIZE -4
#define SD_WRITE_ERROR_NO_CMD_RESPONSE -4
#define SD_WRITE_ERROR_NO_BLOCK_RESPONSE -5
#define SD_WRITE_ERROR_PROGRAMMING -6
#define SD_WRITE_ERROR_TOKEN -7
#define SD_WRITE_ERROR_NO_TOKEN -8
#define SD_WRITE_ERROR_NO_CMD_RESPONSE -5
#define SD_WRITE_ERROR_NO_BLOCK_RESPONSE -6
#define SD_WRITE_ERROR_PROGRAMMING -7
#define SD_WRITE_ERROR_TOKEN -8
#define SD_WRITE_ERROR_NO_TOKEN -9
#define SD_READ_ERROR_NO_CMD_RESPONSE -9
#define SD_READ_ERROR_INVALID_SIZE -10
#define SD_READ_ERROR_TOKEN -11
#define SD_READ_ERROR_NO_TOKEN -12
#define SD_READ_ERROR_NO_CMD_RESPONSE -10
#define SD_READ_ERROR_INVALID_SIZE -11
#define SD_READ_ERROR_TOKEN -12
#define SD_READ_ERROR_NO_TOKEN -13
/* Type definition. */
typedef uint32_t sd_offset_t;