F´ Flight Software - C/C++ Documentation  NASA-v2.0.0
A framework for building embedded system applications to NASA flight quality standards.
FpConfig.hpp
Go to the documentation of this file.
1 
12 #ifndef _FW_CONFIG_HPP_
13 #define _FW_CONFIG_HPP_
14 
15 // A helper macro to declare errors in definitions of the constants
16 #define FW_CONFIG_ERROR( condition, name )\
17  typedef char assert_failed_ ## name [ (condition) ? 1 : -1 ];
18 
19 // To enable various facilities, set the below to 0 or 1. If it is set in compiler flags,
20 // these defaults will be overridden
21 
22 // Available types
23 
24 #ifndef FW_HAS_64_BIT
25 #define FW_HAS_64_BIT 1
26 #endif
27 
28 #ifndef FW_HAS_32_BIT
29 #define FW_HAS_32_BIT 1
30 #endif
31 
32 #ifndef FW_HAS_16_BIT
33 #define FW_HAS_16_BIT 1
34 #endif
35 
36 #ifndef FW_HAS_F64
37 #define FW_HAS_F64 1
38 #endif
39 
40 // Boolean values for serialization
41 
42 #ifndef FW_SERIALIZE_TRUE_VALUE
43 #define FW_SERIALIZE_TRUE_VALUE (0xFF)
44 #endif
45 
46 #ifndef FW_SERIALIZE_FALSE_VALUE
47 #define FW_SERIALIZE_FALSE_VALUE (0x00)
48 #endif
49 
50 #ifndef AssertArg
51 #define AssertArg U32
52 #endif
53 
54 // typedefs for various serialization items
55 // *** NOTE *** Changes here MUST match GSE in order to decode the values correctly
56 
57 #ifndef FwPacketDescriptorType
58 #define FwPacketDescriptorType U32
59 #endif
60 
61 #ifndef FwOpcodeType
62 #define FwOpcodeType U32
63 #endif
64 
65 #ifndef FwChanIdType
66 #define FwChanIdType U32
67 #endif
68 
69 #ifndef FwEventIdType
70 #define FwEventIdType U32
71 #endif
72 
73 #ifndef FwPrmIdType
74 #define FwPrmIdType U32
75 #endif
76 
77 // How big the size of a buffer (or string) representation is
78 #ifndef FwBuffSizeType
79 #define FwBuffSizeType U16
80 #endif
81 
82 // How many bits are used to store an enumeration defined in XML during serialization.
83 #ifndef FwEnumStoreType
84 #define FwEnumStoreType I32
85 #endif
86 
87 // Object facilities
88 
89 // Allow objects to have names. Allocates storage for each instance
90 #ifndef FW_OBJECT_NAMES
91 #define FW_OBJECT_NAMES 1
92 #endif
93 
94 // To reduce binary size, FW_OPTIONAL_NAME(<string>) can be used to substitute strings with an empty string
95 // when running with FW_OBJECT_NAMES disabled
96 #if FW_OBJECT_NAMES == 1
97  #define FW_OPTIONAL_NAME(name) name
98 #else
99  #define FW_OPTIONAL_NAME(name) ""
100 #endif
101 
102 // Add methods to query an object about its name. Can be overridden by derived classes
103 // For FW_OBJECT_TO_STRING to work, FW_OBJECT_NAMES must be enabled
104 #if FW_OBJECT_NAMES == 1
105  #ifndef FW_OBJECT_TO_STRING
106  #define FW_OBJECT_TO_STRING 1
107  #endif
108 #else
109  #define FW_OBJECT_TO_STRING 0
110 #endif
111 
112 // Adds the ability for all component related objects to register
113 // centrally.
114 #ifndef FW_OBJECT_REGISTRATION
115 #define FW_OBJECT_REGISTRATION 1
116 #endif
117 
118 #ifndef FW_QUEUE_REGISTRATION
119 #define FW_QUEUE_REGISTRATION 1
120 #endif
121 
122 #ifndef FW_BAREMETAL_SCHEDULER
123 #define FW_BAREMETAL_SCHEDULER 0
124 #endif
125 
126 // Port Facilities
127 
128 // This allows tracing calls through ports for debugging
129 #ifndef FW_PORT_TRACING
130 #define FW_PORT_TRACING 1
131 #endif
132 
133 // This generates code to connect to serialized ports
134 #ifndef FW_PORT_SERIALIZATION
135 #define FW_PORT_SERIALIZATION 1
136 #endif
137 
138 // Component Facilities
139 
140 // Serialization
141 
142 // Add a type id when serialization is done. More storage,
143 // but better detection of errors
144 // TODO: Not working yet
145 
146 #ifndef FW_SERIALIZATION_TYPE_ID
147 #define FW_SERIALIZATION_TYPE_ID 0
148 #endif
149 
150 // Number of bytes to use for serialization IDs. More
151 // bytes is more storage, but greater number of IDs
152 #if FW_SERIALIZATION_TYPE_ID
153  #ifndef FW_SERIALIZATION_TYPE_ID_BYTES
154  #define FW_SERIALIZATION_TYPE_ID_BYTES 4
155  #endif
156 #endif
157 
158 // Turn asserts on or off
159 
160 #define FW_NO_ASSERT 1
161 #define FW_FILEID_ASSERT 2
162 #define FW_FILENAME_ASSERT 3
163 
164 #ifndef FW_ASSERT_LEVEL
165 #define FW_ASSERT_LEVEL FW_FILENAME_ASSERT
166 #endif
167 
168 // Define max length of assert string
169 #ifndef FW_ASSERT_TEXT_SIZE
170 #define FW_ASSERT_TEXT_SIZE 120
171 #endif
172 
173 // Adjust various configuration parameters in the architecture. Some of the above enables may disable some of the values
174 
175 // The size of the object name stored in the object base class. Larger names will be truncated.
176 #if FW_OBJECT_NAMES
177  #ifndef FW_OBJ_NAME_MAX_SIZE
178  #define FW_OBJ_NAME_MAX_SIZE 80
179  #endif
180 #endif
181 
182 // When querying an object as to an object-specific description, this specifies the size of the buffer to store the description.
183 #if FW_OBJECT_TO_STRING
184  #ifndef FW_OBJ_TO_STRING_BUFFER_SIZE
185  #define FW_OBJ_TO_STRING_BUFFER_SIZE 255
186  #endif
187 #endif
188 
189 #if FW_OBJECT_REGISTRATION
190 // For the simple object registry provided with the framework, this specifies how many objects the registry will store.
191  #ifndef FW_OBJ_SIMPLE_REG_ENTRIES
192  #define FW_OBJ_SIMPLE_REG_ENTRIES 500
193  #endif
194 // When dumping the contents of the registry, this specifies the size of the buffer used to store object names. Should be >= FW_OBJ_NAME_MAX_SIZE.
195  #ifndef FW_OBJ_SIMPLE_REG_BUFF_SIZE
196  #define FW_OBJ_SIMPLE_REG_BUFF_SIZE 255
197  #endif
198 #endif
199 
200 #if FW_QUEUE_REGISTRATION
201 // For the simple queue registry provided with the framework, this specifies how many queues the registry will store.
202  #ifndef FW_QUEUE_SIMPLE_QUEUE_ENTRIES
203  #define FW_QUEUE_SIMPLE_QUEUE_ENTRIES 100
204  #endif
205 #endif
206 
207 
208 // Specifies the size of the string holding the queue name for queues
209 #ifndef FW_QUEUE_NAME_MAX_SIZE
210 #define FW_QUEUE_NAME_MAX_SIZE 80
211 #endif
212 
213 // Specifies the size of the string holding the task name for active components and tasks
214 #ifndef FW_TASK_NAME_MAX_SIZE
215 #define FW_TASK_NAME_MAX_SIZE 80
216 #endif
217 
218 // Specifies the size of the buffer that contains a communications packet.
219 #ifndef FW_COM_BUFFER_MAX_SIZE
220 #define FW_COM_BUFFER_MAX_SIZE 128
221 #endif
222 
223 // Specifies the size of the buffer that contains the serialized command arguments.
224 
225 #ifndef FW_CMD_ARG_BUFFER_MAX_SIZE
226 #define FW_CMD_ARG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwOpcodeType) - sizeof(FwPacketDescriptorType))
227 #endif
228 
229 // Specifies the maximum size of a string in a command argument
230 #ifndef FW_CMD_STRING_MAX_SIZE
231 #define FW_CMD_STRING_MAX_SIZE 40
232 #endif
233 
234 // Normally when a command is deserialized, the handler checks to see if there any any leftover
235 // bytes in the buffer. If there are, it assumes that the command was corrupted somehow since
236 // the serialized size should match the serialized size of the argument list. In some cases,
237 // command buffers are padded so the data can be larger than the serialized size of the command.
238 // Setting the below to zero will disable the check at the cost of not detecting commands that
239 // are too large.
240 #ifndef FW_CMD_CHECK_RESIDUAL
241 #define FW_CMD_CHECK_RESIDUAL 1
242 #endif
243 
244 // Specifies the size of the buffer that contains the serialized log arguments.
245 #ifndef FW_LOG_BUFFER_MAX_SIZE
246 #define FW_LOG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwEventIdType) - sizeof(FwPacketDescriptorType))
247 #endif
248 
249 // Specifies the maximum size of a string in a log event
250 #ifndef FW_LOG_STRING_MAX_SIZE
251 #define FW_LOG_STRING_MAX_SIZE 100
252 #endif
253 
254 // Specifies the size of the buffer that contains the serialized telemetry value.
255 #ifndef FW_TLM_BUFFER_MAX_SIZE
256 #define FW_TLM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwChanIdType) - sizeof(FwPacketDescriptorType))
257 #endif
258 
259 // Specifies the maximum size of a string in a telemetry channel
260 #ifndef FW_TLM_STRING_MAX_SIZE
261 #define FW_TLM_STRING_MAX_SIZE 40
262 #endif
263 
264 // Specifies the size of the buffer that contains the serialized parameter value.
265 #ifndef FW_PARAM_BUFFER_MAX_SIZE
266 #define FW_PARAM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwPrmIdType) - sizeof(FwPacketDescriptorType))
267 #endif
268 
269 // Specifies the maximum size of a string in a parameter
270 #ifndef FW_PARAM_STRING_MAX_SIZE
271 #define FW_PARAM_STRING_MAX_SIZE 40
272 #endif
273 
274 // Specifies the maximum size of a file upload chunk
275 #ifndef FW_FILE_BUFFER_MAX_SIZE
276 #define FW_FILE_BUFFER_MAX_SIZE 255
277 #endif
278 
279 // Specifies the maximum size of a string in an interface call
280 #ifndef FW_INTERNAL_INTERFACE_STRING_MAX_SIZE
281 #define FW_INTERNAL_INTERFACE_STRING_MAX_SIZE 256
282 #endif
283 
284 // enables text logging of events as well as data logging. Adds a second logging port for text output.
285 #ifndef FW_ENABLE_TEXT_LOGGING
286 #define FW_ENABLE_TEXT_LOGGING 1
287 #endif
288 
289  // Define the size of the text log string buffer. Should be large enough for format string and arguments
290 #ifndef FW_LOG_TEXT_BUFFER_SIZE
291 #define FW_LOG_TEXT_BUFFER_SIZE 256
292 #endif
293 
294 // Define if serializables have toString() method. Turning off will save code space and
295 // string constants. Must be enabled if text logging enabled
296 #ifndef FW_SERIALIZABLE_TO_STRING
297 #define FW_SERIALIZABLE_TO_STRING 1
298 #endif
299 
300 #if FW_SERIALIZABLE_TO_STRING
301 #ifndef FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE
302 #define FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE 255
303 #endif
304 #endif
305 
306 // Define if arrays have toString() method.
307 #ifndef FW_ARRAY_TO_STRING
308 #define FW_ARRAY_TO_STRING 1
309 #endif
310 
311 #if FW_ARRAY_TO_STRING
312 #ifndef FW_ARRAY_TO_STRING_BUFFER_SIZE
313 #define FW_ARRAY_TO_STRING_BUFFER_SIZE 256
314 #endif
315 #endif
316 
317 // Some settings to enable AMPCS compatibility. This breaks regular ISF GUI compatibility
318 #ifndef FW_AMPCS_COMPATIBLE
319 #define FW_AMPCS_COMPATIBLE 0
320 #endif
321 
322 // Define enumeration for Time base types
323 enum TimeBase {
327  TB_DONT_CARE = 0xFFFF
328 };
329 
330 // How many bits are used to store the time base
331 #ifndef FwTimeBaseStoreType
332 #define FwTimeBaseStoreType U16
333 #endif
334 
335 #ifndef FwTimeContextStoreType
336 #define FwTimeContextStoreType U8
337 #define FW_CONTEXT_DONT_CARE 0xFF
338 #endif
339 
340 // These setting configure whether or not the timebase and context values for the Fw::Time
341 // class are used. Some systems may not use or need those fields
342 
343 #ifndef FW_USE_TIME_BASE
344 #define FW_USE_TIME_BASE 1
345 #endif
346 
347 #ifndef FW_USE_TIME_CONTEXT
348 #define FW_USE_TIME_CONTEXT 1
349 #endif
350 //
351 //These defines used for the FilepathCharString type
352 
353 #ifndef FW_FIXED_LENGTH_STRING_SIZE
354 #define FW_FIXED_LENGTH_STRING_SIZE 256
355 #endif
356 
357 // *** NOTE configuration checks are in Fw/Cfg/ConfigCheck.cpp in order to have
358 // the type definitions in Fw/Types/BasicTypes available.
359 
360 #endif
TB_PROC_TIME
@ TB_PROC_TIME
Indicates time is processor cycle time. Not tied to external time.
Definition: FpConfig.hpp:325
TimeBase
TimeBase
Definition: FpConfig.hpp:323
TB_DONT_CARE
@ TB_DONT_CARE
Don't care value for sequences. If FwTimeBaseStoreType is changed, value should be changed.
Definition: FpConfig.hpp:327
TB_WORKSTATION_TIME
@ TB_WORKSTATION_TIME
Time as reported on workstation where software is running. For testing.
Definition: FpConfig.hpp:326
TB_NONE
@ TB_NONE
No time base has been established.
Definition: FpConfig.hpp:324