comparison src/g23m-fad/l2r/l2r_dns.c @ 1:d393cd9bb723

src/g23m-*: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
0:b6a5e36de839 1:d393cd9bb723
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : CSD (8411)
4 | Modul : L2r_dns.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 functions for processing
18 | of incomming signals for the component
19 | L2R of the base station
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef L2R_DNS_C
24 #define L2R_DNS_C
25 #endif
26
27 #define ENTITY_L2R
28
29 /*==== INCLUDES ===================================================*/
30
31 #include <string.h>
32 #include "typedefs.h"
33 #include "pconst.cdg"
34 #include "vsi.h"
35 #include "macdef.h"
36 #include "custom.h"
37 #include "gsm.h"
38 #include "cus_l2r.h"
39 #include "cnf_l2r.h"
40 #include "mon_l2r.h"
41 #include "prim.h"
42 #include "pei.h"
43 #include "tok.h"
44 #include "dti.h" /* functionality of the dti library */
45
46 #include "cl_ribu.h"
47 #include "l2r.h"
48
49 /*==== CONST =======================================================*/
50
51 /*==== TYPES =======================================================*/
52
53 /*==== VAR EXPORT ==================================================*/
54
55 /*==== VAR LOCAL ===================================================*/
56
57 /*==== FUNCTIONS ===================================================*/
58
59 /*
60 +------------------------------------------------------------------------------
61 | Function : sig_mgt_dn_conn_req
62 +------------------------------------------------------------------------------
63 | Description : Process signal SIG_MGT_DN_CONN_REQ received
64 | from process management.
65 |
66 | Parameters : flowCtrlUsed -
67 | riBuSize -
68 | inst_id -
69 |
70 |
71 | Return :
72 +------------------------------------------------------------------------------
73 */
74
75 GLOBAL void sig_mgt_dn_conn_req
76 (
77 BOOL flowCtrlUsed,
78 T_PRIM_DESC_RIBU_SIZE riBuSize,
79 UBYTE inst_id
80 )
81 {
82 T_DN *ddn = &l2r_data->dn;
83
84 TRACE_FUNCTION ("sig_mgt_dn_conn_req()");
85
86 switch (GET_STATE (DN))
87 {
88 case DN_DISCONNECTED:
89 {
90 PALLOC (rlp_getdata_req, RLP_GETDATA_REQ);
91
92 ddn->FlowCtrlUsed = flowCtrlUsed;
93 ddn->InstID = inst_id;
94
95 if (riBuSize > MAX_DPRIM_RIBU_SIZE)
96 {
97 ddn->RiBu.idx.depth = MAX_DPRIM_RIBU_SIZE;
98 }
99 else
100 {
101 ddn->RiBu.idx.depth = riBuSize;
102 }
103
104 dn_init_ribu();
105
106 ddn->FlowThresh = ddn->RiBu.idx.depth >> 1;
107
108 ddn->DnFlow = FL_INACTIVE;
109 ddn->UpFlow = FL_INACTIVE;
110 ddn->ULFlow = FL_INACTIVE;
111 ddn->LLFlow = FL_INACTIVE;
112 dn_merge_flow();
113
114 ddn->ReportMrgFlow = FALSE;
115
116 PSENDX (RLP, rlp_getdata_req);
117
118 SET_STATE (DN_LL, IW_WAIT);
119 SET_STATE (DN_UL, IW_IDLE);
120 SET_STATE (DN, DN_WAIT_FIRST_DATA);
121 break;
122 }
123 }
124 }
125
126 /*
127 +------------------------------------------------------------------------------
128 | Function : sig_mgt_dn_disc_req
129 +------------------------------------------------------------------------------
130 | Description : Process signal SIG_MGT_DN_DISC_REQ received
131 | from process management.
132 |
133 |
134 | Parameters : -
135 |
136 |
137 | Return : -
138 +------------------------------------------------------------------------------
139 */
140
141 GLOBAL void sig_mgt_dn_disc_req(void)
142 {
143 TRACE_FUNCTION ("sig_mgt_dn_disc_req()");
144
145 if (GET_STATE (DN) EQ DN_CONNECTED)
146 {
147 dn_free_all_prims();
148 SET_STATE(DN, DN_DISCONNECTED);
149 }
150 }
151
152 /*
153 +------------------------------------------------------------------------------
154 | Function : sig_mgt_dn_break_req
155 +------------------------------------------------------------------------------
156 | Description : Process signal SIG_MGT_DN_BREAK_REQ received
157 | from process management.
158 |
159 |
160 | Parameters : -
161 |
162 |
163 | Return : -
164 +------------------------------------------------------------------------------
165 */
166
167 GLOBAL void sig_mgt_dn_break_req(void)
168 {
169 TRACE_FUNCTION ("sig_mgt_dn_break_req()");
170
171 if (GET_STATE (DN) EQ DN_CONNECTED)
172 {
173 dn_free_all_prims();
174 dn_init_ribu();
175 dn_check_flow();
176 }
177 }
178
179 /*
180 +------------------------------------------------------------------------------
181 | Function : sig_mgt_dn_clear_req
182 +------------------------------------------------------------------------------
183 | Description : Process signal SIG_MGT_DN_CLEAR_REQ received
184 | from process management.
185 |
186 | Parameters : -
187 |
188 |
189 | Return : -
190 +------------------------------------------------------------------------------
191 */
192
193 GLOBAL void sig_mgt_dn_clear_req(void)
194 {
195 TRACE_FUNCTION ("sig_mgt_dn_clear_req()");
196
197 if (GET_STATE (DN) EQ DN_CONNECTED)
198 {
199 dn_free_all_prims();
200 dn_init_ribu();
201 dn_check_flow();
202 }
203 }
204
205 /*
206 +------------------------------------------------------------------------------
207 | Function : sig_mgt_dn_reconn_req
208 +------------------------------------------------------------------------------
209 | Description : Process signal SIG_MGT_DN_RECONN_REQ received
210 | from process management.
211 |
212 | Parameters : -
213 |
214 |
215 | Return : -
216 +------------------------------------------------------------------------------
217 */
218
219 GLOBAL void sig_mgt_dn_reconn_req(void)
220 {
221 TRACE_FUNCTION ("sig_mgt_dn_reconn_req()");
222
223 if (GET_STATE (DN) EQ DN_CONNECTED)
224 {
225 PALLOC (rlp_getdata_req, RLP_GETDATA_REQ);
226 PSENDX (RLP, rlp_getdata_req);
227 SET_STATE (DN_LL, IW_WAIT);
228 }
229 }
230
231 /*
232 +------------------------------------------------------------------------------
233 | Function : sig_mgt_dn_dti_conn_setup
234 +------------------------------------------------------------------------------
235 | Description : Process signal SIG_MGT_DN_DTI_CONN_SETUP
236 | received from process management.
237 |
238 | Parameters : link_id channel id of the link
239 |
240 | Return : -
241 +------------------------------------------------------------------------------
242 */
243
244 GLOBAL void sig_mgt_dn_dti_conn_setup (ULONG link_id)
245 {
246 TRACE_FUNCTION ("sig_mgt_dn_dti_conn_setup()");
247
248 l2r_data->dn.link_id = link_id;
249 SET_STATE (DN_UL, IW_IDLE); /* jk: to IDLE in order to be able to respond with DTI_GETDATA_REQ */
250 }
251
252 /*
253 +------------------------------------------------------------------------------
254 | Function : sig_up_dn_flow
255 +------------------------------------------------------------------------------
256 | Description : Process signal SIG_UP_DN_FLOW received
257 | from process uplink.
258 |
259 | Parameters : flow -
260 |
261 |
262 | Return :
263 +------------------------------------------------------------------------------
264 */
265
266 GLOBAL void sig_up_dn_flow(T_FLOW flow)
267 {
268 if (flow EQ FL_ACTIVE)
269 {
270 TRACE_FUNCTION ("sig_up_dn_flow(ACTIVE)");
271 }
272 else
273 {
274 TRACE_FUNCTION ("sig_up_dn_flow(INACTIVE)");
275 }
276
277 if (GET_STATE (DN) EQ DN_CONNECTED)
278 {
279 T_FLOW oldFlow = l2r_data->dn.UpFlow;
280 l2r_data->dn.UpFlow = flow;
281
282 if (flow NEQ oldFlow)
283 {
284 dn_merge_flow();
285 }
286 dn_cond_report_status();
287 }
288 }
289
290 /*
291 +------------------------------------------------------------------------------
292 | Function : sig_up_dn_ul_flow
293 +------------------------------------------------------------------------------
294 | Description : Process signal SIG_UP_DN_UL_FLOW received
295 | from process uplink.
296 |
297 |
298 | Parameters : flow -
299 |
300 |
301 | Return :
302 +------------------------------------------------------------------------------
303 */
304
305 GLOBAL void sig_up_dn_ul_flow(T_FLOW flow)
306 {
307 if (flow EQ FL_ACTIVE)
308 {
309 TRACE_FUNCTION ("sig_up_dn_ul_flow(ACTIVE)");
310 }
311 else
312 {
313 TRACE_FUNCTION ("sig_up_dn_ul_flow(INACTIVE)");
314 }
315
316 if (GET_STATE (DN) EQ DN_CONNECTED)
317 {
318 l2r_data->dn.ULFlow = flow;
319 if (l2r_data->dn.ULFlow EQ FL_INACTIVE AND GET_STATE (DN_UL) EQ IW_WAIT
320 AND l2r_data->dn.DtiConnected /*jk: data send only when DTI connected*/
321 )
322 {
323 dn_send_data_ind();
324 SET_STATE (DN_UL, IW_IDLE);
325 }
326 }
327 }
328
329 /*
330 +------------------------------------------------------------------------------
331 | Function : sig_mgt_dn_send_break_req
332 +------------------------------------------------------------------------------
333 | Description : Process signal SIG_MGT_DN_SEND_BREAK_REQ received
334 | from process uplink.
335 |
336 |
337 | Parameters : -
338 |
339 |
340 | Return : -
341 +------------------------------------------------------------------------------
342 */
343
344 GLOBAL void sig_mgt_dn_send_break_req(void)
345 {
346 TRACE_FUNCTION ("sig_mgt_dn_send_break_req");
347
348 switch (GET_STATE (DN))
349 {
350 case DN_CONNECTED:
351 case DN_WAIT_FIRST_DATA:
352 /*
353 * processing for state MGT_CONNECTED
354 */
355 if (l2r_data->dn.Brk_dti_data_ind NEQ NULL && GET_STATE (DN_UL) EQ IW_WAIT)
356 {
357 dti_send_data (
358 l2r_hDTI,
359 L2R_DTI_UP_DEF_INSTANCE,
360 L2R_DTI_UP_INTERFACE,
361 L2R_DTI_UP_CHANNEL,
362 l2r_data->dn.Brk_dti_data_ind
363 );
364 SET_STATE (DN_UL, IW_IDLE);
365 /* do not send it twice .. */
366 l2r_data->dn.Brk_dti_data_ind = NULL;
367 }
368 break;
369 default:
370 TRACE_ERROR ("[sig_mgt_dn_send_break_req] unexpected state");
371 break;
372 }
373 }