📄 dps2spc3.lst
字号:
C51 COMPILER V7.50 DPS2SPC3 10/24/2007 09:35:19 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE DPS2SPC3
OBJECT MODULE PLACED IN DPS2SPC3.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE DPS2SPC3.C LARGE OPTIMIZE(SIZE) BROWSE DEBUG OBJECTEXTEND
line level source
1 /*
2 +------------------------------------------------------------------------+
3 | Project: D P S 2 w i t h S P C 3 |
4 | |
5 | File: DPS2SPC3.C |
6 | Date: 27-Sep-2007 |
7 | Version: V 1.17 |
8 | Initial Editor: Thomas Lang Final Editor: Wujiang Zhang |
9 +------------------------------------------------------------------------+
10 | Description: |
11 | This File contains the functions for DPS2 with SPC3. |
12 | |
13 | |
14 +------------------------------------------------------------------------+
15 | following environments are supported |
16 | Processor: SAB C165 |
17 | Compiler: BSO Tasking 80166 C Cross-Compiler, V 4.0 |
18 | Processor: Atmel At89c52 |
19 | Compiler: Keil uVision2 |
20 +------------------------------------------------------------------------+
21 | Copyright (C) Rich ltd., 2007 |
22 | All Rights reserved |
23 +------------------------------------------------------------------------+
24 | History: |
25 | V1.0,LT, first official version |
26 | V1.1,LT, error in calculation of the FDL-SAP-List-Pointer fixed |
27 | (dps2_buf_len was not divided by) |
28 | V1.3,MM,12-Feb-1997, I/O-len calculation corrected |
29 | V1.3,MM,24-Mar-1997, translation |
30 | V1.7,All have been OK and passed the test referable |
31 +------------------------------------------------------------------------+
32 | Technical support: Raga Techniques Development Dept. |
33 | |
34 | ZhangWujiang |
35 | Tel.: 13057811223 |
36 | eMailx: zwujiang_2008@163.com |
37 | |
38 +------------------------------------------------------------------------+
39 */
40
41 /*~
42 includes and declarations
43 ~*/
44 /* formal declaratios for spc3dps2.h */
45 #define SPC3_DPS2 1
46 #define SPC3_INTEL_MODE 1
47 #define SPC3_DATA_XDATA
48 #define SPC3_FAR
49
50 #include "spc3dps2.h"
51
52 /*~
53 literals and macros
54 ~*/
55 /*
C51 COMPILER V7.50 DPS2SPC3 10/24/2007 09:35:19 PAGE 2
56 +------------------------------------------------------------------------+
57 | L i t e r a l s |
58 +------------------------------------------------------------------------+
59 */
60 /*-- cout of buffers assigned to AUX-buffer --*/
61 #define ASS_AUX_BUF 3
62 /*-- masks for config-data --*/
63 #define DPS_CFG_IS_BYTE_FORMAT (UBYTE)0x30
64 #define DPS_CFG_BF_LENGTH (UBYTE)0x0f
65 #define DPS_CFG_LENGTH_IS_WORD_FORMAT (UBYTE)0x40
66 #define DPS_CFG_BF_INP_EXIST (UBYTE)0x10
67 #define DPS_CFG_BF_OUTP_EXIST (UBYTE)0x20
68 #define DPS_CFG_SF_OUTP_EXIST (UBYTE)0x80
69 #define DPS_CFG_SF_INP_EXIST (UBYTE)0x40
70 #define DPS_CFG_SF_LENGTH (UBYTE)0x3f
71
72 /*
73 +------------------------------------------------------------------------+
74 | M a c r o s |
75 +------------------------------------------------------------------------+
76 */
77 /*-- startaddress of user-area in the SPC3 in SPC3-format --*/
78 #define SPC3_BUF_START ((UBYTE)(((UWORD)(dps2_base_ptr -\
79 (UBYTE SPC3_PTR_ATTR*)&spc3)) >> 3))
80
81 /*~
82 Variables
83 ~*/
84 /*
85 +------------------------------------------------------------------------+
86 | g l o b a l V a r i a b l e s |
87 +------------------------------------------------------------------------+
88 */
89 #ifdef _C166
#pragma global
#endif
92
93 UBYTE _dps2_x; /* dummy-byte */
94
95 #ifdef _C166
#pragma public
#endif
98
99 /*
100 +------------------------------------------------------------------------+
101 | "M o d u l" - g l o b a l V a r i a b l e s |
102 +------------------------------------------------------------------------+
103 */
104 static DPS2_BUFINIT dps2_binit; /* storeage for initialization data */
105 static WORD dps2_buf_len = 0; /* used bufferspace */
106 static UBYTE SPC3_PTR_ATTR *dps2_base_ptr =\
107 (UBYTE SPC3_PTR_ATTR*)0; /* buffer base address */
108 static DPS2_IO_DATA_LEN io_data_len; /* Struct. f. IO-lens */
109
110 /*
111 +------------------------------------------------------------------------+
112 | e x t e r n a l D e c l a r a t i o n s |
113 +------------------------------------------------------------------------+
114 */
115 #ifndef _IM182
116 extern SPC3 SPC3_PTR_ATTR spc3;
117 #endif
C51 COMPILER V7.50 DPS2SPC3 10/24/2007 09:35:19 PAGE 3
118
119 /*~
120 assign_aux_buf()
121 ~*/
122 /*
123 +------------------------------------------------------------------------+
124 | Function: a s s i g n _ a u x _ b u f ( ) |
125 +------------------------------------------------------------------------+
126 | Description: |
127 | Based on a list of bufferlens the best len of the aux-buffers is |
128 | calculated. The list's lens will be adjusted, the assignment-list |
129 | will be calculated. |
130 +------------------------------------------------------------------------+
131 | Parameters: |
132 | -lens: Pointer to a list of buffer-lens |
133 | The calculated lens are inserted in this list. |
134 | -count: length of list (2 to ASS_AUX_BUF) |
135 | -assign: pointer to an assignment-byte |
136 | For each len there is a corresponding bit for the |
137 | assignment to AUX-buffer 1 or 2. 0 means AUX-buffer 1, |
138 | 1 means AUX-Buffer 2. Bit 0 ist for the first, Bit 7 |
139 | for the 8th length. |
140 | -aux_len: pointer to a 2-byte-array for AUX-buffer-lens |
141 | The calculated lens of AUX-buffer 1 and 2 are stored here. |
142 | |
143 | Returnvalue: UWORD: total amount of used bytes (0 = error) |
144 +------------------------------------------------------------------------+
145 */
146
147 UWORD assign_aux_buf(UBYTE SPC3_DATA_ATTR *lens, UBYTE count, UBYTE \
148 SPC3_DATA_ATTR *assign, WORD SPC3_DATA_ATTR *aux_len)
149 {
150 1 UBYTE pos[ASS_AUX_BUF]; /* storage for former position of lens */
151 1 UBYTE lensx[ASS_AUX_BUF]; /* working-array for calculated lens */
152 1 UBYTE step; /* counter for done step */
153 1 UBYTE lx; /* temp-var for lenarray-sorting */
154 1 UBYTE px; /* temp-var dor position-sorting */
155 1 UWORD min_len = 0xffff; /* calculated min-len */
156 1 UBYTE min_step = 0; /* step at reached min-len */
157 1 BYTE i,j;
158 1
159 1 if((count < 2) || (count > ASS_AUX_BUF))
160 1 {
161 2 return 0;
162 2 }
163 1 /* init position-array */
164 1 for(i = 0; i < count; i++)
165 1 {
166 2 pos[i] = i;
167 2 }
168 1 /* init working-array */
169 1 for(i = 0; i < count; i++)
170 1 {
171 2 lensx[i] = lens[i];
172 2 }
173 1 /* round up lens to SPC3-lens (8-byte-granularity) */
174 1 for(i = 0; i < count; i++)
175 1 {
176 2 lensx[i] = (lensx[i] + 7) & 0xf8;
177 2 }
178 1 /* sorting of lens: gratest len to index 0 */
179 1 for(i = 0; i < count-1; i++)
C51 COMPILER V7.50 DPS2SPC3 10/24/2007 09:35:19 PAGE 4
180 1 {
181 2 for(j = i+1; j < count; j++)
182 2 {
183 3 if(lensx[i] < lensx[j])
184 3 {
185 4 /* greater len found */
186 4 lx = lensx[i]; /* xchg lens */
187 4 lensx[i] = lensx[j];
188 4 lensx[j] = lx;
189 4 px = pos[i]; /* xchg position */
190 4 pos[i] = pos[j];
191 4 pos[j] = px;
192 4 }
193 3 }
194 2 }
195 1 /* remove NULL-lens of list */
196 1 for(i = count-1; i >= 0; i--)
197 1 {
198 2 if(lensx[i] == 0)
199 2 {
200 3 count--;
201 3 }
202 2 }
203 1 if(count == 0)
204 1 {
205 2 min_len = 0; /* error: no lens specified */
206 2 }
207 1 /* stepwise assignment to the AUX-buffers */
208 1 for(step = 0; step < count; step++)
209 1 {
210 2 /* determine total len for AUX-buffer 1 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -