interrupts_gcc.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2010-04-20 fify the first version
  9. *
  10. * For : Renesas M16C
  11. * Toolchain : IAR's EW for M16C v3.401
  12. */
  13. .text
  14. .globl _rt_hw_context_switch_interrupt_do
  15. .type _rt_hw_context_switch_interrupt_do, #function
  16. _rt_hw_context_switch_interrupt_do:
  17. MOV.B #0, _rt_thread_switch_interrupt_flag
  18. MOV.W _rt_interrupt_from_thread, A0
  19. STC ISP, [A0]
  20. MOV.W _rt_interrupt_to_thread, A0
  21. LDC [A0], ISP
  22. POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore all processor registers from the new task's stack
  23. REIT
  24. .text
  25. .globl _rt_hw_timer_handler
  26. .type _rt_hw_timer_handler, #function
  27. _rt_hw_timer_handler:
  28. PUSHM R0,R1,R2,R3,A0,A1,SB,FB ; Save current task's registers
  29. jsr.a _rt_interrupt_enter
  30. jsr.a _rt_tick_increase
  31. jsr.a _rt_interrupt_leave
  32. CMP.B #1, _rt_thread_switch_interrupt_flag
  33. JEQ _rt_hw_context_switch_interrupt_do
  34. POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore current task's registers
  35. REIT ; Return from interrup
  36. .text
  37. .globl _rt_hw_uart0_receive_handler
  38. .type _rt_hw_uart0_receive_handler, #function
  39. _rt_hw_uart0_receive_handler:
  40. PUSHM R0,R1,R2,R3,A0,A1,SB,FB ; Save current task's registers
  41. jsr.a _rt_interrupt_enter
  42. jsr.a _u0rec_handler
  43. jsr.a _rt_interrupt_leave
  44. CMP.B #1, _rt_thread_switch_interrupt_flag
  45. JEQ _rt_hw_context_switch_interrupt_do
  46. POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore current task's registers
  47. REIT ; Return from interrup