Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CLIC peripheral for ESP32-P4 #301

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions esp32p4/src/clic.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#[repr(C)]
#[cfg_attr(feature = "impl-register-debug", derive(Debug))]
#[doc = "Register block"]
pub struct RegisterBlock {
int_config: INT_CONFIG,
int_info: INT_INFO,
int_thresh: INT_THRESH,
_reserved3: [u8; 0x0ff4],
int_ctrl: [INT_CTRL; 48],
}
impl RegisterBlock {
#[doc = "0x00 - Interrupt configuration register"]
#[inline(always)]
pub const fn int_config(&self) -> &INT_CONFIG {
&self.int_config
}
#[doc = "0x04 - Interrupt information register"]
#[inline(always)]
pub const fn int_info(&self) -> &INT_INFO {
&self.int_info
}
#[doc = "0x08 - Interrupt threshold register"]
#[inline(always)]
pub const fn int_thresh(&self) -> &INT_THRESH {
&self.int_thresh
}
#[doc = "0x1000..0x10c0 - Interrupt control register for each interrupt source"]
#[inline(always)]
pub const fn int_ctrl(&self, n: usize) -> &INT_CTRL {
&self.int_ctrl[n]
}
#[doc = "Iterator for array of:"]
#[doc = "0x1000..0x10c0 - Interrupt control register for each interrupt source"]
#[inline(always)]
pub fn int_ctrl_iter(&self) -> impl Iterator<Item = &INT_CTRL> {
self.int_ctrl.iter()
}
}
#[doc = "INT_CONFIG (rw) register accessor: Interrupt configuration register\n\nYou can [`read`](crate::Reg::read) this register and get [`int_config::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`int_config::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@int_config`] module"]
pub type INT_CONFIG = crate::Reg<int_config::INT_CONFIG_SPEC>;
#[doc = "Interrupt configuration register"]
pub mod int_config;
#[doc = "INT_INFO (rw) register accessor: Interrupt information register\n\nYou can [`read`](crate::Reg::read) this register and get [`int_info::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`int_info::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@int_info`] module"]
pub type INT_INFO = crate::Reg<int_info::INT_INFO_SPEC>;
#[doc = "Interrupt information register"]
pub mod int_info;
#[doc = "INT_THRESH (rw) register accessor: Interrupt threshold register\n\nYou can [`read`](crate::Reg::read) this register and get [`int_thresh::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`int_thresh::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@int_thresh`] module"]
pub type INT_THRESH = crate::Reg<int_thresh::INT_THRESH_SPEC>;
#[doc = "Interrupt threshold register"]
pub mod int_thresh;
#[doc = "INT_CTRL (rw) register accessor: Interrupt control register for each interrupt source\n\nYou can [`read`](crate::Reg::read) this register and get [`int_ctrl::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`int_ctrl::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@int_ctrl`] module"]
pub type INT_CTRL = crate::Reg<int_ctrl::INT_CTRL_SPEC>;
#[doc = "Interrupt control register for each interrupt source"]
pub mod int_ctrl;
80 changes: 80 additions & 0 deletions esp32p4/src/clic/int_config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#[doc = "Register `INT_CONFIG` reader"]
pub type R = crate::R<INT_CONFIG_SPEC>;
#[doc = "Register `INT_CONFIG` writer"]
pub type W = crate::W<INT_CONFIG_SPEC>;
#[doc = "Field `INT_CONFIG_NVBITS` reader - Number of vector bits for interrupt"]
pub type INT_CONFIG_NVBITS_R = crate::BitReader;
#[doc = "Field `INT_CONFIG_NVBITS` writer - Number of vector bits for interrupt"]
pub type INT_CONFIG_NVBITS_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `INT_CONFIG_NLBITS` reader - Number of level bits for interrupt"]
pub type INT_CONFIG_NLBITS_R = crate::FieldReader;
#[doc = "Field `INT_CONFIG_NLBITS` writer - Number of level bits for interrupt"]
pub type INT_CONFIG_NLBITS_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
#[doc = "Field `INT_CONFIG_NMBITS` reader - Number of mode bits for interrupt"]
pub type INT_CONFIG_NMBITS_R = crate::FieldReader;
#[doc = "Field `INT_CONFIG_NMBITS` writer - Number of mode bits for interrupt"]
pub type INT_CONFIG_NMBITS_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
impl R {
#[doc = "Bit 0 - Number of vector bits for interrupt"]
#[inline(always)]
pub fn int_config_nvbits(&self) -> INT_CONFIG_NVBITS_R {
INT_CONFIG_NVBITS_R::new((self.bits & 1) != 0)
}
#[doc = "Bits 1:4 - Number of level bits for interrupt"]
#[inline(always)]
pub fn int_config_nlbits(&self) -> INT_CONFIG_NLBITS_R {
INT_CONFIG_NLBITS_R::new(((self.bits >> 1) & 0x0f) as u8)
}
#[doc = "Bits 5:6 - Number of mode bits for interrupt"]
#[inline(always)]
pub fn int_config_nmbits(&self) -> INT_CONFIG_NMBITS_R {
INT_CONFIG_NMBITS_R::new(((self.bits >> 5) & 3) as u8)
}
}
#[cfg(feature = "impl-register-debug")]
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("INT_CONFIG")
.field("int_config_nmbits", &self.int_config_nmbits())
.field("int_config_nlbits", &self.int_config_nlbits())
.field("int_config_nvbits", &self.int_config_nvbits())
.finish()
}
}
impl W {
#[doc = "Bit 0 - Number of vector bits for interrupt"]
#[inline(always)]
#[must_use]
pub fn int_config_nvbits(&mut self) -> INT_CONFIG_NVBITS_W<INT_CONFIG_SPEC> {
INT_CONFIG_NVBITS_W::new(self, 0)
}
#[doc = "Bits 1:4 - Number of level bits for interrupt"]
#[inline(always)]
#[must_use]
pub fn int_config_nlbits(&mut self) -> INT_CONFIG_NLBITS_W<INT_CONFIG_SPEC> {
INT_CONFIG_NLBITS_W::new(self, 1)
}
#[doc = "Bits 5:6 - Number of mode bits for interrupt"]
#[inline(always)]
#[must_use]
pub fn int_config_nmbits(&mut self) -> INT_CONFIG_NMBITS_W<INT_CONFIG_SPEC> {
INT_CONFIG_NMBITS_W::new(self, 5)
}
}
#[doc = "Interrupt configuration register\n\nYou can [`read`](crate::Reg::read) this register and get [`int_config::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`int_config::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct INT_CONFIG_SPEC;
impl crate::RegisterSpec for INT_CONFIG_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [`int_config::R`](R) reader structure"]
impl crate::Readable for INT_CONFIG_SPEC {}
#[doc = "`write(|w| ..)` method takes [`int_config::W`](W) writer structure"]
impl crate::Writable for INT_CONFIG_SPEC {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets INT_CONFIG to value 0"]
impl crate::Resettable for INT_CONFIG_SPEC {
const RESET_VALUE: u32 = 0;
}
128 changes: 128 additions & 0 deletions esp32p4/src/clic/int_ctrl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#[doc = "Register `INT_CTRL%s` reader"]
pub type R = crate::R<INT_CTRL_SPEC>;
#[doc = "Register `INT_CTRL%s` writer"]
pub type W = crate::W<INT_CTRL_SPEC>;
#[doc = "Field `INT_IP` reader - Pending interrupt bit"]
pub type INT_IP_R = crate::BitReader;
#[doc = "Field `INT_IP` writer - Pending interrupt bit"]
pub type INT_IP_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `INT_IE` reader - Interrupt enable bit"]
pub type INT_IE_R = crate::BitReader;
#[doc = "Field `INT_IE` writer - Interrupt enable bit"]
pub type INT_IE_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `INT_ATTR_SHV` reader - Shadow vector attribute"]
pub type INT_ATTR_SHV_R = crate::BitReader;
#[doc = "Field `INT_ATTR_SHV` writer - Shadow vector attribute"]
pub type INT_ATTR_SHV_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `INT_ATTR_TRIG` reader - Trigger attribute for interrupt"]
pub type INT_ATTR_TRIG_R = crate::FieldReader;
#[doc = "Field `INT_ATTR_TRIG` writer - Trigger attribute for interrupt"]
pub type INT_ATTR_TRIG_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
#[doc = "Field `INT_ATTR_MODE` reader - Interrupt mode attribute"]
pub type INT_ATTR_MODE_R = crate::FieldReader;
#[doc = "Field `INT_ATTR_MODE` writer - Interrupt mode attribute"]
pub type INT_ATTR_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
#[doc = "Field `INT_CTL` reader - Control bits for interrupt"]
pub type INT_CTL_R = crate::FieldReader;
#[doc = "Field `INT_CTL` writer - Control bits for interrupt"]
pub type INT_CTL_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
impl R {
#[doc = "Bit 0 - Pending interrupt bit"]
#[inline(always)]
pub fn int_ip(&self) -> INT_IP_R {
INT_IP_R::new((self.bits & 1) != 0)
}
#[doc = "Bit 8 - Interrupt enable bit"]
#[inline(always)]
pub fn int_ie(&self) -> INT_IE_R {
INT_IE_R::new(((self.bits >> 8) & 1) != 0)
}
#[doc = "Bit 16 - Shadow vector attribute"]
#[inline(always)]
pub fn int_attr_shv(&self) -> INT_ATTR_SHV_R {
INT_ATTR_SHV_R::new(((self.bits >> 16) & 1) != 0)
}
#[doc = "Bits 17:18 - Trigger attribute for interrupt"]
#[inline(always)]
pub fn int_attr_trig(&self) -> INT_ATTR_TRIG_R {
INT_ATTR_TRIG_R::new(((self.bits >> 17) & 3) as u8)
}
#[doc = "Bits 22:23 - Interrupt mode attribute"]
#[inline(always)]
pub fn int_attr_mode(&self) -> INT_ATTR_MODE_R {
INT_ATTR_MODE_R::new(((self.bits >> 22) & 3) as u8)
}
#[doc = "Bits 24:31 - Control bits for interrupt"]
#[inline(always)]
pub fn int_ctl(&self) -> INT_CTL_R {
INT_CTL_R::new(((self.bits >> 24) & 0xff) as u8)
}
}
#[cfg(feature = "impl-register-debug")]
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("INT_CTRL")
.field("int_ctl", &self.int_ctl())
.field("int_attr_mode", &self.int_attr_mode())
.field("int_attr_trig", &self.int_attr_trig())
.field("int_attr_shv", &self.int_attr_shv())
.field("int_ie", &self.int_ie())
.field("int_ip", &self.int_ip())
.finish()
}
}
impl W {
#[doc = "Bit 0 - Pending interrupt bit"]
#[inline(always)]
#[must_use]
pub fn int_ip(&mut self) -> INT_IP_W<INT_CTRL_SPEC> {
INT_IP_W::new(self, 0)
}
#[doc = "Bit 8 - Interrupt enable bit"]
#[inline(always)]
#[must_use]
pub fn int_ie(&mut self) -> INT_IE_W<INT_CTRL_SPEC> {
INT_IE_W::new(self, 8)
}
#[doc = "Bit 16 - Shadow vector attribute"]
#[inline(always)]
#[must_use]
pub fn int_attr_shv(&mut self) -> INT_ATTR_SHV_W<INT_CTRL_SPEC> {
INT_ATTR_SHV_W::new(self, 16)
}
#[doc = "Bits 17:18 - Trigger attribute for interrupt"]
#[inline(always)]
#[must_use]
pub fn int_attr_trig(&mut self) -> INT_ATTR_TRIG_W<INT_CTRL_SPEC> {
INT_ATTR_TRIG_W::new(self, 17)
}
#[doc = "Bits 22:23 - Interrupt mode attribute"]
#[inline(always)]
#[must_use]
pub fn int_attr_mode(&mut self) -> INT_ATTR_MODE_W<INT_CTRL_SPEC> {
INT_ATTR_MODE_W::new(self, 22)
}
#[doc = "Bits 24:31 - Control bits for interrupt"]
#[inline(always)]
#[must_use]
pub fn int_ctl(&mut self) -> INT_CTL_W<INT_CTRL_SPEC> {
INT_CTL_W::new(self, 24)
}
}
#[doc = "Interrupt control register for each interrupt source\n\nYou can [`read`](crate::Reg::read) this register and get [`int_ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`int_ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct INT_CTRL_SPEC;
impl crate::RegisterSpec for INT_CTRL_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [`int_ctrl::R`](R) reader structure"]
impl crate::Readable for INT_CTRL_SPEC {}
#[doc = "`write(|w| ..)` method takes [`int_ctrl::W`](W) writer structure"]
impl crate::Writable for INT_CTRL_SPEC {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets INT_CTRL%s to value 0"]
impl crate::Resettable for INT_CTRL_SPEC {
const RESET_VALUE: u32 = 0;
}
80 changes: 80 additions & 0 deletions esp32p4/src/clic/int_info.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#[doc = "Register `INT_INFO` reader"]
pub type R = crate::R<INT_INFO_SPEC>;
#[doc = "Register `INT_INFO` writer"]
pub type W = crate::W<INT_INFO_SPEC>;
#[doc = "Field `INT_INFO_NUM_INT` reader - Number of interrupts"]
pub type INT_INFO_NUM_INT_R = crate::FieldReader<u16>;
#[doc = "Field `INT_INFO_NUM_INT` writer - Number of interrupts"]
pub type INT_INFO_NUM_INT_W<'a, REG> = crate::FieldWriter<'a, REG, 13, u16>;
#[doc = "Field `INT_INFO_VERSION` reader - Version of interrupt module"]
pub type INT_INFO_VERSION_R = crate::FieldReader;
#[doc = "Field `INT_INFO_VERSION` writer - Version of interrupt module"]
pub type INT_INFO_VERSION_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
#[doc = "Field `INT_INFO_CTLBITS` reader - Control bits for interrupt"]
pub type INT_INFO_CTLBITS_R = crate::FieldReader;
#[doc = "Field `INT_INFO_CTLBITS` writer - Control bits for interrupt"]
pub type INT_INFO_CTLBITS_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
impl R {
#[doc = "Bits 0:12 - Number of interrupts"]
#[inline(always)]
pub fn int_info_num_int(&self) -> INT_INFO_NUM_INT_R {
INT_INFO_NUM_INT_R::new((self.bits & 0x1fff) as u16)
}
#[doc = "Bits 13:20 - Version of interrupt module"]
#[inline(always)]
pub fn int_info_version(&self) -> INT_INFO_VERSION_R {
INT_INFO_VERSION_R::new(((self.bits >> 13) & 0xff) as u8)
}
#[doc = "Bits 21:24 - Control bits for interrupt"]
#[inline(always)]
pub fn int_info_ctlbits(&self) -> INT_INFO_CTLBITS_R {
INT_INFO_CTLBITS_R::new(((self.bits >> 21) & 0x0f) as u8)
}
}
#[cfg(feature = "impl-register-debug")]
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("INT_INFO")
.field("int_info_ctlbits", &self.int_info_ctlbits())
.field("int_info_version", &self.int_info_version())
.field("int_info_num_int", &self.int_info_num_int())
.finish()
}
}
impl W {
#[doc = "Bits 0:12 - Number of interrupts"]
#[inline(always)]
#[must_use]
pub fn int_info_num_int(&mut self) -> INT_INFO_NUM_INT_W<INT_INFO_SPEC> {
INT_INFO_NUM_INT_W::new(self, 0)
}
#[doc = "Bits 13:20 - Version of interrupt module"]
#[inline(always)]
#[must_use]
pub fn int_info_version(&mut self) -> INT_INFO_VERSION_W<INT_INFO_SPEC> {
INT_INFO_VERSION_W::new(self, 13)
}
#[doc = "Bits 21:24 - Control bits for interrupt"]
#[inline(always)]
#[must_use]
pub fn int_info_ctlbits(&mut self) -> INT_INFO_CTLBITS_W<INT_INFO_SPEC> {
INT_INFO_CTLBITS_W::new(self, 21)
}
}
#[doc = "Interrupt information register\n\nYou can [`read`](crate::Reg::read) this register and get [`int_info::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`int_info::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct INT_INFO_SPEC;
impl crate::RegisterSpec for INT_INFO_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [`int_info::R`](R) reader structure"]
impl crate::Readable for INT_INFO_SPEC {}
#[doc = "`write(|w| ..)` method takes [`int_info::W`](W) writer structure"]
impl crate::Writable for INT_INFO_SPEC {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets INT_INFO to value 0"]
impl crate::Resettable for INT_INFO_SPEC {
const RESET_VALUE: u32 = 0;
}
48 changes: 48 additions & 0 deletions esp32p4/src/clic/int_thresh.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#[doc = "Register `INT_THRESH` reader"]
pub type R = crate::R<INT_THRESH_SPEC>;
#[doc = "Register `INT_THRESH` writer"]
pub type W = crate::W<INT_THRESH_SPEC>;
#[doc = "Field `CPU_INT_THRESH` reader - CPU interrupt threshold level"]
pub type CPU_INT_THRESH_R = crate::FieldReader;
#[doc = "Field `CPU_INT_THRESH` writer - CPU interrupt threshold level"]
pub type CPU_INT_THRESH_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
impl R {
#[doc = "Bits 24:31 - CPU interrupt threshold level"]
#[inline(always)]
pub fn cpu_int_thresh(&self) -> CPU_INT_THRESH_R {
CPU_INT_THRESH_R::new(((self.bits >> 24) & 0xff) as u8)
}
}
#[cfg(feature = "impl-register-debug")]
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("INT_THRESH")
.field("cpu_int_thresh", &self.cpu_int_thresh())
.finish()
}
}
impl W {
#[doc = "Bits 24:31 - CPU interrupt threshold level"]
#[inline(always)]
#[must_use]
pub fn cpu_int_thresh(&mut self) -> CPU_INT_THRESH_W<INT_THRESH_SPEC> {
CPU_INT_THRESH_W::new(self, 24)
}
}
#[doc = "Interrupt threshold register\n\nYou can [`read`](crate::Reg::read) this register and get [`int_thresh::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`int_thresh::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct INT_THRESH_SPEC;
impl crate::RegisterSpec for INT_THRESH_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [`int_thresh::R`](R) reader structure"]
impl crate::Readable for INT_THRESH_SPEC {}
#[doc = "`write(|w| ..)` method takes [`int_thresh::W`](W) writer structure"]
impl crate::Writable for INT_THRESH_SPEC {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets INT_THRESH to value 0"]
impl crate::Resettable for INT_THRESH_SPEC {
const RESET_VALUE: u32 = 0;
}
Loading