?? ucosii.lst
字號(hào):
02B8 93000316 STS _OSPrioCur,R16
(0305)
(0306) LDS R30,_OSTCBHighRdy ; Z = OSTCBHighRdy->OSTCBStkPtr
02BA 91E00206 LDS R30,_OSTCBHighRdy
(0307) LDS R31,_OSTCBHighRdy+1 ;
02BC 91F00207 LDS R31,_OSTCBHighRdy+1
(0308) STS _OSTCBCur,R30 ; OSTCBCur = OSTCBHighRdy
02BE 93E0020A STS _OSTCBCur,R30
(0309) STS _OSTCBCur+1,R31 ;
02C0 93F0020B STS _OSTCBCur+1,R31
(0310)
(0311) LD R28,Z+ ; Restore Y pointer
02C2 91C1 LD R28,Z+
(0312) LD R29,Z+ ;
02C3 91D1 LD R29,Z+
(0313)
(0314) POP_SP ; Restore stack pointer
02C4 9109 LD R16,Y+
02C5 BF0D OUT 0x3D,R16
02C6 9109 LD R16,Y+
02C7 BF0E OUT 0x3E,R16
(0315) POP_SREG ; Restore status register
02C8 9109 LD R16,Y+
02C9 BF0F OUT 0x3F,R16
(0316) POP_ALL ; Restore all registers
02CA 9109 LD R16,Y+
02CB BF0B OUT 0x3B,R16
02CC 91F9 LD R31,Y+
02CD 91E9 LD R30,Y+
02CE 91B9 LD R27,Y+
02CF 91A9 LD R26,Y+
02D0 9199 LD R25,Y+
02D1 9189 LD R24,Y+
02D2 9179 LD R23,Y+
02D3 9169 LD R22,Y+
02D4 9159 LD R21,Y+
02D5 9149 LD R20,Y+
02D6 9139 LD R19,Y+
02D7 9129 LD R18,Y+
02D8 9119 LD R17,Y+
02D9 9109 LD R16,Y+
02DA 90F9 LD R15,Y+
02DB 90E9 LD R14,Y+
02DC 90D9 LD R13,Y+
02DD 90C9 LD R12,Y+
02DE 90B9 LD R11,Y+
02DF 90A9 LD R10,Y+
02E0 9099 LD R9,Y+
02E1 9089 LD R8,Y+
02E2 9079 LD R7,Y+
02E3 9069 LD R6,Y+
02E4 9059 LD R5,Y+
02E5 9049 LD R4,Y+
02E6 9039 LD R3,Y+
02E7 9029 LD R2,Y+
02E8 9019 LD R1,Y+
02E9 9009 LD R0,Y+
(0317) RET
02EA 9508 RET
(0318)
(0319) ;/*$PAGE*/.
(0320) ;********************************************************************************************************
(0321) ; SYSTEM TICK ISR
(0322) ;
(0323) ; Description : This function is the ISR used to notify uC/OS-II that a system tick has occurred.
(0324) ;
(0325) ; The following C-like pseudo-code describe the operation being performed in the code below.
(0326) ;
(0327) ; Save all registers on the current task's stack:
(0328) ; Use the PUSH_ALL macro
(0329) ; Get the SREG, set Bit #7 and save onto the task's stack using -Y addressing
(0330) ; Use the PUSH_SP macro to save the task's hardware stack pointer onto the current task's stack
(0331) ; OSIntNesting++;
(0332) ; if (OSIntNesting == 1) {
(0333) ; OSTCBCur->OSTCBStkPtr = SP
(0334) ; }
(0335) ; Clear the interrupt; Not needed for the timer we used.
(0336) ; OSTimeTick(); Notify uC/OS-II that a tick has occured
(0337) ; OSIntExit(); Notify uC/OS-II about end of ISR
(0338) ; Restore all registers that were save on the current task's stack:
(0339) ; Use the POP_SP macro to restore the task's hardware stack pointer
(0340) ; Use the POP_SREG macro to restore the SREG register
(0341) ; Use the POP_ALL macro to restore the remaining registers
(0342) ; Return (DO NOT use a RETI instruction);
(0343) ;********************************************************************************************************
(0344)
(0345) _OSTickISR::
(0346) PUSH_ALL ; Save all registers and status register
_OSTickISR:
02EB 920A ST R0,-Y
02EC 921A ST R1,-Y
02ED 922A ST R2,-Y
02EE 923A ST R3,-Y
02EF 924A ST R4,-Y
02F0 925A ST R5,-Y
02F1 926A ST R6,-Y
02F2 927A ST R7,-Y
02F3 928A ST R8,-Y
02F4 929A ST R9,-Y
02F5 92AA ST R10,-Y
02F6 92BA ST R11,-Y
02F7 92CA ST R12,-Y
02F8 92DA ST R13,-Y
02F9 92EA ST R14,-Y
02FA 92FA ST R15,-Y
02FB 930A ST R16,-Y
02FC 931A ST R17,-Y
02FD 932A ST R18,-Y
02FE 933A ST R19,-Y
02FF 934A ST R20,-Y
0300 935A ST R21,-Y
0301 936A ST R22,-Y
0302 937A ST R23,-Y
0303 938A ST R24,-Y
0304 939A ST R25,-Y
0305 93AA ST R26,-Y
0306 93BA ST R27,-Y
0307 93EA ST R30,-Y
0308 93FA ST R31,-Y
0309 B70B IN R16,0x3B
030A 930A ST R16,-Y
(0347) IN R16,SREG ; Save the SREG but with interrupts enabled
030B B70F IN R16,0x3F
(0348) SBR R16,BIT07
030C 6800 ORI R16,0x80
(0349) ST -Y,R16
030D 930A ST R16,-Y
(0350) PUSH_SP ; Save the task's hardware stack pointer onto task's stack
030E B70E IN R16,0x3E
030F 930A ST R16,-Y
0310 B70D IN R16,0x3D
0311 930A ST R16,-Y
(0351)
(0352) LDS R16,_OSIntNesting ; Notify uC/OS-II of ISR
0312 91000319 LDS R16,_OSIntNesting
(0353) INC R16 ;
0314 9503 INC R16
(0354) STS _OSIntNesting,R16 ;
0315 93000319 STS _OSIntNesting,R16
(0355)
(0356) CPI R16,1 ; if (OSIntNesting == 1) {
0317 3001 CPI R16,1
(0357) BRNE OSTickISR_1
0318 F431 BNE 0x031F
(0358)
(0359) LDS R30,_OSTCBCur ; OSTCBCur->OSTCBStkPtr = Y
0319 91E0020A LDS R30,_OSTCBCur
(0360) LDS R31,_OSTCBCur+1
031B 91F0020B LDS R31,_OSTCBCur+1
(0361) ST Z+,R28
031D 93C1 ST R28,Z+
(0362) ST Z+,R29 ; }
031E 93D1 ST R29,Z+
(0363)
(0364) OSTickISR_1:
(0365) CALL _OSTickISR_Handler ; Handle the tick ISR
031F 940E0CB2 CALL _OSTickISR_Handler
(0366)
(0367) CALL _OSIntExit ; Notify uC/OS-II about end of ISR
0321 940E0361 CALL _OSIntExit
(0368)
(0369) POP_SP ; Restore the hardware stack pointer from task's stack
0323 9109 LD R16,Y+
0324 BF0D OUT 0x3D,R16
0325 9109 LD R16,Y+
0326 BF0E OUT 0x3E,R16
(0370) POP_SREG ; Restore the SREG register
0327 9109 LD R16,Y+
0328 BF0F OUT 0x3F,R16
(0371) POP_ALL ; Restore all registers
0329 9109 LD R16,Y+
032A BF0B OUT 0x3B,R16
032B 91F9 LD R31,Y+
032C 91E9 LD R30,Y+
032D 91B9 LD R27,Y+
032E 91A9 LD R26,Y+
032F 9199 LD R25,Y+
0330 9189 LD R24,Y+
0331 9179 LD R23,Y+
0332 9169 LD R22,Y+
0333 9159 LD R21,Y+
0334 9149 LD R20,Y+
0335 9139 LD R19,Y+
0336 9129 LD R18,Y+
0337 9119 LD R17,Y+
0338 9109 LD R16,Y+
0339 90F9 LD R15,Y+
033A 90E9 LD R14,Y+
033B 90D9 LD R13,Y+
033C 90C9 LD R12,Y+
033D 90B9 LD R11,Y+
033E 90A9 LD R10,Y+
033F 9099 LD R9,Y+
0340 9089 LD R8,Y+
0341 9079 LD R7,Y+
0342 9069 LD R6,Y+
0343 9059 LD R5,Y+
0344 9049 LD R4,Y+
0345 9039 LD R3,Y+
0346 9029 LD R2,Y+
0347 9019 LD R1,Y+
0348 9009 LD R0,Y+
(0372)
(0373) RET ; Note: RET instead of RETI
0349 9508 RET
FILE: \UCOS-II_AVR_ICC\RTOSIC~1\OS_SOURCE\os_core.c
(0001) /*
(0002) *********************************************************************************************************
(0003) * uC/OS-II
(0004) * The Real-Time Kernel
(0005) * CORE FUNCTIONS
(0006) *
(0007) * (c) Copyright 1992-2003, Jean J. Labrosse, Weston, FL
(0008) * All Rights Reserved
(0009) *
(0010) * File : OS_CORE.C
(0011) * By : Jean J. Labrosse
(0012) *********************************************************************************************************
(0013) */
(0014)
(0015) #ifndef OS_MASTER_FILE
(0016) #define OS_GLOBALS
(0017) #include <ucos_ii.h>
(0018) #endif
(0019)
(0020) /*
(0021) *********************************************************************************************************
(0022) * MAPPING TABLE TO MAP BIT POSITION TO BIT MASK
(0023) *
(0024) * Note: Index into table is desired bit position, 0..7
(0025) * Indexed value corresponds to bit mask
(0026) *********************************************************************************************************
(0027) */
(0028)
(0029) INT8U const OSMapTbl[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
(0030)
(0031) /*
(0032) *********************************************************************************************************
(0033) * PRIORITY RESOLUTION TABLE
(0034) *
(0035) * Note: Index into table is bit pattern to resolve highest priority
(0036) * Indexed value corresponds to highest priority bit position (i.e. 0..7)
(0037) *********************************************************************************************************
(0038) */
(0039)
(0040) INT8U const OSUnMapTbl[256] = {
(0041) 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x00 to 0x0F */
(0042) 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x10 to 0x1F */
(0043) 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x20 to 0x2F */
(0044) 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x30 to 0x3F */
(0045) 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x40 to 0x4F */
(0046) 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x50 to 0x5F */
(0047) 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x60 to 0x6F */
(0048) 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x70 to 0x7F */
(0049) 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x80 to 0x8F */
(0050) 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x90 to 0x9F */
(0051) 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xA0 to 0xAF */
(0052) 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xB0 to 0xBF */
(0053) 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xC0 to 0xCF */
(0054) 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xD0 to 0xDF */
(0055) 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xE0 to 0xEF */
(0056) 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 /* 0xF0 to 0xFF */
(0057) };
(0058)
(0059) /*$PAGE*/
(0060) /*
(0061) *********************************************************************************************************
(0062) * FUNCTION PROTOTYPES
(0063) *********************************************************************************************************
(0064) */
(0065) static void OS_InitEventList(void);
(0066) static void OS_InitMisc(void);
(0067) static void OS_InitRdyList(void);
(0068) static void OS_InitTaskIdle(void);
(0069) #if OS_TASK_STAT_EN > 0
(0070) static void OS_InitTaskStat(void);
(0071) #endif
(0072) static void OS_InitTCBList(void);
(0073)
(0074) /*$PAGE*/
(0075) /*
(0076) *********************************************************************************************************
(0077) * GET THE NAME OF A SEMAPHORE, MUTEX, MAILBOX or QUEUE
(0078) *
(0079) * Description: This function is used to obtain the name assigned to a semaphore, mutex, mailbox or queue.
(0080) *
(0081) * Arguments : pevent is a pointer to the event group. 'pevent' can point either to a semaphore,
(0082) * a mutex, a mailbox or a queue. Where this function is concerned, the actual
(0083) * type is irrelevant.
(0084) *
(0085) * pname is a pointer to an ASCII string that will receive the name of the semaphore,
(0086) * mutex, mailbox or queue. The string must be able to hold at least
(0087) * OS_EVENT_NAME_SIZE characters.
(0088) *
(0089) * err is a pointer to an error code that can contain one of the following values:
(0090) *
(0091) * OS_NO_ERR if the name was copied to 'pname'
(0092) * OS_ERR_EVENT_TYPE if 'pevent' is not pointing to the proper event
(0093) * control block type.
(0094) * OS_ERR_PNAME_NULL You passed a NULL pointer for 'pname'
(0095) * OS_ERR_PEVENT_NULL if you passed a NULL pointer for 'pevent'
(0096) *
(0097) * Returns : The length of the string or 0 if the 'pevent' is a NULL pointer.
(0098) *********************************************************************************************************
(0099) */
(0100)
(0101) #if OS_EVENT_NAME_SIZE > 1
(0102) INT8U OSEventNameGet (OS_EVENT *pevent, char *pname, INT8U *err)
(0103) {
(0104) #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
(0105) OS_CPU_SR cpu_sr;
(0106) #endif
(0107) INT8U
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -