eclipse-threadx / threadx

Eclipse ThreadX is an advanced real-time operating system (RTOS) designed specifically for deeply embedded applications.
https://github.com/eclipse-threadx/rtos-docs/blob/main/rtos-docs/threadx/index.md
MIT License
2.89k stars 784 forks source link

Question for RISCV-64 timer interrupt #269

Closed Liuyux closed 1 year ago

Liuyux commented 1 year ago

Hi scott, In contrast to RISCV-32's timer interrupt function, RISCV-64 writes _tx_timer_interrupt in c without _tx_thread_context_save and _tx_thread_context_restore. When the timer interrupt is generated, I make the CPU jump directly to timer1_plic_IRQHandler, which seems unable to perform thread scheduling normally. May I ask whether I should jump to _tx_thread_schedule after the timer interrupt function is executed, as in the _tx_thread_context_restore function?

goldscott commented 1 year ago

Hi @Liuyux - for any interrupt calling ThreadX APIs, including the timer interrupt, you need to call tx_thread_context_save and _restore at the beginning and end of the interrupt, respectively.

Liuyux commented 1 year ago

Hi @Liuyux - for any interrupt calling ThreadX APIs, including the timer interrupt, you need to call tx_thread_context_save and _restore at the beginning and end of the interrupt, respectively.

Thank you for your answer.^^

TiejunMS commented 1 year ago

Closing