Skip to content
Open
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
10 changes: 5 additions & 5 deletions fsw/inc/cs_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@
* \par Cause:
*
* This event message is issued when a report baseline
* for the EEPROM entry specifiedcommand has been received
* for the EEPROM entry specified command has been received
* and there is a baseline computed to report.
*/
#define CS_BASELINE_EEPROM_INF_EID 39
Expand Down Expand Up @@ -603,7 +603,7 @@
*
* \par Type: INFORMATION
*
* \par Cause:invalid
* \par Cause:
*
* This event message is issued when an enable EEPROM Entry ID
* command is accepted.
Expand Down Expand Up @@ -712,7 +712,7 @@
* \par Cause:
*
* This event message is issued when a report baseline
* for the Memory entry specifiedcommand has been received
* for the Memory entry specified command has been received
* and there is a baseline computed to report.
*/
#define CS_BASELINE_MEMORY_INF_EID 54
Expand Down Expand Up @@ -912,7 +912,7 @@
* \par Cause:
*
* This event message is issued when a report baseline
* for the Tables entry specifiedcommand has been received
* for the Tables entry specified command has been received
* and there is a baseline computed to report.
*/
#define CS_BASELINE_TABLES_INF_EID 69
Expand Down Expand Up @@ -1458,7 +1458,7 @@
/***********************************************************************************************/

/**
* \brief CS Software Buse Create Pipe Failed Event ID
* \brief CS Software Bus Create Pipe Failed Event ID
*
* \par Type: ERROR
*
Expand Down
6 changes: 3 additions & 3 deletions fsw/inc/cs_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ typedef struct
uint8 AppCSState; /**< \brief CS App table checksum state */
uint8 TablesCSState; /**< \brief CS Tables table checksum state */
uint8 OSCSState; /**< \brief OS code segment checksum state */
uint8 CfeCoreCSState; /**< \brief cFE Core code segment checksum stat e*/
uint8 CfeCoreCSState; /**< \brief cFE Core code segment checksum state*/
uint8 RecomputeInProgress; /**< \brief CS "Recompute In Progress" flag */
uint8 OneShotInProgress; /**< \brief CS "OneShot In Progress" flag */
uint8 Filler8; /**< \brief 8 bit padding */
Expand All @@ -54,12 +54,12 @@ typedef struct
uint16 AppCSErrCounter; /**< \brief App miscompare counter */
uint16 TablesCSErrCounter; /**< \brief Tables miscompare counter */
uint16 CfeCoreCSErrCounter; /**< \brief cFE core miscompare counter */
uint16 OSCSErrCounter; /**< \brief OS code segment miscopmare counter */
uint16 OSCSErrCounter; /**< \brief OS code segment miscompare counter */
uint16 CurrentCSTable; /**< \brief Current table being checksummed */
uint16 CurrentEntryInTable; /**< \brief Current entry ID in table being checksummed */
uint32 EepromBaseline; /**< \brief Baseline checksum for all of EEPROM */
uint32 OSBaseline; /**< \brief Baseline checksum for the OS code segment */
uint32 CfeCoreBaseline; /**< \brief Basline checksum for the cFE core */
uint32 CfeCoreBaseline; /**< \brief Baseline checksum for the cFE core */
cpuaddr LastOneShotAddress; /**< \brief Address used in last one shot checksum command */
uint32 LastOneShotSize; /**< \brief Size used in the last one shot checksum command */
uint32 LastOneShotMaxBytesPerCycle; /**< \brief Max bytes per cycle for last one shot checksum command */
Expand Down
14 changes: 7 additions & 7 deletions fsw/inc/cs_msgdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
* - The #CS_ONESHOT_STARTED_DBG_EID debug event message will be
* generated when the command is received
* - The CS_ONESHOT_FINISHED_INF_EID informational message will
* be generated when the compuation finishes.
* be generated when the computation finishes.
* - #CS_HkPacket_Payload_t.LastOneShotChecksum will be updated to the new value
*
* \par Error Conditions
Expand Down Expand Up @@ -346,7 +346,7 @@
* \brief Recompute Baseline checksum of cFE core
*
* \par Description
* Recomputesthe baseline checksum of the cFE core
* Recomputes the baseline checksum of the cFE core
* and use the new value as the baseline.
*
* \par Command Structure
Expand Down Expand Up @@ -485,7 +485,7 @@
* \brief Recompute Baseline checksum of OS code segment
*
* \par Description
* Recomputesthe baseline checksum of the OS code segment
* Recomputes the baseline checksum of the OS code segment
* and use the new value as the baseline.
*
* \par Command Structure
Expand Down Expand Up @@ -1099,7 +1099,7 @@
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected
* - The command specified able name is invalid
* - The command specified table name is invalid
*
* \par Evidence of failure may be found in the following telemetry:
* - #CS_HkPacket_Payload_t.CmdErrCounter will increment
Expand Down Expand Up @@ -1317,7 +1317,7 @@
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected
* - The command specified able name is invalid
* - The command specified table name is invalid
*
* \par Evidence of failure may be found in the following telemetry:
* - #CS_HkPacket_Payload_t.CmdErrCounter will increment
Expand Down Expand Up @@ -1433,13 +1433,13 @@
*
* \par Evidence of failure may be found in the following telemetry:
* - #CS_HkPacket_Payload_t.CmdErrCounter will increment
* - Error specific event message #CS_DISABLE_APP_NAME_INF_EID
* - Error specific event message #CS_CMD_LEN_ERR_EID
* - Error specific event message #CS_DISABLE_APP_UNKNOWN_NAME_ERR_EID
*
* \par Criticality
* None
*
* \sa #CS_DISABLE_NAME_APP_CC
* \sa #CS_ENABLE_NAME_APP_CC
*/
#define CS_DISABLE_NAME_APP_CC 39

Expand Down
6 changes: 3 additions & 3 deletions fsw/inc/cs_tbldefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ typedef struct
uint32 NumBytesToChecksum; /**< \brief The number of Bytes to Checksum */
uint32 ComparisonValue; /**< \brief The Memory Integrity Value */
uint32 ByteOffset; /**< \brief Where a previous unfinished calc left off */
uint32 TempChecksumValue; /**< \brief The unfinished caluculation */
uint32 TempChecksumValue; /**< \brief The unfinished calculation */
uint32 Filler32; /**< \brief Padding */
} CS_Res_EepromMemory_Table_Entry_t;

Expand Down Expand Up @@ -118,7 +118,7 @@ typedef struct
uint32 NumBytesToChecksum; /**< \brief The number of Bytes to Checksum */
uint32 ComparisonValue; /**< \brief The Memory Integrity Value */
uint32 ByteOffset; /**< \brief Where a previous unfinished calc left off */
uint32 TempChecksumValue; /**< \brief The unfinished caluculation */
uint32 TempChecksumValue; /**< \brief The unfinished calculation */
CFE_TBL_Handle_t TblHandle; /**< \brief handle recieved from CFE_TBL */
bool IsCSOwner; /**< \brief Is CS the original owner of this table */
bool Filler8; /**< \brief Padding */
Expand All @@ -136,7 +136,7 @@ typedef struct
uint32 NumBytesToChecksum; /**< \brief The number of Bytes to Checksum */
uint32 ComparisonValue; /**< \brief The Memory Integrity Value */
uint32 ByteOffset; /**< \brief Where a previous unfinished calc left off */
uint32 TempChecksumValue; /**< \brief The unfinished caluculation */
uint32 TempChecksumValue; /**< \brief The unfinished calculation */
char Name[OS_MAX_API_NAME]; /**< \brief name of the app */
} CS_Res_App_Table_Entry_t;

Expand Down
2 changes: 1 addition & 1 deletion fsw/src/cs_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ CFE_Status_t CS_AppInit(void)
{
CS_InitSegments();

/* initialize the place to ostart background checksumming */
/* initialize the place to start background checksumming */
CS_AppData.HkPacket.Payload.CurrentCSTable = 0;
CS_AppData.HkPacket.Payload.CurrentEntryInTable = 0;

Expand Down
2 changes: 1 addition & 1 deletion fsw/src/cs_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ typedef struct
CFE_TBL_Handle_t ResTablesTableHandle; /**< \brief Handle to the Tables results table */

CFE_TBL_Handle_t DefAppTableHandle; /**< \brief Handle to the Apps definition table */
CFE_TBL_Handle_t ResAppTableHandle; /**< \brief Hanlde to the Apps results table */
CFE_TBL_Handle_t ResAppTableHandle; /**< \brief Handle to the Apps results table */

CS_Def_EepromMemory_Table_Entry_t *DefEepromTblPtr; /**< \brief Pointer to the EEPROM definition table */
CS_Res_EepromMemory_Table_Entry_t *ResEepromTblPtr; /**< \brief Pointer to the EEPROM results table */
Expand Down
157 changes: 72 additions & 85 deletions fsw/src/cs_app_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,39 @@

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* CS Disable background checking of App command */
/* Common handler for App enable/disable commands */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_DisableAppCmd(const CS_NoArgsCmd_t *CmdPtr)
static void CS_DoEnableDisableAppCmd(const CS_NoArgsCmd_t *CmdPtr, uint16 NewState, uint32 EventID)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
{
if (CS_CheckRecomputeOneshot() == false)
if (CS_CheckRecomputeOneshot() == false)
{
CS_AppData.HkPacket.Payload.AppCSState = NewState;

if (NewState == CS_STATE_DISABLED)
{
CS_AppData.HkPacket.Payload.AppCSState = CS_STATE_DISABLED;
CS_ZeroAppTempValues();
}

#if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true)
CS_UpdateCDS();
CS_UpdateCDS();
#endif

CFE_EVS_SendEvent(CS_DISABLE_APP_INF_EID, CFE_EVS_EventType_INFORMATION, "Checksumming of App is Disabled");
CS_AppData.HkPacket.Payload.CmdCounter++;
}
CFE_EVS_SendEvent(EventID, CFE_EVS_EventType_INFORMATION,
NewState == CS_STATE_ENABLED ? "Checksumming of App is Enabled"
: "Checksumming of App is Disabled");
CS_AppData.HkPacket.Payload.CmdCounter++;
}
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* CS Disable background checking of App command */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_DisableAppCmd(const CS_NoArgsCmd_t *CmdPtr)
{
CS_DoEnableDisableAppCmd(CmdPtr, CS_STATE_DISABLED, CS_DISABLE_APP_INF_EID);
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand All @@ -67,17 +83,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_EnableAppCmd(const CS_NoArgsCmd_t *CmdPtr)
{
if (CS_CheckRecomputeOneshot() == false)
{
CS_AppData.HkPacket.Payload.AppCSState = CS_STATE_ENABLED;

#if (CS_PRESERVE_STATES_ON_PROCESSOR_RESET == true)
CS_UpdateCDS();
#endif

CFE_EVS_SendEvent(CS_ENABLE_APP_INF_EID, CFE_EVS_EventType_INFORMATION, "Checksumming of App is Enabled");
CS_AppData.HkPacket.Payload.CmdCounter++;
}
CS_DoEnableDisableAppCmd(CmdPtr, CS_STATE_ENABLED, CS_ENABLE_APP_INF_EID);
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand Down Expand Up @@ -182,52 +188,69 @@

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* CS Disable a specific entry in the App table command */
/* Common handler for App name-based enable/disable commands */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_DisableNameAppCmd(const CS_AppNameCmd_t *CmdPtr)
static void CS_DoEnableDisableNameAppCmd(const CS_AppNameCmd_t *CmdPtr, uint16 NewState, uint32 EventID,

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
uint32 UnknownNameEventID, uint32 DefNotFoundEventID)
{
/* command verification variables */
CS_Res_App_Table_Entry_t *ResultsEntry;
CS_Def_App_Table_Entry_t *DefinitionEntry;
char Name[OS_MAX_API_NAME];

if (CS_CheckRecomputeOneshot() == false)
if (CS_CheckRecomputeOneshot() == false)
{
strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1);
Name[sizeof(Name) - 1] = '\0';

if (CS_GetAppResTblEntryByName(&ResultsEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning

This Boolean expression is not side-effect free.
{
strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1);
Name[sizeof(Name) - 1] = '\0';
ResultsEntry->State = NewState;

if (CS_GetAppResTblEntryByName(&ResultsEntry, Name))
if (NewState == CS_STATE_DISABLED)
{
ResultsEntry->State = CS_STATE_DISABLED;
ResultsEntry->TempChecksumValue = 0;
ResultsEntry->ByteOffset = 0;
}

CFE_EVS_SendEvent(CS_DISABLE_APP_NAME_INF_EID, CFE_EVS_EventType_INFORMATION,
"Checksumming of app %s is Disabled", Name);

if (CS_GetAppDefTblEntryByName(&DefinitionEntry, Name))
{
DefinitionEntry->State = CS_STATE_DISABLED;
CS_ResetTablesTblResultEntry(CS_AppData.AppResTablesTblPtr);
CFE_TBL_Modified(CS_AppData.DefAppTableHandle);
}
else
{
CFE_EVS_SendEvent(CS_DISABLE_APP_DEF_NOT_FOUND_DBG_EID, CFE_EVS_EventType_DEBUG,
"CS unable to update apps definition table for entry %s", Name);
}
CFE_EVS_SendEvent(EventID, CFE_EVS_EventType_INFORMATION,
NewState == CS_STATE_ENABLED ? "Checksumming of app %s is Enabled"
: "Checksumming of app %s is Disabled",
Name);

CS_AppData.HkPacket.Payload.CmdCounter++;
if (CS_GetAppDefTblEntryByName(&DefinitionEntry, Name))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning

This Boolean expression is not side-effect free.
{
DefinitionEntry->State = NewState;
CS_ResetTablesTblResultEntry(CS_AppData.AppResTablesTblPtr);
CFE_TBL_Modified(CS_AppData.DefAppTableHandle);
}

else
{
CFE_EVS_SendEvent(CS_DISABLE_APP_UNKNOWN_NAME_ERR_EID, CFE_EVS_EventType_ERROR,
"App disable app command failed, app %s not found", Name);
CS_AppData.HkPacket.Payload.CmdErrCounter++;
CFE_EVS_SendEvent(DefNotFoundEventID, CFE_EVS_EventType_DEBUG,
"CS unable to update apps definition table for entry %s", Name);
}
} /* end InProgress if */
CS_AppData.HkPacket.Payload.CmdCounter++;
}
else
{
CFE_EVS_SendEvent(UnknownNameEventID, CFE_EVS_EventType_ERROR,
NewState == CS_STATE_ENABLED ? "App enable app command failed, app %s not found"
: "App disable app command failed, app %s not found",
Name);
CS_AppData.HkPacket.Payload.CmdErrCounter++;
}
}
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* CS Disable a specific entry in the App table command */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_DisableNameAppCmd(const CS_AppNameCmd_t *CmdPtr)
{
CS_DoEnableDisableNameAppCmd(CmdPtr, CS_STATE_DISABLED, CS_DISABLE_APP_NAME_INF_EID,
CS_DISABLE_APP_UNKNOWN_NAME_ERR_EID, CS_DISABLE_APP_DEF_NOT_FOUND_DBG_EID);
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand All @@ -237,42 +260,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_EnableNameAppCmd(const CS_AppNameCmd_t *CmdPtr)
{
/* command verification variables */
CS_Res_App_Table_Entry_t *ResultsEntry;
CS_Def_App_Table_Entry_t *DefinitionEntry;
char Name[OS_MAX_API_NAME];

if (CS_CheckRecomputeOneshot() == false)
{
strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1);
Name[sizeof(Name) - 1] = '\0';

if (CS_GetAppResTblEntryByName(&ResultsEntry, Name))
{
ResultsEntry->State = CS_STATE_ENABLED;

CFE_EVS_SendEvent(CS_ENABLE_APP_NAME_INF_EID, CFE_EVS_EventType_INFORMATION,
"Checksumming of app %s is Enabled", Name);

if (CS_GetAppDefTblEntryByName(&DefinitionEntry, Name))
{
DefinitionEntry->State = CS_STATE_ENABLED;
CS_ResetTablesTblResultEntry(CS_AppData.AppResTablesTblPtr);
CFE_TBL_Modified(CS_AppData.DefAppTableHandle);
}
else
{
CFE_EVS_SendEvent(CS_ENABLE_APP_DEF_NOT_FOUND_DBG_EID, CFE_EVS_EventType_DEBUG,
"CS unable to update apps definition table for entry %s", Name);
}

CS_AppData.HkPacket.Payload.CmdCounter++;
}
else
{
CFE_EVS_SendEvent(CS_ENABLE_APP_UNKNOWN_NAME_ERR_EID, CFE_EVS_EventType_ERROR,
"App enable app command failed, app %s not found", Name);
CS_AppData.HkPacket.Payload.CmdErrCounter++;
}
} /* end InProgress if */
CS_DoEnableDisableNameAppCmd(CmdPtr, CS_STATE_ENABLED, CS_ENABLE_APP_NAME_INF_EID,
CS_ENABLE_APP_UNKNOWN_NAME_ERR_EID, CS_ENABLE_APP_DEF_NOT_FOUND_DBG_EID);
}
Loading
Loading