📄 os_cpu_a.lst
字号:
Freescale HC12-Assembler
(c) Copyright Freescale 1987-2005
Abs. Rel. Loc Obj. code Source line
---- ---- ------ --------- -----------
1 1 ;********************************************************************************************************
2 2 ; uC/OS-II
3 3 ; The Real-Time Kernel
4 4 ;
5 5 ; (c) Copyright 1998, Jean J. Labrosse, Plantation, FL
6 6 ; All Rights Reserved
7 7 ;
8 8 ;
9 9 ; M68HC912DG128A Specific code
10 10 ; (MetroWerks C/C++ V4.1)
11 11 ;
12 12 ; File : OS_CPU_A.S
13 13 ; By : Jean J. Labrosse
14 14 ; Port Version : V1.01
15 15 ; Ported to MC68HC912DG128A : Robert F. Heslar
16 16 ;********************************************************************************************************
17 17
18 18 ;********************************************************************************************************
19 19 ; CONFIGURATION CONSTANTS
20 20 ;********************************************************************************************************
21 21
22 22 0000 0007 OS_TICK_OC: equ 7 ; We will use Output Compare #7 to generate tick interrupts
23 23 0000 1388 OS_TICK_OC_CNTS: equ 5000 ; 100 Hz tick rate (assumes Free Running Timer runs at 500 KHz)
24 24 ; OS_TICK_OC_CNTS = CPU_FRT_FREQ / OS_TICKS_PER_SEC
25 25
26 26 ;********************************************************************************************************
27 27 ; I/O PORT ADDRESSES
28 28 ;********************************************************************************************************
29 29
30 30 0000 008E TFLG1: equ $008E ; I/O port addresses. Assumes all 68HC12 I/Os start at 0x0000
31 31 0000 0090 TC0: equ $0090
32 32 0000 0092 TC1: equ $0092
33 33 0000 0094 TC2: equ $0094
34 34 0000 0096 TC3: equ $0096
35 35 0000 0098 TC4: equ $0098
36 36 0000 009A TC5: equ $009A
37 37 0000 009C TC6: equ $009C
38 38 0000 009E TC7: equ $009E
39 39
40 40 ;********************************************************************************************************
41 41 ; PUBLIC DECLARATIONS
42 42 ;********************************************************************************************************
43 43 xdef OSStartHighRdy
44 44 xdef OSCtxSw
45 45 xdef OSIntCtxSw
46 46 xdef OSTickISR
47 47 xdef _Null
48 48 ;********************************************************************************************************
49 49 ; EXTERNAL DECLARATIONS
50 50 ;********************************************************************************************************
51 51
52 52 xref OSIntExit
53 53 xref OSIntNesting
54 54 xref OSPrioCur
55 55 xref OSPrioHighRdy
56 56 xref OSRunning
57 57 xref OSTaskSwHook
58 58 xref OSTCBCur
59 59 xref OSTCBHighRdy
60 60 xref OSTimeTick
61 61
62 62 ;********************************************************************************************************
63 63 ; START HIGHEST PRIORITY TASK READY-TO-RUN
64 64 ;
Freescale HC12-Assembler
(c) Copyright Freescale 1987-2005
Abs. Rel. Loc Obj. code Source line
---- ---- ------ --------- -----------
65 65 ; Description : This function is called by OSStart() to start the highest priority task that was created
66 66 ; by your application before calling OSStart().
67 67 ;
68 68 ; Arguments : none
69 69 ;
70 70 ; Note(s) : 1) The stack frame is assumed to look as follows:
71 71 ;
72 72 ; OSTCBHighRdy->OSTCBStkPtr + 0 --> CCR
73 73 ; + 1 B
74 74 ; + 2 A
75 75 ; + 3 X (H)
76 76 ; + 4 X (L)
77 77 ; + 5 Y (H)
78 78 ; + 6 Y (L)
79 79 ; + 7 PC(H)
80 80 ; + 8 PC(L)
81 81 ;
82 82 ; 2) OSStartHighRdy() MUST:
83 83 ; a) Call OSTaskSwHook() then,
84 84 ; b) Set OSRunning to TRUE,
85 85 ; c) Switch to the highest priority task.
86 86 ;********************************************************************************************************
87 87
88 88 OSStartHighRdy:
89 89 000000 16xx xx jsr OSTaskSwHook ; 4~, Invoke user defined context switch hook
90 90 000003 72xx xx inc OSRunning ; 4~, Indicate that we are multitasking
91 91
92 92 000006 FExx xx ldx OSTCBHighRdy ; 3~, Point to TCB of highest priority task ready to run
93 93 000009 EF00 lds 0,x ; 3~, Load SP into 68HC12
94 94
95 95 00000B 0B rti ; 8~, Run task
96 96
97 97 ;********************************************************************************************************
98 98 ; TASK LEVEL CONTEXT SWITCH
99 99 ;
100 100 ; Description : This function is called when a task makes a higher priority task ready-to-run.
101 101 ;
102 102 ; Arguments : none
103 103 ;
104 104 ; Note(s) : 1) Upon entry,
105 105 ; OSTCBCur points to the OS_TCB of the task to suspend
106 106 ; OSTCBHighRdy points to the OS_TCB of the task to resume
107 107 ;
108 108 ; 2) The stack frame of the task to suspend looks as follows:
109 109 ;
110 110 ; SP + 0 --> CCR
111 111 ; + 1 B
112 112 ; + 2 A
113 113 ; + 3 X (H)
114 114 ; + 4 X (L)
115 115 ; + 5 Y (H)
116 116 ; + 6 Y (L)
117 117 ; + 7 PC(H)
118 118 ; + 8 PC(L)
119 119 ;
120 120 ; 3) The stack frame of the task to resume looks as follows:
121 121 ;
122 122 ; OSTCBHighRdy->OSTCBStkPtr + 0 --> CCR
123 123 ; + 1 B
124 124 ; + 2 A
125 125 ; + 3 X (H)
126 126 ; + 4 X (L)
127 127 ; + 5 Y (H)
128 128 ; + 6 Y (L)
Freescale HC12-Assembler
(c) Copyright Freescale 1987-2005
Abs. Rel. Loc Obj. code Source line
---- ---- ------ --------- -----------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -