📄 test.lst
字号:
__text_start:
__start:
02FC E5CF LDI R28,0x5F
02FD E0D4 LDI R29,4
02FE BFCD OUT 0x3D,R28
02FF BFDE OUT 0x3E,R29
0300 51C0 SUBI R28,0x10
0301 40D0 SBCI R29,0
0302 EA0A LDI R16,0xAA
0303 8308 STD Y+0,R16
0304 2400 CLR R0
0305 E9E4 LDI R30,0x94
0306 E0F0 LDI R31,0
0307 E014 LDI R17,4
0308 31EF CPI R30,0x1F
0309 07F1 CPC R31,R17
030A F011 BEQ 0x030D
030B 9201 ST R0,Z+
030C CFFB RJMP 0x0308
030D 8300 STD Z+0,R16
030E ECE4 LDI R30,0xC4
030F E0F5 LDI R31,5
0310 E6A0 LDI R26,0x60
0311 E0B0 LDI R27,0
0312 E015 LDI R17,5
0313 3FE8 CPI R30,0xF8
0314 07F1 CPC R31,R17
0315 F021 BEQ 0x031A
0316 95C8 LPM
0317 9631 ADIW R30,1
0318 920D ST R0,X+
0319 CFF9 RJMP 0x0313
031A 940E10A2 CALL _main
_exit:
031C CFFF RJMP _exit
FILE: C:\DOCUME~1\qihaijun\桌面\17_uCOSⅡ\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 len;
(0108)
(0109)
(0110) OS_ENTER_CRITICAL();
(0111) #if OS_ARG_CHK_EN > 0
(0112) if (pevent == (OS_EVENT *)0) { /* Is 'pevent' a NULL pointer? */
(0113) OS_EXIT_CRITICAL(); /* Yes */
(0114) *err = OS_ERR_PEVENT_NULL;
(0115) return (0);
(0116) }
(0117) if (pname == (char *)0) { /* Is 'pname' a NULL pointer? */
(0118) OS_EXIT_CRITICAL(); /* Yes */
(0119) *err = OS_ERR_PNAME_NULL;
(0120) return (0);
(0121) }
(0122) #endif
(0123) switch (pevent->OSEventType) {
(0124) case OS_EVENT_TYPE_SEM:
(0125) case OS_EVENT_TYPE_MUTEX:
(0126) case OS_EVENT_TYPE_MBOX:
(0127) case OS_EVENT_TYPE_Q:
(0128) break;
(0129)
(0130) default:
(0131) OS_EXIT_CRITICAL();
(0132) *err = OS_ERR_EVENT_TYPE;
(0133) return (0);
(0134) }
(0135) len = OS_StrCopy(pname, pevent->OSEventName); /* Copy name from OS_EVENT */
(0136) OS_EXIT_CRITICAL();
(0137) *err = OS_NO_ERR;
(0138) return (len);
(0139) }
(0140) #endif
(0141)
(0142) /*$PAGE*/
(0143) /*
(0144) *********************************************************************************************************
(0145) * ASSIGN A NAME TO A SEMAPHORE, MUTEX, MAILBOX or QUEUE
(0146) *
(0147) * Description: This function assigns a name to a semaphore, mutex, mailbox or queue.
(0148) *
(0149) * Arguments : pevent is a pointer to the event group. 'pevent' can point either to a semaphore,
(0150) * a mutex, a mailbox or a queue. Where this function is concerned, it doesn't
(0151) * matter the actual type.
(0152) *
(0153) * pname is a pointer to an ASCII string that will be used as the name of the semaphore,
(0154) * mutex, mailbox or queue. The string must be able to hold at least
(0155) * OS_EVENT_NAME_SIZE characters.
(0156) *
(0157) * err is a pointer to an error code that can contain one of the following values:
(0158) *
(0159) * OS_NO_ERR if the requested task is resumed
(0160) * OS_ERR_EVENT_TYPE if 'pevent' is not pointing to the proper event
(0161) * control block type.
(0162) * OS_ERR_PNAME_NULL You passed a NULL pointer for 'pname'
(0163) * OS_ERR_PEVENT_NULL if you passed a NULL pointer for 'pevent'
(0164) *
(0165) * Returns : None
(0166) *********************************************************************************************************
(0167) */
(0168)
(0169) #if OS_EVENT_NAME_SIZE > 1
(0170) void OSEventNameSet (OS_EVENT *pevent, char *pname, INT8U *err)
(0171) {
(0172) #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
(0173) OS_CPU_SR cpu_sr;
(0174) #endif
(0175) INT8U len;
(0176)
(0177)
(0178) OS_ENTER_CRITICAL();
(0179) #if OS_ARG_CHK_EN > 0
(0180) if (pevent == (OS_EVENT *)0) { /* Is 'pevent' a NULL pointer? */
(0181) OS_EXIT_CRITICAL(); /* Yes */
(0182) *err = OS_ERR_PEVENT_NULL;
(0183) return;
(0184) }
(0185) if (pname == (char *)0) { /* Is 'pname' a NULL pointer? */
(0186) OS_EXIT_CRITICAL(); /* Yes */
(0187) *err = OS_ERR_PNAME_NULL;
(0188) return;
(0189) }
(0190) #endif
(0191) switch (pevent->OSEventType) {
(0192) case OS_EVENT_TYPE_SEM:
(0193) case OS_EVENT_TYPE_MUTEX:
(0194) case OS_EVENT_TYPE_MBOX:
(0195) case OS_EVENT_TYPE_Q:
(0196) break;
(0197)
(0198) default:
(0199) OS_EXIT_CRITICAL();
(0200) *err = OS_ERR_EVENT_TYPE;
(0201) return;
(0202) }
(0203) len = OS_StrLen(pname); /* Can we fit the string in the storage area? */
(0204) if (len > (OS_EVENT_NAME_SIZE - 1)) { /* No */
(0205) OS_EXIT_CRITICAL();
(0206) *err = OS_ERR_EVENT_NAME_TOO_LONG;
(0207) return;
(0208) }
(0209) (void)OS_StrCopy(pevent->OSEventName, pname); /* Yes, copy name to the event control block */
(0210) OS_EXIT_CRITICAL();
(0211) *err = OS_NO_ERR;
(0212) }
(0213) #endif
(0214)
(0215) /*$PAGE*/
(0216) /*
(0217) *********************************************************************************************************
(0218) * INITIALIZATION
(0219) *
(0220) * Description: This function is used to initialize the internals of uC/OS-II and MUST be called prior to
(0221) * creating any uC/OS-II object and, prior to calling OSStart().
(0222) *
(0223) * Arguments : none
(0224) *
(0225) * Returns : none
(0226) *********************************************************************************************************
(0227) */
(0228)
(0229) void OSInit (void)
(0230) {
(0231) #if OS_VERSION >= 204
(0232) OSInitHookBegin(); /* Call port specific initialization code */
_OSInit:
031D 940E0E33 CALL _OSInitHookBegin
(0233) #endif
(0234)
(0235) OS_InitMisc(); /* Initialize miscellaneous variables */
031F D2D1 RCALL _OS_InitMisc
(0236)
(0237) OS_InitRdyList(); /* Initialize the Ready List */
0320 D310 RCALL _OS_InitRdyList
(0238)
(0239) OS_InitTCBList(); /* Initialize the free list of OS_TCBs */
0321 D34C RCALL _OS_InitTCBList
(0240)
(0241) OS_InitEventList(); /* Initialize the free list of OS_EVENTs */
0322 D2BD RCALL _OS_InitEventList
(0242)
(0243) #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
(0244) OS_FlagInit(); /* Initialize the event flag structures */
(0245) #endif
(0246)
(0247) #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
(0248) OS_MemInit(); /* Initialize the memory manager */
(0249) #endif
(0250)
(0251) #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
(0252) OS_QInit(); /* Initialize the message queue structures */
(0253) #endif
(0254)
(0255) OS_InitTaskIdle(); /* Create the Idle Task */
0323 D32E RCALL _OS_InitTaskIdle
(0256) #if OS_TASK_STAT_EN > 0
(0257) OS_InitTaskStat(); /* Create the Statistic Task */
0324 D33B RCALL _OS_InitTaskStat
(0258) #endif
(0259)
(0260) #if OS_VERSION >= 204
(0261) OSInitHookEnd(); /* Call port specific init. code */
0325 940E0E34 CALL _OSInitHookEnd
(0262) #endif
(0263)
(0264) #if OS_VERSION >= 270 && OS_DEBUG_EN > 0
(0265) OSDebugInit();
0327 940E0F1D CALL _OSDebugInit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -