/* * $Id: sdmmcvar.h,v 1.1 2007/12/18 14:01:21 nbrk Exp $ */ #ifndef _DEV_SDMMC_SDMMCVAR_H #define _DEV_SDMMC_SDMMCVAR_H /* * SD/MMC simplified commands set. */ #define CMD0_GO_IDLE_STATE 0 #define CMD1_SEND_OP_COND 1 #define CMD8_SEND_IF_COND 8 #define CMD9_SEND_CSD 9 #define CMD10_SEND_CID 10 #define CMD12_STOP_TRANSMISSION 12 #define CMD16_SET_BLOCKLEN 16 #define CMD17_READ_SINGLE_BLOCK 17 #define CMD18_READ_MULTIPLE_BLOCK 18 #define CMD23_SET_BLOCK_COUNT 23 #define CMD24_WRITE_BLOCK 24 #define CMD25_WRITE_MULTIPLE_BLOCK 25 #define CMD41_APP_SEND_OP_COND 41 #define CMD55_APP_CMD 55 #define CMD58_READ_OCR 58 /* * Command frame. */ struct sdmmc_cmdframe { uint8_t sc_cmd; uint32_t sc_arg; uint8_t sc_crc; } __attribute__((packed)); /* * Macross to construct frame header and footer. */ #define CMDFRAME_CMD(c) ((c & 0x3f) | 0x40) #define CMDFRAME_CRC(c) (c << 1 | 0x01) /* * Responses bitfields. */ #define R1_IN_IDLE_STATE 0x01 #define R1_ERASE_RESET 0x02 #define R1_ILLEGAL_COMMAND 0x04 #define R1_COMMAND_CRC_ERROR 0x08 #define R1_ERASE_SEQUENSE_ERROR 0x10 #define R1_ADDRESS_ERROR 0x20 #define R1_PARAMETER_ERROR 0x40 /* * R1 response frame. */ struct sdmmc_r1resp { uint8_t sr_eflags; }; /* * R3 response frame. */ struct sdmmc_r3resp { uint8_t sr_eflags; uint32_t sr_ocr; } __attribute__((packed)); #endif /* !_DEV_SDMMC_SDMMCVAR_H */