iCub-main
Loading...
Searching...
No Matches
debugFunctions.h
Go to the documentation of this file.
1// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3/* Copyright (C) <year> iCub Facility, Istituto Italiano di Tecnologia
4 * Author: Alberto Cardellino
5 * email: alberto.cardellino@iit.it
6 * Permission is granted to copy, distribute, and/or modify this program
7 * under the terms of the GNU General Public License, version 2 or any
8 * later version published by the Free Software Foundation.
9 *
10 * A copy of the license can be found at
11 * http://www.robotcub.org/icub/license/gpl.txt
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16 * Public License for more details
17 */
18
19#ifndef __debugfunctions__
20#define __debugfunctions__
21
22#error it seems that file debugFunctions.h is not used anymore
23
24#if 0
25// marco.accame: it seems that we dont need it
26
27// usual includes
28#include "stdint.h"
29#include "stdlib.h"
30#include "stdio.h"
31#include <string>
32#include <signal.h>
33#include <iostream>
34
35// ACE stuff
36#include <ace/ACE.h>
37#include "ace/SOCK_Dgram.h"
38#include "ace/Addr.h"
39#include "ace/Thread.h"
40
41
42#define _LINUX_UDP_SOCKET_
43//#undef _LINUX_UDP_SOCKET_
44
45
46#define _DEEP_DEBUG_
47
48#if 0
49// marco.accame: i remove these as they depend on the number of boards that we have on the specific robot
50
51#define eb1_ip "10.0.1.1"
52#define eb2_ip "10.0.1.2"
53#define eb3_ip "10.0.1.3"
54#define eb4_ip "10.0.1.4"
55#define eb5_ip "10.0.1.5"
56#define eb6_ip "10.0.1.6"
57#define eb7_ip "10.0.1.7"
58#define eb8_ip "10.0.1.8"
59#define eb9_ip "10.0.1.9"
60#define eb10_ip "10.0.1.10"
61#define eb11_ip "10.0.1.11"
62
63#define eb1_addr inet_addr(eb1_ip)
64#define eb2_addr inet_addr(eb2_ip)
65#define eb3_addr inet_addr(eb3_ip)
66#define eb4_addr inet_addr(eb4_ip)
67#define eb5_addr inet_addr(eb5_ip)
68#define eb6_addr inet_addr(eb6_ip)
69#define eb7_addr inet_addr(eb7_ip)
70#define eb8_addr inet_addr(eb8_ip)
71#define eb9_addr inet_addr(eb9_ip)
72#define eb10_addr inet_addr(eb10_ip)
73#define eb11_addr inet_addr(eb11_ip)
74
75
76
77#define BOARD_NUM 10
78#define SOGLIA 1700
79#define MAX_ACQUISITION 100*1000
80
81#endif
82
83bool check_received_pkt(ACE_INET_Addr *sender_addr, void * pkt, ACE_UINT16 pkt_size);
84bool check_received_pkt(sockaddr *sender_addr, void * pkt, ACE_UINT16 pkt_size);
85bool do_real_check(int board, void * pkt, ACE_UINT16 pkt_size);
86
87void print_data(void);
88
89int gettimeofday(struct timeval *tv, struct timezone *tz);
90
91#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
92#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
93
94struct timezone
95{
96 int tz_minuteswest; /* minutes W of Greenwich */
97 int tz_dsttime; /* type of dst correction */
98};
99
100#else
101#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
102#endif
103
104static int timeval_subtract(struct timeval *_result, struct timeval *_x, struct timeval *_y)
105{
106 /* Perform the carry for the later subtraction by updating y. */
107
108 if(_x->tv_usec < _y->tv_usec)
109 {
110 int nsec = (_y->tv_usec - _x->tv_usec) / 1000000 + 1;
111
112 _y->tv_usec -= 1000000 * nsec;
113 _y->tv_sec += nsec;
114 }
115
116 if(_x->tv_usec - _y->tv_usec > 1000000)
117 {
118 int nsec = (_x->tv_usec - _y->tv_usec) / 1000000;
119
120 _y->tv_usec += 1000000 * nsec;
121 _y->tv_sec -= nsec;
122 }
123
124 /* Compute the time remaining to wait. tv_usec is certainly positive. */
125
126 _result->tv_sec = _x->tv_sec - _y->tv_sec;
127 _result->tv_usec = _x->tv_usec - _y->tv_usec;
128
129 /* Return 1 if result is negative. */
130
131 return _x->tv_sec < _y->tv_sec;
132}
133
134
135#endif
136#endif // __debugfunctions__
void print_data(void)
bool do_real_check(int board, void *pkt, ACE_UINT16 pkt_size)
uint8_t board
bool check_received_pkt(ACE_INET_Addr *sender_addr, void *pkt, ACE_UINT16 pkt_size)