context_iar.asm 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2010-04-09 fify the first version
  9. * 2010-04-19 fify rewrite rt_hw_interrupt_disable/enable fuction
  10. * 2010-04-20 fify move peripheral ISR to bsp/interrupts.s34
  11. */
  12. RSEG CSTACK
  13. RSEG ISTACK
  14. RSEG CODE(1)
  15. EXTERN rt_interrupt_from_thread
  16. EXTERN rt_interrupt_to_thread
  17. PUBLIC rt_hw_interrupt_disable
  18. PUBLIC rt_hw_interrupt_enable
  19. PUBLIC rt_hw_context_switch_to
  20. PUBLIC os_context_switch
  21. rt_hw_interrupt_disable:
  22. STC FLG, R0 ;fify 20100419
  23. FCLR I
  24. RTS
  25. rt_hw_interrupt_enable:
  26. LDC R0, FLG ;fify 20100419
  27. RTS
  28. .EVEN
  29. os_context_switch:
  30. PUSHM R0,R1,R2,R3,A0,A1,SB,FB
  31. MOV.W rt_interrupt_from_thread, A0
  32. STC ISP, [A0]
  33. MOV.W rt_interrupt_to_thread, A0
  34. LDC [A0], ISP
  35. POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore registers from the new task's stack
  36. REIT ; Return from interrup
  37. /*
  38. * void rt_hw_context_switch_to(rt_uint32 to);
  39. * r0 --> to
  40. * this fucntion is used to perform the first thread switch
  41. */
  42. rt_hw_context_switch_to:
  43. MOV.W R0, A0
  44. LDC [A0], ISP
  45. POPM R0,R1,R2,R3,A0,A1,SB,FB
  46. REIT
  47. END