comparison g23m-aci/uart/uart_rtp.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 primitives as described in
19 | the SDL-documentation (RT-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef UART_RTP_C
24 #define UART_RTP_C
25 #endif /* !UART_RTP_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 #include "uart_kers.h" /* to get KER signal definitions */
67
68 /*==== CONST ================================================================*/
69
70 /*==== LOCAL VARS ===========================================================*/
71
72 /*==== PRIVATE FUNCTIONS ====================================================*/
73
74 /*==== PUBLIC FUNCTIONS =====================================================*/
75
76
77
78 /*
79 +------------------------------------------------------------------------------
80 | Function : rt_t1_expired
81 +------------------------------------------------------------------------------
82 | Description : Handles the expitration of the acknowledge timer t1.
83 |
84 | Parameters : no parameters
85 |
86 +------------------------------------------------------------------------------
87 */
88 GLOBAL void rt_t1_expired ()
89 {
90 TRACE_FUNCTION( "rt_t1_expired" );
91
92 switch( uart_data->rt.state_t1 )
93 {
94 case UART_RT_STARTED:
95 uart_data->rt.state_t1 = UART_RT_STOPPED;
96 sig_rt_ker_timeout_t1_ind();
97 break;
98 default:
99 TRACE_ERROR( "RT_T1_EXPIRED unexpected" );
100 break;
101 }
102 } /* rt_t1_expired() */
103
104
105
106 /*
107 +------------------------------------------------------------------------------
108 | Function : rt_t2_expired
109 +------------------------------------------------------------------------------
110 | Description : Handles the expitration of the response timer t2.
111 |
112 | Parameters : no parameters
113 |
114 +------------------------------------------------------------------------------
115 */
116 GLOBAL void rt_t2_expired ()
117 {
118 TRACE_FUNCTION( "rt_t2_expired" );
119
120 switch( uart_data->rt.state_t2 )
121 {
122 case UART_RT_STARTED:
123 uart_data->rt.state_t2 = UART_RT_STOPPED;
124 sig_rt_ker_timeout_t2_ind();
125 break;
126 default:
127 TRACE_ERROR( "RT_T2_EXPIRED unexpected" );
128 break;
129 }
130 } /* rt_t2_expired() */
131
132
133
134 /*
135 +------------------------------------------------------------------------------
136 | Function : rt_t3_expired
137 +------------------------------------------------------------------------------
138 | Description : Handles the expiration of the wake-up timer t3.
139 |
140 | Parameters : no parameters
141 |
142 +------------------------------------------------------------------------------
143 */
144 GLOBAL void rt_t3_expired ()
145 {
146 TRACE_FUNCTION( "rt_t3_expired" );
147
148 switch( uart_data->rt.state_t3 )
149 {
150 case UART_RT_STARTED:
151 uart_data->rt.state_t3 = UART_RT_STOPPED;
152 sig_rt_ker_timeout_t3_ind();
153 break;
154 default:
155 TRACE_ERROR( "RT_T3_EXPIRED unexpected" );
156 break;
157 }
158 } /* rt_t3_expired() */
159
160
161 /*
162 +------------------------------------------------------------------------------
163 | Function : rt_tesd_expired
164 +------------------------------------------------------------------------------
165 | Description : Handles the expiration of the timer tesd.
166 |
167 | Parameters : no parameters
168 |
169 +------------------------------------------------------------------------------
170 */
171 GLOBAL void rt_tesd_expired ()
172 {
173 TRACE_FUNCTION( "rt_tesd_expired" );
174
175 switch( uart_data->rt.state_tesd )
176 {
177 case UART_RT_STARTED:
178 /* uart_data->rt.state_tesd = UART_RT_STOPPED; state_tesd is not reset here
179 * Every DLC that needs TESD will call "sig_dtx_rt_start_tesd_req" but only to
180 * indicate its TESD-startvalue. The timer is started hereafter with the lowest
181 * startvalue.
182 */
183 uart_data->rt.tesd = (T_TIME)-1;
184 sig_rt_ker_timeout_tesd_ind();
185 if( uart_data->rt.tesd != ((T_TIME)-1) )
186 { /*
187 * timer needs to be restarted
188 */
189 #ifdef _SIMULATION_
190 char buf[80];
191 sprintf(buf, "ESD: Restart timer TESD: %d", uart_data->rt.tesd);
192 TRACE_EVENT(buf);
193 #endif /* _SIMULATION_ */
194 if (TIMER_START(UART_handle, uart_data->timer_tesd_index, uart_data->rt.tesd) NEQ VSI_OK)
195 {
196 TRACE_EVENT_P1("VSI entity: Can't start timer, uart_rtp(%d)",
197 __LINE__);
198 }
199 uart_data->rt.state_tesd = UART_RT_STARTED;
200 }
201 else
202 {
203 #ifdef _SIMULATION_
204 TRACE_EVENT("Nobody restarted the timer");
205 #endif /* _SIMULATION_ */
206 uart_data->rt.state_tesd = UART_RT_STOPPED;
207 }
208 break;
209 default:
210 TRACE_ERROR( "RT_TESD_EXPIRED unexpected" );
211 break;
212 }
213 } /* rt_tesd_expired() */