F´ Flight Software - C/C++ Documentation
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 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 #include <Platform/PlatformTypes.h>
18 #include <Fw/Types/BasicTypes.h>
19 
20 
21 // ----------------------------------------------------------------------
22 // Type aliases
23 // ----------------------------------------------------------------------
24 
25 
26 
27 // Define enumeration for Time base types
28 // Note: maintaining C-style
29 typedef enum {
34  0xFFFF
35 } TimeBase;
36 #define FW_CONTEXT_DONT_CARE 0xFF
37 
38 // ----------------------------------------------------------------------
39 // Configuration switches
40 // ----------------------------------------------------------------------
41 
42 // Boolean values for serialization
43 #ifndef FW_SERIALIZE_TRUE_VALUE
44 #define FW_SERIALIZE_TRUE_VALUE (0xFF)
45 #endif
46 
47 #ifndef FW_SERIALIZE_FALSE_VALUE
48 #define FW_SERIALIZE_FALSE_VALUE (0x00)
49 #endif
50 
51 // Allow objects to have names. Allocates storage for each instance
52 #ifndef FW_OBJECT_NAMES
53 #define FW_OBJECT_NAMES \
54  1
55 #endif
56 
57 // To reduce binary size, FW_OPTIONAL_NAME(<string>) can be used to substitute strings with an empty string
58 // when running with FW_OBJECT_NAMES disabled
59 #if FW_OBJECT_NAMES == 1
60 #define FW_OPTIONAL_NAME(name) name
61 #else
62 #define FW_OPTIONAL_NAME(name) ""
63 #endif
64 
65 // Add methods to query an object about its name. Can be overridden by derived classes
66 // For FW_OBJECT_TO_STRING to work, FW_OBJECT_NAMES must be enabled
67 #if FW_OBJECT_NAMES == 1
68 #ifndef FW_OBJECT_TO_STRING
69 #define FW_OBJECT_TO_STRING \
70  1
71 #endif
72 #else
73 #define FW_OBJECT_TO_STRING 0
74 #endif
75 
76 // Adds the ability for all component related objects to register
77 // centrally.
78 #ifndef FW_OBJECT_REGISTRATION
79 #define FW_OBJECT_REGISTRATION \
80  1
81 #endif
82 
83 #ifndef FW_QUEUE_REGISTRATION
84 #define FW_QUEUE_REGISTRATION 1
85 #endif
86 
87 // On some systems, use of *printf family functions (snprintf, printf, etc) require a prohibitive amount of program
88 // space. Setting this to `0` indicates that the Fw/String methods should stop using these functions to conserve
89 // program size. However, this comes at the expense of discarding format parameters. i.e. the format string is returned
90 // unchanged.
91 #ifndef FW_USE_PRINTF_FAMILY_FUNCTIONS_IN_STRING_FORMATTING
92 #define FW_USE_PRINTF_FAMILY_FUNCTIONS_IN_STRING_FORMATTING 1
93 #endif
94 
95 // Port Facilities
96 
97 // This allows tracing calls through ports for debugging
98 #ifndef FW_PORT_TRACING
99 #define FW_PORT_TRACING 1
100 #endif
101 
102 // This generates code to connect to serialized ports
103 #ifndef FW_PORT_SERIALIZATION
104 #define FW_PORT_SERIALIZATION \
105  1
106 #endif
108 
109 // Component Facilities
110 
111 // Serialization
112 
113 // Add a type id when serialization is done. More storage,
114 // but better detection of errors
115 // TODO: Not working yet
116 
117 #ifndef FW_SERIALIZATION_TYPE_ID
118 #define FW_SERIALIZATION_TYPE_ID \
119  0
120 #endif
121 
122 // Number of bytes to use for serialization IDs. More
123 // bytes is more storage, but greater number of IDs
124 #if FW_SERIALIZATION_TYPE_ID
125 #ifndef FW_SERIALIZATION_TYPE_ID_BYTES
126 #define FW_SERIALIZATION_TYPE_ID_BYTES 4
127 #endif
128 #endif
129 
130 // Set assertion form. Options:
131 // 1. FW_NO_ASSERT: assertions are compiled out, side effects are kept
132 // 2. FW_FILEID_ASSERT: asserts report a file CRC and line number
133 // 3. FW_FILENAME_ASSERT: asserts report a file path (__FILE__) and line number
134 // 4. FW_RELATIVE_PATH_ASSERT: asserts report a relative path within F´ or F´ library and line number
135 //
136 // Note: users who want alternate asserts should set assert level to FW_NO_ASSERT and define FW_ASSERT in this header
137 #ifndef FW_ASSERT_LEVEL
138 #define FW_ASSERT_LEVEL FW_FILENAME_ASSERT
139 #endif
140 
141 // Adjust various configuration parameters in the architecture. Some of the above enables may disable some of the values
142 
143 // The size of the object name stored in the object base class. Larger names will be truncated.
144 #if FW_OBJECT_NAMES
145 #ifndef FW_OBJ_NAME_BUFFER_SIZE
146 #define FW_OBJ_NAME_BUFFER_SIZE \
147  80
148 #endif
149 #endif
150 
151 #if FW_OBJECT_REGISTRATION
152 // For the simple object registry provided with the framework, this specifies how many objects the registry will store.
153 #ifndef FW_OBJ_SIMPLE_REG_ENTRIES
154 #define FW_OBJ_SIMPLE_REG_ENTRIES 500
155 #endif
156 // When dumping the contents of the registry, this specifies the size of the buffer used to store object names. Should
157 // be >= FW_OBJ_NAME_BUFFER_SIZE.
158 #ifndef FW_OBJ_SIMPLE_REG_BUFF_SIZE
159 #define FW_OBJ_SIMPLE_REG_BUFF_SIZE 255
160 #endif
161 #endif
162 
163 #if FW_QUEUE_REGISTRATION
164 // For the simple queue registry provided with the framework, this specifies how many queues the registry will store.
165 #ifndef FW_QUEUE_SIMPLE_QUEUE_ENTRIES
166 #define FW_QUEUE_SIMPLE_QUEUE_ENTRIES 100
167 #endif
168 #endif
169 
170 // Specifies the size of the string holding the queue name for queues
171 #ifndef FW_QUEUE_NAME_BUFFER_SIZE
172 #define FW_QUEUE_NAME_BUFFER_SIZE 80
173 #endif
174 
175 // Specifies the size of the string holding the task name for active components and tasks
176 #ifndef FW_TASK_NAME_BUFFER_SIZE
177 #define FW_TASK_NAME_BUFFER_SIZE 80
178 #endif
179 
180 // Specifies the size of the buffer that contains a communications packet.
181 #ifndef FW_COM_BUFFER_MAX_SIZE
182 #define FW_COM_BUFFER_MAX_SIZE 512
183 #endif
184 
185 // Specifies the size of the buffer attached to state machine signals.
186 #ifndef FW_SM_SIGNAL_BUFFER_MAX_SIZE
187 #define FW_SM_SIGNAL_BUFFER_MAX_SIZE 128 // Not to exceed max value of FwSizeType
188 #endif
189 
190 // Specifies the size of the buffer that contains the serialized command arguments.
191 
192 #ifndef FW_CMD_ARG_BUFFER_MAX_SIZE
193 #define FW_CMD_ARG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwOpcodeType) - sizeof(FwPacketDescriptorType))
194 #endif
195 
196 // Specifies the maximum size of a string in a command argument
197 #ifndef FW_CMD_STRING_MAX_SIZE
198 #define FW_CMD_STRING_MAX_SIZE 40
199 #endif
200 
201 // Normally when a command is deserialized, the handler checks to see if there are any leftover
202 // bytes in the buffer. If there are, it assumes that the command was corrupted somehow since
203 // the serialized size should match the serialized size of the argument list. In some cases,
204 // command buffers are padded so the data can be larger than the serialized size of the command.
205 // Setting the below to zero will disable the check at the cost of not detecting commands that
206 // are too large.
207 #ifndef FW_CMD_CHECK_RESIDUAL
208 #define FW_CMD_CHECK_RESIDUAL 1
209 #endif
210 
211 // Specifies the size of the buffer that contains the serialized log arguments.
212 #ifndef FW_LOG_BUFFER_MAX_SIZE
213 #define FW_LOG_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwEventIdType) - sizeof(FwPacketDescriptorType))
214 #endif
215 
216 // Specifies the maximum size of a string in a log event
217 // Note: This constant truncates file names in assertion failure event reports
218 #ifndef FW_LOG_STRING_MAX_SIZE
219 #define FW_LOG_STRING_MAX_SIZE 200
220 #endif
221 
222 // Specifies the size of the buffer that contains the serialized telemetry value.
223 #ifndef FW_TLM_BUFFER_MAX_SIZE
224 #define FW_TLM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwChanIdType) - sizeof(FwPacketDescriptorType))
225 #endif
226 
227 // Specifies the size of the buffer that contains statement args for the FpySequencer
228 #ifndef FW_STATEMENT_ARG_BUFFER_MAX_SIZE
229 #define FW_STATEMENT_ARG_BUFFER_MAX_SIZE (FW_CMD_ARG_BUFFER_MAX_SIZE)
230 #endif
231 
232 // Specifies the maximum size of a string in a telemetry channel
233 #ifndef FW_TLM_STRING_MAX_SIZE
234 #define FW_TLM_STRING_MAX_SIZE 40
235 #endif
236 
237 // Specifies the size of the buffer that contains the serialized parameter value.
238 #ifndef FW_PARAM_BUFFER_MAX_SIZE
239 #define FW_PARAM_BUFFER_MAX_SIZE (FW_COM_BUFFER_MAX_SIZE - sizeof(FwPrmIdType) - sizeof(FwPacketDescriptorType))
240 #endif
241 
242 // Specifies the maximum size of a string in a parameter
243 #ifndef FW_PARAM_STRING_MAX_SIZE
244 #define FW_PARAM_STRING_MAX_SIZE 40
245 #endif
246 
247 // Specifies the maximum size of a file upload chunk
248 #ifndef FW_FILE_BUFFER_MAX_SIZE
249 #define FW_FILE_BUFFER_MAX_SIZE 255
250 #endif
251 
252 // Specifies the maximum size of a string in an interface call
253 #ifndef FW_INTERNAL_INTERFACE_STRING_MAX_SIZE
254 #define FW_INTERNAL_INTERFACE_STRING_MAX_SIZE 256
255 #endif
256 
257 // Enables text logging of events as well as data logging. Adds a second logging port for text output.
258 // In order to set this to 0, FPRIME_ENABLE_TEXT_LOGGERS must be set to OFF.
259 #ifndef FW_ENABLE_TEXT_LOGGING
260 #define FW_ENABLE_TEXT_LOGGING 1
261 #endif
262 
263 // Define the size of the text log string buffer. Should be large enough for format string and arguments
264 #ifndef FW_LOG_TEXT_BUFFER_SIZE
265 #define FW_LOG_TEXT_BUFFER_SIZE 256
266 #endif
267 
268 // Define if serializables have toString() method. Turning off will save code space and
269 // string constants. Must be enabled if text logging enabled
270 #ifndef FW_SERIALIZABLE_TO_STRING
271 #define FW_SERIALIZABLE_TO_STRING 1
272 #endif
273 
274 // Some settings to enable AMPCS compatibility. This breaks regular ISF GUI compatibility
275 #ifndef FW_AMPCS_COMPATIBLE
276 #define FW_AMPCS_COMPATIBLE 0
277 #endif
278 
279 // These settings configure whether or not the timebase and context values for the Fw::Time
280 // class are used. Some systems may not use or need those fields
281 
282 #ifndef FW_USE_TIME_BASE
283 #define FW_USE_TIME_BASE 1
284 #endif
285 
286 #ifndef FW_USE_TIME_CONTEXT
287 #define FW_USE_TIME_CONTEXT 1
288 #endif
289 
290 // Configuration for Fw::String
291 
292 #ifndef FW_FIXED_LENGTH_STRING_SIZE
293 #define FW_FIXED_LENGTH_STRING_SIZE 256
294 #endif
295 
296 // OS configuration
297 #ifndef FW_CONSOLE_HANDLE_MAX_SIZE
298 #define FW_CONSOLE_HANDLE_MAX_SIZE 24
299 #endif
300 
301 #ifndef FW_TASK_HANDLE_MAX_SIZE
302 #define FW_TASK_HANDLE_MAX_SIZE 24
303 #endif
304 
305 #ifndef FW_FILE_HANDLE_MAX_SIZE
306 #define FW_FILE_HANDLE_MAX_SIZE 16
307 #endif
308 
309 #ifndef FW_MUTEX_HANDLE_MAX_SIZE
310 #define FW_MUTEX_HANDLE_MAX_SIZE 72
311 #endif
312 
313 #ifndef FW_QUEUE_HANDLE_MAX_SIZE
314 #define FW_QUEUE_HANDLE_MAX_SIZE 352
315 #endif
316 
317 #ifndef FW_DIRECTORY_HANDLE_MAX_SIZE
318 #define FW_DIRECTORY_HANDLE_MAX_SIZE 16
319 #endif
320 
321 #ifndef FW_FILESYSTEM_HANDLE_MAX_SIZE
322 #define FW_FILESYSTEM_HANDLE_MAX_SIZE 16
323 #endif
324 
325 #ifndef FW_RAW_TIME_HANDLE_MAX_SIZE
326 #define FW_RAW_TIME_HANDLE_MAX_SIZE 32
327 #endif
328 
329 #ifndef FW_RAW_TIME_SERIALIZATION_MAX_SIZE
330 #define FW_RAW_TIME_SERIALIZATION_MAX_SIZE 8
331 #endif
332 
333 #ifndef FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE
334 #define FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE 56
335 #endif
336 
337 #ifndef FW_CPU_HANDLE_MAX_SIZE
338 #define FW_CPU_HANDLE_MAX_SIZE 16
339 #endif
340 
341 #ifndef FW_MEMORY_HANDLE_MAX_SIZE
342 #define FW_MEMORY_HANDLE_MAX_SIZE 16
343 #endif
344 
345 #ifndef FW_HANDLE_ALIGNMENT
346 #define FW_HANDLE_ALIGNMENT 8
347 #endif
348 
349 // Note: One buffer of this size will be stack-allocated during certain OSAL operations e.g. when copying a file
350 #ifndef FW_FILE_CHUNK_SIZE
351 #define FW_FILE_CHUNK_SIZE 512
352 #endif
353 
354 // *** NOTE configuration checks are in Fw/Cfg/ConfigCheck.cpp in order to have
355 // the type definitions in Fw/Types/BasicTypes available.
356 #ifdef __cplusplus
357 }
358 #endif
359 
360 #endif
Indicates time is processor cycle time. Not tied to external time.
Definition: FpConfig.h:31
TimeBase
Definition: FpConfig.h:29
Time as reported on workstation where software is running. For testing.
Definition: FpConfig.h:32
Don&#39;t care value for sequences. If FwTimeBaseStoreType is changed, value should be changed...
Definition: FpConfig.h:33
No time base has been established.
Definition: FpConfig.h:30