FreeCalypso > hg > fc-selenite
annotate src/cs/layer1/tm_cust0/l1tm_cust.c @ 205:89aa29293ded
tpudrv12.h: sync with Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 13 Oct 2020 01:07:46 +0000 |
parents | b6a5e36de839 |
children |
rev | line source |
---|---|
0
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /************* Revision Controle System Header ************* |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * GSM Layer 1 software |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * L1TM_CUST.C |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * Filename %M% |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * Version %I% |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * Date %G% |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 * |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 ************* Revision Controle System Header *************/ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "l1_confg.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #if TESTMODE |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include "tm_defs.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include "l1_const.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #include "l1_types.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #include "l1tm_defty.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 #include "l1tm_cust.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 #if (AUDIO_TASK == 1) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #include "l1audio_const.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #include "l1audio_cust.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include "l1audio_defty.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #if (L1_GTT == 1) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 #include "l1gtt_const.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #include "l1gtt_defty.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #include "l1_defty.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #include "l1_msgty.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 #include "l1_tabs.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 #include "l1tm_msgty.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 #include "l1tm_varex.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 #include "abb.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 #if (RF==35) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 #include "tpudrv35.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 #include "l1_rf35.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 #if (RF==12) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 #include "tpudrv12.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 #include "l1_rf12.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 #if (RF==10) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 #include "tpudrv10.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 #include "l1_rf10.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 #if (RF==8) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 #include "tpudrv8.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 #include "l1_rf8.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 #if (RF==2) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 #include "l1_rf2.h" |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 #include <string.h> |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 // Import band configuration from Flash module (need to replace by an access function) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 //extern UWORD8 std; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 extern T_L1_CONFIG l1_config; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 extern T_RF rf; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 extern T_RF_BAND rf_band[GSM_BANDS]; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 extern UWORD16 AGC_TABLE[AGC_TABLE_SIZE]; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 extern T_ADC adc; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 extern T_ADCCAL adc_cal; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 extern UWORD16 TM_ul_data[16]; //Uplink data to be stored into ABB Uplink buffer |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 extern T_STD_CONFIG std_config[]; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 static UWORD8 tm_band = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 // External function prototypes |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 void get_cal_from_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 UWORD8 save_cal_in_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 void Cust_init_std(void); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 void l1_tpu_init_light(void); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 enum { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 TM_RF_ID = 0, |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 TM_ADC_ID = 1 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 }; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 typedef signed char effs_t; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 // external FFS function prototypes |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 effs_t ffs_mkdir(const char *pathname); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 void config_ffs_write(char type); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 /***********************************************************************/ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 /* TESTMODE 4.X */ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 /***********************************************************************/ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 /*----------------------------------------------------------*/ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 /* Cust_tm_init() */ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 /*----------------------------------------------------------*/ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 /* Parameters : */ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 /* Return : */ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 /* Functionality : Init default configuration for TM params */ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 /*----------------------------------------------------------*/ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 void Cust_tm_init(void) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 UWORD32 i; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 l1_config.adc_enable = ADC_ENABLE; // ADC readings enabled |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 l1_config.agc_enable = AGC_ENABLE; // AGC algo enabled |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 l1_config.afc_enable = AFC_ENABLE; // AFC algo enabled |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 l1_config.tmode.rf_params.bcch_arfcn = TM_BCCH_ARFCN; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 l1_config.tmode.rf_params.tch_arfcn = TM_TCH_ARFCN; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 l1_config.tmode.rf_params.mon_arfcn = TM_MON_ARFCN; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 l1_config.tmode.rf_params.channel_type = TM_CHAN_TYPE; // TCH_F |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 l1_config.tmode.rf_params.subchannel = TM_SUB_CHAN; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 l1_config.tmode.rf_params.reload_ramps_flag = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 l1_config.tmode.rf_params.tmode_continuous = TM_NO_CONTINUOUS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 l1_config.tmode.rx_params.slot_num = TM_SLOT_NUM; // Time Slot |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 l1_config.tmode.rx_params.agc = TM_AGC_VALUE; //This may be outside the range of the RF chip used |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 l1_config.tmode.rx_params.pm_enable = TM_PM_ENABLE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 l1_config.tmode.rx_params.lna_off = TM_LNA_OFF; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 l1_config.tmode.rx_params.number_of_measurements = TM_NUM_MEAS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 l1_config.tmode.rx_params.place_of_measurement = TM_WIN_MEAS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 l1_config.tmode.tx_params.txpwr = TM_TXPWR; // Min power level for GSM900 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 l1_config.tmode.tx_params.txpwr_skip = TM_TXPWR_SKIP; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 l1_config.tmode.tx_params.timing_advance = TM_TA; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 l1_config.tmode.tx_params.burst_type = TM_BURST_TYPE; // default is normal up-link burst |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 l1_config.tmode.tx_params.burst_data = TM_BURST_DATA; // default is all zeros |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 l1_config.tmode.tx_params.tsc = TM_TSC; // Training Sequence ("BCC" on BSS) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 #if (CODE_VERSION != SIMULATION) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 l1_config.tmode.stats_config.num_loops = TM_NUM_LOOPS; // 0 actually means infinite |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 #else |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 l1_config.tmode.stats_config.num_loops = 4; // 0 actually means infinite |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 l1_config.tmode.stats_config.auto_result_loops = TM_AUTO_RESULT_LOOPS; // 0 actually means infinite |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 l1_config.tmode.stats_config.auto_reset_loops = TM_AUTO_RESET_LOOPS; // 0 actually means infinite |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 l1_config.tmode.stats_config.stat_type = TM_STAT_TYPE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 l1_config.tmode.stats_config.stat_bitmask = TM_STAT_BITMASK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 #if (CODE_VERSION != SIMULATION) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 // Initialize APCDEL1 register of Omega |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 ABB_Write_Register_on_page(PAGE0, APCDEL1, (C_APCDEL1 - 0x0004) >> 6); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 l1tm.tm_msg_received = FALSE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 for (i=0;i<16;i++) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 TM_ul_data[i]=0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 #if L1_GPRS |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 l1_config.tmode.rf_params.pdtch_arfcn = TM_PDTCH_ARFCN; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 l1_config.tmode.rf_params.multislot_class = TM_MULTISLOT_CLASS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 l1_config.tmode.stats_config.stat_gprs_slots = TM_STAT_GPRS_SLOTS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 l1_config.tmode.rx_params.timeslot_alloc = TM_RX_ALLOCATION; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 l1_config.tmode.rx_params.coding_scheme = TM_RX_CODING_SCHEME; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 l1_config.tmode.tx_params.timeslot_alloc = TM_TX_ALLOCATION; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 l1_config.tmode.tx_params.coding_scheme = TM_TX_CODING_SCHEME; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 for (i=0; i<8; i++) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 l1_config.tmode.tx_params.txpwr_gprs[i] = TM_TXPWR_GPRS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 for (i=0; i<27; i++) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 l1_config.tmode.tx_params.rlc_buffer[i] = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 /**********************************************************************/ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 /* Test mode functions used for RF calibration */ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 /**********************************************************************/ |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 void Cust_tm_rf_param_write(T_TM_RETURN *tm_return, WORD16 index, UWORD16 value) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 switch (index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 case STD_BAND_FLAG: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 UWORD8 std_temp, band_temp; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 std_temp = value & 0xff; // tm_band = b7..0 of value |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 band_temp = value >> 8; // band = b15..8 of value |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 // get define |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 //if (sizeof(std_config)/sizeof(T_STD_CONFIG) <= std_temp) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 if (9 <= std_temp) // std max |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 else if ( GSM_BANDS <= band_temp) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 else if ( BAND_NONE == std_config[std_temp].band[band_temp]) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 else |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 l1_config.std.id = std_temp; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 tm_band = band_temp; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 // update RAM struct with either default or ffs |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 Cust_init_std(); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 l1_tpu_init_light(); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 case INITIAL_AFC_DAC: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 rf.afc.eeprom_afc = (WORD16) value << 3; // shift to put into F13.3 format |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 l1_config.params.eeprom_afc = rf.afc.eeprom_afc; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
217 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
218 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 default: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 } // end switch |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
229 void Cust_tm_rf_param_read(T_TM_RETURN *tm_return, WORD16 index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 volatile UWORD16 value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 switch (index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
234 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 case STD_BAND_FLAG: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
236 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
237 value = ((tm_band << 8) | (l1_config.std.id) ); // return global std, tm_band (intel format) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
238 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
239 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
240 case INITIAL_AFC_DAC: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
241 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
242 value = rf.afc.eeprom_afc >> 3; // returned as F13.3 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
243 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
244 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
245 default: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
246 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
247 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
248 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
249 return; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
250 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
251 } // end switch |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
252 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
253 memcpy(tm_return->result, (UWORD8 *)&value, 2); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
254 tm_return->size = 2; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
255 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
256 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
257 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
258 void Cust_tm_rf_table_write(T_TM_RETURN *tm_return, WORD8 index, UWORD8 size, UWORD8 table[]) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
259 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
260 UWORD8 band=0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
261 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
262 tm_return->index = index; // store index before it gets modified |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
263 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
264 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
265 switch (index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
266 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
267 case RX_AGC_TABLE: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
268 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
269 if (size != sizeof(AGC_TABLE)) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
270 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
271 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
272 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
273 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
274 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
275 memcpy(&AGC_TABLE[0], table, size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
276 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
277 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
278 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
279 case AFC_PARAMS: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
280 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
282 #if (VCXO_ALGO == 1) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
283 if (size != 24) // 4 UWORD32 + 4 WORD16 values |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
284 #else |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
285 if (size != 16) // 4 UWORD32 values |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
286 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
287 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
288 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
289 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
290 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
291 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
292 memcpy(&rf.afc.psi_sta_inv, table, size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
293 l1_config.params.psi_sta_inv = rf.afc.psi_sta_inv; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
294 l1_config.params.psi_st = rf.afc.psi_st; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
295 l1_config.params.psi_st_32 = rf.afc.psi_st_32; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
296 l1_config.params.psi_st_inv = rf.afc.psi_st_inv; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
297 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
298 #if (CODE_VERSION == NOT_SIMULATION) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
299 #if (VCXO_ALGO == 1) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
300 l1_config.params.afc_dac_center = rf.afc.dac_center; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
301 l1_config.params.afc_dac_min = rf.afc.dac_min; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
302 l1_config.params.afc_dac_max = rf.afc.dac_max; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
303 l1_config.params.afc_snr_thr = rf.afc.snr_thr; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
304 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
305 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
306 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
307 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
308 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
309 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
310 case RX_AGC_GLOBAL_PARAMS: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
311 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
312 if (size != 8) // 4 UWORD16 values |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
313 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
314 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
315 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
316 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
317 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
318 memcpy(&rf.rx.agc.low_agc_noise_thr, table, size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
319 l1_config.params.low_agc_noise_thr = rf.rx.agc.low_agc_noise_thr; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
320 l1_config.params.high_agc_sat_thr = rf.rx.agc.high_agc_sat_thr; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
321 l1_config.params.low_agc = rf.rx.agc.low_agc; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
322 l1_config.params.high_agc = rf.rx.agc.high_agc; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
323 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
324 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
325 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
326 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
327 case RX_IL_2_AGC_MAX: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
328 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
329 if (size != sizeof(rf.rx.agc.il2agc_max)) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
330 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
331 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
332 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
333 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
334 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
335 memcpy(&rf.rx.agc.il2agc_max[0], table, size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
336 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
337 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
338 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
339 case RX_IL_2_AGC_PWR: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
340 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
341 if (size != sizeof(rf.rx.agc.il2agc_pwr)) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
342 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
343 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
344 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
345 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
346 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
347 memcpy(&rf.rx.agc.il2agc_pwr[0], table, size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
348 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
349 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
350 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
351 case RX_IL_2_AGC_AV: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
352 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
353 if (size != sizeof(rf.rx.agc.il2agc_av)) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
354 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
355 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
356 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
357 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
358 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
359 memcpy(&rf.rx.agc.il2agc_av[0], table, size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
360 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
361 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
362 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
363 case TX_LEVELS: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
364 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
365 if (size != sizeof(rf_band[tm_band].tx.levels)) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
366 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
367 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
368 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
369 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
370 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
371 memcpy(&rf_band[tm_band].tx.levels[0], table, size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
372 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
373 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
374 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
375 case TX_CAL_CHAN: // generic for all bands |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
376 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
377 if (size != sizeof(rf_band[tm_band].tx.chan_cal_table)) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
378 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
379 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
380 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
381 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
382 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
383 memcpy(&rf_band[tm_band].tx.chan_cal_table[0][0], table, size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
384 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
385 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
386 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
387 case TX_CAL_TEMP: // generic for all bands |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
388 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
389 if (size != sizeof(rf_band[tm_band].tx.temp)) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
390 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
391 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
392 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
393 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
394 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
395 memcpy(&rf_band[tm_band].tx.temp[0], table, size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
396 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
397 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
398 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
399 case RX_CAL_CHAN: // generic for all bands |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
400 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
401 if (size != sizeof(rf_band[tm_band].rx.agc_bands)) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
402 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
403 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
404 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
405 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
406 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
407 memcpy(&rf_band[tm_band].rx.agc_bands[0], table, size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
408 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
409 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
410 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
411 case RX_CAL_TEMP: // generic for all bands |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
412 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
413 if (size != sizeof(rf_band[tm_band].rx.temp)) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
414 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
415 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
416 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
417 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
418 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
419 memcpy(&rf_band[tm_band].rx.temp[0], table, size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
420 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
421 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
422 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
423 case RX_AGC_PARAMS: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
424 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
425 if (size != sizeof(rf_band[tm_band].rx.rx_cal_params)) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
426 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
427 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
428 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
429 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
430 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
431 memcpy(&rf_band[tm_band].rx.rx_cal_params, table, size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
432 if (tm_band == 0) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
433 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
434 l1_config.std.g_magic_band1 = rf_band[tm_band].rx.rx_cal_params.g_magic; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
435 l1_config.std.lna_att_band1 = rf_band[tm_band].rx.rx_cal_params.lna_att; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
436 l1_config.std.lna_switch_thr_low_band1 = rf_band[tm_band].rx.rx_cal_params.lna_switch_thr_low; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
437 l1_config.std.lna_switch_thr_high_band1 = rf_band[tm_band].rx.rx_cal_params.lna_switch_thr_high; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
438 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
439 else if (tm_band == 1) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
440 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
441 l1_config.std.g_magic_band2 = rf_band[tm_band].rx.rx_cal_params.g_magic; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
442 l1_config.std.lna_att_band2 = rf_band[tm_band].rx.rx_cal_params.lna_att; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
443 l1_config.std.lna_switch_thr_low_band2 = rf_band[tm_band].rx.rx_cal_params.lna_switch_thr_low; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
444 l1_config.std.lna_switch_thr_high_band2 = rf_band[tm_band].rx.rx_cal_params.lna_switch_thr_high; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
445 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
446 else |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
447 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
448 tm_return->status = E_INVAL; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
449 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
450 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
451 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
452 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
453 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
454 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
455 case TX_CAL_EXTREME: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
456 case RX_CAL_LEVEL: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
457 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
458 tm_return->status = E_NOSUBSYS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
459 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
460 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
461 #if L1_GPRS |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
462 case RLC_TX_BUFFER_CS1: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
463 case RLC_TX_BUFFER_CS2: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
464 case RLC_TX_BUFFER_CS3: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
465 case RLC_TX_BUFFER_CS4: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
466 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
467 UWORD8 i, buffer_size; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
468 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
469 tm_return->index = index; // store index before it gets modified |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
470 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
471 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
472 buffer_size = size/2 + size%2; // bytes will be concatenated into UWORD16 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
473 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
474 if (buffer_size > 27) //max. number of data bytes |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
475 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
476 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
477 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
478 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
479 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
480 // make sure that last byte is zero in case of odd number of bytes |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
481 table[size] = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
482 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
483 // init the whole buffer before downloading new data |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
484 for (i=0; i<27; i++) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
485 l1_config.tmode.tx_params.rlc_buffer[i] = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
486 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
487 for (i=0; i<buffer_size; i++) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
488 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
489 l1_config.tmode.tx_params.rlc_buffer[i] = (table[2*i+1] << 8) | table[2*i]; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
490 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
491 l1_config.tmode.tx_params.rlc_buffer_size = buffer_size; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
492 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
493 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
494 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
495 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
496 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
497 case TX_DATA_BUFFER: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
498 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
499 UWORD8 i; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
500 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
501 tm_return->index = index; // store index before it gets modified |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
502 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
503 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
504 if (size != 32) // 16 UWORD16 (containing 10 data bits each) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
505 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
506 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
507 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
508 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
509 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
510 memcpy(&TM_ul_data, table, size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
511 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
512 for (i=0; i<16; i++) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
513 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
514 TM_ul_data[i] = TM_ul_data[i] << 6; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
515 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
516 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
517 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
518 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
519 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
520 default: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
521 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
522 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
523 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
524 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
525 } // end switch |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
526 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
527 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
528 void Cust_tm_rf_table_read(T_TM_RETURN *tm_return, WORD8 index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
529 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
530 switch (index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
531 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
532 case RX_AGC_TABLE: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
533 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
534 tm_return->size = sizeof(AGC_TABLE); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
535 memcpy(tm_return->result, &AGC_TABLE[0], tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
536 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
537 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
538 case AFC_PARAMS: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
539 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
540 #if (VCXO_ALGO == 1) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
541 tm_return->size = 24; // 4 UWORD32's + 4 WORD16 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
542 #else |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
543 tm_return->size = 16; // 4 UWORD32's |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
544 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
545 memcpy(tm_return->result, &rf.afc.psi_sta_inv, tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
546 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
547 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
548 case RX_AGC_GLOBAL_PARAMS: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
549 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
550 tm_return->size = 8; // 4 UWORD16's |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
551 memcpy(tm_return->result, &rf.rx.agc.low_agc_noise_thr, tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
552 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
553 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
554 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
555 case RX_IL_2_AGC_MAX: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
556 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
557 tm_return->size = sizeof(rf.rx.agc.il2agc_max); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
558 memcpy(tm_return->result, &rf.rx.agc.il2agc_max[0], tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
559 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
560 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
561 case RX_IL_2_AGC_PWR: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
562 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
563 tm_return->size = sizeof(rf.rx.agc.il2agc_pwr); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
564 memcpy(tm_return->result, &rf.rx.agc.il2agc_pwr[0], tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
565 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
566 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
567 case RX_IL_2_AGC_AV: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
568 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
569 tm_return->size = sizeof(rf.rx.agc.il2agc_av); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
570 memcpy(tm_return->result, &rf.rx.agc.il2agc_av[0], tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
571 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
572 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
573 case TX_LEVELS: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
574 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
575 tm_return->size = sizeof(rf_band[tm_band].tx.levels); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
576 memcpy(tm_return->result, &rf_band[tm_band].tx.levels[0], tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
577 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
578 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
579 case TX_CAL_CHAN: // generic for all bands |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
580 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
581 tm_return->size = sizeof(rf_band[tm_band].tx.chan_cal_table); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
582 memcpy(tm_return->result, &rf_band[tm_band].tx.chan_cal_table[0][0], tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
583 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
584 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
585 case TX_CAL_TEMP: // generic for all bands |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
586 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
587 tm_return->size = sizeof(rf_band[tm_band].tx.temp); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
588 memcpy(tm_return->result, &rf_band[tm_band].tx.temp[0], tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
589 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
590 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
591 case RX_CAL_CHAN: // generic for all bands |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
592 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
593 tm_return->size = sizeof(rf_band[tm_band].rx.agc_bands); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
594 memcpy(tm_return->result, &rf_band[tm_band].rx.agc_bands[0], tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
595 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
596 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
597 case RX_CAL_TEMP: // generic for all bands |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
598 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
599 tm_return->size = sizeof(rf_band[tm_band].rx.temp); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
600 memcpy(tm_return->result, &rf_band[tm_band].rx.temp[0], tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
601 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
602 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
603 case RX_AGC_PARAMS: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
604 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
605 // WARNING: sizeof(rf.rx.rx_cal_params[band]) returns 12 because of alignment |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
606 tm_return->size = 10; // five UWORD16's |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
607 memcpy(tm_return->result, &rf_band[tm_band].rx.rx_cal_params, tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
608 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
609 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
610 case TX_CAL_EXTREME: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
611 case RX_CAL_LEVEL: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
612 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
613 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
614 tm_return->status = E_NOSUBSYS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
615 return; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
616 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
617 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
618 #if L1_GPRS |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
619 case RLC_TX_BUFFER_CS1: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
620 case RLC_TX_BUFFER_CS2: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
621 case RLC_TX_BUFFER_CS3: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
622 case RLC_TX_BUFFER_CS4: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
623 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
624 tm_return->size = l1_config.tmode.tx_params.rlc_buffer_size * 2; // UWORD16's |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
625 memcpy(tm_return->result, &l1_config.tmode.tx_params.rlc_buffer[0], tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
626 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
627 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
628 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
629 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
630 case TX_DATA_BUFFER: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
631 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
632 UWORD8 i; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
633 for (i=0; i<16; i++) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
634 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
635 tm_return->result[2*i]=(TM_ul_data[i] >> 6) & 0x00FF; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
636 tm_return->result[2*i+1]=(TM_ul_data[i] >> 14) & 0x0003; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
637 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
638 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
639 tm_return->size = 32; //16*UWORD16 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
640 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
641 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
642 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
643 #if (RF==35) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
644 case RX_PLL_TUNING_TABLE: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
645 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
646 tm_return->size = sizeof(pll_tuning); //6*UWORD16 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
647 memcpy(tm_return->result, &pll_tuning, tm_return->size); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
648 pll_tuning.enable = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
649 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
650 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
651 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
652 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
653 default: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
654 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
655 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
656 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
657 return; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
658 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
659 } // end switch |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
660 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
661 tm_return->index = index; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
662 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
663 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
664 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
665 void Cust_tm_rx_param_write(T_TM_RETURN *tm_return, WORD16 index, UWORD16 value) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
666 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
667 switch (index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
668 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
669 case RX_FRONT_DELAY: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
670 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
671 //delay for dual band not implemented yet |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
672 rf.tx.prg_tx = value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
673 l1_config.params.prg_tx_gsm = rf.tx.prg_tx; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
674 l1_config.params.prg_tx_dcs = rf.tx.prg_tx; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
675 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
676 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
677 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
678 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
679 default: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
680 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
681 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
682 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
683 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
684 } // end switch |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
685 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
686 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
687 void Cust_tm_rx_param_read(T_TM_RETURN *tm_return, WORD16 index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
688 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
689 volatile UWORD16 value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
690 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
691 switch (index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
692 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
693 case RX_FRONT_DELAY: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
694 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
695 value = rf.tx.prg_tx; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
696 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
697 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
698 default: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
699 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
700 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
701 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
702 return; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
703 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
704 } // end switch |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
705 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
706 memcpy(tm_return->result, (UWORD8 *)&value, 2); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
707 tm_return->size = 2; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
708 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
709 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
710 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
711 void Cust_tm_tx_param_write(T_TM_RETURN *tm_return, WORD16 index, UWORD16 value, UWORD8 band) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
712 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
713 switch (index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
714 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
715 case TX_APC_DAC: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
716 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
717 // generic for all bands |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
718 rf_band[tm_band].tx.levels[l1_config.tmode.tx_params.txpwr].apc = value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
719 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
720 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
721 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
722 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
723 case TX_RAMP_TEMPLATE: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
724 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
725 if (value >= sizeof(rf_band[tm_band].tx.ramp_tables)/sizeof(rf_band[tm_band].tx.ramp_tables[0])) // [0..15] |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
726 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
727 tm_return->status = E_INVAL; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
728 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
729 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
730 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
731 // generic for all bands |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
732 rf_band[tm_band].tx.levels[l1_config.tmode.tx_params.txpwr].ramp_index = value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
733 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
734 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
735 l1_config.tmode.rf_params.reload_ramps_flag = 1; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
736 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
737 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
738 case TX_CHAN_CAL_TABLE: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
739 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
740 if (value >= sizeof(rf_band[tm_band].tx.chan_cal_table)/sizeof(rf_band[tm_band].tx.chan_cal_table[0])) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
741 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
742 tm_return->status = E_INVAL; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
743 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
744 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
745 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
746 // generic for all bands |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
747 rf_band[tm_band].tx.levels[l1_config.tmode.tx_params.txpwr].chan_cal_index = value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
748 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
749 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
750 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
751 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
752 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
753 case TX_BURST_TYPE: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
754 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
755 if (value > 1) // [0..1] |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
756 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
757 tm_return->status = E_INVAL; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
758 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
759 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
760 l1_config.tmode.tx_params.burst_type = value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
761 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
762 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
763 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
764 case TX_BURST_DATA: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
765 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
766 // range is [0..10], currently we support [0..13] at the moment |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
767 if (value > 13) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
768 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
769 tm_return->status = E_INVAL; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
770 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
771 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
772 l1_config.tmode.tx_params.burst_data = value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
773 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
774 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
775 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
776 case TX_TRAINING_SEQ: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
777 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
778 if (value > 7) // [0..7] |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
779 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
780 tm_return->status = E_INVAL; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
781 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
782 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
783 l1_config.tmode.tx_params.tsc = value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
784 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
785 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
786 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
787 default: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
788 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
789 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
790 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
791 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
792 } // end switch |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
793 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
794 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
795 void Cust_tm_tx_param_read(T_TM_RETURN *tm_return, WORD16 index, UWORD8 band) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
796 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
797 volatile UWORD16 value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
798 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
799 switch (index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
800 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
801 case TX_PWR_LEVEL: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
802 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
803 value = l1_config.tmode.tx_params.txpwr; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
804 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
805 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
806 case TX_APC_DAC: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
807 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
808 value = rf_band[tm_band].tx.levels[l1_config.tmode.tx_params.txpwr].apc; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
809 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
810 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
811 case TX_RAMP_TEMPLATE: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
812 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
813 value = rf_band[tm_band].tx.levels[l1_config.tmode.tx_params.txpwr].ramp_index; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
814 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
815 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
816 case TX_CHAN_CAL_TABLE: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
817 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
818 value = rf_band[tm_band].tx.levels[l1_config.tmode.tx_params.txpwr].chan_cal_index; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
819 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
820 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
821 case TX_BURST_TYPE: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
822 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
823 value = l1_config.tmode.tx_params.burst_type; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
824 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
825 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
826 case TX_BURST_DATA: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
827 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
828 value = l1_config.tmode.tx_params.burst_data; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
829 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
830 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
831 case TX_TIMING_ADVANCE: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
832 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
833 value = l1_config.tmode.tx_params.timing_advance; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
834 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
835 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
836 case TX_TRAINING_SEQ: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
837 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
838 value = l1_config.tmode.tx_params.tsc; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
839 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
840 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
841 case TX_PWR_SKIP: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
842 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
843 value = l1_config.tmode.tx_params.txpwr_skip; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
844 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
845 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
846 #if L1_GPRS |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
847 case TX_GPRS_POWER0: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
848 case TX_GPRS_POWER1: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
849 case TX_GPRS_POWER2: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
850 case TX_GPRS_POWER3: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
851 case TX_GPRS_POWER4: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
852 case TX_GPRS_POWER5: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
853 case TX_GPRS_POWER6: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
854 case TX_GPRS_POWER7: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
855 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
856 value = l1_config.tmode.tx_params.txpwr_gprs[index - TX_GPRS_POWER0]; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
857 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
858 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
859 case TX_GPRS_SLOTS: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
860 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
861 value = l1_config.tmode.tx_params.timeslot_alloc; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
862 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
863 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
864 case TX_GPRS_CODING: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
865 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
866 value = l1_config.tmode.tx_params.coding_scheme; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
867 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
868 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
869 #endif |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
870 default: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
871 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
872 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
873 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
874 return; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
875 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
876 } // end switch |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
877 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
878 memcpy(tm_return->result, (UWORD8 *)&value, 2); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
879 tm_return->size = 2; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
880 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
881 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
882 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
883 void Cust_tm_tx_template_write(T_TM_RETURN *tm_return, WORD8 index, UWORD8 size, UWORD8 table[]) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
884 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
885 if (index >= sizeof(rf_band[tm_band].tx.ramp_tables)/sizeof(T_TX_RAMP)) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
886 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
887 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
888 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
889 else if (size != sizeof(T_TX_RAMP)) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
890 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
891 // We are writing both the up and down ramps; size must be exact. |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
892 tm_return->status = E_BADSIZE; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
893 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
894 else |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
895 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
896 memcpy(rf_band[tm_band].tx.ramp_tables[index].ramp_up, &table[0], size/2); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
897 memcpy(rf_band[tm_band].tx.ramp_tables[index].ramp_down, &table[size/2], size/2); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
898 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
899 l1_config.tmode.rf_params.reload_ramps_flag = 1; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
900 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
901 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
902 tm_return->index = index; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
903 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
904 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
905 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
906 void Cust_tm_tx_template_read(T_TM_RETURN *tm_return, WORD8 index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
907 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
908 tm_return->index = index; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
909 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
910 if (index >= sizeof(rf_band[tm_band].tx.ramp_tables)/sizeof(T_TX_RAMP)) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
911 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
912 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
913 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
914 return; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
915 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
916 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
917 memcpy(&tm_return->result[0], rf_band[tm_band].tx.ramp_tables[index].ramp_up, sizeof(rf_band[tm_band].tx.ramp_tables[index].ramp_up)); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
918 memcpy(&tm_return->result[sizeof(rf_band[tm_band].tx.ramp_tables[index].ramp_up)], rf_band[tm_band].tx.ramp_tables[index].ramp_down, sizeof(rf_band[tm_band].tx.ramp_tables[index].ramp_down)); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
919 tm_return->size = sizeof(rf_band[tm_band].tx.ramp_tables[index]); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
920 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
921 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
922 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
923 void Cust_tm_misc_param_write(T_TM_RETURN *tm_return, WORD16 index, UWORD16 value) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
924 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
925 switch (index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
926 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
927 case GPIOSTATE0: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
928 case GPIODIR0: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
929 case GPIOSTATE1: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
930 case GPIODIR1: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
931 case GPIOSTATE0P: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
932 case GPIODIR0P: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
933 case GPIOSTATE1P: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
934 case GPIODIR1P: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
935 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
936 tm_return->status = E_NOSUBSYS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
937 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
938 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
939 case CONVERTED_ADC0: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
940 case CONVERTED_ADC1: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
941 case CONVERTED_ADC2: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
942 case CONVERTED_ADC3: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
943 case CONVERTED_ADC4: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
944 case CONVERTED_ADC5: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
945 case CONVERTED_ADC6: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
946 case CONVERTED_ADC7: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
947 case CONVERTED_ADC8: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
948 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
949 adc.converted[index - CONVERTED_ADC0] = value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
950 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
951 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
952 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
953 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
954 case RAW_ADC0: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
955 case RAW_ADC1: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
956 case RAW_ADC2: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
957 case RAW_ADC3: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
958 case RAW_ADC4: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
959 case RAW_ADC5: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
960 case RAW_ADC6: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
961 case RAW_ADC7: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
962 case RAW_ADC8: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
963 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
964 adc.raw[index - RAW_ADC0] = value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
965 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
966 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
967 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
968 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
969 case ADC0_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
970 case ADC1_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
971 case ADC2_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
972 case ADC3_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
973 case ADC4_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
974 case ADC5_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
975 case ADC6_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
976 case ADC7_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
977 case ADC8_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
978 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
979 adc_cal.a[index - ADC0_COEFF_A] = value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
980 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
981 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
982 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
983 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
984 case ADC0_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
985 case ADC1_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
986 case ADC2_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
987 case ADC3_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
988 case ADC4_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
989 case ADC5_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
990 case ADC6_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
991 case ADC7_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
992 case ADC8_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
993 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
994 adc_cal.b[index - ADC0_COEFF_B] = value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
995 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
996 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
997 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
998 case SLEEP_MODE: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
999 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1000 tm_return->status = E_NOSUBSYS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1001 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1002 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1003 default: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1004 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1005 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1006 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1007 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1008 } // end switch |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1009 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1010 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1011 void Cust_tm_misc_param_read(T_TM_RETURN *tm_return, WORD16 index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1012 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1013 volatile UWORD16 value; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1014 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1015 switch (index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1016 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1017 case GPIOSTATE0: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1018 case GPIODIR0: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1019 case GPIOSTATE1: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1020 case GPIODIR1: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1021 case GPIOSTATE0P: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1022 case GPIODIR0P: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1023 case GPIOSTATE1P: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1024 case GPIODIR1P: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1025 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1026 tm_return->status = E_NOSUBSYS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1027 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1028 return; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1029 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1030 case CONVERTED_ADC0: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1031 case CONVERTED_ADC1: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1032 case CONVERTED_ADC2: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1033 case CONVERTED_ADC3: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1034 case CONVERTED_ADC4: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1035 case CONVERTED_ADC5: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1036 case CONVERTED_ADC6: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1037 case CONVERTED_ADC7: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1038 case CONVERTED_ADC8: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1039 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1040 value = adc.converted[index - CONVERTED_ADC0]; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1041 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1042 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1043 case RAW_ADC0: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1044 case RAW_ADC1: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1045 case RAW_ADC2: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1046 case RAW_ADC3: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1047 case RAW_ADC4: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1048 case RAW_ADC5: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1049 case RAW_ADC6: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1050 case RAW_ADC7: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1051 case RAW_ADC8: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1052 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1053 value = adc.raw[index - RAW_ADC0]; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1054 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1055 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1056 case ADC0_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1057 case ADC1_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1058 case ADC2_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1059 case ADC3_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1060 case ADC4_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1061 case ADC5_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1062 case ADC6_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1063 case ADC7_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1064 case ADC8_COEFF_A: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1065 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1066 value = adc_cal.a[index - ADC0_COEFF_A]; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1067 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1068 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1069 case ADC0_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1070 case ADC1_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1071 case ADC2_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1072 case ADC3_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1073 case ADC4_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1074 case ADC5_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1075 case ADC6_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1076 case ADC7_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1077 case ADC8_COEFF_B: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1078 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1079 value = adc_cal.b[index - ADC0_COEFF_B]; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1080 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1081 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1082 case SLEEP_MODE: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1083 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1084 tm_return->status = E_NOSUBSYS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1085 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1086 return; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1087 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1088 default: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1089 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1090 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1091 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1092 return; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1093 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1094 } // end switch |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1095 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1096 memcpy(tm_return->result, (UWORD8 *)&value, 2); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1097 tm_return->size = 2; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1098 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1099 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1100 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1101 void Cust_tm_misc_enable(T_TM_RETURN *tm_return, WORD16 action) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1102 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1103 UWORD8 status; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1104 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1105 // FIXME: This enum really should go into testmode header file. |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1106 enum ME_CFG_WRITE_E { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1107 CFG_WRITE_MKDIRS = 100, |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1108 CFG_WRITE_RF_CAL = 102, |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1109 CFG_WRITE_RF_CFG = 103, |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1110 CFG_WRITE_TX_CAL = 104, |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1111 CFG_WRITE_TX_CFG = 105, |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1112 CFG_WRITE_RX_CAL = 106, |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1113 CFG_WRITE_RX_CFG = 107, |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1114 CFG_WRITE_SYS_CAL = 108, |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1115 CFG_WRITE_SYS_CFG = 109 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1116 }; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1117 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1118 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1119 tm_return->index = action; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1120 tm_return->status = E_OK; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1121 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1122 // FIXME: This code should actually be in misc_enable() |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1123 switch(action) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1124 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1125 case CFG_WRITE_MKDIRS: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1126 ffs_mkdir("/gsm"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1127 ffs_mkdir("/pcm"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1128 ffs_mkdir("/sys"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1129 ffs_mkdir("/mmi"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1130 ffs_mkdir("/vos"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1131 ffs_mkdir("/var"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1132 ffs_mkdir("/gsm/rf"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1133 ffs_mkdir("/gsm/com"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1134 ffs_mkdir("/vos/vm"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1135 ffs_mkdir("/vos/vrm"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1136 ffs_mkdir("/vos/vrp"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1137 ffs_mkdir("/var/log"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1138 ffs_mkdir("/var/tst"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1139 ffs_mkdir("/gsm/rf/tx"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1140 ffs_mkdir("/gsm/rf/rx"); |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1141 break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1142 case CFG_WRITE_RF_CAL: config_ffs_write('f'); break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1143 case CFG_WRITE_RF_CFG: config_ffs_write('F'); break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1144 case CFG_WRITE_TX_CAL: config_ffs_write('t'); break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1145 case CFG_WRITE_TX_CFG: config_ffs_write('T'); break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1146 case CFG_WRITE_RX_CAL: config_ffs_write('r'); break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1147 case CFG_WRITE_RX_CFG: config_ffs_write('R'); break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1148 case CFG_WRITE_SYS_CAL: config_ffs_write('s'); break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1149 case CFG_WRITE_SYS_CFG: config_ffs_write('S'); break; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1150 default: |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1151 tm_return->status = E_BADINDEX; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1152 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1153 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1154 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1155 void Cust_tm_special_param_write(T_TM_RETURN *tm_return, WORD16 index, UWORD16 value) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1156 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1157 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1158 tm_return->index = index; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1159 tm_return->status = E_NOSYS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1160 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1161 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1162 void Cust_tm_special_param_read(T_TM_RETURN *tm_return, WORD16 index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1163 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1164 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1165 tm_return->index = index; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1166 tm_return->status = E_NOSYS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1167 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1168 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1169 void Cust_tm_special_table_write(T_TM_RETURN *tm_return, WORD8 index, UWORD8 size, UWORD8 table[]) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1170 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1171 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1172 tm_return->index = index; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1173 tm_return->status = E_NOSYS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1174 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1175 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1176 void Cust_tm_special_table_read(T_TM_RETURN *tm_return, WORD8 index) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1177 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1178 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1179 tm_return->index = index; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1180 tm_return->status = E_NOSYS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1181 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1182 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1183 void Cust_tm_special_enable(T_TM_RETURN *tm_return, WORD16 action) |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1184 { |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1185 tm_return->size = 0; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1186 tm_return->index = action; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1187 tm_return->status = E_NOSYS; |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1188 } |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1189 |
b6a5e36de839
src/cs: initial import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1190 #endif // TESTMODE |