OsWrapper.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*******************************************************************************
  2. * Copyright (c) 2016, 2017 logi.cals GmbH
  3. *
  4. * All rights reserved. This program and the accompanying materials
  5. * are made available under the terms of the Eclipse Public License v1.0
  6. * and Eclipse Distribution License v1.0 which accompany this distribution.
  7. *
  8. * The Eclipse Public License is available at
  9. * http://www.eclipse.org/legal/epl-v10.html
  10. * and the Eclipse Distribution License is available at
  11. * http://www.eclipse.org/org/documents/edl-v10.php.
  12. *
  13. * Contributors:
  14. * Gunter Raidl - timer support for VxWorks
  15. * Rainer Poisel - reusability
  16. *******************************************************************************/
  17. #if !defined(OSWRAPPER_H)
  18. #define OSWRAPPER_H
  19. #if defined(_WRS_KERNEL)
  20. #include <time.h>
  21. #define lstat stat
  22. typedef unsigned long useconds_t;
  23. void usleep(useconds_t useconds);
  24. #define timersub(a, b, result) \
  25. do \
  26. { \
  27. (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
  28. (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
  29. if ((result)->tv_usec < 0) \
  30. { \
  31. --(result)->tv_sec; \
  32. (result)->tv_usec += 1000000L; \
  33. } \
  34. } while (0)
  35. #endif /* defined(_WRS_KERNEL) */
  36. #endif /* OSWRAPPER_H */