#include <string.h>
#include <avr/io.h>
#include "sd_mmc.h"
#include "uart.h"
#include "spi.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_LOCK_UNLOCK 0x2a |
#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 |
Functions | |
static uint8_t | sd_send_command_r1 (uint8_t command, uint32_t arg) |
static uint16_t | sd_send_command_r2 (uint8_t command, uint32_t arg) |
uint8_t | sd_init () |
uint8_t | sd_available () |
uint8_t | sd_locked () |
uint8_t | sd_read (uint32_t offset, uint8_t *buffer, uint16_t length) |
uint8_t | sd_read_interval (uint32_t offset, uint8_t *buffer, uint16_t interval, uint16_t length, sd_raw_read_interval_handler_t callback, void *p) |
uint8_t | sd_write (uint32_t offset, const uint8_t *buffer, uint16_t length) |
uint8_t | sd_write_interval (uint32_t offset, uint8_t *buffer, uint16_t length, sd_raw_write_interval_handler_t callback, void *p) |
uint8_t | sd_sync () |
uint8_t | sd_get_info (struct sd_raw_info *info) |
Variables | |
static uint8_t | raw_block [512] |
static uint32_t | raw_block_address |
static uint8_t | raw_block_written |
Definition in file sd_mmc.c.
#define CMD_GO_IDLE_STATE 0x00 |
Definition at line 53 of file sd_mmc.c.
Referenced by sd_init(), sd_send_command_r1(), and sd_send_command_r2().
#define CMD_READ_SINGLE_BLOCK 0x11 |
#define CMD_SEND_CID 0x0a |
#define CMD_SEND_CSD 0x09 |
#define CMD_WRITE_SINGLE_BLOCK 0x18 |
uint8_t raw_block[512] [static] |
uint32_t raw_block_address [static] |
uint8_t raw_block_written [static] |