1 |
kusanagi |
1.1 |
/**************************************************************************** |
2 |
|
|
/* F i l e D a t a |
3 |
|
|
/* |
4 |
|
|
/* Module : MCMDManager |
5 |
|
|
/* C.I. No. : |
6 |
|
|
/* $Revision: 1.1.1.1 $ |
7 |
|
|
/* $Date: 2003/08/04 09:40:21 $ |
8 |
|
|
/* Belonging to : |
9 |
|
|
/* : |
10 |
|
|
/* $RCSfile: MA_MCMDArea_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: MA_MCMDArea_int.c,v $ |
25 |
|
|
/* Revision 1.1.1.1 2003/08/04 09:40:21 sebastiani |
26 |
|
|
/* Imported sources laben rel. 19.06.2003 integrated with pam2 |
27 |
|
|
/* |
28 |
|
|
/* Revision 1.3 2002/05/09 08:16:34 zulia |
29 |
|
|
/* * acceptance release |
30 |
|
|
/* |
31 |
|
|
/* |
32 |
|
|
/*****************************************************************************/ |
33 |
|
|
|
34 |
|
|
|
35 |
|
|
/*============================= Include File ================================*/ |
36 |
|
|
|
37 |
|
|
#include <src/MCMDManager/MCMDArea/MA_MCMDArea_int.h> |
38 |
|
|
|
39 |
|
|
/*============================== Local Variables ============================*/ |
40 |
|
|
|
41 |
|
|
|
42 |
|
|
/*****************************************************************************/ |
43 |
|
|
|
44 |
|
|
/*========== M C M D A r e a I N T E R N A L F U N C T I O N S =========*/ |
45 |
|
|
|
46 |
|
|
/*****************************************************************************/ |
47 |
|
|
/* @Function: MA_ifUpdateMcmdHeader */ |
48 |
|
|
/* @Purpose : */ |
49 |
|
|
/* The function scans the list of the MCMD with timetag and it updates the */ |
50 |
|
|
/* MCMD in top to the list with the more recent MCMD in order of time to be */ |
51 |
|
|
/* executed. */ |
52 |
|
|
/* */ |
53 |
|
|
/* @@ */ |
54 |
|
|
/* @Parameter Name @Mode @Description */ |
55 |
|
|
/* PtrHeaderMcmd IN Pointer to the MCMDs timetag list */ |
56 |
|
|
/* Obt IN On board Time (OBT) */ |
57 |
|
|
/* status_code OUT Return code */ |
58 |
|
|
/* @@ */ |
59 |
|
|
/*****************************************************************************/ |
60 |
|
|
|
61 |
|
|
void MA_ifUpdateMcmdHeader (MA_HEADER_MCMD* PtrHeaderMcmd, TI_TIME Obt) |
62 |
|
|
{ |
63 |
|
|
MA_HEADER_MCMD* pHOverObt; |
64 |
|
|
MA_HEADER_MCMD* pHUnderObt; |
65 |
|
|
MA_HEADER_MCMD* pt; |
66 |
|
|
MA_HEADER_MCMD tmpMcmd; |
67 |
|
|
unsigned int ttOverObt,ttUnderObt; |
68 |
|
|
unsigned int ttOverFlag,ttUnderFlag; |
69 |
|
|
unsigned short i; |
70 |
|
|
unsigned int psr; |
71 |
|
|
float a; |
72 |
|
|
|
73 |
|
|
ttOverObt =MAX_TIMETAG; |
74 |
|
|
ttUnderObt =MAX_TIMETAG; |
75 |
|
|
ttOverFlag =FALSE; |
76 |
|
|
ttUnderFlag =FALSE; |
77 |
|
|
/* Search the more recent MCMD to execute */ |
78 |
|
|
for (i=0,pt =PtrHeaderMcmd; i < MAX_MCMD_TIMETAG; i++,pt++) |
79 |
|
|
{ |
80 |
|
|
if(pt->Type != NULL_MCMD) |
81 |
|
|
{ |
82 |
|
|
if (pt->TimeTag < Obt) |
83 |
|
|
{ |
84 |
|
|
/* Timetag which expires after the obt counter overflow */ |
85 |
|
|
if (pt->TimeTag < ttUnderObt) |
86 |
|
|
{ |
87 |
|
|
pHUnderObt =pt; |
88 |
|
|
ttUnderObt =pt->TimeTag; |
89 |
|
|
ttUnderFlag =TRUE; |
90 |
|
|
} |
91 |
|
|
} |
92 |
|
|
else |
93 |
|
|
{ |
94 |
|
|
/* Timetag which expires before the obt counter overflow */ |
95 |
|
|
if (pt->TimeTag <= ttOverObt) |
96 |
|
|
{ |
97 |
|
|
pHOverObt =pt; |
98 |
|
|
ttOverObt =pt->TimeTag; |
99 |
|
|
ttOverFlag =TRUE; |
100 |
|
|
} |
101 |
|
|
} |
102 |
|
|
} |
103 |
|
|
} |
104 |
|
|
/* Check if next MCMD to execute has been found */ |
105 |
|
|
tmpMcmd =*PtrHeaderMcmd; |
106 |
|
|
if (ttOverFlag) |
107 |
|
|
{ |
108 |
|
|
*PtrHeaderMcmd =*pHOverObt; |
109 |
|
|
*pHOverObt =tmpMcmd; |
110 |
|
|
} |
111 |
|
|
else |
112 |
|
|
{ |
113 |
|
|
if (ttUnderFlag) |
114 |
|
|
{ |
115 |
|
|
*PtrHeaderMcmd =*pHUnderObt; |
116 |
|
|
*pHUnderObt =tmpMcmd; |
117 |
|
|
} |
118 |
|
|
} |
119 |
|
|
|
120 |
|
|
} |
121 |
|
|
|