Skip to content

Commit

Permalink
Bugfix: InterruptContext used non-ISR function in drop (#78)
Browse files Browse the repository at this point in the history
`freertos_rs_isr_yield()` used `portYIELD()` instead of
`portYIELD_FROM_ISR()`.
  • Loading branch information
eivindbergem authored Oct 3, 2024
1 parent 59b0a36 commit 953b580
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions freertos-rust/src/freertos/shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ UBaseType_t freertos_rs_queue_messages_waiting(QueueHandle_t queue) {
return uxQueueMessagesWaiting( queue );
}

void freertos_rs_isr_yield() {
portYIELD();
void freertos_rs_isr_yield(BaseType_t xHigherPriorityTaskWoken) {
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}

TickType_t freertos_rs_max_wait() {
Expand Down
6 changes: 2 additions & 4 deletions freertos-rust/src/isr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ impl InterruptContext {

impl Drop for InterruptContext {
fn drop(&mut self) {
if self.x_higher_priority_task_woken == 1 {
unsafe {
freertos_rs_isr_yield();
}
unsafe {
freertos_rs_isr_yield(self.x_higher_priority_task_woken);
}
}
}
2 changes: 1 addition & 1 deletion freertos-rust/src/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ extern "C" {
item: FreeRtosVoidPtr,
xHigherPriorityTaskWoken: FreeRtosBaseTypeMutPtr,
) -> FreeRtosUBaseType;
pub fn freertos_rs_isr_yield();
pub fn freertos_rs_isr_yield(xHigherPriorityTaskWoken: FreeRtosBaseType);

pub fn freertos_rs_task_notify_take(clear_count: u8, wait: FreeRtosTickType) -> u32;
pub fn freertos_rs_task_notify_wait(
Expand Down

0 comments on commit 953b580

Please sign in to comment.