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

📄 app.s

📁 基于mega128的ucos参考源码
💻 S
📖 第 1 页 / 共 2 页
字号:
	.module app.c
	.area text(rom, con, rel)
	.dbfile C:\DOCUME~1\Administrator\MYDOCU~1\doc_ucosii_data_m128_iccavr_by_zhifeng\app.c
	.dbfunc e main _main fV
	.even
_main::
	sbiw R28,3
	.dbline -1
	.dbline 74
; /*
; *************************************************************************************************************
; *                                                uC/OS-II
; *                                          The Real-Time Kernel
; *
; *                                         ATmega128  Sample code
; *
; * File : APP.C
; * By   : Jean J. Labrosse
; *************************************************************************************************************
; */
; 
; #include  <includes.h>
; 
; /*
; **************************************************************************************************************
; *                                               CONSTANTS
; *
; * Note(s) : 1) See OS_CFG.H for the default stack size: 'OS_TASK_STK_SIZE'
; **************************************************************************************************************
; */
; 
; #define  CPU_CLK_FREQ                  3684000L
; 
; 
; #define  OS_TASK_START_STK_SIZE        OS_TASK_STK_SIZE
; #define  OS_TASK_START_HARD_STK_SIZE   OS_TASK_HARD_STK_SIZE
; 
; #define  OS_TASK_1_STK_SIZE            OS_TASK_STK_SIZE
; #define  OS_TASK_1_HARD_STK_SIZE       OS_TASK_HARD_STK_SIZE
; 
; #define  OS_TASK_2_STK_SIZE            OS_TASK_STK_SIZE
; #define  OS_TASK_2_HARD_STK_SIZE       OS_TASK_HARD_STK_SIZE
; 
; 
; /*
; **************************************************************************************************************
; *                                               VARIABLES
; **************************************************************************************************************
; */
; 
; OS_STK  AppTaskStartStk[OS_TASK_START_STK_SIZE];
; OS_STK  AppTask1Stk[OS_TASK_1_STK_SIZE];
; OS_STK  AppTask2Stk[OS_TASK_2_STK_SIZE];
; 
; /*
; **************************************************************************************************************
; *                                           FUNCTION PROTOTYPES
; **************************************************************************************************************
; */
; 
;        void  main(void);
;        
; static void  AppTaskStart(void *p_arg);
; static void  AppTaskCreate(void);
; static void  AppTask1(void *p_arg);
; static void  AppTask2(void *p_arg);
; 
; static void  AppIOInit(void);
; 
; static void  LED_Toggle(INT8U led);
;  
; /*
; **************************************************************************************************************
; *                                                MAIN
; *
; * Note(s): 1) You SHOULD use OS_TASK_STK_SIZE (see OS_CFG.H) when setting OSTaskStkSize prior to calling 
; *             OSInit() because OS_TASK_IDLE_STK_SIZE and OS_TASK_STAT_STK_SIZE are set to this value in
; *             OS_CFG.H.
; **************************************************************************************************************
; */
; 
; void  main (void)
; {
	.dbline 78
;     /*---- Any initialization code prior to calling OSInit() goes HERE --------------------------------*/
; 
;                                                 /* IMPORTANT: MUST be setup before calling 'OSInit()'  */
;     OSTaskStkSize     = OS_TASK_STK_SIZE;       /* Setup the default stack size                        */
	ldi R24,256
	ldi R25,1
	sts _OSTaskStkSize+1,R25
	sts _OSTaskStkSize,R24
	.dbline 79
;     OSTaskHardStkSize = OS_TASK_HARD_STK_SIZE;  /* Setup the default hardware stack size               */
	ldi R24,64
	ldi R25,0
	sts _OSTaskHardStkSize+1,R25
	sts _OSTaskHardStkSize,R24
	.dbline 81
; 
;     OSInit();                                   /* Initialize "uC/OS-II, The Real-Time Kernel"         */
	xcall _OSInit
	.dbline 85
; 
;     /*---- Any initialization code before starting multitasking ---------------------------------------*/
; 
;     OSTaskStkSize     = OS_TASK_START_STK_SIZE;       /* Setup the total stack size                    */
	ldi R24,256
	ldi R25,1
	sts _OSTaskStkSize+1,R25
	sts _OSTaskStkSize,R24
	.dbline 86
;     OSTaskHardStkSize = OS_TASK_START_HARD_STK_SIZE;  /* Setup the hardware stack size                 */
	ldi R24,64
	ldi R25,0
	sts _OSTaskHardStkSize+1,R25
	sts _OSTaskHardStkSize,R24
	.dbline 87
;     OSTaskCreate(AppTaskStart, (void *)0, (OS_STK *)&AppTaskStartStk[OSTaskStkSize - 1], 0);
	clr R2
	std y+2,R2
	ldi R24,<_AppTaskStartStk
	ldi R25,>_AppTaskStartStk
	lds R30,_OSTaskStkSize
	lds R31,_OSTaskStkSize+1
	sbiw R30,1
	add R30,R24
	adc R31,R25
	std y+1,R31
	std y+0,R30
	clr R18
	clr R19
	ldi R16,<PL_AppTaskStart
	ldi R17,>PL_AppTaskStart
	xcall _OSTaskCreate
	.dbline 91
; 
;     /*---- Create any other task you want before we start multitasking --------------------------------*/
; 
;     OSStart();                                  /* Start multitasking (i.e. give control to uC/OS-II)  */
	xcall _OSStart
	.dbline -2
L1:
	adiw R28,3
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc s AppTaskStart _AppTaskStart fV
;          p_arg -> R20,R21
	.even
_AppTaskStart:
	xcall push_gset1
	movw R20,R16
	.dbline -1
	.dbline 109
; }
; 
; /*
; *********************************************************************************************************
; *                                          STARTUP TASK
; *
; * Description : This is an example of a startup task.  As mentioned in the book's text, you MUST
; *               initialize the ticker only once multitasking has started.
; *
; * Arguments   : p_arg   is the argument passed to 'AppStartTask()' by 'OSTaskCreate()'.
; *
; * Notes       : 1) The first line of code is used to prevent a compiler warning because 'p_arg' is not
; *                  used.  The compiler should not generate any code for this statement.
; *********************************************************************************************************
; */
; 
; static void  AppTaskStart (void *p_arg)
; {
	.dbline 110
;     p_arg = p_arg;                               /* Prevent compiler warnings                          */
	.dbline 112
; 
;     OSTickISR_Init();                            /* Initialize the ticker                              */
	xcall _OSTickISR_Init
	.dbline 114
; 
;     AppIOInit();                                 /* Initialize the I/Os                                */
	xcall _AppIOInit
	.dbline 116
; 
;     AppTaskCreate();
	xcall _AppTaskCreate
	xjmp L4
L3:
	.dbline 118
	.dbline 119
	ldi R16,1
	xcall _LED_Toggle
	.dbline 120
	ldi R16,5
	ldi R17,0
	xcall _OSTimeDly
	.dbline 121
L4:
	.dbline 118
	xjmp L3
X0:
	.dbline -2
L2:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r p_arg 20 pV
	.dbend
	.dbfunc s AppTaskCreate _AppTaskCreate fV
	.even
_AppTaskCreate:
	sbiw R28,3
	.dbline -1
	.dbline 139
; 
;     while (TRUE) {                               /* Task body, always written as an infinite loop.     */
;         LED_Toggle(1);
;         OSTimeDly(OS_TICKS_PER_SEC / 10);
;     }
; }
; 
; 
; /*
; *********************************************************************************************************
; *                                    CREATE APPLICATION TASKS
; *
; * Description : This function creates the application tasks.
; *
; * Arguments   : p_arg   is the argument passed to 'AppStartTask()' by 'OSTaskCreate()'.
; *
; * Notes       : 1) The first line of code is used to prevent a compiler warning because 'p_arg' is not
; *                  used.  The compiler should not generate any code for this statement.
; *********************************************************************************************************
; */
; 
; static  void  AppTaskCreate (void)
; {
	.dbline 141
;     /*---- Task initialization code goes HERE! --------------------------------------------------------*/
;     OSTaskStkSize     = OS_TASK_1_STK_SIZE;        /* Setup the default stack size                     */
	ldi R24,256
	ldi R25,1
	sts _OSTaskStkSize+1,R25
	sts _OSTaskStkSize,R24
	.dbline 142
;     OSTaskHardStkSize = OS_TASK_1_HARD_STK_SIZE;   /* Setup the default hardware stack size            */
	ldi R24,64
	ldi R25,0
	sts _OSTaskHardStkSize+1,R25
	sts _OSTaskHardStkSize,R24
	.dbline 143
;     OSTaskCreate(AppTask1, (void *)0, (OS_STK *)&AppTask1Stk[OSTaskStkSize - 1], 1);
	ldi R24,1
	std y+2,R24
	ldi R24,<_AppTask1Stk
	ldi R25,>_AppTask1Stk
	lds R30,_OSTaskStkSize
	lds R31,_OSTaskStkSize+1
	sbiw R30,1
	add R30,R24
	adc R31,R25
	std y+1,R31
	std y+0,R30
	clr R18
	clr R19
	ldi R16,<PL_AppTask1
	ldi R17,>PL_AppTask1
	xcall _OSTaskCreate
	.dbline 145
; 
;     OSTaskStkSize     = OS_TASK_2_STK_SIZE;        /* Setup the default stack size                     */
	ldi R24,256
	ldi R25,1
	sts _OSTaskStkSize+1,R25
	sts _OSTaskStkSize,R24
	.dbline 146
;     OSTaskHardStkSize = OS_TASK_2_HARD_STK_SIZE;   /* Setup the default hardware stack size            */
	ldi R24,64
	ldi R25,0
	sts _OSTaskHardStkSize+1,R25
	sts _OSTaskHardStkSize,R24
	.dbline 147
;     OSTaskCreate(AppTask2, (void *)0, (OS_STK *)&AppTask2Stk[OSTaskStkSize - 1], 2);
	ldi R24,2
	std y+2,R24
	ldi R24,<_AppTask2Stk
	ldi R25,>_AppTask2Stk
	lds R30,_OSTaskStkSize
	lds R31,_OSTaskStkSize+1
	sbiw R30,1
	add R30,R24
	adc R31,R25
	std y+1,R31
	std y+0,R30
	clr R18
	clr R19
	ldi R16,<PL_AppTask2
	ldi R17,>PL_AppTask2
	xcall _OSTaskCreate
	.dbline -2
L6:
	adiw R28,3
	.dbline 0 ; func end

⌨️ 快捷键说明

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