⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_cpu_c.s

📁 将本站的UCOSFORAVR128V276版本升级到了280版
💻 S
📖 第 1 页 / 共 2 页
字号:
	.module os_cpu_c.c
	.area text(rom, con, rel)
	.dbfile E:\ypt050912\XIAZAI\xinzai\UCOSAVR128\ICC\os_cpu_c.c
	.dbfunc e OSInitHookBegin _OSInitHookBegin fV
	.even
_OSInitHookBegin::
	.dbline -1
	.dbline 31
; /*
; *********************************************************************************************************
; *                                              uC/OS-II
; *                                        The Real-Time Kernel
; * 
; *                                       ATmega128 Specific code
; *
; * File     : OS_CPU_C.C
; * By       : Ole Saether
; *            Jean J. Labrosse
; *********************************************************************************************************
; */
; 
; #define  OS_CPU_GLOBALS
; #include <includes.h>
; 
; /*
; *********************************************************************************************************
; *                                       OS INITIALIZATION HOOK
; *                                            (BEGINNING)
; *
; * Description: This function is called by OSInit() at the beginning of OSInit().
; *
; * Arguments  : none
; *
; * Note(s)    : 1) Interrupts should be disabled during this call.
; *********************************************************************************************************
; */
; #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
; void  OSInitHookBegin (void)
; {
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e OSInitHookEnd _OSInitHookEnd fV
	.even
_OSInitHookEnd::
	.dbline -1
	.dbline 49
; }
; #endif
; 
; /*
; *********************************************************************************************************
; *                                       OS INITIALIZATION HOOK
; *                                               (END)
; *
; * Description: This function is called by OSInit() at the end of OSInit().
; *
; * Arguments  : none
; *
; * Note(s)    : 1) Interrupts should be disabled during this call.
; *********************************************************************************************************
; */
; #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
; void  OSInitHookEnd (void)
; {
	.dbline -2
L2:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e OSTaskCreateHook _OSTaskCreateHook fV
	.dbstruct 0 8 os_event
	.dbfield 0 OSEventType c
	.dbfield 1 OSEventPtr pV
	.dbfield 3 OSEventCnt i
	.dbfield 5 OSEventGrp c
	.dbfield 6 OSEventTbl A[2:2]c
	.dbend
	.dbstruct 0 18 os_tcb
	.dbfield 0 OSTCBStkPtr pc
	.dbfield 2 OSTCBNext pS[os_tcb]
	.dbfield 4 OSTCBPrev pS[os_tcb]
	.dbfield 6 OSTCBEventPtr pS[os_event]
	.dbfield 8 OSTCBDly i
	.dbfield 10 OSTCBStat c
	.dbfield 11 OSTCBPendTO c
	.dbfield 12 OSTCBPrio c
	.dbfield 13 OSTCBX c
	.dbfield 14 OSTCBY c
	.dbfield 15 OSTCBBitX c
	.dbfield 16 OSTCBBitY c
	.dbfield 17 OSTCBDelReq c
	.dbend
;           ptcb -> R0,R1
	.even
_OSTaskCreateHook::
	.dbline -1
	.dbline 67
; }
; #endif
; 
; /*$PAGE*/
; /*
; *********************************************************************************************************
; *                                          TASK CREATION HOOK
; *
; * Description: This function is called when a task is created.
; *
; * Arguments  : ptcb   is a pointer to the task control block of the task being created.
; *
; * Note(s)    : 1) Interrupts are disabled during this call.
; *********************************************************************************************************
; */
; #if OS_CPU_HOOKS_EN > 0 
; void  OSTaskCreateHook (OS_TCB *ptcb)
; {
	.dbline -2
L3:
	.dbline 0 ; func end
	ret
	.dbsym l ptcb 0 pS[os_tcb]
	.dbend
	.dbfunc e OSTaskDelHook _OSTaskDelHook fV
;           ptcb -> R16,R17
	.even
_OSTaskDelHook::
	.dbline -1
	.dbline 90
; #ifdef OS_VIEW_MODULE
; //    OSView_TaskCreateHook(ptcb);
; #else
;     ptcb = ptcb;                       /* Prevent compiler warning                                     */
; #endif
; }
; #endif
; 
; 
; /*
; *********************************************************************************************************
; *                                           TASK DELETION HOOK
; *
; * Description: This function is called when a task is deleted.
; *
; * Arguments  : ptcb   is a pointer to the task control block of the task being deleted.
; *
; * Note(s)    : 1) Interrupts are disabled during this call.
; *********************************************************************************************************
; */
; #if OS_CPU_HOOKS_EN > 0 
; void  OSTaskDelHook (OS_TCB *ptcb)
; {
	.dbline 91
;     ptcb = ptcb;                       /* Prevent compiler warning                                     */
	.dbline -2
L4:
	.dbline 0 ; func end
	ret
	.dbsym r ptcb 16 pS[os_tcb]
	.dbend
	.dbfunc e OSTaskIdleHook _OSTaskIdleHook fV
	.even
_OSTaskIdleHook::
	.dbline -1
	.dbline 109
; }
; #endif
; 
; /*
; *********************************************************************************************************
; *                                             IDLE TASK HOOK
; *
; * Description: This function is called by the idle task.  This hook has been added to allow you to do  
; *              such things as STOP the CPU to conserve power.
; *
; * Arguments  : none
; *
; * Note(s)    : 1) Interrupts are enabled during this call.
; *********************************************************************************************************
; */
; #if OS_CPU_HOOKS_EN > 0 && OS_VERSION >= 251
; void  OSTaskIdleHook (void)
; {
	.dbline -2
L5:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e OSTaskStatHook _OSTaskStatHook fV
	.even
_OSTaskStatHook::
	.dbline -1
	.dbline 126
; }
; #endif
; 
; /*
; *********************************************************************************************************
; *                                           STATISTIC TASK HOOK
; *
; * Description: This function is called every second by uC/OS-II's statistics task.  This allows your 
; *              application to add functionality to the statistics task.
; *
; * Arguments  : none
; *********************************************************************************************************
; */
; 
; #if OS_CPU_HOOKS_EN > 0 
; void  OSTaskStatHook (void)
; {
	.dbline -2
L6:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e OSTaskStkInit _OSTaskStkInit fpc
;      phard_stk -> R10,R11
;            tmp -> R22,R23
;      psoft_stk -> R20,R21
;            opt -> y+8
;           ptos -> y+6
;          p_arg -> R18,R19
;           task -> R16,R17
	.even
_OSTaskStkInit::
	xcall push_gset3
	.dbline -1
	.dbline 167
; }
; #endif
; 
; /*$PAGE*/
; /*
; **********************************************************************************************************
; *                                       INITIALIZE A TASK'S STACK
; *
; * Description: This function is called by either OSTaskCreate() or OSTaskCreateExt() to initialize the
; *              stack frame of the task being created. This function is highly processor specific.
; *
; * Arguments  : task          is a pointer to the task code
; *
; *              p_arg         is a pointer to a user supplied data area that will be passed to the task
; *                            when the task first executes.
; *
; *              ptos          is a pointer to the top of stack. It is assumed that 'ptos' points to the
; *                            highest valid address on the stack.
; *
; *              opt           specifies options that can be used to alter the behavior of OSTaskStkInit().
; *                            (see uCOS_II.H for OS_TASK_OPT_???).
; *
; * Returns    : Always returns the location of the new top-of-stack' once the processor registers have
; *              been placed on the stack in the proper order.
; *
; * Note(s)    : Interrupts are enabled when your task starts executing. You can change this by setting the
; *              SREG to 0x00 instead. In this case, interrupts would be disabled upon task startup. The
; *              application code would be responsible for enabling interrupts at the beginning of the task
; *              code. You will need to modify OSTaskIdle() and OSTaskStat() so that they enable interrupts.
; *              Failure to do this will make your system crash!
; *
; *              The AVR return stack is placed OS_TASK_HARD_STK_SIZE bytes before the bottom of the task's
; *              stack.
; *
; *              (1) IMPORTANT: The ICC compiler handles function pointers by actually passing the pointer
; *                             to a location in Flash that actually contains the pointer to the function.
; **********************************************************************************************************
; */
; 
; OS_STK  *OSTaskStkInit (void (*task)(void *pd), void *p_arg, OS_STK *ptos, INT16U opt)
; {
	.dbline 173
;     INT8U  *psoft_stk;
;     INT8U  *phard_stk;                      /* Temp. variable used for setting up AVR hardware stack    */
;     INT16U  tmp;
; 
; 
;     opt          = opt;                     /* 'opt' is not used, prevent warning                       */
	.dbline 174
;     psoft_stk    = (INT8U *)ptos;
	ldd R20,y+6
	ldd R21,y+7
	.dbline 175
;     phard_stk    = (INT8U *)ptos
	lds R2,_OSTaskStkSize
	lds R3,_OSTaskStkSize+1
	movw R4,R20
	sub R4,R2
	sbc R5,R3
	lds R10,_OSTaskHardStkSize
	lds R11,_OSTaskHardStkSize+1
	add R10,R4
	adc R11,R5
	.dbline 179
;                  - OSTaskStkSize            /* Task stack size                                          */
;                  + OSTaskHardStkSize;       /* AVR return stack ("hardware stack")                      */
; 
;     tmp          = *(INT16U const *)task;   /* (1) ICC compiler handles function pointers indirectly!   */
	movw R30,R16
	lpm R22,Z+
	lpm R23,Z
	.dbline 181
; 
;     *phard_stk-- = (INT8U)tmp;              /* Put task start address on top of "hardware stack"        */
	movw R2,R10
	movw R24,R2
	sbiw R24,1
	movw R30,R2
	std z+0,R22
	.dbline 182
;     *phard_stk-- = (INT8U)(tmp >> 8);
	movw R2,R24
	sbiw R24,1
	movw R10,R24
	movw R4,R22
	mov R4,R5
	clr R5
	movw R30,R2
	std z+0,R4
	.dbline 184
; 
;     *psoft_stk-- = (INT8U)0x00;             /* R0    = 0x00                                             */
	movw R2,R20
	subi R20,1
	sbci R21,0
	clr R4
	movw R30,R2
	std z+0,R4
	.dbline 185
;     *psoft_stk-- = (INT8U)0x01;             /* R1    = 0x01                                             */
	movw R2,R20
	subi R20,1
	sbci R21,0
	ldi R24,1
	movw R30,R2
	std z+0,R24
	.dbline 186
;     *psoft_stk-- = (INT8U)0x02;             /* R2    = 0x02                                             */
	movw R2,R20
	subi R20,1
	sbci R21,0
	ldi R24,2
	movw R30,R2
	std z+0,R24
	.dbline 187
;     *psoft_stk-- = (INT8U)0x03;             /* R3    = 0x03                                             */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -