📄 ucos_ii.lis
字号:
0000 ; case OS_EVENT_TYPE_SEM:
0000 ; case OS_EVENT_TYPE_MUTEX:
0000 ; case OS_EVENT_TYPE_MBOX:
0000 ; case OS_EVENT_TYPE_Q:
0000 ; break;
0000 ;
0000 ; default:
0000 ; OS_EXIT_CRITICAL();
0000 ; *err = OS_ERR_EVENT_TYPE;
0000 ; return (0);
0000 ; }
0000 ; len = OS_StrCopy(pname, pevent->OSEventName); /* Copy name from OS_EVENT */
0000 ; OS_EXIT_CRITICAL();
0000 ; *err = OS_NO_ERR;
0000 ; return (len);
0000 ; }
0000 ; #endif
0000 ;
0000 ; /*$PAGE*/
0000 ; /*
0000 ; *********************************************************************************************************
0000 ; * ASSIGN A NAME TO A SEMAPHORE, MUTEX, MAILBOX or QUEUE
0000 ; *
0000 ; * Description: This function assigns a name to a semaphore, mutex, mailbox or queue.
0000 ; *
0000 ; * Arguments : pevent is a pointer to the event group. 'pevent' can point either to a semaphore,
0000 ; * a mutex, a mailbox or a queue. Where this function is concerned, it doesn't
0000 ; * matter the actual type.
0000 ; *
0000 ; * pname is a pointer to an ASCII string that will be used as the name of the semaphore,
0000 ; * mutex, mailbox or queue. The string must be able to hold at least
0000 ; * OS_EVENT_NAME_SIZE characters.
0000 ; *
0000 ; * err is a pointer to an error code that can contain one of the following values:
0000 ; *
0000 ; * OS_NO_ERR if the requested task is resumed
0000 ; * OS_ERR_EVENT_TYPE if 'pevent' is not pointing to the proper event
0000 ; * control block type.
0000 ; * OS_ERR_PNAME_NULL You passed a NULL pointer for 'pname'
0000 ; * OS_ERR_PEVENT_NULL if you passed a NULL pointer for 'pevent'
0000 ; *
0000 ; * Returns : None
0000 ; *********************************************************************************************************
0000 ; */
0000 ;
0000 ; #if OS_EVENT_NAME_SIZE > 1
0000 ; void OSEventNameSet (OS_EVENT *pevent, char *pname, INT8U *err)
0000 ; {
0000 ; #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
0000 ; OS_CPU_SR cpu_sr;
0000 ; #endif
0000 ; INT8U len;
0000 ;
0000 ;
0000 ; OS_ENTER_CRITICAL();
0000 ; #if OS_ARG_CHK_EN > 0
0000 ; if (pevent == (OS_EVENT *)0) { /* Is 'pevent' a NULL pointer? */
0000 ; OS_EXIT_CRITICAL(); /* Yes */
0000 ; *err = OS_ERR_PEVENT_NULL;
0000 ; return;
0000 ; }
0000 ; if (pname == (char *)0) { /* Is 'pname' a NULL pointer? */
0000 ; OS_EXIT_CRITICAL(); /* Yes */
0000 ; *err = OS_ERR_PNAME_NULL;
0000 ; return;
0000 ; }
0000 ; #endif
0000 ; switch (pevent->OSEventType) {
0000 ; case OS_EVENT_TYPE_SEM:
0000 ; case OS_EVENT_TYPE_MUTEX:
0000 ; case OS_EVENT_TYPE_MBOX:
0000 ; case OS_EVENT_TYPE_Q:
0000 ; break;
0000 ;
0000 ; default:
0000 ; OS_EXIT_CRITICAL();
0000 ; *err = OS_ERR_EVENT_TYPE;
0000 ; return;
0000 ; }
0000 ; len = OS_StrLen(pname); /* Can we fit the string in the storage area? */
0000 ; if (len > (OS_EVENT_NAME_SIZE - 1)) { /* No */
0000 ; OS_EXIT_CRITICAL();
0000 ; *err = OS_ERR_EVENT_NAME_TOO_LONG;
0000 ; return;
0000 ; }
0000 ; (void)OS_StrCopy(pevent->OSEventName, pname); /* Yes, copy name to the event control block */
0000 ; OS_EXIT_CRITICAL();
0000 ; *err = OS_NO_ERR;
0000 ; }
0000 ; #endif
0000 ;
0000 ; /*$PAGE*/
0000 ; /*
0000 ; *********************************************************************************************************
0000 ; * INITIALIZATION
0000 ; *
0000 ; * Description: This function is used to initialize the internals of uC/OS-II and MUST be called prior to
0000 ; * creating any uC/OS-II object and, prior to calling OSStart().
0000 ; *
0000 ; * Arguments : none
0000 ; *
0000 ; * Returns : none
0000 ; *********************************************************************************************************
0000 ; */
0000 ;
0000 ; void OSInit (void)
0000 ; {
0000 .dbline 232
0000 ; #if OS_VERSION >= 204
0000 ; OSInitHookBegin(); /* Call port specific initialization code */
0000 0E940000 xcall _OSInitHookBegin
0004 .dbline 235
0004 ; #endif
0004 ;
0004 ; OS_InitMisc(); /* Initialize miscellaneous variables */
0004 B5D2 xcall _OS_InitMisc
0006 .dbline 237
0006 ;
0006 ; OS_InitRdyList(); /* Initialize the Ready List */
0006 D6D2 xcall _OS_InitRdyList
0008 .dbline 239
0008 ;
0008 ; OS_InitTCBList(); /* Initialize the free list of OS_TCBs */
0008 04D3 xcall _OS_InitTCBList
000A .dbline 241
000A ;
000A ; OS_InitEventList(); /* Initialize the free list of OS_EVENTs */
000A 85D2 xcall _OS_InitEventList
000C .dbline 248
000C ;
000C ; #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
000C ; OS_FlagInit(); /* Initialize the event flag structures */
000C ; #endif
000C ;
000C ; #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
000C ; OS_MemInit(); /* Initialize the memory manager */
000C 63D6 xcall _OS_MemInit
000E .dbline 255
000E ; #endif
000E ;
000E ; #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
000E ; OS_QInit(); /* Initialize the message queue structures */
000E ; #endif
000E ;
000E ; OS_InitTaskIdle(); /* Create the Idle Task */
000E F3D2 xcall _OS_InitTaskIdle
0010 .dbline 261
0010 ; #if OS_TASK_STAT_EN > 0
0010 ; OS_InitTaskStat(); /* Create the Statistic Task */
0010 ; #endif
0010 ;
0010 ; #if OS_VERSION >= 204
0010 ; OSInitHookEnd(); /* Call port specific init. code */
0010 0E940000 xcall _OSInitHookEnd
0014 .dbline -2
0014 L1:
0014 .dbline 0 ; func end
0014 0895 ret
0016 .dbend
0016 .dbfunc e OSIntEnter _OSIntEnter fV
.even
0016 _OSIntEnter::
0016 .dbline -1
0016 .dbline 295
0016 ; #endif
0016 ;
0016 ; #if OS_VERSION >= 270 && OS_DEBUG_EN > 0
0016 ; OSDebugInit();
0016 ; #endif
0016 ; }
0016 ; /*$PAGE*/
0016 ; /*
0016 ; *********************************************************************************************************
0016 ; * ENTER ISR
0016 ; *
0016 ; * Description: This function is used to notify uC/OS-II that you are about to service an interrupt
0016 ; * service routine (ISR). This allows uC/OS-II to keep track of interrupt nesting and thus
0016 ; * only perform rescheduling at the last nested ISR.
0016 ; *
0016 ; * Arguments : none
0016 ; *
0016 ; * Returns : none
0016 ; *
0016 ; * Notes : 1) This function should be called ith interrupts already disabled
0016 ; * 2) Your ISR can directly increment OSIntNesting without calling this function because
0016 ; * OSIntNesting has been declared 'global'.
0016 ; * 3) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
0016 ; * 4) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
0016 ; * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
0016 ; * end of the ISR.
0016 ; * 5) You are allowed to nest interrupts up to 255 levels deep.
0016 ; * 6) I removed the OS_ENTER_CRITICAL() and OS_EXIT_CRITICAL() around the increment because
0016 ; * OSIntEnter() is always called with interrupts disabled.
0016 ; *********************************************************************************************************
0016 ; */
0016 ;
0016 ; void OSIntEnter (void)
0016 ; {
0016 .dbline 296
0016 ; if (OSRunning == TRUE) {
0016 80913D0A lds R24,_OSRunning
001A 8130 cpi R24,1
001C 39F4 brne L3
001E X0:
001E .dbline 296
001E .dbline 297
001E ; if (OSIntNesting < 255u) {
001E 80914B0A lds R24,_OSIntNesting
0022 8F3F cpi R24,255
0024 18F4 brsh L5
0026 X1:
0026 .dbline 297
0026 .dbline 298
0026 ; OSIntNesting++; /* Increment ISR nesting level */
0026 8F5F subi R24,255 ; addi 1
0028 80934B0A sts _OSIntNesting,R24
002C .dbline 299
002C ; }
002C L5:
002C .dbline 300
002C ; }
002C L3:
002C .dbline -2
002C L2:
002C .dbline 0 ; func end
002C 0895 ret
002E .dbend
002E .dbfunc e OSIntExit _OSIntExit fV
002E ; cpu_sr -> R10
.even
002E _OSIntExit::
002E 0E940000 xcall push_xgset300C
0032 .dbline -1
0032 .dbline 323
0032 ; }
0032 ; /*$PAGE*/
0032 ; /*
0032 ; *********************************************************************************************************
0032 ; * EXIT ISR
0032 ; *
0032 ; * Description: This function is used to notify uC/OS-II that you have completed serviving an ISR. When
0032 ; * the last nested ISR has completed, uC/OS-II will call the scheduler to determine whether
0032 ; * a new, high-priority task, is ready to run.
0032 ; *
0032 ; * Arguments : none
0032 ; *
0032 ; * Returns : none
0032 ; *
0032 ; * Notes : 1) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words, for every call
0032 ; * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
0032 ; * end of the ISR.
0032 ; * 2) Rescheduling is prevented when the scheduler is locked (see OS_SchedLock())
0032 ; *********************************************************************************************************
0032 ; */
0032 ;
0032 ; void OSIntExit (void)
0032 ; {
0032 .dbline 329
0032 ; #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
0032 ; OS_CPU_SR cpu_sr;
0032 ; #endif
0032 ;
0032 ;
0032 ; if (OSRunning == TRUE) {
0032 80913D0A lds R24,_OSRunning
0036 8130 cpi R24,1
0038 09F0 breq X7
003A 7FC0 xjmp L8
003C X7:
003C X2:
003C .dbline 329
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -