Skip to content

Commit 4c95771

Browse files
committed
Rename some interrupt functions
) enable_irq -> interrupt_unmask ) disable_irq -> interrupt_mask ) set_pending -> interrupt_pend ) check_irq_pending -> interrupt_is_pending ) set_pending -> interrupt_pend
1 parent 1aa792e commit 4c95771

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

rp235x-hal-examples/src/bin/powman_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ fn main() -> ! {
125125
_ = writeln!(&GLOBAL_UART, "AOT time: 0x{:016x}", powman.aot_get_time());
126126

127127
unsafe {
128-
hal::arch::enable_irq(pac::Interrupt::POWMAN_IRQ_TIMER);
128+
hal::arch::interrupt_unmask(pac::Interrupt::POWMAN_IRQ_TIMER);
129129
hal::arch::interrupt_enable();
130130
}
131131

rp235x-hal/src/arch.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,29 @@ mod inner {
3333
}
3434

3535
/// Placeholder function to check if an IRQ is pending
36-
pub fn check_irq_pending(irq: rp235x_pac::Interrupt) -> bool {
36+
pub fn interrrupt_is_pending(irq: rp235x_pac::Interrupt) -> bool {
3737
cortex_m::peripheral::NVIC::is_pending(irq)
3838
}
3939

40-
/// Placeholder function to enable an IRQ
40+
/// Enable an RP235x IRQ
4141
///
4242
/// This function is unsafe because it can break mask-based critical sections.
43-
pub unsafe fn enable_irq(irq: rp235x_pac::Interrupt) {
43+
pub unsafe fn interrupt_unmask(irq: rp235x_pac::Interrupt) {
4444
unsafe { cortex_m::peripheral::NVIC::unmask(irq) }
4545
}
4646

47-
/// Placeholder function to disable an IRQ
48-
pub fn disable_irq(irq: rp235x_pac::Interrupt) {
47+
/// Disable an RP235x IRQ
48+
pub fn interrupt_mask(irq: rp235x_pac::Interrupt) {
4949
cortex_m::peripheral::NVIC::mask(irq)
5050
}
5151

52-
/// Placeholder function to check if an IRQ is enabled
53-
pub fn is_irq_enabled(irq: rp235x_pac::Interrupt) -> bool {
52+
/// Check if an RP235x IRQ is enabled
53+
pub fn interrupt_is_enabled(irq: rp235x_pac::Interrupt) -> bool {
5454
cortex_m::peripheral::NVIC::is_enabled(irq)
5555
}
5656

57-
/// Placeholder function to mark an IRQ as pending
58-
pub fn set_pending(irq: rp235x_pac::Interrupt) {
57+
/// Mark an RP235x IRQ as pending
58+
pub fn interrupt_pend(irq: rp235x_pac::Interrupt) {
5959
cortex_m::peripheral::NVIC::pend(irq)
6060
}
6161
}
@@ -67,8 +67,8 @@ mod inner {
6767

6868
/// Enable interrupts
6969
///
70-
/// Our version is sure to enable Machine External interrupt as well as the
71-
/// global interrupt flag.
70+
/// Enable the Machine External interrupt as well as the global interrupt
71+
/// flag.
7272
#[inline(always)]
7373
pub fn interrupt_enable() {
7474
unsafe {
@@ -109,7 +109,8 @@ mod inner {
109109
}
110110

111111
pub use crate::xh3irq::{
112-
check_irq_pending, disable_irq, enable_irq, is_irq_enabled, set_pending,
112+
is_enabled as interrupt_is_enabled, is_pending as interrrupt_is_pending,
113+
mask as interrupt_mask, pend as interrupt_pend, unmask as interrupt_unmask,
113114
};
114115

115116
#[no_mangle]
@@ -512,25 +513,25 @@ mod inner {
512513
pub fn sev() {}
513514

514515
/// Placeholder function to check if an IRQ is pending
515-
pub fn check_irq_pending(irq: rp235x_pac::Interrupt) -> bool {
516+
pub fn interrrupt_is_pending(irq: rp235x_pac::Interrupt) -> bool {
516517
false
517518
}
518519

519520
/// Placeholder function to enable an IRQ
520521
///
521522
/// This function is unsafe because it can break mask-based critical sections.
522-
pub unsafe fn enable_irq(irq: rp235x_pac::Interrupt) {}
523+
pub unsafe fn interrupt_mask(irq: rp235x_pac::Interrupt) {}
523524

524525
/// Placeholder function to disable an IRQ
525-
pub fn disable_irq(irq: rp235x_pac::Interrupt) {}
526+
pub fn interrupt_unmask(irq: rp235x_pac::Interrupt) {}
526527

527528
/// Placeholder function to check if an IRQ is enabled
528-
pub fn is_irq_enabled(irq: rp235x_pac::Interrupt) -> bool {
529+
pub fn interrupt_is_enabled(irq: rp235x_pac::Interrupt) -> bool {
529530
false
530531
}
531532

532533
/// Placeholder function to mark an IRQ as pending
533-
pub fn set_pending(irq: rp235x_pac::Interrupt) {}
534+
pub fn interrupt_pend(irq: rp235x_pac::Interrupt) {}
534535
}
535536

536537
pub use inner::*;

rp235x-hal/src/xh3irq.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub const RVCSR_MEINEXT_OFFSET: u32 = 0xbe4;
9494

9595
/// Check if a given interrupt is pending
9696
#[cfg(all(target_arch = "riscv32", target_os = "none"))]
97-
pub fn check_irq_pending(irq: rp235x_pac::Interrupt) -> bool {
97+
pub fn is_pending(irq: rp235x_pac::Interrupt) -> bool {
9898
let (index, bits) = interrupt_to_mask(irq);
9999
let index = index as u32;
100100
let mut csr_rdata: u32;
@@ -116,7 +116,7 @@ pub fn check_irq_pending(irq: rp235x_pac::Interrupt) -> bool {
116116
///
117117
/// This function is unsafe because it can break mask-based critical sections.
118118
#[cfg(all(target_arch = "riscv32", target_os = "none"))]
119-
pub unsafe fn enable_irq(irq: rp235x_pac::Interrupt) {
119+
pub unsafe fn unmask(irq: rp235x_pac::Interrupt) {
120120
let mask_index = interrupt_to_mask_index(irq);
121121
// Do a RISC-V CSR Set on RVCSR_MEIEA_OFFSET
122122
unsafe {
@@ -129,7 +129,7 @@ pub unsafe fn enable_irq(irq: rp235x_pac::Interrupt) {
129129

130130
/// Disable an interrupt
131131
#[cfg(all(target_arch = "riscv32", target_os = "none"))]
132-
pub fn disable_irq(irq: rp235x_pac::Interrupt) {
132+
pub fn mask(irq: rp235x_pac::Interrupt) {
133133
let mask_index = interrupt_to_mask_index(irq);
134134
// Do a RISC-V CSR Clear on RVCSR_MEIEA_OFFSET
135135
unsafe {
@@ -142,7 +142,7 @@ pub fn disable_irq(irq: rp235x_pac::Interrupt) {
142142

143143
/// Check if an interrupt is enabled
144144
#[cfg(all(target_arch = "riscv32", target_os = "none"))]
145-
pub fn is_irq_enabled(irq: rp235x_pac::Interrupt) -> bool {
145+
pub fn is_enabled(irq: rp235x_pac::Interrupt) -> bool {
146146
let (index, bits) = interrupt_to_mask(irq);
147147
let index = index as u32;
148148
let mut csr_rdata: u32;
@@ -160,7 +160,7 @@ pub fn is_irq_enabled(irq: rp235x_pac::Interrupt) -> bool {
160160

161161
/// Set an interrupt as pending, even if it isn't.
162162
#[cfg(all(target_arch = "riscv32", target_os = "none"))]
163-
pub fn set_pending(irq: rp235x_pac::Interrupt) {
163+
pub fn pend(irq: rp235x_pac::Interrupt) {
164164
let mask_index = interrupt_to_mask_index(irq);
165165
// Do a RISC-V CSR Set on RVCSR_MEIFA_OFFSET
166166
unsafe {

0 commit comments

Comments
 (0)