comparison src/g23m-aci/aci/psa_f.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 : GSM-PS (6147)
4 | Modul : PSA_F
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 defines global functions of the protocol
18 | stack adapters.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef PSA_F_C
23 #define PSA_F_C
24 #endif
25
26 #include "aci_all.h"
27
28 /*==== INCLUDES ===================================================*/
29 #include "aci_cmh.h"
30 #include "ati_cmd.h"
31 #include "aci_cmd.h"
32 #include "psa.h"
33 #include "aci.h"
34 #include "l4_tim.h"
35
36 #include "psa_cc.h"
37 #if defined FF_EOTD
38 #include "psa_lc.h"
39 #endif
40
41 #ifdef UART
42 #include "dti_conn_mng.h"
43 #endif
44
45 #ifdef GPRS
46 #include "gaci_cmh.h"
47 #include "psa_gmm.h"
48 #include "psa_sm.h"
49 #include "psa_gppp.h"
50 #include "ffs/ffs.h"
51 #include "ffs_coat.h"
52 #endif /* GPRS */
53
54 #include "aci_lst.h"
55
56 #ifdef UART
57 #include "dti.h" /* functionality of the dti library */
58 #include "psa_uart.h"
59 #include "cmh_uart.h"
60 #endif
61
62 /* removed in FreeCalypso */
63 #if 0 //#ifdef VOCODER_FUNC_INTERFACE
64 #include "hl_audio_drv.h"
65 #endif
66
67 /*==== CONSTANTS ==================================================*/
68
69
70 /*==== TYPES ======================================================*/
71
72
73 /*==== EXPORT =====================================================*/
74
75
76 /*==== VARIABLES ==================================================*/
77
78
79 /*==== FUNCTIONS ==================================================*/
80
81
82 /*
83 +-------------------------------------------------------------------+
84 | PROJECT : GSM-PS (6147) MODULE : CMH |
85 | ROUTINE : psa_Init |
86 +-------------------------------------------------------------------+
87
88 PURPOSE : initialize the protocol stack adapters.
89
90 */
91
92 GLOBAL void psa_Init ( void )
93 {
94
95 /*
96 *-------------------------------------------------------------------
97 * set default parms for protocol stack adapters
98 *-------------------------------------------------------------------
99 */
100
101 /* --- psa init functions --- */
102 }
103
104 /*
105 +-------------------------------------------------------------------+
106 | PROJECT : GSM-PS (6147) MODULE : CMH |
107 | ROUTINE : psa_IsVldOwnid |
108 +-------------------------------------------------------------------+
109
110 PURPOSE : check for a valid owner id.
111
112 */
113
114 GLOBAL BOOL psa_IsVldOwnId ( T_OWN ownId )
115 {
116 if( ownId > ((T_OWN)CMD_SRC_NONE) AND ownId < OWN_SRC_MAX )
117
118 return TRUE;
119
120 return( FALSE );
121 }
122
123 /*
124 +--------------------------------------------------------------------+
125 | PROJECT: GSM-PS (6147) MODULE: ACI_CMD |
126 | STATE : code ROUTINE: psa_timeout |
127 +--------------------------------------------------------------------+
128
129 PURPOSE : A timeout has occured for a timer. The function returns
130 TRUE, if it is a timer which is handled by PSA, else FALSE
131 is returned to indicate that the timer has not been
132 processed.
133
134 */
135
136 GLOBAL UBYTE psa_timeout (USHORT index)
137 {
138 TRACE_FUNCTION ("psa_timeout()");
139
140 switch(index)
141 {
142 case(ACI_TDTMF):
143 /* timeout dtmf timer */
144 psaCC_DTMFTimeout();
145 return(TRUE);
146
147 /* removed in FreeCalypso */
148 #if 0 //#ifdef VOCODER_FUNC_INTERFACE
149 case(ACI_VOCODER):
150 {
151 T_HL_VOCODER_ACTION tmpcurrVocoderAction = currVocoderAction;
152 currVocoderAction = VOCODER_IDLE;
153 /*
154 * If the vocoder state is PENDING_ENABLE/DISABLE then
155 * call the function hl_drv_set_vocoder_state() to Enable/Disable
156 * vocoder depending on the state.
157 */
158 switch(tmpcurrVocoderAction)
159 {
160 case VOCODER_PENDING_DISABLE:
161 hl_drv_set_vocoder_state(FALSE); /* Disable vocoder */
162 break;
163
164 case VOCODER_PENDING_ENABLE:
165 hl_drv_set_vocoder_state(TRUE); /* Enable vocoder */
166 break;
167
168 default:
169 TRACE_ERROR ("Unexpected timeout in state");
170 break;
171 }
172
173 return (TRUE); /* Timeout event handled */
174 }
175 #endif
176
177 #ifdef UART
178 case(ACI_IPR):
179 /* timeout AT+IPR: change baud rate */
180 timeout_PlusIPR();
181 return(TRUE);
182 #endif
183
184 #if defined FF_EOTD
185 case(ACI_LC_1):
186 case(ACI_LC_2):
187 case(ACI_LC_3):
188 case(ACI_LC_4):
189 case(ACI_LC_5):
190 psaLC_posDataReq(index);
191 return(TRUE);
192 #endif /* FF_EOTD */
193 }
194
195 /* the timeout is not for PSA */
196 return FALSE;
197 }
198
199 #if defined (GPRS) AND defined (DTI)
200 /*
201 +-------------------------------------------------------------------+
202 | PROJECT : GSM-PS (6147) MODULE : CMH |
203 | ROUTINE : psa_GPRSInit |
204 +-------------------------------------------------------------------+
205
206 PURPOSE : initialize the protocol stack adapters.
207
208 */
209 #define FACTOR_T3314 1000
210 #define FACTOR_T3312 60000
211
212 GLOBAL void psa_GPRSInit ( void )
213 {
214 T_FFS_GPRS_ACI ffsBuffer;
215
216 T_FFS_SIZE size = FFS_fread("/GPRS/baspar_gprs", &ffsBuffer, sizeof(T_FFS_GPRS_ACI));
217
218 if ( size NEQ sizeof(T_FFS_GPRS_ACI) )
219 {
220 # ifndef _SIMULATION_
221 if ( size < 0 )
222 {
223 TRACE_EVENT_P1("FFS can not read \"/GPRS/baspar_gprs\" (%d)", size);
224 }
225 else
226 {
227 TRACE_EVENT_P2("FFS contains old file of \"/GPRS/baspar_gprs\": %dBytes long, but %dBytes expected",
228 size, sizeof(T_FFS_GPRS_ACI));
229 }
230 # endif /* NOT DEFINED _SIMULATION_ */
231
232 ffsBuffer.max_cid = 2; /* not supported at this moment */
233 ffsBuffer.auto_attach = (UBYTE) CGAATT_ATTACH_MODE_MANUAL;/* 1 */
234 ffsBuffer.auto_detach = (UBYTE) CGAATT_DETACH_MODE_OFF; /* 1 */
235 ffsBuffer.default_mobile_class = (UBYTE) GMMREG_CLASS_BG; /* 4 */
236 ffsBuffer.accm = 0; /* 3 */
237 ffsBuffer.restart_timer = PPP_RT_DEFAULT; /* 3 */
238 ffsBuffer.max_configure = PPP_MC_DEFAULT; /* 10 */
239 ffsBuffer.max_terminate = PPP_MT_DEFAULT; /* 2 */
240 ffsBuffer.max_failure = PPP_MF_DEFAULT; /* 5 */
241 }
242
243 psaGPPP_Init( ffsBuffer.accm, ffsBuffer.restart_timer,
244 ffsBuffer.max_configure, ffsBuffer.max_terminate, ffsBuffer.max_failure );
245 psaGMM_Init( ffsBuffer.auto_attach,ffsBuffer.auto_detach, ffsBuffer.default_mobile_class );
246 psaSM_Init();
247 }
248 #endif /* GPRS */
249
250 /*==== EOF ========================================================*/