annotate src/cs/layer1/p_cfile/l1p_ctl.c @ 488:ff91db8c9eb8

OSL: os_com_fl.c compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 22 Jun 2018 06:38:03 +0000
parents 0740b5ff15f6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
302
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /************* Revision Controle System Header *************
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * GSM Layer 1 software
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * L1P_CTL.C
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * Filename l1p_ctl.c
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * Copyright 2003 (C) Texas Instruments
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 ************* Revision Controle System Header *************/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "l1_macro.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include "l1_confg.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #if L1_GPRS
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #if (CODE_VERSION == SIMULATION)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #include <string.h>
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #include "l1_types.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #include "sys_types.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 #include "l1_const.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 #include "l1_time.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 #include "l1_signa.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 #if TESTMODE
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #include "l1tm_defty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #if (AUDIO_TASK == 1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 #include "l1audio_const.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 #include "l1audio_cust.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 #include "l1audio_signa.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #include "l1audio_defty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 #include "l1audio_msgty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #if (L1_GTT == 1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #include "l1gtt_const.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #include "l1gtt_defty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 #if (L1_MP3 == 1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #include "l1mp3_defty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 #if (L1_MIDI == 1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 #include "l1midi_defty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 #include "l1_defty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 #include "cust_os.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 #include "l1_msgty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 #include "l1_varex.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 #include "l1_proto.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 #include "l1_mftab.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 #include "l1_tabs.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 #include "l1_ver.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 #include "l1_ctl.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 #include "l1p_cons.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 #include "l1p_msgt.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 #include "l1p_deft.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 #include "l1p_vare.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 #include "l1p_sign.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 #if (OP_L1_STANDALONE == 1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 #ifdef _INLINE
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 #define INLINE static inline // Inline functions when -v option is set
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 #else // when the compiler is ivoked.
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 #define INLINE
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 #endif //0maps00090550
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 #include <string.h>
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 #include "l1_types.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 #include "sys_types.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 #include "l1_const.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 #include "l1_time.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 #include "l1_signa.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 #if (RF_FAM == 61)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 #include "tpudrv61.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 #if TESTMODE
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 #include "l1tm_defty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 #if (AUDIO_TASK == 1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 #include "l1audio_const.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 #include "l1audio_cust.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 #include "l1audio_defty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 #if (L1_GTT == 1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 #include "l1gtt_const.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 #include "l1gtt_defty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 #if (L1_MP3 == 1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 #include "l1mp3_defty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 #if (L1_MIDI == 1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 #include "l1midi_defty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 #include "l1_defty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 #include "cust_os.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 #include "l1_msgty.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 #include "l1_varex.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 #include "l1_proto.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 #include "l1_ctl.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 #include "l1p_cons.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 #include "l1p_msgt.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 #include "l1p_deft.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 #include "l1p_vare.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 #include "l1p_sign.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 #if (OP_L1_STANDALONE == 1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 #ifdef _INLINE
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 #define INLINE static inline // Inline functions when -v option is set
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 #else // when the compiler is ivoked.
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 #define INLINE
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 #endif //omaps00090550
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 #if(RF_FAM == 61)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 #include "l1_rf61.h"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 // Macro definition
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 //-----------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 #define min(value1,value2) \
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 value1 < value2 ? value1 : value2
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 // External prototypes
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 //--------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 WORD8 l1ctl_encode_delta1(UWORD16 radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 /*********************************************************/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 /* GPRS AGC Algorithms */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 /*********************************************************/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 /* l1pctl_pagc_ctrl() */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 /* Description: */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 /* =========== */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 /* Based on the same principle as the one used for PAGC */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 /* algorithm except that we also feed the beacon FIFO */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 /* with IL measured on other carriers (Pb parameter is */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 /* applied) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 /* This function is used in the control phase of PCCCH, */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 /* serving PBCCH and PTCCH reading tasks to determine */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 /* which AGC and lna_off must apply */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 /* WARNING: in the layer 1 code, input levels IL(l1) use */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 /* format 7.1: */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 /* ********************* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 /* * IL(l1) = - 2 x IL * */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 /* ********************* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 /* -> Reversed sign, reversed test conditions */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 /* -> max replaced by min */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 /* ex: if IL -120 dBm, IL(l1) = 240 */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 void l1pctl_pagc_ctrl(WORD8 *agc, UWORD8 *lna_off, UWORD16 radio_freq, UWORD8 serving_cell)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 UWORD8 pb;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 WORD16 input_level, new_calibrated_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 WORD32 freq_index;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 UWORD16 beacon_frequency;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 UWORD8 *lna_off_ptr;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 UWORD8 curve_id;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 // We memorize the LNA state used for other serving frequencies that can be used
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 // in Packet idle mode
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 static UWORD8 lna_off_others = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 if (serving_cell == TRUE)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 beacon_frequency = l1a_l1s_com.Scell_info.radio_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 pb = l1a_l1s_com.Scell_info.pb;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 lna_off_ptr = &lna_off_others;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175 curve_id = MAX_ID;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 beacon_frequency = l1pa_l1ps_com.pbcchn.bcch_carrier;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 pb = l1pa_l1ps_com.pbcchn.pb;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 lna_off_ptr = lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 curve_id = AV_ID;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 #if(L1_FF_MULTIBAND == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 freq_index = beacon_frequency - l1_config.std.radio_freq_index_offset;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 freq_index = l1_multiband_radio_freq_convert_into_operative_radio_freq(beacon_frequency);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 // If the downlink channel is decoded on the beacon frequency
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193 if (radio_freq == beacon_frequency)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 // Downlink task on the serving beacon: process AGC according to the "beacon IL"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 input_level = l1a_l1s_com.last_input_level[freq_index].input_level;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 // lna_off already processed in the read phase
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199 *lna_off = l1a_l1s_com.last_input_level[freq_index].lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
202 // If the downlink channel is decoded on a frequency other than the beacon
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 // Process AGC according to "beacon IL + Pb"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 input_level = (WORD16) (l1a_l1s_com.last_input_level[freq_index].input_level + pb);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 // IL_2_AGC_xx array size
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210 if (input_level>INDEX_MAX)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 input_level = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 // lna_off must be processed in the control phase because input_level
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 // depends on last_input_level and Pb, and last_input_level or pb can have changed
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 // at any time
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 // New calibrated IL to reach on radio freq other than beacon
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 new_calibrated_IL = (WORD16) (input_level - l1ctl_encode_delta1(radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219 - l1ctl_encode_delta2(radio_freq));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221 // IL_2_AGC_xx array size
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222 if (new_calibrated_IL>INDEX_MAX)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 new_calibrated_IL = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 // lna_off computing...
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226 l1ctl_encode_lna((UWORD8)(new_calibrated_IL>>1),
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227 lna_off_ptr,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230 *lna_off = *lna_off_ptr;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 } // End if "radio_freq != beacon_frequency"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 // Process AGC to apply
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234 *agc = Cust_get_agc_from_IL(radio_freq,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 input_level >> 1,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236 curve_id);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238 // Store lna_off and input_level field used for current CTRL in order to be able
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239 // to build IL from pm in READ phase.
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
240 l1a_l1s_com.Scell_used_IL.input_level = (UWORD8)input_level;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
241 l1a_l1s_com.Scell_used_IL.lna_off = *lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243 } // End of "l1pctl_pagc_ctrl"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
244
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246 /* l1pctl_pagc_read() */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
247 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248 /* Description : */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249 /* =========== */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 /* Based on the same principle as the one used for PAGC */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 /* algorithm except that we also feed the beacon FIFO */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252 /* with IL measured on other carriers (Pb parameter is */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 /* applied) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 /* This function is used in the read phase of PCCCH and */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255 /* serving PBCCH reading tasks to determine the IL value */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 /* store it in the FIFO and find the next IL to use */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 /* WARNING: in the layer 1 code, input levels IL(l1) use */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259 /* format 7.1: */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 /* ********************* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 /* * IL(l1) = - 2 x IL * */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262 /* ********************* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 /* -> Reversed sign, reversed test conditions */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 /* -> max replaced by min */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 /* ex: if IL -120 dBm, IL(l1) = 240 */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 UWORD8 l1pctl_pagc_read(UWORD8 pm, UWORD16 radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 UWORD8 i, new_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270 WORD8 delta1_freq, delta2_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 WORD16 delta_drp_gain=0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 UWORD16 lna_value;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 WORD16 used_agc, current_IL, new_calibrated_IL, current_calibrated_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 WORD32 serving_index;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 #if (RF_FAM == 61)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 UWORD16 arfcn;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 UWORD8 lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 UWORD16 dco_algo_ctl_pw_temp = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
280 UWORD8 if_ctl = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281 #if (RF_FAM == 61) && (CODE_VERSION != SIMULATION)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282 UWORD8 if_threshold = C_IF_ZERO_LOW_THRESHOLD_GPRS;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285 #if (L1_FF_MULTIBAND == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 serving_index = l1a_l1s_com.Scell_info.radio_freq - l1_config.std.radio_freq_index_offset;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 serving_index = l1_multiband_radio_freq_convert_into_operative_radio_freq(l1a_l1s_com.Scell_info.radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290 #endif /*if (L1_FF_MULTIBAND == 0)*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 // Calibration factors
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
294 delta1_freq = l1ctl_encode_delta1(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295 delta2_freq = l1ctl_encode_delta2(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297 // AGC used in the control phase (format F7.1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298 used_agc = (Cust_get_agc_from_IL(radio_freq, l1a_l1s_com.Scell_used_IL_dd.input_level >> 1, MAX_ID)) << 1;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 // LNA attenuation
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301 lna_value = l1a_l1s_com.Scell_used_IL_dd.lna_off * l1ctl_get_lna_att(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 #if (RF_FAM == 61)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304 // DRP correction
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 #if (L1_FF_MULTIBAND == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 arfcn = Convert_l1_radio_freq(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
307 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
308 arfcn=radio_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
309 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
310
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 #if (CODE_VERSION != SIMULATION)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313 cust_get_if_dco_ctl_algo(&dco_algo_ctl_pw_temp, &if_ctl, (UWORD8) L1_IL_VALID ,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
314 l1a_l1s_com.Scell_used_IL_dd.input_level,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
315 radio_freq,if_threshold);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316 lna_off = l1a_l1s_com.Scell_used_IL_dd.lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317 delta_drp_gain = drp_gain_correction(arfcn, lna_off, used_agc); // F7.1 format
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318 if(if_ctl == IF_100KHZ_DSP){
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
319 delta_drp_gain += SCF_ATTENUATION_LIF_100KHZ;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
320 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
321 else{ /* i.e. if_ctl = IF_120KHZ_DSP*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
322 delta_drp_gain += SCF_ATTENUATION_LIF_120KHZ;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
323 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
324
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
325 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
326 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
327
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
328 // current_IL processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
329
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
330 if (0==pm) // Check and filter illegal pm value by using last valid IL
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
331 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
332 current_IL = l1a_l1s_com.last_input_level[serving_index].input_level - lna_value;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
333 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
334 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
335 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
336 current_IL = -(pm - (used_agc - delta_drp_gain) + lna_value - l1ctl_get_g_magic(radio_freq));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
337
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
338 // IL normalization to beacon (ILnorm = IL - Pb)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
339 if (radio_freq != l1a_l1s_com.Scell_info.radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
340 current_IL -= l1a_l1s_com.Scell_info.pb;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
341 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
342
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
343 // Calibrated IL processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
344 // NOTE: calibrated_IL is normalized to beacon. This is needed for the
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
345 // pccch_lev processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
346 current_calibrated_IL = (WORD16) (current_IL - delta1_freq - delta2_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
347
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
348 // Protect IL stores against overflow
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
349 if (current_calibrated_IL>INDEX_MAX)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
350 current_calibrated_IL=INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
351 if (current_IL>INDEX_MAX)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
352 current_IL=INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
353
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
354 // FIFO management
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
355 for (i=3;i>0;i--)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
356 l1a_l1s_com.Scell_info.buff_beacon[i] = l1a_l1s_com.Scell_info.buff_beacon[i-1];
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
357 l1a_l1s_com.Scell_info.buff_beacon[0] = (UWORD8)current_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
358
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
359 // Find min IL in FIFO
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
360 new_IL = l1ctl_find_max(l1a_l1s_com.Scell_info.buff_beacon, 4);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
361
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
362 // Input levels are always stored with lna_on
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
363 new_calibrated_IL = (WORD16) (new_IL - delta1_freq - delta2_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
364
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
365 if (new_calibrated_IL>INDEX_MAX) new_calibrated_IL = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
366
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
367 l1ctl_encode_lna( (UWORD8)(new_calibrated_IL>>1),
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
368 &(l1a_l1s_com.last_input_level[serving_index].lna_off),
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
369 radio_freq );
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
370
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
371 l1a_l1s_com.last_input_level[serving_index].input_level = new_IL +
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
372 l1a_l1s_com.last_input_level[serving_index].lna_off * l1ctl_get_lna_att(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
373
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
374 return((UWORD8)current_calibrated_IL);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
375 } // End of "l1pctl_pagc_read"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
376
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
377 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
378 /* l1pctl_transfer_agc_init() */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
379 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
380 /* Description : */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
381 /* =========== */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
382 /* Packet transfer AGC algorithm initialization */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
383 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
384 void l1pctl_transfer_agc_init()
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
385 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
386 WORD16 calibrated_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
387 UWORD16 radio_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
388 WORD32 serving_index;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
389 WORD16 input_level;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
390
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
391 #if (L1_FF_MULTIBAND ==0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
392 serving_index = l1a_l1s_com.Scell_info.radio_freq - l1_config.std.radio_freq_index_offset;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
393
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
394 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
395 serving_index = l1_multiband_radio_freq_convert_into_operative_radio_freq(l1a_l1s_com.Scell_info.radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
396 #endif /*if L1_FF_MULTIBAND*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
397
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
398
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
399 // Daughter frequencies input level initialization
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
400 //------------------------------------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
401 if (l1pa_l1ps_com.transfer.aset->dl_pwr_ctl.p0 == 255)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
402 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
403 // No power control mode AGC algorithm
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
404 input_level = (WORD16) (l1a_l1s_com.last_input_level[serving_index].input_level + l1a_l1s_com.Scell_info.pb);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
405
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
406 // Set fn_select to current_fn
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
407 l1ps.fn_select = l1s.actual_time.fn;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
408 // Initialize algorithm in "SEARCH" phase
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
409 l1ps.phase = SEARCH;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
410 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
411 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
412 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
413 // Downlink power control AGC algorithms
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
414 if (l1pa_l1ps_com.transfer.aset->dl_pwr_ctl.bts_pwr_ctl_mode == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
415 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
416 // BTS Power control mode A
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
417 input_level = (WORD16) (l1a_l1s_com.last_input_level[serving_index].input_level +
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
418 l1pa_l1ps_com.transfer.aset->dl_pwr_ctl.p0 + 10);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
419
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
420 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
421 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
422 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
423 // BTS power control mode B
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
424 input_level = (WORD16) (l1a_l1s_com.last_input_level[serving_index].input_level +
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
425 l1pa_l1ps_com.transfer.aset->dl_pwr_ctl.p0);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
426
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
427 // Initialization: PR = P0
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
428 l1ps.last_PR_good = l1pa_l1ps_com.transfer.aset->dl_pwr_ctl.p0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
429 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
430 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
431
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
432 if (input_level>INDEX_MAX) input_level = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
433 l1a_l1s_com.Scell_info.transfer_meas.input_level = (UWORD8)input_level;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
434
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
435
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
436 // Daughter frequencies lna_off processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
437 //----------------------------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
438
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
439 // We need to know on which frequency band we work
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
440 if (!l1pa_l1ps_com.transfer.aset->freq_param.chan_sel.h)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
441 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
442 // Single frequency
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
443 radio_freq = l1pa_l1ps_com.transfer.aset->freq_param.chan_sel.rf_channel.single_rf.radio_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
444 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
445 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
446 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
447 // Frequency hopping: all frequencies of the frequency list are on the same band
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
448 // We take the first frequency of the list
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
449 radio_freq = l1pa_l1ps_com.transfer.aset->freq_param.freq_list.rf_chan_no.A[0];
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
450 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
451
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
452 calibrated_IL = (WORD16) (l1a_l1s_com.Scell_info.transfer_meas.input_level
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
453 - l1ctl_encode_delta1(radio_freq) - l1ctl_encode_delta2(radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
454 - l1a_l1s_com.last_input_level[serving_index].lna_off * l1ctl_get_lna_att(radio_freq));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
455
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
456 if (calibrated_IL>INDEX_MAX) calibrated_IL = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
457
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
458 l1ctl_encode_lna((UWORD8)(calibrated_IL>>1), &(l1a_l1s_com.Scell_info.transfer_meas.lna_off), radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
459
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
460 } // End of "l1pctl_transfer_agc_init"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
461
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
462 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
463 /* l1pctl_transfer_agc_ctrl() */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
464 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
465 /* Description : */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
466 /* =========== */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
467 /* This function is used in the control phase of PDTCH/D */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
468 /* to determine which AGC and lna_off must apply */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
469 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
470 void l1pctl_transfer_agc_ctrl(WORD8 *agc, UWORD8 *lna_off, UWORD16 radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
471 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
472 T_INPUT_LEVEL *selected_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
473 #if(L1_FF_MULTIBAND == 1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
474 UWORD16 operative_radio_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
475 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
476
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
477
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
478 // input_level selection
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
479 if (radio_freq == l1a_l1s_com.Scell_info.radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
480 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
481 // Beacon frequency input_level used for AGC processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
482 #if(L1_FF_MULTIBAND == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
483 selected_IL = &l1a_l1s_com.last_input_level[l1a_l1s_com.Scell_info.radio_freq
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
484 - l1_config.std.radio_freq_index_offset];
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
485
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
486 #else // L1_FF_MULTIBAND = 1 below
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
487
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
488 operative_radio_freq =
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
489 l1_multiband_radio_freq_convert_into_operative_radio_freq(l1a_l1s_com.Scell_info.radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
490 selected_IL = &(l1a_l1s_com.last_input_level[operative_radio_freq]);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
491
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
492
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
493 #endif // #if(L1_FF_MULTIBAND == 0) else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
494
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
495 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
496 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
497 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
498 // Daughter frequency input_level used for AGC processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
499 selected_IL = &l1a_l1s_com.Scell_info.transfer_meas;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
500 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
501 *agc = Cust_get_agc_from_IL(radio_freq,selected_IL->input_level >> 1, MAX_ID);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
502 *lna_off = selected_IL->lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
503
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
504 // Store lna_off and input_level field used for current CTRL in order to be able
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
505 // to build IL from pm in READ phase.
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
506 l1a_l1s_com.Scell_used_IL.input_level = selected_IL->input_level;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
507 l1a_l1s_com.Scell_used_IL.lna_off = *lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
508
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
509 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
510
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
511 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
512 /* l1pctl_npc_agc_read() */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
513 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
514 /* Description : */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
515 /* =========== */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
516 /* AGC algorithm in packet transfer used when */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
517 /* NO POWER CONTROL is done by the BTS. */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
518 /* This function is used during the read phase of PDTCH: */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
519 /* 1- to determine the IL value for each timeslot in each*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
520 /* TDMA */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
521 /* 2- to find the IL value to use for the next PDCH */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
522 /* block */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
523 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
524 /* Algorithm */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
525 /* --------- */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
526 /* For each timeslot i used for PDCH */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
527 /* IL(i) = fct(used AGC, pm) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
528 /* if (beacon) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
529 /* ILmax_beacon = max(ILmax_beacon, IL(i)) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
530 /* else */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
531 /* ILmax_others(i) = max(IL(i), ILmax_others(i)) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
532 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
533 /* If (burst_nb == 3) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
534 /* If (ILmax_beacon was found during the block) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
535 /* FIFO[beacon] updated with ILmax_beacon */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
536 /* transfer_meas = max(FIFO[beacon]) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
537 /* Reset ILmax_beacon */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
538 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
539 /* For each timeslot i used for PDCH */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
540 /* if (CRC good) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
541 /* ILmax_correct = max(ILmax_correct, */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
542 /* ILmax_others(i)) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
543 /* else */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
544 /* ILmax_not_correct = max(ILmax_not_correct, */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
545 /* ILmax_others(i)) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
546 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
547 /* If (no ILmax_correct was found) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
548 /* ILselected = ILmax_correct */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
549 /* FNselected = current FN */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
550 /* else */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
551 /* DeltaFN = (current FN - FNselected) % MAX_FN */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
552 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
553 /* if (DeltaFN < 78) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
554 /* ILweighted = ILselected * (1 - DeltaFN/78) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
555 /* - 120 * DeltaFN /78 */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
556 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
557 /* if (ILweighted < -120) ILweighted = -120 */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
558 /* if (ILmax_not_correct > ILweighted) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
559 /* ILselected = ILmax_not_correct */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
560 /* FNselected = current FN */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
561 /* else */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
562 /* ILselected = -120 */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
563 /* FNselected = current FN */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
564 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
565 /* Reset ILmax_others[8] */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
566 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
567 /* WARNING: in the layer 1 code, input levels IL(l1) use */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
568 /* format 7.1: */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
569 /* ********************* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
570 /* * IL(l1) = - 2 x IL * */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
571 /* ********************* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
572 /* -> Reversed sign, reversed test conditions */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
573 /* -> max replaced by min */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
574 /* ex: if IL -120 dBm, IL(l1) = 240 */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
575 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
576 /* Parameters */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
577 /* ---------- */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
578 /* "calibrated_IL[8]" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
579 /* contains the IL found on timeslots */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
580 /* used for PDCH/D. These ILs can be used to process */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
581 /* RXLEV values. */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
582 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
583 /* "*pdsp_db_r_ptr" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
584 /* Pointer on the DSP DB Read page, used to extract */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
585 /* pm values, burst number and timeslot allocated */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
586 /* for downlink PDCH */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
587 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
588 /* "*pdsp_ndb_ptr" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
589 /* Pointer on the DSP NDB page, used to extract the */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
590 /* CRC value for each decoded burst */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
591 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
592 /* Global parameters */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
593 /* ----------------- */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
594 /* "l1a_l1s_com.Scell_info.transfer_meas.input_level" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
595 /* "l1a_l1s_com.Scell_info.transfer_meas.lna_off" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
596 /* Used to store the ILselected and the associated */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
597 /* lna_off value. */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
598 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
599 /* "l1a_l1s_com.Scell_info.fn_select" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
600 /* Used to store the FNselected value. */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
601 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
602 /* "l1a_l1s_com.last_input_level[freq index] */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
603 /* .input_level */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
604 /* .lna_off" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
605 /* Used to store the beacon input level and */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
606 /* the associated lna_off value. */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
607 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
608 /* "l1ps.transfer_beacon_buf[4]" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
609 /* FIFO[beacon] */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
610 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
611 /* "l1ps.ILmin_beacon" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
612 /* "l1ps.ILmin_others[8]" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
613 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
614 void l1pctl_npc_agc_read(UWORD8 calibrated_IL[8], T_DB_DSP_TO_MCU_GPRS *pdsp_db_r_ptr,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
615 T_NDB_MCU_DSP_GPRS *pdsp_ndb_ptr)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
616 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
617 UWORD8 ts;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
618 UWORD8 rx_no = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
619 UWORD8 bit_mask = 0x80;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
620 UWORD8 ILmin_correct = 255;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
621 UWORD8 ILmin_not_correct = 255;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
622 WORD8 delta1_freq, delta2_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
623 WORD16 delta_drp_gain=0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
624 UWORD16 radio_freq, lna_value;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
625 WORD16 used_agc;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
626 WORD32 serving_index;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
627 #if (RF_FAM == 61)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
628 UWORD16 arfcn;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
629 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
630 UWORD8 lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
631 UWORD16 dco_algo_ctl_pw_temp = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
632 UWORD8 if_ctl = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
633 #if (RF_FAM == 61) && (CODE_VERSION != SIMULATION)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
634 UWORD8 if_threshold = C_IF_ZERO_LOW_THRESHOLD_GPRS;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
635 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
636
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
637 #if(L1_FF_MULTIBAND == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
638 serving_index = l1a_l1s_com.Scell_info.radio_freq - l1_config.std.radio_freq_index_offset;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
639
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
640 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
641 serving_index = l1_multiband_radio_freq_convert_into_operative_radio_freq(l1a_l1s_com.Scell_info.radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
642 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
643
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
644
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
645 // Control phase parameters: same AGC, radio_freq, lna_off used for all PDTCH
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
646 // ***************************************************************************
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
647
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
648 // Get radio_freq on which the downlink block was received
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
649 radio_freq = l1a_l1s_com.dedic_set.radio_freq_dd;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
650
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
651 // Compute calibration factors
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
652 delta1_freq = l1ctl_encode_delta1(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
653 delta2_freq = l1ctl_encode_delta2(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
654
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
655 // AGC used in the control phase (format F7.1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
656 used_agc = (Cust_get_agc_from_IL(radio_freq, l1a_l1s_com.Scell_used_IL_dd.input_level >> 1, MAX_ID)) << 1;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
657
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
658 // LNA attenuation
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
659 lna_value = l1a_l1s_com.Scell_used_IL_dd.lna_off * l1ctl_get_lna_att(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
660
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
661 // Burst 0: Reset ILmin_beacon and ILmin_others
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
662 if(pdsp_db_r_ptr->d_burst_nb_gprs == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
663 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
664 l1ps.ILmin_beacon = 255; // Not valid
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
665
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
666 for (ts = 0; ts < 8; ts++)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
667 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
668 l1ps.ILmin_others[ts] = (UWORD8) l1_config.params.il_min;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
669 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
670 } // End if "burst 0"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
671
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
672 // IL processing for each received burst
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
673 // **************************************
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
674
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
675 // For each timeslot on which a burst was received
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
676 for(ts = 0; ts < 8; ts ++)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
677 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
678 if(pdsp_db_r_ptr->d_task_d_gprs & bit_mask)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
679 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
680 WORD16 current_IL, current_calibrated_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
681 UWORD8 pm;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
682
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
683 // IL = fct(pm, last_known_agc, lna_value, g_magic)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
684 //-------------------------------------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
685
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
686 pm = (UWORD8) ((pdsp_db_r_ptr->a_burst_pm_gprs[ts] & 0xffff) >> 5);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
687
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
688 // current_IL processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
689 if (0==pm) // Check and filter illegal pm value by using last valid IL
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
690 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
691 if (radio_freq == l1a_l1s_com.Scell_info.radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
692 current_IL = l1a_l1s_com.last_input_level[serving_index].input_level
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
693 - lna_value;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
694 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
695 current_IL = l1a_l1s_com.Scell_info.transfer_meas.input_level
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
696 - lna_value;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
697 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
698 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
699 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
700
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
701 #if (RF_FAM == 61)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
702 // DRP correction
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
703 #if (L1_FF_MULTIBAND == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
704 arfcn = Convert_l1_radio_freq(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
705 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
706 arfcn=radio_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
707 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
708
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
709 #if (CODE_VERSION != SIMULATION)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
710
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
711 cust_get_if_dco_ctl_algo(&dco_algo_ctl_pw_temp, &if_ctl, (UWORD8) L1_IL_VALID ,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
712 l1a_l1s_com.Scell_used_IL_dd.input_level,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
713 radio_freq,if_threshold);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
714 lna_off = l1a_l1s_com.Scell_used_IL_dd.lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
715 delta_drp_gain = drp_gain_correction(arfcn, lna_off, used_agc); // F7.1 format
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
716 if(if_ctl == IF_100KHZ_DSP){
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
717 delta_drp_gain += SCF_ATTENUATION_LIF_100KHZ;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
718 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
719 else{ /* i.e. if_ctl = IF_120KHZ_DSP*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
720 delta_drp_gain += SCF_ATTENUATION_LIF_120KHZ;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
721 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
722
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
723 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
724 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
725
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
726 current_IL = -(pm - (used_agc - delta_drp_gain) + lna_value - l1ctl_get_g_magic(radio_freq));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
727 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
728
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
729 // Calibrated IL processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
730 current_calibrated_IL = current_IL - delta1_freq - delta2_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
731
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
732 // Protect IL stores against overflow
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
733 if(current_calibrated_IL>INDEX_MAX)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
734 current_calibrated_IL=INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
735 if (current_IL>INDEX_MAX)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
736 current_IL=INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
737
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
738 calibrated_IL[ts] = (UWORD8)(current_calibrated_IL);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
739
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
740 // Keep ILmax
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
741 if (radio_freq == l1a_l1s_com.Scell_info.radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
742 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
743 // Beacon frequency
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
744 l1ps.ILmin_beacon = min((UWORD8) current_IL, l1ps.ILmin_beacon);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
745 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
746 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
747 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
748 // Daughter frequency
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
749 l1ps.ILmin_others[ts] = min((UWORD8) current_IL,l1ps.ILmin_others[ts]);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
750 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
751
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
752 // Input Level selection among ILmax found on each timeslot during the block (when burst = 3)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
753 // *******************************************************************************************
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
754
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
755 if(pdsp_db_r_ptr->d_burst_nb_gprs == 3)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
756 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
757 // If CRC good
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
758 if (!(pdsp_ndb_ptr->a_dd_gprs[rx_no][0] & 0x0100))
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
759 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
760 // Find the min found IL for blocks that were correctly received
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
761 ILmin_correct = min(l1ps.ILmin_others[ts],ILmin_correct);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
762 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
763 // If CRC bad
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
764 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
765 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
766 // Find the min found IL for blocks that were not correctly received
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
767 ILmin_not_correct = min(l1ps.ILmin_others[ts],ILmin_not_correct);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
768 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
769 } // End if "burst = 3"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
770
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
771 // Next downlink block
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
772 rx_no ++;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
773
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
774 } // End if "timeslot used for downlink PDCH"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
775
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
776 // Next timeslot
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
777 bit_mask >>= 1;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
778 } // End for "each timeslot...."
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
779
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
780
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
781 // IL selection for the next block if burst = 3
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
782 // **********************************************
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
783
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
784 if(pdsp_db_r_ptr->d_burst_nb_gprs == 3)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
785 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
786 WORD16 new_calibrated_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
787
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
788 // Beacon frequency input level updating
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
789 //--------------------------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
790
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
791 // If a PDCH has been received on the beacon
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
792 if (l1ps.ILmin_beacon != 255)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
793 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
794 UWORD8 i, new_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
795
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
796 // FIFO management
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
797 for (i=3;i>0;i--)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
798 l1a_l1s_com.Scell_info.buff_beacon[i] = l1a_l1s_com.Scell_info.buff_beacon[i-1];
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
799 l1a_l1s_com.Scell_info.buff_beacon[0] = l1ps.ILmin_beacon;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
800
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
801 // Find min IL in FIFO
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
802 new_IL = l1ctl_find_max(l1a_l1s_com.Scell_info.buff_beacon, 4);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
803
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
804 // Input levels are always stored with lna_on
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
805
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
806 // lna_off processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
807 new_calibrated_IL = (WORD16) (new_IL - l1ctl_encode_delta1(l1a_l1s_com.Scell_info.radio_freq) - l1ctl_encode_delta2(l1a_l1s_com.Scell_info.radio_freq));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
808
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
809 if (new_calibrated_IL>INDEX_MAX) new_calibrated_IL = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
810
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
811 l1ctl_encode_lna((UWORD8)(new_calibrated_IL>>1),
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
812 &(l1a_l1s_com.last_input_level[serving_index].lna_off),
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
813 l1a_l1s_com.Scell_info.radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
814
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
815 l1a_l1s_com.last_input_level[serving_index].input_level = new_IL +
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
816 l1a_l1s_com.last_input_level[serving_index].lna_off *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
817 l1ctl_get_lna_att(l1a_l1s_com.Scell_info.radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
818
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
819 } // End of "beacon frequency input level updating"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
820
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
821 // Daughter frequencies input level updating
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
822 //------------------------------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
823
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
824 // If at least one block was correctly received
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
825 // (Note: ILs truncated to 240 so 255 isn't valid)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
826 if (ILmin_correct != 255)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
827 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
828 // Select the min input level found on correctly received blocks
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
829 l1a_l1s_com.Scell_info.transfer_meas.input_level = ILmin_correct;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
830 l1ps.fn_select = l1s.actual_time.fn;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
831
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
832 // Algorithm switch to "TRACK" phase if it was in "SEARCH" phase
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
833 l1ps.phase = TRACK;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
834 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
835
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
836 // No block was correctly received
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
837 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
838 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
839 UWORD8 input_level_ref = l1a_l1s_com.Scell_info.transfer_meas.input_level
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
840 - l1a_l1s_com.Scell_info.transfer_meas.lna_off *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
841 l1ctl_get_lna_att(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
842 // SEARCH phase
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
843 if (l1ps.phase == SEARCH)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
844 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
845 // If measured level superior to currently tracket level, switch to TRACK mode
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
846 if (input_level_ref > ILmin_not_correct)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
847 l1ps.phase = TRACK;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
848
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
849 // Select the min input level found on badly received blocks
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
850 l1a_l1s_com.Scell_info.transfer_meas.input_level = ILmin_not_correct;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
851 l1ps.fn_select = l1s.actual_time.fn;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
852 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
853
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
854 // TRACK phase
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
855 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
856 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
857 // If the IL found on incorrect block is lower than current wanted IL
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
858 if (ILmin_not_correct < input_level_ref)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
859 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
860 // Select the new IL
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
861 l1a_l1s_com.Scell_info.transfer_meas.input_level = ILmin_not_correct;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
862 l1ps.fn_select = l1s.actual_time.fn;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
863 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
864
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
865 // If the IL found on incorrect block is higher than current wanted IL
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
866 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
867 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
868 UWORD32 delta_fn;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
869
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
870 // delta_fn processing for IL selection forgetting factor
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
871 delta_fn = l1s.actual_time.fn - l1ps.fn_select;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
872
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
873 // MAX_FN modulo management
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
874 if (l1s.actual_time.fn < l1ps.fn_select)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
875 delta_fn += MAX_FN;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
876
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
877 // If the last selected IL is more recent than 72 frames
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
878 //
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
879 // |....|R...............................C|....|
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
880 // ^ ^
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
881 // fn_selected IL reset to -120
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
882 // <-------------------------------------->
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
883 // 312
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
884 // 306 = 312 - 4 (block_size) - 1 (Read phase fn delay) - 1 (Control phase fn advance)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
885 if (delta_fn > 306)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
886 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
887 WORD16 input_level;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
888
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
889 // IL initialized to "beacon level - Pb"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
890 input_level = (WORD16)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
891 ((l1a_l1s_com.last_input_level[serving_index].input_level +
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
892 l1a_l1s_com.Scell_info.pb) -
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
893 (l1a_l1s_com.last_input_level[serving_index].lna_off *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
894 l1ctl_get_lna_att(l1a_l1s_com.Scell_info.radio_freq)));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
895
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
896 if (input_level>INDEX_MAX) input_level = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
897 l1a_l1s_com.Scell_info.transfer_meas.input_level = (UWORD8)input_level;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
898
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
899 l1ps.fn_select = l1s.actual_time.fn;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
900 // Returns to "SEARCH" phase
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
901 l1ps.phase = SEARCH;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
902 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
903 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
904 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
905 WORD16 input_level;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
906
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
907 input_level = l1a_l1s_com.Scell_info.transfer_meas.input_level -
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
908 l1a_l1s_com.Scell_info.transfer_meas.lna_off *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
909 l1ctl_get_lna_att(l1ps.read_param.radio_freq_for_lna);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
910
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
911 if (input_level>INDEX_MAX) input_level = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
912
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
913 l1a_l1s_com.Scell_info.transfer_meas.input_level = (UWORD8)input_level;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
914 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
915 } // End if the IL found on incorrect block is higher than current wanted IL
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
916 } // End of "track phase"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
917 } // End if no block correctly received
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
918
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
919 // lna_off processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
920 new_calibrated_IL = (WORD16) (l1a_l1s_com.Scell_info.transfer_meas.input_level - l1ctl_encode_delta1(l1ps.read_param.radio_freq_for_lna));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
921 if (new_calibrated_IL>INDEX_MAX) new_calibrated_IL = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
922
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
923 l1ctl_encode_lna((UWORD8)(new_calibrated_IL>>1), &(l1a_l1s_com.Scell_info.transfer_meas.lna_off), l1ps.read_param.radio_freq_for_lna);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
924
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
925 l1a_l1s_com.Scell_info.transfer_meas.input_level +=
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
926 l1a_l1s_com.Scell_info.transfer_meas.lna_off *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
927 l1ctl_get_lna_att(l1ps.read_param.radio_freq_for_lna);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
928 } // End if "burst = 3"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
929
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
930 } // End of "l1pctl_npc_agc_read"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
931
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
932 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
933 /* l1pctl_dpcma_agc_read() */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
934 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
935 /* Description : */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
936 /* =========== */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
937 /* AGC algorithm in packet transfer used when the BTS */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
938 /* use DOWNLINK POWER CONTROL mode A. */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
939 /* This function is used during the read phase of PDTCH: */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
940 /* 1- to determine the IL value for each timeslot in each*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
941 /* TDMA */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
942 /* 2- to find the IL value to use for the next PDCH */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
943 /* block */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
944 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
945 /* Algorithm */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
946 /* --------- */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
947 /* For each timeslot i used for PDCH */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
948 /* IL(i) = fct(used AGC, pm) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
949 /* if (beacon) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
950 /* ILmax_beacon = max(ILmax_beacon, IL(i)) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
951 /* else */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
952 /* ILmax_others(i) = max(IL(i), ILmax_others(i)) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
953 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
954 /* If (burst_nb == 3) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
955 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
956 /* For each timeslot i used for PDCH */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
957 /* if (CRC good) and */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
958 /* ((PR_MODE A) or (PR_MODE B and TFI good)) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
959 /* ILmax = max(ILmax, ILmax_others(i) + P0 + PR(i))*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
960 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
961 /* ILmax=max(ILmax, ILmax_beacon) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
962 /* FIFO[beacon] updated with ILmax */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
963 /* last_input_level[serving beacon] = max(FIFO[beacon])*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
964 /* transfer_meas = max(FIFO[beacon]) - P0 - 5 */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
965 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
966 /* Reset ILmax_others[8] and ILmax_beacon */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
967 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
968 /* WARNING: in the layer 1 code, input levels IL(l1) use */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
969 /* format 7.1: */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
970 /* ********************* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
971 /* * IL(l1) = - 2 x IL * */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
972 /* ********************* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
973 /* -> Reversed sign, reversed test conditions */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
974 /* -> max replaced by min */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
975 /* ex: if IL -120 dBm, IL(l1) = 240 */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
976 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
977 /* Parameters */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
978 /* ---------- */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
979 /* "calibrated_IL[8]" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
980 /* contains the IL found on timeslots */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
981 /* used for PDCH/D. These ILs can be used to process */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
982 /* RXLEV values. */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
983 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
984 /* "*pdsp_db_r_ptr" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
985 /* Pointer on the DSP DB Read page, used to extract */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
986 /* pm values, burst number and timeslot allocated */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
987 /* for downlink PDCH */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
988 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
989 /* "*pdsp_ndb_ptr" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
990 /* Pointer on the DSP NDB page, used to extract the */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
991 /* CRC value for each decoded burst */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
992 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
993 /* Global parameters */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
994 /* ----------------- */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
995 /* "l1a_l1s_com.Scell_info.transfer_meas.input_level" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
996 /* "l1a_l1s_com.Scell_info.transfer_meas.lna_off" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
997 /* Used to store the ILselected and the associated */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
998 /* lna_off value. */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
999 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1000 /* "l1a_l1s_com.last_input_level[freq. index] */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1001 /* .input_level */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1002 /* .lna_off" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1003 /* Used to store the beacon input level and */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1004 /* the associated lna_off value. */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1005 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1006 /* "l1ps.transfer_beacon_buf[4]" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1007 /* FIFO[beacon] */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1008 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1009 /* "l1ps.ILmin_beacon" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1010 /* "l1ps.ILmin_others[8]" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1011 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1012 void l1pctl_dpcma_agc_read(UWORD8 calibrated_IL[8], T_DB_DSP_TO_MCU_GPRS *pdsp_db_r_ptr,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1013 T_NDB_MCU_DSP_GPRS *pdsp_ndb_ptr, UWORD8 pr_table[8])
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1014 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1015 UWORD8 ts = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1016 UWORD8 rx_no = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1017 UWORD8 bit_mask = 0x80;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1018 UWORD8 IL_norm_min = 255;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1019 WORD8 delta1_freq, delta2_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1020 WORD16 delta_drp_gain=0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1021 UWORD16 radio_freq, lna_value;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1022 WORD16 used_agc;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1023 WORD32 serving_index;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1024 #if (RF_FAM == 61)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1025 UWORD16 arfcn;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1026 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1027 UWORD8 lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1028 UWORD16 dco_algo_ctl_pw_temp = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1029 UWORD8 if_ctl = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1030 #if (RF_FAM == 61) && (CODE_VERSION != SIMULATION)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1031 UWORD8 if_threshold = C_IF_ZERO_LOW_THRESHOLD_GPRS;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1032 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1033
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1034 #if(L1_FF_MULTIBAND == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1035 serving_index = l1a_l1s_com.Scell_info.radio_freq - l1_config.std.radio_freq_index_offset;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1036
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1037 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1038 serving_index = l1_multiband_radio_freq_convert_into_operative_radio_freq(l1a_l1s_com.Scell_info.radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1039 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1040
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1041
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1042 // Control phase parameters: same AGC, radio_freq, lna_off used for all PDTCH
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1043 // ***************************************************************************
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1044
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1045 // Get radio_freq on which the downlink block was received
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1046 radio_freq = l1a_l1s_com.dedic_set.radio_freq_dd;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1047
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1048 // Compute calibration factors
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1049 delta1_freq = l1ctl_encode_delta1(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1050 delta2_freq = l1ctl_encode_delta2(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1051
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1052 // Last known AGC (format F7.1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1053 used_agc = (Cust_get_agc_from_IL(radio_freq, l1a_l1s_com.Scell_used_IL_dd.input_level >> 1, MAX_ID)) << 1;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1054
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1055 // LNA attenuation
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1056 lna_value = l1a_l1s_com.Scell_used_IL_dd.lna_off * l1ctl_get_lna_att(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1057
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1058 // Burst 0: Reset ILmin_beacon and ILmin_others
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1059 if(pdsp_db_r_ptr->d_burst_nb_gprs == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1060 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1061 l1ps.ILmin_beacon = 255; // Not valid
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1062
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1063 for (ts = 0; ts < 8; ts++)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1064 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1065 l1ps.ILmin_others[ts] = 255; // Not valid
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1066 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1067 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1068
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1069 // IL processing for each received burst
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1070 // **************************************
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1071
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1072 #if (RF_FAM == 61)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1073 // DRP correction
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1074 #if (L1_FF_MULTIBAND == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1075 arfcn = Convert_l1_radio_freq(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1076 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1077 arfcn=radio_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1078 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1079
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1080 #if (CODE_VERSION != SIMULATION)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1081
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1082 cust_get_if_dco_ctl_algo(&dco_algo_ctl_pw_temp, &if_ctl, (UWORD8) L1_IL_VALID ,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1083 l1a_l1s_com.Scell_used_IL_dd.input_level,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1084 radio_freq, if_threshold);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1085 lna_off = l1a_l1s_com.Scell_used_IL_dd.lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1086 delta_drp_gain = drp_gain_correction(arfcn, lna_off, used_agc); // F7.1 format
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1087
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1088 if(if_ctl == IF_100KHZ_DSP){
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1089 delta_drp_gain += SCF_ATTENUATION_LIF_100KHZ;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1090 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1091 else{ /* i.e. if_ctl = IF_120KHZ_DSP*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1092 delta_drp_gain += SCF_ATTENUATION_LIF_120KHZ;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1093 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1094
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1095 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1096 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1097
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1098 // For each timeslot on which a burst was received
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1099 for(ts = 0; ts < 8; ts ++)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1100 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1101 if(pdsp_db_r_ptr->d_task_d_gprs & bit_mask)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1102 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1103 WORD16 current_IL, current_calibrated_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1104 UWORD8 pm;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1105
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1106 // IL = fct(pm, last_known_agc, lna_value, g_magic)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1107 //-------------------------------------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1108
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1109 pm = (UWORD8) ((pdsp_db_r_ptr->a_burst_pm_gprs[ts] & 0xffff) >> 5);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1110
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1111 // current_IL processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1112 if (0==pm) // Check and filter illegal pm value by using last valid IL
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1113 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1114 current_IL = l1a_l1s_com.last_input_level[serving_index].input_level
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1115 - lna_value;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1116
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1117 if (radio_freq != l1a_l1s_com.Scell_info.radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1118 current_IL += (l1ps.read_param.dl_pwr_ctl.p0 + 10);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1119 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1120 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1121 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1122 current_IL = -(pm - (used_agc - delta_drp_gain) + lna_value - l1ctl_get_g_magic(radio_freq));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1123 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1124
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1125 // Calibrated IL processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1126 current_calibrated_IL = current_IL - delta1_freq - delta2_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1127
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1128 // Protect IL stores against overflow
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1129 if(current_calibrated_IL>INDEX_MAX)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1130 current_calibrated_IL=INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1131 if (current_IL>INDEX_MAX)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1132 current_IL=INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1133
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1134 calibrated_IL[ts] = (UWORD8)(current_calibrated_IL);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1135
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1136 // Keep the minimum IL
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1137 if (radio_freq == l1a_l1s_com.Scell_info.radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1138 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1139 // Beacon frequency
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1140 l1ps.ILmin_beacon = min((UWORD8) current_IL,l1ps.ILmin_beacon);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1141 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1142 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1143 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1144 // Daughter frequency
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1145 l1ps.ILmin_others[ts] = min((UWORD8) current_IL, l1ps.ILmin_others[ts]);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1146 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1147
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1148 // Input Level selection among ILmax found on each timeslot during the block (when burst = 3)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1149 //-------------------------------------------------------------------------------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1150
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1151 if(pdsp_db_r_ptr->d_burst_nb_gprs == 3)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1152 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1153 // If CRC good
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1154 if (!(pdsp_ndb_ptr->a_dd_gprs[rx_no][0] & 0x0100))
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1155 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1156 // If ((PR_MODE A and TFI good) or (PR_MODE B)) AND PR != 0 [Not usable])
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1157 if (((l1ps.read_param.dl_pwr_ctl.pr_mode != 0) || (!(pr_table[ts] & 0x80)))
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1158 && ((pr_table[ts] & 0x1f) != 0))
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1159 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1160 if (l1ps.ILmin_others[ts] != 255)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1161 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1162 UWORD8 IL_norm;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1163
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1164 // IL normalization to beacon (ILnorm = ILmax_others(ts) - P0 - PR)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1165 IL_norm = l1ps.ILmin_others[ts] - l1ps.read_param.dl_pwr_ctl.p0 - ((pr_table[ts] & 0x1f) << 1);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1166
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1167 // Update IL_min with the minimum found IL
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1168 IL_norm_min = min(IL_norm, IL_norm_min);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1169 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1170 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1171 } // End if "CRC good"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1172
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1173 } // End if "burst = 3"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1174
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1175 // Next downlink block
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1176 rx_no ++;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1177
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1178 } // End if "timeslot used for downlink PDCH"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1179
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1180 // Next timeslot
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1181 bit_mask >>= 1;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1182
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1183 } // End for "each timeslot...."
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1184
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1185
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1186 // IL selection for the next block if burst = 3
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1187 // **********************************************
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1188
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1189 if(pdsp_db_r_ptr->d_burst_nb_gprs == 3)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1190 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1191 UWORD8 i, new_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1192 UWORD16 input_level;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1193 WORD16 new_calibrated_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1194
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1195 // Select the minimum IL between minimum IL found on daughter frequencies (normalized to beacon)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1196 // and minimum IL found on the beacon
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1197 IL_norm_min = min(IL_norm_min, l1ps.ILmin_beacon);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1198
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1199 // If a valid IL has been found
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1200 if (IL_norm_min != 255)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1201 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1202 // FIFO management
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1203 for (i=3;i>0;i--)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1204 l1a_l1s_com.Scell_info.buff_beacon[i] = l1a_l1s_com.Scell_info.buff_beacon[i-1];
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1205
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1206 l1a_l1s_com.Scell_info.buff_beacon[0] = IL_norm_min;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1207
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1208 // last_input_level[serving beacon] updating
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1209 //------------------------------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1210
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1211 // Find min IL in FIFO
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1212 new_IL = l1ctl_find_max(l1a_l1s_com.Scell_info.buff_beacon,4);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1213
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1214 // Input levels are always stored with lna_on
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1215
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1216 // lna_off processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1217 new_calibrated_IL = (WORD16) (new_IL - l1ctl_encode_delta1(l1a_l1s_com.Scell_info.radio_freq) - l1ctl_encode_delta2(l1a_l1s_com.Scell_info.radio_freq));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1218 if (new_calibrated_IL>INDEX_MAX) new_calibrated_IL = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1219
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1220 l1ctl_encode_lna((UWORD8)(new_calibrated_IL >> 1),
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1221 &(l1a_l1s_com.last_input_level[serving_index].lna_off),
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1222 l1a_l1s_com.Scell_info.radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1223
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1224 l1a_l1s_com.last_input_level[serving_index].input_level = new_IL +
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1225 l1a_l1s_com.last_input_level[serving_index].lna_off *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1226 l1ctl_get_lna_att(l1a_l1s_com.Scell_info.radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1227 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1228
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1229 // transfer_meas updating
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1230 //-----------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1231
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1232 // IL = (min IL in FIFO) + P0 + 10 (PR = 5 format 7.1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1233 // Input levels are always stored with lna_on
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1234 input_level = l1a_l1s_com.last_input_level[serving_index].input_level
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1235 - l1a_l1s_com.last_input_level[serving_index].lna_off *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1236 l1ctl_get_lna_att(l1a_l1s_com.Scell_info.radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1237 + l1ps.read_param.dl_pwr_ctl.p0 + 10;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1238
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1239 // IL_2_AGC_xx array size
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1240 if (input_level>INDEX_MAX) input_level = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1241
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1242 // lna_off processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1243 new_calibrated_IL = (WORD16) (input_level - l1ctl_encode_delta1(l1ps.read_param.radio_freq_for_lna));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1244
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1245 if (new_calibrated_IL>INDEX_MAX) new_calibrated_IL = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1246
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1247 l1ctl_encode_lna((UWORD8)(new_calibrated_IL>>1), &(l1a_l1s_com.Scell_info.transfer_meas.lna_off), l1ps.read_param.radio_freq_for_lna);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1248
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1249 l1a_l1s_com.Scell_info.transfer_meas.input_level = input_level +
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1250 l1a_l1s_com.Scell_info.transfer_meas.lna_off *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1251 l1ctl_get_lna_att(l1ps.read_param.radio_freq_for_lna);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1252 } // End if "burst = 3"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1253
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1254 } // End of "l1pctl_dpcma_agc_read"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1255
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1256 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1257 /* l1pctl_dpcmb_agc_read() */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1258 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1259 /* Description : */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1260 /* =========== */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1261 /* AGC algorithm in packet transfer used when the BTS */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1262 /* use DOWNLINK POWER CONTROL mode B. */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1263 /* This function is used during the read phase of PDTCH: */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1264 /* 1- to determine the IL value for each timeslot in each*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1265 /* TDMA */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1266 /* 2- to find the IL value to use for the next PDCH */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1267 /* block */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1268 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1269 /* Algorithm */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1270 /* --------- */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1271 /* For each timeslot i used for PDCH */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1272 /* IL(i) = fct(used AGC, pm) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1273 /* if (beacon) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1274 /* ILmax_beacon = max(ILmax_beacon, IL(i)) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1275 /* else */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1276 /* ILmax_others(i) = max(IL(i), ILmax_others(i)) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1277 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1278 /* If (burst_nb == 3) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1279 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1280 /* For each timeslot i used for PDCH */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1281 /* if (CRC good) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1282 /* if (TFI good) last_PR_good = PR(i) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1283 /* if ((PR_MODE A) or (PR_MODE B and TFI good)) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1284 /* ILmax = max(ILmax, ILmax_others(i) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1285 /* + P0 + PR(i)) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1286 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1287 /* ILmax=max(ILmax, ILmax_beacon) */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1288 /* FIFO[beacon] updated with ILmax */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1289 /* last_input_level[serving beacon] = max(FIFO[beacon])*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1290 /* transfer_meas = max(FIFO[beacon]) - last_PR_good */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1291 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1292 /* Reset ILmax_others[8] and ILmax_beacon */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1293 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1294 /* WARNING: in the layer 1 code, input levels IL(l1) use */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1295 /* format 7.1: */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1296 /* ********************* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1297 /* * IL(l1) = - 2 x IL * */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1298 /* ********************* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1299 /* -> Reversed sign, reversed test conditions */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1300 /* -> max replaced by min */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1301 /* ex: if IL -120 dBm, IL(l1) = 240 */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1302 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1303 /* Parameters */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1304 /* ---------- */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1305 /* "calibrated_IL[8]" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1306 /* contains the IL found on timeslots */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1307 /* used for PDCH/D. These ILs can be used to process */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1308 /* RXLEV values. */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1309 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1310 /* "*pdsp_db_r_ptr" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1311 /* Pointer on the DSP DB Read page, used to extract */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1312 /* pm values, burst number and timeslot allocated */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1313 /* for downlink PDCH */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1314 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1315 /* "*pdsp_ndb_ptr" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1316 /* Pointer on the DSP NDB page, used to extract the */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1317 /* CRC value for each decoded burst */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1318 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1319 /* Global parameters */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1320 /* ----------------- */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1321 /* "l1a_l1s_com.Scell_info.transfer_meas.input_level" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1322 /* "l1a_l1s_com.Scell_info.transfer_meas.lna_off" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1323 /* Used to store the ILselected and the associated */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1324 /* lna_off value. */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1325 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1326 /* "l1a_l1s_com.last_input_level[freq. index] */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1327 /* .input_level */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1328 /* .lna_off" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1329 /* Used to store the beacon input level and */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1330 /* the associated lna_off value. */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1331 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1332 /* "l1ps.transfer_beacon_buf[4]" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1333 /* FIFO[beacon] */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1334 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1335 /* "l1ps.ILmin_beacon" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1336 /* "l1ps.ILmin_others[8]" */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1337 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1338 void l1pctl_dpcmb_agc_read(UWORD8 calibrated_IL[8], T_DB_DSP_TO_MCU_GPRS *pdsp_db_r_ptr,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1339 T_NDB_MCU_DSP_GPRS *pdsp_ndb_ptr, UWORD8 pr_table[8])
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1340 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1341 UWORD8 ts = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1342 UWORD8 rx_no = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1343 UWORD8 bit_mask = 0x80;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1344 UWORD8 IL_norm_min = 255;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1345 WORD8 delta1_freq, delta2_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1346 WORD16 delta_drp_gain=0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1347 UWORD16 radio_freq, lna_value;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1348 WORD16 used_agc;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1349 WORD32 serving_index;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1350 #if (RF_FAM == 61)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1351 UWORD16 arfcn;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1352 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1353 UWORD8 lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1354 UWORD16 dco_algo_ctl_pw_temp = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1355 UWORD8 if_ctl = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1356 #if (RF_FAM == 61) && (CODE_VERSION != SIMULATION)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1357 UWORD8 if_threshold = C_IF_ZERO_LOW_THRESHOLD_GPRS;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1358 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1359
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1360 #if(L1_FF_MULTIBAND == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1361 serving_index = l1a_l1s_com.Scell_info.radio_freq - l1_config.std.radio_freq_index_offset;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1362 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1363 serving_index = l1_multiband_radio_freq_convert_into_operative_radio_freq(l1a_l1s_com.Scell_info.radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1364 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1365
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1366
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1367 // Control phase parameters: same AGC, radio_freq, lna_off used for all PDTCH
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1368 // ***************************************************************************
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1369
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1370 // Get radio_freq on which the downlink block was received
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1371 radio_freq = l1a_l1s_com.dedic_set.radio_freq_dd;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1372
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1373 // Compute calibration factors
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1374 delta1_freq = l1ctl_encode_delta1(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1375 delta2_freq = l1ctl_encode_delta2(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1376
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1377 // Last known AGC (format F7.1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1378 used_agc = (Cust_get_agc_from_IL(radio_freq, l1a_l1s_com.Scell_used_IL_dd.input_level >> 1, MAX_ID)) << 1;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1379
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1380 // LNA attenuation
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1381 lna_value = l1a_l1s_com.Scell_used_IL_dd.lna_off * l1ctl_get_lna_att(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1382
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1383 // Burst 0: Reset ILmin_beacon and ILmin_others
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1384 if(pdsp_db_r_ptr->d_burst_nb_gprs == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1385 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1386 l1ps.ILmin_beacon = 255; // Not valid
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1387
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1388 for (ts = 0; ts < 8; ts++)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1389 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1390 l1ps.ILmin_others[ts] = 255; // Not valid
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1391 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1392 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1393
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1394 // IL processing for each received burst
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1395 // **************************************
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1396
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1397 // For each timeslot on which a burst was received
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1398 for(ts = 0; ts < 8; ts ++)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1399 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1400 if(pdsp_db_r_ptr->d_task_d_gprs & bit_mask)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1401 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1402 WORD16 current_IL, current_calibrated_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1403 UWORD8 pm;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1404
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1405 // IL = fct(pm, last_known_agc, lna_value, g_magic)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1406 //-------------------------------------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1407
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1408 pm = (UWORD8) ((pdsp_db_r_ptr->a_burst_pm_gprs[ts] & 0xffff) >> 5);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1409
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1410 // current_IL processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1411 if (0==pm) // Check and filter illegal pm value by using last valid IL
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1412 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1413 current_IL = l1a_l1s_com.last_input_level[serving_index].input_level
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1414 - lna_value;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1415
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1416 if (radio_freq != l1a_l1s_com.Scell_info.radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1417 current_IL += (l1ps.last_PR_good);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1418 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1419 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1420 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1421
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1422 #if (RF_FAM == 61)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1423 // DRP correction
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1424 #if (L1_FF_MULTIBAND == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1425 arfcn = Convert_l1_radio_freq(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1426 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1427 arfcn=radio_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1428 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1429
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1430 #if (CODE_VERSION != SIMULATION)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1431
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1432
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1433 cust_get_if_dco_ctl_algo(&dco_algo_ctl_pw_temp, &if_ctl, (UWORD8) L1_IL_VALID ,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1434 l1a_l1s_com.Scell_used_IL_dd.input_level,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1435 radio_freq, if_threshold);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1436 lna_off = l1a_l1s_com.Scell_used_IL_dd.lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1437 delta_drp_gain = drp_gain_correction(arfcn, lna_off, used_agc); // F7.1 format
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1438
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1439 if(if_ctl == IF_100KHZ_DSP){
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1440 delta_drp_gain += SCF_ATTENUATION_LIF_100KHZ;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1441 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1442 else{ /* i.e. if_ctl = IF_120KHZ_DSP*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1443 delta_drp_gain += SCF_ATTENUATION_LIF_120KHZ;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1444 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1445
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1446
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1447 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1448 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1449
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1450 current_IL = -(pm - ( used_agc - delta_drp_gain) + lna_value - l1ctl_get_g_magic(radio_freq));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1451 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1452
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1453 // Calibrated IL processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1454 current_calibrated_IL = current_IL - delta1_freq - delta2_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1455
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1456 // Protect IL stores against overflow
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1457 if(current_calibrated_IL>INDEX_MAX)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1458 current_calibrated_IL=INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1459 if (current_IL>INDEX_MAX)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1460 current_IL=INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1461
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1462 calibrated_IL[ts] = (UWORD8)(current_calibrated_IL);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1463
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1464 // Keep the minimum IL
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1465 if (radio_freq == l1a_l1s_com.Scell_info.radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1466 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1467 // Beacon frequency
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1468 l1ps.ILmin_beacon = min((UWORD8) current_IL,l1ps.ILmin_beacon);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1469 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1470 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1471 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1472 // Daughter frequency
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1473 l1ps.ILmin_others[ts] = min((UWORD8) current_IL, l1ps.ILmin_others[ts]);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1474 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1475
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1476 // Input Level selection among ILmax found on each timeslot during the block (when burst = 3)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1477 //-------------------------------------------------------------------------------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1478
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1479 if(pdsp_db_r_ptr->d_burst_nb_gprs == 3)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1480 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1481 // If CRC good
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1482 if (!(pdsp_ndb_ptr->a_dd_gprs[rx_no][0] & 0x0100))
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1483 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1484 // If ((PR_MODE A and TFI good) or (PR_MODE B))
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1485 if ((l1ps.read_param.dl_pwr_ctl.pr_mode != 0) || (!(pr_table[ts] & 0x80)))
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1486 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1487
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1488 // If TFI good
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1489 if (!(pr_table[ts] & 0x80))
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1490 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1491 // Memorize decoded PR
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1492 l1ps.last_PR_good = ((pr_table[ts] & 0x1f) << 1);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1493 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1494
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1495 if (l1ps.ILmin_others[ts] != 255)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1496 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1497 UWORD8 IL_norm;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1498
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1499 // IL normalization to beacon (ILnorm = ILmax_others(ts) - PR)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1500 IL_norm = l1ps.ILmin_others[ts] - ((pr_table[ts] & 0x1f) << 1);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1501
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1502 // Update IL_min with the minimum found IL
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1503 IL_norm_min = min(IL_norm, IL_norm_min);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1504 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1505 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1506 } // End if "CRC good"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1507
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1508 } // End if "burst = 3"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1509
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1510 // Next downlink block
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1511 rx_no ++;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1512
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1513 } // End if "timeslot used for downlink PDCH"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1514
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1515 // Next timeslot
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1516 bit_mask >>= 1;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1517
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1518 } // End for "each timeslot...."
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1519
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1520
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1521 // IL selection for the next block if burst = 3
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1522 // **********************************************
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1523
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1524 if(pdsp_db_r_ptr->d_burst_nb_gprs == 3)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1525 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1526 UWORD8 i, new_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1527 UWORD16 input_level;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1528 WORD16 new_calibrated_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1529
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1530 // Select the minimum IL between minimum IL found on daughter frequencies (normalized to beacon)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1531 // and minimum IL found on the beacon
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1532 IL_norm_min = min(IL_norm_min, l1ps.ILmin_beacon);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1533
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1534 // If a valid IL has been found
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1535 if (IL_norm_min != 255)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1536 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1537 // FIFO management
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1538 for (i=3;i>0;i--)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1539 l1a_l1s_com.Scell_info.buff_beacon[i] = l1a_l1s_com.Scell_info.buff_beacon[i-1];
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1540
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1541 l1a_l1s_com.Scell_info.buff_beacon[0] = IL_norm_min;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1542
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1543 // last_input_level[serving beacon] updating
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1544 //------------------------------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1545
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1546 // Find min IL in FIFO
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1547 new_IL = l1ctl_find_max(l1a_l1s_com.Scell_info.buff_beacon,4);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1548
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1549 // Input levels are always stored with lna_on
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1550
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1551 // lna_off processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1552 new_calibrated_IL = (WORD16) (new_IL - l1ctl_encode_delta1(l1a_l1s_com.Scell_info.radio_freq) - l1ctl_encode_delta2(l1a_l1s_com.Scell_info.radio_freq));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1553
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1554 if (new_calibrated_IL>INDEX_MAX) new_calibrated_IL = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1555
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1556 l1ctl_encode_lna((UWORD8)(new_calibrated_IL >> 1),
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1557 &(l1a_l1s_com.last_input_level[serving_index].lna_off),
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1558 l1a_l1s_com.Scell_info.radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1559
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1560 l1a_l1s_com.last_input_level[serving_index].input_level = new_IL +
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1561 l1a_l1s_com.last_input_level[serving_index].lna_off *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1562 l1ctl_get_lna_att(l1a_l1s_com.Scell_info.radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1563 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1564
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1565 // transfer_meas updating
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1566 //-----------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1567
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1568 // IL = (min IL in FIFO) + PR (Middle of the range specified by the last decoded PR with CRC and TFI good)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1569 // Input levels are always stored with lna_on
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1570 input_level = l1a_l1s_com.last_input_level[serving_index].input_level
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1571 - l1a_l1s_com.last_input_level[serving_index].lna_off *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1572 l1ctl_get_lna_att(l1a_l1s_com.Scell_info.radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1573 + l1ps.last_PR_good;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1574
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1575 // IL_2_AGC_xx array size
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1576 if (input_level>INDEX_MAX) input_level = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1577
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1578 // lna_off processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1579 new_calibrated_IL = (WORD16) (input_level - l1ctl_encode_delta1(l1ps.read_param.radio_freq_for_lna));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1580
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1581 if (new_calibrated_IL>INDEX_MAX) new_calibrated_IL = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1582
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1583 l1ctl_encode_lna((UWORD8)(new_calibrated_IL>>1), &(l1a_l1s_com.Scell_info.transfer_meas.lna_off), l1ps.read_param.radio_freq_for_lna);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1584
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1585 l1a_l1s_com.Scell_info.transfer_meas.input_level = input_level +
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1586 l1a_l1s_com.Scell_info.transfer_meas.lna_off *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1587 l1ctl_get_lna_att(l1ps.read_param.radio_freq_for_lna);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1588
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1589 } // End if "burst = 3"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1590
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1591 } // End of "l1pctl_dpcmb_agc_read"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1592
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1593 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1594 /* l1pctl_pgc() */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1595 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1596 /* Description : */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1597 /* ============= */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1598 /* This function is used in packet transfer mode for the*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1599 /* Read phase of power measurements. It permits to: */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1600 /* - Process the IL value in function of the Pm and AGC */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1601 /* used */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1602 /* - Update the FIFO[beacon] used in packet transfer AGC*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1603 /* algorithms */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1604 /* - Update last_input_level */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1605 /* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1606 /* WARNING: in the layer 1 code, input levels IL(l1) use */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1607 /* format 7.1: */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1608 /* ********************* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1609 /* * IL(l1) = - 2 x IL * */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1610 /* ********************* */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1611 /* -> Reversed sign, reversed test conditions */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1612 /* -> max replaced by min */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1613 /* ex: if IL -120 dBm, IL(l1) = 240 */
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1614 /*-------------------------------------------------------*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1615 UWORD8 l1pctl_pgc(UWORD8 pm, UWORD8 last_known_il, UWORD8 lna_off, UWORD16 radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1616 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1617 UWORD8 i, new_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1618 WORD8 delta1_freq, delta2_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1619 WORD16 delta_drp_gain=0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1620 UWORD16 lna_value;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1621 WORD16 used_agc, current_IL, current_calibrated_IL, new_calibrated_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1622 WORD32 index;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1623 #if (RF_FAM == 61)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1624 UWORD16 arfcn;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1625 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1626 UWORD16 dco_algo_ctl_pw_temp = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1627 UWORD8 if_ctl = 0;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1628 #if (RF_FAM == 61) && (CODE_VERSION != SIMULATION)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1629 UWORD8 if_threshold = C_IF_ZERO_LOW_THRESHOLD_GPRS;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1630 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1631
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1632 // Calibration factors
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1633 delta1_freq = l1ctl_encode_delta1(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1634 delta2_freq = l1ctl_encode_delta2(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1635
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1636 // initialize index
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1637 #if(L1_FF_MULTIBAND == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1638 index = radio_freq - l1_config.std.radio_freq_index_offset;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1639
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1640 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1641 index = l1_multiband_radio_freq_convert_into_operative_radio_freq(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1642 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1643
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1644
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1645 // LNA attenuation
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1646 lna_value = lna_off * l1ctl_get_lna_att(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1647
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1648 // Used AGC in the control phase (format F7.1)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1649 used_agc = (Cust_get_agc_from_IL(radio_freq, last_known_il >> 1, PWR_ID)) << 1;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1650
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1651
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1652 #if (RF_FAM == 61)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1653 // DRP correction
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1654 #if (L1_FF_MULTIBAND == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1655 arfcn = Convert_l1_radio_freq(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1656 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1657 arfcn=radio_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1658 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1659
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1660 #if (CODE_VERSION != SIMULATION)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1661
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1662
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1663 #if (PWMEAS_IF_MODE_FORCE == 0)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1664 cust_get_if_dco_ctl_algo(&dco_algo_ctl_pw_temp, &if_ctl, (UWORD8) L1_IL_VALID ,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1665 last_known_il,
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1666 radio_freq, if_threshold);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1667 #else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1668 if_ctl = IF_120KHZ_DSP;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1669 dco_algo_ctl_pw_temp = DCO_IF_0KHZ;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1670 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1671
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1672 lna_off = l1a_l1s_com.Scell_used_IL_dd.lna_off;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1673 delta_drp_gain = drp_gain_correction(arfcn, lna_off, used_agc); // F7.1 format
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1674
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1675 if(if_ctl == IF_100KHZ_DSP){
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1676 delta_drp_gain += SCF_ATTENUATION_LIF_100KHZ;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1677 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1678 else{ /* i.e. if_ctl = IF_120KHZ_DSP*/
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1679 delta_drp_gain += SCF_ATTENUATION_LIF_120KHZ;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1680 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1681
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1682
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1683 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1684 #endif
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1685
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1686 if (0==pm) // Check and filter illegal pm value by using last valid IL
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1687 current_IL = l1a_l1s_com.last_input_level[index].input_level - lna_value;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1688 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1689 current_IL = -(pm - (used_agc - delta_drp_gain) + lna_value - l1ctl_get_g_magic(radio_freq));
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1690
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1691 // Calibrated IL processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1692 current_calibrated_IL = current_IL - delta1_freq - delta2_freq;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1693
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1694 // Protect IL stores against overflow
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1695 if (current_calibrated_IL>INDEX_MAX)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1696 current_calibrated_IL=INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1697 if (current_IL>INDEX_MAX)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1698 current_IL=INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1699
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1700 // if radio freq is the serving beacon
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1701 //------------------------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1702 if (radio_freq == l1a_l1s_com.Scell_info.radio_freq)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1703 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1704 // FIFO management
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1705 for (i=3;i>0;i--)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1706 l1a_l1s_com.Scell_info.buff_beacon[i] = l1a_l1s_com.Scell_info.buff_beacon[i-1];
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1707 l1a_l1s_com.Scell_info.buff_beacon[0] = (UWORD8) current_IL;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1708
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1709 // Find min IL in FIFO
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1710 new_IL = l1ctl_find_max(l1a_l1s_com.Scell_info.buff_beacon,4);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1711
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1712 // lna_off processing
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1713 new_calibrated_IL = (WORD16) (new_IL - delta1_freq - delta2_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1714 if (new_calibrated_IL>INDEX_MAX) new_calibrated_IL = INDEX_MAX;
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1715
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1716 l1ctl_encode_lna((UWORD8)(new_calibrated_IL>>1),
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1717 &(l1a_l1s_com.last_input_level[index].lna_off),
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1718 radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1719
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1720 l1a_l1s_com.last_input_level[index].input_level = new_IL +
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1721 l1a_l1s_com.last_input_level[index].lna_off *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1722 l1ctl_get_lna_att(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1723 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1724
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1725 // if radio freq is a neighbor beacon
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1726 //-----------------------------------
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1727 else
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1728 {
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1729 // Update last_input_level (IL with LNA ON)
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1730 l1ctl_encode_lna((UWORD8)(current_calibrated_IL>>1),
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1731 &(l1a_l1s_com.last_input_level[index].lna_off),
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1732 radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1733
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1734 l1a_l1s_com.last_input_level[index].input_level = current_IL +
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1735 l1a_l1s_com.last_input_level[index].lna_off *
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1736 l1ctl_get_lna_att(radio_freq);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1737 }
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1738
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1739 return((UWORD8)current_calibrated_IL);
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1740
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1741 } // End of "l1pctl_pgc"
0740b5ff15f6 reconstructed L1_GPRS source imported from tcs211-l1-reconst
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1742 #endif