16 #include <sys/neutrino.h> 17 #include <sys/iofunc.h> 18 #include <sys/dispatch.h> 22 #define Jr3DmAddrMask 0x6000 23 #define PAGE_SIZE 0x1000 27 #define SENSOR1 0x80000 28 #define SENSOR2 0x100000 29 #define SENSOR3 0x180000 38 main (
int argc,
char **argv)
47 struct timeval c0, c1, l0, l1;
55 while ((c = getopt (argc, argv,
"n:")) != -1)
59 num = strtol (
optarg, 0, 0);
64 fd = open (
"/dev/jr3q", O_RDWR);
67 fprintf (
stderr,
"Unable to open server connection: %s\n",
73 memset (&msg, 0,
sizeof (msg));
74 memset (&msg_reply, 0,
sizeof (msg_reply));
77 msg.
msg_no = _IO_MAX + num;
78 snprintf (msg.
msg_data, 254,
"client %d requesting reply.",
getpid ());
80 printf (
"client: msg_no: _IO_MAX + %d\n", num);
87 msg.
msg_no = _IO_MAX + num;
89 ret = MsgSend (fd, &msg,
sizeof (msg), msg_reply, 255);
93 fprintf (
stderr,
"Unable to MsgSend() to server: %s\n",
100 memcpy (tmp, msg_reply,
sizeof (
float) * 12);
101 printf (
"client: msg_reply: %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f\n",
102 tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], tmp[5]);
103 #define DELTA_SEC(start, end) (end.tv_sec - start.tv_sec + (end.tv_usec - start.tv_usec)/1e6) 104 printf (
" %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f ... %7.3f msec\n",
105 tmp[6], tmp[7], tmp[8], tmp[9], tmp[10], tmp[11],
110 printf (
"client: msg_reply:\n%s\n", msg_reply);
124 printf (
"Loop took %7.3f msec\n",
DELTA_SEC(l0, l1)*1000);
unsigned long MappedAddress
#define DELTA_SEC(start, end)
int gettimeofday(struct timeval *tv, struct timezone *tz)
int main(int argc, char **argv)
int usleep(useconds_t usec)