check transfer  0.1
Check data transfer for SDAccell OpenCL application
ipc.cpp
Go to the documentation of this file.
1 
2 
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <stdint.h>
6 #include <limits.h>
7 #include <string.h>
8 #include <unistd.h>
9 #include <errno.h>
10 #include <error.h>
11 #include <time.h>
12 #include <sys/ioctl.h>
13 
14 //-----------------------------------------------------------------------------
15 
16 void IPC_delay(int ms)
17 {
18  struct timeval tv = {0, 0};
19  tv.tv_usec = 1000*ms;
20 
21  select(0,NULL,NULL,NULL,&tv);
22 }
23 
24 //-----------------------------------------------------------------------------
25 
26 int IPC_getch(void)
27 {
28  int ch;
29 
30  while(1)
31  {
32  size_t size = 0;
33  if (ioctl(STDIN_FILENO, FIONREAD, &size) == -1)
34  size = 0;
35  if(size)
36  {
37  ch = getchar();
38  //read(0, &ch, 1);
39  //DEBUG_PRINT("%s(): ch = %d\n", __FUNCTION__, ch );
40  break;
41  }
42  }
43  return ch;
44 }
45 
46 //-----------------------------------------------------------------------------
47 
48  int IPC_getche(void)
49 {
50  return IPC_getch();
51 }
52 
53 //-----------------------------------------------------------------------------
54 
55 int IPC_kbhit(void)
56 {
57  size_t size = 0;
58  if (ioctl(STDIN_FILENO, FIONREAD, &size) == -1)
59  return 0;
60 
61  //DEBUG_PRINT("%s(): size = %d\n", __FUNCTION__, size );
62 
63  return size;
64 }
65 
67 {
68  return time(NULL) * 1000;
69 }
int IPC_getche(void)
Definition: ipc.cpp:48
int IPC_kbhit(void)
Definition: ipc.cpp:55
void IPC_delay(int ms)
Definition: ipc.cpp:16
long IPC_getTickCount()
Definition: ipc.cpp:66
int IPC_getch(void)
Definition: ipc.cpp:26