Skip to content

Commit

Permalink
Fix nasa#2475, rename 1HZ to ONEHZ in symbols
Browse files Browse the repository at this point in the history
This avoids having an identifier that starts with a digit
in the case that the CFE_TIME_ prefix is not needed/used.
  • Loading branch information
jphickey committed Dec 7, 2023
1 parent b588fc1 commit f065423
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 38 deletions.
5 changes: 2 additions & 3 deletions cmake/sample_defs/example_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,7 @@
*/
#define CFE_PLATFORM_TIME_START_TASK_PRIORITY 60
#define CFE_PLATFORM_TIME_TONE_TASK_PRIORITY 25
#define CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY 25
#define CFE_PLATFORM_TIME_ONEHZ_TASK_PRIORITY 25

/**
** \cfetimecfg Define TIME Task Stack Sizes
Expand All @@ -1744,7 +1744,6 @@
*/
#define CFE_PLATFORM_TIME_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE
#define CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE 4096
#define CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE 8192
#define CFE_PLATFORM_TIME_ONEHZ_TASK_STACK_SIZE 8192

#endif /* EXAMPLE_PLATFORM_CFG_H */

8 changes: 4 additions & 4 deletions modules/time/config/default_cfe_time_fcncodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -584,13 +584,13 @@
** - \b \c \TIME_CMDPC - command execution counter will increment
** - \b \c \TIME_STCFSECS - Housekeeping Telemetry point indicating new STCF seconds value
** - \b \c \TIME_STCFSUBSECS - Housekeeping Telemetry point indicating new STCF subseconds value
** - The #CFE_TIME_1HZ_EID informational event message will be generated
** - The #CFE_TIME_ONEHZ_EID informational event message will be generated
**
** \par Error Conditions
** - Platform receiving the command is not a Time Server
** <BR><BR>Evidence of Failure may be found in the following telemetry:
** - \b \c \TIME_CMDEC - command error counter will increment
** - Error specific event message will be issued (#CFE_TIME_1HZ_CFG_EID)
** - Error specific event message will be issued (#CFE_TIME_ONEHZ_CFG_EID)
**
** \par Criticality
** Inappropriately setting the clock may result in other sub-systems performing incorrect
Expand Down Expand Up @@ -632,13 +632,13 @@
** - \b \c \TIME_CMDPC - command execution counter will increment
** - \b \c \TIME_STCFSECS - Housekeeping Telemetry point indicating new STCF seconds value
** - \b \c \TIME_STCFSUBSECS - Housekeeping Telemetry point indicating new STCF subseconds value
** - The #CFE_TIME_1HZ_EID informational event message will be generated
** - The #CFE_TIME_ONEHZ_EID informational event message will be generated
**
** \par Error Conditions
** - Platform receiving the command is not a Time Server
** <BR><BR>Evidence of Failure may be found in the following telemetry:
** - \b \c \TIME_CMDEC - command error counter will increment
** - Error specific event message will be issued (#CFE_TIME_1HZ_CFG_EID)
** - Error specific event message will be issued (#CFE_TIME_ONEHZ_CFG_EID)
**
** \par Criticality
** Inappropriately setting the clock may result in other sub-systems performing incorrect
Expand Down
4 changes: 2 additions & 2 deletions modules/time/config/default_cfe_time_internal_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
*/
#define CFE_PLATFORM_TIME_START_TASK_PRIORITY 60
#define CFE_PLATFORM_TIME_TONE_TASK_PRIORITY 25
#define CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY 25
#define CFE_PLATFORM_TIME_ONEHZ_TASK_PRIORITY 25

/**
** \cfetimecfg Define TIME Task Stack Sizes
Expand All @@ -238,6 +238,6 @@
*/
#define CFE_PLATFORM_TIME_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE
#define CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE 4096
#define CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE 8192
#define CFE_PLATFORM_TIME_ONEHZ_TASK_STACK_SIZE 8192

#endif
11 changes: 10 additions & 1 deletion modules/time/config/default_cfe_time_msgids.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define CFE_TIME_CMD_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_TIME_CMD_TOPICID) /* 0x1805 */
#define CFE_TIME_SEND_HK_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_TIME_SEND_HK_TOPICID) /* 0x180D */
#define CFE_TIME_TONE_CMD_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_TIME_TONE_CMD_TOPICID) /* 0x1810 */
#define CFE_TIME_1HZ_CMD_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_TIME_1HZ_CMD_TOPICID) /* 0x1811 */
#define CFE_TIME_ONEHZ_CMD_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_TIME_ONEHZ_CMD_TOPICID) /* 0x1811 */

/*
** cFE Global Command Message Id's
Expand All @@ -46,4 +46,13 @@
#define CFE_TIME_HK_TLM_MID CFE_PLATFORM_TLM_TOPICID_TO_MIDV(CFE_MISSION_TIME_HK_TLM_TOPICID) /* 0x0805 */
#define CFE_TIME_DIAG_TLM_MID CFE_PLATFORM_TLM_TOPICID_TO_MIDV(CFE_MISSION_TIME_DIAG_TLM_TOPICID) /* 0x0806 */

#ifndef CFE_OMIT_DEPRECATED
/*
* This name was changed/deprecated because technically it constitutes an
* identifier that starts with a digit (1) when the CFE_TIME_ namespace
* qualifier is removed. This matters in some circumstances.
*/
#define CFE_TIME_1HZ_CMD_MID CFE_TIME_ONEHZ_CMD_MID
#endif

#endif
2 changes: 1 addition & 1 deletion modules/time/config/default_cfe_time_topicids.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#define CFE_MISSION_TIME_CMD_TOPICID 5
#define CFE_MISSION_TIME_SEND_HK_TOPICID 13
#define CFE_MISSION_TIME_TONE_CMD_TOPICID 16
#define CFE_MISSION_TIME_1HZ_CMD_TOPICID 17
#define CFE_MISSION_TIME_ONEHZ_CMD_TOPICID 17

/**
** \cfemissioncfg cFE Portable Message Numbers for Global Messages
Expand Down
8 changes: 4 additions & 4 deletions modules/time/eds/cfe_time.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1126,14 +1126,14 @@
- \b \c \TIME_CMDPC - command execution counter will increment
- \b \c \TIME_STCFSECS - Housekeeping Telemetry point indicating new STCF seconds value
- \b \c \TIME_STCFSUBSECS - Housekeeping Telemetry point indicating new STCF subseconds value
- The #CFE_TIME_1HZ_EID informational event message will be generated
- The #CFE_TIME_ONEHZ_EID informational event message will be generated

\par Error Conditions
- Platform receiving the command is not a Time Server

Evidence of Failure may be found in the following telemetry:
- \b \c \TIME_CMDEC - command error counter will increment
- Error specific event message will be issued (#CFE_TIME_1HZ_CFG_EID)
- Error specific event message will be issued (#CFE_TIME_ONEHZ_CFG_EID)

\par Criticality
Inappropriately setting the clock may result in other sub-systems performing incorrect
Expand Down Expand Up @@ -1182,14 +1182,14 @@
- \b \c \TIME_CMDPC - command execution counter will increment
- \b \c \TIME_STCFSECS - Housekeeping Telemetry point indicating new STCF seconds value
- \b \c \TIME_STCFSUBSECS - Housekeeping Telemetry point indicating new STCF subseconds value
- The #CFE_TIME_1HZ_EID informational event message will be generated
- The #CFE_TIME_ONEHZ_EID informational event message will be generated

\par Error Conditions
- Platform receiving the command is not a Time Server

Evidence of Failure may be found in the following telemetry:
- \b \c \TIME_CMDEC - command error counter will increment
- Error specific event message will be issued (#CFE_TIME_1HZ_CFG_EID)
- Error specific event message will be issued (#CFE_TIME_ONEHZ_CFG_EID)

\par Criticality
Inappropriately setting the clock may result in other sub-systems performing incorrect
Expand Down
4 changes: 2 additions & 2 deletions modules/time/fsw/inc/cfe_time_eventids.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
* \link #CFE_TIME_ADD_1HZ_ADJUSTMENT_CC TIME Add STCF Adjustment Each Second Command \endlink OR
* \link #CFE_TIME_SUB_1HZ_ADJUSTMENT_CC TIME Subtract STCF Adjustment Each Second Command \endlink success.
*/
#define CFE_TIME_1HZ_EID 16
#define CFE_TIME_ONEHZ_EID 16

/**
* \brief TIME Set Leap Seconds Command Success Event ID
Expand Down Expand Up @@ -435,7 +435,7 @@
* \link #CFE_TIME_SUB_1HZ_ADJUSTMENT_CC TIME Subtract STCF Adjustment Each Second Command \endlink
* failure due to being in an incompatible mode.
*/
#define CFE_TIME_1HZ_CFG_EID 48
#define CFE_TIME_ONEHZ_CFG_EID 48

/**
* \brief TIME Invalid Command Length Event ID
Expand Down
2 changes: 1 addition & 1 deletion modules/time/fsw/src/cfe_time_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void CFE_TIME_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr)
/*
** Run time state machine at 1Hz...
*/
case CFE_TIME_1HZ_CMD_MID:
case CFE_TIME_ONEHZ_CMD_MID:
CFE_TIME_OneHzCmd((const CFE_TIME_1HzCmd_t *)SBBufPtr);
break;

Expand Down
12 changes: 6 additions & 6 deletions modules/time/fsw/src/cfe_time_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ int32 CFE_TIME_TaskInit(void)
}

Status = CFE_ES_CreateChildTask(&CFE_TIME_Global.LocalTaskID, CFE_TIME_TASK_1HZ_NAME, CFE_TIME_Local1HzTask,
CFE_TIME_TASK_STACK_PTR, CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE,
CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY, CFE_TIME_TASK_FLAGS);
CFE_TIME_TASK_STACK_PTR, CFE_PLATFORM_TIME_ONEHZ_TASK_STACK_SIZE,
CFE_PLATFORM_TIME_ONEHZ_TASK_PRIORITY, CFE_TIME_TASK_FLAGS);
if (Status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("%s: Error creating local 1Hz child task:RC=0x%08X\n", __func__, (unsigned int)Status);
Expand Down Expand Up @@ -221,11 +221,11 @@ int32 CFE_TIME_TaskInit(void)
** Subscribe to 1Hz signal commands...
*/
#if (CFE_PLATFORM_TIME_CFG_CLIENT == true)
Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), CFE_TIME_Global.CmdPipe);
Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_ONEHZ_CMD_MID), CFE_TIME_Global.CmdPipe);
#endif

#if (CFE_PLATFORM_TIME_CFG_SERVER == true)
Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), CFE_TIME_Global.CmdPipe,
Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_ONEHZ_CMD_MID), CFE_TIME_Global.CmdPipe,
CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT);
#endif

Expand Down Expand Up @@ -1051,7 +1051,7 @@ void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr
CFE_TIME_Set1HzAdj(Adjust, Direction);

CFE_TIME_Global.CommandCounter++;
CFE_EVS_SendEvent(CFE_TIME_1HZ_EID, CFE_EVS_EventType_INFORMATION,
CFE_EVS_SendEvent(CFE_TIME_ONEHZ_EID, CFE_EVS_EventType_INFORMATION,
"STCF 1Hz Adjust -- secs = %d, ssecs = 0x%X, dir[1=Pos, 2=Neg] = %d", (int)CommandPtr->Seconds,
(unsigned int)CommandPtr->Subseconds, (int)Direction);

Expand All @@ -1061,7 +1061,7 @@ void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr
*/
CFE_TIME_Global.CommandErrorCounter++;

CFE_EVS_SendEvent(CFE_TIME_1HZ_CFG_EID, CFE_EVS_EventType_ERROR,
CFE_EVS_SendEvent(CFE_TIME_ONEHZ_CFG_EID, CFE_EVS_EventType_ERROR,
"1Hz Adjust commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE");

#endif /* CFE_PLATFORM_TIME_CFG_SERVER */
Expand Down
2 changes: 1 addition & 1 deletion modules/time/fsw/src/cfe_time_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ void CFE_TIME_InitData(void)
/*
** Initialize local 1Hz "wake-up" command packet (optional)...
*/
CFE_MSG_Init(CFE_MSG_PTR(CFE_TIME_Global.Local1HzCmd.CommandHeader), CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID),
CFE_MSG_Init(CFE_MSG_PTR(CFE_TIME_Global.Local1HzCmd.CommandHeader), CFE_SB_ValueToMsgId(CFE_TIME_ONEHZ_CMD_MID),
sizeof(CFE_TIME_Global.Local1HzCmd));
}

Expand Down
4 changes: 2 additions & 2 deletions modules/time/fsw/src/cfe_time_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
** Interrupt task definitions...
*/
#define CFE_TIME_TASK_TONE_NAME "TIME_TONE_TASK"
#define CFE_TIME_TASK_1HZ_NAME "TIME_1HZ_TASK"
#define CFE_TIME_TASK_1HZ_NAME "TIME_ONEHZ_TASK"
#define CFE_TIME_TASK_STACK_PTR CFE_ES_TASK_STACK_ALLOCATE
#define CFE_TIME_TASK_FLAGS 0

/*
** Interrupt semaphore definitions...
*/
#define CFE_TIME_SEM_TONE_NAME "TIME_TONE_SEM"
#define CFE_TIME_SEM_1HZ_NAME "TIME_1HZ_SEM"
#define CFE_TIME_SEM_1HZ_NAME "TIME_ONEHZ_SEM"
#define CFE_TIME_SEM_VALUE 0
#define CFE_TIME_SEM_OPTIONS 0

Expand Down
12 changes: 6 additions & 6 deletions modules/time/fsw/src/cfe_time_verify.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@
#elif CFE_PLATFORM_TIME_TONE_TASK_PRIORITY > 255
#error CFE_PLATFORM_TIME_TONE_TASK_PRIORITY must be less than or equal to 255
#endif
#if CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY < 0
#error CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY must be greater than or equal to zero
#elif CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY > 255
#error CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY must be less than or equal to 255
#if CFE_PLATFORM_TIME_ONEHZ_TASK_PRIORITY < 0
#error CFE_PLATFORM_TIME_ONEHZ_TASK_PRIORITY must be greater than or equal to zero
#elif CFE_PLATFORM_TIME_ONEHZ_TASK_PRIORITY > 255
#error CFE_PLATFORM_TIME_ONEHZ_TASK_PRIORITY must be less than or equal to 255
#endif

/*
Expand All @@ -176,8 +176,8 @@
#error CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE must be greater than or equal to 2048
#endif

#if CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE < 2048
#error CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE must be greater than or equal to 2048
#if CFE_PLATFORM_TIME_ONEHZ_TASK_STACK_SIZE < 2048
#error CFE_PLATFORM_TIME_ONEHZ_TASK_STACK_SIZE must be greater than or equal to 2048
#endif

/*************************************************************************/
Expand Down
10 changes: 5 additions & 5 deletions modules/time/ut-coverage/time_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -1802,11 +1802,11 @@ void Test_PipeCmds(void)
UT_TPID_CFE_TIME_CMD_ADD_1HZ_ADJUSTMENT_CC);

#if (CFE_PLATFORM_TIME_CFG_SERVER == true)
CFE_UtAssert_EVENTSENT(CFE_TIME_1HZ_EID);
CFE_UtAssert_EVENTSENT(CFE_TIME_ONEHZ_EID);
UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1);
UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0);
#else
CFE_UtAssert_EVENTSENT(CFE_TIME_1HZ_CFG_EID);
CFE_UtAssert_EVENTSENT(CFE_TIME_ONEHZ_CFG_EID);
UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0);
UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1);
#endif
Expand All @@ -1830,11 +1830,11 @@ void Test_PipeCmds(void)
UT_TPID_CFE_TIME_CMD_SUB_1HZ_ADJUSTMENT_CC);

#if (CFE_PLATFORM_TIME_CFG_SERVER == true)
CFE_UtAssert_EVENTSENT(CFE_TIME_1HZ_EID);
CFE_UtAssert_EVENTSENT(CFE_TIME_ONEHZ_EID);
UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 1);
UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 0);
#else
CFE_UtAssert_EVENTSENT(CFE_TIME_1HZ_CFG_EID);
CFE_UtAssert_EVENTSENT(CFE_TIME_ONEHZ_CFG_EID);
UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0);
UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1);
#endif
Expand Down Expand Up @@ -1929,7 +1929,7 @@ void Test_PipeCmds(void)
/* In the 1Hz state machine it should call PSP GetTime as part,
of latching the clock. This is tested only to see that the latch executed. */
UT_InitData();
UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.onehzcmd), UT_TPID_CFE_TIME_1HZ_CMD);
UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, sizeof(CmdBuf.onehzcmd), UT_TPID_CFE_TIME_ONEHZ_CMD);
UtAssert_NONZERO(UT_GetStubCount(UT_KEY(CFE_PSP_GetTime)));
}

Expand Down

0 comments on commit f065423

Please sign in to comment.