FreeCalypso > hg > fc-magnetite
comparison src/g23m-gprs/llc/llc_uirxp.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 (UIRX-statemachine) | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifndef LLC_UIRXP_C | |
24 #define LLC_UIRXP_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_uirxf.h" /* to get queue management prototypes */ | |
42 /*==== CONST ================================================================*/ | |
43 | |
44 /*==== LOCAL VARS ===========================================================*/ | |
45 | |
46 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
47 | |
48 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
49 | |
50 | |
51 | |
52 /* | |
53 +------------------------------------------------------------------------------ | |
54 | Function : uirx_ll_getunitdata_req | |
55 +------------------------------------------------------------------------------ | |
56 | Description : Handles the primitive LL_GETUNITDATA_REQ | |
57 | | |
58 | Parameters : *ll_getunitdata_req - Ptr to primitive payload | |
59 | | |
60 +------------------------------------------------------------------------------ | |
61 */ | |
62 GLOBAL void uirx_ll_getunitdata_req ( T_LL_GETUNITDATA_REQ *ll_getunitdata_req ) | |
63 { | |
64 T_LL_UNITDATA_IND *ll_unitdata_ind; | |
65 | |
66 TRACE_FUNCTION( "ll_getunitdata_req" ); | |
67 | |
68 SWITCH_LLC (ll_getunitdata_req->sapi); | |
69 | |
70 TRACE_1_PARA("s:%d", ll_getunitdata_req->sapi ); | |
71 | |
72 switch (GET_STATE(UIRX)) | |
73 { | |
74 case UIRX_TLLI_UNASSIGNED_NOT_READY: | |
75 PFREE (ll_getunitdata_req); | |
76 SET_STATE (UIRX, UIRX_TLLI_UNASSIGNED_READY); | |
77 break; | |
78 | |
79 case UIRX_ADM_NOT_READY: | |
80 PFREE (ll_getunitdata_req); | |
81 | |
82 /* | |
83 * First check, if already a frame is waiting. | |
84 */ | |
85 if (uirx_queue_retrieve (&ll_unitdata_ind)) | |
86 { | |
87 /* | |
88 * A frame is waiting. Send primitive LL-UNITDATA-IND | |
89 * to either SNDCP or GSMS, depending on the SAPI (GMM | |
90 * uses now flow control!). | |
91 */ | |
92 switch (ll_unitdata_ind->sapi) | |
93 { | |
94 case LL_SAPI_3: | |
95 case LL_SAPI_5: | |
96 case LL_SAPI_9: | |
97 case LL_SAPI_11: | |
98 TRACE_3_OUT_PARA("s:%d len:%d c:%d", ll_unitdata_ind->sapi, | |
99 BYTELEN(ll_unitdata_ind->sdu.l_buf), | |
100 ll_unitdata_ind->cipher); | |
101 PSEND (hCommSNDCP, ll_unitdata_ind); | |
102 break; | |
103 | |
104 case LL_SAPI_7: | |
105 #ifdef LL_2to1 | |
106 TRACE_PRIM_TO("MM"); | |
107 TRACE_3_OUT_PARA("s:%d len:%d c:%d", ll_unitdata_ind->sapi, | |
108 BYTELEN(ll_unitdata_ind->sdu.l_buf), | |
109 ll_unitdata_ind->cipher); | |
110 PSEND (hCommMM, ll_unitdata_ind); | |
111 break; | |
112 #else | |
113 TRACE_PRIM_TO("GSMS"); | |
114 TRACE_3_OUT_PARA("s:%d len:%d c:%d", ll_unitdata_ind->sapi, | |
115 BYTELEN(ll_unitdata_ind->sdu.l_buf), | |
116 ll_unitdata_ind->cipher); | |
117 PSEND (hCommGSMS, ll_unitdata_ind); | |
118 break; | |
119 #endif | |
120 | |
121 default: | |
122 PFREE (ll_unitdata_ind); | |
123 TRACE_ERROR ("Invalid SAPI value"); | |
124 break; | |
125 } | |
126 } | |
127 else | |
128 { | |
129 /* | |
130 * No frame is waiting. Allow straight forwarding | |
131 * of the next received frame. | |
132 */ | |
133 SET_STATE (UIRX, UIRX_ADM_READY); | |
134 } | |
135 break; | |
136 | |
137 default: | |
138 PFREE (ll_getunitdata_req); | |
139 TRACE_ERROR( "LL_GETUNITDATA_REQ unexpected" ); | |
140 break; | |
141 } | |
142 | |
143 } /* uirx_ll_getunitdata_req() */ |