annotate chipsetsw/layer1/tpu_drivers/source0/tpudrv12.c.fc @ 18:ffee43b74949

checking in tpudrv12 source adapted for C139 in TCS211 environment
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 01 Nov 2015 05:40:24 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 * tpudrv12.c (TPU driver for RF type 12) is a required part of the L1
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 * code for TI GSM chipset solutions consisting of Calypso or other
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4 * classic (non-LoCosto) DBB, one of the classic ABB chips such as Iota
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 * or Syren, and Rita RF transceiver; the number 12 refers to the latter.
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 *
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 * We, the FreeCalypso team, have not been able to find an original
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8 * source for this C module: the LoCosto source has tpudrv61.c instead,
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 * supporting LoCosto RF instead of Rita, whereas the TSM30 source
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 * only supports non-TI RF transceivers. Our only available reference
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11 * for what this tpudrv12.c module is supposed to contain is the
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12 * tpudrv12.obj COFF object from the Leonardo semi-src deliverable.
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 *
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14 * The present reconstruction has been made by copying tpudrv61.c and
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 * tweaking it to match the disassembly of the reference binary object
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16 * named above.
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17 *
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18 * The ugly hacks to support Compal and Pirelli targets in addition to
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 * classic TI/Openmoko ones are original to FreeCalypso.
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22 #define TPUDRV12_C
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24 #include "config.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25 #include "sys_types.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 #include "l1_confg.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
28 #include "l1_macro.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29 #include "l1_const.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
30 #include "l1_types.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31 #if TESTMODE
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32 #include "l1tm_defty.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 #endif
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 #if (AUDIO_TASK == 1)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 #include "l1audio_const.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36 #include "l1audio_cust.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 #include "l1audio_defty.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
38 #endif
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
39 #if (L1_GTT == 1)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
40 #include "l1gtt_const.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
41 #include "l1gtt_defty.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
42 #endif
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
43 #if (L1_MP3 == 1)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
44 #include "l1mp3_defty.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
45 #endif
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
46 #if (L1_MIDI == 1)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
47 #include "l1midi_defty.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
48 #endif
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
49
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
50 #if (L1_AAC == 1)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
51 #include "l1aac_defty.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
52 #endif
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
53
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
54 #include "l1_defty.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
55 #include "l1_time.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
56 #include "l1_ctl.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
57 #include "tpudrv.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
58 #include "tpudrv12.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
59 #include "l1_rf12.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
60
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
61 #include "../../bsp/mem.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
62 #include "../../bsp/armio.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
63 #include "../../bsp/clkm.h"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
64
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
65 // Global variables
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
66 extern T_L1_CONFIG l1_config;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
67 extern UWORD16 AGC_TABLE[];
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
68 extern UWORD16 *TP_Ptr;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
69 #if (L1_FF_MULTIBAND == 1)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
70 extern const WORD8 rf_subband2band[RF_NB_SUBBANDS];
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
71 #endif
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
72
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
73 static WORD8 rf_index; // index into rf_path[]
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
74 static UWORD16 rf_chip_band; /* from tpudrv12.obj, not in tpudrv61.c */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
75 static UWORD8 rfband; /* ditto */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
76
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
77 // Internal function prototypes
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
78 void l1dmacro_rx_down (WORD32 t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
79
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
80 #if (L1_FF_MULTIBAND == 0)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
81 SYS_UWORD16 Convert_l1_radio_freq(SYS_UWORD16 radio_freq);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
82 WORD32 rf_init(WORD32 t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
83
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
84 // External function prototypes
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
85 UWORD8 Cust_is_band_high(UWORD16 radio_freq);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
86 #endif
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
87
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
88
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
89 extern T_RF_BAND rf_band[];
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
90 extern T_RF rf;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
91
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
92 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
93 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
94 /* DEFINITION OF MACROS FOR CHIPS SERIAL PROGRAMMATION */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
95 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
96 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
97
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
98 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
99 /* Is arfcn in the DCS band (512-885) ? */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
100 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
101 #define IS_HIGH_BAND(arfcn) (((arfcn >= 512) && (arfcn <= 885)) ? 1 : 0)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
102
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
103 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
104 /* Send a value to Rita RF */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
105 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
106 #define TSP_TO_RF(rf_data)\
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
107 {\
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
108 *TP_Ptr++ = TPU_MOVE(TSP_TX_REG_1, ((rf_data) >> 8) & 0xFF); \
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
109 *TP_Ptr++ = TPU_MOVE(TSP_TX_REG_2, (rf_data) & 0xFF); \
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
110 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, TC1_DEVICE_RF | 0x0F); \
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
111 *TP_Ptr++ = TPU_MOVE(TSP_CTRL2, TC2_WR); \
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
112 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
113
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
114 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
115 /* Send a TSP command to ABB */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
116 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
117 #define TSP_TO_ABB(data)\
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
118 {\
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
119 *TP_Ptr++ = TPU_MOVE(TSP_TX_REG_1, (data) & 0xFF); \
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
120 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, TC1_DEVICE_ABB | 0x06); \
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
121 *TP_Ptr++ = TPU_MOVE(TSP_CTRL2, TC2_WR); \
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
122 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
123
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
124 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
125 /* Trace arfcn for conversion debug */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
126 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
127 #ifdef ARFCN_DEBUG
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
128 // ----Debug information : record all arfcn programmed into synthesizer!
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
129 #define MAX_ARFCN_TRACE 4096 // enough for 5 sessions of 124+374
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
130 SYS_UWORD16 arfcn_trace[MAX_ARFCN_TRACE];
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
131 static UWORD32 arfcn_trace_index = 0;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
132
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
133 void trace_arfcn(SYS_UWORD16 arfcn)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
134 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
135 arfcn_trace[arfcn_trace_index++] = arfcn;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
136
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
137 // Wrap to beginning
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
138 if (arfcn_trace_index == MAX_ARFCN_TRACE)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
139 arfcn_trace_index = 0;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
140 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
141 #endif
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
142
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
143
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
144 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
145 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
146 /* DEFINITION OF HARWARE DEPENDANT CONSTANTS */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
147 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
148 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
149
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
150 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
151 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
152 /* INTERNAL FUNCTIONS OF TPUDRV14.C */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
153 /* EFFECTIVE DOWNLOADING THROUGH TSP */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
154 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
155 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
156 // rx & tx
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
157 typedef struct tx_rx_s
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
158 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
159 UWORD16 farfcn0;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
160 WORD8 ou;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
161 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
162 T_TX_RX;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
163
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
164 struct synth_s {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
165 // common
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
166 UWORD16 arfcn0;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
167 UWORD16 limit;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
168 UWORD16 rf_chip_band; /* from tpudrv12.obj, not in tpudrv61.c */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
169 T_TX_RX tx_rx[2];
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
170 };
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
171
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
172 #if CONFIG_TARGET_COMPAL || CONFIG_TARGET_PIRELLI
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
173 typedef UWORD16 T_RXTX_UPDOWN;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
174 #else
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
175 typedef UWORD8 T_RXTX_UPDOWN;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
176 #endif
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
177
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
178 struct rf_path_s {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
179 T_RXTX_UPDOWN rx_up;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
180 T_RXTX_UPDOWN rx_down;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
181 T_RXTX_UPDOWN tx_up;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
182 T_RXTX_UPDOWN tx_down;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
183 struct synth_s *synth;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
184 };
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
185
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
186 const struct synth_s synth_900[] =
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
187 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
188 { 0, 124, BAND_SELECT_GSM, {{ 890, 1}, { 935, 2}}},// gsm 0 - 124
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
189 {974, 1023, BAND_SELECT_GSM, {{ 880, 1}, { 925, 2}}},// egsm 975 - 1023
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
190 };
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
191
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
192 const struct synth_s synth_1800[] =
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
193 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
194 {511, 885, BAND_SELECT_DCS, {{1710, 1}, {1805, 1}}}, // dcs 512 - 885
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
195 };
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
196
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
197 const struct synth_s synth_1900[] =
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
198 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
199 {511, 810, BAND_SELECT_PCS, {{1850, 1}, {1930, 1}}}, // pcs 512 - 810;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
200 };
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
201
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
202 const struct synth_s synth_850[] =
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
203 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
204 {127, 192, BAND_SELECT_850_LO, {{ 824, 2}, { 869, 2}}}, // gsm850 low
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
205 {127, 251, BAND_SELECT_850_HI, {{ 824, 1}, { 869, 2}}}, // gsm850 high
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
206 };
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
207
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
208 struct rf_path_s rf_path[] = { //same index used as for band_config[] - 1
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
209 { RU_900, RD_900, TU_900, TD_900, (struct synth_s *)synth_900 }, //EGSM
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
210 { RU_1800, RD_1800, TU_1800, TD_1800, (struct synth_s *)synth_1800}, //DCS
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
211 { RU_1900, RD_1900, TU_1900, TD_1900, (struct synth_s *)synth_1900}, //PCS
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
212 { RU_850, RD_850, TU_850, TD_850, (struct synth_s *)synth_850 }, //GSM850
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
213 { RU_900, RD_900, TU_900, TD_900, (struct synth_s *)synth_900 }, //GSM
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
214 };
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
215
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
216 /*
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
217 * Leonardo tpudrv12.obj contains a function named calc_a_b(); there is
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
218 * no such function in the LoCosto version, but there is a similar-looking
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
219 * calc_rf_freq() function instead. Let's try making our calc_a_b()
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
220 * from LoCosto's calc_rf_freq().
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
221 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
222
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
223 UWORD32 calc_a_b(UWORD16 arfcn, UWORD8 downlink)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
224 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
225 UWORD32 farfcn; /* in 200 kHz units */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
226 UWORD32 n; /* B * P + A */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
227 struct synth_s *s;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
228
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
229 s = rf_path[rf_index].synth;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
230 while(s->limit < arfcn)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
231 s++;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
232
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
233 rf_chip_band = s->rf_chip_band;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
234
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
235 // Convert the ARFCN to the channel frequency (times 5 to avoid the decimal value)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
236 farfcn = 5*s->tx_rx[downlink].farfcn0 + (arfcn - s->arfcn0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
237 n = farfcn * s->tx_rx[downlink].ou;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
238
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
239 /* magic A & B encoding for Rita */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
240 return((n - 4096) << 3);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
241 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
242
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
243 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
244 /* Convert_l1_radio_freq */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
245 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
246 /* conversion of l1 radio_freq to */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
247 /* real channel number */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
248 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
249 SYS_UWORD16 Convert_l1_radio_freq(SYS_UWORD16 radio_freq)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
250 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
251 switch(l1_config.std.id)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
252 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
253 case GSM:
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
254 case DCS1800:
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
255 case PCS1900:
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
256 case GSM850:
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
257 return (radio_freq);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
258 //omaps00090550 break;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
259
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
260 case DUAL:
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
261 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
262 if (radio_freq < l1_config.std.first_radio_freq_band2)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
263 // GSM band...
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
264 return(radio_freq);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
265 else
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
266 // DCS band...
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
267 return (radio_freq - l1_config.std.first_radio_freq_band2 + 512);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
268 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
269 //omaps00090550 break;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
270
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
271 case DUALEXT:
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
272 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
273 if (radio_freq < l1_config.std.first_radio_freq_band2)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
274 // E-GSM band...
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
275 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
276 if(radio_freq <= 124)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
277 // GSM part...
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
278 return(radio_freq);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
279 if(radio_freq < 174)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
280 // Extended part...
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
281 return (radio_freq - 125 + 975);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
282 else
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
283 // Extended part, special case of ARFCN=0
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
284 return(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
285 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
286 else
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
287 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
288 // DCS band...
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
289 return (radio_freq - l1_config.std.first_radio_freq_band2 + 512);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
290 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
291 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
292 // break;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
293
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
294 case GSM_E:
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
295 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
296 if(radio_freq <= 124)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
297 // GSM part...
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
298 return(radio_freq);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
299 else
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
300 if(radio_freq < 174)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
301 // Extended part...
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
302 return (radio_freq - 125 + 975);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
303 else
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
304 // Extended part, special case of ARFCN=0
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
305 return(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
306 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
307 //omaps00090550 break;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
308
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
309 case DUAL_US:
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
310 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
311 if (radio_freq < l1_config.std.first_radio_freq_band2)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
312 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
313 return(radio_freq - l1_config.std.first_radio_freq + 128);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
314 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
315 else
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
316 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
317 // PCS band...
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
318 return (radio_freq - l1_config.std.first_radio_freq_band2 + 512);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
319 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
320 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
321 // break;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
322
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
323 default: // should never occur.
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
324 return(radio_freq);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
325 } // end of switch
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
326 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
327
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
328 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
329 /* rf_init */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
330 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
331 /* Initialization routine for PLL */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
332 /* Effective downloading through TSP */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
333 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
334 /* Rita and LoCosto versions look totally */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
335 /* different, reconstructing from disasm. */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
336 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
337 WORD32 rf_init(WORD32 t)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
338 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
339 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
340 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, 0x47);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
341 t += 5;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
342 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
343 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_OFF);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
344 t += 8;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
345 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
346 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_ON);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
347 t += 5;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
348 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
349 TSP_TO_RF(0x0012);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
350 t += 7;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
351 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
352 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
353 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
354 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
355 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
356 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
357 TSP_TO_RF(0x003A);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
358 t += 117;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
359 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
360 TSP_TO_RF(0xC003);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
361 t += 7;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
362 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
363 TSP_TO_RF(0x02FE);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
364 t += 7;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
365 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
366 TSP_TO_RF(0x401F);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
367 t += 7;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
368 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
369 TSP_TO_RF(0x043D);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
370 t += 7;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
371 return(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
372 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
373
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
374 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
375 /* rf_init_light */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
376 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
377 /* Initialization routine for PLL */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
378 /* Effective downloading through TSP */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
379 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
380 WORD32 rf_init_light(WORD32 t)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
381 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
382 // initialization for change of multi-band configuration dependent on STD
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
383 return(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
384 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
385
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
386 UWORD8 arfcn_to_rf_index(SYS_UWORD16 arfcn)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
387 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
388 UWORD8 index;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
389 extern const T_STD_CONFIG std_config[];
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
390 index = std_config[l1_config.std.id].band[0];
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
391
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
392 if ((std_config[l1_config.std.id].band[1] != BAND_NONE) && IS_HIGH_BAND(arfcn))
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
393 index = std_config[l1_config.std.id].band[1];
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
394
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
395 return (index - 1);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
396 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
397
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
398 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
399 /* rf_program */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
400 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
401 /* Programs the RF synthesizer */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
402 /* called each frame */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
403 /* downloads NA counter value */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
404 /* t = start time in the current frame */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
405 /*------------------------------------------*/ //change 2 UWORD8
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
406 UWORD32 rf_program(UWORD32 t, SYS_UWORD16 radio_freq, UWORD32 rx)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
407 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
408 UWORD32 rfdiv;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
409 SYS_UWORD16 arfcn;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
410
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
411 rfband = Cust_is_band_high(radio_freq);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
412
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
413 arfcn = Convert_l1_radio_freq(radio_freq);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
414 #ifdef ARFCN_DEBUG
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
415 trace_arfcn(arfcn);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
416 #endif
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
417 rf_index = arfcn_to_rf_index(arfcn);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
418
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
419 rfdiv = calc_a_b(arfcn, rx);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
420
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
421 if (rx != 1) {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
422 TSP_TO_RF(rfdiv | REG_PLL);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
423 *TP_Ptr++ = TPU_FAT(0x1274);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
424 TSP_TO_RF(0x043A | rf_chip_band);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
425 } else {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
426 TSP_TO_RF(rfdiv | REG_PLL);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
427 *TP_Ptr++ = TPU_FAT(0x12FD);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
428 TSP_TO_RF(0x023A | rf_chip_band);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
429 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
430
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
431 return(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
432 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
433
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
434 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
435 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
436 /* EXTERNAL FUNCTIONS CALLED BY LAYER1 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
437 /* COMMON TO L1 and TOOLKIT */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
438 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
439 /**************************************************************************/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
440
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
441 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
442 /* agc */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
443 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
444 /* Program a gain into IF amp */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
445 /* agc_value : gain in dB */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
446 /* */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
447 /* additional parameter for LNA setting */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
448 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
449 /* Rita and LoCosto versions look totally */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
450 /* different, reconstructing from disasm. */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
451 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
452
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
453 void l1dmacro_agc(SYS_UWORD16 radio_freq, WORD8 gain, UWORD8 lna_off)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
454 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
455 int agc_table_index;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
456 UWORD16 rf_data;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
457
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
458 agc_table_index = gain - 2;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
459 if (agc_table_index < 0)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
460 agc_table_index++;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
461 agc_table_index >>= 1;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
462 if (gain >= 42)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
463 agc_table_index = 19;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
464 if (gain < 16)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
465 agc_table_index = 6;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
466 *TP_Ptr++ = TPU_FAT(0x1334);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
467 rf_data = REG_RX;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
468 if (!lna_off)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
469 rf_data |= RF_GAIN;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
470 rf_data |= AGC_TABLE[agc_table_index] << 11;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
471 rf_data |= RX_CAL_MODE;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
472 TSP_TO_RF(rf_data);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
473 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
474
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
475 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
476 /* l1dmacro_rx_synth */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
477 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
478 /* programs RF synth for recceive */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
479 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
480 void l1dmacro_rx_synth(SYS_UWORD16 radio_freq)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
481 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
482 UWORD32 t;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
483
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
484 // Important: always use rx_synth_start_time for first TPU_AT
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
485 // Never remove below 2 lines!!!
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
486 t = l1_config.params.rx_synth_start_time;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
487 *TP_Ptr++ = TPU_FAT (t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
488
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
489 t = rf_program(t, radio_freq, 1); // direction is set to 1 for Rx
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
490 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
491
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
492 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
493 /* l1dmacro_tx_synth */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
494 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
495 /* programs RF synth for transmit */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
496 /* programs OPLL for transmit */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
497 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
498 void l1dmacro_tx_synth(SYS_UWORD16 radio_freq)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
499 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
500 UWORD32 t;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
501
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
502 // Important: always use tx_synth_start_time for first TPU_AT
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
503 // Never remove below 2 lines!!!
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
504 t = l1_config.params.tx_synth_start_time;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
505 *TP_Ptr++ = TPU_FAT (t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
506
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
507 t = rf_program(t, radio_freq, 0); // direction set to 0 for Tx
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
508 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
509
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
510 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
511 /* l1dmacro_rx_up */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
512 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
513 /* Open window for normal burst reception */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
514 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
515 /* Rita version differs from LoCosto, */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
516 /* reconstructing from disassembly. */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
517 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
518 void l1dmacro_rx_up (void)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
519 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
520 *TP_Ptr++ = TPU_FAT(0x1377);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
521 TSP_TO_RF(0x0A3A | rf_chip_band);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
522 *TP_Ptr++ = TPU_FAT(0x137E);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
523 TSP_TO_ABB(0x10);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
524 *TP_Ptr++ = TPU_FAT(0x1383);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
525 TSP_TO_ABB(0x18);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
526 *TP_Ptr++ = TPU_FAT(58);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
527 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_up | RF_SER_ON);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
528 *TP_Ptr++ = TPU_FAT(62);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
529 TSP_TO_ABB(0x14);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
530 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
531
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
532 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
533 /* l1pdmacro_rx_down */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
534 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
535 /* Close window for normal burst reception */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
536 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
537 /* Rita version differs from LoCosto, */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
538 /* reconstructing from disassembly. */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
539 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
540 void l1dmacro_rx_down (WORD32 t)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
541 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
542 *TP_Ptr++ = TPU_FAT(t - 37);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
543 TSP_TO_RF(0x003A);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
544 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_down | RF_SER_ON);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
545 *TP_Ptr++ = TPU_FAT(t - 4);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
546 TSP_TO_ABB(0x00);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
547 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
548
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
549 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
550 /* l1dmacro_tx_up */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
551 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
552 /* Open transmission window for normal burst*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
553 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
554 /* Rita version differs from LoCosto, */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
555 /* reconstructing from disassembly. */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
556 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
557 void l1dmacro_tx_up (void)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
558 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
559 if (l1_config.std.id == DCS1800 ||
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
560 rfband == MULTI_BAND2 &&
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
561 (l1_config.std.id == DUAL || l1_config.std.id == DUALEXT)) {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
562 *TP_Ptr++ = TPU_FAT(0x127E);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
563 TSP_TO_RF(0x0007);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
564 *TP_Ptr++ = TPU_FAT(0x1288);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
565 TSP_TO_RF(0xC00B);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
566 *TP_Ptr++ = TPU_FAT(0x1292);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
567 TSP_TO_RF(0x3077);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
568 } else {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
569 *TP_Ptr++ = TPU_FAT(0x127E);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
570 TSP_TO_RF(0xC003);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
571 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
572 *TP_Ptr++ = TPU_FAT(0x12C6);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
573 TSP_TO_ABB(0x80);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
574 *TP_Ptr++ = TPU_FAT(0x12E3);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
575 TSP_TO_RF(0x243A | rf_chip_band);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
576 *TP_Ptr++ = TPU_FAT(0x1302);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
577 TSP_TO_ABB(0xC0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
578 *TP_Ptr++ = TPU_FAT(0x1352);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
579 TSP_TO_ABB(0x80);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
580 *TP_Ptr++ = TPU_FAT(0x1384);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
581 TSP_TO_ABB(0xA0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
582 *TP_Ptr++ = TPU_FAT(16);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
583 #if CONFIG_TARGET_COMPAL || CONFIG_TARGET_PIRELLI
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
584 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_up & 0xFF
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
585 | RF_SER_ON);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
586 *TP_Ptr++ = TPU_MOVE(TSP_ACTX, rf_path[rf_index].tx_up >> 8);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
587 *TP_Ptr++ = TPU_FAT(21);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
588 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_up & 0xFF
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
589 | PA_ENABLE | RF_SER_ON);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
590 #else
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
591 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_up | RF_SER_ON);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
592 *TP_Ptr++ = TPU_FAT(21);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
593 *TP_Ptr++ = TPU_MOVE(TSP_ACTX, 0x0F);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
594 #endif
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
595 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
596
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
597 /*-------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
598 /* l1dmacro_tx_down */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
599 /*-------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
600 /* Close transmission window for normal burst*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
601 /*-------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
602 /* Rita version differs from LoCosto, */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
603 /* reconstructing from disassembly. */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
604 /*-------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
605 void l1dmacro_tx_down (WORD32 t, BOOL tx_flag, UWORD8 adc_active)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
606 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
607 if (adc_active == ACTIVE)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
608 l1dmacro_adc_read_tx(t - 44);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
609 *TP_Ptr++ = TPU_FAT(t - 4);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
610 TSP_TO_ABB(0x80);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
611 *TP_Ptr++ = TPU_FAT(t + 22);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
612 *TP_Ptr++ = TPU_MOVE(TSP_ACTX, 0x00);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
613 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].tx_down | RF_SER_ON);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
614 *TP_Ptr++ = TPU_FAT(t + 25);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
615 TSP_TO_RF(0x003A);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
616 *TP_Ptr++ = TPU_FAT(t + 31);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
617 TSP_TO_ABB(0x00);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
618 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
619
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
620 /*
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
621 * l1dmacro_rx_nb
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
622 *
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
623 * Receive Normal burst
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
624 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
625 void l1dmacro_rx_nb (SYS_UWORD16 radio_freq)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
626 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
627 l1dmacro_rx_up();
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
628 l1dmacro_rx_down(STOP_RX_SNB);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
629 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
630
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
631 /*
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
632 * l1dmacro_rx_sb
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
633 * Receive Synchro burst
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
634 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
635 void l1dmacro_rx_sb (SYS_UWORD16 radio_freq)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
636 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
637 l1dmacro_rx_up();
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
638 l1dmacro_rx_down (STOP_RX_SB);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
639 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
640
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
641 /*
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
642 * l1dmacro_rx_ms
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
643 *
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
644 * Receive Power Measurement window
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
645 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
646 void l1dmacro_rx_ms (SYS_UWORD16 radio_freq)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
647 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
648 l1dmacro_rx_up();
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
649 l1dmacro_rx_down (STOP_RX_PW_1);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
650 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
651
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
652 /*
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
653 * l1dmacro_rx_fb
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
654 *
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
655 * Receive Frequency burst
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
656 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
657 void l1dmacro_rx_fb (SYS_UWORD16 radio_freq)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
658 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
659 l1dmacro_rx_up();
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
660
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
661 *TP_Ptr++ = TPU_AT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
662 *TP_Ptr++ = TPU_AT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
663 *TP_Ptr++ = TPU_AT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
664 *TP_Ptr++ = TPU_AT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
665 *TP_Ptr++ = TPU_AT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
666 *TP_Ptr++ = TPU_AT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
667 *TP_Ptr++ = TPU_AT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
668 *TP_Ptr++ = TPU_AT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
669 *TP_Ptr++ = TPU_AT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
670 *TP_Ptr++ = TPU_AT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
671 *TP_Ptr++ = TPU_AT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
672
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
673 l1dmacro_rx_down (STOP_RX_FB);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
674 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
675
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
676 /*
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
677 * l1dmacro_rx_fb26
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
678 *
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
679 * Receive Frequency burst for TCH.
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
680 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
681 void l1dmacro_rx_fb26 (SYS_UWORD16 radio_freq)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
682 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
683 l1dmacro_rx_up();
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
684
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
685 *TP_Ptr++ = TPU_AT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
686
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
687 l1dmacro_rx_down (STOP_RX_FB26);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
688 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
689
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
690 /*
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
691 * l1dmacro_tx_nb
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
692 *
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
693 * Transmit Normal burst
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
694 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
695 void l1dmacro_tx_nb (SYS_UWORD16 radio_freq, UWORD8 txpwr, UWORD8 adc_active)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
696 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
697 l1dmacro_tx_up ();
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
698 l1dmacro_tx_down (l1_config.params.tx_nb_duration, FALSE, adc_active);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
699 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
700
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
701 /*
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
702 * l1dmacro_tx_ra
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
703 *
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
704 * Transmit Random Access burst
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
705 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
706 void l1dmacro_tx_ra (SYS_UWORD16 radio_freq, UWORD8 txpwr, UWORD8 adc_active)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
707 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
708 l1dmacro_tx_up ();
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
709 l1dmacro_tx_down (l1_config.params.tx_ra_duration, FALSE, adc_active);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
710 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
711
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
712 #if TESTMODE
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
713 /*
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
714 * l1dmacro_rx_cont
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
715 *
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
716 * Receive continuously
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
717 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
718 void l1dmacro_rx_cont (SYS_UWORD16 radio_freq, UWORD8 txpwr)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
719 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
720 l1dmacro_rx_up ();
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
721 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
722
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
723 /*
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
724 * l1dmacro_tx_cont
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
725 *
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
726 * Transmit continuously
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
727 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
728 void l1dmacro_tx_cont (SYS_UWORD16 radio_freq, UWORD8 txpwr)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
729 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
730 l1dmacro_tx_up ();
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
731 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
732
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
733 /*
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
734 * l1d_macro_stop_cont
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
735 *
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
736 * Stop continuous Tx or Rx
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
737 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
738 void l1dmacro_stop_cont (void)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
739 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
740 if (l1_config.tmode.rf_params.down_up == TMODE_DOWNLINK)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
741 l1dmacro_rx_down(STOP_RX_SNB);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
742 else
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
743 l1dmacro_tx_down(l1_config.params.tx_nb_duration, FALSE, 0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
744 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
745 #endif /* TESTMODE */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
746
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
747
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
748 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
749 /* l1dmacro_reset_hw */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
750 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
751 /* Reset and set OFFSET register */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
752 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
753
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
754 void l1dmacro_reset_hw(UWORD32 servingCellOffset)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
755 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
756 TPU_Reset(1); // reset TPU only, no TSP reset
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
757 TPU_Reset(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
758 TP_Ptr = (UWORD16 *) TPU_RAM;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
759
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
760 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_ON);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
761 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_ON | FEM_OFF);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
762
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
763 *TP_Ptr++ = TPU_OFFSET(servingCellOffset);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
764 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
765
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
766 // l1dmacro_RF_sleep
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
767 // Program RF for BIG or DEEP sleep
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
768
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
769
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
770 /* Rita version differs from LoCosto, reconstructing from disassembly */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
771 void l1dmacro_RF_sleep (void)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
772 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
773 TSP_TO_RF(0x0002);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
774 *TP_Ptr++ = TPU_MOVE(TSP_ACT, RF_SER_ON);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
775 *TP_Ptr++ = TPU_WAIT(1);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
776 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET1, 0x21);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
777 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET2, 0x02);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
778 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, TC1_DEVICE_RF | 0x01);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
779 *TP_Ptr++ = TPU_MOVE(TSP_CTRL2, TC2_WR);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
780 *TP_Ptr++ = TPU_WAIT(100);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
781 /* code from tpudrv61.c follows, same for Rita and LoCosto */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
782 *TP_Ptr++ = TPU_SLEEP;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
783 TP_Ptr = (SYS_UWORD16 *) TPU_RAM;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
784 TP_Enable(1);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
785 /*
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
786 * The following call does not appear in tpudrv12.obj, and
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
787 * there is no TPU_wait_idle() function in Leonardo tpudrv.obj
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
788 * either. But this wait operation makes sense to me, so
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
789 * I'm keeping it as-is from the LoCosto version for now.
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
790 * -- Space Falcon
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
791 */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
792 TPU_wait_idle();
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
793 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
794
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
795 // l1dmacro_RF_wakeup
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
796 //* wakeup RF from BIG or DEEP sleep
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
797
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
798 /* Rita version differs from LoCosto, reconstructing from disassembly */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
799 void l1dmacro_RF_wakeup (void)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
800 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
801 TP_Ptr = (SYS_UWORD16 *) TPU_RAM;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
802 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET1, 0x01);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
803 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET2, 0x06);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
804 *TP_Ptr++ = TPU_MOVE(TSP_CTRL1, TC1_DEVICE_RF | 0x01);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
805 *TP_Ptr++ = TPU_MOVE(TSP_CTRL2, TC2_WR);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
806 *TP_Ptr++ = TPU_WAIT(100);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
807 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_down | RF_SER_ON);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
808 *TP_Ptr++ = TPU_WAIT(1);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
809 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_down | RF_SER_OFF);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
810 *TP_Ptr++ = TPU_WAIT(8);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
811 *TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_down | RF_SER_ON);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
812 *TP_Ptr++ = TPU_WAIT(5);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
813 TSP_TO_RF(0x0012);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
814 *TP_Ptr++ = TPU_FAT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
815 *TP_Ptr++ = TPU_FAT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
816 *TP_Ptr++ = TPU_FAT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
817 *TP_Ptr++ = TPU_FAT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
818 *TP_Ptr++ = TPU_FAT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
819 *TP_Ptr++ = TPU_FAT(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
820 TSP_TO_RF(0x003A);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
821 *TP_Ptr++ = TPU_WAIT(7);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
822 TSP_TO_RF(0xC003);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
823 *TP_Ptr++ = TPU_WAIT(7);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
824 TSP_TO_RF(0x02FE);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
825 *TP_Ptr++ = TPU_WAIT(7);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
826 TSP_TO_RF(0x401F);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
827 *TP_Ptr++ = TPU_WAIT(7);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
828 TSP_TO_RF(0x043D);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
829 *TP_Ptr++ = TPU_WAIT(7);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
830 *TP_Ptr++ = TPU_WAIT(117);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
831 /* code from tpudrv61.c follows, same for Rita and LoCosto */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
832 *TP_Ptr++ = TPU_SLEEP;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
833 TP_Ptr = (SYS_UWORD16 *) TPU_RAM;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
834 TP_Enable(1);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
835 /* same issue as in the previous function */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
836 TPU_wait_idle();
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
837 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
838
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
839
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
840 // l1dmacro_init_hw
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
841 // Reset VEGA, then remove reset
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
842 // Init RF/IF synthesizers
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
843
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
844 void l1dmacro_init_hw(void)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
845 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
846 WORD32 t = 100; // start time for actions
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
847
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
848 TP_Reset(1); // reset TPU and TSP
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
849
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
850 // GSM 1.5 : TPU clock enable is in TPU
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
851 //---------------------------------------
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
852 TPU_ClkEnable(1); // TPU CLOCK ON
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
853
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
854 TP_Reset(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
855
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
856
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
857 TP_Ptr = (UWORD16 *) TPU_RAM;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
858
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
859 // Set FEM to inactive state before turning ON the RF Board
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
860 // At this point the RF regulators are still OFF. Thus the
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
861 // FEM command is not inverted yet => Must use the FEM "SLEEP programming"
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
862 *TP_Ptr++ = TPU_MOVE(TSP_ACT, FEM_SLEEP | RF_SER_ON);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
863
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
864 // TPU_SLEEP
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
865 l1dmacro_idle();
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
866
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
867 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
868 *TP_Ptr++ = TPU_SYNC(0);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
869
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
870 /* from disassembly, differs from LoCosto version */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
871 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET1, 0x20);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
872 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET2, 0x06);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
873 *TP_Ptr++ = TPU_MOVE(TSP_SPI_SET3, 0x00);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
874
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
875 t = 1000; // arbitrary start time
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
876
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
877 t = rf_init(t); // Initialize RF Board
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
878
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
879 *TP_Ptr++ = TPU_AT(t);
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
880
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
881 // TPU_SLEEP
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
882 l1dmacro_idle();
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
883
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
884 return;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
885 }
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
886
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
887 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
888 /* l1dmacro_init_hw_light */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
889 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
890 /* Reset VEGA, then remove reset */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
891 /* Init RF/IF synthesizers */
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
892 /*------------------------------------------*/
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
893 void l1dmacro_init_hw_light(void)
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
894 {
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
895 UWORD32 t = 100; // start time for actions //
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
896 TP_Ptr = (SYS_UWORD16 *) TPU_RAM; //
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
897 *TP_Ptr++ = TPU_AT(t); //
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
898 t = 1000; // arbitrary start time //
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
899
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
900 t = rf_init_light(t); // Initialize RF Board //
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
901
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
902 *TP_Ptr++ = TPU_AT(t); //
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
903 l1dmacro_idle(); //
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
904
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
905 return;
ffee43b74949 checking in tpudrv12 source adapted for C139 in TCS211 environment
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
906 }