#include <string.h>#include <avr/io.h>#include "sd_raw.h"

Go to the source code of this file.
Defines | |
| #define | CMD_GO_IDLE_STATE 0x00 |
| #define | CMD_SEND_OP_COND 0x01 |
| #define | CMD_SEND_IF_COND 0x08 |
| #define | CMD_SEND_CSD 0x09 |
| #define | CMD_SEND_CID 0x0a |
| #define | CMD_STOP_TRANSMISSION 0x0c |
| #define | CMD_SEND_STATUS 0x0d |
| #define | CMD_SET_BLOCKLEN 0x10 |
| #define | CMD_READ_SINGLE_BLOCK 0x11 |
| #define | CMD_READ_MULTIPLE_BLOCK 0x12 |
| #define | CMD_WRITE_SINGLE_BLOCK 0x18 |
| #define | CMD_WRITE_MULTIPLE_BLOCK 0x19 |
| #define | CMD_PROGRAM_CSD 0x1b |
| #define | CMD_SET_WRITE_PROT 0x1c |
| #define | CMD_CLR_WRITE_PROT 0x1d |
| #define | CMD_SEND_WRITE_PROT 0x1e |
| #define | CMD_TAG_SECTOR_START 0x20 |
| #define | CMD_TAG_SECTOR_END 0x21 |
| #define | CMD_UNTAG_SECTOR 0x22 |
| #define | CMD_TAG_ERASE_GROUP_START 0x23 |
| #define | CMD_TAG_ERASE_GROUP_END 0x24 |
| #define | CMD_UNTAG_ERASE_GROUP 0x25 |
| #define | CMD_ERASE 0x26 |
| #define | CMD_SD_SEND_OP_COND 0x29 |
| #define | CMD_LOCK_UNLOCK 0x2a |
| #define | CMD_APP 0x37 |
| #define | CMD_READ_OCR 0x3a |
| #define | CMD_CRC_ON_OFF 0x3b |
| #define | R1_IDLE_STATE 0 |
| #define | R1_ERASE_RESET 1 |
| #define | R1_ILL_COMMAND 2 |
| #define | R1_COM_CRC_ERR 3 |
| #define | R1_ERASE_SEQ_ERR 4 |
| #define | R1_ADDR_ERR 5 |
| #define | R1_PARAM_ERR 6 |
| #define | R2_CARD_LOCKED 0 |
| #define | R2_WP_ERASE_SKIP 1 |
| #define | R2_ERR 2 |
| #define | R2_CARD_ERR 3 |
| #define | R2_CARD_ECC_FAIL 4 |
| #define | R2_WP_VIOLATION 5 |
| #define | R2_INVAL_ERASE 6 |
| #define | R2_OUT_OF_RANGE 7 |
| #define | R2_CSD_OVERWRITE 7 |
| #define | R2_IDLE_STATE (R1_IDLE_STATE + 8) |
| #define | R2_ERASE_RESET (R1_ERASE_RESET + 8) |
| #define | R2_ILL_COMMAND (R1_ILL_COMMAND + 8) |
| #define | R2_COM_CRC_ERR (R1_COM_CRC_ERR + 8) |
| #define | R2_ERASE_SEQ_ERR (R1_ERASE_SEQ_ERR + 8) |
| #define | R2_ADDR_ERR (R1_ADDR_ERR + 8) |
| #define | R2_PARAM_ERR (R1_PARAM_ERR + 8) |
| #define | R3_OCR_MASK (0xffffffffUL) |
| #define | R3_IDLE_STATE (R1_IDLE_STATE + 32) |
| #define | R3_ERASE_RESET (R1_ERASE_RESET + 32) |
| #define | R3_ILL_COMMAND (R1_ILL_COMMAND + 32) |
| #define | R3_COM_CRC_ERR (R1_COM_CRC_ERR + 32) |
| #define | R3_ERASE_SEQ_ERR (R1_ERASE_SEQ_ERR + 32) |
| #define | R3_ADDR_ERR (R1_ADDR_ERR + 32) |
| #define | R3_PARAM_ERR (R1_PARAM_ERR + 32) |
| #define | DR_STATUS_MASK 0x0e |
| #define | DR_STATUS_ACCEPTED 0x05 |
| #define | DR_STATUS_CRC_ERR 0x0a |
| #define | DR_STATUS_WRITE_ERR 0x0c |
| #define | SD_RAW_SPEC_1 0 |
| #define | SD_RAW_SPEC_2 1 |
| #define | SD_RAW_SPEC_SDHC 2 |
Functions | |
| static void | sd_raw_send_byte (uint8_t b) |
| static uint8_t | sd_raw_rec_byte () |
| static uint8_t | sd_raw_send_command (uint8_t command, uint32_t arg) |
| uint8_t | sd_raw_init () |
| uint8_t | sd_raw_available () |
| uint8_t | sd_raw_locked () |
| uint8_t | sd_raw_read (offset_t offset, uint8_t *buffer, uintptr_t length) |
| uint8_t | sd_raw_read_interval (offset_t offset, uint8_t *buffer, uintptr_t interval, uintptr_t length, sd_raw_read_interval_handler_t callback, void *p) |
| uint8_t | sd_raw_write (offset_t offset, const uint8_t *buffer, uintptr_t length) |
| uint8_t | sd_raw_write_interval (offset_t offset, uint8_t *buffer, uintptr_t length, sd_raw_write_interval_handler_t callback, void *p) |
| uint8_t | sd_raw_sync () |
| uint8_t | sd_raw_get_info (struct sd_raw_info *info) |
Variables | |
| static uint8_t | raw_block [512] |
| static offset_t | raw_block_address |
| static uint8_t | raw_block_written |
| static uint8_t | sd_raw_card_type |
Definition in file sd_raw.c.
| #define CMD_APP 0x37 |
| #define CMD_GO_IDLE_STATE 0x00 |
| #define CMD_READ_OCR 0x3a |
| #define CMD_READ_SINGLE_BLOCK 0x11 |
| #define CMD_SD_SEND_OP_COND 0x29 |
| #define CMD_SEND_CID 0x0a |
| #define CMD_SEND_CSD 0x09 |
| #define CMD_SEND_IF_COND 0x08 |
| #define CMD_SEND_OP_COND 0x01 |
| #define CMD_SET_BLOCKLEN 0x10 |
| #define CMD_WRITE_SINGLE_BLOCK 0x18 |
| #define R1_IDLE_STATE 0 |
| #define R1_ILL_COMMAND 2 |
| #define SD_RAW_SPEC_1 0 |
| #define SD_RAW_SPEC_2 1 |
| #define SD_RAW_SPEC_SDHC 2 |
Definition at line 145 of file sd_raw.c.
Referenced by sd_raw_init(), sd_raw_read(), sd_raw_read_interval(), and sd_raw_write().
uint8_t raw_block[512] [static] |
Definition at line 149 of file sd_raw.c.
Referenced by sd_raw_init(), sd_raw_read(), sd_raw_sync(), and sd_raw_write().
offset_t raw_block_address [static] |
Definition at line 151 of file sd_raw.c.
Referenced by sd_raw_init(), sd_raw_read(), sd_raw_sync(), and sd_raw_write().
uint8_t raw_block_written [static] |
Definition at line 154 of file sd_raw.c.
Referenced by sd_raw_init(), sd_raw_sync(), and sd_raw_write().
uint8_t sd_raw_card_type [static] |
Definition at line 159 of file sd_raw.c.
Referenced by sd_raw_get_info(), sd_raw_init(), sd_raw_read(), sd_raw_read_interval(), and sd_raw_write().
1.5.6