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_ECOS_UA_ARCHITECTURE_H_
  8. #define PLUGINS_ARCH_ECOS_UA_ARCHITECTURE_H_
  9. #include <pkgconf/system.h>
  10. #include <cyg/kernel/kapi.h>
  11. #include <cyg/io/io.h>
  12. #include <network.h>
  13. #include <stdio.h>
  14. #include <string.h>
  15. #include <netinet/tcp.h>
  16. #include <stdlib.h>
  17. #define UA_sleep_ms(X) cyg_thread_delay(1 + ((1000 * X * CYGNUM_HAL_RTC_DENOMINATOR) / (CYGNUM_HAL_RTC_NUMERATOR / 1000)));
  18. #define OPTVAL_TYPE int
  19. #define UA_fd_set(fd, fds) FD_SET((unsigned int)fd, fds)
  20. #define UA_fd_isset(fd, fds) FD_ISSET((unsigned int)fd, fds)
  21. #define UA_access(x,y) 0
  22. #define UA_IPV6 1
  23. #define UA_SOCKET int
  24. #define UA_INVALID_SOCKET -1
  25. #define UA_ERRNO errno
  26. #define UA_INTERRUPTED EINTR
  27. #define UA_AGAIN EAGAIN
  28. #define UA_EAGAIN EAGAIN
  29. #define UA_WOULDBLOCK EWOULDBLOCK
  30. #define UA_ERR_CONNECTION_PROGRESS EINPROGRESS
  31. #define UA_getnameinfo getnameinfo
  32. #define UA_send send
  33. #define UA_recv recv
  34. #define UA_sendto sendto
  35. #define UA_recvfrom recvfrom
  36. #define UA_htonl htonl
  37. #define UA_ntohl ntohl
  38. #define UA_close close
  39. #define UA_select select
  40. #define UA_shutdown shutdown
  41. #define UA_socket socket
  42. #define UA_bind bind
  43. #define UA_listen listen
  44. #define UA_accept accept
  45. #define UA_connect connect
  46. #define UA_getaddrinfo getaddrinfo
  47. #define UA_getsockopt getsockopt
  48. #define UA_setsockopt setsockopt
  49. #define UA_freeaddrinfo freeaddrinfo
  50. #define UA_gethostname gethostname_ecos
  51. #define UA_inet_pton(af,src,dst) inet_pton(af, src, (char*) dst)
  52. #if UA_IPV6
  53. # define UA_if_nametoindex if_nametoindex
  54. #endif
  55. int gethostname_ecos(char* name, size_t len);
  56. #define UA_free free
  57. #define UA_malloc malloc
  58. #define UA_calloc calloc
  59. #define UA_realloc realloc
  60. #define UA_snprintf snprintf
  61. #define UA_LOG_SOCKET_ERRNO_WRAP(LOG) { \
  62. char *errno_str = strerror(errno); \
  63. LOG; \
  64. }
  65. #define UA_LOG_SOCKET_ERRNO_GAI_WRAP(LOG) { \
  66. const char *errno_str = gai_strerror(errno); \
  67. LOG; \
  68. }
  69. #include "../ua_architecture_functions.h"
  70. #undef SLIST_EMPTY
  71. #undef SLIST_FOREACH
  72. #undef SLIST_INIT
  73. #undef SLIST_REMOVE
  74. #undef LIST_EMPTY
  75. #undef LIST_FOREACH
  76. #undef LIST_INIT
  77. #undef LIST_REMOVE
  78. #undef TAILQ_EMPTY
  79. #undef TAILQ_FOREACH
  80. #undef TAILQ_INIT
  81. #undef TAILQ_REMOVE
  82. #undef TAILQ_FOREACH_REVERSE
  83. #undef CIRCLEQ_EMPTY
  84. #undef CIRCLEQ_FOREACH
  85. #undef CIRCLEQ_INIT
  86. #undef CIRCLEQ_FOREACH_REVERSE
  87. #undef CIRCLEQ_REMOVE
  88. #undef CIRCLEQ_INSERT_TAIL
  89. #undef CIRCLEQ_INSERT_HEAD
  90. #undef CIRCLEQ_INSERT_AFTER
  91. #undef CIRCLEQ_INSERT_BEFORE
  92. #undef _SYS_QUEUE_H_
  93. #endif /* PLUGINS_ARCH_ECOS_UA_ARCHITECTURE_H_ */