~ruther/avr-device

ref: 06ef5e65c7234543f08be66f1a10c284e2cdd68f avr-device/src/interrupt.rs -rw-r--r-- 7.5 KiB
06ef5e65 — Michael Buesch 2 years ago
Small fixes
a6f1a845 — Rahix 2 years ago
Rename `udebug` feature to `ufmt`
1e37fc06 — Michael Buesch 2 years ago
Update the bare-metal crate to 1.0.0

The new crate version generates much cleaner code due to #[inline] annotations.
This is an API break, because the CriticalSection + Mutex mechanism changes
from exterior reference lifetime to interior reference lifetime management.
280d6855 — Michael Büsch 2 years ago
irq: Optimize interrupt save/restore

Avoid unnecessary mask and branch instructions.

The basic reasoning behind this is that all other flags in the SREG can
be clobbered without ill effects. The restore() function is an
optimization fence and the compiler is not allowed to make assumptions
about memory or SREG state after execution.

This avoids an `and` and a `breq` instruction or similar in every
critical section.

While at it, also introduce a better API for manual IRQ-flag management.
bfccae0a — Michael Buesch 2 years ago
Remove all llvm_asm macros
6ab6f94a — Michael Buesch 2 years ago
Add basic documentation for beginners
91d0ad81 — Patryk Wychowaniec 3 years ago
Add support for `asm!()`
bbba9867 — Tray Torrance 3 years ago
Return the previous interrupt status upon disabling interrupts

This commit addresses #88 by returning a boolean which reflects the
previous state of the GIE flag upon disabling interrupts. This allows
`critical-section` to implement itself for AVR, while not breaking the
existing `avr-device` API.
12879fde — Rahix 4 years ago
Only emit inline-assembly when building for AVR

Make sure that we'll never emit AVR assembly on non-AVR targets.
Instead of failing the build, fail at runtime, to allow a potential
application testsuite to run even if those functions somehow get linked
in.

Signed-off-by: Rahix <rahix@rahix.de>
706a5c26 — Rahix 4 years ago
interrupt: Fix interrupt::free() reading wrong address

The SREG is at IO address 0x3F, not 0x35.  Fix interrupt::free() to read
the correct register to make it work as advertised.

Signed-off-by: Rahix <rahix@rahix.de>
c0edb56c — Rahix 4 years ago
interrupt: Make interrupt::enable() unsafe

To bring this crate more in line with cortex-m, mark interrupt::enable()
as unsafe.  This also fixes a soundness issue: When the function is
safe, one could call it inside a critical section in entirely safe rust.
This is problematic because lot's of code in critical sections relies on
the fact that interrupts are disabled and it thus can safely perform
non-atomic operations without anything interrupting it.

Signed-off-by: Rahix <rahix@rahix.de>
c3144637 — Liam Perlaki 4 years ago
Use llvm_asm!() instead of asm!()

The asm!() feature was changed to a new syntax which this project did not yet
adopt.  The old asm!() is now available as llvm_asm!().  Switch to that to
support nightly build.

See PR #27 for details.
dc45b3cc — Rahix 5 years ago
Switch to a new design as outlined in #17

Signed-off-by: Rahix <rahix@rahix.de>
4d71c0ee — Rahix 5 years ago
Add interrupts and use cfg-if

Signed-off-by: Rahix <rahix@rahix.de>
Do not follow this link