From 4deac06576d947168c9e077742e0446b626ea5f5 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Wed, 18 Nov 2020 16:53:55 -0500 Subject: [PATCH] Fix #110, Apply message alignment pattern - Replace CFE_SB_RcvMsg with CFE_SB_ReceiveBuffer - Use CFE_SB_Buffer_t for receiving and casting to command types - Use CFE_MSG_CommandHeader_t and CFE_MSG_TelemetryHeader_t in command and telemetry type definitions - Use CFE_SB_TransmitMsg to copy the command and telemetry into a CFE_SB_Buffer_t and send it where needed - Avoids need to create send buffers within the app (or union the packet types with CFE_SB_Buffer_t) - Eliminates references to CFE_SB_CmdHdr_t and CFE_SB_TlmHdr_t that formerly enforced alignment since these had potential to change the actual packet sizes - No need to cast to CFE_MSG_Message_t anywhere since it's available in the CFE_SB_Buffer_t union - Replaced CFE_MSG_Size_t with size_t --- fsw/src/sample_app.c | 58 ++++++------- fsw/src/sample_app.h | 17 ++-- fsw/src/sample_app_msg.h | 16 ++-- fsw/src/sample_app_version.h | 4 +- .../coveragetest/coveragetest_sample_app.c | 81 +++++++++---------- 5 files changed, 85 insertions(+), 91 deletions(-) diff --git a/fsw/src/sample_app.c b/fsw/src/sample_app.c index cebe98a..eda7784 100644 --- a/fsw/src/sample_app.c +++ b/fsw/src/sample_app.c @@ -48,7 +48,8 @@ SAMPLE_APP_Data_t SAMPLE_APP_Data; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ void SAMPLE_APP_Main(void) { - int32 status; + int32 status; + CFE_SB_Buffer_t *SBBufPtr; /* ** Register the app with Executive services @@ -82,7 +83,7 @@ void SAMPLE_APP_Main(void) CFE_ES_PerfLogExit(SAMPLE_APP_PERF_ID); /* Pend on receipt of command packet */ - status = CFE_SB_RcvMsg(&SAMPLE_APP_Data.MsgPtr, SAMPLE_APP_Data.CommandPipe, CFE_SB_PEND_FOREVER); + status = CFE_SB_ReceiveBuffer(&SBBufPtr, SAMPLE_APP_Data.CommandPipe, CFE_SB_PEND_FOREVER); /* ** Performance Log Entry Stamp @@ -91,7 +92,7 @@ void SAMPLE_APP_Main(void) if (status == CFE_SUCCESS) { - SAMPLE_APP_ProcessCommandPacket(SAMPLE_APP_Data.MsgPtr); + SAMPLE_APP_ProcessCommandPacket(SBBufPtr); } else { @@ -133,9 +134,8 @@ int32 SAMPLE_APP_Init(void) */ SAMPLE_APP_Data.PipeDepth = SAMPLE_APP_PIPE_DEPTH; - strncpy(SAMPLE_APP_Data.PipeName, "SAMPLE_APP_CMD_PIPE", - sizeof(SAMPLE_APP_Data.PipeName)); - SAMPLE_APP_Data.PipeName[sizeof(SAMPLE_APP_Data.PipeName)-1] = 0; + strncpy(SAMPLE_APP_Data.PipeName, "SAMPLE_APP_CMD_PIPE", sizeof(SAMPLE_APP_Data.PipeName)); + SAMPLE_APP_Data.PipeName[sizeof(SAMPLE_APP_Data.PipeName) - 1] = 0; /* ** Initialize event filter table... @@ -168,7 +168,7 @@ int32 SAMPLE_APP_Init(void) /* ** Initialize housekeeping packet (clear user data area). */ - CFE_MSG_Init(&SAMPLE_APP_Data.HkTlm.TlmHeader.BaseMsg, SAMPLE_APP_HK_TLM_MID, sizeof(SAMPLE_APP_Data.HkTlm)); + CFE_MSG_Init(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg, SAMPLE_APP_HK_TLM_MID, sizeof(SAMPLE_APP_Data.HkTlm)); /* ** Create Software Bus message pipe. @@ -232,20 +232,20 @@ int32 SAMPLE_APP_Init(void) /* command pipe. */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SAMPLE_APP_ProcessCommandPacket(CFE_MSG_Message_t *MsgPtr) +void SAMPLE_APP_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr) { CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; - CFE_MSG_GetMsgId(MsgPtr, &MsgId); + CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MsgId); switch (MsgId) { case SAMPLE_APP_CMD_MID: - SAMPLE_APP_ProcessGroundCommand(MsgPtr); + SAMPLE_APP_ProcessGroundCommand(SBBufPtr); break; case SAMPLE_APP_SEND_HK_MID: - SAMPLE_APP_ReportHousekeeping((CFE_SB_CmdHdr_t *)MsgPtr); + SAMPLE_APP_ReportHousekeeping((CFE_MSG_CommandHeader_t *)SBBufPtr); break; default: @@ -263,11 +263,11 @@ void SAMPLE_APP_ProcessCommandPacket(CFE_MSG_Message_t *MsgPtr) /* SAMPLE_APP_ProcessGroundCommand() -- SAMPLE ground commands */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ -void SAMPLE_APP_ProcessGroundCommand(CFE_MSG_Message_t *MsgPtr) +void SAMPLE_APP_ProcessGroundCommand(CFE_SB_Buffer_t *SBBufPtr) { CFE_MSG_FcnCode_t CommandCode = 0; - CFE_MSG_GetFcnCode(MsgPtr, &CommandCode); + CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &CommandCode); /* ** Process "known" SAMPLE app ground commands @@ -275,25 +275,25 @@ void SAMPLE_APP_ProcessGroundCommand(CFE_MSG_Message_t *MsgPtr) switch (CommandCode) { case SAMPLE_APP_NOOP_CC: - if (SAMPLE_APP_VerifyCmdLength(MsgPtr, sizeof(SAMPLE_APP_Noop_t))) + if (SAMPLE_APP_VerifyCmdLength(&SBBufPtr->Msg, sizeof(SAMPLE_APP_NoopCmd_t))) { - SAMPLE_APP_Noop((SAMPLE_APP_Noop_t *)MsgPtr); + SAMPLE_APP_Noop((SAMPLE_APP_NoopCmd_t *)SBBufPtr); } break; case SAMPLE_APP_RESET_COUNTERS_CC: - if (SAMPLE_APP_VerifyCmdLength(MsgPtr, sizeof(SAMPLE_APP_ResetCounters_t))) + if (SAMPLE_APP_VerifyCmdLength(&SBBufPtr->Msg, sizeof(SAMPLE_APP_ResetCountersCmd_t))) { - SAMPLE_APP_ResetCounters((SAMPLE_APP_ResetCounters_t *)MsgPtr); + SAMPLE_APP_ResetCounters((SAMPLE_APP_ResetCountersCmd_t *)SBBufPtr); } break; case SAMPLE_APP_PROCESS_CC: - if (SAMPLE_APP_VerifyCmdLength(MsgPtr, sizeof(SAMPLE_APP_Process_t))) + if (SAMPLE_APP_VerifyCmdLength(&SBBufPtr->Msg, sizeof(SAMPLE_APP_ProcessCmd_t))) { - SAMPLE_APP_Process((SAMPLE_APP_Process_t *)MsgPtr); + SAMPLE_APP_Process((SAMPLE_APP_ProcessCmd_t *)SBBufPtr); } break; @@ -318,7 +318,7 @@ void SAMPLE_APP_ProcessGroundCommand(CFE_MSG_Message_t *MsgPtr) /* telemetry, packetize it and send it to the housekeeping task via */ /* the software bus */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 SAMPLE_APP_ReportHousekeeping(const CFE_SB_CmdHdr_t *Msg) +int32 SAMPLE_APP_ReportHousekeeping(const CFE_MSG_CommandHeader_t *Msg) { int i; @@ -331,8 +331,8 @@ int32 SAMPLE_APP_ReportHousekeeping(const CFE_SB_CmdHdr_t *Msg) /* ** Send housekeeping telemetry packet... */ - CFE_SB_TimeStampMsg(&SAMPLE_APP_Data.HkTlm.TlmHeader.BaseMsg); - CFE_SB_SendMsg(&SAMPLE_APP_Data.HkTlm.TlmHeader.BaseMsg); + CFE_SB_TimeStampMsg(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg); + CFE_SB_TransmitMsg(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg, true); /* ** Manage any pending table loads, validations, etc. @@ -351,7 +351,7 @@ int32 SAMPLE_APP_ReportHousekeeping(const CFE_SB_CmdHdr_t *Msg) /* SAMPLE_APP_Noop -- SAMPLE NOOP commands */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ -int32 SAMPLE_APP_Noop(const SAMPLE_APP_Noop_t *Msg) +int32 SAMPLE_APP_Noop(const SAMPLE_APP_NoopCmd_t *Msg) { SAMPLE_APP_Data.CmdCounter++; @@ -371,7 +371,7 @@ int32 SAMPLE_APP_Noop(const SAMPLE_APP_Noop_t *Msg) /* part of the task telemetry. */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 SAMPLE_APP_ResetCounters(const SAMPLE_APP_ResetCounters_t *Msg) +int32 SAMPLE_APP_ResetCounters(const SAMPLE_APP_ResetCountersCmd_t *Msg) { SAMPLE_APP_Data.CmdCounter = 0; @@ -390,7 +390,7 @@ int32 SAMPLE_APP_ResetCounters(const SAMPLE_APP_ResetCounters_t *Msg) /* This function Process Ground Station Command */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 SAMPLE_APP_Process(const SAMPLE_APP_Process_t *Msg) +int32 SAMPLE_APP_Process(const SAMPLE_APP_ProcessCmd_t *Msg) { int32 status; SAMPLE_APP_Table_t *TblPtr; @@ -429,10 +429,10 @@ int32 SAMPLE_APP_Process(const SAMPLE_APP_Process_t *Msg) /* SAMPLE_APP_VerifyCmdLength() -- Verify command packet length */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ -bool SAMPLE_APP_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, CFE_MSG_Size_t ExpectedLength) +bool SAMPLE_APP_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength) { bool result = true; - CFE_MSG_Size_t ActualLength = 0; + size_t ActualLength = 0; CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t FcnCode = 0; @@ -448,8 +448,8 @@ bool SAMPLE_APP_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, CFE_MSG_Size_t Expect CFE_EVS_SendEvent(SAMPLE_APP_LEN_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid Msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u", - (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, - (unsigned int)ActualLength, (unsigned int)ExpectedLength); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, (unsigned int)ActualLength, + (unsigned int)ExpectedLength); result = false; diff --git a/fsw/src/sample_app.h b/fsw/src/sample_app.h index 354a716..a7fb92c 100644 --- a/fsw/src/sample_app.h +++ b/fsw/src/sample_app.h @@ -81,8 +81,7 @@ typedef struct /* ** Operational data (not reported in housekeeping)... */ - CFE_SB_PipeId_t CommandPipe; - CFE_MSG_Message_t *MsgPtr; + CFE_SB_PipeId_t CommandPipe; /* ** Initialization data (not reported in housekeeping)... @@ -104,16 +103,16 @@ typedef struct */ void SAMPLE_APP_Main(void); int32 SAMPLE_APP_Init(void); -void SAMPLE_APP_ProcessCommandPacket(CFE_MSG_Message_t *MsgPtr); -void SAMPLE_APP_ProcessGroundCommand(CFE_MSG_Message_t *MsgPtr); -int32 SAMPLE_APP_ReportHousekeeping(const CFE_SB_CmdHdr_t *Msg); -int32 SAMPLE_APP_ResetCounters(const SAMPLE_APP_ResetCounters_t *Msg); -int32 SAMPLE_APP_Process(const SAMPLE_APP_Process_t *Msg); -int32 SAMPLE_APP_Noop(const SAMPLE_APP_Noop_t *Msg); +void SAMPLE_APP_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr); +void SAMPLE_APP_ProcessGroundCommand(CFE_SB_Buffer_t *SBBufPtr); +int32 SAMPLE_APP_ReportHousekeeping(const CFE_MSG_CommandHeader_t *Msg); +int32 SAMPLE_APP_ResetCounters(const SAMPLE_APP_ResetCountersCmd_t *Msg); +int32 SAMPLE_APP_Process(const SAMPLE_APP_ProcessCmd_t *Msg); +int32 SAMPLE_APP_Noop(const SAMPLE_APP_NoopCmd_t *Msg); void SAMPLE_APP_GetCrc(const char *TableName); int32 SAMPLE_APP_TblValidationFunc(void *TblData); -bool SAMPLE_APP_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, CFE_MSG_Size_t ExpectedLength); +bool SAMPLE_APP_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength); #endif /* _sample_app_h_ */ diff --git a/fsw/src/sample_app_msg.h b/fsw/src/sample_app_msg.h index 6ae76db..3f35144 100644 --- a/fsw/src/sample_app_msg.h +++ b/fsw/src/sample_app_msg.h @@ -44,20 +44,19 @@ */ typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; - + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ } SAMPLE_APP_NoArgsCmd_t; /* ** The following commands all share the "NoArgs" format ** -** They are each given their own type name matching the command name, which_open_mode +** They are each given their own type name matching the command name, which ** allows them to change independently in the future without changing the prototype ** of the handler function */ -typedef SAMPLE_APP_NoArgsCmd_t SAMPLE_APP_Noop_t; -typedef SAMPLE_APP_NoArgsCmd_t SAMPLE_APP_ResetCounters_t; -typedef SAMPLE_APP_NoArgsCmd_t SAMPLE_APP_Process_t; +typedef SAMPLE_APP_NoArgsCmd_t SAMPLE_APP_NoopCmd_t; +typedef SAMPLE_APP_NoArgsCmd_t SAMPLE_APP_ResetCountersCmd_t; +typedef SAMPLE_APP_NoArgsCmd_t SAMPLE_APP_ProcessCmd_t; /*************************************************************************/ /* @@ -73,11 +72,10 @@ typedef struct typedef struct { - CFE_SB_TlmHdr_t TlmHeader; - SAMPLE_APP_HkTlm_Payload_t Payload; + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + SAMPLE_APP_HkTlm_Payload_t Payload; /**< \brief Telemetry payload */ } SAMPLE_APP_HkTlm_t; - #endif /* _sample_app_msg_h_ */ /************************/ diff --git a/fsw/src/sample_app_version.h b/fsw/src/sample_app_version.h index 406344d..23a8aee 100644 --- a/fsw/src/sample_app_version.h +++ b/fsw/src/sample_app_version.h @@ -40,8 +40,8 @@ #define SAMPLE_APP_MAJOR_VERSION 1 /*!< @brief ONLY APPLY for OFFICIAL releases. Major version number. */ #define SAMPLE_APP_MINOR_VERSION 1 /*!< @brief ONLY APPLY for OFFICIAL releases. Minor version number. */ -#define SAMPLE_APP_REVISION 99 /*!< @brief ONLY APPLY for OFFICIAL releases. The value "99" indicates a development version. Revision version number. */ -#define SAMPLE_APP_MISSION_REV 0 /*!< @brief ONLY USED by MISSION Implementations. Mission revision */ +#define SAMPLE_APP_REVISION 99 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision version number. */ +#define SAMPLE_APP_MISSION_REV 0 /*!< @brief ONLY USED by MISSION Implementations. Mission revision */ #define SAMPLE_APP_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer macros */ #define SAMPLE_APP_STR(x) \ diff --git a/unit-test/coveragetest/coveragetest_sample_app.c b/unit-test/coveragetest/coveragetest_sample_app.c index cc28b90..3398a85 100644 --- a/unit-test/coveragetest/coveragetest_sample_app.c +++ b/unit-test/coveragetest/coveragetest_sample_app.c @@ -208,17 +208,17 @@ void Test_SAMPLE_APP_Main(void) SAMPLE_APP_Main(); /* - * Confirm that CFE_SB_RcvMsg() (inside the loop) was called + * Confirm that CFE_SB_ReceiveBuffer() (inside the loop) was called */ - UtAssert_True(UT_GetStubCount(UT_KEY(CFE_SB_RcvMsg)) == 1, "CFE_SB_RcvMsg() called"); + UtAssert_True(UT_GetStubCount(UT_KEY(CFE_SB_ReceiveBuffer)) == 1, "CFE_SB_ReceiveBuffer() called"); /* - * Now also make the CFE_SB_RcvMsg call fail, + * Now also make the CFE_SB_ReceiveBuffer call fail, * to exercise that error path. This sends an * event which can be checked with a hook function. */ UT_SetDeferredRetcode(UT_KEY(CFE_ES_RunLoop), 1, true); - UT_SetDeferredRetcode(UT_KEY(CFE_SB_RcvMsg), 1, CFE_SB_PIPE_RD_ERR); + UT_SetDeferredRetcode(UT_KEY(CFE_SB_ReceiveBuffer), 1, CFE_SB_PIPE_RD_ERR); UT_CheckEvent_Setup(&EventTest, SAMPLE_APP_PIPE_ERR_EID, "SAMPLE APP: SB Pipe Read Error, App Will Exit"); /* @@ -277,15 +277,12 @@ void Test_SAMPLE_APP_ProcessCommandPacket(void) /* a buffer large enough for any command message */ union { - CFE_MSG_Message_t Base; - CFE_SB_CmdHdr_t Cmd; - SAMPLE_APP_Noop_t Noop; - SAMPLE_APP_ResetCounters_t Reset; - SAMPLE_APP_Process_t Process; + CFE_SB_Buffer_t SBBuf; + SAMPLE_APP_NoopCmd_t Noop; } TestMsg; CFE_SB_MsgId_t TestMsgId; CFE_MSG_FcnCode_t FcnCode; - CFE_MSG_Size_t MsgSize; + size_t MsgSize; UT_CheckEvent_t EventTest; memset(&TestMsg, 0, sizeof(TestMsg)); @@ -296,21 +293,21 @@ void Test_SAMPLE_APP_ProcessCommandPacket(void) * message ID values to return. */ TestMsgId = SAMPLE_APP_CMD_MID; - FcnCode = SAMPLE_APP_NOOP_CC; - MsgSize = sizeof(SAMPLE_APP_Noop_t); + FcnCode = SAMPLE_APP_NOOP_CC; + MsgSize = sizeof(TestMsg.Noop); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &MsgSize, sizeof(MsgSize), false); - SAMPLE_APP_ProcessCommandPacket(&TestMsg.Base); + SAMPLE_APP_ProcessCommandPacket(&TestMsg.SBBuf); TestMsgId = SAMPLE_APP_SEND_HK_MID; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - SAMPLE_APP_ProcessCommandPacket(&TestMsg.Base); + SAMPLE_APP_ProcessCommandPacket(&TestMsg.SBBuf); /* invalid message id */ TestMsgId = CFE_SB_INVALID_MSG_ID; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - SAMPLE_APP_ProcessCommandPacket(&TestMsg.Base); + SAMPLE_APP_ProcessCommandPacket(&TestMsg.SBBuf); /* * Confirm that the event was generated only _once_ @@ -326,16 +323,15 @@ void Test_SAMPLE_APP_ProcessGroundCommand(void) * void SAMPLE_APP_ProcessGroundCommand */ CFE_MSG_FcnCode_t FcnCode; - CFE_MSG_Size_t Size; + size_t Size; /* a buffer large enough for any command message */ union { - CFE_MSG_Message_t Base; - CFE_SB_CmdHdr_t Cmd; - SAMPLE_APP_Noop_t Noop; - SAMPLE_APP_ResetCounters_t Reset; - SAMPLE_APP_Process_t Process; + CFE_SB_Buffer_t SBBuf; + SAMPLE_APP_NoopCmd_t Noop; + SAMPLE_APP_ResetCountersCmd_t Reset; + SAMPLE_APP_ProcessCmd_t Process; } TestMsg; UT_CheckEvent_t EventTest; @@ -352,24 +348,24 @@ void Test_SAMPLE_APP_ProcessGroundCommand(void) /* test dispatch of NOOP */ FcnCode = SAMPLE_APP_NOOP_CC; - Size = sizeof(TestMsg.Noop); + Size = sizeof(TestMsg.Noop); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_CheckEvent_Setup(&EventTest, SAMPLE_APP_COMMANDNOP_INF_EID, NULL); - SAMPLE_APP_ProcessGroundCommand(&TestMsg.Base); + SAMPLE_APP_ProcessGroundCommand(&TestMsg.SBBuf); UtAssert_True(EventTest.MatchCount == 1, "SAMPLE_COMMANDNOP_INF_EID generated (%u)", (unsigned int)EventTest.MatchCount); /* test dispatch of RESET */ FcnCode = SAMPLE_APP_RESET_COUNTERS_CC; - Size = sizeof(TestMsg.Reset); + Size = sizeof(TestMsg.Reset); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_CheckEvent_Setup(&EventTest, SAMPLE_APP_COMMANDRST_INF_EID, NULL); - SAMPLE_APP_ProcessGroundCommand(&TestMsg.Base); + SAMPLE_APP_ProcessGroundCommand(&TestMsg.SBBuf); UtAssert_True(EventTest.MatchCount == 1, "SAMPLE_COMMANDRST_INF_EID generated (%u)", (unsigned int)EventTest.MatchCount); @@ -378,18 +374,18 @@ void Test_SAMPLE_APP_ProcessGroundCommand(void) /* note this will end up calling SAMPLE_APP_Process(), and as such it needs to * avoid dereferencing a table which does not exist. */ FcnCode = SAMPLE_APP_PROCESS_CC; - Size = sizeof(TestMsg.Process); + Size = sizeof(TestMsg.Process); UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_TBL_ERR_UNREGISTERED); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - SAMPLE_APP_ProcessGroundCommand(&TestMsg.Base); + SAMPLE_APP_ProcessGroundCommand(&TestMsg.SBBuf); /* test an invalid CC */ FcnCode = 1000; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); UT_CheckEvent_Setup(&EventTest, SAMPLE_APP_COMMAND_ERR_EID, "Invalid ground command code: CC = %d"); - SAMPLE_APP_ProcessGroundCommand(&TestMsg.Base); + SAMPLE_APP_ProcessGroundCommand(&TestMsg.SBBuf); /* * Confirm that the event was generated only _once_ @@ -412,21 +408,22 @@ void Test_SAMPLE_APP_ReportHousekeeping(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); /* Set up to capture send message address */ - UT_SetDataBuffer(UT_KEY(CFE_SB_SendMsg), &MsgSend, sizeof(MsgSend), false); + UT_SetDataBuffer(UT_KEY(CFE_SB_TransmitMsg), &MsgSend, sizeof(MsgSend), false); /* Set up to capture timestamp message address */ UT_SetDataBuffer(UT_KEY(CFE_SB_TimeStampMsg), &MsgTimestamp, sizeof(MsgTimestamp), false); /* Call unit under test, NULL pointer confirms command access is through APIs */ - SAMPLE_APP_ProcessCommandPacket((CFE_MSG_Message_t *)NULL); + SAMPLE_APP_ProcessCommandPacket((CFE_SB_Buffer_t *)NULL); /* Confirm message sent*/ - UtAssert_True(UT_GetStubCount(UT_KEY(CFE_SB_SendMsg)) == 1, "CFE_SB_SendMsg() called once"); - UtAssert_True(MsgSend == &SAMPLE_APP_Data.HkTlm.TlmHeader.BaseMsg, "CFE_SB_SendMsg() address matches expected"); + UtAssert_True(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)) == 1, "CFE_SB_TransmitMsg() called once"); + UtAssert_True(MsgSend == &SAMPLE_APP_Data.HkTlm.TlmHeader.Msg, "CFE_SB_TransmitMsg() address matches expected"); /* Confirm timestamp msg address */ UtAssert_True(UT_GetStubCount(UT_KEY(CFE_SB_TimeStampMsg)) == 1, "CFE_SB_TimeStampMsg() called once"); - UtAssert_True(MsgTimestamp == &SAMPLE_APP_Data.HkTlm.TlmHeader.BaseMsg, "CFE_SB_TimeStampMsg() adress matches expected"); + UtAssert_True(MsgTimestamp == &SAMPLE_APP_Data.HkTlm.TlmHeader.Msg, + "CFE_SB_TimeStampMsg() adress matches expected"); /* * Confirm that the CFE_TBL_Manage() call was done @@ -440,8 +437,8 @@ void Test_SAMPLE_APP_NoopCmd(void) * Test Case For: * void SAMPLE_APP_NoopCmd( const SAMPLE_APP_Noop_t *Msg ) */ - SAMPLE_APP_Noop_t TestMsg; - UT_CheckEvent_t EventTest; + SAMPLE_APP_NoopCmd_t TestMsg; + UT_CheckEvent_t EventTest; memset(&TestMsg, 0, sizeof(TestMsg)); @@ -463,8 +460,8 @@ void Test_SAMPLE_APP_ResetCounters(void) * Test Case For: * void SAMPLE_APP_ResetCounters( const SAMPLE_APP_ResetCounters_t *Msg ) */ - SAMPLE_APP_ResetCounters_t TestMsg; - UT_CheckEvent_t EventTest; + SAMPLE_APP_ResetCountersCmd_t TestMsg; + UT_CheckEvent_t EventTest; memset(&TestMsg, 0, sizeof(TestMsg)); @@ -485,9 +482,9 @@ void Test_SAMPLE_APP_ProcessCC(void) * Test Case For: * void SAMPLE_APP_ProcessCC( const SAMPLE_APP_Process_t *Msg ) */ - SAMPLE_APP_Process_t TestMsg; - SAMPLE_APP_Table_t TestTblData; - void * TblPtr = &TestTblData; + SAMPLE_APP_ProcessCmd_t TestMsg; + SAMPLE_APP_Table_t TestTblData; + void * TblPtr = &TestTblData; memset(&TestTblData, 0, sizeof(TestTblData)); memset(&TestMsg, 0, sizeof(TestMsg)); @@ -524,7 +521,7 @@ void Test_SAMPLE_APP_VerifyCmdLength(void) * bool SAMPLE_APP_VerifyCmdLength */ UT_CheckEvent_t EventTest; - CFE_MSG_Size_t size = 1; + size_t size = 1; CFE_MSG_FcnCode_t fcncode = 2; CFE_SB_MsgId_t msgid = CFE_SB_ValueToMsgId(3); @@ -549,7 +546,7 @@ void Test_SAMPLE_APP_VerifyCmdLength(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &size, sizeof(size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &msgid, sizeof(msgid), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcncode, sizeof(fcncode), false); - SAMPLE_APP_VerifyCmdLength(NULL, size+1); + SAMPLE_APP_VerifyCmdLength(NULL, size + 1); /* * Confirm that the event WAS generated