X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fdrivers%2Fao_sdcard.h;h=8f794efc13b57f6eb3676161d998d0045d7ea3e2;hb=97cf9df882291b9e494b2f64f84eb37357a6ab31;hp=b9f737c55cbbe04431c4ece415b81678d1ef75a4;hpb=e14834817f78a04b4d9b44a8373119dffd42c966;p=fw%2Faltos diff --git a/src/drivers/ao_sdcard.h b/src/drivers/ao_sdcard.h index b9f737c5..8f794efc 100644 --- a/src/drivers/ao_sdcard.h +++ b/src/drivers/ao_sdcard.h @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -49,9 +50,14 @@ ao_sdcard_init(void); #define SDCARD_APP_SEND_OP_COMD 41 /* Status */ -#define SDCARD_STATUS_READY_STATE 0 -#define SDCARD_STATUS_IDLE_STATE 1 -#define SDCARD_STATUS_ILLEGAL_COMMAND 4 +#define SDCARD_STATUS_READY_STATE 0x00 +#define SDCARD_STATUS_IDLE_STATE 0x01 +#define SDCARD_STATUS_ERASE_RESET 0x02 +#define SDCARD_STATUS_ILLEGAL_COMMAND 0x04 +#define SDCARD_STATUS_COM_CRC_ERROR 0x08 +#define SDCARD_STATUS_ERASE_SEQ_ERROR 0x10 +#define SDCARD_STATUS_ADDRESS_ERROR 0x20 +#define SDCARD_STATUS_PARAMETER_ERROR 0x40 #define SDCARD_STATUS_TIMEOUT 0xff #define SDCARD_DATA_START_BLOCK 0xfe @@ -60,9 +66,11 @@ ao_sdcard_init(void); #define SDCARD_DATA_RES_MASK 0x1f #define SDCARD_DATA_RES_ACCEPTED 0x05 -#define SDCARD_CMD_TIMEOUT 100 -#define SDCARD_IDLE_WAIT 100 -#define SDCARD_BLOCK_TIMEOUT 100 +#define SDCARD_CMD_TIMEOUT AO_MS_TO_TICKS(20) +#define SDCARD_BUSY_TIMEOUT AO_MS_TO_TICKS(20) +#define SDCARD_BLOCK_TIMEOUT AO_MS_TO_TICKS(200) +#define SDCARD_IDLE_RETRY 10 +#define SDCARD_OP_COND_RETRY 10 enum ao_sdtype { ao_sdtype_unknown,