FreeCalypso > hg > fc-magnetite
comparison src/g23m-fad/l2r/l2r_dnp.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_dnp.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_DNP_C | |
24 #define L2R_DNP_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_dti_dn_tx_buffer_full_ind | |
62 +------------------------------------------------------------------------------ | |
63 | Description : Process signal DTI_REASON_TX_BUFFER_FULL received from | |
64 | dti library callback function. | |
65 | | |
66 | Parameters : - | |
67 | | |
68 | Return : - | |
69 +------------------------------------------------------------------------------ | |
70 The buffer function of DTILIB is not used. | |
71 So there is nothing to be done here yet.. | |
72 */ | |
73 GLOBAL void sig_dti_dn_tx_buffer_full_ind() | |
74 { | |
75 TRACE_FUNCTION ("sig_dti_dn_tx_buffer_full_ind()"); | |
76 } | |
77 | |
78 | |
79 /* | |
80 +------------------------------------------------------------------------------ | |
81 | Function : sig_dti_dn_tx_buffer_ready_ind | |
82 +------------------------------------------------------------------------------ | |
83 | Description : Process signal DTI_REASON_TX_BUFFER_READY received from | |
84 | dti library callback function. | |
85 | | |
86 | Parameters : - | |
87 | | |
88 | Return : - | |
89 +------------------------------------------------------------------------------ | |
90 */ | |
91 GLOBAL void sig_dti_dn_tx_buffer_ready_ind() | |
92 { | |
93 T_DN *ddn = &l2r_data->dn; | |
94 | |
95 TRACE_FUNCTION ("sig_dti_dn_tx_buffer_ready_ind()"); | |
96 | |
97 if(ddn->Brk_dti_data_ind NEQ NULL) | |
98 { | |
99 /* | |
100 * if there is a pending break indication to be sent via dti, | |
101 * send it now and go waiting for the next flow control primitive | |
102 */ | |
103 SET_STATE (DN_UL, IW_WAIT); | |
104 sig_mgt_dn_send_break_req(); | |
105 return; | |
106 } | |
107 | |
108 switch (GET_STATE (DN)) | |
109 { | |
110 case DN_CONNECTED: | |
111 if (!ddn->DtiConnected) /*jk: data send only when DTI connected*/ | |
112 break; | |
113 | |
114 if ((ddn->RiBu.idx.filled AND ddn->ULFlow EQ FL_INACTIVE) OR ddn->ReportMrgFlow) | |
115 { | |
116 dn_send_data_ind(); /* primitive is in ring buffer or flow state must be reported*/ | |
117 } | |
118 else | |
119 { | |
120 SET_STATE (DN_UL, IW_WAIT); /* no primitive is ready */ | |
121 } | |
122 | |
123 dn_cond_free_prims(); | |
124 dn_check_flow(); | |
125 | |
126 switch (GET_STATE (DN_LL)) | |
127 { | |
128 case IW_IDLE: | |
129 dn_cond_req_data(); | |
130 break; | |
131 } | |
132 break; | |
133 } | |
134 } | |
135 | |
136 GLOBAL void dn_rlp_data_ind(T_RLP_DATA_IND *rlp_data_ind) | |
137 { | |
138 T_DN *ddn = &l2r_data->dn; | |
139 | |
140 T_PRIM_INDEX frames; | |
141 T_PRIM_INDEX emptyfr; | |
142 T_PRIM_INDEX r_index; | |
143 BOOL break_found; | |
144 T_BIT sa; | |
145 T_BIT sb; | |
146 T_FLOW flow_brk; | |
147 T_FLOW flow_gen; | |
148 | |
149 TRACE_FUNCTION ("dn_rlp_data_ind()"); | |
150 PACCESS (rlp_data_ind); | |
151 | |
152 switch (GET_STATE (DN)) | |
153 { | |
154 case DN_CONNECTED: | |
155 case DN_WAIT_FIRST_DATA: | |
156 dn_scan_break_req | |
157 ( | |
158 rlp_data_ind, | |
159 &break_found, | |
160 &r_index, | |
161 &frames, | |
162 &emptyfr, | |
163 &sa, | |
164 &sb, | |
165 &flow_brk, | |
166 &flow_gen | |
167 ); | |
168 | |
169 if (break_found EQ FALSE) | |
170 { | |
171 if (frames > 0) | |
172 { | |
173 if (GET_STATE (DN) EQ DN_WAIT_FIRST_DATA AND sb EQ 0) | |
174 { | |
175 sig_dn_mgt_first_data_ind(); | |
176 SET_STATE (DN, DN_CONNECTED); | |
177 } | |
178 dn_store_status(flow_gen); /* stores flow ctrl state only */ | |
179 dn_store_prim(rlp_data_ind, 0); /* L2R-ENH-7527 quick fix */ | |
180 } | |
181 else | |
182 { | |
183 dn_cond_report_status(); | |
184 PFREE (rlp_data_ind); | |
185 } | |
186 } | |
187 else /* break found */ | |
188 { | |
189 dn_free_all_prims(); | |
190 dn_init_ribu(); | |
191 dn_check_flow(); | |
192 | |
193 if (r_index EQ frames) | |
194 { | |
195 dn_store_status(flow_brk); | |
196 PFREE (rlp_data_ind); | |
197 } | |
198 else | |
199 { | |
200 dn_store_status(flow_gen); | |
201 dn_store_prim(rlp_data_ind, r_index); | |
202 } | |
203 sig_dn_mgt_break_ind(sa, sb, ddn->MrgFlow); | |
204 ddn->LastState = sa << SO_SA_BIT | sb << SO_SB_BIT; | |
205 } | |
206 dn_cond_req_data(); | |
207 break; | |
208 } | |
209 } | |
210 |