FreeCalypso > hg > fc-magnetite
comparison src/aci2/aci/gaci_srcc.c @ 3:93999a60b835
src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 26 Sep 2016 00:29:36 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:c41a534f33c6 | 3:93999a60b835 |
---|---|
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 module implements the source control management for GACI. | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 | |
22 #ifdef GPRS | |
23 | |
24 #include "aci_all.h" | |
25 | |
26 /*==== INCLUDES ===================================================*/ | |
27 #include "dti.h" /* functionality of the dti library */ | |
28 #include "aci_cmh.h" | |
29 | |
30 #include "dti_conn_mng.h" | |
31 #include "dti_cntrl_mng.h" | |
32 | |
33 #include "gaci.h" | |
34 #include "gaci_cmh.h" | |
35 #include "psa.h" | |
36 #include "psa_sm.h" | |
37 #include "psa_gppp.h" | |
38 #include "psa_gmm.h" | |
39 | |
40 #include "cmh.h" | |
41 #include "cmh_sm.h" | |
42 #include "cmh_gppp.h" | |
43 #include "cmh_gmm.h" | |
44 #include "gaci_srcc.h" | |
45 | |
46 /*===== PRIVATE VARIABLES ==========================================*/ | |
47 static UBYTE entity_counter[SRRC_MAX_ENTITY]; | |
48 | |
49 /*===== FUNCTIONS DECLARATIONS =====================================*/ | |
50 | |
51 /* | |
52 +--------------------------------------------------------------------+ | |
53 | PROJECT : MODULE : ACI_DTI | | |
54 | STATE : finished ROUTINE : srcc_init | | |
55 +--------------------------------------------------------------------+ | |
56 | |
57 PURPOSE : init of source control management | |
58 */ | |
59 GLOBAL void srcc_init (void) | |
60 { | |
61 SHORT i = 0; | |
62 | |
63 for (i = 0; i < SRRC_MAX_ENTITY; i++) | |
64 entity_counter[i] = 0; | |
65 } | |
66 | |
67 /* | |
68 +--------------------------------------------------------------------+ | |
69 | PROJECT : MODULE : ACI_DTI | | |
70 | STATE : finished ROUTINE : srcc_new_count | | |
71 +--------------------------------------------------------------------+ | |
72 | |
73 PURPOSE : | |
74 */ | |
75 GLOBAL void srcc_new_count ( SRCC_LINK_NO link_no ) | |
76 { | |
77 if ( srcc_reserve_sources( link_no, 1) ) | |
78 { | |
79 switch( link_no ) | |
80 { | |
81 case SRCC_PPPS_SNDCP_LINK: | |
82 entity_counter[SRRC_PPPS_ENTITY]++; | |
83 break; | |
84 #if defined (FF_PKTIO) OR defined (FF_TCP_IP) OR defined (FF_PSI) | |
85 case SRCC_PKTIO_SNDCP_LINK: | |
86 break; | |
87 #endif /* FF_PKTIO OR FF_TCP_IP OR FF_PSI */ | |
88 case SRCC_NULL_SNDCP_LINK: | |
89 break; | |
90 #ifdef FF_SAT_E | |
91 case SRCC_SIM_SNDCP_LINK: | |
92 entity_counter[SRRC_SIM_ENTITY]++; | |
93 break; | |
94 #endif | |
95 #ifdef CO_UDP_IP | |
96 case SRCC_IP_SNDCP_LINK: | |
97 entity_counter[SRRC_IP_ENTITY]++; | |
98 break; | |
99 #endif | |
100 #ifdef FF_GPF_TCPIP | |
101 case SRCC_TCPIP_SNDCP_LINK: | |
102 entity_counter[SRRC_TCPIP_ENTITY]++; | |
103 break; | |
104 #endif | |
105 | |
106 default: | |
107 TRACE_EVENT_P1("ERROR: srcc_new_count: link_no unknown: %d",link_no); | |
108 return; | |
109 } | |
110 if( CS_ACTIVATED NEQ pdp_context[work_cids[cid_pointer] - 1].state ) | |
111 { | |
112 entity_counter[SRRC_SNDCP_ENTITY]++; | |
113 } | |
114 } | |
115 else | |
116 { | |
117 TRACE_EVENT_P1("ERROR: srcc_reserve_sources(%d,1) returns fail",link_no); | |
118 } | |
119 } | |
120 | |
121 /* | |
122 +--------------------------------------------------------------------+ | |
123 | PROJECT : MODULE : ACI_DTI | | |
124 | STATE : finished ROUTINE : srcc_delete_count | | |
125 +--------------------------------------------------------------------+ | |
126 | |
127 PURPOSE : | |
128 */ | |
129 GLOBAL void srcc_delete_count ( SRCC_LINK_NO link_no ) | |
130 { | |
131 switch( link_no ) | |
132 { | |
133 case SRCC_PPPS_SNDCP_LINK: | |
134 entity_counter[SRRC_PPPS_ENTITY]--; | |
135 entity_counter[SRRC_SNDCP_ENTITY]--; | |
136 return; | |
137 #if defined (FF_PKTIO) OR defined (FF_TCP_IP) OR defined (FF_PSI) | |
138 case SRCC_PKTIO_SNDCP_LINK: | |
139 entity_counter[SRRC_SNDCP_ENTITY]--; | |
140 return; | |
141 #endif /* FF_PKTIO OR FF_TCP_IP OR FF_PSI */ | |
142 case SRCC_NULL_SNDCP_LINK: | |
143 entity_counter[SRRC_SNDCP_ENTITY]--; | |
144 break; | |
145 #ifdef FF_SAT_E | |
146 case SRCC_SIM_SNDCP_LINK: | |
147 entity_counter[SRRC_SIM_ENTITY]--; | |
148 entity_counter[SRRC_SNDCP_ENTITY]--; | |
149 break; | |
150 #endif | |
151 case SRCC_IP_SNDCP_LINK: | |
152 #ifdef CO_UDP_IP | |
153 entity_counter[SRRC_IP_ENTITY]--; | |
154 #endif | |
155 entity_counter[SRRC_SNDCP_ENTITY]--; | |
156 break; | |
157 | |
158 #ifdef FF_GPF_TCPIP | |
159 case SRCC_TCPIP_SNDCP_LINK: | |
160 entity_counter[SRRC_TCPIP_ENTITY]--; | |
161 entity_counter[SRRC_SNDCP_ENTITY]--; | |
162 return; | |
163 #endif | |
164 | |
165 default: | |
166 return; | |
167 } | |
168 } | |
169 | |
170 /* | |
171 +--------------------------------------------------------------------+ | |
172 | PROJECT : MODULE : ACI_DTI | | |
173 | STATE : finished ROUTINE : srcc_reserve_sources | | |
174 +--------------------------------------------------------------------+ | |
175 | |
176 PURPOSE : check the possibility of creation a number of dti connections | |
177 */ | |
178 GLOBAL BOOL srcc_reserve_sources( SRCC_LINK_NO link_no, SHORT no ) | |
179 { | |
180 switch( link_no ) | |
181 { | |
182 case SRCC_PPPS_SNDCP_LINK: | |
183 if ( entity_counter[SRRC_PPPS_ENTITY] >= MAX_PPPS_INSTANCES || | |
184 entity_counter[SRRC_SNDCP_ENTITY] >= MAX_SNDCP_INSTANCES ) | |
185 return FALSE; | |
186 break; | |
187 | |
188 #if defined (FF_PKTIO) OR defined (FF_TCP_IP) OR defined (FF_PSI) | |
189 case SRCC_PKTIO_SNDCP_LINK: | |
190 #endif /* FF_PKTIO OR FF_TCP_IP OR FF_PSI */ | |
191 | |
192 case SRCC_NULL_SNDCP_LINK: | |
193 if ( entity_counter[SRRC_SNDCP_ENTITY] >= MAX_SNDCP_INSTANCES ) | |
194 return FALSE; | |
195 break; | |
196 #ifdef FF_SAT_E | |
197 case SRCC_SIM_SNDCP_LINK: | |
198 if ( entity_counter[SRRC_SIM_ENTITY] >= MAX_SIM_INSTANCES || | |
199 entity_counter[SRRC_SNDCP_ENTITY] >= MAX_SNDCP_INSTANCES ) | |
200 return FALSE; | |
201 break; | |
202 #endif /* FF_SAT_E */ | |
203 case SRCC_IP_SNDCP_LINK: | |
204 if ( entity_counter[SRRC_SNDCP_ENTITY] >= MAX_SNDCP_INSTANCES | |
205 #ifdef CO_UDP_IP | |
206 || | |
207 entity_counter[SRRC_IP_ENTITY] >= MAX_IP_INSTANCES | |
208 #endif | |
209 ) | |
210 return FALSE; | |
211 break; | |
212 #ifdef FF_GPF_TCPIP | |
213 case SRCC_TCPIP_SNDCP_LINK: | |
214 if ( entity_counter[SRRC_SNDCP_ENTITY] >= MAX_SNDCP_INSTANCES | |
215 || entity_counter[SRRC_TCPIP_ENTITY] >= MAX_TCPIP_INSTANCES ) | |
216 return FALSE; | |
217 break; | |
218 | |
219 #endif /* FF_GPF_TCPIP */ | |
220 default: | |
221 return FALSE; | |
222 } | |
223 | |
224 return TRUE; | |
225 } | |
226 | |
227 #endif |