comparison src/g23m-gprs/llc/llc_itxp.c @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
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 (ITX-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef LLC_ITXP_C
24 #define LLC_ITXP_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 #include "llc_f.h" /* to get the global entity definitions */
41 #include "llc_itxf.h" /* to get local function definitions */
42 #include <string.h> /* to get memcpy */
43
44 /*==== CONST ================================================================*/
45
46 /*==== LOCAL VARS ===========================================================*/
47
48 /*==== PRIVATE FUNCTIONS ====================================================*/
49
50 /*==== PUBLIC FUNCTIONS =====================================================*/
51
52
53 /*
54 +------------------------------------------------------------------------------
55 | Function : itx_ll_desc_req
56 +------------------------------------------------------------------------------
57 | Description : Handles the primitive LL_DATA_REQ
58 |
59 | Parameters : *ll_desc_req/ll_data_req - Ptr to primitive payload
60 |
61 +------------------------------------------------------------------------------
62 */
63 GLOBAL void itx_ll_desc_req
64 (
65 #ifdef LL_DESC
66 T_LL_DESC_REQ *ll_desc_req
67 #else
68 T_LL_DATA_REQ *ll_desc_req
69 #endif
70 )
71 {
72 BOOL success;
73
74 TRACE_FUNCTION( "ll_desc_req" );
75
76 SWITCH_LLC (ll_desc_req->sapi);
77 #ifdef REL99
78 llc_data->cur_pfi = ll_desc_req->pkt_flow_id; /* store current packet flow identifier */
79 TRACE_EVENT_P1("packet flow id = %d",ll_desc_req->pkt_flow_id);
80 #endif
81 llc_data->cur_qos = ll_desc_req->ll_qos; /* store current QoS */
82 TRACE_EVENT_P1("peak throughput = %d",ll_desc_req->ll_qos.peak);
83 llc_data->cur_radio_prio = ll_desc_req->radio_prio;
84 TRACE_EVENT_P1("radio priority = %d",ll_desc_req->radio_prio);
85
86 #ifdef LL_DESC
87 TRACE_2_PARA("s:%d len:%d", ll_desc_req->sapi, ll_desc_req->desc_list3.list_len);
88 #else
89 TRACE_2_PARA("s:%d len:%d", ll_desc_req->sapi, BYTELEN(ll_desc_req->sdu.l_buf));
90 #endif
91 /*
92 * Set up the attached counter
93 */
94 ll_desc_req->attached_counter = CCI_NO_ATTACHE;
95
96 switch (GET_STATE(ITX))
97 {
98 case ITX_TLLI_UNASSIGNED:
99 case ITX_TLLI_ASSIGNED:
100 /*
101 * Ignore primitive, but free prim data.
102 */
103 #ifdef LL_DESC
104 llc_cl_desc3_free((T_desc3*)ll_desc_req->desc_list3.first);
105 #endif /* LL_DESC */
106 PFREE (ll_desc_req);
107 TRACE_ERROR( "ll_desc_req unexpected" );
108 break;
109
110 case ITX_ABM:
111 case ITX_ABM_PEER_BUSY:
112 itx_i_queue_store (ll_desc_req, &success);
113 if ( success == FALSE )
114 {
115 TRACE_0_INFO("ll_desc_req storing failed" );
116 #ifdef LL_DESC
117 llc_cl_desc3_free((T_desc3*)ll_desc_req->desc_list3.first);
118 #endif /* LL_DESC */
119 PFREE (ll_desc_req);
120 }
121 else
122 {
123 itx_send_next_frame (ABIT_NO_REQ);
124 itx_handle_ll_ready_ind (FALSE);
125 }
126 /* SET_STATE (ITX, SAME_STATE); */
127 break;
128
129 default:
130 #ifdef LL_DESC
131 llc_cl_desc3_free((T_desc3*)ll_desc_req->desc_list3.first);
132 #endif /* LL_DESC */
133 PFREE (ll_desc_req);
134 TRACE_ERROR( "ll_desc_req unexpected" );
135 break;
136 }
137
138 } /* itx_ll_desc_req() */
139
140 /*
141 +------------------------------------------------------------------------------
142 | Function : itx_ll_data_req
143 +------------------------------------------------------------------------------
144 | Description : Handles the primitive LL_DATA_REQ
145 |
146 | Parameters : *ll_data_req - Ptr to primitive payload
147 |
148 +------------------------------------------------------------------------------
149 */
150 #ifdef LL_DESC
151 GLOBAL void itx_ll_data_req ( T_LL_DATA_REQ *ll_data_req )
152 {
153 T_desc3 *desc3 = NULL;
154 USHORT len, desc_offset;
155 UBYTE *buf;
156
157 TRACE_FUNCTION( "uitx_ll_data_req" );
158
159 /*
160 * Allocate primitive and fill in the structure elements
161 */
162 {
163 PALLOC(ll_desc_req, LL_DESC_REQ);
164
165 ll_desc_req->sapi = ll_data_req->sapi;
166 ll_desc_req->tlli = ll_data_req->tlli;
167 ll_desc_req->ll_qos = ll_data_req->ll_qos;
168 ll_desc_req->radio_prio = ll_data_req->radio_prio;
169 ll_desc_req->reference1 = ll_data_req->reference1;
170 ll_desc_req->seg_pos = ll_data_req->seg_pos;
171 ll_desc_req->attached_counter = ll_data_req->attached_counter;
172 #ifdef REL99
173 ll_desc_req->pkt_flow_id = ll_data_req->pkt_flow_id;
174 #endif /* REL99 */
175 /*
176 * Allocate memory block for desc2 and set the values of the
177 * desc2-elements.
178 */
179
180 len = ll_data_req->sdu.l_buf >> 3;
181 desc_offset = ll_data_req->sdu.o_buf >> 3;
182
183 desc3 = llc_palloc_desc(len, desc_offset);
184
185 buf = (UBYTE*)desc3->buffer;
186
187 memcpy(&buf[desc3->offset],
188 &ll_data_req->sdu.buf[desc_offset],
189 len);
190 ll_desc_req->desc_list3.first = (ULONG)desc3;
191 ll_desc_req->desc_list3.list_len = desc3->len;
192
193 /*
194 * Primitive is handled in uitx_ll_unitdesc_req
195 */
196 itx_ll_desc_req (ll_desc_req);
197 }
198 PFREE(ll_data_req);
199
200
201 }
202 #endif /* LL_DESC */