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