From 3d8269d522b9022bbfc07c1036e25e59050608b0 Mon Sep 17 00:00:00 2001 From: Avi Weiss Date: Wed, 3 May 2023 08:47:07 +1000 Subject: [PATCH] Fix #82, Convert integers holding boolean truth values to `bool` --- fsw/inc/cs_msg.h | 4 ++-- fsw/inc/cs_tbldefs.h | 10 ++++++---- unit-test/cs_app_tests.c | 8 ++++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/fsw/inc/cs_msg.h b/fsw/inc/cs_msg.h index 45356e3..b73569a 100644 --- a/fsw/inc/cs_msg.h +++ b/fsw/inc/cs_msg.h @@ -48,8 +48,8 @@ typedef struct 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 RecomputeInProgress; /**< \brief CS "Recompute In Progress" flag */ - uint8 OneShotInProgress; /**< \brief CS "OneShot In Progress" flag */ + bool RecomputeInProgress; /**< \brief CS "Recompute In Progress" flag */ + bool OneShotInProgress; /**< \brief CS "OneShot In Progress" flag */ uint8 Filler8; /**< \brief 8 bit padding */ uint16 EepromCSErrCounter; /**< \brief EEPROM miscompare counter */ uint16 MemoryCSErrCounter; /**< \brief Memory miscompare counter */ diff --git a/fsw/inc/cs_tbldefs.h b/fsw/inc/cs_tbldefs.h index 51c2640..0e34463 100644 --- a/fsw/inc/cs_tbldefs.h +++ b/fsw/inc/cs_tbldefs.h @@ -81,7 +81,8 @@ typedef struct { cpuaddr StartAddress; /**< \brief The Start address to Checksum */ uint16 State; /**< \brief Uses the CS_STATE_... defines from above */ - uint16 ComputedYet; /**< \brief Have we computed an Integrity value yet */ + bool ComputedYet; /**< \brief Have we computed an Integrity value yet */ + bool Filler8; /** <\brief Padding */ 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 */ @@ -114,14 +115,14 @@ typedef struct { cpuaddr StartAddress; /**< \brief The Start address to Checksum */ uint16 State; /**< \brief Uses the CS_STATE_... defines from above */ - uint16 ComputedYet; /**< \brief Have we computed an Integrity value yet */ + bool ComputedYet; /**< \brief Have we computed an Integrity value yet */ 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 */ 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 */ + uint16 Filler16; /**< \brief Padding */ char Name[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief name of the table */ } CS_Res_Tables_Table_Entry_t; @@ -132,7 +133,8 @@ typedef struct { cpuaddr StartAddress; /**< \brief The Start address to Checksum */ uint16 State; /**< \brief Uses the CS_STATE_... defines from above */ - uint16 ComputedYet; /**< \brief Have we computed an Integrity value yet */ + bool ComputedYet; /**< \brief Have we computed an Integrity value yet */ + bool Filler8; /** <\brief Padding */ 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 */ diff --git a/unit-test/cs_app_tests.c b/unit-test/cs_app_tests.c index 427e521..6bb03e2 100644 --- a/unit-test/cs_app_tests.c +++ b/unit-test/cs_app_tests.c @@ -2188,8 +2188,8 @@ void CS_HousekeepingCmd_Test_Nominal(void) CS_AppData.HkPacket.TablesCSState = 7; CS_AppData.HkPacket.OSCSState = 8; CS_AppData.HkPacket.CfeCoreCSState = 9; - CS_AppData.HkPacket.RecomputeInProgress = 10; - CS_AppData.HkPacket.OneShotInProgress = 11; + CS_AppData.HkPacket.RecomputeInProgress = true; + CS_AppData.HkPacket.OneShotInProgress = true; CS_AppData.HkPacket.EepromCSErrCounter = 12; CS_AppData.HkPacket.MemoryCSErrCounter = 13; CS_AppData.HkPacket.AppCSErrCounter = 14; @@ -2219,8 +2219,8 @@ void CS_HousekeepingCmd_Test_Nominal(void) UtAssert_True(CS_AppData.HkPacket.TablesCSState == 7, "CS_AppData.HkPacket.TablesCSState == 7"); UtAssert_True(CS_AppData.HkPacket.OSCSState == 8, "CS_AppData.HkPacket.OSCSState == 8"); UtAssert_True(CS_AppData.HkPacket.CfeCoreCSState == 9, "CS_AppData.HkPacket.CfeCoreCSState == 9"); - UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == 10, "CS_AppData.HkPacket.ChildTaskInUse == 10"); - UtAssert_True(CS_AppData.HkPacket.OneShotInProgress == 11, "CS_AppData.HkPacket.OneShotInProgress == 11"); + UtAssert_True(CS_AppData.HkPacket.RecomputeInProgress == true, "CS_AppData.HkPacket.ChildTaskInUse == true"); + UtAssert_True(CS_AppData.HkPacket.OneShotInProgress == true, "CS_AppData.HkPacket.OneShotInProgress == true"); UtAssert_True(CS_AppData.HkPacket.EepromCSErrCounter == 12, "CS_AppData.HkPacket.EepromCSErrCounter == 12"); UtAssert_True(CS_AppData.HkPacket.MemoryCSErrCounter == 13, "CS_AppData.HkPacket.MemoryCSErrCounter == 13"); UtAssert_True(CS_AppData.HkPacket.AppCSErrCounter == 14, "CS_AppData.HkPacket.AppCSErrCounter == 14");