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