1 |
/**************************************************************************** |
2 |
/* F i l e D a t a |
3 |
/* |
4 |
/* Module : Initialization |
5 |
/* C.I. No. : |
6 |
/* $Revision: 1.4 $ |
7 |
/* $Date: 2004/08/26 16:54:39 $ |
8 |
/* Belonging to : |
9 |
/* : |
10 |
/* $RCSfile: IN_InitManager_op.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: IN_InitManager_op.c,v $ |
25 |
/* Revision 1.4 2004/08/26 16:54:39 sebastiani |
26 |
/* version work fine |
27 |
/* |
28 |
/* Revision 1.3 2004/07/27 17:30:17 faber |
29 |
/* OBT can be now in second or milliseconds, depending of the situazion. |
30 |
/* OBT_s is used for FM compatibility, OBT_ms basically for MM infos |
31 |
/* |
32 |
/* Revision 1.2 2003/09/15 17:46:27 faber |
33 |
/* HB_HKBuffer_INFN module introduced. |
34 |
/* |
35 |
/* Revision 1.1.1.1 2003/08/04 09:40:21 sebastiani |
36 |
/* Imported sources laben rel. 19.06.2003 integrated with pam2 |
37 |
/* |
38 |
/* Revision 1.10 2002/09/02 12:53:28 zulia |
39 |
/* added task test |
40 |
/* |
41 |
/* Revision 1.9 2002/06/11 13:50:33 zulia |
42 |
/* TEST_I |
43 |
/* |
44 |
/* Revision 1.8 2002/05/13 14:58:08 zulia |
45 |
/* * update makefiles |
46 |
/* * integration with INFN sw |
47 |
/* |
48 |
/* Revision 1.7 2002/05/09 13:45:55 aurora |
49 |
/* fixed sendMsgCode to reportGenerator |
50 |
/* |
51 |
/* Revision 1.6 2002/05/09 08:16:34 zulia |
52 |
/* * acceptance release |
53 |
/* |
54 |
/* |
55 |
/*****************************************************************************/ |
56 |
|
57 |
/*============================= Include File ================================*/ |
58 |
|
59 |
#include <src/Initialization/InitManager/IN_InitManager_op.h> |
60 |
#include <src/BasicSW/RTEMSInterface/OS_rtems_p.h> |
61 |
#include <src/BasicSW/CrimeaDriver/CD_CrimeaDriver_p.h> |
62 |
#include <src/BasicSW/InterruptManager/IM_InterruptManager_p.h> |
63 |
#include <src/BasicSW/PatchDumpManager/PD_PatchDumpManager_p.h> |
64 |
#include <src/BasicSW/TimingInfo/TI_TimingInfo_p.h> |
65 |
#include <src/BasicSW/Bus1553B/BI_Bus1553B_p.h> |
66 |
#include <src/MCMDManager/MCMDArea/MA_MCMDArea_p.h> |
67 |
#include <src/MCMDManager/TTManager/MT_TTManager_p.h> |
68 |
#include <src/MCMDManager/MCMDDispatcher/MD_MCMDDispatcher_p.h> |
69 |
#include <src/FileManager/FileSystem/FS_FileSystem_p.h> |
70 |
#include <src/FileManager/MMSUManager/FT_MMSUManager_p.h> |
71 |
#include <src/FileManager/MMSUDriver/FD_MMSUDriver_p.h> |
72 |
#include <src/ModeManager/ModeCoordinator/MC_ModeCoordinator_p.h> |
73 |
#include <src/TM_TCManager/TMTCManager/TM_TMTCManager_p.h> |
74 |
#include <src/HKManager/HistoryArea/HA_HistoryArea_p.h> |
75 |
#include <src/HKManager/ReportGenerator/RG_ReportGenerator_p.h> |
76 |
#include <src/QualitySystem/DiagSupervisor/QS_DiagSupervisor_p.h> |
77 |
#include <src/SRAMManager/SRAMDriver/SD_SRAMDriver_p.h> |
78 |
#include <src/SRAMManager/SRAMPageManager/SM_SRAMPageManager_p.h> |
79 |
|
80 |
#ifdef INFN |
81 |
#include <src/INFN/IN_InitManager_INFN_p.h> |
82 |
#endif |
83 |
|
84 |
#ifdef TEST_I |
85 |
// #include <src/TestUtility/Test/TS_Test_p.h> |
86 |
#endif |
87 |
/*============================= Object variables ============================*/ |
88 |
|
89 |
static unsigned int RetCode; |
90 |
|
91 |
/*****************************************************************************/ |
92 |
|
93 |
/*==== I n i t M a n a g e r O P E R A T I O N A L F U N C T I O N S ====*/ |
94 |
|
95 |
/*****************************************************************************/ |
96 |
/* @Function: IN_opInitAllSystem */ |
97 |
/* @Purpose : */ |
98 |
/* This function initializes the rtems resources (tasks,semaphores, */ |
99 |
/* partitons, timers, mailboxes) and all the structures data relative */ |
100 |
/* to the objects application. The boot result is saved into the History */ |
101 |
/* area by log type 6. */ |
102 |
/* The ERC32 interrupt (External Interrupt 1..5) are unmasked. */ |
103 |
/* */ |
104 |
/* @@ */ |
105 |
/* @Parameter Name @Mode @Description */ |
106 |
/* IN */ |
107 |
/* status_code OUT Return code */ |
108 |
/* @@ */ |
109 |
/*****************************************************************************/ |
110 |
|
111 |
status_code IN_opInitAllSystem(void) |
112 |
{ |
113 |
MsgTsk sndMsg; |
114 |
status_code status; |
115 |
unsigned int transiz; |
116 |
unsigned int retCode; |
117 |
TI_TIME obtime; |
118 |
IN_BOOT_RESULT* pRc; |
119 |
|
120 |
|
121 |
/*================== SW object initialization ================*/ |
122 |
OS_piInitOS(); /* RTEMSInterface */ |
123 |
|
124 |
/* Parameter Handler and Log Utility, even in in the INFN have to be done before any other initialization but |
125 |
after the OS intialization */ |
126 |
IN_piInit_PreAll(); |
127 |
|
128 |
|
129 |
TI_piInitTimingInfo (); /* TimingInfo */ |
130 |
CD_piInitCrimeaDriver(); /* CrimeaDriver */ |
131 |
BI_piInitBus1553B(); /* BUS1553B */ |
132 |
PD_piInitPatchDumpManager(); /* PatchDumpManager */ |
133 |
IM_piIntInterruptManager(); /* InterruptManager */ |
134 |
MA_piInitMCMDArea(); /* MCMDArea */ |
135 |
MD_piInitMCMDDispatcher(); /* MCMDDispatcher */ |
136 |
MT_piInitTTManager(); /* TTManager */ |
137 |
FS_piInitFileSystem(); /* FileSystem */ |
138 |
FT_piInitMMSUManager(); /* MMSUManager */ |
139 |
FD_piInitMMSUDriver(); /* MMSUDriver */ |
140 |
MC_piInitModeCoordinator(); /* ModeCoordinator */ |
141 |
TM_piInitTMTCManager(); /* TMTCManager */ |
142 |
HA_piInitHistoryArea(); /* HistoryArea */ |
143 |
RG_piInitReportGenerator(); /* ReportGeneretor */ |
144 |
QS_piInitDiagSupervisor(); /* DiagSupervisor */ |
145 |
SD_piSRAMDriverInit(); /* SRAMDriver */ |
146 |
PM_piSRAMPageManagerInit(TRUE); /* SRAMPageManager */ |
147 |
|
148 |
#ifdef TEST_I |
149 |
//T TS_piTestInit(); |
150 |
#endif |
151 |
|
152 |
#ifdef INFN |
153 |
IN_piInitAllSystem_INFN(); /* All INFN initialisations */ |
154 |
#endif |
155 |
|
156 |
/*================== Get the Boot results ====================*/ |
157 |
retCode =FALSE; |
158 |
pRc = (IN_BOOT_RESULT* )BOOT_RESULT_ADDR; |
159 |
/* Check Warm start flag */ |
160 |
if (pRc->WarmStart) |
161 |
{ |
162 |
retCode |=WARM_START; |
163 |
} |
164 |
else |
165 |
{ |
166 |
pRc->WarmStart =TRUE; |
167 |
} |
168 |
/* Check Ram test */ |
169 |
if (pRc->Ram) |
170 |
{ |
171 |
retCode |=RAM_ERROR; |
172 |
} |
173 |
/* Check Board test */ |
174 |
retCode |=((pRc->Board<<1) & BOARD_ERROR); |
175 |
/* Check Eeprom test */ |
176 |
if (pRc->Eeprom) |
177 |
{ |
178 |
retCode |=EEPROM_ERROR; |
179 |
} |
180 |
/* Check Prom test */ |
181 |
if (pRc->Prom) |
182 |
{ |
183 |
retCode |=PROM_ERROR; |
184 |
} |
185 |
/* Boot result code */ |
186 |
RetCode =retCode; |
187 |
|
188 |
/*============================================================*/ |
189 |
/*============ Boot results, Log to History area =============*/ |
190 |
#warning do we want OBT in s or in ms ? if ms, russian must be warned ? |
191 |
TI_piGetTimeInfo_ms(&obtime); |
192 |
*((unsigned short*)&sndMsg.Info[0]) =HA_HEADER_E6 | POWER_ON_STATE; |
193 |
*((unsigned short* )&sndMsg.Info[2]) =(obtime >>16); |
194 |
*((unsigned short* )&sndMsg.Info[4]) =(obtime & 0xffff); |
195 |
*((unsigned short*)&sndMsg.Info[6]) =retCode; |
196 |
sndMsg.Code = HA_TRACEVENT; |
197 |
sndMsg.LlInfo = HA_SIZEW_E6; |
198 |
HA_piSndMsgHistoryArea(&sndMsg); |
199 |
/*========== Boot results, Log to Report Generator ===========*/ |
200 |
sndMsg.Code = RG_BOOT_RESULT; |
201 |
sndMsg.LlInfo = sizeof(unsigned int); |
202 |
*(unsigned int* )&sndMsg.Info =retCode; |
203 |
RG_piSndMsgReportGenerator(&sndMsg); |
204 |
|
205 |
/*============================================================*/ |
206 |
/*============== System in MAINTENANCE state =================*/ |
207 |
/* Transition to MAINTENANCE state */ |
208 |
MC_piSetState (MC_MAINTENANCE_STATE); |
209 |
/* Switch on the Memory Module 1 */ |
210 |
FT_piMemModuleON(FT_MEM_MOD_1); |
211 |
/*============================================================*/ |
212 |
|
213 |
/*===== EXTERNAL INTERRUPT (ERC32) 1 -2 -3 -4 unmask =========*/ |
214 |
|
215 |
ERC32_Unmask_interrupt (ERC32_INTERRUPT_EXTERNAL_1); |
216 |
ERC32_Unmask_interrupt (ERC32_INTERRUPT_EXTERNAL_2); |
217 |
ERC32_Unmask_interrupt (ERC32_INTERRUPT_EXTERNAL_3); |
218 |
ERC32_Unmask_interrupt (ERC32_INTERRUPT_EXTERNAL_4); |
219 |
/* External Interrupt 5 is intentionally lefu MASKED */ |
220 |
return (SUCCESSFUL); |
221 |
|
222 |
} |