Skip to content

Commit

Permalink
Merge pull request nasa#91 from thnkslprpt/fix-90-convert-int32-retur…
Browse files Browse the repository at this point in the history
…n-codes-to-CFE_Status_t

Fix nasa#90, Convert `int32` return codes and variables to `CFE_Status_t`
  • Loading branch information
dzbaker authored May 18, 2023
2 parents ac13af6 + 2f7419d commit 9da6fb7
Show file tree
Hide file tree
Showing 20 changed files with 182 additions and 184 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: CodeQl Analysis
on:
push:
pull_request:


jobs:
codeql:
name: Codeql Analysis
uses: nasa/cFS/.github/workflows/codeql-reusable.yml@main
with:
component-path: apps/lc
component-path: apps/lc
prep: 'make prep; make -C build/tools/elf2cfetbl'
make: 'make -C build/native/default_cpu1/apps/lc'
setup: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ jobs:
format-check:
name: Run format check
uses: nasa/cFS/.github/workflows/format-check.yml@main

2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
name: Run cppcheck
uses: nasa/cFS/.github/workflows/static-analysis.yml@main
with:
strict-dir-list: './fsw'
strict-dir-list: './fsw'
10 changes: 5 additions & 5 deletions docs/dox_src/cfs_lc.dox
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

This document provides a complete specification for the commands and telemetry associated
with the CFS Limit Checker (LC) application software. The document is intended primarily
for users of the software (operations personal, test engineers, and maintenance personnel).
for users of the software (operations personnel, test engineers, and maintenance personnel).
The last section of the document, the deployment guide section, is intended for mission
developers when deploying and configuring the LC application software for a mission
flight software build environment.
Expand Down Expand Up @@ -113,7 +113,7 @@
is encountered, an event message is issued and a Relative Time Sequence (RTS) command
script may be initiated to respond to the threshold violation.

LC is a table driven application. Monitoring and response configuration data is stored in
LC is a table-driven application. Monitoring and response configuration data is stored in
definition tables that can be updated by the ground operators, while statistics on threshold
violations are stored in dump-only results tables and summarized in housekeeping data.

Expand Down Expand Up @@ -195,7 +195,7 @@
\image html LC_Monitor_Process.png "LC Monitoring Process Example Diagram"
\image latex LC_Monitor_Process.png "LC Monitoring Process Example Diagram"

Since LC is a table driven application, it's behavior is dictated by the contents of the
Since LC is a table-driven application, it's behavior is dictated by the contents of the
WDT and ADT configuration tables. To change this behavior is simply a matter of loading a
new table with modified parameters. LC will check for any pending table updates whenever
it processes a housekeeping request. If the table passes validation it will go into
Expand Down Expand Up @@ -295,11 +295,11 @@
#LC_MAX_ACTIONPOINTS. The index into this table is the same Actionpoint ID used for the
corresponding definition table entry.

The entire WDT is searched anytime a message is received that may contain watchpoints.
The entire WDT is searched any time a message is received that may contain watchpoints.
For this reason, it is important that unused entries are properly marked by setting
the WDT parameter DataType to #LC_DATA_WATCH_NOT_USED.

The entire ADT is processed anytime a sample request is received that specifies an
The entire ADT is processed any time a sample request is received that specifies an
actionpoint equal to #LC_ALL_ACTIONPOINTS. For this reason, it is important that unused
entries are properly marked by setting the ADT parameter DefaultState to
#LC_APSTATE_NOT_USED.
Expand Down
44 changes: 22 additions & 22 deletions fsw/src/lc_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/**
* @file
* The CFS Limit Checker (LC) is a table driven application
* The CFS Limit Checker (LC) is a table-driven application
* that provides telemetry monitoring and autonomous response
* capabilities to Core Flight Executive (cFE) based systems.
*/
Expand Down Expand Up @@ -179,9 +179,9 @@ void LC_AppMain(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

int32 LC_AppInit(void)
CFE_Status_t LC_AppInit(void)
{
int32 Status = CFE_SUCCESS;
CFE_Status_t Status = CFE_SUCCESS;

/*
** Zero out the global data structures...
Expand Down Expand Up @@ -229,9 +229,9 @@ int32 LC_AppInit(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

int32 LC_EvsInit(void)
CFE_Status_t LC_EvsInit(void)
{
int32 Status = CFE_SUCCESS;
CFE_Status_t Status = CFE_SUCCESS;

/*
** If an application event filter table is added
Expand All @@ -257,9 +257,9 @@ int32 LC_EvsInit(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

int32 LC_SbInit(void)
CFE_Status_t LC_SbInit(void)
{
int32 Status = CFE_SUCCESS;
CFE_Status_t Status = CFE_SUCCESS;

/*
** Initialize housekeeping packet...
Expand Down Expand Up @@ -327,9 +327,9 @@ int32 LC_SbInit(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

int32 LC_TableInit(void)
CFE_Status_t LC_TableInit(void)
{
int32 Result;
CFE_Status_t Result;

/*
** LC task use of Critical Data Store (CDS)
Expand Down Expand Up @@ -500,11 +500,11 @@ int32 LC_TableInit(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

int32 LC_CreateResultTables(void)
CFE_Status_t LC_CreateResultTables(void)
{
int32 Result;
uint32 DataSize;
uint32 OptionFlags;
CFE_Status_t Result;
uint32 DataSize;
uint32 OptionFlags;

/*
** Set "dump only" table option flags
Expand Down Expand Up @@ -575,11 +575,11 @@ int32 LC_CreateResultTables(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

int32 LC_CreateDefinitionTables(void)
CFE_Status_t LC_CreateDefinitionTables(void)
{
int32 Result;
uint32 DataSize;
uint32 OptionFlags = CFE_TBL_OPT_DEFAULT;
CFE_Status_t Result;
uint32 DataSize;
uint32 OptionFlags = CFE_TBL_OPT_DEFAULT;

/*
** If CDS is still enabled, try to register the 2 definition tables as critical
Expand Down Expand Up @@ -731,10 +731,10 @@ int32 LC_CreateDefinitionTables(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

int32 LC_CreateTaskCDS(void)
CFE_Status_t LC_CreateTaskCDS(void)
{
int32 Result;
uint32 DataSize;
CFE_Status_t Result;
uint32 DataSize;

/*
** Create CDS and try to restore Watchpoint Results Table (WRT) data
Expand Down Expand Up @@ -858,9 +858,9 @@ int32 LC_CreateTaskCDS(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

int32 LC_LoadDefaultTables(void)
CFE_Status_t LC_LoadDefaultTables(void)
{
int32 Result;
CFE_Status_t Result;

/*
** Load default watchpoint definition table (WDT)
Expand Down
16 changes: 8 additions & 8 deletions fsw/src/lc_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void LC_AppMain(void);
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
*/
int32 LC_AppInit(void);
CFE_Status_t LC_AppInit(void);

/**
* \brief Initialize Event Services
Expand All @@ -252,7 +252,7 @@ int32 LC_AppInit(void);
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
*/
int32 LC_EvsInit(void);
CFE_Status_t LC_EvsInit(void);

/**
* \brief Initialize Software Bus
Expand All @@ -267,7 +267,7 @@ int32 LC_EvsInit(void);
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
*/
int32 LC_SbInit(void);
CFE_Status_t LC_SbInit(void);

/**
* \brief Initialize Table Services (includes CDS)
Expand All @@ -286,7 +286,7 @@ int32 LC_SbInit(void);
*
* \sa LC_SAVE_TO_CDS
*/
int32 LC_TableInit(void);
CFE_Status_t LC_TableInit(void);

/**
* \brief Create Watchpoint and Actionpoint Result Tables
Expand All @@ -303,7 +303,7 @@ int32 LC_TableInit(void);
*
* \sa #LC_TableInit
*/
int32 LC_CreateResultTables(void);
CFE_Status_t LC_CreateResultTables(void);

/**
* \brief Create Watchpoint and Actionpoint Definition Tables
Expand All @@ -320,7 +320,7 @@ int32 LC_CreateResultTables(void);
*
* \sa #LC_TableInit
*/
int32 LC_CreateDefinitionTables(void);
CFE_Status_t LC_CreateDefinitionTables(void);

/**
* \brief Create Result Table and Application Data CDS Areas
Expand All @@ -337,7 +337,7 @@ int32 LC_CreateDefinitionTables(void);
*
* \sa #LC_TableInit
*/
int32 LC_CreateTaskCDS(void);
CFE_Status_t LC_CreateTaskCDS(void);

/**
* \brief Load Default Table Values
Expand All @@ -356,6 +356,6 @@ int32 LC_CreateTaskCDS(void);
*
* \sa #LC_TableInit
*/
int32 LC_LoadDefaultTables(void);
CFE_Status_t LC_LoadDefaultTables(void);

#endif
2 changes: 1 addition & 1 deletion fsw/src/lc_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void LC_SampleAPReq(const CFE_SB_Buffer_t *BufPtr)
/* Housekeeping request */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 LC_SendHkCmd(const CFE_MSG_CommandHeader_t *MsgPtr)
CFE_Status_t LC_SendHkCmd(const CFE_MSG_CommandHeader_t *MsgPtr)
{
uint16 TableIndex;
uint16 HKIndex;
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/lc_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void LC_SampleAPReq(const CFE_SB_Buffer_t *BufPtr);
* \param[in] MsgPtr Pointer to command header
*
*/
int32 LC_SendHkCmd(const CFE_MSG_CommandHeader_t *MsgPtr);
CFE_Status_t LC_SendHkCmd(const CFE_MSG_CommandHeader_t *MsgPtr);

/**
* \brief Noop command
Expand Down
5 changes: 2 additions & 3 deletions fsw/src/lc_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,8 @@ void LC_ResetWPStatsVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
/* Process a command pipe message */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 LC_AppPipe(const CFE_SB_Buffer_t *BufPtr)
CFE_Status_t LC_AppPipe(const CFE_SB_Buffer_t *BufPtr)
{
int32 Status = CFE_SUCCESS;
CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
CFE_MSG_FcnCode_t CommandCode = 0;

Expand Down Expand Up @@ -324,5 +323,5 @@ int32 LC_AppPipe(const CFE_SB_Buffer_t *BufPtr)

} /* end MessageID switch */

return Status;
return CFE_SUCCESS;
}
2 changes: 1 addition & 1 deletion fsw/src/lc_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
*/
int32 LC_AppPipe(const CFE_SB_Buffer_t *BufPtr);
CFE_Status_t LC_AppPipe(const CFE_SB_Buffer_t *BufPtr);

#endif
12 changes: 6 additions & 6 deletions fsw/src/lc_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

int32 LC_ManageTables(void)
CFE_Status_t LC_ManageTables(void)
{
int32 Result;
CFE_Status_t Result;

/*
** It is not necessary to release dump only table pointers before
Expand Down Expand Up @@ -110,9 +110,9 @@ int32 LC_ManageTables(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

int32 LC_UpdateTaskCDS(void)
CFE_Status_t LC_UpdateTaskCDS(void)
{
int32 Result;
CFE_Status_t Result;

/*
** Copy the watchpoint results table (WRT) data to CDS
Expand Down Expand Up @@ -164,9 +164,9 @@ int32 LC_UpdateTaskCDS(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

int32 LC_PerformMaintenance(void)
CFE_Status_t LC_PerformMaintenance(void)
{
int32 Result;
CFE_Status_t Result;

/*
** Manage tables - allow cFE to perform dump, update, etc.
Expand Down
6 changes: 3 additions & 3 deletions fsw/src/lc_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*
* \sa #LC_WDT_GETADDR_ERR_EID, #LC_ADT_GETADDR_ERR_EID
*/
int32 LC_ManageTables(void);
CFE_Status_t LC_ManageTables(void);

/**
* \brief Write to Critical Data Store (CDS)
Expand All @@ -60,7 +60,7 @@ int32 LC_ManageTables(void);
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
*/
int32 LC_UpdateTaskCDS(void);
CFE_Status_t LC_UpdateTaskCDS(void);

/**
* \brief Perform Routine Maintenance
Expand All @@ -82,6 +82,6 @@ int32 LC_UpdateTaskCDS(void);
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
*/
int32 LC_PerformMaintenance(void);
CFE_Status_t LC_PerformMaintenance(void);

#endif
4 changes: 2 additions & 2 deletions fsw/src/lc_watch.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void LC_CreateHashTable(void)
CFE_SB_MsgId_t MessageID;
int32 MessageLinkIndex;
int32 WatchPtTblIndex;
int32 Result;
CFE_Status_t Result;

/* Un-subscribe to any MessageID's referenced in previous Watchpoint Definition Table */
for (MessageLinkIndex = 0; MessageLinkIndex < LC_OperData.MessageIDsCount; MessageLinkIndex++)
Expand Down Expand Up @@ -148,7 +148,7 @@ LC_WatchPtList_t *LC_AddWatchpoint(CFE_SB_MsgId_t MessageID)
LC_WatchPtList_t *WatchPtLink;
bool NeedSubscription;
int32 HashTableIndex;
int32 Result;
CFE_Status_t Result;

/* Hash function converts MessageID into hash table index */
HashTableIndex = LC_GetHashTableIndex(MessageID);
Expand Down
Loading

0 comments on commit 9da6fb7

Please sign in to comment.