annotate chipsetsw/layer1/cfile/l1_drive.c @ 303:5408ac162f16

l1p_cmpl.c: l1ps_read_nb_dl() reconstructed
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 02 Oct 2017 07:49:35 +0000
parents 3d214116a5ba
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1 /************* Revision Controle System Header *************
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2 * GSM Layer 1 software
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
3 * L1_DRIVE.C
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
4 *
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
5 * Filename l1_drive.c
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
6 * Copyright 2003 (C) Texas Instruments
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
7 *
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
8 ************* Revision Controle System Header *************/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
9
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
10 #define L1_DRIVE_C
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
11
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
12 #include "l1_confg.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
13
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
14 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
15 #include "apc.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
16 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
17
96
065ebe468750 l1_drive.c: difference in DSP workaround preprocessor symbols
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 95
diff changeset
18 #define W_A_DSP_PR20037 1 /* FreeCalypso */
065ebe468750 l1_drive.c: difference in DSP workaround preprocessor symbols
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 95
diff changeset
19
065ebe468750 l1_drive.c: difference in DSP workaround preprocessor symbols
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 95
diff changeset
20 #if ((L1M_WAIT_DSP_RESTART_AFTER_VOCODER_ENABLE ==1)&&(W_A_DSP_PR20037 == 1))
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
21 #include "nucleus.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
22 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
23 #include "l1_macro.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
24 #if (CODE_VERSION == SIMULATION)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
25 #include <string.h>
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
26 #include "l1_types.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
27 #include "sys_types.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
28 #include "l1_const.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
29 #include "l1_time.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
30 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
31 #include "l1tm_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
32 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
33 #if (AUDIO_TASK == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
34 #include "l1audio_const.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
35 #include "l1audio_cust.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
36 #include "l1audio_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
37 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
38 #if (L1_GTT == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
39 #include "l1gtt_const.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
40 #include "l1gtt_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
41 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
42 #if (L1_MP3 == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
43 #include "l1mp3_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
44 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
45 #if (L1_MIDI == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
46 #include "l1midi_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
47 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
48 //ADDED FOR AAC
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
49 #if (L1_AAC == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
50 #include "l1aac_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
51 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
52 #include "l1_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
53 #include "l1_varex.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
54 #include "cust_os.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
55 #include "l1_msgty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
56 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
57 #include "l1tm_varex.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
58 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
59 #if L2_L3_SIMUL
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
60 #include "hw_debug.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
61 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
62
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
63 #if L1_GPRS
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
64 #include "l1p_cons.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
65 #include "l1p_msgt.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
66 #include "l1p_deft.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
67 #include "l1p_vare.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
68 #include "l1p_sign.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
69 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
70
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
71 #include <stdio.h>
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
72 #include "sim_cfg.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
73 #include "sim_cons.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
74 #include "sim_def.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
75 #include "sim_var.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
76
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
77 #include "l1_ctl.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
78
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
79 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
80
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
81 #include <string.h>
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
82 #include "l1_types.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
83 #include "sys_types.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
84 #include "l1_const.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
85 #include "l1_time.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
86 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
87 #include "l1tm_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
88 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
89 #if (AUDIO_TASK == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
90 #include "l1audio_const.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
91 #include "l1audio_cust.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
92 #include "l1audio_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
93 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
94 #if (L1_GTT == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
95 #include "l1gtt_const.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
96 #include "l1gtt_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
97 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
98 #if (L1_MP3 == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
99 #include "l1mp3_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
100 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
101 #if (L1_MIDI == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
102 #include "l1midi_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
103 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
104 //ADDED FOR AAC
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
105 #if (L1_AAC == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
106 #include "l1aac_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
107 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
108 #include "l1_defty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
109 #include "l1_varex.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
110 #include "cust_os.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
111 #include "l1_msgty.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
112 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
113 #include "l1tm_varex.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
114 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
115 #if L2_L3_SIMUL
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
116 #include "hw_debug.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
117 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
118 #include "tpudrv.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
119
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
120 #if L1_GPRS
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
121 #include "l1p_cons.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
122 #include "l1p_msgt.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
123 #include "l1p_deft.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
124 #include "l1p_vare.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
125 #include "l1p_sign.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
126 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
127
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
128 #include "l1_ctl.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
129
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
130 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
131
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
132 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
133 #include "tpudrv61.h"
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
134 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
135
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
136
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
137
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
138 /*
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
139 * Prototypes of external functions used in this file.
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
140 *
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
141 * FreeCalypso change: removed all those prototypes which appear
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
142 * in tpudrv.h, and kept only the additional ones.
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
143 */
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
144
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
145 #if ((REL99 == 1) && (FF_BHO == 1))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
146 #if (L1_MADC_ON == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
147 void l1dmacro_rx_fbsb (SYS_UWORD16 radio_freq,UWORD8 adc_active);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
148 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
149 void l1dmacro_rx_fbsb (SYS_UWORD16 radio_freq);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
150 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
151 #endif//#if ((REL99 == 1) && (FF_BHO == 1))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
152
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
153 void Cust_get_ramp_tab(API *a_ramp, UWORD8 txpwr_ramp_up, UWORD8 txpwr_ramp_down, UWORD16 radio_freq);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
154 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3) || (RF_FAM == 61))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
155 UWORD16 Cust_get_pwr_data(UWORD8 txpwr, UWORD16 radio_freq
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
156 #if(REL99 && FF_PRF)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
157 ,UWORD8 number_uplink_timeslot
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
158 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
159 );
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
160 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
161
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
162 #if L1_GPRS
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
163 void l1ps_reset_db_mcu_to_dsp(T_DB_MCU_TO_DSP_GPRS *page_ptr);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
164 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
165
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
166 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
167 /* l1ddsp_load_info() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
168 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
169 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
170 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
171 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
172 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
173 void l1ddsp_load_info(UWORD32 task, API *info_ptr, UWORD8 *data)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
174 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
175 if(task == RACH_DSP_TASK)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
176 // RACH info. format is only 2 words...
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
177 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
178 info_ptr[0] = ((API)(data[0])) | ((API)(data[1])<<8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
179 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
180 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
181 // Fill mcu-dsp comm. buffer.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
182 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
183 UWORD8 i,j;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
184
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
185 // Fill data block Header...
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
186 info_ptr[0] = (1 << B_BLUD); // 1st word: Set B_BLU bit.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
187 info_ptr[1] = 0; // 2nd word: cleared.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
188 info_ptr[2] = 0; // 3rd word: cleared.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
189
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
190 if((info_ptr == l1s_dsp_com.dsp_ndb_ptr->a_du_0) ||
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
191 (info_ptr == l1s_dsp_com.dsp_ndb_ptr->a_du_1))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
192 // DATA traffic buffers: size of buffer is 260 bit -> 17 words but DATA traffic uses
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
193 // only a max of 240 bit (30 bytes) -> 15 words.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
194 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
195 for (i=0, j=(3+0); j<(3+15); j++)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
196 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
197 info_ptr[j] = ((API)(data[i])) | ((API)(data[i+1]) << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
198 i += 2;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
199 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
200 #if (TRACE_TYPE==3)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
201 if (l1_stats.type == PLAY_UL)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
202 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
203 for (i=0, j=(3+0); j<(3+17); j++)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
204 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
205 info_ptr[j] = ((API)(data[i])) |
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
206 ((API)(data[i]) << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
207 i ++;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
208 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
209 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
210 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
211 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
212 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
213 // Data block for control purpose is 184 bit length: 23 bytes: 12 words (16 bit/word).
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
214 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
215 // Copy first 22 bytes in the first 11 words after header.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
216 for (i=0, j=(3+0); j<(3+11); j++)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
217 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
218 info_ptr[j] = ((API)(data[i])) | ((API)(data[i+1]) << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
219 i += 2;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
220 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
221
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
222 // Copy last UWORD8 (23rd) in the 12th word after header.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
223 info_ptr[14] = data[22];
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
224 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
225 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
226 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
227
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
228 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
229 /* l1ddsp_load_monit_task() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
230 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
231 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
232 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
233 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
234 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
235 void l1ddsp_load_monit_task(API monit_task, API fb_mode)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
236 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
237 l1s_dsp_com.dsp_db_w_ptr->d_task_md = monit_task; // Write number of measurements
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
238
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
239 if(l1a_l1s_com.mode == CS_MODE)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
240 l1s_dsp_com.dsp_ndb_ptr->d_fb_mode = fb_mode; // Write FB detection algo. mode.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
241 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
242 l1s_dsp_com.dsp_ndb_ptr->d_fb_mode = 1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
243 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
244
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
245
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
246 /* --------------------------------------------------- */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
247
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
248 /* Locosto Changes....*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
249
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
250 // Parameters: UWORD16 afcval
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
251 // Return :Void
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
252 //Functionality: TPU to accept the afcvalue from the MCU and copy it
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
253 //to the mem_xtal before triggering of AFC Script in DRP
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
254
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
255 #if(RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
256 void l1dtpu_load_afc(UWORD16 afc)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
257 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
258 l1dmacro_afc(afc, 0);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
259 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
260
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
261 /* --------------------------------------------------- */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
262
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
263 /* Locosto Changes....*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
264
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
265 /* Parameters: API dco_algo_ctl_sb */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
266 /* Functionality: Loads the API d_dco_ctl_algo_sb in the API
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
267 This should be called after updating the value in the API via cust_Get_dco_algo_ctl(...) */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
268
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
269 /* --------------------------------------------------- */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
270
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
271 void l1ddsp_load_dco_ctl_algo_sb (UWORD16 dco_ctl_algo)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
272 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
273 #if (DSP == 38) || (DSP == 39)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
274 l1s_dsp_com.dsp_db_common_w_ptr->d_dco_algo_ctrl_sb = (API) dco_ctl_algo;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
275 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
276 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
277
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
278 /* --------------------------------------------------- */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
279
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
280 /* Locosto Changes....*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
281
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
282 /* Parameters: API dco_algo_ctl_nb */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
283 /* Functionality: Loads the API d_dco_ctl_algo_nb in the API
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
284 This should be called after updating the value in the API via cust_Get_dco_algo_ctl(...) */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
285
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
286 /* --------------------------------------------------- */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
287
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
288 void l1ddsp_load_dco_ctl_algo_nb (UWORD16 dco_ctl_algo)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
289 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
290 #if (DSP == 38) || (DSP == 39)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
291 l1s_dsp_com.dsp_db_common_w_ptr->d_dco_algo_ctrl_nb = (API) dco_ctl_algo;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
292 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
293
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
294 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
295 /* --------------------------------------------------- */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
296
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
297 /* Locosto Changes....*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
298
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
299 /* Parameters: API dco_algo_ctl_pw */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
300 /* Functionality: Loads the API d_dco_ctl_algo_pw in the API
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
301 This should be called after updating the value in the API via cust_Get_dco_algo_ctl(...) */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
302
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
303 /* --------------------------------------------------- */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
304
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
305 void l1ddsp_load_dco_ctl_algo_pw (UWORD16 dco_ctl_algo)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
306 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
307 #if (DSP == 38) || (DSP == 39)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
308 l1s_dsp_com.dsp_db_common_w_ptr->d_dco_algo_ctrl_pw = (API) dco_ctl_algo;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
309 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
310 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
311
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
312 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
313
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
314 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
315 /* l1ddsp_load_afc() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
316 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
317 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
318 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
319 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
320 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
321 void l1ddsp_load_afc(API afc)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
322 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
323 #if (L1_EOTD==1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
324 // NEW !!! For EOTD measurements in IDLE mode only, cut AFC updates....
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
325 #if (L1_GPRS)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
326 if ( (l1a_l1s_com.nsync.eotd_meas_session == FALSE) ||
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
327 (l1a_l1s_com.mode == DEDIC_MODE)||
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
328 (l1a_l1s_com.l1s_en_task[PDTCH] == TASK_ENABLED))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
329 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
330 if ( (l1a_l1s_com.nsync.eotd_meas_session == FALSE) ||
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
331 (l1a_l1s_com.mode == DEDIC_MODE))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
332 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
333
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
334 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
335 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
336 //######################## For DSP Rom #################################
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
337 l1s_dsp_com.dsp_db_w_ptr->d_afc = afc; // Write new afc command.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
338 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3) || (RF_FAM == 61))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
339 // NOTE: In Locosto AFC loading is w.r.t DRP not in ABB
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
340 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_abb |= (1 << B_AFC); // Validate new afc value.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
341 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
342 #if (L1_EOTD==1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
343 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
344 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
345
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
346 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
347
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
348 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
349 /* l1ddsp_load_txpwr() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
350 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
351 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
352 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
353 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
354 /*Notes:
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
355
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
356 While Programming APC Ramp always Program the APCDEL also
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
357 Cal+:
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
358 APCDEL1: LSB Dwn(9:5):Up(4:0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
359 APCDEL2: MSB Dwn(9:5):Up(4:0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
360
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
361 Locosto:
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
362 APCDEL1: LSB Dwn(9:5):Up(4:0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
363 APCDEL2: MSB Dwn(9:5):Up(4:0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
364 -----
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
365 Cal+
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
366 APCRAM : Dwn(51:11)Up(10:6)Forced(0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
367 Locosto:
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
368 APCRAM: Dwn(9:5)Up(4:0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
369
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
370 For AFC, APCDEL1, APCDEL2, APCRAMP the Control word d_ctl_abb is checked
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
371 i f they are reqd to be updated.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
372
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
373 For AUXAPC (Cal+), the last bit = 1 would mean the DSP would pick it at Tx
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
374 For APCLEV (Loc), it is picked at every Tx, for dummy burst DSP would make it 0
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
375 */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
376
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
377 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
378 void l1ddsp_load_txpwr(UWORD8 txpwr, UWORD16 radio_freq)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
379 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
380 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3) || (RF_FAM == 61))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
381 UWORD16 pwr_data;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
382 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
383
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
384 //config
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
385 if (l1_config.tx_pwr_code ==0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
386 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
387 // Fixed TXPWR.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
388 l1s_dsp_com.dsp_db_w_ptr->d_power_ctl = l1_config.params.fixed_txpwr; // GSM management disabled: Fixed TXPWR used.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
389
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
390
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
391 #if(RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
392 //Locosto has new API for Ramp
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
393 #if (DSP == 38) || (DSP == 39)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
394 Cust_get_ramp_tab(l1s_dsp_com.dsp_ndb_ptr->a_drp_ramp, txpwr, txpwr, radio_freq);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
395 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
396 #else
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
397 #if (CODE_VERSION != SIMULATION)
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
398 /*** Reference to real ramp array (GSM: 15 power levels, 5-19, DCS: 16 power levels, 0-15) ***/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
399 Cust_get_ramp_tab(l1s_dsp_com.dsp_ndb_ptr->a_ramp, txpwr, txpwr, radio_freq);
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
400 #endif
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
401 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
402
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
403 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
404 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_abb |= ( (1 << B_RAMP) | (1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
405 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
406
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
407 #if(RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
408 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_abb |= ( (1 << B_RAMP) | (1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
409 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
410
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
411 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
412 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
413 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
414 static UWORD8 last_used_freq_band = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
415 UWORD8 freq_band;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
416
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
417 #if (L1_FF_MULTIBAND == 0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
418 // Check whether band has changed
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
419 // This will be used to reload ramps
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
420 if ((l1_config.std.id == DUAL) ||
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
421 (l1_config.std.id == DUALEXT) ||
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
422 (l1_config.std.id == DUAL_US))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
423 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
424 if (radio_freq < l1_config.std.first_radio_freq_band2)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
425 freq_band = BAND1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
426 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
427 freq_band = BAND2;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
428 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
429 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
430 freq_band = BAND1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
431 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
432
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
433 freq_band = l1_multiband_radio_freq_convert_into_effective_band_id(radio_freq);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
434
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
435 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
436
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
437 // Note: txpwr = NO_TXPWR is reserved for forcing the transmitter off
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
438 // ----- (to suppress SACCH during handover, for example)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
439
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
440 /*** Check to see if the TXPWR is to be suppressed (txpwr = NO_TXPWR) ***/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
441
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
442 if(txpwr == NO_TXPWR)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
443 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
444 /*** No transmit ***/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
445 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
446 l1s_dsp_com.dsp_db_w_ptr->d_power_ctl = 0x12; // AUXAPC initialization addr 9 pg 0 Omega
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
447 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_abb |= ( (1 << B_RAMP) | (1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
448 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
449
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
450 #if(RF_FAM == 61 ) //Locosto without Syren Format
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
451 l1s_dsp_com.dsp_db_w_ptr->d_power_ctl = (API) 0; // APCLEV
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
452 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_abb |= ( (1 << B_RAMP) | (1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
453 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
454
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
455 l1s.last_used_txpwr = NO_TXPWR;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
456 return;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
457 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
458 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
459 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
460 /*** Get power data according to clipped TXPWR ***/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
461 pwr_data = Cust_get_pwr_data(txpwr, radio_freq
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
462 #if(REL99 && FF_PRF)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
463 ,1
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
464 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
465 );
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
466
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
467 /*** Load power control level adding the APC address register ***/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
468 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
469 l1s_dsp_com.dsp_db_w_ptr->d_power_ctl = ((pwr_data << 6) | 0x12);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
470 // AUXAPC initialization addr 9 pg 0 Omega
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
471 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
472
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
473 #if(RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
474 l1s_dsp_com.dsp_db_w_ptr->d_power_ctl = (API)(pwr_data);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
475 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
476 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
477
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
478 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
479 #if(RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
480 // Currently for RF_FAM=61 Enabling APC-Ramp, APCDEL1 and APCDEL2 writing always i.e. in every TDMA frame
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
481 // TODO: Check whether this is okay
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
482 if ((l1_config.TestMode) && (l1_config.tmode.rf_params.down_up & TMODE_UPLINK))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
483 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
484 if ((l1_config.TestMode) && (l1_config.tmode.rf_params.down_up & TMODE_UPLINK) &&
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
485 ((l1s.last_used_txpwr != txpwr) || (l1_config.tmode.rf_params.reload_ramps_flag)))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
486 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
487 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
488 #if(RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
489 #if (DSP == 38) || (DSP == 39)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
490 Cust_get_ramp_tab(l1s_dsp_com.dsp_ndb_ptr->a_drp_ramp, txpwr, txpwr, radio_freq);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
491 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
492 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
493 #if (CODE_VERSION != SIMULATION)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
494 Cust_get_ramp_tab(l1s_dsp_com.dsp_ndb_ptr->a_ramp, txpwr, txpwr, radio_freq);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
495 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
496 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
497
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
498 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
499 // Setting bit 3 of this register causes DSP to write to APCDEL1 register in Omega. However,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
500 // we are controlling this register from MCU through the SPI. Therefore, set it to 0.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
501 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_abb |= ( (1 << B_RAMP) | (0 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
502 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
503
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
504 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
505 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_abb |= ( (1 << B_RAMP) | (1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
506 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
507
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
508 l1s.last_used_txpwr = txpwr;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
509 l1_config.tmode.rf_params.reload_ramps_flag = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
510 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
511 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
512 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
513
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
514 if ((l1s.last_used_txpwr != txpwr) || (last_used_freq_band != freq_band))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
515 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
516 /*** Power level or band has changed, so update the ramp, and trigger the data send to ABB ***/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
517
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
518 l1s.last_used_txpwr = txpwr;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
519 last_used_freq_band = freq_band;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
520
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
521 /*** Reference to real ramp array (GSM: 15 power levels, 5-19, DCS: 16 power levels, 0-15) ***/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
522 #if(RF_FAM == 61)
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
523 #if (DSP == 38) || (DSP == 39)
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
524 Cust_get_ramp_tab(l1s_dsp_com.dsp_ndb_ptr->a_drp_ramp, txpwr, txpwr, radio_freq);
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
525 #endif
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
526 #else
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
527 #if (CODE_VERSION != SIMULATION)
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
528 Cust_get_ramp_tab(l1s_dsp_com.dsp_ndb_ptr->a_ramp, txpwr, txpwr, radio_freq);
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
529 #endif
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
530 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
531
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
532 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3) ||(RF_FAM == 61))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
533 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_abb |= ( (1 << B_RAMP) | (1 << B_BULRAMPDEL) | (1 << B_BULRAMPDEL2));
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
534 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
535 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
536 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
537 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
538
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
539 #if (FF_L1_FAST_DECODING == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
540 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
541 /* l1ddsp_load_fp_task() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
542 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
543 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
544 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
545 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
546 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
547 void l1ddsp_load_fast_dec_task(API task, UWORD8 burst_id)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
548 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
549 if (l1s_check_fast_decoding_authorized(task))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
550 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
551 //l1s_dsp_com.dsp_db_w_ptr->d_fast_paging_ctrl = 0x0001
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
552 l1s_dsp_com.dsp_db_common_w_ptr->d_fast_paging_ctrl = 0x00001;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
553 if(burst_id == BURST_1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
554 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
555 l1s_dsp_com.dsp_db_common_w_ptr->d_fast_paging_ctrl |= 0x8000;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
556 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
557 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
558 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
559 #endif /* FF_L1_FAST_DECODING */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
560
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
561 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
562 /* l1ddsp_load_rx_task() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
563 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
564 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
565 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
566 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
567 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
568 void l1ddsp_load_rx_task(API rx_task, UWORD8 burst_id, UWORD8 tsq)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
569 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
570 l1s_dsp_com.dsp_db_w_ptr->d_task_d = rx_task; // Write RX task Identifier.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
571 l1s_dsp_com.dsp_db_w_ptr->d_burst_d = burst_id; // Write RX burst Identifier.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
572 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_system |= tsq << B_TSQ; // Write end of task DSP state.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
573 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
574
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
575 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
576 /* l1ddsp_load_tx_task() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
577 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
578 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
579 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
580 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
581 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
582 void l1ddsp_load_tx_task(API tx_task, UWORD8 burst_id, UWORD8 tsq)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
583 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
584 l1s_dsp_com.dsp_db_w_ptr->d_task_u = tx_task; // write TX task Identifier.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
585 l1s_dsp_com.dsp_db_w_ptr->d_burst_u = burst_id; // write TX burst Identifier.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
586 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_system |= tsq << B_TSQ; // Write end of task DSP state.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
587 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
588
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
589 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
590 /* l1ddsp_load_ra_task() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
591 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
592 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
593 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
594 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
595 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
596 void l1ddsp_load_ra_task(API ra_task)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
597 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
598 l1s_dsp_com.dsp_db_w_ptr->d_task_ra = ra_task; // write RA task Identifier.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
599 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
600
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
601 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
602 /* l1ddsp_load_tch_mode() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
603 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
604 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
605 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
606 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
607 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
608 void l1ddsp_load_tch_mode(UWORD8 dai_mode, BOOL dtx_allowed)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
609 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
610 // TCH mode register.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
611 // bit[0] -> b_eotd.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
612 // bit[1] -> b_audio_async only for WCP
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
613 // bit [2] -> b_dtx.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
614 // bit[3] -> play_ul when set to 1
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
615 // bit[4] -> play_dl when set to 1
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
616 // bit[5] -> DTX selection for voice memo
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
617 // bit[6] -> Reserved for ciphering debug
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
618 // bit[7..10] -> Reserved for ramp up control
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
619 // bit[11] -> Reserved for analog device selection
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
620
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
621 #if (DSP == 32)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
622 UWORD16 mask = 0xfffb;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
623 #else // NO OP_WCP
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
624 UWORD16 mask = 0xfff8;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
625 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
626
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
627 l1s_dsp_com.dsp_ndb_ptr->d_tch_mode = (l1s_dsp_com.dsp_ndb_ptr->d_tch_mode & mask)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
628 | (dtx_allowed<<2);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
629 #if (L1_EOTD == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
630 l1s_dsp_com.dsp_ndb_ptr->d_tch_mode |= B_EOTD;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
631 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
632 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
633
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
634 #if (AMR == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
635 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
636 /* l1ddsp_load_tch_param() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
637 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
638 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
639 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
640 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
641 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
642 #if (FF_L1_TCH_VOCODER_CONTROL == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
643 void l1ddsp_load_tch_param(T_TIME_INFO *next_time, UWORD8 chan_mode,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
644 UWORD8 chan_type, UWORD8 subchannel,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
645 UWORD8 tch_loop, UWORD8 sync_tch,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
646 UWORD8 sync_amr,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
647 UWORD8 reset_sacch,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
648 #if !FF_L1_IT_DSP_DTX
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
649 UWORD8 vocoder_on)
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
650 #else
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
651 UWORD8 vocoder_on,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
652 BOOL dtx_dsp_interrupt)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
653 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
654 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
655 void l1ddsp_load_tch_param(T_TIME_INFO *next_time, UWORD8 chan_mode,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
656 UWORD8 chan_type, UWORD8 subchannel,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
657 UWORD8 tch_loop, UWORD8 sync_tch,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
658 #if !FF_L1_IT_DSP_DTX
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
659 UWORD8 sync_amr)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
660 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
661 UWORD8 sync_amr, BOOL dtx_dsp_interrupt)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
662 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
663 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
664 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
665 UWORD32 count_0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
666 UWORD32 count_1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
667 UWORD32 d_ctrl_tch;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
668 UWORD32 d_fn;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
669
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
670 // d_ctrl_tch
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
671 // ----------
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
672 // bit [0..3] -> b_chan_mode
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
673 // bit [4..7] -> b_chan_type
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
674 // bit [8] -> b_sync_tch_ul
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
675 // bit [9] -> b_sync_amr
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
676 // bit [10] -> b_stop_tch_ul
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
677 // bit [11] -> b_stop_tch_dl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
678 // bit [12..14] -> b_tch_loop
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
679 // bit [15] -> b_subchannel
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
680 #if (FF_L1_TCH_VOCODER_CONTROL == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
681 d_ctrl_tch = (chan_mode<<B_CHAN_MODE) | (chan_type<<B_CHAN_TYPE) | (subchannel<<B_SUBCHANNEL) |
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
682 (sync_tch<<B_SYNC_TCH_UL) | (sync_amr<<B_SYNC_AMR) |
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
683 (tch_loop<<B_TCH_LOOP) | (reset_sacch<<B_RESET_SACCH) | (vocoder_on<<B_VOCODER_ON);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
684 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
685 d_ctrl_tch = (chan_mode<<B_CHAN_MODE) | (chan_type<<B_CHAN_TYPE) | (subchannel<<B_SUBCHANNEL) |
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
686 (sync_tch<<B_SYNC_TCH_UL) | (sync_amr<<B_SYNC_AMR) |
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
687 (tch_loop<<B_TCH_LOOP);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
688 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
689
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
690 // d_fn
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
691 // ----
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
692 // bit [0..7] -> b_fn_report
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
693 // bit [8..15] -> b_fn_sid
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
694 d_fn = (next_time->fn_in_report) | ((next_time->fn%104)<<8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
695
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
696 // a_a5fn
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
697 // ------
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
698 // count_0 (a_a5fn[0]), bit [0..4] -> T2.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
699 // count_0 (a_a5fn[1]), bit [5..10] -> T3.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
700 // count_1 (a_a5fn[0]), bit [0..10] -> T1.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
701 count_0 = ((UWORD16)next_time->t3 << 5) | (next_time->t2);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
702 count_1 = (next_time->t1);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
703
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
704 l1s_dsp_com.dsp_db_w_ptr->d_fn = d_fn; // write both Fn_sid, Fn_report.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
705 l1s_dsp_com.dsp_db_w_ptr->a_a5fn[0] = count_0; // cyphering FN part 1.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
706 l1s_dsp_com.dsp_db_w_ptr->a_a5fn[1] = count_1; // cyphering FN part 2.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
707 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_tch = d_ctrl_tch; // Channel config.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
708 #if FF_L1_IT_DSP_DTX
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
709 // ### TBD: report this block below in the other instance of this function
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
710 // DTX interrupt request is latched by DSP in TDMA3 (TCH-AFS, TCH-AHS0) or TDMA0 (TCH-AHS1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
711 if ((chan_mode == TCH_AFS_MODE) || (chan_mode == TCH_AHS_MODE))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
712 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
713 if (((next_time->fn_mod13_mod4 == 3) &&
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
714 ((chan_mode == TCH_AFS_MODE) || ((subchannel == 0)))) ||
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
715 ((next_time->fn_mod13_mod4 == 0) &&
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
716 ((chan_mode == TCH_AHS_MODE) && (subchannel == 1)))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
717 )
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
718 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
719 if (dtx_dsp_interrupt)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
720 l1s_dsp_com.dsp_ndb_ptr->d_fast_dtx_enable=1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
721 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
722 l1s_dsp_com.dsp_ndb_ptr->d_fast_dtx_enable=0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
723
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
724 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
725 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
726 // Fast DTX not supported
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
727 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
728 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
729 // No interrupt genaration
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
730 l1s_dsp_com.dsp_ndb_ptr->d_fast_dtx_enable=0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
731 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
732 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
733 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
734 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
735 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
736 /* l1ddsp_load_tch_param() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
737 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
738 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
739 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
740 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
741 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
742 #if (FF_L1_TCH_VOCODER_CONTROL == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
743 void l1ddsp_load_tch_param(T_TIME_INFO *next_time, UWORD8 chan_mode,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
744 UWORD8 chan_type, UWORD8 subchannel,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
745 UWORD8 tch_loop, UWORD8 sync_tch,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
746 #if !FF_L1_IT_DSP_DTX
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
747 UWORD8 reset_sacch, UWORD8 vocoder_on)
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
748 #else
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
749 UWORD8 reset_sacch, UWORD8 vocoder_on,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
750 BOOL dtx_dsp_interrupt)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
751 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
752 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
753 void l1ddsp_load_tch_param(T_TIME_INFO *next_time, UWORD8 chan_mode,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
754 UWORD8 chan_type, UWORD8 subchannel,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
755 #if !FF_L1_IT_DSP_DTX
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
756 UWORD8 tch_loop, UWORD8 sync_tch)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
757 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
758 UWORD8 tch_loop, UWORD8 sync_tch,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
759 BOOL dtx_dsp_interrupt)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
760 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
761 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
762 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
763 UWORD32 count_0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
764 UWORD32 count_1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
765 UWORD32 d_ctrl_tch;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
766 UWORD32 d_fn;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
767
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
768 // d_ctrl_tch
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
769 // ----------
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
770 // bit [0..3] -> b_chan_mode
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
771 // bit [4..7] -> b_chan_type
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
772 // bit [8] -> b_sync_tch_ul
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
773 // bit [9] -> b_sync_tch_dl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
774 // bit [10] -> b_stop_tch_ul
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
775 // bit [11] -> b_stop_tch_dl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
776 // bit [12..14] -> b_tch_loop
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
777 // bit [15] -> b_subchannel
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
778 #if (FF_L1_TCH_VOCODER_CONTROL == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
779 d_ctrl_tch = (chan_mode<<B_CHAN_MODE) | (chan_type<<B_CHAN_TYPE) | (subchannel<<B_SUBCHANNEL) |
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
780 (sync_tch<<B_SYNC_TCH_UL) | (sync_tch<<B_SYNC_TCH_DL) |
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
781 (tch_loop<<B_TCH_LOOP) | (reset_sacch<<B_RESET_SACCH) | (vocoder_on<<B_VOCODER_ON);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
782 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
783 d_ctrl_tch = (chan_mode<<B_CHAN_MODE) | (chan_type<<B_CHAN_TYPE) | (subchannel<<B_SUBCHANNEL) |
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
784 (sync_tch<<B_SYNC_TCH_UL) | (sync_tch<<B_SYNC_TCH_DL) |
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
785 (tch_loop<<B_TCH_LOOP);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
786 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
787
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
788 // d_fn
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
789 // ----
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
790 // bit [0..7] -> b_fn_report
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
791 // bit [8..15] -> b_fn_sid
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
792 d_fn = (next_time->fn_in_report) | ((next_time->fn%104)<<8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
793
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
794 // a_a5fn
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
795 // ------
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
796 // count_0 (a_a5fn[0]), bit [0..4] -> T2.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
797 // count_0 (a_a5fn[1]), bit [5..10] -> T3.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
798 // count_1 (a_a5fn[0]), bit [0..10] -> T1.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
799 count_0 = ((UWORD16)next_time->t3 << 5) | (next_time->t2);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
800 count_1 = (next_time->t1);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
801
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
802 l1s_dsp_com.dsp_db_w_ptr->d_fn = d_fn; // write both Fn_sid, Fn_report.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
803 l1s_dsp_com.dsp_db_w_ptr->a_a5fn[0] = count_0; // cyphering FN part 1.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
804 l1s_dsp_com.dsp_db_w_ptr->a_a5fn[1] = count_1; // cyphering FN part 2.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
805 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_tch = d_ctrl_tch; // Channel config.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
806 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
807 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
808
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
809 #if (L1_VOCODER_IF_CHANGE == 0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
810 // TODO: to be moved in API file (see BUG3093)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
811 BOOL enable_tch_vocoder(BOOL vocoder)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
812 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
813 #if (FF_L1_TCH_VOCODER_CONTROL == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
814 // To enable the vocoder, we set the trigger => then handled in l1s_dedicated_mode_manager
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
815 #if (W_A_DSP_PR20037 == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
816 if ((vocoder==TRUE) && (l1a_l1s_com.dedic_set.start_vocoder == TCH_VOCODER_DISABLED))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
817 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
818 l1a_l1s_com.dedic_set.start_vocoder = TCH_VOCODER_ENABLE_REQ;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
819
96
065ebe468750 l1_drive.c: difference in DSP workaround preprocessor symbols
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 95
diff changeset
820 #if ( L1M_WAIT_DSP_RESTART_AFTER_VOCODER_ENABLE ==1)
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
821 NU_Sleep(DSP_VOCODER_ON_TRANSITION); // DSP transition
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
822 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
823 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
824 // When vocoder_on = FALSE, vocoder module is not executed
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
825 else if ((vocoder==FALSE) && (l1a_l1s_com.dedic_set.start_vocoder == TCH_VOCODER_ENABLED))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
826 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
827 l1a_l1s_com.dedic_set.start_vocoder = TCH_VOCODER_DISABLE_REQ;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
828 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
829 #else // W_A_DSP_PR20037 == 0
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
830 if (vocoder)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
831 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
832 l1a_l1s_com.dedic_set.start_vocoder = TRUE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
833 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
834 // When vocoder_on = FALSE, vocoder module is not executed
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
835 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
836 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
837 l1a_l1s_com.dedic_set.vocoder_on = FALSE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
838 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
839 #endif // W_A_DSP_PR20037
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
840
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
841 return TRUE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
842 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
843 return FALSE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
844 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
845 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
846 #endif // L1_VOCODER_IF_CHANGE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
847 BOOL l1_select_mcsi_port(UWORD8 port)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
848 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
849 #if ( (CHIPSET == 12) && (RF_FAM != 61) )
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
850 l1s_dsp_com.dsp_ndb_ptr->d_mcsi_select = (API)port;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
851 return TRUE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
852 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
853 return FALSE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
854 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
855 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
856
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
857 // TODO: to be moved in API file
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
858
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
859 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
860 /* l1ddsp_load_ciph_param() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
861 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
862 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
863 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
864 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
865 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
866 void l1ddsp_load_ciph_param(UWORD8 a5mode,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
867 T_ENCRYPTION_KEY *ciph_key)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
868 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
869 // Store ciphering mode (0 for no ciphering) in MCU-DSP com.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
870 l1s_dsp_com.dsp_ndb_ptr->d_a5mode = a5mode; // A5 algorithm (0 for none).
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
871 // Store ciphering key.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
872
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
873 #if (L1_A5_3 == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
874
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
875 if(a5mode == 3)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
876 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
877 #if(OP_L1_STANDALONE != 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
878 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[0] = (ciph_key->A[0]) | (ciph_key->A[1] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
879 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[1] = (ciph_key->A[2]) | (ciph_key->A[3] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
880 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[2] = (ciph_key->A[4]) | (ciph_key->A[5] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
881 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[3] = (ciph_key->A[6]) | (ciph_key->A[7] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
882 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[4] = (ciph_key->A[8]) | (ciph_key->A[9] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
883 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[5] = (ciph_key->A[10]) | (ciph_key->A[11] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
884 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[6] = (ciph_key->A[12]) | (ciph_key->A[13] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
885 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[7] = (ciph_key->A[14]) | (ciph_key->A[15] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
886 #else // (OP_L1_STANDALONE == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
887 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[0] = (ciph_key->A[0]) | (ciph_key->A[1] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
888 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[1] = (ciph_key->A[2]) | (ciph_key->A[3] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
889 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[2] = (ciph_key->A[4]) | (ciph_key->A[5] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
890 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[3] = (ciph_key->A[6]) | (ciph_key->A[7] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
891 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[4] = (ciph_key->A[8]) | (ciph_key->A[1] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
892 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[5] = (ciph_key->A[10]) | (ciph_key->A[3] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
893 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[6] = (ciph_key->A[12]) | (ciph_key->A[5] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
894 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[7] = (ciph_key->A[14]) | (ciph_key->A[7] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
895 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
896 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
897 else // a5mode == 1 or 2
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
898 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
899 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[0] = (ciph_key->A[0]) | (ciph_key->A[1] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
900 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[1] = (ciph_key->A[2]) | (ciph_key->A[3] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
901 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[2] = (ciph_key->A[4]) | (ciph_key->A[5] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
902 l1s_dsp_com.dsp_ndb_ptr->a_a5_kc[3] = (ciph_key->A[6]) | (ciph_key->A[7] << 8);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
903 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
904
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
905 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
906
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
907 l1s_dsp_com.dsp_ndb_ptr->a_kc[0] = (ciph_key->A[0]) | (ciph_key->A[1] << 8);
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
908 l1s_dsp_com.dsp_ndb_ptr->a_kc[1] = (ciph_key->A[2]) | (ciph_key->A[3] << 8);
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
909 l1s_dsp_com.dsp_ndb_ptr->a_kc[2] = (ciph_key->A[4]) | (ciph_key->A[5] << 8);
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
910 l1s_dsp_com.dsp_ndb_ptr->a_kc[3] = (ciph_key->A[6]) | (ciph_key->A[7] << 8);
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
911
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
912 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
913 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
914
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
915 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
916 /* l1ddsp_stop_tch() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
917 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
918 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
919 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
920 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
921 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
922 void l1ddsp_stop_tch(void)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
923 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
924 // Tch channel description.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
925 // bit [10] -> b_stop_tch_ul, stop TCH/UL.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
926 // bit [11] -> b_stop_tch_dl, stop TCH/DL.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
927
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
928 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_tch |= 3 << B_STOP_TCH_UL;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
929 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
930
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
931 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
932 /* l1ddsp_meas_read() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
933 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
934 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
935 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
936 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
937 /*-------------------------------------------------------*/
97
784c1f136e67 l1_drive.c: l1ddsp_meas_read() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 96
diff changeset
938 void l1ddsp_meas_read(UWORD8 nbmeas, UWORD8 *pm)
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
939 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
940 UWORD8 i;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
941
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
942 for (i= 0; i < nbmeas; i++)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
943 {
97
784c1f136e67 l1_drive.c: l1ddsp_meas_read() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 96
diff changeset
944 pm[i] = ((l1s_dsp_com.dsp_db_r_ptr->a_pm[i] & 0xffff) >> 5);
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
945 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
946
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
947 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
948 if(l1_config.TestMode)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
949 l1tm.tmode_stats.pm_recent = l1s_dsp_com.dsp_db_r_ptr->a_pm[0] & 0xffff;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
950 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
951 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
952
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
953 #if (AMR == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
954 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
955 /* l1ddsp_load_amr_param() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
956 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
957 /* Parameters : AMR configuration */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
958 /* Return : none */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
959 /* Functionality : Download the AMR configuration to the */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
960 /* DSP via API */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
961 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
962 void l1ddsp_load_amr_param(T_AMR_CONFIGURATION amr_param, UWORD8 cmip)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
963 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
964 // Clear the AMR API buffer
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
965 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[0] = (API)0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
966 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[1] = (API)0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
967 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[2] = (API)0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
968 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[3] = (API)0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
969
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
970 // Set the AMR parameters
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
971 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[NSCB_INDEX] |= (API)((amr_param.noise_suppression_bit & NSCB_MASK ) << NSCB_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
972 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[ICMUL_INDEX] |= (API)((amr_param.initial_codec_mode & ICM_MASK ) << ICMUL_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
973 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[ICMDL_INDEX] |= (API)((amr_param.initial_codec_mode & ICM_MASK ) << ICMDL_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
974 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[ICMIUL_INDEX] |= (API)((amr_param.initial_codec_mode_indicator & ICMI_MASK ) << ICMIUL_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
975 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[ICMIDL_INDEX] |= (API)((amr_param.initial_codec_mode_indicator & ICMI_MASK ) << ICMIDL_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
976 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[ACSUL_INDEX] |= (API)((amr_param.active_codec_set & ACS_MASK ) << ACSUL_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
977 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[ACSDL_INDEX] |= (API)((amr_param.active_codec_set & ACS_MASK ) << ACSDL_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
978 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[THR1_INDEX] |= (API)((amr_param.threshold[0] & THR_MASK ) << THR1_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
979 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[THR2_INDEX] |= (API)((amr_param.threshold[1] & THR_MASK ) << THR2_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
980 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[THR3_INDEX] |= (API)((amr_param.threshold[2] & THR_MASK ) << THR3_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
981 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[HYST1_INDEX] |= (API)((amr_param.hysteresis[0] & HYST_MASK ) << HYST1_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
982 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[HYST2_INDEX] |= (API)((amr_param.hysteresis[1] & HYST_MASK ) << HYST2_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
983 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[HYST3_INDEX] |= (API)((amr_param.hysteresis[2] & HYST_MASK ) << HYST3_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
984 l1s_dsp_com.dsp_ndb_ptr->a_amr_config[CMIP_INDEX] |= (API)((cmip & CMIP_MASK ) << CMIP_SHIFT);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
985 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
986 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
987
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
988 #if (L1_SAIC != 0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
989 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
990 /* l1ddsp_load_swh_flag() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
991 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
992 /* Parameters : SWH (Spatial Whitening) Flag */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
993 /* Return : none */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
994 /* Functionality : To write the d_swh_ApplyWhitening flag*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
995 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
996 void l1ddsp_load_swh_flag (UWORD16 SWH_flag, UWORD16 SAIC_flag)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
997 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
998
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
999 if(SAIC_flag)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1000 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1001 l1s_dsp_com.dsp_db_common_w_ptr->d_swh_ctrl_db = SAIC_ENABLE_DB;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1002 if(SWH_flag)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1003 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1004 l1s_dsp_com.dsp_db_common_w_ptr->d_swh_ctrl_db |= (0x01<< B_SWH_DB);
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1005 }
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1006 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1007 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1008 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1009 l1s_dsp_com.dsp_db_common_w_ptr->d_swh_ctrl_db = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1010 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1011 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1012 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1013
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1014 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1015 /* l1ddsp_end_scenario() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1016 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1017 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1018 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1019 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1020 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1021 void l1ddsp_end_scenario(UWORD8 type)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1022 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1023 #if (CODE_VERSION == SIMULATION)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1024 #if (AUDIO_SIMULATION)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1025 switch(type)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1026 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1027 case GSM_CTL:
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1028 case GSM_MISC_CTL:
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1029 // a DSP control for a GSM task or
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1030 // a DSP control for a GSM and a MISC tasks
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1031 //-----------------------------
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1032 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1033 // set DSP_ENB and DSP_PAG for communication interrupt
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1034 l1s_tpu_com.reg_cmd->dsp_pag_bit = l1s_dsp_com.dsp_w_page;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1035 l1s_tpu_com.reg_cmd->dsp_enb_bit = ON;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1036
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1037 // change DSP page pointer for next controle
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1038 l1s_dsp_com.dsp_w_page ^= 1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1039 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1040 break;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1041
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1042 case MISC_CTL:
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1043 // a DSP control for a MISC task
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1044 //------------------------------
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1045 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1046 // set only MISC task and reset MISC page
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1047 // (don't change GSM PAGE).
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1048 // set DSP communication Interrupt.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1049 // set DSP_ENB and the same DSP_PAG for communication interrupt
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1050 l1s_tpu_com.reg_cmd->dsp_pag_bit = l1s_dsp_com.dsp_w_page^1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1051 l1s_tpu_com.reg_cmd->dsp_enb_bit = ON;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1052 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1053 break;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1054 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1055 #else // NO AUDIO_SIMULATION
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1056 // set DSP_ENB and DSP_PAG for communication interrupt
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1057 l1s_tpu_com.reg_cmd->dsp_pag_bit = l1s_dsp_com.dsp_w_page;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1058 l1s_tpu_com.reg_cmd->dsp_enb_bit = ON;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1059
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1060 // change DSP page pointer for next control
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1061 l1s_dsp_com.dsp_w_page ^= 1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1062 #endif // AUDIO_SIMULATION
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1063
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1064 #else // NOT_SIMULATION
98
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1065 UWORD32 dsp_task;
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1066 switch(type)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1067 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1068 case GSM_CTL:
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1069 // a DSP control for a GSM task
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1070 //-----------------------------
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1071 {
98
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1072 // set only GSM task and GSM page
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1073 dsp_task = B_GSM_TASK | l1s_dsp_com.dsp_w_page;
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1074 // change DSP page pointer for next controle
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1075 l1s_dsp_com.dsp_w_page ^= 1;
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1076 }
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1077 break;
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1078
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1079 case MISC_CTL:
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1080 // a DSP control for a MISC task
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1081 //------------------------------
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1082 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1083 UWORD32 previous_page = l1s_dsp_com.dsp_w_page ^ 1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1084
98
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1085 // set only MISC task and reset MISC page
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1086 // (don't change GSM PAGE).
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1087 // set DSP communication Interrupt.
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1088 dsp_task = B_MISC_TASK | previous_page;
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1089
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1090 // Rem: DSP makes the DB header feedback even in case
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1091 // of MISC task (like TONES). This created some
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1092 // side effect which are "work-around" passing
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1093 // the correct DB page to the DSP.
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1094 }
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1095 break;
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1096
98
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1097 case GSM_MISC_CTL:
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1098 // a DSP control for a GSM and a MISC tasks
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1099 //-----------------------------------------
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1100 {
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1101 // set GSM task, MISC task and GSM page bit.....
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1102 dsp_task = B_GSM_TASK | B_MISC_TASK | l1s_dsp_com.dsp_w_page;
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1103 // change DSP page pointer for next controle
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1104 l1s_dsp_com.dsp_w_page ^= 1;
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1105 }
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1106 break;
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1107
98
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1108 #if 0 /* enable this after TCS211 reconstruction */
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1109 default:
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1110 dsp_task = 0;
c78de09b1a90 l1_drive.c: l1ddsp_end_scenario() reconstructed
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 97
diff changeset
1111 #endif
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1112 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1113
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1114 // write dsp tasks.....
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1115 #if (DSP >= 33)
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1116 l1s_dsp_com.dsp_ndb_ptr->d_dsp_page = (API) dsp_task;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1117 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1118 l1s_dsp_com.dsp_param_ptr->d_dsp_page = (API) dsp_task;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1119 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1120
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1121 // Enable frame IT on next TDMA
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1122 l1dmacro_set_frame_it();
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1123
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1124 #if (DSP >= 38)
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1125 // DSP CPU load measurement - write logic (provide TDMA frame number to DSP)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1126 (*((volatile UWORD16 *)(DSP_CPU_LOAD_MCU_W_TDMA_FN))) = (API)l1s.actual_time.fn_mod42432;
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1127 #endif
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1128
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1129 #endif // NOT_SIMULATION
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1130 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1131
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1132 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1133 /* l1dtpu_meas() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1134 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1135 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1136 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1137 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1138
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1139 /* Locosto : should take additional Param of task */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1140
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1141 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1142 void l1dtpu_meas(UWORD16 radio_freq,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1143 WORD8 agc,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1144 UWORD8 lna_off,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1145 UWORD16 win_id,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1146 UWORD16 tpu_synchro, UWORD8 adc_active
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1147 #if(RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1148 ,UWORD8 afc_mode
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1149 ,UWORD8 if_ctl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1150 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1151 )
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1152
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1153 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1154
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1155 WORD16 offset;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1156 WORD16 when;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1157 UWORD16 offset_chg;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1158
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1159 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1160 if (!l1_config.agc_enable)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1161 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1162 // AGC gain can only be controlled in 2dB steps as the bottom bit (bit zero)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1163 // corresponds to the lna_off bit
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1164 agc = l1_config.tmode.rx_params.agc;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1165 lna_off = l1_config.tmode.rx_params.lna_off;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1166 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1167 #endif // TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1168
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1169 // Compute offset
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1170 offset_chg = ((win_id * BP_DURATION) >> BP_SPLIT_PW2);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1171 offset = tpu_synchro + offset_chg;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1172 if(offset >= TPU_CLOCK_RANGE) offset -= TPU_CLOCK_RANGE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1173
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1174 // Compute offset change timing
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1175 when = offset_chg + PROVISION_TIME - (l1_config.params.rx_synth_setup_time + EPSILON_OFFS);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1176 if(when < 0) when += TPU_CLOCK_RANGE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1177
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1178 // Program TPU scenario
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1179 l1dmacro_offset (offset, when); // change TPU offset according to win_id
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1180 l1dmacro_rx_synth (radio_freq); // pgme SYNTH.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1181 if(adc_active == ACTIVE)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1182 l1dmacro_adc_read_rx(); // pgme ADC measurement
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1183
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1184 l1dmacro_agc (radio_freq, agc,lna_off
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1185 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1186 ,if_ctl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1187 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1188 ); // pgme AGC.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1189 #if (CODE_VERSION == SIMULATION)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1190 l1dmacro_rx_ms (radio_freq, 0); // pgm PWR acquisition.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1191 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1192 #if (L1_MADC_ON == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1193 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1194 l1dmacro_rx_ms (radio_freq,adc_active); // pgm PWR acquisition.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1195 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1196 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1197 l1dmacro_rx_ms (radio_freq); // pgm PWR acquisition.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1198 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1199 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1200 l1dmacro_offset (tpu_synchro, IMM); // restore offset
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1201
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1202 //Locosto
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1203 #if(RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1204 // L1_AFC_SCRIPT_MODE - This is specific to Locosto to make AFC script run after
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1205 // the second power measurement during FBNEW
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1206 if ((win_id == 0) || (afc_mode == L1_AFC_SCRIPT_MODE))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1207 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1208 if (win_id == 0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1209 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1210 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1211 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1212 // NOTE: In Locosto AFC is in DRP not in triton
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1213 l1ddsp_load_afc(l1s.afc);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1214 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1215
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1216 //Locosto
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1217 #if(RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1218 if(afc_mode != L1_AFC_NONE)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1219 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1220 if(afc_mode == L1_AFC_SCRIPT_MODE)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1221 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1222 l1dtpu_load_afc(l1s.afc); //Load the Initial afc value to the TPU. TPU would copy it to the DRP Wrapper Mem.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1223 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1224 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1225 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1226 l1ddsp_load_afc(l1s.afc);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1227 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1228 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1229 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1230 // end Locosto
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1231 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1232 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1233
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1234 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1235 /* l1dtpu_neig_fb() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1236 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1237 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1238 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1239 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1240 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1241 void l1dtpu_neig_fb(UWORD16 radio_freq, WORD8 agc, UWORD8 lna_off)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1242 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1243 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1244 if (!l1_config.agc_enable)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1245 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1246 // AGC gain can only be controlled in 2dB steps as the bottom bit (bit zero)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1247 // corresponds to the lna_off bit
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1248 agc = l1_config.tmode.rx_params.agc;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1249 lna_off = l1_config.tmode.rx_params.lna_off;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1250 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1251 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1252
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1253 l1dmacro_rx_synth (radio_freq); // pgme SYNTH.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1254 l1dmacro_agc (radio_freq,agc, lna_off
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1255 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1256 ,IF_120KHZ_DSP
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1257 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1258 ); // pgme AGC.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1259 #if (L1_MADC_ON == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1260 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1261 l1dmacro_rx_fb (radio_freq,INACTIVE); // pgm FB acquisition.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1262 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1263 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1264 l1dmacro_rx_fb (radio_freq); // pgm FB acquisition.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1265 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1266 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1267
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1268 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1269 /* l1dtpu_neig_fb26() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1270 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1271 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1272 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1273 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1274 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1275 void l1dtpu_neig_fb26(UWORD16 radio_freq, WORD8 agc, UWORD8 lna_off, UWORD32 offset_serv)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1276 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1277 WORD16 offset;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1278
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1279 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1280 if (!l1_config.agc_enable)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1281 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1282 // AGC gain can only be controlled in 2dB steps as the bottom bit (bit zero)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1283 // corresponds to the lna_off bit
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1284 agc = l1_config.tmode.rx_params.agc;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1285 lna_off = l1_config.tmode.rx_params.lna_off;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1286 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1287 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1288
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1289 // Compute offset
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1290 offset = offset_serv + l1_config.params.fb26_anchoring_time;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1291 if(offset >= TPU_CLOCK_RANGE) offset -= TPU_CLOCK_RANGE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1292
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1293 // Program TPU scenario
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1294 l1dmacro_offset (offset, l1_config.params.fb26_change_offset_time);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1295 l1dmacro_rx_synth (radio_freq); // pgme SYNTH.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1296 l1dmacro_agc (radio_freq,agc, lna_off
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1297 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1298 ,IF_120KHZ_DSP
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1299 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1300 ); // pgme AGC.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1301 #if (L1_MADC_ON == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1302 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1303 l1dmacro_rx_fb26 (radio_freq, INACTIVE); // pgm FB acquisition.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1304 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1305 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1306 l1dmacro_rx_fb26 (radio_freq); // pgm FB acquisition.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1307 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1308 l1dmacro_offset (offset_serv, IMM); // restore offset
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1309 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1310
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1311 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1312 /* l1dtpu_neig_sb() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1313 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1314 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1315 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1316 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1317 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1318 void l1dtpu_neig_sb(UWORD16 radio_freq, WORD8 agc, UWORD8 lna_off,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1319 UWORD32 time_alignmt, UWORD32 offset_serv, UWORD8 reload_flag,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1320 UWORD8 attempt
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1321 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1322 ,UWORD8 if_ctl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1323 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1324 )
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1325 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1326 UWORD16 offset_neigh;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1327
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1328 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1329 if (!l1_config.agc_enable)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1330 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1331 // AGC gain can only be controlled in 2dB steps as the bottom bit (bit zero)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1332 // corresponds to the lna_off bit
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1333 agc = l1_config.tmode.rx_params.agc;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1334 lna_off = l1_config.tmode.rx_params.lna_off;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1335 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1336 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1337
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1338 // compute offset neighbour...
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1339 offset_neigh = offset_serv + time_alignmt;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1340 if(offset_neigh >= TPU_CLOCK_RANGE) offset_neigh -= TPU_CLOCK_RANGE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1341
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1342 // load OFFSET with NEIGHBOUR value.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1343 l1dmacro_offset (offset_neigh, l1_config.params.rx_change_offset_time);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1344
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1345 // Insert 1 NOP to correct the EPSILON_SYNC side effect.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1346 if(attempt != 2)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1347 if(time_alignmt >= (TPU_CLOCK_RANGE - EPSILON_SYNC))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1348 l1dmacro_offset (offset_neigh, 0); // load OFFSET with NEIGHBOUR value.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1349
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1350 l1dmacro_rx_synth(radio_freq); // pgme SYNTH.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1351 l1dmacro_agc (radio_freq, agc, lna_off
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1352 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1353 ,if_ctl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1354 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1355 ); // pgme AGC.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1356 #if (L1_MADC_ON == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1357 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1358 l1dmacro_rx_sb (radio_freq,INACTIVE); // pgm SB acquisition.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1359 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1360 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1361 l1dmacro_rx_sb (radio_freq); // pgm SB acquisition.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1362 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1363
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1364 // Restore offset with serving value.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1365 if(reload_flag == TRUE)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1366 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1367 l1dmacro_offset (offset_serv, IMM);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1368 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1369 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1370 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1371 /* l1dtpu_neig_fbsb() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1372 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1373 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1374 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1375 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1376 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1377 #if ((REL99 == 1) && (FF_BHO == 1))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1378 /*void l1dtpu_neig_fbsb(UWORD16 radio_freq, WORD8 agc, UWORD8 lna_off
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1379 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1380 ,UWORD8 if_ctl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1381 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1382 )*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1383 void l1dtpu_neig_fbsb(UWORD16 radio_freq, WORD8 agc, UWORD8 lna_off)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1384 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1385 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1386 if (!l1_config.agc_enable)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1387 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1388 // AGC gain can only be controlled in 2dB steps as the bottom bit (bit zero)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1389 // corresponds to the lna_off bit
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1390 agc = l1_config.tmode.rx_params.agc;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1391 lna_off = l1_config.tmode.rx_params.lna_off;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1392 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1393 #endif // TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1394
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1395 l1dmacro_rx_synth (radio_freq); // pgme SYNTH.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1396 /*l1dmacro_agc(radio_freq, agc, lna_off
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1397 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1398 ,if_ctl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1399 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1400 ); // pgme AGC.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1401 */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1402 l1dmacro_agc (radio_freq,agc, lna_off
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1403 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1404 ,L1_CTL_LOW_IF
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1405 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1406 ); // pgme AGC.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1407 #if (L1_MADC_ON == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1408 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1409 l1dmacro_rx_fbsb(radio_freq,INACTIVE); // pgm FB acquisition.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1410 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1411 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1412 l1dmacro_rx_fbsb(radio_freq); // pgm FB acquisition.- sajal commented
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1413 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1414 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1415 #endif // #if ((REL99 == 1) && (FF_BHO == 1))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1416 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1417 /* l1dtpu_neig_sb26() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1418 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1419 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1420 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1421 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1422 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1423 void l1dtpu_neig_sb26(UWORD16 radio_freq, WORD8 agc, UWORD8 lna_off, UWORD32 time_alignmt,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1424 UWORD32 fn_offset, UWORD32 offset_serv
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1425 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1426 ,UWORD8 if_ctl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1427 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1428 )
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1429 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1430 UWORD16 offset_neigh;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1431
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1432 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1433 if (!l1_config.agc_enable)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1434 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1435 // AGC gain can only be controlled in 2dB steps as the bottom bit (bit zero)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1436 // corresponds to the lna_off bit
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1437 agc = l1_config.tmode.rx_params.agc;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1438 lna_off = l1_config.tmode.rx_params.lna_off;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1439 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1440 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1441
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1442 // compute offset neighbour...
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1443 offset_neigh = offset_serv + time_alignmt;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1444 if(offset_neigh >= TPU_CLOCK_RANGE) offset_neigh -= TPU_CLOCK_RANGE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1445
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1446 if(fn_offset != 0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1447 l1dmacro_offset (offset_neigh, 0); // 1 NOP in some case
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1448 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1449 l1dmacro_offset (offset_neigh, l1_config.params.fb26_change_offset_time);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1450
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1451 l1dmacro_rx_synth(radio_freq); // pgme SYNTH.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1452 l1dmacro_agc(radio_freq, agc, lna_off
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1453 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1454 ,if_ctl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1455 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1456 ); // pgme AGC.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1457 #if (L1_MADC_ON == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1458 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1459 l1dmacro_rx_sb (radio_freq, INACTIVE); // pgm SB acquisition.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1460 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1461 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1462 l1dmacro_rx_sb (radio_freq); // pgm SB acquisition.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1463 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1464 l1dmacro_offset (offset_serv, IMM); // Restore offset with serving value.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1465 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1466
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1467 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1468 /* l1dtpu_serv_rx_nb() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1469 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1470 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1471 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1472 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1473 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1474 void l1dtpu_serv_rx_nb(UWORD16 radio_freq, WORD8 agc, UWORD8 lna_off,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1475 UWORD32 synchro_serv,UWORD32 new_offset,BOOL change_offset,
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1476 UWORD8 adc_active
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1477 #if(RF_FAM == 61)
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1478 , UWORD8 csf_filter_choice
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1479 , UWORD8 if_ctl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1480 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1481 #if (NEW_SNR_THRESHOLD == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1482 , UWORD8 saic_flag
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1483 #endif/* NEW_SNR_THRESHOLD == 1*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1484 )
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1485 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1486
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1487 #if (CODE_VERSION == SIMULATION)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1488 UWORD32 tpu_w_page;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1489
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1490 if (hw.tpu_r_page==0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1491 tpu_w_page=1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1492 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1493 tpu_w_page=0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1494
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1495 // Give the Ts related to the L1s
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1496 hw.rx_id[tpu_w_page][0]= ((TPU_CLOCK_RANGE+new_offset-synchro_serv)%TPU_CLOCK_RANGE)/TN_WIDTH;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1497 hw.num_rx[tpu_w_page][0]=1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1498 hw.rx_group_id[tpu_w_page]=1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1499 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1500
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1501 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1502 if (!l1_config.agc_enable)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1503 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1504 // AGC gain can only be controlled in 2dB steps as the bottom bit (bit zero)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1505 // corresponds to the lna_off bit
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1506 agc = l1_config.tmode.rx_params.agc;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1507 lna_off = l1_config.tmode.rx_params.lna_off;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1508 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1509 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1510
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1511 l1dmacro_synchro (l1_config.params.rx_change_synchro_time, synchro_serv); // Adjust serving OFFSET.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1512
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1513 #if L2_L3_SIMUL
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1514 #if (DEBUG_TRACE == BUFFER_TRACE_OFFSET)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1515 buffer_trace(3, 0x43, synchro_serv,l1s.actual_time.fn,0);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1516 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1517 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1518
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1519 // Need to slide offset to cope with the new synchro.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1520 if(change_offset)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1521 l1dmacro_offset(new_offset, l1_config.params.rx_change_offset_time);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1522
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1523 l1dmacro_rx_synth(radio_freq); // load SYNTH.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1524 if(adc_active == ACTIVE)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1525 l1dmacro_adc_read_rx(); // pgme ADC measurement
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1526
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1527 l1dmacro_agc (radio_freq, agc, lna_off
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1528 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1529 ,if_ctl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1530 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1531 );
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1532
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1533 #if TESTMODE && (CODE_VERSION != SIMULATION)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1534 // Continuous mode: Rx continuous scenario only on START_RX state.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1535 if ((l1_config.TestMode) &&
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1536 (l1_config.tmode.rf_params.tmode_continuous == TM_START_RX_CONTINUOUS))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1537 #if (L1_MADC_ON == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1538 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1539 l1dmacro_rx_cont (FALSE, radio_freq,adc_active,csf_filter_choice
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1540 #if (NEW_SNR_THRESHOLD == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1541 ,saic_flag
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1542 #endif /* NEW_SNR_THRESHOLD*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1543 );
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1544 #endif /* RF_FAM == 61*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1545 #else /* L1_MADC_ON == 1 */
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1546 #if (RF_FAM == 61)
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1547 l1dmacro_rx_cont (FALSE, radio_freq,csf_filter_choice);
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1548 #else
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1549 l1dmacro_rx_cont (FALSE, radio_freq);
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1550 #endif
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1551 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1552 //TBD Danny New MAcro for Cont Tx reqd, to use only External Trigger
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1553 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1554 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1555 #if ( L1_MADC_ON == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1556 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1557 l1dmacro_rx_nb (radio_freq, adc_active, csf_filter_choice
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1558 #if (NEW_SNR_THRESHOLD == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1559 ,saic_flag
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1560 #endif /* NEW_SNR_THRESHOLD*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1561 ); // RX window for NB.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1562 #endif /* RF_FAM == 61*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1563 #else /* L1_MADC_ON == 1*/
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1564 #if (RF_FAM == 61)
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1565 l1dmacro_rx_nb (radio_freq, csf_filter_choice); // RX window for NB.
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1566 #else
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1567 l1dmacro_rx_nb (radio_freq); // RX window for NB.
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1568 #endif
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1569 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1570
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1571 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1572 l1ddsp_load_afc(l1s.afc);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1573 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1574 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1575 l1dtpu_load_afc(l1s.afc);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1576 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1577
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1578
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1579 if(change_offset)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1580 l1dmacro_offset(synchro_serv, IMM); // Restore offset.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1581 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1582
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1583 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1584 /* l1dtpu_serv_tx_nb() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1585 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1586 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1587 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1588 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1589 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1590 void l1dtpu_serv_tx_nb(UWORD16 radio_freq, UWORD8 timing_advance,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1591 UWORD32 offset_serv, UWORD8 txpwr, UWORD8 adc_active)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1592 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1593 WORD32 time;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1594 UWORD32 offset_tx;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1595 UWORD32 timing_advance_in_qbit = (UWORD32)timing_advance << 2;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1596
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1597 #if (CODE_VERSION == SIMULATION)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1598 UWORD32 tpu_w_page;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1599
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1600 if (hw.tpu_r_page==0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1601 tpu_w_page=1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1602 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1603 tpu_w_page=0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1604
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1605 hw.tx_id[tpu_w_page][0]=3;// MS synchronized on TN=0 for RX => TN=3 for TX
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1606 hw.num_tx[tpu_w_page][0]=1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1607 hw.tx_group_id[tpu_w_page]=1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1608 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1609
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1610 // Reset timing advance if TA_ALGO not enabled.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1611 #if !TA_ALGO
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1612 timing_advance_in_qbit = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1613 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1614
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1615 // Compute offset value for TX.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1616 // PRG_TX has become variable, no longer contained in TIME_OFFSET_TX !
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1617 offset_tx = (offset_serv + TIME_OFFSET_TX-l1_config.params.prg_tx_gsm - timing_advance_in_qbit) ;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1618 if (offset_tx >= TPU_CLOCK_RANGE) offset_tx -= TPU_CLOCK_RANGE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1619
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1620 // Check that RX controle has been already installed.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1621 // Offset for TX must be set an immediately if RX is there else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1622 // it must be performed EPSILON_SYNC before current offset time.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1623 if( l1s.tpu_ctrl_reg & CTRL_RX )
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1624 time = l1_config.params.tx_change_offset_time - l1_config.params.prg_tx_gsm;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1625 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1626 time = TPU_CLOCK_RANGE - EPSILON_SYNC;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1627
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1628 l1dmacro_offset (offset_tx, time); // load OFFSET for TX before each burst.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1629
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1630 #if L2_L3_SIMUL
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1631 #if (DEBUG_TRACE == BUFFER_TRACE_OFFSET)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1632 buffer_trace(2, offset_tx,l1s.actual_time.fn,0,0);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1633 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1634 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1635
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1636 l1dmacro_tx_synth(radio_freq); // load SYNTH.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1637 #if TESTMODE && (CODE_VERSION != SIMULATION)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1638 // Continuous mode: Tx continuous scenario only on START_TX state.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1639 #if (RF_FAM != 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1640 if ((l1_config.TestMode) &&
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1641 (l1_config.tmode.rf_params.tmode_continuous == TM_START_TX_CONTINUOUS))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1642 l1dmacro_tx_cont (radio_freq, txpwr); // TX window for NB.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1643 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1644 #endif // RF_FAM != 61
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1645 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1646 // NOTE: In Test Mode and in TX Continuous, APC control is in manual mode
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1647 // This is done in l1tm_async.c
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1648 if ((l1_config.TestMode) &&
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1649 (l1_config.tmode.rf_params.tmode_continuous == TM_START_TX_CONTINUOUS))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1650 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1651 // NOTE: APC is set in manual mode from l1tm_async.c
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1652 l1dmacro_tx_cont (radio_freq, txpwr); // TX window for NB.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1653 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1654 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1655 #endif // RF_FAM == 61
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1656 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1657 l1dmacro_tx_nb (radio_freq, txpwr, adc_active); // TX window for NB.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1658 // TX window for NB.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1659 l1dmacro_offset (offset_serv, IMM); // Restore offset with serving value.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1660
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1661 #if L2_L3_SIMUL
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1662 #if (DEBUG_TRACE == BUFFER_TRACE_OFFSET)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1663 buffer_trace(2, offset_serv,l1s.actual_time.fn,0,0);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1664 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1665 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1666 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1667
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1668 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1669 /* l1dtpu_neig_rx_nb() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1670 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1671 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1672 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1673 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1674 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1675 void l1dtpu_neig_rx_nb(UWORD16 radio_freq, WORD8 agc, UWORD8 lna_off,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1676 UWORD32 time_alignmt, UWORD32 offset_serv, UWORD8 reload_flag,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1677 UWORD8 nop
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1678 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1679 ,UWORD8 if_ctl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1680 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1681 #if (NEW_SNR_THRESHOLD == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1682 ,UWORD8 saic_flag
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1683 #endif /* NEW_SNR_THRESHOLD*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1684 )
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1685 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1686 UWORD32 offset_neigh;
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1687 #if (RF_FAM == 61)
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1688 // By default we choose the hardware filter for neighbour Normal Bursts
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1689 UWORD8 csf_filter_choice = L1_SAIC_HARDWARE_FILTER;
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1690 #endif
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1691
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1692 #if TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1693 if (!l1_config.agc_enable)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1694 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1695 // AGC gain can only be controlled in 2dB steps as the bottom bit (bit zero)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1696 // corresponds to the lna_off bit
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1697 agc = l1_config.tmode.rx_params.agc;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1698 lna_off = l1_config.tmode.rx_params.lna_off;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1699 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1700 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1701
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1702 // compute offset neighbour...
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1703 offset_neigh = (offset_serv + time_alignmt) ;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1704 if (offset_neigh >= TPU_CLOCK_RANGE) offset_neigh -= TPU_CLOCK_RANGE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1705
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1706 l1dmacro_offset (offset_neigh, l1_config.params.rx_change_offset_time); // load OFFSET with NEIGHBOUR value.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1707 // Insert 1 NOP to correct the EPSILON_SYNC side effect
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1708 if (nop ==1) l1dmacro_offset (offset_neigh,0);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1709
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1710
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1711 l1dmacro_rx_synth(radio_freq); // load SYNTH.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1712 l1dmacro_agc (radio_freq, agc, lna_off
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1713 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1714 ,if_ctl
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1715 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1716 );
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1717 #if (L1_MADC_ON == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1718 #if (RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1719 l1dmacro_rx_nb (radio_freq, INACTIVE, csf_filter_choice
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1720 #if (NEW_SNR_THRESHOLD == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1721 ,saic_flag
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1722 #endif /* NEW_SNR_THRESHOLD*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1723 ) ; // RX window for NB.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1724 #endif /* RF_FAM == 61*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1725 #else /* L1_MADC_ON == 1*/
95
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1726 #if (RF_FAM == 61)
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1727 l1dmacro_rx_nb (radio_freq, csf_filter_choice); // RX window for NB.
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1728 #else
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1729 l1dmacro_rx_nb (radio_freq); // RX window for NB.
6062d349e747 l1_drive.c: fixes from the freecalypso-sw/gsm-fw version
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 94
diff changeset
1730 #endif
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1731 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1732
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1733 // Restore offset with serving value.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1734 if(reload_flag == TRUE)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1735 l1dmacro_offset (offset_serv, IMM);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1736
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1737 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1738
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1739 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1740 /* l1dtpu_serv_tx_ra() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1741 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1742 /* Parameters : "burst_id" gives the burst identifier */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1743 /* which is used for offset management. */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1744 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1745 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1746 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1747 void l1dtpu_serv_tx_ra(UWORD16 radio_freq, UWORD32 offset_serv, UWORD8 txpwr, UWORD8 adc_active)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1748 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1749 WORD32 time;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1750 UWORD32 offset_tx;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1751
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1752 // Compute offset value for TX.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1753 // Rem: Timing Advance is always 0 for a RA.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1754 // PRG_TX has become variable, no longer contained in TIME_OFFSET_TX !
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1755 offset_tx = (offset_serv + TIME_OFFSET_TX-l1_config.params.prg_tx_gsm);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1756 if (offset_tx >= TPU_CLOCK_RANGE) offset_tx -= TPU_CLOCK_RANGE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1757
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1758 // Check that RX controle has been already installed.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1759 // Offset for TX must be set an immediately if RX is there else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1760 // it must be performed EPSILON_SYNC before current offset time.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1761 if( l1s.tpu_ctrl_reg & CTRL_RX )
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1762 time = l1_config.params.tx_change_offset_time - l1_config.params.prg_tx_gsm;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1763 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1764 time = TPU_CLOCK_RANGE - EPSILON_SYNC;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1765
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1766 l1dmacro_offset (offset_tx, time); // load OFFSET for TX before each burst.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1767 #if L2_L3_SIMUL
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1768 #if (DEBUG_TRACE == BUFFER_TRACE_OFFSET)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1769 buffer_trace(2, offset_tx,l1s.actual_time.fn,0,0);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1770 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1771 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1772 l1dmacro_tx_synth(radio_freq); // load SYNTH.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1773 l1dmacro_tx_ra (radio_freq, txpwr,adc_active); // TX window for RA.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1774 l1dmacro_offset (offset_serv, IMM); // Restore offset with serving value.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1775 #if L2_L3_SIMUL
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1776 #if (DEBUG_TRACE == BUFFER_TRACE_OFFSET)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1777 buffer_trace(2, offset_serv,l1s.actual_time.fn,0,0);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1778 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1779 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1780 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1781
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1782 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1783 /* l1dtpu_end_scenario() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1784 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1785 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1786 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1787 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1788 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1789 void l1dtpu_end_scenario(void)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1790 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1791
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1792 // write IDLE at end of TPU page
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1793 // TPU_ENB and TPU_PAG are set in L1DMACRO_IDLE(). The TPU change
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1794 // is executed by the TPU itself and the TPU pointer is reset to
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1795 // start of page by l1dmacro_idle();
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1796 l1dmacro_idle();
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1797
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1798 #if (CODE_VERSION == SIMULATION)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1799 #if LOGTPU_TRACE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1800 log_macro();
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1801 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1802 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1803 // init pointer within new TPU page at 1st line
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1804 #if (CODE_VERSION == SIMULATION)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1805 // set TPU_ENB, TPU_PAG for communication interrupt
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1806 l1s_tpu_com.reg_cmd->tpu_pag_bit = l1s_tpu_com.tpu_w_page;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1807 l1s_tpu_com.reg_cmd->tpu_enb_bit = ON;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1808
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1809 // change TPU and DSP page pointer for next control
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1810 l1s_tpu_com.tpu_w_page ^= 1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1811
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1812 // points on new "write TPU page"...
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1813 l1s_tpu_com.tpu_page_ptr=&(tpu.buf[l1s_tpu_com.tpu_w_page].line[0]);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1814
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1815 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1816
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1817 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1818
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1819 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1820 /* l1d_reset_hw() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1821 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1822 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1823 /* Return : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1824 /* Functionality : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1825 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1826 void l1d_reset_hw(UWORD32 offset_value)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1827 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1828 #if (CODE_VERSION == SIMULATION)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1829 // Reset DSP write/read page, Reset TPU write page, reset "used" flag.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1830 l1s_dsp_com.dsp_w_page = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1831 l1s_dsp_com.dsp_r_page = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1832 l1s_tpu_com.tpu_w_page = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1833 l1s_dsp_com.dsp_r_page_used = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1834
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1835 // Reset communication pointers.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1836 l1s_dsp_com.dsp_ndb_ptr = &(buf.ndb); // MCU<->DSP comm. read/write (Non Double Buffered comm. memory).
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1837 l1s_dsp_com.dsp_db_r_ptr = &(buf.mcu_rd[l1s_dsp_com.dsp_r_page]); // MCU<->DSP comm. read page (Double Buffered comm. memory).
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1838 l1s_dsp_com.dsp_db_w_ptr = &(buf.mcu_wr[l1s_dsp_com.dsp_w_page]); // MCU<->DSP comm. write page (Double Buffered comm. memory).
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1839
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1840 // Reset task commands.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1841 l1s_dsp_com.dsp_db_w_ptr->d_task_d = NO_DSP_TASK; // Init. RX task to NO TASK.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1842 l1s_dsp_com.dsp_db_w_ptr->d_task_u = NO_DSP_TASK; // Init. TX task to NO TASK.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1843 l1s_dsp_com.dsp_db_w_ptr->d_task_ra = NO_DSP_TASK; // Init. RA task to NO TASK.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1844 l1s_dsp_com.dsp_db_w_ptr->d_task_md = NO_DSP_TASK; // Init. MONITORING task to NO TASK.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1845
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1846
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1847 //Reset the TCH channel description
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1848 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_tch = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1849
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1850 #if (L1_GPRS)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1851 // Reset communication pointers.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1852 l1ps_dsp_com.pdsp_db_r_ptr = &(buf.mcu_rd_gprs[l1s_dsp_com.dsp_r_page]);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1853 l1ps_dsp_com.pdsp_db_w_ptr = &(buf.mcu_wr_gprs[l1s_dsp_com.dsp_w_page]);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1854
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1855 // Reset MCU->DSP page.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1856 l1ps_reset_db_mcu_to_dsp(l1ps_dsp_com.pdsp_db_w_ptr);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1857 #endif // L1_GPRS
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1858
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1859 // Direct access to TPU_RESET_BIT.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1860 l1s_tpu_com.reg_cmd->tpu_reset_bit = ON; // Reset TPU.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1861
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1862 // Reset TPU_ENB, DSP_ENB and TPU_PAG, DSP_PAG for communication interrupt
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1863 l1s_tpu_com.reg_cmd->tpu_pag_bit = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1864 l1s_tpu_com.reg_cmd->dsp_pag_bit = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1865 l1s_tpu_com.reg_cmd->tpu_enb_bit = OFF;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1866 l1s_tpu_com.reg_cmd->dsp_enb_bit = OFF;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1867
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1868 // Init pointer within TPU page 0 at 1st line
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1869 l1s_tpu_com.tpu_page_ptr = &(tpu.buf[0].line[0]);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1870
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1871 // Load offset register according to serving cell.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1872 l1dmacro_offset(offset_value, IMM);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1873
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1874 #else // NOT_SIMULATION
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1875
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1876 // Reset DSP write/read page, Reset TPU write page, reset "used" flag.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1877 l1s_dsp_com.dsp_w_page = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1878 l1s_dsp_com.dsp_r_page = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1879 l1s_tpu_com.tpu_w_page = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1880 l1s_dsp_com.dsp_r_page_used = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1881
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1882 // Reset communication pointers.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1883 l1s_dsp_com.dsp_ndb_ptr = (T_NDB_MCU_DSP *) NDB_ADR; // MCU<->DSP comm. read/write (Non Double Buffered comm. memory).
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1884 l1s_dsp_com.dsp_db_r_ptr = (T_DB_DSP_TO_MCU *) DB_R_PAGE_0; // MCU<->DSP comm. read page (Double Buffered comm. memory).
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1885 l1s_dsp_com.dsp_db_w_ptr = (T_DB_MCU_TO_DSP *) DB_W_PAGE_0; // MCU<->DSP comm. write page (Double Buffered comm. memory).
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1886 l1s_dsp_com.dsp_param_ptr= (T_PARAM_MCU_DSP *) PARAM_ADR;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1887
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1888 #if (DSP == 38) || (DSP == 39)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1889 l1s_dsp_com.dsp_db_common_w_ptr = (T_DB_COMMON_MCU_TO_DSP *) DB_COMMON_W_PAGE_0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1890 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1891
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1892 // Reset task commands.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1893 l1s_dsp_com.dsp_db_w_ptr->d_task_d = NO_DSP_TASK; // Init. RX task to NO TASK.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1894 l1s_dsp_com.dsp_db_w_ptr->d_task_u = NO_DSP_TASK; // Init. TX task to NO TASK.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1895 l1s_dsp_com.dsp_db_w_ptr->d_task_ra = NO_DSP_TASK; // Init. RA task to NO TASK.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1896 l1s_dsp_com.dsp_db_w_ptr->d_task_md = NO_DSP_TASK; // Init. MONITORING task to NO TASK.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1897
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1898 //Reset the TCH channel description
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1899 l1s_dsp_com.dsp_db_w_ptr->d_ctrl_tch = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1900
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1901 // Clear DSP_PAG bit
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1902 #if (DSP == 33) || (DSP == 34) || (DSP == 35) || (DSP == 36) || (DSP == 37) || (DSP == 38) || (DSP == 39)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1903 l1s_dsp_com.dsp_ndb_ptr->d_dsp_page = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1904 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1905 l1s_dsp_com.dsp_param_ptr->d_dsp_page = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1906 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1907
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1908 #if (L1_GPRS)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1909 // Reset communication pointers.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1910 l1ps_dsp_com.pdsp_ndb_ptr = (T_NDB_MCU_DSP_GPRS *) NDB_ADR_GPRS;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1911 l1ps_dsp_com.pdsp_db_r_ptr = (T_DB_DSP_TO_MCU_GPRS *) DB_R_PAGE_0_GPRS;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1912 l1ps_dsp_com.pdsp_db_w_ptr = (T_DB_MCU_TO_DSP_GPRS *) DB_W_PAGE_0_GPRS;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1913 l1ps_dsp_com.pdsp_param_ptr= (T_PARAM_MCU_DSP_GPRS *) PARAM_ADR_GPRS;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1914
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1915 // Reset MCU->DSP page.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1916 l1ps_reset_db_mcu_to_dsp(l1ps_dsp_com.pdsp_db_w_ptr);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1917 #endif // L1_GPRS
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1918
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1919 #if (DSP_DEBUG_TRACE_ENABLE == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1920 l1s_dsp_com.dsp_db2_current_r_ptr = (T_DB2_DSP_TO_MCU *) DB2_R_PAGE_0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1921 l1s_dsp_com.dsp_db2_other_r_ptr = (T_DB2_DSP_TO_MCU *) DB2_R_PAGE_1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1922 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1923
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1924 // Reset TPU and Reload offset register with Serving value.
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1925 // Clear TPU_PAG
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1926 l1dmacro_reset_hw(offset_value);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1927 #endif // NOT_SIMULATION
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1928 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1929
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1930
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1931 #if(RF_FAM == 61)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1932
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1933 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1934 /* l1apc_init_ramp_tables() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1935 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1936 /* Parameters : void */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1937 /* Return : void */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1938 /* Functionality : This would copy the Ramp table */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1939 /* values to the MCU DSP API */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1940 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1941 void l1dapc_init_ramp_tables(void)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1942 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1943
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1944 #if (CODE_VERSION == SIMULATION)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1945 // Do Nothing there is no APC task
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1946 #else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1947 #if ( DSP == 38) || (DSP == 39)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1948 // Load RAMP up/down in NDB memory...
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1949 if (l1_config.tx_pwr_code == 0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1950 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1951 Cust_get_ramp_tab( l1s_dsp_com.dsp_ndb_ptr->a_drp_ramp,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1952 0 /* not used */,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1953 0 /* not used */,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1954 1 /* arbitrary value for arfcn*/);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1955
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1956 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1957 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1958 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1959 Cust_get_ramp_tab( l1s_dsp_com.dsp_ndb_ptr->a_drp_ramp,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1960 5 /* arbitrary value working in any case */,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1961 5 /* arbitrary value working in any case */,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1962 1 /* arbitrary value for arfcn*/);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1963 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1964 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1965 // Is it required to load ramptables for GPRS a_drp2_ramp_gprs
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1966
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1967 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1968
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1969 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1970
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1971
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1972
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1973 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1974 /* l1ddsp_apc_load_apcctrl2 */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1975 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1976 /* Parameters : void */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1977 /* Return : void */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1978 /* Functionality : This would copy the Ramp table */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1979 /* values to the MCU DSP API */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1980 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1981 void l1ddsp_apc_load_apcctrl2(UWORD16 apcctrl2)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1982 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1983 l1s_dsp_com.dsp_ndb_ptr->d_apcctrl2 = ((apcctrl2) | (0x8000));
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1984 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1985
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1986 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1987 /* l1ddsp_apc_set_manual_mode */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1988 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1989 /* Parameters : void */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1990 /* Return : void */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1991 /* Functionality : This would set the APC in manual */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1992 /* OR external trigger mode */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1993 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1994 void l1ddsp_apc_set_manual_mode(void)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1995 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1996 l1s_dsp_com.dsp_ndb_ptr->d_apcctrl2 |= ((APC_APC_MODE) | (0x8000));
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1997 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1998
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
1999 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2000 /* l1ddsp_apc_set_automatic_mode */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2001 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2002 /* Parameters : void */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2003 /* Return : void */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2004 /* Functionality : This would set APC in automatic */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2005 /* OR internal sequencer mode */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2006 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2007 void l1ddsp_apc_set_automatic_mode(void)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2008 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2009 l1s_dsp_com.dsp_ndb_ptr->d_apcctrl2 &= ~(APC_APC_MODE);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2010 l1s_dsp_com.dsp_ndb_ptr->d_apcctrl2 |= (0x8000);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2011 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2012
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2013 #ifdef TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2014
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2015 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2016 /* l1ddsp_apc_load_apclev */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2017 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2018 /* Parameters : void */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2019 /* Return : void */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2020 /* Functionality : This function writes the apclev */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2021 /* val into the APCLEV register via DSP */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2022 /* NOTE: Used only in TESTMODE and only when */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2023 /* l1_config.tmode.rf_params.down_up == TMODE_UPLINK; */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2024 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2025 void l1ddsp_apc_load_apclev(UWORD16 apclev)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2026 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2027 l1s_dsp_com.dsp_ndb_ptr->d_apclev = ((apclev) | (0x8000));
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2028 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2029
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2030
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2031 #endif // TESTMODE
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2032
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2033 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2034 #if FF_L1_IT_DSP_DTX
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2035 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2036 /* l1ddsp_dtx_interrupt_pending() */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2037 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2038 /* Parameters : */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2039 /* Return : DTX interrupt status */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2040 /* Functionality : Test and clear the DTX IT pending */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2041 /* flag for DSP ISR screening purpose */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2042 /*-------------------------------------------------------*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2043 BOOL l1ddsp_dtx_interrupt_pending(void)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2044 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2045 if (l1s_dsp_com.dsp_ndb_ptr->d_dsp_hint_flag & (2 << B_DTX_HINT_ISSUED))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2046 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2047 // Flag HISR to be scheduled
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2048 l1a_apihisr_com.dtx.pending = TRUE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2049 // Clear API ISR condition
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2050 l1s_dsp_com.dsp_ndb_ptr->d_dsp_hint_flag &= ~(2 << B_DTX_HINT_ISSUED);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2051 return TRUE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2052 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2053 else
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2054 return FALSE;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2055 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2056 #endif
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2057
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2058
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2059 #define L1_DEBUG_IQ_DUMP 0
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2060
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2061 #if (L1_DEBUG_IQ_DUMP == 1)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2062
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2063 #define IQ_DUMP_MAX_LOG_SIZE (400) /* i.e. 200 I-Q Sample Pair */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2064 #define IQ_DUMP_BUFFER_SIZE (1280)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2065 #define L1_DSP_DUMP_IQ_BUFFER_PAGE0 (0xFFD00000 + ((0x2000 - 0x800)*2))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2066 #define L1_DSP_DUMP_IQ_BUFFER_PAGE1 (0xFFD00000 + ((0x2190 - 0x800)*2))
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2067
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2068 typedef struct
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2069 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2070 UWORD8 task;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2071 UWORD8 hole;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2072 UWORD16 size;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2073 UWORD16 fn_mod42432;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2074 UWORD16 iq_sample[IQ_DUMP_MAX_LOG_SIZE];
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2075 }T_IQ_LOG_BUFFER;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2076
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2077 #pragma DATA_SECTION(iq_dump_buffer,".debug_data");
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2078 T_IQ_LOG_BUFFER iq_dump_buffer[IQ_DUMP_BUFFER_SIZE];
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2079
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2080 UWORD32 iq_dump_buffer_log_index = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2081 UWORD32 iq_overflow_ind=0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2082
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2083 void l1ddsp_read_iq_dump(UWORD8 task)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2084 {
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2085 UWORD16 *p_dsp_iq_buffer_ptr;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2086 UWORD16 size;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2087 int i;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2088
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2089 /* get the page logic*/
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2090 p_dsp_iq_buffer_ptr = (UWORD16 *)(L1_DSP_DUMP_IQ_BUFFER_PAGE0);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2091 if(l1s_dsp_com.dsp_r_page){
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2092 p_dsp_iq_buffer_ptr = (UWORD16 *)(L1_DSP_DUMP_IQ_BUFFER_PAGE1);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2093 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2094
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2095 /* */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2096 size = *p_dsp_iq_buffer_ptr;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2097
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2098 if(size == 0)
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2099 return;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2100
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2101 /* size given by DSP is in units of I-Q sample pair */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2102 if(size > (IQ_DUMP_MAX_LOG_SIZE /2)){
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2103 size = (IQ_DUMP_MAX_LOG_SIZE/2);
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2104 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2105
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2106 /* make size as zero again */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2107 *p_dsp_iq_buffer_ptr++ = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2108
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2109 if(iq_dump_buffer_log_index >= IQ_DUMP_BUFFER_SIZE){
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2110 iq_overflow_ind=1;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2111 iq_dump_buffer_log_index = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2112 }
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2113
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2114 iq_dump_buffer[iq_dump_buffer_log_index].task = task;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2115 iq_dump_buffer[iq_dump_buffer_log_index].hole = 0;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2116 iq_dump_buffer[iq_dump_buffer_log_index].size = size;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2117 iq_dump_buffer[iq_dump_buffer_log_index].fn_mod42432 = l1s.actual_time.fn_mod42432;
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2118
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2119 memcpy(&iq_dump_buffer[iq_dump_buffer_log_index].iq_sample[0],
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2120 p_dsp_iq_buffer_ptr,
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2121 size*2*2); /* size * 2 (as size is in IQsample pair) * 2 (to convert to bytes) */
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2122
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2123 iq_dump_buffer_log_index = iq_dump_buffer_log_index + 1;
99
3d214116a5ba l1_drive.c: matches TCS211 object after removing l1ddsp_read_iq_dump()
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 98
diff changeset
2124 }
94
9348cbd02cab l1_drive.c: initial import of LoCosto source
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 15
diff changeset
2125 #endif