11 个版本
0.5.0 | 2021 年 11 月 26 日 |
---|---|
0.4.3 | 2021 年 4 月 28 日 |
0.4.1 | 2021 年 2 月 6 日 |
0.3.1 | 2020 年 9 月 11 日 |
0.1.1 | 2019 年 8 月 9 日 |
#2119 在 嵌入式开发 中
45KB
846 行
中断 RusPiRo 包
此包提供函数和宏(自定义属性),以便在裸机环境中方便地定义和实现 Raspberry Pi 3 的中断处理程序。
依赖项
当使用此包构建最终二进制文件时,假设已存在一个低级异常处理程序,该处理程序将调用名为 __isr_default
的函数。当使用 ruspiro-boot
包 时,此函数会从其中 弱导出,以允许无缝编译和链接。然而,此空导出将被此包中导出相同名称的函数覆盖。
用法
要使用此包,只需将以下依赖项添加到您的 Cargo.toml
文件中
[dependencies]
ruspiro-interrupt = "0.5.0"
完成之后,中断包的特性和属性将可在您的 Rust 文件中访问,如下所示
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 */
}
在罕见的情况下,中断线被不同的源共享,在这种情况下,属性需要指定源
#[IrqHandler(<irq-type-name>, <source>)]
unsafe fn my_handler_for_source(channel: Option<IsrSender<Box<dyn Any>>>) {
/* implementation omitted */
}
目前仅实现了共享源中断线 AUX
中断。在那里,源可以是以下之一:Uart1
、Spi1
或 Spi2
。
特性
特性 | 描述 |
---|---|
pi3 | 使用 Raspberry Pi 3 的 MMIO 映射外围设备地址 |
pi4_low | 以 低 peri 模式使用 Raspberry Pi 4 的 MMIO 映射外围设备地址。需要 config.txt 中的 arm_peri_high=0 设置。 |
pi4_high | 以 高 peri 模式使用 Raspberry Pi 4 的 MMIO 映射外围设备地址。需要 config.txt 中的 arm_peri_high=1 设置。 |
async | 启用中断处理实现中的 async 版本。 |
许可证
根据您的选择,在 Apache 许可证版本 2.0 (LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0) 或 MIT (LICENSE-MIT 或 http://opensource.org/licenses/MIT) 下许可。
依赖项
~2MB
~42K SLoC