annotate src/g23m-gsm/alr2/alr_rach.c @ 303:f76436d19a7a default tip

!GPRS config: fix long-standing AT+COPS chance hanging bug There has been a long-standing bug in FreeCalypso going back years: sometimes in the AT command bring-up sequence of an ACI-only MS, the AT+COPS command would produce only a power scan followed by cessation of protocol stack activity (only L1 ADC traces), instead of the expected network search sequence. This behaviour was seen in different FC firmware versions going back to Citrine, and seemed to follow some law of chance, not reliably repeatable. This bug has been tracked down and found to be specific to !GPRS configuration, stemming from our TCS2/TCS3 hybrid and reconstruction of !GPRS support that was bitrotten in TCS3.2/LoCosto version. ACI module psa_mms.c, needed only for !GPRS, was missing in the TCS3 version and had to be pulled from TCS2 - but as it turns out, there is a new field in the MMR_REG_REQ primitive that needs to be set correctly, and that psa_mms.c module is the place where this initialization needed to be added.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 08 Jun 2023 08:23:37 +0000
parents 3a14ee9a9843
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 +-----------------------------------------------------------------------------
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 | Project : GSM-PS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 | Modul : ALR_RACH
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 +-----------------------------------------------------------------------------
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 | Copyright 2002 Texas Instruments Berlin, AG
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 | All rights reserved.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 | This file is confidential and a trade secret of Texas
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 | Instruments Berlin, AG
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 | The receipt of or possession of this file does not convey
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 | any rights to reproduce or disclose its contents or to
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 | manufacture, use, or sell anything it may describe, in
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 | whole, or in part, without the specific written consent of
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 | Texas Instruments Berlin, AG.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 +-----------------------------------------------------------------------------
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 | Purpose : This Modul defines the SDL process RACH_Control.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 +-----------------------------------------------------------------------------
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 #ifndef ALR_RACH_C
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #define ALR_RACH_C
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #define ENTITY_PL
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 /*==== INCLUDES ===================================================*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 #include <string.h>
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #include <stdlib.h>
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 #include <ctype.h>
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #include "typedefs.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #include "pconst.cdg"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #include "mconst.cdg"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #include "message.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 #include "ccdapi.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 #include "vsi.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #include "custom.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 #include "gsm.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 #include "prim.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 #include "cnf_alr.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 #include "mon_alr.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 #include "pei.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 #include "tok.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 #include "pcm.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 #include "alr_gprs.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 #include "alr.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 #include "alr_em.h"
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 /*==== EXPORT =====================================================*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 /*==== PRIVAT =====================================================*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 /*==== VARIABLES ==================================================*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 #if defined (WIN32)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 #define TRACING
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 #if defined (TRACING)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 #define ALR_TRACE_RACH(a) ALR_TRACE(a)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 #else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 #define ALR_TRACE_RACH(a)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 #if defined (TRACING)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 #define ALR_TRACE_RACH_CLASS(x) TRACE_EVENT_P1 ("class %d",x)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 #define ALR_TRACE_RACH_POWER(p) TRACE_EVENT_P1 ("configured power = %d", p)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 #else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 #define ALR_TRACE_RACH_CLASS(x)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 #define ALR_TRACE_RACH_POWER(p)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 /*==== FUNCTIONS ==================================================*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 | PROJECT : GSM-PS (6103) MODULE : ALR_RACH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 | STATE : code ROUTINE : rach_init |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 PURPOSE : Initialize RACH Control Process.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 GLOBAL void rach_init (void)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 alr_data->state[STATE_RA] = RA_NULL;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 | PROJECT : GSM-PS (6103) MODULE : ALR_RACH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 | STATE : code ROUTINE : rach_configure_class |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 PURPOSE : Process signal rach_configure_class from SDL process
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 Main_Control.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 GLOBAL void rach_configure_class (UBYTE ms_class,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 UBYTE dcs_class)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 * +1 because of interface difference between RR and TI
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 alr_data->rach_data.ms_class = (UBYTE)(ms_class + 1);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 alr_data->rach_data.dcs_class = (UBYTE)(dcs_class + 1);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 ALR_TRACE_RACH_CLASS (alr_data->rach_data.ms_class);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 | PROJECT : GSM-PS (6103) MODULE : ALR_RACH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 | STATE : code ROUTINE : rach_configure_power |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 PURPOSE : Process signal rach_configure_power from SDL process
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 Main_Control.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 GLOBAL void rach_configure_power (UBYTE power)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 ALR_TRACE_RACH_POWER(power);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 alr_data->rach_data.max_tx_pwr_ccch = power;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 | PROJECT : GSM-PS (6103) MODULE : ALR_RACH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 | STATE : code ROUTINE : rach_stop |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 PURPOSE : Process signal rach_stop from SDL process
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 Main_Control.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 GLOBAL void rach_stop (void)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 switch (GET_STATE (STATE_RA))
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 case RA_ACTIVE:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 ma_rach_stop_ra_req ();
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 /*lint -fallthrough*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 case RA_LISTEN_TO_CCCH:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 SET_STATE (STATE_RA, RA_NULL);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 default:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 | PROJECT : GSM-PS (6103) MODULE : ALR_RACH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 | STATE : code ROUTINE : rach_random_req |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 PURPOSE : Process signal rach_random_req from SDL process
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 Main_Control.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 GLOBAL void rach_random_req (T_MPH_RANDOM_ACCESS_REQ *random_req)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 switch (GET_STATE (STATE_RA))
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175 case RA_NULL:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 if (random_req->send_mode.no NEQ 0)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 PALLOC (ra_req, MPHC_RA_REQ);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 ALR_EM_START_CONNECTION_ESTABLISHMENT;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 * Start Random Burst Sending
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 memcpy (alr_data->rach_data.delta, random_req->send_mode.delta,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 sizeof (alr_data->rach_data.delta));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 memcpy (alr_data->rach_data.channel_request,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 random_req->send_mode.rach,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 sizeof (alr_data->rach_data.channel_request));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 alr_data->rach_data.max_bursts = random_req->send_mode.no;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 alr_data->rach_data.c_burst = 0;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193 * power limitation
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 ra_req->txpwr = cut_power_value (alr_data->rach_data.max_tx_pwr_ccch, NULL);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 ra_req->powerclass_gsm = alr_data->rach_data.ms_class;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 ra_req->powerclass_dcs = alr_data->rach_data.dcs_class;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 * Modification: Add 1 to the time of RR !!!!
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
202 ra_req->rand = (UBYTE)(alr_data->rach_data.delta[alr_data->rach_data.c_burst]+1);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203 ra_req->channel_request = alr_data->rach_data.channel_request[alr_data->rach_data.c_burst++];
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204 SET_STATE (STATE_RA, RA_ACTIVE);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205 ma_rach_ra_req (ra_req);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 case RA_ACTIVE:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210 if (random_req->send_mode.no EQ 0)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 ALR_EM_STOP_CONNECTION_ESTABLISHMENT;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 SET_STATE (STATE_RA, RA_LISTEN_TO_CCCH);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 ma_rach_stop_ra_req ();
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220 /*stop to be safe */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221 ma_rach_stop_ra_req ();
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 PALLOC (ra_req, MPHC_RA_REQ);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 ALR_EM_START_CONNECTION_ESTABLISHMENT;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 * Start Random Burst Sending
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230 memcpy (alr_data->rach_data.delta, random_req->send_mode.delta,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 sizeof (alr_data->rach_data.delta));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232 memcpy (alr_data->rach_data.channel_request,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 random_req->send_mode.rach,
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234 sizeof (alr_data->rach_data.channel_request));
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 alr_data->rach_data.max_bursts = random_req->send_mode.no;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236 alr_data->rach_data.c_burst = 0;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238 * power limitation
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
240 ra_req->txpwr = cut_power_value (alr_data->rach_data.max_tx_pwr_ccch, NULL);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
241 ra_req->powerclass_gsm = alr_data->rach_data.ms_class;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242 ra_req->powerclass_dcs = alr_data->rach_data.dcs_class;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
244 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245 * Modification: Add 1 to the time of RR !!!!
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
247 ra_req->rand = (UBYTE)(alr_data->rach_data.delta[alr_data->rach_data.c_burst]+1);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248 ra_req->channel_request = alr_data->rach_data.channel_request[alr_data->rach_data.c_burst++];
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249 SET_STATE (STATE_RA, RA_ACTIVE);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 ma_rach_ra_req (ra_req);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 } /*PALLOC*/
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252 } /* if */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 default:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 | PROJECT : GSM-PS (6103) MODULE : ALR_RACH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262 | STATE : code ROUTINE : rach_ra_cnf |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 PURPOSE : Process signal rach_ra_cnf from SDL process
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 Main_Control.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270 GLOBAL void rach_ra_cnf (T_MPHC_RA_CON *ra_cnf)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 UBYTE c_burst = alr_data->rach_data.c_burst-1; /* confirmed index */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 switch (GET_STATE (STATE_RA))
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 case RA_ACTIVE:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 PALLOC (random_cnf, MPH_RANDOM_ACCESS_CNF);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
280 ra_cnf->fn %= 42432L;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281 #ifdef GPRS
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282 alr_data->rach_data.t1[c_burst] =
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 random_cnf->frame_no.t1=
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284 (UBYTE)((ra_cnf->fn / 1326) % 32);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285 alr_data->rach_data.t2[c_burst] =
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 random_cnf->frame_no.t2=
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287 (UBYTE)(ra_cnf->fn % 26);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 alr_data->rach_data.t3[c_burst] =
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 random_cnf->frame_no.t3=
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290 (UBYTE)(ra_cnf->fn % 51);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291 #else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 random_cnf->frame_no.t1= (UBYTE)((ra_cnf->fn / 1326) % 32);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 random_cnf->frame_no.t2= (UBYTE)(ra_cnf->fn % 26);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
294 random_cnf->frame_no.t3= (UBYTE)(ra_cnf->fn % 51);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295 #endif
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296 ma_rach_random_cnf (random_cnf);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298 c_burst++; /* next index */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299 if (c_burst >= alr_data->rach_data.max_bursts)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 {/* last index ? */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301 SET_STATE (STATE_RA, RA_LISTEN_TO_CCCH);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302 ma_rach_stop_ra_req ();
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 #if !defined(TNNN_WITH_TIMER)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304 ma_fake_rr_report();
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 #endif /* !TNNN_WITH_TIMER */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
307 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
308 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
309 PALLOC (ra_req, MPHC_RA_REQ);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
310
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312 * power limitation
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
314 ra_req->txpwr = cut_power_value (alr_data->rach_data.max_tx_pwr_ccch, NULL);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
315 ra_req->powerclass_gsm = alr_data->rach_data.ms_class;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316 ra_req->powerclass_dcs = alr_data->rach_data.dcs_class;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
319 * Modification: Add 1 to the time of RR !!!!
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
320 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
321 ra_req->rand = (UBYTE)(alr_data->rach_data.delta[c_burst]+1);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
322 ra_req->channel_request = alr_data->rach_data.channel_request[c_burst];
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
323 ma_rach_ra_req (ra_req);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
324 alr_data->rach_data.c_burst++; /* the next index */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
325 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
326 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
327 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
328 default:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
329 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
330 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
331 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
332
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
333
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
334
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
335 /*
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
336 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
337 | PROJECT : GSM-PS (6103) MODULE : ALR_RACH |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
338 | STATE : code ROUTINE : cut_power_value |
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
339 +--------------------------------------------------------------------+
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
340
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
341 PURPOSE : Cut the nominal maximum output power to the
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
342 associated power class.
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
343 (Reference for the tables with the associated
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
344 power classes, control levels and nominal output power
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
345 is 3GPP TS 05.05, 4.1)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
346
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
347 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
348
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
349 GLOBAL UBYTE cut_power_value (UBYTE power, T_MPH_DEDICATED_REQ *mph_dedicated_req)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
350 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
351 UBYTE new_power = power;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
352 UBYTE sc_band;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
353
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
354 if(mph_dedicated_req == NULL)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
355 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
356 sc_band = alr_data->sc_band;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
357 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
358 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
359 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
360 if(mph_dedicated_req->ch_type.h)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
361 sc_band = get_band(mph_dedicated_req->ch_type.ma[0]);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
362 else
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
363 sc_band = get_band(mph_dedicated_req->ch_type.arfcn);
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
364 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
365
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
366 switch (sc_band)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
367 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
368 case BAND_GSM_900:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
369 case BAND_E_GSM:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
370 case BAND_GSM_850:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
371 switch (alr_data->rach_data.ms_class)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
372 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
373 case POW_CLASS_1: /* doesn´t exist */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
374 case POW_CLASS_2: /* power class 2, 8W, 39 dBm, level 0..2 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
375 /* highest level allowed => no cut necessary */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
376 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
377 case POW_CLASS_3: /* power class 3, 5W, 37 dBm, level 3 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
378 if (new_power < 3)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
379 new_power = 3;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
380 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
381 case POW_CLASS_4: /* power class 4, 2W, 33 dBm, level 5 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
382 if (new_power < 5)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
383 new_power = 5;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
384 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
385 case POW_CLASS_5: /* power class 5, 0.8W, 29 dBm, level 7 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
386 if (new_power < 7)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
387 new_power = 7;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
388 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
389 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
390 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
391 case BAND_DCS_1800:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
392 switch (alr_data->rach_data.dcs_class)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
393 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
394 case POW_CLASS_1: /* power class 1, 1W, 30 dBm, level 0 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
395 if (new_power > 28)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
396 new_power = 0;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
397 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
398 case POW_CLASS_2: /* power class 2, 0.25W, 24 dBm, level 3 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
399 if (!INRANGE (3, new_power, 28))
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
400 new_power = 3;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
401 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
402 case POW_CLASS_3: /* power class 3, 4W, 36 dBm , level 29 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
403 /* highest level allowed => no cut necessary */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
404 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
405 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
406 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
407 case BAND_PCS_1900:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
408 switch (alr_data->rach_data.dcs_class)
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
409 {
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
410 case POW_CLASS_1: /* power class 1, 1W, 30 dBm, level 0 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
411 if (!INRANGE (0, new_power, 15))
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
412 new_power = 0;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
413 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
414 case POW_CLASS_2: /* power class 2, 0.25W, 24 dBm, level 3 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
415 if (!INRANGE (3, new_power, 15))
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
416 new_power = 3;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
417 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
418 default:
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
419 case POW_CLASS_3: /* power class 3, 2W, 33 dBm , level 30 */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
420 /* highest level allowed => no cut necessary */
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
421 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
422 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
423 break;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
424 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
425 return new_power;
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
426 }
3a14ee9a9843 src/g23m-gsm: same alr2 & alr3 structure as in Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
427 #endif