Skip to content

Commit eff974a

Browse files
authored
Merge pull request #49 from jphickey/fix-45-dispatch
Fix #45, use separate dispatcher for messages
2 parents 550f908 + 0d1ccc1 commit eff974a

17 files changed

+719
-771
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ project(CFS_HK C)
22

33
set(APP_SRC_FILES
44
fsw/src/hk_app.c
5+
fsw/src/hk_dispatch.c
56
fsw/src/hk_utils.c
67
)
78

docs/dox_src/cfs_hk.dox

+57-57
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@
5353
<H2> Scope </H2>
5454

5555
This document provides a complete specification for the commands and telemetry associated
56-
with the CFS Housekeeping (HK) application software. The document is intended primarily
57-
for users of the software (operations personal, test engineers, and maintenance personnel).
58-
The last section of the document, the deployment guide section, is intended for mission
59-
developers when deploying and configuring the FM application software for a mission
60-
flight software build environment.
56+
with the CFS Housekeeping (HK) application software. The document is intended primarily
57+
for users of the software (operations personal, test engineers, and maintenance personnel).
58+
The last section of the document, the deployment guide section, is intended for mission
59+
developers when deploying and configuring the FM application software for a mission
60+
flight software build environment.
6161

6262
\ref cfshkversion
6363

@@ -121,16 +121,16 @@
121121
The HK Application is a passive application and is completely packet driven.
122122
There are no timers used to wake up the application. The housekeeping request
123123
commands are not sent to the system apps by HK. A common system design uses the
124-
Scheduler (SCH) Application to send the housekeeping
124+
Scheduler (SCH) Application to send the housekeeping
125125
requests to the system apps as well as the send-output-message-x command to HK.
126126

127-
A key component that is part of the HK application is the 'copy table'. The copy
127+
A key component that is part of the HK application is the 'copy table'. The copy
128128
table has a configurable number of entries. Each entry specifies a source (via
129-
msgid and offset into the packet), destination (via msgid and offset) and a
129+
msgid and offset into the packet), destination (via msgid and offset) and a
130130
number of bytes to copy.
131131

132132
<H2> HK Design Overview </H2>
133-
133+
134134
The HK Application has a single Software Bus pipe and wakes
135135
up only when a message is received on the pipe (named HK_CMD_PIPE). The
136136
HK_CMD_PIPE receives commands and input messages. If the message received
@@ -144,10 +144,10 @@
144144
than one area in the same output packet. The number of output packets is also
145145
limited only by the the number of entries in the table. The number of entries in
146146
the table is a platform configuration parameter.
147-
148-
The output messages are sent to the software bus when HK receives the
149-
'Send Output Message x' command. Where 'x' is a parameter in the command that
150-
specifies the message ID of the output message to send. If a piece of data is
147+
148+
The output messages are sent to the software bus when HK receives the
149+
'Send Output Message x' command. Where 'x' is a parameter in the command that
150+
specifies the message ID of the output message to send. If a piece of data is
151151
missing in the output message at the time the 'Send Output Message x' command
152152
is received, the HK app will send a debug event (which is filtered by default)
153153
and increment the 'missing data counter' in telemetry.
@@ -158,45 +158,45 @@
158158

159159
The operational interface of the HK application consists of two commands, two
160160
tables and a few telemetry points. The following items detail the operational
161-
interface.
161+
interface.
162162

163163
<H2>1. The application version number</H2>
164-
164+
165165
The application version number is displayed in the initialization event and the
166166
no-op event. Both events are 'informational' type and are unfiltered by default.
167167

168168
<H2>2. Loading the copy table</H2>
169-
169+
170170
The copy table is loaded by way of a file. The file must be present when the
171171
application starts up. Otherwise, the app will terminate after initialization.
172172
The location of the file is specified by the platform configuration parameter
173-
named #HK_COPY_TABLE_FILENAME. The value of this define specifies the full
173+
named #HK_COPY_TABLE_FILENAME. The value of this define specifies the full
174174
path as well as the filename.
175-
176-
After initialization, a new copy table may be loaded at any time. The steps to
175+
176+
After initialization, a new copy table may be loaded at any time. The steps to
177177
load a new copy table are:
178178
- Transfer the table file to the on-board file system
179179
- Send the #CFE_TBL_LOAD_CC \copybrief CFE_TBL_LOAD_CC
180180
- Send the #CFE_TBL_VALIDATE_CC \copybrief CFE_TBL_VALIDATE_CC
181181
- Send the #CFE_TBL_ACTIVATE_CC \copybrief CFE_TBL_ACTIVATE_CC
182-
182+
183183
The HK application will clean up the items used for the old table (such as SB
184184
subscriptions) before updating and processing the new table.
185185

186186
<H2>3. Sending the No-op Command</H2>
187-
187+
188188
To verify connectivity with the Housekeeping application, the ground may send an
189189
#HK_NOOP_CC \copybrief HK_NOOP_CC
190190

191-
If the packet length field in the
192-
command is set to the value expected by the HK app, then the command counter will
191+
If the packet length field in the
192+
command is set to the value expected by the HK app, then the command counter will
193193
increment and a #HK_NOOP_CMD_EID event message
194194
will be sent. This no-op event will show the version number of the HK application.
195-
195+
196196
<H2>4. Sending the reset counters command</H2>
197-
198-
The #HK_RESET_CC \copybrief HK_RESET_CC will reset counters in telemetry.
199-
197+
198+
The #HK_RESET_COUNTERS_CC \copybrief HK_RESET_COUNTERS_CC will reset counters in telemetry.
199+
200200
<H2>5. Monitoring the command counter</H2>
201201

202202
The #HK_HkTlm_Payload_t.CmdCounter will increment only
@@ -208,7 +208,7 @@
208208
b. Unexpected packet length field for #HK_SEND_COMBINED_PKT_MID command
209209
c. Unexpected packet length field for #HK_SEND_HK_MID command
210210
d. Unexpected packet length field for #HK_NOOP_CC command
211-
e. Unexpected packet length field for #HK_RESET_CC command
211+
e. Unexpected packet length field for #HK_RESET_COUNTERS_CC command
212212

213213
<H2>7. Monitoring the 'Combined Packets Sent" counter</H2>
214214

@@ -229,12 +229,12 @@
229229
The #HK_HkTlm_Payload_t.MissingDataCtr will advance
230230
by one count (at most) and send one event (at most) for each
231231
#HK_SEND_COMBINED_PKT_MID.
232-
232+
233233
The HK app will not zero-out or alter the missing data section(s) in any way.
234234
The missing data values will match the last 'good' section received.
235235

236236
<H2>9. Using the Memory Pool handle to get mempool stats</H2>
237-
237+
238238
The HK memory pool is used to allocate the memory needed to store the output
239239
packets. Each time a new copy table is processed, the memory for the output
240240
packets is dynamically allocated from the memory pool. The memory pool handle is
@@ -248,30 +248,30 @@
248248
\page cfshkdg CFS Housekeeping Deployment Guide
249249

250250
Follow the general guidelines below for platform deployment of the Housekeeping app.
251-
251+
252252
There are two message IDs that must be included in the CFS Scheduler Table:
253253
#HK_SEND_HK_MID is sent out at the housekeeping request interval. The housekeeping app must send its
254254
housekeeping data to itself like any other app.
255255
#HK_SEND_COMBINED_PKT_MID is sent out at the desired rate for each combined packet. UP to four
256256
combined packets are available.
257-
257+
258258
The HK app can build up to four combined packets based on the definitions supplied in the
259-
HK copy table. The Scheduler Table uses each telemetry IDs (#HK_COMBINED_PKT1_MID ,
259+
HK copy table. The Scheduler Table uses each telemetry IDs (#HK_COMBINED_PKT1_MID ,
260260
#HK_COMBINED_PKT2_MID , #HK_COMBINED_PKT3_MID , and #HK_COMBINED_PKT4_MID ) as a valid parameter
261261
in the #HK_SEND_COMBINED_PKT_MID table entries.
262-
262+
263263
The ES app uses the HK performance ID, #HK_APPMAIN_PERF_ID , to keep track of the performance
264264
of the HK app.
265-
266-
The platform configuration file hk_platform_cfg.h contains parameters that can be adjusted to
265+
266+
The platform configuration file hk_platform_cfg.h contains parameters that can be adjusted to
267267
specific platforms. See \ref cfshkplatformcfg.
268268

269269
See \ref cfshkmissioncfg for mission configuration parameters.
270270
**/
271271

272272
/**
273273
\page cfshktbl CFS Housekeeping Table Definitions
274-
274+
275275
The Housekeeping Application uses two tables. A load-dump table referred to as
276276
the "copy table" and a dump-only table referred to as the "run-time table". Each
277277
table has the same number of entries, defined by the configuration parameter
@@ -281,12 +281,12 @@
281281
tables were chosen so that checksumming can be executed on the more-static copy
282282
table.
283283

284-
<B>HK Copy Table Validation</B> - The HK copy table currently has an empty validation
285-
call-back function that always returns success. At the time of development,
284+
<B>HK Copy Table Validation</B> - The HK copy table currently has an empty validation
285+
call-back function that always returns success. At the time of development,
286286
a validation process that would apply to all projects was not perceived.
287287

288288
<B>HK Copy Table Entries</B> - Entries follow the concept of:
289-
<I>Copy A bytes from input message B, byte-offset C to output message Y,
289+
<I>Copy A bytes from input message B, byte-offset C to output message Y,
290290
byte-offset Z. </I>
291291

292292
The structure format of a single copy table entry is defined by #hk_copy_table_entry_t.
@@ -309,7 +309,7 @@
309309
/**
310310
\page cfshkcons CFS Housekeeping Constraints
311311

312-
The Housekeeping Application needs to find a valid table at the location
312+
The Housekeeping Application needs to find a valid table at the location
313313
specified by the configuration parameter #HK_COPY_TABLE_FILENAME in order to
314314
startup. Otherwise the application will send an error event or syslog message
315315
then terminate. See \ref cfshktbl for more detail.
@@ -323,10 +323,10 @@
323323
\page cfshkfaqs CFS Housekeeping Frequently Asked Questions
324324

325325
<B> (Q)
326-
Does the protocol for collecting telemetry use a single housekeeping request
326+
Does the protocol for collecting telemetry use a single housekeeping request
327327
command for all apps or a unique housekeeping request command for each app?
328328
</B> <BR> <BR> <I>
329-
It is unknown to the HK application because HK does not send the
329+
It is unknown to the HK application because HK does not send the
330330
housekeeping request command(s). These commands are usually sent by the
331331
scheduler. However, each CFS application is capable of receiving a unique
332332
housekeeping request command. The message ID of this command is specified in the
@@ -336,15 +336,15 @@
336336
housekeeping request commands for each app or using a single command for all
337337
apps. In the latter case, all the defines would be set to the same value.
338338
</I>
339-
339+
340340
<B> (Q)
341341
What is the basic flow of the application?
342342
</B> <BR> <BR> <I>
343-
The HK application uses a common application format. When the app starts,
343+
The HK application uses a common application format. When the app starts,
344344
initialization is performed, then the app enters an infinite loop waiting for
345345
commands from the software bus.
346346
</I>
347-
347+
348348
<B> (Q)
349349
In general, what is done during initialization?
350350
</B> <BR> <BR> <I>
@@ -356,24 +356,24 @@
356356
variables. If any error is encountered during initialization, the application
357357
will send an event or syslog message, then terminate.
358358
</I>
359-
359+
360360
<B> (Q)
361-
How does the app react if the file to load the copy table (during
361+
How does the app react if the file to load the copy table (during
362362
initialization) is not found?
363363
</B> <BR> <BR> <I>
364364
HK will send an error event or a syslog message, then terminate.
365365
</I>
366-
366+
367367
<B> (Q)
368-
At what frequency is the housekeeping request command sent to the system
368+
At what frequency is the housekeeping request command sent to the system
369369
applications?
370370
</B> <BR> <BR> <I>
371371
The HK application does not send the housekeeping request command to the
372-
system applications. The frequency of the housekeeping request commands is
373-
typically specified in the scheduler table and sent by the scheduler
372+
system applications. The frequency of the housekeeping request commands is
373+
typically specified in the scheduler table and sent by the scheduler
374374
application.
375375
</I>
376-
376+
377377
<B> (Q)
378378
What factor controls the input message timing?
379379
</B> <BR> <BR> <I>
@@ -382,7 +382,7 @@
382382
command(s). The housekeeping request command(s) are not sent by the HK
383383
application. Rather, it is typically sent by the scheduler application.
384384
</I>
385-
385+
386386
<B> (Q)
387387
What determines the timing of the combined output messages?
388388
</B> <BR> <BR> <I>
@@ -391,12 +391,12 @@
391391
command periodically. Where 'x' is a parameter in the command that specifies the
392392
message ID of the output message to send.
393393
</I>
394-
394+
395395
<B> (Q)
396396
How is the format of the combined output messages defined?
397397
</B> <BR> <BR> <I>
398-
The output message format is defined by the entries in the copy table. If a
399-
format change to one or more output messages is needed, a new table must be
398+
The output message format is defined by the entries in the copy table. If a
399+
format change to one or more output messages is needed, a new table must be
400400
loaded.
401401
</I>
402402
**/

fsw/inc/hk_msg.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ typedef struct
7373
/**
7474
* \brief No-Operation command packet structure
7575
*
76-
* For command details see #HK_RESET_CC
76+
* For command details see #HK_RESET_COUNTERS_CC
7777
*/
7878
typedef struct
7979
{

fsw/inc/hk_msgdefs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
* to be designed such that they react to changes in the counter
8787
* values that are reset by this command.
8888
*/
89-
#define HK_RESET_CC 1
89+
#define HK_RESET_COUNTERS_CC 1
9090

9191
/**\}*/
9292

0 commit comments

Comments
 (0)