FreeCalypso > hg > fc-tourmaline
comparison src/g23m-gprs/gmm/gmm_syncf.c @ 1:fa8dc04885d8
src/g23m-*: import from Magnetite
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Fri, 16 Oct 2020 06:25:50 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:4e78acac3d88 | 1:fa8dc04885d8 |
|---|---|
| 1 /* | |
| 2 +----------------------------------------------------------------------------- | |
| 3 | Project : GPRS (8441) | |
| 4 | Modul : gmm_syncf.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 is part of the entity GMM and implements all | |
| 18 | procedures and functions as described in the | |
| 19 | SDL-documentation (SYNC-statemachine) | |
| 20 +----------------------------------------------------------------------------- | |
| 21 */ | |
| 22 | |
| 23 #ifndef GMM_SYNCF_C | |
| 24 #define GMM_SYNCF_C | |
| 25 #endif | |
| 26 | |
| 27 #define ENTITY_GMM | |
| 28 | |
| 29 /*==== INCLUDES =============================================================*/ | |
| 30 | |
| 31 #include "typedefs.h" /* to get Condat data types */ | |
| 32 #include "vsi.h" /* to get a lot of macros */ | |
| 33 #include "macdef.h" | |
| 34 #include "gprs.h" | |
| 35 #include "gsm.h" /* to get a lot of macros */ | |
| 36 #include "ccdapi.h" /* to get CCD API */ | |
| 37 #include "cnf_gmm.h" /* to get cnf-definitions */ | |
| 38 #include "mon_gmm.h" /* to get mon-definitions */ | |
| 39 #include "prim.h" /* to get the definitions of used SAP and directions */ | |
| 40 #include "gmm.h" /* to get the global entity definitions */ | |
| 41 #include "gmm_kerns.h" /* to get some signals */ | |
| 42 | |
| 43 #include <string.h> /* to get memset */ | |
| 44 | |
| 45 /*==== CONST ================================================================*/ | |
| 46 | |
| 47 /*==== LOCAL VARS ===========================================================*/ | |
| 48 | |
| 49 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
| 50 | |
| 51 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
| 52 | |
| 53 | |
| 54 | |
| 55 /* | |
| 56 +------------------------------------------------------------------------------ | |
| 57 | Function : rxgmm_init | |
| 58 +------------------------------------------------------------------------------ | |
| 59 | Description : The function rxgmm_init() .... | |
| 60 | | |
| 61 | Parameters : void | |
| 62 | | |
| 63 +------------------------------------------------------------------------------ | |
| 64 */ | |
| 65 GLOBAL void sync_gmm_init ( void ) | |
| 66 { | |
| 67 TRACE_FUNCTION( "sync_gmm_init" ); | |
| 68 | |
| 69 /* | |
| 70 * Initialise service SYNC with state SYNC_IDLE. | |
| 71 */ | |
| 72 gmm_data->sync.grr_cell_info.net_mode = GMMRR_NET_MODE_II; | |
| 73 gmm_data->sync.mm_cell_info.status= MMGMM_LIMITED_SERVICE; | |
| 74 gmm_data->sync.sig_cell_info.env.rai.rac = GMMRR_RAC_INVALID; | |
| 75 gmm_data->sync.mm_cell_info.cid = 0xff; | |
| 76 gmm_data->sync.grr_cell_info.cell_env.cid= 0xff; | |
| 77 gmm_data->sync.mm_cell_info.lac = GMMRR_LA_INVALID; | |
| 78 gmm_data->sync.grr_cell_info.cell_env.rai.lac = GMMRR_LA_INVALID; | |
| 79 | |
| 80 #ifdef REL99 | |
| 81 /* sgsnr_flag should be initialized to a value 0 (CL_SGSN_REL_98_OR_OLDER). | |
| 82 * SM also will initialize the value of sgsnr_flag in its | |
| 83 * context to 0. GMM will update SM when the value changes. | |
| 84 */ | |
| 85 gmm_data->kern.sig_cell_info.sgsnr_flag = PS_SGSN_98_OLDER; /* TCS 4.0 */ | |
| 86 #endif | |
| 87 | |
| 88 INIT_STATE ( SYNC, SYNC_IDLE ); | |
| 89 vsi_t_stop ( GMM_handle, sync_TSYNC); | |
| 90 } /* sync_gmm_init() */ | |
| 91 | |
| 92 /* | |
| 93 +------------------------------------------------------------------------------ | |
| 94 | Function : sync_is_cid_equal | |
| 95 +------------------------------------------------------------------------------ | |
| 96 | Description : The function sync_is_cid_equal() .... | |
| 97 | | |
| 98 | Parameters : void | |
| 99 | | |
| 100 +------------------------------------------------------------------------------ | |
| 101 */ | |
| 102 GLOBAL BOOL sync_is_cid_equal () | |
| 103 { | |
| 104 GMM_TRACE_FUNCTION( "sync_is_cid_equal" ); | |
| 105 | |
| 106 GMM_RETURN_ ( | |
| 107 gmm_data->sync.mm_cell_info.cid == gmm_data->sync.grr_cell_info.cell_env.cid | |
| 108 && gmm_data->sync.mm_cell_info.lac == gmm_data->sync.grr_cell_info.cell_env.rai.lac | |
| 109 && memcmp (gmm_data->sync.mm_cell_info.plmn.mnc, gmm_data->sync.grr_cell_info.cell_env.rai.plmn.mnc, SIZE_MNC)==0 | |
| 110 && memcmp (gmm_data->sync.mm_cell_info.plmn.mcc, gmm_data->sync.grr_cell_info.cell_env.rai.plmn.mcc, SIZE_MCC)==0 | |
| 111 ); | |
| 112 } /* sync_sync_is_cid_equal() */ | |
| 113 | |
| 114 /* | |
| 115 +------------------------------------------------------------------------------ | |
| 116 | Function : sync_send_cell_info | |
| 117 +------------------------------------------------------------------------------ | |
| 118 | Description : The function sync_send_cell_info() .... | |
| 119 | | |
| 120 | Parameters : void | |
| 121 | | |
| 122 +------------------------------------------------------------------------------ | |
| 123 */ | |
| 124 GLOBAL void sync_send_cell_info() | |
| 125 { | |
| 126 GMM_TRACE_FUNCTION( "sync_send_cell_info" ); | |
| 127 | |
| 128 gmm_data->sync.sig_cell_info.env = gmm_data->sync.grr_cell_info.cell_env; | |
| 129 gmm_data->sync.sig_cell_info.net_mode = gmm_data->sync.grr_cell_info.net_mode; | |
| 130 #ifdef GMM_TCS4 | |
| 131 gmm_data->sync.sig_cell_info.rt = gmm_data->sync.grr_cell_info.rt; | |
| 132 #endif | |
| 133 /* MM */ | |
| 134 gmm_data->sync.sig_cell_info.mm_status = gmm_data->sync.mm_cell_info.status; | |
| 135 | |
| 136 gmm_data->sync.sig_cell_info.t3212_val = gmm_data->sync.mm_cell_info.t3212_val; | |
| 137 | |
| 138 | |
| 139 | |
| 140 /* GRR */ | |
| 141 if ( MMGMM_GPRS_SUPP_NO == gmm_data->sync.mm_cell_info.gprs_indicator) | |
| 142 { | |
| 143 gmm_data->sync.sig_cell_info.gmm_status = GMMRR_SERVICE_NONE; | |
| 144 gmm_data->sync.sig_cell_info.env.cid = gmm_data->sync.mm_cell_info.cid; | |
| 145 gmm_data->sync.sig_cell_info.env.rai.lac = gmm_data->sync.mm_cell_info.lac; | |
| 146 gmm_data->sync.sig_cell_info.env.rai.plmn = gmm_data->sync.mm_cell_info.plmn; | |
| 147 gmm_data->sync.sig_cell_info.net_mode = GMMRR_NET_MODE_II; | |
| 148 } | |
| 149 else | |
| 150 { | |
| 151 gmm_data->sync.sig_cell_info.gmm_status = gmm_data->sync.grr_cell_info.service_state; | |
| 152 if (GMMRR_SERVICE_NONE==gmm_data->sync.sig_cell_info.gmm_status) | |
| 153 { | |
| 154 gmm_data->sync.sig_cell_info.net_mode = GMMRR_NET_MODE_II; | |
| 155 } | |
| 156 | |
| 157 } | |
| 158 | |
| 159 sig_sync_kern_cell_ind ( &gmm_data->sync.sig_cell_info ); | |
| 160 gmm_data->sync.sig_cell_info.gmmrr_cell_ind_received = FALSE; | |
| 161 GMM_RETURN; | |
| 162 } /* sync_send_cell_info() */ | |
| 163 /* | |
| 164 +------------------------------------------------------------------------------ | |
| 165 | Function : sync_send_mm_cell_info | |
| 166 +------------------------------------------------------------------------------ | |
| 167 | Description : The function sync_send_cell_info() .... | |
| 168 | | |
| 169 | Parameters : void | |
| 170 | | |
| 171 +------------------------------------------------------------------------------ | |
| 172 */ | |
| 173 GLOBAL void sync_send_mm_cell_info() | |
| 174 { | |
| 175 GMM_TRACE_FUNCTION( "sync_send_mm_cell_info" ); | |
| 176 | |
| 177 gmm_data->sync.sig_cell_info.mm_status = gmm_data->sync.mm_cell_info.status; | |
| 178 | |
| 179 gmm_data->sync.sig_cell_info.t3212_val = gmm_data->sync.mm_cell_info.t3212_val; | |
| 180 | |
| 181 | |
| 182 | |
| 183 /* GRR */ | |
| 184 if ( MMGMM_GPRS_SUPP_NO == gmm_data->sync.mm_cell_info.gprs_indicator) | |
| 185 { | |
| 186 gmm_data->sync.sig_cell_info.gmm_status = GMMRR_SERVICE_NONE; | |
| 187 gmm_data->sync.sig_cell_info.net_mode = GMMRR_NET_MODE_II; | |
| 188 } | |
| 189 | |
| 190 gmm_data->sync.sig_cell_info.env.cid = gmm_data->sync.mm_cell_info.cid; | |
| 191 gmm_data->sync.sig_cell_info.env.rai.lac = gmm_data->sync.mm_cell_info.lac; | |
| 192 gmm_data->sync.sig_cell_info.env.rai.plmn = gmm_data->sync.mm_cell_info.plmn; | |
| 193 | |
| 194 sig_sync_kern_cell_ind ( &gmm_data->sync.sig_cell_info ); | |
| 195 | |
| 196 GMM_RETURN; | |
| 197 } /* sync_send_cell_info() */ | |
| 198 |
