1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

cpu/atmega_common: Clean up & fix IRQ handling

At the end of an ISR, the ATmega code was doing an `thread_yield()` instead of
 a `thread_yield_higher()`. This resulted in tests/isr_yield_higher failing.
 Fixing this saves a few lines of code, some ROM, and solves the issue.
This commit is contained in:
Marian Buschsieweke 2019-11-23 11:57:11 +01:00
parent 2b1bee750a
commit 606d72f64b
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F
2 changed files with 3 additions and 17 deletions

View File

@ -71,25 +71,10 @@ static inline void atmega_enter_isr(void)
atmega_in_isr = 1;
}
/**
* @brief Exit ISR mode and yield with a return from interrupt. Use at the
* end of ISRs in place of thread_yield_higher. If thread_yield is needed, use
* thread_yield followed by thread_yield_isr instead of thread_yield alone.
*/
void atmega_thread_yield_isr(void)
/**
* @brief Run this code on exiting interrupt routines
*/
static inline void atmega_exit_isr(void)
{
if (sched_context_switch_request) {
thread_yield();
atmega_in_isr = 0;
atmega_thread_yield_isr()
}
atmega_in_isr = 0;
}
void atmega_exit_isr(void);
/**
* @brief Initialization of the CPU

View File

@ -245,8 +245,9 @@ void thread_yield_higher(void)
}
}
void atmega_thread_yield_isr(void)
void atmega_exit_isr(void)
{
atmega_in_isr = 0;
atmega_context_save();
sched_run();
atmega_context_restore();