1 |
/**************************************************************************** |
2 |
* F i l e D a t a |
3 |
* $Id: S4_INFN.c,v 1.20 2005/03/06 14:54:46 sebastiani Exp $ |
4 |
* $Revision: 1.20 $ |
5 |
* $Date: 2005/03/06 14:54:46 $ |
6 |
* $RCSfile: S4_INFN.c,v $ |
7 |
* |
8 |
**************************************************************************** |
9 |
* S W D e v e l o p m e n t E n v i r o n m e n t |
10 |
* |
11 |
* $Author: sebastiani $ |
12 |
* : |
13 |
**************************************************************************** |
14 |
* U p d a t i n g |
15 |
|
16 |
* $Log: S4_INFN.c,v $ |
17 |
* Revision 1.20 2005/03/06 14:54:46 sebastiani |
18 |
* version running on 06 03 2005 |
19 |
* |
20 |
* Revision 1.19 2005/02/19 10:19:38 sebastiani |
21 |
* ALM_S4_CALIB_00_HARD,ALM_S4_CALIB_00_SOFT,ALM_S4_128TRIGGER_0 added |
22 |
* |
23 |
* Revision 1.18 2005/01/10 14:02:13 faber |
24 |
* TRG,AC_1,AC_2,TOF Error Handler reviewed |
25 |
* |
26 |
* Revision 1.17 2004/12/20 14:02:04 faber |
27 |
* @LOG entry introduced in all ALM_WriteLog occurrences |
28 |
* |
29 |
* Revision 1.16 2004/11/30 11:51:53 faber |
30 |
* AC+AC2 software moved into AC_1 AC_2 |
31 |
* new calibration and initialization for AC |
32 |
* first version,never run |
33 |
* |
34 |
* Revision 1.15 2004/11/19 15:41:50 sebastiani |
35 |
* *** empty log message *** |
36 |
* |
37 |
* Revision 1.14 2004/11/19 15:14:52 sebastiani |
38 |
* PRH_EXTERN_{VAR,ARR,TABLE} removed and put them on the autogenerated parameter heeader file |
39 |
* |
40 |
* Revision 1.13 2004/10/05 13:32:41 sebastiani |
41 |
* stupid bugfix |
42 |
* |
43 |
* Revision 1.12 2004/10/04 13:59:05 alfarano |
44 |
* fixed some return code in run manager |
45 |
* |
46 |
* Revision 1.11 2004/10/04 13:42:48 sebastiani |
47 |
* *** empty log message *** |
48 |
* |
49 |
* Revision 1.10 2004/10/04 08:25:06 sebastiani |
50 |
* *** empty log message *** |
51 |
* |
52 |
* Revision 1.9 2004/10/01 13:59:45 sebastiani |
53 |
* some bugfix in calib, but not tested |
54 |
* |
55 |
* Revision 1.8 2004/10/01 11:13:21 sebastiani |
56 |
* TIMEOUT S4 calib fix |
57 |
* |
58 |
* Revision 1.7 2004/10/01 09:20:23 alfarano |
59 |
* AC2 and little bug fix on S4 return code |
60 |
* |
61 |
* Revision 1.6 2004/10/01 08:48:10 sebastiani |
62 |
* TRD alarma renamed TRD_S4 - S4 Alarm renamed S4_POWER |
63 |
* Callback function into DAQ_SendCmd2PIFWaitDAQReply_internal |
64 |
* |
65 |
* Revision 1.5 2004/09/27 15:42:43 alfarano |
66 |
* tracker sensor board functions |
67 |
* |
68 |
* Revision 1.4 2004/09/22 15:54:54 alfarano |
69 |
* S4 functions |
70 |
* |
71 |
* Revision 1.3 2004/08/27 13:30:39 alfarano |
72 |
* cvs header |
73 |
* |
74 |
* Revision 1.1 2003/10/03 16:12:26 faber |
75 |
* *** empty log message *** |
76 |
* |
77 |
* |
78 |
*****************************************************************************/ |
79 |
/*============================= Include File ================================*/ |
80 |
|
81 |
|
82 |
#include <src/INFN/LU_SourceFileID_INFN.h> |
83 |
#define __FILEID__ _S4_INFN__c |
84 |
|
85 |
#include <src/INFN/PRH_ParamHandler_INFN.h> |
86 |
#include <src/INFN/LU_LogUtility_INFN.h> |
87 |
#include <src/INFN/PRH_ParamHandler_INFN_auto.h> |
88 |
LU_DECL_MASK(); |
89 |
|
90 |
#include <src/INFN/DAQ_IDAQ_INFN.h> |
91 |
#include <src/INFN/CM_Common_INFN.h> |
92 |
#include <src/INFN/S4_INFN.h> |
93 |
#include <src/INFN/KHB_Driver_INFN.h> |
94 |
#include <src/INFN/CH_CommandHandler_INFN.h> |
95 |
#include <src/INFN/HB_HKBuffer_INFN.h> |
96 |
#include <src/INFN/HK_Manager_INFN.h> |
97 |
#include <src/INFN/ALM_Alarm_INFN.h> |
98 |
#include <src/INFN/RM_RunManager_INFN.h> |
99 |
#include <src/INFN/DAQ_IDAQ_INFN.h> |
100 |
|
101 |
/*============================ Global define ================================*/ |
102 |
|
103 |
|
104 |
/*============================== global types ==============================*/ |
105 |
|
106 |
DAQ_DECLBUF(S4_TempPif0,S4_MAXTEMPBUFFER); |
107 |
DAQ_DECLBUF(daq_reply,S4_MAXTEMPBUFFER); |
108 |
DAQ_DECLBUF(S4_Buffer,S4_MAXTEMPBUFFER); |
109 |
|
110 |
#define S4_SKIP_HEADER SM_PKTHEADER_LEN |
111 |
|
112 |
/*=========================== Structure define ==============================*/ |
113 |
|
114 |
|
115 |
/*============================ Enumerate define =============================*/ |
116 |
|
117 |
|
118 |
status_code S4_Init_ETOATO() |
119 |
{ |
120 |
CH_SetAtoEto(CH_S4_GEN_RESET,2,3); |
121 |
CH_SetAtoEto(CH_S4_READ_CR,2,3); |
122 |
CH_SetAtoEto(CH_S4_ACQUISITION,2,3); |
123 |
} |
124 |
|
125 |
status_code S4_Init() |
126 |
{ |
127 |
DAQ_BUFFER_INIT(S4_TempPif0); |
128 |
DAQ_BUFFER_INIT(daq_reply); |
129 |
DAQ_BUFFER_INIT(S4_Buffer); |
130 |
|
131 |
S4_Init_ETOATO(); |
132 |
|
133 |
return CM_RC_SUCCESSFUL; |
134 |
} |
135 |
|
136 |
status_code S4_Initialization() |
137 |
{ |
138 |
status_code status; |
139 |
DAQ_CMD_BUF* auto_buf; |
140 |
UINT16 status_reg; |
141 |
UINT16 combuf,outbuf; |
142 |
DAQ_FE s4_link = DAQ_FE_S4; |
143 |
|
144 |
DAQ_ResetPIF(DAQ_DEFAULT_ETO_TICS,DAQ_MAX_DTO_TICS,SM_DAQSETUP,HB_PKTTYPE_S4_INIT); |
145 |
PRH_VAR_S4_WORKING = 1; |
146 |
|
147 |
combuf = PRH_VAR_S4_TRH; |
148 |
status = HK_KHB_Cmd2FE(KHB_S4,1,0,&combuf,&outbuf,S4_BOARD_TIMEOUT); |
149 |
|
150 |
if (status == CM_RC_SUCCESSFUL) |
151 |
{ |
152 |
status = HK_ReadKHBStatusRegister(&status_reg); |
153 |
|
154 |
if (status == CM_RC_SUCCESSFUL) |
155 |
{ |
156 |
if (status_reg & KHB_STS_ALARM_S4_FE) |
157 |
{ |
158 |
/*@LOG S4 Initialization: S4 alarm on KHB status after S4_TRH setting */ |
159 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_TRH_1_SOFT); |
160 |
PRH_VAR_S4_WORKING = 0; |
161 |
} |
162 |
|
163 |
DAQ_Format_CMD_Empty(&S4_TempPif0); |
164 |
CH_GetBuf(CH_S4_GEN_RESET, &auto_buf); |
165 |
DAQ_Format_Fe2Daq(&S4_TempPif0,auto_buf,s4_link); |
166 |
|
167 |
DAQ_StoreCmdQueue2PIF(SM_CALEXP0,&S4_TempPif0); |
168 |
status = DAQ_SendCmd2PIFWaitDAQReply(SM_CALEXP0,DAQ_STORE_MM,NULL,DAQ_NO_STORE_RAM); |
169 |
} |
170 |
else |
171 |
{ |
172 |
/*@LOG S4 Initialization: KHB status register reading error after S4_TRH setting */ |
173 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_TRH_1_HARD); |
174 |
status = CM_RC_DO_POWER_OFF_ON; |
175 |
} |
176 |
} |
177 |
else |
178 |
{ |
179 |
/*@LOG S4 Initialization: KHB status eror reading error after S4_TRH setting */ |
180 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_TRH_1_HARD); |
181 |
status = CM_RC_DO_POWER_OFF_ON; |
182 |
} |
183 |
return status; |
184 |
} |
185 |
|
186 |
status_code S4_Calibration() |
187 |
{ |
188 |
status_code status; |
189 |
DAQ_CMD_BUF* auto_buf; |
190 |
UINT16 status_reg,i,combuf,outbuf; |
191 |
DAQ_FE s4_link,tb_link; |
192 |
|
193 |
s4_link = DAQ_FE_S4; |
194 |
tb_link = DAQ_SELECT_TRIG(PRH_VAR_TB_LINK); |
195 |
|
196 |
DAQ_ResetPIF(DAQ_ACQ_ETO_TICS,DAQ_MAX_DTO_TICS,SM_DAQSETUP,HB_PKTTYPE_CALIB_S4); |
197 |
DAQ_Format_CMD_Empty(&S4_TempPif0); |
198 |
DAQ_Format_CMD_Empty(&S4_Buffer); |
199 |
|
200 |
CH_GetBuf(CH_TB_OPEN_CALIB_GATE,&auto_buf); |
201 |
DAQ_Format_Cmd2Fe(&S4_TempPif0,auto_buf,tb_link); |
202 |
DAQ_StoreCmdQueue2PIF(SM_CALEXP0,&S4_TempPif0); |
203 |
status = DAQ_SendCmdQueue2CMDIF(SM_CALEXP0); |
204 |
|
205 |
if (status) |
206 |
return(status); |
207 |
|
208 |
|
209 |
combuf = S4_CALIB_00; |
210 |
status = HK_KHB_Cmd2FE(KHB_S4,1,0,&combuf,&outbuf,S4_BOARD_TIMEOUT); |
211 |
|
212 |
if(status == CM_RC_SUCCESSFUL) /* calib 00 */ |
213 |
{ |
214 |
|
215 |
status = HK_ReadKHBStatusRegister(&status_reg); |
216 |
|
217 |
if (status == CM_RC_SUCCESSFUL) /* calib 00 stw */ |
218 |
{ |
219 |
if (status_reg & KHB_STS_ALARM_S4_FE) |
220 |
{ |
221 |
/*@LOG S4 Calibration: KHB alarm on status register after S4_CALIB_00 setting */ |
222 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_CALIB_00_SOFT); |
223 |
PRH_VAR_S4_WORKING = 0; |
224 |
|
225 |
} |
226 |
DAQ_Format_CMD_Empty(&S4_TempPif0); |
227 |
DAQ_Format_ReleaseBusy(&S4_TempPif0); |
228 |
CH_GetBuf(CH_S4_ACQUISITION,&auto_buf); |
229 |
DAQ_Format_Fe2Daq(&S4_TempPif0,auto_buf,s4_link); |
230 |
DAQ_StoreCmdQueue2PIF(SM_CALEXP0,&S4_TempPif0); |
231 |
status = DAQ_SendCmd2PIFWaitDAQReply_CallBack(SM_CALEXP0, |
232 |
DAQ_NO_STORE_MM, |
233 |
&daq_reply, |
234 |
DAQ_STORE_RAM, |
235 |
HK_KHBSend128Trigger); |
236 |
LU_EXIT_IFERROR(status); |
237 |
|
238 |
DAQ_Format_AppendBuffer_offset(&S4_Buffer,&daq_reply,S4_SKIP_HEADER); |
239 |
|
240 |
if (status == CM_RC_SUCCESSFUL) /* 128_0 */ |
241 |
{ |
242 |
for(i=0; i < 127; i++) |
243 |
{ |
244 |
status = DAQ_SendCmd2PIFWaitDAQReply(SM_CALEXP0,DAQ_NO_STORE_MM,&daq_reply,DAQ_STORE_RAM); |
245 |
LU_EXIT_IFERROR(status); |
246 |
DAQ_Format_AppendBuffer_offset(&S4_Buffer,&daq_reply,S4_SKIP_HEADER); |
247 |
} |
248 |
|
249 |
combuf = S4_CALIB_01; |
250 |
status = HK_KHB_Cmd2FE(KHB_S4,1,0,&combuf,&outbuf,S4_BOARD_TIMEOUT); |
251 |
|
252 |
if (status == CM_RC_SUCCESSFUL) /* calib 01 */ |
253 |
{ |
254 |
status = HK_ReadKHBStatusRegister(&status_reg); |
255 |
|
256 |
if (status == CM_RC_SUCCESSFUL) /* calib 01 stw */ |
257 |
{ |
258 |
if (status_reg & KHB_STS_ALARM_S4_FE) |
259 |
{ |
260 |
/*@LOG S4 Calibration: KHB alarm on status register after S4_CALIB_01 setting */ |
261 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_CALIB_01_SOFT); |
262 |
PRH_VAR_S4_WORKING = 0; |
263 |
} |
264 |
|
265 |
DAQ_Format_CMD_Empty(&S4_TempPif0); |
266 |
DAQ_Format_ReleaseBusy(&S4_TempPif0); |
267 |
CH_GetBuf(CH_S4_ACQUISITION,&auto_buf); |
268 |
DAQ_Format_Fe2Daq(&S4_TempPif0,auto_buf,s4_link); |
269 |
DAQ_StoreCmdQueue2PIF(SM_CALEXP0,&S4_TempPif0); |
270 |
status = DAQ_SendCmd2PIFWaitDAQReply_CallBack(SM_CALEXP0, |
271 |
DAQ_NO_STORE_MM, |
272 |
&daq_reply, |
273 |
DAQ_STORE_RAM, |
274 |
HK_KHBSend128Trigger); |
275 |
LU_EXIT_IFERROR(status); |
276 |
|
277 |
DAQ_Format_AppendBuffer_offset(&S4_Buffer,&daq_reply,S4_SKIP_HEADER); |
278 |
|
279 |
if (status == CM_RC_SUCCESSFUL) /* 128_1 */ |
280 |
{ |
281 |
for(i=0; i < 127; i++) |
282 |
{ |
283 |
status = DAQ_SendCmd2PIFWaitDAQReply(SM_CALEXP0,DAQ_NO_STORE_MM,&daq_reply,DAQ_STORE_RAM); |
284 |
LU_EXIT_IFERROR(status); |
285 |
DAQ_Format_AppendBuffer_offset(&S4_Buffer,&daq_reply,S4_SKIP_HEADER); |
286 |
} |
287 |
|
288 |
combuf = S4_CALIB_10; |
289 |
status = HK_KHB_Cmd2FE(KHB_S4,1,0,&combuf,&outbuf,S4_BOARD_TIMEOUT); |
290 |
|
291 |
if (status == CM_RC_SUCCESSFUL) /* calib 10 */ |
292 |
{ |
293 |
status = HK_ReadKHBStatusRegister(&status_reg); |
294 |
|
295 |
if (status == CM_RC_SUCCESSFUL) /* calib 10 stw */ |
296 |
{ |
297 |
if (status_reg & KHB_STS_ALARM_S4_FE) |
298 |
{ |
299 |
/*@LOG S4 Calibration: S4 alarm on status register after S4_CALIB_02 setting */ |
300 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_CALIB_10_SOFT); |
301 |
PRH_VAR_S4_WORKING = 0; |
302 |
} |
303 |
|
304 |
status = DAQ_SendCmd2PIFWaitDAQReply_CallBack(SM_CALEXP0, |
305 |
DAQ_NO_STORE_MM, |
306 |
&daq_reply, |
307 |
DAQ_STORE_RAM, |
308 |
HK_KHBSend128Trigger); |
309 |
LU_EXIT_IFERROR(status); |
310 |
DAQ_Format_AppendBuffer_offset(&S4_Buffer,&daq_reply,S4_SKIP_HEADER); |
311 |
|
312 |
if (status == CM_RC_SUCCESSFUL) /* 128_2 */ |
313 |
{ |
314 |
for(i=0; i < 127; i++) |
315 |
{ |
316 |
status = DAQ_SendCmd2PIFWaitDAQReply(SM_CALEXP0,DAQ_NO_STORE_MM,&daq_reply,DAQ_STORE_RAM); |
317 |
LU_EXIT_IFERROR(status); |
318 |
DAQ_Format_AppendBuffer_offset(&S4_Buffer,&daq_reply,S4_SKIP_HEADER); |
319 |
} |
320 |
|
321 |
combuf = S4_CALIB_11; |
322 |
status = HK_KHB_Cmd2FE(KHB_S4,1,0,&combuf,&outbuf,S4_BOARD_TIMEOUT); |
323 |
|
324 |
if (status == CM_RC_SUCCESSFUL) /* calib 11 */ |
325 |
{ |
326 |
status = HK_ReadKHBStatusRegister(&status_reg); |
327 |
|
328 |
if (status == CM_RC_SUCCESSFUL) /* calib 11 stw */ |
329 |
{ |
330 |
if (status_reg & KHB_STS_ALARM_S4_FE) |
331 |
{ |
332 |
/*@LOG S4 Calibration: S4 alarm on status register after S4_CALIB_11 setting */ |
333 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_CALIB_11_SOFT); |
334 |
PRH_VAR_S4_WORKING = 0; |
335 |
} |
336 |
|
337 |
status = DAQ_SendCmd2PIFWaitDAQReply_CallBack(SM_CALEXP0, |
338 |
DAQ_NO_STORE_MM, |
339 |
&daq_reply, |
340 |
DAQ_STORE_RAM, |
341 |
HK_KHBSend128Trigger); |
342 |
|
343 |
LU_EXIT_IFERROR(status); |
344 |
DAQ_Format_AppendBuffer_offset(&S4_Buffer,&daq_reply,S4_SKIP_HEADER); |
345 |
|
346 |
if (status == CM_RC_SUCCESSFUL) /* 128_3 */ |
347 |
{ |
348 |
for(i=0; i < 127; i++) |
349 |
{ |
350 |
status = DAQ_SendCmd2PIFWaitDAQReply(SM_CALEXP0, |
351 |
DAQ_NO_STORE_MM, |
352 |
&daq_reply, |
353 |
DAQ_STORE_RAM); |
354 |
LU_EXIT_IFERROR(status); |
355 |
DAQ_Format_AppendBuffer_offset(&S4_Buffer,&daq_reply,S4_SKIP_HEADER); |
356 |
} |
357 |
|
358 |
combuf = PRH_VAR_S4_TRH; |
359 |
status = HK_KHB_Cmd2FE(KHB_S4,1,0,&combuf,&outbuf,S4_BOARD_TIMEOUT); |
360 |
|
361 |
if (status == CM_RC_SUCCESSFUL) /* S4_TRH_1 */ |
362 |
{ |
363 |
status = HK_ReadKHBStatusRegister(&status_reg); |
364 |
|
365 |
if (status == CM_RC_SUCCESSFUL) /* S4_TRH_1 stw */ |
366 |
{ |
367 |
if (status_reg & KHB_STS_ALARM_S4_FE) |
368 |
{ |
369 |
/*@LOG S4 Calibration: S4 alarm on status register after S4_TRH setting */ |
370 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_TRH_2_SOFT); |
371 |
PRH_VAR_S4_WORKING = 0; |
372 |
} |
373 |
|
374 |
DAQ_Format_CMD_Empty(&S4_TempPif0); |
375 |
CH_GetBuf(CH_TB_CLOSE_CALIB_GATE,&auto_buf); |
376 |
DAQ_Format_Cmd2Fe(&S4_TempPif0,auto_buf,tb_link); |
377 |
DAQ_StoreCmdQueue2PIF(SM_CALEXP0,&S4_TempPif0); |
378 |
status = DAQ_SendCmdQueue2CMDIF(SM_CALEXP0); |
379 |
LU_EXIT_IFERROR(status); |
380 |
HB_StoreMisc(HB_PKTTYPE_CALIB_S4,&S4_Buffer); |
381 |
RM_WriteHBInfos(FALSE); |
382 |
} |
383 |
else /* S4_TRH_1 stw */ |
384 |
{ |
385 |
/*@LOG S4 Calibration: S4 KHB status register reading hard error after S4_TRH_1 */ |
386 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_TRH_1_HARD); |
387 |
status = CM_RC_DO_POWER_OFF_ON; |
388 |
} |
389 |
} |
390 |
else /* S4_TRH_1 */ |
391 |
{ |
392 |
/*@LOG S4 Calibration: S4 KHB hard error after S4_TRH_1 */ |
393 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_TRH_1_HARD); |
394 |
status = CM_RC_DO_POWER_OFF_ON; |
395 |
} |
396 |
} |
397 |
else /* 128_3 */ |
398 |
{ |
399 |
/*@LOG S4 Calibration: S4 KHB 128_3 failed */ |
400 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_128TRIGGER_3); |
401 |
status = CM_RC_DO_POWER_OFF_ON; |
402 |
} |
403 |
} |
404 |
else /* calib 11 stw */ |
405 |
{ |
406 |
/*@LOG S4 Calibration: S4 KHB status register reading hard error after S4_TRH_11 */ |
407 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_CALIB_11_HARD); |
408 |
status = CM_RC_DO_POWER_OFF_ON; |
409 |
} |
410 |
} |
411 |
else /* calib 11 */ |
412 |
{ |
413 |
/*@LOG S4 Calibration: S4 KHB hard error after S4_TRH_11 */ |
414 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_CALIB_11_HARD); |
415 |
status = CM_RC_DO_POWER_OFF_ON; |
416 |
} |
417 |
} |
418 |
else /* 128_2 */ |
419 |
{ |
420 |
/*@LOG S4 Calibration: S4 KHB 128_2 failed */ |
421 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_128TRIGGER_2); |
422 |
status = CM_RC_DO_POWER_OFF_ON; |
423 |
} |
424 |
} |
425 |
else /* calib 10 stw */ |
426 |
{ |
427 |
/*@LOG S4 Calibration: S4 KHB status register reading hard error after S4_TRH_10 */ |
428 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_CALIB_10_HARD); |
429 |
status = CM_RC_DO_POWER_OFF_ON; |
430 |
} |
431 |
} |
432 |
else /* calib 10 */ |
433 |
{ |
434 |
/*@LOG S4 Calibration: S4 KHB hard error after S4_TRH_10 */ |
435 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_CALIB_10_HARD); |
436 |
status = CM_RC_DO_POWER_OFF_ON; |
437 |
} |
438 |
} |
439 |
else /* 128_1 */ |
440 |
{ |
441 |
/*@LOG S4 Calibration: S4 KHB 128_1 failed */ |
442 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_128TRIGGER_1); |
443 |
status = CM_RC_DO_POWER_OFF_ON; |
444 |
} |
445 |
} |
446 |
else /*calib 01 stw */ |
447 |
{ |
448 |
/*@LOG S4 Calibration: S4 KHB status register reading hard error after S4_TRH_01 */ |
449 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_CALIB_01_HARD); |
450 |
status = CM_RC_DO_POWER_OFF_ON; |
451 |
} |
452 |
} |
453 |
else /* calib 01 */ |
454 |
{ |
455 |
/*@LOG S4 Calibration: S4 KHB hard error after S4_TRH_01 */ |
456 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_CALIB_01_HARD); |
457 |
status = CM_RC_DO_POWER_OFF_ON; |
458 |
} |
459 |
}else /* 128_0 */ |
460 |
{ |
461 |
/*@LOG S4 Calibration: S4 KHB 128_1 failed */ |
462 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_128TRIGGER_0); |
463 |
status = CM_RC_DO_POWER_OFF_ON; |
464 |
} |
465 |
}else /*calib 01 stw */ |
466 |
{ |
467 |
/*@LOG S4 Calibration: S4 KHB status register reading hard error after S4_TRH_01 */ |
468 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_CALIB_00_HARD); |
469 |
status = CM_RC_DO_POWER_OFF_ON; |
470 |
} |
471 |
}else /* calib 01 */ |
472 |
{ |
473 |
/*@LOG S4 Calibration: S4 KHB hard error after S4_TRH_00 */ |
474 |
ALM_WriteLog(ALM_TRACE_ID,ALM_S4_CALIB_00_HARD); |
475 |
status = CM_RC_DO_POWER_OFF_ON; |
476 |
} |
477 |
|
478 |
return status; |
479 |
} |
480 |
|
481 |
status_code S4_Error_Handler() |
482 |
{ |
483 |
status_code status; |
484 |
DAQ_CMD_BUF* auto_buf; |
485 |
PRH_VAR_S4_WORKING = 0; |
486 |
|
487 |
DAQ_Format_CMD_Empty(&S4_TempPif0); |
488 |
|
489 |
CH_GetBuf(CH_S4_READ_CR,&auto_buf); |
490 |
DAQ_Format_Fe2Daq(&S4_TempPif0,auto_buf,DAQ_FE_S4); |
491 |
|
492 |
DAQ_StoreCmdQueue2PIF(SM_CALEXP0,&S4_TempPif0); |
493 |
status = DAQ_SendCmd2PIFWaitDAQReply(SM_CALEXP0,DAQ_STORE_MM,NULL,DAQ_NO_STORE_RAM); |
494 |
if(status != CM_RC_SUCCESSFUL) |
495 |
status=CM_RC_DO_RESET_IF_ALM; |
496 |
return status; |
497 |
} |