annotate chipsetsw/layer1/p_cfile/l1p_driv.c @ 317:3a2c43579200

l1p_driv.c: initial import from LoCosto source
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 04 Oct 2017 04:36:06 +0000
parents 6814a6bced4f
children 08caa229dfa2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
317
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1 /************* Revision Controle System Header *************
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2 * GSM Layer 1 software
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
3 * L1P_DRIVE.C
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
4 *
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
5 * Filename l1p_driv.c
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
6 * Copyright 2003 (C) Texas Instruments
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
7 *
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
8 ************* Revision Controle System Header *************/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
9
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
10 #define L1P_DRIVE_C
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
11
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
12 #include "l1_macro.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
13 #include "l1_confg.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
14
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
15 #if L1_GPRS
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
16 #if (CODE_VERSION == SIMULATION)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
17 #include <string.h>
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
18 #include "l1_types.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
19 #include "sys_types.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
20 #include "l1_const.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
21 #include "l1_time.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
22 #if TESTMODE
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
23 #include "l1tm_defty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
24 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
25 #if (AUDIO_TASK == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
26 #include "l1audio_const.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
27 #include "l1audio_cust.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
28 #include "l1audio_defty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
29 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
30 #if (L1_GTT == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
31 #include "l1gtt_const.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
32 #include "l1gtt_defty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
33 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
34 #if (L1_MP3 == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
35 #include "l1mp3_defty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
36 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
37 #if (L1_MIDI == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
38 #include "l1midi_defty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
39 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
40 #include "l1_defty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
41 #include "l1_varex.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
42 #include "cust_os.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
43 #include "l1_msgty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
44 #if L2_L3_SIMUL
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
45 #include "hw_debug.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
46 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
47
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
48 #include "l1p_cons.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
49 #include "l1p_msgt.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
50 #include "l1p_deft.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
51 #include "l1p_vare.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
52 #include "l1p_tabs.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
53
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
54 #include "sim_cons.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
55 #include "sim_def.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
56 extern T_hw FAR hw;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
57 #include "l1_proto.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
58
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
59 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
60
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
61 #include <string.h>
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
62 #include "l1_types.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
63 #include "sys_types.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
64 #include "l1_const.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
65 #include "l1_time.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
66
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
67 #if TESTMODE
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
68 #include "l1tm_defty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
69 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
70 #if (AUDIO_TASK == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
71 #include "l1audio_const.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
72 #include "l1audio_cust.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
73 #include "l1audio_defty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
74 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
75 #if (L1_GTT == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
76 #include "l1gtt_const.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
77 #include "l1gtt_defty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
78 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
79 #if (L1_MP3 == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
80 #include "l1mp3_defty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
81 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
82 #if (L1_MIDI == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
83 #include "l1midi_defty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
84 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
85 #include "l1_defty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
86 #include "l1_varex.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
87 #include "cust_os.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
88 #include "l1_msgty.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
89 #if L2_L3_SIMUL
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
90 #include "hw_debug.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
91 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
92
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
93 #include "l1p_cons.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
94 #include "l1p_msgt.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
95 #include "l1p_deft.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
96 #include "l1p_vare.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
97 #include "l1p_tabs.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
98
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
99 #include "l1_proto.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
100 #include "tpudrv.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
101
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
102 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
103
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
104 #if(RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
105 #include "l1_rf61.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
106 #include "tpudrv61.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
107 #include "l1_ctl.h"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
108 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
109
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
110 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
111 /* Prototypes of external functions used in this file. */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
112 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
113 void l1dmacro_synchro (UWORD32 when, UWORD32 value);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
114 void l1dmacro_offset (UWORD32 offset_value, WORD32 relative_time);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
115 void l1dmacro_afc (UWORD16 afc_value, UWORD8 win_id);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
116
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
117 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3) || (RF_FAM == 61) )
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
118 UWORD16 Cust_get_pwr_data(UWORD8 txpwr, UWORD16 radio_freq
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
119 #if(REL99 && FF_PRF)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
120 ,UWORD8 number_uplink_timeslot
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
121 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
122 );
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
123 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
124 void Cust_get_ramp_tab(API *a_ramp, UWORD8 txpwr_ramp_up, UWORD8 txpwr_ramp_down, UWORD16 radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
125
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
126 BOOL l1ps_swap_iq_ul (UWORD16 radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
127 BOOL l1ps_swap_iq_dl (UWORD16 radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
128 #if (L1_MADC_ON == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
129 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
130 void l1pdmacro_rx_up (UWORD16 radio_freq,UWORD8 adc_active, UWORD8 csf_filter_choice
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
131 #if (NEW_SNR_THRESHOLD == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
132 ,UWORD8 saic_flag
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
133 #endif /* NEW_SNR_THRESHOLD == 1*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
134 );
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
135 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
136 #else /* RF_FAM == 61*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
137 void l1pdmacro_rx_up (UWORD16 radio_freq, UWORD8 csf_filter_choice);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
138 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
139 void l1pdmacro_rx_down (UWORD16 radio_freq, UWORD8 num_rx, BOOL rx_done_flag);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
140 void l1pdmacro_tx_up (UWORD16 radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
141 void l1pdmacro_tx_down (UWORD16 radio_freq, WORD16 time, BOOL tx_flag, UWORD8 timing_advance,UWORD8 adc_active);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
142 void l1pdmacro_tx_synth(UWORD16 radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
143 void l1pdmacro_anchor (WORD16 time);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
144
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
145 void l1dmacro_rx_synth(UWORD16 radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
146 void l1dmacro_agc(UWORD16 radio_freq, WORD8 agc_value, UWORD8 lna_off
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
147 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
148 ,UWORD8 if_ctl
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
149 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
150 );
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
151 #if (CODE_VERSION == SIMULATION)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
152 void l1dmacro_rx_ms (UWORD16 arfcn, BOOL rxnb_select);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
153 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
154 #if (L1_MADC_ON == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
155 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
156 void l1dmacro_rx_ms (UWORD16 arfcn,UWORD8 adc_active);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
157 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
158 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
159 void l1dmacro_rx_ms (UWORD16 arfcn);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
160 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
161 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
162 void l1pdmacro_it_dsp_gen(WORD16 time);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
163
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
164 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
165 /* Prototypes of functions defined in this file. */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
166 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
167 // TPU Drivers...
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
168
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
169
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
170 // DSP Drivers...
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
171 void l1pddsp_synchro (UWORD8 switch_mode, UWORD8 camp_timeslot);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
172 void l1pddsp_idle_prach_data (BOOL polling, UWORD8 cs_type, UWORD16 channel_request_data,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
173 UWORD8 bsic, UWORD16 radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
174 void l1pddsp_idle_prach_power (UWORD8 txpwr, UWORD16 radio_freq, UWORD8 ts);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
175 void l1pddsp_single_tx_block (UWORD8 burst_nb, UWORD8 *data, UWORD8 tsc,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
176 UWORD16 radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
177 #if FF_L1_IT_DSP_USF
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
178 void l1pddsp_idle_rx_nb (UWORD8 burst_nb, UWORD8 tsq, UWORD16 radio_freq,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
179 UWORD8 timeslot_no, BOOL ptcch_dl, BOOL usf_interrupt);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
180 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
181 void l1pddsp_idle_rx_nb (UWORD8 burst_nb, UWORD8 tsq, UWORD16 radio_freq,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
182 UWORD8 timeslot_no, BOOL ptcch_dl);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
183 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
184 void l1pddsp_transfer_mslot_ctrl (UWORD8 burst_nb, UWORD8 dl_bitmap, UWORD8 ul_bitmap,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
185 UWORD8 *usf_table, UWORD8 mac_mode, UWORD8 *ul_buffer_index,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
186 UWORD8 tsc, UWORD16 radio_freq, UWORD8 synchro_timeslot,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
187 #if FF_L1_IT_DSP_USF
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
188 UWORD8 dsp_usf_interrupt
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
189 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
190 UWORD8 usf_vote_enable
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
191 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
192 );
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
193 void l1pddsp_transfer_mslot_power (UWORD8 *txpwr, UWORD16 radio_freq, UWORD8 ul_bitmap);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
194 void l1pddsp_ul_ptcch_data (UWORD8 cs_type, UWORD16 channel_request_data, UWORD8 bsic,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
195 UWORD16 radio_freq, UWORD8 timeslot_no);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
196 void l1pddsp_interf_meas_ctrl (UWORD8 nb_meas_req);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
197 void l1pddsp_transfer_meas_ctrl (UWORD8 meas_position);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
198
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
199 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
200 /* l1pd_afc() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
201 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
202 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
203 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
204 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
205 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
206 void l1pd_afc(void)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
207 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
208 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
209 l1ddsp_load_afc(l1s.afc);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
210 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
211 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
212 l1dtpu_load_afc(l1s.afc);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
213 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
214 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
215
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
216 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
217 /* l1pdtpu_interf_meas() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
218 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
219 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
220 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
221 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
222 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
223 UWORD8 l1pdtpu_interf_meas(UWORD16 radio_freq,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
224 WORD8 agc,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
225 UWORD8 lna_off,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
226 UWORD8 meas_bitmap,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
227 UWORD32 offset_serv,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
228 UWORD16 win_id,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
229 UWORD8 synchro_ts
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
230 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
231 ,UWORD8 if_ctl
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
232 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
233 )
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
234 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
235 UWORD8 bit_mask = 0x80;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
236 UWORD8 ts;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
237 BOOL rf_programmed = FALSE;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
238 UWORD8 count = 0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
239
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
240 if(!win_id)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
241 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
242 // Nothing programmed yet, we must avoid Mirror effect in Ctrl phase.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
243 l1pdmacro_anchor(l1_config.params.rx_change_offset_time);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
244 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
245
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
246 for (ts=0; ts<8; ts++)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
247 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
248 // the bitmap corresponds to that of the idle frame of the network!!!
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
249 #if ((CHIPSET==3)||(CHIPSET == 4))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
250 // limitation of 5 measurements for SAMSON (TPU RAM size limitation)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
251 if((meas_bitmap & bit_mask)&&(count <= 4))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
252 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
253 if(meas_bitmap & bit_mask)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
254 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
255 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
256 UWORD16 local_win_id;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
257 UWORD16 offset;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
258 WORD16 when;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
259 UWORD16 offset_chg;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
260
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
261 if((ts>synchro_ts) && (count==0))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
262 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
263 // The 1st Work does not contain any Interf meas.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
264 // We must ovoid a possible Mirror effect for the rest of TS.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
265 l1pdmacro_anchor(l1_config.params.rx_change_offset_time);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
266 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
267
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
268 // Increment nbr of meas. programmed.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
269 count++;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
270
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
271 local_win_id = (8 - synchro_ts + ts) * BP_SPLIT;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
272 if(local_win_id >= (BP_SPLIT * 8)) local_win_id -= BP_SPLIT * 8; // Modulo.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
273
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
274 // Compute offset
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
275 offset_chg = ((local_win_id * BP_DURATION) >> BP_SPLIT_PW2);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
276 offset = offset_serv + offset_chg;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
277 if(offset >= TPU_CLOCK_RANGE) offset -= TPU_CLOCK_RANGE;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
278
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
279 if(!rf_programmed)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
280 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
281 // Compute offset change timing
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
282 when = offset_chg +
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
283 PROVISION_TIME -
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
284 l1_config.params.rx_synth_setup_time -
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
285 EPSILON_OFFS;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
286
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
287 if(when < 0) when += TPU_CLOCK_RANGE;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
288
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
289 // Program TPU scenario
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
290 l1dmacro_offset (offset, when); // change TPU offset according to win_id
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
291 l1dmacro_rx_synth (radio_freq); // pgme SYNTH.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
292 #if (RF_FAM !=61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
293 l1dmacro_agc (radio_freq, agc,lna_off); // pgme AGC.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
294 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
295
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
296 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
297 l1dmacro_agc (radio_freq, agc,lna_off, if_ctl); // pgme AGC.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
298 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
299
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
300 rf_programmed = TRUE;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
301 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
302 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
303 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
304 // Compute offset change timing
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
305 when = offset_chg - BP_DURATION + PROVISION_TIME + PW_ACQUIS_DURATION + 20;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
306 if(when < 0) when += TPU_CLOCK_RANGE;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
307
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
308 // Program TPU scenario
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
309 l1dmacro_offset (offset, when); // change TPU offset according to win_id
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
310 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
311
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
312 #if (CODE_VERSION == SIMULATION)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
313 l1dmacro_rx_ms (radio_freq, 1); // pgm PWR acquisition.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
314 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
315 #if (L1_MADC_ON == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
316 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
317 l1dmacro_rx_ms (radio_freq,INACTIVE); // pgm PWR acquisition.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
318 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
319 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
320 l1dmacro_rx_ms (radio_freq); // pgm PWR acquisition.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
321 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
322 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
323
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
324 l1dmacro_offset (offset_serv, IMM); // restore offset
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
325 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
326
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
327 bit_mask >>= 1;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
328
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
329 } // for(ts...
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
330
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
331 return(count);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
332 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
333
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
334 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
335 /* l1dtpu_serv_rx() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
336 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
337 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
338 /* rx_id: range 0-7, first slot of RX group */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
339 /* rx_group_id: used in case |RX| |RX| */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
340 /* */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
341 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
342 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
343 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
344 void l1pdtpu_serv_rx_nb(UWORD16 radio_freq, WORD8 agc, UWORD8 lna_off,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
345 UWORD8 rx_id, UWORD32 offset_serv, UWORD8 num_rx,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
346 UWORD8 rx_group_id, BOOL rx_done_flag,UWORD8 adc_active,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
347 UWORD8 csf_filter_choice
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
348 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
349 ,UWORD8 if_ctl
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
350 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
351 #if (NEW_SNR_THRESHOLD == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
352 ,UWORD8 saic_flag
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
353 #endif /* NEW_SNR_THRESHOLD*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
354 )
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
355 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
356 UWORD16 offset;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
357
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
358 #if (CODE_VERSION == SIMULATION)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
359 UWORD32 tpu_w_page;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
360
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
361 if (hw.tpu_r_page==0)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
362 tpu_w_page=1;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
363 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
364 tpu_w_page=0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
365
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
366 hw.rx_id[tpu_w_page][rx_group_id-1]=rx_id;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
367 hw.num_rx[tpu_w_page][rx_group_id-1]=num_rx;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
368 hw.rx_group_id[tpu_w_page]=rx_group_id;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
369 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
370
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
371 offset = offset_serv + (rx_id * BP_DURATION);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
372 if(offset >= TPU_CLOCK_RANGE) offset -= TPU_CLOCK_RANGE;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
373
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
374 if (rx_group_id == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
375 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
376 // Time tracking.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
377 l1dmacro_synchro (l1_config.params.rx_change_synchro_time, offset_serv); // Adjust serving OFFSET.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
378
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
379 #if L2_L3_SIMUL
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
380 #if (DEBUG_TRACE == BUFFER_TRACE_OFFSET)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
381 buffer_trace(3, 0x43, offset_serv, l1s.actual_time.fn, 0);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
382 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
383 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
384
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
385 // Change offset to align on RX.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
386 l1dmacro_offset(offset, IMM);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
387
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
388 // Program Synth.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
389 // Program ADC measurement
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
390 // Program AGC.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
391 l1dmacro_rx_synth(radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
392 if(adc_active == ACTIVE)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
393 l1dmacro_adc_read_rx();
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
394
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
395 l1dmacro_agc (radio_freq, agc, lna_off
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
396 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
397 ,if_ctl
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
398 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
399 );
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
400 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
401 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
402 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
403 // Change offset to align on RX.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
404 l1dmacro_offset(offset, IMM); // Change offset to align on RX.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
405 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
406
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
407 l1pdmacro_rx_up (radio_freq,adc_active, csf_filter_choice
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
408 #if (NEW_SNR_THRESHOLD == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
409 ,saic_flag
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
410 #endif /* NEW_SNR_THRESHOLD*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
411
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
412 ); // RX window opened.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
413 l1pdmacro_rx_down(radio_freq, num_rx, rx_done_flag); // RX window closed.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
414
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
415 // Restore offset to synchro value.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
416 l1dmacro_offset (offset_serv, IMM);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
417 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
418
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
419 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
420 /* l1dtpu_serv_tx() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
421 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
422 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
423 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
424 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
425 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
426 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
427 #ifndef ABB_RAMP_UP_TIME //Flexi ABB Delays defines it in tpudrvXX.h
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
428 #define ABB_RAMP_UP_TIME 32 // maximum time for ramp up
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
429 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
430
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
431 #ifndef ABB_RAMP_DELAY//Flexi ABB Delays defines it in tpudrvXX.h
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
432 #define ABB_RAMP_DELAY 6 // minimum ramp delay APCDEL
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
433 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
434
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
435 #ifndef ABB_BULON_HOLD_TIME //Flexi ABB Delays defines it in tpudrvXX.h
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
436 #define ABB_BULON_HOLD_TIME 32 // min. hold time for BULON after BULENA down
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
437 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
438
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
439
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
440 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
441 void l1pdtpu_serv_tx(UWORD16 radio_freq,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
442 UWORD8 timing_advance,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
443 UWORD32 offset_serv,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
444 UWORD8 tx_id,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
445 UWORD8 num_tx,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
446 UWORD8 tx_group_id,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
447 UWORD8 switch_flag,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
448 BOOL burst_type,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
449 BOOL rx_flag,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
450 UWORD8 adc_active)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
451 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
452 WORD16 time;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
453 UWORD32 offset_tx;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
454 UWORD32 timing_advance_in_qbit = (UWORD32)timing_advance << 2;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
455 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3) || (RF_FAM == 61))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
456 UWORD16 apcdel1_data, apcdel1_data_up;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
457 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
458 UWORD8 i;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
459 static UWORD8 static_switch_flag = 0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
460
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
461 #if (CODE_VERSION == SIMULATION)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
462 UWORD32 tpu_w_page;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
463
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
464 if (hw.tpu_r_page==0)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
465 tpu_w_page=1;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
466 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
467 tpu_w_page=0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
468
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
469 hw.tx_id[tpu_w_page][tx_group_id-1]=tx_id;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
470 hw.num_tx[tpu_w_page][tx_group_id-1]=num_tx;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
471 hw.tx_group_id[tpu_w_page]=tx_group_id;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
472 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
473
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
474 // Reset timing advance if TA_ALGO not enabled.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
475 #if !TA_ALGO
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
476 timing_advance_in_qbit = 0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
477 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
478
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
479 // In case another group of TX bursts is called, the previous slot was a hole
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
480 // An IT has to be generated to the DSP so that ramps and power level are reloaded
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
481 // This does not apply to combinations of PRACH and TX NB
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
482 if ((tx_group_id > 1) && (!static_switch_flag))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
483 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
484 // exact timing for generation of IT during hole not required but
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
485 // time > time of previous ramp down (BULENA -> BULON down = 32 qb) + margin (10 qb)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
486 #if (RF_FAM != 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
487 time = TX_TABLE[tx_id-1] + PROVISION_TIME + ABB_BULON_HOLD_TIME + 10
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
488 - l1_config.params.prg_tx_gsm;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
489 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
490
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
491 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
492 time = TX_TABLE[tx_id-1] + PROVISION_TIME + APC_RAMP_DOWN_TIME + 10
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
493 - l1_config.params.prg_tx_gsm;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
494 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
495
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
496 if (burst_type == TX_NB_BURST)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
497 time -= timing_advance_in_qbit; // time can never be negative here
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
498
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
499 l1pdmacro_it_dsp_gen(time);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
500 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
501
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
502
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
503 if (tx_group_id == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
504 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
505 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
506 //MS TX, set ABB in MS mode
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
507 #if (DSP == 33) || (DSP == 34) || (DSP == 35) || (DSP == 36) || (DSP == 37)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
508 // ABB set to MS mode if |TX|TX|.., |TX|PRACH|, |PRACH|TX| or |PRACH|PRACH|
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
509 // switch_flag is set for the first burst of TX/PRACH or PRACH/PRACH combinations
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
510 // MS mode in ABB must be maintained for second burst (static_switch_flag)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
511 if ((num_tx > 1) || (switch_flag) || (static_switch_flag))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
512 l1ps_dsp_com.pdsp_ndb_ptr->d_bbctrl_gprs = l1_config.params.bbctrl | B_MSLOT;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
513 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
514 l1ps_dsp_com.pdsp_ndb_ptr->d_bbctrl_gprs = l1_config.params.bbctrl;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
515 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
516 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
517 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
518 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
519 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
520 // handle special case |TX| |TX|TX|
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
521 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
522 //MS TX, set ABB in MS mode
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
523 #if (DSP == 33) || (DSP == 34) || (DSP == 35) || (DSP == 36) || (DSP == 37)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
524 if ((num_tx > 1) || (switch_flag) || (static_switch_flag))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
525 l1ps_dsp_com.pdsp_ndb_ptr->d_bbctrl_gprs = l1_config.params.bbctrl | B_MSLOT;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
526 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
527 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
528 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
529
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
530 // Compute offset value for TX.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
531 // PRG_TX has become variable, no longer contained in TIME_OFFSET_TX !
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
532 if ((burst_type == TX_NB_BURST) || (switch_flag==1))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
533 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
534 offset_tx = offset_serv + TX_TABLE[tx_id] + PROVISION_TIME
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
535 - l1_config.params.prg_tx_gsm - timing_advance_in_qbit;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
536 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
537 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
538 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
539 offset_tx = offset_serv + TX_TABLE[tx_id] + PROVISION_TIME
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
540 - l1_config.params.prg_tx_gsm;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
541 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
542
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
543 // offset_tx mod 5000
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
544 if (offset_tx >= TPU_CLOCK_RANGE)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
545 offset_tx -= TPU_CLOCK_RANGE;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
546
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
547 if(rx_flag == TRUE)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
548 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
549 time = offset_tx -
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
550 l1_config.params.tx_synth_setup_time -
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
551 EPSILON_OFFS
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
552 - offset_serv;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
553 if ((burst_type == TX_NB_BURST) || (switch_flag==1))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
554 time += timing_advance_in_qbit - TA_MAX;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
555 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
556 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
557 time = TPU_CLOCK_RANGE - EPSILON_SYNC;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
558
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
559 if (time < 0)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
560 time += TPU_CLOCK_RANGE;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
561
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
562 if (!static_switch_flag)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
563 l1dmacro_offset (offset_tx, (WORD32) time); // load OFFSET for TX before each burst.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
564
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
565 #if L2_L3_SIMUL
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
566 #if (DEBUG_TRACE == BUFFER_TRACE_OFFSET)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
567 buffer_trace(2, offset_tx,l1s.actual_time.fn,0,0);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
568 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
569 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
570
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
571 time=0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
572
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
573 // program PLL only if no TX control carried out in same frame: |TX| |TX|TX| possible
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
574 // |PRACH|TX|, |TX|PRACH| or |PRACH|PRACH| also possible
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
575 if (tx_group_id == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
576 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
577 l1pdmacro_tx_synth(radio_freq); // load SYNTH.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
578 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
579
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
580 if (!static_switch_flag) // window opened for previous time slot (TX/PRACH or PRACH/PRACH)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
581 l1pdmacro_tx_up(radio_freq); // TX window opened
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
582
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
583
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
584 #if (CODE_VERSION == SIMULATION)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
585 if (burst_type == TX_RA_BURST)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
586 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
587 time += l1_config.params.tx_ra_duration;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
588 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
589 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
590 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
591 if (num_tx > 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
592 // num_tx * BP_DURATION
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
593 time += TX_TABLE[num_tx - 1] + l1_config.params.tx_nb_duration;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
594 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
595 time += l1_config.params.tx_nb_duration;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
596 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
597 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
598 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
599 // Read APCDEL1 register DELU(4:0): delay of ramp up start, DELD (9:5) delay of ramp down start
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
600 // This value is used for computations in MS TX or TX/PRACH combinations
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
601 // This value is not modified by the computations
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
602 apcdel1_data = (l1s_dsp_com.dsp_ndb_ptr->d_apcdel1 >> 6) & 0x03ff;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
603 apcdel1_data_up = apcdel1_data & 0x001f; //delay of ramp up start
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
604 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
605
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
606 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
607 // Read APCDEL1 register DELU(4:0): delay of ramp up start, DELD (9:5) delay of ramp down start
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
608 // This value is used for computations in MS TX or TX/PRACH combinations
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
609 // This value is not modified by the computations
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
610 apcdel1_data = (l1s_dsp_com.dsp_ndb_ptr->d_apcdel1) & 0x03ff;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
611 apcdel1_data_up = apcdel1_data & 0x001f; //delay of ramp up start
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
612 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
613
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
614 if (!switch_flag)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
615 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
616 if (burst_type == TX_NB_BURST)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
617 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
618 // If PRACH precedes TX normal burst(s) we have to add BP_DURATION
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
619 if (static_switch_flag)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
620 time += BP_DURATION;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
621
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
622 // generate DSP IT for each TX slot after ramp up
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
623 // Margin:
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
624 // ABB_RAMP_DELAY = 4*1.5bits internal ABB delay BULENA ON -> ramp up
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
625 // apcdel1_data_up = additional delay BULENA ON -> ramp up
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
626 // ABB_RAMP_UP_TIME: maximum time for ramp up: 16 coeff.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
627 // 10 qbits of additional margin
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
628 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
629 for (i=0; i<num_tx; i++)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
630 l1pdmacro_it_dsp_gen(time + ABB_RAMP_DELAY + ABB_RAMP_UP_TIME + i*BP_DURATION + apcdel1_data_up + 10);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
631 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
632
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
633 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
634 for (i=0; i<num_tx; i++)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
635 l1pdmacro_it_dsp_gen(time + APC_RAMP_DELAY + APC_RAMP_UP_TIME + i*BP_DURATION + apcdel1_data_up + 10);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
636 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
637
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
638
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
639 if (num_tx > 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
640 // (num_tx - 1) * BP_DURATION + normal burst duration
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
641 time += TX_TABLE[num_tx - 1] + l1_config.params.tx_nb_duration - (num_tx - 1);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
642 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
643 time += l1_config.params.tx_nb_duration;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
644 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
645 else //PRACH
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
646 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
647 // If TX NB precedes PRACH we have to add BP_DURATION and TA (in qbits)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
648 if (static_switch_flag == 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
649 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
650 if (timing_advance_in_qbit > 240) // clip TA, cf. comment below
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
651 timing_advance_in_qbit = 240;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
652 time += BP_DURATION + timing_advance_in_qbit;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
653 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
654 // If PRACH precedes PRACH we have to add BP_DURATION
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
655 else if (static_switch_flag == 2)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
656 time += BP_DURATION ;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
657
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
658 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
659 l1pdmacro_it_dsp_gen(time + ABB_RAMP_DELAY + ABB_RAMP_UP_TIME + apcdel1_data_up + 10);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
660 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
661
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
662 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
663 l1pdmacro_it_dsp_gen(time + APC_RAMP_DELAY + APC_RAMP_UP_TIME + apcdel1_data_up + 10);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
664 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
665
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
666 time += l1_config.params.tx_ra_duration;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
667 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
668
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
669 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
670 else if (switch_flag == 1) // |TX|PRACH| or |PRACH|TX|
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
671 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
672 #if (DSP == 33) || (DSP == 34) || (DSP == 35) || (DSP == 36) || (DSP == 37) || (DSP == 38) || (DSP == 39)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
673 // => ABB windows are opened as for TX_NB in MS mode
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
674 // => Ramp up start of PRACH is delayed inside this window by the TA of the TX_NB
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
675 // => DSP inserts dummy bits such that ramp and modulation match
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
676 // Rem.: the TA passed for the PRACH is the one for the following TX_NB!!!
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
677 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3)) || (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
678 // In combinations of TX_NB and PRACH apcdel1_bis and apcdel2_bis apply to the PRACH
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
679 UWORD16 apcdel1_bis_data, apcdel1_bis_data_up, apcdel2_bis_data_up, prach_delay;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
680 API d_ctrl_abb_gprs;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
681
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
682 // clip TA (in qbit): max. TA supported = BP_DURATION - PRACH duration - max. ramp time
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
683 // = 625 - 88*4 - 32 = 241
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
684 if (timing_advance_in_qbit > 240)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
685 timing_advance_in_qbit = 240;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
686
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
687 prach_delay = apcdel1_data_up + timing_advance_in_qbit;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
688 apcdel1_bis_data_up = prach_delay & 0x001f;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
689 apcdel2_bis_data_up = (prach_delay >> 5) & 0x001f;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
690
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
691 // For ramp down delay we need to keep the original value from APCDEL1 (bits 9:5)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
692 // APCDEL2 default value is '0'
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
693 apcdel1_bis_data = apcdel1_bis_data_up | (apcdel1_data & 0x03e0);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
694
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
695 #if(RF_FAM != 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
696 l1s_dsp_com.dsp_ndb_ptr->d_apcdel1_bis = (apcdel1_bis_data << 6) | 0x04;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
697 l1s_dsp_com.dsp_ndb_ptr->d_apcdel2_bis = (apcdel2_bis_data_up << 6) | 0x34;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
698 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
699 l1s_dsp_com.dsp_ndb_ptr->d_apcdel1_bis = (apcdel1_bis_data );
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
700 l1s_dsp_com.dsp_ndb_ptr->d_apcdel2_bis = (apcdel2_bis_data_up);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
701 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
702
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
703 if (burst_type == TX_RA_BURST) // |PRACH|TX|
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
704 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
705
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
706 #if(RF_FAM != 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
707 l1pdmacro_it_dsp_gen(time + ABB_RAMP_DELAY + ABB_RAMP_UP_TIME + prach_delay + 10);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
708 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
709 l1pdmacro_it_dsp_gen(time + APC_RAMP_DELAY + APC_RAMP_UP_TIME + prach_delay + 10);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
710 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
711 // apcdel1_bis, apcdel2_bis must be programmed for the current ts (PRACH)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
712 // here we need to overwrite (mask) bits for APCDEL1, APCDEL2 programming done in l1pddsp_transfer_mslot_power()
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
713 d_ctrl_abb_gprs = l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_abb_gprs[tx_id];
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
714 d_ctrl_abb_gprs |= ((1 << B_BULRAMPDEL_BIS) | (1 << B_BULRAMPDEL2_BIS));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
715 d_ctrl_abb_gprs &= ~((1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
716 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_abb_gprs[tx_id] = d_ctrl_abb_gprs;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
717 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
718 else // |TX|PRACH|
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
719 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
720 #if(RF_FAM != 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
721 l1pdmacro_it_dsp_gen(time + ABB_RAMP_DELAY + ABB_RAMP_UP_TIME + apcdel1_data_up + 10);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
722 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
723 l1pdmacro_it_dsp_gen(time + APC_RAMP_DELAY + APC_RAMP_UP_TIME + apcdel1_data_up + 10);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
724 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
725
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
726 // apcdel1_bis, apcdel2_bis must be programmed for the next ts (PRACH)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
727 d_ctrl_abb_gprs = l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_abb_gprs[tx_id + 1];
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
728 d_ctrl_abb_gprs |= ((1 << B_BULRAMPDEL_BIS) | (1 << B_BULRAMPDEL2_BIS));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
729 d_ctrl_abb_gprs &= ~((1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
730 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_abb_gprs[tx_id + 1] = d_ctrl_abb_gprs;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
731 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
732 #endif // ANALOG
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
733
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
734 static_switch_flag = 1;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
735
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
736 #endif // DSP == 33 || DSP == 34 || (DSP == 36) || (DSP == 37)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
737 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
738 else if (switch_flag == 2) // |PRACH|PRACH|
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
739 // Combination handled by programming ABB with MS mode = 1
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
740 // => first burst length of first PRACH = BP_DURATION
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
741 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
742 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
743 l1pdmacro_it_dsp_gen(time + ABB_RAMP_DELAY + ABB_RAMP_UP_TIME + apcdel1_data_up + 10);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
744 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
745
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
746 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
747 l1pdmacro_it_dsp_gen(time + APC_RAMP_DELAY + APC_RAMP_UP_TIME + apcdel1_data_up + 10);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
748 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
749
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
750 static_switch_flag = 2;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
751 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
752 #endif //Codeversion
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
753
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
754 // In case of combinations TX_NB/PRACH or PRACH/PRACH the TX window is kept open
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
755 if (!switch_flag)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
756 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
757 l1pdmacro_tx_down(radio_freq, time, switch_flag, timing_advance_in_qbit,adc_active); // TX window closed
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
758
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
759 l1dmacro_offset (offset_serv, IMM); // Restore offset with serving value.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
760
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
761 static_switch_flag = 0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
762 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
763
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
764 #if L2_L3_SIMUL
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
765 #if (DEBUG_TRACE == BUFFER_TRACE_OFFSET)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
766 buffer_trace(2, offset_serv,l1s.actual_time.fn,0,0);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
767 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
768 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
769 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
770
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
771 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
772 /* l1pddsp_synchro() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
773 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
774 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
775 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
776 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
777 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
778 void l1pddsp_synchro(UWORD8 switch_mode, UWORD8 camp_timeslot)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
779 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
780 // Set "b_abort" to TRUE.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
781 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_system |= (1 << B_TASK_ABORT);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
782
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
783 // Set switch mode within "b_switch_to_gprs" & "b_switch_to_gms"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
784 l1ps_dsp_com.pdsp_ndb_ptr->d_sched_mode_gprs = (switch_mode << B_SWITCH);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
785
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
786 // In case of a switch to GPRS_SCHEDULER, last_used_txpwr is set to "NO_TXPWR"
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
787 // in order to force GSM ramp programming when the MS will switch back to
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
788 // GSM_SCHEDULER
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
789 // Moreover, the d_win_start_gprs register must be initialized only during the
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
790 // GSM->GPRS switch too.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
791 if(switch_mode == GPRS_SCHEDULER)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
792 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
793 l1s.last_used_txpwr = NO_TXPWR;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
794
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
795 // Set camp timeslot.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
796 l1ps_dsp_com.pdsp_ndb_ptr->d_win_start_gprs = camp_timeslot;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
797 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
798 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
799
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
800
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
801 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
802 /* l1pddsp_idle_prach_data() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
803 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
804 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
805 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
806 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
807 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
808 void l1pddsp_idle_prach_data(BOOL polling,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
809 UWORD8 cs_type,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
810 UWORD16 channel_request_data,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
811 UWORD8 bsic,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
812 UWORD16 radio_freq)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
813 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
814 UWORD16 swap_bit; // 16 bit wide to allow shift left.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
815
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
816 // UL on TS=3.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
817 l1ps_dsp_com.pdsp_db_w_ptr->d_task_u_gprs |= 0x80 >> 3;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
818
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
819 // Swap I/Q management.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
820 swap_bit = l1ps_swap_iq_ul(radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
821 l1ps_dsp_com.pdsp_db_w_ptr->d_task_u_gprs |= swap_bit << 15;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
822
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
823 // Load UL buffer according to "polling" bit.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
824 if(polling)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
825 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
826 // Select first UL polling buffer.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
827 l1ps_dsp_com.pdsp_ndb_ptr->a_ul_buffer_gprs[3] = 8;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
828
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
829 // Store CS type.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
830 l1ps_dsp_com.pdsp_ndb_ptr->a_pu_gprs[0][0] = cs_type;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
831
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
832 // Store UL data block.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
833 if(cs_type == CS_PAB8_TYPE)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
834 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
835 l1ps_dsp_com.pdsp_ndb_ptr->a_pu_gprs[0][2] = ((API)(bsic << 2)) |
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
836 ((API)(channel_request_data) << 8);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
837 l1ps_dsp_com.pdsp_ndb_ptr->a_pu_gprs[0][3] = 0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
838 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
839 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
840 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
841 l1ps_dsp_com.pdsp_ndb_ptr->a_pu_gprs[0][2] = ((API)(channel_request_data) << 5);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
842 l1ps_dsp_com.pdsp_ndb_ptr->a_pu_gprs[0][3] = ((API)(bsic << 10));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
843 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
844 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
845 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
846 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
847 // Set "b_access_prach" to indicate 1 Prach only to DSP.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
848 l1ps_dsp_com.pdsp_db_w_ptr->d_task_u_gprs |= (1 << B_ACCESS_PRACH);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
849
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
850 // Select first UL data buffer.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
851 l1ps_dsp_com.pdsp_ndb_ptr->a_ul_buffer_gprs[3] = 0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
852
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
853 // Store CS type.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
854 l1ps_dsp_com.pdsp_ndb_ptr->a_du_gprs[0][0] = cs_type;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
855
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
856 // Store UL data block.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
857 if(cs_type == CS_PAB8_TYPE)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
858 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
859 l1ps_dsp_com.pdsp_ndb_ptr->a_du_gprs[0][1] = ((API)(bsic << 2)) |
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
860 ((API)(channel_request_data) << 8);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
861 l1ps_dsp_com.pdsp_ndb_ptr->a_du_gprs[0][2] = 0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
862 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
863 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
864 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
865 l1ps_dsp_com.pdsp_ndb_ptr->a_du_gprs[0][1] = ((API)(channel_request_data) << 5);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
866 l1ps_dsp_com.pdsp_ndb_ptr->a_du_gprs[0][2] = ((API)(bsic << 10));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
867 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
868
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
869 if (l1pa_l1ps_com.pra_info.prach_alloc == FIX_PRACH_ALLOC)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
870 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
871 // Set fix alloc bit.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
872 l1ps_dsp_com.pdsp_ndb_ptr->d_sched_mode_gprs |= (2 << B_MAC_MODE);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
873 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
874 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
875 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
876 // Reset MAC mode to dynamic allocation
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
877 l1ps_dsp_com.pdsp_ndb_ptr->d_sched_mode_gprs &= ~(3 << B_MAC_MODE);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
878
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
879 #if !FF_L1_IT_DSP_USF
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
880 #if (DSP == 33) || (DSP == 34) || (DSP == 35) || (DSP == 36) || (DSP == 37) || (DSP == 38) || (DSP == 39)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
881 // Enable USF vote on timeslot 0
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
882 l1ps_dsp_com.pdsp_ndb_ptr->d_usf_vote_enable = 0x80;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
883 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
884 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
885 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
886 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
887 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
888
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
889 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
890 /* l1pddsp_idle_prach_power() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
891 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
892 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
893 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
894 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
895 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
896 void l1pddsp_idle_prach_power(UWORD8 txpwr,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
897 UWORD16 radio_freq,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
898 UWORD8 ts)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
899 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
900 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3) || (RF_FAM == 61))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
901 UWORD16 pwr_data;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
902 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
903
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
904 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3) )
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
905 // Force FIXED transmit power if requested.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
906 if(l1_config.tx_pwr_code == 0)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
907 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
908 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_power_gprs[ts] = l1_config.params.fixed_txpwr;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
909
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
910 // Control bitmap: update RAMP, use RAMP[5][..].
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
911 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_abb_gprs[ts] =
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
912 ((1 << B_RAMP_GPRS) | (5 << B_RAMP_NB_GPRS) | (1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
913
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
914 // Store Ramp.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
915 #if (CODE_VERSION != SIMULATION)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
916 Cust_get_ramp_tab(l1ps_dsp_com.pdsp_ndb_ptr->a_ramp_gprs[5],
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
917 0, /* not used */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
918 0, /* not used */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
919 1 /* arbitrary value for arfcn */ );
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
920 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
921 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
922 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
923 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
924 // Get H/W value corresponding to txpwr command.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
925 pwr_data = Cust_get_pwr_data(txpwr, radio_freq
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
926 #if(REL99 && FF_PRF)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
927 ,1
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
928 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
929 );
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
930
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
931 // Store Transmit power.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
932 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_power_gprs[ts] = ((pwr_data << 6) | 0x12);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
933
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
934 // Control bitmap: update RAMP, use RAMP[5][..].
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
935 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_abb_gprs[ts] = ((1 << B_RAMP_GPRS) | (5 << B_RAMP_NB_GPRS) | (1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
936
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
937 // Store Ramp.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
938 #if (CODE_VERSION != SIMULATION)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
939 Cust_get_ramp_tab(&(l1ps_dsp_com.pdsp_ndb_ptr->a_ramp_gprs[5][0]), txpwr, txpwr, radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
940 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
941 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
942 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
943
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
944 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
945 // Force FIXED transmit power if requested.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
946 if(l1_config.tx_pwr_code == 0)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
947 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
948 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_power_gprs[ts] = l1_config.params.fixed_txpwr;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
949
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
950 // Control bitmap: update RAMP, use RAMP[5][..].
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
951 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_abb_gprs[ts] =
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
952 ((1 << B_RAMP_GPRS) | (5 << B_RAMP_NB_GPRS) | (1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
953
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
954 // Store Ramp.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
955 #if (DSP ==38) || (DSP == 39)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
956 Cust_get_ramp_tab(l1ps_dsp_com.pdsp_ndb_ptr->a_drp_ramp2_gprs[5],
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
957 0, /* not used */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
958 0, /* not used */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
959 1 /* arbitrary value for arfcn */ );
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
960 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
961 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
962 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
963 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
964 // Get H/W value corresponding to txpwr command.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
965 pwr_data = Cust_get_pwr_data(txpwr, radio_freq
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
966 #if(REL99 && FF_PRF)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
967 ,1
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
968 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
969 );
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
970
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
971 // Store Transmit power.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
972 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_power_gprs[ts] = (API) (pwr_data);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
973
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
974 // Control bitmap: update RAMP, use RAMP[5][..].
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
975 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_abb_gprs[ts] = ((1 << B_RAMP_GPRS) | (5 << B_RAMP_NB_GPRS) | (1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
976
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
977 // Store Ramp.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
978 #if(DSP == 38) || (DSP == 39)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
979 Cust_get_ramp_tab(&(l1ps_dsp_com.pdsp_ndb_ptr->a_drp_ramp2_gprs[5][0]), txpwr, txpwr, radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
980 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
981 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
982 #endif //RF_FAM == 61
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
983
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
984 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
985
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
986 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
987 /* l1pddsp_single_block() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
988 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
989 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
990 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
991 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
992 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
993 void l1pddsp_single_tx_block(UWORD8 burst_nb,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
994 UWORD8 *data,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
995 UWORD8 tsc,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
996 UWORD16 radio_freq)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
997 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
998 UWORD16 swap_bit; // 16 bit wide to allow shift left.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
999
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1000 // Burst number within a block.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1001 l1ps_dsp_com.pdsp_db_w_ptr->d_burst_nb_gprs = burst_nb;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1002
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1003 // UL on TS=3.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1004 l1ps_dsp_com.pdsp_db_w_ptr->d_task_u_gprs |= 0x80 >> 3;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1005
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1006 // Swap I/Q management.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1007 swap_bit = l1ps_swap_iq_ul(radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1008 l1ps_dsp_com.pdsp_db_w_ptr->d_task_u_gprs |= swap_bit << 15;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1009
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1010 // Select first UL polling buffer.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1011 l1ps_dsp_com.pdsp_ndb_ptr->a_ul_buffer_gprs[3] = 8;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1012
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1013 // Store CS type: CS1 for Polling.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1014 l1ps_dsp_com.pdsp_ndb_ptr->a_pu_gprs[0][0] = CS1_TYPE_POLL;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1015
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1016 if(burst_nb == BURST_1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1017 // Store UL data block.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1018 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1019 API *ul_block_ptr = &(l1ps_dsp_com.pdsp_ndb_ptr->a_pu_gprs[0][2]);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1020 UWORD8 i,j;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1021
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1022 // Copy first 22 bytes in the first 11 words after header.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1023 for (i=0, j=0; j<11; j++)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1024 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1025 ul_block_ptr[j] = ((API)(data[i])) | ((API)(data[i+1]) << 8);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1026 i += 2;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1027 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1028 // Copy last UWORD8 (23rd) in the 12th word after header.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1029 ul_block_ptr[11] = data[22];
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1030 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1031
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1032 // Training sequence.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1033 // Rem: bcch_freq_ind is set within Hopping algo.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1034 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_system |= tsc << B_TSQ;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1035 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1036
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1037 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1038 /* l1pddsp_idle_rx_nb() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1039 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1040 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1041 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1042 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1043 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1044 #if FF_L1_IT_DSP_USF
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1045 void l1pddsp_idle_rx_nb(UWORD8 burst_nb,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1046 UWORD8 tsc,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1047 UWORD16 radio_freq,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1048 UWORD8 timeslot_no,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1049 BOOL ptcch_dl,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1050 BOOL usf_interrupt)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1051 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1052 void l1pddsp_idle_rx_nb(UWORD8 burst_nb,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1053 UWORD8 tsc,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1054 UWORD16 radio_freq,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1055 UWORD8 timeslot_no,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1056 BOOL ptcch_dl)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1057 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1058 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1059 UWORD16 swap_bit; // 16 bit wide to allow shift left.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1060
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1061 // DL on TS=0.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1062 l1ps_dsp_com.pdsp_db_w_ptr->d_task_d_gprs |= 0x80 >> timeslot_no;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1063
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1064 // Swap I/Q management.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1065 swap_bit = l1ps_swap_iq_dl(radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1066 l1ps_dsp_com.pdsp_db_w_ptr->d_task_d_gprs |= swap_bit << 15;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1067
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1068 if(ptcch_dl)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1069 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1070 // PTCCH/DL case must be flagged to DSP.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1071 l1ps_dsp_com.pdsp_db_w_ptr->d_task_d_gprs |= (1 << B_PTCCH_DL);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1072 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1073
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1074 // Burst number within a block.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1075 l1ps_dsp_com.pdsp_db_w_ptr->d_burst_nb_gprs = burst_nb;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1076
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1077 // Channel coding is forced to CS1.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1078 l1ps_dsp_com.pdsp_ndb_ptr->a_ctrl_ched_gprs[timeslot_no] = CS1_TYPE_DATA;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1079
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1080 // pass information to DSP which good USF value is to be expected
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1081 l1ps_dsp_com.pdsp_ndb_ptr->a_usf_gprs[0] = (API) 0x07;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1082
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1083 #if FF_L1_IT_DSP_USF
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1084 // In case of connection establishment mode with dynamic or fixed
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1085 // allocation scheme we need to request the DSP USF interrupt for PRACH
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1086 // scheduling. Latched by DSP during Work3
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1087 if (burst_nb == 3)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1088 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1089 if (usf_interrupt)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1090 l1ps_dsp_com.pdsp_ndb_ptr->d_usf_vote_enable |= (1 << B_USF_IT);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1091 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1092 l1ps_dsp_com.pdsp_ndb_ptr->d_usf_vote_enable &= ~(1 << B_USF_IT);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1093 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1094 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1095
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1096 // RIF receiver algorithm: select 156.25.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1097 l1ps_dsp_com.pdsp_ndb_ptr->d_sched_mode_gprs &= 0xFFFF ^ (1 << B_RIF_RX_MODE);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1098
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1099 // Training sequence.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1100 // Rem: bcch_freq_ind is set within Hopping algo.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1101 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_system |= tsc << B_TSQ;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1102
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1103 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1104
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1105
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1106 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1107 /* l1pddsp_transfer_mslot_ctrl() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1108 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1109 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1110 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1111 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1112 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1113 void l1pddsp_transfer_mslot_ctrl(UWORD8 burst_nb,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1114 UWORD8 dl_bitmap,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1115 UWORD8 ul_bitmap,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1116 UWORD8 *usf_table,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1117 UWORD8 mac_mode,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1118 UWORD8 *ul_buffer_index,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1119 UWORD8 tsc,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1120 UWORD16 radio_freq,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1121 UWORD8 synchro_timeslot,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1122 #if FF_L1_IT_DSP_USF
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1123 UWORD8 dsp_usf_interrupt
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1124 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1125 UWORD8 usf_vote_enable
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1126 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1127 )
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1128 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1129 UWORD8 i;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1130 UWORD16 swap_bit; // 16 bit wide to allow shift left.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1131
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1132 // Burst number within a block.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1133 l1ps_dsp_com.pdsp_db_w_ptr->d_burst_nb_gprs = burst_nb;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1134
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1135 // DL bitmap.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1136 l1ps_dsp_com.pdsp_db_w_ptr->d_task_d_gprs = dl_bitmap;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1137
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1138 // UL bitmap.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1139 l1ps_dsp_com.pdsp_db_w_ptr->d_task_u_gprs = ul_bitmap;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1140
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1141 // Swap I/Q management for DL.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1142 swap_bit = l1ps_swap_iq_dl(radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1143 l1ps_dsp_com.pdsp_db_w_ptr->d_task_d_gprs |= swap_bit << 15;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1144
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1145 // Swap I/Q management for UL.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1146 swap_bit = l1ps_swap_iq_ul(radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1147 l1ps_dsp_com.pdsp_db_w_ptr->d_task_u_gprs |= swap_bit << 15;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1148
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1149 if(burst_nb == 0)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1150 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1151 // Store USF table
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1152 for(i=0;i<(8 - synchro_timeslot);i++)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1153 l1ps_dsp_com.pdsp_ndb_ptr->a_usf_gprs[i] = usf_table[i+synchro_timeslot];
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1154
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1155 // Automatic CS detection.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1156 for(i=0;i<8;i++)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1157 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1158 l1ps_dsp_com.pdsp_ndb_ptr->a_ctrl_ched_gprs[i] = CS_AUTO_DETECT;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1159
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1160 // Select first UL polling buffer.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1161 l1ps_dsp_com.pdsp_ndb_ptr->a_ul_buffer_gprs[i] = ul_buffer_index[i];
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1162 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1163
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1164 #if !FF_L1_IT_DSP_USF
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1165 // USF vote enable programming
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1166
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1167 #if (DSP == 33) || (DSP == 34) || (DSP == 35) || (DSP == 36) || (DSP == 37) || (DSP == 38) || (DSP == 39)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1168 // Multislot TX allowed and usf_vote_enable suported: programs usf_vote_enable
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1169 l1ps_dsp_com.pdsp_ndb_ptr->d_usf_vote_enable = usf_vote_enable;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1170 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1171 // Single slot TX only and usf_vote_enable not supported
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1172 // Modify MAC mode
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1173 if (usf_vote_enable)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1174 // USF vote enabled --> Set MAC mode to dynamic mode
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1175 mac_mode = DYN_ALLOC;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1176 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1177 // USF vote disabled --> Set MAC mode to fixed mode
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1178 mac_mode = FIX_ALLOC_NO_HALF;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1179 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1180
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1181 #endif // !FF_L1_IT_DSP_USF
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1182
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1183 // MAC mode.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1184 l1ps_dsp_com.pdsp_ndb_ptr->d_sched_mode_gprs &= ~(3 << B_MAC_MODE);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1185 l1ps_dsp_com.pdsp_ndb_ptr->d_sched_mode_gprs |= mac_mode << B_MAC_MODE;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1186 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1187
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1188 #if FF_L1_IT_DSP_USF
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1189 if(burst_nb == 3)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1190 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1191 // Program DSP to generate an interrupt once USF available if
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1192 // required. Latched by DSP during Work3.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1193 if (dsp_usf_interrupt)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1194 l1ps_dsp_com.pdsp_ndb_ptr->d_usf_vote_enable = (1 << B_USF_IT);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1195 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1196 l1ps_dsp_com.pdsp_ndb_ptr->d_usf_vote_enable = 0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1197 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1198 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1199
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1200 // RIF receiver algorithm: select 156.25.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1201 l1ps_dsp_com.pdsp_ndb_ptr->d_sched_mode_gprs &= 0xFFFF ^ (1 << B_RIF_RX_MODE);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1202
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1203 // d_fn
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1204 // ----
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1205 // bit [0..7] -> b_fn_report, unused for GPRS
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1206 // bit [8..15] -> b_fn_sid , FN%104
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1207 l1s_dsp_com.dsp_db_w_ptr->d_fn = ((l1s.next_time.fn_mod104)<<8);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1208
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1209 // Training sequence.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1210 // Rem: bcch_freq_ind is set within Hopping algo.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1211 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_system |= tsc << B_TSQ;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1212
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1213 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1214
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1215
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1216 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1217 /* l1pddsp_transfer_mslot_power() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1218 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1219 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1220 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1221 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1222 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1223 void l1pddsp_transfer_mslot_power(UWORD8 *txpwr,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1224 UWORD16 radio_freq,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1225 UWORD8 ul_bitmap)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1226 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1227 #define NO_TX 100
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1228
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1229 UWORD16 i; // 16 bit needed for shifting pupose.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1230 UWORD8 last_TX = NO_TX;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1231 UWORD8 txpwr_ramp_up;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1232 UWORD8 txpwr_ramp_down;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1233 UWORD8 cpt_TX = 0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1234 UWORD8 ts_mask;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1235 WORD16 ts_conv;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1236
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1237 #if (REL99 && FF_PRF)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1238 UWORD8 number_uplink_timeslot = 0 ; // number of uplink timeslot for power reduction feature
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1239 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1240
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1241
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1242 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3) || (RF_FAM == 61))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1243 UWORD16 pwr_data;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1244 UWORD16 d_ramp_idx;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1245 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1246
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1247 //Locosto #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1248
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1249 // This function is called with an ul_bitmap which represents the abolute
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1250 // position of any Tx bursts in this frame. This bitmap has already
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1251 // absorbed any synchro change (in dl_tn), hence we need to do some
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1252 // processing to recover the actual Tx timeslot number which is used
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1253 // as an index into the txpwr array.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1254 //
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1255 // Example : MS Class 8 with 4 Rx and 1 Tx :
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1256 //
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1257 //
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1258 // dl_ts_alloc : 0x0f 0 0 0 0 R R R R
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1259 // ul_ts_alloc : 0x02 0 0 0 0 0 0 T 0
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1260 // shift + combine : 0 0 0 0 R R R R 0 T
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1261 // set dl_tn=4 : R R R R 0 T 0 0
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1262 // ul_bitmap : 0x04 0 0 0 0 0 1 0 0
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1263 // i : 5
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1264 //
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1265 // Example : MS Class 8 with 1 Rx and 1 Tx on TS=7
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1266 //
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1267 // dl_ts_alloc : 0x01 0 0 0 0 0 0 0 R
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1268 // ul_ts_alloc : 0x01 0 0 0 0 0 0 0 T
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1269 // shift + combine : 0 0 0 0 0 0 0 R 0 0 T
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1270 // set dl_tn=7 : R 0 0 T 0 0 0 0
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1271 // ul_bitmap : 0x10 0 0 0 1 0 0 0 0
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1272 // i : 3
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1273 //
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1274 // We recover the actual timeslot from the ul_bitmap by the following
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1275 // method :
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1276 //
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1277 // ts = (i + dl_tn) - 3
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1278 //
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1279 // Where i is the loopindex usd to detect "1" in the ul_bitmap.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1280 // This works for MS class 8 because (3 <= i <= 5) if the
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1281 // multislot class is respected.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1282
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1283 #if (REL99 && FF_PRF)// power reduction feature
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1284 for (i=0; i<8; i++)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1285 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1286 // computed number of uplink timeslot in order to determine uplink power reduction
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1287 ts_mask = (0x80>>i);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1288 if (ul_bitmap & ts_mask)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1289 number_uplink_timeslot++;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1290 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1291 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1292
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1293
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1294 ts_conv = l1a_l1s_com.dl_tn - 3;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1295
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1296 // Index of the programmed ramps
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1297 d_ramp_idx = 0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1298
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1299 for(i=0;i<8;i++)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1300 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1301 // Program Transmit power and ramp for allocated timeslots.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1302 if(ul_bitmap & (0x80>>i))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1303 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1304 // Fixe transmit power.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1305 if(l1_config.tx_pwr_code == 0)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1306 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1307 // Store Transmit power.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1308 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_power_gprs[i] = l1_config.params.fixed_txpwr;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1309
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1310 // Control bitmap: update RAMP, use RAMP[d_ramp_idx][..].
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1311 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_abb_gprs[i] =
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1312 ((d_ramp_idx << B_RAMP_NB_GPRS) | (1 << B_RAMP_GPRS) | (1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1313
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1314 // Store Ramp.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1315 #if (RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1316 #if (DSP ==38) || (DSP == 39)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1317 Cust_get_ramp_tab(l1ps_dsp_com.pdsp_ndb_ptr->a_drp_ramp2_gprs[d_ramp_idx++],
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1318 0, /* not used */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1319 0, /* not used */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1320 1 /* arbitrary value for arfcn */ );
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1321 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1322 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1323 #if (CODE_VERSION != SIMULATION)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1324 Cust_get_ramp_tab(l1ps_dsp_com.pdsp_ndb_ptr->a_ramp_gprs[d_ramp_idx++],
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1325 0, /* not used */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1326 0, /* not used */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1327 1 /* arbitrary value for arfcn */ );
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1328 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1329 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1330 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1331 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1332 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1333 // count the number of TX windows
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1334 cpt_TX ++;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1335
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1336 // Get power amplifier data.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1337 #if(REL99 && FF_PRF)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1338 pwr_data = Cust_get_pwr_data(txpwr[i+ts_conv], radio_freq, number_uplink_timeslot);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1339 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1340 pwr_data = Cust_get_pwr_data(txpwr[i+ts_conv], radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1341 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1342
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1343
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1344 // Store Transmit power.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1345 #if(RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1346 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_power_gprs[i] = (pwr_data);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1347 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1348 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_power_gprs[i] = ((pwr_data << 6) | 0x12);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1349 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1350
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1351 // Control bitmap: update RAMP, use RAMP[d_ramp_idx][..] for slot i.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1352 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_abb_gprs[i] = ((d_ramp_idx << B_RAMP_NB_GPRS) | (1 << B_RAMP_GPRS) | (1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1353
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1354 // Store Ramp.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1355 // ==========
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1356 // for the 1st TX the RAMP is: RAMP_UP_TX1 / RAMP_DOWN_TX1
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1357 // for the 2nd TX the RAMP is: RAMP_UP_TX2 / RAMP_DOWN_TX1
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1358 // for the 3rd TX the RAMP is: RAMP_UP_TX3 / RAMP_DOWN_TX2
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1359 // (...)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1360 // for the (i)th TX the RAMP is: RAMP_UP_TX_(i) / RAMP_DOWN_TX_(i-1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1361 // for the additionnal RAMP : xxxx / RAMP_DOWN_TX_last
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1362
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1363 txpwr_ramp_up = txpwr[i+ts_conv]; // the ramp up is the current TX
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1364
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1365 if(last_TX == NO_TX) // specific case of the first TX
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1366 txpwr_ramp_down = txpwr[i+ts_conv]; // the ramp down is the current TX
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1367 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1368 txpwr_ramp_down = txpwr[last_TX+ts_conv]; // the ramp down is the previous TX
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1369
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1370 #if(RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1371 #if(DSP == 38) || (DSP == 39)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1372 Cust_get_ramp_tab(&(l1ps_dsp_com.pdsp_ndb_ptr->a_drp_ramp2_gprs[d_ramp_idx++][0]), txpwr_ramp_up, txpwr_ramp_down, radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1373 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1374 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1375 #if (CODE_VERSION != SIMULATION)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1376 Cust_get_ramp_tab(&(l1ps_dsp_com.pdsp_ndb_ptr->a_ramp_gprs[d_ramp_idx++][0]), txpwr_ramp_up, txpwr_ramp_down, radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1377 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1378 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1379 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1380
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1381 // memorize the last TX window
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1382 last_TX = i;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1383 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1384 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1385 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1386 // program an interrupt in the TS following
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1387 // the last TX window and needed by the DSP
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1388
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1389 // Is it the TS following a TX window ?
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1390 if((i == last_TX+1) && (i<8))
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1391 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1392 // program the interrupt
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1393 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_abb_gprs[i] = (1 << B_MS_RULE);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1394 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1395 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1396 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1397
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1398 // in a multi-TX case an additionnal ramp down must be set
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1399 if(cpt_TX > 1)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1400 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1401 // Control bitmap: update RAMP, use RAMP[d_ramp_idx][..] for slot i and set the interrupt
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1402 if((last_TX+1) <= 7)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1403 l1ps_dsp_com.pdsp_db_w_ptr->a_ctrl_abb_gprs[last_TX+1] = ((d_ramp_idx << B_RAMP_NB_GPRS) | (1 << B_RAMP_GPRS) | (1 << B_MS_RULE));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1404
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1405 // Store Ramp.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1406 // ==========
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1407 txpwr_ramp_up = txpwr[last_TX+ts_conv]; // this ramp up is unused (default: set to last_TX)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1408 txpwr_ramp_down = txpwr[last_TX+ts_conv]; // the ramp down is the last TX
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1409
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1410 #if(RF_FAM == 61)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1411 #if(DSP ==38) || (DSP == 39)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1412 Cust_get_ramp_tab(&(l1ps_dsp_com.pdsp_ndb_ptr->a_drp_ramp2_gprs[d_ramp_idx][0]), txpwr_ramp_up, txpwr_ramp_down, radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1413 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1414 #else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1415 #if (CODE_VERSION != SIMULATION)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1416 Cust_get_ramp_tab(&(l1ps_dsp_com.pdsp_ndb_ptr->a_ramp_gprs[d_ramp_idx][0]), txpwr_ramp_up, txpwr_ramp_down, radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1417 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1418 #endif
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1419 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1420 // #endif Locosto
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1421 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1422
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1423
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1424 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1425 /* l1pddsp_ul_ptcch_data() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1426 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1427 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1428 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1429 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1430 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1431 void l1pddsp_ul_ptcch_data(UWORD8 cs_type,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1432 UWORD16 channel_request_data,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1433 UWORD8 bsic,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1434 UWORD16 radio_freq,
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1435 UWORD8 timeslot_no)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1436 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1437 UWORD16 swap_bit; // 16 bit wide to allow shift left.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1438
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1439 // UL on TS=timeslot_no.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1440 l1ps_dsp_com.pdsp_db_w_ptr->d_task_u_gprs |= 0x80 >> timeslot_no;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1441
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1442 // Swap I/Q management.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1443 swap_bit = l1ps_swap_iq_ul(radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1444 l1ps_dsp_com.pdsp_db_w_ptr->d_task_u_gprs |= swap_bit << 15;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1445
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1446 // Set "b_ptcch_ul" to indicate PTCCH/UL to DSP.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1447 l1ps_dsp_com.pdsp_db_w_ptr->d_task_u_gprs |= (1 << B_PTCCH_UL);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1448
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1449 // Store CS type.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1450 l1ps_dsp_com.pdsp_ndb_ptr->a_ptcchu_gprs[0] = cs_type;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1451
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1452 // Store UL data block.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1453 if(cs_type == CS_PAB8_TYPE)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1454 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1455 l1ps_dsp_com.pdsp_ndb_ptr->a_ptcchu_gprs[1] = ((API)(bsic << 2)) |
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1456 ((API)(channel_request_data) << 8);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1457 l1ps_dsp_com.pdsp_ndb_ptr->a_ptcchu_gprs[2] = 0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1458 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1459 else
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1460 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1461 l1ps_dsp_com.pdsp_ndb_ptr->a_ptcchu_gprs[1] = ((API)(channel_request_data) << 5);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1462 l1ps_dsp_com.pdsp_ndb_ptr->a_ptcchu_gprs[2] = ((API)(bsic << 10));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1463 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1464 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1465
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1466
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1467 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1468 /* l1pddsp_interf_meas_ctrl() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1469 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1470 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1471 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1472 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1473 void l1pddsp_interf_meas_ctrl(UWORD8 nb_meas_req)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1474 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1475 // Interference measurement task set as a monitoring task within GSM interface.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1476 // 101 means 1 meas, 102 means 2 meas ...
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1477 // Rem: swap I/Q is not managed for power measurements.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1478 l1s_dsp_com.dsp_db_w_ptr->d_task_md = INTERF_DSP_TASK + nb_meas_req;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1479 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1480
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1481
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1482 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1483 /* l1pddsp_transfer_meas_ctrl() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1484 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1485 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1486 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1487 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1488 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1489 void l1pddsp_transfer_meas_ctrl(UWORD8 meas_position)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1490 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1491 // Store measurement position.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1492 // Rem: This is a L1S filtered information giving the position of the meas. as a
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1493 // bitmap.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1494 // Rem: swap I/Q is not managed for power measurements.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1495 l1ps_dsp_com.pdsp_db_w_ptr->d_task_pm_gprs = meas_position;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1496 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1497
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1498 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1499 /* l1pddsp_meas_ctrl() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1500 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1501 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1502 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1503 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1504 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1505 void l1pddsp_meas_ctrl(UWORD8 nbmeas, UWORD8 pm_pos)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1506 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1507 // Request Signal level measurement task to DSP. A bit map is passed
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1508 // to DSP in order to specify the position of the measurement.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1509 // Note: MSB is TN = 0 and LSB is TN = 7.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1510 // Rem: swap I/Q is not managed for power measurements.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1511 // Note: currently a maximum of four Pm can be performed / TDMA. This would
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1512 // be modified in a near futur.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1513 // Note: If a Rx is programmed i.e. pm_pos = 1, only a maximum
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1514 // of 3 Pm is requested to DSP and position of the Pm are right shifted (Rx on TN = 0).
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1515 // Remark: In packet Idle mode Rx are still on TN = 0. This implies three Pm
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1516 // always after the Rx.
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1517 l1ps_dsp_com.pdsp_db_w_ptr->d_task_pm_gprs = ((UWORD8) (0xff << (8 - nbmeas))) >> pm_pos;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1518 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1519
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1520 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1521 /* l1pddsp_meas_read() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1522 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1523 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1524 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1525 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1526 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1527 void l1pddsp_meas_read(UWORD8 nbmeas, UWORD16 *a_pm)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1528 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1529 UWORD8 i = 0;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1530 UWORD8 j;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1531 UWORD8 bit_mask = 0x80;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1532
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1533 // Looks for first PM position
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1534 while ((i < 8) && (l1ps_dsp_com.pdsp_db_r_ptr->d_task_pm_gprs & bit_mask) == 0)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1535 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1536 i++;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1537 bit_mask >>= 1;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1538 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1539
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1540 // Read 'nbmeas' contiguous PM levels from the first PM position
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1541 // Note: PM are always programmed on contiguous timeslots
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1542 for (j = 0; ((j < nbmeas)&&(i < 8)); j++)
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1543 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1544 // Download PM from DSP/MCU memory interface
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1545 a_pm[j] = ((l1ps_dsp_com.pdsp_db_r_ptr->a_burst_pm_gprs[i] & 0xffff));
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1546
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1547 // Read next PM on following TN
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1548 i++;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1549 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1550 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1551
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1552 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1553 /* l1pddsp_load_bcchn_task() */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1554 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1555 /* Parameters : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1556 /* Return : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1557 /* Functionality : */
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1558 /*-------------------------------------------------------*/
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1559 void l1pddsp_load_bcchn_task(UWORD8 tsq,UWORD16 radio_freq )
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1560 {
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1561 UWORD16 swap_bit = l1ps_swap_iq_dl(radio_freq);
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1562
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1563 l1s_dsp_com.dsp_db_w_ptr->d_task_md = NBN_DSP_TASK | (swap_bit << 15); // Load BCCHN task
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1564 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_system |= tsq << B_TSQ;
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1565 }
3a2c43579200 l1p_driv.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1566 #endif