FreeCalypso > hg > fc-magnetite
comparison src/g23m-gprs/gmm/gmm_rdyf.c @ 183:219afcfc6250
src/g23m-gprs: initial import from TCS3.2/LoCosto
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 13 Oct 2016 04:24:13 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 182:f02d0a0e1849 | 183:219afcfc6250 |
|---|---|
| 1 /* | |
| 2 +----------------------------------------------------------------------------- | |
| 3 | Project : GPRS (8441) | |
| 4 | Modul : gmm_rdyf.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 (RDY-statemachine) | |
| 20 +----------------------------------------------------------------------------- | |
| 21 */ | |
| 22 | |
| 23 #ifndef GMM_RDYF_C | |
| 24 #define GMM_RDYF_C | |
| 25 #endif | |
| 26 | |
| 27 #define ENTITY_GMM | |
| 28 | |
| 29 /*==== INCLUDES =============================================================*/ | |
| 30 #include <stdio.h> /* to get Sprintf */ | |
| 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 "gsm.h" /* to get a lot of macros */ | |
| 35 #include "ccdapi.h" /* to get CCD API */ | |
| 36 #include "cnf_gmm.h" /* to get cnf-definitions */ | |
| 37 #include "mon_gmm.h" /* to get mon-definitions */ | |
| 38 #include "prim.h" /* to get the definitions of used SAP and directions */ | |
| 39 #include "gmm.h" /* to get the global entity definitions */ | |
| 40 | |
| 41 /*==== CONST ================================================================*/ | |
| 42 | |
| 43 /*==== LOCAL VARS ===========================================================*/ | |
| 44 | |
| 45 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
| 46 | |
| 47 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
| 48 | |
| 49 /* | |
| 50 +------------------------------------------------------------------------------ | |
| 51 | Function : rdy_cgrlc_ready_timer_config_req | |
| 52 +------------------------------------------------------------------------------ | |
| 53 | Description : this procedure sends ready_timer value to CGRLC | |
| 54 | | |
| 55 | Parameters : ready_timer value | |
| 56 | | |
| 57 +------------------------------------------------------------------------------ | |
| 58 */ | |
| 59 GLOBAL void rdy_cgrlc_ready_timer_config_req (ULONG timer) | |
| 60 { | |
| 61 GMM_TRACE_FUNCTION( "rdy_cgrlc_ready_timer_config_req" ); | |
| 62 | |
| 63 TRACE_1_OUT_PARA ("ready_timer value: %x", timer); | |
| 64 | |
| 65 { | |
| 66 PALLOC ( cgrlc_ready_timer_config_req, CGRLC_READY_TIMER_CONFIG_REQ); | |
| 67 cgrlc_ready_timer_config_req->t3314_val = timer; | |
| 68 PSEND ( hCommGRLC, cgrlc_ready_timer_config_req ); | |
| 69 } | |
| 70 | |
| 71 } /* rdy_cgrlc_ready_timer_config_req */ | |
| 72 | |
| 73 | |
| 74 | |
| 75 /* | |
| 76 +------------------------------------------------------------------------------ | |
| 77 | Function : rdy_init | |
| 78 +------------------------------------------------------------------------------ | |
| 79 | Description : The function rdy_init() .... | |
| 80 | | |
| 81 | Parameters : void | |
| 82 | | |
| 83 +------------------------------------------------------------------------------ | |
| 84 */ | |
| 85 GLOBAL void rdy_init ( void ) | |
| 86 { | |
| 87 USHORT timer; | |
| 88 TRACE_FUNCTION( "rdy_init" ); | |
| 89 | |
| 90 /* | |
| 91 * Initialise service RDY with state RDY_READY. | |
| 92 * | |
| 93 * default the init state has to be IDLE, but i think we do not need IDLE state | |
| 94 */ | |
| 95 INIT_STATE (RDY, RDY_STANDBY); | |
| 96 | |
| 97 /* | |
| 98 * Initialise the timers T3312 and T3314 with default values | |
| 99 */ | |
| 100 gmm_data->rdy.t3312_val = T3312_VALUE; | |
| 101 gmm_data->rdy.t3314_val = T3314_VALUE; | |
| 102 gmm_data->rdy.t3312_deactivated = FALSE; | |
| 103 gmm_data->rdy.attempting_to_update = FALSE; | |
| 104 for (timer=0;timer<TIMER_MAX;timer++) | |
| 105 { | |
| 106 gmm_data->rdy.timer_value[timer] = 0; | |
| 107 } | |
| 108 vsi_t_stop ( GMM_handle, rdy_T3312); | |
| 109 rdy_cgrlc_ready_timer_config_req (gmm_data->rdy.t3314_val); | |
| 110 return; | |
| 111 } /* rdy_init() */ | |
| 112 | |
| 113 /* | |
| 114 +------------------------------------------------------------------------------ | |
| 115 | Function : rdy_get_timer | |
| 116 +------------------------------------------------------------------------------ | |
| 117 | Description : this procedure sets the ready or rau timer value received | |
| 118 | from the network | |
| 119 | | |
| 120 | Parameters : timer - the AIR message timer | |
| 121 | returns: timer_val - the timer_value in ms | |
| 122 | | |
| 123 +------------------------------------------------------------------------------ | |
| 124 */ | |
| 125 GLOBAL ULONG rdy_get_timer ( T_rau_timer * timer ) | |
| 126 { | |
| 127 GMM_TRACE_FUNCTION ("rdy_get_timer()"); | |
| 128 | |
| 129 switch ( timer->timer_unit ) | |
| 130 { | |
| 131 case TIMER_2_SEC: | |
| 132 GMM_RETURN_ (timer->timer_value * 2 * SEC); | |
| 133 case TIMER_1_MIN: | |
| 134 GMM_RETURN_ (timer->timer_value * 60 * SEC); | |
| 135 case TIMER_1_DH: | |
| 136 GMM_RETURN_ (timer->timer_value * 6 * 60 * SEC); | |
| 137 default: | |
| 138 GMM_RETURN_ (timer->timer_value * 60 * SEC); | |
| 139 } | |
| 140 } /* rdy_get_timer */ | |
| 141 | |
| 142 /* | |
| 143 +------------------------------------------------------------------------------ | |
| 144 | Function : rdy_start_t3312 | |
| 145 +------------------------------------------------------------------------------ | |
| 146 | Description : this procedure starts the timer t3312 if it is not deactivated | |
| 147 | | |
| 148 | Parameters : void | |
| 149 | | |
| 150 +------------------------------------------------------------------------------ | |
| 151 */ | |
| 152 GLOBAL void rdy_start_t3312 ( void ) | |
| 153 { | |
| 154 GMM_TRACE_FUNCTION ("rdy_start_t3312()"); | |
| 155 | |
| 156 if( !gmm_data->rdy.t3312_deactivated | |
| 157 && !gmm_data->rdy.attempting_to_update) | |
| 158 { | |
| 159 TRACE_1_INFO ("Periodic RAU will be started in %d minutes", | |
| 160 (int)(gmm_data->rdy.t3312_val/(60000.0))); | |
| 161 vsi_t_start ( GMM_handle , rdy_T3312, gmm_data->rdy.t3312_val ); | |
| 162 } | |
| 163 GMM_RETURN; | |
| 164 } /* rdy_get_timer */ |
