Skip to content

Commit 3ef4de8

Browse files
committed
feat(port_std): support interrupts
I feel the current implementation is under-documented but it should be at least enough for running tests.
1 parent 79adc9b commit 3ef4de8

File tree

4 files changed

+456
-14
lines changed

4 files changed

+456
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Constance is a proof-of-concept of a static RTOS that utilizes Rust's compile-ti
2020
| ☐ Mutexes | **Tools** | **Boards** |
2121
| ☐ Timer | ☑︎ Test Harness | ☑︎ Hosted |
2222
| ☐ Alarm | ☑︎ Test Suite | ☐ F401RE |
23-
| Interrupts | ☑︎ Configurator | |
23+
| ☑︎ Interrupts | ☑︎ Configurator | |
2424
| ☐ CPU Exceptions | | |
2525
| ☐ Panicking | | |
2626

src/constance_port_std/src/lib.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,26 @@ fn task_body(_: usize) {
3030
log::warn!("yay");
3131
}
3232
```
33+
34+
# Interrupts
35+
36+
This port fully supports [the standard interrupt handling framework].
37+
38+
- The full range of priority values is available. The default priority is `0`.
39+
- The simulated hardware exposes `1024` (= [`NUM_INTERRUPT_LINES`]) interrupt
40+
lines.
41+
- Smaller priority values are prioritized.
42+
- Negative priority values are considered unmanaged.
43+
44+
[the standard interrupt handling framework]: ::constance#interrupt-handling-framework
45+
[`NUM_INTERRUPT_LINES`]: crate::NUM_INTERRUPT_LINES
46+
47+
## Implementation
48+
49+
All interrupt handlers execute in the main thread. Whenever an interrupt is pended or enabled, preemption checking code will run, and under the right condition, will yield the control to the dispatcher.
50+
51+
The dispatcher loop handles top-level interrupts and calls the interrupt handlers directly.
52+
53+
In an interrupt handler, the preemption checking code handles nested interrupts and calls their interrupt handlers.
54+
55+
**To be implemented:** True asynchronous interrupts aren't supported yet.

0 commit comments

Comments
 (0)