annotate chipsetsw/layer1/cust0/l1_cust.c @ 348:bc7ca94e52e7

STATUS: l1p_driv.obj reconstruction is now perfect
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 30 Oct 2017 17:27:58 +0000
parents f56dea71a75f
children
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 enum {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
127 RF_ID = 0,
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
128 ADC_ID = 1
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
129 };
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 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
132 /* Parameters: none */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
133 /* Return: none */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
134 /* 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
135 /* for each std. */
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 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
139 { /*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
140 {"",(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
141 {"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
142 {"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
143 {"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
144 {"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
145 #if (RF == 10)
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
146 {"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
147 #endif
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, 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
149 };
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
150
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
151 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
152 /* Parameters: none */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
153 /* Return: none */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
154 /* 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
155 /* for each std. */
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 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
158 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
159 /* 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
160 { 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
161 { 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
162 { 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
163 { 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
164 { 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
165 { 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
166 { 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
167 { 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
168 #if (RF == 10)
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
169 { 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
170 #else
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
171 { 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
172 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
173 };
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
174
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
175 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
176 /* 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
177 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
178 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
179 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
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 /* Cust_recover_Os() */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
183 /*-------------------------------------------------------*/
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 /* 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
186 /* ------------ */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
187 /* 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
188 /* - system clock */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
189 /* - Nucleus timers */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
190 /* - xxxxxx (customer dependant) */
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
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
193 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
194 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
195 #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
196 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
197
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 // 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
200 /***************************************************/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
201 // Fix System clock ....
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
202 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
203 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
204 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
205
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
206 // 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
207 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
208 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
209 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
210 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
211 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
212
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
213 /***************************************************/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
214 // Cust dependant part ... */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
215 /***************************************************/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
216 //.............
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 //..............
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
219 return(TRUE);
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 #endif
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
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 /* Cust_check_system() */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
228 /*-------------------------------------------------------*/
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 /* Description: */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
231 /* ------------ */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
232 /* GSM 1.5 : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
233 /* - 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
234 /* 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
235 /* - 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
236 /* 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
237 /* - 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
238 /* 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
239 /* - 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
240 /* - 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
241 /* */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
242 /* Return: */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
243 /* ------- */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
244 /* 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
245 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
246 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
247 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
248 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
249 #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
250 #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
251 // 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
252 if(LT_Status())
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 //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
255 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
256 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
257 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
258 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
259
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
260 // 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
261 if(SIM_SleepStatus())
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 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
264 if(SER_UartSleepStatus())
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
265 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
266 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
267 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
268 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
269 #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
270 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
271 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
272 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
273 // 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
274 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
275 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
276 #else // Simulation part
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
277 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
278 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
279 }
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
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
282 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
283 /* Parameters: none */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
284 /* Return: none */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
285 /* 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
286 /* from FFS files. */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
287 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
288 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
289 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
290 #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
291
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
292 // 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
293 // 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
294 // 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
295 // 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
296 // 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
297 // 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
298 "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
299 "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
300 #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
301 "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
302 #else
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
303 "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
304 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
305
212
f56dea71a75f l1_cust.c: reconstruction complete after agcglobals file size fix
Mychaela Falconia <falcon@freecalypso.org>
parents: 210
diff changeset
306 "R/gsm/rf/rx/agcglobals", &rf.rx.agc, 4 * sizeof(UWORD16),
200
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
307 "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
308 "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
309
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
310 "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
311
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
312 "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
313 "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
314
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
315 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
316 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
317 };
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
318
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 /* Parameters: none */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
321 /* Return: none */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
322 /* 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
323 /* 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
324 /* 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
325 /* for all bands. */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
326 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
327 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
328 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
329 // 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
330 // 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
331 // 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
332 // 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
333 // 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
334 // 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
335
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
336 // 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
337 // 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
338 "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
339 "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
340 "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
341 "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
342
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
343 "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
344 "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
345 "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
346 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
347 };
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
348
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
349 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
350 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
351 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
352 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
353 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
354
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
355 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
356 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
357 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
358 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
359 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
360
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
361 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
362 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
363 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
364
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
365 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
366 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
367 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
368 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
369 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
370 file++;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
371 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
372 }
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 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
375 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
376 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
377
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
378 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
379 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
380 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
381 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
382 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
383 file++;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
384 }
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 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
388 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
389 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
390 UWORD8 i;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
391 WORD32 offset;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
392 char name[64];
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
393 char *p;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
394 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
395
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
396 #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
397 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
398 UWORD16 time;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
399 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
400 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
401 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
402 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
403 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
404 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
405 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
406 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
407 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
408 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
409 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
410 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
411 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
412 strcat(name, ".");
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
413 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
414
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
415 if (read == 1)
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
416 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
417 else //write == 0
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
418 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
419 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
420
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
421 // 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
422 #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
423 stat.inode = 0;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
424 time = 0;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
425
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
426 do {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
427 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
428 time += 10;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
429 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
430 } 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
431 #endif
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 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
434 f1++;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
435 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
436 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
437 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
438 }
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 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
441 /* Cust_init_std() */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
442 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
443 /* Parameters : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
444 /* Return : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
445 /* 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
446 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
447 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
448 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
449 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
450 UWORD8 band1, band2;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
451 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
452
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
453 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
454 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
455
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
456 //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
457 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
458 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
459
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
460 // 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
461 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
462
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
463 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
464 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
465
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
466 // 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
467 // 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
468
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
469 config_ffs_read('*');
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
470
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
471 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
472
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
473 if(band2!=0)
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
474 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
475 else
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
476 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
477
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
478 // 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
479 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
480 if(band2!=0)
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
481 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
482
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
483 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
484 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
485 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
486 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
487 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
488
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
489 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
490 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
491 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
492 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
493 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
494
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.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
496 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
497 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
498 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
499 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
500
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.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
502
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
503 // 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
504 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
505 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
506
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
507
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 /* Cust_init_params() */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
510 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
511 /* Parameters : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
512 /* Return : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
513 /* 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
514 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
515 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
516 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
517
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
518 #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
519 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
520 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
521
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
522 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
523 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
524 #else
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
525 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
526 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
527 #endif
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
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
530 // 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
531 // 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
532 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
533 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
534
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
535 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
536 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
537
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
538 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
539 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
540
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
541 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
542 TA_MAX -
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
543 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
544 EPSILON_OFFS;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
545
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
546 // 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
547 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
548 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
549
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_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
551 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
552
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
553 // 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
554 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
555 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
556
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
557 // 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
558 // 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
559 // 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
560 // 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
561 // 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
562 // ---------
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
563 // Total: 3 qbit
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
564
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.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
566 #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
567 // 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
568 1 -
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
569 #else
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
570 // 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
571 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
572 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
573 EPSILON_SYNC -
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
574 TPU_SLEEP_LOAD -
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
575 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
576 FB26_ACQUIS_DURATION -
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
577 PROVISION_TIME +
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
578 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
579
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
580 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
581 PROVISION_TIME -
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
582 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
583 EPSILON_OFFS;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
584
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.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
586
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
587 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
588 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
589
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
590 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
591 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
592 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
593 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
594 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
595
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.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
597 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
598 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
599
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
600 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
601 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
602 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
603 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
604
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
605 #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
606 #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
607 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
608 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
609 #else
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
610 #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
611 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
612 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
613 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
614 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
615 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
616 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
617 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
618 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
619 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
620 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
621
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
622 #if DCO_ALGO
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
623 #if (RF == 10)
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
624 // 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
625 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
626 #else
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.dco_enabled = FALSE;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
628 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
629 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
630
202
47ac87c0bc1b l1_cust.c & l1_rf12.c: s/ANALOG/ANLG_FAM/
Mychaela Falconia <falcon@freecalypso.org>
parents: 201
diff changeset
631 #if (ANLG_FAM == 1)
204
2d691e51d678 l1_cust.c: passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents: 202
diff changeset
632 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
633 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
634 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
635 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
636 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
637 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
638 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
639 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
640 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
641 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
642 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
643 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
644 #endif
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 == 2)
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.bulgcal = abb[ABB_BULGCAL]; // value at reset
2d691e51d678 l1_cust.c: passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents: 202
diff changeset
652 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
653 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
654 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
655 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
656 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
657 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
658 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
659 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
660 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
661 #endif
202
47ac87c0bc1b l1_cust.c & l1_rf12.c: s/ANALOG/ANLG_FAM/
Mychaela Falconia <falcon@freecalypso.org>
parents: 201
diff changeset
662 #if (ANLG_FAM == 3)
204
2d691e51d678 l1_cust.c: passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents: 202
diff changeset
663 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
664 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
665 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
666 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
667 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
668 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
669 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
670 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
671 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
672 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
673 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
674 l1_config.params.vbctrl1 = abb[ABB_VBCTRL1]; // VULSWITCH=0
2d691e51d678 l1_cust.c: passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents: 202
diff changeset
675 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
676 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
677 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
678 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
679 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
680 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
681 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
682 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
683 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
684 #endif
204
2d691e51d678 l1_cust.c: passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents: 202
diff changeset
685
2d691e51d678 l1_cust.c: passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents: 202
diff changeset
686 #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
687 // global variable for access to deep sleep time
2d691e51d678 l1_cust.c: passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents: 202
diff changeset
688 l1_config.params.sleep_time = 0;
2d691e51d678 l1_cust.c: passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents: 202
diff changeset
689 #endif
200
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
690 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
691
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
692
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
693 /************************************/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
694 /* Automatic Gain Control */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
695 /************************************/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
696
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
697 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
698 /* 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
699 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
700 /* Parameters : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
701 /* Return : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
702 /* 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
703 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
704 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
705 {
208
fe1846dee240 l1_cust.c: Cust_get_agc_from_IL() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 207
diff changeset
706 WORD8 agc_value;
fe1846dee240 l1_cust.c: Cust_get_agc_from_IL() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 207
diff changeset
707
200
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
708 // 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
709 // 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
710 // (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
711
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
712 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
713 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
714
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
715 switch (table_id)
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
716 {
208
fe1846dee240 l1_cust.c: Cust_get_agc_from_IL() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 207
diff changeset
717 case MAX_ID:
fe1846dee240 l1_cust.c: Cust_get_agc_from_IL() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 207
diff changeset
718 agc_value = rf.rx.agc.il2agc_max[agc_index];
fe1846dee240 l1_cust.c: Cust_get_agc_from_IL() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 207
diff changeset
719 break;
fe1846dee240 l1_cust.c: Cust_get_agc_from_IL() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 207
diff changeset
720 case AV_ID:
fe1846dee240 l1_cust.c: Cust_get_agc_from_IL() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 207
diff changeset
721 agc_value = rf.rx.agc.il2agc_av[agc_index];
fe1846dee240 l1_cust.c: Cust_get_agc_from_IL() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 207
diff changeset
722 break;
fe1846dee240 l1_cust.c: Cust_get_agc_from_IL() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 207
diff changeset
723 case PWR_ID:
fe1846dee240 l1_cust.c: Cust_get_agc_from_IL() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 207
diff changeset
724 agc_value = rf.rx.agc.il2agc_pwr[agc_index];
fe1846dee240 l1_cust.c: Cust_get_agc_from_IL() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 207
diff changeset
725 break;
200
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
726 }
208
fe1846dee240 l1_cust.c: Cust_get_agc_from_IL() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 207
diff changeset
727
fe1846dee240 l1_cust.c: Cust_get_agc_from_IL() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 207
diff changeset
728 return agc_value;
200
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
729 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
730
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
731 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
732 /* 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
733 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
734 /* Parameters : radio_freq */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
735 /* Return : band number */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
736 /* 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
737 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
738 /*---------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
739
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
740
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
741 #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
742 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
743 #else
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
744 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
745 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
746 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
747 WORD32 i ;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
748
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
749 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
750 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
751 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
752 return(i);
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
753 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
754 // Should never happen!
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
755 return(0);
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
756 }
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 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
759 /* 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
760 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
761 /* Parameters : arfcn */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
762 /* 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
763 /* 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
764 /* 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
765 /* 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
766 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
767
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
768 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
769 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
770 UWORD16 max_carrier;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
771 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
772
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
773 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
774
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
775 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
776 (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
777 }
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 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
780 /* l1ctl_encode_delta2() */
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 /* Parameters : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
783 /* Return : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
784 /* Functionality : */
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 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
787 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
788 WORD8 delta2_freq;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
789 UWORD16 i;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
790 UWORD16 arfcn;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
791 UWORD8 band;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
792
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
793 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
794 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
795
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
796 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
797 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
798
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
799 //temperature compensation
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
800 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
801 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
802 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
803 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
804 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
805 break;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
806 }
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
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
809 return(delta2_freq);
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 /* TX Management */
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 /* 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
817 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
818 /* Parameters : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
819 /* Return : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
820 /* Functionality : */
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
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
823 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
824 {
209
c79dd8f07fc5 l1_cust.c: Cust_get_ramp_tab() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 208
diff changeset
825 UWORD16 index_up, index_down, j;
200
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
826 UWORD8 band;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
827
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
828 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
829
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
830 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
831 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
832
202
47ac87c0bc1b l1_cust.c & l1_rf12.c: s/ANALOG/ANLG_FAM/
Mychaela Falconia <falcon@freecalypso.org>
parents: 201
diff changeset
833 #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
834 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
835 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
836 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
837 ((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
838 0x14;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
839 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
840 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
841 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
842
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
843 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
844 /* get_pwr_data */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
845 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
846 /* Parameters : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
847 /* Return : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
848 /* Functionality : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
849 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
850
202
47ac87c0bc1b l1_cust.c & l1_rf12.c: s/ANALOG/ANLG_FAM/
Mychaela Falconia <falcon@freecalypso.org>
parents: 201
diff changeset
851 #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
852 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
853 {
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 UWORD16 i,j;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
856 UWORD16 arfcn;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
857 UWORD8 band;
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 #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
860 WORD16 pwr_data;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
861 #else
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
862 UWORD16 pwr_data;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
863 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
864
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
865 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
866 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
867
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
868 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
869 j=0;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
870 // get uncalibrated apc
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
871 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
872
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
873 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
874 j++;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
875
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
876 // channel calibrate apc
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
877 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
878
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
879 // temperature compensate apc
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 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
882
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
883 pt = rf_band[band].tx.temp;
210
7f3182969aac l1_cust.c: Cust_get_pwr_data() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 209
diff changeset
884 while (((WORD16)adc.converted[ADC_RFTEMP] > pt->temperature) && ((pt-rf_band[band].tx.temp) < (RF_TX_CAL_TEMP_SIZE-1)))
200
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
885 pt++;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
886 #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
887 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
888 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
889 #else
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
890 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
891 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
892 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
893 return(pwr_data);
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
894 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
895 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
896 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
897 /* Cust_Init_Layer1 */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
898 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
899 /* Parameters : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
900 /* Return : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
901 /* 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
902 /* 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
903 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
904
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
905 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
906 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
907 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
908
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
909 // 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
910 #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
911 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
912 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
913 #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
914 // cfg.std = std;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
915 cfg.std = STD;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
916 #endif // OP_WCP
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
917
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
918 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
919
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
920 // sleep management configuration
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
921 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
922 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
923 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
924
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
925
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
926
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
927 #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
928 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
929 #endif
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 l1_initialize(&cfg);
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
932
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
933 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
934 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
935
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
936 }
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
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
939 /*****************************************************************************************/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
940 /*************************** TESTMODE functions **********************************/
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 /*------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
946 /* 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
947 /*------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
948 /* Parameters : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
949 /* Return : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
950 /* 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
951 /* 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
952 /*------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
953
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
954 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
955 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
956 WORD16 i;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
957 UWORD16 y;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
958 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
959 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
960
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
961 //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
962 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
963
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
964 // 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
965 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
966 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
967
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
968 /*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
969 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
970 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
971 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
972 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
973 Smax=index;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
974 else
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
975 Smin=index;
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 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
978 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
979 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
980
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
981 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
982 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
983
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
984 //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
985 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
986 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
987
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 /*------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
990 /* 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
991 /*------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
992 /* Parameters : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
993 /* Return : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
994 /* 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
995 /* 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
996 /*------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
997
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
998 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
999 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1000
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 /*------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1004 /* 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
1005 /*------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1006 /* Parameters : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1007 /* Return : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1008 /* 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
1009 /* into NV memory */
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
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1012 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
1013 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1014 #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
1015 // 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
1016 // 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
1017 // 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
1018 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
1019 ffs_backup();
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1020 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1021 return (0);
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1022 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1023
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1024 #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
1025
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1026 /*------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1027 /* 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
1028 /*------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1029 /* 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
1030 /* 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
1031 /* 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
1032 /* and configuration */
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 /* 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
1035 /* 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
1036 /*------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1037 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
1038 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1039 /*
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1040 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
1041 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
1042 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
1043 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
1044 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
1045 */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1046
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1047 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
1048 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
1049 UWORD8 uIndex = 0;
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 /* *** retrieve all parameters *** */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1052 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
1053 uIndex++;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1054 aParam[0] = 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 /* 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
1057
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1058 while (s[uIndex] != '>')
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1059 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1060 if (s[uIndex] == ',')
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1061 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1062 uNParams++;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1063 aParam[uNParams] = 0;
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 else
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 /* 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
1068 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
1069 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
1070 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
1071 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
1072 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
1073 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
1074 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
1075 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
1076 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1077
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1078 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
1079 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1080
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1081 /* 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
1082 uNParams++;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1083
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1084 /* *** handle parameters *** */
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 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
1087 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
1088 */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1089 switch (aParam[0])
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 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
1092 /* 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
1093 if (uNParams >=2)
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1094 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
1095 else
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1096 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
1097 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
1098 break;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1099 default: /* ignore it */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1100 break;
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1101 } // switch
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1102 }
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1103
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1104 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1105
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1106 #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
1107 (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
1108 (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
1109 (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
1110 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1111 /* 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
1112 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1113 /* 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
1114 /* 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
1115 /* Return : */
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1116 /* 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
1117 /* 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
1118 /* 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
1119 /*-------------------------------------------------------*/
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1120 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
1121 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1122 #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
1123 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
1124 #endif
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1125 {
87fffabe4aec l1_cust.c & l1_rf12.c: initial import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents: 185
diff changeset
1126 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
1127 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
1128 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
1129 }
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 #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
1132 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
1133 #endif
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 #endif