/[PAMELA software]/quicklook/dataToXML/Data/compilationInfo/src/SRAMManager/SRAMDriver/SD_SRAMDriver_p.c
ViewVC logotype

Contents of /quicklook/dataToXML/Data/compilationInfo/src/SRAMManager/SRAMDriver/SD_SRAMDriver_p.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 : SRAMManager
5 /* C.I. No. :
6 /* $Revision: 1.3 $
7 /* $Date: 2004/02/11 16:26:52 $
8 /* Belonging to :
9 /* :
10 /* $RCSfile: SD_SRAMDriver_p.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: SD_SRAMDriver_p.c,v $
25 /* Revision 1.3 2004/02/11 16:26:52 faber
26 /* CM_TIME2REG introduced
27 /*
28 /* Revision 1.2 2003/10/27 19:01:43 sebastiani
29 /* SD_piSetEventTimeout_microseconds introduced, still not used
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 2003/04/29 13:30:01 aurora
35 /* introduced the new register TRIG3 for manage page overrun every 64Kbyte
36 /*
37 /* Revision 1.6 2003/03/12 10:56:22 aurora
38 /* added the provider for the counter of bytes left on CMD I/F queue
39 /*
40 /* Revision 1.5 2002/10/17 10:07:14 zulia
41 /* added SD_PIFReset
42 /*
43 /* Revision 1.4 2002/07/31 14:30:10 zulia
44 /* Added driver for indipendent control of CMD I/F from DAQ I/F
45 /*
46 /* Revision 1.3 2002/05/09 08:16:35 zulia
47 /* * acceptance release
48 /*
49 /*
50 /*****************************************************************************/
51
52
53 /*============================= Include File ================================*/
54
55 #include <src/SRAMManager/SRAMDriver/SD_SRAMDriver_p.h>
56 #include <src/SRAMManager/SRAMDriver/SD_SRAMDriver_op.h>
57
58 /*============================== global define ==============================*/
59
60 /*============================== local types ================================*/
61
62 /*****************************************************************************/
63
64 /*====== S R A M D r i v e r P R O V I D E D I N T E R F A C E ======*/
65
66 /*****************************************************************************/
67 /* @Function: SD_piSRAMDriverInit */
68 /* @Purpose : */
69 /* Provided Interface to init the SRAM driver */
70 /* */
71 /* @@ */
72 /* @Parameter Name @Mode @Description */
73 /* SD_EXITCODE OUT Exit code */
74 /* @@ */
75 /*****************************************************************************/
76
77 SD_EXITCODE SD_piSRAMDriverInit(void)
78 {
79 SD_EXITCODE status;
80
81 status = SD_opSRAMDriverInit();
82 return (status);
83 }
84
85 /*****************************************************************************/
86 /* @Function: SD_piSetDataWritePage */
87 /* @Purpose : */
88 /* Provided Interface to select the SRAM page to hold new incoming data. */
89 /* */
90 /* @@ */
91 /* @Parameter Name @Mode @Description */
92 /* Page IN SRAM page to be selected in input */
93 /* SD_EXITCODE OUT Exit code */
94 /* @@ */
95 /*****************************************************************************/
96
97 SD_EXITCODE SD_piSetDAQWritePage(UINT32 Page)
98 {
99 SD_EXITCODE status = SD_SUCCESS;
100
101 SD_opSetDAQWritePage(Page);
102 return (status);
103 }
104
105 /*****************************************************************************/
106 /* @Function: SD_piIsDAQWriteOk */
107 /* @Purpose : */
108 /* Provided Interface to retrive the status uf the last DAQ I/F write into */
109 /* SRAM. */
110 /* */
111 /* @@ */
112 /* @Parameter Name @Mode @Description */
113 /* SD_TRANSFERSTAT OUT status of the last DAQ I/F SRAM write */
114 /* @@ */
115 /*****************************************************************************/
116
117 SD_TRANSFERSTAT SD_piIsDAQWriteOk(void)
118 {
119 SD_TRANSFERSTAT status;
120
121 status = SD_opIsDAQWriteOk();
122 return (status);
123 }
124
125 /*****************************************************************************/
126 /* @Function: SD_piGetDAQWriteResult */
127 /* @Purpose : */
128 /* Provided Interface to retrive the end address of the data written by the */
129 /* DAQ I/F in the selected SRAM page. */
130 /* */
131 /* @@ */
132 /* @Parameter Name @Mode @Description */
133 /* SD_DAQ_RESULT OUT structure to hold the end address, page and */
134 /* status of the last DAQ I/F SRAM write */
135 /* @@ */
136 /*****************************************************************************/
137
138 SD_DAQ_WRESULT SD_piGetDAQWriteResult(void)
139 {
140 SD_DAQ_WRESULT Result;
141
142 Result = SD_opGetDAQWriteResult();
143 return (Result);
144 }
145
146 /*****************************************************************************/
147 /* @Function: SD_piStartTransferToCMD */
148 /* @Purpose : */
149 /* Provided Interface to start the transfer of data stored in the pervoiusly*/
150 /* selected SRAM to the CMD I/F. */
151 /* */
152 /* @@ */
153 /* @Parameter Name @Mode @Description */
154 /* SD_EXITCODE OUT Exit code */
155 /* @@ */
156 /*****************************************************************************/
157
158 SD_EXITCODE SD_piStartTransferToCMD(void)
159 {
160 SD_EXITCODE status = SD_SUCCESS;
161
162 SD_opStartTransferToCMD();
163 return (status);
164 }
165
166 /*****************************************************************************/
167 /* @Function: SD_piWriteSRAM */
168 /* @Purpose : */
169 /* Provided Interface to write a data byte in the pervoiusly selected */
170 /* SRAM address. */
171 /* */
172 /* @@ */
173 /* @Parameter Name @Mode @Description */
174 /* data IN 8bit data to store into perviously selected */
175 /* SRAM address */
176 /* SD_EXITCODE OUT Exit code */
177 /* @@ */
178 /*****************************************************************************/
179
180 SD_EXITCODE SD_piWriteSRAM(UINT32 data)
181 {
182 SD_EXITCODE status = SD_SUCCESS;
183
184 SD_opWriteSRAM(data);
185 return (status);
186 }
187
188 /*****************************************************************************/
189 /* @Function: SD_piReadSRAM */
190 /* @Purpose : */
191 /* Provided Interface to read a data byte from the pervoiusly selected */
192 /* SRAM address. */
193 /* */
194 /* @@ */
195 /* @Parameter Name @Mode @Description */
196 /* BYTE OUT 8bit data read from perviously selected */
197 /* SRAM address */
198 /* @@ */
199 /*****************************************************************************/
200
201 UINT32 SD_piReadSRAM(void)
202 {
203 UINT32 data;
204
205 data = SD_opReadSRAM();
206 return (data);
207 }
208
209 /*****************************************************************************/
210 /* @Function: SD_piSetEventTimeout */
211 /* @Purpose : */
212 /* Provided Interface to set the event timeout generation counter. The LSB */
213 /* has a resolution of 65us. */
214 /* SRAM address. */
215 /* */
216 /* @@ */
217 /* @Parameter Name @Mode @Description */
218 /* tics IN counter value */
219 /* SD_EXITCODE OUT Exit code */
220 /* @@ */
221 /*****************************************************************************/
222
223 SD_EXITCODE SD_piSetEventTimeout_microseconds(UINT32 microseconds)
224 {
225 /* ETO1 LSB register is in 65us - ETO2 LSB register is in 16 ms, so the formula is:
226 *
227 * microseconds = 16 * 10^3 * ETO2 + 65 * ETO1
228 *
229 * ETO2 = microseconds / 16*10^3
230 * ETO1 = (microseconds - ETO2 * 10*10^3) / 65
231 */
232 SD_EXITCODE status = SD_SUCCESS;
233 BYTE eto2 = microseconds / (16*1000);
234 BYTE eto1 = (microseconds - eto2 * 16*1000) / 65;
235 SD_opSetEventTimeout( (eto2 << 8) | eto1);
236 return (status);
237 }
238
239 SD_EXITCODE SD_piSetEventTimeout(UINT32 tics)
240 {
241 SD_EXITCODE status = SD_SUCCESS;
242
243 SD_opSetEventTimeout(tics);
244 return (status);
245 }
246
247 /*****************************************************************************/
248 /* @Function: SD_piSetDataTimeout */
249 /* @Purpose : */
250 /* Provided Interface to set the data timeout generation counter. The LSB */
251 /* has a resolution of 508ns. */
252 /* SRAM address. */
253 /* */
254 /* @@ */
255 /* @Parameter Name @Mode @Description */
256 /* tics IN counter value */
257 /* SD_EXITCODE OUT Exit code */
258 /* @@ */
259 /*****************************************************************************/
260
261 SD_EXITCODE SD_piSetDataTimeout(UINT32 tics)
262 {
263 SD_EXITCODE status = SD_SUCCESS;
264
265 SD_opSetDataTimeout(tics);
266 return (status);
267 }
268
269 /*****************************************************************************/
270 /* @Function: SD_piTrigDataEvent */
271 /* @Purpose : */
272 /* Provided Interface that trigs the DAQ I/F to recieve incoming */
273 /* data packet, enabling the DTO, ETO timeouts and PAGE OVERRUN detection */
274 /* at each 16 Kbytes pages. */
275 /* */
276 /* @@ */
277 /* @Parameter Name @Mode @Description */
278 /* SD_EXITCODE OUT Exit code */
279 /* @@ */
280 /*****************************************************************************/
281
282 SD_EXITCODE SD_piTrigDataEvent(void)
283 {
284 SD_EXITCODE status = SD_SUCCESS;
285
286 SD_opTrigDataEvent();
287 return (status);
288 }
289
290 /*****************************************************************************/
291 /* @Function: SD_piTrigData64Event */
292 /* @Purpose : */
293 /* Provided Interface that trigs the DAQ I/F to recieve incoming */
294 /* data packet, enabling the DTO, ETO timeouts and PAGE OVERRUN detection */
295 /* at each 64 Kbytes pages. */
296 /* */
297 /* @@ */
298 /* @Parameter Name @Mode @Description */
299 /* SD_EXITCODE OUT Exit code */
300 /* @@ */
301 /*****************************************************************************/
302
303 SD_EXITCODE SD_piTrigData64Event(void)
304 {
305 SD_EXITCODE status = SD_SUCCESS;
306
307 SD_opTrigData64Event();
308 return (status);
309 }
310
311 /*****************************************************************************/
312 /* @Function: SD_piTrigCalibrationEvent */
313 /* @Purpose : */
314 /* Provided Interface that trigs the DAQ I/F to recieve incoming data */
315 /* enabling the DTO and ETO timeouts (for calibration mode) */
316 /* and PAGE OVERRUN detection at 128 Kbyte */
317 /* */
318 /* @@ */
319 /* @Parameter Name @Mode @Description */
320 /* SD_EXITCODE OUT Exit code */
321 /* @@ */
322 /*****************************************************************************/
323
324 SD_EXITCODE SD_piTrigCalibrationEvent(void)
325 {
326 SD_EXITCODE status = SD_SUCCESS;
327
328 SD_opTrigCalibrationEvent();
329 return (status);
330 }
331
332 /*****************************************************************************/
333 /* @Function: SD_piSetDataHeaderLength */
334 /* @Purpose : */
335 /* Provided Interface to set the length of the header of incoming data */
336 /* packets. */
337 /* */
338 /* @@ */
339 /* @Parameter Name @Mode @Description */
340 /* length IN header length */
341 /* SD_EXITCODE OUT Exit code */
342 /* @@ */
343 /*****************************************************************************/
344
345 SD_EXITCODE SD_piSetDataHeaderLength(UINT32 length)
346 {
347 SD_EXITCODE status = SD_SUCCESS;
348
349 SD_opSetDataHeaderLength(length);
350 return (status);
351 }
352
353
354 /*****************************************************************************/
355 /* @Function: SD_piSetCalibrationHeaderLength */
356 /* @Purpose : */
357 /* Provided Interface to set the length of the header of incoming */
358 /* calibration packets. */
359 /* */
360 /* @@ */
361 /* @Parameter Name @Mode @Description */
362 /* length IN header length */
363 /* SD_EXITCODE OUT Exit code */
364 /* @@ */
365 /*****************************************************************************/
366
367 SD_EXITCODE SD_piSetCalibrationHeaderLength(UINT32 length)
368 {
369 SD_EXITCODE status = SD_SUCCESS;
370
371 SD_opSetCalibrationHeaderLength(length);
372 return (status);
373 }
374
375 /*****************************************************************************/
376 /* @Function: SD_piIsCMDReadOk */
377 /* @Purpose : */
378 /* Provided Interface to retrive the status of the last SRAM to CMD write */
379 /* */
380 /* @@ */
381 /* @Parameter Name @Mode @Description */
382 /* SD_TRANSFERSTAT OUT Last SRAM Page send to CMD result */
383 /* @@ */
384 /*****************************************************************************/
385
386 SD_TRANSFERSTAT SD_piIsCMDReadOk(void)
387 {
388 SD_TRANSFERSTAT status;
389
390 status = SD_opIsCMDReadOk();
391 return (status);
392 }
393
394 /*****************************************************************************/
395 /* @Function: SD_piSetSRAMRWAddress */
396 /* @Purpose : */
397 /* Provided Interface to set the address for I/O operation between SRAM and */
398 /* processor. */
399 /* */
400 /* @@ */
401 /* @Parameter Name @Mode @Description */
402 /* address IN read/write address */
403 /* SD_EXITCODE OUT Exit code */
404 /* @@ */
405 /*****************************************************************************/
406
407 SD_EXITCODE SD_piSetSRAMRWAddress(UINT32 address)
408 {
409 SD_EXITCODE status = SD_SUCCESS;
410
411 SD_opSetSRAMRWAddress(address);
412 return (status);
413 }
414
415 /*****************************************************************************/
416 /* @Function: SD_piGetSRAMRWAddress */
417 /* @Purpose : */
418 /* Provided Interface to get the address for I/O operation between SRAM and */
419 /* processor. */
420 /* */
421 /* @@ */
422 /* @Parameter Name @Mode @Description */
423 /* address IN read/write address */
424 /* SD_EXITCODE OUT Exit code */
425 /* @@ */
426 /*****************************************************************************/
427
428 UINT32 SD_piGetSRAMRWAddress(void)
429 {
430 UINT32 Address;
431
432 Address = SD_opGetSRAMRWAddress();
433 return (Address);
434 }
435
436 /*****************************************************************************/
437 /* @Function: SD_piSetWPBUSReadPage */
438 /* @Purpose : */
439 /* Provided Interface to select the SRAM page be tranfered from MMSU or CMD */
440 /* */
441 /* @@ */
442 /* @Parameter Name @Mode @Description */
443 /* Page IN SRAM page to be transfered */
444 /* SD_EXITCODE OUT Exit code */
445 /* @@ */
446 /*****************************************************************************/
447
448 SD_EXITCODE SD_piSetWPBUSReadPage(UINT32 Page)
449 {
450 SD_EXITCODE status = SD_SUCCESS;
451
452 SD_opSetWPBUSReadPage(Page);
453 return (status);
454 }
455
456 /*****************************************************************************/
457 /* @Function: SD_piSetWPBUSReadParams */
458 /* @Purpose : */
459 /* Provided Interface to set the stop address for the SRAM transfer into */
460 /* both tne MMSU od CMD. */
461 /* */
462 /* @@ */
463 /* @Parameter Name @Mode @Description */
464 /* ReadParams IN structure to hold the stop page end address */
465 /* SD_EXITCODE OUT Exit code */
466 /* @@ */
467 /*****************************************************************************/
468
469 SD_EXITCODE SD_piSetWPBUSReadParams(SD_DAQ_WRESULT ReadParams)
470 {
471 SD_EXITCODE status = SD_SUCCESS;
472
473 SD_opSetWPBUSReadParams(ReadParams);
474 return (status);
475 }
476
477 /*****************************************************************************/
478 /* @Function: SD_piSetCMDBUSReadPage */
479 /* @Purpose : */
480 /* Provided Interface to select the SRAM page be tranfered from CMD */
481 /* */
482 /* @@ */
483 /* @Parameter Name @Mode @Description */
484 /* Page IN SRAM page to be transfered */
485 /* SD_EXITCODE OUT Exit code */
486 /* @@ */
487 /*****************************************************************************/
488
489 SD_EXITCODE SD_piSetCMDBUSReadPage(UINT32 Page)
490 {
491 SD_EXITCODE status = SD_SUCCESS;
492
493 SD_opSetCMDBUSReadPage(Page);
494 return (status);
495 }
496
497 /*****************************************************************************/
498 /* @Function: SD_piSetCMDBUSReadParams */
499 /* @Purpose : */
500 /* Provided Interface to set the stop address for the SRAM transfer into */
501 /* the CMD. */
502 /* */
503 /* @@ */
504 /* @Parameter Name @Mode @Description */
505 /* ReadParams IN structure to hold the stop page end address */
506 /* SD_EXITCODE OUT Exit code */
507 /* @@ */
508 /*****************************************************************************/
509
510 SD_EXITCODE SD_piSetCMDBUSReadParams(SD_DAQ_WRESULT ReadParams)
511 {
512 SD_EXITCODE status = SD_SUCCESS;
513
514 SD_opSetCMDBUSReadParams(ReadParams);
515 return (status);
516 }
517
518 /*****************************************************************************/
519 /* @Function: SD_piMaskInt */
520 /* @Purpose : */
521 /* Provided Interface to mask the Interrupts of the SRAM module */
522 /* */
523 /* @@ */
524 /* @Parameter Name @Mode @Description */
525 /* IntLine IN Interrupts to mask */
526 /* SD_EXITCODE OUT Exit code */
527 /* @@ */
528 /*****************************************************************************/
529
530 SD_EXITCODE SD_piMaskInt(SD_INTLINE IntLine)
531 {
532 SD_EXITCODE status = SD_SUCCESS;
533 #ifndef SIMULATOR
534 SD_opMaskInt(IntLine);
535 #endif
536 return (status);
537 }
538
539 /*****************************************************************************/
540 /* @Function: SD_piUnMaskInt */
541 /* @Purpose : */
542 /* Provided Interface to set the Interrupt Mask of the SRAM module */
543 /* */
544 /* @@ */
545 /* @Parameter Name @Mode @Description */
546 /* IntLine IN Interrupts to unmask */
547 /* SD_EXITCODE OUT Exit code */
548 /* @@ */
549 /*****************************************************************************/
550
551 SD_EXITCODE SD_piUnMaskInt(SD_INTLINE IntLine)
552 {
553 SD_EXITCODE status = SD_SUCCESS;
554 #ifndef SIMULATOR
555 SD_opUnMaskInt(IntLine);
556 #endif
557 return (status);
558 }
559
560 /*****************************************************************************/
561 /* @Function: SD_piIsIntMasked */
562 /* @Purpose : */
563 /* Provided Interface to check if an Interrupt of the SRAM module is masked */
564 /* */
565 /* @@ */
566 /* @Parameter Name @Mode @Description */
567 /* IntLine IN Interrupts to unmask */
568 /* @@ */
569 /*****************************************************************************/
570
571 BOOL SD_piIsIntMasked(SD_INTLINE IntLine)
572 {
573 return SD_piIsIntMasked(IntLine);
574 }
575
576 /*****************************************************************************/
577 /* @Function: SD_piClearInt */
578 /* @Purpose : */
579 /* Provided Interface to clear the Interrupt pending register of the */
580 /* SRAM module */
581 /* */
582 /* @@ */
583 /* @Parameter Name @Mode @Description */
584 /* IntLine IN Interrupt to be cleared */
585 /* SD_EXITCODE OUT Exit code */
586 /* @@ */
587 /*****************************************************************************/
588
589 SD_EXITCODE SD_piClearInt(SD_INTLINE IntLine)
590 {
591 SD_EXITCODE status = SD_SUCCESS;
592 #ifndef SIMULATOR
593 SD_opClearInt(IntLine);
594 #endif
595 return (status);
596 }
597
598 /*****************************************************************************/
599 /* @Function: SD_piIsIntPending */
600 /* @Purpose : */
601 /* Provided Interface to check if an Interrupt of the SRAM module is pending*/
602 /* */
603 /* @@ */
604 /* @Parameter Name @Mode @Description */
605 /* IntLine IN Interrupt to be checked */
606 /* BOOL OUT True if the Interrupt is pending */
607 /* @@ */
608 /*****************************************************************************/
609
610 BOOL SD_piIsIntPending(SD_INTLINE IntLine)
611 {
612 BOOL IsPending;
613
614 IsPending = SD_opIsIntPending(IntLine);
615 return (IsPending);
616 }
617
618
619 /*****************************************************************************/
620 /* @Function: SD_piPIFReset */
621 /* @Purpose : */
622 /* Provided Interface to reset the PIF I/F */
623 /* */
624 /* @@ */
625 /* @Parameter Name @Mode @Description */
626 /* status_code OUT Return code */
627 /* @@ */
628 /*****************************************************************************/
629
630 status_code SD_piPIFReset(void)
631 {
632 status_code status = SUCCESSFUL;
633 #ifndef SIMULATOR
634 SD_opPIFReset();
635 #endif
636 return (status);
637 }
638
639 /*****************************************************************************/
640 /* @Function: SD_piGetCMDCounterLeft */
641 /* @Purpose : */
642 /* Provided Interface to get the number of bytes left in CMD I/F queue */
643 /* */
644 /* @@ */
645 /* @Parameter Name @Mode @Description */
646 /* UINT32 OUT number of byte left in CMD queue */
647 /* @@ */
648 /*****************************************************************************/
649
650 UINT32 SD_piGetCMDCounterLeft(void)
651 {
652 return (SD_opGetCMDCounterLeft());
653 }

  ViewVC Help
Powered by ViewVC 1.1.23