Skip to content

RusPiRo/ruspiro-interrupt

Repository files navigation

Interrupt RusPiRo crate

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.

CI Latest Version Documentation License

Dependencies

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.

Usage

To use the crate just add the following dependency to your Cargo.toml file:

[dependencies]
ruspiro-interrupt = "||VERSION||"

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.

Features

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.

License

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.

About

RusPiRo interrupt crate providing features for convenient IRQ handler definitions

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages