FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/L1/tpudrv/tpudrv61.h @ 576:660e83f13cab
gsm-fw/L1/tpudrv: tpudrv.c and tpudrv61.[ch] imported from LoCosto source
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Mon, 11 Aug 2014 04:45:42 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
575:1d7a12925b8e | 576:660e83f13cab |
---|---|
1 /****************** Revision Controle System Header *********************** | |
2 * GSM Layer 1 software | |
3 * Copyright (c) Texas Instruments 1998 | |
4 * | |
5 * Filename tpudrv61.h | |
6 * Version 1.0 | |
7 * Date June 1st, 2005 | |
8 * | |
9 ****************** Revision Controle System Header ***********************/ | |
10 //FLEXIBLE ADC... | |
11 #undef VARIABLE_ADC_ON_TX | |
12 //VARIABLE_ADC_ON_TX- represents the number of symbols before TRF_T11 (the time where the PA is disabled) | |
13 //the ADC conversion should be performed. VARIABLE_ADC_ON_TX- has a valid range from 14 to 155 symbols. | |
14 //Hence, to use the fix, VARIABLE_ADC_ON_TX- must be defined to a value between 14 and 155, compile time. | |
15 //This will cause the ADC conversion offset (TRF_T9) to be calculated by the following equation: | |
16 //TRF_T9 = TRF_T11-VARIABLE_ADC_ON_TX*4 | |
17 //The customer is expected to use a value of 76. If this compile flag is not set, the ADC conversion offset (TRF_T9) | |
18 // is set to a default value of 14 symbols before TXEN is disabled (i.e. the default timing is 40 qbit before the | |
19 // TX down time anchor and 20 qb before the last tail bit). | |
20 #define VARIABLE_ADC_ON_TX 76 | |
21 | |
22 #if(L1_RF_KBD_FIX == 1) | |
23 // Keyboard disable config: | |
24 #define L1_KBD_DIS_RX_NB 1 | |
25 #define L1_KBD_DIS_RX_SB 1 | |
26 #define L1_KBD_DIS_RX_FB 1 | |
27 #define L1_KBD_DIS_RX_FB26 1 | |
28 #define L1_KBD_DIS_RX_MS 1 | |
29 #define L1_KBD_DIS_TX_NB 1 | |
30 #define L1_KBD_DIS_TX_RA 1 | |
31 | |
32 #define KBD_DISABLED 1 | |
33 | |
34 #endif/*(L1_RF_KBD_FIX == 1)*/ | |
35 | |
36 //Fixed declaration of script numbers | |
37 #define DRP_REG_ON (0x0000) | |
38 #define DRP_TX_ON (0x0001) | |
39 #define DRP_RX_ON (0x0002) | |
40 #define DRP_TEMP_CONV (0x0003) | |
41 #define DRP_ROC (0x0004) | |
42 #define DRP_REG_OFF (0x0007) | |
43 #define DRP_AFC (0x000D) | |
44 #define DRP_IDLE (0x000F) | |
45 | |
46 #define SCRIPT_EN (0x3080) | |
47 | |
48 #define START_SCRIPT(script_nb) (SCRIPT_EN | script_nb) | |
49 | |
50 // IF settings | |
51 #define IF_100KHZ_DRP 0 | |
52 #define IF_120KHZ_DRP 1 | |
53 | |
54 // Gain Compensation Enable/Disable | |
55 #define GAIN_COMP_DISABLE (0x0) //Default | |
56 #define GAIN_COMP_ENABLE (0x1) | |
57 | |
58 // AFE Gains Definition | |
59 #define AFE_LOW_GAIN (0x0) // 11 dB | |
60 #define AFE_HIGH_GAIN (0x1) // 38 dB | |
61 | |
62 // ABE Gains Definition | |
63 #define ABE_0_DB (0x0) | |
64 #define ABE_2_DB (0x1) | |
65 #define ABE_5_DB (0x2) | |
66 #define ABE_8_DB (0x3) | |
67 #define ABE_11_DB (0x4) | |
68 #define ABE_14_DB (0x5) | |
69 #define ABE_17_DB (0x6) | |
70 #define ABE_20_DB (0x7) | |
71 #define ABE_23_DB (0x8) | |
72 | |
73 // Switched Cap Filter Corner Freq Defition | |
74 #define SCF_270KHZ 0 | |
75 #define SCF_400KHZ 1 | |
76 | |
77 // Retiming definition | |
78 #define RETIM_DISABLE (0x0000) | |
79 #define RETIM_TX_ONLY (0x0001) | |
80 #define RETIM_RX_ONLY (0x0002) | |
81 #define RETIM_FULL (0x0003) | |
82 | |
83 // IF settings for DSP | |
84 #define IF_100KHZ_DSP 2 | |
85 #define IF_120KHZ_DSP 1 | |
86 | |
87 // DCO algo settings | |
88 #define DCO_IF_100KHZ 1 | |
89 #define DCO_IF_0KHZ 2 | |
90 #define DCO_IF_0KHZ_100KHZ 3 | |
91 #define DCO_NONE 0 | |
92 | |
93 | |
94 //--- Configuration values | |
95 //- Select the RF PG (x10), i.e. 10 for 1.0, 11 for 1.1 or 20 for 2.0 | |
96 // This is also used in l1_rf14h to select the SWAP_IQ | |
97 | |
98 | |
99 //- Bit definitions for TST register programings, etc | |
100 #define BIT_0 0x000001 | |
101 #define BIT_1 0x000002 | |
102 #define BIT_2 0x000004 | |
103 #define BIT_3 0x000008 | |
104 #define BIT_4 0x000010 | |
105 #define BIT_5 0x000020 | |
106 #define BIT_6 0x000040 | |
107 #define BIT_7 0x000080 | |
108 #define BIT_8 0x000100 | |
109 #define BIT_9 0x000200 | |
110 #define BIT_10 0x000400 | |
111 #define BIT_11 0x000800 | |
112 #define BIT_12 0x001000 | |
113 #define BIT_13 0x002000 | |
114 #define BIT_14 0x004000 | |
115 #define BIT_15 0x008000 | |
116 #define BIT_16 0x010000 | |
117 #define BIT_17 0x020000 | |
118 #define BIT_18 0x040000 | |
119 #define BIT_19 0x080000 | |
120 #define BIT_20 0x100000 | |
121 #define BIT_21 0x200000 | |
122 #define BIT_22 0x400000 | |
123 #define BIT_23 0x800000 | |
124 | |
125 | |
126 //- Base REGISTER definitions - | |
127 | |
128 //- RF signals connected to TSPACT - | |
129 #define RX_START BIT_0 // RX_START of DRP2 | |
130 #define TX_START BIT_1 // TX_START of DRP2 modulator | |
131 #define START_APC BIT_2 // Start of the APC module | |
132 #define LDO_EN BIT_3 // Activation of the internal LDO inside the APC bloc | |
133 #if(L1_RF_KBD_FIX == 1) | |
134 #define KBD_DIS_TSPACT BIT_4 // Disable keyboard | |
135 #endif | |
136 #define APC_EN BIT_5 // Enable of the APC module | |
137 #define START_ADC BIT_0 // Activation of the Triton ADC | |
138 #define B3 BIT_3 // Control of the RFMD TX module | |
139 #define B1 BIT_5 // Control of the RFMD TX module | |
140 #define TX_EN BIT_6 // Control of the RFMD TX module | |
141 #define B2 BIT_7 // Control of the RFMD TX module | |
142 | |
143 #define TXM_SLEEP (0) // To avoid leakage during Deep-Seep | |
144 | |
145 // DRP write register | |
146 #define OCP_DATA_MSB 0x05 | |
147 #define OCP_DATA_LSB 0x04 | |
148 #define OCP_ADDRESS_MSB 0x0B | |
149 #define OCP_ADDRESS_LSB 0x0A | |
150 #define OCP_ADDRESS_START 0x01 | |
151 | |
152 // TSPACT | |
153 #define REG_SPI_ACT_U 0x07 | |
154 #define REG_SPI_ACT_L 0x06 | |
155 | |
156 // 3-band config | |
157 // RX_UP/DOWN and TX_UP/DOWN | |
158 #define RU_900 ( B1 | B3 ) | |
159 #define RD_900 ( B1 | B3 ) | |
160 #define TU_900 ( TX_EN | B1 | B3 ) | |
161 #define TD_900 ( B1 | B3 ) | |
162 | |
163 #define RU_850 ( B3 ) | |
164 #define RD_850 ( B3 ) | |
165 #define TU_850 ( TX_EN | B3 ) | |
166 #define TD_850 ( B3 ) | |
167 | |
168 #define RU_1800 ( B2 | B3 ) | |
169 #define RD_1800 ( B2 | B3 ) | |
170 #define TU_1800 ( TX_EN | B1 | B2 | B3 ) | |
171 #define TD_1800 ( B2 | B3 ) | |
172 | |
173 | |
174 #define RU_1900 ( B1 | B2 | B3 ) | |
175 #define RD_1900 ( B1 | B2 | B3 ) | |
176 #define TU_1900 ( TX_EN | B1 | B2 | B3 ) | |
177 #define TD_1900 ( B1 | B2 | B3 ) | |
178 | |
179 | |
180 | |
181 | |
182 //--- TIMINGS ---------------------------------------------------------- | |
183 | |
184 /*------------------------------------------*/ | |
185 /* Download delay values */ | |
186 /*------------------------------------------*/ | |
187 // 1 qbit = 12/13 usec (~0.9230769), i.e. 200 usec is ~ 217 qbit (200 * 13 / 12) | |
188 | |
189 #define T TPU_CLOCK_RANGE | |
190 | |
191 | |
192 // - TPU instruction into TSP timings --- | |
193 // 1 tpu instruction = 1 qbit | |
194 #define DLT_1 1 // 1 tpu instruction = 1 qbit | |
195 #define DLT_2 2 // 2 tpu instruction = 2 qbit | |
196 #define DLT_3 3 // 3 tpu instruction = 3 qbit | |
197 #define DLT_4 4 // 4 tpu instruction = 4 qbit | |
198 | |
199 // - TPU command execution + serialization length --- | |
200 #define DLT_4B 5 // 5*move | |
201 | |
202 | |
203 // - INIT (delta or DLT) timings --- | |
204 #define DLT_I1 5 // Time required to set EN high before RF_SER_OFF -> RF_SER_ON | |
205 #define DLT_I2 200 // Regulators turn on time | |
206 #define DLT_I3 5 // Time required to set RF_SER_ON | |
207 #define DLT_I4 110 // Regulator Turn-ON time | |
208 | |
209 | |
210 // - tdt & rdt --- | |
211 // MAX GSM (not GPRS) rdt and tdt values are... | |
212 //#define rdt 380 // MAX GSM rx delta timing | |
213 //#define tdt 400 // MAX GSM tx delta timing | |
214 // but current rdt and tdt values are... | |
215 #define rdt 0 // rx delta timing | |
216 #define tdt 0 // tx delta timing | |
217 | |
218 // - RX timings --- | |
219 // - RX down: | |
220 // Flexible TPU Timings .... | |
221 | |
222 /************************************/ | |
223 /* Timing for TPU prog */ | |
224 /************************************/ | |
225 #if ( L1_TPU_DEV == 0) | |
226 #define APC_RAMP_UP_TIME 20 // maximum time for ramp up | |
227 #define APC_RAMP_DELAY 6 // minimum ramp up delay APCDEL | |
228 #define APC_RAMP_DOWN_TIME 20 // maximum ramp down time | |
229 #endif | |
230 | |
231 | |
232 #if ( L1_TPU_DEV == 1) | |
233 extern WORD16 rf_tx_tpu_timings[]; | |
234 extern WORD16 rf_rx_tpu_timings[]; | |
235 | |
236 //define for TPU Dev Mode via the arrays so that they can be tweaked later for Rx & Tx | |
237 | |
238 | |
239 | |
240 #define TRF_T1 rf_tx_tpu_timings[0] | |
241 #define TRF_T2 rf_tx_tpu_timings[1] | |
242 #define TRF_T3 rf_tx_tpu_timings[2] | |
243 #define TRF_T4 rf_tx_tpu_timings[3] | |
244 #define TRF_T5 rf_tx_tpu_timings[4] | |
245 #define TRF_T6 rf_tx_tpu_timings[5] | |
246 #define TRF_T7 rf_tx_tpu_timings[6] | |
247 #define TRF_T8 rf_tx_tpu_timings[7] | |
248 #define TRF_T9 rf_tx_tpu_timings[8] | |
249 #define TRF_T10 rf_tx_tpu_timings[9] | |
250 #define TRF_T11 rf_tx_tpu_timings[10] | |
251 #define TRF_T12 rf_tx_tpu_timings[11] | |
252 #define TRF_T13 rf_tx_tpu_timings[12] | |
253 #define TRF_T14 rf_tx_tpu_timings[13] | |
254 #define TRF_T15 rf_tx_tpu_timings[14] | |
255 #define TRF_T16 rf_tx_tpu_timings[15] | |
256 #define TRF_T17 rf_tx_tpu_timings[16] | |
257 #define TRF_T18 rf_tx_tpu_timings[17] | |
258 #define TRF_T19 rf_tx_tpu_timings[18] | |
259 #define TRF_T20 rf_tx_tpu_timings[19] | |
260 #define TRF_T21 rf_tx_tpu_timings[20] | |
261 #define TRF_T22 rf_tx_tpu_timings[21] | |
262 #define TRF_T23 rf_tx_tpu_timings[22] | |
263 #define TRF_T24 rf_tx_tpu_timings[23] | |
264 #define TRF_T25 rf_tx_tpu_timings[24] | |
265 #define TRF_T26 rf_tx_tpu_timings[25] | |
266 #define TRF_T27 rf_tx_tpu_timings[26] | |
267 #define TRF_T28 rf_tx_tpu_timings[27] | |
268 #define TRF_T29 rf_tx_tpu_timings[28] | |
269 #define TRF_T30 rf_tx_tpu_timings[29] | |
270 #define TRF_T31 rf_tx_tpu_timings[30] | |
271 #define TRF_T32 rf_tx_tpu_timings[31] | |
272 | |
273 | |
274 #define TRF_R1 rf_rx_tpu_timings[0] | |
275 #define TRF_R2 rf_rx_tpu_timings[1] | |
276 #define TRF_R3 rf_rx_tpu_timings[2] | |
277 #define TRF_R4 rf_rx_tpu_timings[3] | |
278 #define TRF_R5 rf_rx_tpu_timings[4] | |
279 #define TRF_R6 rf_rx_tpu_timings[5] | |
280 #define TRF_R7 rf_rx_tpu_timings[6] | |
281 #define TRF_R8 rf_rx_tpu_timings[7] | |
282 #define TRF_R9 rf_rx_tpu_timings[8] | |
283 #define TRF_R10 rf_rx_tpu_timings[9] | |
284 #define TRF_R11 rf_rx_tpu_timings[10] | |
285 #define TRF_R12 rf_rx_tpu_timings[11] | |
286 #define TRF_R13 rf_rx_tpu_timings[12] | |
287 #define TRF_R14 rf_rx_tpu_timings[13] | |
288 #define TRF_R15 rf_rx_tpu_timings[14] | |
289 #define TRF_R16 rf_rx_tpu_timings[15] | |
290 #define TRF_R17 rf_rx_tpu_timings[16] | |
291 #define TRF_R18 rf_rx_tpu_timings[17] | |
292 #define TRF_R19 rf_rx_tpu_timings[18] | |
293 #define TRF_R20 rf_rx_tpu_timings[19] | |
294 #define TRF_R21 rf_rx_tpu_timings[20] | |
295 #define TRF_R22 rf_rx_tpu_timings[21] | |
296 #define TRF_R23 rf_rx_tpu_timings[22] | |
297 #define TRF_R24 rf_rx_tpu_timings[23] | |
298 #define TRF_R25 rf_rx_tpu_timings[24] | |
299 #define TRF_R26 rf_rx_tpu_timings[25] | |
300 #define TRF_R27 rf_rx_tpu_timings[26] | |
301 #define TRF_R28 rf_rx_tpu_timings[27] | |
302 #define TRF_R29 rf_rx_tpu_timings[28] | |
303 #define TRF_R30 rf_rx_tpu_timings[29] | |
304 #define TRF_R31 rf_rx_tpu_timings[30] | |
305 #define TRF_R32 rf_rx_tpu_timings[31] | |
306 | |
307 //Flexi ABB Delays | |
308 // The existing #defines in the code would have to be removed and the definitions done here. | |
309 | |
310 extern WORD16 rf_flexi_abb_delays[]; | |
311 | |
312 | |
313 | |
314 #ifdef APC_RAMP_UP_TIME | |
315 #undef APC_RAMP_UP_TIME | |
316 #endif | |
317 #define APC_RAMP_UP_TIME rf_flexi_abb_delays[1] //default 32 | |
318 | |
319 | |
320 #ifdef DL_ABB_DELAY | |
321 #undef DL_ABB_DELAY | |
322 #endif | |
323 #define DL_ABB_DELAY (rf_flexi_abb_delays[2]) // ( 32L + 4L) | |
324 | |
325 | |
326 #ifdef UL_ABB_DELAY | |
327 #undef UL_ABB_DELAY | |
328 #endif | |
329 #define UL_ABB_DELAY rf_flexi_abb_delays[3] //12 | |
330 | |
331 #ifdef UL_DELAY_1RF | |
332 #undef UL_DELAY_1RF | |
333 #endif | |
334 #define UL_DELAY_1RF rf_flexi_abb_delays[4] //0 | |
335 | |
336 #ifdef UL_DELAY_2RF | |
337 #undef UL_DELAY_2RF | |
338 #endif | |
339 #define UL_DELAY_2RF rf_flexi_abb_delays[5] //0 | |
340 | |
341 #ifdef APCDEL_DOWN | |
342 #undef APCDEL_DOWN | |
343 #endif | |
344 #define APCDEL_DOWN rf_flexi_abb_delays[6] //3//3 | |
345 | |
346 #ifdef APCDEL_UP | |
347 #undef APCDEL_UP | |
348 #endif | |
349 #define APCDEL_UP rf_flexi_abb_delays[7] //24 | |
350 | |
351 #ifdef GUARD_BITS | |
352 #undef GUARD_BITS | |
353 #endif | |
354 #define GUARD_BITS rf_flexi_abb_delays[8] //7 | |
355 | |
356 #ifdef SETUP_AFC_AND_RF | |
357 #undef SETUP_AFC_AND_RF | |
358 #endif | |
359 #define SETUP_AFC_AND_RF rf_flexi_abb_delays[9] //6 | |
360 | |
361 #ifdef SERV_OFFS_REST_LOAD | |
362 #undef SERV_OFFS_REST_LOAD | |
363 #endif | |
364 #define SERV_OFFS_REST_LOAD rf_flexi_abb_delays[10] // 1L | |
365 | |
366 #ifdef TA_MAX | |
367 #undef TA_MAX | |
368 #endif | |
369 #define TA_MAX rf_flexi_abb_delays[11] // ( 63L * 4L ) | |
370 | |
371 #ifdef PRG_TX | |
372 #undef PRG_TX | |
373 #endif | |
374 #define PRG_TX rf_flexi_abb_delays[12] // (DL_DELAY_RF + UL_DELAY_2RF + (GUARD_BITS*4) + UL_DELAY_1RF + UL_ABB_DELAY) | |
375 | |
376 #ifdef EPSILON_OFFS | |
377 #undef EPSILON_OFFS | |
378 #endif | |
379 #define EPSILON_OFFS rf_flexi_abb_delays[14] // 2L | |
380 | |
381 #ifdef EPSILON_MEAS | |
382 #undef EPSILON_MEAS | |
383 #endif | |
384 #define EPSILON_MEAS rf_flexi_abb_delays[15]//20L | |
385 | |
386 #ifdef EPSILON_SYNC | |
387 #undef EPSILON_SYNC | |
388 #endif | |
389 #define EPSILON_SYNC rf_flexi_abb_delays[16] //10L | |
390 | |
391 #ifdef APC_RAMP_DOWN_TIME | |
392 #undef APC_RAMP_DOWN_TIME | |
393 #endif | |
394 #define APC_RAMP_DOWN_TIME rf_flexi_abb_delays[17] //32 | |
395 | |
396 #ifdef APC_RAMP_DELAY | |
397 #undef APC_RAMP_DELAY | |
398 #endif | |
399 #define APC_RAMP_DELAY rf_flexi_abb_delays[18] //6 | |
400 #endif //L1_TPU_DEV | |
401 // End Flexible TPU Timings, ABB DElays | |
402 | |
403 #if ( L1_TPU_DEV == 0) | |
404 // - RX timings --- | |
405 // - RX down: | |
406 #if (L1_MADC_ON == 1) | |
407 #define TRF_R8 (PROVISION_TIME - 170 - DLT_4B - rdt ) // for doing MADC | |
408 #endif | |
409 // The times below are offsets to when BDLENA goes down | |
410 #define TRF_R7 ( 2 - DLT_4B ) // Power down RF (idle script) | |
411 // TRF_R6 not use, warning timing TRF_R6 > TRF_R7 | |
412 #define TRF_R6 ( -20 - DLT_4B) // Disable RX Start and RF switch | |
413 | |
414 // - RX up: | |
415 // The times below are offsets to when BDLENA goes high | |
416 // Burst data comes here | |
417 #define TRF_R5 (PROVISION_TIME - 19 - DLT_1 ) // Enable RX_START | |
418 #define TRF_R4 (PROVISION_TIME - 39 - DLT_1 - rdt ) // Set RF switch for RX in selected band | |
419 #if(L1_RF_KBD_FIX == 1) | |
420 #define TRF_R3_1 (PROVISION_TIME - 89 - DLT_1 - rdt ) // Disable keyboard | |
421 #endif | |
422 #define TRF_R3 (PROVISION_TIME - 190 - DLT_4B - rdt ) // RX_ON | |
423 #define TRF_R2 (PROVISION_TIME - 197 - DLT_4B - rdt ) // Select the AGC & LNA gains | |
424 #define TRF_R1 (PROVISION_TIME - 203 - DLT_4B - rdt ) // Set RX Synth channel | |
425 | |
426 | |
427 | |
428 // - TX timings --- | |
429 // - TX down: | |
430 // The times below are offsets to when TXSTART goes down | |
431 #define TRF_T13 ( 25 - DLT_1 ) // | |
432 #define TRF_T12 ( 23 - DLT_4B ) // | |
433 #define TRF_T11 ( 16 - DLT_1 ) // | |
434 #define TRF_T10 ( 0 - DLT_1 ) // | |
435 #ifdef VARIABLE_ADC_ON_TX | |
436 #define TRF_T9 (TRF_T11-VARIABLE_ADC_ON_TX*4) | |
437 #else | |
438 #define TRF_T9 ( - 40 - DLT_1 ) // | |
439 #endif | |
440 | |
441 // - TX up: | |
442 // The times below are offsets to when TXSTART goes high | |
443 //burst data comes here | |
444 #define TRF_T8 ( 18 - DLT_1 ) // | |
445 #define TRF_T7 ( 12 - DLT_1 ) // | |
446 #define TRF_T6 ( 6 - DLT_1 ) // | |
447 #define TRF_T5 ( 0 - DLT_1 ) // | |
448 #define TRF_T4 ( - 100 - DLT_1 ) // | |
449 #if(L1_RF_KBD_FIX == 1) | |
450 #define TRF_T3_1 (-215 -DLT_1 ) // Disable keyboard | |
451 #endif | |
452 #define TRF_T3 ( - 225 - DLT_1 ) // Set APC_LDO enabled | |
453 #define TRF_T2 ( - 235 - DLT_4B - tdt ) // Power ON TX | |
454 #define TRF_T1 ( - 255 - DLT_4B - tdt ) // Set TX synth | |
455 | |
456 #endif // Non TPU DEV | |
457 | |
458 | |
459 |