📄 test.lst
字号:
__text_start:
__start:
00FC EFCF LDI R28,0xFF
00FD E1D0 LDI R29,0x10
00FE BFCD OUT 0x3D,R28
00FF BFDE OUT 0x3E,R29
0100 51C0 SUBI R28,0x10
0101 40D0 SBCI R29,0
0102 EA0A LDI R16,0xAA
0103 8308 STD Y+0,R16
0104 2400 CLR R0
0105 E0E0 LDI R30,0
0106 E0F1 LDI R31,1
0107 E016 LDI R17,6
0108 34E8 CPI R30,0x48
0109 07F1 CPC R31,R17
010A F011 BEQ 0x010D
010B 9201 ST R0,Z+
010C CFFB RJMP 0x0108
010D 8300 STD Z+0,R16
010E EFE8 LDI R30,0xF8
010F E0F1 LDI R31,1
0110 E0A0 LDI R26,0
0111 E0B1 LDI R27,1
0112 E011 LDI R17,1
0113 3FE8 CPI R30,0xF8
0114 07F1 CPC R31,R17
0115 F021 BEQ 0x011A
0116 95C8 LPM
0117 9631 ADIW R30,1
0118 920D ST R0,X+
0119 CFF9 RJMP 0x0113
011A 940E0C84 CALL _main
_exit:
011C CFFF RJMP _exit
FILE: C:\DOCUME~1\Administrator\MYDOCU~1\doc_ucosii_data_m128_iccavr_by_zhifeng\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:
011D 940E0B2E CALL _OSInitHookBegin
(0233) #endif
(0234)
(0235) OS_InitMisc(); /* Initialize miscellaneous variables */
011F D2BB RCALL _OS_InitMisc
(0236)
(0237) OS_InitRdyList(); /* Initialize the Ready List */
0120 D2E0 RCALL _OS_InitRdyList
(0238)
(0239) OS_InitTCBList(); /* Initialize the free list of OS_TCBs */
0121 D30E RCALL _OS_InitTCBList
(0240)
(0241) OS_InitEventList(); /* Initialize the free list of OS_EVENTs */
0122 D28A 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 */
0123 D2FE RCALL _OS_InitTaskIdle
(0256) #if OS_TASK_STAT_EN > 0
(0257) OS_InitTaskStat(); /* Create the Statistic Task */
(0258) #endif
(0259)
(0260) #if OS_VERSION >= 204
(0261) OSInitHookEnd(); /* Call port specific init. code */
0124 940E0B2F CALL _OSInitHookEnd
(0262) #endif
(0263)
(0264) #if OS_VERSION >= 270 && OS_DEBUG_EN > 0
(0265) OSDebugInit();
0126 940E0C29 CALL _OSDebugInit
0128 9508 RET
(0266) #endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -