FreeCalypso > hg > fc-magnetite
comparison src/g23m-fad/l2r/l2r_mgtf.c @ 174:90eb61ecd093
src/g23m-fad: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 12 Oct 2016 05:40:46 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
173:bf64d785238a | 174:90eb61ecd093 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : CSD (8411) | |
4 | Modul : L2r_mgtf.c | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : This Modul defines the procedures and functions for | |
18 | the component L2R of the base station | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef L2R_MGTF_C | |
23 #define L2R_MGTF_C | |
24 #endif | |
25 | |
26 #define ENTITY_L2R | |
27 | |
28 /*==== INCLUDES ===================================================*/ | |
29 | |
30 #include <string.h> | |
31 #include "typedefs.h" | |
32 #include "pconst.cdg" | |
33 #include "vsi.h" | |
34 #include "macdef.h" | |
35 #include "custom.h" | |
36 #include "gsm.h" | |
37 #include "cus_l2r.h" | |
38 #include "cnf_l2r.h" | |
39 #include "mon_l2r.h" | |
40 #include "prim.h" | |
41 #include "pei.h" | |
42 #include "tok.h" | |
43 #include "dti.h" /* functionality of the dti library */ | |
44 | |
45 #include "cl_ribu.h" | |
46 #include "l2r.h" | |
47 | |
48 /*==== CONST =======================================================*/ | |
49 | |
50 /*==== TYPES =======================================================*/ | |
51 | |
52 /*==== VAR EXPORT ==================================================*/ | |
53 | |
54 /*==== VAR LOCAL ===================================================*/ | |
55 | |
56 /*==== FUNCTIONS ===================================================*/ | |
57 | |
58 /* | |
59 +------------------------------------------------------------------------------ | |
60 | Function : mgt_init | |
61 +------------------------------------------------------------------------------ | |
62 | Description : initialise the l2r data for the management process | |
63 | | |
64 | Parameters : - | |
65 | | |
66 | | |
67 | Return : - | |
68 +------------------------------------------------------------------------------ | |
69 */ | |
70 | |
71 GLOBAL void mgt_init(T_MGT *dmgt) | |
72 { | |
73 TRACE_FUNCTION ("mgt_init()"); | |
74 | |
75 dmgt->FlowCtrlUsed = FALSE; | |
76 dmgt->RiBuSize = 0; | |
77 dmgt->ConnectPrimType = L2R_CONNECT_IND; | |
78 dmgt->Connected = FALSE; | |
79 | |
80 INIT_STATE (CONIND, IW_IDLE); | |
81 INIT_STATE (BREAK, IW_IDLE); | |
82 INIT_STATE (MGT, MGT_DETACHED); | |
83 } | |
84 | |
85 /* | |
86 +------------------------------------------------------------------------------ | |
87 | Function : mgt_deinit_connection | |
88 +------------------------------------------------------------------------------ | |
89 | Description : is called when L2R is disconnected | |
90 | | |
91 | Parameters : - | |
92 | | |
93 | | |
94 | Return : - | |
95 +------------------------------------------------------------------------------ | |
96 */ | |
97 | |
98 GLOBAL void mgt_deinit_connection(void) | |
99 { | |
100 | |
101 TRACE_FUNCTION ("mgt_deinit_connection()"); | |
102 | |
103 if (l2r_data->mgt.Connected) | |
104 { | |
105 l2r_data->mgt.Connected = FALSE; | |
106 sig_mgt_dn_disc_req(); | |
107 sig_mgt_up_disc_req(); | |
108 } | |
109 } | |
110 | |
111 /* | |
112 +------------------------------------------------------------------------------ | |
113 | Function : mgt_checkpar | |
114 +------------------------------------------------------------------------------ | |
115 | Description : Checks the parameter values of an l2r_activate_req | |
116 | | |
117 | | |
118 | Parameters : ar - | |
119 | | |
120 | | |
121 | Return : TRUE - | |
122 | FALSE - | |
123 +------------------------------------------------------------------------------ | |
124 */ | |
125 | |
126 GLOBAL BOOL mgt_checkpar(T_L2R_ACTIVATE_REQ *ar) | |
127 { | |
128 TRACE_FUNCTION ("mgt_checkpar()"); | |
129 | |
130 /*lint -e568 -e685 operator > always evaluates to false non-negative quantity is never less than zero */ | |
131 if ( | |
132 ar->k_ms_iwf > L2R_K_MS_IWF_MAX OR | |
133 | |
134 ar->k_iwf_ms > L2R_K_IWF_MS_MAX OR | |
135 | |
136 ar->t2 > L2R_T2_MAX OR | |
137 | |
138 ar->n2 < L2R_N2_MIN OR | |
139 ar->n2 > L2R_N2_MAX OR | |
140 | |
141 ar->pt > L2R_PT_MAX OR | |
142 | |
143 #ifndef _SIMULATION_ | |
144 ar->p0 > L2R_P0_MAX OR | |
145 #endif | |
146 ar->p1 < L2R_P1_MIN OR | |
147 ar->p1 > L2R_P1_MAX OR | |
148 | |
149 ar->p2 < L2R_P2_MIN OR | |
150 ar->p2 > L2R_P2_MAX OR | |
151 | |
152 ar->bytes_per_prim < L2R_BYTES_PER_PRIM_MIN OR | |
153 ar->bytes_per_prim > L2R_BYTES_PER_PRIM_MAX OR | |
154 | |
155 ar->buffer_size < L2R_BUFFER_SIZE_MIN OR | |
156 ar->buffer_size > L2R_BUFFER_SIZE_MAX OR | |
157 | |
158 ar->t1 > L2R_T1_MAX | |
159 ) | |
160 /*lint +e568 +e685 operator > always evaluates to false non-negative quantity is never less than zero */ | |
161 { | |
162 return (FALSE); | |
163 } | |
164 | |
165 if ( | |
166 ar->uil2p NEQ L2R_ISO6429 AND | |
167 ar->uil2p NEQ L2R_COPnoFlCt | |
168 ) | |
169 { | |
170 return (FALSE); | |
171 } | |
172 | |
173 switch (ar->rate) | |
174 { | |
175 case L2R_FULLRATE_14400: | |
176 if (ar->t1 < L2R_T1_MIN_FULLRATE_14400) | |
177 { | |
178 return (FALSE); | |
179 } | |
180 break; | |
181 | |
182 case L2R_FULLRATE_9600: | |
183 if (ar->t1 < L2R_T1_MIN_FULLRATE_9600) | |
184 { | |
185 return (FALSE); | |
186 } | |
187 break; | |
188 | |
189 case L2R_FULLRATE_4800: | |
190 if (ar->t1 < L2R_T1_MIN_FULLRATE_4800) | |
191 { | |
192 return (FALSE); | |
193 } | |
194 break; | |
195 | |
196 case L2R_HALFRATE_4800: | |
197 if (ar->t1 < L2R_T1_MIN_HALFRATE_4800) | |
198 { | |
199 return (FALSE); | |
200 } | |
201 break; | |
202 | |
203 default: | |
204 return (FALSE); | |
205 } | |
206 | |
207 /* Finally its really true: all parameters are valid */ | |
208 return (TRUE); | |
209 } | |
210 | |
211 /* | |
212 +------------------------------------------------------------------------------ | |
213 | Function : mgt_init_connection | |
214 +------------------------------------------------------------------------------ | |
215 | Description : | |
216 | | |
217 | Parameters : indication - | |
218 | | |
219 | | |
220 | Return : - | |
221 +------------------------------------------------------------------------------ | |
222 */ | |
223 | |
224 | |
225 GLOBAL void mgt_init_connection(BOOL indication) | |
226 { | |
227 T_MGT *dmgt = &l2r_data->mgt; | |
228 | |
229 TRACE_FUNCTION ("mgt_init_connection()"); | |
230 | |
231 SET_STATE (BREAK, IW_IDLE); | |
232 sig_mgt_dn_conn_req | |
233 ( | |
234 dmgt->FlowCtrlUsed, | |
235 dmgt->RiBuSize, | |
236 dmgt->InstID | |
237 ); | |
238 if (indication) | |
239 { | |
240 dmgt->ConnectPrimType = L2R_CONNECT_IND; | |
241 } | |
242 else | |
243 { | |
244 dmgt->ConnectPrimType = L2R_CONNECT_CNF; | |
245 } | |
246 sig_mgt_up_conn_req | |
247 ( | |
248 dmgt->FramesPerPrim, | |
249 dmgt->FrameSize, | |
250 dmgt->FlowCtrlUsed, | |
251 dmgt->RiBuSize, | |
252 dmgt->InstID | |
253 ); | |
254 dmgt->Connected = TRUE; | |
255 } | |
256 | |
257 /* | |
258 +------------------------------------------------------------------------------ | |
259 | Function : mgt_send_l2r_error_ind | |
260 +------------------------------------------------------------------------------ | |
261 | Description : | |
262 | | |
263 | Parameters : cause - | |
264 | | |
265 | | |
266 | Return : - | |
267 +------------------------------------------------------------------------------ | |
268 */ | |
269 | |
270 GLOBAL void mgt_send_l2r_error_ind(USHORT cause) | |
271 { | |
272 PALLOC (l2r_error_ind, L2R_ERROR_IND); | |
273 | |
274 TRACE_FUNCTION ("mgt_send_l2r_error_ind()"); | |
275 | |
276 l2r_error_ind->cause = cause; | |
277 PSENDX (CTRL, l2r_error_ind); | |
278 mgt_deinit_connection(); | |
279 } | |
280 |