📄 app.lis
字号:
.module app.c
.area text(rom, con, rel)
0000 .dbfile F:\AVRPRA~1\ucosii-port2-mega8\app.c
0000 .dbfunc e main _main fV
.even
0000 _main::
0000 2397 sbiw R28,3
0002 .dbline -1
0002 .dbline 75
0002 ; /*
0002 ; *************************************************************************************************************
0002 ; * uC/OS-II
0002 ; * The Real-Time Kernel
0002 ; *
0002 ; * ATmega128 Sample code
0002 ; *
0002 ; * File : APP.C
0002 ; * By : Jean J. Labrosse
0002 ; *************************************************************************************************************
0002 ; */
0002 ;
0002 ; #include "includes.h"
0002 ; #include "iom8v.h"
0002 ; #include "1602LCD.h"
0002 ; /*
0002 ; **************************************************************************************************************
0002 ; * CONSTANTS
0002 ; *
0002 ; * Note(s) : 1) See OS_CFG.H for the default stack size: 'OS_TASK_STK_SIZE'
0002 ; **************************************************************************************************************
0002 ; */
0002 ;
0002 ; #define CPU_CLK_FREQ 8000000L
0002 ;
0002 ;
0002 ; #define OS_TASK_START_STK_SIZE OS_TASK_STK_SIZE
0002 ; #define OS_TASK_START_HARD_STK_SIZE OS_TASK_HARD_STK_SIZE
0002 ;
0002 ; #define OS_TASK_1_STK_SIZE OS_TASK_STK_SIZE
0002 ; #define OS_TASK_1_HARD_STK_SIZE OS_TASK_HARD_STK_SIZE
0002 ;
0002 ; #define OS_TASK_2_STK_SIZE OS_TASK_STK_SIZE
0002 ; #define OS_TASK_2_HARD_STK_SIZE OS_TASK_HARD_STK_SIZE
0002 ;
0002 ;
0002 ; /*
0002 ; **************************************************************************************************************
0002 ; * VARIABLES
0002 ; **************************************************************************************************************
0002 ; */
0002 ;
0002 ; OS_STK AppTaskStartStk[OS_TASK_START_STK_SIZE];
0002 ; OS_STK AppTask1Stk[OS_TASK_1_STK_SIZE];
0002 ; OS_STK AppTask2Stk[OS_TASK_2_STK_SIZE];
0002 ;
0002 ; /*
0002 ; **************************************************************************************************************
0002 ; * FUNCTION PROTOTYPES
0002 ; **************************************************************************************************************
0002 ; */
0002 ;
0002 ; void main(void);
0002 ;
0002 ; static void AppTaskStart(void *p_arg);
0002 ; static void AppTaskCreate(void);
0002 ; static void AppTask1(void *p_arg);
0002 ; static void AppTask2(void *p_arg);
0002 ;
0002 ; static void AppIOInit(void);
0002 ;
0002 ; static void LED_Toggle(INT8U led);
0002 ; unsigned char *i;
0002 ; /*
0002 ; **************************************************************************************************************
0002 ; * MAIN
0002 ; *
0002 ; * Note(s): 1) You SHOULD use OS_TASK_STK_SIZE (see OS_CFG.H) when setting OSTaskStkSize prior to calling
0002 ; * OSInit() because OS_TASK_IDLE_STK_SIZE and OS_TASK_STAT_STK_SIZE are set to this value in
0002 ; * OS_CFG.H.
0002 ; **************************************************************************************************************
0002 ; */
0002 ;
0002 ; void main (void)
0002 ; {
0002 .dbline 79
0002 ; /*---- Any initialization code prior to calling OSInit() goes HERE --------------------------------*/
0002 ;
0002 ; /* IMPORTANT: MUST be setup before calling 'OSInit()' */
0002 ; OSTaskStkSize = OS_TASK_STK_SIZE; /* Setup the default stack size */
0002 80E8 ldi R24,128
0004 90E0 ldi R25,0
0006 90930100 sts _OSTaskStkSize+1,R25
000A 80930000 sts _OSTaskStkSize,R24
000E .dbline 80
000E ; OSTaskHardStkSize = OS_TASK_HARD_STK_SIZE; /* Setup the default hardware stack size */
000E 80E2 ldi R24,32
0010 90930100 sts _OSTaskHardStkSize+1,R25
0014 80930000 sts _OSTaskHardStkSize,R24
0018 .dbline 82
0018 ;
0018 ; OSInit(); /* Initialize "uC/OS-II, The Real-Time Kernel" */
0018 00D0 rcall _OSInit
001A .dbline 86
001A ;
001A ; /*---- Any initialization code before starting multitasking ---------------------------------------*/
001A ;
001A ; OSTaskStkSize = OS_TASK_START_STK_SIZE; /* Setup the total stack size */
001A 80E8 ldi R24,128
001C 90E0 ldi R25,0
001E 90930100 sts _OSTaskStkSize+1,R25
0022 80930000 sts _OSTaskStkSize,R24
0026 .dbline 87
0026 ; OSTaskHardStkSize = OS_TASK_START_HARD_STK_SIZE; /* Setup the hardware stack size */
0026 80E2 ldi R24,32
0028 90930100 sts _OSTaskHardStkSize+1,R25
002C 80930000 sts _OSTaskHardStkSize,R24
0030 .dbline 88
0030 ; OSTaskCreate(AppTaskStart, (void *)0, (OS_STK *)&AppTaskStartStk[OSTaskStkSize - 1], 0);
0030 2224 clr R2
0032 2A82 std y+2,R2
0034 80E0 ldi R24,<_AppTaskStartStk
0036 90E0 ldi R25,>_AppTaskStartStk
0038 E0910000 lds R30,_OSTaskStkSize
003C F0910100 lds R31,_OSTaskStkSize+1
0040 3197 sbiw R30,1
0042 E80F add R30,R24
0044 F91F adc R31,R25
0046 F983 std y+1,R31
0048 E883 std y+0,R30
004A 2227 clr R18
004C 3327 clr R19
004E 00E0 ldi R16,<PL_AppTaskStart
0050 10E0 ldi R17,>PL_AppTaskStart
0052 00D0 rcall _OSTaskCreate
0054 .dbline 92
0054 ;
0054 ; /*---- Create any other task you want before we start multitasking --------------------------------*/
0054 ;
0054 ; OSStart(); /* Start multitasking (i.e. give control to uC/OS-II) */
0054 00D0 rcall _OSStart
0056 .dbline -2
0056 L3:
0056 2396 adiw R28,3
0058 .dbline 0 ; func end
0058 0895 ret
005A .dbend
005A .dbfunc s AppTaskStart _AppTaskStart fV
005A ; p_arg -> R20,R21
.even
005A _AppTaskStart:
005A 00D0 rcall push_gset1
005C A801 movw R20,R16
005E 2497 sbiw R28,4
0060 .dbline -1
0060 .dbline 110
0060 ; }
0060 ;
0060 ; /*
0060 ; *********************************************************************************************************
0060 ; * STARTUP TASK
0060 ; *
0060 ; * Description : This is an example of a startup task. As mentioned in the book's text, you MUST
0060 ; * initialize the ticker only once multitasking has started.
0060 ; *
0060 ; * Arguments : p_arg is the argument passed to 'AppStartTask()' by 'OSTaskCreate()'.
0060 ; *
0060 ; * Notes : 1) The first line of code is used to prevent a compiler warning because 'p_arg' is not
0060 ; * used. The compiler should not generate any code for this statement.
0060 ; *********************************************************************************************************
0060 ; */
0060 ;
0060 ; static void AppTaskStart (void *p_arg)
0060 ; {
0060 .dbline 111
0060 ; p_arg = p_arg; /* Prevent compiler warnings */
0060 .dbline 113
0060 ;
0060 ; OSTickISR_Init(); /* Initialize the ticker */
0060 9DD0 rcall _OSTickISR_Init
0062 .dbline 115
0062 ;
0062 ; AppIOInit(); /* Initialize the I/Os */
0062 95D0 rcall _AppIOInit
0064 .dbline 116
0064 ; LCD_init();
0064 00D0 rcall _LCD_init
0066 .dbline 117
0066 ; AppTaskCreate();
0066 1AD0 rcall _AppTaskCreate
0068 15C0 rjmp L6
006A L5:
006A .dbline 119
006A .dbline 123
006A 2227 clr R18
006C 3327 clr R19
006E 01E0 ldi R16,1
0070 10E0 ldi R17,0
0072 00D0 rcall _LCD_write_char
0074 .dbline 125
0074 80E0 ldi R24,<L8
0076 90E0 ldi R25,>L8
0078 9983 std y+1,R25
007A 8883 std y+0,R24
007C 2227 clr R18
007E 0027 clr R16
0080 00D0 rcall _LCD_write_string
0082 .dbline 126
0082 2224 clr R2
0084 3324 clr R3
0086 3B82 std y+3,R3
0088 2A82 std y+2,R2
008A 83E0 ldi R24,3
008C 8883 std y+0,R24
008E 2227 clr R18
0090 0027 clr R16
0092 00D0 rcall _OSTimeDlyHMSM
0094 .dbline 127
0094 L6:
0094 .dbline 119
0094 EACF rjmp L5
0096 X0:
0096 .dbline -2
0096 L4:
0096 2496 adiw R28,4
0098 00D0 rcall pop_gset1
009A .dbline 0 ; func end
009A 0895 ret
009C .dbsym r p_arg 20 pV
009C .dbend
009C .dbfunc s AppTaskCreate _AppTaskCreate fV
.even
009C _AppTaskCreate:
009C 2397 sbiw R28,3
009E .dbline -1
009E .dbline 145
009E ;
009E ; while (TRUE) { /* Task body, always written as an infinite loop. */
009E ; //LED_Toggle(1);
009E ; //OSTimeDly(OS_TICKS_PER_SEC / 10);
009E ;
009E ; LCD_write_char(0x01,0); /*显示清屏 */
009E ;
009E ; LCD_write_string(0,0,"Welcome");
009E ; OSTimeDlyHMSM(0,0,3,0);
009E ; }
009E ; }
009E ;
009E ;
009E ; /*
009E ; *********************************************************************************************************
009E ; * CREATE APPLICATION TASKS
009E ; *
009E ; * Description : This function creates the application tasks.
009E ; *
009E ; * Arguments : p_arg is the argument passed to 'AppStartTask()' by 'OSTaskCreate()'.
009E ; *
009E ; * Notes : 1) The first line of code is used to prevent a compiler warning because 'p_arg' is not
009E ; * used. The compiler should not generate any code for this statement.
009E ; *********************************************************************************************************
009E ; */
009E ;
009E ; static void AppTaskCreate (void)
009E ; {
009E .dbline 147
009E ; /*---- Task initialization code goes HERE! --------------------------------------------------------*/
009E ; OSTaskStkSize = OS_TASK_1_STK_SIZE; /* Setup the default stack size */
009E 80E8 ldi R24,128
00A0 90E0 ldi R25,0
00A2 90930100 sts _OSTaskStkSize+1,R25
00A6 80930000 sts _OSTaskStkSize,R24
00AA .dbline 148
00AA ; OSTaskHardStkSize = OS_TASK_1_HARD_STK_SIZE; /* Setup the default hardware stack size */
00AA 80E2 ldi R24,32
00AC 90930100 sts _OSTaskHardStkSize+1,R25
00B0 80930000 sts _OSTaskHardStkSize,R24
00B4 .dbline 149
00B4 ; OSTaskCreate(AppTask1, (void *)0, (OS_STK *)&AppTask1Stk[OSTaskStkSize - 1], 1);
00B4 81E0 ldi R24,1
00B6 8A83 std y+2,R24
00B8 80E0 ldi R24,<_AppTask1Stk
00BA 90E0 ldi R25,>_AppTask1Stk
00BC E0910000 lds R30,_OSTaskStkSize
00C0 F0910100 lds R31,_OSTaskStkSize+1
00C4 3197 sbiw R30,1
00C6 E80F add R30,R24
00C8 F91F adc R31,R25
00CA F983 std y+1,R31
00CC E883 std y+0,R30
00CE 2227 clr R18
00D0 3327 clr R19
00D2 00E0 ldi R16,<PL_AppTask1
00D4 10E0 ldi R17,>PL_AppTask1
00D6 00D0 rcall _OSTaskCreate
00D8 .dbline 151
00D8 ;
00D8 ; OSTaskStkSize = OS_TASK_2_STK_SIZE; /* Setup the default stack size */
00D8 80E8 ldi R24,128
00DA 90E0 ldi R25,0
00DC 90930100 sts _OSTaskStkSize+1,R25
00E0 80930000 sts _OSTaskStkSize,R24
00E4 .dbline 152
00E4 ; OSTaskHardStkSize = OS_TASK_2_HARD_STK_SIZE; /* Setup the default hardware stack size */
00E4 80E2 ldi R24,32
00E6 90930100 sts _OSTaskHardStkSize+1,R25
00EA 80930000 sts _OSTaskHardStkSize,R24
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -