46 } __attribute__((packed));
67 uint8_t read_bl_len:4;
69 uint8_t c_size_high:2;
72 uint8_t read_blk_misalign:1;
73 uint8_t write_blk_misalign:1;
74 uint8_t read_bl_partial:1;
76 uint8_t vdd_r_curr_max:3;
77 uint8_t vdd_r_curr_min:3;
78 uint8_t c_size_low :2;
79 uint8_t c_size_mult_high:2;
80 uint8_t vdd_w_cur_max:3;
81 uint8_t vdd_w_curr_min:3;
82 uint8_t sector_size_high:6;
83 uint8_t erase_blk_en:1;
84 uint8_t c_size_mult_low:1;
85 uint8_t wp_grp_size:7;
86 uint8_t sector_size_low:1;
87 uint8_t write_bl_len_high:2;
90 uint8_t wp_grp_enable:1;
92 uint8_t write_partial:1;
93 uint8_t write_bl_len_low:2;
95 uint8_t file_format:2;
96 uint8_t tmp_write_protect:1;
97 uint8_t perm_write_protect:1;
99 uint8_t file_format_grp:1;
111 uint8_t read_bl_len:4;
115 uint8_t read_blk_misalign:1;
116 uint8_t write_blk_misalign:1;
117 uint8_t read_bl_partial:1;
118 uint8_t c_size_high:6;
122 uint8_t sector_size_high:6;
123 uint8_t erase_blk_en:1;
125 uint8_t wp_grp_size:7;
126 uint8_t sector_size_low:1;
127 uint8_t write_bl_len_high:2;
128 uint8_t r2w_factor:3;
130 uint8_t wp_grp_enable:1;
132 uint8_t write_partial:1;
133 uint8_t write_bl_len_low:2;
135 uint8_t file_format:2;
136 uint8_t tmp_write_protect:1;
137 uint8_t perm_write_protect:1;
139 uint8_t file_format_grp:1;
185 } __attribute__((packed));
196 } __attribute__((packed));
209 } __attribute__((packed));;
215 uint8_t in_idle_state:1;
216 uint8_t erase_reset:1;
217 uint8_t illegal_command:1;
218 uint8_t com_crc_error:1;
219 uint8_t erase_sequence_error:1;
220 uint8_t address_error:1;
221 uint8_t parameter_error:1;
224 R1(uint8_t value = 0) { as_uint8 = value; }
225 bool is_error()
const {
return ((as_uint8 & 0x7e) != 0); }
233 uint8_t card_is_locked:1;
237 uint8_t card_ecc_failed:1;
238 uint8_t wp_violation:1;
239 uint8_t erase_param:1;
240 uint8_t out_of_range:1;
242 R2(uint8_t value = 0) { as_uint8 = value; }
247 uint32_t vdd_voltage_window:24;
248 uint8_t switch_to_1V8_accepted:1;
250 uint8_t uhs_ii_card:1;
251 uint8_t card_capacity:1;
252 uint8_t card_power_up:1;
262 R6(uint32_t value = 0L) { as_uint32 = value; }
270 uint8_t voltage_accepted:4;
271 uint32_t reserved:16;
272 uint8_t command_version:4;
274 R7(uint32_t value = 0L) { as_uint32 = value; }
288 } __attribute__((packed));
322 uint8_t
send(
CMD command, uint32_t arg = 0L);
332 bool send(uint16_t ms,
CMD command, uint32_t arg = 0L);
341 uint8_t
send(
ACMD command, uint32_t arg = 0L);
352 bool send(uint16_t ms,
ACMD command, uint32_t arg = 0L);
362 bool await(uint16_t ms = 0, uint8_t token = 0);
380 bool read(
CMD command, uint32_t arg,
void* buf,
size_t count);
388 #if defined(BOARD_ATTINYX5) 393 #elif defined(WICKEDDEVICE_WILDFIRE) 436 bool erase(uint32_t start, uint32_t end);
446 bool read(uint32_t block, uint8_t* dst)
447 __attribute__((always_inline))
461 __attribute__((always_inline))
473 __attribute__((always_inline))
485 bool write(uint32_t block,
const uint8_t* src);
Asks the selected card to send CSD.
char oid[2]
OEM/Application ID.
Set/reset password or unlock/lock card.
Sends host capacity support information.
uint32_t psn
Product serial number.
Checks switchable function.
bool erase(uint32_t start, uint32_t end)
static const uint16_t ERASE_TIMEOUT
static const uint16_t WRITE_TIMEOUT
static const size_t BLOCK_MAX
Enable pull-up resistor on CD/DAT3 (pin 1).
static const uint8_t INIT_RETRY
Reads the Configuration Register.
static const uint8_t INIT_PULSES
Write block length bytes.
Number of pre-erased write blocks.
Next command is application specific command.
bool write(uint32_t block, const uint8_t *src)
Divide system clock by 128.
Reset the SD Memory Card.
Set programmable bits in CSD.
Asks the selected card to send CID.
Read blocks until STOP_TRANSMISSION.
Send 64 byte tuning pattern to card.
uint16_t mdt
Manufacturing date.
Sends SD Memory Card interface condition.
static const uint8_t CHECK_PATTERN
static const uint16_t INIT_TIMEOUT
uint8_t mid
Manufacturer ID.
Toggles card state (stdby/prog and disc).
Set first write block to be erased.
Asks the selected card status register.
Defines the data bus width.
SD(Board::DigitalPin csn=Board::D8)
bool read(uint32_t block, uint8_t *dst)
Switch to 1V8 bus signaling level.
Set block length (in bytes).
bool await(uint16_t ms=0, uint8_t token=0)
bool read(CMD command, uint32_t arg, void *buf, size_t count)
uint8_t prv
Product revision.
static const uint16_t READ_TIMEOUT
bool begin(SPI::Clock rate=SPI::DIV128_CLOCK)
Programs the DSR of all cards.
static const uint8_t RESPONSE_RETRY
Set last write block to be erased.
Host capacity support information.
Clears write protect bit.
Addressed card into inactive state.
Read OCR register of a card.
Write block until STOP_TRANSMISSION.
Checks switchable function.
uint8_t send(CMD command, uint32_t arg=0L)
Stop Multiple Block Read.
Specify block count for multiple block.
Erases selected write blocks.
uint8_t crc
CRC7 checksum.
Driver(Board::DigitalPin cs, Pulse pulse=DEFAULT_PULSE, Clock rate=DEFAULT_CLOCK, uint8_t mode=0, Order order=MSB_ORDER, Interrupt::Handler *irq=NULL)
Data block for application specific command.