?? os_cpu_c.lst
字號:
##############################################################################
# #
# IAR AT90S C-Compiler V1.41C/386 #
# #
# Compile time = 13/Aug/2000 20:31:02 #
# Target option = Max 64 KB data + 128 KB code #
# Memory model = small #
# Source file = os_cpu_c.c #
# List file = ..\lst\os_cpu_c.lst #
# Object file = ..\obj\os_cpu_c.r90 #
# Command line = -r -ms -v3 -K -e -y -z9 -q -o ..\obj\os_cpu_c.r90 #
# -l ..\lst\os_cpu_c os_cpu_c.c #
# #
# Copyright 1998 IAR Systems. All rights reserved. #
##############################################################################
\ NAME os_cpu_c(19)
\ RSEG CODE(0)
\ PUBLIC OSTaskCreateHook
\ PUBLIC OSTaskDelHook
\ PUBLIC OSTaskStatHook
\ PUBLIC OSTaskStkInit
\ PUBLIC OSTaskSwHook
\ PUBLIC OSTimeTickHook
\ EXTERN ?CL3S_1_40_L08
\ RSEG CODE
\ OSTaskStkInit:
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 *
6 * ATmega103 Specific code
7 *
8 * File : OS_CPU_C.C
9 * By : Ole Saether
10 *
11 * $Revision: 2 $
12 *
13 *
14 * $History: OS_CPU_C.C $
15 *
16 * ***************** Version 2 *****************
17 * User: Ole Date: 8/13/00 Time: 18:14
18 * Updated in $/UCOS-II/AT-M103
19 * Changed return type and type of parameter "ptos" of "OSTaskStkInit"
20 * from "void *" to "OS_STK *". Added OS_TASK_DEF_STK_SIZE for stacksize.
21 *
22 * ***************** Version 1 *****************
23 * User: Ole Date: 8/12/00 Time: 17:39
24 * Created in $/UCOS-II/AT-M103
25 * File copied from AVR port version 1.0 to the version control system.
26 *
27 *********************************************************************************************************
28 */
29
30 #define OS_CPU_GLOBALS
31 #include "includes.h"
32
33 /*
34 **********************************************************************************************************
35 * INITIALIZE A TASK'S STACK
36 *
37 * Description: This function is called by either OSTaskCreate() or OSTaskCreateExt() to initialize the
38 * stack frame of the task being created. This function is highly processor specific.
39 *
40 * Arguments : task is a pointer to the task code
41 *
42 * pdata is a pointer to a user supplied data area that will be passed to the task
43 * when the task first executes.
44 *
45 * ptos is a pointer to the top of stack. It is assumed that 'ptos' points to the
46 * highest valid address on the stack.
47 *
48 * opt specifies options that can be used to alter the behavior of OSTaskStkInit().
49 * (see uCOS_II.H for OS_TASK_OPT_???).
50 *
51 * Returns : Always returns the location of the new top-of-stack' once the processor registers have
52 * been placed on the stack in the proper order.
53 *
54 * Note(s) : Interrupts are enabled when your task starts executing. You can change this by setting the
55 * SREG to 0x00 instead. In this case, interrupts would be disabled upon task startup. The
56 * application code would be responsible for enabling interrupts at the beginning of the task
57 * code. You will need to modify OSTaskIdle() and OSTaskStat() so that they enable
58 * interrupts. Failure to do this will make your system crash!
59 *
60 * The AVR return stack is placed 64 bytes above the start of the (512 byte) stack. This
61 * provides 32 levels of function call nesting which should be more than enough for most
62 * applications (see the "read.me" file for more info).
63 *
64 **********************************************************************************************************
65 */
66
67 OS_STK *OSTaskStkInit (void (*task)(void *pd), void *pdata, OS_STK *ptos, INT16U opt)
68 {
\ 00000000 2E00 MOV R0,R16
\ 00000002 2E11 MOV R1,R17
\ 00000004 8108 LDD R16,Y+0
\ 00000006 8119 LDD R17,Y+1
\ 00000008 812A LDD R18,Y+2
\ 0000000A 813B LDD R19,Y+3
69 INT8U *stk;
70 INT8U *stks; /* Temp. variable used for setting up AVR hardware stack */
71 INT16U tmp;
72
73
74 opt = opt; /* 'opt' is not used, prevent warning */
75 stk = (INT8U *)ptos;
\ 0000000C 2F60 MOV R22,R16
\ 0000000E 2F71 MOV R23,R17
76 stks = (INT8U *)(ptos)-(OS_TASK_DEF_STK_SIZE-64); /* AVR return stack ("hardware stack") */
\ 00000010 5C00 SUBI R16,LOW(192)
\ 00000012 4011 SBCI R17,LOW(1)
77 tmp = (INT16U)task;
78 *stks-- = (INT8U)tmp; /* Put task start address on top of hardware stack */
\ 00000014 2FE0 MOV R30,R16
\ 00000016 2FF1 MOV R31,R17
\ 00000018 5001 SUBI R16,LOW(1)
\ 0000001A 4010 SBCI R17,LOW(0)
\ 0000001C 8200 ST Z,R0
79 *stks-- = (INT8U)(tmp >> 8);
\ 0000001E 2FE0 MOV R30,R16
\ 00000020 2FF1 MOV R31,R17
\ 00000022 5001 SUBI R16,LOW(1)
\ 00000024 4010 SBCI R17,LOW(0)
\ 00000026 8210 ST Z,R1
80
81 *stk-- = (INT8U)0x00; /* R0 = 0x00 */
\ 00000028 2400 CLR R0
\ 0000002A D029 RCALL ?0020
82 *stk-- = (INT8U)0x00; /* R1 = 0x00 */
\ 0000002C D029 RCALL ?0021
83 *stk-- = (INT8U)0x00; /* R2 = 0x00 */
\ 0000002E D028 RCALL ?0021
84 *stk-- = (INT8U)0x00; /* R3 = 0x00 */
\ 00000030 D027 RCALL ?0021
85 *stk-- = (INT8U)0x00; /* R4 = 0x00 */
\ 00000032 D026 RCALL ?0021
86 *stk-- = (INT8U)0x00; /* R5 = 0x00 */
\ 00000034 D025 RCALL ?0021
87 *stk-- = (INT8U)0x00; /* R6 = 0x00 */
\ 00000036 D024 RCALL ?0021
88 *stk-- = (INT8U)0x00; /* R7 = 0x00 */
\ 00000038 D023 RCALL ?0021
89 *stk-- = (INT8U)0x00; /* R8 = 0x00 */
\ 0000003A D022 RCALL ?0021
90 *stk-- = (INT8U)0x00; /* R9 = 0x00 */
\ 0000003C D021 RCALL ?0021
91 *stk-- = (INT8U)0x00; /* R10 = 0x00 */
\ 0000003E D020 RCALL ?0021
92 *stk-- = (INT8U)0x00; /* R11 = 0x00 */
\ 00000040 D01F RCALL ?0021
93 *stk-- = (INT8U)0x00; /* R12 = 0x00 */
\ 00000042 D01E RCALL ?0021
94 *stk-- = (INT8U)0x00; /* R13 = 0x00 */
\ 00000044 D01D RCALL ?0021
95 *stk-- = (INT8U)0x00; /* R14 = 0x00 */
\ 00000046 D01C RCALL ?0021
96 *stk-- = (INT8U)0x00; /* R15 = 0x00 */
\ 00000048 D01B RCALL ?0021
97 tmp = (INT16U)pdata;
98 *stk-- = (INT8U)tmp; /* Simulate call to function with argument */
99 *stk-- = (INT8U)(tmp >> 8);
\ 0000004A D01C RCALL ?0022
\ 0000004C 8350 ST Z,R21
100 *stk-- = (INT8U)0x00; /* R18 = 0x00 */
\ 0000004E D017 RCALL ?0020
101 *stk-- = (INT8U)0x00; /* R19 = 0x00 */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -