AFHBA404
AFHBA404 connects ACQ2106 to PCI-Express
amx_dummy.cpp
Go to the documentation of this file.
1 /*
2  * amx_dummy.cpp
3  *
4  * Created on: 28 Aug 2020
5  * Author: pgm
6  */
7 
8 
9 
10 
11 #include <stdio.h>
12 
13 #include <errno.h>
14 #include <stdlib.h>
15 #include <sys/ioctl.h>
16 #include <sys/mman.h>
17 #include <sys/types.h>
18 #include <sys/stat.h>
19 #include <sys/time.h>
20 
21 
22 
23 #include <sched.h>
24 
25 //using namespace std;
26 
27 #include "RTM_T_Device.h"
28 #include "local.h"
29 #include "popt.h"
30 
31 #include "rtm-t_ioctl.h"
32 /* default implementation is NULL */
33 
34 
35 
36 int main(int argc, char* argv[])
37 {
38  int devnum = 0;
39  int verbose = 0;
40  int sleepms = 20;
41 
42  if (getenv("RTM_DEVNUM")){
43  devnum = atol(getenv("RTM_DEVNUM"));
44  }
45  if (getenv("VERBOSE")){
46  verbose = atol(getenv("VERBOSE"));
47  }
48  if (getenv("SLEEPMS")){
49  sleepms = atol(getenv("SLEEPMS"));
50  }
51 
52  RTM_T_Device* dev = new RTM_T_Device(devnum);
53 
54  int fp = dev->getDeviceHandle();
55 
56  struct AO_BURST ao_burst;
57  ao_burst.id = AO_BURST_ID;
58  ao_burst.nbuf = 1;
59 
60  int rc = ioctl(fp, AFHBA_AO_BURST_INIT, &ao_burst);
61  if (rc != 0){
62  perror("AFHBA_AO_BURST_INIT");
63  return 1;
64  }
65 
66  while(1){
67  rc = ioctl(fp, AFHBA_AO_BURST_SETBUF, 0);
68  if (rc != 0){
69  perror("AFHBA_AO_BURST_SETBUF");
70  return 1;
71  }
72  if (verbose > 1){
73  fprintf(stderr, "hit me\n");
74  getchar();
75  }else{
76  usleep(sleepms*1000);
77  }
78  }
79 
80  return 0;
81 }
main
int main(int argc, char *argv[])
Definition: amx_dummy.cpp:36
local.h
AFHBA_AO_BURST_SETBUF
#define AFHBA_AO_BURST_SETBUF
Definition: rtm-t_ioctl.h:112
AO_BURST::nbuf
unsigned nbuf
Definition: rtm-t_ioctl.h:69
AO_BURST::id
unsigned id
Definition: rtm-t_ioctl.h:68
RTM_T_Device::getDeviceHandle
const int getDeviceHandle(void)
Definition: RTM_T_Device.h:56
rtm-t_ioctl.h
AO_BURST
Definition: rtm-t_ioctl.h:67
verbose
int verbose
Definition: InlineDataHandlerMuxAO_LLC.cpp:59
AO_BURST_ID
#define AO_BURST_ID
Definition: rtm-t_ioctl.h:65
RTM_T_Device.h
AFHBA_AO_BURST_INIT
#define AFHBA_AO_BURST_INIT
ioctl AFHBA_START_AO_ABN LLC, multiple buffers, OUTPUT
Definition: rtm-t_ioctl.h:110
RTM_T_Device
Definition: RTM_T_Device.h:17
getenv
int getenv(const char *key, int def, int(*cvt)(const char *key))
Definition: acqproc.cpp:23