comparison src/g23m-gsm/rr/rr_fors.c @ 104:27a4235405c6

src/g23m-gsm: import from LoCosto source
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 04 Oct 2016 18:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
103:76d139c7a25e 104:27a4235405c6
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul :
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 : Encoding of Air Interface Messages. Send AIMs to DL.
18 +-----------------------------------------------------------------------------
19 */
20
21 #ifndef RR_FORS_C
22 #define RR_FORS_C
23
24 #define ENTITY_RR
25
26 /*==== INCLUDES ===================================================*/
27
28 #include <string.h>
29 #include <stdlib.h>
30 #include "typedefs.h"
31 #include "pcm.h"
32 #include "pconst.cdg"
33 #include "mconst.cdg"
34 #include "message.h"
35 #include "ccdapi.h"
36 #include "vsi.h"
37 #include "custom.h"
38 #include "gsm.h"
39 #include "prim.h"
40 #include "tok.h"
41 #include "rr.h"
42
43 /*==== EXPORT =====================================================*/
44
45 /*==== PRIVAT =====================================================*/
46
47 /*==== VARIABLES ==================================================*/
48
49 /*==== FUNCTIONS ==================================================*/
50
51 /*
52 * -------------------------------------------------------------------
53 * SIGNAL Processing functions
54 * -------------------------------------------------------------------
55 */
56
57 /*
58 +--------------------------------------------------------------------+
59 | PROJECT : GSM-PS (6147) MODULE : RR_FOR |
60 | STATE : code ROUTINE : for_dat_encode_send |
61 +--------------------------------------------------------------------+
62
63 PURPOSE : Encode an Air Interface Message usinf CCD and send it do DL.
64
65 */
66
67 LOCAL void for_dat_encode_send (void *prim, T_sdu *sdu)
68 {
69 U8 *payload;
70 U16 length;
71
72 if ( sdu NEQ NULL )
73 {
74 ccd_codeMsg (CCDENT_RR, UPLINK, (T_MSGBUF *)sdu, _decodedMsg, NOT_PRESENT_8BIT);
75
76 sdu->buf[sdu->o_buf/8-1] = PD_RR_TI_0; /* RR Protocol Discriminator, Skip Indicator */
77 sdu->l_buf += 8;
78 sdu->o_buf -= 8;
79
80 payload = &(sdu->buf[0]); /* Beginning of the buffer */
81 payload += (sdu->o_buf) >> 3; /* Plus offset (bytes) */
82
83 length = BYTELEN(sdu->l_buf); /* Length (bytes) */
84
85 RR_BINDUMP (payload,length,ARFCN_NOT_PRESENT,
86 FRAME_NUM_NOT_PRESENT,UPLINK);
87 }
88
89 PSENDX (DL, prim);
90 }
91
92 /*
93 +--------------------------------------------------------------------+
94 | PROJECT : GSM-PS (6147) MODULE : RR_FOR |
95 | STATE : code ROUTINE : for_dat_data_req |
96 +--------------------------------------------------------------------+
97
98 PURPOSE : Encoding of a Layer 3 message and forwarding to Layer 2.
99
100 */
101
102 GLOBAL void for_dat_data_req (T_DL_DATA_REQ *dl_data_req)
103 {
104 TRACE_FUNCTION ("for_dat_data_req()");
105 for_dat_encode_send ( dl_data_req, &dl_data_req->sdu );
106 }
107
108 /*
109 +--------------------------------------------------------------------+
110 | PROJECT : GSM-PS (6147) MODULE : RR_FOR |
111 | STATE : code ROUTINE : for_dat_est_req |
112 +--------------------------------------------------------------------+
113
114 PURPOSE : Start establishment for SMS on SAPI 3.
115
116 */
117
118 GLOBAL void for_dat_est_req (T_DL_ESTABLISH_REQ *dl_establish_req)
119 {
120 TRACE_FUNCTION ("for_dat_est_req()");
121 dl_establish_req->sdu.l_buf = 0;
122 dl_establish_req->sdu.o_buf = ENCODE_OFFSET;
123 for_dat_encode_send ( dl_establish_req, NULL );
124 }
125
126 /*
127 +--------------------------------------------------------------------+
128 | PROJECT : GSM-PS (6147) MODULE : RR_FOR |
129 | STATE : code ROUTINE : for_dat_est_req_not_coding |
130 +--------------------------------------------------------------------+
131
132 PURPOSE : Start a connection for an upper layer.
133
134 */
135
136 GLOBAL void for_dat_est_req_not_coding (T_DL_ESTABLISH_REQ *dl_establish_req)
137 {
138 TRACE_FUNCTION ("for_dat_est_req_not_coding()");
139 for_dat_encode_send ( dl_establish_req, NULL );
140 }
141
142 /*
143 +--------------------------------------------------------------------+
144 | PROJECT : GSM-PS (6147) MODULE : RR_FOR |
145 | STATE : code ROUTINE : for_dat_est_req_content |
146 +--------------------------------------------------------------------+
147
148 PURPOSE : Start a connection with a layer 3 message from RR.
149
150 */
151
152 GLOBAL void for_dat_est_req_content (T_DL_ESTABLISH_REQ *dl_establish_req)
153 {
154 TRACE_FUNCTION ("for_dat_est_req_content()");
155 for_dat_encode_send ( dl_establish_req, &dl_establish_req->sdu );
156 }
157
158 /*
159 +--------------------------------------------------------------------+
160 | PROJECT : GSM-PS (6147) MODULE : RR_FOR |
161 | STATE : code ROUTINE : for_dat_l3_data_req |
162 +--------------------------------------------------------------------+
163
164 PURPOSE : send an upper layer message to layer 2.
165
166 */
167
168 GLOBAL void for_dat_l3_data_req (T_DL_DATA_REQ *dl_data_req)
169 {
170 TRACE_FUNCTION ("for_dat_l3_data_req()");
171 for_dat_encode_send ( dl_data_req, NULL );
172 }
173
174 /*
175 +--------------------------------------------------------------------+
176 | PROJECT : GSM-PS (6147) MODULE : RR_FOR |
177 | STATE : code ROUTINE : for_dat_reconnect_req |
178 +--------------------------------------------------------------------+
179
180 PURPOSE : After a failed handover or channel assignment RR
181 switches back to the old channel. This function starts
182 the reconnection of the layer 2 link.
183
184 */
185
186 GLOBAL void for_dat_reconnect_req (T_DL_RECONNECT_REQ *dl_reconnect_req)
187 {
188 TRACE_FUNCTION ("for_dat_reconnect_req()");
189 TRACE_EVENT ("DL_RECONNECT_REQ");
190 for_dat_encode_send ( dl_reconnect_req, &dl_reconnect_req->sdu );
191 }
192
193 /*
194 +--------------------------------------------------------------------+
195 | PROJECT : GSM-PS (6147) MODULE : RR_FOR |
196 | STATE : code ROUTINE : for_dat_resume_req |
197 +--------------------------------------------------------------------+
198
199 PURPOSE : After reception of a handover command or assignment command
200 message, layer 1 is configured to a new channel and the
201 layer 2 link is resumed.
202
203 */
204
205 GLOBAL void for_dat_resume_req (T_DL_RESUME_REQ *dl_resume_req)
206 {
207 TRACE_FUNCTION ("for_dat_resume_req()");
208 for_dat_encode_send ( dl_resume_req, &dl_resume_req->sdu );
209 }
210
211 /*
212 +--------------------------------------------------------------------+
213 | PROJECT : GSM-PS (6147) MODULE : RR_FOR |
214 | STATE : code ROUTINE : for_dat_unitdata_req |
215 +--------------------------------------------------------------------+
216
217 PURPOSE : Send an unacknowledged message on the uplink SACCH.
218 This message is a measurement report message from RR.
219
220 */
221
222 GLOBAL void for_dat_unitdata_req (T_DL_UNITDATA_REQ *dl_unitdata_req)
223 {
224 TRACE_FUNCTION ("for_dat_unitdata_req()");
225 for_dat_encode_send ( dl_unitdata_req, &dl_unitdata_req->sdu );
226 }
227
228 #if defined (REL99) && defined (TI_PS_FF_EMR)
229 /*
230 +--------------------------------------------------------------------+
231 | PROJECT : GSM-PS (6147) MODULE : RR_FOR |
232 | STATE : code ROUTINE : for_dat_spd_unitdata_req |
233 +--------------------------------------------------------------------+
234
235 PURPOSE : Send an unacknowledged message on the uplink SACCH with short PD.
236 This is a enhanced measurement report message from RR.
237
238 */
239
240 GLOBAL void for_dat_spd_unitdata_req (T_DL_SHORT_UNITDATA_REQ *p_msg)
241 {
242 T_sdu *sdu = &p_msg->sdu;
243 TRACE_FUNCTION ("for_dat_spd_unitdata_req()");
244 if ( sdu NEQ NULL )
245 {
246 ccd_codeMsg (CCDENT_RR_SHORT, UPLINK, (T_MSGBUF *)sdu, _decodedMsg, NOT_PRESENT_8BIT);
247 }
248 p_msg->ch_type=L2_CHANNEL_SACCH;
249 PSENDX (DL, p_msg);
250 }
251
252 /*
253 +--------------------------------------------------------------------+
254 | PROJECT : GSM-PS (6147) MODULE : RR_FOR |
255 | STATE : code ROUTINE : for_dat_process_common_emr_data |
256 +--------------------------------------------------------------------+
257
258 PURPOSE : DAT process requests FOR for processing the common EMR
259 parameters
260 */
261
262 GLOBAL BOOL for_dat_process_common_emr_data (T_gprs_rep_prio *p_rep,
263 T_gprs_bsic *p_bl,
264 UBYTE msg_index,
265 BOOL ba_available)
266 {
267 TRACE_FUNCTION ("for_dat_process_common_emr_data()");
268 return(for_process_common_emr_data ( p_rep,p_bl,msg_index, ba_available));
269 }
270
271 /*
272 +--------------------------------------------------------------------+
273 | PROJECT : GSM-PS (6147) MODULE : RR_FOR |
274 | STATE : code ROUTINE : for_att_update_ba2bsic_mapping |
275 +--------------------------------------------------------------------+
276
277 PURPOSE :
278 */
279 GLOBAL void for_att_update_ba2bsic_mapping(T_rr_enh_para *p_enh)
280 {
281 GET_INSTANCE_DATA;
282 UBYTE i;
283 USHORT *p_list = rr_data->act_ncell_list;
284 T_enh_cell_list *p_enh_list = p_enh->enh_para.enh_cell_list;
285
286 for (i = 0; i < p_enh->enh_para.num_valid_cells ; i++ )
287 {
288 if ( (((p_enh->ba2bsic_map_pending >> i) & 0x1) EQ TRUE) AND
289 ( p_list[(UBYTE)p_enh_list[i].arfcn] NEQ NOT_PRESENT_16BIT ) )
290 p_enh_list[i].arfcn = p_list[(UBYTE)p_enh_list[i].arfcn];
291
292 }
293 p_enh->ba2bsic_map_pending = 0;
294 return;
295 }
296 #endif
297 #endif