comparison gsm-fw/g23m-aci/uart/uart_rtp.c @ 775:eedbf248bac0

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