diff --git a/README.md b/README.md index ff01c8f11..42d420523 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,25 @@ The detailed cFE user's guide can be viewed at and + ### Development Build: v6.8.0-rc1+dev1030 - Grammatical cleanup of requirements diff --git a/cmake/mission_defaults.cmake b/cmake/mission_defaults.cmake index 7b288e5e8..c7871c5ce 100644 --- a/cmake/mission_defaults.cmake +++ b/cmake/mission_defaults.cmake @@ -35,6 +35,7 @@ set(MISSION_CORE_MODULES "msg" "sbr" "resourceid" + "config" ) # The "MISSION_GLOBAL_APPLIST" is a set of apps/libs that will be built @@ -75,4 +76,3 @@ list(APPEND MISSION_GLOBAL_APPLIST cfe_assert) if (ENABLE_UNIT_TESTS) list(APPEND MISSION_GLOBAL_APPLIST cfe_testcase) endif (ENABLE_UNIT_TESTS) - diff --git a/docs/src/mnem_maps/cfe_es_tlm_mnem_map b/docs/src/mnem_maps/cfe_es_tlm_mnem_map index e76b8701d..e847477a9 100644 --- a/docs/src/mnem_maps/cfe_es_tlm_mnem_map +++ b/docs/src/mnem_maps/cfe_es_tlm_mnem_map @@ -68,12 +68,6 @@ ES_APPFILENAME=$sc_$cpu_ES_AppFilename[OS_MAX_PATH_LEN] \ ES_STACKSIZE=$sc_$cpu_ES_StackSize \ ES_MODULEID=$sc_$cpu_ES_ModuleID \ ES_ADDRVALID=$sc_$cpu_ES_AddrsValid \ -ES_CODEADDR=$sc_$cpu_ES_CodeAddress \ -ES_CODESIZE=$sc_$cpu_ES_CodeSize \ -ES_DATAADDR=$sc_$cpu_ES_DataAddress \ -ES_DATASIZE=$sc_$cpu_ES_DataSize \ -ES_BSSADDR=$sc_$cpu_ES_BSSAddress \ -ES_BSSSIZE=$sc_$cpu_ES_BSSSize \ ES_STARTADDR=$sc_$cpu_ES_StartAddr \ ES_EXCEPTNACTN=$sc_$cpu_ES_ExceptnActn \ ES_PRIORITY=$sc_$cpu_ES_Priority \ diff --git a/modules/cfe_testcase/src/es_info_test.c b/modules/cfe_testcase/src/es_info_test.c index 27990fbde..632cdce67 100644 --- a/modules/cfe_testcase/src/es_info_test.c +++ b/modules/cfe_testcase/src/es_info_test.c @@ -79,19 +79,20 @@ void TestAppInfo(void) if (TestAppInfo.AddressesAreValid) { - UtAssert_True(TestAppInfo.AddressesAreValid > 0, "Test App Info -> AddrsValid? = %d", + UtAssert_True(TestAppInfo.AddressesAreValid > 0, "Test App Info -> Addrs.Valid? = %d", (int)TestAppInfo.AddressesAreValid); - UtAssert_True(TestAppInfo.CodeAddress > 0, "Test App Info -> CodeAddress = %ld", - (unsigned long)TestAppInfo.CodeAddress); - UtAssert_True(TestAppInfo.CodeSize > 0, "Test App Info -> CodeSize = %ld", - (unsigned long)TestAppInfo.CodeSize); - UtAssert_True(TestAppInfo.DataAddress > 0, "Test App Info -> DataAddress = %ld", - (unsigned long)TestAppInfo.DataAddress); - UtAssert_True(TestAppInfo.DataSize > 0, "Test App Info -> DataSize = %ld", - (unsigned long)TestAppInfo.DataSize); - UtAssert_True(TestAppInfo.BSSAddress > 0, "Test App Info -> BSSAddress = %ld", - (unsigned long)TestAppInfo.BSSAddress); - UtAssert_True(TestAppInfo.BSSSize > 0, "Test App Info -> BSSSize = %ld", (unsigned long)TestAppInfo.BSSSize); + UtAssert_True(TestAppInfo.Code.Address > 0, "Test App Info -> Code.Address = %ld", + (unsigned long)TestAppInfo.Code.Address); + UtAssert_True(TestAppInfo.Code.Size > 0, "Test App Info -> Code.Size = %ld", + (unsigned long)TestAppInfo.Code.Size); + UtAssert_True(TestAppInfo.Data.Address > 0, "Test App Info -> Data.Address = %ld", + (unsigned long)TestAppInfo.Data.Address); + UtAssert_True(TestAppInfo.Data.Size > 0, "Test App Info -> Data.Size = %ld", + (unsigned long)TestAppInfo.Data.Size); + UtAssert_True(TestAppInfo.BSS.Address > 0, "Test App Info -> BSS.Address = %ld", + (unsigned long)TestAppInfo.BSS.Address); + UtAssert_True(TestAppInfo.BSS.Size > 0, "Test App Info -> BSS.Size = %ld", + (unsigned long)TestAppInfo.BSS.Size); } else { @@ -190,12 +191,12 @@ void TestLibInfo(void) { UtAssert_True(LibInfo.AddressesAreValid > 0, "Lib Info -> AddrsValid? = %ld", (unsigned long)LibInfo.AddressesAreValid); - UtAssert_True(LibInfo.CodeAddress > 0, "Lib Info -> CodeAddress = %ld", (unsigned long)LibInfo.CodeAddress); - UtAssert_True(LibInfo.CodeSize > 0, "Lib Info -> CodeSize = %ld", (unsigned long)LibInfo.CodeSize); - UtAssert_True(LibInfo.DataAddress > 0, "Lib Info -> DataAddress = %ld", (unsigned long)LibInfo.DataAddress); - UtAssert_True(LibInfo.DataSize > 0, "Lib Info -> DataSize = %ld", (unsigned long)LibInfo.DataSize); - UtAssert_True(LibInfo.BSSAddress > 0, "Lib Info -> BSSAddress = %ld", (unsigned long)LibInfo.BSSAddress); - UtAssert_True(LibInfo.BSSSize > 0, "Lib Info -> BSSSize = %ld", (unsigned long)LibInfo.BSSSize); + UtAssert_True(LibInfo.Code.Address > 0, "Lib Info -> CodeAddress = %ld", (unsigned long)LibInfo.Code.Address); + UtAssert_True(LibInfo.Code.Size > 0, "Lib Info -> Code.Size = %ld", (unsigned long)LibInfo.Code.Size); + UtAssert_True(LibInfo.Data.Address > 0, "Lib Info -> Data.Address = %ld", (unsigned long)LibInfo.Data.Address); + UtAssert_True(LibInfo.Data.Size > 0, "Lib Info -> Data.Size = %ld", (unsigned long)LibInfo.Data.Size); + UtAssert_True(LibInfo.BSS.Address > 0, "Lib Info -> BSS.Address = %ld", (unsigned long)LibInfo.BSS.Address); + UtAssert_True(LibInfo.BSS.Size > 0, "Lib Info -> BSS.Size = %ld", (unsigned long)LibInfo.BSS.Size); } else { diff --git a/modules/cfe_testcase/src/es_task_test.c b/modules/cfe_testcase/src/es_task_test.c index d4361d733..765460164 100644 --- a/modules/cfe_testcase/src/es_task_test.c +++ b/modules/cfe_testcase/src/es_task_test.c @@ -218,7 +218,7 @@ void TestChildTaskName(void) UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, CFE_ES_TASKID_UNDEFINED, sizeof(TaskNameBuf)), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, 0), CFE_ES_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, sizeof(TaskName) - 1), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, sizeof(TaskName) - 1), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_SUCCESS); } diff --git a/modules/cfe_testcase/src/evs_send_test.c b/modules/cfe_testcase/src/evs_send_test.c index bd25184c1..bd14a2ff8 100644 --- a/modules/cfe_testcase/src/evs_send_test.c +++ b/modules/cfe_testcase/src/evs_send_test.c @@ -39,6 +39,15 @@ void TestSendEvent(void) UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "OK Send"), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, NULL), CFE_EVS_INVALID_PARAMETER); + + UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_DEBUG, "OK (Debug) Send"), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_DEBUG, NULL), CFE_EVS_INVALID_PARAMETER); + + UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_ERROR, "OK (Error) Send"), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_ERROR, NULL), CFE_EVS_INVALID_PARAMETER); + + UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_CRITICAL, "OK (Critical) Send"), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_CRITICAL, NULL), CFE_EVS_INVALID_PARAMETER); } void TestSendEventAppID(void) @@ -55,6 +64,24 @@ void TestSendEventAppID(void) CFE_EVS_INVALID_PARAMETER); UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, CFE_ES_APPID_UNDEFINED, "OK"), CFE_EVS_APP_ILLEGAL_APP_ID); + + UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_DEBUG, AppId, " OK (Debug) App ID"), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_DEBUG, AppId, NULL), CFE_EVS_INVALID_PARAMETER); + UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_DEBUG, CFE_ES_APPID_UNDEFINED, "OK (Debug)"), + CFE_EVS_APP_ILLEGAL_APP_ID); + + UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_ERROR, AppId, "OK (Error) App ID"), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_ERROR, AppId, NULL), CFE_EVS_INVALID_PARAMETER); + UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_ERROR, CFE_ES_APPID_UNDEFINED, "OK (Error)"), + CFE_EVS_APP_ILLEGAL_APP_ID); + + UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_CRITICAL, AppId, "OK (Critical) App ID"), + CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_CRITICAL, AppId, NULL), + CFE_EVS_INVALID_PARAMETER); + UtAssert_INT32_EQ( + CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_CRITICAL, CFE_ES_APPID_UNDEFINED, "OK (Critical)"), + CFE_EVS_APP_ILLEGAL_APP_ID); } void TestSendTimedEvent(void) @@ -64,6 +91,15 @@ void TestSendTimedEvent(void) UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(Time, 0, CFE_EVS_EventType_INFORMATION, "OK Time"), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(Time, 0, CFE_EVS_EventType_INFORMATION, NULL), CFE_EVS_INVALID_PARAMETER); + + UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(Time, 0, CFE_EVS_EventType_DEBUG, "Ok (Debug) Time"), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(Time, 0, CFE_EVS_EventType_DEBUG, NULL), CFE_EVS_INVALID_PARAMETER); + + UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(Time, 0, CFE_EVS_EventType_ERROR, "Ok (Error) Time"), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(Time, 0, CFE_EVS_EventType_ERROR, NULL), CFE_EVS_INVALID_PARAMETER); + + UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(Time, 0, CFE_EVS_EventType_CRITICAL, "Ok (Critical) Time"), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(Time, 0, CFE_EVS_EventType_CRITICAL, NULL), CFE_EVS_INVALID_PARAMETER); } void EVSSendTestSetup(void) diff --git a/modules/cfe_testcase/src/message_id_test.c b/modules/cfe_testcase/src/message_id_test.c index 235d1cf8d..2956c2895 100644 --- a/modules/cfe_testcase/src/message_id_test.c +++ b/modules/cfe_testcase/src/message_id_test.c @@ -42,7 +42,7 @@ void TestMsgId(void) UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, expectedmsgid), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&msg, &msgid), CFE_SUCCESS); - UtAssert_UINT32_EQ(msgid, expectedmsgid); + CFE_Assert_MSGID_EQ(msgid, expectedmsgid); UtAssert_INT32_EQ(CFE_MSG_SetMsgId(NULL, msgid), CFE_MSG_BAD_ARGUMENT); @@ -93,4 +93,4 @@ void MessageIdTestSetup(void) { UtTest_Add(TestMsgId, NULL, NULL, "Test Set/Get Message ID"); UtTest_Add(TestGetTypeFromMsgId, NULL, NULL, "Test Get Type From Message ID"); -} \ No newline at end of file +} diff --git a/modules/cfe_testcase/src/msg_api_test.c b/modules/cfe_testcase/src/msg_api_test.c index 11e12f40d..9d1452e8b 100644 --- a/modules/cfe_testcase/src/msg_api_test.c +++ b/modules/cfe_testcase/src/msg_api_test.c @@ -50,79 +50,80 @@ void TestMsgApiBasic(void) bool _returned = false; memset(&cmd, 0xFF, sizeof(cmd)); - msgId = CFE_SB_ValueToMsgId(0); + msgId = CFE_SB_ValueToMsgId(1); /* test msg-init */ UtAssert_INT32_EQ(CFE_MSG_Init(NULL, CFE_SB_ValueToMsgId(0), sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_Init(&cmd.Msg, msgId, 0), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_Init(&cmd.Msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1, sizeof(cmd)), - CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), msgId, 0), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ( + CFE_MSG_Init(CFE_MSG_PTR(cmd), CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), sizeof(cmd)), + CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_Init(&cmd.Msg, msgId, sizeof(cmd)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), msgId, sizeof(cmd)), CFE_SUCCESS); /* test set-msg-size */ UtAssert_INT32_EQ(CFE_MSG_SetSize(NULL, 12), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetSize(&cmd.Msg, 0), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetSize(&cmd.Msg, UINT32_MAX), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetSize(CFE_MSG_PTR(cmd), 0), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetSize(CFE_MSG_PTR(cmd), UINT32_MAX), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetSize(&cmd.Msg, 12), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetSize(CFE_MSG_PTR(cmd), 12), CFE_SUCCESS); /* test get-msg-size */ UtAssert_INT32_EQ(CFE_MSG_GetSize(NULL, &size), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_GetSize(&cmd.Msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_GetSize(CFE_MSG_PTR(cmd), NULL), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_GetSize(&cmd.Msg, &size), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_GetSize(CFE_MSG_PTR(cmd), &size), CFE_SUCCESS); UtAssert_UINT32_EQ(size, 12); /* test get-type */ UtAssert_INT32_EQ(CFE_MSG_SetType(NULL, CFE_MSG_Type_Cmd), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetType(&cmd.Msg, CFE_MSG_Type_Invalid), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetType(CFE_MSG_PTR(cmd), CFE_MSG_Type_Invalid), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetType(&cmd.Msg, CFE_MSG_Type_Cmd), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetType(CFE_MSG_PTR(cmd), CFE_MSG_Type_Cmd), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetType(NULL, &type), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_GetType(&cmd.Msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_GetType(CFE_MSG_PTR(cmd), NULL), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_GetType(&cmd.Msg, &type), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_GetType(CFE_MSG_PTR(cmd), &type), CFE_SUCCESS); UtAssert_INT32_EQ(type, CFE_MSG_Type_Cmd); /* test msg set-type */ - UtAssert_INT32_EQ(CFE_MSG_SetType(&cmd.Msg, CFE_MSG_Type_Tlm), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetType(CFE_MSG_PTR(cmd), CFE_MSG_Type_Tlm), CFE_SUCCESS); /* check if set-type works like expected */ - UtAssert_INT32_EQ(CFE_MSG_GetType(&cmd.Msg, &type), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_GetType(CFE_MSG_PTR(cmd), &type), CFE_SUCCESS); UtAssert_INT32_EQ(type, CFE_MSG_Type_Tlm); /* test get header-version */ UtAssert_INT32_EQ(CFE_MSG_GetHeaderVersion(NULL, &hdrVer), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_GetHeaderVersion(&cmd.Msg, &hdrVer), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_GetHeaderVersion(&cmd.Msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_GetHeaderVersion(CFE_MSG_PTR(cmd), &hdrVer), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_GetHeaderVersion(CFE_MSG_PTR(cmd), NULL), CFE_MSG_BAD_ARGUMENT); /* test set header-version */ UtAssert_INT32_EQ(CFE_MSG_SetHeaderVersion(NULL, hdrVer), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetHeaderVersion(&cmd.Msg, UINT16_MAX), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetHeaderVersion(&cmd.Msg, 0), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_GetHeaderVersion(&cmd.Msg, &hdrVer), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetHeaderVersion(CFE_MSG_PTR(cmd), UINT16_MAX), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetHeaderVersion(CFE_MSG_PTR(cmd), 0), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_GetHeaderVersion(CFE_MSG_PTR(cmd), &hdrVer), CFE_SUCCESS); UtAssert_True(hdrVer == 0, "hdrVer = 0"); /* test get-has-secondary-header and set-has-secondary-header*/ UtAssert_INT32_EQ(CFE_MSG_GetHasSecondaryHeader(NULL, &_expected), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_GetHasSecondaryHeader(&cmd.Msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_GetHasSecondaryHeader(CFE_MSG_PTR(cmd), NULL), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(NULL, _expected), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(&cmd.Msg, _expected), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_GetHasSecondaryHeader(&cmd.Msg, &_returned), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(CFE_MSG_PTR(cmd), _expected), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_GetHasSecondaryHeader(CFE_MSG_PTR(cmd), &_returned), CFE_SUCCESS); UtAssert_UINT32_EQ(_expected, _returned); /* test get-apid */ UtAssert_INT32_EQ(CFE_MSG_GetApId(NULL, &appId), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_GetApId(&cmd.Msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_GetApId(CFE_MSG_PTR(cmd), NULL), CFE_MSG_BAD_ARGUMENT); /* test set-apid */ - UtAssert_INT32_EQ(CFE_MSG_SetApId(&cmd.Msg, 0xFFFF), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetApId(CFE_MSG_PTR(cmd), 0xFFFF), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_MSG_SetApId(NULL, 0), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetApId(&cmd.Msg, 5), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_GetApId(&cmd.Msg, &appId), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetApId(CFE_MSG_PTR(cmd), 5), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_GetApId(CFE_MSG_PTR(cmd), &appId), CFE_SUCCESS); UtAssert_INT32_EQ(appId, 5); } @@ -140,30 +141,30 @@ void TestMsgApiAdvanced(void) memset(&cmd, 0xFF, sizeof(cmd)); msgId = CFE_SB_ValueToMsgId(0); - UtAssert_INT32_EQ(CFE_MSG_Init(&cmd.Msg, msgId, sizeof(cmd)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), msgId, sizeof(cmd)), CFE_SUCCESS); /* test get/set-segmentation-flag */ UtAssert_INT32_EQ(CFE_MSG_GetSegmentationFlag(NULL, &segFlag), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_GetSegmentationFlag(&cmd.Msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_GetSegmentationFlag(CFE_MSG_PTR(cmd), NULL), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(NULL, CFE_MSG_SegFlag_Continue), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(&cmd.Msg, CFE_MSG_SegFlag_Invalid), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(CFE_MSG_PTR(cmd), CFE_MSG_SegFlag_Invalid), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(&cmd.Msg, CFE_MSG_SegFlag_Continue), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(&cmd.Msg, CFE_MSG_SegFlag_First), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(&cmd.Msg, CFE_MSG_SegFlag_Last), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(&cmd.Msg, CFE_MSG_SegFlag_Unsegmented), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_GetSegmentationFlag(&cmd.Msg, &segFlag), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(CFE_MSG_PTR(cmd), CFE_MSG_SegFlag_Continue), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(CFE_MSG_PTR(cmd), CFE_MSG_SegFlag_First), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(CFE_MSG_PTR(cmd), CFE_MSG_SegFlag_Last), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetSegmentationFlag(CFE_MSG_PTR(cmd), CFE_MSG_SegFlag_Unsegmented), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_GetSegmentationFlag(CFE_MSG_PTR(cmd), &segFlag), CFE_SUCCESS); UtAssert_UINT32_EQ(segFlag, CFE_MSG_SegFlag_Unsegmented); /* test set/get-sequence-count */ UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(NULL, 2), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&cmd.Msg, UINT16_MAX), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(CFE_MSG_PTR(cmd), UINT16_MAX), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(NULL, &seqCnt), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&cmd.Msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(CFE_MSG_PTR(cmd), NULL), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&cmd.Msg, 2), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&cmd.Msg, &seqCnt), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(CFE_MSG_PTR(cmd), 2), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(CFE_MSG_PTR(cmd), &seqCnt), CFE_SUCCESS); UtAssert_INT32_EQ(seqCnt, 2); /* test get-next-sequence-count */ @@ -191,17 +192,17 @@ void TestMsgHeaderSecondaryApi(void) memset(&cmd2, 0xFF, sizeof(cmd2)); /* msg-init */ - UtAssert_INT32_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(0), sizeof(cmd)), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(&cmd.Msg, true), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_SetType(&cmd.Msg, CFE_MSG_Type_Cmd), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), CFE_SB_ValueToMsgId(1), sizeof(cmd)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(CFE_MSG_PTR(cmd), true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetType(CFE_MSG_PTR(cmd), CFE_MSG_Type_Cmd), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_Init(&cmdTlm.Msg, CFE_SB_ValueToMsgId(1), sizeof(cmdTlm)), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(&cmdTlm.Msg, true), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_SetType(&cmdTlm.Msg, CFE_MSG_Type_Tlm), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmdTlm), CFE_SB_ValueToMsgId(2), sizeof(cmdTlm)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(CFE_MSG_PTR(cmdTlm), true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetType(CFE_MSG_PTR(cmdTlm), CFE_MSG_Type_Tlm), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_Init(&cmd2.Msg, CFE_SB_ValueToMsgId(2), sizeof(cmd2)), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(&cmd2.Msg, true), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_SetType(&cmd2.Msg, CFE_MSG_Type_Cmd), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd2), CFE_SB_ValueToMsgId(3), sizeof(cmd2)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(CFE_MSG_PTR(cmd2), true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetType(CFE_MSG_PTR(cmd2), CFE_MSG_Type_Cmd), CFE_SUCCESS); /* test generate-checksum */ status = CFE_MSG_GenerateChecksum(NULL); @@ -212,37 +213,37 @@ void TestMsgHeaderSecondaryApi(void) else { UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(NULL), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(&cmdTlm.Msg), CFE_MSG_WRONG_MSG_TYPE); - UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(&cmdTlm.Msg, &isValid), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(CFE_MSG_PTR(cmdTlm)), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(CFE_MSG_PTR(cmdTlm), &isValid), CFE_MSG_WRONG_MSG_TYPE); UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(NULL, &isValid), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(&cmdTlm.Msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(CFE_MSG_PTR(cmdTlm), NULL), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(&cmd.Msg, &isValid), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(CFE_MSG_PTR(cmd), &isValid), CFE_SUCCESS); UtAssert_True(!isValid, "Checksum isValid (%d) = false", isValid); - UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(&cmd.Msg), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(&cmd.Msg, &isValid), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(CFE_MSG_PTR(cmd)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(CFE_MSG_PTR(cmd), &isValid), CFE_SUCCESS); UtAssert_True(isValid, "Checksum isValid (%d) = true", isValid); } /* test get/set-fcn-code */ UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(NULL, 4), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(&cmdTlm.Msg, 4), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(CFE_MSG_PTR(cmdTlm), 4), CFE_MSG_WRONG_MSG_TYPE); - UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(&cmd.Msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(CFE_MSG_PTR(cmd), NULL), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(NULL, &fcnCode), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(&cmdTlm.Msg, &fcnCode), CFE_MSG_WRONG_MSG_TYPE); + UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(CFE_MSG_PTR(cmdTlm), &fcnCode), CFE_MSG_WRONG_MSG_TYPE); - UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(&cmd.Msg, 4), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(&cmd.Msg, &fcnCode), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(CFE_MSG_PTR(cmd), 4), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(CFE_MSG_PTR(cmd), &fcnCode), CFE_SUCCESS); UtAssert_INT32_EQ(fcnCode, 4); /* test get/set-msg-time */ - UtAssert_INT32_EQ(CFE_MSG_SetType(&cmd.Msg, CFE_MSG_Type_Tlm), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetType(CFE_MSG_PTR(cmd), CFE_MSG_Type_Tlm), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(NULL, &msgTime), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(&cmd.Msg, NULL), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(CFE_MSG_PTR(cmd), NULL), CFE_MSG_BAD_ARGUMENT); - CFE_Assert_STATUS_STORE(CFE_MSG_GetMsgTime(&cmd2.Msg, &msgTime)); + CFE_Assert_STATUS_STORE(CFE_MSG_GetMsgTime(CFE_MSG_PTR(cmd2), &msgTime)); if (!CFE_Assert_STATUS_MAY_BE(CFE_SUCCESS)) { CFE_Assert_STATUS_MUST_BE(CFE_MSG_WRONG_MSG_TYPE); @@ -250,14 +251,14 @@ void TestMsgHeaderSecondaryApi(void) UtAssert_INT32_EQ(CFE_MSG_SetMsgTime(NULL, currentTime), CFE_MSG_BAD_ARGUMENT); - CFE_Assert_STATUS_STORE(CFE_MSG_SetMsgTime(&cmd2.Msg, currentTime)); + CFE_Assert_STATUS_STORE(CFE_MSG_SetMsgTime(CFE_MSG_PTR(cmd2), currentTime)); if (!CFE_Assert_STATUS_MAY_BE(CFE_SUCCESS)) { CFE_Assert_STATUS_MUST_BE(CFE_MSG_WRONG_MSG_TYPE); } - UtAssert_INT32_EQ(CFE_MSG_SetMsgTime(&cmd.Msg, currentTime), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(&cmd.Msg, &msgTime), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_SetMsgTime(CFE_MSG_PTR(cmd), currentTime), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(CFE_MSG_PTR(cmd), &msgTime), CFE_SUCCESS); UtAssert_UINT32_EQ(CFE_TIME_Compare(msgTime, currentTime), CFE_TIME_EQUAL); } diff --git a/modules/cfe_testcase/src/sb_sendrecv_test.c b/modules/cfe_testcase/src/sb_sendrecv_test.c index 36c708332..0c64451fa 100644 --- a/modules/cfe_testcase/src/sb_sendrecv_test.c +++ b/modules/cfe_testcase/src/sb_sendrecv_test.c @@ -39,15 +39,15 @@ /* A simple command message */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; - uint32 CmdPayload; + CFE_MSG_CommandHeader_t CommandHeader; + uint64 CmdPayload; } CFE_FT_TestCmdMessage_t; /* A simple telemetry message */ typedef struct { - CFE_MSG_TelemetryHeader_t TlmHeader; - uint32 TlmPayload; + CFE_MSG_TelemetryHeader_t TelemetryHeader; + uint64 TlmPayload; } CFE_FT_TestTlmMessage_t; /* A message intended to be (overall) larger than the CFE_MISSION_SB_MAX_SB_MSG_SIZE */ @@ -90,34 +90,34 @@ void TestBasicTransmitRecv(void) UtAssert_INT32_EQ(CFE_SB_SubscribeEx(CFE_FT_TLM_MSGID, PipeId2, CFE_SB_DEFAULT_QOS, 3), CFE_SUCCESS); /* Initialize the message content */ - UtAssert_INT32_EQ(CFE_MSG_Init(&CmdMsg.CmdHeader.Msg, CFE_FT_CMD_MSGID, sizeof(CmdMsg)), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_Init(&TlmMsg.TlmHeader.Msg, CFE_FT_TLM_MSGID, sizeof(TlmMsg)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(CmdMsg.CommandHeader), CFE_FT_CMD_MSGID, sizeof(CmdMsg)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(TlmMsg.TelemetryHeader), CFE_FT_TLM_MSGID, sizeof(TlmMsg)), CFE_SUCCESS); - CFE_MSG_SetSequenceCount(&CmdMsg.CmdHeader.Msg, 11); - CFE_MSG_SetSequenceCount(&TlmMsg.TlmHeader.Msg, 21); + CFE_MSG_SetSequenceCount(CFE_MSG_PTR(CmdMsg.CommandHeader), 11); + CFE_MSG_SetSequenceCount(CFE_MSG_PTR(TlmMsg.TelemetryHeader), 21); /* Sending with sequence update should ignore the sequence in the msg struct */ CmdMsg.CmdPayload = 0x0c0ffee; TlmMsg.TlmPayload = 0x0d00d1e; - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&CmdMsg.CmdHeader.Msg, true), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&TlmMsg.TlmHeader.Msg, true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), true), CFE_SUCCESS); CmdMsg.CmdPayload = 0x1c0ffee; TlmMsg.TlmPayload = 0x1d00d1e; - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&CmdMsg.CmdHeader.Msg, true), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&TlmMsg.TlmHeader.Msg, true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), true), CFE_SUCCESS); /* Sending without sequence update should use the sequence in the msg struct */ CmdMsg.CmdPayload = 0x2c0ffee; TlmMsg.TlmPayload = 0x2d00d1e; - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&CmdMsg.CmdHeader.Msg, false), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&TlmMsg.TlmHeader.Msg, false), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), false), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), false), CFE_SUCCESS); /* Sending again should trigger MsgLimit errors on the pipe, however the call still returns CFE_SUCCESS */ CmdMsg.CmdPayload = 0x3c0ffee; TlmMsg.TlmPayload = 0x3d00d1e; - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&CmdMsg.CmdHeader.Msg, true), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&TlmMsg.TlmHeader.Msg, true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), true), CFE_SUCCESS); /* Attempt to send a msg which does not have a valid msgid */ memset(&CFE_FT_BigMsg, 0xFF, sizeof(CFE_FT_BigMsg)); @@ -247,17 +247,17 @@ void TestMsgBroadcast(void) UtAssert_INT32_EQ(CFE_SB_SubscribeEx(CFE_FT_CMD_MSGID, PipeId4, CFE_SB_DEFAULT_QOS, 6), CFE_SUCCESS); /* Initialize the message content */ - UtAssert_INT32_EQ(CFE_MSG_Init(&CmdMsg.CmdHeader.Msg, CFE_FT_CMD_MSGID, sizeof(CmdMsg)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(CmdMsg.CommandHeader), CFE_FT_CMD_MSGID, sizeof(CmdMsg)), CFE_SUCCESS); /* Make unique content in each message. Sending should always be successful. */ CmdMsg.CmdPayload = 0xbabb1e00; - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&CmdMsg.CmdHeader.Msg, true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); CmdMsg.CmdPayload = 0xbabb1e01; - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&CmdMsg.CmdHeader.Msg, true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); CmdMsg.CmdPayload = 0xbabb1e02; - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&CmdMsg.CmdHeader.Msg, true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); CmdMsg.CmdPayload = 0xbabb1e03; - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&CmdMsg.CmdHeader.Msg, true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); /* Now receive 1st message from Pipes, actual msg should appear on all (no limit violations here) */ UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf1, PipeId1, CFE_SB_POLL), CFE_SUCCESS); @@ -326,9 +326,9 @@ void TestMsgBroadcast(void) /* Send two more messages */ CmdMsg.CmdPayload = 0xbabb1e04; - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&CmdMsg.CmdHeader.Msg, true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); CmdMsg.CmdPayload = 0xbabb1e05; - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&CmdMsg.CmdHeader.Msg, true), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); /* poll all pipes again, message should appear on all except PipeId2 (Unsubscribed) */ UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf1, PipeId1, CFE_SB_POLL), CFE_SUCCESS); diff --git a/modules/cfe_testcase/src/sb_subscription_test.c b/modules/cfe_testcase/src/sb_subscription_test.c index 8e1745272..628360445 100644 --- a/modules/cfe_testcase/src/sb_subscription_test.c +++ b/modules/cfe_testcase/src/sb_subscription_test.c @@ -54,7 +54,6 @@ void TestSubscribeUnsubscribe(void) /* Subscribe - Confirm Bad MsgId Arg Rejection */ UtAssert_INT32_EQ(CFE_SB_Subscribe(CFE_SB_INVALID_MSG_ID, PipeId1), CFE_SB_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_SB_Subscribe(CFE_SB_MSGID_RESERVED, PipeId2), CFE_SB_BAD_ARGUMENT); /* Subscribe - Confirm Bad PipeId Arg Rejection */ UtAssert_INT32_EQ(CFE_SB_Subscribe(CFE_FT_CMD_MSGID, CFE_SB_INVALID_PIPE), CFE_SB_BAD_ARGUMENT); @@ -73,7 +72,6 @@ void TestSubscribeUnsubscribe(void) /* Unsubscribe - Confirm Bad MsgId Arg Rejection */ UtAssert_INT32_EQ(CFE_SB_Unsubscribe(CFE_SB_INVALID_MSG_ID, PipeId1), CFE_SB_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_SB_Unsubscribe(CFE_SB_MSGID_RESERVED, PipeId2), CFE_SB_BAD_ARGUMENT); /* Unsubscribe - Confirm Bad PipeId Arg Rejection */ UtAssert_INT32_EQ(CFE_SB_Unsubscribe(CFE_FT_CMD_MSGID, CFE_SB_INVALID_PIPE), CFE_SB_BAD_ARGUMENT); @@ -108,7 +106,6 @@ void TestSubscribeUnsubscribeLocal(void) /* Subscribe - Confirm Bad MsgId Arg Rejection */ UtAssert_INT32_EQ(CFE_SB_SubscribeLocal(CFE_SB_INVALID_MSG_ID, PipeId1, 2), CFE_SB_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_SB_SubscribeLocal(CFE_SB_MSGID_RESERVED, PipeId2, 2), CFE_SB_BAD_ARGUMENT); /* Subscribe - Confirm Bad PipeId Arg Rejection */ UtAssert_INT32_EQ(CFE_SB_SubscribeLocal(CFE_FT_CMD_MSGID, CFE_SB_INVALID_PIPE, 2), CFE_SB_BAD_ARGUMENT); @@ -127,7 +124,6 @@ void TestSubscribeUnsubscribeLocal(void) /* Unsubscribe - Confirm Bad MsgId Arg Rejection */ UtAssert_INT32_EQ(CFE_SB_UnsubscribeLocal(CFE_SB_INVALID_MSG_ID, PipeId1), CFE_SB_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_SB_UnsubscribeLocal(CFE_SB_MSGID_RESERVED, PipeId2), CFE_SB_BAD_ARGUMENT); /* Unsubscribe - Confirm Bad PipeId Arg Rejection */ UtAssert_INT32_EQ(CFE_SB_UnsubscribeLocal(CFE_FT_CMD_MSGID, CFE_SB_INVALID_PIPE), CFE_SB_BAD_ARGUMENT); @@ -174,7 +170,6 @@ void TestSubscribeEx(void) /* Subscribe - Confirm Bad MsgId Arg Rejection */ UtAssert_INT32_EQ(CFE_SB_SubscribeEx(CFE_SB_INVALID_MSG_ID, PipeId1, CFE_SB_DEFAULT_QOS, 2), CFE_SB_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_SB_SubscribeEx(CFE_SB_MSGID_RESERVED, PipeId2, CFE_SB_DEFAULT_QOS, 2), CFE_SB_BAD_ARGUMENT); /* Subscribe - Confirm Bad PipeId Arg Rejection */ UtAssert_INT32_EQ(CFE_SB_SubscribeEx(CFE_FT_CMD_MSGID, CFE_SB_INVALID_PIPE, CFE_SB_DEFAULT_QOS, 2), @@ -214,7 +209,7 @@ void TestSBMaxSubscriptions(void) while (NumSubs <= CFE_PLATFORM_SB_MAX_MSG_IDS) { /* fabricate a msgid to subscribe to (this may overlap real msgids) */ - TestMsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_PLATFORM_CMD_MID_BASE + NumSubs); + TestMsgId = CFE_SB_ValueToMsgId(CFE_PLATFORM_CMD_MID_BASE + NumSubs); Status = CFE_SB_Subscribe(TestMsgId, PipeId); if (Status != CFE_SUCCESS) diff --git a/modules/cfe_testcase/src/tbl_content_mang_test.c b/modules/cfe_testcase/src/tbl_content_mang_test.c index c0a133aea..77e85c23c 100644 --- a/modules/cfe_testcase/src/tbl_content_mang_test.c +++ b/modules/cfe_testcase/src/tbl_content_mang_test.c @@ -68,6 +68,7 @@ void TestLoad(void) TBL_TEST_Table_t TestTable = {0xd00d, 0xdad}; TBL_TEST_Table_t *TablePtr; CFE_TBL_Handle_t OtherHandle; + void * TempPtr; UtPrintf("Testing: CFE_TBL_Load"); @@ -107,7 +108,8 @@ void TestLoad(void) UtAssert_INT32_EQ(CFE_TBL_Load(CFE_FT_Global.TblHandle, CFE_TBL_SRC_FILE, TESTTBL_NOMINAL_FILE), CFE_SUCCESS); /* confirm content (football) */ - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&TablePtr, CFE_FT_Global.TblHandle), CFE_TBL_INFO_UPDATED); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TempPtr, CFE_FT_Global.TblHandle), CFE_TBL_INFO_UPDATED); + TablePtr = TempPtr; UtAssert_UINT32_EQ(TablePtr->Int1, 0xf007); UtAssert_UINT32_EQ(TablePtr->Int2, 0xba11); UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_FT_Global.TblHandle), CFE_SUCCESS); @@ -117,7 +119,8 @@ void TestLoad(void) CFE_TBL_ERR_FILE_TOO_LARGE); /* confirm content again (note content should not have been updated) */ - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&TablePtr, CFE_FT_Global.TblHandle), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TempPtr, CFE_FT_Global.TblHandle), CFE_SUCCESS); + TablePtr = TempPtr; UtAssert_UINT32_EQ(TablePtr->Int1, 0xf007); UtAssert_UINT32_EQ(TablePtr->Int2, 0xba11); UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_FT_Global.TblHandle), CFE_SUCCESS); @@ -126,7 +129,8 @@ void TestLoad(void) UtAssert_INT32_EQ(CFE_TBL_Load(CFE_FT_Global.TblHandle, CFE_TBL_SRC_FILE, TESTTBL_ALTERNATE_FILE), CFE_SUCCESS); /* confirm content again (changed to alternate data) */ - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&TablePtr, CFE_FT_Global.TblHandle), CFE_TBL_INFO_UPDATED); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TempPtr, CFE_FT_Global.TblHandle), CFE_TBL_INFO_UPDATED); + TablePtr = TempPtr; UtAssert_UINT32_EQ(TablePtr->Int1, 0xdead); UtAssert_UINT32_EQ(TablePtr->Int2, 0xbeef); UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_FT_Global.TblHandle), CFE_SUCCESS); @@ -136,7 +140,8 @@ void TestLoad(void) CFE_TBL_ERR_LOAD_INCOMPLETE); /* confirm content again (should not be changed) */ - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&TablePtr, CFE_FT_Global.TblHandle), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TempPtr, CFE_FT_Global.TblHandle), CFE_SUCCESS); + TablePtr = TempPtr; UtAssert_UINT32_EQ(TablePtr->Int1, 0xdead); UtAssert_UINT32_EQ(TablePtr->Int2, 0xbeef); UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_FT_Global.TblHandle), CFE_SUCCESS); @@ -145,13 +150,15 @@ void TestLoad(void) UtAssert_INT32_EQ(CFE_TBL_Load(OtherHandle, CFE_TBL_SRC_FILE, TESTTBL_OTHERTBL_FILE), CFE_SUCCESS); /* confirm content of first table again (should not be changed) */ - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&TablePtr, CFE_FT_Global.TblHandle), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TempPtr, CFE_FT_Global.TblHandle), CFE_SUCCESS); + TablePtr = TempPtr; UtAssert_UINT32_EQ(TablePtr->Int1, 0xdead); UtAssert_UINT32_EQ(TablePtr->Int2, 0xbeef); UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_FT_Global.TblHandle), CFE_SUCCESS); /* confirm content of other table (boatload) */ - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&TablePtr, OtherHandle), CFE_TBL_INFO_UPDATED); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TempPtr, OtherHandle), CFE_TBL_INFO_UPDATED); + TablePtr = TempPtr; UtAssert_UINT32_EQ(TablePtr->Int1, 0xb0a7); UtAssert_UINT32_EQ(TablePtr->Int2, 0x10ad); UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(OtherHandle), CFE_SUCCESS); @@ -161,7 +168,8 @@ void TestLoad(void) /* confirm content again (reported as updated from partial load) */ /* Should have updated the first word only */ - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&TablePtr, CFE_FT_Global.TblHandle), CFE_TBL_INFO_UPDATED); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TempPtr, CFE_FT_Global.TblHandle), CFE_TBL_INFO_UPDATED); + TablePtr = TempPtr; UtAssert_UINT32_EQ(TablePtr->Int1, 0x5555); UtAssert_UINT32_EQ(TablePtr->Int2, 0xbeef); UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_FT_Global.TblHandle), CFE_SUCCESS); @@ -171,7 +179,8 @@ void TestLoad(void) /* confirm content again (reported as updated from partial load) */ /* Should have updated the second word only */ - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&TablePtr, CFE_FT_Global.TblHandle), CFE_TBL_INFO_UPDATED); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TempPtr, CFE_FT_Global.TblHandle), CFE_TBL_INFO_UPDATED); + TablePtr = TempPtr; UtAssert_UINT32_EQ(TablePtr->Int1, 0x5555); UtAssert_UINT32_EQ(TablePtr->Int2, 0x6666); UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_FT_Global.TblHandle), CFE_SUCCESS); diff --git a/modules/cfe_testcase/src/tbl_information_test.c b/modules/cfe_testcase/src/tbl_information_test.c index 813aa4ef0..bb44c31dc 100644 --- a/modules/cfe_testcase/src/tbl_information_test.c +++ b/modules/cfe_testcase/src/tbl_information_test.c @@ -78,7 +78,7 @@ void TestNotifyByMessage(void) UtPrintf("Testing: CFE_TBL_NotifyByMessage"); CFE_TBL_Handle_t SharedTblHandle; const char * SharedTblName = "SAMPLE_APP.SampleAppTable"; - CFE_SB_MsgId_t TestMsgId = CFE_TEST_CMD_MID; + CFE_SB_MsgId_t TestMsgId = CFE_SB_ValueToMsgId(CFE_TEST_CMD_MID); CFE_MSG_FcnCode_t TestCmdCode = 0; uint32 TestParameter = 0; diff --git a/modules/cfe_testcase/src/tbl_registration_test.c b/modules/cfe_testcase/src/tbl_registration_test.c index ed300ece3..dcbf74885 100644 --- a/modules/cfe_testcase/src/tbl_registration_test.c +++ b/modules/cfe_testcase/src/tbl_registration_test.c @@ -220,7 +220,7 @@ void TestTblNonAppContext(void) CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_TBL_Manage(CFE_FT_Global.TblHandle), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_TBL_Modified(CFE_FT_Global.TblHandle), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UtAssert_INT32_EQ(CFE_TBL_NotifyByMessage(CFE_FT_Global.TblHandle, CFE_TEST_CMD_MID, 0, 0), + UtAssert_INT32_EQ(CFE_TBL_NotifyByMessage(CFE_FT_Global.TblHandle, CFE_SB_ValueToMsgId(CFE_TEST_CMD_MID), 0, 0), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_FT_Global.TblHandle), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_TBL_Share(&Handle, CFE_FT_Global.TblName), CFE_ES_ERR_RESOURCEID_NOT_VALID); diff --git a/modules/config/CMakeLists.txt b/modules/config/CMakeLists.txt new file mode 100644 index 000000000..6c8ddf1f0 --- /dev/null +++ b/modules/config/CMakeLists.txt @@ -0,0 +1,29 @@ +################################################################## +# +# cFE Configuration Service (CONFIG) module CMake build recipe +# +################################################################## + +project(CFE_CONFIG C) + +# Executive services source files +set(config_SOURCES + fsw/src/cfe_config_init.c + fsw/src/cfe_config_lookup.c + fsw/src/cfe_config_get.c + fsw/src/cfe_config_set.c +) +add_library(config STATIC + ${config_SOURCES} + ${MISSION_BINARY_DIR}/src/cfe_config_map.c +) + +# need to include the "src" dir explicitly here, in order to compile +# the generated tables under ${MISSION_BINARY_DIR} +target_include_directories(config PRIVATE fsw/src) +target_link_libraries(config PRIVATE core_private) + +# Add unit test coverage subdirectory +if (ENABLE_UNIT_TESTS) + add_subdirectory(ut-coverage) +endif (ENABLE_UNIT_TESTS) diff --git a/modules/config/cmake/cfe_config_ids.h.in b/modules/config/cmake/cfe_config_ids.h.in new file mode 100644 index 000000000..ab7f2d2bc --- /dev/null +++ b/modules/config/cmake/cfe_config_ids.h.in @@ -0,0 +1,22 @@ +/* This file is auto-generated from CMake build system. Do not manually edit! */ +#ifndef CFE_CONFIG_IDS_H +#define CFE_CONFIG_IDS_H + +#include "cfe_config_api_typedefs.h" +#include "cfe_resourceid.h" +#include "cfe_core_resourceid_basevalues.h" + +/* Value offsets from base (needed for macros; do not use directly) */ +enum CFE_ConfigIdOffset +{ +@GENERATED_ENUM_OFFSET_LIST@ + CFE_ConfigIdOffset_MAX +}; + +/* + * Set of actual CONFIGID constants - + * these may be used in application code + */ +@GENERATED_CONSTANT_DEFINE_LIST@ + +#endif /* CFE_CONFIG_IDS_H */ diff --git a/modules/config/cmake/cfe_config_map.c.in b/modules/config/cmake/cfe_config_map.c.in new file mode 100644 index 000000000..b15ea89ba --- /dev/null +++ b/modules/config/cmake/cfe_config_map.c.in @@ -0,0 +1,8 @@ +/* This file is auto-generated from CMake build system. Do not manually edit! */ +#include "cfe_config_map.h" + +/* Map of configuration key IDs to printable names */ +const CFE_Config_IdNameEntry_t CFE_CONFIG_IDNAME_MAP[CFE_ConfigIdOffset_MAX] = +{ +@GENERATED_IDNAME_MAP_LIST@ +}; diff --git a/modules/config/fsw/src/cfe_config_get.c b/modules/config/fsw/src/cfe_config_get.c new file mode 100644 index 000000000..f1dc11f65 --- /dev/null +++ b/modules/config/fsw/src/cfe_config_get.c @@ -0,0 +1,175 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/** + * @file + * + * API definition for configuration registry + * + * This defines the "getter" functions, which are publicly available + */ + +/* +** Required header files. +*/ +#include "cfe_config_priv.h" +#include "cfe_config_map.h" + +#include + +/*---------------------------------------------------------------- + * + * Function: CFE_Config_GetValue + * + * Defined per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +uint32 CFE_Config_GetValue(CFE_ConfigId_t ConfigId) +{ + const CFE_Config_ValueEntry_t *Entry; + + Entry = CFE_Config_LocateConfigRecordByID(ConfigId); + if (Entry == NULL || Entry->ActualType != CFE_ConfigType_VALUE) + { + return 0; + } + + return Entry->Datum.AsInteger; +} + +/*---------------------------------------------------------------- + * + * Function: CFE_Config_GetObjPointer + * + * Defined per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +const void *CFE_Config_GetObjPointer(CFE_ConfigId_t ConfigId) +{ + const CFE_Config_ValueEntry_t *Entry; + + Entry = CFE_Config_LocateConfigRecordByID(ConfigId); + if (Entry == NULL || (Entry->ActualType != CFE_ConfigType_POINTER && Entry->ActualType != CFE_ConfigType_STRING)) + { + return NULL; + } + + return Entry->Datum.AsPointer; +} + +/*---------------------------------------------------------------- + * + * Function: CFE_Config_GetObjPointer + * + * Defined per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +const char *CFE_Config_GetString(CFE_ConfigId_t ConfigId) +{ + const CFE_Config_ValueEntry_t *Entry; + + Entry = CFE_Config_LocateConfigRecordByID(ConfigId); + if (Entry == NULL || Entry->ActualType != CFE_ConfigType_STRING) + { + return CFE_Config_Global.UnknownString; + } + + return Entry->Datum.AsPointer; +} + +/*---------------------------------------------------------------- + * + * Function: CFE_Config_GetName + * + * Defined per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +const char *CFE_Config_GetName(CFE_ConfigId_t ConfigId) +{ + uint32 OffsetVal; + + OffsetVal = CFE_Config_IdToOffset(ConfigId); + + if (OffsetVal >= CFE_ConfigIdOffset_MAX) + { + return CFE_Config_Global.UnknownString; + } + + return CFE_CONFIG_IDNAME_MAP[OffsetVal].Name; +} + +/*---------------------------------------------------------------- + * + * Function: CFE_Config_GetIdByName + * + * Defined per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +CFE_ConfigId_t CFE_Config_GetIdByName(const char *Name) +{ + const CFE_Config_IdNameEntry_t *NamePtr; + uint32 OffsetVal; + + NamePtr = CFE_CONFIG_IDNAME_MAP; + for (OffsetVal = 0; OffsetVal < CFE_ConfigIdOffset_MAX; ++OffsetVal) + { + if (NamePtr->Name != NULL && strcmp(NamePtr->Name, Name) == 0) + { + break; + } + ++NamePtr; + } + + if (OffsetVal >= CFE_ConfigIdOffset_MAX) + { + return CFE_CONFIGID_UNDEFINED; + } + + return CFE_Config_OffsetToId(OffsetVal); +} + +/*---------------------------------------------------------------- + * + * Function: CFE_Config_GetIdByName + * + * Defined per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_Config_IterateAll(void *Arg, CFE_Config_Callback_t Callback) +{ + const CFE_Config_IdNameEntry_t *NamePtr; + uint32 OffsetVal; + + NamePtr = CFE_CONFIG_IDNAME_MAP; + for (OffsetVal = 0; OffsetVal < CFE_ConfigIdOffset_MAX; ++OffsetVal) + { + if (CFE_Config_Global.Table[OffsetVal].ActualType != CFE_ConfigType_UNDEFINED) + { + Callback(Arg, CFE_Config_OffsetToId(OffsetVal), NamePtr->Name); + } + ++NamePtr; + } +} diff --git a/modules/config/fsw/src/cfe_config_init.c b/modules/config/fsw/src/cfe_config_init.c new file mode 100644 index 000000000..4539ae6a1 --- /dev/null +++ b/modules/config/fsw/src/cfe_config_init.c @@ -0,0 +1,229 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/** + * @file + * + * Initialization for CFE configuration registry + */ + +#include "cfe_config_priv.h" +#include "cfe_error.h" +#include "cfe_version.h" +#include "target_config.h" + +#include "cfe_config_map.h" +#include "cfe_config_ids.h" + +#include +#include +#include + +/* The define names are uppercase while the module names are likely lowercase */ +/* C99 does not have a standard "strcasecmp" - must do it manually */ +bool CFE_Config_StrCaseEq(const char *c1, const char *c2) +{ + while (*c1 != 0 && *c2 != 0) + { + if (toupper((unsigned char)*c1) != toupper((unsigned char)*c2)) + { + break; + } + ++c1; + ++c2; + } + + return (*c1 == 0 && *c2 == 0); +} + +/*---------------------------------------------------------------- + * + * Function: CFE_Config_FindTargetKeyValue + * + * Internal helper routine only, not part of API. + * + * Find value for given config key + * + *-----------------------------------------------------------------*/ +const char *CFE_Config_FindTargetKeyValue(CFE_ConfigKeyValue_t *ConfigList, const char *KeyName) +{ + const char *ValuePtr; + + ValuePtr = NULL; + if (KeyName != NULL && ConfigList != NULL) + { + while (ConfigList->Key != NULL) + { + if (CFE_Config_StrCaseEq(KeyName, ConfigList->Key)) + { + ValuePtr = ConfigList->Value; + break; + } + ++ConfigList; + } + } + + return ValuePtr; +} + +const char *CFE_Config_IsModuleInList(CFE_ConfigName_t *ModuleListPtr, const char *ModuleName) +{ + const char *Result; + + Result = NULL; + while (ModuleListPtr != NULL && ModuleListPtr->Name != NULL) + { + if (CFE_Config_StrCaseEq(ModuleListPtr->Name, ModuleName)) + { + Result = ModuleListPtr->Name; + break; + } + ++ModuleListPtr; + } + + return Result; +} + +const char *CFE_Config_IsPspModule(CFE_StaticModuleLoadEntry_t *PspModuleList, const char *ModuleName) +{ + const char * Result; + CFE_StaticModuleLoadEntry_t *ModuleListPtr; + + ModuleListPtr = PspModuleList; + Result = NULL; + while (ModuleListPtr != NULL && ModuleListPtr->Name != NULL) + { + if (CFE_Config_StrCaseEq(ModuleListPtr->Name, ModuleName)) + { + Result = ModuleListPtr->Name; + break; + } + ++ModuleListPtr; + } + + return Result; +} + +const char *CFE_Config_FindStaticModName(CFE_ConfigName_t *ModuleListSet[], size_t SetLength, const char *ModuleName) +{ + const char *Result; + size_t i; + + Result = NULL; + for (i = 0; i < SetLength; ++i) + { + Result = CFE_Config_IsModuleInList(ModuleListSet[i], ModuleName); + if (Result != NULL) + { + break; + } + } + + return Result; +} + +void CFE_Config_SetupModuleVersions(CFE_ConfigName_t *ModuleListSet[], size_t SetLength, + CFE_ConfigKeyValue_t *ActiveList) +{ + const char * ModName; + const char * KeyVal; + uint32 OffsetVal; + const CFE_Config_IdNameEntry_t *NamePtr; + + static const char IDNAME_PREFIX[] = "MOD_SRCVER_"; + + NamePtr = CFE_CONFIG_IDNAME_MAP; + for (OffsetVal = 0; OffsetVal < CFE_ConfigIdOffset_MAX; ++OffsetVal) + { + if (NamePtr->Name != NULL && strncmp(NamePtr->Name, IDNAME_PREFIX, sizeof(IDNAME_PREFIX) - 1) == 0) + { + ModName = NamePtr->Name + sizeof(IDNAME_PREFIX) - 1; + + /* skip modules which are not statically linked (version depends on dynamic load) */ + ModName = CFE_Config_FindStaticModName(ModuleListSet, SetLength, ModName); + if (ModName != NULL) + { + KeyVal = CFE_Config_FindTargetKeyValue(ActiveList, ModName); + if (KeyVal != NULL) + { + CFE_Config_SetString(CFE_Config_OffsetToId(OffsetVal), KeyVal); + } + } + } + ++NamePtr; + } +} + +void CFE_Config_SetupBasicBuildInfo(void) +{ + const char *KeyVal; + + /* Global mission name */ + CFE_Config_SetString(CFE_CONFIGID_MISSION_NAME, GLOBAL_CONFIGDATA.MissionName); + KeyVal = CFE_Config_FindTargetKeyValue(GLOBAL_CONFIGDATA.ModuleVersionList, "MISSION"); + CFE_Config_SetString(CFE_CONFIGID_MISSION_SRCVER, KeyVal); + + /* propagate the version numbers from version.h */ + CFE_Config_SetValue(CFE_CONFIGID_CORE_VERSION_MAJOR, CFE_MAJOR_VERSION); + CFE_Config_SetValue(CFE_CONFIGID_CORE_VERSION_MINOR, CFE_MINOR_VERSION); + CFE_Config_SetValue(CFE_CONFIGID_CORE_VERSION_REVISION, CFE_REVISION); + CFE_Config_SetValue(CFE_CONFIGID_CORE_VERSION_MISSION_REV, CFE_MISSION_REV); + CFE_Config_SetValue(CFE_CONFIGID_CORE_VERSION_BUILDNUM, CFE_BUILD_NUMBER); + + CFE_Config_SetString(CFE_CONFIGID_CORE_VERSION_BASELINE, CFE_BUILD_BASELINE); + CFE_Config_SetString(CFE_CONFIGID_CORE_VERSION_DESCRIPTION, CFE_VERSION_STRING); + + /* + * Initialize values from the "target_config" CFE internal object + */ + KeyVal = CFE_Config_FindTargetKeyValue(GLOBAL_CONFIGDATA.BuildEnvironment, "BUILDDATE"); + CFE_Config_SetString(CFE_CONFIGID_CORE_BUILDINFO_DATE, KeyVal); + KeyVal = CFE_Config_FindTargetKeyValue(GLOBAL_CONFIGDATA.BuildEnvironment, "BUILDUSER"); + CFE_Config_SetString(CFE_CONFIGID_CORE_BUILDINFO_USER, KeyVal); + KeyVal = CFE_Config_FindTargetKeyValue(GLOBAL_CONFIGDATA.BuildEnvironment, "BUILDHOST"); + CFE_Config_SetString(CFE_CONFIGID_CORE_BUILDINFO_HOST, KeyVal); +} + +/*---------------------------------------------------------------- + * + * Function: CFE_Config_Init + * + * CFE core internal function + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_Config_Init(void) +{ + /* Clear the table, just in case it was not already cleared from initial program loading */ + memset(&CFE_Config_Global, 0, sizeof(CFE_Config_Global)); + + CFE_ConfigName_t *ModuleListSet[2] = {GLOBAL_CONFIGDATA.CoreModuleList, GLOBAL_CONFIGDATA.StaticAppList}; + + /* + * Create a fixed string that can be returned in place of NULL for string returns, + * this makes it safer/easier to use with printf-style calls + */ + CFE_Config_Global.UnknownString = "[unknown]"; + + CFE_Config_SetupBasicBuildInfo(); + CFE_Config_SetupModuleVersions(ModuleListSet, 2, GLOBAL_CONFIGDATA.ModuleVersionList); + + return CFE_SUCCESS; +} diff --git a/modules/config/fsw/src/cfe_config_lookup.c b/modules/config/fsw/src/cfe_config_lookup.c new file mode 100644 index 000000000..16a3cb426 --- /dev/null +++ b/modules/config/fsw/src/cfe_config_lookup.c @@ -0,0 +1,69 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/* +** File: +** cfe_es_api.c +** +** Purpose: +** This file implements the cFE Executive Services API functions. +** +** References: +** Flight Software Branch C Coding Standard Version 1.0a +** cFE Flight Software Application Developers Guide +** +** Notes: +** +*/ + +/* +** Required header files. +*/ +#include "cfe_config_priv.h" + +#include "cfe_resourceid.h" +#include "cfe_core_resourceid_basevalues.h" + +/* + * Instantiate the global table + */ +CFE_Config_Global_t CFE_Config_Global; + +/*---------------------------------------------------------------- + * + * Function: CFE_Config_LocateConfigRecordByID + * + * Application scope internal function + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +CFE_Config_ValueEntry_t *CFE_Config_LocateConfigRecordByID(CFE_ConfigId_t ConfigId) +{ + uint32 OffsetVal; + + OffsetVal = CFE_Config_IdToOffset(ConfigId); + + if (OffsetVal >= CFE_ConfigIdOffset_MAX) + { + return NULL; + } + + return &CFE_Config_Global.Table[OffsetVal]; +} diff --git a/modules/config/fsw/src/cfe_config_map.h b/modules/config/fsw/src/cfe_config_map.h new file mode 100644 index 000000000..212bdd1f1 --- /dev/null +++ b/modules/config/fsw/src/cfe_config_map.h @@ -0,0 +1,43 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/** + * @file + * + * This file contains the CFE configuration registry global data definitions. + */ + +#ifndef CFE_CONFIG_MAP_H +#define CFE_CONFIG_MAP_H + +/* +** Includes +*/ +#include "common_types.h" +#include "cfe_config_ids.h" + +typedef struct CFE_Config_IdNameEntry +{ + const char *Name; +} CFE_Config_IdNameEntry_t; + +extern const CFE_Config_IdNameEntry_t CFE_CONFIG_IDNAME_MAP[]; + +#endif /* CFE_CONFIG_MAP_H */ diff --git a/modules/config/fsw/src/cfe_config_priv.h b/modules/config/fsw/src/cfe_config_priv.h new file mode 100644 index 000000000..56da3a560 --- /dev/null +++ b/modules/config/fsw/src/cfe_config_priv.h @@ -0,0 +1,100 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/** + * @file + * + * This file contains the CFE configuration registry global data definitions. + */ + +#ifndef CFE_CONFIG_PRIV_H +#define CFE_CONFIG_PRIV_H + +/* +** Includes +*/ +#include "cfe_config_core_internal.h" +#include "cfe_config_table.h" +#include "cfe_config.h" +#include "target_config.h" + +/* + * Actual definition of the config registry table + * + * Note this object is instantiated by a bit of generated code from CMake - + * The final length depends on the number of config keys in use in the mission + */ +typedef struct +{ + const char * UnknownString; + CFE_Config_ValueEntry_t Table[CFE_ConfigIdOffset_MAX]; +} CFE_Config_Global_t; + +extern CFE_Config_Global_t CFE_Config_Global; + +/* + ****************************** + * INTERNAL FUNCTION CALLS + ****************************** + */ + +/** + * @brief Converts a configuration ID to a table index + * + * This function is intended for internal use only, and does not perform + * any error checks. It uses a simpler conversion than other ID conversions. + */ +static inline uint32 CFE_Config_IdToOffset(CFE_ConfigId_t ConfigId) +{ + uint32 OffsetVal; + + OffsetVal = CFE_RESOURCEID_TO_ULONG(ConfigId); + OffsetVal -= CFE_CONFIGID_BASE; + + return OffsetVal; +} + +/** + * @brief Converts a table index to a configuration ID + * + * This function is intended for internal use only, and does not perform + * any error checks. It uses a simpler conversion than other ID conversions. + */ +static inline CFE_ConfigId_t CFE_Config_OffsetToId(uint32 OffsetVal) +{ + return CFE_CONFIGID_C(CFE_ResourceId_FromInteger(CFE_CONFIGID_BASE + OffsetVal)); +} + +bool CFE_Config_StrCaseEq(const char *c1, const char *c2); +const char *CFE_Config_FindTargetKeyValue(CFE_ConfigKeyValue_t *ConfigList, const char *KeyName); +const char *CFE_Config_IsModuleInList(CFE_ConfigName_t *ModuleListPtr, const char *ModuleName); +const char *CFE_Config_IsPspModule(CFE_StaticModuleLoadEntry_t *PspModuleList, const char *ModuleName); +const char *CFE_Config_FindStaticModName(CFE_ConfigName_t *ModuleListSet[], size_t SetLength, const char *ModuleName); + +void CFE_Config_SetupModuleVersions(CFE_ConfigName_t *ModuleListSet[], size_t SetLength, + CFE_ConfigKeyValue_t *ActiveList); +void CFE_Config_SetupBasicBuildInfo(void); + +/** + * @brief Gets the value record associated with a config ID + */ +CFE_Config_ValueEntry_t *CFE_Config_LocateConfigRecordByID(CFE_ConfigId_t ConfigId); + +#endif /* CFE_CONFIG_PRIV_H */ diff --git a/modules/config/fsw/src/cfe_config_set.c b/modules/config/fsw/src/cfe_config_set.c new file mode 100644 index 000000000..d2b374e9e --- /dev/null +++ b/modules/config/fsw/src/cfe_config_set.c @@ -0,0 +1,92 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/** + * @file + * + * API definition for configuration registry + * + * This defines the "setter" functions, which are reserved for CFE core internal use during startup. + */ + +/* +** Required header files. +*/ +#include "cfe_config_priv.h" + +/*---------------------------------------------------------------- + * + * Function: CFE_Config_SetValue + * + * CFE core internal function + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_Config_SetValue(CFE_ConfigId_t ConfigId, uint32 Value) +{ + CFE_Config_ValueEntry_t *Entry; + + Entry = CFE_Config_LocateConfigRecordByID(ConfigId); + if (Entry != NULL) + { + Entry->ActualType = CFE_ConfigType_VALUE; + Entry->Datum.AsInteger = Value; + } +} + +/*---------------------------------------------------------------- + * + * Function: CFE_Config_SetObjPointer + * + * CFE core internal function + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_Config_SetObjPointer(CFE_ConfigId_t ConfigId, const void *Ptr) +{ + CFE_Config_ValueEntry_t *Entry; + + Entry = CFE_Config_LocateConfigRecordByID(ConfigId); + if (Entry != NULL) + { + Entry->ActualType = CFE_ConfigType_POINTER; + Entry->Datum.AsPointer = Ptr; + } +} + +/*---------------------------------------------------------------- + * + * Function: CFE_Config_SetString + * + * CFE core internal function + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_Config_SetString(CFE_ConfigId_t ConfigId, const char *Ptr) +{ + CFE_Config_ValueEntry_t *Entry; + + Entry = CFE_Config_LocateConfigRecordByID(ConfigId); + if (Entry != NULL) + { + Entry->ActualType = CFE_ConfigType_STRING; + Entry->Datum.AsPointer = Ptr; + } +} diff --git a/modules/config/fsw/src/cfe_config_table.h b/modules/config/fsw/src/cfe_config_table.h new file mode 100644 index 000000000..d3e7583fb --- /dev/null +++ b/modules/config/fsw/src/cfe_config_table.h @@ -0,0 +1,56 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/** + * @file + * + * This file contains the CFE configuration registry global data definitions. + */ + +#ifndef CFE_CONFIG_TABLE_H +#define CFE_CONFIG_TABLE_H + +/* +** Includes +*/ +#include "common_types.h" +#include "cfe_config_ids.h" + +typedef enum CFE_ConfigType +{ + CFE_ConfigType_UNDEFINED, + CFE_ConfigType_VALUE, /**< Value is an unsigned int */ + CFE_ConfigType_STRING, /**< Value is a string pointer */ + CFE_ConfigType_POINTER, /**< Value is a non-string object pointer */ +} CFE_ConfigType_t; + +typedef union CFE_Config_ValueBuffer +{ + uint32 AsInteger; + const void *AsPointer; +} CFE_Config_ValueBuffer_t; + +typedef struct CFE_Config_ValueEntry +{ + CFE_ConfigType_t ActualType; + CFE_Config_ValueBuffer_t Datum; +} CFE_Config_ValueEntry_t; + +#endif /* CFE_CONFIG_TABLE_H */ diff --git a/modules/config/mission_build.cmake b/modules/config/mission_build.cmake new file mode 100644 index 000000000..a5a6d4551 --- /dev/null +++ b/modules/config/mission_build.cmake @@ -0,0 +1,61 @@ +########################################################### +# +# CFE configuration mission build setup +# +# This file is evaluated as part of the "prepare" stage +# and can be used to set up prerequisites for the build, +# such as generating header files +# +########################################################### + +# Generate the complete list of configuration ids +set(CFE_CONFIG_IDS) +set(GENERATED_ENUM_OFFSET_LIST) +set(GENERATED_CONSTANT_DEFINE_LIST) +set(GENERATED_IDNAME_MAP_LIST) + +# Append the set of version description config keys +list(APPEND CFE_CONFIG_IDS + MISSION_NAME + MISSION_SRCVER + + CORE_VERSION_MAJOR + CORE_VERSION_MINOR + CORE_VERSION_REVISION + CORE_VERSION_MISSION_REV + CORE_VERSION_BUILDNUM + CORE_VERSION_BASELINE + CORE_VERSION_DESCRIPTION + + CORE_BUILDINFO_DATE + CORE_BUILDINFO_USER + CORE_BUILDINFO_HOST +) + +# Generate config ID for source version of modules that are included in the build +# NOTE: the presence in this list does not necesarily mean it will have a value at runtime, +# which may be the case for dynamic apps which are not loaded, for instance. +foreach(DEP ${MISSION_CORE_INTERFACES} ${MISSION_APPS} ${MISSION_CORE_MODULES} ${MISSION_PSPMODULES}) + string(TOUPPER "${DEP}" DEPNAME) + list(APPEND CFE_CONFIG_IDS MOD_SRCVER_${DEPNAME}) +endforeach() + +# Append any mission-defined config keys +# this may further extend the list of IDs +include(${MISSIONCONFIG}/config_ids_custom.cmake OPTIONAL) + +foreach(CFGID ${CFE_CONFIG_IDS}) + list(APPEND GENERATED_ENUM_OFFSET_LIST " CFE_ConfigIdOffset_${CFGID},\n") + list(APPEND GENERATED_IDNAME_MAP_LIST " [CFE_ConfigIdOffset_${CFGID}] = { \"${CFGID}\" },\n") + list(APPEND GENERATED_CONSTANT_DEFINE_LIST "#define CFE_CONFIGID_${CFGID} CFE_CONFIGID_C(CFE_ResourceId_FromInteger(CFE_CONFIGID_BASE + CFE_ConfigIdOffset_${CFGID}))\n") +endforeach() + +string(CONCAT GENERATED_ENUM_OFFSET_LIST ${GENERATED_ENUM_OFFSET_LIST}) +string(CONCAT GENERATED_CONSTANT_DEFINE_LIST ${GENERATED_CONSTANT_DEFINE_LIST}) +string(CONCAT GENERATED_IDNAME_MAP_LIST ${GENERATED_IDNAME_MAP_LIST}) + +# Write header file for config IDs +configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake/cfe_config_ids.h.in ${CMAKE_BINARY_DIR}/inc/cfe_config_ids.h) + +# Write constant map list for config IDs +configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake/cfe_config_map.c.in ${CMAKE_BINARY_DIR}/src/cfe_config_map.c) diff --git a/modules/config/ut-coverage/CMakeLists.txt b/modules/config/ut-coverage/CMakeLists.txt new file mode 100644 index 000000000..bb4ba20b4 --- /dev/null +++ b/modules/config/ut-coverage/CMakeLists.txt @@ -0,0 +1,22 @@ +################################################################## +# +# cFE unit test CMake build recipe +# +################################################################## + +set(UT_SOURCES) +foreach(SRC ${config_SOURCES}) + list(APPEND UT_SOURCES "${CFE_CONFIG_SOURCE_DIR}/${SRC}") +endforeach() + +add_cfe_coverage_test(config ALL + "test_cfe_config.c" + "${UT_SOURCES}" +) + +# This permits UT test cases to directly access private headers in the fsw/src dir +target_include_directories(coverage-config-ALL-testrunner PRIVATE + ${CFE_CONFIG_SOURCE_DIR}/fsw/src +) + +target_link_libraries(coverage-config-ALL-testrunner ut_core_private_stubs) diff --git a/modules/config/ut-coverage/test_cfe_config.c b/modules/config/ut-coverage/test_cfe_config.c new file mode 100644 index 000000000..c4edf3f7b --- /dev/null +++ b/modules/config/ut-coverage/test_cfe_config.c @@ -0,0 +1,285 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/* + * Includes + */ +#include "cfe_config.h" +#include "cfe_config_priv.h" +#include "cfe_config_map.h" + +#include "utassert.h" +#include "utstubs.h" +#include "uttest.h" + +#include "ut_support.h" + +const CFE_Config_IdNameEntry_t CFE_CONFIG_IDNAME_MAP[CFE_ConfigIdOffset_MAX] = {{"UT_CHECK_1"}, + {"UT_CHECK_2"}, + {"UT_CHECK_3"}, + {"UT_CHECK_4"}, + {"MOD_SRCVER_COREMODULE1"}, + {"MOD_SRCVER_COREMODULE2"}}; + +#define CFE_CONFIGID_UT_CHECK_1 CFE_CONFIGID_C(CFE_RESOURCEID_WRAP(CFE_CONFIGID_BASE + 0)) +#define CFE_CONFIGID_UT_CHECK_2 CFE_CONFIGID_C(CFE_RESOURCEID_WRAP(CFE_CONFIGID_BASE + 1)) +#define CFE_CONFIGID_UT_CHECK_3 CFE_CONFIGID_C(CFE_RESOURCEID_WRAP(CFE_CONFIGID_BASE + 2)) +#define CFE_CONFIGID_UT_CHECK_4 CFE_CONFIGID_C(CFE_RESOURCEID_WRAP(CFE_CONFIGID_BASE + 3)) + +const char UT_UNKNOWN_STR[] = "UT-Unknown"; +const char UT_VALUE_STR[] = "UT-Value"; +const struct +{ + uint16 val; +} UT_TEST_OBJ = {456}; + +CFE_StaticModuleLoadEntry_t UT_PspModuleListSet[3] = {{"pspmodule1"}, {"pspmodule2"}, {NULL}}; +CFE_ConfigName_t UT_StaticModuleSet[3] = {{"staticmodule1"}, {"staticmodule2"}, {NULL}}; +CFE_ConfigName_t UT_CoreModuleSet[3] = {{"coremodule1"}, {"coremodule2"}, {NULL}}; +CFE_ConfigName_t * UT_ModuleListSet[2] = {UT_CoreModuleSet, UT_StaticModuleSet}; +CFE_ConfigKeyValue_t UT_ActiveList[3] = {{"coremodule1", "ut1"}, {"staticmodule2", "ut2"}, {NULL, NULL}}; + +void Test_CFE_Config_GetValue(void) +{ + /* + * Test case for: + * uint32 CFE_Config_GetValue(CFE_ConfigId_t ConfigId) + */ + UtAssert_UINT32_EQ(CFE_Config_GetValue(CFE_CONFIGID_UNDEFINED), 0); + UtAssert_UINT32_EQ(CFE_Config_GetValue(CFE_CONFIGID_UT_CHECK_1), 123); + UtAssert_UINT32_EQ(CFE_Config_GetValue(CFE_CONFIGID_UT_CHECK_2), 0); + UtAssert_UINT32_EQ(CFE_Config_GetValue(CFE_CONFIGID_UT_CHECK_3), 0); + UtAssert_UINT32_EQ(CFE_Config_GetValue(CFE_CONFIGID_UT_CHECK_4), 0); +} + +void Test_CFE_Config_GetObjPointer(void) +{ + /* + * Test case for: + * const void *CFE_Config_GetObjPointer(CFE_ConfigId_t ConfigId) + */ + UtAssert_NULL(CFE_Config_GetObjPointer(CFE_CONFIGID_UNDEFINED)); + UtAssert_NULL(CFE_Config_GetObjPointer(CFE_CONFIGID_UT_CHECK_1)); + UtAssert_ADDRESS_EQ(CFE_Config_GetObjPointer(CFE_CONFIGID_UT_CHECK_2), &UT_TEST_OBJ); + UtAssert_ADDRESS_EQ(CFE_Config_GetObjPointer(CFE_CONFIGID_UT_CHECK_3), UT_VALUE_STR); + UtAssert_NULL(CFE_Config_GetObjPointer(CFE_CONFIGID_UT_CHECK_4)); +} + +void Test_CFE_Config_GetString(void) +{ + /* + * Test case for: + * const char *CFE_Config_GetString(CFE_ConfigId_t ConfigId) + */ + UtAssert_ADDRESS_EQ(CFE_Config_GetString(CFE_CONFIGID_UNDEFINED), UT_UNKNOWN_STR); + UtAssert_ADDRESS_EQ(CFE_Config_GetString(CFE_CONFIGID_UT_CHECK_1), UT_UNKNOWN_STR); + UtAssert_ADDRESS_EQ(CFE_Config_GetString(CFE_CONFIGID_UT_CHECK_2), UT_UNKNOWN_STR); + UtAssert_ADDRESS_EQ(CFE_Config_GetString(CFE_CONFIGID_UT_CHECK_3), UT_VALUE_STR); + UtAssert_ADDRESS_EQ(CFE_Config_GetString(CFE_CONFIGID_UT_CHECK_4), UT_UNKNOWN_STR); +} + +void Test_CFE_Config_SetValue(void) +{ + /* + * Test case for: + * void CFE_Config_SetValue(CFE_ConfigId_t ConfigId, uint32 Value) + */ + UtAssert_VOIDCALL(CFE_Config_SetValue(CFE_CONFIGID_UNDEFINED, 789)); + UtAssert_VOIDCALL(CFE_Config_SetValue(CFE_CONFIGID_UT_CHECK_4, 789)); + UtAssert_UINT32_EQ(CFE_Config_GetValue(CFE_CONFIGID_UNDEFINED), 0); + UtAssert_UINT32_EQ(CFE_Config_GetValue(CFE_CONFIGID_UT_CHECK_4), 789); +} + +void Test_CFE_Config_SetObjPointer(void) +{ + /* + * Test case for: + * void CFE_Config_SetObjPointer(CFE_ConfigId_t ConfigId, const void *Ptr) + */ + static const char TESTOBJ[] = "TEST-OBJ"; + + UtAssert_VOIDCALL(CFE_Config_SetObjPointer(CFE_CONFIGID_UNDEFINED, TESTOBJ)); + UtAssert_VOIDCALL(CFE_Config_SetObjPointer(CFE_CONFIGID_UT_CHECK_4, TESTOBJ)); + UtAssert_NULL(CFE_Config_GetObjPointer(CFE_CONFIGID_UNDEFINED)); + UtAssert_ADDRESS_EQ(CFE_Config_GetObjPointer(CFE_CONFIGID_UT_CHECK_4), TESTOBJ); +} + +void Test_CFE_Config_SetString(void) +{ + /* + * Test case for: + * void CFE_Config_SetString(CFE_ConfigId_t ConfigId, const char *Ptr) + */ + static const char TESTSTR[] = "TEST-STRING"; + + UtAssert_VOIDCALL(CFE_Config_SetString(CFE_CONFIGID_UNDEFINED, TESTSTR)); + UtAssert_VOIDCALL(CFE_Config_SetString(CFE_CONFIGID_UT_CHECK_4, TESTSTR)); + UtAssert_ADDRESS_EQ(CFE_Config_GetString(CFE_CONFIGID_UNDEFINED), UT_UNKNOWN_STR); + UtAssert_ADDRESS_EQ(CFE_Config_GetString(CFE_CONFIGID_UT_CHECK_4), TESTSTR); +} + +void Test_CFE_Config_GetName(void) +{ + /* + * Test case for: + * const char *CFE_Config_GetName(CFE_ConfigId_t ConfigId) + */ + UtAssert_STRINGBUF_EQ(CFE_Config_GetName(CFE_CONFIGID_UT_CHECK_1), -1, "UT_CHECK_1", -1); + UtAssert_STRINGBUF_EQ(CFE_Config_GetName(CFE_CONFIGID_UNDEFINED), -1, UT_UNKNOWN_STR, -1); +} + +void Test_CFE_Config_GetIdByName(void) +{ + /* + * Test case for: + * CFE_ConfigId_t CFE_Config_GetIdByName(const char *Name) + */ + CFE_UtAssert_RESOURCEID_EQ(CFE_Config_GetIdByName("UT_CHECK_2"), CFE_CONFIGID_UT_CHECK_2); + CFE_UtAssert_RESOURCEID_EQ(CFE_Config_GetIdByName("INVALID"), CFE_CONFIGID_UNDEFINED); +} + +void UT_Callback(void *Arg, CFE_ConfigId_t Id, const char *Name) +{ + uint32 *Count = Arg; + + ++(*Count); + + UtAssert_NOT_NULL(Name); +} + +void Test_CFE_Config_IterateAll(void) +{ + /* + * Test case for: + * void CFE_Config_IterateAll(void *Arg, CFE_Config_Callback_t Callback) + */ + uint32 Count; + + Count = 0; + CFE_Config_IterateAll(&Count, UT_Callback); + + /* Callback should only be given for configured/set entities */ + UtAssert_UINT32_EQ(Count, 3); +} + +void Test_CFE_Config_StrCaseEq(void) +{ + /* + * Test case for: + * bool CFE_Config_StrCaseEq(const char *c1, const char *c2) + */ + UtAssert_BOOL_FALSE(CFE_Config_StrCaseEq("xx", "yy")); + UtAssert_BOOL_TRUE(CFE_Config_StrCaseEq("STR", "STR")); + UtAssert_BOOL_TRUE(CFE_Config_StrCaseEq("STR", "str")); + UtAssert_BOOL_TRUE(CFE_Config_StrCaseEq("StR", "sTr")); + UtAssert_BOOL_FALSE(CFE_Config_StrCaseEq("St", "sTr")); + UtAssert_BOOL_FALSE(CFE_Config_StrCaseEq("StR", "sT")); +} + +void Test_CFE_Config_FindTargetKeyValue(void) +{ + /* + * Test case for: + * const char *CFE_Config_FindTargetKeyValue(const CFE_ConfigKeyValue_t *ConfigList, const char *KeyName) + */ + + UtAssert_NOT_NULL(CFE_Config_FindTargetKeyValue(UT_ActiveList, "staticmodule2")); + UtAssert_NULL(CFE_Config_FindTargetKeyValue(UT_ActiveList, "nonexisting")); + UtAssert_NULL(CFE_Config_FindTargetKeyValue(UT_ActiveList, NULL)); + UtAssert_NULL(CFE_Config_FindTargetKeyValue(NULL, "staticmodule2")); +} + +void Test_CFE_Config_IsPspModule(void) +{ + /* + * Test case for: + * const char *CFE_Config_IsPspModule(const char *ModuleName) + */ + UtAssert_STRINGBUF_EQ(CFE_Config_IsPspModule(UT_PspModuleListSet, "pspmodule1"), -1, "pspmodule1", -1); + UtAssert_STRINGBUF_EQ(CFE_Config_IsPspModule(UT_PspModuleListSet, "pspmodule2"), -1, "pspmodule2", -1); + UtAssert_NULL(CFE_Config_IsPspModule(UT_PspModuleListSet, "notapspmodule")); + UtAssert_NULL(CFE_Config_IsPspModule(NULL, "notapspmodule")); +} + +void Test_CFE_Config_FindStaticModName(void) +{ + /* + * Test case for: + * const char *CFE_Config_FindStaticModName(const char *ModuleName) + */ + UtAssert_STRINGBUF_EQ(CFE_Config_FindStaticModName(UT_ModuleListSet, 2, "staticmodule2"), -1, "staticmodule2", -1); + UtAssert_STRINGBUF_EQ(CFE_Config_FindStaticModName(UT_ModuleListSet, 2, "coremodule2"), -1, "coremodule2", -1); + UtAssert_NULL(CFE_Config_FindStaticModName(UT_ModuleListSet, 2, "notastaticmodule")); +} + +void Test_CFE_Config_SetupModuleVersions(void) +{ + /* + * Test case for: + * void CFE_Config_SetupModuleVersions(void) + */ + UtAssert_VOIDCALL(CFE_Config_SetupModuleVersions(UT_ModuleListSet, 2, UT_ActiveList)); +} + +void Test_CFE_Config_Init(void) +{ + /* + * Test case for: + * int32 CFE_Config_Init(void) + */ + UtAssert_INT32_EQ(CFE_Config_Init(), CFE_SUCCESS); +} + +void Test_CFE_Config_Setup(void) +{ + memset(&CFE_Config_Global, 0, sizeof(CFE_Config_Global)); + + CFE_Config_Global.UnknownString = UT_UNKNOWN_STR; + + /* Set up one entry of each type */ + CFE_Config_Global.Table[0].ActualType = CFE_ConfigType_VALUE; + CFE_Config_Global.Table[0].Datum.AsInteger = 123; + CFE_Config_Global.Table[1].ActualType = CFE_ConfigType_POINTER; + CFE_Config_Global.Table[1].Datum.AsPointer = &UT_TEST_OBJ; + CFE_Config_Global.Table[2].ActualType = CFE_ConfigType_STRING; + CFE_Config_Global.Table[2].Datum.AsPointer = UT_VALUE_STR; + + /* NOTE: Leaves last entry unset */ +} + +void UtTest_Setup(void) +{ + UtTest_Add(Test_CFE_Config_GetValue, Test_CFE_Config_Setup, NULL, "Test CFE_Config_GetValue()"); + UtTest_Add(Test_CFE_Config_GetObjPointer, Test_CFE_Config_Setup, NULL, "Test CFE_Config_GetObjPointer()"); + UtTest_Add(Test_CFE_Config_GetString, Test_CFE_Config_Setup, NULL, "Test CFE_Config_GetString()"); + UtTest_Add(Test_CFE_Config_SetValue, Test_CFE_Config_Setup, NULL, "Test CFE_Config_SetValue()"); + UtTest_Add(Test_CFE_Config_SetObjPointer, Test_CFE_Config_Setup, NULL, "Test CFE_Config_SetObjPointer()"); + UtTest_Add(Test_CFE_Config_SetString, Test_CFE_Config_Setup, NULL, "Test CFE_Config_SetString()"); + UtTest_Add(Test_CFE_Config_GetName, Test_CFE_Config_Setup, NULL, "Test CFE_Config_GetName()"); + UtTest_Add(Test_CFE_Config_GetIdByName, Test_CFE_Config_Setup, NULL, "Test CFE_Config_GetIdByName()"); + UtTest_Add(Test_CFE_Config_IterateAll, Test_CFE_Config_Setup, NULL, "Test CFE_Config_IterateAll()"); + UtTest_Add(Test_CFE_Config_StrCaseEq, Test_CFE_Config_Setup, NULL, "Test CFE_Config_StrCaseEq()"); + UtTest_Add(Test_CFE_Config_FindTargetKeyValue, Test_CFE_Config_Setup, NULL, "Test CFE_Config_FindTargetKeyValue()"); + UtTest_Add(Test_CFE_Config_IsPspModule, Test_CFE_Config_Setup, NULL, "Test CFE_Config_IsPspModule()"); + UtTest_Add(Test_CFE_Config_FindStaticModName, Test_CFE_Config_Setup, NULL, "Test CFE_Config_FindStaticModName()"); + UtTest_Add(Test_CFE_Config_SetupModuleVersions, Test_CFE_Config_Setup, NULL, + "Test CFE_Config_SetupModuleVersions()"); + UtTest_Add(Test_CFE_Config_Init, Test_CFE_Config_Setup, NULL, "Test CFE_Config_Init()"); +} diff --git a/modules/core_api/fsw/inc/cfe_config.h b/modules/core_api/fsw/inc/cfe_config.h new file mode 100644 index 000000000..57bd4c2b2 --- /dev/null +++ b/modules/core_api/fsw/inc/cfe_config.h @@ -0,0 +1,124 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/** + * @file + * + * Title: cFE Status Code Definition Header File + * + * Purpose: + * Common source of cFE API return status codes. + * + * Design Notes: + * + * References: + * Flight Software Branch C Coding Standard Version 1.0a + * + */ + +#ifndef CFE_CONFIG_H +#define CFE_CONFIG_H + +/* Include Files */ +#include "common_types.h" +#include "cfe_config_api_typedefs.h" +#include "cfe_config_ids.h" + +/** + * @brief Obtain an integer value correlating to an CFE configuration ID + * + * Retreives the integer value associated with the specified key. + * + * If no value has been set, or the key is not valid, this returns 0. + * + * @param[in] ConfigId Configuration ID/Key to look up + * + * @return Value associated with key + * @retval 0 if key is not defined or not set + */ +uint32 CFE_Config_GetValue(CFE_ConfigId_t ConfigId); + +/** + * @brief Obtain a pointer value correlating to an CFE configuration ID + * + * Retreives the pointer value associated with the specified key. + * + * If no value has been set, or the key is not valid, this returns NULL. + * + * @param[in] ConfigId Configuration ID/Key to look up + * + * @return Value associated with key + * @retval NULL if key is not defined or not set + */ +const void *CFE_Config_GetObjPointer(CFE_ConfigId_t ConfigId); + +/** + * @brief Obtain a string value correlating to an CFE configuration ID + * + * Retreives the string value associated with the specified key. + * + * If no value has been set, or the key is not valid, this returns the + * special string "UNDEFINED" + * + * @note This function does not return NULL, so it can be used directly + * in printf-style calls. + * + * @param[in] ConfigId Configuration ID/Key to look up + * + * @return String value associated with key + */ +const char *CFE_Config_GetString(CFE_ConfigId_t ConfigId); + +/** + * @brief Obtain the name of a CFE configuration ID + * + * Retreives the printable name associated with the specified key. + * + * @note This function does not return NULL. + * + * If the ID is not valid/known, then the implementation returns the + * special string '[unknown]' rather than NULL, so this function may + * be more easily used in printf() style calls. + * + * @param[in] ConfigId Configuration ID/Key to look up + * + * @return Name associated with key + */ +const char *CFE_Config_GetName(CFE_ConfigId_t ConfigId); + +/** + * @brief Obtain the ID value associated with a configuration name + * + * @param[in] Name The name of the ID to look up + * + * @return ID associated with name + * @retval CFE_CONFIGID_UNDEFINED if the name did not correspond to a key + */ +CFE_ConfigId_t CFE_Config_GetIdByName(const char *Name); + +/** + * @brief Iterate all known name/ID value pairs + * + * @param[in] Arg User-supplied opaque argument to pass to callback + * @param[in] Callback User-supplied callback function to invoke for each ID + */ +void CFE_Config_IterateAll(void *Arg, CFE_Config_Callback_t Callback); + +#endif /* CFE_CONFIG_H */ diff --git a/modules/core_api/fsw/inc/cfe_config_api_typedefs.h b/modules/core_api/fsw/inc/cfe_config_api_typedefs.h new file mode 100644 index 000000000..7f1ac1eef --- /dev/null +++ b/modules/core_api/fsw/inc/cfe_config_api_typedefs.h @@ -0,0 +1,55 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/** + * @file + * + * Title: cFE Status Code Definition Header File + * + * Purpose: + * Common source of cFE API return status codes. + * + * Design Notes: + * + * References: + * Flight Software Branch C Coding Standard Version 1.0a + * + */ + +#ifndef CFE_CONFIG_API_TYPEDEFS_H +#define CFE_CONFIG_API_TYPEDEFS_H + +/* Include Files */ +#include "common_types.h" +#include "cfe_resourceid_api_typedefs.h" + +/** + * @brief A type for Configuration IDs + * + * This is the type that is used for any API accepting or returning a configuration key ID + */ +typedef CFE_RESOURCEID_BASE_TYPE CFE_ConfigId_t; + +#define CFE_CONFIGID_C(val) ((CFE_ConfigId_t)CFE_RESOURCEID_WRAP(val)) +#define CFE_CONFIGID_UNDEFINED CFE_CONFIGID_C(CFE_RESOURCEID_UNDEFINED) + +typedef void (*CFE_Config_Callback_t)(void *Arg, CFE_ConfigId_t Id, const char *Name); + +#endif /* CFE_CONFIG_API_TYPEDEFS_H */ diff --git a/modules/core_api/fsw/inc/cfe_es_extern_typedefs.h b/modules/core_api/fsw/inc/cfe_es_extern_typedefs.h index 0d1949c27..ed0043c96 100644 --- a/modules/core_api/fsw/inc/cfe_es_extern_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_es_extern_typedefs.h @@ -427,6 +427,19 @@ typedef uint32 CFE_ES_MemAddress_t; */ #define CFE_ES_MEMADDRESS_C(x) ((CFE_ES_MemAddress_t)((cpuaddr)(x)&0xFFFFFFFF)) +/** + * Memory Address and Memory Offset combination + * + * A combination of #CFE_ES_MemAddress_t and #CFE_ES_MemOffset_t, since they are often used together. + */ +typedef struct CFE_ES_MemAddOff +{ + CFE_ES_MemAddress_t Address; + + CFE_ES_MemOffset_t Size; + +} CFE_ES_MemAddOff_t; + /* * Data Structures shared between API and Message (CMD/TLM) interfaces */ @@ -455,22 +468,16 @@ typedef struct CFE_ES_AppInfo char FileName[CFE_MISSION_MAX_PATH_LEN]; /**< \cfetlmmnemonic \ES_APPFILENAME \brief The Filename of the file containing the Application */ - CFE_ES_MemOffset_t StackSize; /**< \cfetlmmnemonic \ES_STACKSIZE - \brief The Stack Size of the Application */ - uint32 AddressesAreValid; /**< \cfetlmmnemonic \ES_ADDRVALID - \brief Indicates that the Code, Data, and BSS addresses/sizes are valid */ - CFE_ES_MemAddress_t CodeAddress; /**< \cfetlmmnemonic \ES_CODEADDR - \brief The Address of the Application Code Segment*/ - CFE_ES_MemOffset_t CodeSize; /**< \cfetlmmnemonic \ES_CODESIZE - \brief The Code Size of the Application */ - CFE_ES_MemAddress_t DataAddress; /**< \cfetlmmnemonic \ES_DATAADDR - \brief The Address of the Application Data Segment*/ - CFE_ES_MemOffset_t DataSize; /**< \cfetlmmnemonic \ES_DATASIZE - \brief The Data Size of the Application */ - CFE_ES_MemAddress_t BSSAddress; /**< \cfetlmmnemonic \ES_BSSADDR - \brief The Address of the Application BSS Segment*/ - CFE_ES_MemOffset_t BSSSize; /**< \cfetlmmnemonic \ES_BSSSIZE - \brief The BSS Size of the Application */ + CFE_ES_MemOffset_t StackSize; /**< \cfetlmmnemonic \ES_STACKSIZE + \brief The Stack Size of the Application */ + uint32 AddressesAreValid; /**< \cfetlmmnemonic \ES_ADDRVALID + \brief Indicates that the Code, Data, and BSS addresses/sizes are valid */ + CFE_ES_MemAddOff_t Code; + + CFE_ES_MemAddOff_t Data; + + CFE_ES_MemAddOff_t BSS; + CFE_ES_MemAddress_t StartAddress; /**< \cfetlmmnemonic \ES_STARTADDR \brief The Start Address of the Application */ CFE_ES_ExceptionAction_Enum_t ExceptionAction; /**< \cfetlmmnemonic \ES_EXCEPTNACTN diff --git a/modules/core_api/fsw/inc/cfe_resourceid.h b/modules/core_api/fsw/inc/cfe_resourceid.h index 49108d207..70fec7e44 100644 --- a/modules/core_api/fsw/inc/cfe_resourceid.h +++ b/modules/core_api/fsw/inc/cfe_resourceid.h @@ -152,7 +152,7 @@ static inline bool CFE_ResourceId_Equal(CFE_ResourceId_t id1, CFE_ResourceId_t i */ static inline bool CFE_ResourceId_IsDefined(CFE_ResourceId_t id) { - return (CFE_RESOURCEID_UNWRAP(id) != 0); + return (!CFE_ResourceId_Equal(id, CFE_RESOURCEID_UNDEFINED)); } /** \} */ diff --git a/modules/core_api/fsw/inc/cfe_sb.h b/modules/core_api/fsw/inc/cfe_sb.h index 8f1eeff8f..0133eb06c 100644 --- a/modules/core_api/fsw/inc/cfe_sb.h +++ b/modules/core_api/fsw/inc/cfe_sb.h @@ -827,7 +827,7 @@ static inline CFE_SB_MsgId_Atom_t CFE_SB_MsgIdToValue(CFE_SB_MsgId_t MsgId) */ static inline CFE_SB_MsgId_t CFE_SB_ValueToMsgId(CFE_SB_MsgId_Atom_t MsgIdValue) { - CFE_SB_MsgId_t Result = CFE_SB_MSGID_WRAP_VALUE(MsgIdValue); + CFE_SB_MsgId_t Result = CFE_SB_MSGID_C(MsgIdValue); return Result; } /** @} */ diff --git a/modules/core_api/fsw/inc/cfe_sb_api_typedefs.h b/modules/core_api/fsw/inc/cfe_sb_api_typedefs.h index 64d800062..fa5a7f2d0 100644 --- a/modules/core_api/fsw/inc/cfe_sb_api_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_sb_api_typedefs.h @@ -63,7 +63,23 @@ * * \sa CFE_SB_ValueToMsgId() */ -#define CFE_SB_MSGID_WRAP_VALUE(val) ((CFE_SB_MsgId_t)(val)) +#define CFE_SB_MSGID_WRAP_VALUE(val) \ + { \ + val \ + } + +/** + * \brief Translation macro to convert to MsgId integer values from a literal + * + * This ensures that the literal is interpreted as the CFE_SB_MsgId_t type, rather + * than the default type associated with that literal (e.g. int/unsigned int). + * + * \note Due to constraints in C99 this style of initializer can only be used + * at runtime, not for static/compile-time initializers. + * + * \sa CFE_SB_ValueToMsgId() + */ +#define CFE_SB_MSGID_C(val) ((CFE_SB_MsgId_t)CFE_SB_MSGID_WRAP_VALUE(val)) /** * \brief Translation macro to convert to MsgId integer values from opaque/abstract API values @@ -75,7 +91,7 @@ * * \sa CFE_SB_MsgIdToValue() */ -#define CFE_SB_MSGID_UNWRAP_VALUE(mid) ((CFE_SB_MsgId_Atom_t)(mid)) +#define CFE_SB_MSGID_UNWRAP_VALUE(mid) ((mid).Value) /** * \brief Reserved value for CFE_SB_MsgId_t that will not match any valid MsgId @@ -83,7 +99,7 @@ * This rvalue macro can be used for static/compile-time data initialization to ensure that * the initialized value does not alias to a valid MsgId object. */ -#define CFE_SB_MSGID_RESERVED CFE_SB_MSGID_WRAP_VALUE(-1) +#define CFE_SB_MSGID_RESERVED CFE_SB_MSGID_WRAP_VALUE(0) /** * \brief A literal of the CFE_SB_MsgId_t type representing an invalid ID @@ -96,7 +112,7 @@ * purposes (rvalue), #CFE_SB_MSGID_RESERVED should be used instead. * However, in the current implementation, they are equivalent. */ -#define CFE_SB_INVALID_MSG_ID CFE_SB_MSGID_RESERVED +#define CFE_SB_INVALID_MSG_ID CFE_SB_MSGID_C(0) /** * \brief Cast/Convert a generic CFE_ResourceId_t to a CFE_SB_PipeId_t diff --git a/modules/core_api/fsw/inc/cfe_sb_extern_typedefs.h b/modules/core_api/fsw/inc/cfe_sb_extern_typedefs.h index 3ccf2f8f9..bc58e23e9 100644 --- a/modules/core_api/fsw/inc/cfe_sb_extern_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_sb_extern_typedefs.h @@ -115,7 +115,10 @@ typedef uint32 CFE_SB_MsgId_Atom_t; * @note In a future version it could become a type-safe wrapper similar to the route index, * to avoid message IDs getting mixed between other integer values. */ -typedef CFE_SB_MsgId_Atom_t CFE_SB_MsgId_t; +typedef struct +{ + CFE_SB_MsgId_Atom_t Value; +} CFE_SB_MsgId_t; /** \brief CFE_SB_PipeId_t to primitive type definition * diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index eac498eef..81bd120a9 100644 --- a/modules/core_api/fsw/inc/cfe_version.h +++ b/modules/core_api/fsw/inc/cfe_version.h @@ -28,14 +28,21 @@ #define CFE_VERSION_H /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 1030 /**< @brief Development: Number of development commits since baseline */ -#define CFE_BUILD_BASELINE "v6.8.0-rc1" /**< @brief Development: Reference git tag for build number */ +#define CFE_BUILD_NUMBER 39 /**< @brief Development: Number of development commits since baseline */ +#define CFE_BUILD_BASELINE "v7.0.0-rc4" /**< @brief Development: Reference git tag for build number */ /* Version Macro Definitions updated for official releases only */ -#define CFE_MAJOR_VERSION 6 /**< @brief Major release version (Former for Revision == 99) */ -#define CFE_MINOR_VERSION 7 /**< @brief Minor release version (Former for Revision == 99) */ -#define CFE_REVISION 99 /**< @brief Revision, 99 indicates development */ -#define CFE_MISSION_REV 0 /**< @brief Mission revision, reserved for mission use */ +#define CFE_MAJOR_VERSION 6 /**< @brief Major release version (Former for Revision == 99) */ +#define CFE_MINOR_VERSION 7 /**< @brief Minor release version (Former for Revision == 99) */ +#define CFE_REVISION 0 /*!< @brief ONLY APPLY for OFFICIAL releases. Revision number. */ + +/*! + * @brief Mission revision. + * + * Set to 0 on OFFICIAL releases, and set to 255 (0xFF) on development versions. + * Values 1-254 are reserved for mission use to denote patches/customizations as needed. + */ +#define CFE_MISSION_REV 0xFF #define CFE_STR_HELPER(x) #x /**< @brief Convert argument to string */ #define CFE_STR(x) CFE_STR_HELPER(x) /**< @brief Expand macro before conversion */ @@ -55,6 +62,6 @@ * and official releases. */ #define CFE_VERSION_STRING \ - " cFE DEVELOPMENT BUILD " CFE_SRC_VERSION " (Codename: Bootes), Last Official Release: cfe v6.7.0" + " cFE DEVELOPMENT BUILD " CFE_SRC_VERSION " (Codename: Draco), Last Official Release: cfe v6.7.0" #endif /* CFE_VERSION_H */ diff --git a/modules/core_api/ut-stubs/CMakeLists.txt b/modules/core_api/ut-stubs/CMakeLists.txt index 3d74005e5..315c993c8 100644 --- a/modules/core_api/ut-stubs/CMakeLists.txt +++ b/modules/core_api/ut-stubs/CMakeLists.txt @@ -16,6 +16,8 @@ include_directories(${osal_MISSION_DIR}/ut_assert/inc) # Create the generic stubs library # add_library(ut_core_api_stubs STATIC + src/cfe_config_handlers.c + src/cfe_config_stubs.c src/cfe_es_handlers.c src/cfe_es_stubs.c src/cfe_evs_handlers.c diff --git a/modules/core_api/ut-stubs/src/cfe_config_handlers.c b/modules/core_api/ut-stubs/src/cfe_config_handlers.c new file mode 100644 index 000000000..956addd35 --- /dev/null +++ b/modules/core_api/ut-stubs/src/cfe_config_handlers.c @@ -0,0 +1,96 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/* +** File: ut_config_handlers.c +** +** Purpose: +** Unit test handlers for Configuration Service routines +** +** Notes: +** Mostly implement a NULL default return where needed, as this is not done +** automatically by UT assert. +** +*/ + +/* +** Includes +*/ +#include +#include "cfe_config.h" + +#include "utstubs.h" +#include "utassert.h" + +/* +** Functions +*/ + +/*------------------------------------------------------------ + * + * Default handler for CFE_Config_GetString coverage stub function + * + *------------------------------------------------------------*/ +void UT_DefaultHandler_CFE_Config_GetString(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + int32 status; + const char FIXED_BUFFER[] = "UT"; + void * Buffer; + + Buffer = NULL; + UT_Stub_GetInt32StatusCode(Context, &status); + + if (status >= 0) + { + UT_GetDataBuffer(FuncKey, &Buffer, NULL, NULL); + + /* + * The public API has a contract _not_ to return a NULL + * pointer, so this should be mimiced by the UT stub + */ + if (Buffer == NULL) + { + Buffer = (void *)FIXED_BUFFER; + } + } + + UT_Stub_SetReturnValue(FuncKey, Buffer); +} + +/*------------------------------------------------------------ + * + * Default handler for CFE_Config_GetObjPointer coverage stub function + * + *------------------------------------------------------------*/ +void UT_DefaultHandler_CFE_Config_GetObjPointer(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + int32 status; + void *Buffer; + + Buffer = NULL; + UT_Stub_GetInt32StatusCode(Context, &status); + + if (status >= 0) + { + UT_GetDataBuffer(FuncKey, &Buffer, NULL, NULL); + } + + UT_Stub_SetReturnValue(FuncKey, Buffer); +} diff --git a/modules/core_api/ut-stubs/src/cfe_config_stubs.c b/modules/core_api/ut-stubs/src/cfe_config_stubs.c new file mode 100644 index 000000000..45ad8c9ee --- /dev/null +++ b/modules/core_api/ut-stubs/src/cfe_config_stubs.c @@ -0,0 +1,124 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in cfe_config header + */ + +#include "cfe_config.h" +#include "utgenstub.h" + +extern void UT_DefaultHandler_CFE_Config_GetObjPointer(void *, UT_EntryKey_t, const UT_StubContext_t *); +extern void UT_DefaultHandler_CFE_Config_GetString(void *, UT_EntryKey_t, const UT_StubContext_t *); + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_Config_GetIdByName() + * ---------------------------------------------------- + */ +CFE_ConfigId_t CFE_Config_GetIdByName(const char *Name) +{ + UT_GenStub_SetupReturnBuffer(CFE_Config_GetIdByName, CFE_ConfigId_t); + + UT_GenStub_AddParam(CFE_Config_GetIdByName, const char *, Name); + + UT_GenStub_Execute(CFE_Config_GetIdByName, Basic, NULL); + + return UT_GenStub_GetReturnValue(CFE_Config_GetIdByName, CFE_ConfigId_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_Config_GetName() + * ---------------------------------------------------- + */ +const char *CFE_Config_GetName(CFE_ConfigId_t ConfigId) +{ + UT_GenStub_SetupReturnBuffer(CFE_Config_GetName, const char *); + + UT_GenStub_AddParam(CFE_Config_GetName, CFE_ConfigId_t, ConfigId); + + UT_GenStub_Execute(CFE_Config_GetName, Basic, NULL); + + return UT_GenStub_GetReturnValue(CFE_Config_GetName, const char *); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_Config_GetObjPointer() + * ---------------------------------------------------- + */ +const void *CFE_Config_GetObjPointer(CFE_ConfigId_t ConfigId) +{ + UT_GenStub_SetupReturnBuffer(CFE_Config_GetObjPointer, const void *); + + UT_GenStub_AddParam(CFE_Config_GetObjPointer, CFE_ConfigId_t, ConfigId); + + UT_GenStub_Execute(CFE_Config_GetObjPointer, Basic, UT_DefaultHandler_CFE_Config_GetObjPointer); + + return UT_GenStub_GetReturnValue(CFE_Config_GetObjPointer, const void *); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_Config_GetString() + * ---------------------------------------------------- + */ +const char *CFE_Config_GetString(CFE_ConfigId_t ConfigId) +{ + UT_GenStub_SetupReturnBuffer(CFE_Config_GetString, const char *); + + UT_GenStub_AddParam(CFE_Config_GetString, CFE_ConfigId_t, ConfigId); + + UT_GenStub_Execute(CFE_Config_GetString, Basic, UT_DefaultHandler_CFE_Config_GetString); + + return UT_GenStub_GetReturnValue(CFE_Config_GetString, const char *); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_Config_GetValue() + * ---------------------------------------------------- + */ +uint32 CFE_Config_GetValue(CFE_ConfigId_t ConfigId) +{ + UT_GenStub_SetupReturnBuffer(CFE_Config_GetValue, uint32); + + UT_GenStub_AddParam(CFE_Config_GetValue, CFE_ConfigId_t, ConfigId); + + UT_GenStub_Execute(CFE_Config_GetValue, Basic, NULL); + + return UT_GenStub_GetReturnValue(CFE_Config_GetValue, uint32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_Config_IterateAll() + * ---------------------------------------------------- + */ +void CFE_Config_IterateAll(void *Arg, CFE_Config_Callback_t Callback) +{ + UT_GenStub_AddParam(CFE_Config_IterateAll, void *, Arg); + UT_GenStub_AddParam(CFE_Config_IterateAll, CFE_Config_Callback_t, Callback); + + UT_GenStub_Execute(CFE_Config_IterateAll, Basic, NULL); +} diff --git a/modules/core_api/ut-stubs/src/cfe_es_handlers.c b/modules/core_api/ut-stubs/src/cfe_es_handlers.c index f240b58bf..08cc6a17e 100644 --- a/modules/core_api/ut-stubs/src/cfe_es_handlers.c +++ b/modules/core_api/ut-stubs/src/cfe_es_handlers.c @@ -125,7 +125,7 @@ void UT_DefaultHandler_CFE_ES_GetAppID(void *UserObj, UT_EntryKey_t FuncKey, con { CFE_ES_AppId_t *AppIdPtr = UT_Hook_GetArgValueByName(Context, "AppIdPtr", CFE_ES_AppId_t *); int32 status; - CFE_ES_AppId_t *IdBuff; + void * IdBuff; size_t BuffSize; size_t Position; @@ -133,10 +133,10 @@ void UT_DefaultHandler_CFE_ES_GetAppID(void *UserObj, UT_EntryKey_t FuncKey, con if (status >= 0) { - UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppID), (void **)&IdBuff, &BuffSize, &Position); + UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppID), &IdBuff, &BuffSize, &Position); if (IdBuff != NULL && BuffSize == sizeof(*AppIdPtr)) { - *AppIdPtr = *IdBuff; + memcpy(AppIdPtr, IdBuff, sizeof(*AppIdPtr)); } else { @@ -159,7 +159,7 @@ void UT_DefaultHandler_CFE_ES_GetTaskID(void *UserObj, UT_EntryKey_t FuncKey, co { CFE_ES_TaskId_t *TaskIdPtr = UT_Hook_GetArgValueByName(Context, "TaskIdPtr", CFE_ES_TaskId_t *); int32 status; - CFE_ES_TaskId_t *IdBuff; + void * IdBuff; size_t BuffSize; size_t Position; @@ -167,10 +167,10 @@ void UT_DefaultHandler_CFE_ES_GetTaskID(void *UserObj, UT_EntryKey_t FuncKey, co if (status >= 0) { - UT_GetDataBuffer(UT_KEY(CFE_ES_GetTaskID), (void **)&IdBuff, &BuffSize, &Position); + UT_GetDataBuffer(UT_KEY(CFE_ES_GetTaskID), &IdBuff, &BuffSize, &Position); if (IdBuff != NULL && BuffSize == sizeof(*TaskIdPtr)) { - *TaskIdPtr = *IdBuff; + memcpy(TaskIdPtr, IdBuff, sizeof(*TaskIdPtr)); } else { @@ -194,11 +194,11 @@ void UT_DefaultHandler_CFE_ES_GetAppIDByName(void *UserObj, UT_EntryKey_t FuncKe CFE_ES_AppId_t *AppIdPtr = UT_Hook_GetArgValueByName(Context, "AppIdPtr", CFE_ES_AppId_t *); const char * AppName = UT_Hook_GetArgValueByName(Context, "AppName", const char *); - size_t UserBuffSize; - size_t BuffPosition; - const char * NameBuff; - CFE_ES_AppId_t *IdBuff; - int32 status; + size_t UserBuffSize; + size_t BuffPosition; + void * NameBuff; + void * IdBuff; + int32 status; UT_Stub_GetInt32StatusCode(Context, &status); @@ -207,15 +207,15 @@ void UT_DefaultHandler_CFE_ES_GetAppIDByName(void *UserObj, UT_EntryKey_t FuncKe if (UT_Stub_CopyToLocal(UT_KEY(CFE_ES_GetAppIDByName), AppIdPtr, sizeof(*AppIdPtr)) < sizeof(*AppIdPtr)) { IdBuff = NULL; - UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppName), (void **)&NameBuff, &UserBuffSize, &BuffPosition); - if (NameBuff != NULL && UserBuffSize > 0 && strncmp(NameBuff, AppName, UserBuffSize) == 0) + UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppName), &NameBuff, &UserBuffSize, &BuffPosition); + if (NameBuff != NULL && UserBuffSize > 0 && strncmp((const char *)NameBuff, AppName, UserBuffSize) == 0) { - UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppID), (void **)&IdBuff, &UserBuffSize, &BuffPosition); + UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppID), &IdBuff, &UserBuffSize, &BuffPosition); } if (IdBuff != NULL && UserBuffSize == sizeof(*AppIdPtr)) { - *AppIdPtr = *IdBuff; + memcpy(AppIdPtr, IdBuff, sizeof(*AppIdPtr)); } else { @@ -243,18 +243,23 @@ void UT_DefaultHandler_CFE_ES_GetAppName(void *UserObj, UT_EntryKey_t FuncKey, c size_t UserBuffSize; size_t BuffPosition; const char *NameBuff; + void * TempBuff; int32 status; UT_Stub_GetInt32StatusCode(Context, &status); if (status >= 0 && BufferLength > 0) { - UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppName), (void **)&NameBuff, &UserBuffSize, &BuffPosition); - if (NameBuff == NULL || UserBuffSize == 0) + UT_GetDataBuffer(UT_KEY(CFE_ES_GetAppName), &TempBuff, &UserBuffSize, &BuffPosition); + if (TempBuff == NULL || UserBuffSize == 0) { NameBuff = "UT"; UserBuffSize = 2; } + else + { + NameBuff = TempBuff; + } if (UserBuffSize < BufferLength) { diff --git a/modules/core_api/ut-stubs/src/cfe_es_stubs.c b/modules/core_api/ut-stubs/src/cfe_es_stubs.c index 9f36afda0..5a1a75c2c 100644 --- a/modules/core_api/ut-stubs/src/cfe_es_stubs.c +++ b/modules/core_api/ut-stubs/src/cfe_es_stubs.c @@ -29,22 +29,22 @@ #include "cfe_es.h" #include "utgenstub.h" -extern void UT_DefaultHandler_CFE_ES_AppID_ToIndex(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_CopyToCDS(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_ExitApp(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_GetAppID(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_GetAppIDByName(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_GetAppName(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_GetPoolBuf(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_GetResetType(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_GetTaskID(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_GetTaskInfo(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_PoolCreate(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_PoolCreateNoSem(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_RestoreFromCDS(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_RunLoop(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_TaskID_ToIndex(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ES_WriteToSysLog(void *, UT_EntryKey_t, const UT_StubContext_t *, va_list); +void UT_DefaultHandler_CFE_ES_AppID_ToIndex(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_CopyToCDS(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_ExitApp(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_GetAppID(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_GetAppIDByName(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_GetAppName(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_GetPoolBuf(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_GetResetType(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_GetTaskID(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_GetTaskInfo(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_PoolCreate(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_PoolCreateNoSem(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_RestoreFromCDS(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_RunLoop(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_TaskID_ToIndex(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_WriteToSysLog(void *, UT_EntryKey_t, const UT_StubContext_t *, va_list); /* * ---------------------------------------------------- diff --git a/modules/core_api/ut-stubs/src/cfe_evs_stubs.c b/modules/core_api/ut-stubs/src/cfe_evs_stubs.c index d3c4560f2..e71bf88de 100644 --- a/modules/core_api/ut-stubs/src/cfe_evs_stubs.c +++ b/modules/core_api/ut-stubs/src/cfe_evs_stubs.c @@ -29,9 +29,9 @@ #include "cfe_evs.h" #include "utgenstub.h" -extern void UT_DefaultHandler_CFE_EVS_SendEvent(void *, UT_EntryKey_t, const UT_StubContext_t *, va_list); -extern void UT_DefaultHandler_CFE_EVS_SendEventWithAppID(void *, UT_EntryKey_t, const UT_StubContext_t *, va_list); -extern void UT_DefaultHandler_CFE_EVS_SendTimedEvent(void *, UT_EntryKey_t, const UT_StubContext_t *, va_list); +void UT_DefaultHandler_CFE_EVS_SendEvent(void *, UT_EntryKey_t, const UT_StubContext_t *, va_list); +void UT_DefaultHandler_CFE_EVS_SendEventWithAppID(void *, UT_EntryKey_t, const UT_StubContext_t *, va_list); +void UT_DefaultHandler_CFE_EVS_SendTimedEvent(void *, UT_EntryKey_t, const UT_StubContext_t *, va_list); /* * ---------------------------------------------------- diff --git a/modules/core_api/ut-stubs/src/cfe_fs_handlers.c b/modules/core_api/ut-stubs/src/cfe_fs_handlers.c index 42b70e6d0..86e18fec9 100644 --- a/modules/core_api/ut-stubs/src/cfe_fs_handlers.c +++ b/modules/core_api/ut-stubs/src/cfe_fs_handlers.c @@ -50,6 +50,7 @@ void UT_DefaultHandler_CFE_FS_GetDefaultMountPoint(void *UserObj, UT_EntryKey_t { int32 Status; static const char DEFAULT_MOUNTPOINT[] = "/ut"; + void * TempBuff; const char * Result; UT_Stub_GetInt32StatusCode(Context, &Status); @@ -58,11 +59,15 @@ void UT_DefaultHandler_CFE_FS_GetDefaultMountPoint(void *UserObj, UT_EntryKey_t if (Status == CFE_SUCCESS) { /* If the test case supplied a buffer, return it, otherwise return fixed value */ - UT_GetDataBuffer(UT_KEY(CFE_FS_GetDefaultMountPoint), (void **)&Result, NULL, NULL); - if (Result == NULL) + UT_GetDataBuffer(UT_KEY(CFE_FS_GetDefaultMountPoint), &TempBuff, NULL, NULL); + if (TempBuff == NULL) { Result = DEFAULT_MOUNTPOINT; } + else + { + Result = TempBuff; + } } UT_Stub_SetReturnValue(FuncKey, Result); @@ -77,6 +82,7 @@ void UT_DefaultHandler_CFE_FS_GetDefaultExtension(void *UserObj, UT_EntryKey_t F { int32 Status; static const char DEFAULT_EXTENSION[] = ".ut"; + void * TempBuff; const char * Result; UT_Stub_GetInt32StatusCode(Context, &Status); @@ -85,11 +91,15 @@ void UT_DefaultHandler_CFE_FS_GetDefaultExtension(void *UserObj, UT_EntryKey_t F if (Status == CFE_SUCCESS) { /* If the test case supplied a buffer, return it, otherwise return fixed value */ - UT_GetDataBuffer(UT_KEY(CFE_FS_GetDefaultExtension), (void **)&Result, NULL, NULL); - if (Result == NULL) + UT_GetDataBuffer(UT_KEY(CFE_FS_GetDefaultExtension), &TempBuff, NULL, NULL); + if (TempBuff == NULL) { Result = DEFAULT_EXTENSION; } + else + { + Result = TempBuff; + } } UT_Stub_SetReturnValue(FuncKey, Result); diff --git a/modules/core_api/ut-stubs/src/cfe_fs_stubs.c b/modules/core_api/ut-stubs/src/cfe_fs_stubs.c index 7e447664e..3485b325b 100644 --- a/modules/core_api/ut-stubs/src/cfe_fs_stubs.c +++ b/modules/core_api/ut-stubs/src/cfe_fs_stubs.c @@ -27,15 +27,15 @@ #include "cfe_fs.h" #include "utgenstub.h" -extern void UT_DefaultHandler_CFE_FS_BackgroundFileDumpIsPending(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_FS_BackgroundFileDumpRequest(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_FS_ExtractFilenameFromPath(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_FS_GetDefaultExtension(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_FS_GetDefaultMountPoint(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_FS_ParseInputFileName(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_FS_ParseInputFileNameEx(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_FS_ReadHeader(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_FS_WriteHeader(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_FS_BackgroundFileDumpIsPending(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_FS_BackgroundFileDumpRequest(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_FS_ExtractFilenameFromPath(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_FS_GetDefaultExtension(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_FS_GetDefaultMountPoint(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_FS_ParseInputFileName(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_FS_ParseInputFileNameEx(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_FS_ReadHeader(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_FS_WriteHeader(void *, UT_EntryKey_t, const UT_StubContext_t *); /* * ---------------------------------------------------- diff --git a/modules/core_api/ut-stubs/src/cfe_msg_stubs.c b/modules/core_api/ut-stubs/src/cfe_msg_stubs.c index 1c5b6059f..6168f7bbe 100644 --- a/modules/core_api/ut-stubs/src/cfe_msg_stubs.c +++ b/modules/core_api/ut-stubs/src/cfe_msg_stubs.c @@ -27,24 +27,24 @@ #include "cfe_msg.h" #include "utgenstub.h" -extern void UT_DefaultHandler_CFE_MSG_GetApId(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetEDSVersion(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetEndian(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetFcnCode(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetHasSecondaryHeader(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetHeaderVersion(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetMsgId(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetMsgTime(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetNextSequenceCount(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetPlaybackFlag(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetSegmentationFlag(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetSequenceCount(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetSize(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetSubsystem(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetSystem(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetType(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_GetTypeFromMsgId(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_MSG_ValidateChecksum(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetApId(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetEDSVersion(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetEndian(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetFcnCode(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetHasSecondaryHeader(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetHeaderVersion(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetMsgId(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetMsgTime(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetNextSequenceCount(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetPlaybackFlag(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetSegmentationFlag(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetSequenceCount(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetSize(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetSubsystem(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetSystem(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetType(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_GetTypeFromMsgId(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_MSG_ValidateChecksum(void *, UT_EntryKey_t, const UT_StubContext_t *); /* * ---------------------------------------------------- diff --git a/modules/core_api/ut-stubs/src/cfe_resourceid_stubs.c b/modules/core_api/ut-stubs/src/cfe_resourceid_stubs.c index 7eb1c7c7b..f565a79f3 100644 --- a/modules/core_api/ut-stubs/src/cfe_resourceid_stubs.c +++ b/modules/core_api/ut-stubs/src/cfe_resourceid_stubs.c @@ -27,10 +27,10 @@ #include "cfe_resourceid.h" #include "utgenstub.h" -extern void UT_DefaultHandler_CFE_ResourceId_FindNext(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ResourceId_GetBase(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ResourceId_GetSerial(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_ResourceId_ToIndex(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ResourceId_FindNext(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ResourceId_GetBase(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ResourceId_GetSerial(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ResourceId_ToIndex(void *, UT_EntryKey_t, const UT_StubContext_t *); /* * ---------------------------------------------------- diff --git a/modules/core_api/ut-stubs/src/cfe_sb_handlers.c b/modules/core_api/ut-stubs/src/cfe_sb_handlers.c index bd47cd9ae..2e245748e 100644 --- a/modules/core_api/ut-stubs/src/cfe_sb_handlers.c +++ b/modules/core_api/ut-stubs/src/cfe_sb_handlers.c @@ -50,12 +50,12 @@ typedef struct static CFE_SB_StubMsg_MetaData_t *CFE_SB_StubMsg_GetMetaData(const CFE_MSG_Message_t *MsgPtr) { - CFE_SB_StubMsg_MetaData_t *MetaPtr; - CFE_SB_StubMsg_MetaData_t DefaultMeta; - size_t MetaSize; - UT_EntryKey_t MsgKey = (UT_EntryKey_t)MsgPtr; + void * MetaPtr; + CFE_SB_StubMsg_MetaData_t DefaultMeta; + size_t MetaSize; + UT_EntryKey_t MsgKey = (UT_EntryKey_t)MsgPtr; - UT_GetDataBuffer(MsgKey, (void **)&MetaPtr, &MetaSize, NULL); + UT_GetDataBuffer(MsgKey, &MetaPtr, &MetaSize, NULL); if (MetaPtr == NULL || MetaSize != sizeof(DefaultMeta)) { memset(&DefaultMeta, 0, sizeof(DefaultMeta)); @@ -64,7 +64,7 @@ static CFE_SB_StubMsg_MetaData_t *CFE_SB_StubMsg_GetMetaData(const CFE_MSG_Messa UT_SetDataBuffer(MsgKey, &DefaultMeta, sizeof(DefaultMeta), true); /* Because "allocate copy" is true above, this gets a pointer to the copy */ - UT_GetDataBuffer(MsgKey, (void **)&MetaPtr, &MetaSize, NULL); + UT_GetDataBuffer(MsgKey, &MetaPtr, &MetaSize, NULL); } return MetaPtr; @@ -123,6 +123,7 @@ void UT_DefaultHandler_CFE_SB_GetPipeName(void *UserObj, UT_EntryKey_t FuncKey, size_t UserBuffSize; size_t BuffPosition; + void * TempBuff; const char *NameBuff; int32 status; @@ -130,12 +131,16 @@ void UT_DefaultHandler_CFE_SB_GetPipeName(void *UserObj, UT_EntryKey_t FuncKey, if (status >= 0 && PipeNameSize > 0) { - UT_GetDataBuffer(UT_KEY(CFE_SB_GetPipeName), (void **)&NameBuff, &UserBuffSize, &BuffPosition); - if (NameBuff == NULL || UserBuffSize == 0) + UT_GetDataBuffer(UT_KEY(CFE_SB_GetPipeName), &TempBuff, &UserBuffSize, &BuffPosition); + if (TempBuff == NULL || UserBuffSize == 0) { NameBuff = "UT"; UserBuffSize = 2; } + else + { + NameBuff = TempBuff; + } if (UserBuffSize < PipeNameSize) { diff --git a/modules/core_api/ut-stubs/src/cfe_sb_stubs.c b/modules/core_api/ut-stubs/src/cfe_sb_stubs.c index 711cb8a85..005099647 100644 --- a/modules/core_api/ut-stubs/src/cfe_sb_stubs.c +++ b/modules/core_api/ut-stubs/src/cfe_sb_stubs.c @@ -27,21 +27,21 @@ #include "cfe_sb.h" #include "utgenstub.h" -extern void UT_DefaultHandler_CFE_SB_AllocateMessageBuffer(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_CreatePipe(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_DeletePipe(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_GetPipeIdByName(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_GetPipeName(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_GetUserData(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_GetUserDataLength(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_IsValidMsgId(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_MessageStringGet(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_MessageStringSet(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_ReceiveBuffer(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_SetUserDataLength(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_TimeStampMsg(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_TransmitBuffer(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_SB_TransmitMsg(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_AllocateMessageBuffer(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_CreatePipe(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_DeletePipe(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_GetPipeIdByName(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_GetPipeName(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_GetUserData(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_GetUserDataLength(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_IsValidMsgId(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_MessageStringGet(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_MessageStringSet(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_ReceiveBuffer(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_SetUserDataLength(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_TimeStampMsg(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_TransmitBuffer(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_SB_TransmitMsg(void *, UT_EntryKey_t, const UT_StubContext_t *); /* * ---------------------------------------------------- diff --git a/modules/core_api/ut-stubs/src/cfe_tbl_stubs.c b/modules/core_api/ut-stubs/src/cfe_tbl_stubs.c index c0c28d727..d063d91cb 100644 --- a/modules/core_api/ut-stubs/src/cfe_tbl_stubs.c +++ b/modules/core_api/ut-stubs/src/cfe_tbl_stubs.c @@ -27,9 +27,9 @@ #include "cfe_tbl.h" #include "utgenstub.h" -extern void UT_DefaultHandler_CFE_TBL_GetAddress(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_TBL_GetInfo(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_TBL_Register(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_TBL_GetAddress(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_TBL_GetInfo(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_TBL_Register(void *, UT_EntryKey_t, const UT_StubContext_t *); /* * ---------------------------------------------------- diff --git a/modules/core_api/ut-stubs/src/cfe_time_stubs.c b/modules/core_api/ut-stubs/src/cfe_time_stubs.c index 722a176e2..dc436599a 100644 --- a/modules/core_api/ut-stubs/src/cfe_time_stubs.c +++ b/modules/core_api/ut-stubs/src/cfe_time_stubs.c @@ -27,15 +27,15 @@ #include "cfe_time.h" #include "utgenstub.h" -extern void UT_DefaultHandler_CFE_TIME_Add(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_TIME_GetMET(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_TIME_GetSTCF(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_TIME_GetTAI(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_TIME_GetTime(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_TIME_GetUTC(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_TIME_MET2SCTime(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_TIME_Print(void *, UT_EntryKey_t, const UT_StubContext_t *); -extern void UT_DefaultHandler_CFE_TIME_Subtract(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_TIME_Add(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_TIME_GetMET(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_TIME_GetSTCF(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_TIME_GetTAI(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_TIME_GetTime(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_TIME_GetUTC(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_TIME_MET2SCTime(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_TIME_Print(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_TIME_Subtract(void *, UT_EntryKey_t, const UT_StubContext_t *); /* * ---------------------------------------------------- diff --git a/modules/core_private/fsw/inc/cfe_config_core_internal.h b/modules/core_private/fsw/inc/cfe_config_core_internal.h new file mode 100644 index 000000000..06dd01f16 --- /dev/null +++ b/modules/core_private/fsw/inc/cfe_config_core_internal.h @@ -0,0 +1,53 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/** + * @file + * + * cFE Internal configuration APIs + * + * The internal APIs prototyped within this file are only intended to be invoked from + * other CFE core apps. They still need to be prototyped in the shared header such that + * they can be called from other core modules, but applications should not call these. + */ + +#ifndef CFE_CONFIG_CORE_INTERNAL_H +#define CFE_CONFIG_CORE_INTERNAL_H + +#include "cfe_config_api_typedefs.h" + +#include "common_types.h" + +/** @defgroup CFEAPIConfigCoreInternal cFE Internal configuration APIs, internal to CFE core + * @{ + */ + +int32 CFE_Config_Init(void); + +/* + * The "Set" API is only used during init phase + */ +void CFE_Config_SetValue(CFE_ConfigId_t ConfigId, uint32 Value); +void CFE_Config_SetString(CFE_ConfigId_t ConfigId, const char *Ptr); +void CFE_Config_SetObjPointer(CFE_ConfigId_t ConfigId, const void *Ptr); + +/**@}*/ + +#endif /* CFE_CONFIG_CORE_INTERNAL_H */ diff --git a/modules/core_private/fsw/inc/cfe_es_core_internal.h b/modules/core_private/fsw/inc/cfe_es_core_internal.h index 257c7d24f..86237f229 100644 --- a/modules/core_private/fsw/inc/cfe_es_core_internal.h +++ b/modules/core_private/fsw/inc/cfe_es_core_internal.h @@ -59,7 +59,7 @@ ** None ** ******************************************************************************/ -extern void CFE_ES_TaskMain(void); +void CFE_ES_TaskMain(void); /*****************************************************************************/ /** @@ -72,7 +72,7 @@ extern void CFE_ES_TaskMain(void); ** -# This function MUST be called before any module API's are called. ** ******************************************************************************/ -extern int32 CFE_ES_CDS_EarlyInit(void); +int32 CFE_ES_CDS_EarlyInit(void); /*****************************************************************************/ /** diff --git a/modules/core_private/fsw/inc/cfe_evs_core_internal.h b/modules/core_private/fsw/inc/cfe_evs_core_internal.h index 694833da3..712f96baf 100644 --- a/modules/core_private/fsw/inc/cfe_evs_core_internal.h +++ b/modules/core_private/fsw/inc/cfe_evs_core_internal.h @@ -59,7 +59,7 @@ ** None ** ******************************************************************************/ -extern void CFE_EVS_TaskMain(void); +void CFE_EVS_TaskMain(void); /*****************************************************************************/ /** @@ -72,7 +72,7 @@ extern void CFE_EVS_TaskMain(void); ** -# This function MUST be called before any module API's are called. ** ******************************************************************************/ -extern int32 CFE_EVS_EarlyInit(void); +int32 CFE_EVS_EarlyInit(void); /*****************************************************************************/ /** @@ -84,7 +84,7 @@ extern int32 CFE_EVS_EarlyInit(void); ** that have been allocated to the specified Application. ** ******************************************************************************/ -extern int32 CFE_EVS_CleanUpApp(CFE_ES_AppId_t AppId); +int32 CFE_EVS_CleanUpApp(CFE_ES_AppId_t AppId); /**@}*/ diff --git a/modules/core_private/fsw/inc/cfe_fs_core_internal.h b/modules/core_private/fsw/inc/cfe_fs_core_internal.h index 2a1d11b1f..2533fcedd 100644 --- a/modules/core_private/fsw/inc/cfe_fs_core_internal.h +++ b/modules/core_private/fsw/inc/cfe_fs_core_internal.h @@ -53,7 +53,7 @@ ** -# This function MUST be called before any module API's are called. ** ******************************************************************************/ -extern int32 CFE_FS_EarlyInit(void); +int32 CFE_FS_EarlyInit(void); /*****************************************************************************/ /** diff --git a/modules/core_private/fsw/inc/cfe_sb_core_internal.h b/modules/core_private/fsw/inc/cfe_sb_core_internal.h index 25ee96929..673fe7510 100644 --- a/modules/core_private/fsw/inc/cfe_sb_core_internal.h +++ b/modules/core_private/fsw/inc/cfe_sb_core_internal.h @@ -56,7 +56,7 @@ ** None ** ******************************************************************************/ -extern void CFE_SB_TaskMain(void); +void CFE_SB_TaskMain(void); /*****************************************************************************/ /** @@ -69,7 +69,7 @@ extern void CFE_SB_TaskMain(void); ** -# This function MUST be called before any module API's are called. ** ******************************************************************************/ -extern int32 CFE_SB_EarlyInit(void); +int32 CFE_SB_EarlyInit(void); /*****************************************************************************/ /** @@ -81,7 +81,7 @@ extern int32 CFE_SB_EarlyInit(void); ** that have been allocated to the specified Application. ** ******************************************************************************/ -extern int32 CFE_SB_CleanUpApp(CFE_ES_AppId_t AppId); +int32 CFE_SB_CleanUpApp(CFE_ES_AppId_t AppId); /**@}*/ diff --git a/modules/core_private/fsw/inc/cfe_tbl_core_internal.h b/modules/core_private/fsw/inc/cfe_tbl_core_internal.h index b298b2054..36a0a8da6 100644 --- a/modules/core_private/fsw/inc/cfe_tbl_core_internal.h +++ b/modules/core_private/fsw/inc/cfe_tbl_core_internal.h @@ -64,7 +64,7 @@ ** None ** ******************************************************************************/ -extern void CFE_TBL_TaskMain(void); +void CFE_TBL_TaskMain(void); /*****************************************************************************/ /** @@ -77,7 +77,7 @@ extern void CFE_TBL_TaskMain(void); ** -# This function MUST be called before any TBL API's are called. ** ******************************************************************************/ -extern int32 CFE_TBL_EarlyInit(void); +int32 CFE_TBL_EarlyInit(void); /*****************************************************************************/ /** @@ -93,7 +93,7 @@ extern int32 CFE_TBL_EarlyInit(void); ** the specified application from the Critical Data Store. ** ******************************************************************************/ -extern int32 CFE_TBL_CleanUpApp(CFE_ES_AppId_t AppId); +int32 CFE_TBL_CleanUpApp(CFE_ES_AppId_t AppId); /**@}*/ diff --git a/modules/core_private/fsw/inc/cfe_time_core_internal.h b/modules/core_private/fsw/inc/cfe_time_core_internal.h index 0c0fc5839..c883eb65c 100644 --- a/modules/core_private/fsw/inc/cfe_time_core_internal.h +++ b/modules/core_private/fsw/inc/cfe_time_core_internal.h @@ -56,7 +56,7 @@ ** None ** ******************************************************************************/ -extern void CFE_TIME_TaskMain(void); +void CFE_TIME_TaskMain(void); /*****************************************************************************/ /** @@ -69,7 +69,7 @@ extern void CFE_TIME_TaskMain(void); ** -# This function MUST be called before any module API's are called. ** ******************************************************************************/ -extern int32 CFE_TIME_EarlyInit(void); +int32 CFE_TIME_EarlyInit(void); /*****************************************************************************/ /** @@ -81,7 +81,7 @@ extern int32 CFE_TIME_EarlyInit(void); ** that have been allocated to the specified Application. ** ******************************************************************************/ -extern int32 CFE_TIME_CleanUpApp(CFE_ES_AppId_t AppId); +int32 CFE_TIME_CleanUpApp(CFE_ES_AppId_t AppId); /**@}*/ diff --git a/modules/core_private/ut-stubs/CMakeLists.txt b/modules/core_private/ut-stubs/CMakeLists.txt index 7e55ac114..e83aa2da2 100644 --- a/modules/core_private/ut-stubs/CMakeLists.txt +++ b/modules/core_private/ut-stubs/CMakeLists.txt @@ -13,6 +13,7 @@ # Create the generic stubs library # add_library(ut_core_private_stubs STATIC + src/cfe_config_core_internal_stubs.c src/cfe_es_core_internal_handlers.c src/cfe_es_core_internal_stubs.c src/cfe_evs_core_internal_stubs.c diff --git a/modules/core_private/ut-stubs/inc/ut_support.h b/modules/core_private/ut-stubs/inc/ut_support.h index 8e65cfe0f..873ba9253 100644 --- a/modules/core_private/ut-stubs/inc/ut_support.h +++ b/modules/core_private/ut-stubs/inc/ut_support.h @@ -214,6 +214,27 @@ void UT_ResetCDS(void); /* Reset pool buffer array index */ void UT_ResetPoolBufferIndex(void); +/*****************************************************************************/ +/** +** \brief Sets up stubs to follow the intended path through a dispatch call +** +** \par Description +** Configures the MSG stubs appropriately so the intended command handler +** is called when invoking a "TaskPipe" handler function. +** +** DispatchReq should point to the intended MsgId + command code to set up. +** +** If DispatchReq is NULL, then any existing stub config is cleared/reset. +** +** If ExpectFailureEvent is set true, then it sets a second stub registration +** for both MsgId and FcnCode to account for failure event reporting +** +** \returns +** This function does not return a value. +******************************************************************************/ +void UT_SetupBasicMsgDispatch(const UT_TaskPipeDispatchId_t *DispatchReq, CFE_MSG_Size_t MsgSize, + bool ExpectFailureEvent); + /*****************************************************************************/ /** ** \brief Send a message via the software bus diff --git a/modules/core_private/ut-stubs/src/cfe_config_core_internal_stubs.c b/modules/core_private/ut-stubs/src/cfe_config_core_internal_stubs.c new file mode 100644 index 000000000..051a4269d --- /dev/null +++ b/modules/core_private/ut-stubs/src/cfe_config_core_internal_stubs.c @@ -0,0 +1,68 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/** + * @file + * + * Auto-Generated stub implementations for functions defined in cfe_config_core_internal header + */ + +#include "cfe_config_core_internal.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_Config_Init() + * ---------------------------------------------------- + */ +int32 CFE_Config_Init(void) +{ + UT_GenStub_SetupReturnBuffer(CFE_Config_Init, int32); + + UT_GenStub_Execute(CFE_Config_Init, Basic, NULL); + + return UT_GenStub_GetReturnValue(CFE_Config_Init, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_Config_SetValue() + * ---------------------------------------------------- + */ +void CFE_Config_SetValue(CFE_ConfigId_t ConfigId, uint32 Value) +{ + UT_GenStub_AddParam(CFE_Config_SetValue, CFE_ConfigId_t, ConfigId); + UT_GenStub_AddParam(CFE_Config_SetValue, uint32, Value); + + UT_GenStub_Execute(CFE_Config_SetValue, Basic, NULL); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_Config_SetPointer() + * ---------------------------------------------------- + */ +void CFE_Config_SetPointer(CFE_ConfigId_t ConfigId, const void *Ptr) +{ + UT_GenStub_AddParam(CFE_Config_SetPointer, CFE_ConfigId_t, ConfigId); + UT_GenStub_AddParam(CFE_Config_SetPointer, const void *, Ptr); + + UT_GenStub_Execute(CFE_Config_SetPointer, Basic, NULL); +} diff --git a/modules/core_private/ut-stubs/src/cfe_es_core_internal_stubs.c b/modules/core_private/ut-stubs/src/cfe_es_core_internal_stubs.c index c3f75ef0f..ff53a95da 100644 --- a/modules/core_private/ut-stubs/src/cfe_es_core_internal_stubs.c +++ b/modules/core_private/ut-stubs/src/cfe_es_core_internal_stubs.c @@ -27,7 +27,7 @@ #include "cfe_es_core_internal.h" #include "utgenstub.h" -extern void UT_DefaultHandler_CFE_ES_RegisterCDSEx(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_ES_RegisterCDSEx(void *, UT_EntryKey_t, const UT_StubContext_t *); /* * ---------------------------------------------------- diff --git a/modules/core_private/ut-stubs/src/cfe_fs_core_internal_stubs.c b/modules/core_private/ut-stubs/src/cfe_fs_core_internal_stubs.c index 8b4c3e176..f9540e6a1 100644 --- a/modules/core_private/ut-stubs/src/cfe_fs_core_internal_stubs.c +++ b/modules/core_private/ut-stubs/src/cfe_fs_core_internal_stubs.c @@ -27,7 +27,7 @@ #include "cfe_fs_core_internal.h" #include "utgenstub.h" -extern void UT_DefaultHandler_CFE_FS_RunBackgroundFileDump(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_FS_RunBackgroundFileDump(void *, UT_EntryKey_t, const UT_StubContext_t *); /* * ---------------------------------------------------- diff --git a/modules/core_private/ut-stubs/src/ut_support.c b/modules/core_private/ut-stubs/src/ut_support.c index 5f50655fa..f38ca3823 100644 --- a/modules/core_private/ut-stubs/src/ut_support.c +++ b/modules/core_private/ut-stubs/src/ut_support.c @@ -69,7 +69,7 @@ static uint16 UT_SendEventHistory[UT_EVENT_HISTORY_SIZE]; static uint16 UT_SendTimedEventHistory[UT_EVENT_HISTORY_SIZE]; static uint16 UT_SendEventAppIDHistory[UT_EVENT_HISTORY_SIZE * 10]; -extern int32 dummy_function(void); +int32 dummy_function(void); /* ** Functions @@ -197,6 +197,41 @@ void UT_ResetPoolBufferIndex(void) UT_SetDataBuffer(UT_KEY(CFE_ES_GetPoolBuf), &UT_CFE_ES_MemoryPool, sizeof(UT_CFE_ES_MemoryPool), false); } +/* +** Sets up the MSG stubs in preparation to invoke a "TaskPipe" dispatch function +** +** This is part of the general UT_CallTaskPipe process, but split off to support use cases +** where the task pipe is reached through other means. +*/ +void UT_SetupBasicMsgDispatch(const UT_TaskPipeDispatchId_t *DispatchReq, CFE_MSG_Size_t MsgSize, + bool ExpectFailureEvent) +{ + if (DispatchReq != NULL) + { + /* Set up for the typical task pipe related calls */ + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), (void *)&DispatchReq->MsgId, sizeof(DispatchReq->MsgId), true); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &MsgSize, sizeof(MsgSize), true); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), (void *)&DispatchReq->CommandCode, + sizeof(DispatchReq->CommandCode), true); + + /* If a failure event is being set up, also set for MsgId/FcnCode retrieval as part of failure event reporting + */ + if (ExpectFailureEvent) + { + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), (void *)&DispatchReq->MsgId, sizeof(DispatchReq->MsgId), true); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), (void *)&DispatchReq->CommandCode, + sizeof(DispatchReq->CommandCode), true); + } + } + else + { + /* Clear any stub config that may have been already set */ + UT_ResetState(UT_KEY(CFE_MSG_GetMsgId)); + UT_ResetState(UT_KEY(CFE_MSG_GetSize)); + UT_ResetState(UT_KEY(CFE_MSG_GetFcnCode)); + } +} + /* ** Calls the specified "task pipe" function ** @@ -215,22 +250,19 @@ void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_SB_Buffer_t *), CFE_MSG_Message_t /* Copy message into aligned SB buffer */ memcpy(SBBuf.Bytes, MsgPtr, MsgSize); - /* Set up for the typical task pipe related calls */ - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &DispatchId.MsgId, sizeof(DispatchId.MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &MsgSize, sizeof(MsgSize), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &DispatchId.CommandCode, sizeof(DispatchId.CommandCode), false); - - /* If 0 size passed in, set buffers for calls in the command length failure reporting */ - if (MsgSize == 0) - { - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &DispatchId.MsgId, sizeof(DispatchId.MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &DispatchId.CommandCode, sizeof(DispatchId.CommandCode), false); - } + /* Passing MsgSize == 0 indicates intent to perform a size validation failure */ + UT_SetupBasicMsgDispatch(&DispatchId, MsgSize, (MsgSize == 0)); /* * Finally, call the actual task pipe requested. */ TaskPipeFunc(&SBBuf.Buf); + + /* + * UN-set the stub config, as some values may point to values on stack. + * This removes any pointers to stack values that may not have been consumed during the call + */ + UT_SetupBasicMsgDispatch(NULL, 0, false); } int32 UT_SoftwareBusSnapshotHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) @@ -372,11 +404,13 @@ static bool UT_CheckEventHistoryFromFunc(UT_EntryKey_t Func, uint16 EventIDToSea bool Result = false; size_t Position; size_t MaxSize; + void * TempBuff; uint16 *EvBuf; - UT_GetDataBuffer(Func, (void **)&EvBuf, &MaxSize, &Position); - if (EvBuf != NULL && MaxSize > 0) + UT_GetDataBuffer(Func, &TempBuff, &MaxSize, &Position); + if (TempBuff != NULL && MaxSize > 0) { + EvBuf = TempBuff; Position /= sizeof(*EvBuf); while (Position > 0) { diff --git a/modules/es/eds/cfe_es.xml b/modules/es/eds/cfe_es.xml index 2e4bdf978..f32537039 100644 --- a/modules/es/eds/cfe_es.xml +++ b/modules/es/eds/cfe_es.xml @@ -173,36 +173,6 @@ \cfetlmmnemonic \ES_ADDRVALID - - - \cfetlmmnemonic \ES_CODEADDR - - - - - \cfetlmmnemonic \ES_CODESIZE - - - - - \cfetlmmnemonic \ES_DATAADDR - - - - - \cfetlmmnemonic \ES_DATASIZE - - - - - \cfetlmmnemonic \ES_BSSADDR - - - - - \cfetlmmnemonic \ES_BSSSIZE - - \cfetlmmnemonic \ES_STARTADDR diff --git a/modules/es/fsw/inc/cfe_es_msg.h b/modules/es/fsw/inc/cfe_es_msg.h index 8755f4d86..fcb64c3ed 100644 --- a/modules/es/fsw/inc/cfe_es_msg.h +++ b/modules/es/fsw/inc/cfe_es_msg.h @@ -1060,7 +1060,7 @@ */ typedef struct CFE_ES_NoArgsCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ } CFE_ES_NoArgsCmd_t; /* @@ -1093,8 +1093,8 @@ typedef struct CFE_ES_RestartCmd_Payload */ typedef struct CFE_ES_RestartCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_RestartCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_RestartCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_RestartCmd_t; /** @@ -1116,8 +1116,8 @@ typedef struct CFE_ES_FileNameCmd_Payload */ typedef struct CFE_ES_FileNameCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_FileNameCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_FileNameCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_FileNameCmd_t; /* @@ -1147,8 +1147,8 @@ typedef struct CFE_ES_OverWriteSysLogCmd_Payload */ typedef struct CFE_ES_OverWriteSysLogCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_OverWriteSysLogCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_OverWriteSysLogCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_OverWriteSysLogCmd_t; /** @@ -1179,8 +1179,8 @@ typedef struct CFE_ES_StartAppCmd_Payload */ typedef struct CFE_ES_StartApp { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_StartAppCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_StartAppCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_StartAppCmd_t; /** @@ -1199,8 +1199,8 @@ typedef struct CFE_ES_AppNameCmd_Payload */ typedef struct CFE_ES_AppNameCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_AppNameCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_AppNameCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_AppNameCmd_t; /* @@ -1230,8 +1230,8 @@ typedef struct CFE_ES_AppReloadCmd_Payload */ typedef struct CFE_ES_ReloadAppCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_AppReloadCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_AppReloadCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_ReloadAppCmd_t; /** @@ -1251,8 +1251,8 @@ typedef struct CFE_ES_SetMaxPRCountCmd_Payload */ typedef struct CFE_ES_SetMaxPRCountCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_SetMaxPRCountCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_SetMaxPRCountCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_SetMaxPRCountCmd_t; /** @@ -1273,8 +1273,8 @@ typedef struct CFE_ES_DeleteCDSCmd_Payload */ typedef struct CFE_ES_DeleteCDSCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_DeleteCDSCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_DeleteCDSCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_DeleteCDSCmd_t; /** @@ -1293,8 +1293,8 @@ typedef struct CFE_ES_StartPerfCmd_Payload */ typedef struct CFE_ES_StartPerfDataCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_StartPerfCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_StartPerfCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_StartPerfDataCmd_t; /** @@ -1314,8 +1314,8 @@ typedef struct CFE_ES_StopPerfCmd_Payload */ typedef struct CFE_ES_StopPerfDataCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_StopPerfCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_StopPerfCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_StopPerfDataCmd_t; /** @@ -1336,8 +1336,8 @@ typedef struct CFE_ES_SetPerfFilterMaskCmd_Payload */ typedef struct CFE_ES_SetPerfFilterMaskCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_SetPerfFilterMaskCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_SetPerfFilterMaskCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_SetPerfFilterMaskCmd_t; /** @@ -1358,8 +1358,8 @@ typedef struct CFE_ES_SetPerfTrigMaskCmd_Payload */ typedef struct CFE_ES_SetPerfTriggerMaskCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_SetPerfTrigMaskCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_SetPerfTrigMaskCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_SetPerfTriggerMaskCmd_t; /** @@ -1380,8 +1380,8 @@ typedef struct CFE_ES_SendMemPoolStatsCmd_Payload */ typedef struct CFE_ES_SendMemPoolStatsCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_SendMemPoolStatsCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_SendMemPoolStatsCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_SendMemPoolStatsCmd_t; /** @@ -1401,8 +1401,8 @@ typedef struct CFE_ES_DumpCDSRegistryCmd_Payload */ typedef struct CFE_ES_DumpCDSRegistryCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_ES_DumpCDSRegistryCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_ES_DumpCDSRegistryCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_ES_DumpCDSRegistryCmd_t; /*************************************************************************/ @@ -1425,8 +1425,8 @@ typedef struct CFE_ES_OneAppTlm_Payload typedef struct CFE_ES_OneAppTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_ES_OneAppTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_ES_OneAppTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_ES_OneAppTlm_t; /** @@ -1441,8 +1441,8 @@ typedef struct CFE_ES_PoolStatsTlm_Payload typedef struct CFE_ES_MemStatsTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_ES_PoolStatsTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_ES_PoolStatsTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_ES_MemStatsTlm_t; /*************************************************************************/ @@ -1549,8 +1549,8 @@ typedef struct CFE_ES_HousekeepingTlm_Payload typedef struct CFE_ES_HousekeepingTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_ES_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_ES_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_ES_HousekeepingTlm_t; diff --git a/modules/es/fsw/src/cfe_es_api.c b/modules/es/fsw/src/cfe_es_api.c index efd0c3281..d325e251d 100644 --- a/modules/es/fsw/src/cfe_es_api.c +++ b/modules/es/fsw/src/cfe_es_api.c @@ -1000,10 +1000,22 @@ CFE_Status_t CFE_ES_GetTaskName(char *TaskName, CFE_ES_TaskId_t TaskId, size_t B OsalId = CFE_ES_TaskId_ToOSAL(TaskId); OsStatus = OS_GetResourceName(OsalId, TaskName, BufferLength); - if (OsStatus != OS_SUCCESS) + if (OsStatus == OS_ERR_INVALID_ID) { + /* Supplied ID is not a CFE task */ return CFE_ES_ERR_RESOURCEID_NOT_VALID; } + if (OsStatus == OS_ERR_NAME_TOO_LONG) + { + /* Name is too long to fit in supplied buffer */ + return CFE_ES_BAD_ARGUMENT; + } + if (OsStatus != OS_SUCCESS) + { + /* Some other uncaught error */ + CFE_ES_WriteToSysLog("%s(): Unexpected error from OS_GetResourceName(): %ld", __func__, (long)OsStatus); + return CFE_STATUS_EXTERNAL_RESOURCE_FAIL; + } return CFE_SUCCESS; } diff --git a/modules/es/fsw/src/cfe_es_apps.c b/modules/es/fsw/src/cfe_es_apps.c index 8d583fcb3..35e8f3cb0 100644 --- a/modules/es/fsw/src/cfe_es_apps.c +++ b/modules/es/fsw/src/cfe_es_apps.c @@ -1791,7 +1791,7 @@ void CFE_ES_CopyModuleAddressInfo(osal_id_t ModuleId, CFE_ES_AppInfo_t *AppInfoP if (OsStatus == OS_SUCCESS) { AppInfoPtr->AddressesAreValid = - (sizeof(ModuleInfo.addr.code_address) <= sizeof(AppInfoPtr->CodeAddress)) && ModuleInfo.addr.valid; + (sizeof(ModuleInfo.addr.code_address) <= sizeof(AppInfoPtr->Code.Address)) && ModuleInfo.addr.valid; } else { @@ -1803,10 +1803,10 @@ void CFE_ES_CopyModuleAddressInfo(osal_id_t ModuleId, CFE_ES_AppInfo_t *AppInfoP * Convert the internal size and address to the telemetry format. * (The telemetry format may be a different bitwidth than the native processor) */ - AppInfoPtr->CodeAddress = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.code_address); - AppInfoPtr->CodeSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.code_size); - AppInfoPtr->DataAddress = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.data_address); - AppInfoPtr->DataSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.data_size); - AppInfoPtr->BSSAddress = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.bss_address); - AppInfoPtr->BSSSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.bss_size); + AppInfoPtr->Code.Address = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.code_address); + AppInfoPtr->Code.Size = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.code_size); + AppInfoPtr->Data.Address = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.data_address); + AppInfoPtr->Data.Size = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.data_size); + AppInfoPtr->BSS.Address = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.bss_address); + AppInfoPtr->BSS.Size = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.bss_size); } diff --git a/modules/es/fsw/src/cfe_es_cds.c b/modules/es/fsw/src/cfe_es_cds.c index 2604b6c2e..c81b10aff 100644 --- a/modules/es/fsw/src/cfe_es_cds.c +++ b/modules/es/fsw/src/cfe_es_cds.c @@ -429,7 +429,7 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, CFE_ES_CDSBlockRecordSetUsed(RegRecPtr, PendingBlockId); } - if (Status == CFE_SUCCESS && (IsNewOffset || IsNewEntry)) + if (Status == CFE_SUCCESS && IsNewOffset) { /* If we succeeded at creating a CDS, save updated registry in the CDS */ RegUpdateStatus = CFE_ES_UpdateCDSRegistry(); diff --git a/modules/es/fsw/src/cfe_es_global.h b/modules/es/fsw/src/cfe_es_global.h index c522ac0a5..c3794ac50 100644 --- a/modules/es/fsw/src/cfe_es_global.h +++ b/modules/es/fsw/src/cfe_es_global.h @@ -240,7 +240,7 @@ extern CFE_ES_Global_t CFE_ES_Global; * @param FunctionName the name of the function/caller * @param LineNumber the line number of the caller */ -extern void CFE_ES_LockSharedData(const char *FunctionName, int32 LineNumber); +void CFE_ES_LockSharedData(const char *FunctionName, int32 LineNumber); /*---------------------------------------------------------------------------------------*/ /** @@ -252,6 +252,6 @@ extern void CFE_ES_LockSharedData(const char *FunctionName, int32 LineNumber); * @param FunctionName the name of the function/caller * @param LineNumber the line number of the caller */ -extern void CFE_ES_UnlockSharedData(const char *FunctionName, int32 LineNumber); +void CFE_ES_UnlockSharedData(const char *FunctionName, int32 LineNumber); #endif /* CFE_ES_GLOBAL_H */ diff --git a/modules/es/fsw/src/cfe_es_objtab.c b/modules/es/fsw/src/cfe_es_objtab.c index 6bf370f3b..d3ddc6a05 100644 --- a/modules/es/fsw/src/cfe_es_objtab.c +++ b/modules/es/fsw/src/cfe_es_objtab.c @@ -44,6 +44,7 @@ #include "cfe_sb_core_internal.h" #include "cfe_tbl_core_internal.h" #include "cfe_time_core_internal.h" +#include "cfe_config_core_internal.h" /* ** @@ -58,7 +59,9 @@ CFE_ES_ObjectTable_t CFE_ES_ObjectTable[CFE_PLATFORM_ES_OBJECT_TABLE_SIZE] = { {.ObjectType = CFE_ES_NULL_ENTRY}, {.ObjectType = CFE_ES_NULL_ENTRY}, {.ObjectType = CFE_ES_NULL_ENTRY}, - {.ObjectType = CFE_ES_NULL_ENTRY}, + + /* Initialize the configuration registry early, so it can be used by core apps */ + {.ObjectType = CFE_ES_FUNCTION_CALL, .ObjectName = "CFE_Config_Init", .FuncPtrUnion.FunctionPtr = CFE_Config_Init}, /* ** cFE core early initialization calls. These must be done before the tasks start diff --git a/modules/es/fsw/src/cfe_es_resource.h b/modules/es/fsw/src/cfe_es_resource.h index ec35beedd..a4b4605b0 100644 --- a/modules/es/fsw/src/cfe_es_resource.h +++ b/modules/es/fsw/src/cfe_es_resource.h @@ -64,7 +64,7 @@ * @param[in] AppID the app ID to locate * @return pointer to App Table entry for the given app ID, or NULL if out of range */ -extern CFE_ES_AppRecord_t *CFE_ES_LocateAppRecordByID(CFE_ES_AppId_t AppID); +CFE_ES_AppRecord_t *CFE_ES_LocateAppRecordByID(CFE_ES_AppId_t AppID); /*---------------------------------------------------------------------------------------*/ /** @@ -92,7 +92,7 @@ extern CFE_ES_AppRecord_t *CFE_ES_LocateAppRecordByID(CFE_ES_AppId_t AppID); * @param[in] LibID the Lib ID to locate * @return pointer to Library Table entry for the given Lib ID, or NULL if out of range */ -extern CFE_ES_LibRecord_t *CFE_ES_LocateLibRecordByID(CFE_ES_LibId_t LibID); +CFE_ES_LibRecord_t *CFE_ES_LocateLibRecordByID(CFE_ES_LibId_t LibID); /*---------------------------------------------------------------------------------------*/ /** @@ -120,7 +120,7 @@ extern CFE_ES_LibRecord_t *CFE_ES_LocateLibRecordByID(CFE_ES_LibId_t LibID); * @param[in] TaskID the task ID to locate * @return pointer to Task Table entry for the given task ID, or NULL if out of range */ -extern CFE_ES_TaskRecord_t *CFE_ES_LocateTaskRecordByID(CFE_ES_TaskId_t TaskID); +CFE_ES_TaskRecord_t *CFE_ES_LocateTaskRecordByID(CFE_ES_TaskId_t TaskID); /*---------------------------------------------------------------------------------------*/ /** @@ -148,7 +148,7 @@ extern CFE_ES_TaskRecord_t *CFE_ES_LocateTaskRecordByID(CFE_ES_TaskId_t TaskID); * @param[in] CounterID the Counter ID to locate * @return pointer to Counter Table entry for the given Counter ID, or NULL if out of range */ -extern CFE_ES_GenCounterRecord_t *CFE_ES_LocateCounterRecordByID(CFE_ES_CounterId_t CounterID); +CFE_ES_GenCounterRecord_t *CFE_ES_LocateCounterRecordByID(CFE_ES_CounterId_t CounterID); /*---------------------------------------------------------------------------------------*/ /** @@ -659,7 +659,7 @@ static inline const char *CFE_ES_CounterRecordGetName(const CFE_ES_GenCounterRec * * The global data lock should be obtained prior to invoking this function. */ -extern CFE_ES_AppRecord_t *CFE_ES_GetAppRecordByContext(void); +CFE_ES_AppRecord_t *CFE_ES_GetAppRecordByContext(void); /*---------------------------------------------------------------------------------------*/ /** @@ -672,7 +672,7 @@ extern CFE_ES_AppRecord_t *CFE_ES_GetAppRecordByContext(void); * * The global data lock should be obtained prior to invoking this function. */ -extern CFE_ES_TaskRecord_t *CFE_ES_GetTaskRecordByContext(void); +CFE_ES_TaskRecord_t *CFE_ES_GetTaskRecordByContext(void); /* * OSAL <-> CFE task ID conversion @@ -706,7 +706,7 @@ extern CFE_ES_TaskRecord_t *CFE_ES_GetTaskRecordByContext(void); * @param[in] id The CFE task ID * @returns The OSAL task ID */ -extern osal_id_t CFE_ES_TaskId_ToOSAL(CFE_ES_TaskId_t id); +osal_id_t CFE_ES_TaskId_ToOSAL(CFE_ES_TaskId_t id); /*---------------------------------------------------------------------------------------*/ /** @@ -727,7 +727,7 @@ extern osal_id_t CFE_ES_TaskId_ToOSAL(CFE_ES_TaskId_t id); * @param[in] id The OSAL task ID * @returns The CFE task ID */ -extern CFE_ES_TaskId_t CFE_ES_TaskId_FromOSAL(osal_id_t id); +CFE_ES_TaskId_t CFE_ES_TaskId_FromOSAL(osal_id_t id); /* * Internal functions to perform name based resource lookups diff --git a/modules/es/fsw/src/cfe_es_start.h b/modules/es/fsw/src/cfe_es_start.h index cae467ac1..c0d01efb6 100644 --- a/modules/es/fsw/src/cfe_es_start.h +++ b/modules/es/fsw/src/cfe_es_start.h @@ -89,7 +89,7 @@ extern CFE_ES_ObjectTable_t CFE_ES_ObjectTable[CFE_PLATFORM_ES_OBJECT_TABLE_SIZE * Purpose: This function reads the es_object_table and performs all of the * application layer initialization. */ -extern void CFE_ES_CreateObjects(void); +void CFE_ES_CreateObjects(void); /* * Name: CFE_ES_SetupResetVariables @@ -99,7 +99,7 @@ extern void CFE_ES_CreateObjects(void); * have happened. * */ -extern void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, uint32 BootSource); +void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, uint32 BootSource); /* * Name: CFE_ES_InitializeFileSystems @@ -107,7 +107,7 @@ extern void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, ui * Purpose: This function initializes the file systems used in the cFE core. * */ -extern void CFE_ES_InitializeFileSystems(uint32 StartType); +void CFE_ES_InitializeFileSystems(uint32 StartType); /* * Name: CFE_ES_SetupPerfVariables @@ -118,6 +118,6 @@ extern void CFE_ES_InitializeFileSystems(uint32 StartType); * This code must be called before any other task or code that would use * CFE_ES_PerfLogEntry() / CFE_ES_PerfLogExit() functions */ -extern void CFE_ES_SetupPerfVariables(uint32 ResetType); +void CFE_ES_SetupPerfVariables(uint32 ResetType); #endif /* CFE_ES_START_H */ diff --git a/modules/es/fsw/src/cfe_es_task.c b/modules/es/fsw/src/cfe_es_task.c index 31b532f38..4703763f1 100644 --- a/modules/es/fsw/src/cfe_es_task.c +++ b/modules/es/fsw/src/cfe_es_task.c @@ -41,6 +41,8 @@ #include "target_config.h" #include "cfe_es_verify.h" +#include "cfe_config.h" + #include /* @@ -179,65 +181,44 @@ void CFE_ES_TaskMain(void) /*---------------------------------------------------------------- * - * Function: CFE_ES_FindConfigKeyValue + * Function: CFE_ES_GenerateSingleVersionEvent * * Internal helper routine only, not part of API. * - * Find value for given config key + * Send a single CFE_ES_VERSION_INF_EID event for a component/module * *-----------------------------------------------------------------*/ -const char *CFE_ES_FindConfigKeyValue(const CFE_ConfigKeyValue_t *ConfigList, const char *KeyName) +int32 CFE_ES_GenerateSingleVersionEvent(const char *ModuleType, const char *ModuleName, CFE_ConfigId_t Id) { - const char *ValuePtr; + int32 Status; - ValuePtr = NULL; - if (KeyName != NULL && ConfigList != NULL) - { - while (ConfigList->Key != NULL) - { - if (strcmp(KeyName, ConfigList->Key) == 0) - { - ValuePtr = ConfigList->Value; - break; - } - - ++ConfigList; - } - } + /* + * Advertise the mission version information + * NOTE: CFE_Config_GetString() does not return NULL, so its OK to use inside an arg list + */ + Status = CFE_EVS_SendEvent(CFE_ES_VERSION_INF_EID, CFE_EVS_EventType_INFORMATION, "Version Info: %s %s, version %s", + ModuleType, ModuleName, CFE_Config_GetString(Id)); - return ValuePtr; + return Status; } /*---------------------------------------------------------------- * - * Function: CFE_ES_GenerateSingleVersionEvent + * Function: CFE_ES_ModSrcVerCallback * * Internal helper routine only, not part of API. * - * Send a single CFE_ES_VERSION_INF_EID event for a component/module + * Callback for iterating all configuration keys * *-----------------------------------------------------------------*/ -int32 CFE_ES_GenerateSingleVersionEvent(const char *ModuleType, const char *ModuleName) +void CFE_ES_ModSrcVerCallback(void *Arg, CFE_ConfigId_t Id, const char *Name) { - int32 Status; - const char *VersionString; - - /* The mission version which should appear in the version list under the mission name */ - VersionString = CFE_ES_FindConfigKeyValue(GLOBAL_CONFIGDATA.ModuleVersionList, ModuleName); + static const char IDNAME_PREFIX[] = "MOD_SRCVER_"; - /* If NULL that means the source code was either uncontrolled or there was no way to determine its version */ - if (VersionString == NULL) + if (strncmp(Name, IDNAME_PREFIX, sizeof(IDNAME_PREFIX) - 1) == 0) { - VersionString = "[unknown]"; + CFE_ES_GenerateSingleVersionEvent("Module", &Name[sizeof(IDNAME_PREFIX) - 1], Id); } - - /* - * Advertise the mission version information - */ - Status = CFE_EVS_SendEvent(CFE_ES_VERSION_INF_EID, CFE_EVS_EventType_INFORMATION, "Version Info: %s %s, version %s", - ModuleType, ModuleName, VersionString); - - return Status; } /*---------------------------------------------------------------- @@ -251,55 +232,18 @@ int32 CFE_ES_GenerateSingleVersionEvent(const char *ModuleType, const char *Modu *-----------------------------------------------------------------*/ void CFE_ES_GenerateVersionEvents(void) { - int32 Status; - CFE_ConfigName_t * ModuleNamePtr; - CFE_StaticModuleLoadEntry_t *StaticModulePtr; + int32 Status; /* * Advertise the mission version information */ - Status = CFE_ES_GenerateSingleVersionEvent("Mission", GLOBAL_CONFIGDATA.MissionName); + Status = CFE_ES_GenerateSingleVersionEvent("Mission", GLOBAL_CONFIGDATA.MissionName, CFE_CONFIGID_MISSION_SRCVER); if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("%s: Error sending mission version event:RC=0x%08X\n", __func__, (unsigned int)Status); } - /* - * Also Advertise the version information for all statically-linked core modules. - * Send a separate CFE_ES_VERSION_INF_EID for every component. - */ - ModuleNamePtr = GLOBAL_CONFIGDATA.CoreModuleList; - if (ModuleNamePtr != NULL) - { - while (Status == CFE_SUCCESS && ModuleNamePtr->Name != NULL) - { - Status = CFE_ES_GenerateSingleVersionEvent("Core Module", ModuleNamePtr->Name); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("%s: Error sending core module version event:RC=0x%08X\n", __func__, - (unsigned int)Status); - } - ++ModuleNamePtr; - } - } - - /* - * Advertise PSP module versions - */ - StaticModulePtr = GLOBAL_CONFIGDATA.PspModuleList; - if (StaticModulePtr != NULL) - { - while (Status == CFE_SUCCESS && StaticModulePtr->Name != NULL) - { - Status = CFE_ES_GenerateSingleVersionEvent("PSP Module", StaticModulePtr->Name); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("%s: Error sending PSP module version event:RC=0x%08X\n", __func__, - (unsigned int)Status); - } - ++StaticModulePtr; - } - } + CFE_Config_IterateAll(NULL, CFE_ES_ModSrcVerCallback); } /*---------------------------------------------------------------- @@ -318,25 +262,10 @@ void CFE_ES_GenerateBuildInfoEvents(void) const char *BuildUser; const char *BuildHost; - BuildDate = CFE_ES_FindConfigKeyValue(GLOBAL_CONFIGDATA.BuildEnvironment, "BUILDDATE"); - BuildUser = CFE_ES_FindConfigKeyValue(GLOBAL_CONFIGDATA.BuildEnvironment, "BUILDUSER"); - BuildHost = CFE_ES_FindConfigKeyValue(GLOBAL_CONFIGDATA.BuildEnvironment, "BUILDHOST"); - - /* Ensure all strings are set to something non-NULL */ - if (BuildDate == NULL) - { - BuildDate = "[unknown]"; - } - - if (BuildUser == NULL) - { - BuildUser = "[unknown]"; - } - - if (BuildHost == NULL) - { - BuildHost = "[unknown]"; - } + /* NOTE: The config APIs using "GetString" will not return NULL */ + BuildDate = CFE_Config_GetString(CFE_CONFIGID_CORE_BUILDINFO_DATE); + BuildUser = CFE_Config_GetString(CFE_CONFIGID_CORE_BUILDINFO_USER); + BuildHost = CFE_Config_GetString(CFE_CONFIGID_CORE_BUILDINFO_HOST); Status = CFE_EVS_SendEvent(CFE_ES_BUILD_INF_EID, CFE_EVS_EventType_INFORMATION, "Build %s by %s@%s, config %s", BuildDate, BuildUser, BuildHost, GLOBAL_CONFIGDATA.Config); @@ -393,20 +322,20 @@ int32 CFE_ES_TaskInit(void) /* ** Initialize housekeeping packet (clear user data area) */ - CFE_MSG_Init(&CFE_ES_Global.TaskData.HkPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_ES_HK_TLM_MID), + CFE_MSG_Init(CFE_MSG_PTR(CFE_ES_Global.TaskData.HkPacket.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_ES_HK_TLM_MID), sizeof(CFE_ES_Global.TaskData.HkPacket)); /* ** Initialize single application telemetry packet */ - CFE_MSG_Init(&CFE_ES_Global.TaskData.OneAppPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_ES_APP_TLM_MID), - sizeof(CFE_ES_Global.TaskData.OneAppPacket)); + CFE_MSG_Init(CFE_MSG_PTR(CFE_ES_Global.TaskData.OneAppPacket.TelemetryHeader), + CFE_SB_ValueToMsgId(CFE_ES_APP_TLM_MID), sizeof(CFE_ES_Global.TaskData.OneAppPacket)); /* ** Initialize memory pool statistics telemetry packet */ - CFE_MSG_Init(&CFE_ES_Global.TaskData.MemStatsPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_ES_MEMSTATS_TLM_MID), - sizeof(CFE_ES_Global.TaskData.MemStatsPacket)); + CFE_MSG_Init(CFE_MSG_PTR(CFE_ES_Global.TaskData.MemStatsPacket.TelemetryHeader), + CFE_SB_ValueToMsgId(CFE_ES_MEMSTATS_TLM_MID), sizeof(CFE_ES_Global.TaskData.MemStatsPacket)); /* ** Create Software Bus message pipe @@ -839,8 +768,8 @@ int32 CFE_ES_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) /* ** Send housekeeping telemetry packet. */ - CFE_SB_TimeStampMsg(&CFE_ES_Global.TaskData.HkPacket.TlmHeader.Msg); - CFE_SB_TransmitMsg(&CFE_ES_Global.TaskData.HkPacket.TlmHeader.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(CFE_ES_Global.TaskData.HkPacket.TelemetryHeader)); + CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_ES_Global.TaskData.HkPacket.TelemetryHeader), true); /* ** This command does not affect the command execution counter. @@ -1235,8 +1164,8 @@ int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOneCmd_t *data) /* ** Send application status telemetry packet. */ - CFE_SB_TimeStampMsg(&CFE_ES_Global.TaskData.OneAppPacket.TlmHeader.Msg); - Result = CFE_SB_TransmitMsg(&CFE_ES_Global.TaskData.OneAppPacket.TlmHeader.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(CFE_ES_Global.TaskData.OneAppPacket.TelemetryHeader)); + Result = CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_ES_Global.TaskData.OneAppPacket.TelemetryHeader), true); if (Result == CFE_SUCCESS) { CFE_ES_Global.TaskData.CommandCounter++; @@ -1974,8 +1903,8 @@ int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStatsCmd_t *data) /* ** Send memory statistics telemetry packet. */ - CFE_SB_TimeStampMsg(&CFE_ES_Global.TaskData.MemStatsPacket.TlmHeader.Msg); - CFE_SB_TransmitMsg(&CFE_ES_Global.TaskData.MemStatsPacket.TlmHeader.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(CFE_ES_Global.TaskData.MemStatsPacket.TelemetryHeader)); + CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_ES_Global.TaskData.MemStatsPacket.TelemetryHeader), true); CFE_ES_Global.TaskData.CommandCounter++; CFE_EVS_SendEvent(CFE_ES_TLM_POOL_STATS_INFO_EID, CFE_EVS_EventType_DEBUG, diff --git a/modules/es/fsw/src/cfe_es_task.h b/modules/es/fsw/src/cfe_es_task.h index c5e281cd7..1249d24b2 100644 --- a/modules/es/fsw/src/cfe_es_task.h +++ b/modules/es/fsw/src/cfe_es_task.h @@ -44,6 +44,7 @@ #include "cfe_fs_api_typedefs.h" #include "cfe_sb_api_typedefs.h" #include "cfe_es_erlog_typedef.h" +#include "cfe_msg_api_typedefs.h" /*************************************************************************/ diff --git a/modules/es/ut-coverage/es_UT.c b/modules/es/ut-coverage/es_UT.c index f550efd25..245487995 100644 --- a/modules/es/ut-coverage/es_UT.c +++ b/modules/es/ut-coverage/es_UT.c @@ -57,7 +57,7 @@ extern CFE_ES_Global_t CFE_ES_Global; -extern int32 dummy_function(void); +int32 dummy_function(void); /* ** Global variables @@ -700,6 +700,7 @@ void TestStartupErrorPaths(void) OS_statvfs_t StatBuf; CFE_ES_TaskRecord_t * TaskRecPtr; CFE_ES_AppRecord_t * AppRecPtr; + void * TempBuff; UtPrintf("Begin Test Startup Error Paths"); @@ -709,7 +710,8 @@ void TestStartupErrorPaths(void) * is part of CFE_ES_Global which is zeroed out as part of test reset. Formerly * this was a separate global which was not cleared with the other globals. */ - UT_GetDataBuffer(UT_KEY(CFE_PSP_GetResetArea), (void **)&ES_UT_PersistentResetData, NULL, NULL); + UT_GetDataBuffer(UT_KEY(CFE_PSP_GetResetArea), &TempBuff, NULL, NULL); + ES_UT_PersistentResetData = TempBuff; /* Set up the startup script for reading */ strncpy(StartupScript, @@ -2456,7 +2458,7 @@ void TestTask(void) union { CFE_MSG_Message_t Msg; - CFE_ES_NoArgsCmd_t NoArgsCmd; + CFE_MSG_CommandHeader_t NoArgsCmd; CFE_ES_ClearSysLogCmd_t ClearSysLogCmd; CFE_ES_ClearERLogCmd_t ClearERLogCmd; CFE_ES_ResetPRCountCmd_t ResetPRCountCmd; @@ -3522,11 +3524,14 @@ void TestPerf(void) UtPrintf("Begin Test Performance Log"); CFE_ES_PerfData_t *Perf; + void * TempBuff; /* ** Set the pointer to the data area */ - UT_GetDataBuffer(UT_KEY(CFE_PSP_GetResetArea), (void **)&ES_UT_PersistentResetData, NULL, NULL); + UT_GetDataBuffer(UT_KEY(CFE_PSP_GetResetArea), &TempBuff, NULL, NULL); + ES_UT_PersistentResetData = TempBuff; + Perf = &ES_UT_PersistentResetData->Perf; /* Test successful performance mask and value initialization */ @@ -4498,8 +4503,12 @@ void TestAPI(void) UtAssert_INT32_EQ(CFE_ES_GetTaskName(NULL, TaskId, sizeof(AppName)), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, 0), CFE_ES_BAD_ARGUMENT); CFE_UtAssert_SUCCESS(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName))); - UT_SetDeferredRetcode(UT_KEY(OS_GetResourceName), 1, OS_ERROR); + UT_SetDeferredRetcode(UT_KEY(OS_GetResourceName), 1, OS_ERR_INVALID_ID); UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UT_SetDeferredRetcode(UT_KEY(OS_GetResourceName), 1, OS_ERR_NAME_TOO_LONG); + UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_ES_BAD_ARGUMENT); + UT_SetDeferredRetcode(UT_KEY(OS_GetResourceName), 1, OS_ERROR); + UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); UtAssert_INT32_EQ(CFE_ES_GetTaskID(NULL), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, NULL), CFE_ES_BAD_ARGUMENT); @@ -4651,7 +4660,7 @@ void TestGenericCounterAPI(void) void TestCDS() { size_t CdsSize; - uint8 * CdsPtr; + void * CdsPtr; char CDSName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN + 4]; CFE_ES_CDSHandle_t CDSHandle; CFE_ES_CDS_RegRec_t *UtCDSRegRecPtr; @@ -4842,7 +4851,7 @@ void TestCDS() /* Reset back to a sufficient CDS size */ UT_SetCDSSize(128 * 1024); - UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, &CdsSize, NULL); + UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), &CdsPtr, &CdsSize, NULL); /* Test CDS initialization with rebuilding not possible */ ES_ResetUnitTest(); @@ -4858,11 +4867,11 @@ void TestCDS() UtAssert_INT32_EQ(CFE_ES_ValidateCDS(), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS validation with CDS read end check failure */ - memset(CdsPtr + CdsSize - CFE_ES_CDS_SIGNATURE_LEN, 'x', CFE_ES_CDS_SIGNATURE_LEN); + memset((unsigned char *)CdsPtr + CdsSize - CFE_ES_CDS_SIGNATURE_LEN, 'x', CFE_ES_CDS_SIGNATURE_LEN); UtAssert_INT32_EQ(CFE_ES_ValidateCDS(), CFE_ES_CDS_INVALID); /* Test CDS validation with CDS read begin check failure */ - UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, &CdsSize, NULL); + UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), &CdsPtr, &CdsSize, NULL); memset(CdsPtr, 'x', CFE_ES_CDS_SIGNATURE_LEN); UtAssert_INT32_EQ(CFE_ES_ValidateCDS(), CFE_ES_CDS_INVALID); @@ -4880,9 +4889,9 @@ void TestCDS() /* Test rebuilding the CDS where the registry is not the same size */ ES_ResetUnitTest(); - UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, &CdsSize, NULL); + UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), &CdsPtr, &CdsSize, NULL); TempSize = CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES + 1; - memcpy(CdsPtr + CDS_REG_SIZE_OFFSET, &TempSize, sizeof(TempSize)); + memcpy((unsigned char *)CdsPtr + CDS_REG_SIZE_OFFSET, &TempSize, sizeof(TempSize)); UtAssert_INT32_EQ(CFE_ES_RebuildCDS(), CFE_ES_CDS_INVALID); /* Test clearing CDS where size is an odd number (requires partial write) */ @@ -5003,7 +5012,7 @@ void TestCDSMempool(void) CFE_ES_CDSHandle_t BlockHandle; size_t SavedSize; size_t SavedOffset; - uint8 * CdsPtr; + void * CdsPtr; UtPrintf("Begin Test CDS memory pool"); @@ -5097,10 +5106,10 @@ void TestCDSMempool(void) UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_CDS_ACCESS_ERROR); /* Corrupt the data as to cause a CRC mismatch */ - UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, NULL, NULL); - CdsPtr[UtCdsRegRecPtr->BlockOffset] ^= 0x02; /* Bit flip */ + UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), &CdsPtr, NULL, NULL); + *((unsigned char *)CdsPtr + UtCdsRegRecPtr->BlockOffset) ^= 0x02; /* Bit flip */ UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_CDS_BLOCK_CRC_ERR); - CdsPtr[UtCdsRegRecPtr->BlockOffset] ^= 0x02; /* Fix Bit */ + *((unsigned char *)CdsPtr + UtCdsRegRecPtr->BlockOffset) ^= 0x02; /* Fix Bit */ /* Set up again with a CDS that is too small to get branch coverage */ /* Test CDS block access */ @@ -5189,7 +5198,7 @@ void TestESMempool(void) * types are in use, underneath the wrapper(s) lies a uint32 eventually. * This is intentionally a type-UNSAFE access to this value. */ - *((uint32 *)&PoolPtr->PoolID) ^= 10; /* cause it to fail validation */ + *((unsigned char *)&PoolPtr->PoolID) ^= 10; /* cause it to fail validation */ UtAssert_BOOL_FALSE(CFE_ES_ValidateHandle(PoolID2)); @@ -5223,7 +5232,7 @@ void TestESMempool(void) UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID2, addressp2), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Undo the previous memory corruption */ - *((uint32 *)&PoolPtr->PoolID) ^= 10; /* Repair Pool2 ID */ + *((unsigned char *)&PoolPtr->PoolID) ^= 10; /* Repair Pool2 ID */ /* Test returning a pool buffer using an invalid memory block */ UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID2, CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp2 - 40)), diff --git a/modules/evs/fsw/inc/cfe_evs_msg.h b/modules/evs/fsw/inc/cfe_evs_msg.h index 84a8de8ac..66f613e5d 100644 --- a/modules/evs/fsw/inc/cfe_evs_msg.h +++ b/modules/evs/fsw/inc/cfe_evs_msg.h @@ -906,7 +906,7 @@ **/ typedef struct CFE_EVS_NoArgsCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ } CFE_EVS_NoArgsCmd_t; /* @@ -934,8 +934,8 @@ typedef struct CFE_EVS_LogFileCmd_Payload */ typedef struct CFE_EVS_WriteLogDataFileCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_EVS_LogFileCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_EVS_LogFileCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_WriteLogDataFileCmd_t; /** @@ -954,8 +954,8 @@ typedef struct CFE_EVS_AppDataCmd_Payload */ typedef struct CFE_EVS_WriteAppDataFileCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_EVS_AppDataCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_EVS_AppDataCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_WriteAppDataFileCmd_t; /** @@ -975,8 +975,8 @@ typedef struct CFE_EVS_SetLogMode_Payload */ typedef struct CFE_EVS_SetLogModeCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_EVS_SetLogMode_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_EVS_SetLogMode_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_SetLogModeCmd_t; /** @@ -996,8 +996,8 @@ typedef struct CFE_EVS_SetEventFormatCode_Payload */ typedef struct CFE_EVS_SetEventFormatModeCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_EVS_SetEventFormatMode_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_EVS_SetEventFormatMode_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_SetEventFormatModeCmd_t; /** @@ -1018,8 +1018,8 @@ typedef struct CFE_EVS_BitMaskCmd_Payload */ typedef struct CFE_EVS_BitMaskCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_EVS_BitMaskCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_EVS_BitMaskCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_BitMaskCmd_t; /* @@ -1049,8 +1049,8 @@ typedef struct CFE_EVS_AppNameCmd_Payload */ typedef struct CFE_EVS_AppNameCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_EVS_AppNameCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_EVS_AppNameCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_AppNameCmd_t; /* @@ -1080,8 +1080,8 @@ typedef struct CFE_EVS_AppNameEventIDCmd_Payload */ typedef struct CFE_EVS_AppNameEventIDCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_EVS_AppNameEventIDCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_EVS_AppNameEventIDCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_AppNameEventIDCmd_t; /* @@ -1110,8 +1110,8 @@ typedef struct CFE_EVS_AppNameBitMaskCmd_Payload */ typedef struct CFE_EVS_AppNameBitMaskCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_EVS_AppNameBitMaskCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_EVS_AppNameBitMaskCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_AppNameBitMaskCmd_t; /* @@ -1141,8 +1141,8 @@ typedef struct CFE_EVS_AppNameEventIDMaskCmd_Payload */ typedef struct CFE_EVS_AppNameEventIDMaskCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_EVS_AppNameEventIDMaskCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_EVS_AppNameEventIDMaskCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_EVS_AppNameEventIDMaskCmd_t; /* @@ -1214,8 +1214,8 @@ typedef struct CFE_EVS_HousekeepingTlm_Payload typedef struct CFE_EVS_HousekeepingTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_EVS_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_EVS_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_EVS_HousekeepingTlm_t; /** Telemetry packet structures */ @@ -1260,15 +1260,15 @@ typedef struct CFE_EVS_ShortEventTlm_Payload typedef struct CFE_EVS_LongEventTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_EVS_LongEventTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_EVS_LongEventTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_EVS_LongEventTlm_t; typedef struct CFE_EVS_ShortEventTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_EVS_ShortEventTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_EVS_ShortEventTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_EVS_ShortEventTlm_t; diff --git a/modules/evs/fsw/src/cfe_evs_task.c b/modules/evs/fsw/src/cfe_evs_task.c index cd19e038f..27b0763e9 100644 --- a/modules/evs/fsw/src/cfe_evs_task.c +++ b/modules/evs/fsw/src/cfe_evs_task.c @@ -72,7 +72,7 @@ int32 CFE_EVS_EarlyInit(void) memset(&CFE_EVS_Global, 0, sizeof(CFE_EVS_Global)); /* Initialize housekeeping packet */ - CFE_MSG_Init(&CFE_EVS_Global.EVS_TlmPkt.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_EVS_HK_TLM_MID), + CFE_MSG_Init(CFE_MSG_PTR(CFE_EVS_Global.EVS_TlmPkt.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_EVS_HK_TLM_MID), sizeof(CFE_EVS_Global.EVS_TlmPkt)); /* Elements stored in the hk packet that have non-zero default values */ @@ -672,9 +672,9 @@ int32 CFE_EVS_ReportHousekeepingCmd(const CFE_MSG_CommandHeader_t *data) AppTlmDataPtr->AppMessageSentCounter = 0; } - CFE_SB_TimeStampMsg(&CFE_EVS_Global.EVS_TlmPkt.TlmHeader.Msg); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(CFE_EVS_Global.EVS_TlmPkt.TelemetryHeader)); - CFE_SB_TransmitMsg(&CFE_EVS_Global.EVS_TlmPkt.TlmHeader.Msg, true); + CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_EVS_Global.EVS_TlmPkt.TelemetryHeader), true); return CFE_STATUS_NO_COUNTER_INCREMENT; } diff --git a/modules/evs/fsw/src/cfe_evs_task.h b/modules/evs/fsw/src/cfe_evs_task.h index ed750014c..13bac811e 100644 --- a/modules/evs/fsw/src/cfe_evs_task.h +++ b/modules/evs/fsw/src/cfe_evs_task.h @@ -139,7 +139,7 @@ extern CFE_EVS_Global_t CFE_EVS_Global; * * This function performs any necessary EVS task initialization. */ -extern int32 CFE_EVS_TaskInit(void); +int32 CFE_EVS_TaskInit(void); /*---------------------------------------------------------------------------------------*/ /** @@ -147,7 +147,7 @@ extern int32 CFE_EVS_TaskInit(void); * * This function processes packets received on the EVS command pipe. */ -extern void CFE_EVS_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr); +void CFE_EVS_ProcessCommandPacket(CFE_SB_Buffer_t *SBBufPtr); /* * EVS Message Handler Functions diff --git a/modules/evs/fsw/src/cfe_evs_utils.c b/modules/evs/fsw/src/cfe_evs_utils.c index 669dc9cc8..a03e03e8b 100644 --- a/modules/evs/fsw/src/cfe_evs_utils.c +++ b/modules/evs/fsw/src/cfe_evs_utils.c @@ -361,7 +361,8 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 int ExpandedLength; /* Initialize EVS event packets */ - CFE_MSG_Init(&LongEventTlm.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID), sizeof(LongEventTlm)); + CFE_MSG_Init(CFE_MSG_PTR(LongEventTlm.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID), + sizeof(LongEventTlm)); LongEventTlm.Payload.PacketID.EventID = EventID; LongEventTlm.Payload.PacketID.EventType = EventType; @@ -388,7 +389,7 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 LongEventTlm.Payload.PacketID.ProcessorID = CFE_PSP_GetProcessorId(); /* Set the packet timestamp */ - CFE_MSG_SetMsgTime(&LongEventTlm.TlmHeader.Msg, *TimeStamp); + CFE_MSG_SetMsgTime(CFE_MSG_PTR(LongEventTlm.TelemetryHeader), *TimeStamp); /* Write event to the event log */ EVS_AddLog(&LongEventTlm); @@ -399,7 +400,7 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 if (CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode == CFE_EVS_MsgFormat_LONG) { /* Send long event via SoftwareBus */ - CFE_SB_TransmitMsg(&LongEventTlm.TlmHeader.Msg, true); + CFE_SB_TransmitMsg(CFE_MSG_PTR(LongEventTlm.TelemetryHeader), true); } else if (CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode == CFE_EVS_MsgFormat_SHORT) { @@ -409,11 +410,11 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 * * This goes out on a separate message ID. */ - CFE_MSG_Init(&ShortEventTlm.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_EVS_SHORT_EVENT_MSG_MID), + CFE_MSG_Init(CFE_MSG_PTR(ShortEventTlm.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_EVS_SHORT_EVENT_MSG_MID), sizeof(ShortEventTlm)); - CFE_MSG_SetMsgTime(&ShortEventTlm.TlmHeader.Msg, *TimeStamp); + CFE_MSG_SetMsgTime(CFE_MSG_PTR(ShortEventTlm.TelemetryHeader), *TimeStamp); ShortEventTlm.Payload.PacketID = LongEventTlm.Payload.PacketID; - CFE_SB_TransmitMsg(&ShortEventTlm.TlmHeader.Msg, true); + CFE_SB_TransmitMsg(CFE_MSG_PTR(ShortEventTlm.TelemetryHeader), true); } /* Increment message send counters (prevent rollover) */ diff --git a/modules/evs/ut-coverage/evs_UT.c b/modules/evs/ut-coverage/evs_UT.c index 3303c5d8f..748a71753 100644 --- a/modules/evs/ut-coverage/evs_UT.c +++ b/modules/evs/ut-coverage/evs_UT.c @@ -853,7 +853,7 @@ void Test_Logging(void) char tmpString[100]; union { - CFE_EVS_NoArgsCmd_t cmd; + CFE_MSG_CommandHeader_t cmd; CFE_EVS_SetLogModeCmd_t modecmd; CFE_EVS_WriteLogDataFileCmd_t logfilecmd; } CmdBuf; @@ -1003,7 +1003,7 @@ void Test_WriteApp(void) { union { - CFE_EVS_NoArgsCmd_t cmd; + CFE_MSG_CommandHeader_t cmd; CFE_EVS_WriteAppDataFileCmd_t AppDataCmd; CFE_EVS_AppNameBitMaskCmd_t appbitcmd; } CmdBuf; @@ -1683,7 +1683,7 @@ void Test_FilterCmd(void) */ void Test_InvalidCmd(void) { - CFE_EVS_NoArgsCmd_t cmd; + CFE_MSG_CommandHeader_t cmd; UtPrintf("Begin Test Invalid Command"); @@ -1816,7 +1816,7 @@ void Test_Misc(void) union { CFE_MSG_Message_t msg; - CFE_EVS_NoArgsCmd_t cmd; + CFE_MSG_CommandHeader_t cmd; CFE_EVS_SetLogModeCmd_t modecmd; CFE_EVS_WriteLogDataFileCmd_t writelogdatacmd; } PktBuf; diff --git a/modules/fs/fsw/src/cfe_fs_priv.h b/modules/fs/fsw/src/cfe_fs_priv.h index 376b65802..11ad51ea9 100644 --- a/modules/fs/fsw/src/cfe_fs_priv.h +++ b/modules/fs/fsw/src/cfe_fs_priv.h @@ -154,7 +154,7 @@ extern CFE_FS_Global_t CFE_FS_Global; * * @param FunctionName The name of the calling function */ -extern void CFE_FS_LockSharedData(const char *FunctionName); +void CFE_FS_LockSharedData(const char *FunctionName); /*---------------------------------------------------------------------------------------*/ /** @@ -162,7 +162,7 @@ extern void CFE_FS_LockSharedData(const char *FunctionName); * * @param FunctionName The name of the calling function */ -extern void CFE_FS_UnlockSharedData(const char *FunctionName); +void CFE_FS_UnlockSharedData(const char *FunctionName); /*---------------------------------------------------------------------------------------*/ /** @@ -170,7 +170,7 @@ extern void CFE_FS_UnlockSharedData(const char *FunctionName); * * @param Hdr The object to byte swap */ -extern void CFE_FS_ByteSwapCFEHeader(CFE_FS_Header_t *Hdr); +void CFE_FS_ByteSwapCFEHeader(CFE_FS_Header_t *Hdr); /*---------------------------------------------------------------------------------------*/ /** @@ -178,6 +178,6 @@ extern void CFE_FS_ByteSwapCFEHeader(CFE_FS_Header_t *Hdr); * * @param Uint32ToSwapPtr The buffer to byte swap */ -extern void CFE_FS_ByteSwapUint32(uint32 *Uint32ToSwapPtr); +void CFE_FS_ByteSwapUint32(uint32 *Uint32ToSwapPtr); #endif /* CFE_FS_PRIV_H */ diff --git a/modules/msg/option_inc/default_cfe_msg_hdr_pri.h b/modules/msg/option_inc/default_cfe_msg_hdr_pri.h index dbc7336ee..f62aaf1c1 100644 --- a/modules/msg/option_inc/default_cfe_msg_hdr_pri.h +++ b/modules/msg/option_inc/default_cfe_msg_hdr_pri.h @@ -38,6 +38,21 @@ #include "cfe_msg_sechdr.h" #include "cfe_msg_api_typedefs.h" +/*****************************************************************************/ +/** + * \brief Convert from a CFE_MSG_TelemetryHeader_t or CFE_MSG_CommandHeader_t to a CFE_MSG_Message_t + * + * \par Description + * Given a pointer to a secondary header structure, return a pointer + * to the CFE_MSG_Message_t (base header/primary header) object. + * + * \par Notes + * Implemented as a macro, so it should work with both Command and Telemetry headers, as well as + * both const and non-const headers. The const-ness of the pointer type should be preserved. + * + */ +#define CFE_MSG_PTR(shdr) (&((shdr).Msg)) + /* * Type Definitions */ diff --git a/modules/msg/option_inc/default_cfe_msg_hdr_priext.h b/modules/msg/option_inc/default_cfe_msg_hdr_priext.h index bea3c3f0a..1788bc7ad 100644 --- a/modules/msg/option_inc/default_cfe_msg_hdr_priext.h +++ b/modules/msg/option_inc/default_cfe_msg_hdr_priext.h @@ -38,6 +38,21 @@ #include "cfe_msg_sechdr.h" #include "cfe_msg_api_typedefs.h" +/*****************************************************************************/ +/** + * \brief Convert from a CFE_MSG_TelemetryHeader_t or CFE_MSG_CommandHeader_t to a CFE_MSG_Message_t + * + * \par Description + * Given a pointer to a secondary header structure, return a pointer + * to the CFE_MSG_Message_t (base header/primary header) object. + * + * \par Notes + * Implemented as a macro, so it should work with both Command and Telemetry headers, as well as + * both const and non-const headers. The const-ness of the pointer type should be preserved. + * + */ +#define CFE_MSG_PTR(shdr) (&((shdr).Msg)) + /* * Type Definitions */ diff --git a/modules/msg/ut-coverage/test_cfe_msg_checksum.c b/modules/msg/ut-coverage/test_cfe_msg_checksum.c index 3dd45579b..8ea0768d5 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_checksum.c +++ b/modules/msg/ut-coverage/test_cfe_msg_checksum.c @@ -37,7 +37,7 @@ void Test_MSG_Checksum(void) { CFE_MSG_CommandHeader_t cmd; - CFE_MSG_Message_t * msgptr = &cmd.Msg; + CFE_MSG_Message_t * msgptr = CFE_MSG_PTR(cmd); bool actual; UtPrintf("Bad parameter tests, Null pointers"); diff --git a/modules/msg/ut-coverage/test_cfe_msg_fc.c b/modules/msg/ut-coverage/test_cfe_msg_fc.c index e9763e2c2..e1aef17d5 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_fc.c +++ b/modules/msg/ut-coverage/test_cfe_msg_fc.c @@ -42,7 +42,7 @@ void Test_MSG_FcnCode(void) { CFE_MSG_CommandHeader_t cmd; - CFE_MSG_Message_t * msgptr = &cmd.Msg; + CFE_MSG_Message_t * msgptr = CFE_MSG_PTR(cmd); CFE_MSG_FcnCode_t input[] = {0, TEST_FCNCODE_MAX / 2, TEST_FCNCODE_MAX}; CFE_MSG_FcnCode_t actual = TEST_FCNCODE_MAX; int i; diff --git a/modules/msg/ut-coverage/test_cfe_msg_init.c b/modules/msg/ut-coverage/test_cfe_msg_init.c index 4364c16d3..bfa67591e 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_init.c +++ b/modules/msg/ut-coverage/test_cfe_msg_init.c @@ -55,27 +55,28 @@ void Test_MSG_Init(void) UtPrintf("Bad parameter tests, Null pointer, invalid size, invalid msgid"); UtAssert_INT32_EQ(CFE_MSG_Init(NULL, CFE_SB_ValueToMsgId(0), sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(0), 0), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), sizeof(cmd)), - CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(-1), sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), CFE_SB_ValueToMsgId(0), 0), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ( + CFE_MSG_Init(CFE_MSG_PTR(cmd), CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), sizeof(cmd)), + CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), CFE_SB_ValueToMsgId(-1), sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); UtPrintf("Set to all F's, msgid value = 0"); memset(&cmd, 0xFF, sizeof(cmd)); msgidval_exp = 0; - CFE_UtAssert_SUCCESS(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(cmd))); - UT_DisplayPkt(&cmd.Msg, 0); - CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&cmd.Msg, &msgid_act)); + CFE_UtAssert_SUCCESS(CFE_MSG_Init(CFE_MSG_PTR(cmd), CFE_SB_ValueToMsgId(msgidval_exp), sizeof(cmd))); + UT_DisplayPkt(CFE_MSG_PTR(cmd), 0); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(CFE_MSG_PTR(cmd), &msgid_act)); UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); - CFE_UtAssert_SUCCESS(CFE_MSG_GetSize(&cmd.Msg, &size)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSize(CFE_MSG_PTR(cmd), &size)); CFE_UtAssert_MEMOFFSET_EQ(size, sizeof(cmd)); - CFE_UtAssert_SUCCESS(CFE_MSG_GetSegmentationFlag(&cmd.Msg, &segflag)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSegmentationFlag(CFE_MSG_PTR(cmd), &segflag)); UtAssert_INT32_EQ(segflag, CFE_MSG_SegFlag_Unsegmented); - CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(&cmd.Msg, &apid)); - CFE_UtAssert_SUCCESS(CFE_MSG_GetHeaderVersion(&cmd.Msg, &hdrver)); - CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&cmd.Msg, &hassec)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(CFE_MSG_PTR(cmd), &apid)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHeaderVersion(CFE_MSG_PTR(cmd), &hdrver)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(CFE_MSG_PTR(cmd), &hassec)); /* A zero msgid will set hassec to false for v1 */ is_v1 = !hassec; @@ -92,25 +93,25 @@ void Test_MSG_Init(void) } /* Confirm the rest of the fields not already explicitly checked */ - UtAssert_UINT32_EQ(Test_MSG_Pri_NotZero(&cmd.Msg) & ~(MSG_APID_FLAG | MSG_HDRVER_FLAG | MSG_HASSEC_FLAG), + UtAssert_UINT32_EQ(Test_MSG_Pri_NotZero(CFE_MSG_PTR(cmd)) & ~(MSG_APID_FLAG | MSG_HDRVER_FLAG | MSG_HASSEC_FLAG), MSG_LENGTH_FLAG | MSG_SEGMENT_FLAG); UtPrintf("Set to all 0, max msgid value"); memset(&cmd, 0, sizeof(cmd)); msgidval_exp = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID; - CFE_UtAssert_SUCCESS(CFE_MSG_Init(&cmd.Msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(cmd))); - UT_DisplayPkt(&cmd.Msg, 0); - CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&cmd.Msg, &msgid_act)); + CFE_UtAssert_SUCCESS(CFE_MSG_Init(CFE_MSG_PTR(cmd), CFE_SB_ValueToMsgId(msgidval_exp), sizeof(cmd))); + UT_DisplayPkt(CFE_MSG_PTR(cmd), 0); + CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(CFE_MSG_PTR(cmd), &msgid_act)); UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); - CFE_UtAssert_SUCCESS(CFE_MSG_GetSize(&cmd.Msg, &size)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSize(CFE_MSG_PTR(cmd), &size)); UtAssert_INT32_EQ(size, sizeof(cmd)); - CFE_UtAssert_SUCCESS(CFE_MSG_GetSegmentationFlag(&cmd.Msg, &segflag)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetSegmentationFlag(CFE_MSG_PTR(cmd), &segflag)); UtAssert_INT32_EQ(segflag, CFE_MSG_SegFlag_Unsegmented); - CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(&cmd.Msg, &apid)); - CFE_UtAssert_SUCCESS(CFE_MSG_GetHeaderVersion(&cmd.Msg, &hdrver)); - CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(&cmd.Msg, &hassec)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetApId(CFE_MSG_PTR(cmd), &apid)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHeaderVersion(CFE_MSG_PTR(cmd), &hdrver)); + CFE_UtAssert_SUCCESS(CFE_MSG_GetHasSecondaryHeader(CFE_MSG_PTR(cmd), &hassec)); UtAssert_BOOL_TRUE(hassec); if (!is_v1) { @@ -123,6 +124,6 @@ void Test_MSG_Init(void) UtAssert_INT32_EQ(hdrver, 0); } - UtAssert_UINT32_EQ(Test_MSG_Pri_NotZero(&cmd.Msg) & ~MSG_HDRVER_FLAG, + UtAssert_UINT32_EQ(Test_MSG_Pri_NotZero(CFE_MSG_PTR(cmd)) & ~MSG_HDRVER_FLAG, MSG_APID_FLAG | MSG_HASSEC_FLAG | MSG_TYPE_FLAG | MSG_LENGTH_FLAG | MSG_SEGMENT_FLAG); } diff --git a/modules/msg/ut-coverage/test_cfe_msg_msgid_shared.c b/modules/msg/ut-coverage/test_cfe_msg_msgid_shared.c index 759409a3c..65151ab22 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_msgid_shared.c +++ b/modules/msg/ut-coverage/test_cfe_msg_msgid_shared.c @@ -46,7 +46,7 @@ void Test_MSG_GetTypeFromMsgId(void) UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Bad parameter tests, Invalid message ID"); - UtAssert_INT32_EQ(CFE_MSG_GetTypeFromMsgId(CFE_SB_INVALID_MSG_ID, &actual), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_GetTypeFromMsgId(CFE_SB_ValueToMsgId(-1), &actual), CFE_MSG_BAD_ARGUMENT); UtPrintf("Set to all F's, test cmd and tlm"); memset(&msg, 0xFF, sizeof(msg)); diff --git a/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c b/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c index b7616a27b..976e00059 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c +++ b/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c @@ -48,28 +48,29 @@ void Test_MSG_MsgId(void) UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&msg, NULL), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtAssert_INT32_EQ(CFE_MSG_SetMsgId(NULL, msgid), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_SB_INVALID_MSG_ID), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(-1)), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); - UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1)), + CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); - UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, 0xFFFF), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0xFFFF)), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); - UtPrintf("Set msg to all F's, set msgid to 0 and verify"); + UtPrintf("Set msg to all F's, set msgid to 1 and verify"); memset(&msg, 0xFF, sizeof(msg)); CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 0xFFFF); - CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, 0)); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(1))); UT_DisplayPkt(&msg, sizeof(msg)); CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); - UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 0); + UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 1); UtAssert_INT32_EQ(Test_MSG_NotF(&msg), MSG_HDRVER_FLAG | MSG_APID_FLAG | MSG_TYPE_FLAG | MSG_HASSEC_FLAG); UtPrintf("Set msg to all 0, set msgid to max and verify"); memset(&msg, 0, sizeof(msg)); CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 0); - CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID)); + CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID))); UT_DisplayPkt(&msg, sizeof(msg)); CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); diff --git a/modules/msg/ut-coverage/test_cfe_msg_time.c b/modules/msg/ut-coverage/test_cfe_msg_time.c index 05d3317a6..a64401efe 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_time.c +++ b/modules/msg/ut-coverage/test_cfe_msg_time.c @@ -37,7 +37,7 @@ void Test_MSG_Time(void) { CFE_MSG_TelemetryHeader_t tlm; - CFE_MSG_Message_t * msgptr = &tlm.Msg; + CFE_MSG_Message_t * msgptr = CFE_MSG_PTR(tlm); CFE_TIME_SysTime_t input[] = {{0, 0}, {0x12345678, 0xABCDEF12}, {0xFFFFFFFF, 0xFFFFFFFF}}; CFE_TIME_SysTime_t actual = {0xFFFFFFFF, 0xFFFFFFFF}; int i; diff --git a/modules/core_private/fsw/inc/cfe_core_resourceid_basevalues.h b/modules/resourceid/fsw/inc/cfe_core_resourceid_basevalues.h similarity index 92% rename from modules/core_private/fsw/inc/cfe_core_resourceid_basevalues.h rename to modules/resourceid/fsw/inc/cfe_core_resourceid_basevalues.h index 8991a1d78..79d676b9c 100644 --- a/modules/core_private/fsw/inc/cfe_core_resourceid_basevalues.h +++ b/modules/resourceid/fsw/inc/cfe_core_resourceid_basevalues.h @@ -68,7 +68,11 @@ enum CFE_RESOURCEID_ES_CDSBLOCKID_BASE_OFFSET = OS_OBJECT_TYPE_USER + 5, /* SB managed resources */ - CFE_RESOURCEID_SB_PIPEID_RESOURCE_BASE_OFFSET = OS_OBJECT_TYPE_USER + 6 + CFE_RESOURCEID_SB_PIPEID_RESOURCE_BASE_OFFSET = OS_OBJECT_TYPE_USER + 6, + + /* configuration registry */ + CFE_RESOURCEID_CONFIGID_BASE_OFFSET = OS_OBJECT_TYPE_USER + 7, + }; /* @@ -87,7 +91,10 @@ enum CFE_ES_CDSBLOCKID_BASE = CFE_RESOURCEID_MAKE_BASE(CFE_RESOURCEID_ES_CDSBLOCKID_BASE_OFFSET), /* SB managed resources */ - CFE_SB_PIPEID_BASE = CFE_RESOURCEID_MAKE_BASE(CFE_RESOURCEID_SB_PIPEID_RESOURCE_BASE_OFFSET) + CFE_SB_PIPEID_BASE = CFE_RESOURCEID_MAKE_BASE(CFE_RESOURCEID_SB_PIPEID_RESOURCE_BASE_OFFSET), + + /* configuration registry */ + CFE_CONFIGID_BASE = CFE_RESOURCEID_MAKE_BASE(CFE_RESOURCEID_CONFIGID_BASE_OFFSET), }; /** @} */ diff --git a/modules/sb/fsw/inc/cfe_sb_msg.h b/modules/sb/fsw/inc/cfe_sb_msg.h index eb505f81d..a2c385788 100644 --- a/modules/sb/fsw/inc/cfe_sb_msg.h +++ b/modules/sb/fsw/inc/cfe_sb_msg.h @@ -504,8 +504,8 @@ typedef struct CFE_SB_WriteFileInfoCmd_Payload */ typedef struct CFE_SB_WriteFileInfoCmd { - CFE_MSG_CommandHeader_t Hdr; /**< \brief Command header */ - CFE_SB_WriteFileInfoCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_SB_WriteFileInfoCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_SB_WriteFileInfoCmd_t; /* @@ -536,8 +536,8 @@ typedef struct CFE_SB_RouteCmd_Payload */ typedef struct CFE_SB_RouteCmd { - CFE_MSG_CommandHeader_t Hdr; /**< \brief Command header */ - CFE_SB_RouteCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_SB_RouteCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_SB_RouteCmd_t; /* @@ -599,8 +599,8 @@ typedef struct CFE_SB_HousekeepingTlm_Payload typedef struct CFE_SB_HousekeepingTlm { - CFE_MSG_TelemetryHeader_t Hdr; /**< \brief Telemetry header */ - CFE_SB_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_SB_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_SB_HousekeepingTlm_t; /** @@ -705,8 +705,8 @@ typedef struct CFE_SB_StatsTlm_Payload typedef struct CFE_SB_StatsTlm { - CFE_MSG_TelemetryHeader_t Hdr; /**< \brief Telemetry header */ - CFE_SB_StatsTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_SB_StatsTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_SB_StatsTlm_t; /** @@ -757,8 +757,8 @@ typedef struct CFE_SB_SingleSubscriptionTlm_Payload typedef struct CFE_SB_SingleSubscriptionTlm { - CFE_MSG_TelemetryHeader_t Hdr; /**< \brief Telemetry header */ - CFE_SB_SingleSubscriptionTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_SB_SingleSubscriptionTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_SB_SingleSubscriptionTlm_t; /** @@ -798,8 +798,8 @@ typedef struct CFE_SB_AllSubscriptionsTlm_Payload typedef struct CFE_SB_AllSubscriptionsTlm { - CFE_MSG_TelemetryHeader_t Hdr; /**< \brief Telemetry header */ - CFE_SB_AllSubscriptionsTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_SB_AllSubscriptionsTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_SB_AllSubscriptionsTlm_t; #endif /* CFE_SB_MSG_H */ diff --git a/modules/sb/fsw/src/cfe_sb_api.c b/modules/sb/fsw/src/cfe_sb_api.c index fb5f119be..e40f74b6f 100644 --- a/modules/sb/fsw/src/cfe_sb_api.c +++ b/modules/sb/fsw/src/cfe_sb_api.c @@ -1503,24 +1503,42 @@ int32 CFE_SB_TransmitMsgValidate(const CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t switch (PendingEventID) { case CFE_SB_SEND_BAD_ARG_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_SEND_BAD_ARG_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, - "Send Err:Bad input argument,Arg 0x%lx,App %s", (unsigned long)MsgPtr, - CFE_SB_GetAppTskName(TskId, FullName)); + if (CFE_SB_RequestToSendEvent(TskId, CFE_SB_SEND_BAD_ARG_EID_BIT) == CFE_SB_GRANTED) + { + CFE_EVS_SendEventWithAppID(CFE_SB_SEND_BAD_ARG_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Send Err:Bad input argument,Arg 0x%lx,App %s", (unsigned long)MsgPtr, + CFE_SB_GetAppTskName(TskId, FullName)); + + /* clear the bit so the task may send this event again */ + CFE_SB_FinishSendEvent(TskId, CFE_SB_SEND_BAD_ARG_EID_BIT); + } break; case CFE_SB_SEND_INV_MSGID_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_SEND_INV_MSGID_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, - "Send Err:Invalid MsgId(0x%x)in msg,App %s", - (unsigned int)CFE_SB_MsgIdToValue(*MsgIdPtr), - CFE_SB_GetAppTskName(TskId, FullName)); + if (CFE_SB_RequestToSendEvent(TskId, CFE_SB_SEND_INV_MSGID_EID_BIT) == CFE_SB_GRANTED) + { + CFE_EVS_SendEventWithAppID(CFE_SB_SEND_INV_MSGID_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Send Err:Invalid MsgId(0x%x)in msg,App %s", + (unsigned int)CFE_SB_MsgIdToValue(*MsgIdPtr), + CFE_SB_GetAppTskName(TskId, FullName)); + + /* clear the bit so the task may send this event again */ + CFE_SB_FinishSendEvent(TskId, CFE_SB_SEND_INV_MSGID_EID_BIT); + } break; case CFE_SB_MSG_TOO_BIG_EID: - CFE_EVS_SendEventWithAppID(CFE_SB_MSG_TOO_BIG_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, - "Send Err:Msg Too Big MsgId=0x%x,app=%s,size=%d,MaxSz=%d", - (unsigned int)CFE_SB_MsgIdToValue(*MsgIdPtr), - CFE_SB_GetAppTskName(TskId, FullName), (int)*SizePtr, - CFE_MISSION_SB_MAX_SB_MSG_SIZE); + if (CFE_SB_RequestToSendEvent(TskId, CFE_SB_MSG_TOO_BIG_EID_BIT) == CFE_SB_GRANTED) + { + CFE_EVS_SendEventWithAppID(CFE_SB_MSG_TOO_BIG_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId, + "Send Err:Msg Too Big MsgId=0x%x,app=%s,size=%d,MaxSz=%d", + (unsigned int)CFE_SB_MsgIdToValue(*MsgIdPtr), + CFE_SB_GetAppTskName(TskId, FullName), (int)*SizePtr, + CFE_MISSION_SB_MAX_SB_MSG_SIZE); + + /* clear the bit so the task may send this event again */ + CFE_SB_FinishSendEvent(TskId, CFE_SB_MSG_TOO_BIG_EID_BIT); + } break; case CFE_SB_SEND_NO_SUBS_EID: diff --git a/modules/sb/fsw/src/cfe_sb_init.c b/modules/sb/fsw/src/cfe_sb_init.c index 1daa95834..82179e6f2 100644 --- a/modules/sb/fsw/src/cfe_sb_init.c +++ b/modules/sb/fsw/src/cfe_sb_init.c @@ -89,7 +89,7 @@ int32 CFE_SB_EarlyInit(void) CFE_SBR_Init(); /* Initialize the SB Statistics Pkt */ - CFE_MSG_Init(&CFE_SB_Global.StatTlmMsg.Hdr.Msg, CFE_SB_ValueToMsgId(CFE_SB_STATS_TLM_MID), + CFE_MSG_Init(CFE_MSG_PTR(CFE_SB_Global.StatTlmMsg.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_SB_STATS_TLM_MID), sizeof(CFE_SB_Global.StatTlmMsg)); return Stat; diff --git a/modules/sb/fsw/src/cfe_sb_priv.h b/modules/sb/fsw/src/cfe_sb_priv.h index 54df50a38..f46669726 100644 --- a/modules/sb/fsw/src/cfe_sb_priv.h +++ b/modules/sb/fsw/src/cfe_sb_priv.h @@ -90,12 +90,14 @@ #define CFE_SB_FILE_IO_ERR (-5) /* bit map for stopping recursive event problem */ -#define CFE_SB_SEND_NO_SUBS_EID_BIT 0 -#define CFE_SB_GET_BUF_ERR_EID_BIT 1 -#define CFE_SB_MSGID_LIM_ERR_EID_BIT 2 -#define CFE_SB_Q_FULL_ERR_EID_BIT 3 -#define CFE_SB_Q_WR_ERR_EID_BIT 4 - +#define CFE_SB_SEND_NO_SUBS_EID_BIT 0 +#define CFE_SB_GET_BUF_ERR_EID_BIT 1 +#define CFE_SB_MSGID_LIM_ERR_EID_BIT 2 +#define CFE_SB_Q_FULL_ERR_EID_BIT 3 +#define CFE_SB_Q_WR_ERR_EID_BIT 4 +#define CFE_SB_SEND_BAD_ARG_EID_BIT 5 +#define CFE_SB_SEND_INV_MSGID_EID_BIT 6 +#define CFE_SB_MSG_TOO_BIG_EID_BIT 7 /* ** Type Definitions */ @@ -920,7 +922,7 @@ int32 CFE_SB_SendPrevSubsCmd(const CFE_SB_SendPrevSubsCmd_t *data); * @param[in] PipeId the Pipe ID to locate * @return pointer to Pipe Table entry for the given Pipe ID */ -extern CFE_SB_PipeD_t *CFE_SB_LocatePipeDescByID(CFE_SB_PipeId_t PipeId); +CFE_SB_PipeD_t *CFE_SB_LocatePipeDescByID(CFE_SB_PipeId_t PipeId); /*---------------------------------------------------------------------------------------*/ /** diff --git a/modules/sb/fsw/src/cfe_sb_task.c b/modules/sb/fsw/src/cfe_sb_task.c index 6f8da5897..92205ff88 100644 --- a/modules/sb/fsw/src/cfe_sb_task.c +++ b/modules/sb/fsw/src/cfe_sb_task.c @@ -204,10 +204,10 @@ int32 CFE_SB_AppInit(void) CFE_ES_WriteToSysLog("%s: Registered %d events for filtering\n", __func__, (int)CfgFileEventsToFilter); - CFE_MSG_Init(&CFE_SB_Global.HKTlmMsg.Hdr.Msg, CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID), + CFE_MSG_Init(CFE_MSG_PTR(CFE_SB_Global.HKTlmMsg.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID), sizeof(CFE_SB_Global.HKTlmMsg)); - CFE_MSG_Init(&CFE_SB_Global.PrevSubMsg.Hdr.Msg, CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID), + CFE_MSG_Init(CFE_MSG_PTR(CFE_SB_Global.PrevSubMsg.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID), sizeof(CFE_SB_Global.PrevSubMsg)); /* Populate the fixed fields in the HK Tlm Msg */ @@ -535,8 +535,8 @@ int32 CFE_SB_SendHKTlmCmd(const CFE_MSG_CommandHeader_t *data) CFE_SB_UnlockSharedData(__FILE__, __LINE__); - CFE_SB_TimeStampMsg(&CFE_SB_Global.HKTlmMsg.Hdr.Msg); - CFE_SB_TransmitMsg(&CFE_SB_Global.HKTlmMsg.Hdr.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(CFE_SB_Global.HKTlmMsg.TelemetryHeader)); + CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_SB_Global.HKTlmMsg.TelemetryHeader), true); return CFE_SUCCESS; } @@ -757,8 +757,8 @@ int32 CFE_SB_SendStatsCmd(const CFE_SB_SendSbStatsCmd_t *data) --PipeStatCount; } - CFE_SB_TimeStampMsg(&CFE_SB_Global.StatTlmMsg.Hdr.Msg); - CFE_SB_TransmitMsg(&CFE_SB_Global.StatTlmMsg.Hdr.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(CFE_SB_Global.StatTlmMsg.TelemetryHeader)); + CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_SB_Global.StatTlmMsg.TelemetryHeader), true); CFE_EVS_SendEvent(CFE_SB_SND_STATS_EID, CFE_EVS_EventType_DEBUG, "Software Bus Statistics packet sent"); @@ -865,14 +865,15 @@ int32 CFE_SB_SendSubscriptionReport(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId if (CFE_SB_Global.SubscriptionReporting == CFE_SB_ENABLE) { - CFE_MSG_Init(&SubRptMsg.Hdr.Msg, CFE_SB_ValueToMsgId(CFE_SB_ONESUB_TLM_MID), sizeof(SubRptMsg)); + CFE_MSG_Init(CFE_MSG_PTR(SubRptMsg.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_SB_ONESUB_TLM_MID), + sizeof(SubRptMsg)); SubRptMsg.Payload.MsgId = MsgId; SubRptMsg.Payload.Pipe = PipeId; SubRptMsg.Payload.Qos = Quality; SubRptMsg.Payload.SubType = CFE_SB_SUBSCRIPTION; - Status = CFE_SB_TransmitMsg(&SubRptMsg.Hdr.Msg, true); + Status = CFE_SB_TransmitMsg(CFE_MSG_PTR(SubRptMsg.TelemetryHeader), true); CFE_EVS_SendEventWithAppID(CFE_SB_SUBSCRIPTION_RPT_EID, CFE_EVS_EventType_DEBUG, CFE_SB_Global.AppId, "Sending Subscription Report Msg=0x%x,Pipe=%lu,Stat=0x%x", (unsigned int)CFE_SB_MsgIdToValue(MsgId), CFE_RESOURCEID_TO_ULONG(PipeId), @@ -1334,7 +1335,7 @@ void CFE_SB_SendRouteSub(CFE_SBR_RouteId_t RouteId, void *ArgPtr) if (CFE_SB_Global.PrevSubMsg.Payload.Entries >= CFE_SB_SUB_ENTRIES_PER_PKT) { CFE_SB_UnlockSharedData(__func__, __LINE__); - status = CFE_SB_TransmitMsg(&CFE_SB_Global.PrevSubMsg.Hdr.Msg, true); + status = CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_SB_Global.PrevSubMsg.TelemetryHeader), true); CFE_EVS_SendEvent(CFE_SB_FULL_SUB_PKT_EID, CFE_EVS_EventType_DEBUG, "Full Sub Pkt %d Sent,Entries=%d,Stat=0x%x\n", (int)CFE_SB_Global.PrevSubMsg.Payload.PktSegment, @@ -1385,7 +1386,7 @@ int32 CFE_SB_SendPrevSubsCmd(const CFE_SB_SendPrevSubsCmd_t *data) /* if pkt has any number of entries, send it as a partial pkt */ if (CFE_SB_Global.PrevSubMsg.Payload.Entries > 0) { - status = CFE_SB_TransmitMsg(&CFE_SB_Global.PrevSubMsg.Hdr.Msg, true); + status = CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_SB_Global.PrevSubMsg.TelemetryHeader), true); CFE_EVS_SendEvent(CFE_SB_PART_SUB_PKT_EID, CFE_EVS_EventType_DEBUG, "Partial Sub Pkt %d Sent,Entries=%d,Stat=0x%x", (int)CFE_SB_Global.PrevSubMsg.Payload.PktSegment, diff --git a/modules/sb/fsw/src/cfe_sb_util.c b/modules/sb/fsw/src/cfe_sb_util.c index 1a46605c1..ea1ef0bf8 100644 --- a/modules/sb/fsw/src/cfe_sb_util.c +++ b/modules/sb/fsw/src/cfe_sb_util.c @@ -63,7 +63,7 @@ size_t CFE_SB_MsgHdrSize(const CFE_MSG_Message_t *MsgPtr) /* Since all cFE messages must have a secondary hdr this check is not needed */ if (!hassechdr) { - size = sizeof(CCSDS_SpacePacket_t); + size = sizeof(CFE_MSG_Message_t); } else if (type == CFE_MSG_Type_Cmd) { diff --git a/modules/sb/ut-coverage/sb_UT.c b/modules/sb/ut-coverage/sb_UT.c index 79bf145ec..ee2fda2db 100644 --- a/modules/sb/ut-coverage/sb_UT.c +++ b/modules/sb/ut-coverage/sb_UT.c @@ -77,6 +77,49 @@ const CFE_SB_MsgId_t SB_UT_TLM_MID4 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALU const CFE_SB_MsgId_t SB_UT_TLM_MID5 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE + 5); const CFE_SB_MsgId_t SB_UT_TLM_MID6 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE + 6); +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_CMD_NOOP_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_CMD_MID), + .CommandCode = CFE_SB_NOOP_CC}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_CMD_RESET_COUNTERS_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_CMD_MID), + .CommandCode = CFE_SB_RESET_COUNTERS_CC}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_CMD_SEND_SB_STATS_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_CMD_MID), + .CommandCode = CFE_SB_SEND_SB_STATS_CC}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_CMD_WRITE_ROUTING_INFO_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_CMD_MID), .CommandCode = CFE_SB_WRITE_ROUTING_INFO_CC}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_CMD_WRITE_PIPE_INFO_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_CMD_MID), + .CommandCode = CFE_SB_WRITE_PIPE_INFO_CC}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_CMD_WRITE_MAP_INFO_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_CMD_MID), + .CommandCode = CFE_SB_WRITE_MAP_INFO_CC}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_CMD_ENABLE_ROUTE_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_CMD_MID), + .CommandCode = CFE_SB_ENABLE_ROUTE_CC}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_CMD_DISABLE_ROUTE_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_CMD_MID), + .CommandCode = CFE_SB_DISABLE_ROUTE_CC}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_SEND_HK = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_SEND_HK_MID)}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_SUB_RPT_CTL_SEND_PREV_SUBS_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_SUB_RPT_CTRL_MID), .CommandCode = CFE_SB_SEND_PREV_SUBS_CC}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_SUB_RPT_CTL_ENABLE_SUB_REPORTING_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_SUB_RPT_CTRL_MID), .CommandCode = CFE_SB_ENABLE_SUB_REPORTING_CC}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_SUB_RPT_CTL_DISABLE_SUB_REPORTING_CC = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_SUB_RPT_CTRL_MID), .CommandCode = CFE_SB_DISABLE_SUB_REPORTING_CC}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_CMD_BAD_FCNCODE = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_CMD_MID), + .CommandCode = 99}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_SUB_RPT_CTRL_BAD_FCNCODE = { + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_SB_SUB_RPT_CTRL_MID), .CommandCode = 99}; + +const UT_TaskPipeDispatchId_t UT_TPID_CFE_SB_BAD_MSGID = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE)}; + /* * A MsgId value which still qualifies as valid * @@ -91,7 +134,7 @@ const CFE_SB_MsgId_t SB_UT_LAST_VALID_MID = CFE_SB_MSGID_WRAP_VALUE(CFE_PLATFORM * This is a "borderline" value to test the limits of the validity checking * The specific value depends on how MsgId is actually defined internally */ -const CFE_SB_MsgId_t SB_UT_FIRST_VALID_MID = CFE_SB_MSGID_WRAP_VALUE(0); +const CFE_SB_MsgId_t SB_UT_FIRST_VALID_MID = CFE_SB_MSGID_WRAP_VALUE(1); /* * A MsgId value which is in the middle of the valid range @@ -133,12 +176,16 @@ CFE_ResourceId_t UT_SB_MakePipeIdForIndex(uint32 ArrayIdx) */ CFE_ES_AppId_t UT_SB_AppID_Modify(CFE_ES_AppId_t InitialID, int32 Modifier) { - CFE_ES_AppId_t TempValue = InitialID; + CFE_ES_AppId_t OutValue; + uint32 InValue; - /* Underneath the wrapper(s) the IDs are 32-bit integer values, so it can be cast */ - *((uint32 *)&TempValue) += Modifier; + InValue = CFE_RESOURCEID_TO_ULONG(InitialID); + InValue += Modifier; - return TempValue; + /* Underneath the wrapper(s) the IDs are 32-bit integer values, so it can be copied */ + memcpy(&OutValue, &InValue, sizeof(OutValue)); + + return OutValue; } /* @@ -390,9 +437,7 @@ void Test_SB_Main_Nominal(void) CFE_SB_BufferD_t Desc; uint8 Data[sizeof(CFE_SB_NoopCmd_t) + offsetof(CFE_SB_BufferD_t, Content)]; } Buffer; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_NOOP_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(CFE_SB_NoopCmd_t); + CFE_MSG_Size_t Size = sizeof(CFE_SB_NoopCmd_t); memset(&Buffer, 0, sizeof(Buffer)); Buffer.Desc.UseCount = 1; @@ -404,9 +449,7 @@ void Test_SB_Main_Nominal(void) UT_SetDeferredRetcode(UT_KEY(OS_QueueGet), 2, OS_QUEUE_EMPTY); /* For the first pass it will call CFE_SB_ProcessCmdPacket which needs to decode it */ - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); + UT_SetupBasicMsgDispatch(&UT_TPID_CFE_SB_CMD_NOOP_CC, Size, false); CFE_SB_TaskMain(); @@ -482,26 +525,14 @@ void Test_SB_Cmds_Noop(void) CFE_SB_Buffer_t SBBuf; CFE_SB_NoopCmd_t Cmd; } Noop; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_NOOP_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(Noop.Cmd); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&Noop.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &Noop.SBBuf.Msg, sizeof(Noop.Cmd), UT_TPID_CFE_SB_CMD_NOOP_CC); CFE_UtAssert_EVENTCOUNT(1); CFE_UtAssert_EVENTSENT(CFE_SB_CMD0_RCVD_EID); - --Size; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&Noop.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &Noop.SBBuf.Msg, 0, UT_TPID_CFE_SB_CMD_NOOP_CC); CFE_UtAssert_EVENTSENT(CFE_SB_LEN_ERR_EID); } /* end Test_SB_Cmds_Noop */ @@ -516,26 +547,15 @@ void Test_SB_Cmds_RstCtrs(void) CFE_SB_Buffer_t SBBuf; CFE_SB_ResetCountersCmd_t Cmd; } ResetCounters; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_RESET_COUNTERS_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(ResetCounters.Cmd); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&ResetCounters.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &ResetCounters.SBBuf.Msg, sizeof(ResetCounters.Cmd), + UT_TPID_CFE_SB_CMD_RESET_COUNTERS_CC); CFE_UtAssert_EVENTCOUNT(1); CFE_UtAssert_EVENTSENT(CFE_SB_CMD1_RCVD_EID); - --Size; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&ResetCounters.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &ResetCounters.SBBuf.Msg, 0, UT_TPID_CFE_SB_CMD_RESET_COUNTERS_CC); CFE_UtAssert_EVENTSENT(CFE_SB_LEN_ERR_EID); } /* Test_SB_Cmds_RstCtrs */ @@ -550,32 +570,26 @@ void Test_SB_Cmds_Stats(void) CFE_SB_Buffer_t SBBuf; CFE_SB_SendSbStatsCmd_t Cmd; } SendSbStats; - CFE_MSG_FcnCode_t FcnCode; - CFE_SB_MsgId_t MsgId; - CFE_MSG_Size_t Size; - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_PipeId_t PipeId3; + CFE_SB_MsgId_t MsgId; + CFE_MSG_Size_t Size; + CFE_SB_PipeId_t PipeId1; + CFE_SB_PipeId_t PipeId2; + CFE_SB_PipeId_t PipeId3; /* Make the pipe table non-empty so the stats command writes something */ CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId1, 4, "TestPipe1")); CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId2, 4, "TestPipe2")); CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId3, 4, "TestPipe3")); + /* Generic command processing - The dispatch must be set up FIRST */ + UT_SetupBasicMsgDispatch(&UT_TPID_CFE_SB_CMD_SEND_SB_STATS_CC, sizeof(SendSbStats.Cmd), false); + /* For internal TransmitMsg call */ MsgId = CFE_SB_ValueToMsgId(CFE_SB_STATS_TLM_MID); Size = sizeof(CFE_SB_Global.StatTlmMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - /* For Generic command processing */ - MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - Size = sizeof(SendSbStats.Cmd); - FcnCode = CFE_SB_SEND_SB_STATS_CC; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&SendSbStats.SBBuf); /* No subs event and command processing event */ @@ -583,13 +597,7 @@ void Test_SB_Cmds_Stats(void) CFE_UtAssert_EVENTSENT(CFE_SB_SND_STATS_EID); - --Size; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&SendSbStats.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &SendSbStats.SBBuf.Msg, 0, UT_TPID_CFE_SB_CMD_SEND_SB_STATS_CC); CFE_UtAssert_EVENTSENT(CFE_SB_LEN_ERR_EID); CFE_UtAssert_TEARDOWN(CFE_SB_DeletePipe(PipeId1)); @@ -608,19 +616,14 @@ void Test_SB_Cmds_RoutingInfoDef(void) CFE_SB_Buffer_t SBBuf; CFE_SB_WriteRoutingInfoCmd_t Cmd; } WriteRoutingInfo; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_ROUTING_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteRoutingInfo.Cmd); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); WriteRoutingInfo.Cmd.Payload.Filename[0] = '\0'; /* Make some routing info by calling CFE_SB_AppInit */ CFE_UtAssert_SETUP(CFE_SB_AppInit()); - CFE_SB_ProcessCmdPipePkt(&WriteRoutingInfo.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &WriteRoutingInfo.SBBuf.Msg, sizeof(WriteRoutingInfo.Cmd), + UT_TPID_CFE_SB_CMD_WRITE_ROUTING_INFO_CC); CFE_UtAssert_EVENTCOUNT(5); @@ -629,21 +632,13 @@ void Test_SB_Cmds_RoutingInfoDef(void) CFE_UtAssert_EVENTSENT(CFE_SB_SUBSCRIPTION_RCVD_EID); /* Also test with a bad file name - should generate CFE_SB_SND_RTG_ERR1_EID */ - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); - CFE_SB_ProcessCmdPipePkt(&WriteRoutingInfo.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &WriteRoutingInfo.SBBuf.Msg, sizeof(WriteRoutingInfo.Cmd), + UT_TPID_CFE_SB_CMD_WRITE_ROUTING_INFO_CC); CFE_UtAssert_EVENTSENT(CFE_SB_SND_RTG_ERR1_EID); - --Size; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&WriteRoutingInfo.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &WriteRoutingInfo.SBBuf.Msg, 0, UT_TPID_CFE_SB_CMD_WRITE_ROUTING_INFO_CC); CFE_UtAssert_EVENTSENT(CFE_SB_LEN_ERR_EID); CFE_UtAssert_TEARDOWN(CFE_SB_DeletePipe(CFE_SB_Global.CmdPipe)); @@ -660,19 +655,14 @@ void Test_SB_Cmds_RoutingInfoAlreadyPending(void) CFE_SB_Buffer_t SBBuf; CFE_SB_WriteRoutingInfoCmd_t Cmd; } WriteRoutingInfo; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_ROUTING_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteRoutingInfo.Cmd); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), true); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); strncpy(WriteRoutingInfo.Cmd.Payload.Filename, "RoutingTstFile", sizeof(WriteRoutingInfo.Cmd.Payload.Filename) - 1); WriteRoutingInfo.Cmd.Payload.Filename[sizeof(WriteRoutingInfo.Cmd.Payload.Filename) - 1] = '\0'; - CFE_SB_ProcessCmdPipePkt(&WriteRoutingInfo.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &WriteRoutingInfo.SBBuf.Msg, sizeof(WriteRoutingInfo.Cmd), + UT_TPID_CFE_SB_CMD_WRITE_ROUTING_INFO_CC); CFE_UtAssert_EVENTCOUNT(1); @@ -767,17 +757,11 @@ void Test_SB_Cmds_PipeInfoDef(void) CFE_SB_Buffer_t SBBuf; CFE_SB_WritePipeInfoCmd_t Cmd; } WritePipeInfo; - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_PipeId_t PipeId3; - uint16 PipeDepth = 10; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_PIPE_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WritePipeInfo.Cmd); + CFE_SB_PipeId_t PipeId1; + CFE_SB_PipeId_t PipeId2; + CFE_SB_PipeId_t PipeId3; + uint16 PipeDepth = 10; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); WritePipeInfo.Cmd.Payload.Filename[0] = '\0'; /* Create some pipe info */ @@ -785,27 +769,20 @@ void Test_SB_Cmds_PipeInfoDef(void) CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId2, PipeDepth, "TestPipe2")); CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId3, PipeDepth, "TestPipe3")); - CFE_SB_ProcessCmdPipePkt(&WritePipeInfo.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &WritePipeInfo.SBBuf.Msg, sizeof(WritePipeInfo.Cmd), + UT_TPID_CFE_SB_CMD_WRITE_PIPE_INFO_CC); CFE_UtAssert_EVENTCOUNT(3); CFE_UtAssert_EVENTSENT(CFE_SB_PIPE_ADDED_EID); /* Also test with a bad file name - should generate CFE_SB_SND_RTG_ERR1_EID */ - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); - CFE_SB_ProcessCmdPipePkt(&WritePipeInfo.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &WritePipeInfo.SBBuf.Msg, sizeof(WritePipeInfo.Cmd), + UT_TPID_CFE_SB_CMD_WRITE_PIPE_INFO_CC); CFE_UtAssert_EVENTSENT(CFE_SB_SND_RTG_ERR1_EID); - --Size; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&WritePipeInfo.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &WritePipeInfo.SBBuf.Msg, 0, UT_TPID_CFE_SB_CMD_WRITE_PIPE_INFO_CC); CFE_UtAssert_EVENTSENT(CFE_SB_LEN_ERR_EID); CFE_UtAssert_TEARDOWN(CFE_SB_DeletePipe(PipeId1)); @@ -824,19 +801,14 @@ void Test_SB_Cmds_PipeInfoAlreadyPending(void) CFE_SB_Buffer_t SBBuf; CFE_SB_WritePipeInfoCmd_t Cmd; } WritePipeInfo; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_PIPE_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WritePipeInfo.Cmd); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), true); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); strncpy(WritePipeInfo.Cmd.Payload.Filename, "PipeTstFile", sizeof(WritePipeInfo.Cmd.Payload.Filename) - 1); WritePipeInfo.Cmd.Payload.Filename[sizeof(WritePipeInfo.Cmd.Payload.Filename) - 1] = '\0'; - CFE_SB_ProcessCmdPipePkt(&WritePipeInfo.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &WritePipeInfo.SBBuf.Msg, sizeof(WritePipeInfo.Cmd), + UT_TPID_CFE_SB_CMD_WRITE_PIPE_INFO_CC); CFE_UtAssert_EVENTCOUNT(1); @@ -974,23 +946,17 @@ void Test_SB_Cmds_MapInfoDef(void) CFE_SB_Buffer_t SBBuf; CFE_SB_WriteMapInfoCmd_t Cmd; } WriteMapInfo; - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_PipeId_t PipeId3; - CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID1; - CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID2; - CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID3; - CFE_SB_MsgId_t MsgId3 = SB_UT_TLM_MID4; - CFE_SB_MsgId_t MsgId4 = SB_UT_TLM_MID5; - CFE_SB_MsgId_t MsgId5 = SB_UT_TLM_MID6; - uint16 PipeDepth = 10; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_MAP_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteMapInfo.Cmd); + CFE_SB_PipeId_t PipeId1; + CFE_SB_PipeId_t PipeId2; + CFE_SB_PipeId_t PipeId3; + CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID1; + CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID2; + CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID3; + CFE_SB_MsgId_t MsgId3 = SB_UT_TLM_MID4; + CFE_SB_MsgId_t MsgId4 = SB_UT_TLM_MID5; + CFE_SB_MsgId_t MsgId5 = SB_UT_TLM_MID6; + uint16 PipeDepth = 10; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); WriteMapInfo.Cmd.Payload.Filename[0] = '\0'; /* Create some map info */ @@ -1005,7 +971,8 @@ void Test_SB_Cmds_MapInfoDef(void) CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId4, PipeId3)); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId5, PipeId2)); - CFE_SB_ProcessCmdPipePkt(&WriteMapInfo.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &WriteMapInfo.SBBuf.Msg, sizeof(WriteMapInfo.Cmd), + UT_TPID_CFE_SB_CMD_WRITE_MAP_INFO_CC); CFE_UtAssert_EVENTCOUNT(10); @@ -1014,20 +981,13 @@ void Test_SB_Cmds_MapInfoDef(void) CFE_UtAssert_EVENTSENT(CFE_SB_SUBSCRIPTION_RCVD_EID); /* Also test with a bad file name - should generate CFE_SB_SND_RTG_ERR1_EID */ - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); - CFE_SB_ProcessCmdPipePkt(&WriteMapInfo.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &WriteMapInfo.SBBuf.Msg, sizeof(WriteMapInfo.Cmd), + UT_TPID_CFE_SB_CMD_WRITE_MAP_INFO_CC); CFE_UtAssert_EVENTSENT(CFE_SB_SND_RTG_ERR1_EID); - --Size; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&WriteMapInfo.SBBuf); + /* Bad Size */ + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &WriteMapInfo.SBBuf.Msg, 0, UT_TPID_CFE_SB_CMD_WRITE_MAP_INFO_CC); CFE_UtAssert_EVENTSENT(CFE_SB_LEN_ERR_EID); CFE_UtAssert_TEARDOWN(CFE_SB_DeletePipe(PipeId1)); @@ -1046,19 +1006,14 @@ void Test_SB_Cmds_MapInfoAlreadyPending(void) CFE_SB_Buffer_t SBBuf; CFE_SB_WriteMapInfoCmd_t Cmd; } WriteMapInfo; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_WRITE_MAP_INFO_CC; - CFE_SB_MsgId_t MsgId = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(WriteMapInfo.Cmd); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), true); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); strncpy(WriteMapInfo.Cmd.Payload.Filename, "MapTstFile", sizeof(WriteMapInfo.Cmd.Payload.Filename) - 1); WriteMapInfo.Cmd.Payload.Filename[sizeof(WriteMapInfo.Cmd.Payload.Filename) - 1] = '\0'; - CFE_SB_ProcessCmdPipePkt(&WriteMapInfo.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &WriteMapInfo.SBBuf.Msg, sizeof(WriteMapInfo.Cmd), + UT_TPID_CFE_SB_CMD_WRITE_MAP_INFO_CC); CFE_UtAssert_EVENTCOUNT(1); @@ -1077,23 +1032,17 @@ void Test_SB_Cmds_EnRouteValParam(void) CFE_SB_Buffer_t SBBuf; CFE_SB_EnableRouteCmd_t Cmd; } EnableRoute; - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - uint16 PipeDepth = 5; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_ROUTE_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnableRoute.Cmd); - - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); + CFE_SB_PipeId_t PipeId; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + uint16 PipeDepth = 5; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "EnRouteTestPipe")); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId)); EnableRoute.Cmd.Payload.MsgId = MsgId; EnableRoute.Cmd.Payload.Pipe = PipeId; - CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &EnableRoute.SBBuf.Msg, sizeof(EnableRoute.Cmd), + UT_TPID_CFE_SB_CMD_ENABLE_ROUTE_CC); CFE_UtAssert_EVENTCOUNT(3); @@ -1103,13 +1052,8 @@ void Test_SB_Cmds_EnRouteValParam(void) CFE_UtAssert_EVENTSENT(CFE_SB_ENBL_RTE2_EID); - --Size; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); + /* Bad Size */ + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &EnableRoute.SBBuf.Msg, 0, UT_TPID_CFE_SB_CMD_ENABLE_ROUTE_CC); CFE_UtAssert_EVENTSENT(CFE_SB_LEN_ERR_EID); CFE_UtAssert_TEARDOWN(CFE_SB_DeletePipe(PipeId)); @@ -1126,17 +1070,10 @@ void Test_SB_Cmds_EnRouteNonExist(void) CFE_SB_Buffer_t SBBuf; CFE_SB_EnableRouteCmd_t Cmd; } EnableRoute; - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - uint16 PipeDepth = 5; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_ROUTE_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnableRoute.Cmd); - - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); + CFE_SB_PipeId_t PipeId1; + CFE_SB_PipeId_t PipeId2; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + uint16 PipeDepth = 5; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "EnRouteTestPipe1")); CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId2, PipeDepth, "EnRouteTestPipe2")); @@ -1144,7 +1081,8 @@ void Test_SB_Cmds_EnRouteNonExist(void) EnableRoute.Cmd.Payload.MsgId = MsgId; EnableRoute.Cmd.Payload.Pipe = PipeId2; - CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &EnableRoute.SBBuf.Msg, sizeof(EnableRoute.Cmd), + UT_TPID_CFE_SB_CMD_ENABLE_ROUTE_CC); CFE_UtAssert_EVENTCOUNT(4); @@ -1167,18 +1105,12 @@ void Test_SB_Cmds_EnRouteInvParam(void) CFE_SB_Buffer_t SBBuf; CFE_SB_EnableRouteCmd_t Cmd; } EnableRoute; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_ROUTE_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnableRoute.Cmd); - - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); EnableRoute.Cmd.Payload.MsgId = SB_UT_LAST_VALID_MID; EnableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; - CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &EnableRoute.SBBuf.Msg, sizeof(EnableRoute.Cmd), + UT_TPID_CFE_SB_CMD_ENABLE_ROUTE_CC); CFE_UtAssert_EVENTCOUNT(1); @@ -1196,18 +1128,12 @@ void Test_SB_Cmds_EnRouteInvParam2(void) CFE_SB_Buffer_t SBBuf; CFE_SB_EnableRouteCmd_t Cmd; } EnableRoute; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_ROUTE_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnableRoute.Cmd); - - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); EnableRoute.Cmd.Payload.MsgId = CFE_SB_INVALID_MSG_ID; EnableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; - CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &EnableRoute.SBBuf.Msg, sizeof(EnableRoute.Cmd), + UT_TPID_CFE_SB_CMD_ENABLE_ROUTE_CC); CFE_UtAssert_EVENTCOUNT(1); @@ -1226,18 +1152,12 @@ void Test_SB_Cmds_EnRouteInvParam3(void) CFE_SB_Buffer_t SBBuf; CFE_SB_EnableRouteCmd_t Cmd; } EnableRoute; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_ROUTE_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(EnableRoute.Cmd); - - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); EnableRoute.Cmd.Payload.MsgId = SB_UT_ALTERNATE_INVALID_MID; EnableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_0; - CFE_SB_ProcessCmdPipePkt(&EnableRoute.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &EnableRoute.SBBuf.Msg, sizeof(EnableRoute.Cmd), + UT_TPID_CFE_SB_CMD_ENABLE_ROUTE_CC); CFE_UtAssert_EVENTCOUNT(1); @@ -1255,23 +1175,17 @@ void Test_SB_Cmds_DisRouteValParam(void) CFE_SB_Buffer_t SBBuf; CFE_SB_DisableRouteCmd_t Cmd; } DisableRoute; - CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - uint16 PipeDepth = 5; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_DISABLE_ROUTE_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(DisableRoute.Cmd); - - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); + CFE_SB_PipeId_t PipeId; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + uint16 PipeDepth = 5; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "DisRouteTestPipe")); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId)); DisableRoute.Cmd.Payload.MsgId = MsgId; DisableRoute.Cmd.Payload.Pipe = PipeId; - CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &DisableRoute.SBBuf.Msg, sizeof(DisableRoute.Cmd), + UT_TPID_CFE_SB_CMD_DISABLE_ROUTE_CC); CFE_UtAssert_EVENTCOUNT(3); @@ -1281,13 +1195,8 @@ void Test_SB_Cmds_DisRouteValParam(void) CFE_UtAssert_EVENTSENT(CFE_SB_DSBL_RTE2_EID); - --Size; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); + /* Bad Size */ + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &DisableRoute.SBBuf.Msg, 0, UT_TPID_CFE_SB_CMD_DISABLE_ROUTE_CC); CFE_UtAssert_EVENTSENT(CFE_SB_LEN_ERR_EID); CFE_UtAssert_TEARDOWN(CFE_SB_DeletePipe(PipeId)); @@ -1304,16 +1213,9 @@ void Test_SB_Cmds_DisRouteNonExist(void) CFE_SB_Buffer_t SBBuf; CFE_SB_DisableRouteCmd_t Cmd; } DisableRoute; - CFE_SB_PipeId_t PipeId1, PipeId2; - CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; - uint16 PipeDepth = 5; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_DISABLE_ROUTE_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(DisableRoute.Cmd); - - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); + CFE_SB_PipeId_t PipeId1, PipeId2; + CFE_SB_MsgId_t MsgId = SB_UT_TLM_MID; + uint16 PipeDepth = 5; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "DisRouteTestPipe1")); CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId2, PipeDepth, "DisRouteTestPipe2")); @@ -1321,7 +1223,8 @@ void Test_SB_Cmds_DisRouteNonExist(void) DisableRoute.Cmd.Payload.MsgId = MsgId; DisableRoute.Cmd.Payload.Pipe = PipeId2; - CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &DisableRoute.SBBuf.Msg, sizeof(DisableRoute.Cmd), + UT_TPID_CFE_SB_CMD_DISABLE_ROUTE_CC); CFE_UtAssert_EVENTCOUNT(4); @@ -1344,18 +1247,12 @@ void Test_SB_Cmds_DisRouteInvParam(void) CFE_SB_Buffer_t SBBuf; CFE_SB_DisableRouteCmd_t Cmd; } DisableRoute; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_DISABLE_ROUTE_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(DisableRoute.Cmd); - - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); DisableRoute.Cmd.Payload.MsgId = SB_UT_LAST_VALID_MID; DisableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; - CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &DisableRoute.SBBuf.Msg, sizeof(DisableRoute.Cmd), + UT_TPID_CFE_SB_CMD_DISABLE_ROUTE_CC); CFE_UtAssert_EVENTCOUNT(1); @@ -1373,18 +1270,12 @@ void Test_SB_Cmds_DisRouteInvParam2(void) CFE_SB_Buffer_t SBBuf; CFE_SB_DisableRouteCmd_t Cmd; } DisableRoute; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_DISABLE_ROUTE_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(DisableRoute.Cmd); - - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); DisableRoute.Cmd.Payload.MsgId = CFE_SB_INVALID_MSG_ID; DisableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_3; - CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &DisableRoute.SBBuf.Msg, sizeof(DisableRoute.Cmd), + UT_TPID_CFE_SB_CMD_DISABLE_ROUTE_CC); CFE_UtAssert_EVENTCOUNT(1); @@ -1403,18 +1294,12 @@ void Test_SB_Cmds_DisRouteInvParam3(void) CFE_SB_Buffer_t SBBuf; CFE_SB_DisableRouteCmd_t Cmd; } DisableRoute; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_DISABLE_ROUTE_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(DisableRoute.Cmd); - - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); DisableRoute.Cmd.Payload.MsgId = SB_UT_ALTERNATE_INVALID_MID; DisableRoute.Cmd.Payload.Pipe = SB_UT_PIPEID_0; - CFE_SB_ProcessCmdPipePkt(&DisableRoute.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &DisableRoute.SBBuf.Msg, sizeof(DisableRoute.Cmd), + UT_TPID_CFE_SB_CMD_DISABLE_ROUTE_CC); CFE_UtAssert_EVENTCOUNT(1); @@ -1435,16 +1320,15 @@ void Test_SB_Cmds_SendHK(void) CFE_SB_MsgId_t MsgIdCmd; CFE_MSG_Size_t Size; + /* For HK command processing - set up FIRST */ + UT_SetupBasicMsgDispatch(&UT_TPID_CFE_SB_SEND_HK, sizeof(Housekeeping.Cmd), false); + /* For internal TransmitMsg call */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID); Size = sizeof(CFE_SB_Global.HKTlmMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - /* For HK command processing */ - MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SEND_HK_MID); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - CFE_SB_ProcessCmdPipePkt(&Housekeeping.SBBuf); CFE_UtAssert_EVENTCOUNT(1); @@ -1464,23 +1348,22 @@ void Test_SB_Cmds_SendPrevSubs(void) CFE_SB_Buffer_t SBBuf; CFE_SB_SendPrevSubsCmd_t Cmd; } SendPrevSubs; - CFE_SB_PipeId_t PipeId1; - CFE_SB_PipeId_t PipeId2; - CFE_SB_MsgId_t MsgId = SB_UT_BARE_TLM_MID3; - uint16 MsgLim = 4; - uint16 PipeDepth = 50; - int32 i; - int32 NumEvts; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_SEND_PREV_SUBS_CC; - CFE_SB_MsgId_t MsgIdCmd; - CFE_MSG_Size_t Size; + CFE_SB_PipeId_t PipeId1; + CFE_SB_PipeId_t PipeId2; + CFE_SB_MsgId_t MsgId = SB_UT_BARE_TLM_MID3; + uint16 MsgLim = 4; + uint16 PipeDepth = 50; + int32 i; + int32 NumEvts; + CFE_MSG_Size_t Size; + CFE_SB_MsgId_t MsgIdCmd; CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId1, PipeDepth, "TestPipe1")); CFE_UtAssert_SETUP(CFE_SB_CreatePipe(&PipeId2, PipeDepth, "TestPipe2")); NumEvts = 2; /* one for each pipe create */ /* Two full pkts to be sent plus five entries in a partial pkt, skipping MSGID 0x0D */ - for (i = 0; i < CFE_SB_SUB_ENTRIES_PER_PKT * 2 + 5; i++) + for (i = 1; i < (CFE_SB_SUB_ENTRIES_PER_PKT * 2) + 6; i++) { /* Skip subscribing to ALLSUBS mid. This is the one we are testing. * MsgID for this in CCSDS v.1 was 0x180d so this MID did not appear in the @@ -1488,7 +1371,7 @@ void Test_SB_Cmds_SendPrevSubs(void) * testing here so it is irrelevant * For CCSDS v.2 CFE_SB_ALLSUBS_TLM_MID (0x0d) now appears in the * SB subscription list and thus we must skip adding 0x0D to the list - * as we were going from MSGID 0-45 (0x00-0x2D) + * as we were going from MSGID 1-46 (0x01-0x2E) * */ if (i != CFE_SB_ALLSUBS_TLM_MID) { @@ -1499,6 +1382,9 @@ void Test_SB_Cmds_SendPrevSubs(void) CFE_UtAssert_SETUP(CFE_SB_SubscribeLocal(MsgId, PipeId2, MsgLim)); + /* Set up for dispatch FIRST */ + UT_SetupBasicMsgDispatch(&UT_TPID_CFE_SB_SUB_RPT_CTL_SEND_PREV_SUBS_CC, sizeof(SendPrevSubs.Cmd), false); + /* For 3 internal TransmitMsg calls */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID); Size = sizeof(CFE_SB_Global.PrevSubMsg); @@ -1509,13 +1395,6 @@ void Test_SB_Cmds_SendPrevSubs(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - /* Set buffers for gets */ - MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); - Size = sizeof(SendPrevSubs.Cmd); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&SendPrevSubs.SBBuf); NumEvts += 7; /* +1 for the subscribe, +6 for the SEND_PREV_SUBS_CC */ @@ -1533,7 +1412,7 @@ void Test_SB_Cmds_SendPrevSubs(void) /* Round out the number to three full pkts in order to test branch path * coverage, MSGID 0x0D was skipped in previous subscription loop */ - for (; i < CFE_SB_SUB_ENTRIES_PER_PKT * 3; i++) + for (; i < (CFE_SB_SUB_ENTRIES_PER_PKT * 3) + 1; i++) { CFE_UtAssert_SETUP(CFE_SB_Subscribe(CFE_SB_ValueToMsgId(i), PipeId1)); NumEvts += 1; @@ -1542,6 +1421,9 @@ void Test_SB_Cmds_SendPrevSubs(void) /* Additional unique local route to hit while loop destptr == NULL branch */ CFE_UtAssert_SETUP(CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(i), PipeId2, MsgLim)); + /* Set up for dispatch FIRST */ + UT_SetupBasicMsgDispatch(&UT_TPID_CFE_SB_SUB_RPT_CTL_SEND_PREV_SUBS_CC, sizeof(SendPrevSubs.Cmd), false); + /* For 3 internal TransmitMsg calls */ MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID); Size = sizeof(CFE_SB_Global.PrevSubMsg); @@ -1552,13 +1434,6 @@ void Test_SB_Cmds_SendPrevSubs(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - /* Set buffers for gets */ - MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); - Size = sizeof(SendPrevSubs.Cmd); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&SendPrevSubs.SBBuf); NumEvts += 7; /* +1 for the local subscribe, +6 for the SEND_PREV_SUBS_CC */ @@ -1580,13 +1455,9 @@ void Test_SB_Cmds_SendPrevSubs(void) /* Test error paths in the CFE_SB_SEND_PREV_SUBS_CC handling */ UT_ClearEventHistory(); - Size = sizeof(SendPrevSubs.Cmd) - 1; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&SendPrevSubs.SBBuf); + + /* Bad Size */ + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &SendPrevSubs.SBBuf.Msg, 0, UT_TPID_CFE_SB_SUB_RPT_CTL_SEND_PREV_SUBS_CC); CFE_UtAssert_EVENTSENT(CFE_SB_LEN_ERR_EID); @@ -1605,27 +1476,18 @@ void Test_SB_Cmds_SubRptOn(void) CFE_SB_Buffer_t SBBuf; CFE_SB_EnableSubReportingCmd_t Cmd; } EnableSubReporting; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_SUB_REPORTING_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); - CFE_MSG_Size_t Size = sizeof(EnableSubReporting.Cmd); - - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&EnableSubReporting.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &EnableSubReporting.SBBuf.Msg, sizeof(EnableSubReporting.Cmd), + UT_TPID_CFE_SB_SUB_RPT_CTL_ENABLE_SUB_REPORTING_CC); CFE_UtAssert_EVENTCOUNT(0); /* Test error paths in the CFE_SB_ENABLE_SUB_REPORTING_CC handling */ UT_ClearEventHistory(); - Size = sizeof(EnableSubReporting.Cmd) - 1; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&EnableSubReporting.SBBuf); + + /* Bad Size */ + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &EnableSubReporting.SBBuf.Msg, 0, + UT_TPID_CFE_SB_SUB_RPT_CTL_ENABLE_SUB_REPORTING_CC); CFE_UtAssert_EVENTSENT(CFE_SB_LEN_ERR_EID); @@ -1641,27 +1503,18 @@ void Test_SB_Cmds_SubRptOff(void) CFE_SB_Buffer_t SBBuf; CFE_SB_DisableSubReportingCmd_t Cmd; } DisableSubReporting; - CFE_MSG_FcnCode_t FcnCode = CFE_SB_DISABLE_SUB_REPORTING_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); - CFE_MSG_Size_t Size = sizeof(DisableSubReporting.Cmd); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - - CFE_SB_ProcessCmdPipePkt(&DisableSubReporting.SBBuf); + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &DisableSubReporting.SBBuf.Msg, sizeof(DisableSubReporting.Cmd), + UT_TPID_CFE_SB_SUB_RPT_CTL_DISABLE_SUB_REPORTING_CC); CFE_UtAssert_EVENTCOUNT(0); /* Test error paths in the CFE_SB_DISABLE_SUB_REPORTING_CC handling */ UT_ClearEventHistory(); - Size = sizeof(DisableSubReporting.Cmd) - 1; - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt(&DisableSubReporting.SBBuf); + + /* Bad Size */ + UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &DisableSubReporting.SBBuf.Msg, 0, + UT_TPID_CFE_SB_SUB_RPT_CTL_DISABLE_SUB_REPORTING_CC); CFE_UtAssert_EVENTSENT(CFE_SB_LEN_ERR_EID); @@ -1672,20 +1525,12 @@ void Test_SB_Cmds_SubRptOff(void) */ void Test_SB_Cmds_CmdUnexpCmdCode(void) { - CFE_MSG_FcnCode_t FcnCode = 99; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - - /* Use a command code known to be invalid */ + UT_SetupBasicMsgDispatch(&UT_TPID_CFE_SB_CMD_BAD_FCNCODE, sizeof(CFE_MSG_CommandHeader_t), true); CFE_SB_ProcessCmdPipePkt((CFE_SB_Buffer_t *)NULL); CFE_UtAssert_EVENTCOUNT(1); CFE_UtAssert_EVENTSENT(CFE_SB_BAD_CMD_CODE_EID); - MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_SUB_RPT_CTRL_MID); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); + UT_SetupBasicMsgDispatch(&UT_TPID_CFE_SB_SUB_RPT_CTRL_BAD_FCNCODE, sizeof(CFE_MSG_CommandHeader_t), true); CFE_SB_ProcessCmdPipePkt((CFE_SB_Buffer_t *)NULL); } /* end Test_SB_Cmds_UnexpCmdCode */ @@ -1698,18 +1543,14 @@ void Test_SB_Cmds_BadCmdLength(void) /* * Just choosing "EnableRoute" command here as it has a non-empty payload */ - CFE_MSG_FcnCode_t FcnCode = CFE_SB_ENABLE_ROUTE_CC; - CFE_SB_MsgId_t MsgIdCmd = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); - CFE_MSG_Size_t Size = sizeof(CFE_SB_EnableRouteCmd_t) - 1; - - /* Second GetMsgId and GetFcnCode are for reporting */ - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode, sizeof(FcnCode), false); - CFE_SB_ProcessCmdPipePkt((CFE_SB_Buffer_t *)NULL); + /* + * Note the length validation failure paths have already been checked + * in the other command processor tests. The only thing unique about + * this dedicated test is that it does so with a non-zero size + */ + UT_SetupBasicMsgDispatch(&UT_TPID_CFE_SB_CMD_ENABLE_ROUTE_CC, sizeof(CFE_SB_EnableRouteCmd_t) - 1, true); + CFE_SB_ProcessCmdPipePkt(NULL); CFE_UtAssert_EVENTCOUNT(1); @@ -1722,11 +1563,8 @@ void Test_SB_Cmds_BadCmdLength(void) */ void Test_SB_Cmds_UnexpMsgId(void) { - CFE_SB_MsgId_t MsgIdCmd = SB_UT_TLM_MID; - - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgIdCmd, sizeof(MsgIdCmd), false); - - CFE_SB_ProcessCmdPipePkt((CFE_SB_Buffer_t *)NULL); + UT_SetupBasicMsgDispatch(&UT_TPID_CFE_SB_BAD_MSGID, sizeof(CFE_MSG_CommandHeader_t), true); + CFE_SB_ProcessCmdPipePkt(NULL); CFE_UtAssert_EVENTCOUNT(1); @@ -2571,18 +2409,18 @@ void Test_Subscribe_MaxMsgIdCount(void) { if (i < CFE_PLATFORM_SB_MAX_MSG_IDS) { - CFE_UtAssert_SETUP(CFE_SB_Subscribe(CFE_SB_ValueToMsgId(i), PipeId2)); + CFE_UtAssert_SETUP(CFE_SB_Subscribe(CFE_SB_ValueToMsgId(1 + i), PipeId2)); } else { - UtAssert_INT32_EQ(CFE_SB_Subscribe(CFE_SB_ValueToMsgId(i), PipeId2), CFE_SB_MAX_MSGS_MET); + UtAssert_INT32_EQ(CFE_SB_Subscribe(CFE_SB_ValueToMsgId(1 + i), PipeId2), CFE_SB_MAX_MSGS_MET); } } UtAssert_UINT32_EQ(CFE_SB_Global.StatTlmMsg.Payload.PeakMsgIdsInUse, CFE_PLATFORM_SB_MAX_MSG_IDS); CFE_UtAssert_EVENTSENT(CFE_SB_MAX_MSGS_MET_EID); - CFE_UtAssert_SUCCESS(CFE_SB_Subscribe(CFE_SB_ValueToMsgId(0), PipeId1)); + CFE_UtAssert_SUCCESS(CFE_SB_Subscribe(CFE_SB_ValueToMsgId(1), PipeId1)); UtAssert_UINT32_EQ(CFE_SB_Global.StatTlmMsg.Payload.PeakMsgIdsInUse, CFE_PLATFORM_SB_MAX_MSG_IDS); CFE_UtAssert_TEARDOWN(CFE_SB_DeletePipe(PipeId0)); @@ -3098,7 +2936,7 @@ void Test_TransmitMsg_NoSubscribers(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); CFE_UtAssert_EVENTCOUNT(1); @@ -3119,7 +2957,7 @@ void Test_TransmitMsg_MaxMsgSizePlusOne(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter = 0; - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true), CFE_SB_MSG_TOO_BIG); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true), CFE_SB_MSG_TOO_BIG); CFE_UtAssert_EVENTCOUNT(1); @@ -3146,7 +2984,7 @@ void Test_TransmitMsg_BasicSend(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); CFE_UtAssert_EVENTCOUNT(2); @@ -3192,7 +3030,7 @@ void Test_TransmitMsg_SequenceCount(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - CFE_UtAssert_SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SETUP(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); UtAssert_STUB_COUNT(CFE_MSG_SetSequenceCount, 1); UtAssert_STUB_COUNT(CFE_MSG_GetNextSequenceCount, 1); UtAssert_INT32_EQ(SeqCnt, SeqCntExpected); @@ -3200,7 +3038,7 @@ void Test_TransmitMsg_SequenceCount(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, false)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), false)); /* Assert sequence count wasn't set */ UtAssert_STUB_COUNT(CFE_MSG_GetNextSequenceCount, 1); @@ -3211,7 +3049,7 @@ void Test_TransmitMsg_SequenceCount(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); UtAssert_INT32_EQ(SeqCnt, SeqCntExpected); UtAssert_STUB_COUNT(CFE_MSG_SetSequenceCount, 2); UtAssert_STUB_COUNT(CFE_MSG_GetNextSequenceCount, 2); @@ -3226,7 +3064,7 @@ void Test_TransmitMsg_SequenceCount(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - CFE_UtAssert_SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); /* increment to 3 */ + CFE_UtAssert_SETUP(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); /* increment to 3 */ UtAssert_STUB_COUNT(CFE_MSG_SetSequenceCount, 3); UtAssert_STUB_COUNT(CFE_MSG_GetNextSequenceCount, 3); @@ -3237,7 +3075,7 @@ void Test_TransmitMsg_SequenceCount(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - CFE_UtAssert_SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); /* increment to 4 */ + CFE_UtAssert_SETUP(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); /* increment to 4 */ UtAssert_INT32_EQ(SeqCnt, SeqCntExpected); UtAssert_STUB_COUNT(CFE_MSG_SetSequenceCount, 4); UtAssert_STUB_COUNT(CFE_MSG_GetNextSequenceCount, 4); @@ -3265,7 +3103,7 @@ void Test_TransmitMsg_QueuePutError(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); CFE_UtAssert_EVENTCOUNT(4); @@ -3294,7 +3132,7 @@ void Test_TransmitMsg_PipeFull(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); /* This send should pass */ - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); /* Tell the QueuePut stub to return OS_QUEUE_FULL on its next call */ UT_SetDeferredRetcode(UT_KEY(OS_QueuePut), 1, OS_QUEUE_FULL); @@ -3304,7 +3142,7 @@ void Test_TransmitMsg_PipeFull(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); /* Pipe overflow causes TransmitMsg to return CFE_SUCCESS */ - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); CFE_UtAssert_EVENTCOUNT(4); @@ -3336,7 +3174,7 @@ void Test_TransmitMsg_MsgLimitExceeded(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); /* First send should pass */ - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -3345,7 +3183,7 @@ void Test_TransmitMsg_MsgLimitExceeded(void) /* This send should produce a MsgId to Pipe Limit Exceeded message, but * return success */ - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); CFE_UtAssert_EVENTCOUNT(4); @@ -3376,7 +3214,7 @@ void Test_TransmitMsg_GetPoolBufErr(void) * allocation failed) */ UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_MEM_BLOCK_SIZE); - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true), CFE_SB_BUF_ALOC_ERR); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true), CFE_SB_BUF_ALOC_ERR); CFE_UtAssert_EVENTCOUNT(3); CFE_UtAssert_EVENTSENT(CFE_SB_GET_BUF_ERR_EID); @@ -3386,7 +3224,7 @@ void Test_TransmitMsg_GetPoolBufErr(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_MEM_BLOCK_SIZE); UT_SetDeferredRetcode(UT_KEY(CFE_ES_TaskID_ToIndex), 1, -1); - UtAssert_INT32_EQ(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true), CFE_SB_BUF_ALOC_ERR); + UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true), CFE_SB_BUF_ALOC_ERR); /* Confirm no additional events sent */ CFE_UtAssert_EVENTCOUNT(3); @@ -3648,7 +3486,7 @@ void Test_TransmitMsg_DisabledDestination(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); CFE_UtAssert_EVENTCOUNT(2); @@ -3707,7 +3545,7 @@ void Test_TransmitMsgValidate_MaxMsgSizePlusOne(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - UtAssert_INT32_EQ(CFE_SB_TransmitMsgValidate(&TlmPkt.Hdr.Msg, &MsgIdRtn, &SizeRtn, &RouteIdRtn), + UtAssert_INT32_EQ(CFE_SB_TransmitMsgValidate(CFE_MSG_PTR(TlmPkt.TelemetryHeader), &MsgIdRtn, &SizeRtn, &RouteIdRtn), CFE_SB_MSG_TOO_BIG); CFE_UtAssert_MSGID_EQ(MsgIdRtn, MsgId); UtAssert_INT32_EQ(SizeRtn, Size); @@ -3732,7 +3570,8 @@ void Test_TransmitMsgValidate_NoSubscribers(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsgValidate(&TlmPkt.Hdr.Msg, &MsgIdRtn, &SizeRtn, &RouteIdRtn)); + CFE_UtAssert_SUCCESS( + CFE_SB_TransmitMsgValidate(CFE_MSG_PTR(TlmPkt.TelemetryHeader), &MsgIdRtn, &SizeRtn, &RouteIdRtn)); CFE_UtAssert_MSGID_EQ(MsgIdRtn, MsgId); UtAssert_INT32_EQ(SizeRtn, Size); UtAssert_BOOL_FALSE(CFE_SBR_IsValidRouteId(RouteIdRtn)); @@ -3755,7 +3594,7 @@ void Test_TransmitMsgValidate_InvalidMsgId(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UtAssert_INT32_EQ(CFE_SB_TransmitMsgValidate(&TlmPkt.Hdr.Msg, &MsgIdRtn, &SizeRtn, &RouteIdRtn), + UtAssert_INT32_EQ(CFE_SB_TransmitMsgValidate(CFE_MSG_PTR(TlmPkt.TelemetryHeader), &MsgIdRtn, &SizeRtn, &RouteIdRtn), CFE_SB_BAD_ARGUMENT); CFE_UtAssert_EVENTCOUNT(1); CFE_UtAssert_EVENTSENT(CFE_SB_SEND_INV_MSGID_EID); @@ -3970,7 +3809,7 @@ void Test_ReceiveBuffer_PendForever(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId)); - CFE_UtAssert_SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SETUP(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); CFE_UtAssert_SUCCESS(CFE_SB_ReceiveBuffer(&SBBufPtr, PipeId, CFE_SB_PEND_FOREVER)); @@ -4141,42 +3980,42 @@ void Test_CFE_SB_GetUserData(void) CFE_MSG_Type_t type = CFE_MSG_Type_Invalid; struct { - CFE_MSG_CommandHeader_t cmd; + CFE_MSG_CommandHeader_t CommandHeader; uint8 payload; } cmd_uint8; struct { - CFE_MSG_CommandHeader_t cmd; + CFE_MSG_CommandHeader_t CommandHeader; uint16 payload; } cmd_uint16; struct { - CFE_MSG_CommandHeader_t cmd; + CFE_MSG_CommandHeader_t CommandHeader; uint32 payload; } cmd_uint32; struct { - CFE_MSG_CommandHeader_t cmd; + CFE_MSG_CommandHeader_t CommandHeader; uint64 payload; } cmd_uint64; struct { - CFE_MSG_TelemetryHeader_t tlm; + CFE_MSG_TelemetryHeader_t TelemetryHeader; uint8 payload; } tlm_uint8; struct { - CFE_MSG_TelemetryHeader_t tlm; + CFE_MSG_TelemetryHeader_t TelemetryHeader; uint16 payload; } tlm_uint16; struct { - CFE_MSG_TelemetryHeader_t tlm; + CFE_MSG_TelemetryHeader_t TelemetryHeader; uint32 payload; } tlm_uint32; struct { - CFE_MSG_TelemetryHeader_t tlm; + CFE_MSG_TelemetryHeader_t TelemetryHeader; uint64 payload; } tlm_uint64; @@ -4186,7 +4025,7 @@ void Test_CFE_SB_GetUserData(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); /* Expected return */ - expected = (uint8 *)&msg + sizeof(CCSDS_SpacePacket_t); + expected = (uint8 *)&msg + sizeof(CFE_MSG_Message_t); UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(&msg), expected); /* Commands */ @@ -4194,31 +4033,31 @@ void Test_CFE_SB_GetUserData(void) type = CFE_MSG_Type_Cmd; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(&cmd_uint8.cmd.Msg), &(cmd_uint8.payload)); + UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(CFE_MSG_PTR(cmd_uint8.CommandHeader)), &(cmd_uint8.payload)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(&cmd_uint16.cmd.Msg), &(cmd_uint16.payload)); + UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(CFE_MSG_PTR(cmd_uint16.CommandHeader)), &(cmd_uint16.payload)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(&cmd_uint32.cmd.Msg), &(cmd_uint32.payload)); + UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(CFE_MSG_PTR(cmd_uint32.CommandHeader)), &(cmd_uint32.payload)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(&cmd_uint64.cmd.Msg), &(cmd_uint64.payload)); + UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(CFE_MSG_PTR(cmd_uint64.CommandHeader)), &(cmd_uint64.payload)); /* Telemetry */ type = CFE_MSG_Type_Tlm; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(&tlm_uint8.tlm.Msg), &(tlm_uint8.payload)); + UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(CFE_MSG_PTR(tlm_uint8.TelemetryHeader)), &(tlm_uint8.payload)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(&tlm_uint16.tlm.Msg), &(tlm_uint16.payload)); + UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(CFE_MSG_PTR(tlm_uint16.TelemetryHeader)), &(tlm_uint16.payload)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(&tlm_uint32.tlm.Msg), &(tlm_uint32.payload)); + UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(CFE_MSG_PTR(tlm_uint32.TelemetryHeader)), &(tlm_uint32.payload)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); - UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(&tlm_uint64.tlm.Msg), &(tlm_uint64.payload)); + UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(CFE_MSG_PTR(tlm_uint64.TelemetryHeader)), &(tlm_uint64.payload)); /* Bad inputs */ UtAssert_NULL(CFE_SB_GetUserData(NULL)); @@ -4239,7 +4078,7 @@ void Test_CFE_SB_SetGetUserDataLength(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetHasSecondaryHeader), &hassec, sizeof(hassec), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &type, sizeof(type), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &size, sizeof(size), false); - UtAssert_INT32_EQ(CFE_SB_GetUserDataLength(&msg), size - sizeof(CCSDS_SpacePacket_t)); + UtAssert_INT32_EQ(CFE_SB_GetUserDataLength(&msg), size - sizeof(CFE_MSG_Message_t)); /* * Note, this function currently has a type mismatch - it attempts to @@ -4512,16 +4351,15 @@ void Test_SB_TransmitMsgPaths_Nominal(void) CFE_MSG_Size_t Size; CFE_MSG_Type_t Type; + /* Set up for dispatch FIRST */ + UT_SetupBasicMsgDispatch(&UT_TPID_CFE_SB_SEND_HK, sizeof(Housekeeping.Cmd), false); + /* For internal send message call */ MsgId = CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID); Size = sizeof(CFE_SB_Global.HKTlmMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - /* For HK command processing */ - MsgId = CFE_SB_ValueToMsgId(CFE_SB_SEND_HK_MID); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - /* Repress sending the no subscriptions event and process request */ CFE_SB_Global.HKTlmMsg.Payload.NoSubscribersCounter = 0; CFE_SB_Global.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_SEND_NO_SUBS_EID_BIT); @@ -4535,16 +4373,15 @@ void Test_SB_TransmitMsgPaths_Nominal(void) CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter = 0; CFE_SB_Global.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_GET_BUF_ERR_EID_BIT); + /* Set up for dispatch FIRST */ + UT_SetupBasicMsgDispatch(&UT_TPID_CFE_SB_SEND_HK, sizeof(Housekeeping.Cmd), false); + /* For internal send message call */ MsgId = CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID); Size = sizeof(CFE_SB_Global.HKTlmMsg); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); - /* For HK command processing */ - MsgId = CFE_SB_ValueToMsgId(CFE_SB_SEND_HK_MID); - UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); - UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetPoolBuf), 1, CFE_ES_ERR_MEM_BLOCK_SIZE); CFE_SB_ProcessCmdPipePkt(&Housekeeping.SBBuf); UtAssert_INT32_EQ(CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter, 0); @@ -4568,10 +4405,41 @@ void Test_SB_TransmitMsgPaths_Nominal(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); CFE_UtAssert_EVENTCOUNT(3); + /* + * Test Additional paths within CFE_SB_TransmitMsgValidate that skip sending events to avoid a loop + * For all of these they should skip sending the event but still increment the MsgSendErrorCounter + */ + + /* CFE_SB_MSG_TOO_BIG_EID loop filter */ + CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter = 0; + Size = CFE_MISSION_SB_MAX_SB_MSG_SIZE + 1; + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); + CFE_SB_Global.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_MSG_TOO_BIG_EID_BIT); + CFE_SB_TransmitMsg(&Housekeeping.SBBuf.Msg, true); + CFE_UtAssert_EVENTNOTSENT(CFE_SB_MSG_TOO_BIG_EID); + UtAssert_UINT32_EQ(CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter, 1); + + /* CFE_SB_SEND_INV_MSGID_EID loop filter */ + CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter = 0; + MsgId = CFE_SB_INVALID_MSG_ID; + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); + CFE_SB_Global.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_SEND_INV_MSGID_EID_BIT); + CFE_SB_TransmitMsg(&Housekeeping.SBBuf.Msg, true); + CFE_UtAssert_EVENTNOTSENT(CFE_SB_SEND_INV_MSGID_EID); + UtAssert_UINT32_EQ(CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter, 1); + + /* CFE_SB_SEND_BAD_ARG_EID loop filter */ + CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter = 0; + CFE_SB_Global.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_SEND_BAD_ARG_EID_BIT); + CFE_SB_TransmitMsg(NULL, true); + CFE_UtAssert_EVENTNOTSENT(CFE_SB_SEND_BAD_ARG_EID); + UtAssert_UINT32_EQ(CFE_SB_Global.HKTlmMsg.Payload.MsgSendErrorCounter, 1); + CFE_UtAssert_TEARDOWN(CFE_SB_DeletePipe(PipeId)); } /* end Test_SB_TransmitMsgPaths */ @@ -4596,14 +4464,14 @@ void Test_SB_TransmitMsgPaths_LimitErr(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); /* First send should pass */ - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); CFE_SB_Global.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_MSGID_LIM_ERR_EID_BIT); - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); CFE_SB_Global.StopRecurseFlags[1] = 0; CFE_UtAssert_EVENTNOTSENT(CFE_SB_MSGID_LIM_ERR_EID); @@ -4631,7 +4499,7 @@ void Test_SB_TransmitMsgPaths_FullErr(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); /* This send should pass */ - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); @@ -4640,7 +4508,7 @@ void Test_SB_TransmitMsgPaths_FullErr(void) /* Tell the QueuePut stub to return OS_QUEUE_FULL on its next call */ UT_SetDeferredRetcode(UT_KEY(OS_QueuePut), 1, OS_QUEUE_FULL); CFE_SB_Global.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_Q_FULL_ERR_EID_BIT); - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); CFE_SB_Global.StopRecurseFlags[1] = 0; CFE_UtAssert_EVENTNOTSENT(CFE_SB_Q_FULL_ERR_EID_BIT); @@ -4670,14 +4538,14 @@ void Test_SB_TransmitMsgPaths_WriteErr(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); CFE_SB_Global.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_Q_WR_ERR_EID_BIT); - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); CFE_SB_Global.StopRecurseFlags[1] = 0; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); CFE_UtAssert_EVENTCOUNT(2); @@ -4709,7 +4577,7 @@ void Test_SB_TransmitMsgPaths_IgnoreOpt(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); /* Test skipping this pipe and the send should pass */ - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); UtAssert_STUB_COUNT(OS_QueuePut, 0); /* Set up and send again without matching ApId and it should transmit */ @@ -4722,7 +4590,7 @@ void Test_SB_TransmitMsgPaths_IgnoreOpt(void) /* Also hit case where not the peak depth */ PipeDscPtr->PeakQueueDepth += 2; - CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); UtAssert_STUB_COUNT(OS_QueuePut, 1); /* Set AppId back so it can be deleted */ @@ -4752,7 +4620,7 @@ void Test_ReceiveBuffer_UnsubResubPath(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &Type, sizeof(Type), false); - CFE_UtAssert_SETUP(CFE_SB_TransmitMsg(&TlmPkt.Hdr.Msg, true)); + CFE_UtAssert_SETUP(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true)); CFE_UtAssert_SETUP(CFE_SB_Unsubscribe(MsgId, PipeId)); CFE_UtAssert_SETUP(CFE_SB_Subscribe(MsgId, PipeId)); diff --git a/modules/sb/ut-coverage/sb_UT.h b/modules/sb/ut-coverage/sb_UT.h index 01529e0b1..a6a2b9767 100644 --- a/modules/sb/ut-coverage/sb_UT.h +++ b/modules/sb/ut-coverage/sb_UT.h @@ -49,7 +49,7 @@ */ typedef struct { - CFE_MSG_CommandHeader_t Hdr; + CFE_MSG_CommandHeader_t CommandHeader; uint32 Cmd32Param1; uint16 Cmd16Param1; uint16 Cmd16Param2; @@ -61,7 +61,7 @@ typedef struct typedef struct { - CFE_MSG_TelemetryHeader_t Hdr; + CFE_MSG_TelemetryHeader_t TelemetryHeader; uint32 Tlm32Param1; uint16 Tlm16Param1; uint16 Tlm16Param2; @@ -73,7 +73,7 @@ typedef struct typedef struct { - CFE_MSG_Message_t Pri; + CFE_MSG_Message_t Message; uint8 Tlm8Param1; uint8 Tlm8Param2; uint32 Tlm32Param1; diff --git a/modules/tbl/fsw/inc/cfe_tbl_msg.h b/modules/tbl/fsw/inc/cfe_tbl_msg.h index 7ea480fb5..3350d7505 100644 --- a/modules/tbl/fsw/inc/cfe_tbl_msg.h +++ b/modules/tbl/fsw/inc/cfe_tbl_msg.h @@ -491,7 +491,7 @@ */ typedef struct CFE_TBL_NoArgsCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ } CFE_TBL_NoArgsCmd_t; /* @@ -518,8 +518,8 @@ typedef struct CFE_TBL_LoadCmd_Payload */ typedef struct CFE_TBL_LoadCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TBL_LoadCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TBL_LoadCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TBL_LoadCmd_t; /** @@ -548,8 +548,8 @@ typedef struct CFE_TBL_DumpCmd_Payload */ typedef struct CFE_TBL_DumpCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TBL_DumpCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TBL_DumpCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TBL_DumpCmd_t; /** @@ -575,8 +575,8 @@ typedef struct CFE_TBL_ValidateCmd_Payload */ typedef struct CFE_TBL_ValidateCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TBL_ValidateCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TBL_ValidateCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TBL_ValidateCmd_t; /** @@ -596,8 +596,8 @@ typedef struct CFE_TBL_ActivateCmd_Payload */ typedef struct CFE_TBL_ActivateCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TBL_ActivateCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TBL_ActivateCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TBL_ActivateCmd_t; /** @@ -618,8 +618,8 @@ typedef struct CFE_TBL_DumpRegistryCmd_Payload */ typedef struct CFE_TBL_DumpRegistryCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TBL_DumpRegistryCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TBL_DumpRegistryCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TBL_DumpRegistryCmd_t; /** @@ -641,8 +641,8 @@ typedef struct CFE_TBL_SendRegistryCmd_Payload */ typedef struct CFE_TBL_SendRegistryCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TBL_SendRegistryCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TBL_SendRegistryCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TBL_SendRegistryCmd_t; /** @@ -664,8 +664,8 @@ typedef struct CFE_TBL_DelCDSCmd_Payload */ typedef struct CFE_TBL_DeleteCDSCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TBL_DelCDSCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TBL_DelCDSCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TBL_DeleteCDSCmd_t; /** @@ -685,8 +685,8 @@ typedef struct CFE_TBL_AbortLoadCmd_Payload */ typedef struct CFE_TBL_AbortLoadCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TBL_AbortLoadCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TBL_AbortLoadCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TBL_AbortLoadCmd_t; /*************************************************************************/ @@ -712,8 +712,8 @@ typedef struct CFE_TBL_NotifyCmd_Payload */ typedef struct CFE_TBL_NotifyCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TBL_NotifyCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TBL_NotifyCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TBL_NotifyCmd_t; /*************************************************************************/ @@ -784,8 +784,8 @@ typedef struct CFE_TBL_HousekeepingTlm_Payload typedef struct CFE_TBL_HousekeepingTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_TBL_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_TBL_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_TBL_HousekeepingTlm_t; /** @@ -831,8 +831,8 @@ typedef struct CFE_TBL_TblRegPacket_Payload typedef struct CFE_TBL_TableRegistryTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_TBL_TblRegPacket_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_TBL_TblRegPacket_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_TBL_TableRegistryTlm_t; #endif /* CFE_TBL_MSG_H */ diff --git a/modules/tbl/fsw/src/cfe_tbl_internal.c b/modules/tbl/fsw/src/cfe_tbl_internal.c index 63b85f3aa..230f71ade 100644 --- a/modules/tbl/fsw/src/cfe_tbl_internal.c +++ b/modules/tbl/fsw/src/cfe_tbl_internal.c @@ -1423,16 +1423,16 @@ int32 CFE_TBL_SendNotificationMsg(CFE_TBL_RegistryRec_t *RegRecPtr) if (RegRecPtr->NotifyByMsg) { /* Set the message ID */ - CFE_MSG_SetMsgId(&CFE_TBL_Global.NotifyMsg.CmdHeader.Msg, RegRecPtr->NotificationMsgId); + CFE_MSG_SetMsgId(CFE_MSG_PTR(CFE_TBL_Global.NotifyMsg.CommandHeader), RegRecPtr->NotificationMsgId); /* Set the command code */ - CFE_MSG_SetFcnCode(&CFE_TBL_Global.NotifyMsg.CmdHeader.Msg, RegRecPtr->NotificationCC); + CFE_MSG_SetFcnCode(CFE_MSG_PTR(CFE_TBL_Global.NotifyMsg.CommandHeader), RegRecPtr->NotificationCC); /* Set the command parameter */ CFE_TBL_Global.NotifyMsg.Payload.Parameter = RegRecPtr->NotificationParam; - CFE_SB_TimeStampMsg(&CFE_TBL_Global.NotifyMsg.CmdHeader.Msg); - Status = CFE_SB_TransmitMsg(&CFE_TBL_Global.NotifyMsg.CmdHeader.Msg, false); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(CFE_TBL_Global.NotifyMsg.CommandHeader)); + Status = CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_TBL_Global.NotifyMsg.CommandHeader), false); if (Status != CFE_SUCCESS) { diff --git a/modules/tbl/fsw/src/cfe_tbl_internal.h b/modules/tbl/fsw/src/cfe_tbl_internal.h index 545599bfb..d9d84cec7 100644 --- a/modules/tbl/fsw/src/cfe_tbl_internal.h +++ b/modules/tbl/fsw/src/cfe_tbl_internal.h @@ -550,7 +550,7 @@ int32 CFE_TBL_SendNotificationMsg(CFE_TBL_RegistryRec_t *RegRecPtr); ** \param[in, out] Uint32ToSwapPtr Pointer to uint32 value to be swapped. *Uint32ToSwapPtr is the swapped uint32 value ** */ -extern void CFE_TBL_ByteSwapUint32(uint32 *Uint32ToSwapPtr); +void CFE_TBL_ByteSwapUint32(uint32 *Uint32ToSwapPtr); /* * Internal helper functions for Table Registry dump diff --git a/modules/tbl/fsw/src/cfe_tbl_task.c b/modules/tbl/fsw/src/cfe_tbl_task.c index dc941abc5..86ee8ea82 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task.c +++ b/modules/tbl/fsw/src/cfe_tbl_task.c @@ -238,14 +238,15 @@ void CFE_TBL_InitData(void) CFE_ES_GetAppID(&CFE_TBL_Global.TableTaskAppId); /* Initialize Packet Headers */ - CFE_MSG_Init(&CFE_TBL_Global.HkPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID), + CFE_MSG_Init(CFE_MSG_PTR(CFE_TBL_Global.HkPacket.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID), sizeof(CFE_TBL_Global.HkPacket)); - CFE_MSG_Init(&CFE_TBL_Global.TblRegPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID), + CFE_MSG_Init(CFE_MSG_PTR(CFE_TBL_Global.TblRegPacket.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID), sizeof(CFE_TBL_Global.TblRegPacket)); /* Message ID is set when sent, so OK as 0 here */ - CFE_MSG_Init(&CFE_TBL_Global.NotifyMsg.CmdHeader.Msg, CFE_SB_ValueToMsgId(0), sizeof(CFE_TBL_Global.NotifyMsg)); + CFE_MSG_Init(CFE_MSG_PTR(CFE_TBL_Global.NotifyMsg.CommandHeader), CFE_SB_ValueToMsgId(0), + sizeof(CFE_TBL_Global.NotifyMsg)); } /*---------------------------------------------------------------- diff --git a/modules/tbl/fsw/src/cfe_tbl_task.h b/modules/tbl/fsw/src/cfe_tbl_task.h index fde831dab..ed0fb49ea 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task.h +++ b/modules/tbl/fsw/src/cfe_tbl_task.h @@ -370,7 +370,7 @@ typedef struct ** \retval #CFE_TBL_BAD_MSG_ID \copydoc CFE_TBL_BAD_MSG_ID ** */ -extern int16 CFE_TBL_SearchCmdHndlrTbl(CFE_SB_MsgId_t MessageID, uint16 CommandCode); +int16 CFE_TBL_SearchCmdHndlrTbl(CFE_SB_MsgId_t MessageID, uint16 CommandCode); /*---------------------------------------------------------------------------------------*/ /** diff --git a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c index 8cf5195d3..0d7745a03 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c +++ b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c @@ -62,8 +62,8 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) /* ** Send housekeeping telemetry packet */ - CFE_SB_TimeStampMsg(&CFE_TBL_Global.HkPacket.TlmHeader.Msg); - Status = CFE_SB_TransmitMsg(&CFE_TBL_Global.HkPacket.TlmHeader.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(CFE_TBL_Global.HkPacket.TelemetryHeader)); + Status = CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_TBL_Global.HkPacket.TelemetryHeader), true); if (Status != CFE_SUCCESS) { @@ -79,8 +79,8 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) /* ** Send Table Registry Info Packet */ - CFE_SB_TimeStampMsg(&CFE_TBL_Global.TblRegPacket.TlmHeader.Msg); - CFE_SB_TransmitMsg(&CFE_TBL_Global.TblRegPacket.TlmHeader.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(CFE_TBL_Global.TblRegPacket.TelemetryHeader)); + CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_TBL_Global.TblRegPacket.TelemetryHeader), true); /* Once the data has been sent, clear the index so that we don't send it again and again */ CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND; diff --git a/modules/tbl/fsw/src/cfe_tbl_task_cmds.h b/modules/tbl/fsw/src/cfe_tbl_task_cmds.h index 959a54777..c8b2c8594 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task_cmds.h +++ b/modules/tbl/fsw/src/cfe_tbl_task_cmds.h @@ -101,7 +101,7 @@ typedef struct ** None ** */ -extern void CFE_TBL_GetHkData(void); +void CFE_TBL_GetHkData(void); /*---------------------------------------------------------------------------------------*/ /** @@ -117,7 +117,7 @@ extern void CFE_TBL_GetHkData(void); ** the Table Registry. ** */ -extern void CFE_TBL_GetTblRegData(void); +void CFE_TBL_GetTblRegData(void); /*---------------------------------------------------------------------------------------*/ /** @@ -336,8 +336,8 @@ int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoadCmd_t *data); ** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR ** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR */ -extern CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile(const char *DumpFilename, const char *TableName, - const void *DumpDataAddr, size_t TblSizeInBytes); +CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile(const char *DumpFilename, const char *TableName, const void *DumpDataAddr, + size_t TblSizeInBytes); /*---------------------------------------------------------------------------------------*/ /** diff --git a/modules/tbl/ut-coverage/tbl_UT.c b/modules/tbl/ut-coverage/tbl_UT.c index ef73dfd08..8371f5bb5 100644 --- a/modules/tbl/ut-coverage/tbl_UT.c +++ b/modules/tbl/ut-coverage/tbl_UT.c @@ -229,8 +229,8 @@ void Test_CFE_TBL_TaskInit(void) uint32 ExitCode; union { - CFE_TBL_NoArgsCmd_t NoArgsCmd; - CFE_MSG_Message_t Msg; + CFE_MSG_CommandHeader_t NoArgsCmd; + CFE_MSG_Message_t Msg; } CmdBuf; CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t FcnCode = 0; @@ -2045,7 +2045,7 @@ void Test_CFE_TBL_Load(void) UT_Table1_t TestTable1; CFE_FS_Header_t StdFileHeader; CFE_TBL_File_Hdr_t TblFileHeader; - UT_Table1_t * App2TblPtr; + void * App2TblPtr; CFE_TBL_RegistryRec_t * RegRecPtr; CFE_TBL_AccessDescriptor_t *AccessDescPtr; @@ -2236,7 +2236,7 @@ void Test_CFE_TBL_Load(void) CFE_UtAssert_EVENTCOUNT(0); /* a. Test setup part 2 */ - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&App2TblPtr, App2TblHandle1), CFE_TBL_INFO_UPDATED); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&App2TblPtr, App2TblHandle1), CFE_TBL_INFO_UPDATED); CFE_UtAssert_EVENTCOUNT(0); /* c. Perform test */ @@ -2258,8 +2258,8 @@ void Test_CFE_TBL_Load(void) */ void Test_CFE_TBL_GetAddress(void) { - UT_Table1_t *App3TblPtr; - UT_Table1_t *App2TblPtr; + void *App3TblPtr; + void *App2TblPtr; UtPrintf("Begin Test Get Address"); @@ -2272,19 +2272,18 @@ void Test_CFE_TBL_GetAddress(void) */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_3); - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&App3TblPtr, App2TblHandle1), CFE_TBL_ERR_NO_ACCESS); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&App3TblPtr, App2TblHandle1), CFE_TBL_ERR_NO_ACCESS); CFE_UtAssert_EVENTCOUNT(0); /* Test attempt to get the address with an invalid application ID */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&App3TblPtr, App2TblHandle1), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&App3TblPtr, App2TblHandle1), CFE_ES_ERR_RESOURCEID_NOT_VALID); CFE_UtAssert_EVENTCOUNT(0); /* Test attempt to get the address with an invalid handle */ UT_InitData(); - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&App3TblPtr, CFE_PLATFORM_TBL_MAX_NUM_HANDLES), - CFE_TBL_ERR_INVALID_HANDLE); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&App3TblPtr, CFE_PLATFORM_TBL_MAX_NUM_HANDLES), CFE_TBL_ERR_INVALID_HANDLE); CFE_UtAssert_EVENTCOUNT(0); /* Attempt to get the address of an unregistered (unowned) table */ @@ -2297,7 +2296,7 @@ void Test_CFE_TBL_GetAddress(void) /* b. Perform test */ UT_InitData(); UT_SetAppID(UT_TBL_APPID_2); - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&App2TblPtr, App2TblHandle1), CFE_TBL_ERR_UNREGISTERED); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&App2TblPtr, App2TblHandle1), CFE_TBL_ERR_UNREGISTERED); CFE_UtAssert_EVENTCOUNT(0); } @@ -2528,7 +2527,7 @@ void Test_CFE_TBL_Manage(void) CFE_TBL_RegistryRec_t * RegRecPtr; CFE_TBL_LoadBuff_t * WorkingBufferPtr; UT_Table1_t TestTable1; - UT_Table1_t * App2TblPtr; + void * App2TblPtr; CFE_TBL_AccessDescriptor_t *AccessDescPtr; CFE_TBL_Handle_t AccessIterator; @@ -2712,7 +2711,7 @@ void Test_CFE_TBL_Manage(void) CFE_UtAssert_EVENTCOUNT(0); /* a. Test setup - part 2 */ - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&App2TblPtr, App2TblHandle1), CFE_TBL_ERR_NEVER_LOADED); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&App2TblPtr, App2TblHandle1), CFE_TBL_ERR_NEVER_LOADED); CFE_UtAssert_EVENTCOUNT(0); /* c. Perform test */ @@ -3025,6 +3024,7 @@ void Test_CFE_TBL_TblMod(void) UT_TempFile_t File; uint32 Index; CFE_TBL_Info_t TblInfo1; + void * TblDataAddr; UT_Table1_t * TblDataPtr; char MyFilename[OS_MAX_PATH_LEN]; CFE_TBL_AccessDescriptor_t *AccessDescPtr; @@ -3087,7 +3087,8 @@ void Test_CFE_TBL_TblMod(void) CFE_UtAssert_EVENTSENT(CFE_TBL_LOAD_SUCCESS_INF_EID); /* Modify the contents of the table */ - CFE_TBL_GetAddress((void **)&TblDataPtr, App1TblHandle1); + CFE_TBL_GetAddress(&TblDataAddr, App1TblHandle1); + TblDataPtr = TblDataAddr; TblDataPtr->TblElement1 ^= 0xFFFFFFFF; File.TblData.TblElement1 ^= 0xFFFFFFFF; @@ -3164,7 +3165,7 @@ void Test_CFE_TBL_TblMod(void) CFE_UtAssert_SUCCESS(CFE_TBL_GetInfo(&TblInfo1, "ut_cfe_tbl.UT_Table2")); UtAssert_INT32_EQ(TblInfo1.TimeOfLastUpdate.Seconds, TblInfo1.TimeOfLastUpdate.Subseconds); UtAssert_UINT32_EQ(TblInfo1.Crc, ExpectedCrc); - UtAssert_INT32_EQ(CFE_TBL_GetAddress((void **)&TblDataPtr, App1TblHandle1), CFE_TBL_INFO_UPDATED); + UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblDataAddr, App1TblHandle1), CFE_TBL_INFO_UPDATED); /* * LastFileLoaded (limited by mission) can be bigger than MyFilename (limited by osal), diff --git a/modules/time/fsw/inc/cfe_time_msg.h b/modules/time/fsw/inc/cfe_time_msg.h index 9810dcd12..d3415e94c 100644 --- a/modules/time/fsw/inc/cfe_time_msg.h +++ b/modules/time/fsw/inc/cfe_time_msg.h @@ -730,7 +730,7 @@ */ typedef struct CFE_TIME_NoArgsCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ } CFE_TIME_NoArgsCmd_t; @@ -759,8 +759,8 @@ typedef struct CFE_TIME_LeapsCmd_Payload */ typedef struct CFE_TIME_SetLeapSecondsCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TIME_LeapsCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TIME_LeapsCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_SetLeapSecondsCmd_t; /** @@ -768,10 +768,11 @@ typedef struct CFE_TIME_SetLeapSecondsCmd */ typedef struct CFE_TIME_StateCmd_Payload { - int16 ClockState; /**< \brief #CFE_TIME_ClockState_INVALID=Spacecraft time has not been accurately set, - #CFE_TIME_ClockState_VALID=Spacecraft clock has been accurately set, - #CFE_TIME_ClockState_FLYWHEEL=Force into FLYWHEEL mode */ - /**< Selects the current clock state */ + CFE_TIME_ClockState_Enum_t ClockState; /**< \brief #CFE_TIME_ClockState_INVALID=Spacecraft time has + not been accurately set, #CFE_TIME_ClockState_VALID=Spacecraft clock + has been accurately set, #CFE_TIME_ClockState_FLYWHEEL=Force into + FLYWHEEL mode */ + /**< Selects the current clock state */ } CFE_TIME_StateCmd_Payload_t; /** @@ -779,8 +780,8 @@ typedef struct CFE_TIME_StateCmd_Payload */ typedef struct CFE_TIME_SetStateCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TIME_StateCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TIME_StateCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_SetStateCmd_t; /** @@ -798,8 +799,8 @@ typedef struct CFE_TIME_SourceCmd_Payload */ typedef struct CFE_TIME_SetSourceCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TIME_SourceCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TIME_SourceCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_SetSourceCmd_t; /** @@ -817,8 +818,8 @@ typedef struct CFE_TIME_SignalCmd_Payload */ typedef struct CFE_TIME_SetSignalCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TIME_SignalCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TIME_SignalCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_SetSignalCmd_t; /** @@ -835,8 +836,8 @@ typedef struct CFE_TIME_TimeCmd_Payload */ typedef struct CFE_TIME_TimeCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TIME_TimeCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TIME_TimeCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_TimeCmd_t; /* @@ -867,8 +868,8 @@ typedef struct CFE_TIME_OneHzAdjustmentCmd_Payload */ typedef struct CFE_TIME_OneHzAdjustmentCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TIME_OneHzAdjustmentCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TIME_OneHzAdjustmentCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_OneHzAdjustmentCmd_t; /* @@ -884,10 +885,10 @@ typedef CFE_TIME_OneHzAdjustmentCmd_t CFE_TIME_Sub1HZAdjustmentCmd_t; */ typedef struct CFE_TIME_ToneDataCmd_Payload { - CFE_TIME_SysTime_t AtToneMET; /**< \brief MET at time of tone */ - CFE_TIME_SysTime_t AtToneSTCF; /**< \brief STCF at time of tone */ - int16 AtToneLeapSeconds; /**< \brief Leap Seconds at time of tone */ - int16 AtToneState; /**< \brief Clock state at time of tone */ + CFE_TIME_SysTime_t AtToneMET; /**< \brief MET at time of tone */ + CFE_TIME_SysTime_t AtToneSTCF; /**< \brief STCF at time of tone */ + int16 AtToneLeapSeconds; /**< \brief Leap Seconds at time of tone */ + CFE_TIME_ClockState_Enum_t AtToneState; /**< \brief Clock state at time of tone */ } CFE_TIME_ToneDataCmd_Payload_t; /** @@ -895,8 +896,8 @@ typedef struct CFE_TIME_ToneDataCmd_Payload */ typedef struct CFE_TIME_ToneDataCmd { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ - CFE_TIME_ToneDataCmd_Payload_t Payload; /**< \brief Command payload */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CFE_TIME_ToneDataCmd_Payload_t Payload; /**< \brief Command payload */ } CFE_TIME_ToneDataCmd_t; /*************************************************************************/ @@ -917,10 +918,10 @@ typedef struct CFE_TIME_HousekeepingTlm_Payload /* ** Clock state flags and "as calculated" clock state... */ - uint16 ClockStateFlags; /**< \cfetlmmnemonic \TIME_STATEFLG - \brief State Flags */ - int16 ClockStateAPI; /**< \cfetlmmnemonic \TIME_APISTATE - \brief API State */ + uint16 ClockStateFlags; /**< \cfetlmmnemonic \TIME_STATEFLG + \brief State Flags */ + CFE_TIME_ClockState_Enum_t ClockStateAPI; /**< \cfetlmmnemonic + \TIME_APISTATE \brief API State */ /* ** Leap Seconds... @@ -965,8 +966,8 @@ typedef struct CFE_TIME_HousekeepingTlm_Payload typedef struct CFE_TIME_HousekeepingTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_TIME_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_TIME_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_TIME_HousekeepingTlm_t; /*************************************************************************/ @@ -988,10 +989,10 @@ typedef struct CFE_TIME_DiagnosticTlm_Payload CFE_TIME_SysTime_t AtToneLatch; /**< \cfetlmmnemonic \TIME_TVALIDS \brief Local clock latched at time of tone */ - int16 AtToneLeapSeconds; /**< \cfetlmmnemonic \TIME_LEAPS - \brief Leap Seconds at time of tone */ - int16 ClockStateAPI; /**< \cfetlmmnemonic \TIME_APISTATE - \brief Clock state as per API */ + int16 AtToneLeapSeconds; /**< \cfetlmmnemonic \TIME_LEAPS + \brief Leap Seconds at time of tone */ + CFE_TIME_ClockState_Enum_t ClockStateAPI; /**< \cfetlmmnemonic \TIME_APISTATE + \brief Clock state as per API */ /* ** Data values that reflect the time (right now)... @@ -1122,8 +1123,8 @@ typedef struct CFE_TIME_DiagnosticTlm_Payload typedef struct CFE_TIME_DiagnosticTlm { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - CFE_TIME_DiagnosticTlm_Payload_t Payload; /**< \brief Telemetry payload */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */ + CFE_TIME_DiagnosticTlm_Payload_t Payload; /**< \brief Telemetry payload */ } CFE_TIME_DiagnosticTlm_t; #endif /* CFE_TIME_MSG_H */ diff --git a/modules/time/fsw/src/cfe_time_task.c b/modules/time/fsw/src/cfe_time_task.c index 87915e3aa..740b00eba 100644 --- a/modules/time/fsw/src/cfe_time_task.c +++ b/modules/time/fsw/src/cfe_time_task.c @@ -200,7 +200,8 @@ int32 CFE_TIME_TaskInit(void) #endif #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), CFE_TIME_Global.CmdPipe, 4); + Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), CFE_TIME_Global.CmdPipe, + CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT); #endif if (Status != CFE_SUCCESS) { @@ -216,7 +217,8 @@ int32 CFE_TIME_TaskInit(void) #endif #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), CFE_TIME_Global.CmdPipe, 4); + Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), CFE_TIME_Global.CmdPipe, + CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT); #endif if (Status != CFE_SUCCESS) { @@ -232,7 +234,8 @@ int32 CFE_TIME_TaskInit(void) #endif #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), CFE_TIME_Global.CmdPipe, 4); + Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), CFE_TIME_Global.CmdPipe, + CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT); #endif if (Status != CFE_SUCCESS) @@ -583,8 +586,8 @@ int32 CFE_TIME_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) /* ** Send housekeeping telemetry packet... */ - CFE_SB_TimeStampMsg(&CFE_TIME_Global.HkPacket.TlmHeader.Msg); - CFE_SB_TransmitMsg(&CFE_TIME_Global.HkPacket.TlmHeader.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(CFE_TIME_Global.HkPacket.TelemetryHeader)); + CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_TIME_Global.HkPacket.TelemetryHeader), true); /* ** Note: we only increment the command execution counter when @@ -772,8 +775,8 @@ int32 CFE_TIME_SendDiagnosticTlm(const CFE_TIME_SendDiagnosticCmd_t *data) /* ** Send diagnostics telemetry packet... */ - CFE_SB_TimeStampMsg(&CFE_TIME_Global.DiagPacket.TlmHeader.Msg); - CFE_SB_TransmitMsg(&CFE_TIME_Global.DiagPacket.TlmHeader.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(CFE_TIME_Global.DiagPacket.TelemetryHeader)); + CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_TIME_Global.DiagPacket.TelemetryHeader), true); CFE_EVS_SendEvent(CFE_TIME_DIAG_EID, CFE_EVS_EventType_DEBUG, "Request diagnostics command"); diff --git a/modules/time/fsw/src/cfe_time_tone.c b/modules/time/fsw/src/cfe_time_tone.c index bddb2de65..f43fe82bb 100644 --- a/modules/time/fsw/src/cfe_time_tone.c +++ b/modules/time/fsw/src/cfe_time_tone.c @@ -154,7 +154,7 @@ void CFE_TIME_ToneSend(void) /* ** Send "time at the tone" command data packet... */ - CFE_SB_TransmitMsg(&CFE_TIME_Global.ToneDataCmd.CmdHeader.Msg, false); + CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_TIME_Global.ToneDataCmd.CommandHeader), false); /* ** Count of "time at the tone" commands sent with internal data... @@ -1125,7 +1125,7 @@ void CFE_TIME_Tone1HzTask(void) /* ** Send tone signal command packet... */ - CFE_SB_TransmitMsg(&CFE_TIME_Global.ToneSignalCmd.CmdHeader.Msg, false); + CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_TIME_Global.ToneSignalCmd.CommandHeader), false); #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) /* @@ -1133,7 +1133,7 @@ void CFE_TIME_Tone1HzTask(void) ** to send the tone to other time clients. ** (this is done by scheduler in non-fake mode) */ - CFE_SB_TransmitMsg(&CFE_TIME_Global.ToneSendCmd.CmdHeader.Msg, false); + CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_TIME_Global.ToneSendCmd.CommandHeader), false); #endif /* @@ -1336,7 +1336,7 @@ void CFE_TIME_Local1HzTask(void) ** This used to be optional in previous CFE versions, but it is now required ** as TIME subscribes to this itself to do state machine tasks. */ - CFE_SB_TransmitMsg(&CFE_TIME_Global.Local1HzCmd.CmdHeader.Msg, false); + CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_TIME_Global.Local1HzCmd.CommandHeader), false); CFE_TIME_Global.LocalTaskCounter++; diff --git a/modules/time/fsw/src/cfe_time_utils.c b/modules/time/fsw/src/cfe_time_utils.c index 0e8aafee8..0d209b5d7 100644 --- a/modules/time/fsw/src/cfe_time_utils.c +++ b/modules/time/fsw/src/cfe_time_utils.c @@ -333,26 +333,26 @@ void CFE_TIME_InitData(void) /* ** Initialize housekeeping packet (clear user data area)... */ - CFE_MSG_Init(&CFE_TIME_Global.HkPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_HK_TLM_MID), + CFE_MSG_Init(CFE_MSG_PTR(CFE_TIME_Global.HkPacket.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_TIME_HK_TLM_MID), sizeof(CFE_TIME_Global.HkPacket)); /* ** Initialize diagnostic packet (clear user data area)... */ - CFE_MSG_Init(&CFE_TIME_Global.DiagPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_DIAG_TLM_MID), + CFE_MSG_Init(CFE_MSG_PTR(CFE_TIME_Global.DiagPacket.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_TIME_DIAG_TLM_MID), sizeof(CFE_TIME_Global.DiagPacket)); /* ** Initialize "time at the tone" signal command packet... */ - CFE_MSG_Init(&CFE_TIME_Global.ToneSignalCmd.CmdHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), + CFE_MSG_Init(CFE_MSG_PTR(CFE_TIME_Global.ToneSignalCmd.CommandHeader), CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), sizeof(CFE_TIME_Global.ToneSignalCmd)); /* ** Initialize "time at the tone" data command packet... */ #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - CFE_MSG_Init(&CFE_TIME_Global.ToneDataCmd.CmdHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), + CFE_MSG_Init(CFE_MSG_PTR(CFE_TIME_Global.ToneDataCmd.CommandHeader), CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), sizeof(CFE_TIME_Global.ToneDataCmd)); #endif @@ -360,14 +360,14 @@ void CFE_TIME_InitData(void) ** Initialize simulated tone send message ("fake tone" mode only)... */ #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) - CFE_MSG_Init(&CFE_TIME_Global.ToneSendCmd.CmdHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_SEND_CMD_MID), + CFE_MSG_Init(CFE_MSG_PTR(CFE_TIME_Global.ToneSendCmd.CommandHeader), CFE_SB_ValueToMsgId(CFE_TIME_SEND_CMD_MID), sizeof(CFE_TIME_Global.ToneSendCmd)); #endif /* ** Initialize local 1Hz "wake-up" command packet (optional)... */ - CFE_MSG_Init(&CFE_TIME_Global.Local1HzCmd.CmdHeader.Msg, CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), + CFE_MSG_Init(CFE_MSG_PTR(CFE_TIME_Global.Local1HzCmd.CommandHeader), CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), sizeof(CFE_TIME_Global.Local1HzCmd)); return; @@ -393,7 +393,7 @@ void CFE_TIME_GetHkData(const CFE_TIME_Reference_t *Reference) /* ** Current "as calculated" clock state... */ - CFE_TIME_Global.HkPacket.Payload.ClockStateAPI = (int16)CFE_TIME_CalculateState(Reference); + CFE_TIME_Global.HkPacket.Payload.ClockStateAPI = (CFE_TIME_ClockState_Enum_t)CFE_TIME_CalculateState(Reference); /* ** Current clock state flags... @@ -728,9 +728,9 @@ CFE_TIME_SysTime_t CFE_TIME_CalculateUTC(const CFE_TIME_Reference_t *Reference) * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -int16 CFE_TIME_CalculateState(const CFE_TIME_Reference_t *Reference) +CFE_TIME_ClockState_Enum_t CFE_TIME_CalculateState(const CFE_TIME_Reference_t *Reference) { - int16 ClockState; + CFE_TIME_ClockState_Enum_t ClockState; /* ** Determine the current clock state... @@ -782,7 +782,7 @@ int16 CFE_TIME_CalculateState(const CFE_TIME_Reference_t *Reference) * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_TIME_SetState(int16 NewState) +void CFE_TIME_SetState(CFE_TIME_ClockState_Enum_t NewState) { volatile CFE_TIME_ReferenceState_t *RefState; diff --git a/modules/time/fsw/src/cfe_time_utils.h b/modules/time/fsw/src/cfe_time_utils.h index 657371257..be0f563da 100644 --- a/modules/time/fsw/src/cfe_time_utils.h +++ b/modules/time/fsw/src/cfe_time_utils.h @@ -186,10 +186,10 @@ typedef struct /* ** Pending data values (from "time at tone" command data)... */ - CFE_TIME_SysTime_t PendingMET; - CFE_TIME_SysTime_t PendingSTCF; - int16 PendingLeaps; - int16 PendingState; + CFE_TIME_SysTime_t PendingMET; + CFE_TIME_SysTime_t PendingSTCF; + int16 PendingLeaps; + CFE_TIME_ClockState_Enum_t PendingState; /* ** STCF adjustment values... @@ -395,13 +395,13 @@ CFE_TIME_SysTime_t CFE_TIME_CalculateUTC(const CFE_TIME_Reference_t *Reference); /** * @brief determine current time state (per API) */ -int16 CFE_TIME_CalculateState(const CFE_TIME_Reference_t *Reference); +CFE_TIME_ClockState_Enum_t CFE_TIME_CalculateState(const CFE_TIME_Reference_t *Reference); /*---------------------------------------------------------------------------------------*/ /** * @brief set clock state */ -void CFE_TIME_SetState(int16 NewState); +void CFE_TIME_SetState(CFE_TIME_ClockState_Enum_t NewState); #if (CFE_PLATFORM_TIME_CFG_SOURCE == true)