Merge pull request #2073 from embassy-rs/rcc-no-spaghetti

nrf/pac: reeport s and ns peripherals always independently of the current mode.
This commit is contained in:
Dario Nieuwenhuis 2023-10-16 17:43:13 +00:00 committed by GitHub
commit 889d482d2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 297 additions and 268 deletions

View File

@ -7,9 +7,12 @@ pub mod pac {
pub use nrf5340_app_pac::NVIC_PRIO_BITS; pub use nrf5340_app_pac::NVIC_PRIO_BITS;
#[cfg(feature="rt")]
#[doc(no_inline)]
pub use nrf5340_app_pac::interrupt;
#[doc(no_inline)] #[doc(no_inline)]
pub use nrf5340_app_pac::{ pub use nrf5340_app_pac::{
interrupt,
Interrupt, Interrupt,
Peripherals, Peripherals,
@ -60,6 +63,8 @@ pub mod pac {
wdt0_ns as wdt0, wdt0_ns as wdt0,
}; };
/// Non-Secure mode (NS) peripherals
pub mod ns {
#[cfg(feature = "nrf5340-app-ns")] #[cfg(feature = "nrf5340-app-ns")]
#[doc(no_inline)] #[doc(no_inline)]
pub use nrf5340_app_pac::{ pub use nrf5340_app_pac::{
@ -130,7 +135,10 @@ pub mod pac {
WDT0_NS as WDT0, WDT0_NS as WDT0,
WDT1_NS as WDT1, WDT1_NS as WDT1,
}; };
}
/// Secure mode (S) peripherals
pub mod s {
#[cfg(feature = "nrf5340-app-s")] #[cfg(feature = "nrf5340-app-s")]
#[doc(no_inline)] #[doc(no_inline)]
pub use nrf5340_app_pac::{ pub use nrf5340_app_pac::{
@ -212,6 +220,12 @@ pub mod pac {
}; };
} }
#[cfg(feature = "_ns")]
pub use ns::*;
#[cfg(feature = "_s")]
pub use s::*;
}
/// The maximum buffer size that the EasyDMA can send/recv in one operation. /// The maximum buffer size that the EasyDMA can send/recv in one operation.
pub const EASY_DMA_SIZE: usize = (1 << 16) - 1; pub const EASY_DMA_SIZE: usize = (1 << 16) - 1;
pub const FORCE_COPY_BUFFER_SIZE: usize = 1024; pub const FORCE_COPY_BUFFER_SIZE: usize = 1024;

View File

@ -7,9 +7,12 @@ pub mod pac {
pub use nrf5340_net_pac::NVIC_PRIO_BITS; pub use nrf5340_net_pac::NVIC_PRIO_BITS;
#[cfg(feature="rt")]
#[doc(no_inline)]
pub use nrf5340_net_pac::interrupt;
#[doc(no_inline)] #[doc(no_inline)]
pub use nrf5340_net_pac::{ pub use nrf5340_net_pac::{
interrupt,
Interrupt, Interrupt,
Peripherals, Peripherals,

View File

@ -7,9 +7,12 @@ pub mod pac {
pub use nrf9160_pac::NVIC_PRIO_BITS; pub use nrf9160_pac::NVIC_PRIO_BITS;
#[cfg(feature="rt")]
#[doc(no_inline)]
pub use nrf9160_pac::interrupt;
#[doc(no_inline)] #[doc(no_inline)]
pub use nrf9160_pac::{ pub use nrf9160_pac::{
interrupt,
Interrupt, Interrupt,
cc_host_rgf_s as cc_host_rgf, cc_host_rgf_s as cc_host_rgf,
@ -45,7 +48,8 @@ pub mod pac {
wdt_ns as wdt, wdt_ns as wdt,
}; };
#[cfg(feature = "nrf9160-ns")] /// Non-Secure mode (NS) peripherals
pub mod ns {
#[doc(no_inline)] #[doc(no_inline)]
pub use nrf9160_pac::{ pub use nrf9160_pac::{
CLOCK_NS as CLOCK, CLOCK_NS as CLOCK,
@ -99,8 +103,10 @@ pub mod pac {
VMC_NS as VMC, VMC_NS as VMC,
WDT_NS as WDT, WDT_NS as WDT,
}; };
}
#[cfg(feature = "nrf9160-s")] /// Secure mode (S) peripherals
pub mod s {
#[doc(no_inline)] #[doc(no_inline)]
pub use nrf9160_pac::{ pub use nrf9160_pac::{
CC_HOST_RGF_S as CC_HOST_RGF, CC_HOST_RGF_S as CC_HOST_RGF,
@ -163,6 +169,12 @@ pub mod pac {
}; };
} }
#[cfg(feature = "_ns")]
pub use ns::*;
#[cfg(feature = "_s")]
pub use s::*;
}
/// The maximum buffer size that the EasyDMA can send/recv in one operation. /// The maximum buffer size that the EasyDMA can send/recv in one operation.
pub const EASY_DMA_SIZE: usize = (1 << 13) - 1; pub const EASY_DMA_SIZE: usize = (1 << 13) - 1;
pub const FORCE_COPY_BUFFER_SIZE: usize = 1024; pub const FORCE_COPY_BUFFER_SIZE: usize = 1024;