Skip to content

Commit 2aa60ed

Browse files
committed
fix(port_riscv): call Timer::init in port_boot
This call was missing due to an oversight.
1 parent 35782e6 commit 2aa60ed

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/r3_port_riscv/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1919
### Fixed
2020

2121
- The default stack alignment (`PortThreading::STACK_ALIGN`) now conforms to the standard ABI requirement (128-bit alignment).
22+
- The port startup code now calls `<Traits as Timer>::init`.
2223

2324
## [0.1.3] - 2021-10-29
2425

src/r3_port_riscv/src/threading/cfg.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ pub const PRIVILEGE_LEVEL_USER: u8 = 0b00;
3030

3131
/// Define a kernel trait type implementing [`PortThreading`],
3232
/// [`PortInterrupts`], and [`EntryPoint`].
33-
/// **Requires [`ThreadingOptions`] and [`InterruptController`].**
33+
/// **Requires [`ThreadingOptions`], [`Timer`], and [`InterruptController`].**
3434
///
3535
/// [`PortThreading`]: r3_kernel::PortThreading
3636
/// [`PortInterrupts`]: r3_kernel::PortInterrupts
3737
/// [`EntryPoint`]: crate::EntryPoint
3838
/// [`InterruptController`]: crate::InterruptController
39+
/// [`Timer`]: crate::Timer
3940
#[macro_export]
4041
macro_rules! use_port {
4142
(unsafe $vis:vis struct $Traits:ident) => {

src/r3_port_riscv/src/threading/imp.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ use r3_core::{
1010
use r3_kernel::{KernelTraits, Port, PortToKernel, System, TaskCb};
1111
use r3_portkit::pptext::pp_asm;
1212

13-
use crate::{InterruptController, ThreadingOptions, INTERRUPT_PLATFORM_START, INTERRUPT_SOFTWARE};
13+
use crate::{
14+
InterruptController, ThreadingOptions, Timer, INTERRUPT_PLATFORM_START, INTERRUPT_SOFTWARE,
15+
};
1416

1517
/// `XLEN / 8`
1618
const X_SIZE: usize = core::mem::size_of::<usize>();
@@ -160,7 +162,7 @@ const XSTATUS_PART_MASK: usize = csr::XSTATUS_FS_1;
160162
///
161163
/// Only meant to be implemented by [`use_port!`].
162164
pub unsafe trait PortInstance:
163-
KernelTraits + Port<PortTaskState = TaskState> + ThreadingOptions + InterruptController
165+
KernelTraits + Port<PortTaskState = TaskState> + ThreadingOptions + InterruptController + Timer
164166
{
165167
fn port_state() -> &'static State;
166168

@@ -231,6 +233,9 @@ impl State {
231233
// Safety: We are the port, so it's okay to call this
232234
unsafe { <Traits as InterruptController>::init() };
233235

236+
// Safety: We are the port, so it's okay to call this
237+
unsafe { <Traits as Timer>::init() };
238+
234239
// Enable local interrupts
235240
{
236241
let mut clear_set = [0usize; 2];

0 commit comments

Comments
 (0)