comparison src/g23m-aci/aci/ati_mmi.c @ 1:d393cd9bb723

src/g23m-*: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
0:b6a5e36de839 1:d393cd9bb723
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-F&D (8411)
4 | Modul : ATI
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 : AT Command to connect UART with MTST in order to send
18 | traces on the channel
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef ATI_MMI_C
23 #define ATI_MMI_C
24
25 #include "aci_all.h"
26
27 #include "aci_cmh.h"
28 #include "ati_cmd.h"
29 #include "aci_io.h"
30 #include "aci_cmd.h"
31 #include "dti.h" /* functionality of the dti library */
32
33 #include "aci_mem.h"
34 #include "aci_cmh.h"
35 #ifdef FF_PSI
36 #include "psa_psi.h"
37 #endif /*FF_PSI*/
38
39 #ifdef FF_TRACE_OVER_MTST
40
41 typedef enum {
42 MTST_CONNECT = 0,
43 MTST_DISCONNECT
44 } T_MTST_CONNECT_CMD;
45
46 LOCAL T_ACI_RETURN sAT_PercentMTST (T_ACI_CMD_SRC srcId,
47 T_MTST_CONNECT_CMD connect_cmd);
48 GLOBAL BOOL MTST_connect_dti_cb(UBYTE dti_id, T_DTI_MNG_CB_TYPE result_type);
49
50 /*
51 +--------------------------------------------------------------------+
52 | PROJECT : GSM-F&D (8411) MODULE : |
53 | STATE : code ROUTINE : |
54 +--------------------------------------------------------------------+
55
56 PURPOSE : %MTST command ( display trace funktion )
57 */
58
59 GLOBAL T_ATI_RSLT setatPercentMTST ( char *cl, UBYTE srcId ) /* Function prototype is T_ATI_RSLT,so it is changed to T_ATI_RSLT */
60
61 {
62 TRACE_FUNCTION( "setatPercentMTST()" );
63
64 switch( *cl )
65 {
66 case '0':
67 if (sAT_PercentMTST(srcId, MTST_DISCONNECT) EQ AT_FAIL)
68 {
69 cmdCmeError(CME_ERR_Unknown);
70 return (ATI_FAIL);
71 }
72 break;
73
74 case '1':
75 if (sAT_PercentMTST (srcId, MTST_CONNECT) EQ AT_FAIL)
76 {
77 cmdCmeError(CME_ERR_Unknown);
78 return (ATI_FAIL);
79 }
80 break;
81
82 default:
83 cmdCmeError(CME_ERR_Unknown);
84 return (ATI_FAIL);
85 }
86
87 return (ATI_CMPL);
88 }
89
90 /*
91 +--------------------------------------------------------------------+
92 | PROJECT : GSM-F&D (8411) MODULE : |
93 | STATE : code ROUTINE : |
94 +--------------------------------------------------------------------+
95
96 PURPOSE :
97 */
98
99
100 GLOBAL T_ACI_RETURN sAT_PercentMTST (T_ACI_CMD_SRC srcId,
101 T_MTST_CONNECT_CMD connect_cmd)
102
103 {
104 UBYTE dti_id;
105 T_DTI_MNG_CONN_STATE state;
106 #ifdef FF_PSI
107 T_ACI_DTI_PRC_PSI *dti_prc=find_element (psi_src_params, srcId, cmhPSItest_srcId);
108 #endif /*FF_PSI*/
109 TRACE_FUNCTION ("sAT_PercentMTST()");
110
111 switch (connect_cmd)
112 {
113 case MTST_CONNECT:
114 if (dti_mng_connection (UNIT_MTST, &dti_id, &state) NEQ UNIT_INVALID)
115 {
116 return( AT_FAIL );
117 }
118 #ifdef FF_PSI
119 if (dti_prc EQ NULL)
120 {
121 if (!dti_mng_connect((UBYTE) srcId, DTI_ENTITY_UART, DTI_ENTITY_MTST,MTST_connect_dti_cb))
122 {
123 return( AT_FAIL );
124 }
125 return(AT_CMPL);
126 }
127 else
128 {
129 if (!dti_mng_connect((UBYTE) srcId, DTI_ENTITY_PSI, DTI_ENTITY_MTST,MTST_connect_dti_cb))
130 {
131 return( AT_FAIL );
132 }
133 return(AT_CMPL);
134 }
135 #else
136 if (!dti_mng_connect((UBYTE) srcId,
137 DTI_ENTITY_UART, DTI_ENTITY_MTST,
138 MTST_connect_dti_cb))
139 {
140 return( AT_FAIL );
141 }
142 return(AT_CMPL);
143 #endif /*FF_PSI*/
144
145 case MTST_DISCONNECT:
146 if (dti_mng_connection (DTI_ENTITY_MTST, &dti_id, &state) NEQ DTI_ENTITY_INVALID)
147 {
148 if (!dti_mng_disconnect ((UBYTE) dti_id))
149 {
150 return (AT_FAIL);
151 }
152 }
153 return (AT_CMPL);
154
155 default:
156 /* TRCCmeError(CME_ERR_Unknown);*/
157 return (AT_FAIL);
158 }
159 }
160
161 /*
162 +--------------------------------------------------------------------+
163 | PROJECT : GSM-F&D (8411) MODULE : |
164 | STATE : code ROUTINE : MTST_connect_dti_cb|
165 +--------------------------------------------------------------------+
166
167 PURPOSE : Callback for connection between MTST and UART/PSI.
168
169 */
170
171 GLOBAL BOOL MTST_connect_dti_cb(UBYTE dti_id, T_DTI_MNG_CB_TYPE result_type)
172 {
173 return TRUE;
174 }
175
176 #endif /* FF_TRACE_OVER_MTST */
177
178 #endif /* ATI_MMI_C */