use volatile_register::{RO, WO, RW}; use crate::{register, register_bit, register_bits, register_bits_typed}; #[repr(C)] pub struct RegisterBlock { pub config: Config, pub intr_status: RW, pub intr_en: RW, pub intr_dis: RW, pub intr_mask: RO, pub enable: RW, pub delay: RW, pub txd0: WO, pub rx_data: RO, pub slave_idle_count: RW, pub tx_thres: RW, pub rx_thes: RW, pub gpio: RW, pub _unused1: RO, pub lpbk_dly_adj: RW, pub _unused2: [RO; 17], pub txd1: WO, pub txd2: WO, pub txd3: WO, pub _unused3: [RO; 5], pub lqspi_cfg: RW, pub lqspi_sts: RW, pub _unused4: [RO; 21], pub mod_id: RW, } impl RegisterBlock { const BASE_ADDRESS: *mut Self = 0xE000D000 as *mut _; pub fn qspi() -> &'static mut Self { unsafe { &mut *Self::BASE_ADDRESS } } } register!(config, Config, RW, u32); register_bit!(config, /// Enables master mode mode_sel, 0); register_bit!(config, /// Clock polarity low/high clk_pol, 1); register_bit!(config, /// Clock phase clk_ph, 2); register_bits!(config, /// divisor = 2 ** (1 + baud_rate_div) baud_rate_div, u8, 3, 5); register_bits!(config, /// Must be set to 0b11 fifo_width, u8, 6, 7); register_bit!(config, /// Must be 0 ref_clk, 8); register_bit!(config, /// Peripheral Chip Select Line pcs, 10); register_bit!(config, /// false: auto mode, true: manual CS mode manual_cs, 14); register_bit!(config, /// false: auto mode, true: enables manual start enable man_start_en, 15); register_bit!(config, /// false: auto mode, true: enables manual start command man_start_com, 16); register_bit!(config, holdb_dr, 19); register_bit!(config, /// false: little, true: endian endian, 26); register_bit!(config, /// false: legacy SPI mode, true: Flash memory interface mode leg_flsh, 31);