RTI Connext DDS Micro  Version 2.4.11
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
osapi_os_threadx.h
Go to the documentation of this file.
1 /*
2  * FILE: osapi_config_threadx.h - OS configuration file for ThreadX
3  *
4  * (c) Copyright, Real-Time Innovations, 2012-2016
5  *
6  * All rights reserved.
7  *
8  * No duplications, whole or partial, manual or electronic, may be made
9  * without express written permission. Any such copies, or
10  * revisions thereof, must display this notice unaltered.
11  * This code contains trade secrets of Real-Time Innovations, Inc.
12  *
13  * Modification History
14  * --------------------
15  * 13dec2016,francisco File created
16  *
17  */
18 /*ce \file
19  * \brief OS API Configuration
20  */
21 #ifndef osapi_os_threadx_h
22 #define osapi_os_threadx_h
23 
24 /* This is needed to compile the ThreadX source files */
25 #define OSAPI_INCLUDE_THREADX 1
26 
27 #define OSAPI_DONT_HAVE_REALLOC 1
28 
29 /* Linker section definitions:
30  * -Any data in bss_sdram will be initially zeroed.
31  * -Any data in data_sdram will be initialized if an initializer is provided.
32  */
33 #if defined(RX63N)
34 #define LINK_SECTION_DATA_SDRAM LINK_SECTION(data_sdram)
35 #define LINK_SECTION_BSS_SDRAM LINK_SECTION(bss_sdram)
36 #elif defined(MPC5125)
37 #define LINK_SECTION_DATA_SDRAM
38 #define LINK_SECTION_BSS_SDRAM
39 #elif defined(SYNERGY_S7G2)
40 #define LINK_SECTION_DATA_SDRAM
41 #define LINK_SECTION_BSS_SDRAM
42 #else
43 #error "Platform not defined"
44 #endif
45 
46 /* Standard ThreadX headers */
47 #if !defined(SYNERGY_S7G2)
48 #include "types.h"
49 #endif
50 #include "tx_api.h"
51 #include "nx_api.h"
52 
53 #include <errno.h>
54 
55 /* Needed definitions */
56 #define OSAPI_PLATFORM_THREADX_HOSTNAME "ThreadX-host"
57 
58 #define OSAPI_PLATFORM_THREADX_STACK_SIZE_DEFAULT (4 * 1024)
59 
60 #ifndef OSAPI_PLATFORM_THREADX_MAX_THREADS
61 #ifdef RTI_USE_NONBLOCKING_SOCKET
62 #define OSAPI_PLATFORM_THREADX_MAX_THREADS 2
63 #else
64 #define OSAPI_PLATFORM_THREADX_MAX_THREADS 4
65 #endif /* RTI_USE_NONBLOCKING_SOCKET */
66 #endif /* !OSAPI_PLATFORM_THREADX_MAX_THREADS */
67 
68 #define OSAPI_PLATFORM_THREADX_HEAP_SIZE (1 * 1024 * 1024)
69 
70 /* There are 100 timer ticks in a second, so 10ms in a tick */
71 #define OSAPI_MS_TIMER_TICK 10
72 
73 /* Socket definitions */
74 #if defined(SYNERGY_S7G2)
75 typedef uint32_t socklen_t;
76 #elif defined(RX63N) || defined(MPC5125)
77 typedef uint32 socklen_t;
78 #else
79 #error "Platform does not define integer"
80 #endif
81 
82 struct in_addr
83 {
84  unsigned long s_addr;
85 };
86 
87 struct sockaddr_in
88 {
89  short sin_family;
90  unsigned short sin_port;
91  struct in_addr sin_addr;
92  char sin_zero[8];
93 };
94 
95 struct sockaddr
96 {
97  unsigned short sa_family; // address family, AF_xxx
98  char sa_data[14]; // 14 bytes of protocol address
99 };
100 
101 #define SOCK_DGRAM 0
102 #define AF_INET 0
103 #define INADDR_ANY 0
104 
105 #define IPPROTO_IP 0
106 #define SOL_SOCKET 1
107 
108 #define IP_MULTICAST_LOOP 1
109 #define IP_MULTICAST_IF 2
110 #define IP_MULTICAST_TTL 3
111 #define IP_ADD_MEMBERSHIP 4
112 #define IP_DROP_MEMBERSHIP 5
113 #define SO_SNDBUF 6
114 #define SO_RCVBUF 7
115 #define SO_REUSEPORT 8
116 #define SO_REUSEADDR 9
117 
118 struct ip_mreq
119 {
120  struct in_addr imr_multiaddr; /* IP multicast group address */
121  struct in_addr imr_interface; /* IP address of local interface */
122  struct in_addr imr_sourceaddr; /* IP address of multicast source */
123 };
124 
125 /* Define the thread handle */
126 struct OSAPI_ThreadHandle
127 {
128  TX_THREAD thread;
129  void *stack;
130 };
131 typedef struct OSAPI_ThreadHandle OSAPI_ThreadHandle;
132 
133 #define OSAPI_ThreadId TX_THREAD *
134 
135 #define OSAPI_ProcessId TX_THREAD *
136 
137 #define HAVE_SOCKET_API
138 
139 #ifndef OSAPI_LOG_WRITE_BUFFER
140 #define OSAPI_LOG_WRITE_BUFFER(buf_,len_) UNUSED_ARG(len_); \
141  bsp_debug_printf("%s", buf_)
142 #endif
143 
144 #endif /* osapi_os_threadx_h */

RTI Connext DDS Micro Version 2.4.11 Copyright © Mon Jul 23 2018 Real-Time Innovations, Inc