F´ Flight Software - C/C++ Documentation  NASA-v1.6.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 // To enable various facilities, set the below to 0 or 1. If it is set in compiler flags,
16 // these defaults will be overridden
17 
18 // Available types
19 
20 #ifndef FW_HAS_64_BIT
21 #define FW_HAS_64_BIT 1
22 #endif
23 
24 #ifndef FW_HAS_32_BIT
25 #define FW_HAS_32_BIT 1
26 #endif
27 
28 #ifndef FW_HAS_16_BIT
29 #define FW_HAS_16_BIT 1
30 #endif
31 
32 #ifndef FW_HAS_F64
33 #define FW_HAS_F64 1
34 #endif
35 
36 // Boolean values for serialization
37 
38 #ifndef FW_SERIALIZE_TRUE_VALUE
39 #define FW_SERIALIZE_TRUE_VALUE (0xFF)
40 #endif
41 
42 #ifndef FW_SERIALIZE_FALSE_VALUE
43 #define FW_SERIALIZE_FALSE_VALUE (0x00)
44 #endif
45 
46 #ifndef AssertArg
47 #define AssertArg U32
48 #endif
49 
50 // typedefs for various serialization items
51 // *** NOTE *** Changes here MUST match GSE in order to decode the values correctly
52 
53 #ifndef FwPacketDescriptorType
54 #define FwPacketDescriptorType U32
55 #endif
56 
57 #ifndef FwOpcodeType
58 #define FwOpcodeType U32
59 #endif
60 
61 #ifndef FwChanIdType
62 #define FwChanIdType U32
63 #endif
64 
65 #ifndef FwEventIdType
66 #define FwEventIdType U32
67 #endif
68 
69 #ifndef FwPrmIdType
70 #define FwPrmIdType U32
71 #endif
72 
73 #ifndef FwTlmPacketizeIdType
74 #define FwTlmPacketizeIdType U16
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 #define FW_ASSERT_DFL_MSG_LEN 256
164 
165 #ifndef FW_ASSERT_LEVEL
166 #define FW_ASSERT_LEVEL FW_FILENAME_ASSERT
167 #endif
168 
169 // Define max length of assert string
170 #ifndef FW_ASSERT_TEXT_SIZE
171 #define FW_ASSERT_TEXT_SIZE 120
172 #endif
173 
174 // Adjust various configuration parameters in the architecture. Some of the above enables may disable some of the values
175 
176 // The size of the object name stored in the object base class. Larger names will be truncated.
177 #if FW_OBJECT_NAMES
178  #ifndef FW_OBJ_NAME_MAX_SIZE
179  #define FW_OBJ_NAME_MAX_SIZE 80
180  #endif
181 #endif
182 
183 // When querying an object as to an object-specific description, this specifies the size of the buffer to store the description.
184 #if FW_OBJECT_TO_STRING
185  #ifndef FW_OBJ_TO_STRING_BUFFER_SIZE
186  #define FW_OBJ_TO_STRING_BUFFER_SIZE 255
187  #endif
188 #endif
189 
190 #if FW_OBJECT_REGISTRATION
191 // For the simple object registry provided with the framework, this specifies how many objects the registry will store.
192  #ifndef FW_OBJ_SIMPLE_REG_ENTRIES
193  #define FW_OBJ_SIMPLE_REG_ENTRIES 500
194  #endif
195 // 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.
196  #ifndef FW_OBJ_SIMPLE_REG_BUFF_SIZE
197  #define FW_OBJ_SIMPLE_REG_BUFF_SIZE 255
198  #endif
199 #endif
200 
201 #if FW_QUEUE_REGISTRATION
202 // For the simple queue registry provided with the framework, this specifies how many queues the registry will store.
203  #ifndef FW_QUEUE_SIMPLE_QUEUE_ENTRIES
204  #define FW_QUEUE_SIMPLE_QUEUE_ENTRIES 100
205  #endif
206 #endif
207 
208 
209 // Specifies the size of the string holding the queue name for queues
210 #ifndef FW_QUEUE_NAME_MAX_SIZE
211 #define FW_QUEUE_NAME_MAX_SIZE 80
212 #endif
213 
214 // Specifies the size of the string holding the task name for active components and tasks
215 #ifndef FW_TASK_NAME_MAX_SIZE
216 #define FW_TASK_NAME_MAX_SIZE 80
217 #endif
218 
219 // Specifies the size of the buffer that contains a communications packet.
220 #ifndef FW_COM_BUFFER_MAX_SIZE
221 #define FW_COM_BUFFER_MAX_SIZE 128
222 #endif
223 
224 // Specifies the size of the buffer that contains the serialized command arguments.
225 
226 #ifndef FW_CMD_ARG_BUFFER_MAX_SIZE
227 #define FW_CMD_ARG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwOpcodeType) - sizeof(FwPacketDescriptorType))
228 #endif
229 
230 // Specifies the maximum size of a string in a command argument
231 #ifndef FW_CMD_STRING_MAX_SIZE
232 #define FW_CMD_STRING_MAX_SIZE 40
233 #endif
234 
235 // Normally when a command is deserialized, the handler checks to see if there are any leftover
236 // bytes in the buffer. If there are, it assumes that the command was corrupted somehow since
237 // the serialized size should match the serialized size of the argument list. In some cases,
238 // command buffers are padded so the data can be larger than the serialized size of the command.
239 // Setting the below to zero will disable the check at the cost of not detecting commands that
240 // are too large.
241 #ifndef FW_CMD_CHECK_RESIDUAL
242 #define FW_CMD_CHECK_RESIDUAL 1
243 #endif
244 
245 // Specifies the size of the buffer that contains the serialized log arguments.
246 #ifndef FW_LOG_BUFFER_MAX_SIZE
247 #define FW_LOG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwEventIdType) - sizeof(FwPacketDescriptorType))
248 #endif
249 
250 // Specifies the maximum size of a string in a log event
251 #ifndef FW_LOG_STRING_MAX_SIZE
252 #define FW_LOG_STRING_MAX_SIZE 100
253 #endif
254 
255 // Specifies the size of the buffer that contains the serialized telemetry value.
256 #ifndef FW_TLM_BUFFER_MAX_SIZE
257 #define FW_TLM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwChanIdType) - sizeof(FwPacketDescriptorType))
258 #endif
259 
260 // Specifies the maximum size of a string in a telemetry channel
261 #ifndef FW_TLM_STRING_MAX_SIZE
262 #define FW_TLM_STRING_MAX_SIZE 40
263 #endif
264 
265 // Specifies the size of the buffer that contains the serialized parameter value.
266 #ifndef FW_PARAM_BUFFER_MAX_SIZE
267 #define FW_PARAM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwPrmIdType) - sizeof(FwPacketDescriptorType))
268 #endif
269 
270 // Specifies the maximum size of a string in a parameter
271 #ifndef FW_PARAM_STRING_MAX_SIZE
272 #define FW_PARAM_STRING_MAX_SIZE 40
273 #endif
274 
275 // Specifies the maximum size of a file upload chunk
276 #ifndef FW_FILE_BUFFER_MAX_SIZE
277 #define FW_FILE_BUFFER_MAX_SIZE 255
278 #endif
279 
280 // Specifies the maximum size of a string in an interface call
281 #ifndef FW_INTERNAL_INTERFACE_STRING_MAX_SIZE
282 #define FW_INTERNAL_INTERFACE_STRING_MAX_SIZE 256
283 #endif
284 
285 // enables text logging of events as well as data logging. Adds a second logging port for text output.
286 #ifndef FW_ENABLE_TEXT_LOGGING
287 #define FW_ENABLE_TEXT_LOGGING 1
288 #endif
289 
290  // Define the size of the text log string buffer. Should be large enough for format string and arguments
291 #ifndef FW_LOG_TEXT_BUFFER_SIZE
292 #define FW_LOG_TEXT_BUFFER_SIZE 256
293 #endif
294 
295 // Define if serializables have toString() method. Turning off will save code space and
296 // string constants. Must be enabled if text logging enabled
297 #ifndef FW_SERIALIZABLE_TO_STRING
298 #define FW_SERIALIZABLE_TO_STRING 1
299 #endif
300 
301 #if FW_SERIALIZABLE_TO_STRING
302 #ifndef FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE
303 #define FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE 255
304 #endif
305 #endif
306 
307 // Define if arrays have toString() method.
308 #ifndef FW_ARRAY_TO_STRING
309 #define FW_ARRAY_TO_STRING 1
310 #endif
311 
312 #if FW_ARRAY_TO_STRING
313 #ifndef FW_ARRAY_TO_STRING_BUFFER_SIZE
314 #define FW_ARRAY_TO_STRING_BUFFER_SIZE 256
315 #endif
316 #endif
317 
318 // Some settings to enable AMPCS compatibility. This breaks regular ISF GUI compatibility
319 #ifndef FW_AMPCS_COMPATIBLE
320 #define FW_AMPCS_COMPATIBLE 0
321 #endif
322 
323 // Define enumeration for Time base types
324 enum TimeBase {
328  TB_DONT_CARE = 0xFFFF
329 };
330 
331 // How many bits are used to store the time base
332 #ifndef FwTimeBaseStoreType
333 #define FwTimeBaseStoreType U16
334 #endif
335 
336 #ifndef FwTimeContextStoreType
337 #define FwTimeContextStoreType U8
338 #define FW_CONTEXT_DONT_CARE 0xFF
339 #endif
340 
341 // These settings configure whether or not the timebase and context values for the Fw::Time
342 // class are used. Some systems may not use or need those fields
343 
344 #ifndef FW_USE_TIME_BASE
345 #define FW_USE_TIME_BASE 1
346 #endif
347 
348 #ifndef FW_USE_TIME_CONTEXT
349 #define FW_USE_TIME_CONTEXT 1
350 #endif
351 //
352 //These defines used for the FilepathCharString type
353 
354 #ifndef FW_FIXED_LENGTH_STRING_SIZE
355 #define FW_FIXED_LENGTH_STRING_SIZE 256
356 #endif
357 
358 // *** NOTE configuration checks are in Fw/Cfg/ConfigCheck.cpp in order to have
359 // the type definitions in Fw/Types/BasicTypes available.
360 
361 #endif
TB_PROC_TIME
@ TB_PROC_TIME
Indicates time is processor cycle time. Not tied to external time.
Definition: FpConfig.hpp:326
TimeBase
TimeBase
Definition: FpConfig.hpp:324
TB_DONT_CARE
@ TB_DONT_CARE
Don't care value for sequences. If FwTimeBaseStoreType is changed, value should be changed.
Definition: FpConfig.hpp:328
TB_WORKSTATION_TIME
@ TB_WORKSTATION_TIME
Time as reported on workstation where software is running. For testing.
Definition: FpConfig.hpp:327
TB_NONE
@ TB_NONE
No time base has been established.
Definition: FpConfig.hpp:325