open62541 1.3.12
Open source implementation of OPC UA
Loading...
Searching...
No Matches
ua_architecture.h
Go to the documentation of this file.
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
9#ifndef PLUGINS_ARCH_ECOS_UA_ARCHITECTURE_H_
10#define PLUGINS_ARCH_ECOS_UA_ARCHITECTURE_H_
11
12#include <pkgconf/system.h>
13#include <cyg/kernel/kapi.h>
14#include <cyg/io/io.h>
15
16#include <network.h>
17
18#include <stdio.h>
19#include <string.h>
20#include <netinet/tcp.h>
21#include <stdlib.h>
22
23#define UA_sleep_ms(X) cyg_thread_delay(1 + ((1000 * X * CYGNUM_HAL_RTC_DENOMINATOR) / (CYGNUM_HAL_RTC_NUMERATOR / 1000)));
24
25#define OPTVAL_TYPE int
26
27#define UA_fd_set(fd, fds) FD_SET((unsigned int)fd, fds)
28#define UA_fd_isset(fd, fds) FD_ISSET((unsigned int)fd, fds)
29
30#define UA_access(x,y) 0
31
32#define UA_IPV6 1
33#define UA_SOCKET int
34#define UA_INVALID_SOCKET -1
35#define UA_ERRNO errno
36#define UA_INTERRUPTED EINTR
37#define UA_AGAIN EAGAIN
38#define UA_EAGAIN EAGAIN
39#define UA_WOULDBLOCK EWOULDBLOCK
40#define UA_ERR_CONNECTION_PROGRESS EINPROGRESS
41
42#define UA_getnameinfo getnameinfo
43#define UA_send send
44#define UA_recv recv
45#define UA_sendto sendto
46#define UA_recvfrom recvfrom
47#define UA_recvmsg recvmsg
48#define UA_htonl htonl
49#define UA_ntohl ntohl
50#define UA_close close
51#define UA_select select
52#define UA_shutdown shutdown
53#define UA_socket socket
54#define UA_bind bind
55#define UA_listen listen
56#define UA_accept accept
57#define UA_connect connect
58#define UA_getaddrinfo getaddrinfo
59#define UA_getsockopt getsockopt
60#define UA_setsockopt setsockopt
61#define UA_ioctl ioctl
62#define UA_freeaddrinfo freeaddrinfo
63#define UA_gethostname gethostname_ecos
64#define UA_getsockname getsockname
65#define UA_inet_pton(af,src,dst) inet_pton(af, src, (char*) dst)
66#if UA_IPV6
67# define UA_if_nametoindex if_nametoindex
68#endif
69
70int gethostname_ecos(char* name, size_t len);
71
72#define UA_free free
73#define UA_malloc malloc
74#define UA_calloc calloc
75#define UA_realloc realloc
76
77#define UA_snprintf snprintf
78#define UA_strncasecmp strncasecmp
79
80#define UA_LOG_SOCKET_ERRNO_WRAP(LOG) { \
81 char *errno_str = strerror(errno); \
82 LOG; \
83}
84#define UA_LOG_SOCKET_ERRNO_GAI_WRAP(LOG) { \
85 const char *errno_str = gai_strerror(errno); \
86 LOG; \
87}
88
89#if UA_MULTITHREADING >= 100
90#error Multithreading unsupported
91#else
92#define UA_LOCK_INIT(lock)
93#define UA_LOCK_DESTROY(lock)
94#define UA_LOCK(lock)
95#define UA_UNLOCK(lock)
96#define UA_LOCK_ASSERT(lock, num)
97#endif
98
100
101#endif /* PLUGINS_ARCH_ECOS_UA_ARCHITECTURE_H_ */
102
103#endif /* UA_ARCHITECTURE_ECOS */