comparison L1/include/l1_ctl.h @ 0:75a11d740a02

initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 Jun 2016 00:02:41 +0000
parents
children f93dab57b032
comparison
equal deleted inserted replaced
-1:000000000000 0:75a11d740a02
1 /************* Revision Controle System Header *************
2 * GSM Layer 1 software
3 * L1_CTL.H
4 *
5 * Filename l1_ctl.h
6 * Copyright 2003 (C) Texas Instruments
7 *
8 ************* Revision Controle System Header *************/
9
10 /************************************/
11 /* Automatic timing control (TOA) */
12 /************************************/
13 #define C_RED 1 // Factor used to reduce the maximum accumulated values.
14 // Default : 1/2
15 #define C_GEW 1 // Weighting factor. Default : 1/2
16
17 #define C_SNRGR 2560 // 2.5 F6.10
18 #define C_SNR_THR 8192 // 8 F6.10
19 #define TOA_HISTO_LEN 11 // Histogram length
20
21 #define IL_FOR_RXLEV_SNR 220 // RX POWER LEVEL //increased from 210 to 220
22
23 #if (TOA_ALGO == 2)
24 #define L1_TOA_SCALING_CONSTANT (32768) // L1_TOA_SCALING_CONSTANT
25 #define L1_TOA_LAMBDA (0x7800) // 0.9375 represented in Q15 i.e. 0.9375*32768
26 #define L1_TOA_ONE_MINUS_LAMBDA (0x0800) // 0.0625 represented in Q15 i.e. 0.0625*32768
27 #define L1_TOA_THRESHOLD_15 (0x1333) // 0.15 in Q15
28 #define L1_TOA_THRESHOLD_20 (0x1999) // 0.20 in Q15
29 #define L1_TOA_THRESHOLD_25 (0x2000) // 0.25 in Q15
30 #define L1_TOA_THRESHOLD_30 (0x2666) // 0.30 in Q15
31 #if (CODE_VERSION == SIMULATION)
32 #define L1_TOA_SNR_THRESHOLD (0) // For simulator the threshold is made zero to facilitate
33 // TOA testing in simulator
34 #else
35 #if (NEW_SNR_THRESHOLD == 0)
36 #define L1_TOA_SNR_THRESHOLD (480) // 0x1E0 in F6.10 is equal to 0.46875
37 #else
38 #define L1_TOA_SNR_THRESHOLD (2048) // 0x1E0 in F6.10 is equal to 0.46875
39 #endif /* NEW_SNR_THRESHOLD*/
40
41 #endif
42 #if (CODE_VERSION == SIMULATION)
43 #define L1_TOA_EXPECTED_TOA (14) // Expected TOA on the MCU side
44 #else
45 #define L1_TOA_EXPECTED_TOA (14) // Expected TOA on the MCU side
46 #endif
47 #endif
48
49 #if (NEW_SNR_THRESHOLD == 1)
50 #define SAIC_OFF (0)
51 #define SAIC_ON (1)
52 #endif /* NEW_SNR_THRESHOLD */
53 /************************************/
54 /* Automatic Gain Control (AGC) */
55 /************************************/
56
57 #define INDEX_MIN 0
58 #define INDEX_MAX 240 // 120
59
60 /************************************/
61 /* Automatic frequency compensation */
62 /************************************/
63 #if (L1_SAIC == 1)
64 #define C_thr_snr 2048// 1/0.4 * 2**10 - CQ no- 76320
65 #else
66 #define C_thr_snr 2560 // 1/0.4 * 2**10
67 #endif
68 #define C_thr_P 524288L // 0.5 * 2**20
69 #define C_cov_start 838861L // 0.8 * 2**20
70 #define C_a0_kalman 10486L // 0.01 * 2**20
71 #define C_g_kalman 53687091L// 0.05 * 2**30
72 #define C_N_del 2 // delay of frequency control loop
73 // due to C W R pipeline
74 #define C_Q 3L // 0.000003 * 2**20
75 #define C_thr_K 209715L // 0.2 * 2**20
76 #define C_thr_phi 328 // 0.01 * 2**15
77
78 #if (VCXO_ALGO == 1)
79 #define C_WIN_AVG_SIZE_M 64 // average size M
80 #define C_PSI_AVG_SIZE_D 32 // distance size D
81 #define C_MSIZE (C_WIN_AVG_SIZE_M * C_PSI_AVG_SIZE_D) // Data history for predictor
82 #define C_RGAP_BAD_SNR_COUNT_B 32 // bad SNR count B
83 #define ALGO_AFC_RXGAP 1 // reception gap algo
84 #define ALGO_AFC_KALMAN 1 // Kalman filter
85 #define ALGO_AFC_LQG_PREDICTOR 2 // LQG filter + rgap predictor
86 #define ALGO_AFC_KALMAN_PREDICTOR 3 // Kalman filter + rgap predictor
87 #endif
88
89 #if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3) || (ANALOG == 11))
90 // clipping related to AFC DAC linearity range
91 #define C_max_step 32000 // 4000 * 2**3
92 #define C_min_step -32000 // -4000 * 2**3
93 #endif
94
95 /***************************************************/
96 /* SAIC (Single Antenna Interference Cancellation) */
97 /***************************************************/
98
99 #if (L1_SAIC != 0)
100 #define L1_SAIC_GENIE_GSM_GPRS_IDLE_THRESHOLD 192 // Input Level Threshold for GSM/GPRS Idle.
101 #define L1_SAIC_GENIE_GSM_DEDIC_THRESHOLD 192 // Input Level Threshold for GSM Dedicated.
102 #define L1_SAIC_GENIE_GPRS_PCKT_TRAN_THRESHOLD 192 // Input Level Threshold for GPRS Packet Transfer
103 #endif
104
105
106 #define L1_SAIC_HARDWARE_FILTER (1)
107 #define L1_SAIC_PROGRAMMABLE_FILTER (0)
108
109 //Locosto. For Locosto psi_quant = F14.2 else F13.3
110 #if(RF_FAM == 61)
111 #define CONVERT_PSI_QUANT(value) (value >> 2)
112 #else
113 #define CONVERT_PSI_QUANT(value) (value >> 3)
114 #endif
115