annotate chipsetsw/layer1/cust0/l1_cust.c @ 204:2d691e51d678

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