ua_architecture.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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_inet_pton(af,src,dst) inet_pton(af, src, (char*) dst)
  53. #if UA_IPV6
  54. # define UA_if_nametoindex if_nametoindex
  55. #endif
  56. int gethostname_ecos(char* name, size_t len);
  57. #define UA_free free
  58. #define UA_malloc malloc
  59. #define UA_calloc calloc
  60. #define UA_realloc realloc
  61. #define UA_snprintf snprintf
  62. #define UA_LOG_SOCKET_ERRNO_WRAP(LOG) { \
  63. char *errno_str = strerror(errno); \
  64. LOG; \
  65. }
  66. #define UA_LOG_SOCKET_ERRNO_GAI_WRAP(LOG) { \
  67. const char *errno_str = gai_strerror(errno); \
  68. LOG; \
  69. }
  70. #include <open62541/architecture_functions.h>
  71. #endif /* PLUGINS_ARCH_ECOS_UA_ARCHITECTURE_H_ */
  72. #endif /* UA_ARCHITECTURE_ECOS */