1 |
kusanagi |
1.1 |
/**************************************************************************** |
2 |
|
|
/* F i l e D a t a |
3 |
|
|
/* |
4 |
|
|
/* Module : FileManager |
5 |
|
|
/* C.I. No. : |
6 |
|
|
/* $Revision: 1.4 $ |
7 |
|
|
/* $Date: 2005/02/21 08:58:28 $ |
8 |
|
|
/* Belonging to : |
9 |
|
|
/* : |
10 |
|
|
/* $RCSfile: FD_MMSUDriver_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: FD_MMSUDriver_op.c,v $ |
25 |
|
|
/* Revision 1.4 2005/02/21 08:58:28 sebastiani |
26 |
|
|
/* all log comments completed |
27 |
|
|
/* |
28 |
|
|
/* Revision 1.3 2003/10/21 16:09:12 alfarano |
29 |
|
|
/* LU_LOG_INFN replacement for all remaining original log functions |
30 |
|
|
/* |
31 |
|
|
/* Revision 1.2 2003/08/07 08:44:14 wizard |
32 |
|
|
/* SIMULATOR bugs ifdef/ifndef corrected |
33 |
|
|
/* laben bug "GetFileInfo" for FS_ERC32 id accepted in order to fix SM_pi_GetPacket |
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.5 2002/11/08 11:10:36 zulia |
39 |
|
|
/* fixed down link in case of the last sector stored |
40 |
|
|
/* |
41 |
|
|
/* Revision 1.4 2002/10/17 10:03:54 zulia |
42 |
|
|
/* removed FD_PIFReset |
43 |
|
|
/* |
44 |
|
|
/* Revision 1.3 2002/05/09 08:16:34 zulia |
45 |
|
|
/* * acceptance release |
46 |
|
|
/* |
47 |
|
|
/* |
48 |
|
|
/*****************************************************************************/ |
49 |
|
|
|
50 |
|
|
|
51 |
|
|
/*============================= Include File ================================*/ |
52 |
|
|
|
53 |
|
|
#include <src/FileManager/MMSUDriver/FD_MMSUDriver_op.h> |
54 |
|
|
#include <src/FileManager/MMSUDriver/FD_MMSUDriver_int.h> |
55 |
|
|
|
56 |
|
|
#include <src/INFN/LU_SourceFileID_INFN.h> |
57 |
|
|
#define __FILEID__ _FD_MMSUDriver_op__c |
58 |
|
|
#include <src/INFN/PRH_ParamHandler_INFN_auto.h> |
59 |
|
|
#include <src/INFN/PRH_ParamHandler_INFN.h> |
60 |
|
|
#include <src/INFN/LU_LogUtility_INFN.h> |
61 |
|
|
|
62 |
|
|
LU_DECL_MASK(); |
63 |
|
|
|
64 |
|
|
|
65 |
|
|
/*============================== local define ===============================*/ |
66 |
|
|
|
67 |
|
|
/*======================== Object Internal variables ========================*/ |
68 |
|
|
|
69 |
|
|
|
70 |
|
|
/*****************************************************************************/ |
71 |
|
|
/* @Constant: FD_DrammaRegMask */ |
72 |
|
|
/* @Purpose : */ |
73 |
|
|
/* Array of FD_DRAMMA_REG type. */ |
74 |
|
|
/* DRAMMA registers mask. */ |
75 |
|
|
/* @@ */ |
76 |
|
|
/*****************************************************************************/ |
77 |
|
|
const FD_DRAMMA_REG FD_DrammaRegMask= {{0x00, |
78 |
|
|
0x80000000, |
79 |
|
|
0xc0000000, |
80 |
|
|
0xc8000000, |
81 |
|
|
0xd0000000, |
82 |
|
|
0xd8000000, |
83 |
|
|
0xe0000000, |
84 |
|
|
0xf0000000, |
85 |
|
|
0xf8000000, |
86 |
|
|
0xfc000000, |
87 |
|
|
0xfe000000}, |
88 |
|
|
{0x00, |
89 |
|
|
0x01, |
90 |
|
|
0x02, |
91 |
|
|
0x03, |
92 |
|
|
0x04, |
93 |
|
|
0x05, |
94 |
|
|
0x06, |
95 |
|
|
0x07} |
96 |
|
|
}; |
97 |
|
|
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
/*****************************************************************************/ |
101 |
|
|
|
102 |
|
|
/*===== M M S U D r i v e r O P E R A T I O N A L F U N C T I O N S =====*/ |
103 |
|
|
|
104 |
|
|
/*****************************************************************************/ |
105 |
|
|
/* @Function: FD_opInitMMSUDriver */ |
106 |
|
|
/* @Purpose : */ |
107 |
|
|
/* The function performs the MMSUDriver object initialization. */ |
108 |
|
|
/* The BOX ID register is read to get the MMSU boxes composition. If the */ |
109 |
|
|
/* box ID returned is 0 the addresses of the Box X are Local and the */ |
110 |
|
|
/* addresses of the Box Y are Remote. Otherwise if the value returned is 1 */ |
111 |
|
|
/* the addresses of the Box Y are Local and the addresses of the Box X */ |
112 |
|
|
/* are Remote. */ |
113 |
|
|
/* The Wideband registers are also initialized with the default value. */ |
114 |
|
|
/* */ |
115 |
|
|
/* @@ */ |
116 |
|
|
/* @Parameter Name @Mode @Description */ |
117 |
|
|
/* status_code OUT Return code */ |
118 |
|
|
/* @@ */ |
119 |
|
|
/*****************************************************************************/ |
120 |
|
|
|
121 |
|
|
status_code FD_opInitMMSUDriver (void) |
122 |
|
|
{ |
123 |
|
|
status_code status; |
124 |
|
|
|
125 |
|
|
|
126 |
|
|
status =SUCCESSFUL; |
127 |
|
|
return (status); |
128 |
|
|
} |
129 |
|
|
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
/*****************************************************************************/ |
133 |
|
|
/* @Function: FD_opDrammaWrWPBUSReg */ |
134 |
|
|
/* @Purpose : */ |
135 |
|
|
/* The function programs a writing into the Dramma WPBUS register. */ |
136 |
|
|
/* The value is written into the Dramma register specified through the */ |
137 |
|
|
/* Box, Board address, and register parameters. */ |
138 |
|
|
/* An invalid parameter detection, causes an internal error notified */ |
139 |
|
|
/* with a log into the History area object. */ |
140 |
|
|
/* */ |
141 |
|
|
/* @@ */ |
142 |
|
|
/* @Parameter Name @Mode @Description */ |
143 |
|
|
/* BoardId IN Board address (0 to FD_MAX_BOARD_ADDR) */ |
144 |
|
|
/* Reg IN Register indentifier */ |
145 |
|
|
/* (FD_DRAMMA_REG_WPBUS type) */ |
146 |
|
|
/* Value IN Value to write into the Dramma register */ |
147 |
|
|
/* status_code OUT Return code */ |
148 |
|
|
/* @@ */ |
149 |
|
|
/*****************************************************************************/ |
150 |
|
|
|
151 |
|
|
status_code FD_opDrammaWrWPBUSReg (unsigned int BoardId, |
152 |
|
|
unsigned int Reg, |
153 |
|
|
unsigned int Value) |
154 |
|
|
{ |
155 |
|
|
status_code status; |
156 |
|
|
|
157 |
|
|
/* Check box, board ID, and register parameter */ |
158 |
|
|
if (BoardId <= FD_MAX_BOARD_ADDR && Reg < FD_MAX_DRAMMA_WPBUS_REG) |
159 |
|
|
{ |
160 |
|
|
/* Write DRAMMA WPBUS register */ |
161 |
|
|
FD_ifDrammaWrWPBUSReg ((void*)&FD_DrammaRegMask,BoardId,Reg,Value); |
162 |
|
|
status =SUCCESSFUL; |
163 |
|
|
} |
164 |
|
|
else |
165 |
|
|
{ |
166 |
|
|
|
167 |
|
|
// LOG_INFN HA_piLogHistoryEntry10(HA_E10_SW_FD,HA_E10_MMSU_REG_ADDRESS_ERR,HA_E10_REP2_NULL); |
168 |
|
|
/*@LOG Invalid MMSU register address */ |
169 |
|
|
LU_INFN_LOG(LU_CRITICAL,LU_MASK(__FILEID__),__FILEID__,__LINE__,HA_E10_REP2_NULL); |
170 |
|
|
status =HA_E2_INTERNAL_ERR; |
171 |
|
|
} |
172 |
|
|
|
173 |
|
|
return (status); |
174 |
|
|
|
175 |
|
|
} |
176 |
|
|
|
177 |
|
|
|
178 |
|
|
|
179 |
|
|
/*****************************************************************************/ |
180 |
|
|
/* @Function: FD_opDrammaRdRPBUSReg */ |
181 |
|
|
/* @Purpose : */ |
182 |
|
|
/* The function programs a reading from the Dramma WPBUS register. */ |
183 |
|
|
/* The value is read from the Dramma register specified through the Box, */ |
184 |
|
|
/* Board address, and register parameters. */ |
185 |
|
|
/* An invalid parameter detection, causes an internal error notified */ |
186 |
|
|
/* with a log into the History area object. */ |
187 |
|
|
/* */ |
188 |
|
|
/* @@ */ |
189 |
|
|
/* @Parameter Name @Mode @Description */ |
190 |
|
|
/* BoardId IN Board address (0 to FD_MAX_BOARD_ADDR) */ |
191 |
|
|
/* Reg IN Register indentifier */ |
192 |
|
|
/* (FD_DRAMMA_REG_RPBUS type) */ |
193 |
|
|
|
194 |
|
|
/* Value OUT Value read from the Dramma register */ |
195 |
|
|
/* status_code OUT Return code */ |
196 |
|
|
/* @@ */ |
197 |
|
|
/*****************************************************************************/ |
198 |
|
|
|
199 |
|
|
status_code FD_opDrammaRdRPBUSReg (unsigned int BoardId, |
200 |
|
|
unsigned int Reg, |
201 |
|
|
unsigned int* Value) |
202 |
|
|
{ |
203 |
|
|
status_code status; |
204 |
|
|
|
205 |
|
|
/* Check box, board ID, and register parameter */ |
206 |
|
|
if (BoardId<=FD_MAX_BOARD_ADDR && Reg<FD_MAX_DRAMMA_RPBUS_REG) |
207 |
|
|
{ |
208 |
|
|
/* Read DRAMMA RPBUS register */ |
209 |
|
|
FD_ifDrammaRdRPBUSReg ((void*)&FD_DrammaRegMask,BoardId,Reg,Value); |
210 |
|
|
status =SUCCESSFUL; |
211 |
|
|
} |
212 |
|
|
else |
213 |
|
|
{ |
214 |
|
|
|
215 |
|
|
// LOG_INFN HA_piLogHistoryEntry10(HA_E10_SW_FD,HA_E10_MMSU_REG_ADDRESS_ERR,HA_E10_REP2_NULL); |
216 |
|
|
/*@LOG Invalid MMSU register address */ |
217 |
|
|
LU_INFN_LOG(LU_CRITICAL,LU_MASK(__FILEID__),__FILEID__,__LINE__,HA_E10_REP2_NULL); |
218 |
|
|
status =HA_E2_INTERNAL_ERR; |
219 |
|
|
} |
220 |
|
|
|
221 |
|
|
return (status); |
222 |
|
|
|
223 |
|
|
} |
224 |
|
|
|
225 |
|
|
/*****************************************************************************/ |
226 |
|
|
/* @Function: FD_opStartTransferToMemory */ |
227 |
|
|
/* @Purpose : */ |
228 |
|
|
/* Provided Interface to start the WPBUS writing into the memory module. */ |
229 |
|
|
/* */ |
230 |
|
|
/* @@ */ |
231 |
|
|
/* @Parameter Name @Mode @Description */ |
232 |
|
|
/* Module IN Module ID to write to */ |
233 |
|
|
/* status_code OUT Return code */ |
234 |
|
|
/* @@ */ |
235 |
|
|
/*****************************************************************************/ |
236 |
|
|
|
237 |
|
|
status_code FD_opStartTransferToMemory(FD_MODID Module) |
238 |
|
|
{ |
239 |
|
|
status_code status = SUCCESSFUL; |
240 |
|
|
BYTE *reg; |
241 |
|
|
|
242 |
|
|
reg = (BYTE *) FD_WPBUS_DBID; |
243 |
|
|
/* Start the data transfer to the selected module */ |
244 |
|
|
switch(Module) { |
245 |
|
|
case FD_PRIMARY: { |
246 |
|
|
#ifndef SIMULATOR |
247 |
|
|
*reg = (BYTE)(0x00); |
248 |
|
|
#endif |
249 |
|
|
} break; |
250 |
|
|
case FD_BACKUP: { |
251 |
|
|
#ifndef SIMULATOR |
252 |
|
|
*reg = (BYTE)(0x01); |
253 |
|
|
#endif |
254 |
|
|
} break; |
255 |
|
|
default:{ |
256 |
|
|
status = UNSATISFIED; |
257 |
|
|
} |
258 |
|
|
} |
259 |
|
|
return (status); |
260 |
|
|
} |
261 |
|
|
|
262 |
|
|
/*****************************************************************************/ |
263 |
|
|
/* @Function: FD_opStartTransferFromMemory */ |
264 |
|
|
/* @Purpose : */ |
265 |
|
|
/* Provided Interface to start the RPBUS reading from the memory module. */ |
266 |
|
|
/* */ |
267 |
|
|
/* @@ */ |
268 |
|
|
/* @Parameter Name @Mode @Description */ |
269 |
|
|
/* Module IN Module ID to write to */ |
270 |
|
|
/* status_code OUT Return code */ |
271 |
|
|
/* @@ */ |
272 |
|
|
/*****************************************************************************/ |
273 |
|
|
|
274 |
|
|
status_code FD_opStartTransferFromMemory(FD_MODID Module, BOOL LastSector) |
275 |
|
|
{ |
276 |
|
|
#ifdef SIMULATOR |
277 |
|
|
return SUCCESSFUL; |
278 |
|
|
#else |
279 |
|
|
status_code status = SUCCESSFUL; |
280 |
|
|
BYTE *reg; |
281 |
|
|
BYTE Lsf = 0x00; |
282 |
|
|
|
283 |
|
|
reg = (BYTE *) FD_RPBUS_DBID; |
284 |
|
|
if(LastSector) |
285 |
|
|
{ |
286 |
|
|
Lsf = FD_LAST_SECTOR_FLAG; |
287 |
|
|
} |
288 |
|
|
switch(Module) { |
289 |
|
|
case FD_PRIMARY: { |
290 |
|
|
*reg = (BYTE)(0x00 | Lsf); |
291 |
|
|
} break; |
292 |
|
|
case FD_BACKUP: { |
293 |
|
|
*reg = (BYTE)(0x01 | Lsf); |
294 |
|
|
} break; |
295 |
|
|
default:{ |
296 |
|
|
status = UNSATISFIED; |
297 |
|
|
} |
298 |
|
|
} |
299 |
|
|
return (status); |
300 |
|
|
#endif |
301 |
|
|
} |
302 |
|
|
|
303 |
|
|
/*****************************************************************************/ |
304 |
|
|
/* @Function: FD_opAbortTransfer */ |
305 |
|
|
/* @Purpose : */ |
306 |
|
|
/* Provided Interface to start the WPBUS writing into the memory module. */ |
307 |
|
|
/* */ |
308 |
|
|
/* @@ */ |
309 |
|
|
/* @Parameter Name @Mode @Description */ |
310 |
|
|
/* Module IN Module ID to write to */ |
311 |
|
|
/* status_code OUT Return code */ |
312 |
|
|
/* @@ */ |
313 |
|
|
/*****************************************************************************/ |
314 |
|
|
|
315 |
|
|
status_code FD_opAbortTransfer(FD_ABT_TYPE Aborttype) |
316 |
|
|
{ |
317 |
|
|
#ifdef SIMULATOR |
318 |
|
|
return SUCCESSFUL; |
319 |
|
|
#else |
320 |
|
|
status_code status = SUCCESSFUL; |
321 |
|
|
BYTE *reg; |
322 |
|
|
|
323 |
|
|
reg = (BYTE *) FD_RWPB_ABORT; |
324 |
|
|
/* Abort the selected operation */ |
325 |
|
|
switch(Aborttype) { |
326 |
|
|
case FD_ABT_WRITE: { |
327 |
|
|
*reg = (BYTE)(0x01); |
328 |
|
|
} break; |
329 |
|
|
case FD_ABT_READ: { |
330 |
|
|
*reg = (BYTE)(0x02); |
331 |
|
|
} break; |
332 |
|
|
} |
333 |
|
|
return (status); |
334 |
|
|
#endif |
335 |
|
|
} |
336 |
|
|
|
337 |
|
|
/*****************************************************************************/ |
338 |
|
|
/* @Function: FD_opSetWPBUSWaitState */ |
339 |
|
|
/* @Purpose : */ |
340 |
|
|
/* Provided Interface to set the WPBUS wait state counter */ |
341 |
|
|
/* packets. */ |
342 |
|
|
/* */ |
343 |
|
|
/* @@ */ |
344 |
|
|
/* @Parameter Name @Mode @Description */ |
345 |
|
|
/* Counter IN Number of WPBUS wait states */ |
346 |
|
|
/* @@ */ |
347 |
|
|
/*****************************************************************************/ |
348 |
|
|
|
349 |
|
|
void FD_opSetWPBUSWaitState(UINT32 Counter) |
350 |
|
|
{ |
351 |
|
|
#ifdef SIMULATOR |
352 |
|
|
return; |
353 |
|
|
#else |
354 |
|
|
BYTE *reg; |
355 |
|
|
|
356 |
|
|
reg = (BYTE *) FD_WPB_WSC; |
357 |
|
|
*reg = (BYTE)(Counter & 0x000000FF); |
358 |
|
|
#endif |
359 |
|
|
} |
360 |
|
|
|
361 |
|
|
/*****************************************************************************/ |
362 |
|
|
/* @Function: FD_opSetRPBUSWaitState */ |
363 |
|
|
/* @Purpose : */ |
364 |
|
|
/* Provided Interface to set the RPBUS wait state counter */ |
365 |
|
|
/* packets. */ |
366 |
|
|
/* */ |
367 |
|
|
/* @@ */ |
368 |
|
|
/* @Parameter Name @Mode @Description */ |
369 |
|
|
/* Counter IN Number of RPBUS wait states */ |
370 |
|
|
/* @@ */ |
371 |
|
|
/*****************************************************************************/ |
372 |
|
|
|
373 |
|
|
void FD_opSetRPBUSWaitState(UINT32 Counter) |
374 |
|
|
{ |
375 |
|
|
#ifdef SIMULATOR |
376 |
|
|
return; |
377 |
|
|
#else |
378 |
|
|
BYTE *reg; |
379 |
|
|
|
380 |
|
|
reg = (BYTE *) FD_RPB_WSC; |
381 |
|
|
*reg = (BYTE)(Counter & 0x000000FF); |
382 |
|
|
#endif |
383 |
|
|
} |
384 |
|
|
|
385 |
|
|
/*****************************************************************************/ |
386 |
|
|
/* @Function: FD_opSetBlockLength */ |
387 |
|
|
/* @Purpose : */ |
388 |
|
|
/* Provided Interface to set the last block length for the RPBUS */ |
389 |
|
|
/* */ |
390 |
|
|
/* @@ */ |
391 |
|
|
/* @Parameter Name @Mode @Description */ |
392 |
|
|
/* Length IN block length */ |
393 |
|
|
/* status_code OUT Return code */ |
394 |
|
|
/* @@ */ |
395 |
|
|
/*****************************************************************************/ |
396 |
|
|
|
397 |
|
|
status_code FD_opSetBlockLength(UINT32 Length) |
398 |
|
|
{ |
399 |
|
|
#ifdef SIMULATOR |
400 |
|
|
return SUCCESSFUL; |
401 |
|
|
#else |
402 |
|
|
status_code status = SUCCESSFUL; |
403 |
|
|
BYTE *reg; |
404 |
|
|
|
405 |
|
|
/* Program the Block length for the RPBUS*/ |
406 |
|
|
reg = (BYTE *) FD_RPB_RBL1; |
407 |
|
|
*reg = (BYTE)(Length & 0x000000FF); |
408 |
|
|
reg = (BYTE *) FD_RPB_RBL2; |
409 |
|
|
*reg = (BYTE)((Length>>8) & 0x000000FF); |
410 |
|
|
reg = (BYTE *) FD_RPB_RBL3; |
411 |
|
|
*reg = (BYTE)((Length>>16) & 0x000000FF); |
412 |
|
|
|
413 |
|
|
return (status); |
414 |
|
|
#endif |
415 |
|
|
} |
416 |
|
|
|
417 |
|
|
|
418 |
|
|
|
419 |
|
|
|