/[PAMELA software]/quicklook/dataToXML/Data/compilationInfo/src/MCMDManager/TTManager/MT_TTManager_int.c
ViewVC logotype

Contents of /quicklook/dataToXML/Data/compilationInfo/src/MCMDManager/TTManager/MT_TTManager_int.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Tue Apr 25 09:00:21 2006 UTC (19 years, 2 months ago) by kusanagi
Branch: MAIN
CVS Tags: dataToXML1_02/01, dataToXML1_02/00, dataToXML1_03/00, dataToXML1_03/01, dataToXML1_00/00, firstRelease, dataToXML1_01/00, dataToXML1_03_02, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
These program extract in an XML format the info contained into the ROOT files generated by YODA from the PAMELA data. To visualize the XML files in a more human readable format a collection of XSL files are given in the Data subfolder.

1 /****************************************************************************
2 /* F i l e D a t a
3 /*
4 /* Module : MCMDManager
5 /* C.I. No. :
6 /* $Revision: 1.6 $
7 /* $Date: 2005/02/21 08:58:29 $
8 /* Belonging to :
9 /* :
10 /* $RCSfile: MT_TTManager_int.c,v $
11 /* Program Type :
12 /* Sub-modules :
13 /*
14 /****************************************************************************
15 /* S W D e v e l o p m e n t E n v i r o n m e n t
16 /*
17 /* Host system :
18 /* SW Compiler :
19 /* $Author: sebastiani $
20 /* :
21 /****************************************************************************
22 /* U p d a t i n g
23 /*
24 /* $Log: MT_TTManager_int.c,v $
25 /* Revision 1.6 2005/02/21 08:58:29 sebastiani
26 /* all log comments completed
27 /*
28 /* Revision 1.5 2004/09/17 15:01:00 faber
29 /* LU_INFN_LOG flags fixing
30 /*
31 /* Revision 1.4 2004/07/27 17:30:17 faber
32 /* OBT can be now in second or milliseconds, depending of the situazion.
33 /* OBT_s is used for FM compatibility, OBT_ms basically for MM infos
34 /*
35 /* Revision 1.3 2003/11/18 09:01:15 alfarano
36 /* laben patch fixes some problems
37 /*
38 /* Revision 1.2 2003/10/21 16:09:12 alfarano
39 /* LU_LOG_INFN replacement for all remaining original log functions
40 /*
41 /* Revision 1.1.1.1 2003/08/04 09:40:21 sebastiani
42 /* Imported sources laben rel. 19.06.2003 integrated with pam2
43 /*
44 /* Revision 1.5 2002/05/09 08:16:34 zulia
45 /* * acceptance release
46 /*
47 /*
48 /*****************************************************************************/
49
50 /*============================= Include File ================================*/
51
52 #include <src/MCMDManager/TTManager/MT_TTManager_int.h>
53
54 #include <src/INFN/LU_SourceFileID_INFN.h>
55 #define __FILEID__ _OS_rtems_INFN_p__c
56 #include <src/INFN/PRH_ParamHandler_INFN.h>
57 #include <src/INFN/LU_LogUtility_INFN.h>
58 #include <src/INFN/PRH_ParamHandler_INFN_auto.h>
59 LU_DECL_MASK();
60
61 /*============================== Local Variables ============================*/
62
63
64
65 /*****************************************************************************/
66
67 /*========= T T M a n a g e r I N T E R N A L F U N C T I O N S =========*/
68
69 /*****************************************************************************/
70 /* @Function: MT_ifCheckIfTimetagIsElapsed */
71 /* @Purpose : */
72 /* The function gets the MCMD timetag at top of list and checks if the time */
73 /* is elapsed. The reference time is the -Obt- parameter (On Board Time). */
74 /* If the time is expired, a message to MCMDDispatcher object is send to */
75 /* put the MCMD in execution. */
76 /* */
77 /* @@ */
78 /* @Parameter Name @Mode @Description */
79 /* Obt IN On Board Time (OBT) */
80 /* status_code OUT Return code */
81 /* @@ */
82 /*****************************************************************************/
83
84 void MT_ifCheckIfTimetagIsElapsed (TI_TIME Obt)
85 {
86 status_code status;
87 MA_HEADER_MCMD mcmd;
88 MsgTsk sndMsg;
89
90 MA_piGetMCMDtimetag (&mcmd,WAIT,NO_TIMEOUT);
91 /* Check if timetag is elapsed */
92 if (mcmd.Type)
93 {
94 if (mcmd.TimeTag == Obt)
95 {
96 /* Send MCMD to MCMDDispatcher */
97 sndMsg.Code =MD_MCMD_EXEC;
98 *(MA_HEADER_MCMD* )sndMsg.Info =mcmd;
99 sndMsg.LlInfo =sizeof(MA_HEADER_MCMD);
100 status =MD_piSndMsgMCMDDispatcher(&sndMsg);
101 if (status==SUCCESSFUL)
102 {
103 /* MCMD sent to MCMDDispatcher, delete it from the list */
104 status =MA_piDelMCMDtimetag(&mcmd,Obt,WAIT,NO_TIMEOUT);
105 if (status==HA_E10_MCMD_ERR)
106 {
107 /*@LOG MCMD indefined,not deleted from the TT MCMD queue LOG_INFN HA_piLogHistoryEntry10(HA_E10_SW_MT,HA_E10_MCMD_ERR,HA_E10_REP2_NULL); */
108 LU_INFN_LOG(LU_CRITICAL|LU_HA,LU_MASK(__FILEID__),__FILEID__,__LINE__,HA_E10_REP2_NULL);
109 }
110 }
111 else
112 {
113 /*@LOG MCMD not sent, MCMDDispatcher queue full LOG_INFN HA_piLogHistoryEntry2 (mcmd.Type,HA_E2_INTERNAL_ERR); */
114 LU_INFN_LOG(LU_CRITICAL|LU_HA,LU_MASK(__FILEID__),__FILEID__,__LINE__,HA_E2_INTERNAL_ERR);
115 MA_piDelBufferMCMD(mcmd.PtrMCMD,TIMETAG_MCMD);
116 }
117 }
118 }
119
120 }
121
122
123
124 /*****************************************************************************/
125 /* @Function: MT_ifVerifyTimeTag */
126 /* @Purpose : */
127 /* The Function verifies if MCMD timetag is included in the defined time */
128 /* window (OBT + 46.875 ms <= timetag <= OBT + Twin). */
129 /* */
130 /* @@ */
131 /* @Parameter Name @Mode @Description */
132 /* PtrMcmd IN Pointer to MCMD header */
133 /* Twin IN MCMD timetag window */
134 /* status_code OUT Return code */
135 /* @@ */
136 /*****************************************************************************/
137
138 status_code MT_ifVerifyTimeTag (MA_HEADER_MCMD* PtrMcmd, TI_TIME Twin)
139 {
140 status_code status;
141 TI_TIME time;
142 TI_TIME timeMin, timeMax;
143
144 /* Get OBT */
145 #warning do we want OBT in s or in ms ? if ms, russian must be warned ?
146 TI_piGetTimeInfo_ms(&time);
147 /* calculates the timetag window */
148 timeMin =time + MCMD_MIN_WIN;
149 timeMax =time + Twin;
150 /* The last seven bits of the Timetag must be zero */
151 PtrMcmd->TimeTag &=LAST_SEVEN_BIT_ZERO;
152
153 /* Check Timetag window */
154 status =HA_E1_TIMETAG_NOT_ALLOWED;
155 if(time<timeMin && time>timeMax)
156 {
157 /* The timetag window is across the boundery */
158 if ((PtrMcmd->TimeTag>timeMin && PtrMcmd->TimeTag<=0xFFFFFFFF) ||
159 (PtrMcmd->TimeTag>=0 && PtrMcmd->TimeTag<timeMax))
160 {
161 status =SUCCESSFUL;
162 }
163 }
164 else
165 {
166 /* The timetag window is not across the boundery */
167 if (PtrMcmd->TimeTag>timeMin && PtrMcmd->TimeTag<timeMax)
168 {
169 status =SUCCESSFUL;
170 }
171 }
172 return (status);
173 }
174
175
176
177 /*****************************************************************************/
178 /* @Function: MT_ifStoreTimetagMcmd */
179 /* @Purpose : */
180 /* The Function inserts the MCMD into the MCMD timetag list by calling the */
181 /* MCMDArea provided interface. If during MCMD inserition another MCMD with */
182 /* the same timetag is found, the MCMD is not stored into the list. A log */
183 /* into the history area notifies the MCMD rejection for timetag already */
184 /* existing. */
185 /* */
186 /* @@ */
187 /* @Parameter Name @Mode @Description */
188 /* PtrMcmd IN Pointer to MCMD header */
189 /* @@ */
190 /*****************************************************************************/
191
192 void MT_ifStoreTimetagMcmd (MA_HEADER_MCMD* PtrMcmd)
193 {
194 status_code status;
195 TI_TIME time;
196
197 /* Get OBT */
198 #warning do we want OBT in s or in ms ? if ms, russian must be warned ?
199 TI_piGetTimeInfo_ms(&time);
200 /* Put the MCMD in a timetag list */
201 status =MA_piPutMCMDtimetag(PtrMcmd,time,WAIT,NO_TIMEOUT);
202
203 if (status != SUCCESSFUL)
204 {
205 if (status != HA_E2_TIMETAG_ALREADY_EXIST &&
206 status != HA_E2_MCMD_QUEUE_FULL)
207 {
208 status = HA_E2_INTERNAL_ERR;
209 }
210 /* Delete MCMD from partition */
211 MA_piDelBufferMCMD(PtrMcmd->PtrMCMD,TIMETAG_MCMD);
212 /*@LOG MCMD refused - LOG_INFN HA_piLogHistoryEntry2 (PtrMcmd->Type,status); */
213 LU_INFN_LOG(LU_CRITICAL|LU_HA,LU_MASK(__FILEID__),__FILEID__,__LINE__,status);
214 }
215 }
216
217
218
219 /*****************************************************************************/
220 /* @Function: MT_ifDeleteMcmdQueue */
221 /* @Purpose : */
222 /* The function manages the MCMD (DEL_MCMD_QUEUE) execution. */
223 /* The MCMD information are extracted from the MCMD buffer partition that */
224 /* then is deleted. The MCMD is executed by calling the MCMD area provided */
225 /* interface that allows, as specified from the delete strategy, to delete */
226 /* one (specified by the parameter timetag) or all queued MCMD. */
227 /* */
228 /* @@ */
229 /* @Parameter Name @Mode @Description */
230 /* PtrMcmd IN Pointer to MCMD header */
231 /* OUT */
232 /* @@ */
233 /*****************************************************************************/
234
235 void MT_ifDeleteMcmdQueue (MA_HEADER_MCMD* PtrMcmd)
236 {
237 status_code status;
238 unsigned short* pMcmdInfo;
239 unsigned int mcmdDelAllFalg;
240 unsigned int timetag;
241 unsigned int timetagFlag;
242
243 /* Extract MCMD information */
244 pMcmdInfo =(unsigned short* )(PtrMcmd->PtrMCMD);
245 timetagFlag =(*(pMcmdInfo+1)&TIMETAG_MASK) ? TIMETAG_MCMD : IMMEDIATE_MCMD;
246 pMcmdInfo +=OFFSET_HEADER;
247 /* Extract the first bit (Delete All MCMD flag) */
248 mcmdDelAllFalg =(unsigned int)(*pMcmdInfo & 0x01);
249 /* Extract timetag parameter */
250 pMcmdInfo++;
251 timetag =(*pMcmdInfo<<16) + (*(pMcmdInfo+1));
252 /* Delete MCMD from partition */
253 MA_piDelBufferMCMD(PtrMcmd->PtrMCMD,timetagFlag);
254
255 /* Delete all or one timetag MCMDs */
256 status =MA_piDelAllMCMDtimetag (mcmdDelAllFalg,timetag,WAIT,NO_TIMEOUT);
257 if (status==HA_E10_PARTITION_ERR)
258 {
259 /* MCMDs not all deleted */
260 status =HA_E2_INTERNAL_ERR;
261 }
262 else if (status==HA_E10_MCMD_ERR)
263 {
264 /* MCMD timetag not found */
265 status =HA_E2_TIMETAG_ERR;
266 }
267 else if (status==HA_E10_SEMAPHORE_ERR)
268 {
269 /* Semaphore error, MCMDs not deleted */
270 status =HA_E2_INTERNAL_ERR;
271 }
272
273 /*============== Log into History Area =============*/
274 /*@LOG DeleteMacrocommand Queue LOG_INFN HA_piLogHistoryEntry2 (PtrMcmd->Type,status); */
275 LU_INFN_LOG(LU_CRITICAL|LU_HA,LU_MASK(__FILEID__),__FILEID__,__LINE__,status);
276 }
277
278
279

  ViewVC Help
Powered by ViewVC 1.1.23