1 |
kusanagi |
1.1 |
/**************************************************************************** |
2 |
|
|
/* F i l e D a t a |
3 |
|
|
/* |
4 |
|
|
/* Module : BasicSW |
5 |
|
|
/* C.I. No. : |
6 |
|
|
/* $Revision: 1.3 $ |
7 |
|
|
/* $Date: 2004/09/17 15:01:00 $ |
8 |
|
|
/* Belonging to : |
9 |
|
|
/* : |
10 |
|
|
/* $RCSfile: PD_PatchDumpManager_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: faber $ |
20 |
|
|
/* : |
21 |
|
|
/**************************************************************************** |
22 |
|
|
/* U p d a t i n g |
23 |
|
|
/* |
24 |
|
|
/* $Log: PD_PatchDumpManager_op.c,v $ |
25 |
|
|
/* Revision 1.3 2004/09/17 15:01:00 faber |
26 |
|
|
/* LU_INFN_LOG flags fixing |
27 |
|
|
/* |
28 |
|
|
/* Revision 1.2 2003/10/21 16:09:12 alfarano |
29 |
|
|
/* LU_LOG_INFN replacement for all remaining original log functions |
30 |
|
|
/* |
31 |
|
|
/* Revision 1.1.1.1 2003/08/04 09:40:21 sebastiani |
32 |
|
|
/* Imported sources laben rel. 19.06.2003 integrated with pam2 |
33 |
|
|
/* |
34 |
|
|
/* Revision 1.7 2002/11/14 09:45:07 zulia |
35 |
|
|
/* correct use of status returned value |
36 |
|
|
/* |
37 |
|
|
/* Revision 1.6 2002/08/05 14:25:35 zulia |
38 |
|
|
/* Fixed Patch & Dump |
39 |
|
|
/* |
40 |
|
|
/* Revision 1.5 2002/05/09 08:16:34 zulia |
41 |
|
|
/* * acceptance release |
42 |
|
|
/* |
43 |
|
|
/* |
44 |
|
|
/*****************************************************************************/ |
45 |
|
|
|
46 |
|
|
|
47 |
|
|
/*============================= Include File ================================*/ |
48 |
|
|
|
49 |
|
|
#include <src/BasicSW/PatchDumpManager/PD_PatchDumpManager_op.h> |
50 |
|
|
#include <src/BasicSW/PatchDumpManager/PD_PatchDumpManager_int.h> |
51 |
|
|
#include <src/HKManager/HistoryArea/HA_HistoryArea_p.h> |
52 |
|
|
#include <src/INFN/LU_SourceFileID_INFN.h> |
53 |
|
|
#define __FILEID__ _PD_PatchDumpManager_op__c |
54 |
|
|
#include <src/INFN/PRH_ParamHandler_INFN_auto.h> |
55 |
|
|
#include <src/INFN/PRH_ParamHandler_INFN.h> |
56 |
|
|
#include <src/INFN/LU_LogUtility_INFN.h> |
57 |
|
|
|
58 |
|
|
LU_DECL_MASK(); |
59 |
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
/*****************************************************************************/ |
63 |
|
|
/*============================= Object variables ============================*/ |
64 |
|
|
/*****************************************************************************/ |
65 |
|
|
/* @Variable: PD_PatchBuff */ |
66 |
|
|
/* @Purpose : */ |
67 |
|
|
/* Array of words 16 bits wide to stores data to be patched */ |
68 |
|
|
/* @@ */ |
69 |
|
|
/*****************************************************************************/ |
70 |
|
|
static UWORD PD_PatchBuff[PD_BUFFER_PATCH_MAX_SIZE]; |
71 |
|
|
|
72 |
|
|
/*****************************************************************************/ |
73 |
|
|
/* @Variable: PD_DumpBuff */ |
74 |
|
|
/* @Purpose : */ |
75 |
|
|
/* Array of words 16 bits wide to store dumped data */ |
76 |
|
|
/* @@ */ |
77 |
|
|
/*****************************************************************************/ |
78 |
|
|
static UWORD PD_DumpBuff [PD_BUFFER_DUMP_MAX_SIZE]; |
79 |
|
|
|
80 |
|
|
/*****************************************************************************/ |
81 |
|
|
/* @Variable: PD_DumpInfo */ |
82 |
|
|
/* @Purpose : */ |
83 |
|
|
/* Structure to collect relevant data to manages patch/dump object */ |
84 |
|
|
/* */ |
85 |
|
|
/* @@ */ |
86 |
|
|
/*****************************************************************************/ |
87 |
|
|
static PD_INFO PD_DumpInfo; |
88 |
|
|
|
89 |
|
|
/*****************************************************************************/ |
90 |
|
|
|
91 |
|
|
/* P a t c h D u m p 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 */ |
92 |
|
|
|
93 |
|
|
/*****************************************************************************/ |
94 |
|
|
/* @Function: PD_opInitPatchDumpManager */ |
95 |
|
|
/* @Purpose : */ |
96 |
|
|
/* This function initalize the PatchDump object setting the task to */ |
97 |
|
|
/* the READY state and setting its priority */ |
98 |
|
|
/* */ |
99 |
|
|
/* @@ */ |
100 |
|
|
/* @Parameter Name @Mode @Description */ |
101 |
|
|
/* status_code OUT Return code */ |
102 |
|
|
/* @@ */ |
103 |
|
|
/*****************************************************************************/ |
104 |
|
|
|
105 |
|
|
status_code PD_opInitPatchDumpManager( void ) |
106 |
|
|
{ |
107 |
|
|
status_code status; |
108 |
|
|
unsigned int OldPriority; |
109 |
|
|
|
110 |
|
|
status = SUCCESSFUL; |
111 |
|
|
|
112 |
|
|
status |= OS_piTaskReady(PD_TASK,PD_tkPatchDumpManager); |
113 |
|
|
if ( status != SUCCESSFUL ) |
114 |
|
|
{ |
115 |
|
|
/* Task is not correctly started */ |
116 |
|
|
// LOG_INFN HA_piLogHistoryEntry10(HA_E10_SW_HA,HA_E10_TSK_READY_ERR,status); |
117 |
|
|
LU_INFN_LOG(LU_FATAL | LU_HA,LU_MASK(__FILEID__),__FILEID__,__LINE__,status); |
118 |
|
|
} |
119 |
|
|
|
120 |
|
|
status |= OS_piTaskPriority( PD_TASK,PATCHDUMPMANAGER_PRIORITY,&OldPriority); |
121 |
|
|
if ( status != SUCCESSFUL ) |
122 |
|
|
{ |
123 |
|
|
/* Task priority is not correctly updated */ |
124 |
|
|
// LOG_INFN HA_piLogHistoryEntry10(HA_E10_SW_HA,HA_E10_TSK_READY_ERR,status); |
125 |
|
|
LU_INFN_LOG(LU_FATAL | LU_HA ,LU_MASK(__FILEID__),__FILEID__,__LINE__,status); |
126 |
|
|
} |
127 |
|
|
|
128 |
|
|
PD_DumpInfo.pAppend = PD_DumpBuff; |
129 |
|
|
PD_DumpInfo.nWordsAvailable = PD_BUFFER_DUMP_MAX_SIZE; |
130 |
|
|
|
131 |
|
|
return (status); |
132 |
|
|
|
133 |
|
|
} |
134 |
|
|
|
135 |
|
|
|
136 |
|
|
/*****************************************************************************/ |
137 |
|
|
/* @Function: PD_opSndMsgPatchDumpManager */ |
138 |
|
|
/* @Purpose : */ |
139 |
|
|
/* This function sends a message to the PatchDump task. */ |
140 |
|
|
/* */ |
141 |
|
|
/* @@ */ |
142 |
|
|
/* @Parameter Name @Mode @Description */ |
143 |
|
|
/* SndMsg IN pointer to message structure */ |
144 |
|
|
/* status_code OUT Return code */ |
145 |
|
|
/* @@ */ |
146 |
|
|
/*****************************************************************************/ |
147 |
|
|
|
148 |
|
|
status_code PD_opSndMsgPatchDumpManager(MsgTsk* SndMsg) |
149 |
|
|
{ |
150 |
|
|
return OS_piMsgQueueSend(PD_MAILBOX,(void*)SndMsg,sizeof(MsgTsk)); |
151 |
|
|
} |
152 |
|
|
|
153 |
|
|
|
154 |
|
|
/*****************************************************************************/ |
155 |
|
|
/* @Function: PD_tkPatchDumpManager */ |
156 |
|
|
/* @Purpose : */ |
157 |
|
|
/* The function is the task handler of the PatchDump object. */ |
158 |
|
|
/* When a message is received into task mailbox it wakes up. */ |
159 |
|
|
/* The information contained in the message (MsgTsk structure) define */ |
160 |
|
|
/* parameters (Info field), and the operation type that the task performs */ |
161 |
|
|
/* (Code field). */ |
162 |
|
|
/* The PatchDump task activity is to manage the Patch or Dump mcmd. */ |
163 |
|
|
/* The function switches between these two commands. */ |
164 |
|
|
/* The allowed messages for this task are: */ |
165 |
|
|
/* Message code Action */ |
166 |
|
|
/* RG_RESET Puts the ReportGenerator object into its */ |
167 |
|
|
/* initial state */ |
168 |
|
|
/* RG_PREPARE_FRM_RT Commands the task to prepare the telemetry */ |
169 |
|
|
/* real time format */ |
170 |
|
|
/* */ |
171 |
|
|
/* @@ */ |
172 |
|
|
/* @Parameter Name @Mode @Description */ |
173 |
|
|
/* @@ */ |
174 |
|
|
/*****************************************************************************/ |
175 |
|
|
|
176 |
|
|
task PD_tkPatchDumpManager(task_argument unused) |
177 |
|
|
{ |
178 |
|
|
status_code status; |
179 |
|
|
MsgTsk RxMsg; |
180 |
|
|
unsigned int MsgSize; |
181 |
|
|
UWORD* pw; |
182 |
|
|
|
183 |
|
|
|
184 |
|
|
while( FOREVER ) |
185 |
|
|
{ |
186 |
|
|
RxMsg.Code = NULL_MSG_PD; |
187 |
|
|
/* Wait for a message to become available */ |
188 |
|
|
if ((status = OS_piMsgQueueReceive(PD_MAILBOX,(void*)&RxMsg, |
189 |
|
|
&MsgSize, WAIT, NO_TIMEOUT)) == SUCCESSFUL ) |
190 |
|
|
{ |
191 |
|
|
switch ( RxMsg.Code ) |
192 |
|
|
{ |
193 |
|
|
case PD_PATCH: /*=== MCMD PATCH management */ |
194 |
|
|
PD_ifPatch((MA_HEADER_MCMD*)RxMsg.Info, &PD_PatchBuff[0]); |
195 |
|
|
break; |
196 |
|
|
|
197 |
|
|
case PD_DUMP: /*=== MCMD DUMP management */ |
198 |
|
|
PD_ifDump((MA_HEADER_MCMD*)RxMsg.Info, &PD_DumpBuff[0],&PD_DumpInfo); |
199 |
|
|
break; |
200 |
|
|
|
201 |
|
|
default: |
202 |
|
|
break; |
203 |
|
|
} |
204 |
|
|
} |
205 |
|
|
} |
206 |
|
|
} |
207 |
|
|
|
208 |
|
|
|
209 |
|
|
/*****************************************************************************/ |
210 |
|
|
/* @Function: PD_opGetDumpDataAddress */ |
211 |
|
|
/* @Purpose : */ |
212 |
|
|
/* This function gets the address of dumped data. Dumped data are stored */ |
213 |
|
|
/* into an array resident in RAM memory. This function retrieves the */ |
214 |
|
|
/* pointer to the first location. */ |
215 |
|
|
/* */ |
216 |
|
|
/* @@ */ |
217 |
|
|
/* @Parameter Name @Mode @Description */ |
218 |
|
|
/* pDump IN pointer to dump memory area address */ |
219 |
|
|
/* status_code OUT Return code */ |
220 |
|
|
/* @@ */ |
221 |
|
|
/*****************************************************************************/ |
222 |
|
|
|
223 |
|
|
status_code PD_opGetDumpDataAddress(unsigned short int** pDump) |
224 |
|
|
{ |
225 |
|
|
*pDump = &PD_DumpBuff[0]; |
226 |
|
|
return (SUCCESSFUL); |
227 |
|
|
} |
228 |
|
|
|