4141/*
4242** global data
4343*/
44- Sample_AppData_t Sample_AppData ;
44+ SAMPLE_AppData_t SAMPLE_AppData ;
4545
4646/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
4747/* SAMPLE_AppMain() -- Application entry point and main process loop */
@@ -69,22 +69,22 @@ void SAMPLE_AppMain( void )
6969 status = SAMPLE_AppInit ();
7070 if (status != CFE_SUCCESS )
7171 {
72- Sample_AppData .RunStatus = CFE_ES_RunStatus_APP_ERROR ;
72+ SAMPLE_AppData .RunStatus = CFE_ES_RunStatus_APP_ERROR ;
7373 }
7474
7575 /*
7676 ** SAMPLE Runloop
7777 */
78- while (CFE_ES_RunLoop (& Sample_AppData .RunStatus ) == true)
78+ while (CFE_ES_RunLoop (& SAMPLE_AppData .RunStatus ) == true)
7979 {
8080 /*
8181 ** Performance Log Exit Stamp
8282 */
8383 CFE_ES_PerfLogExit (SAMPLE_APP_PERF_ID );
8484
8585 /* Pend on receipt of command packet */
86- status = CFE_SB_RcvMsg (& Sample_AppData . SAMPLEMsgPtr ,
87- Sample_AppData . SAMPLE_CommandPipe ,
86+ status = CFE_SB_RcvMsg (& SAMPLE_AppData . MsgPtr ,
87+ SAMPLE_AppData . CommandPipe ,
8888 CFE_SB_PEND_FOREVER );
8989
9090 /*
@@ -94,15 +94,15 @@ void SAMPLE_AppMain( void )
9494
9595 if (status == CFE_SUCCESS )
9696 {
97- SAMPLE_ProcessCommandPacket (Sample_AppData . SAMPLEMsgPtr );
97+ SAMPLE_ProcessCommandPacket (SAMPLE_AppData . MsgPtr );
9898 }
9999 else
100100 {
101101 CFE_EVS_SendEvent (SAMPLE_PIPE_ERR_EID ,
102102 CFE_EVS_EventType_ERROR ,
103103 "SAMPLE APP: SB Pipe Read Error, App Will Exit" );
104104
105- Sample_AppData .RunStatus = CFE_ES_RunStatus_APP_ERROR ;
105+ SAMPLE_AppData .RunStatus = CFE_ES_RunStatus_APP_ERROR ;
106106 }
107107
108108 }
@@ -112,7 +112,7 @@ void SAMPLE_AppMain( void )
112112 */
113113 CFE_ES_PerfLogExit (SAMPLE_APP_PERF_ID );
114114
115- CFE_ES_ExitApp (Sample_AppData .RunStatus );
115+ CFE_ES_ExitApp (SAMPLE_AppData .RunStatus );
116116
117117} /* End of SAMPLE_AppMain() */
118118
@@ -125,43 +125,43 @@ int32 SAMPLE_AppInit( void )
125125{
126126 int32 status ;
127127
128- Sample_AppData .RunStatus = CFE_ES_RunStatus_APP_RUN ;
128+ SAMPLE_AppData .RunStatus = CFE_ES_RunStatus_APP_RUN ;
129129
130130 /*
131131 ** Initialize app command execution counters
132132 */
133- Sample_AppData .CmdCounter = 0 ;
134- Sample_AppData .ErrCounter = 0 ;
133+ SAMPLE_AppData .CmdCounter = 0 ;
134+ SAMPLE_AppData .ErrCounter = 0 ;
135135
136136 /*
137137 ** Initialize app configuration data
138138 */
139- Sample_AppData .PipeDepth = SAMPLE_PIPE_DEPTH ;
139+ SAMPLE_AppData .PipeDepth = SAMPLE_PIPE_DEPTH ;
140140
141- strcpy (Sample_AppData .PipeName , "SAMPLE_CMD_PIPE" );
141+ strcpy (SAMPLE_AppData .PipeName , "SAMPLE_CMD_PIPE" );
142142
143143 /*
144144 ** Initialize event filter table...
145145 */
146- Sample_AppData . SAMPLE_EventFilters [0 ].EventID = SAMPLE_STARTUP_INF_EID ;
147- Sample_AppData . SAMPLE_EventFilters [0 ].Mask = 0x0000 ;
148- Sample_AppData . SAMPLE_EventFilters [1 ].EventID = SAMPLE_COMMAND_ERR_EID ;
149- Sample_AppData . SAMPLE_EventFilters [1 ].Mask = 0x0000 ;
150- Sample_AppData . SAMPLE_EventFilters [2 ].EventID = SAMPLE_COMMANDNOP_INF_EID ;
151- Sample_AppData . SAMPLE_EventFilters [2 ].Mask = 0x0000 ;
152- Sample_AppData . SAMPLE_EventFilters [3 ].EventID = SAMPLE_COMMANDRST_INF_EID ;
153- Sample_AppData . SAMPLE_EventFilters [3 ].Mask = 0x0000 ;
154- Sample_AppData . SAMPLE_EventFilters [4 ].EventID = SAMPLE_INVALID_MSGID_ERR_EID ;
155- Sample_AppData . SAMPLE_EventFilters [4 ].Mask = 0x0000 ;
156- Sample_AppData . SAMPLE_EventFilters [5 ].EventID = SAMPLE_LEN_ERR_EID ;
157- Sample_AppData . SAMPLE_EventFilters [5 ].Mask = 0x0000 ;
158- Sample_AppData . SAMPLE_EventFilters [6 ].EventID = SAMPLE_PIPE_ERR_EID ;
159- Sample_AppData . SAMPLE_EventFilters [6 ].Mask = 0x0000 ;
146+ SAMPLE_AppData . EventFilters [0 ].EventID = SAMPLE_STARTUP_INF_EID ;
147+ SAMPLE_AppData . EventFilters [0 ].Mask = 0x0000 ;
148+ SAMPLE_AppData . EventFilters [1 ].EventID = SAMPLE_COMMAND_ERR_EID ;
149+ SAMPLE_AppData . EventFilters [1 ].Mask = 0x0000 ;
150+ SAMPLE_AppData . EventFilters [2 ].EventID = SAMPLE_COMMANDNOP_INF_EID ;
151+ SAMPLE_AppData . EventFilters [2 ].Mask = 0x0000 ;
152+ SAMPLE_AppData . EventFilters [3 ].EventID = SAMPLE_COMMANDRST_INF_EID ;
153+ SAMPLE_AppData . EventFilters [3 ].Mask = 0x0000 ;
154+ SAMPLE_AppData . EventFilters [4 ].EventID = SAMPLE_INVALID_MSGID_ERR_EID ;
155+ SAMPLE_AppData . EventFilters [4 ].Mask = 0x0000 ;
156+ SAMPLE_AppData . EventFilters [5 ].EventID = SAMPLE_LEN_ERR_EID ;
157+ SAMPLE_AppData . EventFilters [5 ].Mask = 0x0000 ;
158+ SAMPLE_AppData . EventFilters [6 ].EventID = SAMPLE_PIPE_ERR_EID ;
159+ SAMPLE_AppData . EventFilters [6 ].Mask = 0x0000 ;
160160
161161 /*
162162 ** Register the events
163163 */
164- status = CFE_EVS_Register (Sample_AppData . SAMPLE_EventFilters ,
164+ status = CFE_EVS_Register (SAMPLE_AppData . EventFilters ,
165165 SAMPLE_EVENT_COUNTS ,
166166 CFE_EVS_EventFilter_BINARY );
167167 if (status != CFE_SUCCESS )
@@ -174,17 +174,17 @@ int32 SAMPLE_AppInit( void )
174174 /*
175175 ** Initialize housekeeping packet (clear user data area).
176176 */
177- CFE_SB_InitMsg (& Sample_AppData . SAMPLE_HkTelemetryPkt ,
177+ CFE_SB_InitMsg (& SAMPLE_AppData . HkBuf . MsgHdr ,
178178 SAMPLE_APP_HK_TLM_MID ,
179- sizeof (sample_hk_tlm_t ),
179+ sizeof (SAMPLE_AppData . HkBuf ),
180180 true);
181181
182182 /*
183183 ** Create Software Bus message pipe.
184184 */
185- status = CFE_SB_CreatePipe (& Sample_AppData . SAMPLE_CommandPipe ,
186- Sample_AppData .PipeDepth ,
187- Sample_AppData .PipeName );
185+ status = CFE_SB_CreatePipe (& SAMPLE_AppData . CommandPipe ,
186+ SAMPLE_AppData .PipeDepth ,
187+ SAMPLE_AppData .PipeName );
188188 if (status != CFE_SUCCESS )
189189 {
190190 CFE_ES_WriteToSysLog ("Sample App: Error creating pipe, RC = 0x%08lX\n" ,
@@ -196,7 +196,7 @@ int32 SAMPLE_AppInit( void )
196196 ** Subscribe to Housekeeping request commands
197197 */
198198 status = CFE_SB_Subscribe (SAMPLE_APP_SEND_HK_MID ,
199- Sample_AppData . SAMPLE_CommandPipe );
199+ SAMPLE_AppData . CommandPipe );
200200 if (status != CFE_SUCCESS )
201201 {
202202 CFE_ES_WriteToSysLog ("Sample App: Error Subscribing to HK request, RC = 0x%08lX\n" ,
@@ -208,7 +208,7 @@ int32 SAMPLE_AppInit( void )
208208 ** Subscribe to ground command packets
209209 */
210210 status = CFE_SB_Subscribe (SAMPLE_APP_CMD_MID ,
211- Sample_AppData . SAMPLE_CommandPipe );
211+ SAMPLE_AppData . CommandPipe );
212212 if (status != CFE_SUCCESS )
213213 {
214214 CFE_ES_WriteToSysLog ("Sample App: Error Subscribing to Command, RC = 0x%08lX\n" ,
@@ -220,9 +220,9 @@ int32 SAMPLE_AppInit( void )
220220 /*
221221 ** Register Table(s)
222222 */
223- status = CFE_TBL_Register (& Sample_AppData .TblHandles [0 ],
223+ status = CFE_TBL_Register (& SAMPLE_AppData .TblHandles [0 ],
224224 "SampleTable" ,
225- sizeof (SampleTable_t ),
225+ sizeof (SAMPLE_Table_t ),
226226 CFE_TBL_OPT_DEFAULT ,
227227 SAMPLE_TblValidationFunc );
228228 if ( status != CFE_SUCCESS )
@@ -234,7 +234,7 @@ int32 SAMPLE_AppInit( void )
234234 }
235235 else
236236 {
237- status = CFE_TBL_Load (Sample_AppData .TblHandles [0 ],
237+ status = CFE_TBL_Load (SAMPLE_AppData .TblHandles [0 ],
238238 CFE_TBL_SRC_FILE ,
239239 SAMPLE_TABLE_FILE );
240240 }
@@ -306,7 +306,7 @@ void SAMPLE_ProcessGroundCommand( CFE_SB_MsgPtr_t Msg )
306306 case SAMPLE_APP_NOOP_CC :
307307 if (SAMPLE_VerifyCmdLength (Msg , sizeof (SAMPLE_Noop_t )))
308308 {
309- SAMPLE_NoopCmd ((SAMPLE_Noop_t * )Msg );
309+ SAMPLE_Noop ((SAMPLE_Noop_t * )Msg );
310310 }
311311
312312 break ;
@@ -322,7 +322,7 @@ void SAMPLE_ProcessGroundCommand( CFE_SB_MsgPtr_t Msg )
322322 case SAMPLE_APP_PROCESS_CC :
323323 if (SAMPLE_VerifyCmdLength (Msg , sizeof (SAMPLE_Process_t )))
324324 {
325- SAMPLE_ProcessCC ((SAMPLE_Process_t * )Msg );
325+ SAMPLE_Process ((SAMPLE_Process_t * )Msg );
326326 }
327327
328328 break ;
@@ -349,43 +349,43 @@ void SAMPLE_ProcessGroundCommand( CFE_SB_MsgPtr_t Msg )
349349/* telemetry, packetize it and send it to the housekeeping task via */
350350/* the software bus */
351351/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
352- void SAMPLE_ReportHousekeeping ( const CCSDS_CommandPacket_t * Msg )
352+ int32 SAMPLE_ReportHousekeeping ( const CCSDS_CommandPacket_t * Msg )
353353{
354354 int i ;
355355
356356 /*
357357 ** Get command execution counters...
358358 */
359- Sample_AppData . SAMPLE_HkTelemetryPkt . sample_command_error_count = Sample_AppData .ErrCounter ;
360- Sample_AppData . SAMPLE_HkTelemetryPkt . sample_command_count = Sample_AppData .CmdCounter ;
359+ SAMPLE_AppData . HkBuf . HkTlm . Payload . CommandErrorCounter = SAMPLE_AppData .ErrCounter ;
360+ SAMPLE_AppData . HkBuf . HkTlm . Payload . CommandCounter = SAMPLE_AppData .CmdCounter ;
361361
362362 /*
363363 ** Send housekeeping telemetry packet...
364364 */
365- CFE_SB_TimeStampMsg (( CFE_SB_Msg_t * ) & Sample_AppData . SAMPLE_HkTelemetryPkt );
366- CFE_SB_SendMsg (( CFE_SB_Msg_t * ) & Sample_AppData . SAMPLE_HkTelemetryPkt );
365+ CFE_SB_TimeStampMsg (& SAMPLE_AppData . HkBuf . MsgHdr );
366+ CFE_SB_SendMsg (& SAMPLE_AppData . HkBuf . MsgHdr );
367367
368368 /*
369369 ** Manage any pending table loads, validations, etc.
370370 */
371- for (i = 0 ; i < NUMBER_OF_TABLES ; i ++ )
371+ for (i = 0 ; i < SAMPLE_NUMBER_OF_TABLES ; i ++ )
372372 {
373- CFE_TBL_Manage (Sample_AppData .TblHandles [i ]);
373+ CFE_TBL_Manage (SAMPLE_AppData .TblHandles [i ]);
374374 }
375375
376- return ;
376+ return CFE_SUCCESS ;
377377
378378} /* End of SAMPLE_ReportHousekeeping() */
379379
380380/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
381381/* */
382- /* SAMPLE_NoopCmd -- SAMPLE NOOP commands */
382+ /* SAMPLE_Noop -- SAMPLE NOOP commands */
383383/* */
384384/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
385- void SAMPLE_NoopCmd ( const SAMPLE_Noop_t * Msg )
385+ int32 SAMPLE_Noop ( const SAMPLE_Noop_t * Msg )
386386{
387387
388- Sample_AppData .CmdCounter ++ ;
388+ SAMPLE_AppData .CmdCounter ++ ;
389389
390390 CFE_EVS_SendEvent (SAMPLE_COMMANDNOP_INF_EID ,
391391 CFE_EVS_EventType_INFORMATION ,
@@ -395,9 +395,9 @@ void SAMPLE_NoopCmd( const SAMPLE_Noop_t *Msg )
395395 SAMPLE_APP_REVISION ,
396396 SAMPLE_APP_MISSION_REV );
397397
398- return ;
398+ return CFE_SUCCESS ;
399399
400- } /* End of SAMPLE_NoopCmd */
400+ } /* End of SAMPLE_Noop */
401401
402402/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
403403/* Name: SAMPLE_ResetCounters */
@@ -407,43 +407,43 @@ void SAMPLE_NoopCmd( const SAMPLE_Noop_t *Msg )
407407/* part of the task telemetry. */
408408/* */
409409/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
410- void SAMPLE_ResetCounters ( const SAMPLE_ResetCounters_t * Msg )
410+ int32 SAMPLE_ResetCounters ( const SAMPLE_ResetCounters_t * Msg )
411411{
412412
413- Sample_AppData .CmdCounter = 0 ;
414- Sample_AppData .ErrCounter = 0 ;
413+ SAMPLE_AppData .CmdCounter = 0 ;
414+ SAMPLE_AppData .ErrCounter = 0 ;
415415
416416 CFE_EVS_SendEvent (SAMPLE_COMMANDRST_INF_EID ,
417417 CFE_EVS_EventType_INFORMATION ,
418418 "SAMPLE: RESET command" );
419419
420- return ;
420+ return CFE_SUCCESS ;
421421
422422} /* End of SAMPLE_ResetCounters() */
423423
424424/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
425- /* Name: SAMPLE_ProcessCC */
425+ /* Name: SAMPLE_Process */
426426/* */
427427/* Purpose: */
428428/* This function Process Ground Station Command */
429429/* */
430430/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
431- void SAMPLE_ProcessCC ( const SAMPLE_Process_t * Msg )
431+ int32 SAMPLE_Process ( const SAMPLE_Process_t * Msg )
432432{
433433 int32 status ;
434- SampleTable_t * TblPtr ;
434+ SAMPLE_Table_t * TblPtr ;
435435 const char * TableName = "SAMPLE_APP.SampleTable" ;
436436
437437 /* Sample Use of Table */
438438
439439 status = CFE_TBL_GetAddress ((void * )& TblPtr ,
440- Sample_AppData .TblHandles [0 ]);
440+ SAMPLE_AppData .TblHandles [0 ]);
441441
442442 if (status != CFE_SUCCESS )
443443 {
444444 CFE_ES_WriteToSysLog ("Sample App: Fail to get table address: 0x%08lx" ,
445445 (unsigned long )status );
446- return ;
446+ return status ;
447447 }
448448
449449 CFE_ES_WriteToSysLog ("Sample App: Table Value 1: %d Value 2: %d" ,
@@ -455,7 +455,7 @@ void SAMPLE_ProcessCC( const SAMPLE_Process_t *Msg )
455455 /* Invoke a function provided by SAMPLE_LIB */
456456 SAMPLE_Function ();
457457
458- return ;
458+ return CFE_SUCCESS ;
459459
460460} /* End of SAMPLE_ProcessCC */
461461
@@ -488,7 +488,7 @@ bool SAMPLE_VerifyCmdLength( CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength )
488488
489489 result = false;
490490
491- Sample_AppData .ErrCounter ++ ;
491+ SAMPLE_AppData .ErrCounter ++ ;
492492 }
493493
494494 return ( result );
@@ -504,7 +504,7 @@ bool SAMPLE_VerifyCmdLength( CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength )
504504int32 SAMPLE_TblValidationFunc ( void * TblData )
505505{
506506 int32 ReturnCode = CFE_SUCCESS ;
507- SampleTable_t * TblDataPtr = (SampleTable_t * )TblData ;
507+ SAMPLE_Table_t * TblDataPtr = (SAMPLE_Table_t * )TblData ;
508508
509509 /*
510510 ** Sample Table Validation
0 commit comments