comparison src/g23m-aci/aci/psa_f.c @ 1:d393cd9bb723

src/g23m-*: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:40:46 +0000
parents
children 8c5d012b9c4d
comparison
equal deleted inserted replaced
0:b6a5e36de839 1:d393cd9bb723
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 #ifdef VOCODER_FUNC_INTERFACE
63 #include "hl_audio_drv.h"
64 #endif
65
66 /*==== CONSTANTS ==================================================*/
67
68
69 /*==== TYPES ======================================================*/
70
71
72 /*==== EXPORT =====================================================*/
73
74
75 /*==== VARIABLES ==================================================*/
76
77
78 /*==== FUNCTIONS ==================================================*/
79
80
81 /*
82 +-------------------------------------------------------------------+
83 | PROJECT : GSM-PS (6147) MODULE : CMH |
84 | ROUTINE : psa_Init |
85 +-------------------------------------------------------------------+
86
87 PURPOSE : initialize the protocol stack adapters.
88
89 */
90
91 GLOBAL void psa_Init ( void )
92 {
93
94 /*
95 *-------------------------------------------------------------------
96 * set default parms for protocol stack adapters
97 *-------------------------------------------------------------------
98 */
99
100 /* --- psa init functions --- */
101 }
102
103 /*
104 +-------------------------------------------------------------------+
105 | PROJECT : GSM-PS (6147) MODULE : CMH |
106 | ROUTINE : psa_IsVldOwnid |
107 +-------------------------------------------------------------------+
108
109 PURPOSE : check for a valid owner id.
110
111 */
112
113 GLOBAL BOOL psa_IsVldOwnId ( T_OWN ownId )
114 {
115 if( ownId > ((T_OWN)CMD_SRC_NONE) AND ownId < OWN_SRC_MAX )
116
117 return TRUE;
118
119 return( FALSE );
120 }
121
122 /*
123 +--------------------------------------------------------------------+
124 | PROJECT: GSM-PS (6147) MODULE: ACI_CMD |
125 | STATE : code ROUTINE: psa_timeout |
126 +--------------------------------------------------------------------+
127
128 PURPOSE : A timeout has occured for a timer. The function returns
129 TRUE, if it is a timer which is handled by PSA, else FALSE
130 is returned to indicate that the timer has not been
131 processed.
132
133 */
134
135 GLOBAL UBYTE psa_timeout (USHORT index)
136 {
137 TRACE_FUNCTION ("psa_timeout()");
138
139 switch(index)
140 {
141 case(ACI_TDTMF):
142 /* timeout dtmf timer */
143 psaCC_DTMFTimeout();
144 return(TRUE);
145
146 #ifdef VOCODER_FUNC_INTERFACE
147 case(ACI_VOCODER):
148 {
149 T_HL_VOCODER_ACTION tmpcurrVocoderAction = currVocoderAction;
150 currVocoderAction = VOCODER_IDLE;
151 /*
152 * If the vocoder state is PENDING_ENABLE/DISABLE then
153 * call the function hl_drv_set_vocoder_state() to Enable/Disable
154 * vocoder depending on the state.
155 */
156 switch(tmpcurrVocoderAction)
157 {
158 case VOCODER_PENDING_DISABLE:
159 hl_drv_set_vocoder_state(FALSE); /* Disable vocoder */
160 break;
161
162 case VOCODER_PENDING_ENABLE:
163 hl_drv_set_vocoder_state(TRUE); /* Enable vocoder */
164 break;
165
166 default:
167 TRACE_ERROR ("Unexpected timeout in state");
168 break;
169 }
170
171 return (TRUE); /* Timeout event handled */
172 }
173 #endif
174
175 #ifdef UART
176 case(ACI_IPR):
177 /* timeout AT+IPR: change baud rate */
178 timeout_PlusIPR();
179 return(TRUE);
180 #endif
181
182 #if defined FF_EOTD
183 case(ACI_LC_1):
184 case(ACI_LC_2):
185 case(ACI_LC_3):
186 case(ACI_LC_4):
187 case(ACI_LC_5):
188 psaLC_posDataReq(index);
189 return(TRUE);
190 #endif /* FF_EOTD */
191 }
192
193 /* the timeout is not for PSA */
194 return FALSE;
195 }
196
197 #if defined (GPRS) AND defined (DTI)
198 /*
199 +-------------------------------------------------------------------+
200 | PROJECT : GSM-PS (6147) MODULE : CMH |
201 | ROUTINE : psa_GPRSInit |
202 +-------------------------------------------------------------------+
203
204 PURPOSE : initialize the protocol stack adapters.
205
206 */
207 #define FACTOR_T3314 1000
208 #define FACTOR_T3312 60000
209
210 GLOBAL void psa_GPRSInit ( void )
211 {
212 T_FFS_GPRS_ACI ffsBuffer;
213
214 T_FFS_SIZE size = FFS_fread("/GPRS/baspar_gprs", &ffsBuffer, sizeof(T_FFS_GPRS_ACI));
215
216 if ( size NEQ sizeof(T_FFS_GPRS_ACI) )
217 {
218 # ifndef _SIMULATION_
219 if ( size < 0 )
220 {
221 TRACE_EVENT_P1("FFS can not read \"/GPRS/baspar_gprs\" (%d)", size);
222 }
223 else
224 {
225 TRACE_EVENT_P2("FFS contains old file of \"/GPRS/baspar_gprs\": %dBytes long, but %dBytes expected",
226 size, sizeof(T_FFS_GPRS_ACI));
227 }
228 # endif /* NOT DEFINED _SIMULATION_ */
229
230 ffsBuffer.max_cid = 2; /* not supported at this moment */
231 ffsBuffer.auto_attach = (UBYTE) CGAATT_ATTACH_MODE_MANUAL;/* 1 */
232 ffsBuffer.auto_detach = (UBYTE) CGAATT_DETACH_MODE_OFF; /* 1 */
233 ffsBuffer.default_mobile_class = (UBYTE) GMMREG_CLASS_BG; /* 4 */
234 ffsBuffer.accm = 0; /* 3 */
235 ffsBuffer.restart_timer = PPP_RT_DEFAULT; /* 3 */
236 ffsBuffer.max_configure = PPP_MC_DEFAULT; /* 10 */
237 ffsBuffer.max_terminate = PPP_MT_DEFAULT; /* 2 */
238 ffsBuffer.max_failure = PPP_MF_DEFAULT; /* 5 */
239 }
240
241 psaGPPP_Init( ffsBuffer.accm, ffsBuffer.restart_timer,
242 ffsBuffer.max_configure, ffsBuffer.max_terminate, ffsBuffer.max_failure );
243 psaGMM_Init( ffsBuffer.auto_attach,ffsBuffer.auto_detach, ffsBuffer.default_mobile_class );
244 psaSM_Init();
245 }
246 #endif /* GPRS */
247
248 /*==== EOF ========================================================*/