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