comparison src/cs/layer1/cust0/l1_cust.c @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children 04aaa5622fa7
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
1 /************* Revision Controle System Header *************
2 * GSM Layer 1 software
3 * L1_CUST.C
4 *
5 * Filename l1_cust.c
6 * Version 3.66
7 * Date 03/21/03
8 *
9 ************* Revision Controle System Header *************/
10
11 //#define GLOBAL
12
13
14 #include "string.h"
15
16 #include "l1_confg.h"
17 #include "l1_const.h"
18 #include "ulpd.h"
19 #include "tm_defs.h"
20 #include "l1_types.h"
21 #include "l1_time.h"
22 #include "l1_trace.h"
23 #include "sys_types.h"
24 #include "sim.h"
25 #include "buzzer.h"
26 #include "serialswitch.h"
27
28 #include "abb.h"
29
30 #if TESTMODE
31 #include "l1tm_defty.h"
32 #endif
33
34 #if (AUDIO_TASK == 1)
35 #include "l1audio_const.h"
36 #include "l1audio_cust.h"
37 #include "l1audio_defty.h"
38 #endif
39
40 #if (L1_GTT == 1)
41 #include "l1gtt_const.h"
42 #include "l1gtt_defty.h"
43 #endif
44 #include "l1_defty.h"
45 #include "l1_msgty.h"
46 #include "l1_tabs.h"
47 #include "l1_varex.h"
48
49 #if (VCXO_ALGO == 1)
50 #include "l1_ctl.h"
51 #endif
52
53 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
54 #include "spi_drv.h"
55 #endif
56
57 #if (RF==35)
58 #include "tpudrv35.h"
59 #include "l1_rf35.h"
60 #include "l1_rf35.c"
61 #endif
62
63 #if (RF==12)
64 #include "tpudrv12.h"
65 #include "l1_rf12.h"
66 #include "l1_rf12.c"
67 #endif
68
69 #if (RF==10)
70 #include "tpudrv10.h"
71 #include "l1_rf10.h"
72 #include "l1_rf10.c"
73 #endif
74
75 #if (RF==8)
76 #include "tpudrv8.h"
77 #include "l1_rf8.h"
78 #include "l1_rf8.c"
79 #endif
80
81 #if (RF==2)
82 #include "l1_rf2.h"
83 #include "l1_rf2.c"
84 #endif
85
86 #include "rv/rv_defined_swe.h" // for RVM_FCHG_SWE
87 #ifdef RVM_FCHG_SWE
88 #include "fchg/fchg_struct.h"
89 #endif
90
91 // Nucleus functions
92 extern INT TMD_Timer_State;
93 extern UWORD32 TMD_Timer; // for big sleep
94 extern UWORD32 TCD_Priority_Groups;
95 extern VOID *TCD_Current_Thread;
96 extern TC_HCB *TCD_Active_HISR_Heads[TC_HISR_PRIORITIES];
97 extern TC_HCB *TCD_Active_HISR_Tails[TC_HISR_PRIORITIES];
98 extern TC_PROTECT TCD_System_Protect;
99
100 #if (L2_L3_SIMUL == 0)
101 #define FFS_WORKAROUND 1
102 #else
103 #define FFS_WORKAROUND 0
104 #endif
105 #if (FFS_WORKAROUND == 1)
106 #include "ffs.h"
107 #else
108 typedef signed int int32;
109 typedef signed char effs_t;
110 typedef int32 filesize_t;
111 effs_t ffs_fwrite(const char *name, void *addr, filesize_t size);
112 effs_t ffs_fread(const char *name, void *addr, filesize_t size);
113 #endif
114
115 // Import band configuration from Flash module (need to replace by an access function)
116 //extern UWORD8 std;
117 extern T_L1_CONFIG l1_config;
118 extern T_L1S_GLOBAL l1s;
119
120 #if (CODE_VERSION != SIMULATION)
121 // Import serial switch configuration
122 extern char ser_cfg_info[2];
123 #endif
124
125 void get_cal_from_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id);
126 UWORD8 save_cal_in_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id);
127 void config_rf_rw_band(char type, UWORD8 read);
128 void config_rf_read(char type);
129 void config_rf_write(char type);
130
131 enum {
132 RF_ID = 0,
133 ADC_ID = 1
134 };
135
136 /*-------------------------------------------------------*/
137 /* Parameters: none */
138 /* Return: none */
139 /* Functionality: Defines the location of rf-struct */
140 /* for each std. */
141 /*-------------------------------------------------------*/
142
143 const static T_BAND_CONFIG band_config[] =
144 { /*ffs name, default addr, max carrier, min tx pwr */
145 {"",(T_RF_BAND *) 0,0,0},//undefined
146 {"900", (T_RF_BAND *)&rf_900, 174, 19 },//EGSM
147 {"1800",(T_RF_BAND *)&rf_1800, 374, 15 },//DCS
148 {"1900",(T_RF_BAND *)&rf_1900, 299, 15 },//PCS
149 {"850", (T_RF_BAND *)&rf_850, 124, 19 },//GSM850
150 #if (RF == 10)
151 {"1900_us",(T_RF_BAND *)&rf_1900, 299, 15 },//usdual 1900 rf tables are the same as 3band 1900 rf tables at the moment
152 #endif
153 {"900", (T_RF_BAND *)&rf_900, 124, 19 } //GSM, this should be last entry
154 };
155
156 /*-------------------------------------------------------*/
157 /* Parameters: none */
158 /* Return: none */
159 /* Functionality: Defines the indices into band_config */
160 /* for each std. */
161 /*-------------------------------------------------------*/
162 const T_STD_CONFIG std_config[] =
163 {
164 /* band1 index, band2 index, txpwr turning point, first arfcn*/
165 { 0, 0, 0, 0 }, // std = 0 not used
166 { BAND_GSM900, BAND_NONE, 0, 1 }, // std = 1 GSM
167 { BAND_EGSM900, BAND_NONE, 0, 1 }, // std = 2 EGSM
168 { BAND_PCS1900, BAND_NONE, 21, 512 }, // std = 3 PCS
169 { BAND_DCS1800, BAND_NONE, 28, 512 }, // std = 4 DCS
170 { BAND_GSM900, BAND_DCS1800, 28, 1 }, // std = 5 DUAL
171 { BAND_EGSM900, BAND_DCS1800, 28, 1 }, // std = 6 DUALEXT
172 { BAND_GSM850, BAND_NONE, 0, 128 }, // std = 7 850
173 #if (RF == 10)
174 { BAND_GSM850, BAND_PCS1900_US, 21, 1 } // std = 8 850/1900
175 #else
176 { BAND_GSM850, BAND_PCS1900, 21, 1 } // std = 8 850/1900
177 #endif
178 };
179
180 /*-------------------------------------------------------*/
181 /* Prototypes of external functions used in this file. */
182 /*-------------------------------------------------------*/
183 void l1_initialize(T_MMI_L1_CONFIG *mmi_l1_config);
184 WORD16 Convert_l1_radio_freq (UWORD16 radio_freq);
185
186 /*-------------------------------------------------------*/
187 /* Cust_recover_Os() */
188 /*-------------------------------------------------------*/
189 /* */
190 /* Description: adjust OS from sleep duration */
191 /* ------------ */
192 /* This function fix the : */
193 /* - system clock */
194 /* - Nucleus timers */
195 /* - xxxxxx (customer dependant) */
196 /*-------------------------------------------------------*/
197
198 UWORD8 Cust_recover_Os(void)
199 {
200 #if (CODE_VERSION != SIMULATION)
201 UWORD32 current_system_clock;
202
203 /***************************************************/
204 // Fix System clock and Nucleus Timers if any.... */
205 /***************************************************/
206 // Fix System clock ....
207 current_system_clock = NU_Retrieve_Clock();
208 current_system_clock += l1s.pw_mgr.sleep_duration;
209 NU_Set_Clock(current_system_clock);
210
211 // Fix Nucleus timer (if needed) ....
212 if (TMD_Timer_State == TM_ACTIVE)
213 {
214 TMD_Timer -= l1s.pw_mgr.sleep_duration;
215 if (!TMD_Timer) TMD_Timer_State = TM_EXPIRED;
216 }
217
218 /***************************************************/
219 // Cust dependant part ... */
220 /***************************************************/
221 //.............
222 //.............
223 //..............
224 return(TRUE);
225
226 #endif
227 }
228
229
230
231 /*-------------------------------------------------------*/
232 /* Cust_check_system() */
233 /*-------------------------------------------------------*/
234 /* */
235 /* Description: */
236 /* ------------ */
237 /* GSM 1.5 : */
238 /* - authorize UWIRE clock to be stopped */
239 /* and write value in l1s.pw_mgr.modules_status. */
240 /* - authorize ARMIO clock to be stopped if the light is */
241 /* off and write value in l1s.pw_mgr.modules_status. */
242 /* - check if SIM clock have been stopped */
243 /* before allowing DEEP SLEEP. */
244 /* - check if UARTs are ready to enter deep sleep */
245 /* - choose the sleep mode */
246 /* */
247 /* Return: */
248 /* ------- */
249 /* DO_NOT_SLEEP, FRAME_STOP or CLOCK_STOP */
250 /*-------------------------------------------------------*/
251 UWORD8 Cust_check_system(void)
252 {
253 extern UWORD8 why_big_sleep;
254 #ifdef RVM_FCHG_SWE
255 extern T_PWR_CTRL_BLOCK *pwr_ctrl;
256 #endif
257 extern SYS_BOOL uart_sleep_timer_enabled;
258
259 #if (CODE_VERSION != SIMULATION)
260
261 //cut ARMIO and UWIRE clocks in big sleep
262 l1s.pw_mgr.modules_status = ARMIO_CLK_CUT | UWIRE_CLK_CUT;
263
264 #ifdef RVM_FCHG_SWE
265 // Forbig deep sleep when charging
266 if (pwr_ctrl && pwr_ctrl->state >= FCHG_STATE_I2V_CAL_1 &&
267 pwr_ctrl->state <= FCHG_STATE_CV_CHARGING)
268 {
269 why_big_sleep = BIG_SLEEP_DUE_TO_CHARGING;
270 return(FRAME_STOP); // BIG sleep
271 }
272 #endif
273
274 // Forbid deep sleep if the light is on
275 if (LT_Status())
276 {
277 why_big_sleep = BIG_SLEEP_DUE_TO_LIGHT_ON;
278 return(FRAME_STOP); // BIG sleep
279 }
280
281 // Forbid deep sleep if the SIM and UARTs not ready
282 if (!SIM_SleepStatus())
283 {
284 why_big_sleep = BIG_SLEEP_DUE_TO_SIM;
285 return(FRAME_STOP); // BIG sleep
286 }
287
288 /* FreeCalypso: check UART activity timer */
289 if (uart_sleep_timer_enabled)
290 {
291 why_big_sleep = BIG_SLEEP_DUE_TO_UART;
292 return(FRAME_STOP); // BIG sleep
293 }
294
295 if ((l1s.pw_mgr.mode_authorized == DEEP_SLEEP) ||
296 (l1s.pw_mgr.mode_authorized == ALL_SLEEP))
297 {
298 if(SER_UartSleepStatus())
299 return(CLOCK_STOP); // DEEP sleep
300 else
301 return(DO_NOT_SLEEP); /* wait another frame or two */
302 }
303 else
304 {
305 why_big_sleep = BIG_SLEEP_DUE_TO_SLEEP_MODE;
306 return(FRAME_STOP); // BIG sleep
307 }
308
309 #else // Simulation part
310 return(CLOCK_STOP); // DEEP sleep
311 #endif
312 }
313
314
315 /*-------------------------------------------------------*/
316 /* Parameters: none */
317 /* Return: none */
318 /* Functionality: Read the RF configuration, tables etc. */
319 /* from FFS files. */
320 /*-------------------------------------------------------*/
321 const static T_CONFIG_FILE config_files_common[] =
322 {
323 #if (CODE_VERSION != SIMULATION)
324
325 // The first char is NOT part of the filename. It is used for
326 // categorizing the ffs file contents:
327 // f=rf-cal, F=rf-config,
328 // t=tx-cal, T=tx-config,
329 // r=rx-cal, R=rx-config,
330 // s=sys-cal, S=sys-config,
331 "f/gsm/rf/afcdac", &rf.afc.eeprom_afc, sizeof(rf.afc.eeprom_afc),
332 "F/gsm/rf/stdmap", &rf.radio_band_support, sizeof(rf.radio_band_support),
333 #if (VCXO_ALGO == 1)
334 "F/gsm/rf/afcparams", &rf.afc.psi_sta_inv, 4 * sizeof(UWORD32) + 4 * sizeof(WORD16),
335 #else
336 "F/gsm/rf/afcparams", &rf.afc.psi_sta_inv, 4 * sizeof(UWORD32),
337 #endif
338
339 "R/gsm/rf/rx/agcglobals", &rf.rx.agc, 4 * sizeof(UWORD16),
340 "R/gsm/rf/rx/il2agc", &rf.rx.agc.il2agc_pwr[0], 3 * sizeof(rf.rx.agc.il2agc_pwr),
341 "R/gsm/rf/rx/agcwords", &AGC_TABLE, sizeof(AGC_TABLE),
342
343 "s/sys/adccal", &adc_cal, sizeof(adc_cal),
344
345 "S/sys/abb", &abb, sizeof(abb),
346 "S/sys/uartswitch", &ser_cfg_info, sizeof(ser_cfg_info),
347
348 #endif
349 NULL, 0, 0 // terminator
350 };
351
352 /*-------------------------------------------------------*/
353 /* Parameters: none */
354 /* Return: none */
355 /* Functionality: Read the RF configurations for */
356 /* each band from FFS files. These files */
357 /* are defined for one band, and and used */
358 /* for all bands. */
359 /*-------------------------------------------------------*/
360 const static T_CONFIG_FILE config_files_band[] =
361 {
362 // The first char is NOT part of the filename. It is used for
363 // categorizing the ffs file contents:
364 // f=rf-cal, F=rf-config,
365 // t=tx-cal, T=tx-config,
366 // r=rx-cal, R=rx-config,
367 // s=sys-cal, S=sys-config,
368
369 // generic for all bands
370 // band[0] is used as template for all bands.
371 "t/gsm/rf/tx/ramps", &rf_band[0].tx.ramp_tables, sizeof(rf_band[0].tx.ramp_tables),
372 "t/gsm/rf/tx/levels", &rf_band[0].tx.levels, sizeof(rf_band[0].tx.levels),
373 "t/gsm/rf/tx/calchan", &rf_band[0].tx.chan_cal_table, sizeof(rf_band[0].tx.chan_cal_table),
374 "T/gsm/rf/tx/caltemp", &rf_band[0].tx.temp, sizeof(rf_band[0].tx.temp),
375
376 "r/gsm/rf/rx/calchan", &rf_band[0].rx.agc_bands, sizeof(rf_band[0].rx.agc_bands),
377 "R/gsm/rf/rx/caltemp", &rf_band[0].rx.temp, sizeof(rf_band[0].rx.temp),
378 "r/gsm/rf/rx/agcparams", &rf_band[0].rx.rx_cal_params, sizeof(rf_band[0].rx.rx_cal_params),
379 NULL, 0, 0 // terminator
380 };
381
382 void config_ffs_read(char type)
383 {
384 config_rf_read(type);
385 config_rf_rw_band(type, 1);
386 }
387
388 void config_ffs_write(char type)
389 {
390 config_rf_write(type);
391 config_rf_rw_band(type, 0);
392 }
393
394 void config_rf_read(char type)
395 {
396 const T_CONFIG_FILE *file = config_files_common;
397
398 while (file->name != NULL)
399 {
400 if (type == '*' || type == file->name[0]) {
401 ffs_fread(&file->name[1], file->addr, file->size);
402 }
403 file++;
404 }
405 }
406
407 void config_rf_write(char type)
408 {
409 const T_CONFIG_FILE *file = config_files_common;
410
411 while (file->name != NULL)
412 {
413 if (type == '*' || type == file->name[0]) {
414 ffs_fwrite(&file->name[1], file->addr, file->size);
415 }
416 file++;
417 }
418 }
419
420 void config_rf_rw_band(char type, UWORD8 read)
421 {
422 const T_CONFIG_FILE *f1 = config_files_band;
423 UWORD8 i;
424 WORD32 offset;
425 char name[64];
426 char *p;
427 UWORD8 std = l1_config.std.id;
428
429 #if FFS_WORKAROUND == 1
430 struct stat_s stat;
431 UWORD16 time;
432 #endif
433 for (i=0; i< GSM_BANDS; i++)
434 {
435 if(std_config[std].band[i] !=0 )
436 {
437 f1 = &config_files_band[0];
438 while (f1->name != NULL)
439 {
440 offset = (WORD32) f1->addr - (WORD32) &rf_band[0]; //offset in bytes
441 p = ((char *) &rf_band[i]) + offset;
442 if (type == '*' || type == f1->name[0])
443 {
444 strcpy(name, &f1->name[1]);
445 strcat(name, ".");
446 strcat(name, band_config[std_config[std].band[i]].name);
447
448 if (read == 1)
449 ffs_fread(name, p, f1->size);
450 else //write == 0
451 {
452 ffs_fwrite(name, p, f1->size);
453
454 // wait until ffs write has finished
455 #if FFS_WORKAROUND == 1
456 stat.inode = 0;
457 time = 0;
458
459 do {
460 rvf_delay(10); // in milliseconds
461 time += 10;
462 ffs_stat(name, &stat);
463 } while (stat.inode == 0 && time < 500);
464 #endif
465 }
466 }
467 f1++;
468 }
469 }
470 }
471 }
472
473 /*-------------------------------------------------------*/
474 /* Cust_init_std() */
475 /*-------------------------------------------------------*/
476 /* Parameters : */
477 /* Return : */
478 /* Functionality : Init Standard variable configuration */
479 /*-------------------------------------------------------*/
480 void Cust_init_std(void)
481 {
482 UWORD8 std = l1_config.std.id;
483 UWORD8 band1, band2;
484 T_RF_BAND *pt1, *pt2;
485
486 band1 = std_config[std].band[0];
487 band2 = std_config[std].band[1];
488
489 //get these from std
490 pt1 = band_config[band1].addr;
491 pt2 = band_config[band2].addr;
492
493 // copy rf-struct from default flash to ram
494 memcpy(&rf_band[0], pt1, sizeof(T_RF_BAND));
495
496 if(std_config[std].band[1] != BAND_NONE )
497 memcpy(&rf_band[1], pt2, sizeof(T_RF_BAND));
498
499 // Read all RF and system configuration from FFS *before* we copy any of
500 // the rf structure variables to other places, like L1.
501
502 config_ffs_read('*');
503
504 l1_config.std.first_radio_freq = std_config[std].first_arfcn;
505
506 if(band2!=0)
507 l1_config.std.first_radio_freq_band2 = band_config[band1].max_carrier + 1;
508 else
509 l1_config.std.first_radio_freq_band2 = 0; //band1 carrier + 1 else 0
510
511 // if band2 is not used it is initialised with zeros
512 l1_config.std.nbmax_carrier = band_config[band1].max_carrier;
513 if(band2!=0)
514 l1_config.std.nbmax_carrier += band_config[band2].max_carrier;
515
516 l1_config.std.max_txpwr_band1 = band_config[band1].max_txpwr;
517 l1_config.std.max_txpwr_band2 = band_config[band2].max_txpwr;
518 l1_config.std.txpwr_turning_point = std_config[std].txpwr_tp;
519 l1_config.std.cal_freq1_band1 = 0;
520 l1_config.std.cal_freq1_band2 = 0;
521
522 l1_config.std.g_magic_band1 = rf_band[MULTI_BAND1].rx.rx_cal_params.g_magic;
523 l1_config.std.lna_att_band1 = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_att;
524 l1_config.std.lna_switch_thr_low_band1 = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_switch_thr_low;
525 l1_config.std.lna_switch_thr_high_band1 = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_switch_thr_high;
526 l1_config.std.swap_iq_band1 = rf_band[MULTI_BAND1].swap_iq;
527
528 l1_config.std.g_magic_band2 = rf_band[MULTI_BAND2].rx.rx_cal_params.g_magic;
529 l1_config.std.lna_att_band2 = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_att;
530 l1_config.std.lna_switch_thr_low_band2 = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_switch_thr_low;
531 l1_config.std.lna_switch_thr_high_band2 = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_switch_thr_high;
532 l1_config.std.swap_iq_band2 = rf_band[MULTI_BAND2].swap_iq;
533
534 l1_config.std.radio_freq_index_offset = l1_config.std.first_radio_freq-1;
535
536 // init variable indicating which radio bands are supported by the chosen RF
537 l1_config.std.radio_band_support = rf.radio_band_support;
538 }
539
540
541 /*-------------------------------------------------------*/
542 /* Cust_init_params() */
543 /*-------------------------------------------------------*/
544 /* Parameters : */
545 /* Return : */
546 /* Functionality : Init RF dependent paramters (AGC, TX) */
547 /*-------------------------------------------------------*/
548 void Cust_init_params(void)
549 {
550
551 #if (CODE_VERSION==SIMULATION)
552 extern UWORD16 simu_RX_SYNTH_SETUP_TIME; // set in xxx.txt l3 scenario file
553 extern UWORD16 simu_TX_SYNTH_SETUP_TIME; // set in xxx.txt l3 scenario file
554
555 l1_config.params.rx_synth_setup_time = simu_RX_SYNTH_SETUP_TIME;
556 l1_config.params.tx_synth_setup_time = simu_TX_SYNTH_SETUP_TIME;
557 #else
558 l1_config.params.rx_synth_setup_time = RX_SYNTH_SETUP_TIME;
559 l1_config.params.tx_synth_setup_time = TX_SYNTH_SETUP_TIME;
560 #endif
561
562
563 // Convert SYNTH_SETUP_TIME into SPLIT.
564 // We have kept a margin of 20qbit (EPSILON_MEAS) to cover offset change and Scenario closing time + margin.
565 l1_config.params.rx_synth_load_split = 1L + (l1_config.params.rx_synth_setup_time + EPSILON_MEAS) / (BP_DURATION/BP_SPLIT);
566 l1_config.params.tx_synth_load_split = 1L + (l1_config.params.tx_synth_setup_time + EPSILON_MEAS) / (BP_DURATION/BP_SPLIT);
567
568 l1_config.params.rx_synth_start_time = TPU_CLOCK_RANGE + PROVISION_TIME - l1_config.params.rx_synth_setup_time;
569 l1_config.params.tx_synth_start_time = TPU_CLOCK_RANGE - l1_config.params.tx_synth_setup_time;
570
571 l1_config.params.rx_change_synchro_time = l1_config.params.rx_synth_start_time - EPSILON_SYNC;
572 l1_config.params.rx_change_offset_time = l1_config.params.rx_synth_start_time - EPSILON_OFFS;
573
574 l1_config.params.tx_change_offset_time = TIME_OFFSET_TX -
575 TA_MAX -
576 l1_config.params.tx_synth_setup_time -
577 EPSILON_OFFS;
578
579 // TX duration = ramp up time + burst duration (data + tail bits)
580 l1_config.params.tx_nb_duration = UL_ABB_DELAY + rf.tx.guard_bits*4 + NB_BURST_DURATION_UL;
581 l1_config.params.tx_ra_duration = UL_ABB_DELAY + rf.tx.guard_bits*4 + RA_BURST_DURATION;
582
583 l1_config.params.tx_nb_load_split = 1L + (l1_config.params.tx_nb_duration - rf.tx.prg_tx - NB_MARGIN) / (BP_DURATION/BP_SPLIT);
584 l1_config.params.tx_ra_load_split = 1L + (l1_config.params.tx_ra_duration - rf.tx.prg_tx - NB_MARGIN) / (BP_DURATION/BP_SPLIT);
585
586 // time for the end of RX and TX TPU scenarios
587 l1_config.params.rx_tpu_scenario_ending = RX_TPU_SCENARIO_ENDING;
588 l1_config.params.tx_tpu_scenario_ending = TX_TPU_SCENARIO_ENDING;
589
590 // FB26 anchoring time is computed backward to leave only 6 qbit margin between
591 // FB26 window and next activity (RX time tracking).
592 // This margin is used as follow:
593 // Serving offset restore: 1 qbit (SERV_OFFS_REST_LOAD)
594 // Tpu Sleep: 2 qbit (TPU_SLEEP_LOAD)
595 // ---------
596 // Total: 3 qbit
597
598 l1_config.params.fb26_anchoring_time = (l1_config.params.rx_synth_start_time -
599 #if (CODE_VERSION == SIMULATION)
600 // simulator: end of scenario not included in window (no serialization)
601 1 -
602 #else
603 // RF dependent end of RX TPU scenario
604 l1_config.params.rx_tpu_scenario_ending -
605 #endif
606 EPSILON_SYNC -
607 TPU_SLEEP_LOAD -
608 SERV_OFFS_REST_LOAD -
609 FB26_ACQUIS_DURATION -
610 PROVISION_TIME +
611 TPU_CLOCK_RANGE) % TPU_CLOCK_RANGE;
612
613 l1_config.params.fb26_change_offset_time = l1_config.params.fb26_anchoring_time +
614 PROVISION_TIME -
615 l1_config.params.rx_synth_setup_time -
616 EPSILON_OFFS;
617
618 l1_config.params.guard_bits = rf.tx.guard_bits;
619
620 l1_config.params.prg_tx_gsm = rf.tx.prg_tx;
621 l1_config.params.prg_tx_dcs = rf.tx.prg_tx; //delay for dual band not implemented yet
622
623 l1_config.params.low_agc_noise_thr = rf.rx.agc.low_agc_noise_thr;
624 l1_config.params.high_agc_sat_thr = rf.rx.agc.high_agc_sat_thr;
625 l1_config.params.low_agc = rf.rx.agc.low_agc;
626 l1_config.params.high_agc = rf.rx.agc.high_agc;
627 l1_config.params.il_min = IL_MIN;
628
629 l1_config.params.fixed_txpwr = FIXED_TXPWR;
630 l1_config.params.eeprom_afc = rf.afc.eeprom_afc;
631 l1_config.params.setup_afc_and_rf = SETUP_AFC_AND_RF;
632
633 l1_config.params.psi_sta_inv = rf.afc.psi_sta_inv;
634 l1_config.params.psi_st = rf.afc.psi_st;
635 l1_config.params.psi_st_32 = rf.afc.psi_st_32;
636 l1_config.params.psi_st_inv = rf.afc.psi_st_inv;
637
638 #if (CODE_VERSION == SIMULATION)
639 #if (VCXO_ALGO == 1)
640 l1_config.params.afc_algo = ALGO_AFC_LQG_PREDICTOR; // VCXO|VCTCXO - Choosing AFC algorithm
641 #endif
642 #else
643 #if (VCXO_ALGO == 1)
644 l1_config.params.afc_dac_center = rf.afc.dac_center; // VCXO - assuming DAC linearity
645 l1_config.params.afc_dac_min = rf.afc.dac_min; // VCXO - assuming DAC linearity
646 l1_config.params.afc_dac_max = rf.afc.dac_max; // VCXO - assuming DAC linearity
647 l1_config.params.afc_snr_thr = rf.afc.snr_thr; // VCXO - SNR threshold
648 l1_config.params.afc_algo = ALGO_AFC_LQG_PREDICTOR; // VCXO|VCTCXO - Choosing AFC algorithm
649 l1_config.params.afc_win_avg_size_M = C_WIN_AVG_SIZE_M; // VCXO - Average psi values with this value
650 l1_config.params.rgap_algo = ALGO_AFC_RXGAP; // VCXO - Choosing Reception Gap algorithm
651 l1_config.params.rgap_bad_snr_count_B = C_RGAP_BAD_SNR_COUNT_B; // VCXO - Prediction SNR count
652 #endif
653 #endif
654
655 #if DCO_ALGO
656 #if (RF == 10)
657 // Enable DCO algorithm for direct conversion RFs
658 l1_config.params.dco_enabled = TRUE;
659 #else
660 l1_config.params.dco_enabled = FALSE;
661 #endif
662 #endif
663
664 #if (ANLG_FAM == 1)
665 l1_config.params.debug1 = C_DEBUG1; // Enable f_tx delay of 400000 cyc DEBUG
666 l1_config.params.afcctladd = abb[ABB_AFCCTLADD]; // Value at reset
667 l1_config.params.vbuctrl = abb[ABB_VBUCTRL]; // Uplink gain amp 0dB, Sidetone gain to mute
668 l1_config.params.vbdctrl = abb[ABB_VBDCTRL]; // Downlink gain amp 0dB, Volume control 0 dB
669 l1_config.params.bbctrl = abb[ABB_BBCTRL]; // value at reset
670 l1_config.params.apcoff = abb[ABB_APCOFF]; // value at reset
671 l1_config.params.bulioff = abb[ABB_BULIOFF]; // value at reset
672 l1_config.params.bulqoff = abb[ABB_BULQOFF]; // value at reset
673 l1_config.params.dai_onoff = abb[ABB_DAI_ON_OFF]; // value at reset
674 l1_config.params.auxdac = abb[ABB_AUXDAC]; // value at reset
675 l1_config.params.vbctrl = abb[ABB_VBCTRL]; // VULSWITCH=0, VDLAUX=1, VDLEAR=1
676 l1_config.params.apcdel1 = abb[ABB_APCDEL1]; // value at reset
677 #endif
678 #if (ANLG_FAM == 2)
679 l1_config.params.debug1 = C_DEBUG1; // Enable f_tx delay of 400000 cyc DEBUG
680 l1_config.params.afcctladd = abb[ABB_AFCCTLADD]; // Value at reset
681 l1_config.params.vbuctrl = abb[ABB_VBUCTRL]; // Uplink gain amp 0dB, Sidetone gain to mute
682 l1_config.params.vbdctrl = abb[ABB_VBDCTRL]; // Downlink gain amp 0dB, Volume control 0 dB
683 l1_config.params.bbctrl = abb[ABB_BBCTRL]; // value at reset
684 l1_config.params.bulgcal = abb[ABB_BULGCAL]; // value at reset
685 l1_config.params.apcoff = abb[ABB_APCOFF]; // value at reset
686 l1_config.params.bulioff = abb[ABB_BULIOFF]; // value at reset
687 l1_config.params.bulqoff = abb[ABB_BULQOFF]; // value at reset
688 l1_config.params.dai_onoff = abb[ABB_DAI_ON_OFF]; // value at reset
689 l1_config.params.auxdac = abb[ABB_AUXDAC]; // value at reset
690 l1_config.params.vbctrl1 = abb[ABB_VBCTRL1]; // VULSWITCH=0, VDLAUX=1, VDLEAR=1
691 l1_config.params.vbctrl2 = abb[ABB_VBCTRL2]; // MICBIASEL=0, VDLHSO=0, MICAUX=0
692 l1_config.params.apcdel1 = abb[ABB_APCDEL1]; // value at reset
693 l1_config.params.apcdel2 = abb[ABB_APCDEL2]; // value at reset
694 #endif
695 #if (ANLG_FAM == 3)
696 l1_config.params.debug1 = C_DEBUG1; // Enable f_tx delay of 400000 cyc DEBUG
697 l1_config.params.afcctladd = abb[ABB_AFCCTLADD]; // Value at reset
698 l1_config.params.vbuctrl = abb[ABB_VBUCTRL]; // Uplink gain amp 0dB, Sidetone gain to mute
699 l1_config.params.vbdctrl = abb[ABB_VBDCTRL]; // Downlink gain amp 0dB, Volume control 0 dB
700 l1_config.params.bbctrl = abb[ABB_BBCTRL]; // value at reset
701 l1_config.params.bulgcal = abb[ABB_BULGCAL]; // value at reset
702 l1_config.params.apcoff = abb[ABB_APCOFF]; // X2 Slope 128 and APCSWP disabled
703 l1_config.params.bulioff = abb[ABB_BULIOFF]; // value at reset
704 l1_config.params.bulqoff = abb[ABB_BULQOFF]; // value at reset
705 l1_config.params.dai_onoff = abb[ABB_DAI_ON_OFF]; // value at reset
706 l1_config.params.auxdac = abb[ABB_AUXDAC]; // value at reset
707 l1_config.params.vbctrl1 = abb[ABB_VBCTRL1]; // VULSWITCH=0
708 l1_config.params.vbctrl2 = abb[ABB_VBCTRL2]; // MICBIASEL=0, VDLHSO=0, MICAUX=0
709 l1_config.params.apcdel1 = abb[ABB_APCDEL1]; // value at reset
710 l1_config.params.apcdel2 = abb[ABB_APCDEL2]; // value at reset
711 l1_config.params.vbpop = abb[ABB_VBPOP]; // HSOAUTO enabled
712 l1_config.params.vau_delay_init = abb[ABB_VAUDINITD]; // 2 TDMA Frames between VDL "ON" and VDLHSO "ON"
713 l1_config.params.vaud_cfg = abb[ABB_VAUDCTRL]; // value at reset
714 l1_config.params.vauo_onoff = abb[ABB_VAUOCTRL]; // speech on AUX and EAR
715 l1_config.params.vaus_vol = abb[ABB_VAUSCTRL]; // value at reset
716 l1_config.params.vaud_pll = abb[ABB_VAUDPLL]; // value at reset
717 #endif
718
719 #if 0 /* present in MV100 version, but not in TCS211 */
720 // global variable for access to deep sleep time
721 l1_config.params.sleep_time = 0;
722 #endif
723 }
724
725
726 /************************************/
727 /* Automatic Gain Control */
728 /************************************/
729
730 /*-------------------------------------------------------*/
731 /* Cust_get_agc_from_IL() */
732 /*-------------------------------------------------------*/
733 /* Parameters : */
734 /* Return : */
735 /* Functionality : returns agc value */
736 /*-------------------------------------------------------*/
737 WORD8 Cust_get_agc_from_IL(UWORD16 radio_freq, UWORD16 agc_index, UWORD8 table_id)
738 {
739 WORD8 agc_value;
740
741 // radio_freq currently not used
742 // this parameter is passed in order to allow band dependent tables for specific RFs
743 // (e.g. dual band RF with separate AGC H/W blocks for GSM and DCS)
744
745 if (agc_index > 120)
746 agc_index = 120; // Clip agc_index
747
748 switch (table_id)
749 {
750 case MAX_ID:
751 agc_value = rf.rx.agc.il2agc_max[agc_index];
752 break;
753 case AV_ID:
754 agc_value = rf.rx.agc.il2agc_av[agc_index];
755 break;
756 case PWR_ID:
757 agc_value = rf.rx.agc.il2agc_pwr[agc_index];
758 break;
759 }
760
761 return agc_value;
762 }
763
764 /*-------------------------------------------------------*/
765 /* Cust_get_agc_band */
766 /*-------------------------------------------------------*/
767 /* Parameters : radio_freq */
768 /* Return : band number */
769 /* Functionality : Computes the band for RF calibration */
770 /*-------------------------------------------------------*/
771 /*---------------------------------------------*/
772
773
774 #if (CODE_VERSION == SIMULATION)
775 UWORD16 Cust_get_agc_band(UWORD16 arfcn, UWORD8 gsm_band)
776 #else
777 UWORD16 inline Cust_get_agc_band(UWORD16 arfcn, UWORD8 gsm_band)
778 #endif
779 {
780 WORD32 i ;
781
782 for (i=0;i<RF_RX_CAL_CHAN_SIZE;i++)
783 {
784 if (arfcn <= rf_band[gsm_band].rx.agc_bands[i].upper_bound)
785 return(i);
786 }
787 // Should never happen!
788 return(0);
789 }
790
791 /*-------------------------------------------------------*/
792 /* Cust_is_band_high */
793 /*-------------------------------------------------------*/
794 /* Parameters : arfcn */
795 /* Return : 0 if low band */
796 /* 1 if high band */
797 /* Functionality : Generic function which return 1 if */
798 /* arfcn is in the high band */
799 /*-------------------------------------------------------*/
800
801 UWORD8 Cust_is_band_high(UWORD16 radio_freq)
802 {
803 UWORD16 max_carrier;
804 UWORD8 std = l1_config.std.id;
805
806 max_carrier = band_config[std_config[std].band[0]].max_carrier;
807
808 return(((radio_freq >= l1_config.std.first_radio_freq) &&
809 (radio_freq < (l1_config.std.first_radio_freq + max_carrier))) ? MULTI_BAND1 : MULTI_BAND2);
810 }
811
812 /*-------------------------------------------------------*/
813 /* l1ctl_encode_delta2() */
814 /*-------------------------------------------------------*/
815 /* Parameters : */
816 /* Return : */
817 /* Functionality : */
818 /*-------------------------------------------------------*/
819 WORD8 l1ctl_encode_delta2(UWORD16 radio_freq)
820 {
821 WORD8 delta2_freq;
822 UWORD16 i;
823 UWORD16 arfcn;
824 UWORD8 band;
825
826 band = Cust_is_band_high(radio_freq);
827 arfcn = Convert_l1_radio_freq(radio_freq);
828
829 i = Cust_get_agc_band(arfcn,band); //
830 delta2_freq = rf_band[band].rx.agc_bands[i].agc_calib;
831
832 //temperature compensation
833 for (i=0;i<RF_RX_CAL_TEMP_SIZE;i++)
834 {
835 if ((WORD16)adc.converted[ADC_RFTEMP] <= rf_band[band].rx.temp[i].temperature)
836 {
837 delta2_freq += rf_band[band].rx.temp[i].agc_calib;
838 break;
839 }
840 }
841
842 return(delta2_freq);
843 }
844
845 /************************************/
846 /* TX Management */
847 /************************************/
848 /*-------------------------------------------------------*/
849 /* Cust_get_ramp_tab */
850 /*-------------------------------------------------------*/
851 /* Parameters : */
852 /* Return : */
853 /* Functionality : */
854 /*-------------------------------------------------------*/
855
856 void Cust_get_ramp_tab(API *a_ramp, UWORD8 txpwr_ramp_up, UWORD8 txpwr_ramp_down, UWORD16 radio_freq)
857 {
858 UWORD16 index_up, index_down, j;
859 UWORD8 band;
860
861 band = Cust_is_band_high(radio_freq);
862
863 index_up = rf_band[band].tx.levels[txpwr_ramp_up].ramp_index;
864 index_down = rf_band[band].tx.levels[txpwr_ramp_down].ramp_index;
865
866 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
867 for (j=0; j<16; j++)
868 {
869 a_ramp[j]=((rf_band[band].tx.ramp_tables[index_down].ramp_down[j])<<11) |
870 ((rf_band[band].tx.ramp_tables[index_up].ramp_up[j]) << 6) |
871 0x14;
872 }
873 #endif
874 }
875
876 /*-------------------------------------------------------*/
877 /* get_pwr_data */
878 /*-------------------------------------------------------*/
879 /* Parameters : */
880 /* Return : */
881 /* Functionality : */
882 /*-------------------------------------------------------*/
883
884 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
885 UWORD16 Cust_get_pwr_data(UWORD8 txpwr, UWORD16 radio_freq)
886 {
887
888 UWORD16 i,j;
889 UWORD16 arfcn;
890 UWORD8 band;
891
892 #if(ORDER2_TX_TEMP_CAL==1)
893 WORD16 pwr_data;
894 #else
895 UWORD16 pwr_data;
896 #endif
897
898 band = Cust_is_band_high(radio_freq);
899 arfcn = Convert_l1_radio_freq(radio_freq);
900
901 i = rf_band[band].tx.levels[txpwr].chan_cal_index;
902 j=0;
903 // get uncalibrated apc
904 pwr_data = rf_band[band].tx.levels[txpwr].apc;
905
906 while (arfcn > rf_band[band].tx.chan_cal_table[i][j].arfcn_limit)
907 j++;
908
909 // channel calibrate apc
910 pwr_data = ((UWORD32) (pwr_data * rf_band[band].tx.chan_cal_table[i][j].chan_cal))/128;
911
912 // temperature compensate apc
913 {
914 T_TX_TEMP_CAL *pt;
915
916 pt = rf_band[band].tx.temp;
917 while (((WORD16)adc.converted[ADC_RFTEMP] > pt->temperature) && ((pt-rf_band[band].tx.temp) < (RF_TX_CAL_TEMP_SIZE-1)))
918 pt++;
919 #if(ORDER2_TX_TEMP_CAL==1)
920 pwr_data += (txpwr*(pt->a*txpwr + pt->b) + pt->c) / 64; //delta apc = ax^2+bx+c
921 if(pwr_data < 0) pwr_data = 0;
922 #else
923 pwr_data += pt->apc_calib;
924 #endif
925 }
926 return(pwr_data);
927 }
928 #endif
929 /*-------------------------------------------------------*/
930 /* Cust_Init_Layer1 */
931 /*-------------------------------------------------------*/
932 /* Parameters : */
933 /* Return : */
934 /* Functionality : Load and boot the DSP */
935 /* Initialize shared memory and L1 data structures */
936 /*-------------------------------------------------------*/
937
938 void Cust_Init_Layer1(void)
939 {
940 T_MMI_L1_CONFIG cfg;
941
942 // Get the current band configuration from the flash
943 #if (OP_WCP==1)
944 extern unsigned char ffs_GetBand();
945 cfg.std = ffs_GetBand();
946 #else // NO OP_WCP
947 // cfg.std = std;
948 cfg.std = STD;
949 #endif // OP_WCP
950
951 cfg.tx_pwr_code = 1;
952
953 // sleep management configuration
954 cfg.pwr_mngt = 0;
955 cfg.pwr_mngt_mode_authorized = NO_SLEEP; //Sleep mode
956 cfg.pwr_mngt_clocks = 0x5ff; // list of clocks cut in Big Sleep
957
958
959
960 #if (CODE_VERSION != SIMULATION)
961 cfg.dwnld = DWNLD; //external define from makefile
962 #endif
963
964 l1_initialize(&cfg);
965
966 get_cal_from_nvmem((UWORD8 *)&rf, sizeof(rf), RF_ID);
967 get_cal_from_nvmem((UWORD8 *)&adc_cal, sizeof(adc_cal), ADC_ID);
968
969 }
970
971
972 /******************************************************************************/
973 /********************* TESTMODE functions *****************************/
974 /******************************************************************************/
975
976
977
978 /*------------------------------------------------------*/
979 /* madc_hex_2_physical */
980 /*------------------------------------------------------*/
981 /* Parameters : */
982 /* Return : */
983 /* Functionality : Function to convert MAD hexadecimal */
984 /* values into physical values */
985 /*------------------------------------------------------*/
986
987 void madc_hex_2_physical (UWORD16 *adc_hex, T_ADC *adc_phy)
988 {
989 WORD16 i;
990 UWORD16 y;
991 WORD16 Smin = 0, Smax = TEMP_TABLE_SIZE-1;
992 WORD16 index = (TEMP_TABLE_SIZE-1)/2; /* y is the adc code after compensation of ADC slope error introduced by VREF error */
993
994 //store raw ADC values
995 memcpy(&adc.raw[0], adc_hex, sizeof(adc.raw));
996
997 // Convert Vbat [mV] : direct equation with slope and offset compensation
998 for (i = ADC_VBAT; i<ADC_RFTEMP; i++)
999 adc.converted[i] = (((UWORD32)(adc_cal.a[i] * adc.raw[i])) >>10) + adc_cal.b[i];
1000
1001 /*Convert RF Temperature [Celsius]: binsearch into a table*/
1002 y = ((UWORD32)(adc_cal.a[ADC_RFTEMP] * adc.raw[ADC_RFTEMP]))>>8; /* rf.tempcal is the calibration of VREF*/
1003 while((Smax-Smin) > 1 )
1004 {
1005 if(y < temperature[index].adc)
1006 Smax=index;
1007 else
1008 Smin=index;
1009
1010 index = (Smax+Smin)/2;
1011 }
1012 adc.converted[ADC_RFTEMP] = temperature[index].temp;
1013
1014 for (i = ADC_RFTEMP+1; i<ADC_INDEX_END; i++)
1015 adc.converted[i] = (((UWORD32)(adc_cal.a[i] * adc.raw[i])) >>10) + adc_cal.b[i];
1016
1017 //store converted ADC values
1018 memcpy(adc_phy, &adc.converted[0], sizeof(adc.raw));
1019 }
1020
1021 /*
1022 * FreeCalypso: the following two functions have been added
1023 * to support the new battery charging code.
1024 */
1025
1026 UWORD16 madc_vbat_2_physical (UWORD16 adc_val)
1027 {
1028 return (((UWORD32)(adc_cal.a[ADC_VBAT] * adc_val)) >> 10) +
1029 adc_cal.b[ADC_VBAT];
1030 }
1031
1032 UWORD16 madc_vbat_inverse (UWORD16 mv)
1033 {
1034 return ((UWORD32)(mv - adc_cal.b[ADC_VBAT]) << 10) / adc_cal.a[ADC_VBAT];
1035 }
1036
1037 /*------------------------------------------------------*/
1038 /* get_cal_from_nvmem */
1039 /*------------------------------------------------------*/
1040 /* Parameters : */
1041 /* Return : */
1042 /* Functionality : Copy calibrated parameter to */
1043 /* calibration structure in RAM */
1044 /*------------------------------------------------------*/
1045
1046 void get_cal_from_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id)
1047 {
1048
1049 }
1050
1051 /*------------------------------------------------------*/
1052 /* save_cal_from_nvmem */
1053 /*------------------------------------------------------*/
1054 /* Parameters : */
1055 /* Return : */
1056 /* Functionality : Copy calibrated structure from RAM */
1057 /* into NV memory */
1058 /*------------------------------------------------------*/
1059
1060 UWORD8 save_cal_in_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id)
1061 {
1062 #if (OP_WCP == 1)
1063 // FFS backup implementation an Avenger 2
1064 // Request MPU-S to backup the FFS
1065 // after full calibration of device
1066 extern void ffs_backup(void);
1067 ffs_backup();
1068 #endif
1069 return (0);
1070 }
1071
1072 #if (TRACE_TYPE == 4)
1073
1074 /*------------------------------------------------------*/
1075 /* l1_cst_l1_parameters */
1076 /*------------------------------------------------------*/
1077 /* Parameters : s: pointer on configuration string */
1078 /* Return : nothing: global var are set */
1079 /* Functionality : Set global L1 vars for dynamic trace */
1080 /* and configuration */
1081 /* */
1082 /* This function is called when a CST message is sent */
1083 /* from the Condat Panel. */
1084 /*------------------------------------------------------*/
1085 void l1_cst_l1_parameters(char *s)
1086 {
1087 /*
1088 a sample command string can be:
1089 L1_PARAMS=<1,2,3,4,5> or
1090 L1_PARAMS=<1,23,3E32,4,5>
1091 with n parameters (here: 5 params); n>=1
1092 parameters are decoded as hexadecimal unsigned integers (UWORD16)
1093 */
1094
1095 UWORD8 uNParams = 0; /* Number of parameters */
1096 UWORD32 aParam[10]; /* Parameters array */
1097 UWORD8 uIndex = 0;
1098
1099 /* *** retrieve all parameters *** */
1100 while (s[uIndex] != '<') uIndex++;
1101 uIndex++;
1102 aParam[0] = 0;
1103
1104 /* uIndex points on 1st parameter */
1105
1106 while (s[uIndex] != '>')
1107 {
1108 if (s[uIndex] == ',')
1109 {
1110 uNParams++;
1111 aParam[uNParams] = 0;
1112 }
1113 else
1114 {
1115 /* uIndex points on a parameter char */
1116 UWORD8 uChar = s[uIndex];
1117 aParam[uNParams] = aParam[uNParams] << 4; /* shift 4 bits left */
1118 if ((uChar>='0') && (uChar<='9'))
1119 aParam[uNParams] += (uChar - '0'); /* retrieve value */
1120 else if ((uChar>='A') && (uChar<='F'))
1121 aParam[uNParams] += (10 + uChar - 'A'); /* retrieve value */
1122 else if ((uChar>='a') && (uChar<='f'))
1123 aParam[uNParams] += (10 + uChar - 'a'); /* retrieve value */
1124 }
1125
1126 uIndex++; /* go to next char */
1127 }
1128
1129 /* increment number of params */
1130 uNParams++;
1131
1132 /* *** handle parameters *** */
1133 /*
1134 1st param: command type
1135 2nd param: argument for command type
1136 */
1137 switch (aParam[0])
1138 {
1139 case 0: /* Trace setting */
1140 /* The 2nd parameter contains the trace bitmap*/
1141 if (uNParams >=2)
1142 trace_info.current_config->l1_dyn_trace = aParam[1];
1143 else
1144 trace_info.current_config->l1_dyn_trace = 0; /* error case: disable all trace */
1145 Trace_dyn_trace_change();
1146 break;
1147 default: /* ignore it */
1148 break;
1149 } // switch
1150 }
1151
1152 #endif
1153
1154 #if ((CHIPSET == 2) || (CHIPSET == 3) || (CHIPSET == 4) || \
1155 (CHIPSET == 5) || (CHIPSET == 6) || (CHIPSET == 7) || \
1156 (CHIPSET == 8) || (CHIPSET == 9) || (CHIPSET == 10) || \
1157 (CHIPSET == 11) || (CHIPSET == 12))
1158 /*-------------------------------------------------------*/
1159 /* power_down_config() : temporary implementation !!! */
1160 /*-------------------------------------------------------*/
1161 /* Parameters : sleep_mode (NO, SMALL, BIG, DEEP or ALL) */
1162 /* clocks to be cut in BIG sleep */
1163 /* Return : */
1164 /* Functionality : set the l1s variables */
1165 /* l1s.pw_mgr.mode_authorized and l1s.pw_mgr.clocks */
1166 /* according to the desired mode. */
1167 /*-------------------------------------------------------*/
1168 void power_down_config(UWORD8 sleep_mode, UWORD16 clocks)
1169 {
1170 #if (OP_L1_STANDALONE == 1)
1171 if(sleep_mode != NO_SLEEP)
1172 #endif
1173 {
1174 l1_config.pwr_mngt = PWR_MNGT;
1175 l1s.pw_mgr.mode_authorized = sleep_mode;
1176 l1s.pw_mgr.clocks = clocks;
1177 }
1178
1179 #if (OP_L1_STANDALONE == 0)
1180 l1s.pw_mgr.enough_gaug = FALSE;
1181 #endif
1182 }
1183 #endif