FreeCalypso > hg > fc-tourmaline
comparison src/g23m-gprs/llc/llc_irxp.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 (IRX-statemachine) | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifndef LLC_IRXP_C | |
24 #define LLC_IRXP_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_irxf.h" /* to get IRX helper functions */ | |
42 | |
43 | |
44 /*==== CONST ================================================================*/ | |
45 | |
46 /*==== LOCAL VARS ===========================================================*/ | |
47 | |
48 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
49 | |
50 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
51 | |
52 /* | |
53 +------------------------------------------------------------------------------ | |
54 | Function : irx_ll_getdata_req | |
55 +------------------------------------------------------------------------------ | |
56 | Description : Handles the primitive LL_GETDATA_REQ | |
57 | | |
58 | Parameters : *ll_getdata_req - Ptr to primitive payload | |
59 | | |
60 +------------------------------------------------------------------------------ | |
61 */ | |
62 GLOBAL void irx_ll_getdata_req ( T_LL_GETDATA_REQ *ll_getdata_req ) | |
63 { | |
64 BOOL frame_found; | |
65 T_LL_UNITDATA_IND *ll_unitdata_ind; | |
66 | |
67 TRACE_FUNCTION( "ll_getdata_req" ); | |
68 | |
69 SWITCH_LLC (ll_getdata_req->sapi); | |
70 | |
71 TRACE_1_PARA("s:%d", ll_getdata_req->sapi); | |
72 | |
73 switch (GET_STATE(IRX)) | |
74 { | |
75 case IRX_TLLI_UNASSIGNED: | |
76 /* | |
77 * Ignore primitive. | |
78 */ | |
79 PFREE (ll_getdata_req); | |
80 /* SET_STATE (IRX, SAME_STATE); */ | |
81 break; | |
82 | |
83 case IRX_TLLI_ASSIGNED: | |
84 /* | |
85 * Store L3 ready flag | |
86 */ | |
87 llc_data->irx->ll_send_ready = TRUE; | |
88 PFREE (ll_getdata_req); | |
89 /* SET_STATE (IRX, SAME_STATE); */ | |
90 break; | |
91 | |
92 case IRX_ABM: | |
93 /* | |
94 * Try to retrieve a frame from the queue and | |
95 * forward it to L3, else store L3 ready flag. | |
96 */ | |
97 irx_queue_retrieve (&ll_unitdata_ind, &frame_found); | |
98 if (frame_found) | |
99 { | |
100 PPASS (ll_unitdata_ind, ll_data_ind, LL_DATA_IND); | |
101 TRACE_2_OUT_PARA("s:%d len:%d", ll_data_ind->sapi, BYTELEN(ll_data_ind->sdu.l_buf)); | |
102 PSEND (hCommSNDCP, ll_data_ind); | |
103 | |
104 llc_data->irx->ll_send_ready = FALSE; | |
105 | |
106 /* SET_STATE (IRX, SAME_STATE); */ | |
107 } | |
108 else | |
109 { | |
110 llc_data->irx->ll_send_ready = TRUE; | |
111 | |
112 /* SET_STATE (IRX, SAME_STATE); */ | |
113 } | |
114 PFREE (ll_getdata_req); | |
115 break; | |
116 | |
117 case IRX_ABM_BUSY: | |
118 /* | |
119 * Try to retrieve a frame from the queue and | |
120 * forward it to L3, else store L3 ready flag. | |
121 */ | |
122 irx_queue_retrieve (&ll_unitdata_ind, &frame_found); | |
123 if (frame_found) | |
124 { | |
125 PPASS (ll_unitdata_ind, ll_data_ind, LL_DATA_IND); | |
126 TRACE_2_OUT_PARA("s:%d len:%d", ll_data_ind->sapi, BYTELEN(ll_data_ind->sdu.l_buf)); | |
127 PSEND (hCommSNDCP, ll_data_ind); | |
128 | |
129 llc_data->irx->ll_send_ready = FALSE; | |
130 | |
131 /* | |
132 * Indicate the clearance of the 'own received | |
133 * busy' condition to the peer entity | |
134 */ | |
135 irx_send_ack (ABIT_SET_REQ); | |
136 | |
137 SET_STATE (IRX, IRX_ABM); | |
138 } | |
139 else | |
140 { | |
141 llc_data->irx->ll_send_ready = TRUE; | |
142 | |
143 /* SET_STATE (IRX, SAME_STATE); */ | |
144 } | |
145 PFREE (ll_getdata_req); | |
146 break; | |
147 | |
148 default: | |
149 PFREE (ll_getdata_req); | |
150 TRACE_ERROR( "LL_GETDATA_REQ unexpected" ); | |
151 break; | |
152 } | |
153 | |
154 } /* irx_ll_getdata_req() */ |