comparison src/g23m-gprs/llc/llc_itxt.c @ 183:219afcfc6250

src/g23m-gprs: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 13 Oct 2016 04:24:13 +0000
parents
children
comparison
equal deleted inserted replaced
182:f02d0a0e1849 183:219afcfc6250
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 LLC and implements all
18 | functions to handles the incoming primitives as described in
19 | the SDL-documentation (T201-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef LLC_ITXT_C
24 #define LLC_ITXT_C
25 #endif
26
27 #define ENTITY_LLC
28
29 /*==== INCLUDES =============================================================*/
30
31 #include "typedefs.h" /* to get Condat data types */
32 #include "vsi.h" /* to get a lot of macros */
33 #include "macdef.h"
34 #include "gprs.h"
35 #include "gsm.h" /* to get a lot of macros */
36 #include "cnf_llc.h" /* to get cnf-definitions */
37 #include "mon_llc.h" /* to get mon-definitions */
38 #include "prim.h" /* to get the definitions of used SAP and directions */
39 #include "llc.h" /* to get the global entity definitions */
40
41 #include "llc_itxf.h" /* to get local function definitions */
42 #include "llc_llmes.h" /* to get LLME signal definitions */
43 #include "llc_irxs.h" /* to get ITX signal definitions */
44
45
46 /*==== CONST ================================================================*/
47
48 /*==== LOCAL VARS ===========================================================*/
49
50 /*==== PRIVATE FUNCTIONS ====================================================*/
51
52 /*==== PUBLIC FUNCTIONS =====================================================*/
53
54
55 /*
56 +------------------------------------------------------------------------------
57 | Function : itx_T201_start
58 +------------------------------------------------------------------------------
59 | Description : This procedure starts timer T201 for the current SAPI.
60 |
61 | Parameters :
62 +------------------------------------------------------------------------------
63 */
64 GLOBAL void itx_T201_start (T_TIME length)
65 {
66 TRACE_FUNCTION( "itx_T201_start" );
67
68 /*
69 * Start timer T201 for the current SAPI.
70 */
71 #ifdef _SIMULATION_
72 /*
73 * In simulation mode, use always a timer value of 5 seconds.
74 */
75 vsi_t_start (VSI_CALLER
76 (USHORT)(TIMER_T201_BASE + IMAP(llc_data->current_sapi)), 5000);
77 #else
78 vsi_t_start (VSI_CALLER
79 (USHORT)(TIMER_T201_BASE + IMAP(llc_data->current_sapi)), length);
80 #endif /* _SIMULATION_ */
81
82 return;
83 } /* itx_T201_start() */
84
85
86 /*
87 +------------------------------------------------------------------------------
88 | Function : itx_T201_stop
89 +------------------------------------------------------------------------------
90 | Description : This procedure stops timer T201 for the current SAPI.
91 |
92 | Parameters :
93 +------------------------------------------------------------------------------
94 */
95 GLOBAL void itx_T201_stop (void)
96 {
97 TRACE_FUNCTION( "itx_T201_stop" );
98
99 /*
100 * Stops timer T201 for the current SAPI.
101 */
102 vsi_t_stop (VSI_CALLER
103 (USHORT)(TIMER_T201_BASE + IMAP(llc_data->current_sapi)));
104
105 return;
106 } /* itx_T201_stop() */
107
108
109
110 /*
111 +------------------------------------------------------------------------------
112 | Function : itx_timer_t201
113 +------------------------------------------------------------------------------
114 | Description : Handles expiry of timer T201. This function is called from
115 | pei_timeout().
116 |
117 | Parameters : sapi - indicates the SAPI for which the timer has expired
118 |
119 +------------------------------------------------------------------------------
120 */
121 GLOBAL void itx_timer_t201 (UBYTE sapi)
122 {
123 TRACE_FUNCTION( "itx_timer_t201" );
124
125 TRACE_0_INFO("T201 EXPIRED" );
126
127 SWITCH_LLC (sapi);
128
129 switch (GET_STATE(ITX))
130 {
131 case ITX_ABM:
132 /*
133 * If a frame is associated with T201, increment the
134 * retransmission counter and if below N200, restart
135 * T201. Else initate the ABM-Re-Establish procedure.
136 */
137 if ( llc_data->itx->t201_entry != NULL)
138 {
139 llc_data->itx->t201_entry->status = IQ_RETR_FRAME;
140
141 if ( llc_data->itx->t201_entry->n_retr <= *(llc_data->n200) )
142 {
143 TIMERSTART (T201, llc_data->t200->length);
144 itx_send_next_frame (ABIT_SET_REQ);
145 }
146 else
147 {
148 /*
149 * Initate ABM Re-Establish procedure. The state change
150 * will be done by the reestablish procedure later.
151 */
152 sig_itx_llme_reest_ind (LLGMM_ERRCS_ACK_NO_PEER_RES_REEST);
153 }
154 }
155 /* SET_STATE (ITX, SAME_STATE); */
156 break;
157
158 case ITX_ABM_PEER_BUSY:
159 /*
160 * If the Peer busy retransmission counter is below N200
161 * restart T201 and send an appropriated S frame. Else
162 * initate the ABM-Re-Establish procedure.
163 */
164 if ( llc_data->itx->n_pb_retr < *(llc_data->n200) )
165 {
166 TIMERSTART (T201, llc_data->t200->length);
167 sig_itx_irx_s_frame_req (ABIT_SET_REQ);
168 llc_data->itx->n_pb_retr += 1;
169 }
170 else
171 {
172 sig_itx_llme_reest_ind (LLGMM_ERRCS_PEER_BUSY_REEST);
173 }
174 /* SET_STATE (ITX, SAME_STATE); */
175 break;
176
177 default:
178 TRACE_ERROR( "T201 unexpected" );
179 break;
180 }
181
182 } /* itx_timer_t201() */