Last change
on this file since 3537 was 3537, checked in by ansari, 17 years ago |
Ajout du module AddOn/TAcq (programmes test pour acquisition BAORadio) ds cvs sophya (sous-repertoire AddOn/) , Reza 22/10/2008
|
File size:
1.0 KB
|
Rev | Line | |
---|
[3537] | 1 | #include "pciewrap.h"
|
---|
| 2 |
|
---|
| 3 | #include <stdlib.h>
|
---|
| 4 | #include <stdio.h>
|
---|
| 5 | #include <math.h>
|
---|
| 6 |
|
---|
| 7 | #include <iostream>
|
---|
| 8 |
|
---|
| 9 | PCIEWrapper::PCIEWrapper()
|
---|
| 10 | {
|
---|
| 11 | // Faire l'initialisation PCI-Express ici
|
---|
| 12 | }
|
---|
| 13 |
|
---|
| 14 | PCIEWrapper::~PCIEWrapper()
|
---|
| 15 | {
|
---|
| 16 | // Faire le nettoyage (liberer memoire ...)
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 |
|
---|
| 20 | // Variables pour tests
|
---|
| 21 | static uint_4 NBytes = 0;
|
---|
| 22 | static uint_4 Choix = 0;
|
---|
| 23 |
|
---|
| 24 | uint_4 PCIEWrapper::NBytesToRead()
|
---|
| 25 | {
|
---|
| 26 | // Lire le registre indiquant le nombre de mots prets a etre lus
|
---|
| 27 | // cad transfere en memoire du PC
|
---|
| 28 | int choix = rand()%5;
|
---|
| 29 | if (choix < 2) {
|
---|
| 30 | Choix = choix;
|
---|
| 31 | if (choix == 0) NBytes = 4096;
|
---|
| 32 | else NBytes = 5000;
|
---|
| 33 | }
|
---|
| 34 | else {
|
---|
| 35 | NBytes = 0;
|
---|
| 36 | Choix = 0;
|
---|
| 37 | }
|
---|
| 38 | return NBytes;
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | uint_4 PCIEWrapper::Read(uint_1* buff, uint_4 nbytes)
|
---|
| 42 | {
|
---|
| 43 | if (NBytes == 0) throw PCIEWException("PCIEWrapper::Read()/Error NBytes==0");
|
---|
| 44 | if (nbytes > NBytes) nbytes = NBytes;
|
---|
| 45 | double dx = (rand()%8+1)*0.05;
|
---|
| 46 | for(int k=0; k<nbytes; k++) buff[k] = (uint_1)((1.+sin(dx*k))*100.);
|
---|
| 47 | if ((Choix == 1) && (nbytes>2000))
|
---|
| 48 | for(int k=1600; k<1900; k++) buff[k] = (uint_1)(128);
|
---|
| 49 | return nbytes;
|
---|
| 50 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.