comparison src/g23m-fad/l2r/l2r_upp.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_upp.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 primitives for the component
19 | L2R of the base station
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef L2R_UPP_C
24 #define L2R_UPP_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 /*==== TYPES =======================================================*/
51 /*==== VAR EXPORT ==================================================*/
52 /*==== VAR LOCAL ===================================================*/
53 /*==== FUNCTIONS ===================================================*/
54
55 /*
56 +------------------------------------------------------------------------------
57 | Function : sig_dti_up_data_received_ind
58 +------------------------------------------------------------------------------
59 | Description : Process primitive DTI2_DATA_REQ received from CSDIWF.
60 |
61 | Parameters : dti_data_req -
62 |
63 |
64 | Return : -
65 +------------------------------------------------------------------------------
66 */
67
68 GLOBAL void sig_dti_up_data_received_ind(T_DTI2_DATA_REQ *dti_data_req)
69 {
70 T_UP *dup = &l2r_data->up;
71
72 TRACE_FUNCTION ("sig_dti_up_data_received_ind()");
73
74 PACCESS (dti_data_req);
75
76 switch (GET_STATE (UP))
77 {
78 case UP_CONNECTED:
79 {
80 if (GET_STATE (DTI) NEQ DTI_CLOSED)
81 {
82 /*
83 * do not send flow control primitives automatically
84 */
85 dti_stop(l2r_hDTI, L2R_DTI_UP_DEF_INSTANCE, L2R_DTI_UP_INTERFACE, L2R_DTI_UP_CHANNEL);
86 }
87
88 SET_STATE (UP_UL, IW_IDLE);
89 dup->Prim = dti_data_req;
90
91 /* detect break request */
92 if (dup->Prim->parameters.st_lines.st_break_len NEQ DTI_BREAK_OFF)
93 {
94 sig_up_mgt_break_ind(dup->Prim);
95 }
96 else
97 {
98 up_store_data();
99 }
100
101 switch (GET_STATE (UP_LL))
102 {
103 case ISW_WAIT:
104 if (dup->LLFlow EQ FL_INACTIVE AND dup->RiBu.idx.filled)
105 {
106 /* L_UDR_1 */
107 TIMERSTOP (TIMER_TUP_SND);
108 up_send_current_prim();
109
110 if (!dup->RiBu.idx.filled)
111 {
112 SET_STATE (UP_LL, ISW_IDLE);
113 }
114 else
115 {
116 SET_STATE (UP_LL, ISW_SEND);
117 }
118 }
119 else
120 {
121 /* L_UDR_2 */
122 if( dup->LastSentFlow EQ dup->MrgFlow )
123 return;
124
125 TIMERSTOP (TIMER_TUP_SND);
126
127 switch (dup->LLFlow)
128 {
129 case FL_INACTIVE:
130 up_send_prim_timeout();
131 break;
132
133 case FL_ACTIVE:
134 up_send_empty_frame(dup->LastSentSa, dup->LastSentSb, dup->MrgFlow);
135 break;
136 }
137
138 if (!dup->RiBu.idx.filled)
139 {
140 SET_STATE (UP_LL, ISW_IDLE);
141 }
142 else
143 {
144 SET_STATE (UP_LL, ISW_SEND);
145 }
146 }
147 break;
148
149 default:
150 if (!dup->RiBu.idx.filled) /* no primitive is ready */
151 return;
152
153 /* L_UDR3 */
154 up_check_flow();
155 up_check_alloc();
156 SET_STATE (UP_LL, ISW_SEND);
157 break;
158 }
159 break;
160 }
161 }
162 }
163
164 /*
165 +------------------------------------------------------------------------------
166 | Function : up_rlp_ready_ind
167 +------------------------------------------------------------------------------
168 | Description : Process primitive RLP_READY_IND received from RLP.
169 |
170 | Parameters : rlp_ready_ind -
171 |
172 |
173 | Return : -
174 +------------------------------------------------------------------------------
175 */
176
177 GLOBAL void up_rlp_ready_ind(T_RLP_READY_IND *rlp_ready_ind)
178 {
179 T_UP *dup = &l2r_data->up;
180
181 TRACE_FUNCTION ("rlp_ready_ind()");
182 PACCESS (rlp_ready_ind);
183
184 switch (GET_STATE (UP))
185 {
186 case UP_CONNECTED:
187 switch (GET_STATE (UP_LL))
188 {
189 case ISW_SEND:
190 if (dup->LLFlow EQ FL_INACTIVE OR dup->UrgentMsg)
191 {
192 up_send_current_prim();
193 if (!dup->RiBu.idx.filled)
194 {
195 SET_STATE (UP_LL, ISW_IDLE);
196 }
197 }
198 else
199 {
200 if (dup->LastSentFlow NEQ dup->MrgFlow)
201 {
202 up_send_empty_frame(dup->LastSentSa, dup->LastSentSb, dup->MrgFlow);
203 }
204 else
205 {
206 SET_STATE (UP_LL, ISW_WAIT);
207 TIMERSTART(TIMER_TUP_SND, LL_TO);
208 }
209 }
210 break;
211
212 default:
213 SET_STATE (UP_LL, ISW_WAIT);
214 TIMERSTART(TIMER_TUP_SND, LL_TO);
215 break;
216 }
217 break;
218
219 case UP_REMAP:
220 SET_STATE (UP_LL, ISW_WAIT);
221 break;
222 }
223 PFREE (rlp_ready_ind);
224 }
225