ua_architecture.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #ifdef UA_ARCHITECTURE_ECOS
  8. #ifndef PLUGINS_ARCH_ECOS_UA_ARCHITECTURE_H_
  9. #define PLUGINS_ARCH_ECOS_UA_ARCHITECTURE_H_
  10. #include <pkgconf/system.h>
  11. #include <cyg/kernel/kapi.h>
  12. #include <cyg/io/io.h>
  13. #include <network.h>
  14. #include <stdio.h>
  15. #include <string.h>
  16. #include <netinet/tcp.h>
  17. #include <stdlib.h>
  18. #define UA_sleep_ms(X) cyg_thread_delay(1 + ((1000 * X * CYGNUM_HAL_RTC_DENOMINATOR) / (CYGNUM_HAL_RTC_NUMERATOR / 1000)));
  19. #define OPTVAL_TYPE int
  20. #define UA_fd_set(fd, fds) FD_SET((unsigned int)fd, fds)
  21. #define UA_fd_isset(fd, fds) FD_ISSET((unsigned int)fd, fds)
  22. #define UA_access(x,y) 0
  23. #define UA_IPV6 1
  24. #define UA_SOCKET int
  25. #define UA_INVALID_SOCKET -1
  26. #define UA_ERRNO errno
  27. #define UA_INTERRUPTED EINTR
  28. #define UA_AGAIN EAGAIN
  29. #define UA_EAGAIN EAGAIN
  30. #define UA_WOULDBLOCK EWOULDBLOCK
  31. #define UA_ERR_CONNECTION_PROGRESS EINPROGRESS
  32. #define UA_getnameinfo getnameinfo
  33. #define UA_send send
  34. #define UA_recv recv
  35. #define UA_sendto sendto
  36. #define UA_recvfrom recvfrom
  37. #define UA_htonl htonl
  38. #define UA_ntohl ntohl
  39. #define UA_close close
  40. #define UA_select select
  41. #define UA_shutdown shutdown
  42. #define UA_socket socket
  43. #define UA_bind bind
  44. #define UA_listen listen
  45. #define UA_accept accept
  46. #define UA_connect connect
  47. #define UA_getaddrinfo getaddrinfo
  48. #define UA_getsockopt getsockopt
  49. #define UA_setsockopt setsockopt
  50. #define UA_freeaddrinfo freeaddrinfo
  51. #define UA_gethostname gethostname_ecos
  52. #define UA_getsockname getsockname
  53. #define UA_inet_pton(af,src,dst) inet_pton(af, src, (char*) dst)
  54. #if UA_IPV6
  55. # define UA_if_nametoindex if_nametoindex
  56. #endif
  57. int gethostname_ecos(char* name, size_t len);
  58. #define UA_free free
  59. #define UA_malloc malloc
  60. #define UA_calloc calloc
  61. #define UA_realloc realloc
  62. #define UA_snprintf snprintf
  63. #define UA_LOG_SOCKET_ERRNO_WRAP(LOG) { \
  64. char *errno_str = strerror(errno); \
  65. LOG; \
  66. }
  67. #define UA_LOG_SOCKET_ERRNO_GAI_WRAP(LOG) { \
  68. const char *errno_str = gai_strerror(errno); \
  69. LOG; \
  70. }
  71. #include <open62541/architecture_functions.h>
  72. #endif /* PLUGINS_ARCH_ECOS_UA_ARCHITECTURE_H_ */
  73. #endif /* UA_ARCHITECTURE_ECOS */