From 0666a6ba1dbd66cf8b93c113e362ccbcd99152a0 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Sat, 6 Nov 2021 11:50:33 +0100 Subject: Initial commit --- src/tc0.rs | 146 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 src/tc0.rs (limited to 'src/tc0.rs') diff --git a/src/tc0.rs b/src/tc0.rs new file mode 100644 index 0000000..86e973b --- /dev/null +++ b/src/tc0.rs @@ -0,0 +1,146 @@ +#[doc = r"Register block"] +#[repr(C)] +pub struct RegisterBlock { + _reserved_0_count8: [u8; 0x38], +} +impl RegisterBlock { + #[doc = "0x00..0x38 - 32-bit Counter Mode"] + #[inline(always)] + pub fn count32(&self) -> &COUNT32 { + unsafe { &*(((self as *const Self) as *const u8).add(0usize) as *const COUNT32) } + } + #[doc = "0x00..0x34 - 16-bit Counter Mode"] + #[inline(always)] + pub fn count16(&self) -> &COUNT16 { + unsafe { &*(((self as *const Self) as *const u8).add(0usize) as *const COUNT16) } + } + #[doc = "0x00..0x32 - 8-bit Counter Mode"] + #[inline(always)] + pub fn count8(&self) -> &COUNT8 { + unsafe { &*(((self as *const Self) as *const u8).add(0usize) as *const COUNT8) } + } +} +#[doc = r"Register block"] +#[repr(C)] +pub struct COUNT8 { + #[doc = "0x00 - Control A"] + pub ctrla: crate::Reg, + #[doc = "0x04 - Control B Clear"] + pub ctrlbclr: crate::Reg, + #[doc = "0x05 - Control B Set"] + pub ctrlbset: crate::Reg, + #[doc = "0x06 - Event Control"] + pub evctrl: crate::Reg, + #[doc = "0x08 - Interrupt Enable Clear"] + pub intenclr: crate::Reg, + #[doc = "0x09 - Interrupt Enable Set"] + pub intenset: crate::Reg, + #[doc = "0x0a - Interrupt Flag Status and Clear"] + pub intflag: crate::Reg, + #[doc = "0x0b - Status"] + pub status: crate::Reg, + #[doc = "0x0c - Waveform Generation Control"] + pub wave: crate::Reg, + #[doc = "0x0d - Control C"] + pub drvctrl: crate::Reg, + _reserved10: [u8; 0x01], + #[doc = "0x0f - Debug Control"] + pub dbgctrl: crate::Reg, + #[doc = "0x10 - Synchronization Status"] + pub syncbusy: crate::Reg, + #[doc = "0x14 - COUNT8 Count"] + pub count: crate::Reg, + _reserved13: [u8; 0x06], + #[doc = "0x1b - COUNT8 Period"] + pub per: crate::Reg, + #[doc = "0x1c - COUNT8 Compare and Capture"] + pub cc: [crate::Reg; 2], + _reserved15: [u8; 0x11], + #[doc = "0x2f - COUNT8 Period Buffer"] + pub perbuf: crate::Reg, + #[doc = "0x30 - COUNT8 Compare and Capture Buffer"] + pub ccbuf: [crate::Reg; 2], +} +#[doc = r"Register block"] +#[doc = "8-bit Counter Mode"] +pub mod count8; +#[doc = r"Register block"] +#[repr(C)] +pub struct COUNT16 { + #[doc = "0x00 - Control A"] + pub ctrla: crate::Reg, + #[doc = "0x04 - Control B Clear"] + pub ctrlbclr: crate::Reg, + #[doc = "0x05 - Control B Set"] + pub ctrlbset: crate::Reg, + #[doc = "0x06 - Event Control"] + pub evctrl: crate::Reg, + #[doc = "0x08 - Interrupt Enable Clear"] + pub intenclr: crate::Reg, + #[doc = "0x09 - Interrupt Enable Set"] + pub intenset: crate::Reg, + #[doc = "0x0a - Interrupt Flag Status and Clear"] + pub intflag: crate::Reg, + #[doc = "0x0b - Status"] + pub status: crate::Reg, + #[doc = "0x0c - Waveform Generation Control"] + pub wave: crate::Reg, + #[doc = "0x0d - Control C"] + pub drvctrl: crate::Reg, + _reserved10: [u8; 0x01], + #[doc = "0x0f - Debug Control"] + pub dbgctrl: crate::Reg, + #[doc = "0x10 - Synchronization Status"] + pub syncbusy: crate::Reg, + #[doc = "0x14 - COUNT16 Count"] + pub count: crate::Reg, + _reserved13: [u8; 0x06], + #[doc = "0x1c - COUNT16 Compare and Capture"] + pub cc: [crate::Reg; 2], + _reserved14: [u8; 0x10], + #[doc = "0x30 - COUNT16 Compare and Capture Buffer"] + pub ccbuf: [crate::Reg; 2], +} +#[doc = r"Register block"] +#[doc = "16-bit Counter Mode"] +pub mod count16; +#[doc = r"Register block"] +#[repr(C)] +pub struct COUNT32 { + #[doc = "0x00 - Control A"] + pub ctrla: crate::Reg, + #[doc = "0x04 - Control B Clear"] + pub ctrlbclr: crate::Reg, + #[doc = "0x05 - Control B Set"] + pub ctrlbset: crate::Reg, + #[doc = "0x06 - Event Control"] + pub evctrl: crate::Reg, + #[doc = "0x08 - Interrupt Enable Clear"] + pub intenclr: crate::Reg, + #[doc = "0x09 - Interrupt Enable Set"] + pub intenset: crate::Reg, + #[doc = "0x0a - Interrupt Flag Status and Clear"] + pub intflag: crate::Reg, + #[doc = "0x0b - Status"] + pub status: crate::Reg, + #[doc = "0x0c - Waveform Generation Control"] + pub wave: crate::Reg, + #[doc = "0x0d - Control C"] + pub drvctrl: crate::Reg, + _reserved10: [u8; 0x01], + #[doc = "0x0f - Debug Control"] + pub dbgctrl: crate::Reg, + #[doc = "0x10 - Synchronization Status"] + pub syncbusy: crate::Reg, + #[doc = "0x14 - COUNT32 Count"] + pub count: crate::Reg, + _reserved13: [u8; 0x04], + #[doc = "0x1c..0x24 - COUNT32 Compare and Capture"] + pub cc: [crate::Reg; 2], + _reserved14: [u8; 0x0c], + #[doc = "0x30..0x38 - COUNT32 Compare and Capture Buffer"] + pub ccbuf: [crate::Reg; 2], +} +#[doc = r"Register block"] +#[doc = "32-bit Counter Mode"] +pub mod count32; -- cgit v1.2.3-70-g09d2