#![allow(dead_code)]
use crate::pac::common::{R, RW, Reg, W};
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Regs {
ptr: *mut u8,
}
unsafe impl Send for Regs {}
unsafe impl Sync for Regs {}
impl Regs {
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
pub const SIZE: usize = 0x200;
pub const fn tasks_start(self) -> Reg<u32, W> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x000) as _) }
}
pub const fn tasks_reset(self) -> Reg<u32, W> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x004) as _) }
}
pub const fn events_core(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x008) as _) }
}
pub const fn events_dma(self) -> EventsDma {
unsafe { EventsDma::from_ptr(self.ptr.wrapping_add(0x00C) as _) }
}
pub const fn events_idle(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x03C) as _) }
}
pub const fn shorts(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x040) as _) }
}
pub const fn inten(self) -> Reg<Inten, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x044) as _) }
}
pub const fn intenset(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x048) as _) }
}
pub const fn intenclr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x04C) as _) }
}
pub const fn intpend(self) -> Reg<u32, R> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x050) as _) }
}
pub const fn enable(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x054) as _) }
}
pub const fn config(self) -> RegConfig {
unsafe { RegConfig::from_ptr(self.ptr.wrapping_add(0x058) as _) }
}
pub const fn format(self) -> Format {
unsafe { Format::from_ptr(self.ptr.wrapping_add(0x06C) as _) }
}
pub const fn dma(self) -> Dma {
unsafe { Dma::from_ptr(self.ptr.wrapping_add(0x080) as _) }
}
pub const fn core(self) -> Core {
unsafe { Core::from_ptr(self.ptr.wrapping_add(0x0A8) as _) }
}
pub const fn spsync(self) -> Spsync {
unsafe { Spsync::from_ptr(self.ptr.wrapping_add(0x1A8) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct EventsDma {
ptr: *mut u8,
}
unsafe impl Send for EventsDma {}
unsafe impl Sync for EventsDma {}
impl EventsDma {
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
pub const fn events_done(self) -> EventsDmaDone {
unsafe { EventsDmaDone::from_ptr(self.ptr.wrapping_add(0x00) as _) }
}
pub const fn error(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x14) as _) }
}
pub const fn paused(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x18) as _) }
}
pub const fn reset(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x1C) as _) }
}
pub const fn done(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x20) as _) }
}
pub const fn txunexpectedidle(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x24) as _) }
}
pub const fn internalbuserror(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x28) as _) }
}
pub const fn aborted(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x2C) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct EventsDmaDone {
ptr: *mut u8,
}
unsafe impl Send for EventsDmaDone {}
unsafe impl Sync for EventsDmaDone {}
impl EventsDmaDone {
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
pub const fn list(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x00) as _) }
}
pub const fn listpart(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x04) as _) }
}
pub const fn selectjob(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x08) as _) }
}
pub const fn data(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x0C) as _) }
}
pub const fn job(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x10) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct RegConfig {
ptr: *mut u8,
}
unsafe impl Send for RegConfig {}
unsafe impl Sync for RegConfig {}
impl RegConfig {
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
pub const fn txburstlength(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x00) as _) }
}
pub const fn rxburstlength(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x04) as _) }
}
pub const fn rxtransferlength(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x08) as _) }
}
pub const fn stopon(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x0C) as _) }
}
pub const fn aximode(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x10) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Format {
ptr: *mut u8,
}
unsafe impl Send for Format {}
unsafe impl Sync for Format {}
impl Format {
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
pub const fn dfs(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x00) as _) }
}
pub const fn bpp(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x04) as _) }
}
pub const fn pixels(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x08) as _) }
}
pub const fn cilen(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x0C) as _) }
}
pub const fn bitorder(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x10) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Dma {
ptr: *mut u8,
}
unsafe impl Send for Dma {}
unsafe impl Sync for Dma {}
impl Dma {
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
pub const fn status(self) -> DmaStatus {
unsafe { DmaStatus::from_ptr(self.ptr.wrapping_add(0x00) as _) }
}
pub const fn config(self) -> DmaConfig {
unsafe { DmaConfig::from_ptr(self.ptr.wrapping_add(0x1C) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaStatus {
ptr: *mut u8,
}
unsafe impl Send for DmaStatus {}
unsafe impl Sync for DmaStatus {}
impl DmaStatus {
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
pub const fn bytecount(self) -> Reg<u32, R> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x00) as _) }
}
pub const fn attribute(self) -> Reg<u32, R> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x04) as _) }
}
pub const fn address(self) -> Reg<u32, R> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x08) as _) }
}
pub const fn jobcount(self) -> Reg<u32, R> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x0C) as _) }
}
pub const fn buserror(self) -> Reg<u32, R> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x10) as _) }
}
pub const fn fifo(self) -> Reg<u32, R> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x14) as _) }
}
pub const fn active(self) -> Reg<u32, R> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x18) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct DmaConfig {
ptr: *mut u8,
}
unsafe impl Send for DmaConfig {}
unsafe impl Sync for DmaConfig {}
impl DmaConfig {
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
pub const fn bufferfill(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x00) as _) }
}
pub const fn listptr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x04) as _) }
}
pub const fn listpartthresh(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x08) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Core {
ptr: *mut u8,
}
unsafe impl Send for Core {}
unsafe impl Sync for Core {}
impl Core {
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
pub const fn ctrlr0(self) -> Reg<Ctrlr0, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x00) as _) }
}
pub const fn ctrlr1(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x04) as _) }
}
pub const fn sqspienr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x08) as _) }
}
pub const fn mwcr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x0C) as _) }
}
pub const fn ser(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x10) as _) }
}
pub const fn baudr(self) -> Reg<Baudr, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x14) as _) }
}
pub const fn txftlr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x18) as _) }
}
pub const fn rxftlr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x1C) as _) }
}
pub const fn txflr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x20) as _) }
}
pub const fn rxflr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x24) as _) }
}
pub const fn sr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x28) as _) }
}
pub const fn imr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x2C) as _) }
}
pub const fn isr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x30) as _) }
}
pub const fn risr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x34) as _) }
}
pub const fn txeicr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x38) as _) }
}
pub const fn rxoicr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x3C) as _) }
}
pub const fn rxuicr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x40) as _) }
}
pub const fn msticr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x44) as _) }
}
pub const fn icr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x48) as _) }
}
pub const fn dmacr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x4C) as _) }
}
pub const fn dmatdlr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x50) as _) }
}
pub const fn dmardlr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x54) as _) }
}
pub const fn idr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x58) as _) }
}
pub const fn sqspicversionid(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x5C) as _) }
}
pub const fn dr(self, index: usize) -> Reg<u32, RW> {
core::assert!(index < 36);
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0x60 + index * 4) as _) }
}
pub const fn rxsampledelay(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0xF0) as _) }
}
pub const fn spictrlr0(self) -> Reg<Spictrlr0, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0xF4) as _) }
}
pub const fn spictrlr1(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0xF8) as _) }
}
pub const fn spitecr(self) -> Reg<u32, RW> {
unsafe { Reg::from_ptr(self.ptr.wrapping_add(0xFC) as _) }
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Spsync {
ptr: *mut u8,
}
unsafe impl Send for Spsync {}
unsafe impl Sync for Spsync {}
impl Spsync {
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
pub const fn aux(self, index: usize) -> Reg<u32, RW> {
core::assert!(index < 4);
unsafe { Reg::from_ptr(self.ptr.wrapping_add(index * 4) as _) }
}
}
pub const SP_VPR_BASE_FREQ_HZ: u32 = 128_000_000;
pub const SP_VPR_EVENT_IDX: usize = 20;
pub const SP_VPR_TASK_DPPI_0_IDX: usize = 16;
pub const SP_VPR_TASK_CONFIG_IDX: usize = 17;
pub const SP_VPR_TASK_ACTION_IDX: usize = 18;
pub const SP_VPR_TASK_STOP_IDX: usize = 19;
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Default)]
pub struct Ctrlr0(pub u32);
impl Ctrlr0 {
pub const fn set_dfs(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 0)) | (((val as u32) & 0x1f) << 0);
}
pub const fn set_scph(&mut self, val: bool) {
self.0 = (self.0 & !(1 << 8)) | ((val as u32) << 8);
}
pub const fn set_scpol(&mut self, val: bool) {
self.0 = (self.0 & !(1 << 9)) | ((val as u32) << 9);
}
pub const fn set_tmod(&mut self, val: u8) {
self.0 = (self.0 & !(0x3 << 10)) | (((val as u32) & 0x3) << 10);
}
pub const fn set_cfs(&mut self, val: u8) {
self.0 = (self.0 & !(0xf << 16)) | (((val as u32) & 0xf) << 16);
}
pub const fn set_spi_frf(&mut self, val: u8) {
self.0 = (self.0 & !(0x3 << 22)) | (((val as u32) & 0x3) << 22);
}
pub const fn set_sqspiismst(&mut self, val: bool) {
self.0 = (self.0 & !(1 << 31)) | ((val as u32) << 31);
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Default)]
pub struct Spictrlr0(pub u32);
impl Spictrlr0 {
pub const fn set_transtype(&mut self, val: u8) {
self.0 = (self.0 & !(0x3 << 0)) | (((val as u32) & 0x3) << 0);
}
pub const fn set_addrl(&mut self, val: u8) {
self.0 = (self.0 & !(0xf << 2)) | (((val as u32) & 0xf) << 2);
}
pub const fn set_instl(&mut self, val: u8) {
self.0 = (self.0 & !(0x3 << 8)) | (((val as u32) & 0x3) << 8);
}
pub const fn set_waitcycles(&mut self, val: u8) {
self.0 = (self.0 & !(0x1f << 11)) | (((val as u32) & 0x1f) << 11);
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Default)]
pub struct Inten(pub u32);
impl Inten {
pub const fn set_dmadonejob(&mut self, val: bool) {
self.0 = (self.0 & !(1 << 5)) | ((val as u32) << 5);
}
pub const fn set_dmadone(&mut self, val: bool) {
self.0 = (self.0 & !(1 << 9)) | ((val as u32) << 9);
}
pub const fn set_dmaaborted(&mut self, val: bool) {
self.0 = (self.0 & !(1 << 12)) | ((val as u32) << 12);
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Default)]
pub struct Baudr(pub u32);
impl Baudr {
pub const fn set_sckdv(&mut self, val: u16) {
self.0 = (self.0 & !(0x7fff << 1)) | (((val as u32) & 0x7fff) << 1);
}
}