esp-wifi: fix unused timer result (#1633)
This commit is contained in:
parent
8aee84f842
commit
06bf505093
@ -268,7 +268,7 @@ pub fn initialize(
|
|||||||
init_radio_clock_control(radio_clocks);
|
init_radio_clock_control(radio_clocks);
|
||||||
init_rng(rng);
|
init_rng(rng);
|
||||||
init_tasks();
|
init_tasks();
|
||||||
setup_timer_isr(timer);
|
setup_timer_isr(timer)?;
|
||||||
wifi_set_log_verbose();
|
wifi_set_log_verbose();
|
||||||
init_clocks();
|
init_clocks();
|
||||||
|
|
||||||
@ -314,6 +314,13 @@ pub enum InitializationError {
|
|||||||
#[cfg(feature = "wifi")]
|
#[cfg(feature = "wifi")]
|
||||||
WifiError(WifiError),
|
WifiError(WifiError),
|
||||||
WrongClockConfig,
|
WrongClockConfig,
|
||||||
|
Timer(hal::timer::Error),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<hal::timer::Error> for InitializationError {
|
||||||
|
fn from(value: hal::timer::Error) -> Self {
|
||||||
|
InitializationError::Timer(value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "wifi")]
|
#[cfg(feature = "wifi")]
|
||||||
|
|||||||
@ -14,14 +14,15 @@ mod arch_specific;
|
|||||||
pub use arch_specific::*;
|
pub use arch_specific::*;
|
||||||
pub use chip_specific::*;
|
pub use chip_specific::*;
|
||||||
|
|
||||||
pub fn setup_timer_isr(timebase: TimeBase) {
|
pub fn setup_timer_isr(timebase: TimeBase) -> Result<(), esp_hal::timer::Error> {
|
||||||
setup_radio_isr();
|
setup_radio_isr();
|
||||||
|
|
||||||
setup_timer(timebase);
|
setup_timer(timebase)?;
|
||||||
|
|
||||||
setup_multitasking();
|
setup_multitasking();
|
||||||
|
|
||||||
yield_task();
|
yield_task();
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
|
|||||||
@ -26,7 +26,7 @@ const TIMESLICE_FREQUENCY: fugit::HertzU32 = fugit::HertzU32::from_raw(crate::CO
|
|||||||
// Time keeping
|
// Time keeping
|
||||||
pub const TICKS_PER_SECOND: u64 = 1_000_000;
|
pub const TICKS_PER_SECOND: u64 = 1_000_000;
|
||||||
|
|
||||||
pub fn setup_timer(systimer: TimeBase) {
|
pub fn setup_timer(systimer: TimeBase) -> Result<(), esp_hal::timer::Error> {
|
||||||
// make sure the scheduling won't start before everything is setup
|
// make sure the scheduling won't start before everything is setup
|
||||||
riscv::interrupt::disable();
|
riscv::interrupt::disable();
|
||||||
|
|
||||||
@ -50,6 +50,7 @@ pub fn setup_timer(systimer: TimeBase) {
|
|||||||
Interrupt::SYSTIMER_TARGET0,
|
Interrupt::SYSTIMER_TARGET0,
|
||||||
interrupt::Priority::Priority1,
|
interrupt::Priority::Priority1,
|
||||||
));
|
));
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setup_multitasking() {
|
pub fn setup_multitasking() {
|
||||||
|
|||||||
@ -30,7 +30,7 @@ pub fn get_systimer_count() -> u64 {
|
|||||||
esp_hal::time::current_time().ticks()
|
esp_hal::time::current_time().ticks()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setup_timer(timer1: TimeBase) {
|
pub fn setup_timer(timer1: TimeBase) -> Result<(), esp_hal::timer::Error> {
|
||||||
unsafe {
|
unsafe {
|
||||||
interrupt::bind_interrupt(
|
interrupt::bind_interrupt(
|
||||||
peripherals::Interrupt::TG1_T0_LEVEL,
|
peripherals::Interrupt::TG1_T0_LEVEL,
|
||||||
@ -44,11 +44,12 @@ pub fn setup_timer(timer1: TimeBase) {
|
|||||||
));
|
));
|
||||||
|
|
||||||
timer1.listen();
|
timer1.listen();
|
||||||
timer1.load_value(TIMESLICE_FREQUENCY.into_duration());
|
timer1.load_value(TIMESLICE_FREQUENCY.into_duration())?;
|
||||||
timer1.start();
|
timer1.start();
|
||||||
critical_section::with(|cs| {
|
critical_section::with(|cs| {
|
||||||
TIMER1.borrow_ref_mut(cs).replace(timer1);
|
TIMER1.borrow_ref_mut(cs).replace(timer1);
|
||||||
});
|
});
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setup_multitasking() {
|
pub fn setup_multitasking() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user