F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
FpConfig.h
Go to the documentation of this file.
1 
11 #ifndef FPCONFIG_H_
12 #define FPCONFIG_H_
13 
14 #include <Fw/Types/BasicTypes.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 // ----------------------------------------------------------------------
21 // Type aliases
22 // ----------------------------------------------------------------------
23 
24 // The type of port indices and smaller sizes internal to the software
26 #define PRI_FwIndexType PRI_PlatformIndexType
27 
28 // The signed type of larger sizes internal to the software, e.g., memory buffer sizes,
29 // file sizes
30 typedef PlatformSignedSizeType FwSignedSizeType;
31 #define PRI_FwSignedSizeType PRI_PlatformSignedSizeType
32 
33 // The unsigned type of larger sizes internal to the software, e.g., memory buffer sizes,
34 // file sizes
36 #define PRI_FwSizeType PRI_PlatformSizeType
37 
38 // The type of an assertion argument
40 #define PRI_FwAssertArgType PRI_PlatformAssertArgType
41 
42 // The type of a machine integer. Ordinarily this should be int.
44 #define PRI_FwNativeIntType PRI_PlatformIntType
45 
46 // The type of a machine unsigned integer. Ordinarily this should be unsigned int.
48 #define PRI_FwNativeUIntType PRI_PlatformUIntType
49 
50 // Task priority type
51 typedef PlatformTaskPriorityType FwTaskPriorityType;
52 #define PRI_FwTaskPriorityType PRI_PlatformTaskPriorityType
53 
54 // Queue priority type
55 typedef PlatformQueuePriorityType FwQueuePriorityType;
56 #define PRI_FwQueuePriorityType PRI_PlatformQueuePriorityType
57 
58 // The type used to serialize a size value
59 typedef U16 FwSizeStoreType;
60 #define PRI_FwSizeStoreType PRIu16
61 
62 // The type used to serialize a C++ enumeration constant
63 // FPP enumerations are serialized according to their representation types
64 typedef I32 FwEnumStoreType;
65 #define PRI_FwEnumStoreType PRId32
66 
67 // Define enumeration for Time base types
68 // Note: maintaining C-style
69 typedef enum {
73  TB_DONT_CARE =
74  0xFFFF
76 #define FW_CONTEXT_DONT_CARE 0xFF
77 
78 // The type used to serialize a time base value
79 typedef U16 FwTimeBaseStoreType;
80 #define PRI_FwTimeBaseStoreType PRIu16
81 
82 // The type used to serialize a time context value
84 #define PRI_FwTimeContextStoreType PRIu8
85 
86 // The type of a com packet descriptor
88 #define PRI_FwPacketDescriptorType PRIu32
89 
90 // The type of a command opcode
91 typedef U32 FwOpcodeType;
92 #define PRI_FwOpcodeType PRIu32
93 
94 // The type of a telemetry channel identifier
95 typedef U32 FwChanIdType;
96 #define PRI_FwChanIdType PRIu32
97 
98 // The type of a trace identifier
99 typedef U32 FwTraceIdType;
100 #define PRI_FwTraceIdType PRIu32
101 
102 // The type of an event identifier
103 typedef U32 FwEventIdType;
104 #define PRI_FwEventIdType PRIu32
105 
106 // The type of a parameter identifier
107 typedef U32 FwPrmIdType;
108 #define PRI_FwPrmIdType PRIu32
109 
110 // The type of a telemetry packet identifier
112 #define PRI_FwTlmPacketizeIdType PRIu16
113 
114 // The type of a data product identifier
115 typedef U32 FwDpIdType;
116 #define PRI_FwDpIdType PRIu32
117 
118 // The type of a data product priority
119 typedef U32 FwDpPriorityType;
120 #define PRI_FwDpPriorityType PRIu32
121 
122 // ----------------------------------------------------------------------
123 // Derived type aliases
124 // By default, these types are aliases of types defined above
125 // If necessary, you can change these definitions
126 // In most cases, the defaults should work
127 // ----------------------------------------------------------------------
128 
129 // The type of a queue size
131 #define PRI_FwQueueSizeType PRI_FwIndexType
132 
133 // ----------------------------------------------------------------------
134 // Configuration switches
135 // ----------------------------------------------------------------------
136 
137 // Boolean values for serialization
138 #ifndef FW_SERIALIZE_TRUE_VALUE
139 #define FW_SERIALIZE_TRUE_VALUE (0xFF)
140 #endif
141 
142 #ifndef FW_SERIALIZE_FALSE_VALUE
143 #define FW_SERIALIZE_FALSE_VALUE (0x00)
144 #endif
145 
146 // Allow objects to have names. Allocates storage for each instance
147 #ifndef FW_OBJECT_NAMES
148 #define FW_OBJECT_NAMES \
149  1
150 #endif
151 
152 // To reduce binary size, FW_OPTIONAL_NAME(<string>) can be used to substitute strings with an empty string
153 // when running with FW_OBJECT_NAMES disabled
154 #if FW_OBJECT_NAMES == 1
155 #define FW_OPTIONAL_NAME(name) name
156 #else
157 #define FW_OPTIONAL_NAME(name) ""
158 #endif
159 
160 // Add methods to query an object about its name. Can be overridden by derived classes
161 // For FW_OBJECT_TO_STRING to work, FW_OBJECT_NAMES must be enabled
162 #if FW_OBJECT_NAMES == 1
163 #ifndef FW_OBJECT_TO_STRING
164 #define FW_OBJECT_TO_STRING \
165  1
166 #endif
167 #else
168 #define FW_OBJECT_TO_STRING 0
169 #endif
170 
171 // Adds the ability for all component related objects to register
172 // centrally.
173 #ifndef FW_OBJECT_REGISTRATION
174 #define FW_OBJECT_REGISTRATION \
175  1
176 #endif
177 
178 #ifndef FW_QUEUE_REGISTRATION
179 #define FW_QUEUE_REGISTRATION 1
180 #endif
181 
182 #ifndef FW_BAREMETAL_SCHEDULER
183 #define FW_BAREMETAL_SCHEDULER \
184  0
185 #endif
186 
187 // On some systems, use of *printf family functions (snprintf, printf, etc) require a prohibitive amount of program
188 // space. Setting this to `0` indicates that the Fw/String methods should stop using these functions to conserve
189 // program size. However, this comes at the expense of discarding format parameters. i.e. the format string is returned
190 // unchanged.
191 #ifndef FW_USE_PRINTF_FAMILY_FUNCTIONS_IN_STRING_FORMATTING
192 #define FW_USE_PRINTF_FAMILY_FUNCTIONS_IN_STRING_FORMATTING 1
193 #endif
194 
195 // Port Facilities
196 
197 // This allows tracing calls through ports for debugging
198 #ifndef FW_PORT_TRACING
199 #define FW_PORT_TRACING 1
200 #endif
201 
202 // This generates code to connect to serialized ports
203 #ifndef FW_PORT_SERIALIZATION
204 #define FW_PORT_SERIALIZATION \
205  1
207 #endif
208 
209 // Component Facilities
210 
211 // Serialization
212 
213 // Add a type id when serialization is done. More storage,
214 // but better detection of errors
215 // TODO: Not working yet
216 
217 #ifndef FW_SERIALIZATION_TYPE_ID
218 #define FW_SERIALIZATION_TYPE_ID \
219  0
220 #endif
221 
222 // Number of bytes to use for serialization IDs. More
223 // bytes is more storage, but greater number of IDs
224 #if FW_SERIALIZATION_TYPE_ID
225 #ifndef FW_SERIALIZATION_TYPE_ID_BYTES
226 #define FW_SERIALIZATION_TYPE_ID_BYTES 4
227 #endif
228 #endif
229 
230 // Set assertion form. Options:
231 // 1. FW_NO_ASSERT: assertions are compiled out, side effects are kept
232 // 2. FW_FILEID_ASSERT: asserts report a file CRC and line number
233 // 3. FW_FILENAME_ASSERT: asserts report a file path (__FILE__) and line number
234 // 4. FW_RELATIVE_PATH_ASSERT: asserts report a relative path within F´ or F´ library and line number
235 //
236 // Note: users who want alternate asserts should set assert level to FW_NO_ASSERT and define FW_ASSERT in this header
237 #ifndef FW_ASSERT_LEVEL
238 #define FW_ASSERT_LEVEL FW_FILENAME_ASSERT
239 #endif
240 
241 // Adjust various configuration parameters in the architecture. Some of the above enables may disable some of the values
242 
243 // The size of the object name stored in the object base class. Larger names will be truncated.
244 #if FW_OBJECT_NAMES
245 #ifndef FW_OBJ_NAME_BUFFER_SIZE
246 #define FW_OBJ_NAME_BUFFER_SIZE \
247  80
248 #endif
249 #endif
250 
251 #if FW_OBJECT_REGISTRATION
252 // For the simple object registry provided with the framework, this specifies how many objects the registry will store.
253 #ifndef FW_OBJ_SIMPLE_REG_ENTRIES
254 #define FW_OBJ_SIMPLE_REG_ENTRIES 500
255 #endif
256 // When dumping the contents of the registry, this specifies the size of the buffer used to store object names. Should
257 // be >= FW_OBJ_NAME_BUFFER_SIZE.
258 #ifndef FW_OBJ_SIMPLE_REG_BUFF_SIZE
259 #define FW_OBJ_SIMPLE_REG_BUFF_SIZE 255
260 #endif
261 #endif
262 
263 #if FW_QUEUE_REGISTRATION
264 // For the simple queue registry provided with the framework, this specifies how many queues the registry will store.
265 #ifndef FW_QUEUE_SIMPLE_QUEUE_ENTRIES
266 #define FW_QUEUE_SIMPLE_QUEUE_ENTRIES 100
267 #endif
268 #endif
269 
270 // Specifies the size of the string holding the queue name for queues
271 #ifndef FW_QUEUE_NAME_BUFFER_SIZE
272 #define FW_QUEUE_NAME_BUFFER_SIZE 80
273 #endif
274 
275 // Specifies the size of the string holding the task name for active components and tasks
276 #ifndef FW_TASK_NAME_BUFFER_SIZE
277 #define FW_TASK_NAME_BUFFER_SIZE 80
278 #endif
279 
280 // Specifies the size of the buffer that contains a communications packet.
281 #ifndef FW_COM_BUFFER_MAX_SIZE
282 #define FW_COM_BUFFER_MAX_SIZE 512
283 #endif
284 
285 // Specifies the size of the buffer attached to state machine signals.
286 #ifndef FW_SM_SIGNAL_BUFFER_MAX_SIZE
287 #define FW_SM_SIGNAL_BUFFER_MAX_SIZE 128 // Not to exceed size of NATIVE_UINT_TYPE
288 #endif
289 
290 // Specifies the size of the buffer that contains the serialized command arguments.
291 
292 #ifndef FW_CMD_ARG_BUFFER_MAX_SIZE
293 #define FW_CMD_ARG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwOpcodeType) - sizeof(FwPacketDescriptorType))
294 #endif
295 
296 // Specifies the maximum size of a string in a command argument
297 #ifndef FW_CMD_STRING_MAX_SIZE
298 #define FW_CMD_STRING_MAX_SIZE 40
299 #endif
300 
301 // Normally when a command is deserialized, the handler checks to see if there are any leftover
302 // bytes in the buffer. If there are, it assumes that the command was corrupted somehow since
303 // the serialized size should match the serialized size of the argument list. In some cases,
304 // command buffers are padded so the data can be larger than the serialized size of the command.
305 // Setting the below to zero will disable the check at the cost of not detecting commands that
306 // are too large.
307 #ifndef FW_CMD_CHECK_RESIDUAL
308 #define FW_CMD_CHECK_RESIDUAL 1
309 #endif
310 
311 // Specifies the size of the buffer that contains the serialized log arguments.
312 #ifndef FW_LOG_BUFFER_MAX_SIZE
313 #define FW_LOG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwEventIdType) - sizeof(FwPacketDescriptorType))
314 #endif
315 
316 // Specifies the maximum size of a string in a log event
317 // Note: This constant truncates file names in assertion failure event reports
318 #ifndef FW_LOG_STRING_MAX_SIZE
319 #define FW_LOG_STRING_MAX_SIZE 200
320 #endif
321 
322 // Specifies the size of the buffer that contains the serialized telemetry value.
323 #ifndef FW_TLM_BUFFER_MAX_SIZE
324 #define FW_TLM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwChanIdType) - sizeof(FwPacketDescriptorType))
325 #endif
326 
327 // Specifies the maximum size of a string in a telemetry channel
328 #ifndef FW_TLM_STRING_MAX_SIZE
329 #define FW_TLM_STRING_MAX_SIZE 40
330 #endif
331 
332 // Specifies the size of the buffer that contains the serialized parameter value.
333 #ifndef FW_PARAM_BUFFER_MAX_SIZE
334 #define FW_PARAM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwPrmIdType) - sizeof(FwPacketDescriptorType))
335 #endif
336 
337 // Specifies the maximum size of a string in a parameter
338 #ifndef FW_PARAM_STRING_MAX_SIZE
339 #define FW_PARAM_STRING_MAX_SIZE 40
340 #endif
341 
342 // Specifies the maximum size of a file upload chunk
343 #ifndef FW_FILE_BUFFER_MAX_SIZE
344 #define FW_FILE_BUFFER_MAX_SIZE 255
345 #endif
346 
347 // Specifies the maximum size of a string in an interface call
348 #ifndef FW_INTERNAL_INTERFACE_STRING_MAX_SIZE
349 #define FW_INTERNAL_INTERFACE_STRING_MAX_SIZE 256
350 #endif
351 
352 // enables text logging of events as well as data logging. Adds a second logging port for text output.
353 #ifndef FW_ENABLE_TEXT_LOGGING
354 #define FW_ENABLE_TEXT_LOGGING 1
355 #endif
356 
357 // Define the size of the text log string buffer. Should be large enough for format string and arguments
358 #ifndef FW_LOG_TEXT_BUFFER_SIZE
359 #define FW_LOG_TEXT_BUFFER_SIZE 256
360 #endif
361 
362 // Define if serializables have toString() method. Turning off will save code space and
363 // string constants. Must be enabled if text logging enabled
364 #ifndef FW_SERIALIZABLE_TO_STRING
365 #define FW_SERIALIZABLE_TO_STRING 1
366 #endif
367 
368 // Some settings to enable AMPCS compatibility. This breaks regular ISF GUI compatibility
369 #ifndef FW_AMPCS_COMPATIBLE
370 #define FW_AMPCS_COMPATIBLE 0
371 #endif
372 
373 // These settings configure whether or not the timebase and context values for the Fw::Time
374 // class are used. Some systems may not use or need those fields
375 
376 #ifndef FW_USE_TIME_BASE
377 #define FW_USE_TIME_BASE 1
378 #endif
379 
380 #ifndef FW_USE_TIME_CONTEXT
381 #define FW_USE_TIME_CONTEXT 1
382 #endif
383 
384 // Configuration for Fw::String
385 
386 #ifndef FW_FIXED_LENGTH_STRING_SIZE
387 #define FW_FIXED_LENGTH_STRING_SIZE 256
388 #endif
389 
390 // OS configuration
391 #ifndef FW_CONSOLE_HANDLE_MAX_SIZE
392 #define FW_CONSOLE_HANDLE_MAX_SIZE 24
393 #endif
394 
395 #ifndef FW_TASK_HANDLE_MAX_SIZE
396 #define FW_TASK_HANDLE_MAX_SIZE 24
397 #endif
398 
399 #ifndef FW_FILE_HANDLE_MAX_SIZE
400 #define FW_FILE_HANDLE_MAX_SIZE 16
401 #endif
402 
403 #ifndef FW_MUTEX_HANDLE_MAX_SIZE
404 #define FW_MUTEX_HANDLE_MAX_SIZE 72
405 #endif
406 
407 #ifndef FW_QUEUE_HANDLE_MAX_SIZE
408 #define FW_QUEUE_HANDLE_MAX_SIZE 352
409 #endif
410 
411 #ifndef FW_DIRECTORY_HANDLE_MAX_SIZE
412 #define FW_DIRECTORY_HANDLE_MAX_SIZE 16
413 #endif
414 
415 #ifndef FW_FILESYSTEM_HANDLE_MAX_SIZE
416 #define FW_FILESYSTEM_HANDLE_MAX_SIZE 16
417 #endif
418 
419 #ifndef FW_RAW_TIME_HANDLE_MAX_SIZE
420 #define FW_RAW_TIME_HANDLE_MAX_SIZE 24
421 #endif
422 
423 #ifndef FW_RAW_TIME_SERIALIZATION_MAX_SIZE
424 #define FW_RAW_TIME_SERIALIZATION_MAX_SIZE 8
425 #endif
426 
427 #ifndef FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE
428 #define FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE 56
429 #endif
430 
431 #ifndef FW_CPU_HANDLE_MAX_SIZE
432 #define FW_CPU_HANDLE_MAX_SIZE 16
433 #endif
434 
435 #ifndef FW_MEMORY_HANDLE_MAX_SIZE
436 #define FW_MEMORY_HANDLE_MAX_SIZE 16
437 #endif
438 
439 #ifndef FW_HANDLE_ALIGNMENT
440 #define FW_HANDLE_ALIGNMENT 8
441 #endif
442 
443 // Note: One buffer of this size will be stack-allocated during certain OSAL operations e.g. when copying a file
444 #ifndef FW_FILE_CHUNK_SIZE
445 #define FW_FILE_CHUNK_SIZE 512
446 #endif
447 
448 // *** NOTE configuration checks are in Fw/Cfg/ConfigCheck.cpp in order to have
449 // the type definitions in Fw/Types/BasicTypes available.
450 
451 // DO NOT TOUCH. These types are specified for backwards naming compatibility.
453 #define PRI_FwBuffSizeType PRI_FwSizeStoreType
454 
455 #ifdef __cplusplus
456 }
457 #endif
458 
459 #endif
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:30
PlatformIntType PlatformIndexType
unsigned int PlatformUIntType
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
PlatformIntType PlatformAssertArgType
PlatformUIntType PlatformSizeType
TimeBase
Definition: FpConfig.h:69
@ TB_WORKSTATION_TIME
Time as reported on workstation where software is running. For testing.
Definition: FpConfig.h:72
@ TB_DONT_CARE
Don't care value for sequences. If FwTimeBaseStoreType is changed, value should be changed.
Definition: FpConfig.h:73
@ TB_PROC_TIME
Indicates time is processor cycle time. Not tied to external time.
Definition: FpConfig.h:71
@ TB_NONE
No time base has been established.
Definition: FpConfig.h:70
I32 FwEnumStoreType
Definition: FpConfig.h:64
PlatformTaskPriorityType FwTaskPriorityType
Definition: FpConfig.h:51
PlatformAssertArgType FwAssertArgType
Definition: FpConfig.h:39
PlatformUIntType FwNativeUIntType
Definition: FpConfig.h:47
PlatformIntType FwNativeIntType
Definition: FpConfig.h:43
U32 FwDpPriorityType
Definition: FpConfig.h:119
U32 FwChanIdType
Definition: FpConfig.h:95
PlatformSignedSizeType FwSignedSizeType
Definition: FpConfig.h:30
U32 FwEventIdType
Definition: FpConfig.h:103
U32 FwDpIdType
Definition: FpConfig.h:115
FwSizeStoreType FwBuffSizeType
Definition: FpConfig.h:452
FwIndexType FwQueueSizeType
Definition: FpConfig.h:130
U16 FwSizeStoreType
Definition: FpConfig.h:59
U32 FwPacketDescriptorType
Definition: FpConfig.h:87
U16 FwTlmPacketizeIdType
Definition: FpConfig.h:111
U16 FwTimeBaseStoreType
Definition: FpConfig.h:79
U32 FwOpcodeType
Definition: FpConfig.h:91
U8 FwTimeContextStoreType
Definition: FpConfig.h:83
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
U32 FwTraceIdType
Definition: FpConfig.h:99
U32 FwPrmIdType
Definition: FpConfig.h:107
PlatformQueuePriorityType FwQueuePriorityType
Definition: FpConfig.h:55
PlatformIndexType FwIndexType
Definition: FpConfig.h:25