Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #78, Convert int32 return codes and variables to CFE_Status_t #79

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codeql-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CodeQl Analysis
on:
push:
pull_request:


jobs:
codeql:
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'
25 changes: 14 additions & 11 deletions fsw/inc/cs_tbldefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ typedef struct
* \retval #CFE_SUCCESS \copydoc CFE_SUCCESS
* \retval #CS_TABLE_ERROR \copydoc CS_TABLE_ERROR
*/
int32 CS_ValidateEepromChecksumDefinitionTable(void *TblPtr);
CFE_Status_t CS_ValidateEepromChecksumDefinitionTable(void *TblPtr);

/**
* \brief Validate Memory definition table
Expand All @@ -180,7 +180,7 @@ int32 CS_ValidateEepromChecksumDefinitionTable(void *TblPtr);
* \retval #CFE_SUCCESS \copydoc CFE_SUCCESS
* \retval #CS_TABLE_ERROR \copydoc CS_TABLE_ERROR
*/
int32 CS_ValidateMemoryChecksumDefinitionTable(void *TblPtr);
CFE_Status_t CS_ValidateMemoryChecksumDefinitionTable(void *TblPtr);

/**
* \brief Validate Tables definition table
Expand All @@ -198,7 +198,7 @@ int32 CS_ValidateMemoryChecksumDefinitionTable(void *TblPtr);
* \retval #CFE_SUCCESS \copydoc CFE_SUCCESS
* \retval #CS_TABLE_ERROR \copydoc CS_TABLE_ERROR
*/
int32 CS_ValidateTablesChecksumDefinitionTable(void *TblPtr);
CFE_Status_t CS_ValidateTablesChecksumDefinitionTable(void *TblPtr);

/**
* \brief Validate App definition table
Expand All @@ -216,7 +216,7 @@ int32 CS_ValidateTablesChecksumDefinitionTable(void *TblPtr);
* \retval #CFE_SUCCESS \copydoc CFE_SUCCESS
* \retval #CS_TABLE_ERROR \copydoc CS_TABLE_ERROR
*/
int32 CS_ValidateAppChecksumDefinitionTable(void *TblPtr);
CFE_Status_t CS_ValidateAppChecksumDefinitionTable(void *TblPtr);

/**
* \brief Processes a new definition table for EEPROM or Memory tables
Expand Down Expand Up @@ -363,11 +363,12 @@ void CS_ProcessNewAppDefinitionTable(const CS_Def_App_Table_Entry_t *DefinitionT
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
*/
int32 CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handle_t *ResultsTableHandle,
void *DefinitionTblPtr, void *ResultsTblPtr, const uint16 Table, const char *DefinitionTableName,
const char *ResultsTableName, const uint16 NumEntries, const char *DefinitionTableFileName,
const void *DefaultDefTableAddress, const uint16 SizeofDefinitionTableEntry,
const uint16 SizeofResultsTableEntry, const CFE_TBL_CallbackFuncPtr_t CallBackFunction);
CFE_Status_t CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handle_t *ResultsTableHandle,
void *DefinitionTblPtr, void *ResultsTblPtr, const uint16 Table,
const char *DefinitionTableName, const char *ResultsTableName, const uint16 NumEntries,
const char *DefinitionTableFileName, const void *DefaultDefTableAddress,
const uint16 SizeofDefinitionTableEntry, const uint16 SizeofResultsTableEntry,
const CFE_TBL_CallbackFuncPtr_t CallBackFunction);

/**
* \brief Handles table updates for all CS tables
Expand Down Expand Up @@ -398,7 +399,9 @@ int32 CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handle_t *Re
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
*/
int32 CS_HandleTableUpdate(void *DefinitionTblPtr, void *ResultsTblPtr, const CFE_TBL_Handle_t DefinitionTableHandle,
const CFE_TBL_Handle_t ResultsTableHandle, const uint16 Table, const uint16 NumEntries);
CFE_Status_t CS_HandleTableUpdate(void *DefinitionTblPtr, void *ResultsTblPtr,
const CFE_TBL_Handle_t DefinitionTableHandle,
const CFE_TBL_Handle_t ResultsTableHandle, const uint16 Table,
const uint16 NumEntries);

#endif
22 changes: 11 additions & 11 deletions fsw/src/cs_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ CS_AppData_t CS_AppData;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_AppMain(void)
{
int32 Result = 0;
CFE_Status_t Result = 0;
CFE_SB_Buffer_t *BufPtr = NULL;

/* Performance Log (start time counter) */
Expand Down Expand Up @@ -145,9 +145,9 @@ void CS_AppMain(void)
/* CS Application initialization function */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 CS_AppInit(void)
CFE_Status_t CS_AppInit(void)
{
int32 Result = CFE_SUCCESS;
CFE_Status_t Result = CFE_SUCCESS;

/* Register for event services */
Result = CFE_EVS_Register(NULL, 0, 0);
Expand Down Expand Up @@ -219,10 +219,10 @@ int32 CS_AppInit(void)
/* CS's command pipe processing */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 CS_AppPipe(const CFE_SB_Buffer_t *BufPtr)
CFE_Status_t CS_AppPipe(const CFE_SB_Buffer_t *BufPtr)
{
CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
int32 Result = CFE_SUCCESS;
CFE_Status_t Result = CFE_SUCCESS;

CFE_MSG_GetMsgId(&BufPtr->Msg, &MessageID);

Expand Down Expand Up @@ -492,12 +492,12 @@ void CS_HousekeepingCmd(const CS_NoArgsCmd_t *CmdPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

int32 CS_CreateRestoreStatesFromCDS(void)
CFE_Status_t CS_CreateRestoreStatesFromCDS(void)
{
/* Store task ena/dis state of tables in CDS */
uint8 DataStoreBuffer[CS_NUM_DATA_STORE_STATES];
int32 Result;
int32 EventId = 0;
uint8 DataStoreBuffer[CS_NUM_DATA_STORE_STATES];
CFE_Status_t Result;
int32 EventId = 0;

memset(DataStoreBuffer, 0, sizeof(DataStoreBuffer));

Expand Down Expand Up @@ -589,8 +589,8 @@ int32 CS_CreateRestoreStatesFromCDS(void)
void CS_UpdateCDS(void)
{
/* Store table ena/dis state in CDS */
uint8 DataStoreBuffer[CS_NUM_DATA_STORE_STATES];
int32 Result;
uint8 DataStoreBuffer[CS_NUM_DATA_STORE_STATES];
CFE_Status_t Result;

/*
** Handle is defined when CDS is active...
Expand Down
7 changes: 3 additions & 4 deletions fsw/src/cs_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
* \name CS Error Codes
* \{
*/
#define CS_SUCCESS 0 /**< \brief Success return code when a checksum compare did not fail */
#define CS_ERROR (-1) /**< \brief Error code returned when a checksum compare failed */
#define CS_ERR_NOT_FOUND (-2) /**< \brief Error code returned the app or table requested could not be found */
#define CS_TABLE_ERROR (-3) /**< \brief Error code returned on table validation error */
Expand Down Expand Up @@ -237,7 +236,7 @@ void CS_UpdateCDS(void);
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
*/
int32 CS_AppInit(void);
CFE_Status_t CS_AppInit(void);

/**
* \brief Process a command pipe message
Expand All @@ -258,7 +257,7 @@ int32 CS_AppInit(void);
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
*/
int32 CS_AppPipe(const CFE_SB_Buffer_t *BufPtr);
CFE_Status_t CS_AppPipe(const CFE_SB_Buffer_t *BufPtr);

/**
* \brief Process housekeeping request
Expand Down Expand Up @@ -298,7 +297,7 @@ void CS_ProcessCmd(const CFE_SB_Buffer_t *BufPtr);
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
*/
int32 CS_CreateRestoreStatesFromCDS(void);
CFE_Status_t CS_CreateRestoreStatesFromCDS(void);
#endif

#endif
2 changes: 1 addition & 1 deletion fsw/src/cs_app_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void CS_RecomputeBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr)
size_t ExpectedLength = sizeof(CS_AppNameCmd_t);

CFE_ES_TaskId_t ChildTaskID;
int32 Status;
CFE_Status_t Status;
CS_Res_App_Table_Entry_t *ResultsEntry;
char Name[OS_MAX_API_NAME];

Expand Down
10 changes: 5 additions & 5 deletions fsw/src/cs_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ void CS_RecomputeBaselineCfeCoreCmd(const CS_NoArgsCmd_t *CmdPtr)
/* command verification variables */
size_t ExpectedLength = sizeof(CS_NoArgsCmd_t);
CFE_ES_TaskId_t ChildTaskID;
int32 Status;
CFE_Status_t Status;

/* Verify command packet length... */
if (CS_VerifyCmdLength(&CmdPtr->CmdHeader.Msg, ExpectedLength))
Expand Down Expand Up @@ -475,7 +475,7 @@ void CS_RecomputeBaselineOSCmd(const CS_NoArgsCmd_t *CmdPtr)
/* command verification variables */
size_t ExpectedLength = sizeof(CS_NoArgsCmd_t);
CFE_ES_TaskId_t ChildTaskID;
int32 Status;
CFE_Status_t Status;

/* Verify command packet length... */
if (CS_VerifyCmdLength(&CmdPtr->CmdHeader.Msg, ExpectedLength))
Expand Down Expand Up @@ -527,7 +527,7 @@ void CS_OneShotCmd(const CS_OneShotCmd_t *CmdPtr)
/* command verification variables */
size_t ExpectedLength = sizeof(CS_OneShotCmd_t);
CFE_ES_TaskId_t ChildTaskID;
int32 Status;
CFE_Status_t Status;

/* Verify command packet length... */
if (CS_VerifyCmdLength(&CmdPtr->CmdHeader.Msg, ExpectedLength))
Expand Down Expand Up @@ -606,8 +606,8 @@ void CS_OneShotCmd(const CS_OneShotCmd_t *CmdPtr)
void CS_CancelOneShotCmd(const CS_NoArgsCmd_t *CmdPtr)
{
/* command verification variables */
size_t ExpectedLength = sizeof(CS_NoArgsCmd_t);
int32 Status;
size_t ExpectedLength = sizeof(CS_NoArgsCmd_t);
CFE_Status_t Status;

/* Verify command packet length... */
if (CS_VerifyCmdLength(&CmdPtr->CmdHeader.Msg, ExpectedLength))
Expand Down
66 changes: 33 additions & 33 deletions fsw/src/cs_compute.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@
/* and cFE core code segments */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 CS_ComputeEepromMemory(CS_Res_EepromMemory_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue,
bool *DoneWithEntry)
CFE_Status_t CS_ComputeEepromMemory(CS_Res_EepromMemory_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue,
bool *DoneWithEntry)
{
uint32 OffsetIntoCurrEntry = 0;
cpuaddr FirstAddrThisCycle = 0;
uint32 NumBytesThisCycle = 0;
int32 NumBytesRemainingCycles = 0;
uint32 NewChecksumValue = 0;
int32 Status = CS_SUCCESS;
*DoneWithEntry = false;
uint32 OffsetIntoCurrEntry = 0;
cpuaddr FirstAddrThisCycle = 0;
uint32 NumBytesThisCycle = 0;
int32 NumBytesRemainingCycles = 0;
uint32 NewChecksumValue = 0;
CFE_Status_t Status = CFE_SUCCESS;
*DoneWithEntry = false;

/* By the time we get here, we know we have an enabled entry */

Expand Down Expand Up @@ -116,18 +116,18 @@ int32 CS_ComputeEepromMemory(CS_Res_EepromMemory_Table_Entry_t *ResultsEntry, ui
/* CS function that computes the checksum for Tables */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 CS_ComputeTables(CS_Res_Tables_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry)
CFE_Status_t CS_ComputeTables(CS_Res_Tables_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry)
{
uint32 OffsetIntoCurrEntry = 0;
cpuaddr FirstAddrThisCycle = 0;
uint32 NumBytesThisCycle = 0;
int32 NumBytesRemainingCycles = 0;
uint32 NewChecksumValue = 0;
int32 Status = CS_SUCCESS;
int32 Result = CS_SUCCESS;
int32 ResultShare = 0;
int32 ResultGetInfo = 0;
int32 ResultGetAddress = 0;
uint32 OffsetIntoCurrEntry = 0;
cpuaddr FirstAddrThisCycle = 0;
uint32 NumBytesThisCycle = 0;
int32 NumBytesRemainingCycles = 0;
uint32 NewChecksumValue = 0;
CFE_Status_t Status = CFE_SUCCESS;
CFE_Status_t Result = CFE_SUCCESS;
CFE_Status_t ResultShare = 0;
CFE_Status_t ResultGetInfo = 0;
CFE_Status_t ResultGetAddress = 0;

/* variables to get the table address */
CFE_TBL_Handle_t LocalTblHandle = CFE_TBL_BAD_TABLE_HANDLE;
Expand Down Expand Up @@ -304,18 +304,18 @@ int32 CS_ComputeTables(CS_Res_Tables_Table_Entry_t *ResultsEntry, uint32 *Comput
/* CS function that computes the checksum for Apps */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry)
CFE_Status_t CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry)
{
uint32 OffsetIntoCurrEntry = 0;
cpuaddr FirstAddrThisCycle = 0;
uint32 NumBytesThisCycle = 0;
int32 NumBytesRemainingCycles = 0;
uint32 NewChecksumValue = 0;
int32 Status = CS_SUCCESS;
int32 Result;
int32 ResultGetResourceID = CS_ERROR;
int32 ResultGetResourceInfo = CS_ERROR;
int32 ResultAddressValid = false;
uint32 OffsetIntoCurrEntry = 0;
cpuaddr FirstAddrThisCycle = 0;
uint32 NumBytesThisCycle = 0;
int32 NumBytesRemainingCycles = 0;
uint32 NewChecksumValue = 0;
CFE_Status_t Status = CFE_SUCCESS;
CFE_Status_t Result;
CFE_Status_t ResultGetResourceID = CS_ERROR;
CFE_Status_t ResultGetResourceInfo = CS_ERROR;
int32 ResultAddressValid = false;

/* variables to get applications address */
CFE_ResourceId_t ResourceID = CFE_RESOURCEID_UNDEFINED;
Expand Down Expand Up @@ -573,7 +573,7 @@ void CS_RecomputeAppChildTask(void)
CS_Res_App_Table_Entry_t *ResultsEntry = NULL;
uint16 PreviousState = CS_STATE_EMPTY;
bool DoneWithEntry = false;
int32 Status = CS_ERROR;
CFE_Status_t Status = CS_ERROR;
uint16 PreviousDefState = CS_STATE_EMPTY;
bool DefEntryFound = false;
uint16 DefEntryID = 0;
Expand Down Expand Up @@ -679,7 +679,7 @@ void CS_RecomputeTablesChildTask(void)
CS_Res_Tables_Table_Entry_t *ResultsEntry = NULL;
uint16 PreviousState = CS_STATE_EMPTY;
bool DoneWithEntry = false;
int32 Status = CS_ERROR;
CFE_Status_t Status = CS_ERROR;
uint16 PreviousDefState = CS_STATE_EMPTY;
bool DefEntryFound = false;
uint16 DefEntryID = 0;
Expand Down
14 changes: 7 additions & 7 deletions fsw/src/cs_compute.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@
* completed during this call.
*
* \return Execution status
* \retval #CS_SUCCESS \copybrief CS_SUCCESS
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
* \retval #CS_ERROR \copybrief CS_ERROR
*/
int32 CS_ComputeEepromMemory(CS_Res_EepromMemory_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue,
bool *DoneWithEntry);
CFE_Status_t CS_ComputeEepromMemory(CS_Res_EepromMemory_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue,
bool *DoneWithEntry);

/**
* \brief Computes checksums on tables
Expand All @@ -86,11 +86,11 @@ int32 CS_ComputeEepromMemory(CS_Res_EepromMemory_Table_Entry_t *ResultsEntry, ui
* completed during this call.
*
* \return Execution status
* \retval #CS_SUCCESS \copybrief CS_SUCCESS
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
* \retval #CS_ERROR \copybrief CS_ERROR
* \retval #CS_ERR_NOT_FOUND \copydoc CS_ERR_NOT_FOUND
*/
int32 CS_ComputeTables(CS_Res_Tables_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry);
CFE_Status_t CS_ComputeTables(CS_Res_Tables_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry);

/**
* \brief Computes checksums on applications
Expand All @@ -115,11 +115,11 @@ int32 CS_ComputeTables(CS_Res_Tables_Table_Entry_t *ResultsEntry, uint32 *Comput
* completed during this call.
*
* \return Execution status
* \retval #CS_SUCCESS \copybrief CS_SUCCESS
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
* \retval #CS_ERROR \copybrief CS_ERROR
* \retval #CS_ERR_NOT_FOUND \copydoc CS_ERR_NOT_FOUND
*/
int32 CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry);
CFE_Status_t CS_ComputeApp(CS_Res_App_Table_Entry_t *ResultsEntry, uint32 *ComputedCSValue, bool *DoneWithEntry);

/**
* \brief Child task main function for recomputing baselines for
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/cs_eeprom_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void CS_RecomputeBaselineEepromCmd(const CS_EntryCmd_t *CmdPtr)
size_t ExpectedLength = sizeof(CS_EntryCmd_t);

CFE_ES_TaskId_t ChildTaskID = CFE_ES_TASKID_UNDEFINED;
int32 Status = CS_ERROR;
CFE_Status_t Status = CS_ERROR;
uint16 EntryID = 0;
uint16 State = CS_STATE_EMPTY;

Expand Down
Loading