?? os_core.s
字號:
.module OS_CORE.C
.area lit(rom, con, rel)
_OSMapTbl::
.byte 1,2
.byte 4,8
.byte 16,32
.byte 64,128
.dbfile E:\study\ucos_ii\ucos2_iccavr\iccavr\ucos2_without_cpu\OS_CORE.C
.dbsym e OSMapTbl _OSMapTbl A[8:8]kc
_OSUnMapTbl::
.byte 0,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 4,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 5,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 4,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 6,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 4,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 5,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 4,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 7,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 4,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 5,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 4,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 6,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 4,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 5,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 4,0
.byte 1,0
.byte 2,0
.byte 1,0
.byte 3,0
.byte 1,0
.byte 2,0
.byte 1,0
.dbsym e OSUnMapTbl _OSUnMapTbl A[256:256]kc
.area text(rom, con, rel)
.dbfile E:\study\ucos_ii\ucos2_iccavr\iccavr\ucos2_without_cpu\OS_CORE.C
.dbfunc e OSInit _OSInit fV
.even
_OSInit::
.dbline -1
.dbline 86
; /*
; *********************************************************************************************************
; * uC/OS-II
; * The Real-Time Kernel
; * CORE FUNCTIONS
; *
; * (c) Copyright 1992-2002, Jean J. Labrosse, Weston, FL
; * All Rights Reserved
; *
; * File : OS_CORE.C
; * By : Jean J. Labrosse
; *********************************************************************************************************
; */
;
; #ifndef OS_MASTER_FILE
; #define OS_GLOBALS
; #include "..\ucos2_application\includes.h"
; #endif
;
; /*
; *********************************************************************************************************
; * MAPPING TABLE TO MAP BIT POSITION TO BIT MASK
; *
; * Note: Index into table is desired bit position, 0..7
; * Indexed value corresponds to bit mask
; *********************************************************************************************************
; */
;
; INT8U const OSMapTbl[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
;
; /*
; *********************************************************************************************************
; * PRIORITY RESOLUTION TABLE
; *
; * Note: Index into table is bit pattern to resolve highest priority
; * Indexed value corresponds to highest priority bit position (i.e. 0..7)
; *********************************************************************************************************
; */
;
; INT8U const OSUnMapTbl[] = {
; 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x00 to 0x0F */
; 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x10 to 0x1F */
; 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x20 to 0x2F */
; 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x30 to 0x3F */
; 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x40 to 0x4F */
; 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x50 to 0x5F */
; 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x60 to 0x6F */
; 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x70 to 0x7F */
; 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x80 to 0x8F */
; 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x90 to 0x9F */
; 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xA0 to 0xAF */
; 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xB0 to 0xBF */
; 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xC0 to 0xCF */
; 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xD0 to 0xDF */
; 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xE0 to 0xEF */
; 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 /* 0xF0 to 0xFF */
; };
;
; /*
; *********************************************************************************************************
; * FUNCTION PROTOTYPES
; *********************************************************************************************************
; */
; static void OS_InitEventList(void);
; static void OS_InitMisc(void);
; static void OS_InitRdyList(void);
; static void OS_InitTaskIdle(void);
; static void OS_InitTaskStat(void);
; static void OS_InitTCBList(void);
;
;
; /*
; *********************************************************************************************************
; * INITIALIZATION
; *
; * Description: This function is used to initialize the internals of uC/OS-II and MUST be called prior to
; * creating any uC/OS-II object and, prior to calling OSStart().
; *
; * Arguments : none
; *
; * Returns : none
; *********************************************************************************************************
; */
;
; void OSInit (void)
; {
.dbline 88
; #if OS_VERSION >= 204
; OSInitHookBegin(); /* Call port specific initialization code */
xcall _OSInitHookBegin
.dbline 91
; #endif
;
; OS_InitMisc(); /* Initialize miscellaneous(雜項) variables */
xcall _OS_InitMisc
.dbline 93
;
; OS_InitRdyList(); /* Initialize the Ready List */
xcall _OS_InitRdyList
.dbline 94
; OS_InitTCBList(); /* Initialize the free list of OS_TCBs */
xcall _OS_InitTCBList
.dbline 95
; OS_InitEventList(); /* Initialize the free list of OS_EVENTs */
xcall _OS_InitEventList
.dbline 98
;
; #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
; OS_FlagInit(); /* Initialize the event flag structures */
xcall _OS_FlagInit
.dbline 109
; #endif
;
; #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
; OS_MemInit(); /* Initialize the memory manager */
; #endif
;
; #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
; OS_QInit(); /* Initialize the message queue structures */
; #endif
;
; OS_InitTaskIdle(); /* Create the Idle Task */
xcall _OS_InitTaskIdle
.dbline 115
; #if OS_TASK_STAT_EN > 0
; OS_InitTaskStat(); /* Create the Statistic Task */
; #endif
;
; #if OS_VERSION >= 204
; OSInitHookEnd(); /* Call port specific init. code */
xcall _OSInitHookEnd
.dbline -2
L3:
.dbline 0 ; func end
ret
.dbend
.dbfunc e OSIntEnter _OSIntEnter fV
.even
_OSIntEnter::
.dbline -1
.dbline 145
; #endif
; }
;
; /*
; *********************************************************************************************************
; * ENTER ISR
; *
; * Description: This function is used to notify uC/OS-II that you are about to service an interrupt
; * service routine (ISR). This allows uC/OS-II to keep track of interrupt nesting and thus
; * only perform rescheduling at the last nested ISR.
; *
; * Arguments : none
; *
; * Returns : none
; *
; * Notes : 1) This function should be called ith interrupts already disabled
; * 2) Your ISR can directly increment OSIntNesting without calling this function because
; * OSIntNesting has been declared 'global'.
; * 3) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
; * 4) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
; * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
; * end of the ISR.
; * 5) You are allowed to nest interrupts up to 255 levels deep.
; * 6) I removed the OS_ENTER_CRITICAL() and OS_EXIT_CRITICAL() around the increment because
; * OSIntEnter() is always called with interrupts disabled.
; *********************************************************************************************************
; */
;
; void OSIntEnter (void)
; {
.dbline 146
; if (OSRunning == TRUE) {
lds R24,_OSRunning
cpi R24,1
brne L5
.dbline 146
.dbline 147
; if (OSIntNesting < 255) {
lds R24,_OSIntNesting
cpi R24,255
brsh L7
.dbline 147
.dbline 148
; OSIntNesting++; /* Increment ISR nesting level */
subi R24,255 ; addi 1
sts _OSIntNesting,R24
.dbline 149
; }
L7:
.dbline 150
L5:
.dbline -2
L4:
.dbline 0 ; func end
ret
.dbend
.dbfunc e OSIntExit _OSIntExit fV
.even
_OSIntExit::
xcall push_gset2
.dbline -1
.dbline 173
; }
; }
;
; /*
; *********************************************************************************************************
; * EXIT ISR
; *
; * Description: This function is used to notify uC/OS-II that you have completed serviving an ISR. When
; * the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
; * a new, high-priority task, is ready to run.
; *
; * Arguments : none
; *
; * Returns : none
; *
; * Notes : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
; * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
; * end of the ISR.
; * 2) Rescheduling is prevented when the scheduler is locked (see OS_SchedLock())
; *********************************************************************************************************
; */
;
; void OSIntExit (void)
; {
.dbline 179
; #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
; OS_CPU_SR cpu_sr;
; #endif
;
;
; if (OSRunning == TRUE) {
lds R24,_OSRunning
cpi R24,1
breq X0
xjmp L10
X0:
.dbline 179
.dbline 180
; OS_ENTER_CRITICAL();
st -y,r16
in r16,0x3F
cli
push r16
ld r16,y+
.dbline 180
.dbline 181
; if (OSIntNesting > 0) { /* Prevent OSIntNesting from wrapping */
clr R2
lds R3,_OSIntNesting
cp R2,R3
brsh L12
.dbline 181
.dbline 182
; OSIntNesting--;
mov R24,R3
subi R24,1
sts _OSIntNesting,R24
.dbline 183
; }
L12:
.dbline 184
; if ((OSIntNesting == 0) && (OSLockNesting == 0)) { /* Reschedule only if all ISRs complete ... */
lds R2,_OSIntNesting
tst R2
breq X1
xjmp L14
X1:
lds R2,_OSLockNesting
tst R2
breq X2
xjmp L14
X2:
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -