|
@@ -94,11 +94,10 @@ _rt_hw_interrupt_enable:
|
|
|
|
|
|
.asmfunc
|
|
|
_rt_hw_context_switch_interrupt:
|
|
|
-_rt_hw_context_switch:
|
|
|
MOVL XAR0, #0
|
|
|
MOV AR0, AL
|
|
|
MOVL XAR4, *-SP[4]
|
|
|
- ; set rt_thread_switch_interrupt_flag to 1
|
|
|
+ ; set rt_thread_switch_interrupt_flag to 1
|
|
|
MOVL XAR5, #_rt_thread_switch_interrupt_flag
|
|
|
MOVL XAR6, *XAR5
|
|
|
MOVL ACC, XAR6
|
|
@@ -114,6 +113,37 @@ _reswitch:
|
|
|
MOVL XAR5, #_rt_interrupt_to_thread ; set rt_interrupt_to_thread
|
|
|
MOVL *XAR5, XAR4
|
|
|
|
|
|
+ ;TRAP #16
|
|
|
+ LRETR
|
|
|
+ .endasmfunc
|
|
|
+
|
|
|
+;
|
|
|
+; void rt_hw_context_switch(rt_uint32 from, rt_uint32 to);
|
|
|
+; r0 --> from
|
|
|
+; r4 --> to
|
|
|
+
|
|
|
+
|
|
|
+ .asmfunc
|
|
|
+_rt_hw_context_switch:
|
|
|
+ MOVL XAR0, #0
|
|
|
+ MOV AR0, AL
|
|
|
+ MOVL XAR4, *-SP[4]
|
|
|
+ ; set rt_thread_switch_interrupt_flag to 1
|
|
|
+ MOVL XAR5, #_rt_thread_switch_interrupt_flag
|
|
|
+ MOVL XAR6, *XAR5
|
|
|
+ MOVL ACC, XAR6
|
|
|
+ CMPB AL, #1
|
|
|
+ B _reswitch2, EQ
|
|
|
+ MOVL XAR6, #1
|
|
|
+ MOVL *XAR5, XAR6
|
|
|
+
|
|
|
+ MOVL XAR5, #_rt_interrupt_from_thread ; set rt_interrupt_from_thread
|
|
|
+ MOVL *XAR5, XAR0
|
|
|
+
|
|
|
+_reswitch2:
|
|
|
+ MOVL XAR5, #_rt_interrupt_to_thread ; set rt_interrupt_to_thread
|
|
|
+ MOVL *XAR5, XAR4
|
|
|
+
|
|
|
TRAP #16
|
|
|
LRETR
|
|
|
.endasmfunc
|
|
@@ -159,9 +189,9 @@ _RTOSINT_Handler:
|
|
|
;#endif
|
|
|
|
|
|
MOV AL, *AR0
|
|
|
- MOV AR1, AL
|
|
|
+ MOV AR0, AL
|
|
|
MOVZ AR1, @SP ; get from thread stack pointer
|
|
|
- MOV *AR0, AR1 ; update from thread stack pointer
|
|
|
+ MOV *AR0, AR1 ; update from thread stack pointer
|
|
|
|
|
|
switch_to_thread:
|
|
|
MOV AR1, #_rt_interrupt_to_thread
|
|
@@ -175,7 +205,7 @@ switch_to_thread:
|
|
|
;#endif
|
|
|
|
|
|
MOV @SP, AR1
|
|
|
- INC SP
|
|
|
+ ;INC SP
|
|
|
RT_CTX_RESTORE ; pop r4 - r11 register
|
|
|
|
|
|
rtosint_exit:
|