From 1dc455b9b236575253f8cebe2a9c79c9bab93f5c Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 17 Apr 2023 14:49:14 +0000 Subject: [PATCH 1/6] Fix #219, #93, Add EVS port timestamp and simplify port selection --- cmake/sample_defs/cpu1_platform_cfg.h | 11 ++++ modules/evs/fsw/src/cfe_evs_task.c | 37 ++--------- modules/evs/fsw/src/cfe_evs_task.h | 1 + modules/evs/fsw/src/cfe_evs_utils.c | 92 ++++++++------------------- modules/evs/fsw/src/cfe_evs_verify.h | 4 ++ modules/evs/ut-coverage/evs_UT.c | 15 ++++- 6 files changed, 61 insertions(+), 99 deletions(-) diff --git a/cmake/sample_defs/cpu1_platform_cfg.h b/cmake/sample_defs/cpu1_platform_cfg.h index b898e7b37..55c81ba2a 100644 --- a/cmake/sample_defs/cpu1_platform_cfg.h +++ b/cmake/sample_defs/cpu1_platform_cfg.h @@ -1462,6 +1462,17 @@ */ #define CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE CFE_EVS_MsgFormat_LONG +/** +** \cfeevscfg Include time in port send +** +** \par Description: +** Includes the time when sending events out a port +** +** \par Limits +** Set as true or false +*/ +#define CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND false + /* Platform Configuration Parameters for Table Service (TBL) */ /** diff --git a/modules/evs/fsw/src/cfe_evs_task.c b/modules/evs/fsw/src/cfe_evs_task.c index 782a297c5..f7e34ad6c 100644 --- a/modules/evs/fsw/src/cfe_evs_task.c +++ b/modules/evs/fsw/src/cfe_evs_task.c @@ -76,7 +76,8 @@ int32 CFE_EVS_EarlyInit(void) CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort = CFE_PLATFORM_EVS_PORT_DEFAULT; CFE_EVS_Global.EVS_TlmPkt.Payload.LogMode = CFE_PLATFORM_EVS_DEFAULT_LOG_MODE; - CFE_EVS_Global.EVS_EventBurstMax = CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST; + CFE_EVS_Global.EVS_EventBurstMax = CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST; + CFE_EVS_Global.IncludeTimeInPortSend = CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND; /* Get a pointer to the CFE reset area from the BSP */ PspStatus = CFE_PSP_GetResetArea(&resetAreaAddr, &resetAreaSize); @@ -491,22 +492,7 @@ int32 CFE_EVS_EnablePortsCmd(const CFE_EVS_EnablePortsCmd_t *data) else { /* Process command data */ - if (((CmdPtr->BitMask & CFE_EVS_PORT1_BIT) >> 0) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CFE_EVS_PORT1_BIT; - } - if (((CmdPtr->BitMask & CFE_EVS_PORT2_BIT) >> 1) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CFE_EVS_PORT2_BIT; - } - if (((CmdPtr->BitMask & CFE_EVS_PORT3_BIT) >> 2) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CFE_EVS_PORT3_BIT; - } - if (((CmdPtr->BitMask & CFE_EVS_PORT4_BIT) >> 3) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CFE_EVS_PORT4_BIT; - } + CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort |= CmdPtr->BitMask; EVS_SendEvent(CFE_EVS_ENAPORT_EID, CFE_EVS_EventType_DEBUG, "Enable Ports Command Received with Port Bit Mask = 0x%02x", (unsigned int)CmdPtr->BitMask); @@ -538,22 +524,7 @@ int32 CFE_EVS_DisablePortsCmd(const CFE_EVS_DisablePortsCmd_t *data) else { /* Process command data */ - if (((CmdPtr->BitMask & CFE_EVS_PORT1_BIT) >> 0) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CFE_EVS_PORT1_BIT; - } - if (((CmdPtr->BitMask & CFE_EVS_PORT2_BIT) >> 1) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CFE_EVS_PORT2_BIT; - } - if (((CmdPtr->BitMask & CFE_EVS_PORT3_BIT) >> 2) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CFE_EVS_PORT3_BIT; - } - if (((CmdPtr->BitMask & CFE_EVS_PORT4_BIT) >> 3) == true) - { - CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CFE_EVS_PORT4_BIT; - } + CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort &= ~CmdPtr->BitMask; EVS_SendEvent(CFE_EVS_DISPORT_EID, CFE_EVS_EventType_DEBUG, "Disable Ports Command Received with Port Bit Mask = 0x%02x", (unsigned int)CmdPtr->BitMask); diff --git a/modules/evs/fsw/src/cfe_evs_task.h b/modules/evs/fsw/src/cfe_evs_task.h index f8274057e..b39775495 100644 --- a/modules/evs/fsw/src/cfe_evs_task.h +++ b/modules/evs/fsw/src/cfe_evs_task.h @@ -122,6 +122,7 @@ typedef struct osal_id_t EVS_SharedDataMutexID; CFE_ES_AppId_t EVS_AppID; uint32 EVS_EventBurstMax; + bool IncludeTimeInPortSend; /* Includes time in message sent out ports */ } CFE_EVS_Global_t; /* diff --git a/modules/evs/fsw/src/cfe_evs_utils.c b/modules/evs/fsw/src/cfe_evs_utils.c index 8127046b4..75cc90f40 100644 --- a/modules/evs/fsw/src/cfe_evs_utils.c +++ b/modules/evs/fsw/src/cfe_evs_utils.c @@ -35,10 +35,7 @@ /* Local Function Prototypes */ void EVS_SendViaPorts(CFE_EVS_LongEventTlm_t *EVS_PktPtr); -void EVS_OutputPort1(char *Message); -void EVS_OutputPort2(char *Message); -void EVS_OutputPort3(char *Message); -void EVS_OutputPort4(char *Message); +void EVS_OutputPort(uint8 PortNum, char *Message); /* Function Definitions */ @@ -541,50 +538,45 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 *-----------------------------------------------------------------*/ void EVS_SendViaPorts(CFE_EVS_LongEventTlm_t *EVS_PktPtr) { - char PortMessage[CFE_EVS_MAX_PORT_MSG_LENGTH]; + char PortMessage[CFE_EVS_MAX_PORT_MSG_LENGTH]; + char TimeBuffer[CFE_TIME_PRINTED_STRING_SIZE] = ""; + char Separator[2] = ""; + CFE_TIME_SysTime_t PktTime; - if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT1_BIT) >> 0) == true) + if (CFE_EVS_Global.IncludeTimeInPortSend) + { + CFE_MSG_GetMsgTime(CFE_MSG_PTR(EVS_PktPtr->TelemetryHeader), &PktTime); + CFE_TIME_Print(TimeBuffer, PktTime); + snprintf(Separator, sizeof(Separator), " "); + } + + snprintf(PortMessage, sizeof(PortMessage), "%s%s%u/%u/%s %u: %s", TimeBuffer, Separator, + (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, + (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, + (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); + + if (CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT1_BIT) { - /* Copy event message to string format */ - snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port1 %u/%u/%s %u: %s", - (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, - (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, - (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); /* Send string event out port #1 */ - EVS_OutputPort1(PortMessage); + EVS_OutputPort(1, PortMessage); } - if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT2_BIT) >> 1) == true) + if (CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT2_BIT) { - /* Copy event message to string format */ - snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port2 %u/%u/%s %u: %s", - (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, - (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, - (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); /* Send string event out port #2 */ - EVS_OutputPort2(PortMessage); + EVS_OutputPort(2, PortMessage); } - if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT3_BIT) >> 2) == true) + if (CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT3_BIT) { - /* Copy event message to string format */ - snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port3 %u/%u/%s %u: %s", - (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, - (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, - (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); /* Send string event out port #3 */ - EVS_OutputPort3(PortMessage); + EVS_OutputPort(3, PortMessage); } - if (((CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT4_BIT) >> 3) == true) + if (CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT4_BIT) { - /* Copy event message to string format */ - snprintf(PortMessage, CFE_EVS_MAX_PORT_MSG_LENGTH, "EVS Port4 %u/%u/%s %u: %s", - (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, - (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, - (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); /* Send string event out port #4 */ - EVS_OutputPort4(PortMessage); + EVS_OutputPort(4, PortMessage); } } @@ -593,39 +585,9 @@ void EVS_SendViaPorts(CFE_EVS_LongEventTlm_t *EVS_PktPtr) * Internal helper routine only, not part of API. * *-----------------------------------------------------------------*/ -void EVS_OutputPort1(char *Message) -{ - OS_printf("%s\n", Message); -} - -/*---------------------------------------------------------------- - * - * Internal helper routine only, not part of API. - * - *-----------------------------------------------------------------*/ -void EVS_OutputPort2(char *Message) -{ - OS_printf("%s\n", Message); -} - -/*---------------------------------------------------------------- - * - * Internal helper routine only, not part of API. - * - *-----------------------------------------------------------------*/ -void EVS_OutputPort3(char *Message) -{ - OS_printf("%s\n", Message); -} - -/*---------------------------------------------------------------- - * - * Internal helper routine only, not part of API. - * - *-----------------------------------------------------------------*/ -void EVS_OutputPort4(char *Message) +void EVS_OutputPort(uint8 PortNum, char *Message) { - OS_printf("%s\n", Message); + OS_printf("EVS Port%u %s\n", PortNum, Message); } /*---------------------------------------------------------------- diff --git a/modules/evs/fsw/src/cfe_evs_verify.h b/modules/evs/fsw/src/cfe_evs_verify.h index 7c8c8df6e..15ae544a0 100644 --- a/modules/evs/fsw/src/cfe_evs_verify.h +++ b/modules/evs/fsw/src/cfe_evs_verify.h @@ -45,6 +45,10 @@ #error CFE_PLATFORM_EVS_DEFAULT_LOG_MODE can only be 0 (Overwrite) or 1 (Discard)! #endif +#if (CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND != true) && (CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND != false) +#error CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND must be true or false +#endif + #if (CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE != CFE_EVS_MsgFormat_LONG) && \ (CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE != CFE_EVS_MsgFormat_SHORT) #error CFE_EVS_DEFAULT_MSG_FORMAT can only be CFE_EVS_MsgFormat_LONG or CFE_EVS_MsgFormat_SHORT ! diff --git a/modules/evs/ut-coverage/evs_UT.c b/modules/evs/ut-coverage/evs_UT.c index 534743970..6d593aa2d 100644 --- a/modules/evs/ut-coverage/evs_UT.c +++ b/modules/evs/ut-coverage/evs_UT.c @@ -279,6 +279,7 @@ void Test_Init(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); CFE_EVS_EarlyInit(); + CFE_EVS_Global.IncludeTimeInPortSend = false; /* Do generic testing without time in port message */ CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[4]); /* Task main with init failure */ @@ -359,6 +360,7 @@ void Test_Init(void) UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); CFE_EVS_EarlyInit(); + CFE_EVS_Global.IncludeTimeInPortSend = false; /* Do generic testing without time in port message */ CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[4]); /* Test task initialization where event services fails */ @@ -812,7 +814,9 @@ void Test_Ports(void) { CFE_EVS_BitMaskCmd_t bitmaskcmd; UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID)}; + CFE_TIME_SysTime_t PacketTime; + memset(&PacketTime, 0, sizeof(PacketTime)); memset(&bitmaskcmd, 0, sizeof(bitmaskcmd)); UtPrintf("Begin Test Ports"); @@ -829,8 +833,17 @@ void Test_Ports(void) /* Test that ports are enabled by sending a message */ UT_InitData(); UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); - CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Test ports message"); + UtAssert_UINT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Test ports message"), CFE_SUCCESS); UtAssert_UINT32_EQ(LocalSnapshotData.Count, 1); + UtAssert_STUB_COUNT(CFE_TIME_Print, 0); + + /* Test with time included */ + UT_InitData(); + CFE_EVS_Global.IncludeTimeInPortSend = true; + UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgTime), &PacketTime, sizeof(PacketTime), false); + UtAssert_UINT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Test ports message"), CFE_SUCCESS); + UtAssert_STUB_COUNT(CFE_TIME_Print, 1); + CFE_EVS_Global.IncludeTimeInPortSend = false; /* Do generic testing without time in port message */ /* Disable all ports to cut down on unneeded output */ UT_InitData(); From 972f76aa640d57bd063a91af7be804a9fe986a68 Mon Sep 17 00:00:00 2001 From: havencarlson Date: Mon, 24 Apr 2023 14:51:21 -0400 Subject: [PATCH 2/6] Fix #1901, remove else statement that was unreachable by unit tests --- modules/tbl/fsw/inc/cfe_tbl_events.h | 12 ------------ modules/tbl/fsw/src/cfe_tbl_task_cmds.c | 7 +------ 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/modules/tbl/fsw/inc/cfe_tbl_events.h b/modules/tbl/fsw/inc/cfe_tbl_events.h index 83c2205ad..edcbe2926 100644 --- a/modules/tbl/fsw/inc/cfe_tbl_events.h +++ b/modules/tbl/fsw/inc/cfe_tbl_events.h @@ -345,18 +345,6 @@ */ #define CFE_TBL_NO_WORK_BUFFERS_ERR_EID 60 -/** - * \brief TBL Load Table Command Get Working Buffer Internal Failure Event ID - * - * \par Type: ERROR - * - * \par Cause: - * - * \link #CFE_TBL_LOAD_CC TBL Load Table Command \endlink failure due to - * internal get working buffer error. - */ -#define CFE_TBL_INTERNAL_ERROR_ERR_EID 61 - /** * \brief TBL Write File Creation Failure Event ID * diff --git a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c index 5af3f9da6..3f4ef27c9 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c +++ b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c @@ -475,16 +475,11 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) TblFileHeader.TableName); } } - else if (Status == CFE_TBL_ERR_NO_BUFFER_AVAIL) + else { CFE_EVS_SendEvent(CFE_TBL_NO_WORK_BUFFERS_ERR_EID, CFE_EVS_EventType_ERROR, "No working buffers available for table '%s'", TblFileHeader.TableName); } - else - { - CFE_EVS_SendEvent(CFE_TBL_INTERNAL_ERROR_ERR_EID, CFE_EVS_EventType_ERROR, - "Internal Error (Status=0x%08X)", (unsigned int)Status); - } } else { From 85f4238d0f89b5f9ef3061eef2b972f0ef35f93e Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 25 Apr 2023 12:38:21 -0400 Subject: [PATCH 3/6] Fix #2305, document CFS component file naming Expand section 4 of the CFE application developer guide with recommended file naming patterns and the expected content of the files. CFS apps should strive to match this pattern for the next release. --- docs/cFE Application Developers Guide.md | 140 +++++++++++++++++------ 1 file changed, 108 insertions(+), 32 deletions(-) diff --git a/docs/cFE Application Developers Guide.md b/docs/cFE Application Developers Guide.md index f80ac237b..ebf9e6f0c 100644 --- a/docs/cFE Application Developers Guide.md +++ b/docs/cFE Application Developers Guide.md @@ -318,14 +318,14 @@ directory is described as a note under each folder. | |-- The flight software is all configured and built under this directory | |-- All mission and platform configuration files are placed here |-- apps - | |-- Contains application source code. + | |-- Contains application source code. | |-- Application source code may be shared amoung multiple build CPUs |-- libs | |-- Contains Core Flight System (cFS) Sample Library (sample_lib) |-- tools | |-- Contains Core Flight System (cFS) tools -``` -Module descriptions are provided in the table below. +``` +Module descriptions are provided in the table below. ``` -- missionxyz/cfe |-- cmake @@ -353,7 +353,7 @@ Module descriptions are provided in the table below. ``` -- missionxyz/build |-- CMakeFiles - | |-- Cmake fore cfe core build and all apps + | |-- Cmake for cfe core build and all apps |-- cpu1 | |-- Contains start up script "cfe_es_startup.scr" | |-- Where build.o and executable files, etc. are placed @@ -364,12 +364,12 @@ Module descriptions are provided in the table below. | |-- Where the cpu1 platform configuration include files go |-- src |-- tools -``` +``` ``` -- missionxyz/build/cpu1 |-- default_cpu1 | |-- CMakeFiles - | | | Cmake fore cfe core build and all apps + | | | Cmake for cfe core build and all apps | |-- apps | | |-- Where application makefiles go | | |-- One directory per application @@ -392,19 +392,19 @@ Module descriptions are provided in the table below. | |-- tbl | |-- time ``` -``` +``` -- missionxyz/apps |-- ci_lab |-- sample_app |-- sch_lab |-- to_lab -``` -``` +``` +``` -- missionxyz/tools |-- cFS-GroundSystem |-- elf2cfetbl |-- tblCRCTool -``` +``` ``` -- missionxyz/cf/modules/es |-- eds @@ -599,33 +599,109 @@ Child Tasks can be useful in both "Software Only" and "Hardware Servicing" applications. ## 4.2 Best Practices + ### 4.2.1 cFS Application Template Applications designed to interface with the cFE should follow standard templates. Reference sample_app on Github for “live” example. -| **Directory** | **Descriptions** | -|:--------------------------------------|:-------------------------------------------------------------------------------------------------------------| -| fsw/ | All components which are used on/deployed to the actual target or define the interface to those components | -| fsw/inc/ | Public/Interface headers for the component | -| fsw/src/ | Source files and private headers for the component | -| tables/ | Example/Initial table definitions | - - - -| **Files** | **Descriptions** | -|:--------------------------------------|:-------------------------------------------------------------------------------------------------------------| -| fsw/src/sample_app.c | Main source code for sample_app. Located in src directory. | -| fsw/src/sample_app.h | Main header file for sample_app. It contains your main global typedef, prototypes, and miscellaneous define. | -| fsw/src/sample_app_events.h | Defines sample_app event IDs | -| fsw/src/sample_app_msg.h | Defines sample_app commands and its structures | -| fsw/tables/sample_app_table.c | Define sample_app table(s) | -| fsw/platform_inc/sample_app_msgids.h | Define sample_app message IDs | -| fsw/mission_inc/sample_app_perfids.h | Define sample_app performance IDs | - -In addition to showing the standard structure of a cFS application, the -sample_app also demonstrates how to interface with cFS libraries and table -services. +__File Organization and Directory Structure__ + +| **Directory** | **Content** | +|:--------------------------------------|:-------------------------------------------------------------------------------| +| config/ | Example configuration files for the component | +| eds/ | CCSDS Electronic Data Sheet package for the component (defined per book 876.0) | +| fsw/ | Source units that comprise the flight software that executes on the target | +| fsw/inc/ | Public/Interface headers for the component | +| fsw/src/ | Source files and private headers for the component | +| tables/ | Example table definitions for the component | + +__Source File Naming Convention__ + +All source files associated with a component should begin with the component name as a prefix, to help ensure uniqueness +of file names across all flight software packages once imported into a combined software tree. All of the configuration header +files should also be overridable at the mission level; that is, a component only provides a default file (with a `default_` prefix, +for distinction) that can be "cloned and owned" by placing a copy, without the `default_` prefix, into the `_defs` directory +for the CFE/CFS mission build. Any customized file(s) in the `_defs` directory will be seen by the CMake build system and used +instead of the default version of the file that is provided from the orignal source tree. + +| **File Name Pattern** | **Scope** | **Content** | +|:---------------------------|:---------:|:----------------------------------------------------------------------------------------------------| +| _module_`_fcncodes.h` | INTERFACE | Function Codes and associated documentation for the CMD interface of the component (see note) | +| _module_`_msgdefs.h` | INTERFACE | Constant definitions for the CMD/TLM interface(s) of the component (see note) | +| _module_`_tbldefs.h` | INTERFACE | Constant definitions that affect the table file interface(s) of the component | +| _module_`_msgstruct.h` | INTERFACE | Structures that define the CMD/TLM message interface(s) of the component | +| _module_`_tblstruct.h` | INTERFACE | Structures that define the table file interface(s) of the component | +| _module_`_interface_cfg.h` | INTERFACE | Other configuration that affects the interface(s) of the component (table files and/or messages) | +| _module_`_eventids.h` | INTERFACE | CFE EVS Event IDs for the component, with descriptions/documentation | +| _module_`_global_cfg.h` | MISSION | Constants that need to be consistent across all instances, but do not directly affect interface(s) | +| _module_`_version.h` | MISSION | Version number of the component | +| _module_`_msgids.h` | PLATFORM | CFE Software Bus Message ID definitions for CMD/TLM interface(s) of the component | +| _module_`_internal_cfg.h` | PLATFORM | Software configuration that does not affect interfaces, and may be different per instance/platform | +| _module_`_perfids.h` | PLATFORM | CFE ES Performance monitor IDs for the component, with descriptions/documentation | +| _module_`_verify.h` | FSW | Compile-time configuration validation (typically included from only one source file) | +| _module_`_app.[ch]` | FSW | Application entry point, initialization, and main task loop | +| _module_`_cmds.[ch]` | FSW | Application command processor functions | +| _module_`_dispatch.[ch]` | FSW | Dispatch table for validating incoming commands and invoking appropriate command processor | + +**NOTE**: For backward compatibility, the `_msgdefs.h` header should also provide the function code definitions from `_fcncodes.h`, such that +inclusion of the `_msgdefs.h` file alone provides the command codes as well as any other required definitions for message interpretation. +However, the `_fcncodes.h` header should be strictly limited to defining command/function codes for the command interface and should not contain +any other information. + +**IMPORANT**: All of the header files above with "INTERFACE" scope control the table/message interface of the component. Changing any of the +values or definitions in these files will affect the inter-processor communication - either table files, exported data products, commands, or +telementry messages. Due caution should be exercised when customizing any of these files, as any changes will need to be propagated to all +other CFE instances, ground systems, test software or scripts, or any other tools that interact with the flight softare. + +Also note that Electronic Data Sheets (EDS) definitions will supercede the "INTERFACE" header files listed above. These headers are not +used by the software when building FSW based on EDS. Instead, the EDS tool will generate these headers based on the content of the EDS file(s) +and the software will be configured to use the generated headers during the build. + +__Combination Headers__ + +The header files in this section combine two or more files from the above set for simplicity of usage in source code, as well as backward +compatiblity with traditional file names from older versions of CFS apps. Although these files may also be overridden directly, it is +recommended to only override/modify the more granular headers defined above. + +| **File Name Pattern** | **Content** | +|:---------------------------|:-------------------------------------------------------------------------------------------| +| _module_`_mission_cfg.h` | Combination of `global_cfg.h` and `interface_cfg.h` (mission scope configuration) | +| _module_`_platform_cfg.h` | Combination of `mission_cfg.h` (above), `internal_cfg.h` and any other dependencies | +| _module_`_msg.h` | Complete message interface: Combination of `msgdefs.h`, `msgstruct.h` and all dependencies | +| _module_`_tbl.h` | Complete table interface: Combination of `tbldefs.h`, `tblstruct.h` and all dependencies | + +**IMPORANT**: Files from a limited scope may depend on files from a broader scope, but not the other way around. For example, +the `platform_cfg.h` may depend on items defined in `mission_cfg.h`, but items in `mission_cfg.h` must **not** depend on items +defined in `platform_cfg.h`. + +__Example for SAMPLE_APP__ + +The sample application (SAMPLE_APP) provides a concrete example of the currently-recommended patterns for CFE/CFS applications. +This section provides a summary the naming conventions put into practice for the sample application. + +| **Files** | **Description** | +|:--------------------------------------------|:--------------------------------------------------------------------------------------------------| +| `config/default_sample_app_msgids.h` | CFE Software Bus Message ID definitions for SAMPLE_APP (CMD, SEND_HK, and HK_TLM) | +| `config/default_sample_app_msgdefs.h` | Not needed | +| `config/default_sample_app_tbldefs.h` | Not needed | +| `config/default_sample_app_msgstruct.h` | Defines NoopCmd, ResetCountersCmd, ProcessCmd, and HkTlm message structures | +| `config/default_sample_app_tblstruct.h` | Defines the example table content structure | +| `config/default_sample_app_interface_cfg.h` | Not needed | +| `config/default_sample_app_global_cfg.h` | Not needed | +| `config/default_sample_app_internal_cfg.h` | Not needed | +| `eds/sample_app.xml` | EDS `` for the SAMPLE_APP component (supercedes headers above, if enabled) | +| `fsw/inc/sample_app_events.h` | Defines sample_app event IDs | +| `fsw/inc/sample_app_perfids.h` | Define sample_app performance IDs | +| `fsw/src/sample_app.c` | Application entry point, initialization, and main task loop | +| `fsw/inc/sample_app.h` | Declarations/Prototypes for `sample_app.c` that are needed by other source units | +| `fsw/src/sample_app_cmds.c` | Application command processor functions | +| `fsw/inc/sample_app_cmds.h` | Declarations/Prototypes for `sample_app_cmds.c` that are needed by other source units | +| `fsw/src/sample_app_dispatch.c` | Application command dispatcher ("TaskPipe"; identification and validation of all message inputs) | +| `fsw/inc/sample_app_dispatch.h` | Declarations/Prototypes for `sample_app_dispatch.c` that are needed by other source units | + +In addition to showing the standard structure of a cFS application, the sample_app also demonstrates how to interface with cFS libraries +and table services. ### 4.2.2 Avoid "Endian-ness" Dependencies From 43270f5bcdb3ba39de1d5e41ef485f316dc72243 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Thu, 27 Apr 2023 21:38:29 +0000 Subject: [PATCH 4/6] Fix #219, Remove option to exclude port output timestamp --- cmake/sample_defs/cpu1_platform_cfg.h | 11 - modules/evs/fsw/src/cfe_evs_task.c | 3 +- modules/evs/fsw/src/cfe_evs_task.h | 1 - modules/evs/fsw/src/cfe_evs_utils.c | 13 +- modules/evs/fsw/src/cfe_evs_verify.h | 4 - modules/evs/ut-coverage/evs_UT.c | 414 +++++++++++++------------- 6 files changed, 213 insertions(+), 233 deletions(-) diff --git a/cmake/sample_defs/cpu1_platform_cfg.h b/cmake/sample_defs/cpu1_platform_cfg.h index 55c81ba2a..b898e7b37 100644 --- a/cmake/sample_defs/cpu1_platform_cfg.h +++ b/cmake/sample_defs/cpu1_platform_cfg.h @@ -1462,17 +1462,6 @@ */ #define CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE CFE_EVS_MsgFormat_LONG -/** -** \cfeevscfg Include time in port send -** -** \par Description: -** Includes the time when sending events out a port -** -** \par Limits -** Set as true or false -*/ -#define CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND false - /* Platform Configuration Parameters for Table Service (TBL) */ /** diff --git a/modules/evs/fsw/src/cfe_evs_task.c b/modules/evs/fsw/src/cfe_evs_task.c index f7e34ad6c..01352f49d 100644 --- a/modules/evs/fsw/src/cfe_evs_task.c +++ b/modules/evs/fsw/src/cfe_evs_task.c @@ -76,8 +76,7 @@ int32 CFE_EVS_EarlyInit(void) CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort = CFE_PLATFORM_EVS_PORT_DEFAULT; CFE_EVS_Global.EVS_TlmPkt.Payload.LogMode = CFE_PLATFORM_EVS_DEFAULT_LOG_MODE; - CFE_EVS_Global.EVS_EventBurstMax = CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST; - CFE_EVS_Global.IncludeTimeInPortSend = CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND; + CFE_EVS_Global.EVS_EventBurstMax = CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST; /* Get a pointer to the CFE reset area from the BSP */ PspStatus = CFE_PSP_GetResetArea(&resetAreaAddr, &resetAreaSize); diff --git a/modules/evs/fsw/src/cfe_evs_task.h b/modules/evs/fsw/src/cfe_evs_task.h index b39775495..f8274057e 100644 --- a/modules/evs/fsw/src/cfe_evs_task.h +++ b/modules/evs/fsw/src/cfe_evs_task.h @@ -122,7 +122,6 @@ typedef struct osal_id_t EVS_SharedDataMutexID; CFE_ES_AppId_t EVS_AppID; uint32 EVS_EventBurstMax; - bool IncludeTimeInPortSend; /* Includes time in message sent out ports */ } CFE_EVS_Global_t; /* diff --git a/modules/evs/fsw/src/cfe_evs_utils.c b/modules/evs/fsw/src/cfe_evs_utils.c index 75cc90f40..bf6057b05 100644 --- a/modules/evs/fsw/src/cfe_evs_utils.c +++ b/modules/evs/fsw/src/cfe_evs_utils.c @@ -539,18 +539,13 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 void EVS_SendViaPorts(CFE_EVS_LongEventTlm_t *EVS_PktPtr) { char PortMessage[CFE_EVS_MAX_PORT_MSG_LENGTH]; - char TimeBuffer[CFE_TIME_PRINTED_STRING_SIZE] = ""; - char Separator[2] = ""; + char TimeBuffer[CFE_TIME_PRINTED_STRING_SIZE]; CFE_TIME_SysTime_t PktTime; - if (CFE_EVS_Global.IncludeTimeInPortSend) - { - CFE_MSG_GetMsgTime(CFE_MSG_PTR(EVS_PktPtr->TelemetryHeader), &PktTime); - CFE_TIME_Print(TimeBuffer, PktTime); - snprintf(Separator, sizeof(Separator), " "); - } + CFE_MSG_GetMsgTime(CFE_MSG_PTR(EVS_PktPtr->TelemetryHeader), &PktTime); + CFE_TIME_Print(TimeBuffer, PktTime); - snprintf(PortMessage, sizeof(PortMessage), "%s%s%u/%u/%s %u: %s", TimeBuffer, Separator, + snprintf(PortMessage, sizeof(PortMessage), "%s %u/%u/%s %u: %s", TimeBuffer, (unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID, (unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName, (unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message); diff --git a/modules/evs/fsw/src/cfe_evs_verify.h b/modules/evs/fsw/src/cfe_evs_verify.h index 15ae544a0..7c8c8df6e 100644 --- a/modules/evs/fsw/src/cfe_evs_verify.h +++ b/modules/evs/fsw/src/cfe_evs_verify.h @@ -45,10 +45,6 @@ #error CFE_PLATFORM_EVS_DEFAULT_LOG_MODE can only be 0 (Overwrite) or 1 (Discard)! #endif -#if (CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND != true) && (CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND != false) -#error CFE_PLATFORM_EVS_INCLUDE_TIME_IN_PORT_SEND must be true or false -#endif - #if (CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE != CFE_EVS_MsgFormat_LONG) && \ (CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE != CFE_EVS_MsgFormat_SHORT) #error CFE_EVS_DEFAULT_MSG_FORMAT can only be CFE_EVS_MsgFormat_LONG or CFE_EVS_MsgFormat_SHORT ! diff --git a/modules/evs/ut-coverage/evs_UT.c b/modules/evs/ut-coverage/evs_UT.c index 6d593aa2d..d122dba1d 100644 --- a/modules/evs/ut-coverage/evs_UT.c +++ b/modules/evs/ut-coverage/evs_UT.c @@ -132,6 +132,17 @@ typedef struct typedef CFE_Status_t (*UT_EVS_SendEventFunc_t)(uint32); +/* Custom time handler to avoid needing to provide buffer for every event call */ +void UT_CFE_MSG_GetMsgTime_CustomHandler(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) {} + +/* Add custom logic to cFE common UT_InitData */ +void UT_InitData_EVS(void) +{ + UT_InitData(); + + UT_SetHandlerFunction(UT_KEY(CFE_MSG_GetMsgTime), UT_CFE_MSG_GetMsgTime_CustomHandler, NULL); +} + /* Message init hook to stora last MsgId passed in */ static int32 UT_EVS_MSGInitHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { @@ -274,16 +285,15 @@ void Test_Init(void) appbitcmd.Payload.AppName[sizeof(appbitcmd.Payload.AppName) - 1] = '\0'; /* Test successful early initialization of the cFE EVS */ - UT_InitData(); + UT_InitData_EVS(); UT_SetSizeofESResetArea(sizeof(CFE_ES_ResetData_t)); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); CFE_EVS_EarlyInit(); - CFE_EVS_Global.IncludeTimeInPortSend = false; /* Do generic testing without time in port message */ CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[4]); /* Task main with init failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, -1); UtAssert_VOIDCALL(CFE_EVS_TaskMain()); @@ -291,7 +301,7 @@ void Test_Init(void) * invalid command packet */ UtPrintf("CFE_EVS_TaskMain - Test error reading command pipe, unrecognized msgid"); - UT_InitData(); + UT_InitData_EVS(); /* Set unexpected message ID */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &msgid, sizeof(msgid), false); @@ -301,20 +311,20 @@ void Test_Init(void) UtAssert_INT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_MSGID_EID); /* Test early initialization with a get reset area failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetStatusBSPResetArea(-1, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_EVS_EarlyInit(); UT_SetStatusBSPResetArea(OS_SUCCESS, CFE_TIME_RESET_SIGNATURE, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[1]); /* Test early initialization, restoring the event log */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, -1); CFE_EVS_EarlyInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[6]); /* Test early initialization, clearing the event log (log mode path) */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, -1); CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_EVS_LogMode_OVERWRITE + CFE_EVS_LogMode_DISCARD + 1; CFE_EVS_Global.EVS_LogPtr->LogFullFlag = false; @@ -323,7 +333,7 @@ void Test_Init(void) CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[5]); /* Test early initialization, clearing the event log (log full path) */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, -1); CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_EVS_LogMode_DISCARD; CFE_EVS_Global.EVS_LogPtr->LogFullFlag = 2; @@ -332,7 +342,7 @@ void Test_Init(void) CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[5]); /* Test early initialization, clearing the event log (next log path) */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, -1); CFE_EVS_Global.EVS_LogPtr->LogMode = CFE_EVS_LogMode_OVERWRITE; CFE_EVS_Global.EVS_LogPtr->LogFullFlag = true; @@ -341,7 +351,7 @@ void Test_Init(void) CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[5]); /* Test early initialization with a mutex creation failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, -1); CFE_EVS_EarlyInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[3]); @@ -349,64 +359,63 @@ void Test_Init(void) /* Test early initialization with an unexpected size returned * by CFE_PSP_GetResetArea */ - UT_InitData(); + UT_InitData_EVS(); UT_SetSizeofESResetArea(0); CFE_EVS_EarlyInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[2]); /* Repeat successful initialization to configure log for later references */ - UT_InitData(); + UT_InitData_EVS(); UT_SetSizeofESResetArea(sizeof(CFE_ES_ResetData_t)); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetResetType), 1, CFE_PSP_RST_TYPE_POWERON); CFE_EVS_EarlyInit(); - CFE_EVS_Global.IncludeTimeInPortSend = false; /* Do generic testing without time in port message */ CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[4]); /* Test task initialization where event services fails */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 2, -1); /* Set Failure in CFE_EVS_Register -> EVS_GetApp_ID */ CFE_EVS_TaskInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[11]); /* Test task initialization where the pipe creation fails */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, -1); CFE_EVS_TaskInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[12]); /* Test task initialization where command subscription fails */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 1, -1); CFE_EVS_TaskInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[13]); /* Test task initialization where HK request subscription fails */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 2, -1); CFE_EVS_TaskInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[14]); /* Test task initialization where getting the application ID fails */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppID), -1); CFE_EVS_TaskInit(); CFE_UtAssert_SYSLOG(EVS_SYSLOG_MSGS[10]); /* Test successful task initialization */ - UT_InitData(); + UT_InitData_EVS(); CFE_EVS_TaskInit(); UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 0); /* Enable DEBUG message output */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Disable ports */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); @@ -426,7 +435,7 @@ void Test_IllegalAppID(void) UtPrintf("Begin Test Illegal App ID"); /* Set test up with illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test registering an event using an illegal application ID */ @@ -438,42 +447,42 @@ void Test_IllegalAppID(void) UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(time, 0, 0, NULL), CFE_EVS_INVALID_PARAMETER); /* Test sending an event using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, 0, "NULL"), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test sending an event using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); CFE_UtAssert_SUCCESS(EVS_SendEvent(0, 0, "NULL")); /* Test sending a timed event using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(time, 0, 0, "NULL"), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test sending an event with app ID using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, 0, CFE_ES_APPID_UNDEFINED, "NULL"), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test resetting a filter using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_EVS_ResetFilter(0), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test resetting all filters using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_EVS_ResetAllFilters(), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test application cleanup using an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_AppID_ToIndex), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_EVS_CleanUpApp(CFE_ES_APPID_UNDEFINED), CFE_EVS_APP_ILLEGAL_APP_ID); /* Test with out of range AppID */ - UT_InitData(); + UT_InitData_EVS(); AppID = CFE_ES_APPID_C(CFE_ResourceId_FromInteger(CFE_PLATFORM_ES_MAX_APPLICATIONS)); UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, 0, AppID, "NULL"), CFE_EVS_APP_ILLEGAL_APP_ID); } @@ -492,39 +501,39 @@ void Test_UnregisteredApp(void) UtPrintf("Begin Test Unregistered App"); - UT_InitData(); + UT_InitData_EVS(); /* Unregister the application (it was registered in CFE_EVS_TaskInit) */ CFE_EVS_CleanUpApp(AppID); /* Test sending an event to an unregistered application */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_SendEvent(0, 0, "NULL"), CFE_EVS_APP_NOT_REGISTERED); /* Test resetting a filter using an unregistered application */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_ResetFilter(0), CFE_EVS_APP_NOT_REGISTERED); /* Test resetting all filters using an unregistered application */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_ResetAllFilters(), CFE_EVS_APP_NOT_REGISTERED); /* Test sending an event with app ID to an unregistered application */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "NULL"), CFE_EVS_APP_NOT_REGISTERED); /* Test sending a timed event to an unregistered application */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_SendTimedEvent(time, CFE_EVS_EventType_INFORMATION, 0, "NULL"), CFE_EVS_APP_NOT_REGISTERED); /* Test application cleanup using an unregistered application */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_CleanUpApp(AppID)); /* Re-register the application for subsequent tests */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); } @@ -550,29 +559,29 @@ void Test_FilterRegistration(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; /* Test filter registration using an invalid filter option */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY + 1), CFE_EVS_UNKNOWN_FILTER); /* Test successful filter registration with no filters */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); /* Re-register to test valid unregistration */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); /* Test successful app cleanup */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_CleanUpApp(AppID)); /* Test successful filter registration with a valid filter */ - UT_InitData(); + UT_InitData_EVS(); filter[0].EventID = 0; filter[0].Mask = 0x0001; CFE_UtAssert_SUCCESS(CFE_EVS_Register(filter, 1, CFE_EVS_EventFilter_BINARY)); /* Test successful multiple filter registration with valid filters */ - UT_InitData(); + UT_InitData_EVS(); for (i = 0; i < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1; i++) { @@ -585,19 +594,19 @@ void Test_FilterRegistration(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter = 0; /* Send 1st information message, should get through */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "OK")); UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter, 1); UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)), 1); /* Send 2nd information message, should be filtered */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED")); UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter, 1); UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)), 0); /* Send last information message, which should cause filtering to lock */ - UT_InitData(); + UT_InitData_EVS(); FilterPtr = EVS_FindEventID(0, (EVS_BinFilter_t *)AppDataPtr->BinFilters); FilterPtr->Count = CFE_EVS_MAX_FILTER_COUNT - 1; CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "OK")); @@ -606,33 +615,33 @@ void Test_FilterRegistration(void) UtAssert_UINT32_EQ(FilterPtr->Count, CFE_EVS_MAX_FILTER_COUNT); /* Test that filter lock is applied */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED")); UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter, 3); UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)), 0); UtAssert_UINT32_EQ(FilterPtr->Count, CFE_EVS_MAX_FILTER_COUNT); /* Test that filter lock is (still) applied */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "FAILED")); UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter, 3); UtAssert_INT32_EQ(UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg)), 0); UtAssert_UINT32_EQ(FilterPtr->Count, CFE_EVS_MAX_FILTER_COUNT); /* Return application to original state: re-register application */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); /* Test sending an event with app ID to a registered, filtered * application */ - UT_InitData(); + UT_InitData_EVS(); AppDataPtr->AppID = AppID; AppDataPtr->ActiveFlag = false; CFE_UtAssert_SUCCESS(CFE_EVS_SendEventWithAppID(0, CFE_EVS_EventType_INFORMATION, AppID, "NULL")); /* Test sending a timed event to a registered, filtered application */ - UT_InitData(); + UT_InitData_EVS(); AppDataPtr->AppID = AppID; AppDataPtr->ActiveFlag = false; CFE_UtAssert_SUCCESS(CFE_EVS_SendTimedEvent(time, CFE_EVS_EventType_INFORMATION, 0, "NULL")); @@ -648,29 +657,29 @@ void Test_FilterReset(void) UtPrintf("Begin Test Filter Reset"); /* Test successful filter registration */ - UT_InitData(); + UT_InitData_EVS(); filter.EventID = 1; filter.Mask = 0x0001; CFE_UtAssert_SUCCESS(CFE_EVS_Register(&filter, 1, CFE_EVS_EventFilter_BINARY)); /* Test filter reset using an invalid event ID */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_ResetFilter(CFE_PLATFORM_EVS_MAX_EVENT_FILTERS + 1), CFE_EVS_EVT_NOT_REGISTERED); /* Test filter reset using an unregistered event ID */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_ResetFilter(-1)); /* Test successful filter reset */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_ResetFilter(1)); /* Test successful reset of all filters */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_ResetAllFilters()); /* Return application to original state: re-register application */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); } @@ -713,7 +722,7 @@ void Test_Format(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; /* Enable DEBUG message output */ - UT_InitData(); + UT_InitData_EVS(); strncpy(appbitcmd.Payload.AppName, "ut_cfe_evs", sizeof(appbitcmd.Payload.AppName) - 1); appbitcmd.Payload.AppName[sizeof(appbitcmd.Payload.AppName) - 1] = '\0'; modecmd.Payload.MsgFormat = CFE_EVS_MsgFormat_LONG; @@ -723,7 +732,7 @@ void Test_Format(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Test set event format mode command using an invalid mode */ - UT_InitData(); + UT_InitData_EVS(); modecmd.Payload.MsgFormat = 0xff; UT_EVS_DoDispatchCheckEvents(&modecmd, sizeof(modecmd), UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, &UT_EVS_EventBuf); @@ -732,14 +741,14 @@ void Test_Format(void) /* Test set event format mode command using a valid command to set short * format, reports implicitly via event */ - UT_InitData(); + UT_InitData_EVS(); modecmd.Payload.MsgFormat = CFE_EVS_MsgFormat_SHORT; UT_EVS_DoDispatchCheckEventsShort(&modecmd, sizeof(modecmd), UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_SETEVTFMTMOD_EID); UtPrintf("Test for short event sent when configured to do so "); - UT_InitData(); + UT_InitData_EVS(); UT_SetHookFunction(UT_KEY(CFE_MSG_Init), UT_EVS_MSGInitHook, &MsgData); UT_SetDataBuffer(UT_KEY(CFE_SB_TransmitMsg), &MsgSend, sizeof(MsgSend), false); CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Short format check 1"); @@ -756,7 +765,7 @@ void Test_Format(void) /* Test set event format mode command using a valid command to set long * format, reports implicitly via event */ - UT_InitData(); + UT_InitData_EVS(); modecmd.Payload.MsgFormat = CFE_EVS_MsgFormat_LONG; UT_EVS_DoDispatchCheckEvents(&modecmd, sizeof(modecmd), UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, &UT_EVS_EventBuf); @@ -765,7 +774,7 @@ void Test_Format(void) /* Test event long format mode command was successful (the following * messages are output if long format selection is successful) */ - UT_InitData(); + UT_InitData_EVS(); memset(&CapturedMsg, 0xFF, sizeof(CapturedMsg)); UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LongFmtSnapshotData); CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Long format check (SendEvent)"); @@ -782,7 +791,7 @@ void Test_Format(void) /* Test sending an event using a string length greater than * the maximum allowed */ - UT_InitData(); + UT_InitData_EVS(); for (i = 0; i <= CFE_MISSION_EVS_MAX_MESSAGE_LENGTH; i++) { @@ -824,84 +833,77 @@ void Test_Ports(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; /* Test enabling all ports; reports implicitly via port output */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAPORT_EID); /* Test that ports are enabled by sending a message */ - UT_InitData(); + UT_InitData_EVS(); UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &LocalSnapshotData); - UtAssert_UINT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Test ports message"), CFE_SUCCESS); - UtAssert_UINT32_EQ(LocalSnapshotData.Count, 1); - UtAssert_STUB_COUNT(CFE_TIME_Print, 0); - - /* Test with time included */ - UT_InitData(); - CFE_EVS_Global.IncludeTimeInPortSend = true; UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgTime), &PacketTime, sizeof(PacketTime), false); UtAssert_UINT32_EQ(CFE_EVS_SendEvent(0, CFE_EVS_EventType_INFORMATION, "Test ports message"), CFE_SUCCESS); + UtAssert_UINT32_EQ(LocalSnapshotData.Count, 1); UtAssert_STUB_COUNT(CFE_TIME_Print, 1); - CFE_EVS_Global.IncludeTimeInPortSend = false; /* Do generic testing without time in port message */ /* Disable all ports to cut down on unneeded output */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT | CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DISPORT_EID); /* Test enabling a port using a bitmask that is out of range (high) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test disabling a port using a bitmask that is out of range */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling a port using a bitmask that is out of range (low) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling a port 1 and 2, but not 3 and 4 (branch path coverage) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAPORT_EID); /* Test enabling a port 3 and 4, but not 1 and 2 (branch path coverage) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAPORT_EID); /* Test disabling a port using a bitmask that is out of range (low) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test disabling a port 1 and 2, but not 3 and 4 (branch path coverage) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT1_BIT | CFE_EVS_PORT2_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DISPORT_EID); /* Test disabling a port 3 and 4, but not 1 and 2 (branch path coverage) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_PORT3_BIT | CFE_EVS_PORT4_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); @@ -932,7 +934,7 @@ void Test_Logging(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; /* Initialize */ - UT_InitData(); + UT_InitData_EVS(); memset(&CmdBuf, 0, sizeof(CmdBuf)); /* Enable logging and set conditions to allow complete code coverage */ @@ -945,21 +947,21 @@ void Test_Logging(void) CFE_EVS_Global.EVS_LogPtr = &CFE_EVS_ResetDataPtr->EVS_Log; /* Test setting the logging mode using an invalid mode */ - UT_InitData(); + UT_InitData_EVS(); CmdBuf.modecmd.Payload.LogMode = 0xff; UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_LOGMODE_EID); /* Test setting the logging mode to discard */ - UT_InitData(); + UT_InitData_EVS(); CmdBuf.modecmd.Payload.LogMode = CFE_EVS_LogMode_DISCARD; UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LOGMODE_EID); /* Test overfilling the log in discard mode */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_VOIDCALL(EVS_ClearLog()); /* Ensure log is filled, then add one more, implicitly testing @@ -977,7 +979,7 @@ void Test_Logging(void) UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter, LogOverflowCounterExpected); /* Test setting the logging mode to overwrite */ - UT_InitData(); + UT_InitData_EVS(); CmdBuf.modecmd.Payload.LogMode = CFE_EVS_LogMode_OVERWRITE; UT_EVS_DoDispatchCheckEvents(&CmdBuf.modecmd, sizeof(CmdBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); @@ -988,14 +990,14 @@ void Test_Logging(void) UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter, LogOverflowCounterExpected); /* Test sending a no op command */ - UT_InitData(); + UT_InitData_EVS(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_EVS_DoDispatchCheckEvents(&CmdBuf.noopcmd, sizeof(CmdBuf.noopcmd), UT_TPID_CFE_EVS_CMD_NOOP_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_NOOP_EID); /* Clear log for next test */ - UT_InitData(); + UT_InitData_EVS(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; UT_EVS_DoDispatchCheckEvents(&CmdBuf.clearlogcmd, sizeof(CmdBuf.clearlogcmd), UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC, &UT_EVS_EventBuf); @@ -1003,7 +1005,7 @@ void Test_Logging(void) UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_LogPtr->LogOverflowCounter, 0); /* Test setting the logging mode to overwrite */ - UT_InitData(); + UT_InitData_EVS(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetSizeofESResetArea(sizeof(CFE_ES_ResetData_t)); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); @@ -1017,31 +1019,31 @@ void Test_Logging(void) /* Test successfully writing a single event log entry using the default * log name */ - UT_InitData(); + UT_InitData_EVS(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); CmdBuf.logfilecmd.Payload.LogFilename[0] = '\0'; CFE_UtAssert_SUCCESS(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd)); /* Test writing a log entry with a file name failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UtAssert_INT32_EQ(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd), CFE_FS_INVALID_PATH); /* Test writing a log entry with a create failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UtAssert_INT32_EQ(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Test successfully writing all log entries */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); CFE_EVS_Global.EVS_LogPtr->LogCount = CFE_PLATFORM_EVS_LOG_MAX; CFE_UtAssert_SUCCESS(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd)); /* Test writing a log entry with a write failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); CFE_EVS_Global.EVS_LogPtr->LogCount = CFE_PLATFORM_EVS_LOG_MAX; @@ -1050,7 +1052,7 @@ void Test_Logging(void) /* Test successfully writing a single event log entry using a specified * log name */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS); strncpy(CmdBuf.logfilecmd.Payload.LogFilename, "LogFile", sizeof(CmdBuf.logfilecmd.Payload.LogFilename) - 1); CmdBuf.logfilecmd.Payload.LogFilename[sizeof(CmdBuf.logfilecmd.Payload.LogFilename) - 1] = '\0'; @@ -1059,7 +1061,7 @@ void Test_Logging(void) /* Test successfully writing a single event log entry with a failure * writing the header */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, sizeof(CFE_FS_Header_t) + 1); CmdBuf.logfilecmd.Payload.LogFilename[0] = '\0'; UtAssert_INT32_EQ(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd), CFE_EVS_FILE_WRITE_ERROR); @@ -1082,7 +1084,7 @@ void Test_WriteApp(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; /* Enable DEBUG message output */ - UT_InitData(); + UT_InitData_EVS(); memset(&CmdBuf, 0, sizeof(CmdBuf)); strncpy(CmdBuf.appbitcmd.Payload.AppName, "ut_cfe_evs", sizeof(CmdBuf.appbitcmd.Payload.AppName) - 1); CmdBuf.appbitcmd.Payload.AppName[sizeof(CmdBuf.appbitcmd.Payload.AppName) - 1] = '\0'; @@ -1093,7 +1095,7 @@ void Test_WriteApp(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Test resetting counters */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&CmdBuf.ResetCountersCmd, sizeof(CmdBuf.ResetCountersCmd), UT_TPID_CFE_EVS_CMD_RESET_COUNTERS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTCNT_EID); @@ -1101,7 +1103,7 @@ void Test_WriteApp(void) /* Test writing application data with a create failure using default * file name */ - UT_InitData(); + UT_InitData_EVS(); strncpy(CmdBuf.AppDataCmd.Payload.AppDataFilename, "ut_cfe_evs", sizeof(CmdBuf.AppDataCmd.Payload.AppDataFilename) - 1); CmdBuf.AppDataCmd.Payload.AppDataFilename[sizeof(CmdBuf.AppDataCmd.Payload.AppDataFilename) - 1] = '\0'; @@ -1111,14 +1113,14 @@ void Test_WriteApp(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_CRDATFILE_EID); /* Test writing application data with bad file name */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_CRDATFILE_EID); /* Test writing application data with a write/close failure */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_close), OS_ERROR); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), @@ -1126,7 +1128,7 @@ void Test_WriteApp(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_WRDATFILE_EID); /* Test successfully writing application data */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&CmdBuf.AppDataCmd, sizeof(CmdBuf.AppDataCmd), UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_WRDAT_EID); @@ -1134,7 +1136,7 @@ void Test_WriteApp(void) /* Test writing application data with a create failure using specified * file name */ - UT_InitData(); + UT_InitData_EVS(); strncpy(CmdBuf.AppDataCmd.Payload.AppDataFilename, "AppDataFileName", sizeof(CmdBuf.AppDataCmd.Payload.AppDataFilename) - 1); CmdBuf.AppDataCmd.Payload.AppDataFilename[sizeof(CmdBuf.AppDataCmd.Payload.AppDataFilename) - 1] = '\0'; @@ -1144,7 +1146,7 @@ void Test_WriteApp(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_CRDATFILE_EID); /* Test writing application data with a failure writing the header */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, sizeof(CFE_FS_Header_t) + 1); CmdBuf.AppDataCmd.Payload.AppDataFilename[0] = '\0'; UtAssert_INT32_EQ(CFE_EVS_WriteAppDataFileCmd(&CmdBuf.AppDataCmd), CFE_EVS_FILE_WRITE_ERROR); @@ -1165,7 +1167,7 @@ void Test_BadAppCmd(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; - UT_InitData(); + UT_InitData_EVS(); /* Set up event and mask */ appbitcmd.Payload.BitMask = 0; @@ -1189,21 +1191,21 @@ void Test_BadAppCmd(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test enabling application event types with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test disabling application events with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test enabling application events with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); @@ -1212,47 +1214,47 @@ void Test_BadAppCmd(void) /* Test resetting the application event counter with an unknown * application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test modifying event filters with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test deleting event filters with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test setting the event filter mask with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test resetting the filter with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test resetting all filters with an unknown application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDefaultReturnValue(UT_KEY(CFE_ES_GetAppIDByName), CFE_ES_ERR_NAME_NOT_FOUND); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_NOAPPIDFOUND_EID); /* Test disabling application event types with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); strncpy(appbitcmd.Payload.AppName, "illegal_id", sizeof(appbitcmd.Payload.AppName) - 1); appbitcmd.Payload.AppName[sizeof(appbitcmd.Payload.AppName) - 1] = '\0'; strncpy(appnamecmd.Payload.AppName, "illegal_id", sizeof(appnamecmd.Payload.AppName) - 1); @@ -1272,21 +1274,21 @@ void Test_BadAppCmd(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test enabling application event types with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test disabling application events with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test enabling application events with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); @@ -1295,40 +1297,40 @@ void Test_BadAppCmd(void) /* Test resetting the application event counter with an illegal * application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test adding the event filter with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test deleting the event filter with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test setting the filter mask with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test resetting the filter with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_ILLAPPIDRANGE_EID); /* Test resetting all filters with an illegal application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_AppID_ToIndex), 1, CFE_ES_ERR_RESOURCEID_NOT_VALID); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); @@ -1337,7 +1339,7 @@ void Test_BadAppCmd(void) /* Test disabling application event types with an unregistered * application ID */ - UT_InitData(); + UT_InitData_EVS(); TestAppIndex = 2; UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); strncpy(appbitcmd.Payload.AppName, "unregistered_app", sizeof(appbitcmd.Payload.AppName) - 1); @@ -1355,21 +1357,21 @@ void Test_BadAppCmd(void) /* Test enabling application event types with an unregistered * application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test disabling application events with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test enabling application events with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); @@ -1378,40 +1380,40 @@ void Test_BadAppCmd(void) /* Test resetting the application event counter with an unregistered * application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test adding the event filter with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test deleting the event filter with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test setting the filter mask with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test resetting the filter with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_APPNOREGS_EID); /* Test resetting all filters with an unregistered application ID */ - UT_InitData(); + UT_InitData_EVS(); UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &TestAppIndex, sizeof(TestAppIndex), false); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); @@ -1435,7 +1437,7 @@ void Test_EventCmd(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; - UT_InitData(); + UT_InitData_EVS(); /* Run the next series of tests with valid, registered application name */ strncpy(appbitcmd.Payload.AppName, "ut_cfe_evs", sizeof(appbitcmd.Payload.AppName) - 1); @@ -1465,7 +1467,7 @@ void Test_EventCmd(void) UtAssert_ZERO(EventCount[3]); /* Test enabling of all events */ - UT_InitData(); + UT_InitData_EVS(); LocalSnapshotData.Count = 0; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1485,7 +1487,7 @@ void Test_EventCmd(void) UtAssert_UINT32_EQ(EventCount[3], 4); /* Test disabling event type using an illegal type */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1493,51 +1495,51 @@ void Test_EventCmd(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling event type using an illegal type */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test successful disabling of application events */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, 0xFFFF); /* Test successful enabling of application events */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVT_EID); /* Test disabling event types (leave debug enabled) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DISEVTTYPE_EID); /* Test enabling all event types (debug already enabled) */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAEVTTYPE_EID); /* Test successfully resetting the application event counter */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTEVTCNT_EID); /* Test disabling an event type using an out of range bit mask (high) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling an event type using an out of range bit mask (high) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1546,7 +1548,7 @@ void Test_EventCmd(void) /* Test disabling an application event type using an out of * range bit mask (high) */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1555,21 +1557,21 @@ void Test_EventCmd(void) /* Test enabling an application event type using an out of * range bit mask (high) */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = 0xff; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test disabling an event type using an out of range bit mask (low) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_INVALID_BITMASK_EID); /* Test enabling an event type using an out of range bit mask (low) */ - UT_InitData(); + UT_InitData_EVS(); bitmaskcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&bitmaskcmd, sizeof(bitmaskcmd), UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1578,7 +1580,7 @@ void Test_EventCmd(void) /* Test disabling an application event type using an out of * range bit mask (low) */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1587,7 +1589,7 @@ void Test_EventCmd(void) /* Test enabling an application event type using an out of * range bit mask (low) */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = 0x0; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); @@ -1609,7 +1611,7 @@ void Test_FilterCmd(void) CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; - UT_InitData(); + UT_InitData_EVS(); /* Set up event and mask */ appmaskcmd.Payload.Mask = 0; @@ -1633,7 +1635,7 @@ void Test_FilterCmd(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Ensure there is no filter for the next tests */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_EVTIDNOREGS_EID); @@ -1641,25 +1643,25 @@ void Test_FilterCmd(void) /* Test setting a filter with an application that is not registered * for filtering */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_EVTIDNOREGS_EID); /* Test resetting a filter with an application that is not registered * for filtering */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_EVTIDNOREGS_EID); /* Test resetting all filters */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTALLFILTER_EID); /* Test successfully adding an event filter */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ADDFILTER_EID); @@ -1667,35 +1669,35 @@ void Test_FilterCmd(void) /* Test adding an event filter to an event already registered * for filtering */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_EVT_FILTERED_EID); /* Test successfully setting a filter mask */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_SETFILTERMSK_EID); /* Test successfully resetting a filter mask */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTFILTER_EID); /* Test successfully resetting all filters */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appnamecmd, sizeof(appnamecmd), UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_RSTALLFILTER_EID); /* Test successfully deleting an event filter */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DELFILTER_EID); /* Test filling the event filters */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_EventBuf.Count = 0; for (i = 0; i < CFE_PLATFORM_EVS_MAX_EVENT_FILTERS; i++) @@ -1709,43 +1711,43 @@ void Test_FilterCmd(void) UtAssert_UINT32_EQ(UT_EVS_EventBuf.Count, CFE_PLATFORM_EVS_MAX_EVENT_FILTERS); /* Test overfilling the event filters */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_MAXREGSFILTER_EID); /* Return application to original state, re-register application */ - UT_InitData(); + UT_InitData_EVS(); appmaskcmd.Payload.EventID = 0; CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); /* Enable all application event message output */ - UT_InitData(); + UT_InitData_EVS(); appbitcmd.Payload.BitMask = CFE_EVS_DEBUG_BIT | CFE_EVS_INFORMATION_BIT | CFE_EVS_ERROR_BIT | CFE_EVS_CRITICAL_BIT; UT_EVS_DoDispatchCheckEvents(&appbitcmd, sizeof(appbitcmd), UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ENAAPPEVTTYPE_EID); /* Set-up to test filtering the same event twice */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ADDFILTER_EID); /* Test filtering the same event again */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appmaskcmd, sizeof(appmaskcmd), UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_EVT_FILTERED_EID); /* Test successful event filter deletion */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&appcmdcmd, sizeof(appcmdcmd), UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_DELFILTER_EID); /* Return application to original state, re-register application */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY)); } @@ -1761,122 +1763,122 @@ void Test_InvalidCmd(void) UtPrintf("Begin Test Invalid Command"); /* Test invalid msg id event */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, sizeof(cmd), UT_TPID_CFE_EVS_INVALID_MID, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_MSGID_EID); /* Test invalid command code event */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, sizeof(cmd), UT_TPID_CFE_EVS_CMD_INVALID_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_ERR_CC_EID); /* Test invalid command length event */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_NOOP_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with reset counters command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_COUNTERS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with enable event type command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with disable event type command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with set event format mode command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with enable application event * type command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with disable application event * type command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with enable application events command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with disable application events command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with reset application counter command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with set filter command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_SET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with enable ports command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with disable ports command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with reset filter command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with reset all filters command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with add event filter command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with delete event filter command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with write application data command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with write log data command */ - UT_InitData(); + UT_InitData_EVS(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_WRITE_LOG_DATA_FILE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with set log mode command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); /* Test invalid command length with clear log command */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC, &UT_EVS_EventBuf); UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID); } @@ -1902,7 +1904,7 @@ void Test_Squelching(void) UtPrintf("Begin Test Squelching"); - UT_InitData(); + UT_InitData_EVS(); UT_EVS_ResetSquelch(); CFE_EVS_Global.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG; @@ -2037,7 +2039,7 @@ void Test_Misc(void) */ /* Test successful log data file write */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&PktBuf.writelogdatacmd, sizeof(PktBuf.writelogdatacmd), UT_TPID_CFE_EVS_CMD_WRITE_LOG_DATA_FILE_CC, &UT_EVS_EventBuf); if (UT_EVS_EventBuf.EventID == 0xFFFF) @@ -2050,7 +2052,7 @@ void Test_Misc(void) } /* Test successfully setting the logging mode */ - UT_InitData(); + UT_InitData_EVS(); UT_EVS_DoDispatchCheckEvents(&PktBuf.modecmd, sizeof(PktBuf.modecmd), UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC, &UT_EVS_EventBuf); if (UT_EVS_EventBuf.EventID == 0xFFFF) @@ -2063,7 +2065,7 @@ void Test_Misc(void) } /* Test housekeeping report with log enabled */ - UT_InitData(); + UT_InitData_EVS(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = true; HK_SnapshotData.Count = 0; UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &HK_SnapshotData); @@ -2071,15 +2073,15 @@ void Test_Misc(void) UtAssert_UINT32_EQ(HK_SnapshotData.Count, 1); /* Test successful application cleanup */ - UT_InitData(); + UT_InitData_EVS(); CFE_UtAssert_SUCCESS(CFE_EVS_CleanUpApp(CFE_ES_APPID_UNDEFINED)); /* Test registering an application with invalid filter argument */ - UT_InitData(); + UT_InitData_EVS(); UtAssert_INT32_EQ(CFE_EVS_Register(NULL, 1, 0), CFE_ES_BAD_ARGUMENT); /* Test housekeeping report with log disabled */ - UT_InitData(); + UT_InitData_EVS(); CFE_EVS_Global.EVS_TlmPkt.Payload.LogEnabled = false; HK_SnapshotData.Count = 0; UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_SoftwareBusSnapshotHook, &HK_SnapshotData); @@ -2089,7 +2091,7 @@ void Test_Misc(void) /* Test sending a packet with the message counter and the event counter * at their maximum allowed values */ - UT_InitData(); + UT_InitData_EVS(); CFE_EVS_Global.EVS_TlmPkt.Payload.MessageSendCounter = CFE_EVS_MAX_EVENT_SEND_COUNT; AppDataPtr->EventCount = CFE_EVS_MAX_EVENT_SEND_COUNT; EVS_SendEvent(0, 0, "Max Event Count"); @@ -2099,7 +2101,7 @@ void Test_Misc(void) /* Test sending a message with the message length greater than the * maximum allowed value */ - UT_InitData(); + UT_InitData_EVS(); for (i = 0; i <= CFE_MISSION_EVS_MAX_MESSAGE_LENGTH; i++) { @@ -2115,7 +2117,7 @@ void Test_Misc(void) UtAssert_UINT32_EQ(CFE_EVS_Global.EVS_TlmPkt.Payload.MessageTruncCounter, 1); /* Use all AppData and report housekeeping to get branch coverage */ - UT_InitData(); + UT_InitData_EVS(); for (i = 0; i < sizeof(CFE_EVS_Global.AppData) / sizeof(CFE_EVS_Global.AppData[0]); i++) { /* Doesn't matter here that AppID is all the same... */ From 75ecb39cd047266674bc090ea12c1d6001f76db8 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 27 Apr 2023 15:19:25 -0400 Subject: [PATCH 5/6] Fix #2311, correct fallback file case Only include the "FALLBACK_FILE" if the normal search came up empty. Do not return a list containing the fallback/default along with the user-supplied files, only return the user-supplied files. This was an issue when using "ALLOW_LIST" in that it had both. --- cmake/global_functions.cmake | 27 +++++++++++++++------------ modules/core_api/mission_build.cmake | 4 ++-- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/cmake/global_functions.cmake b/cmake/global_functions.cmake index ba68c447e..46396be1f 100644 --- a/cmake/global_functions.cmake +++ b/cmake/global_functions.cmake @@ -28,14 +28,17 @@ function(cfe_locate_implementation_file OUTPUT_VAR FILE_NAME) cmake_parse_arguments(LOCATEIMPL_ARG "OPTIONAL;ALLOW_LIST" "FALLBACK_FILE" "PREFIX;SUBDIR" ${ARGN}) - # Always check for filename matches directly in the MISSION_DEFS dir - set(IMPL_SEARCH_BASEDIRS "${MISSION_DEFS}/") + set(IMPL_SEARCH_BASEDIRS) # The prefix could also be a subdir, but do not repeat the mission name foreach (PREFIX ${LOCATEIMPL_ARG_PREFIX}) if (NOT "${MISSIONCONFIG}" STREQUAL "${PREFIX}") list(APPEND IMPL_SEARCH_BASEDIRS "${MISSION_DEFS}/${PREFIX}/") endif() endforeach() + # Always check for filename matches directly in the MISSION_DEFS dir + list(APPEND IMPL_SEARCH_BASEDIRS "${MISSION_DEFS}/") + list(REVERSE IMPL_SEARCH_BASEDIRS) + set(ADD_SUBDIRS) foreach (SUBDIR ${LOCATEIMPL_ARG_SUBDIR}) foreach (BASEDIR ${IMPL_SEARCH_BASEDIRS}) @@ -43,17 +46,10 @@ function(cfe_locate_implementation_file OUTPUT_VAR FILE_NAME) endforeach() endforeach() list(APPEND IMPL_SEARCH_BASEDIRS ${ADD_SUBDIRS}) + list(REMOVE_DUPLICATES IMPL_SEARCH_BASEDIRS) # Build the list of possible locations for this file in REVERSE priority order set(IMPL_SEARCH_PATH) - if (LOCATEIMPL_ARG_FALLBACK_FILE) - if (IS_ABSOLUTE "${LOCATEIMPL_ARG_FALLBACK_FILE}") - list(APPEND IMPL_SEARCH_PATH "${LOCATEIMPL_ARG_FALLBACK_FILE}") - else() - list(APPEND IMPL_SEARCH_PATH "${CMAKE_CURRENT_LIST_DIR}/${LOCATEIMPL_ARG_FALLBACK_FILE}") - endif() - endif() - # Check for the existence of the file in each of the dirs foreach(BASEDIR ${IMPL_SEARCH_BASEDIRS}) list(APPEND IMPL_SEARCH_PATH "${BASEDIR}${FILE_NAME}") @@ -74,6 +70,14 @@ function(cfe_locate_implementation_file OUTPUT_VAR FILE_NAME) endif() endforeach() + if (NOT SELECTED_FILE AND LOCATEIMPL_ARG_FALLBACK_FILE) + if (IS_ABSOLUTE "${LOCATEIMPL_ARG_FALLBACK_FILE}") + set(SELECTED_FILE "${LOCATEIMPL_ARG_FALLBACK_FILE}") + else() + set(SELECTED_FILE "${CMAKE_CURRENT_LIST_DIR}/${LOCATEIMPL_ARG_FALLBACK_FILE}") + endif() + endif() + if (SELECTED_FILE) message(STATUS "Using file: ${SELECTED_FILE} for ${FILE_NAME}") elseif(NOT LOCATEIMPL_ARG_OPTIONAL) @@ -156,7 +160,7 @@ function(generate_config_includefile) set(GENCONFIG_ARG_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/inc") endif (NOT GENCONFIG_ARG_OUTPUT_DIRECTORY) - if (IS_CFS_ARCH_BUILD) + if (IS_CFS_ARCH_BUILD AND NOT GENCONFIG_ARG_PREFIXES) set(ARCH_PREFIXES ${BUILD_CONFIG}) else() set(ARCH_PREFIXES) @@ -176,7 +180,6 @@ function(generate_config_includefile) else() # Use the common search function to find the candidate(s) cfe_locate_implementation_file(SRC_LOCAL_PATH_LIST "${TGTFILE}" - ALLOW_LIST FALLBACK_FILE "${GENCONFIG_ARG_FALLBACK_FILE}" PREFIX ${GENCONFIG_ARG_PREFIXES} ${ARCH_PREFIXES} SUBDIR config diff --git a/modules/core_api/mission_build.cmake b/modules/core_api/mission_build.cmake index 34eff598a..6bc99b88b 100644 --- a/modules/core_api/mission_build.cmake +++ b/modules/core_api/mission_build.cmake @@ -13,12 +13,12 @@ generate_config_includefile( FILE_NAME "cfe_mission_cfg.h" MATCH_SUFFIX "mission_cfg.h" - PREFIXES ${MISSIONCONFIG} + PREFIXES ${MISSIONCONFIG} cfe ) generate_config_includefile( FILE_NAME "cfe_perfids.h" MATCH_SUFFIX "perfids.h" - PREFIXES ${MISSIONCONFIG} + PREFIXES ${MISSIONCONFIG} cfe ) From 78333d3796027357d11ef6a5bdf767f34fcc3fcf Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 28 Apr 2023 08:57:16 -0400 Subject: [PATCH 6/6] Bump to v7.0.0-rc4+dev287 --- CHANGELOG.md | 7 +++++++ modules/core_api/fsw/inc/cfe_version.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3fad7bc5..8e5f5e828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Development Build: v7.0.0-rc4+dev287 +- document CFS component file naming +- Add EVS port timestamp and simplify port selection +- remove else statement that was unreachable by unit tests +- correct fallback file case +- See , , , and + ## Development Build: v7.0.0-rc4+dev276 - improve add_cfe_tables function - add option to link to generated files diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index 59f771ed3..d00df42b9 100644 --- a/modules/core_api/fsw/inc/cfe_version.h +++ b/modules/core_api/fsw/inc/cfe_version.h @@ -26,7 +26,7 @@ #define CFE_VERSION_H /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 276 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */ +#define CFE_BUILD_NUMBER 287 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */ #define CFE_BUILD_BASELINE "v7.0.0-rc4" /**< @brief Development: Reference git tag for build number */ /* See \ref cfsversions for definitions */