#include "pciewrap.h" #include #include #include #include PCIEWrapper::PCIEWrapper() { // Faire l'initialisation PCI-Express ici } PCIEWrapper::~PCIEWrapper() { // Faire le nettoyage (liberer memoire ...) } // Variables pour tests static uint_4 NBytes = 0; static uint_4 Choix = 0; uint_4 PCIEWrapper::NBytesToRead() { // Lire le registre indiquant le nombre de mots prets a etre lus // cad transfere en memoire du PC int choix = rand()%5; if (choix < 2) { Choix = choix; if (choix == 0) NBytes = 4096; else NBytes = 5000; } else { NBytes = 0; Choix = 0; } return NBytes; } uint_4 PCIEWrapper::Read(uint_1* buff, uint_4 nbytes) { if (NBytes == 0) throw PCIEWException("PCIEWrapper::Read()/Error NBytes==0"); if (nbytes > NBytes) nbytes = NBytes; double dx = (rand()%8+1)*0.05; for(int k=0; k2000)) for(int k=1600; k<1900; k++) buff[k] = (uint_1)(128); return nbytes; }