annotate chipsetsw/layer1/tm_cfile/l1tm_async.c @ 348:bc7ca94e52e7

STATUS: l1p_driv.obj reconstruction is now perfect
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 30 Oct 2017 17:27:58 +0000
parents a4899cf67fd1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
214
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1 /************* Revision Controle System Header *************
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2 * GSM Layer 1 software
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
3 * L1TM_ASYNC.C
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
4 *
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
5 * Filename l1tm_async.c
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
6 * Copyright 2003 (C) Texas Instruments
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
7 *
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
8 ************* Revision Controle System Header *************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
9
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
10 #include "l1_macro.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
11 #include "l1_confg.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
12
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
13 #if TESTMODE
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
14 #define L1TM_ASYNC_C
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
15
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
16 #include <string.h>
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
17 #include <stdlib.h>
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
18 #include "l1_types.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
19 #include "sys_types.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
20 #include "l1_const.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
21 #include "l1_time.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
22 #include "l1_signa.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
23 #include "cust_os.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
24
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
25 #include "l1tm_defty.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
26
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
27 #if (AUDIO_TASK == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
28 #include "l1audio_const.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
29 #include "l1audio_cust.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
30 #include "l1audio_defty.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
31 #include "l1audio_signa.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
32 #include "l1audio_proto.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
33 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
34
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
35 #if (L1_GTT == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
36 #include "l1gtt_const.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
37 #include "l1gtt_defty.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
38 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
39
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
40 #if (L1_MP3 == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
41 #include "l1mp3_defty.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
42 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
43
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
44 #if (L1_MIDI == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
45 #include "l1midi_defty.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
46 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
47
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
48 #include "l1_defty.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
49 #include "l1_msgty.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
50 #include "l1_varex.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
51 #include "l1_proto.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
52
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
53 #include "l1tm_msgty.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
54 #include "l1tm_signa.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
55 #include "l1tm_varex.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
56
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
57 #if (L1_STEREOPATH == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
58 #include "sys_dma.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
59 #include "l1audio_stereo.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
60 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
61
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
62 #if L1_GPRS
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
63 #include "l1p_cons.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
64 #include "l1p_msgt.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
65 #include "l1p_deft.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
66 #include "l1p_vare.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
67 #include "l1p_sign.h"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
68 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
69
215
fd96174924df l1tm_async.c passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents: 214
diff changeset
70 /* FreeCalypso TCS211 reconstruction */
fd96174924df l1tm_async.c passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents: 214
diff changeset
71 #define ETM_PROTOCOL 0
fd96174924df l1tm_async.c passes compilation
Mychaela Falconia <falcon@freecalypso.org>
parents: 214
diff changeset
72 #define ETM_MODE 0
214
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
73
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
74 //------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
75 // Prototypes from external functions
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
76 //------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
77 #if (OP_L1_STANDALONE == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
78 void etm_core(xSignalHeaderRec *msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
79 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
80
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
81 void Cust_tm_init(void);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
82
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
83 void l1tm_stats_fb_confirm (T_TMODE_FB_CON *prim, WORD32 test);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
84 void l1tm_stats_sb_confirm (T_TMODE_NCELL_SYNC_IND *prim, WORD32 test);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
85 void l1tm_stats_bcch_confirm (T_TMODE_BCCHS_CON *prim);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
86 void l1tm_stats_tch_confirm (T_TMODE_TCH_INFO *prim);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
87 void l1tm_stats_mon_confirm (T_TMODE_FB_CON *prim);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
88 void l1tm_stats_full_list_meas_confirm(T_TMODE_RXLEV_REQ *prim);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
89 BOOL l1tm_is_rx_counter_done (void);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
90 void l1tm_reset_rx_state (void);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
91
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
92 void l1tm_rf_param_write (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
93 void l1tm_rf_param_read (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
94 void l1tm_rf_table_write (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
95 void l1tm_rf_table_read (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
96 void l1tm_rx_param_write (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
97 void l1tm_rx_param_read (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
98 void l1tm_tx_param_write (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
99 void l1tm_tx_param_read (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
100 void l1tm_tx_template_write (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
101 void l1tm_tx_template_read (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
102
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
103 void l1tm_special_param_write (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
104 void l1tm_special_param_read (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
105 void l1tm_special_table_write (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
106 void l1tm_special_table_read (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
107 void l1tm_special_enable (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
108 void l1tm_rf_enable (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
109 void l1tm_stats_config_write (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
110 void l1tm_stats_config_read (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
111 void l1tm_statistics (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
112 void l1tm_stats_read (T_TM_RETURN *tm_return, WORD16 type, UWORD16 bitmask);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
113 #if (L1_DRP == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
114 void l1tm_drp_sw_write(T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
115 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
116
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
117
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
118 void l1a_tmode_send_ul_msg (T_TM_RETURN *tm_ret);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
119 UWORD16 l1tm_convert_arfcn2l1ch(UWORD16 arfcn, UWORD8 *error_flag);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
120 void l1tm_fill_burst (UWORD16 pattern, UWORD16 *TM_ul_data);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
121 void l1tm_initialize_var (void);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
122 UWORD16 Convert_l1_radio_freq (SYS_UWORD16 radio_freq);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
123
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
124 void tm_transmit(T_TM_RETURN *tm_ret);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
125
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
126 #if (CODE_VERSION != SIMULATION)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
127 void l1tm_tpu_table_write (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
128 void l1tm_tpu_table_read (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
129 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
130
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
131 #if L1_GPRS
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
132 T_TRANSFER_SET *l1pa_get_free_transfer_set (UWORD8 new_tbf);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
133 T_CRES_LIST_PARAM *l1pa_get_free_cres_list_set(void);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
134 void l1tm_stats_pdtch_confirm (T_TMODE_PDTCH_INFO *prim);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
135 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
136
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
137
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
138 #if (L1_TPU_DEV == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
139 void l1tm_flexi_tpu_table_read(T_TESTMODE_PRIM * prim, T_TM_RETURN * tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
140 void l1tm_flexi_tpu_table_write(T_TESTMODE_PRIM * prim, T_TM_RETURN * tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
141
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
142 //Flexi ABB Delay
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
143 void l1tm_flexi_abb_read(T_TESTMODE_PRIM * prim, T_TM_RETURN * tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
144 void l1tm_flexi_abb_write(T_TESTMODE_PRIM * prim, T_TM_RETURN * tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
145 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
146
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
147 // DRP Calibration
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
148 void l1tm_drp_calib_read(T_TESTMODE_PRIM * prim, T_TM_RETURN * tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
149 void l1tm_drp_calib_write(T_TESTMODE_PRIM * prim, T_TM_RETURN * tm_return);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
150
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
151 // Prototypes from internal functions
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
152 //------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
153 void l1a_tmode_fb0_process(xSignalHeaderRec *msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
154 void l1a_tmode_fb1_process(xSignalHeaderRec *msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
155 void l1a_tmode_sb_process(xSignalHeaderRec *msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
156 void l1a_tmode_bcch_reading_process(xSignalHeaderRec *msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
157 void l1a_tmode_dedicated_process(xSignalHeaderRec *msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
158 void l1a_tmode_access_process(xSignalHeaderRec *msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
159 void l1a_tmode_full_list_meas_process(xSignalHeaderRec *msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
160
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
161 #if L1_GPRS
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
162 void l1a_tmode_transfer_process(xSignalHeaderRec *msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
163 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
164 #if ((L1_STEREOPATH == 1) && (OP_L1_STANDALONE == 1))
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
165 void l1a_tmode_audio_stereopath_process(xSignalHeaderRec *msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
166 extern void l1tm_stereopath_DMA_handler(SYS_UWORD16 dma_status);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
167 extern void l1tm_stereopath_fill_buffer(void* buffer_address);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
168 extern UWORD16 l1tm_stereopath_get_pattern(UWORD16 sampling_freq, UWORD16 sin_freq_left,UWORD16 sin_freq_right, UWORD8 data_type);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
169 extern void l1a_audio_send_confirmation(UWORD32 SignalCode);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
170 extern void l1_trigger_api_interrupt(void);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
171 #if ( ANLG_FAM == 11)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
172 //Add the two new sampling frequencies in the test mode for Locosto - 12khz and 24 khz
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
173 const UWORD16 l1tm_stereopath_sampling_freqs[9] = {8000,11025,12000,16000,22050,24000,32000,44100,48000};
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
174 #else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
175 const UWORD16 l1tm_stereopath_sampling_freqs[8] = {48000,0,44100,32000,22050,16000,11025,8000};
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
176 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
177 const UWORD16 l1tm_stereopath_sin_freqs[4][2] = {{0,0},
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
178 {100,1000},
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
179 {1000,10000},
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
180 {1000,1000}}; // 4 different pattern of two freqs
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
181 const UWORD16 l1tm_stereopath_buffer[(480+1)*2];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
182
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
183 T_STP_DRV_MCU_DSP *stp_drv_ndb = (T_STP_DRV_MCU_DSP *)API_address_dsp2mcu(C_STP_DRV_API_BASE_ADDRESS);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
184
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
185 #if (CODE_VERSION == NOT_SIMULATION)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
186 #pragma DATA_SECTION(TM_stereo_buf,".TM_stereo_buf");
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
187 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
188
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
189 #if (CHIPSET == 15)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
190 #pragma DATA_SECTION(TM_stereo_buf_ext_mem, ".TM_stereo_buf_ext_mem");
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
191 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
192 volatile WORD16 TM_stereo_buf[STEREOPATH_MAX_NB_OF_FRAMES*2];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
193 #if (CHIPSET == 15)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
194 volatile WORD16 TM_stereo_buf_ext_mem[STEREOPATH_MAX_NB_OF_FRAMES*2];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
195 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
196 #endif // ((L1_STEREOPATH == 1) && (OP_L1_STANDALONE == 1))
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
197
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
198 /***********************************************************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
199 /* TESTMODE 3.X */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
200 /***********************************************************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
201
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
202 // omaps00090550 static UWORD8 tx_param_band=0; // used in tx_param_write/read; default is GSM900
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
203 /*-----------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
204 /* l1a_tmode() */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
205 /*-----------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
206 /* Description : State machine controls TestMode processes */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
207 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
208 /* Starting messages: TMODE_BCCH_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
209 /* TMODE_PM_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
210 /* TMODE_FB0_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
211 /* TMODE_FB1_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
212 /* TMODE_SB_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
213 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
214 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
215 /* Result messages (input): L1_TMODE_MEAS_REPORT */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
216 /* L1_SB_INFO */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
217 /* L1_BCCHS_INFO */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
218 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
219 /* Result messages (output): TMODE_PM_CON */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
220 /* MPH5_NCELL_SB_IND */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
221 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
222 /* Reset messages (input): MPH5_STOP_BCCH_READING */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
223 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
224 /*-----------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
225 void l1a_tmode(xSignalHeaderRec *msg)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
226 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
227 T_TESTMODE_PRIM *prim;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
228 T_TM_RETURN tm_ret;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
229
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
230 int SignalCode = msg->SignalCode;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
231
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
232 #if (OP_WCP==1) && (OP_L1_STANDALONE!=1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
233 // Security check for Operating System platforms (open platforms)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
234 // We forbid TESTMODE if the phone is running with an OS
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
235 // so users can not invoke TESTMODE for malicious goals
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
236 extern unsigned long GC_RunningWithOs();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
237
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
238 if(GC_RunningWithOs())
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
239 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
240 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
241
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
242 if (SignalCode == TESTMODE_PRIM)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
243 {
217
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
244 // use CID to decide what to do
214
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
245 prim = (T_TESTMODE_PRIM *)(msg->SigP);
217
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
246
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
247 // fill in the cid also named fid in the ETM protocol
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
248 tm_ret.cid = prim->cid;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
249
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
250 switch (prim->cid)
214
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
251 {
218
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
252 case TM_INIT:
220
ea1020598734 l1tm_async.c: l1tm_initialize() call was reconstructed incorrectly
Mychaela Falconia <falcon@freecalypso.org>
parents: 219
diff changeset
253 l1tm_initialize(&tm_ret);
218
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
254 break;
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
255 case TM_MODE_SET:
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
256 l1tm_mode_set(prim, &tm_ret);
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
257 break;
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
258 case VERSION_GET:
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
259 l1tm_version_get(prim, &tm_ret);
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
260 break;
217
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
261 case RF_ENABLE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
262 l1tm_rf_enable(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
263 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
264 case STATS_READ:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
265 l1tm_statistics(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
266 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
267 case STATS_CONFIG_WRITE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
268 l1tm_stats_config_write(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
269 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
270 case STATS_CONFIG_READ:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
271 l1tm_stats_config_read(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
272 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
273 case RF_PARAM_WRITE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
274 l1tm_rf_param_write(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
275 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
276 case RF_PARAM_READ:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
277 l1tm_rf_param_read(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
278 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
279 case RF_TABLE_WRITE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
280 l1tm_rf_table_write(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
281 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
282 case RF_TABLE_READ:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
283 l1tm_rf_table_read(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
284 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
285 case RX_PARAM_WRITE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
286 l1tm_rx_param_write(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
287 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
288 case RX_PARAM_READ:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
289 l1tm_rx_param_read(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
290 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
291 case TX_PARAM_WRITE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
292 l1tm_tx_param_write(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
293 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
294 case TX_PARAM_READ:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
295 l1tm_tx_param_read(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
296 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
297 case TX_TEMPLATE_WRITE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
298 l1tm_tx_template_write(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
299 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
300 case TX_TEMPLATE_READ:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
301 l1tm_tx_template_read(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
302 break;
218
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
303 case MEM_WRITE:
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
304 l1tm_mem_write(prim, &tm_ret);
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
305 break;
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
306 case MEM_READ:
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
307 l1tm_mem_read(prim, &tm_ret);
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
308 break;
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
309 case CODEC_WRITE:
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
310 l1tm_codec_write(prim, &tm_ret);
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
311 break;
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
312 case CODEC_READ:
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
313 l1tm_codec_read(prim, &tm_ret);
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
314 break;
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
315 case MISC_PARAM_WRITE:
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
316 l1tm_misc_param_write(prim, &tm_ret);
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
317 break;
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
318 case MISC_PARAM_READ:
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
319 l1tm_misc_param_read(prim, &tm_ret);
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
320 break;
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
321 case MISC_ENABLE:
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
322 l1tm_misc_enable(prim, &tm_ret);
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
323 break;
217
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
324 case SPECIAL_PARAM_WRITE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
325 l1tm_special_param_write(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
326 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
327 case SPECIAL_PARAM_READ:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
328 l1tm_special_param_read(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
329 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
330 case SPECIAL_TABLE_WRITE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
331 l1tm_special_table_write(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
332 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
333 case SPECIAL_TABLE_READ:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
334 l1tm_special_table_read(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
335 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
336 case SPECIAL_ENABLE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
337 l1tm_special_enable(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
338 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
339 #if (L1_DRP == 1)
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
340 case DRP_SW_WRITE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
341 l1tm_drp_sw_write(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
342 break;
214
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
343 #endif
217
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
344 #if (CODE_VERSION != SIMULATION)
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
345 case TPU_TABLE_WRITE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
346 l1tm_tpu_table_write(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
347 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
348 case TPU_TABLE_READ:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
349 l1tm_tpu_table_read(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
350 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
351 #endif
218
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
352 case TM_FFS:
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
353 l1tm_ffs(prim, &tm_ret);
24f094deabe3 l1tm_async.c: l1a_tmode() reconstructed
Mychaela Falconia <falcon@freecalypso.org>
parents: 217
diff changeset
354 break;
217
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
355 #if(L1_TPU_DEV == 1)
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
356 case FLEXI_TPU_TABLE_WRITE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
357 l1tm_flexi_tpu_table_write(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
358 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
359 case FLEXI_TPU_TABLE_READ:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
360 l1tm_flexi_tpu_table_read(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
361 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
362 case FLEXI_ABB_WRITE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
363 l1tm_flexi_abb_write(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
364 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
365 case FLEXI_ABB_READ:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
366 l1tm_flexi_abb_read(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
367 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
368 #endif
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
369 #if 0 //(CODE_VERSION != SIMULATION) // FreeCalypso TCS211 reconstruction
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
370 case DRP_CALIB_WRITE:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
371 l1tm_drp_calib_write(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
372 break;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
373 case DRP_CALIB_READ:
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
374 l1tm_drp_calib_read(prim, &tm_ret);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
375 break; // TBD for Future Use
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
376 #endif // CODE_VERSION
214
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
377 default:
217
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
378 #if (OP_L1_STANDALONE == 1)
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
379 etm_core(msg);
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
380 return;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
381 #else
214
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
382 tm_ret.size = 0;
217
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
383 #if (ETM_PROTOCOL == 1)
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
384 tm_ret.status = -ETM_BADOP;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
385 #else
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
386 tm_ret.status = E_BADCID;
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
387 #endif
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
388 #endif // OP_L1_STANDALONE
214
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
389 break;
217
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
390 } // end of switch
aea3c2548676 l1tm_async.c: starting reconstruction
Mychaela Falconia <falcon@freecalypso.org>
parents: 215
diff changeset
391 tm_transmit(&tm_ret);
214
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
392 } //end of TESTMODE_PRIM
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
393 #if L1_GPRS
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
394 else if ( ((SignalCode <= TMODE_PDTCH_INFO) && (SignalCode >= TMODE_RXLEV_REQ)) || (l1tm.tm_msg_received == TRUE) )
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
395 #else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
396 else if ( ((SignalCode <= TMODE_TCH_INFO) && (SignalCode >= TMODE_RXLEV_REQ)) || (l1tm.tm_msg_received == TRUE) )
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
397 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
398 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
399 #if (CODE_VERSION == SIMULATION)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
400 static BOOL tm_init = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
401
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
402 if (! tm_init)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
403 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
404 Cust_tm_init();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
405 l1tm_initialize_var();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
406 l1_config.TestMode = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
407 tm_init=TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
408 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
409 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
410 l1a_tmode_fb0_process(msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
411 l1a_tmode_fb1_process(msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
412 l1a_tmode_sb_process(msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
413 l1a_tmode_bcch_reading_process(msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
414 l1a_tmode_dedicated_process(msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
415 l1a_tmode_access_process(msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
416 l1a_tmode_full_list_meas_process(msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
417 #if L1_GPRS
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
418 l1a_tmode_transfer_process(msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
419 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
420 #if ((L1_STEREOPATH == 1) && (OP_L1_STANDALONE == 1))
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
421 l1a_tmode_audio_stereopath_process(msg);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
422 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
423 } //end of not TESTMODE_PRIM
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
424 } // end of procedure.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
425
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
426
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
427 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
428 /* l1a_tmode_fb0_process() */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
429 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
430 /* Description : This state machine handles the 1st */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
431 /* synchronization with the network in Test Mode. */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
432 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
433 /* Starting messages: TMODE_FB0_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
434 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
435 /* Result messages (input): L1C_FB_INFO */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
436 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
437 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
438 void l1a_tmode_fb0_process(xSignalHeaderRec *msg)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
439 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
440 enum states
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
441 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
442 RESET = 0, // Reset state.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
443 WAIT_INIT = 1, // Initial state.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
444 SET_FS_FB_MODE0 = 2, // First Synchro, Setting of 1st FB mode 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
445 WAIT_FS_FB_MODE0 = 3 // First Synchro, 1st FB mode 0 state.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
446 };
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
447
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
448 UWORD8 *state = &l1a.state[TMODE_FB0];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
449 UWORD32 SignalCode = msg->SignalCode;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
450 BOOL done = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
451
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
452 #if (VCXO_ALGO == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
453 #define FS_FB_MODE0_CENTER 1
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
454 #define FS_FB_MODE0_MAX 2
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
455 #define FS_FB_MODE0_MIN 3
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
456
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
457 static WORD16 state_vcxo;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
458 static WORD16 static_attempt_counter;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
459 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
460
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
461 BOOL end_process = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
462
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
463 while(!end_process)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
464 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
465 switch(*state)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
466 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
467 case RESET:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
468 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
469 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
470 *state = WAIT_INIT;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
471
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
472 #if (VCXO_ALGO == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
473 if(l1_config.params.eeprom_afc == 0) {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
474 // Go to the initial VCXO AFC_INIT algorithm state
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
475 state_vcxo = FS_FB_MODE0_CENTER;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
476 static_attempt_counter = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
477 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
478 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
479
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
480 // Reset tasks used in the process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
481 l1a_l1s_com.l1s_en_task[FBNEW] = TASK_DISABLED; // in tmode, not ALR
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
482 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_DISABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
483
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
484 // Disable neighbour sync 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
485 l1a_l1s_com.nsync.list[0].status = NSYNC_FREE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
486
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
487 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
488 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
489
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
490 case WAIT_INIT:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
491 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
492 if (SignalCode == TMODE_FB0_REQ)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
493 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
494 #if (CODE_VERSION == SIMULATION)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
495 l1tm_reset_rx_state();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
496 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
497
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
498 // Flag msg received
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
499 l1tm.tm_msg_received = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
500
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
501 // Set task semaphores.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
502 l1a_l1s_com.task_param[FBNEW] = SEMAPHORE_SET; // Set "parameter synchro semaphore for FB task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
503 l1a_l1s_com.task_param[NSYNC] = SEMAPHORE_SET; // Set "parameter synchro semaphore for FB task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
504
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
505 l1a_l1s_com.nsync.current_list_size = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
506
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
507 // Downlink stuff timeslot is 0 (default in CS)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
508 l1a_l1s_com.dl_tn = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
509
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
510 // Set arfcn
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
511 l1a_l1s_com.nsync.list[0].radio_freq =l1_config.tmode.rf_params.bcch_arfcn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
512
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
513 //Set timing validity for FB no a priori info
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
514 l1a_l1s_com.nsync.list[0].timing_validity = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
515
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
516 // Reset offset and time alignment
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
517 l1a_l1s_com.nsync.list[0].fn_offset = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
518 l1a_l1s_com.nsync.list[0].time_alignmt = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
519
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
520 // Set functional mode.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
521 l1a_l1s_com.mode = CS_MODE; //Needs to be set for l1ddsp_load_monit_task()
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
522
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
523 // Wideband search for FB detection.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
524 l1a_l1s_com.fb_mode = FB_MODE_0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
525
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
526 // Enable SYNCHRO task to cleanup the MFTAB.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
527 l1a_l1s_com.l1s_en_task[SYNCHRO] = TASK_ENABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
528
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
529 // Initialize AFC control function.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
530 #if AFC_ALGO
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
531 if (l1_config.afc_enable) { // l1_config.TestMode MUST == 1
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
532 #if (VCXO_ALGO == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
533 // The TM rfpw 10 parameter has a different meaning when using
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
534 // a VCXO. Instead of containing the AFC used for the FB0, which
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
535 // is stored in the rftw 9 table now, it tells the TM which "state" must
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
536 // be used for the VCXO algorithm
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
537 //
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
538 switch(l1_config.params.eeprom_afc) {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
539 case 0: // Full VCXO algo
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
540 // The AFC_INIT state is controlled by the state machine
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
541 // Reset attempt counter
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
542 static_attempt_counter = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
543 state_vcxo = FS_FB_MODE0_CENTER;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
544 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
545 case FS_FB_MODE0_CENTER * 8:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
546 state_vcxo = FS_FB_MODE0_CENTER;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
547 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
548 case FS_FB_MODE0_MIN * 8:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
549 state_vcxo = FS_FB_MODE0_MIN;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
550 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
551 case FS_FB_MODE0_MAX * 8:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
552 state_vcxo = FS_FB_MODE0_MAX;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
553 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
554 default:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
555 state_vcxo = FS_FB_MODE0_CENTER;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
556 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
557 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
558 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
559 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
560
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
561 // Step in state machine
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
562 *state = SET_FS_FB_MODE0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
563 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
564 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
565 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
566 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
567 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
568 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
569 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
570 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
571
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
572 case SET_FS_FB_MODE0:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
573 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
574 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
575 *state = WAIT_FS_FB_MODE0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
576
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
577 // Enable neighbour sync 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
578 l1a_l1s_com.nsync.list[0].status = NSYNC_PENDING; //Used by l1s_schedule_tasks in l1_sync
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
579
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
580 // Enable NSYNC task for FB detection mode 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
581 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_ENABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
582 if (l1_config.afc_enable) {// l1_config.TestMode MUST == 1
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
583 #if (VCXO_ALGO == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
584 switch(state_vcxo) {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
585 case FS_FB_MODE0_CENTER:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
586 l1s.afc = l1ctl_afc(AFC_INIT_CENTER, &l1s.afc_frame_count, NULL, 0, l1a_l1s_com.nsync.list[0].radio_freq,l1a_l1s_com.mode);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
587 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
588 case FS_FB_MODE0_MIN:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
589 l1s.afc = l1ctl_afc(AFC_INIT_MIN, &l1s.afc_frame_count, NULL, 0, l1a_l1s_com.nsync.list[0].radio_freq,l1a_l1s_com.mode);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
590 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
591 case FS_FB_MODE0_MAX:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
592 l1s.afc = l1ctl_afc(AFC_INIT_MAX, &l1s.afc_frame_count, NULL, 0, l1a_l1s_com.nsync.list[0].radio_freq,l1a_l1s_com.mode);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
593 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
594 default:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
595 l1s.afc = l1ctl_afc(AFC_INIT_CENTER, &l1s.afc_frame_count, NULL, 0, l1a_l1s_com.nsync.list[0].radio_freq,l1a_l1s_com.mode);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
596 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
597 #else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
598 l1s.afc = l1ctl_afc(AFC_INIT, &l1s.afc_frame_count, l1_config.params.eeprom_afc, 0, l1a_l1s_com.nsync.list[0].radio_freq);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
599 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
600 } // (l1_config.afc_enable) is TRUE
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
601
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
602 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
603 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
604 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
605 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
606
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
607 case WAIT_FS_FB_MODE0:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
608 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
609 if(SignalCode == L1C_FB_INFO)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
610 // Frequency Burst acquisition result.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
611 //------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
612 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
613 BOOL fb_found = ((T_L1C_FB_INFO *) (msg->SigP))->fb_flag;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
614
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
615 if (fb_found)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
616 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
617 // We consider the result of this successfull FB search attempt
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
618 // as a good a-priori information for next attempt.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
619 // "fn_offset" is reversed to satisfy its definition,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
620 // fn_offset = Fn_neigh - Fn_serving.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
621 l1a_l1s_com.nsync.list[0].timing_validity = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
622 l1a_l1s_com.nsync.list[0].fn_offset = 51 - l1a_l1s_com.nsync.list[0].fn_offset;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
623 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
624 #if (VCXO_ALGO == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
625 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
626 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
627 if(l1_config.params.eeprom_afc == 0)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
628 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
629 //- Full VCXO algo
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
630
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
631 // Increment "static_attempt_counter".
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
632 static_attempt_counter++;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
633 if(static_attempt_counter < 4)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
634 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
635 // Max number of attemps not reached yet...
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
636 // try again with the same VCXO state
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
637 *state = SET_FS_FB_MODE0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
638 // Do not accumulate the statistics yet, just try again
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
639 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
640 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
641 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
642 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
643 // Max number of attempt is reached... go back to 1st FB mode 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
644 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
645 static_attempt_counter = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
646
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
647 // Go to the next FS_FB_MODE0_CENTER state (CENTER -> MAX -> MIN)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
648 // After MIN go to CENTER again, which means that the attempt failed
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
649 switch(state_vcxo)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
650 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
651 case FS_FB_MODE0_CENTER:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
652 state_vcxo = FS_FB_MODE0_MAX;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
653 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
654 case FS_FB_MODE0_MAX:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
655 state_vcxo = FS_FB_MODE0_MIN;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
656 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
657 default: // i.e. case FS_FB_MODE0_MAX:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
658 // The algorithm tried all the AFC_INIT values (CENTER, MAX & MIN)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
659 // but did not detect an FB in any of the attemps for these values:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
660 // The current attempt FAILED => Continue and accumulate the statistics
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
661 state_vcxo = FS_FB_MODE0_CENTER;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
662 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
663 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
664
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
665 if (state_vcxo != FS_FB_MODE0_CENTER)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
666 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
667 *state = SET_FS_FB_MODE0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
668 // Do not accumulate the statistics yet, just try again with the new
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
669 // selected state_vcxo
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
670 break; // This breaks from the switch(*state), and thus re-loops thanks to the while(!end_process)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
671 } // (state_vcxo != FS_FB_MODE0_CENTER)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
672 } // (static_attempt_counter >= 4)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
673 } // (l1_config.params.eeprom_afc != 0)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
674 } // (fb_found) is FALSE
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
675 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
676
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
677 #if (VCXO_ALGO == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
678 if(l1_config.params.eeprom_afc == 0)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
679 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
680 // If we got this far, the attempt ended (with a fail or a success)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
681 // So we can go back to the initial state
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
682 state_vcxo = FS_FB_MODE0_CENTER;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
683 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
684 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
685
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
686 //accumulate FB stats
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
687 l1tm_stats_fb_confirm( (T_TMODE_FB_CON*) ((T_L1C_FB_INFO *) (msg->SigP)), 0);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
688
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
689 done = l1tm_is_rx_counter_done();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
690 if (done == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
691 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
692 // Loop counter expired, stop the test
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
693 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
694
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
695 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
696 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
697 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
698 break; // break out of switch
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
699 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
700 *state = SET_FS_FB_MODE0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
701 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
702 else if (SignalCode == TMODE_STOP_RX_TX)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
703 // Stop SYNC mode message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
704 //--------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
705 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
706 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
707 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
708 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
709
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
710 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
711 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
712
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
713 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
714 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
715 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
716 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
717 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
718 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
719 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
720 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
721 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
722 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
723 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
724 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
725
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
726
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
727 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
728 /* l1a_tmode_fb1_process() */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
729 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
730 /* Description : This state machine handles the 1st */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
731 /* synchronization with the network in Test Mode. */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
732 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
733 /* Starting messages: TMODE_FB1_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
734 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
735 /* Result messages (input): L1C_FB_INFO */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
736 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
737 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
738 void l1a_tmode_fb1_process(xSignalHeaderRec *msg)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
739 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
740 enum states
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
741 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
742 RESET = 0, // Reset state.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
743 WAIT_INIT = 1, // Initial state.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
744 SET_FS_FB_MODE1 = 2, // First Synchro, Setting of 1st FB mode 1.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
745 WAIT_FS_FB_MODE1 = 3 // First Synchro, FB mode 1 state.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
746 };
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
747
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
748 UWORD8 *state = &l1a.state[TMODE_FB1];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
749 UWORD32 SignalCode = msg->SignalCode;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
750 BOOL done = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
751
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
752 BOOL end_process = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
753
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
754 while(!end_process)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
755 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
756 switch(*state)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
757 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
758 case RESET:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
759 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
760 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
761 *state = WAIT_INIT;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
762
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
763 // Reset of tasks used in this process is carried out in WAIT_FS_FBMODE1 state
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
764 // Otherwise we would possibly reset the task set by l1a_tmode_fb0_process()
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
765 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
766 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
767
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
768 case WAIT_INIT:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
769 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
770 if (SignalCode == TMODE_FB1_REQ)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
771 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
772 #if (CODE_VERSION == SIMULATION)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
773 l1tm_reset_rx_state();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
774 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
775
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
776 // Flag msg received
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
777 l1tm.tm_msg_received = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
778
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
779 // Set task semaphores.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
780 l1a_l1s_com.task_param[FBNEW] = SEMAPHORE_SET; // Set "parameter synchro semaphore for FB task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
781 l1a_l1s_com.task_param[NSYNC] = SEMAPHORE_SET; // Set "parameter synchro semaphore for FB task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
782
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
783 // Downlink stuff timeslot is 0 (default in CS)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
784 l1a_l1s_com.dl_tn = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
785
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
786 // Set arfcn
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
787 l1a_l1s_com.nsync.list[0].radio_freq =l1_config.tmode.rf_params.bcch_arfcn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
788
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
789 // Set functional mode.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
790 l1a_l1s_com.mode = CS_MODE; //Needs to be set for l1ddsp_load_monit_task()
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
791
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
792 // Set FB detection mode.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
793 l1a_l1s_com.fb_mode = FB_MODE_1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
794
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
795 // Step in state machine
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
796 *state = SET_FS_FB_MODE1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
797 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
798 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
799 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
800 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
801 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
802 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
803 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
804 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
805
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
806 case SET_FS_FB_MODE1:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
807 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
808 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
809 *state = WAIT_FS_FB_MODE1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
810
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
811 // Enable neighbour sync 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
812 l1a_l1s_com.nsync.list[0].status = NSYNC_PENDING;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
813
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
814 // Enable NSYNC task for FB detection mode 1.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
815 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_ENABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
816
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
817 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
818 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
819 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
820 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
821
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
822 case WAIT_FS_FB_MODE1:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
823 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
824 // Use incoming message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
825 //----------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
826 if(SignalCode == L1C_FB_INFO)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
827 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
828 //accumulate FB stats
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
829 l1tm_stats_fb_confirm( (T_TMODE_FB_CON*) ((T_L1C_FB_INFO *) (msg->SigP)), 0);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
830
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
831 // increment counter
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
832 done = l1tm_is_rx_counter_done();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
833
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
834 if (done == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
835 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
836 // Loop counter expired, stop the test
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
837 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
838
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
839 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
840 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
841 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
842
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
843 // Reset tasks used in the process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
844 l1a_l1s_com.l1s_en_task[FBNEW] = TASK_DISABLED; // in tmode, not ALR
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
845 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_DISABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
846
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
847 // Disable neighbour sync 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
848 l1a_l1s_com.nsync.list[0].status = NSYNC_FREE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
849
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
850 break; // break out of switch
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
851 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
852
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
853 *state = SET_FS_FB_MODE1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
854 } // end if L1C_FB_INFO
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
855 else if (SignalCode == TMODE_STOP_RX_TX)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
856 // Stop SYNC mode message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
857 //--------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
858 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
859 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
860 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
861 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
862
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
863 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
864 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
865
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
866 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
867 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
868 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
869 // No action in this machine for other messages.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
870 //----------------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
871 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
872 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
873 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
874 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
875 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
876 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
877 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
878 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
879 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
880
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
881
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
882 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
883 /* l1a_tmode_sb_process() */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
884 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
885 /* Description : This state machine handles the 1st */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
886 /* synchronization with the network in Test Mode. */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
887 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
888 /* Starting messages: TMODE_SB_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
889 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
890 /* Result messages (input): L1C_SB_INFO */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
891 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
892 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
893 void l1a_tmode_sb_process(xSignalHeaderRec *msg)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
894 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
895 enum states
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
896 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
897 RESET = 0, // Reset state.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
898 WAIT_INIT = 1, // Initial state.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
899 SET_FS_SB = 2, // Set SB
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
900 WAIT_FS_SB = 3, // Wait for SB result
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
901 NEW_SYNCHRO = 4 // Camp on cell
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
902 };
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
903
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
904 UWORD8 *state = &l1a.state[TMODE_SB];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
905 UWORD32 SignalCode = msg->SignalCode;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
906 BOOL done = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
907
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
908 static UWORD8 static_bsic;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
909 static UWORD32 static_fn_offset;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
910 static UWORD32 static_time_alignmt;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
911
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
912 BOOL end_process = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
913 while(!end_process)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
914 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
915 switch(*state)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
916 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
917 case RESET:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
918 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
919 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
920 *state = WAIT_INIT;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
921
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
922 // Reset of tasks used in this process is carried out in WAIT_FS_SB state
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
923 // Otherwise we would possibly reset the NSYNC task set by l1a_tmode_fb0_process()
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
924 // or l1a_tmode_fb1_process
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
925 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
926 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
927
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
928 case WAIT_INIT:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
929 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
930 if (SignalCode == TMODE_SB_REQ)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
931 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
932 #if (CODE_VERSION == SIMULATION)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
933 l1tm_reset_rx_state();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
934 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
935
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
936 // Flag msg received
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
937 l1tm.tm_msg_received = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
938
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
939 // Set arfcn
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
940 l1a_l1s_com.nsync.list[0].radio_freq =l1_config.tmode.rf_params.bcch_arfcn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
941
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
942 // Enable NSYNC task for SB detection (SB2).
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
943 #if ((REL99 == 1) && ((FF_BHO == 1) || (FF_RTD == 1)))
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
944 l1a_l1s_com.nsync.list[0].timing_validity = SB_ACQUISITION_PHASE ;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
945 #else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
946 l1a_l1s_com.nsync.list[0].timing_validity = 3;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
947 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
948
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
949 // Step in state machine
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
950 *state = SET_FS_SB;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
951 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
952 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
953 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
954 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
955 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
956 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
957 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
958 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
959
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
960 case SET_FS_SB:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
961 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
962 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
963 *state = WAIT_FS_SB;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
964
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
965 // Enable neighbour sync 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
966 l1a_l1s_com.nsync.list[0].status = NSYNC_PENDING;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
967
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
968 // Enable NSYNC task for SB detection.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
969 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_ENABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
970
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
971 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
972 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
973 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
974 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
975
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
976 case WAIT_FS_SB:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
977 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
978 // Use incoming message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
979 //----------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
980 if(SignalCode == L1C_SB_INFO)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
981 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
982 UWORD8 sb_found = ((T_MPHC_NCELL_SYNC_IND *)(msg->SigP))->sb_flag;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
983 UWORD8 bsic = ((T_MPHC_NCELL_SYNC_IND *)(msg->SigP))->bsic;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
984
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
985 if(sb_found == TRUE)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
986 // SB detection is a success...
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
987 //-----------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
988 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
989 // Save Results.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
990 static_bsic = ((T_MPHC_NCELL_SYNC_IND *)(msg->SigP))->bsic;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
991 static_fn_offset = ((T_MPHC_NCELL_SYNC_IND *)(msg->SigP))->fn_offset;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
992 static_time_alignmt = ((T_MPHC_NCELL_SYNC_IND *)(msg->SigP))->time_alignmt;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
993 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
994
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
995 l1tm_stats_sb_confirm( (T_TMODE_NCELL_SYNC_IND*) ((T_MPHC_NCELL_SYNC_IND*)(msg->SigP)), 0);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
996
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
997 // if just an SB test, increment counter
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
998 // if not done, just stay in this state, schedule a new attempt
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
999 done = l1tm_is_rx_counter_done();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1000
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1001 if (done == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1002 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1003 // step in state machine
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1004 *state = NEW_SYNCHRO;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1005
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1006 // Reset NSYNC task and SB2 task enable flags.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1007 l1a_l1s_com.l1s_en_task[SB2] = TASK_DISABLED; // in tmode, not ALR
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1008 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_DISABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1009
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1010 // Disable neighbour sync 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1011 l1a_l1s_com.nsync.list[0].status = NSYNC_FREE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1012
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1013 // Save results.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1014 l1a_l1s_com.nsync.list[0].fn_offset = static_fn_offset;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1015 l1a_l1s_com.nsync.list[0].time_alignmt = static_time_alignmt;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1016
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1017 // Correct "ntdma" and "time_alignment" to shift 20 bit to the
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1018 // future for Normal Burst reading tasks.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1019 l1a_add_time_for_nb(&l1a_l1s_com.nsync.list[0].time_alignmt,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1020 &l1a_l1s_com.nsync.list[0].fn_offset);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1021
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1022 break; // break out of switch
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1023 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1024 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1025 // Make a new SB attempt
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1026 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1027 l1a_l1s_com.nsync.list[0].status = NSYNC_PENDING;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1028
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1029 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1030 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1031 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1032 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1033 else if (SignalCode == TMODE_STOP_RX_TX)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1034 // Stop SYNC mode message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1035 //--------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1036 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1037 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1038 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1039 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1040
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1041 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1042 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1043
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1044 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1045 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1046 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1047 // No action in this machine for other messages.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1048 //----------------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1049 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1050 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1051 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1052 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1053 }//End Case WAIT_FS_SB
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1054 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1055
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1056 case NEW_SYNCHRO:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1057 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1058 // Reset the Neighbor Cell information structure.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1059 l1a_reset_cell_info(&(l1a_l1s_com.Scell_info));
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1060
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1061 // STILL SAVING TSC WITHIN BSIC !!!!!!!!!!!!!!!!
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1062
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1063 // Download ARFCN, timing information and bitmap from the command message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1064 l1a_l1s_com.Scell_info.radio_freq = l1_config.tmode.rf_params.bcch_arfcn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1065 l1a_l1s_com.Scell_info.bsic = static_bsic;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1066 l1a_l1s_com.Scell_info.time_alignmt = l1a_l1s_com.nsync.list[0].time_alignmt;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1067 l1a_l1s_com.Scell_info.fn_offset = l1a_l1s_com.nsync.list[0].fn_offset;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1068
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1069 // tn_difference -> loaded with the number of timeslot to shift.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1070 // dl_tn -> loaded with the new timeslot.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1071 l1a_l1s_com.tn_difference = 0 - l1a_l1s_com.dl_tn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1072 l1a_l1s_com.dl_tn = 0; // Camping on timeslot 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1073
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1074 // Layer 1 internal mode is set to IDLE MODE.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1075 l1a_l1s_com.mode = I_MODE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1076
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1077 // Set flag for toa init.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1078 #if (TOA_ALGO != 0)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1079 l1a_l1s_com.toa_reset = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1080 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1081
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1082 // Enable SYNCHRO tasks.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1083 l1a_l1s_com.l1s_en_task[SYNCHRO] = TASK_ENABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1084
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1085 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1086 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1087
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1088 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1089 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1090 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1091 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1092 break; // break out of switch
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1093 // omaps00090550 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1094 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1095 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1096 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1097
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1098 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1099 /* l1a_tmode_bcch_reading_process() */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1100 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1101 /* Description : This state machine handles serving cell */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1102 /* BCCH reading in Test Mode. */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1103 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1104 /* This process happens for a TestMode BCCH test, after */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1105 /* completing FB's and SB's in */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1106 /* l1a_tmode_initial_network_sync_process, */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1107 /* and then passing through l1a_tmode_cres_process, */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1108 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1109 /* OR */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1110 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1111 /* it can also happen for a TestMode TCH with synch */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1112 /* test where, FB's and SB's have already been detected, */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1113 /* and 4 BCCH's will be received before moving to the */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1114 /* TCH and dedicated mode. */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1115 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1116 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1117 /* Starting messages: TMODE_SCELL_NBCCH_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1118 /* ------------------ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1119 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1120 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1121 /* Result messages (input): L1C_BCCHS_INFO */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1122 /* ------------------------ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1123 /* System information data block from L1S. */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1124 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1125 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1126 /* Reset messages (input): TMODE_STOP_SCELL_BCCH_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1127 /* ----------------------- */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1128 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1129 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1130 void l1a_tmode_bcch_reading_process(xSignalHeaderRec *msg)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1131 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1132 enum states
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1133 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1134 RESET = 0,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1135 WAIT_INIT = 1,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1136 NBCCHS_CONFIG = 2,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1137 WAIT_BCCHS_RESULT = 3
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1138 };
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1139
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1140 UWORD8 *state = &l1a.state[TMODE_BCCH];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1141 UWORD32 SignalCode = msg->SignalCode;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1142 BOOL done = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1143
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1144 BOOL end_process = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1145 while(!end_process)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1146 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1147 switch(*state)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1148 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1149 case RESET:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1150 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1151 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1152 *state = WAIT_INIT;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1153
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1154 // Reset CS_MEAS process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1155 l1a_l1s_com.l1s_en_task[NBCCHS] = TASK_DISABLED; // Clear NBCCHS task enable flag.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1156 //l1a_l1s_com.l1s_en_task[EBCCHS] = TASK_DISABLED; // Clear EBCCHS task enable flag.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1157 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1158 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1159
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1160 case WAIT_INIT:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1161 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1162 if(SignalCode == TMODE_SCELL_NBCCH_REQ)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1163 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1164
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1165 #if (CODE_VERSION == SIMULATION)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1166 l1tm_reset_rx_state();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1167 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1168
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1169 // Flag msg received
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1170 l1tm.tm_msg_received = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1171
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1172 // Request to read Normal BCCH from serving cell.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1173 l1a_l1s_com.Scell_info.radio_freq = l1_config.tmode.rf_params.bcch_arfcn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1174
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1175 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1176 *state = NBCCHS_CONFIG;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1177 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1178
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1179 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1180 // No action in this machine for other messages.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1181 //----------------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1182 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1183 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1184 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1185 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1186 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1187 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1188
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1189 case NBCCHS_CONFIG:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1190 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1191 UWORD8 i;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1192
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1193 // Set semaphores for Normal Serving BCCH reading task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1194 l1a_l1s_com.task_param[NBCCHS] = SEMAPHORE_SET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1195
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1196 // Download message content.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1197 //--------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1198 l1a_l1s_com.nbcchs.schedule_array_size = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1199
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1200 for(i=0;i<l1a_l1s_com.nbcchs.schedule_array_size;i++)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1201 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1202 l1a_l1s_com.nbcchs.schedule_array[i].modulus = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1203 l1a_l1s_com.nbcchs.schedule_array[i].relative_position = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1204 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1205
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1206 // Enable NBCCHS task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1207 l1a_l1s_com.l1s_en_task[NBCCHS] = TASK_ENABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1208
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1209 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1210 *state = WAIT_BCCHS_RESULT;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1211
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1212 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1213 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1214 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1215 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1216
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1217 case WAIT_BCCHS_RESULT:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1218 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1219 if(SignalCode == L1C_BCCHS_INFO)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1220 // Serving cell BCCH reading result.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1221 //----------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1222 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1223 // this function takes care of loops management
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1224 l1tm_stats_bcch_confirm( (T_TMODE_BCCHS_CON*) ((T_MPHC_DATA_IND *)(msg->SigP)) );
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1225
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1226 done = l1tm_is_rx_counter_done();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1227
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1228 if (done == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1229 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1230 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1231 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1232 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1233
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1234 // This process must be reset.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1235 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1236
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1237 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1238 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1239 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1240 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1241 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1242 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1243 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1244 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1245 else if (SignalCode == TMODE_STOP_RX_TX)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1246 // Stop BCCH mode message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1247 //--------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1248 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1249 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1250 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1251 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1252
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1253 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1254 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1255
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1256 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1257 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1258 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1259 // No action in this machine for other messages.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1260 //----------------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1261 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1262 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1263 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1264 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1265 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1266 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1267 } // end of "switch".
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1268 } // end of "while"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1269 } // end of procedure.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1270
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1271 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1272 /* l1a_tmode_dedicated_process() */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1273 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1274 /* Description : This state machine handles the dedicated*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1275 /* mode setup in Test Mode (L1A side). */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1276 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1277 /* Starting messages: TMODE_IMMED_ASSIGN_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1278 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1279 /* Subsequent messages: */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1280 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1281 /* Result messages (input): L1C_DEDIC_DONE */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1282 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1283 /* Result messages (output): */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1284 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1285 /* Reset messages (input): TMODE_STOP_RX_TX */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1286 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1287 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1288 void l1a_tmode_dedicated_process(xSignalHeaderRec *msg)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1289 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1290 enum states
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1291 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1292 RESET = 0,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1293 WAIT_INIT = 1,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1294 WAIT_MSG = 2
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1295 };
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1296
221
5aeabd5e6ded l1tm_async.c: confirm_SignalCode bogon removed from
Mychaela Falconia <falcon@freecalypso.org>
parents: 220
diff changeset
1297 T_DEDIC_SET *free_set;
5aeabd5e6ded l1tm_async.c: confirm_SignalCode bogon removed from
Mychaela Falconia <falcon@freecalypso.org>
parents: 220
diff changeset
1298 UWORD8 *state = &l1a.state[TMODE_DEDICATED];
5aeabd5e6ded l1tm_async.c: confirm_SignalCode bogon removed from
Mychaela Falconia <falcon@freecalypso.org>
parents: 220
diff changeset
1299 UWORD32 SignalCode = msg->SignalCode;
214
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1300
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1301 BOOL end_process = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1302 while(!end_process)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1303 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1304 switch(*state)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1305 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1306 case RESET:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1307 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1308 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1309 *state = WAIT_INIT;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1310
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1311 l1a_l1s_com.l1s_en_task[FB26] = TASK_DISABLED; // Reset FB26 task enable flag.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1312
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1313 // Reset D_NMEAS process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1314 l1a_l1s_com.l1s_en_meas &= D_BAMS_MEAS_MASK; // Reset D_BAMS Measurement enable flag.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1315 l1a.l1a_en_meas[D_NMEAS] &= D_BAMS_MEAS_MASK;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1316
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1317 // Reset L1S dedicated mode manager trigger.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1318 l1a_l1s_com.dedic_set.SignalCode = NULL;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1319 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1320 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1321
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1322 case WAIT_INIT:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1323 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1324 switch(SignalCode)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1325 // switch on input message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1326 //-------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1327 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1328 case TMODE_IMMED_ASSIGN_REQ:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1329 // Immediate assignement message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1330 //-------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1331 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1332 UWORD8 maio_bef_sti;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1333 #if(L1_FF_MULTIBAND == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1334 UWORD8 operative_radio_freq;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1335 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1336
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1337 // Flag msg received
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1338 l1tm.tm_msg_received = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1339
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1340 #if (CODE_VERSION == SIMULATION)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1341 l1_config.tmode.rf_params.down_up = ((T_TMODE_IMMED_ASSIGN_REQ*)(msg->SigP))->ul_dl;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1342 l1tm_reset_rx_state();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1343 l1_config.tmode.stats_config.num_loops = 26; // 0 actually means infinite
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1344 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1345
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1346 // save this info for later
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1347 if (l1_config.tmode.rf_params.down_up == (TMODE_DOWNLINK|TMODE_UPLINK) &&
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1348 l1_config.tmode.rf_params.mon_tasks == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1349 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1350 l1a_l1s_com.nsync.list[0].radio_freq = l1_config.tmode.rf_params.mon_arfcn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1351 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1352
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1353 // Get Ptr to the free dedicated parameter set.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1354 // All important fields are initialised.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1355 free_set = l1a_get_free_dedic_set();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1356
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1357 // Save given dedicated channel parameters from MPHC_IMMED_ASSIGN_REQ msg.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1358
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1359 //========================================================================
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1360
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1361 free_set->chan1.desc.chan_sel.h = 0; // no hopping
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1362
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1363 free_set->chan1.desc.chan_sel.rf_channel.single_rf.radio_freq = l1_config.tmode.rf_params.tch_arfcn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1364 //DON'T: union with radio_freq
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1365 //free_set->chan1.desc.chan_sel.rf_channel.hopping_rf.maio=0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1366 //free_set->chan1.desc.chan_sel.rf_channel.hopping_rf.hsn=0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1367
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1368 free_set->chan1.desc.channel_type = l1_config.tmode.rf_params.channel_type;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1369 free_set->chan1.desc.subchannel = l1_config.tmode.rf_params.subchannel;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1370 free_set->chan1.desc.timeslot_no = l1_config.tmode.rx_params.slot_num;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1371 free_set->chan1.desc.tsc = l1_config.tmode.tx_params.tsc;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1372
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1373 //Set the loopback mode
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1374 // 0: No loopback, 1: Loop A ... 6: Loop F
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1375 if(l1_config.tmode.tx_params.burst_data >= 5 && l1_config.tmode.tx_params.burst_data <= 10 &&
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1376 l1_config.tmode.rf_params.down_up == (TMODE_DOWNLINK | TMODE_UPLINK))
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1377 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1378 free_set->chan1.tch_loop = l1_config.tmode.tx_params.burst_data - 4;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1379
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1380 // For loop back the channel mode needs to be set to TCH/FS
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1381 free_set->chan1.mode = TCH_FS_MODE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1382 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1383 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1384 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1385 free_set->chan1.tch_loop = 0; // no loopback
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1386
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1387 // Rem1: Mode is forced to Signalling Only.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1388 if (l1_config.tmode.rf_params.channel_type == TCH_F)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1389 free_set->chan1.mode = TCH_FS_MODE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1390 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1391 free_set->chan1.mode = SIG_ONLY_MODE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1392
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1393 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1394 /*
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1395 ;--------------------------------------------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1396 ; channel_desc_1 :
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1397 ; chan_sel : ( h=FALSE, arfcn=5a )
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1398 ; channel_type = 1 (TCHFS)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1399 ; subchannel = 0
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1400 ; timeslot_no = 0
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1401 ; tsc = 5
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1402 ; timing_advance = 0
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1403 ; frequency_list :
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1404 ; rf_chan_cnt = 0000
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1405 ; rf_chan_no : (0000, 0000, ...(total of 64)... 0000)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1406 ; starting_time =
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1407 ; start_time_present = FALSE
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1408 ; start_time :
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1409 ; n32 =
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1410 ; n51 =
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1411 ; n26 =
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1412 ; frequency_list_bef_sti
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1413 ; rf_chan_cnt = 0000
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1414 ; rf_chan_no : (0000, 0000, ...(total of 64)... 0000)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1415 ; maio_bef_sti = 0
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1416 ; dtx_allowed = FALSE
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1417 ; bcch_allocation = 0 carriers (...) UNUSED
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1418 ; ba_id = 0 UNUSED
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1419 ; pwrc = 5
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1420 ;--------------------------------------------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1421 */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1422 free_set->ma.freq_list.rf_chan_cnt = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1423 free_set->ma.freq_list.rf_chan_no.A[0] = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1424 free_set->ma.freq_list_bef_sti.rf_chan_cnt = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1425 free_set->ma.freq_list_bef_sti.rf_chan_no.A[0] = 0; //DedicNew
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1426
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1427 maio_bef_sti = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1428
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1429 free_set->new_timing_advance = l1_config.tmode.tx_params.timing_advance;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1430 free_set->dtx_allowed = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1431 // New Timing Advance value must be applied on 1st frame of dedic. channel.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1432 free_set->timing_advance = free_set->new_timing_advance;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1433
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1434 l1a_l1s_com.dedic_set.pwrc = l1_config.tmode.tx_params.txpwr;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1435 // l1a_l1s_com.dedic_set.pwrc = 5; // change from TM2!
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1436
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1437 // TXPWR command was given in Idle, save it in dedicated mode structure.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1438 free_set->new_target_txpwr = l1s.applied_txpwr = l1_config.tmode.tx_params.txpwr;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1439
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1440 // Serving Cell stays the same.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1441 free_set->cell_desc = l1a_l1s_com.Scell_info;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1442
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1443 #if(L1_FF_MULTIBAND == 0)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1444
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1445 free_set->cell_desc.traffic_meas_beacon
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1446 = l1a_l1s_com.last_input_level[l1a_l1s_com.Scell_info.radio_freq - l1_config.std.radio_freq_index_offset];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1447 free_set->cell_desc.traffic_meas = l1a_l1s_com.last_input_level[l1a_l1s_com.Scell_info.radio_freq - l1_config.std.radio_freq_index_offset];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1448
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1449 #else // L1_FF_MULTIBAND = 1 below
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1450
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1451 operative_radio_freq =
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1452 l1_multiband_radio_freq_convert_into_operative_radio_freq(l1a_l1s_com.Scell_info.radio_freq);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1453
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1454 free_set->cell_desc.traffic_meas_beacon
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1455 = l1a_l1s_com.last_input_level[operative_radio_freq];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1456 free_set->cell_desc.traffic_meas = l1a_l1s_com.last_input_level[operative_radio_freq];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1457
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1458 #endif // #if(L1_FF_MULTIBAND == 0) else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1459
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1460
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1461 // Decode the "starting time field", since staying on the same serving
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1462 // the same STI fn is saved in both "neig_sti_fn" and "serv_sti_fn".
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1463 free_set->neig_sti_fn = -1; //l1a_decode_starting_time(((T_MPHC_IMMED_ASSIGN_REQ *)(msg->SigP))->starting_time);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1464 free_set->serv_sti_fn = free_set->neig_sti_fn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1465
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1466 // Check/Fill "before starting time" fields.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1467 //l1a_fill_bef_sti_param(free_set, ((T_MPHC_IMMED_ASSIGN_REQ *)(msg->SigP))->starting_time.start_time_present);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1468
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1469 //No hopping channel
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1470
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1471 // Save the "timeslot difference" between new and old configuration
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1472 // in "tn_difference".
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1473 // tn_difference -> loaded with the number of timeslot to shift.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1474 // dl_tn -> loaded with the new timeslot.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1475 l1a_l1s_com.tn_difference = free_set->chan1.desc.timeslot_no - l1a_l1s_com.dl_tn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1476 l1a_l1s_com.dl_tn = free_set->chan1.desc.timeslot_no; // Save new TN id.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1477
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1478 // Set "fset" pointer to the new parameter set.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1479 l1a_l1s_com.dedic_set.fset = free_set;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1480
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1481 // Give new msg code to L1S. //TestMode: use existing L1S primitive name
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1482 l1a_l1s_com.dedic_set.SignalCode = MPHC_IMMED_ASSIGN_REQ;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1483
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1484 // step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1485 *state = WAIT_MSG;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1486 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1487 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1488
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1489 } // end of "switch(SignalCode)".
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1490 // end of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1491 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1492 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1493 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1494
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1495 case WAIT_MSG:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1496 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1497 switch(SignalCode)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1498 // switch on input message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1499 //-------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1500 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1501 case L1C_DEDIC_DONE:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1502 // Dedicated channel activated.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1503 //-----------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1504 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1505 // if MON tasks are enabled, set up FB26 and D_BAMS_MEAS tasks now as well
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1506 if (l1_config.tmode.rf_params.down_up == (TMODE_DOWNLINK|TMODE_UPLINK) &&
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1507 l1_config.tmode.rf_params.mon_tasks == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1508 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1509 l1a_l1s_com.task_param[FB26] = SEMAPHORE_SET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1510 l1a_l1s_com.l1s_en_task[FB26] = TASK_ENABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1511 #if (L1_12NEIGH ==1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1512 //Set timing validity for FB no a priori info
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1513 l1a_l1s_com.nsync.list[0].timing_validity = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1514
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1515 // Enable neighbour sync 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1516 l1a_l1s_com.nsync.list[0].status = NSYNC_PENDING; //Used by l1s_schedule_tasks in l1_sync
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1517 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_ENABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1518 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1519 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1520
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1521 if (l1_config.tmode.rx_params.pm_enable)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1522 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1523 // Reset the BA list structure
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1524 l1a_reset_ba_list();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1525
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1526 // Next measurement report must indicate INVALID.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1527 //meas_valid = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1528
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1529 l1a_l1s_com.ba_list.nbr_carrier = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1530
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1531 // l1a_l1s_com.nsync.list[0].radio_freq was set to mon_arfcn above
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1532 l1a_l1s_com.ba_list.A[0].radio_freq = l1a_l1s_com.nsync.list[0].radio_freq;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1533
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1534 // Set parameter synchro semaphore for D_BAMS task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1535 // Enable Dedicated mode BA list measurement task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1536 l1a_l1s_com.meas_param |= D_BAMS_MEAS;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1537 l1a.l1a_en_meas[D_NMEAS] |= D_BAMS_MEAS;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1538 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1539
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1540 // keep track of dedicated mode state.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1541 l1tm.tmode_state.dedicated_active = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1542
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1543 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1544 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1545 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1546 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1547
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1548 case TMODE_TCH_INFO:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1549 // TCH result messages.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1550 //-----------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1551 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1552 // Check if RX stats done in TCH
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1553 if (l1_config.tmode.rf_params.mon_report == 0)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1554 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1555 BOOL done;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1556
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1557 // loop and stats management done within this function
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1558 l1tm_stats_tch_confirm((T_TMODE_TCH_INFO *) (msg->SigP));
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1559
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1560 done = l1tm_is_rx_counter_done();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1561
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1562 if (done == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1563 // if done, send stop message
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1564 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1565 l1tm.tmode_state.dedicated_active = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1566
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1567 // Give new msg code to L1S.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1568 l1a_l1s_com.dedic_set.SignalCode = MPHC_STOP_DEDICATED_REQ;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1569
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1570 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1571 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1572 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1573
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1574 #if (L1_12NEIGH ==1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1575 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_DISABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1576 // Disable neighbour sync 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1577 l1a_l1s_com.nsync.list[0].status = NSYNC_FREE; //Used by l1s_schedule_tasks in l1_sync
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1578 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1579
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1580 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1581 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1582 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1583 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1584
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1585 // end of process
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1586 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1587 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1588 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1589
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1590 case L1C_FB_INFO:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1591 // MON result messages.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1592 //-----------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1593 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1594 // Check if RX stats done in Monitor channel
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1595 if (l1_config.tmode.rf_params.mon_report == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1596 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1597 BOOL done;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1598
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1599 // loop and stats management done within this function
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1600 l1tm_stats_mon_confirm( (T_TMODE_FB_CON*) ((T_L1C_FB_INFO *) (msg->SigP)));
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1601
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1602 done = l1tm_is_rx_counter_done();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1603
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1604 if (done == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1605 // if done, send stop message
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1606 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1607 l1tm.tmode_state.dedicated_active = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1608
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1609 // Give new msg code to L1S.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1610 l1a_l1s_com.dedic_set.SignalCode = MPHC_STOP_DEDICATED_REQ;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1611
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1612 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1613 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1614 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1615
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1616 #if (L1_12NEIGH ==1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1617 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_DISABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1618 // Disable neighbour sync 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1619 l1a_l1s_com.nsync.list[0].status = NSYNC_FREE; //Used by l1s_schedule_tasks in l1_sync
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1620 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1621
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1622 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1623 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1624 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1625 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1626
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1627 // end of process
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1628 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1629 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1630 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1631
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1632 case TMODE_STOP_RX_TX:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1633 // Release dedicated mode message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1634 //--------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1635 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1636 l1tm.tmode_state.dedicated_active = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1637
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1638 // Give new msg code to L1S.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1639 l1a_l1s_com.dedic_set.SignalCode = MPHC_STOP_DEDICATED_REQ;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1640
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1641 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1642 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1643 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1644
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1645 #if (L1_12NEIGH ==1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1646 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_DISABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1647 // Disable neighbour sync 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1648 l1a_l1s_com.nsync.list[0].status = NSYNC_FREE; //Used by l1s_schedule_tasks in l1_sync
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1649 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1650 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1651 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1652
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1653 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1654 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1655 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1656
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1657 default:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1658 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1659 //----------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1660 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1661 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1662 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1663 } // end of "switch(SignalCode)".
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1664 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1665 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1666
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1667 } // end of "switch".
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1668 } // end of "while"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1669 } // end of procedure.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1670
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1671 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1672 /* l1a_tmode_ra_process() */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1673 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1674 /* Description : This state machine handles the TestMode */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1675 /* access to the network (IDLE mode). */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1676 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1677 /* Starting messages: TMODE_RA_START */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1678 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1679 /* Result messages (input): L1C_RA_DONE */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1680 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1681 /* Result messages (output): TMODE_RA_DONE */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1682 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1683 /* Stop messages (input): TMODE_STOP_RX_TX */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1684 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1685 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1686 void l1a_tmode_access_process(xSignalHeaderRec *msg)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1687 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1688 enum states
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1689 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1690 RESET = 0,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1691 WAIT_INIT = 1,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1692 WAIT_RESULT = 2
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1693 };
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1694
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1695 UWORD8 *state = &l1a.state[TMODE_RA];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1696 UWORD32 SignalCode = msg->SignalCode;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1697 BOOL done = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1698
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1699 while(1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1700 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1701 switch(*state)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1702 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1703 case RESET:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1704 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1705 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1706 *state = WAIT_INIT;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1707
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1708 // Reset RAACC process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1709 l1a_l1s_com.l1s_en_task[RAACC] = TASK_DISABLED; // Clear RAACC task enable flag.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1710 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1711 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1712
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1713 case WAIT_INIT:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1714 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1715 if(SignalCode == TMODE_RA_START)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1716 // Configuration message for Access Link.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1717 //---------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1718 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1719 // Flag msg received
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1720 l1tm.tm_msg_received = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1721
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1722 l1s.applied_txpwr = l1_config.tmode.tx_params.txpwr;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1723 l1a_l1s_com.ra_info.channel_request = 2; //l1_config.tm_params.channel_request;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1724
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1725 // Initialize rand counter for RAACC process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1726 l1a_l1s_com.ra_info.rand = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1727
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1728 // rand is random number of frames to wait between each AB transmission.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1729 // In actual L1 code this changes with each burst.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1730 // It is set to 1 here so the test runs fast.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1731
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1732 // also, channel_request is constant in TestMode for all bursts.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1733 // Actual L1 changes channel_request message each time with a different
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1734 // random reference. [channel_request = 3 bits for establishment cause
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1735 // and 5 bits of random reference]
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1736
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1737 // Use 2 multiframes (0.5 seconds) in reading all serving normal bursts
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1738 // (like paging reorganization) to refine TOA since we must have the quarter
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1739 // bit accuracy for RACH transmission.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1740
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1741 // Delay the start of RACH transmission (by incrementing rand
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1742 // counter), only at the start of the test.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1743
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1744 if(l1a_l1s_com.bcch_combined)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1745 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1746 l1a_l1s_com.ra_info.rand += 54; // Combined: 2 multiframes = 54 slots.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1747 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1748 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1749 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1750 l1a_l1s_com.ra_info.rand += 102; // Not combined: 2 multiframes = 102 slots.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1751 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1752
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1753 // step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1754 *state = WAIT_RESULT;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1755
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1756 // TestMode does not set up full BCCH reading
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1757
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1758 // Activate RAACC task (no semaphore for UL tasks).
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1759 // TestMode does not enable Paging Reorg and Normal paging tasks.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1760 l1a_l1s_com.l1s_en_task[RAACC] = TASK_ENABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1761
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1762 // Change mode to connection establishment part 1.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1763 l1a_l1s_com.mode = CON_EST_MODE1; // used for toa calc.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1764 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1765
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1766 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1767 // No action in this machine for other messages.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1768 //----------------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1769 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1770 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1771 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1772 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1773 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1774 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1775
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1776 case WAIT_RESULT:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1777 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1778 if(SignalCode == L1C_RA_DONE)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1779 // Random access acknowledge message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1780 //-----------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1781 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1782 // Change mode to connection establishment part 2.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1783 l1a_l1s_com.mode = CON_EST_MODE2; // used for toa calc.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1784
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1785 //change power level and arfcn on the fly
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1786 l1s.applied_txpwr = l1_config.tmode.tx_params.txpwr;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1787 // l1a_l1s_com.Scell_info.radio_freq = l1_config.tmode.rf_params.tch_arfcn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1788
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1789 done = l1tm_is_rx_counter_done();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1790
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1791 if (done)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1792 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1793 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1794 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1795 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1796
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1797 // No stats, just report end
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1798 //tmstats_ra_confirm( (T_TMODE_RA_DONE*) ((T_MPHC_RA_CON *)(msg->SigP)) );
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1799
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1800 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1801 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1802 else // there are more loops to do...
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1803 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1804 l1a_l1s_com.ra_info.rand += 10; // 1 chosen/set for quicker test
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1805 // Activate RAACC task (no semaphore for UL tasks).
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1806 l1a_l1s_com.l1s_en_task[RAACC] = TASK_ENABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1807 // end of process
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1808 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1809 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1810 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1811
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1812 else if(SignalCode == TMODE_STOP_RX_TX)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1813 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1814 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1815 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1816 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1817
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1818 // No stats, just report end
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1819 //tmstats_ra_confirm( (T_TMODE_RA_DONE*) ((T_MPHC_RA_CON *)(msg->SigP)) );
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1820 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1821 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1822 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1823
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1824 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1825 // No action in this machine for other messages.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1826 //----------------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1827 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1828 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1829 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1830 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1831 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1832 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1833 } // end of "switch".
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1834 } // end of "while"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1835 } // end of procedure.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1836
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1837 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1838 /* l1a_tmode_full_list_meas_process() */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1839 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1840 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1841 /* Description: */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1842 /* ------------ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1843 /* This function is a state machine which handles the */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1844 /* Cell Selection Full List Power Measurement L1/L3 */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1845 /* interface and it handles the neigbour cell */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1846 /* measurement process in IDLE mode with FULL list. */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1847 /* When a message MPHC_RXLEV_REQ is received */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1848 /* the L1S task FSMS_MEAS is enabled. When this task */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1849 /* is completed a reporting message L1C_VALID_MEAS_INFO */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1850 /* is received and forwarded to L3. */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1851 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1852 /* Starting messages: MPHC_RXLEV_REQ. */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1853 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1854 /* Result messages (input): L1C_VALID_MEAS_INFO */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1855 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1856 /* Result messages (output): MPHC_RXLEV_IND */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1857 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1858 /* Reset messages (input): none */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1859 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1860 /* Stop message (input): MPHC_STOP_RXLEV_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1861 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1862 /* Stop message (output): MPHC_STOP_RXLEV_CON */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1863 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1864 /* Rem: */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1865 /* ---- */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1866 /* L3 is in charge of the number of pass to follow the */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1867 /* GSM recommendation. */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1868 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1869 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1870 void l1a_tmode_full_list_meas_process(xSignalHeaderRec *msg)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1871 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1872 enum states
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1873 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1874 RESET = 0,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1875 WAIT_INIT = 1,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1876 WAIT_RESULT = 2
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1877 };
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1878
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1879 UWORD8 *state = &l1a.state[TMODE_FULL_MEAS];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1880 UWORD32 SignalCode = msg->SignalCode;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1881
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1882 BOOL end_process = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1883
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1884 while(!end_process)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1885 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1886 switch(*state)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1887 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1888 case RESET:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1889 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1890 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1891 *state = WAIT_INIT;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1892
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1893 // Reset FULL_MEAS process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1894 l1a_l1s_com.l1s_en_meas &= FSMS_MEAS_MASK; // Clear Cell Selection Measurement enable flag.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1895 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1896 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1897
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1898 case WAIT_INIT:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1899 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1900 if(SignalCode == TMODE_RXLEV_REQ)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1901 // Request to enter the Cell Selection measurements.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1902 //--------------------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1903 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1904 UWORD16 i;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1905
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1906 // Flag msg received
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1907 l1tm.tm_msg_received = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1908
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1909 // Do NOT download info from message
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1910 // In TestMode always a full scanning is done, therefore primitive does not send the list
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1911 l1a_l1s_com.full_list_ptr=(T_FULL_LIST_MEAS *)((T_TMODE_RXLEV_REQ *)(msg->SigP));
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1912
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1913 // Single power measurement carried out on monitor channel
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1914 l1a_l1s_com.full_list_ptr->power_array_size = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1915 l1a_l1s_com.full_list_ptr->power_array[0].radio_freq = l1_config.tmode.rf_params.mon_arfcn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1916
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1917 // Set "parameter synchro semaphores"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1918 l1a_l1s_com.meas_param |= FSMS_MEAS;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1919
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1920 // Reset the full list structure.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1921 l1a_reset_full_list();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1922
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1923 // Reset the Input Level (IL) memory table.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1924 #if (L1_FF_MULTIBAND == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1925 for(i=0; i<= NBMAX_CARRIER; i++)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1926 #else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1927 for(i=0; i<=l1_config.std.nbmax_carrier; i++)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1928 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1929 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1930 l1a_l1s_com.last_input_level[i].input_level = l1_config.params.il_min;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1931 l1a_l1s_com.last_input_level[i].lna_off = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1932 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1933
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1934 // Enable Cell Selection Full list measurement task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1935 l1a.l1a_en_meas[TMODE_FULL_MEAS] |= FSMS_MEAS;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1936
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1937 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1938 *state = WAIT_RESULT;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1939 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1940
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1941 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1942 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1943 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1944 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1945
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1946 case WAIT_RESULT:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1947 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1948 if(SignalCode == L1C_VALID_MEAS_INFO)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1949 // One valid measurement pass has been completed over the full list of carriers.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1950 //------------------------------------------------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1951 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1952 BOOL done = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1953
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1954 //--------------------------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1955 // WE COULD PUT HERE THE CODE TO TRANSLATE IL -> RXLEV !!!
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1956 //--------------------------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1957
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1958 l1tm_stats_full_list_meas_confirm((T_TMODE_RXLEV_REQ *)(msg->SigP));
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1959
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1960 done = l1tm_is_rx_counter_done();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1961
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1962 if (done)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1963 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1964 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1965 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1966 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1967
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1968 // Reset the machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1969 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1970 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1971 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1972 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1973 // Reset the full list structure.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1974 l1a_reset_full_list();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1975
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1976 // Enable Cell Selection Full list measurement task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1977 l1a.l1a_en_meas[TMODE_FULL_MEAS] |= FSMS_MEAS;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1978
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1979 // End of process
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1980 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1981 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1982 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1983
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1984 else if (SignalCode == TMODE_STOP_RX_TX)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1985 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1986 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1987 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1988 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1989
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1990 // Forward result message to L3.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1991 l1a_send_confirmation(TMODE_STOP_RXLEV_CON,RRM1_QUEUE);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1992 // Reset the machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1993 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1994 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1995 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1996 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1997 // No action in this machine for other messages.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1998 //----------------------------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1999 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2000 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2001 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2002 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2003 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2004 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2005 } // end of "switch".
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2006 } // end of "while"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2007 } // end of procedure.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2008
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2009
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2010 #if L1_GPRS
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2011 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2012 /* l1pa_tmode_transfer_process() */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2013 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2014 /* Description: */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2015 /* ------------ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2016 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2017 /* Starting messages: */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2018 /* ------------------ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2019 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2020 /* Subsequent messages: */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2021 /* -------------------- */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2022 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2023 /* Result messages (input): */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2024 /* ------------------------ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2025 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2026 /* Result messages (output): */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2027 /* ------------------------- */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2028 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2029 /* Reset messages (input): */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2030 /* ----------------------- */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2031 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2032 /*-------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2033 void l1a_tmode_transfer_process(xSignalHeaderRec *msg)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2034 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2035 enum states
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2036 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2037 RESET = 0,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2038 WAIT_INIT = 1,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2039 WAIT_MSG = 2
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2040 };
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2041
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2042 UWORD8 *state = &l1a.state[TMODE_TRANSFER];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2043 UWORD32 SignalCode = msg->SignalCode;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2044
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2045 static UWORD8 stat_gprs_slots;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2046
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2047 BOOL end_process = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2048
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2049 while(!end_process)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2050 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2051 switch(*state)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2052 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2053 case RESET:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2054 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2055 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2056 *state = WAIT_INIT;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2057
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2058 // Reset FB26 task enable flag.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2059 l1a_l1s_com.l1s_en_task[FB26] = TASK_DISABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2060
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2061 // Reset TCR_MEAS process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2062 l1pa_l1ps_com.l1ps_en_meas &= P_TCRMS_MEAS_MASK; // Disable Neighbour Measurement task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2063 l1pa.l1pa_en_meas[TCR_MEAS] &= P_TCRMS_MEAS_MASK; // Reset Neighbour Measurement task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2064
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2065 // Rise transfert parameter semaphore.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2066 l1pa_l1ps_com.transfer.semaphore = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2067 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2068 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2069
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2070 case WAIT_INIT:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2071 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2072 switch(SignalCode)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2073 // switch on input message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2074 //-------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2075 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2076 case TMODE_PDTCH_ASSIGN_REQ:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2077 // Assignement message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2078 //---------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2079 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2080 static UWORD32 count =0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2081
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2082 T_TRANSFER_SET *free_set;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2083 UWORD8 assignment_command;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2084 UWORD8 timeslot_alloc;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2085 UWORD8 timeslot;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2086 UWORD32 i;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2087
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2088 count++ ;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2089
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2090 #if (CODE_VERSION == SIMULATION)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2091 l1tm_reset_rx_state();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2092 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2093
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2094 // Flag msg received
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2095 l1tm.tm_msg_received = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2096
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2097 // Rise transfert parameter semaphore to prevent L1S to use partial configuration.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2098 l1pa_l1ps_com.transfer.semaphore = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2099
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2100 assignment_command = BOTH_TBF;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2101
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2102 // Get Ptr to the free dedicated parameter set.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2103 // All important fields are initialised.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2104 free_set = l1pa_get_free_transfer_set(assignment_command);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2105
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2106 // Download message containt.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2107 free_set->assignment_id = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2108 free_set->assignment_command = assignment_command;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2109 #if (CODE_VERSION == SIMULATION)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2110 free_set->multislot_class = ((T_TMODE_PDTCH_ASSIGN_REQ *)(msg->SigP))->multislot_class;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2111 #else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2112 free_set->multislot_class = l1_config.tmode.rf_params.multislot_class;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2113 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2114 free_set->dl_pwr_ctl.p0 = 255; // no power control
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2115 free_set->packet_ta.ta = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2116 free_set->packet_ta.ta_index = 255;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2117 free_set->packet_ta.ta_tn = 255;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2118 free_set->tsc = l1_config.tmode.tx_params.tsc;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2119 free_set->freq_param.chan_sel.h = FALSE; // no hopping
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2120 free_set->freq_param.chan_sel.rf_channel.single_rf.radio_freq = l1_config.tmode.rf_params.pdtch_arfcn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2121 free_set->mac_mode = FIX_ALLOC_NO_HALF; // fixed allocation
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2122 free_set->tbf_sti.present = TRUE; // STI present
222
a4899cf67fd1 l1tm_async.c: reconstruction complete, exact match to TCS211 binary object
Mychaela Falconia <falcon@freecalypso.org>
parents: 221
diff changeset
2123 // FreeCalypso TCS211 reconstruction: LoCosto change backed out
a4899cf67fd1 l1tm_async.c: reconstruction complete, exact match to TCS211 binary object
Mychaela Falconia <falcon@freecalypso.org>
parents: 221
diff changeset
2124 #if 0 //(CODE_VERSION == NOT_SIMULATION)
214
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2125 // In order to reduce the latency for the ETM command "rfe 4", make absolute_fn as
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2126 // next_time.fn+1. This was originally +100 because of which we had to wait for some
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2127 // time before L1 actually starts the TBF.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2128 free_set->tbf_sti.absolute_fn= l1s.next_time.fn + 1;
222
a4899cf67fd1 l1tm_async.c: reconstruction complete, exact match to TCS211 binary object
Mychaela Falconia <falcon@freecalypso.org>
parents: 221
diff changeset
2129 #else
a4899cf67fd1 l1tm_async.c: reconstruction complete, exact match to TCS211 binary object
Mychaela Falconia <falcon@freecalypso.org>
parents: 221
diff changeset
2130 // In PC simulation, keep the old +100 to keep output logs same as reference
a4899cf67fd1 l1tm_async.c: reconstruction complete, exact match to TCS211 binary object
Mychaela Falconia <falcon@freecalypso.org>
parents: 221
diff changeset
2131 free_set->tbf_sti.absolute_fn= l1s.next_time.fn + 100; // force to current FN+100
a4899cf67fd1 l1tm_async.c: reconstruction complete, exact match to TCS211 binary object
Mychaela Falconia <falcon@freecalypso.org>
parents: 221
diff changeset
2132 #endif
214
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2133
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2134 free_set->interf_meas_enable = FALSE; // Interference measurements disabled
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2135 free_set->pc_meas_chan = TRUE; // No measurement on the beacon (6 per MF52)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2136
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2137 // Allocation of both UL and DL time slots
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2138 free_set->dl_tbf_alloc.tfi = 1; // DL TFI ID
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2139 free_set->ul_tbf_alloc->tfi = 2; // UL TFI ID
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2140 #if (CODE_VERSION == SIMULATION)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2141 free_set->dl_tbf_alloc.timeslot_alloc = ((T_TMODE_PDTCH_ASSIGN_REQ *)(msg->SigP))->dl_ts_alloc;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2142 free_set->ul_tbf_alloc->timeslot_alloc = ((T_TMODE_PDTCH_ASSIGN_REQ *)(msg->SigP))->ul_ts_alloc;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2143 l1_config.tmode.stats_config.num_loops = ((T_TMODE_PDTCH_ASSIGN_REQ *)(msg->SigP))->ul_alloc_length;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2144 l1_config.tmode.rf_params.mon_tasks = ((T_TMODE_PDTCH_ASSIGN_REQ *)(msg->SigP))->mon_enable;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2145 l1_config.tmode.rf_params.mon_report = ((T_TMODE_PDTCH_ASSIGN_REQ *)(msg->SigP))->mon_enable;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2146 l1_config.tmode.rx_params.pm_enable = ((T_TMODE_PDTCH_ASSIGN_REQ *)(msg->SigP))->pm_enable;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2147 #else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2148 free_set->dl_tbf_alloc.timeslot_alloc = l1_config.tmode.rx_params.timeslot_alloc;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2149 free_set->ul_tbf_alloc->timeslot_alloc = l1_config.tmode.tx_params.timeslot_alloc;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2150 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2151 // free_set->ul_tbf_alloc->fixed_alloc.bitmap_length = l1_config.tmode.stats_config.num_loops;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2152 // force to 127
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2153 free_set->ul_tbf_alloc->fixed_alloc.bitmap_length = 127;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2154
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2155 // Init fixed allocation bitmap
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2156 for (i=0;i<free_set->ul_tbf_alloc->fixed_alloc.bitmap_length;i++)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2157 free_set->ul_tbf_alloc->fixed_alloc.bitmap[i] = free_set->ul_tbf_alloc->timeslot_alloc;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2158
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2159 free_set->allocated_tbf = BOTH_TBF;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2160
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2161 // Process the downlink TBF first allocated timeslot
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2162 timeslot_alloc = free_set->dl_tbf_alloc.timeslot_alloc;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2163 timeslot = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2164
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2165 while((timeslot<7) && !(timeslot_alloc & (0x80>>timeslot)))
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2166 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2167 timeslot++;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2168 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2169
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2170 free_set->dl_tbf_synchro_timeslot = timeslot;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2171
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2172 // Fill "synchro_timeslot" which will be the frame synchro slot.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2173 free_set->transfer_synchro_timeslot = timeslot;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2174
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2175 // save stats bitmap
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2176 stat_gprs_slots = l1_config.tmode.stats_config.stat_gprs_slots;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2177 // Adjust stats bit map
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2178 l1_config.tmode.stats_config.stat_gprs_slots <<= timeslot;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2179
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2180 // Process the uplink TBF first allocated timeslot
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2181 // Fixed mode: the 1st allocated timeslot is the downlink control
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2182 // timeslot allocated by the network, which is a timeslot allocated
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2183 // in uplink
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2184 timeslot_alloc = free_set->ul_tbf_alloc->timeslot_alloc;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2185
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2186 timeslot = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2187 while((timeslot<7) && !(timeslot_alloc & (0x80>>timeslot)))
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2188 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2189 timeslot++;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2190 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2191 // if UL synchro TS > DL synchro TS, then fixed alloc ctrl TS is the UL sync TS
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2192 // else fixed alloc ctrl TS is the DL sync TS
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2193 if (timeslot > free_set->dl_tbf_synchro_timeslot)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2194 free_set->ul_tbf_alloc->fixed_alloc.ctrl_timeslot = timeslot;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2195 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2196 free_set->ul_tbf_alloc->fixed_alloc.ctrl_timeslot = free_set->dl_tbf_synchro_timeslot;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2197
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2198 free_set->ul_tbf_synchro_timeslot = free_set->ul_tbf_alloc->fixed_alloc.ctrl_timeslot;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2199
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2200 // Init txpwr levels for multi slot TX
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2201 // txpwr[index] is calculated according to TX allocation given by MACS
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2202 // timeslot contains the first allocated TS in UL
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2203 for(i = timeslot; i < 8; i++)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2204 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2205 l1pa_l1ps_com.transfer.dl_pwr_ctrl.txpwr[i]
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2206 = l1_config.tmode.tx_params.txpwr_gprs[i];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2207 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2208
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2209 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2210 *state = WAIT_MSG;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2211
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2212 // Store signalcode.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2213 free_set->SignalCode = MPHP_ASSIGNMENT_REQ;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2214
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2215 // Clear transfer parameter semaphore to let L1S use the new parameters.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2216 l1pa_l1ps_com.transfer.semaphore = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2217
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2218 // end of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2219 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2220 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2221 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2222
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2223 default:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2224 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2225 //----------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2226 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2227 return;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2228 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2229 } // end switch(SignalCode)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2230 } // end case WAIT_INIT
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2231 case WAIT_MSG:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2232 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2233 switch(SignalCode)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2234 // switch on input message.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2235 //-------------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2236 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2237 case L1P_TRANSFER_DONE:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2238 // Switch to TRANSFER mode has been done.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2239 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2240 T_CRES_LIST_PARAM *free_list;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2241
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2242 // Set up TCR_MEAS task, if MON tasks are enabled set up FB26
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2243 if (l1_config.tmode.rf_params.mon_tasks == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2244 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2245 // Set FB26 task semaphore
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2246 l1a_l1s_com.task_param[FB26] = SEMAPHORE_SET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2247
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2248 // This process always use the first element of "nsync" structure.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2249 l1a_l1s_com.nsync.current_list_size = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2250 // l1a_l1s_com.nsync.list[0].radio_freq was set to mon_arfcn above
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2251 l1a_l1s_com.nsync.list[0].radio_freq = l1_config.tmode.rf_params.mon_arfcn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2252
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2253 // Enable FB detection during packet transfer
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2254 l1a_l1s_com.l1s_en_task[FB26] = TASK_ENABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2255 #if (L1_12NEIGH ==1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2256 //Set timing validity for FB no a priori info
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2257 l1a_l1s_com.nsync.list[0].timing_validity = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2258 // Enable neighbour sync 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2259 l1a_l1s_com.nsync.list[0].status = NSYNC_PENDING; //Used by l1s_schedule_tasks in l1_sync
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2260 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_ENABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2261 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2262 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2263
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2264 if (l1_config.tmode.rx_params.pm_enable)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2265 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2266 // Set parameter synchro semaphore for P_TCRMS_MEAS task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2267 l1pa_l1ps_com.meas_param |= P_TCRMS_MEAS;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2268
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2269 // Reset Neighbour Cell measurement parameters.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2270 l1pa_l1ps_com.tcr_freq_list.tcr_next_to_ctrl = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2271 l1pa_l1ps_com.tcr_freq_list.tcr_next_to_read = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2272
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2273 // Get Ptr to the free Neighbour meas list.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2274 // The number of carriers in the list and the list
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2275 // identification are initialized.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2276 free_list = l1pa_get_free_cres_list_set();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2277
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2278 // Download new list within T_CRES_LIST_PARAM structure.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2279 free_list->nb_carrier = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2280 free_list->freq_list[0] = l1_config.tmode.rf_params.mon_arfcn;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2281
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2282 free_list->list_id = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2283
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2284 // Set "flist" with Circuit Swithed BA frequency list parameters
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2285 l1pa_l1ps_com.cres_freq_list.alist = free_list;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2286
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2287 // Reset flags.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2288 l1pa_l1ps_com.tcr_freq_list.ms_ctrl = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2289 l1pa_l1ps_com.tcr_freq_list.ms_ctrl_d = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2290 l1pa_l1ps_com.tcr_freq_list.ms_ctrl_dd = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2291
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2292 // Reset measures made on beacon frequency.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2293 l1pa_l1ps_com.tcr_freq_list.beacon_meas = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2294
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2295 // Enable Packet Transfer Neighbour Measurement task.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2296 l1pa.l1pa_en_meas[TCR_MEAS] |= P_TCRMS_MEAS;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2297 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2298
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2299 // Flag packet transfer mode active
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2300 l1tm.tmode_state.packet_transfer_active = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2301
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2302 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2303 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2304 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2305 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2306
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2307 case TMODE_PDTCH_INFO:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2308 // TCH result messages.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2309 //-----------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2310 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2311 // Check if RX stats done in PDTCH
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2312 if (l1_config.tmode.rf_params.mon_report == 0)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2313 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2314 BOOL done;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2315
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2316 // loop and stats management done within this function
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2317 l1tm_stats_pdtch_confirm((T_TMODE_PDTCH_INFO *) (msg->SigP));
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2318
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2319 done = l1tm_is_rx_counter_done();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2320
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2321 if (done == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2322 // if done, send stop TBFs
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2323 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2324 // Rise transfer parameter semaphore to prevent L1S to use partial configuration.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2325 l1pa_l1ps_com.transfer.semaphore = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2326
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2327 // Enables the TBF release processing in L1S.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2328 l1pa_l1ps_com.transfer.tbf_release_param.tbf_release_cmd = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2329
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2330 // Download msg info into L1PA_L1PS_COM.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2331 l1pa_l1ps_com.transfer.tbf_release_param.released_tbf = BOTH_TBF;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2332
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2333 // Clear transfer parameter semaphore to let L1S use the new parameters.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2334 l1pa_l1ps_com.transfer.semaphore = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2335 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2336 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2337
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2338 // end of process
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2339 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2340 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2341 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2342
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2343 case L1C_FB_INFO:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2344 // MON result messages.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2345 //-----------------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2346 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2347 // Check if RX stats done in Monitor channel
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2348 if (l1_config.tmode.rf_params.mon_report == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2349 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2350 BOOL done;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2351
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2352 // loop and stats management done within this function
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2353 l1tm_stats_mon_confirm( (T_TMODE_FB_CON*) ((T_L1C_FB_INFO *) (msg->SigP)));
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2354
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2355 done = l1tm_is_rx_counter_done();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2356
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2357 if (done == 1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2358 // if done, send stop TBFs
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2359 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2360 // Rise transfer parameter semaphore to prevent L1S to use partial configuration.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2361 l1pa_l1ps_com.transfer.semaphore = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2362
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2363 // Enables the TBF release processing in L1S.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2364 l1pa_l1ps_com.transfer.tbf_release_param.tbf_release_cmd = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2365
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2366 // Download msg info into L1PA_L1PS_COM.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2367 l1pa_l1ps_com.transfer.tbf_release_param.released_tbf = BOTH_TBF;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2368
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2369 // Clear transfer parameter semaphore to let L1S use the new parameters.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2370 l1pa_l1ps_com.transfer.semaphore = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2371 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2372 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2373
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2374 // end of process
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2375 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2376 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2377 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2378
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2379 case TMODE_STOP_RX_TX:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2380 // TBF Release.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2381 //-------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2382 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2383 // Rise transfer parameter semaphore to prevent L1S to use partial configuration.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2384 l1pa_l1ps_com.transfer.semaphore = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2385
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2386 // Enables the TBF release processing in L1S.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2387 l1pa_l1ps_com.transfer.tbf_release_param.tbf_release_cmd = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2388
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2389 // Download msg info into L1PA_L1PS_COM.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2390 l1pa_l1ps_com.transfer.tbf_release_param.released_tbf = BOTH_TBF;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2391
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2392 // Clear transfer parameter semaphore to let L1S use the new parameters.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2393 l1pa_l1ps_com.transfer.semaphore = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2394
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2395 // end of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2396 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2397 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2398 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2399
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2400 case L1P_TBF_RELEASED:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2401 // TBF has been release by L1S.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2402 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2403 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2404 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2405 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2406
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2407 // Reset transfer active state
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2408 l1tm.tmode_state.packet_transfer_active = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2409
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2410 // Restore stats bitmap
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2411 l1_config.tmode.stats_config.stat_gprs_slots = stat_gprs_slots;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2412
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2413 #if (L1_12NEIGH ==1)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2414 l1a_l1s_com.l1s_en_task[NSYNC] = TASK_DISABLED;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2415 // Disable neighbour sync 0.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2416 l1a_l1s_com.nsync.list[0].status = NSYNC_FREE; //Used by l1s_schedule_tasks in l1_sync
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2417 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2418
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2419 // Step in state machine.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2420 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2421
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2422 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2423 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2424 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2425 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2426
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2427 default:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2428 // End of process.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2429 //----------------
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2430 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2431 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2432 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2433 } // end of switch(SignalCode)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2434 } // end of case WAIT_MSG.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2435 } // end of "switch".
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2436 } // end of "while"
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2437 } // end of procedure.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2438 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2439
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2440 #if ((L1_STEREOPATH == 1) && (OP_L1_STANDALONE == 1))
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2441 /*----------------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2442 /* l1a_tmode_audio_stereopath_process() */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2443 /*----------------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2444 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2445 /* Description: */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2446 /* ------------ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2447 /* This function is a state machine which handles the */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2448 /* stereopath feature. */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2449 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2450 /* Starting messages: TMODE_AUDIO_STEREOPATH_DRV_START_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2451 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2452 /* Result messages (input): L1_STEREOPATH_DRV_START_CON */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2453 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2454 /* Result messages (output): TMODE_AUDIO_STEREOPATH_DRV_START_CON */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2455 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2456 /* Reset messages (input): none */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2457 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2458 /* Stop message (input): TMODE_AUDIO_STEREOPATH_DRV_STOP_REQ */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2459 /* L1_STEREOPATH_DRV_STOP_CON */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2460 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2461 /* Stop message (output): TMODE_AUDIO_STEREOPATH_DRV_STOP_CON */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2462 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2463 /* Rem: */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2464 /* ---- */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2465 /* */
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2466 /*----------------------------------------------------------------*/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2467 void l1a_tmode_audio_stereopath_process(xSignalHeaderRec *msg)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2468 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2469 #if (CODE_VERSION == NOT_SIMULATION)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2470 enum states
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2471 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2472 RESET = 0,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2473 WAIT_START_REQ = 1,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2474 WAIT_START_CON = 2,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2475 WAIT_STOP = 3,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2476 WAIT_DSP_STOP = 4
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2477
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2478 };
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2479
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2480 UWORD8 *state = &l1a.state[TMODE_AUDIO_STEREOPATH_DRV_STATE];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2481 UWORD32 SignalCode = msg->SignalCode;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2482
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2483 static UWORD8 previous_config = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2484
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2485 BOOL end_process = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2486
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2487 while(!end_process)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2488 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2489 switch(*state)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2490 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2491 case RESET:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2492 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2493 // initialize global variable
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2494 l1tm.stereopath.stereopath_source_timeout = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2495 l1tm.stereopath.stereopath_dest_timeout = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2496 l1tm.stereopath.stereopath_drop = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2497 l1tm.stereopath.stereopath_frame = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2498 l1tm.stereopath.stereopath_block = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2499 l1tm.stereopath.stereopath_half_block = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2500 l1tm.stereopath.stereopath_current_sample = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2501 l1tm.stereopath.stereopath_buffer_number = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2502
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2503 // initialize ndb
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2504 stp_drv_ndb->d_cport_api_dma_install = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2505 stp_drv_ndb->d_cport_api_dma_channel = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2506 stp_drv_ndb->d_cport_api_dma_rootcause = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2507
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2508 // Init DSP background
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2509 l1s_dsp_com.dsp_ndb_ptr->a_background_tasks[C_BGD_STP_DRV] = (API)((C_BGD_STP_DRV<<11) | 1);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2510 if (l1s_dsp_com.dsp_ndb_ptr->d_max_background<(C_BGD_STP_DRV+1))
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2511 l1s_dsp_com.dsp_ndb_ptr->d_max_background=(API)(C_BGD_STP_DRV+1);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2512
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2513
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2514 *state = WAIT_START_REQ;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2515 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2516 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2517
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2518 case WAIT_START_REQ:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2519 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2520 if (SignalCode == TMODE_AUDIO_STEREOPATH_START_REQ)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2521 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2522 // receive a request to start stereopath
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2523 T_TMODE_AUDIO_STEREOPATH_START_REQ* tmode_audio_sp_conf_ptr;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2524
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2525 // Flag msg received
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2526 l1tm.tm_msg_received = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2527
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2528 /******************************************************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2529 /**************** GET STEREOPATH PARAMETERS ***********************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2530 /******************************************************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2531
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2532 if (((T_TMODE_AUDIO_STEREOPATH_START_REQ *)(msg->SigP))->configuration == AUDIO_SP_SELF_CONF)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2533 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2534 // no use of a predefined configuration, we have to get parameters from the message
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2535 tmode_audio_sp_conf_ptr = ((T_TMODE_AUDIO_STEREOPATH_START_REQ *)(msg->SigP));
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2536 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2537 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2538 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2539 UWORD8 conf_index = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2540
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2541 // use of a predefined configuration, we have to get parameters from the constant config
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2542 tmode_audio_sp_conf_ptr = (T_TMODE_AUDIO_STEREOPATH_START_REQ *) tmode_audio_sp_conf[conf_index];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2543
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2544 while ((tmode_audio_sp_conf_ptr != NULL) && (conf_index < NB_MAX_STEREOPATH_CONFIG))
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2545 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2546 if (tmode_audio_sp_conf_ptr->configuration == ((T_TMODE_AUDIO_STEREOPATH_START_REQ *)(msg->SigP))->configuration)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2547 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2548
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2549 tmode_audio_sp_conf_ptr = (T_TMODE_AUDIO_STEREOPATH_START_REQ *) tmode_audio_sp_conf[++conf_index];
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2550 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2551 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2552
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2553 if (tmode_audio_sp_conf_ptr == NULL)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2554 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2555 // unknow configuration identifier --> use message parameters
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2556 tmode_audio_sp_conf_ptr = ((T_TMODE_AUDIO_STEREOPATH_START_REQ *)(msg->SigP));
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2557 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2558
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2559 // Download the stereopath description in the l1a_l1s structure.
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2560 l1a_l1s_com.stereopath_drv_task.parameters.sampling_frequency = tmode_audio_sp_conf_ptr->sampling_frequency;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2561 l1a_l1s_com.stereopath_drv_task.parameters.DMA_allocation = tmode_audio_sp_conf_ptr->DMA_allocation;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2562 l1a_l1s_com.stereopath_drv_task.parameters.DMA_channel_number = tmode_audio_sp_conf_ptr->DMA_channel_number;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2563 l1a_l1s_com.stereopath_drv_task.parameters.data_type = tmode_audio_sp_conf_ptr->data_type;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2564 l1a_l1s_com.stereopath_drv_task.parameters.source_port = tmode_audio_sp_conf_ptr->source_port;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2565 l1a_l1s_com.stereopath_drv_task.parameters.element_number = tmode_audio_sp_conf_ptr->element_number;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2566 l1a_l1s_com.stereopath_drv_task.parameters.frame_number = tmode_audio_sp_conf_ptr->frame_number;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2567 l1a_l1s_com.stereopath_drv_task.parameters.mono_stereo = tmode_audio_sp_conf_ptr->mono_stereo;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2568 l1a_l1s_com.stereopath_drv_task.parameters.feature_identifier = AUDIO_SP_TESTS_ID;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2569
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2570 /******************************************************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2571 /**************** CHECK ALLOCATION DSP/MCU ************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2572 /******************************************************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2573
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2574 if (tmode_audio_sp_conf_ptr->DMA_allocation == AUDIO_SP_DMA_ALLOC_MCU)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2575 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2576 l1a_l1s_com.stereopath_drv_task.parameters.DMA_int_callback_fct = l1tm_stereopath_DMA_handler;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2577 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2578 else // DMA_allocation == AUDIO_SP_DMA_ALLOC_DSP
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2579 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2580 // Update ndb
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2581 stp_drv_ndb->d_cport_api_dma_install = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2582 stp_drv_ndb->d_cport_api_dma_channel = l1a_l1s_com.stereopath_drv_task.parameters.DMA_channel_number;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2583 stp_drv_ndb->d_cport_api_dma_rootcause = 0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2584
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2585 // start background task
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2586 l1s_dsp_com.dsp_ndb_ptr->d_background_enable|=(API)(1<<C_BGD_STP_DRV);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2587 l1_trigger_api_interrupt();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2588
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2589 l1a_l1s_com.stereopath_drv_task.parameters.DMA_int_callback_fct = f_dma_default_call_back_it;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2590 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2591
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2592 /******************************************************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2593 /**************** GENERATION OF THE PATTERN ***********************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2594 /******************************************************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2595
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2596 // Reservation and generation of the pattern used to fill the buffer
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2597 if (tmode_audio_sp_conf_ptr->pattern_identifier != AUDIO_SP_SILENCE_PATTERN)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2598 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2599 l1tm.stereopath.stereopath_pattern = (WORD8 *)l1tm_stereopath_buffer;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2600
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2601 // if pattern has already been build with the same config (mp3,midi or ext audio) in the current scenario,
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2602 // we don't do it again. This is to avoid to have a CPU overload during critical operation such as access or packet transfer
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2603 if ((tmode_audio_sp_conf_ptr->configuration == 0) || (tmode_audio_sp_conf_ptr->configuration != previous_config))
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2604 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2605 previous_config = tmode_audio_sp_conf_ptr->configuration;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2606 l1tm.stereopath.stereopath_nb_samples = l1tm_stereopath_get_pattern(l1tm_stereopath_sampling_freqs[tmode_audio_sp_conf_ptr->sampling_frequency],
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2607 l1tm_stereopath_sin_freqs[tmode_audio_sp_conf_ptr->pattern_identifier][0],
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2608 l1tm_stereopath_sin_freqs[tmode_audio_sp_conf_ptr->pattern_identifier][1],
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2609 tmode_audio_sp_conf_ptr->data_type);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2610 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2611 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2612 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2613 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2614 // Silence pattern, consider just 2 samples at the value 0
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2615 l1tm.stereopath.stereopath_nb_samples = 2;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2616
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2617 l1tm.stereopath.stereopath_pattern = (WORD8 *)l1tm_stereopath_buffer;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2618 l1tm.stereopath.stereopath_pattern[0] = l1tm.stereopath.stereopath_pattern[1] =
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2619 l1tm.stereopath.stereopath_pattern[2] = l1tm.stereopath.stereopath_pattern[3] = 0x0000;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2620 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2621
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2622 /******************************************************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2623 /**************** GET ADDRESS OF THE BUFFER ***********************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2624 /******************************************************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2625 #if (CHIPSET == 15)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2626 if (tmode_audio_sp_conf_ptr->source_port == AUDIO_SP_SOURCE_EMIF)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2627 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2628 // get an address in internal RAM
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2629 l1a_l1s_com.stereopath_drv_task.parameters.source_buffer_address = (WORD8*) TM_stereo_buf_ext_mem;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2630 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2631
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2632
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2633 if (tmode_audio_sp_conf_ptr->source_port == AUDIO_SP_SOURCE_IMIF)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2634 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2635 // get an address in internal RAM
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2636 l1a_l1s_com.stereopath_drv_task.parameters.source_buffer_address = (WORD8*) TM_stereo_buf;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2637 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2638
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2639 if (tmode_audio_sp_conf_ptr->source_port == AUDIO_SP_SOURCE_API)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2640 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2641 // Disable DSP trace
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2642 l1s_dsp_com.dsp_ndb_ptr->d_debug_trace_type &= 0xfff0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2643 l1s_dsp_com.dsp_ndb_ptr->d_debug_trace_type |= 0x8000;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2644
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2645 l1a_l1s_com.stereopath_drv_task.parameters.source_buffer_address = (WORD8*)API_address_dsp2mcu(C_STP_DRV_BUF_API_BASE_ADDRESS);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2646 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2647 #else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2648 if (tmode_audio_sp_conf_ptr->source_port == AUDIO_SP_SOURCE_IMIF)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2649 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2650 // get an address in internal RAM
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2651 l1a_l1s_com.stereopath_drv_task.parameters.source_buffer_address = (WORD8*) TM_stereo_buf;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2652 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2653 else // source_port == AUDIO_SP_SOURCE_API
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2654 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2655 // Disable DSP trace
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2656 l1s_dsp_com.dsp_ndb_ptr->d_debug_trace_type &= 0xfff0;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2657 l1s_dsp_com.dsp_ndb_ptr->d_debug_trace_type |= 0x8000;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2658
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2659 l1a_l1s_com.stereopath_drv_task.parameters.source_buffer_address = (WORD8*)API_address_dsp2mcu(C_STP_DRV_BUF_API_BASE_ADDRESS);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2660 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2661 #endif
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2662
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2663 /******************************************************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2664 /**************** FILL THE 2 FIRST BUFFERS ************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2665 /******************************************************************/
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2666
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2667 l1tm_stereopath_fill_buffer((void*) l1a_l1s_com.stereopath_drv_task.parameters.source_buffer_address);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2668 l1tm_stereopath_fill_buffer((void*) l1a_l1s_com.stereopath_drv_task.parameters.source_buffer_address);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2669
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2670 // Start the L1S stereopath task
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2671 l1a_l1s_com.stereopath_drv_task.command.start = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2672
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2673 *state = WAIT_START_CON;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2674 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2675
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2676 // End process
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2677 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2678 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2679 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2680
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2681 case WAIT_START_CON:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2682 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2683 if (SignalCode == L1_STEREOPATH_DRV_START_CON)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2684 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2685 // Send the start confirmation message
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2686 l1a_audio_send_confirmation(TMODE_AUDIO_STEREOPATH_START_CON);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2687
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2688 *state = WAIT_STOP;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2689 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2690
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2691 // End process
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2692 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2693 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2694 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2695
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2696 case WAIT_STOP:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2697 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2698 if (SignalCode == TMODE_AUDIO_STEREOPATH_STOP_REQ)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2699 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2700 if (l1a_l1s_com.stereopath_drv_task.parameters.DMA_allocation == AUDIO_SP_DMA_ALLOC_DSP)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2701 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2702 // we first need to stop the DSP background task
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2703 stp_drv_ndb->d_cport_api_dma_install = 0xFFFF;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2704 l1_trigger_api_interrupt();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2705
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2706 *state = WAIT_DSP_STOP;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2707 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2708 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2709 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2710 // Stop the L1S stereopath task
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2711 l1a_l1s_com.stereopath_drv_task.command.stop = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2712
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2713 // End process
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2714 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2715 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2716 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2717 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2718 if (SignalCode == L1_STEREOPATH_DRV_STOP_CON)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2719 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2720 // Reset TM msg flag
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2721 // No new L1S result messages may be received before a new TM command
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2722 l1tm.tm_msg_received = FALSE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2723
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2724 free(l1tm.stereopath.stereopath_pattern);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2725
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2726 // Send the stop confirmation message
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2727 l1a_audio_send_confirmation(TMODE_AUDIO_STEREOPATH_STOP_CON);
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2728
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2729 *state = RESET;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2730 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2731 else
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2732 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2733 // End process
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2734 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2735 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2736 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2737 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2738
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2739 case WAIT_DSP_STOP:
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2740 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2741 if (stp_drv_ndb->d_cport_api_dma_install == 0)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2742 {
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2743 // stop the DSP background task
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2744 l1s_dsp_com.dsp_ndb_ptr->d_background_enable&=(API)(~(1<<C_BGD_STP_DRV));
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2745 l1_trigger_api_interrupt();
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2746
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2747 // Stop the L1S stereopath task
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2748 l1a_l1s_com.stereopath_drv_task.command.stop = TRUE;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2749
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2750 *state = WAIT_STOP;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2751
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2752 end_process = 1;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2753 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2754 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2755 break;
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2756 } // switch
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2757 } // while(!end_process)
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2758 #endif // CODE_VERSION == NOT_SIMULATION
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2759 }
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2760 #endif // #if ((L1_STEREOPATH == 1) && (OP_L1_STANDALONE == 1))
370fb4862df8 l1tm_async.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2761 #endif