use bitflags::bitflags;
#[derive(Debug, Default)]
pub struct SdCsd {
pub csd_structure: u8,
pub data_read_access_time1: u8,
pub data_read_access_time2: u8,
pub transfer_speed: u8,
pub card_command_classes: u16,
pub read_block_length: u8,
pub flags: u16,
pub device_size: u32,
pub read_current_vdd_min: u8,
pub read_current_vdd_max: u8,
pub write_current_vdd_min: u8,
pub write_current_vdd_max: u8,
pub device_size_multiplier: u8,
pub erase_sector_size: u8,
pub write_protect_group_size: u8,
pub write_speed_factor: u8,
pub write_block_length: u8,
pub file_format: u8,
}
impl SdCsd {
pub fn new() -> Self {
SdCsd {
csd_structure: 0,
data_read_access_time1: 0,
data_read_access_time2: 0,
transfer_speed: 0,
card_command_classes: 0,
read_block_length: 0,
flags: 0,
device_size: 0,
read_current_vdd_min: 0,
read_current_vdd_max: 0,
write_current_vdd_min: 0,
write_current_vdd_max: 0,
device_size_multiplier: 0,
erase_sector_size: 0,
write_protect_group_size: 0,
write_speed_factor: 0,
write_block_length: 0,
file_format: 0,
}
}
}
bitflags! {
pub struct CsdFlags: u16 {
const READ_BLOCK_PARTIAL = 1 << 0;
const WRITE_BLOCK_MISALIGN = 1 << 1;
const READ_BLOCK_MISALIGN = 1 << 2;
const DSR_IMPLEMENTED = 1 << 3;
const ERASE_BLOCK_ENABLED = 1 << 4;
const WRITE_PROTECT_GROUP_ENABLED = 1 << 5;
const WRITE_BLOCK_PARTIAL = 1 << 6;
const FILE_FORMAT_GROUP = 1 << 7;
const COPY = 1 << 8;
const PERMANENT_WRITE_PROTECT = 1 << 9;
const TEMPORARY_WRITE_PROTECT = 1 << 10;
}
}
bitflags! {
pub struct SdCardCmdClass: u16 {
const Basic = 1 << 0;
const BlockRead = 1 << 2;
const BlockWrite = 1 << 4;
const Erase = 1 << 5;
const WriteProtect = 1 << 6;
const LockCard = 1 << 7;
const ApplicationSpecific = 1 << 8;
const InputOutputMode = 1 << 9;
const Switch = 1 << 10;
}
}