source: Sophya/trunk/AddOn/TAcq/pciewrap.cc@ 3623

Last change on this file since 3623 was 3623, checked in by ansari, 16 years ago

Modifications et ameliorations diverses pour programme acquisition/traitement multifibres

Reza 22/05/2009

1- Extension/amelioration classe BRPaquet et BRPaqChecker
2- Correction BUG dans RAcqMemZoneMgr bloquant l'utilisation a une seule zone memoire
3- Classe PCIEWrapper devenue virtuelle pure et introduction de la classe TestPCIWrapperNODMA
pour les smulations.

File size: 1.2 KB
Line 
1#include "pciewrap.h"
2#include "brpaqu.h"
3
4#include "racqumem.h"
5
6#include <stdlib.h>
7#include <stdio.h>
8#include <math.h>
9#include <iostream>
10
11TestPCIWrapperNODMA::TestPCIWrapperNODMA(UInt32 sz)
12 : PCIEWrapper() , size_(sz)
13{
14 data_ = new Byte[size_];
15 frame_counter_ = 0;
16 timetag_ = 0;
17 tottransfer_ = 0;
18}
19
20TestPCIWrapperNODMA::~TestPCIWrapperNODMA()
21{
22 delete[] data_;
23}
24
25UInt32 TestPCIWrapperNODMA::TransferSize()
26{
27 return size_;
28}
29
30UInt64 TestPCIWrapperNODMA::TotTransferBytes()
31{
32 return tottransfer_;
33}
34
35Byte* TestPCIWrapperNODMA::DoTransferData(int numbuff)
36{
37 frame_counter_ ++;
38 timetag_ = frame_counter_ * size_ / 2;
39 BRPaquet paq(data_, size_);
40 paq.SetHDRMarker64(pchk_.HDRTag());
41 paq.SetTRLMarker64(pchk_.TRLTag());
42 paq.SetFrameCounter(frame_counter_);
43 paq.SetTimeTag(timetag_);
44 paq.SetPaqLen((UInt16)((size_ - BRHDRSIZE - BRTRLSIZE)/4));
45 Byte* bp = paq.Data1();
46 for(UInt32 kk=0; kk<paq.DataSize(); kk++)
47 bp[kk] = (Byte)(sin(0.0345*kk)*78.+127.5);
48 tottransfer_ += size_;
49 return data_;
50}
51
52void TestPCIWrapperNODMA::PrintStatus(ostream& os)
53{
54 os << "TestPCIWrapperNODMA::Status, FrameCounter=" << frame_counter_
55 << " TimeTag=" << timetag_ << endl;
56}
Note: See TracBrowser for help on using the repository browser.