interrupts_gcc.S 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * File : interrupt.s34
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2010-04-20 fify the first version
  13. *
  14. * For : Renesas M16C
  15. * Toolchain : IAR's EW for M16C v3.401
  16. */
  17. .text
  18. .globl _rt_hw_context_switch_interrupt_do
  19. .type _rt_hw_context_switch_interrupt_do, #function
  20. _rt_hw_context_switch_interrupt_do:
  21. MOV.B #0, _rt_thread_switch_interrupt_flag
  22. MOV.W _rt_interrupt_from_thread, A0
  23. STC ISP, [A0]
  24. MOV.W _rt_interrupt_to_thread, A0
  25. LDC [A0], ISP
  26. POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore all processor registers from the new task's stack
  27. REIT
  28. .text
  29. .globl _rt_hw_timer_handler
  30. .type _rt_hw_timer_handler, #function
  31. _rt_hw_timer_handler:
  32. PUSHM R0,R1,R2,R3,A0,A1,SB,FB ; Save current task's registers
  33. jsr.a _rt_interrupt_enter
  34. jsr.a _rt_tick_increase
  35. jsr.a _rt_interrupt_leave
  36. CMP.B #1, _rt_thread_switch_interrupt_flag
  37. JEQ _rt_hw_context_switch_interrupt_do
  38. POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore current task's registers
  39. REIT ; Return from interrup
  40. .text
  41. .globl _rt_hw_uart0_receive_handler
  42. .type _rt_hw_uart0_receive_handler, #function
  43. _rt_hw_uart0_receive_handler:
  44. PUSHM R0,R1,R2,R3,A0,A1,SB,FB ; Save current task's registers
  45. jsr.a _rt_interrupt_enter
  46. jsr.a _u0rec_handler
  47. jsr.a _rt_interrupt_leave
  48. CMP.B #1, _rt_thread_switch_interrupt_flag
  49. JEQ _rt_hw_context_switch_interrupt_do
  50. POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore current task's registers
  51. REIT ; Return from interrup