comparison src/g23m-aci/uart/uart_rts.c @ 162:53929b40109c

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