comparison g23m-aci/uart/uart_rts.c @ 0:75a11d740a02

initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 Jun 2016 00:02:41 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:75a11d740a02
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 modul is part of the entity UART and implements all
18 | functions to handle the incoming process internal signals as
19 | described in the SDL-documentation (RT-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef UART_RTS_C
24 #define UART_RTS_C
25 #endif /* !UART_RTS_C */
26
27 #include "config.h"
28 #include "fixedconf.h"
29 #include "condat-features.h"
30
31 #define ENTITY_UART
32
33 /*==== INCLUDES =============================================================*/
34
35 #ifdef _SIMULATION_
36 #include <stdio.h>
37 #endif
38
39 #ifdef WIN32
40 #include "nucleus.h"
41 #endif /* WIN32 */
42 #include "typedefs.h" /* to get Condat data types */
43 #include "vsi.h" /* to get a lot of macros */
44 #include "macdef.h" /* to get a lot of macros */
45 #include "custom.h"
46 #include "gsm.h" /* to get a lot of macros */
47 #include "cnf_uart.h" /* to get cnf-definitions */
48 #include "mon_uart.h" /* to get mon-definitions */
49 #include "prim.h" /* to get the definitions of used SAP and directions */
50 #ifdef DTILIB
51 #include "dti.h" /* to get dti lib */
52 #endif /* DTILIB */
53 #include "pei.h" /* to get PEI interface */
54 #ifdef FF_MULTI_PORT
55 #include "gsi.h" /* to get definitions of serial driver */
56 #else /* FF_MULTI_PORT */
57 #ifdef _TARGET_
58 #include "../../serial/serialswitch.h"
59 #include "../../serial/traceswitch.h"
60 #else /* _TARGET_ */
61 #include "serial_dat.h" /* to get definitions of serial driver */
62 #endif /* _TARGET_ */
63 #endif /* FF_MULTI_PORT */
64 #include "uart.h" /* to get the global entity definitions */
65
66 /*==== CONST ================================================================*/
67
68 /*==== LOCAL VARS ===========================================================*/
69
70 /*==== PRIVATE FUNCTIONS ====================================================*/
71
72 /*==== PUBLIC FUNCTIONS =====================================================*/
73
74
75
76 /*
77 +------------------------------------------------------------------------------
78 | Function : sig_ker_rt_parameters_req
79 +------------------------------------------------------------------------------
80 | Description : Handles the internal signal SIG_KER_RT_PARAMETERS_REQ
81 | This signal sets new start values for the three multiplexer
82 | timers:
83 | T1 - acknowledgement timer (in units of 10 ms)
84 | T2 - response timer for multiplexer control channel
85 | (in units of 10 ms)
86 | T3 - wake-up response timer (in seconds)
87 |
88 | Parameters : t1 - new start value of timer T1
89 | t2 - new start value of timer T2
90 | t3 - new start value of timer T3
91 |
92 +------------------------------------------------------------------------------
93 */
94 GLOBAL void sig_ker_rt_parameters_req (UBYTE t1, UBYTE t2, UBYTE t3)
95 {
96 TRACE_ISIG( "sig_ker_rt_parameters_req" );
97
98 /*
99 * set set new start values of timers
100 */
101 uart_data->rt.t1 = (T_TIME)t1 * 10;
102 uart_data->rt.t2 = (T_TIME)t2 * 10;
103 uart_data->rt.t3 = (T_TIME)t3 * 1000;
104 } /* sig_ker_rt_parameters_req() */
105
106
107
108 /*
109 +------------------------------------------------------------------------------
110 | Function : sig_ker_rt_start_t1_req
111 +------------------------------------------------------------------------------
112 | Description : Handles the internal signal SIG_KER_RT_START_T1_REQ
113 | which is used to (re-)start the timer t1
114 |
115 | Parameters : none
116 |
117 +------------------------------------------------------------------------------
118 */
119 GLOBAL void sig_ker_rt_start_t1_req ()
120 {
121 TRACE_ISIG( "sig_ker_rt_start_t1_req" );
122
123 if(TIMER_START(UART_handle, uart_data->timer_t1_index, uart_data->rt.t1 ) NEQ VSI_OK)
124 {
125 TRACE_ERROR_P1("VSI entity: Can't start timer t1, uart_rts.c(%d)", __LINE__);
126 }
127
128 uart_data->rt.state_t1 = UART_RT_STARTED;
129
130 } /* sig_ker_rt_start_t1_req() */
131
132
133
134 /*
135 +------------------------------------------------------------------------------
136 | Function : sig_ker_rt_start_t2_req
137 +------------------------------------------------------------------------------
138 | Description : Handles the internal signal SIG_KER_RT_START_T2_REQ
139 | which is used to (re-)start the timer t2
140 |
141 | Parameters : none
142 |
143 +------------------------------------------------------------------------------
144 */
145 GLOBAL void sig_ker_rt_start_t2_req ()
146 {
147 TRACE_ISIG( "sig_ker_rt_start_t2_req" );
148
149
150 if(TIMER_START(UART_handle, uart_data->timer_t2_index, uart_data->rt.t2 ) NEQ VSI_OK)
151 {
152 TRACE_ERROR_P1("VSI entity: Can't start timer t2, uart_rts.c(%d)", __LINE__);
153 }
154
155 uart_data->rt.state_t2 = UART_RT_STARTED;
156
157 } /* sig_ker_rt_start_t2_req() */
158
159
160
161 /*
162 +------------------------------------------------------------------------------
163 | Function : sig_ker_rt_start_t3_req
164 +------------------------------------------------------------------------------
165 | Description : Handles the internal signal SIG_KER_RT_START_T3_REQ
166 | which is used to (re-)start the timer t3
167 |
168 | Parameters : none
169 |
170 +------------------------------------------------------------------------------
171 */
172 GLOBAL void sig_ker_rt_start_t3_req ()
173 {
174 TRACE_ISIG( "sig_ker_rt_start_t3_req" );
175
176
177 if(TIMER_START(UART_handle, uart_data->timer_t3_index, uart_data->rt.t3 ) NEQ VSI_OK)
178 {
179 TRACE_ERROR_P1("VSI entity: Can't start timer t3, uart_rts.c(%d)", __LINE__);
180 }
181
182 uart_data->rt.state_t3 = UART_RT_STARTED;
183
184 } /* sig_ker_rt_start_t3_req() */
185
186
187 /*
188 +------------------------------------------------------------------------------
189 | Function : sig_dtx_rt_start_tesd_req
190 +------------------------------------------------------------------------------
191 | Description : Handles the internal signal SIG_DTX_RT_START_TESD_REQ
192 | which is used to start the timer tesd
193 |
194 | Parameters : tesd_value - startvalue of TESD
195 |
196 +------------------------------------------------------------------------------
197 */
198 GLOBAL void sig_dtx_rt_start_tesd_req (T_TIME tesd_value)
199 {
200 TRACE_ISIG( "sig_dtx_rt_start_tesd_req" );
201 /*
202 * store lowest value
203 */
204 if (tesd_value < uart_data->rt.tesd)
205 {
206 #ifdef _SIMULATION_
207 TRACE_EVENT_P1("ESD: New start value uart_data->rt.tesd: %d", tesd_value);
208 #endif /* _SIMULATION_ */
209 uart_data->rt.tesd = tesd_value;
210 }
211 /*
212 * 1. This is the "first" call to sig_dtx_rt_start_tesd_req:
213 * state is UART_RT_STOPPED
214 * 2. Called from sig_ker_dtx_timeout_tesd_req:
215 * state is still UART_RT_STARTED (is reset to UART_RT_STOPPED when none
216 * of the DLCs wants to restart TESD)
217 */
218 if (uart_data->rt.state_tesd EQ UART_RT_STOPPED)
219 {
220 #ifdef _SIMULATION_
221 TRACE_EVENT_P1("ESD: Start timer TESD( %d )", uart_data->rt.tesd);
222 #endif /* _SIMULATION_ */
223
224 if(TIMER_START (UART_handle, uart_data->timer_tesd_index, uart_data->rt.tesd ) NEQ VSI_OK)
225 {
226 TRACE_ERROR_P1("VSI entity: Can't start timer, uart_rts.c(%d)", __LINE__);
227 }
228 uart_data->rt.state_tesd = UART_RT_STARTED;
229 }
230 #ifdef _SIMULATION_
231 else
232 {
233 TRACE_EVENT("ESD: Timer TESD will be started later !");
234 }
235 #endif /* _SIMULATION_ */
236 } /* sig_dtx_rt_start_tesd_req() */
237
238
239 /*
240 +------------------------------------------------------------------------------
241 | Function : sig_ker_rt_stop_t1_req
242 +------------------------------------------------------------------------------
243 | Description : Handles the internal signal SIG_KER_RT_STOP_T1_REQ
244 |
245 | Parameters : none
246 |
247 +------------------------------------------------------------------------------
248 */
249 GLOBAL void sig_ker_rt_stop_t1_req ()
250 {
251 TRACE_ISIG( "sig_ker_rt_stop_t1_req" );
252
253 if( uart_data->rt.state_t1 EQ UART_RT_STARTED )
254 {
255 if(TIMER_STOP(UART_handle, uart_data->timer_t1_index ) NEQ VSI_OK)
256 {
257 TRACE_ERROR_P1("VSI entity: Can't stop timer t1, uartrts.c(%d)", __LINE__);
258 }
259 }
260
261 uart_data->rt.state_t1 = UART_RT_STOPPED;
262 } /* sig_ker_rt_stop_t1_req() */
263
264
265
266 /*
267 +------------------------------------------------------------------------------
268 | Function : sig_ker_rt_stop_t2_req
269 +------------------------------------------------------------------------------
270 | Description : Handles the internal signal SIG_KER_RT_STOP_T2_REQ
271 |
272 | Parameters : none
273 |
274 +------------------------------------------------------------------------------
275 */
276 GLOBAL void sig_ker_rt_stop_t2_req ()
277 {
278 TRACE_ISIG( "sig_ker_rt_stop_t2_req" );
279
280 if( uart_data->rt.state_t2 EQ UART_RT_STARTED )
281 {
282 if(TIMER_STOP(UART_handle, uart_data->timer_t2_index ) NEQ VSI_OK)
283 {
284 TRACE_ERROR_P1("VSI entity: Can't stop timer t2, uart_rts.c(%d)",__LINE__);
285 }
286 }
287
288 uart_data->rt.state_t2 = UART_RT_STOPPED;
289 } /* sig_ker_rt_stop_t2_req() */
290
291
292
293 /*
294 +------------------------------------------------------------------------------
295 | Function : sig_ker_rt_stop_t3_req
296 +------------------------------------------------------------------------------
297 | Description : Handles the internal signal SIG_KER_RT_STOP_T3_REQ
298 |
299 | Parameters : none
300 |
301 +------------------------------------------------------------------------------
302 */
303 GLOBAL void sig_ker_rt_stop_t3_req ()
304 {
305 TRACE_ISIG( "sig_ker_rt_stop_t3_req" );
306
307 if( uart_data->rt.state_t3 EQ UART_RT_STARTED )
308 {
309 if(TIMER_STOP(UART_handle, uart_data->timer_t3_index ) NEQ VSI_OK)
310 {
311 TRACE_ERROR_P1("VSI entity: Can't stop timer t3, uart_rts.c(%d)", __LINE__);
312 }
313 }
314
315 uart_data->rt.state_t3 = UART_RT_STOPPED;
316 } /* sig_ker_rt_stop_t3_req() */
317
318
319 /*
320 +------------------------------------------------------------------------------
321 | Function : sig_dtx_rt_stop_tesd_req
322 +------------------------------------------------------------------------------
323 | Description : Handles the internal signal SIG_DTX_RT_STOP_TESD_REQ
324 |
325 | Parameters : none
326 |
327 +------------------------------------------------------------------------------
328 */
329 GLOBAL void sig_dtx_rt_stop_tesd_req ()
330 {
331 TRACE_ISIG( "sig_dtx_rt_stop_tesd_req" );
332
333 if( uart_data->rt.state_tesd EQ UART_RT_STARTED )
334 {
335 if(TIMER_STOP(UART_handle, uart_data->timer_tesd_index ) NEQ VSI_OK)
336 {
337 TRACE_ERROR_P1("VSI entity: Can't stop timer, uart_rts.c(%d)", __LINE__);
338 }
339 }
340
341 uart_data->rt.state_tesd = UART_RT_STOPPED;
342 } /* sig_dtx_rt_stop_tesd_req() */