comparison src/g23m-aci/aci/cmh_psir.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 | File: cmh_psir.c
4 +------------------------------------------------------------------------------
5 | Copyright 2002 Texas Instruments Berlin, AG
6 | All rights reserved.
7 |
8 | This file is confidential and a trade secret of Texas
9 | Instruments Berlin, AG
10 | The receipt of or possession of this file does not convey
11 | any rights to reproduce or disclose its contents or to
12 | manufacture, use, or sell anything it may describe, in
13 | whole, or in part, without the specific written consent of
14 | Texas Instruments Berlin, AG.
15 +------------------------------------------------------------------------------
16 | Purpose: This module defines the functions used by the command
17 | handler for packet I/O (PSI).
18 +------------------------------------------------------------------------------
19 */
20 #ifdef FF_PSI
21
22 #ifndef CMH_PSIR_C
23 #define CMH_PSIR_C
24 #endif
25
26 #include "aci_all.h"
27 /*==== INCLUDES ===================================================*/
28
29 #ifdef GPRS
30 #include "gprs.h"
31 #endif
32 #include "dti.h" /* functionality of the dti library */
33 #include "aci_cmh.h"
34 #include "ati_cmd.h"
35 #include "aci_cmd.h"
36
37 #include "aci.h"
38 #include "psa.h"
39
40 #include "cmh.h"
41 #include "dti_conn_mng.h"
42 #include "dti_cntrl_mng.h"
43 #ifdef GPRS
44 #include "gaci.h"
45 #include "gaci_cmh.h"
46 #endif
47
48
49 #include "sap_dti.h"
50 #include "cmh_sm.h"
51
52 #include "psa_psi.h"
53 #include "cmh_psi.h"
54 #include "ati_src_psi.h"
55
56
57 #ifndef CMH_UARTR_C
58 #define CMH_UARTR_C
59 #endif
60
61 #include "aci_all.h"
62
63
64 /*==== CONSTANTS ==================================================*/
65 #define MAX_BAUD_RATE 20
66 /*==== TYPES ======================================================*/
67
68 /*==== EXPORT =====================================================*/
69
70 /*==== VARIABLES ==================================================*/
71
72
73 /*==== FUNCTIONS ==================================================*/
74
75 /*
76 +--------------------------------------------------------------------+
77 | PROJECT : GPRS (8441) MODULE : CMH_PSI |
78 | STATE : finished ROUTINE : cmhPSI_Ind |
79 +--------------------------------------------------------------------+
80
81 PURPOSE :
82 */
83 GLOBAL void cmhPSI_Ind (T_ACI_PSI *psi_indic_msg, UBYTE src_id,U32 dio_cap)
84 {
85 #ifdef DTI
86 UBYTE capability = DTI_CPBLTY_NO;
87 UBYTE dti_capability;
88 BOOL ret_val1 = FALSE;
89 BOOL ret_val2 = FALSE;
90 T_DTI_ENTITY_ID entity_list[] = {DTI_ENTITY_ACI};
91
92 TRACE_FUNCTION ("cmhPSI_Ind()");
93 /* register device to the DTI Control Manager */
94 switch (dio_cap)
95 {
96 case DIO_DATA_SER:
97 capability = DTI_CPBLTY_SER;
98 break;
99 case DIO_DATA_MUX:
100 capability = DTI_CPBLTY_SER;
101 break;
102 case DIO_DATA_PKT:
103 capability = DTI_CPBLTY_PKT;
104 break;
105 }
106 dti_capability = capability;
107 ret_val1 = dti_cntrl_new_device ( src_id, /* ATI source ID */
108 DTI_ENTITY_PSI, /* device ID */
109 (UBYTE)(psi_indic_msg->devId&DIO_DEVICE_MASK), /* device number */
110 UART_DLCI_NOT_MULTIPLEXED,/* sub-channel number */
111 DTI_PORT_NUMBER_NOTPRESENT,/* ATI-RIV port number */
112 (UBYTE)(dti_capability|DTI_CPBLTY_CMD),/* capability */
113 (UBYTE)((psi_indic_msg->devId&DIO_DRV_MASK)>>24),/* driver id */
114 (UBYTE)((psi_indic_msg->devId&ACI_DIO_ID_MASK)>>8)); /* dio id */
115
116 if((psi_indic_msg->psi_data_mode EQ DRIVER_MODE_AT) OR
117 (psi_indic_msg->psi_data_mode EQ DRIVER_MODE_AT_DATA))
118 {
119
120 ret_val2 = dti_cntrl_est_dpath_indirect ( src_id,
121 entity_list,
122 1,
123 SPLIT,
124 atiPSI_dti_cb,
125 /*dti_capability*/DTI_CPBLTY_CMD,
126 DTI_CID_NOTPRESENT);
127 }
128 else
129 {
130 ret_val2 = TRUE;
131 }
132 if ((ret_val1 EQ TRUE) AND (ret_val2 EQ TRUE))
133 {
134 psaPSI_ConnRes ( psi_indic_msg->devId);
135 }
136 else
137 {
138 TRACE_EVENT ("ERROR: DTI MANAGER CAN NOT REGISTER DEVICE OR SET UP DTI CONNECTION");
139 }
140 #else
141 TRACE_EVENT ("ERROR: DTI MANAGER NOT ENABLED");
142 #endif /* DTI */
143 }
144
145 /*
146 +--------------------------------------------------------------------+
147 | PROJECT : GPRS (8441) MODULE : CMH_PSI |
148 | STATE : finished ROUTINE : cmhPSI_DTI_OpenCnf |
149 +--------------------------------------------------------------------+
150
151 PURPOSE :
152 */
153 GLOBAL void cmhPSI_DTI_OpenCnf (U32 devId, U32 link_id, T_DTI_CONN_RESULT result)
154 {
155 #ifdef DTI
156
157 TRACE_FUNCTION ("cmhPSI_DTI_OpenCnf()");
158
159 dti_cntrl_entity_connected( link_id, DTI_ENTITY_PSI, result);
160 #endif /* DTI */
161 }
162
163 /*
164 +--------------------------------------------------------------------+
165 | PROJECT : MODULE : CMH_PSI |
166 | STATE : finished ROUTINE : cmhPSI_DTI_Close |
167 +--------------------------------------------------------------------+
168
169 PURPOSE :
170 */
171 GLOBAL void cmhPSI_DTI_Close (U32 devId, T_PSI_DTI_CLS_TYP state, U32 link_id)
172 {
173 #ifdef DTI
174 #ifdef GPRS
175 UBYTE cid = PDP_CONTEXT_CID_INVALID;
176 #endif
177
178 TRACE_FUNCTION ("cmhPSI_Close()");
179 #ifdef GPRS
180 cid = gaci_get_cid_over_link_id(link_id);
181 #endif
182
183 switch(state)
184 {
185 case PSI_DTI_CLS_CNF:
186 /*DTI connection has been closed*/
187 dti_cntrl_entity_disconnected(link_id, DTI_ENTITY_PSI);
188 break;
189
190 case PSI_DTI_CLS_IND:
191 /*dti_cntrl_close_dpath_from_dti_id(EXTRACT_DTI_ID(link_id));*/
192 dti_cntrl_entity_disconnected(link_id, DTI_ENTITY_PSI);
193 break;
194
195 default:
196 break;
197 }
198 #ifdef GPRS
199 if( PDP_CONTEXT_CID_INVALID NEQ cid)
200 {
201 /* Make sure the context gets de-activated in any case */
202 cmhSM_deactivateAContext(CMD_SRC_NONE, cid);
203
204 gaci_RAT_caller(RAT_NO_CARRIER, cid, AT_CMD_CGDATA, CME_ERR_Unknown);
205 }
206 #endif
207
208 #endif /* DTI */
209 }
210
211 #endif /*FF_PSI*/
212 /*==== EOF ========================================================*/