ua_architecture.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  2. * See http://creativecommons.org/publicdomain/zero/1.0/ for more information.
  3. *
  4. * Copyright 2016-2017 (c) Julius Pfrommer, Fraunhofer IOSB
  5. * Copyright 2017 (c) Stefan Profanter, fortiss GmbH
  6. */
  7. #ifndef PLUGINS_ARCH_POSIX_UA_ARCHITECTURE_H_
  8. #define PLUGINS_ARCH_POSIX_UA_ARCHITECTURE_H_
  9. #define UA_THREAD_LOCAL
  10. #define UA_ECOS_HOSTNAME "172.20.12.151"
  11. #include <pkgconf/system.h>
  12. #include <cyg/kernel/kapi.h>
  13. #include <cyg/io/io.h>
  14. #include <network.h>
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <netinet/tcp.h>
  18. #include <stdlib.h>
  19. #define UA_sleep_ms(X) cyg_thread_delay(1 + ((1000 * X * CYGNUM_HAL_RTC_DENOMINATOR) / (CYGNUM_HAL_RTC_NUMERATOR / 1000)));
  20. #define OPTVAL_TYPE int
  21. #define UA_fd_set(fd, fds) FD_SET((unsigned int)fd, fds)
  22. #define UA_fd_isset(fd, fds) FD_ISSET((unsigned int)fd, fds)
  23. #define UA_access(x,y) 0
  24. #define UA_IPV6 1
  25. #define UA_SOCKET int
  26. #define UA_INVALID_SOCKET -1
  27. #define UA_ERRNO errno
  28. #define UA_INTERRUPTED EINTR
  29. #define UA_AGAIN EAGAIN
  30. #define UA_EAGAIN EAGAIN
  31. #define UA_WOULDBLOCK EWOULDBLOCK
  32. #define UA_ERR_CONNECTION_PROGRESS EINPROGRESS
  33. #define UA_getnameinfo getnameinfo
  34. #define UA_send send
  35. #define UA_recv recv
  36. #define UA_close close
  37. #define UA_select select
  38. #define UA_shutdown shutdown
  39. #define UA_socket socket
  40. #define UA_bind bind
  41. #define UA_listen listen
  42. #define UA_accept accept
  43. #define UA_connect connect
  44. #define UA_getaddrinfo getaddrinfo
  45. #define UA_getsockopt getsockopt
  46. #define UA_setsockopt setsockopt
  47. #define UA_freeaddrinfo freeaddrinfo
  48. #define UA_gethostname gethostname_ecos
  49. int gethostname_ecos(char* name, size_t len);
  50. #define UA_free free
  51. #define UA_malloc malloc
  52. #define UA_calloc calloc
  53. #define UA_realloc realloc
  54. #define UA_snprintf snprintf
  55. #define UA_LOG_SOCKET_ERRNO_WRAP(LOG) { \
  56. char *errno_str = strerror(errno); \
  57. LOG; \
  58. }
  59. #define UA_LOG_SOCKET_ERRNO_GAI_WRAP(LOG) { \
  60. const char *errno_str = gai_strerror(errno); \
  61. LOG; \
  62. }
  63. #include "../ua_architecture_functions.h"
  64. #undef SLIST_EMPTY
  65. #undef SLIST_FOREACH
  66. #undef SLIST_INIT
  67. #undef SLIST_REMOVE
  68. #undef LIST_EMPTY
  69. #undef LIST_FOREACH
  70. #undef LIST_INIT
  71. #undef LIST_REMOVE
  72. #undef TAILQ_EMPTY
  73. #undef TAILQ_FOREACH
  74. #undef TAILQ_INIT
  75. #undef TAILQ_REMOVE
  76. #undef TAILQ_FOREACH_REVERSE
  77. #undef CIRCLEQ_EMPTY
  78. #undef CIRCLEQ_FOREACH
  79. #undef CIRCLEQ_INIT
  80. #undef CIRCLEQ_FOREACH_REVERSE
  81. #undef CIRCLEQ_REMOVE
  82. #undef CIRCLEQ_INSERT_TAIL
  83. #undef CIRCLEQ_INSERT_HEAD
  84. #undef CIRCLEQ_INSERT_AFTER
  85. #undef CIRCLEQ_INSERT_BEFORE
  86. #undef _SYS_QUEUE_H_
  87. //#include "../deps/queue.h" //in some compilers there's already a _SYS_QUEUE_H_ who is included first and doesn't have all functions
  88. #endif /* PLUGINS_ARCH_POSIX_UA_ARCHITECTURE_H_ */