📄 test.lst
字号:
(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 940E07B4 CALL _OSInitHookBegin
(0233) #endif
(0234)
(0235) OS_InitMisc(); /* Initialize miscellaneous variables */
011F D1FB RCALL _OS_InitMisc
(0236)
(0237) OS_InitRdyList(); /* Initialize the Ready List */
0120 D21A RCALL _OS_InitRdyList
(0238)
(0239) OS_InitTCBList(); /* Initialize the free list of OS_TCBs */
0121 D241 RCALL _OS_InitTCBList
(0240)
(0241) OS_InitEventList(); /* Initialize the free list of OS_EVENTs */
0122 D1D1 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 D235 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 940E07B5 CALL _OSInitHookEnd
(0262) #endif
(0263)
(0264) #if OS_VERSION >= 270 && OS_DEBUG_EN > 0
(0265) OSDebugInit();
(0266) #endif
(0267) }
0126 940C0853 JMP _OSDebugInit
(0268) /*$PAGE*/
(0269) /*
(0270) *********************************************************************************************************
(0271) * ENTER ISR
(0272) *
(0273) * Description: This function is used to notify uC/OS-II that you are about to service an interrupt
(0274) * service routine (ISR). This allows uC/OS-II to keep track of interrupt nesting and thus
(0275) * only perform rescheduling at the last nested ISR.
(0276) *
(0277) * Arguments : none
(0278) *
(0279) * Returns : none
(0280) *
(0281) * Notes : 1) This function should be called ith interrupts already disabled
(0282) * 2) Your ISR can directly increment OSIntNesting without calling this function because
(0283) * OSIntNesting has been declared 'global'.
(0284) * 3) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
(0285) * 4) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
(0286) * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
(0287) * end of the ISR.
(0288) * 5) You are allowed to nest interrupts up to 255 levels deep.
(0289) * 6) I removed the OS_ENTER_CRITICAL() and OS_EXIT_CRITICAL() around the increment because
(0290) * OSIntEnter() is always called with interrupts disabled.
(0291) *********************************************************************************************************
(0292) */
(0293)
(0294) void OSIntEnter (void)
(0295) {
(0296) if (OSRunning == TRUE) {
_OSIntEnter:
0128 9180030D LDS R24,_OSRunning
012A 3081 CPI R24,1
012B F439 BNE 0x0133
(0297) if (OSIntNesting < 255u) {
012C 91800315 LDS R24,_OSIntNesting
012E 3F8F CPI R24,0xFF
012F F418 BCC 0x0133
(0298) OSIntNesting++; /* Increment ISR nesting level */
0130 5F8F SUBI R24,0xFF
0131 93800315 STS _OSIntNesting,R24
(0299) }
(0300) }
(0301) }
0133 9508 RET
_OSIntExit:
cpu_sr --> R10
0134 940E09F2 CALL push_gset3
(0302) /*$PAGE*/
(0303) /*
(0304) *********************************************************************************************************
(0305) * EXIT ISR
(0306) *
(0307) * Description: This function is used to notify uC/OS-II that you have completed serviving an ISR. When
(0308) * the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
(0309) * a new, high-priority task, is ready to run.
(0310) *
(0311) * Arguments : none
(0312) *
(0313) * Returns : none
(0314) *
(0315) * Notes : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
(0316) * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
(0317) * end of the ISR.
(0318) * 2) Rescheduling is prevented when the scheduler is locked (see OS_SchedLock())
(0319) *********************************************************************************************************
(0320) */
(0321)
(0322) void OSIntExit (void)
(0323) {
(0324) #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
(0325) OS_CPU_SR cpu_sr;
(0326) #endif
(0327)
(0328)
(0329) if (OSRunning == TRUE) {
0136 9180030D LDS R24,_OSRunning
0138 3081 CPI R24,1
0139 F009 BEQ 0x013B
013A C02C RJMP 0x0167
(0330) OS_ENTER_CRITICAL();
013B D143 RCALL 0x027F
013C 2EA0 MOV R10,R16
013D 940E0AF7 CALL 0xAF7
(0331) if (OSIntNesting > 0) { /* Prevent OSIntNesting from wrapping */
013F F420 BCC 0x0144
(0332) OSIntNesting--;
0140 2D83 MOV R24,R3
0141 5081 SUBI R24,1
0142 93800315 STS _OSIntNesting,R24
(0333) }
(0334) if (OSIntNesting == 0) { /* Reschedule only if all ISRs complete ... */
0144 90200315 LDS R2,_OSIntNesting
0146 2022 TST R2
0147 F009 BEQ 0x0149
0148 C01C RJMP 0x0165
(0335) if (OSLockNesting == 0) { /* ... and not locked. */
0149 90200313 LDS R2,_OSLockNesting
014B 2022 TST R2
014C F009 BEQ 0x014E
014D C017 RJMP 0x0165
(0336) OSIntExitY = OSUnMapTbl[OSRdyGrp];
014E 940E0ACB CALL 0xACB
0150 91E4 LPM R30,0(Z)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -