comparison src/g23m-aci/aci/aci_bat_err.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 : ACI_BAT
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 : Handle cme and cms errors for BAT clients
18 +-----------------------------------------------------------------------------
19 */
20 #include "aci_all.h"
21
22 #include "aci_cmh.h" /* so see T_ACI_ERR_CLASS and other */
23 #include "psa.h"
24 #include "cmh.h" /* extern definition of aciErrDesc */
25
26 #include "aci_bat_cmh.h"
27 #include "aci_bat.h"
28 #include "aci_bat_err.h"
29
30 #include "psa_psi.h"
31
32
33 /*
34 * the [stq]AT_xxx function will set the global variable aciErrDesc with ACI_ERR_DESC.
35 * here we read it and cast it to the BAT value defined in
36 * T_BAT_plus_cme_error_error and T_BAT_plus_cms_error_err.
37 * Currently (03.March 2005) the error values of ACI and BAT are identical,
38 * but can cause a lot of problems when there is a mismatch!
39 * There should be used only the values of p_bat.h defined in bat.sap !
40 *
41 * on ACI level there are CME, CMS, CEER and EXT error values.
42 * CEER errors are/is only one in
43 * cmh_ccf.c:2159: ACI_ERR_DESC( ACI_ERR_CLASS_Ceer, CAUSE_MAKE(DEFBY_STD,
44 * and must be requested with the
45 * T_BAT_cmd_send send.ctrl_params = BAT_CMD_SET_PLUS_CEER by the apllication.
46 * BAT returns with a T_BAT_res_set_plus_ceer structure.
47 *
48 */
49
50 /*
51 +--------------------------------------------------------------------+
52 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
53 | STATE : code ROUTINE : aci_bat_err |
54 +--------------------------------------------------------------------+
55
56 PURPOSE : central BAT error function called by aci_bat_wrapper only.
57 it evaluates the global varaible aciErrDesc, which has been set
58 with the appropriate error value of the just ran ACI function.
59 */
60 GLOBAL void aci_bat_err (T_ACI_DTI_PRC_PSI *src_infos_psi)
61 {
62 T_ACI_ERR_CLASS err_class;
63 T_BAT_res_plus_cme_error cme_data;
64 T_BAT_res_plus_cms_error cms_data;
65 T_BAT_res_plus_ext_error ext_data;
66 T_BAT_cmd_response resp;
67
68 if (ACI_BAT_VALID_ERR_DESC())
69 {
70 err_class = (T_ACI_ERR_CLASS)ACI_BAT_GET_ERR_CLASS();
71 switch (err_class)
72 {
73 case (ACI_ERR_CLASS_Cme):
74 {
75 T_BAT_plus_cme_error_error bat_err;
76 T_ACI_CME_ERR err = (T_ACI_CME_ERR)ACI_BAT_GET_ERR_VALUE();
77 ACI_BAT_RESET_ERR_DESC();
78 bat_err = (T_BAT_plus_cme_error_error)err;
79 resp.ctrl_response = BAT_RES_PLUS_CME_ERROR;
80 resp.response.ptr_plus_cme_error=&cme_data;
81 resp.response.ptr_plus_cme_error->error = bat_err;
82 TRACE_EVENT_P1("aci_bat_err(): CME ERROR: %d", bat_err);
83 break;
84 }
85 case (ACI_ERR_CLASS_Cms):
86 {
87 T_BAT_plus_cms_error_err bat_err;
88 T_ACI_CMS_ERR err = (T_ACI_CMS_ERR)ACI_BAT_GET_ERR_VALUE();
89 ACI_BAT_RESET_ERR_DESC();
90 bat_err = (T_BAT_plus_cms_error_err)err;
91 resp.ctrl_response = BAT_RES_PLUS_CMS_ERROR;
92 resp.response.ptr_plus_cms_error=&cms_data;
93 resp.response.ptr_plus_cms_error->err = bat_err;
94 TRACE_EVENT_P1("aci_bat_err(): CMS ERROR: %d", bat_err);
95 break;
96 }
97 case (ACI_ERR_CLASS_Ext):
98 {
99 T_BAT_plus_ext_error_err bat_err;
100 T_ACI_EXT_ERR err = (T_ACI_EXT_ERR)ACI_BAT_GET_ERR_VALUE();
101 ACI_BAT_RESET_ERR_DESC();
102 bat_err = (T_BAT_plus_ext_error_err)err;
103 resp.ctrl_response = BAT_RES_PLUS_EXT_ERROR;
104 resp.response.ptr_plus_ext_error=&ext_data;
105 resp.response.ptr_plus_ext_error->err = bat_err;
106 TRACE_EVENT_P1("aci_bat_err(): EXT ERROR: %d", bat_err);
107 break;
108 }
109 case (ACI_ERR_CLASS_NotPresent):
110 default:
111 /* this should trigger to request the CEER errors by the application */
112 resp.ctrl_response = BAT_RES_PLUS_CME_ERROR;
113 resp.response.ptr_plus_cms_error=&cms_data;
114 resp.response.ptr_plus_cms_error->err=(T_BAT_plus_cms_error_err)BAT_CME_ERROR_UNKNOWN;
115 TRACE_EVENT("aci_bat_err(): UNKNOWN ERROR");
116 break;
117 }
118 }
119 else
120 {
121 TRACE_EVENT("aci_bat_err(): WARNING, no error value set!");
122
123 resp.ctrl_response = BAT_RES_PLUS_CME_ERROR;
124 resp.response.ptr_plus_cme_error=&cme_data;
125 resp.response.ptr_plus_cme_error->error=BAT_CME_ERROR_UNKNOWN;
126 }
127
128 aci_bat_send(src_infos_psi,&resp);
129 }
130
131 /*
132 +--------------------------------------------------------------------+
133 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
134 | STATE : code ROUTINE : sBAT_PlusCEER |
135 +--------------------------------------------------------------------+
136
137 PURPOSE :
138 */
139 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCEER (T_ACI_DTI_PRC_PSI *src_infos_psi,
140 T_BAT_cmd_send *cmd)
141 {
142 T_ACI_BAT_RSLT ret;
143 USHORT cause;
144
145 TRACE_FUNCTION ("sBAT_PlusCEER()");
146
147 /*
148 * Call the corresponding ACI function. T_ACI_BAT_RSLT is
149 * assumed to be equivalent to T_ACI_RESULT.
150 */
151 ret=(T_ACI_BAT_RSLT)qAT_PlusCEER((T_ACI_CMD_SRC)src_infos_psi->srcId,&cause);
152
153 /*
154 * If the query completes - and it should - send the response now.
155 */
156 if (ret==ACI_BAT_CMPL)
157 {
158 T_BAT_cmd_response resp;
159 T_BAT_res_set_plus_ceer ceer_data;
160
161 resp.ctrl_response=BAT_RES_SET_PLUS_CEER;
162 resp.response.ptr_set_plus_ceer=&ceer_data;
163
164 ceer_data.definedby=(T_BAT_plus_ceer_definedby)GET_CAUSE_DEFBY(cause);
165 ceer_data.originatingside=(T_BAT_plus_ceer_originatingside)GET_CAUSE_ORIGSIDE(cause);
166 ceer_data.originatingentity=(T_BAT_plus_ceer_originatingentity)GET_CAUSE_ORIGIN_ENTITY(cause);
167 ceer_data.causevalue=(U8)GET_CAUSE_VALUE(cause);
168
169 aci_bat_send(src_infos_psi,&resp);
170 }
171
172 return(ret);
173 }