????д???????????????
???????????? ???????[ 2013/8/14 11:30:19 ] ????????
	;/**************************************************************************************
	;* ????????: OSIntCtxSw
	;*
	;* ????????: ?ж???????л?
	;*
	;* ??    ??: None
	;*
	;* ?? ?? ?: None
	;***************************************************************************************/
	OSIntCtxSw
	  PUSH    {R4?? R5}
	        LDR     R4?? =NVIC_INT_CTRL      ;????PendSV?? (causes context switch)
	        LDR     R5?? =NVIC_PENDSVSET
	        STR     R5?? [R4]
	  POP     {R4?? R5}
	        BX      LR
	        NOP
	;/**************************************************************************************
	;* ????????: OSPendSV
	;*
	;* ????????: OSPendSV is used to cause a context switch.
	;*
	;* ??    ??: None
	;*
	;* ?? ?? ?: None
	;***************************************************************************************/
	PendSV_Handler
	        CPSID   I                                   ; Prevent interruption during context switch
	        MRS     R0?? PSP                             ; PSP is process stack pointer ???????PSP???????????????????????ο?CM3????е?????-????
	        CBZ     R0?? PendSV_Handler_Nosave           ; Skip register save the first time
	        SUBS    R0?? R0?? #0x20         
	        STM     R0?? {R4-R11}                        ; Save remaining regs r4-11 on process stack
	        LDR     R1?? =OSCurTCB    
	        LDR     R1?? [R1]
	        STR     R0?? [R1]                             ; R0 is SP of process being switched out          
	PendSV_Handler_Nosave
	        PUSH    {R14}                                ; Save LR exc_return value
	        LDR     R0?? =OSTaskSwHook                    ; OSTaskSwHook();
	        BLX     R0
	        POP     {R14}
	        LDR     R0?? =OSCurTCB                         ;OSCurTCB=OSNewTCB;     
	        LDR     R1?? =OSNewTCB
	        LDR     R2?? [R1]
	        STR     R2?? [R0]
	        LDR     R0?? [R2]                              ; R0 is new process SP; SP = OSCurTCB;       
	        LDM     R0?? {R4-R11}                ; Restore r4-11 from new process stac
	        ADD     R0?? R0?? #0x20
	        MSR     PSP?? R0             
	        ORR     LR?? LR?? #0x04
	  CPSIE   I                                 ; Exception return will restore remaining context
	        BX      LR                   
	  end
????????????????????????飺
	typedef struct taskControlBlock
	{
	 /*???????????*/
	 OS_STK     *pStackTop;
	 /*????????*/
	 PRIO_TYPE    CurPriority;
	 /*??????*/
	 uint8      TaskStat;
	 /*????????????*/
	 int32     TCBDelay;
	 
	} TCB;
	/*??????е?????*/
	TCB   *OSCurTCB;
	/*???????????е?????*/
	TCB   *OSNewTCB;
	/*???OS?????е?????*/
	uint8  TaskNUM=0;
	TCB   OSTCBTable[MAX_TASK_NUM];
??????
					
					???·???
App??С????H5?????????????????Щ??
2024/9/11 15:34:34?????????????????????????
2024/9/10 11:13:49P-One ???????????????????????????????????????
2024/9/10 10:14:12???????????????????????????
2024/9/9 18:04:26??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44
					
			
								
								
								
								
								
								
								
								
								
								
				
sales@spasvo.com