2015-03-12 04:45:16 +08:00
|
|
|
|
/*
|
|
|
|
|
* Simple Open EtherCAT Master Library
|
2014-11-25 23:10:29 +08:00
|
|
|
|
*
|
2015-03-12 04:45:16 +08:00
|
|
|
|
* File : osal_win32.h
|
|
|
|
|
* Version : 1.3.1
|
|
|
|
|
* Date : 11-03-2015
|
|
|
|
|
* Copyright (C) 2005-2015 Speciaal Machinefabriek Ketels v.o.f.
|
|
|
|
|
* Copyright (C) 2005-2015 Arthur Ketels
|
|
|
|
|
* Copyright (C) 2008-2009 TU/e Technische Universiteit Eindhoven
|
|
|
|
|
* Copyright (C) 2012-2015 rt-labs AB , Sweden
|
|
|
|
|
*
|
|
|
|
|
* SOEM is free software; you can redistribute it and/or modify it under
|
|
|
|
|
* the terms of the GNU General Public License version 2 as published by the Free
|
|
|
|
|
* Software Foundation.
|
|
|
|
|
*
|
|
|
|
|
* SOEM is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
|
* for more details.
|
|
|
|
|
*
|
|
|
|
|
* As a special exception, if other files instantiate templates or use macros
|
|
|
|
|
* or inline functions from this file, or you compile this file and link it
|
|
|
|
|
* with other works to produce a work based on this file, this file does not
|
|
|
|
|
* by itself cause the resulting work to be covered by the GNU General Public
|
|
|
|
|
* License. However the source code for this file must still be made available
|
|
|
|
|
* in accordance with section (3) of the GNU General Public License.
|
|
|
|
|
*
|
|
|
|
|
* This exception does not invalidate any other reasons why a work based on
|
|
|
|
|
* this file might be covered by the GNU General Public License.
|
|
|
|
|
*
|
|
|
|
|
* The EtherCAT Technology, the trade name and logo <EFBFBD>EtherCAT<EFBFBD> are the intellectual
|
|
|
|
|
* property of, and protected by Beckhoff Automation GmbH. You can use SOEM for
|
|
|
|
|
* the sole purpose of creating, using and/or selling or otherwise distributing
|
|
|
|
|
* an EtherCAT network master provided that an EtherCAT Master License is obtained
|
|
|
|
|
* from Beckhoff Automation GmbH.
|
|
|
|
|
*
|
|
|
|
|
* In case you did not receive a copy of the EtherCAT Master License along with
|
|
|
|
|
* SOEM write to Beckhoff Automation GmbH, Eiserstra<EFBFBD>e 5, D-33415 Verl, Germany
|
|
|
|
|
* (www.beckhoff.com).
|
2014-11-25 23:10:29 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _osal_win32_
|
|
|
|
|
#define _osal_win32_
|
|
|
|
|
|
|
|
|
|
/* Convenience macros for operations on timevals.
|
|
|
|
|
NOTE: `timercmp' does not work for >= or <=. */
|
|
|
|
|
# define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
|
|
|
|
|
# define timeradd(a, b, result) \
|
|
|
|
|
do { \
|
|
|
|
|
(result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
|
|
|
|
|
(result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
|
|
|
|
|
if ((result)->tv_usec >= 1000000) \
|
|
|
|
|
{ \
|
|
|
|
|
++(result)->tv_sec; \
|
|
|
|
|
(result)->tv_usec -= 1000000; \
|
|
|
|
|
} \
|
|
|
|
|
} while (0)
|
|
|
|
|
# define timersub(a, b, result) \
|
|
|
|
|
do { \
|
|
|
|
|
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
|
|
|
|
|
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
|
|
|
|
|
if ((result)->tv_usec < 0) { \
|
|
|
|
|
--(result)->tv_sec; \
|
|
|
|
|
(result)->tv_usec += 1000000; \
|
|
|
|
|
} \
|
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
int osal_gettimeofday (struct timeval *tv, struct timezone *tz);
|
|
|
|
|
|
|
|
|
|
#endif
|