Crates.io | ruspiro-interrupt |
lib.rs | ruspiro-interrupt |
version | 0.5.0 |
source | src |
created_at | 2019-08-07 08:00:31.474255 |
updated_at | 2021-11-26 20:36:36.993724 |
description | Providing a simple and convenient way to implement interrupt handler for Raspberry Pi interrupts. |
homepage | |
repository | https://github.com/RusPiRo/ruspiro-interrupt/tree/v0.5.0 |
max_upload_size | |
id | 154760 |
size | 43,936 |
This crates provides functions and macros (custom attributes) to conviniently define and implement interrupt handler for the Raspberry Pi 3 in a bare metal environment.
This crate, when used to build a final binary, assumes that there is a low level exeption handler in place that will call into a function called __isr_default
. When using the ruspiro-boot
crate this function is weakly exported from their to allow floawless compiling and linking. However, this empty export will be overruled by the linker with the function of the same name exported from this crate.
To use the crate just add the following dependency to your Cargo.toml
file:
[dependencies]
ruspiro-interrupt = "0.5.0"
Once done the access to the features/attribute of the interrupt crate is available in your rust files like so:
extern crate ruspiro_interrupt; // needed for proper linking of weak defined functions
use ruspiro_interrupt::*;
#[IrqHandler(<irq-type-name>)]
unsafe fn my_handler(channel: Option<IsrSender<Box<dyn Any>>>) {
/* implementation omitted */
}
In rare cases the interrupt line is shared for different sources, in this case the attribute need to specify the source:
#[IrqHandler(<irq-type-name>, <source>)]
unsafe fn my_handler_for_source(channel: Option<IsrSender<Box<dyn Any>>>) {
/* implementation omitted */
}
The currently only implemented shared source interrupt line is the AUX
interrupt. There the source could be one of:
Uart1
, Spi1
or Spi2
.
Feature | Description |
---|
pi3 | Uses the MMIO mapped peripheral Addresses of Raspberry Pi 3
pi4_low | Uses the MMIO mapped peripheral Addresses of Raspberry Pi 4 in low-peri mode. The config.txt
requires arm_peri_high=0
setting.
pi4_high | Uses the MMIO mapped peripheral Addresses of Raspberry Pi 4 in high-peri mode. The config.txt
requires arm_peri_high=1
setting.
async | Enables the async
version of the interrupt handling implementation.
Licensed under Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) or MIT (LICENSE-MIT or http://opensource.org/licenses/MIT)) at your choice.