comparison gsm-fw/g23m-gsm/rr/rr_gprs.c @ 673:2f7df7a314f8

gsm-fw/g23m-gsm subtree: initial import from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 28 Sep 2014 23:20:04 +0000
parents
children
comparison
equal deleted inserted replaced
672:0dc6f9e8e980 673:2f7df7a314f8
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 : This module holds the functions for handling primitives
18 | sent from entity GRR to entity RR and vice versa.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef RR_GPRS_C
23 #define RR_GPRS_C
24
25 #ifdef GPRS
26
27 #define ENTITY_RR
28
29 /*==== INCLUDES ===================================================*/
30
31 #include <string.h>
32 #include <stddef.h>
33 #include "typedefs.h"
34 #include "pcm.h"
35 #include "pconst.cdg"
36 #include "mconst.cdg"
37 #include "message.h"
38 #include "ccdapi.h"
39 #include "vsi.h"
40 #include "custom.h"
41 #include "gsm.h"
42 #include "prim.h"
43 #include "cnf_rr.h"
44 #include "pei.h"
45 #include "tok.h"
46 #include "rr_gprs.h"
47 #include "rr.h"
48
49 /*==== EXPORT =====================================================*/
50
51 /*==== PRIVATE =====================================================*/
52 LOCAL void pei_not_supported (void *data);
53
54 /*==== VARIABLES ==================================================*/
55
56 /*==== FUNCTIONS ==================================================*/
57
58 LOCAL const T_FUNC rrgrr_table[] = {
59 MAK_FUNC_0( dat_rrgrr_channel_req, RRGRR_CHANNEL_REQ ), /* 0*/
60 MAK_FUNC_0( dat_rrgrr_resumed_tbf_req, RRGRR_RESUMED_TBF_REQ ), /* 1*/
61 MAK_FUNC_S( dat_rrgrr_data_req, RRGRR_DATA_REQ ), /* 2*/
62 MAK_FUNC_0( att_rrgrr_start_mon_ccch_req, RRGRR_START_MON_CCCH_REQ ), /* 3*/
63 MAK_FUNC_0( att_rrgrr_stop_mon_ccch_req, RRGRR_STOP_MON_CCCH_REQ ), /* 4*/
64 MAK_FUNC_0( att_rrgrr_cr_req, RRGRR_CR_REQ ), /* 5*/
65 MAK_FUNC_0( att_rrgrr_start_mon_bcch_req, RRGRR_START_MON_BCCH_REQ ), /* 6*/
66 MAK_FUNC_0( dat_rrgrr_rr_est_req, RRGRR_RR_EST_REQ ), /* 7*/
67 MAK_FUNC_0( dat_rrgrr_rr_est_rsp, RRGRR_RR_EST_RSP ), /* 8*/
68 MAK_FUNC_N( pei_not_supported, 0 ), /* 9*/
69 MAK_FUNC_0( dat_rrgrr_activate_req, RRGRR_ACTIVATE_REQ ), /* A*/
70 MAK_FUNC_N( pei_not_supported, 0 ), /* B*/
71 MAK_FUNC_0( dat_rrgrr_gprs_data_req, RRGRR_GPRS_DATA_REQ ), /* C*/
72 MAK_FUNC_0( dat_rrgrr_suspend_dcch_req, RRGRR_SUSPEND_DCCH_REQ ), /* D*/
73 MAK_FUNC_0( dat_rrgrr_reconnect_dcch_req, RRGRR_RECONNECT_DCCH_REQ ), /* E*/
74 MAK_FUNC_0( att_check_bsic, RRGRR_NCELL_SYNC_REQ ), /* F*/
75 MAK_FUNC_0( att_gprs_sync_req, RRGRR_SYNC_REQ ), /* 10*/
76 MAK_FUNC_N( pei_not_supported, 0 ), /* 11*/
77 MAK_FUNC_0( att_rrgrr_update_ba_req, RRGRR_UPDATE_BA_REQ ), /* 12*/
78 MAK_FUNC_N( att_rrgrr_meas_rep_req, RRGRR_MEAS_REP_REQ ), /* 13*/
79 MAK_FUNC_N( pei_not_supported, RRGRR_TBF_ESTABLISHED_REQ ), /* 14*/
80 MAK_FUNC_0( att_gprs_cr_rsp, RRGRR_CR_RSP ), /* 15*/
81 MAK_FUNC_0( att_rrgrr_ext_meas_req, RRGRR_EXT_MEAS_REQ ), /* 16*/
82 MAK_FUNC_0( att_rrgrr_ext_meas_stop_req, RRGRR_EXT_MEAS_STOP_REQ ), /* 17*/
83 MAK_FUNC_0( gprs_rrgrr_stop_task, RRGRR_STOP_TASK_REQ ), /* 18*/
84 MAK_FUNC_0( att_gprs_start_task, RRGRR_START_TASK_REQ ), /* 19*/
85 MAK_FUNC_0( att_rrgrr_standby_ind, RRGRR_STANDBY_STATE_IND ), /* 1A*/
86 MAK_FUNC_0( att_rrgrr_ready_ind, RRGRR_READY_STATE_IND ) /* 1B*/
87 #ifdef REL99
88 ,
89 MAK_FUNC_0( att_rrgrr_cbch_info_ind, RRGRR_CBCH_INFO_IND ) /* 1C*/
90 #endif
91 };
92
93 GLOBAL const char * const STATE_GPRS_NAME[] = { STATE_GPRS_NAME_INIT };
94
95
96 /*
97 +-----------------------------------------------------------------------------+
98 | PROJECT : GSM-GPRS () MODULE : RR_GPRS |
99 | STATE : code ROUTINE : gprs_init_gprs_data |
100 +-----------------------------------------------------------------------------+
101
102 PURPOSE : initialises the RR related GPRS data.
103
104 */
105
106 GLOBAL void gprs_init_gprs_data (void)
107 {
108 GET_INSTANCE_DATA;
109 TRACE_FUNCTION ("gprs_init_gprs_data()");
110
111 SET_STATE(STATE_GPRS, GPRS_NULL);
112
113 memset(rr_data->gprs_data.rr_sdu, NOT_PRESENT_8BIT, sizeof(rr_data->gprs_data.rr_sdu));
114 memset(rr_data->gprs_data.si13_sdu, NOT_PRESENT_8BIT, sizeof(rr_data->gprs_data.si13_sdu));
115 rr_data->gprs_data.tma_in_progress = 0;
116 rr_data->gprs_data.fn = 0;
117 rr_data->gprs_data.req_ref_idx = NOT_PRESENT_8BIT;
118 rr_data->gprs_data.page_mode = PAG_MODE_DEFAULT;
119 rr_data->gprs_data.si13_received = 0;
120 rr_data->gprs_data.split_pg = 0;
121
122 rr_data->gprs_data.cr_type = NOT_PRESENT_8BIT;
123 rr_data->gprs_data.cr_orig = NOT_PRESENT_8BIT;
124 rr_data->gprs_data.start_proc = START_PROC_NOTHING;
125
126 rr_data->gprs_data.is_nc2_used_in_si13 = FALSE; /* NC0 is default */
127 rr_data->gprs_data.nc_mode_of_pmo = NC_MODE_RESET; /* Use NC of SI13 */
128 rr_data->gprs_data.ready_state = FALSE; /* Standby */
129
130 /*rr_data->gprs_data.cr_pbcch_active = 0;*/
131 if ( rr_data->gprs_data.dl_data_ind NEQ NULL )
132 {
133 PFREE ( rr_data->gprs_data.dl_data_ind );
134 }
135 rr_data->gprs_data.dl_data_ind = NULL;
136 #ifdef REL99
137 rr_data->gprs_data.cbch_psi_valid = FALSE;
138 rr_data->gprs_data.cbch_info_rxvd_in_ptm = FALSE;
139 rr_data->gprs_data.nw_release = RR_GPRS_R97;
140 #endif
141 rr_data->gprs_data.ba_bcch_modified= FALSE;
142
143 }
144
145 GLOBAL void gprs_init_data_cr (void)
146 {
147 GET_INSTANCE_DATA;
148 if(GET_STATE(STATE_GPRS) NEQ GPRS_NULL)
149 SET_STATE(STATE_GPRS, GPRS_ACTIVATED);
150
151 memset(rr_data->gprs_data.rr_sdu, NOT_PRESENT_8BIT, sizeof(rr_data->gprs_data.rr_sdu));
152 memset(rr_data->gprs_data.si13_sdu, NOT_PRESENT_8BIT, sizeof(rr_data->gprs_data.si13_sdu));
153 rr_data->gprs_data.tma_in_progress = 0;
154 rr_data->gprs_data.fn = 0;
155 rr_data->gprs_data.req_ref_idx = NOT_PRESENT_8BIT;
156 rr_data->gprs_data.page_mode = PAG_MODE_DEFAULT;
157 rr_data->gprs_data.si13_received = 0;
158 rr_data->gprs_data.split_pg = 0;
159 /*rr_data->gprs_data.cr_pbcch_active = 0;*/
160 rr_data->gprs_data.cr_type = NOT_PRESENT_8BIT;
161 rr_data->gprs_data.cr_orig = NOT_PRESENT_8BIT;
162 rr_data->gprs_data.start_proc = START_PROC_NOTHING;
163 rr_data->gprs_data.is_nc2_used_in_si13 = FALSE; /* NC0 is default */
164 rr_data->gprs_data.nc_mode_of_pmo = NC_MODE_RESET; /* Use NC of SI13 */
165 /* ready state variable should not be cleared know because it is still needed */
166
167 if ( rr_data->gprs_data.dl_data_ind NEQ NULL )
168 {
169 PFREE ( rr_data->gprs_data.dl_data_ind );
170 }
171 rr_data->gprs_data.dl_data_ind = NULL;
172 #ifdef REL99
173 rr_data->gprs_data.cbch_psi_valid = FALSE;
174 rr_data->gprs_data.cbch_info_rxvd_in_ptm = FALSE;
175 rr_data->gprs_data.nw_release = RR_GPRS_R97;
176 #endif
177
178 }
179 /*
180 +-----------------------------------------------------------------------------+
181 | PROJECT : GSM-GPRS (??6147) MODULE : RR_GPRS |
182 | STATE : code ROUTINE : gprs_get_table_n |
183 +-----------------------------------------------------------------------------+
184
185 PURPOSE : process jumptable,
186 IN : adresses of table, n
187 OUT : values of rrgrr_table in table, n
188
189 */
190 void gprs_get_table_n (const T_FUNC **table, USHORT *n)
191 {
192 TRACE_FUNCTION ("gprs_get_table_n()");
193
194 *table = rrgrr_table;
195 *n = TAB_SIZE ( rrgrr_table);
196 }
197
198 /*
199 +-----------------------------------------------------------------------------+
200 | PROJECT : GSM-GPRS (6147) MODULE : RR_GPRS |
201 | STATE : code ROUTINE : gprs_rrgrr_store_sdu |
202 +-----------------------------------------------------------------------------+
203
204 PURPOSE :
205 IN :
206 OUT :
207
208 */
209 void gprs_rrgrr_store_sdu(UBYTE* to, T_sdu* from)
210 {
211 from->o_buf-=8;
212 from->l_buf+=8;
213 memcpy(to, &from->buf[from->o_buf/8], from->l_buf/8);
214 }
215
216 /*
217 +-----------------------------------------------------------------------------+
218 | PROJECT : GSM-GPRS (6147) MODULE : RR_GPRS |
219 | STATE : code ROUTINE : gprs_rrgrr_fill_from_stored_sdu |
220 +-----------------------------------------------------------------------------+
221
222 PURPOSE :
223 IN :
224 OUT :
225
226 */
227 void gprs_rrgrr_fill_from_stored_sdu(T_sdu* sdu, UBYTE* from)
228 {
229 /*
230 * copy message content
231 */
232 sdu->l_buf = 22*8;
233 #if defined (_SIMULATION_)
234 sdu->o_buf = 0*8;
235 #else
236 sdu->o_buf = 1*8;
237 #endif
238
239 memcpy(sdu->buf, from, MAX_L2_FRAME_SIZE);/*lint !e419 Apparent data overrun for function*/
240 }
241
242 /*
243 +--------------------------------------------------------------------+
244 | PROJECT : GSM-PS (6147) MODULE : RR_PEI |
245 | STATE : code ROUTINE : pei_not_supported |
246 +--------------------------------------------------------------------+
247
248 PURPOSE : An unsupported primitive is received.
249
250 */
251
252 LOCAL void pei_not_supported (void * data)
253 {
254 TRACE_FUNCTION ("pei_not_supported()");
255
256 PFREE (data);
257 }
258
259 #endif /* GPRS */
260 #endif /* RR_GPRS_C */