📄 impulse.lst
字号:
C:\TIC2XX\C2000\CGTOOLS\BIN\DSPA.EXE -q -v2xx -gs impulse.asm -o ..\obj\impulse.obj -l ..\temp\impulse.lst
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00 Tue May 6 12:41:21 2003
Copyright (c) 1987-1999 Texas Instruments Incorporated
impulse.asm PAGE 1
1 ;=====================================================================================
2 ; File name: IMPULSE.ASM
3 ;
4 ; Originator: Digital Control Systems Group
5 ; Texas Instruments
6 ;
7 ; Description:
8 ; This file contains source for periodic impulse function routine.
9 ;=====================================================================================
10 ; History:
11 ;-------------------------------------------------------------------------------------
12 ; 9-15-2000 Release Rev 1.0
13 ;================================================================================
14 ; Applicability: F240,F241,C242,F243,F24xx. (Peripheral Independant).
15 ;
16 ;
17 ;================================================================================
18 ; Routine Name : Impulse Generator. Routine Type: C Callable
19 ;
20 ; Description : This module implements a periodic impulse function.
21 ;
22 ; C prototype : void impulse_calc(IMPULSE *p);
23 ;================================================================================
24 ; History Created July 25, 2000.
25 ;
26 ; Definition of IMPULSE:
27 ;
28 ; typedef struct IMPULSE {
29 ; int period;
30 ; int out;
31 ; int skpcnt;
32 ; (int (*) (int))impulse_calc
33 ;================================================================================
34
35 0001 ON .set 1
36 0000 OFF .set 0
37 ;--------------------------------------------------------------------------------
38 0001 RETURN_ADDRESS_SAVE .set ON ; If this function calls no other functions
39 ; set RETURN_ADDRESS_SAVE to OFF for
40 ; optimization
41 ;--------------------------------------------------------------------------------
42 7fff MAX_PERIOD .set 07fffh
43 0000 CLEAR .set 0000h
44 ;--------------------------------------------------------------------------------
45 .def _impulse_calc
46 ;================================================================================
47
48 0000 _impulse_calc:
49
50 0001 __IMPULSE_framesize .set 0001h
51 ;--------------------------------------------------------------------------------
52 .if (RETURN_ADDRESS_SAVE = ON)
53 ; AR1 is stack pointer (SP)
54 ; AR0 is frame pointer (FP)
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00 Tue May 6 12:41:21 2003
Copyright (c) 1987-1999 Texas Instruments Incorporated
impulse.asm PAGE 2
55
56 0000 8aa0 POPD *+ ; Save the return address from hardware
57 ; stack onto the software stack
58
59 .endif
60 ;--------------------------------------------------------------------------------
61 0001 80a0 SAR AR0,*+ ; push AR0 (FP). ARP = AR1
62 0002 8180 SAR AR1,* ; *SP = SP. ARP = AR1
63 0003 b001 LAR AR0,#__IMPULSE_framesize
64 ; FP = size of frame. ARP = AR1
65
66 0004 00ea LAR AR0,*0+,AR2 ; Allocate frame. AR0 = *AR1
67 ; AR1 = AR1 + AR0. ARP = AR2
68
69
70 ;================================================================================
71
72 .if (RETURN_ADDRESS_SAVE = ON)
73 0005 bf0a LAR AR2,#-3
0006 fffd
74 .endif
75
76 .if (RETURN_ADDRESS_SAVE = OFF)
77 LAR AR2,#-2
78 .endif
79
80 ;--------------------------------------------------------------------------------
81 0007 8be0 MAR *0+ ; AR2 -> passed parameter
82 ; (i.e. pointer to the structure).
83 ; ARP = AR2. AR2 = AR2 + AR0
84 ;--------------------------------------------------------------------------------
85 0008 0380 LAR AR3,* ; AR3 points to the first structure member
86 ; (i.e. AR3->Period)
87 ; ARP = AR2.
88 ;--------------------------------------------------------------------------------
89 0009 0480 LAR AR4,* ; AR4 points to the first structure member
90 ; (i.e. AR4->Period).
91 ; ARP = AR2. AR3-> Period
92 ;--------------------------------------------------------------------------------
93 000a 058c LAR AR5,*,AR4
94 ; AR5 points to the first structure member
95 ; (i.e. AR5->Period). ARP =AR4.
96 ; AR4->Period. AR3-> Period
97 ;--------------------------------------------------------------------------------
98 000b 8ba0 MAR *+ ; AR4->Out. ARP = AR4. AR5-> Period.
99 ; AR3-> Period
100 ;--------------------------------------------------------------------------------
101 000c ae8d SPLK #CLEAR, *, AR5
000d 0000
102 ; Always clear Impulse Output on entry.
103 ; ARP = AR5. AR5-> Period. AR4-> Out.
104 ; AR3-> Period.
105 ;--------------------------------------------------------------------------------
106 000e 7802 ADRK #2 ; ARP = AR5. AR3-> Period .
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00 Tue May 6 12:41:21 2003
Copyright (c) 1987-1999 Texas Instruments Incorporated
impulse.asm PAGE 3
107 ; AR4-> Out . AR5-> skpcnt
108 ;--------------------------------------------------------------------------------
109 000f 1080 LACC * ; Load accumulator with skpcnt
110 ; ARP = AR5. AR5-> skpcnt. AR3-> Period.
111 ; AR4-> Out.
112 ;--------------------------------------------------------------------------------
113 0010 b801 ADD #1 ; Increment the Accumulator contents by 1
114 ; ARP = AR5. AR5-> skpcnt. AR3-> Period.
115 ; AR4-> Out.
116 ;--------------------------------------------------------------------------------
117 0011 908b SACL *, AR3 ; Increment skpcnt and store
118 ; ARP = AR3. AR3-> period. AR4->Out.
119 ; AR5-> skpcnt.
120 ;--------------------------------------------------------------------------------
121 0012 308c SUB *, AR4 ; Accumulator = skpcnt - period.
122 ; ARP = AR4. AR3-> Period. AR4-> Out.
123 ; AR5-> skpcnt.
124 ;--------------------------------------------------------------------------------
125 0013 e344 BCND __impulse_calc_exit, LT
0014 0019'
126 ; If (skpcnt < period) then
127 ; goto __Impulse_exit
128 ; i.e. Skip setting impulse High
129 ; ARP = AR4. AR3-> Period. AR4-> Out.
130 ; AR5-> skpcnt.
131 ;--------------------------------------------------------------------------------
132 0015 ae8d SPLK #MAX_PERIOD, *, AR5
0016 7fff
133 ; Out = 7fffh. ARP = AR5. AR5-> skpcnt
134 ; AR4-> Out. AR3-> Period.
135 ;--------------------------------------------------------------------------------
136 0017 ae80 SPLK #CLEAR, *
0018 0000
137 ; Reset skip counter.
138 ; ARP = AR5. AR5-> skpcnt
139 ; AR4-> Out. AR3-> Period.
140 ;================================================================================
141 ; Retrieve FP and SP of parent function
142 0019 __impulse_calc_exit:
143 0019 8b89 MAR * , AR1 ; set ARP = SP before you exit.
144 001a 7c02 SBRK #(__IMPULSE_framesize+1)
145 ; Deallocate frame, point to saved FP
146
147 .if (RETURN_ADDRESS_SAVE = ON)
148 001b 0090 LAR AR0, *- ; Restore frame pointer
149 001c 7680 PSHD * ; Push return address on Hardware stack
150 .endif
151
152 .if (RETURN_ADDRESS_SAVE = OFF)
153 LAR AR0, * ; Restore frame pointer
154 .endif
155
156 001d ef00 RET ; Return to the Parent Function
157
TMS320C1x/C2x/C2xx/C5x COFF Assembler Version 7.00 Tue May 6 12:41:21 2003
Copyright (c) 1987-1999 Texas Instruments Incorporated
impulse.asm PAGE 4
158 .end
No Errors, No Warnings
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -