Skip to content

Commit

Permalink
WIP nasa#1009, compiles and runs, still working SendMsg replacement a…
Browse files Browse the repository at this point in the history
…nd unit tests
  • Loading branch information
skliper committed Nov 17, 2020
1 parent 6c64889 commit 36ce14d
Show file tree
Hide file tree
Showing 25 changed files with 486 additions and 445 deletions.
116 changes: 58 additions & 58 deletions fsw/cfe-core/src/es/cfe_es_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void CFE_ES_TaskMain(void)
{
int32 Status;
uint32 AppRunStatus = CFE_ES_RunStatus_APP_RUN;
CFE_SB_Buffer_t *SBBuffer;
CFE_SB_Buffer_t *SBBufPtr;

/*
** Performance Time Stamp Entry
Expand Down Expand Up @@ -136,7 +136,7 @@ void CFE_ES_TaskMain(void)
/*
** Wait for the next Software Bus message.
*/
Status = CFE_SB_RcvMsg(&SBBuffer, CFE_ES_TaskData.CmdPipe, CFE_SB_PEND_FOREVER);
Status = CFE_SB_RcvMsg(&SBBufPtr, CFE_ES_TaskData.CmdPipe, CFE_SB_PEND_FOREVER);

/*
** Performance Time Stamp Entry
Expand All @@ -148,7 +148,7 @@ void CFE_ES_TaskMain(void)
/*
** Process message.
*/
CFE_ES_TaskPipe(SBBuffer);
CFE_ES_TaskPipe(SBBufPtr);

/*
* Wake up the background task, which includes the
Expand Down Expand Up @@ -432,194 +432,194 @@ int32 CFE_ES_TaskInit(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

void CFE_ES_TaskPipe(CFE_SB_Buffer_t *SBBuffer)
void CFE_ES_TaskPipe(CFE_SB_Buffer_t *SBBufPtr)
{
CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
CFE_MSG_FcnCode_t CommandCode = 0;

CFE_MSG_GetMsgId(&SBBuffer->Msg, &MessageID);
CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID);
switch (CFE_SB_MsgIdToValue(MessageID))
{
/*
** Housekeeping telemetry request
*/
case CFE_ES_SEND_HK_MID:
CFE_ES_HousekeepingCmd((CFE_MSG_CommandHeader_t *)SBBuffer);
CFE_ES_HousekeepingCmd((CFE_MSG_CommandHeader_t *)SBBufPtr);
break;

/*
** ES task ground commands
*/
case CFE_ES_CMD_MID:

CFE_MSG_GetFcnCode(&SBBuffer->Msg, &CommandCode);
CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &CommandCode);
switch (CommandCode)
{
case CFE_ES_NOOP_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_Noop_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_Noop_t)))
{
CFE_ES_NoopCmd((CFE_ES_Noop_t*)SBBuffer);
CFE_ES_NoopCmd((CFE_ES_Noop_t*)SBBufPtr);
}
break;

case CFE_ES_RESET_COUNTERS_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_ResetCounters_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ResetCounters_t)))
{
CFE_ES_ResetCountersCmd((CFE_ES_ResetCounters_t*)SBBuffer);
CFE_ES_ResetCountersCmd((CFE_ES_ResetCounters_t*)SBBufPtr);
}
break;

case CFE_ES_RESTART_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_Restart_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_Restart_t)))
{
CFE_ES_RestartCmd((CFE_ES_Restart_t*)SBBuffer);
CFE_ES_RestartCmd((CFE_ES_Restart_t*)SBBufPtr);
}
break;

case CFE_ES_START_APP_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_StartApp_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StartApp_t)))
{
CFE_ES_StartAppCmd((CFE_ES_StartApp_t*)SBBuffer);
CFE_ES_StartAppCmd((CFE_ES_StartApp_t*)SBBufPtr);
}
break;

case CFE_ES_STOP_APP_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_StopApp_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StopApp_t)))
{
CFE_ES_StopAppCmd((CFE_ES_StopApp_t*)SBBuffer);
CFE_ES_StopAppCmd((CFE_ES_StopApp_t*)SBBufPtr);
}
break;

case CFE_ES_RESTART_APP_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_RestartApp_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_RestartApp_t)))
{
CFE_ES_RestartAppCmd((CFE_ES_RestartApp_t*)SBBuffer);
CFE_ES_RestartAppCmd((CFE_ES_RestartApp_t*)SBBufPtr);
}
break;

case CFE_ES_RELOAD_APP_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_ReloadApp_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ReloadApp_t)))
{
CFE_ES_ReloadAppCmd((CFE_ES_ReloadApp_t*)SBBuffer);
CFE_ES_ReloadAppCmd((CFE_ES_ReloadApp_t*)SBBufPtr);
}
break;

case CFE_ES_QUERY_ONE_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_QueryOne_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryOne_t)))
{
CFE_ES_QueryOneCmd((CFE_ES_QueryOne_t*)SBBuffer);
CFE_ES_QueryOneCmd((CFE_ES_QueryOne_t*)SBBufPtr);
}
break;

case CFE_ES_QUERY_ALL_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_QueryAll_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryAll_t)))
{
CFE_ES_QueryAllCmd((CFE_ES_QueryAll_t*)SBBuffer);
CFE_ES_QueryAllCmd((CFE_ES_QueryAll_t*)SBBufPtr);
}
break;

case CFE_ES_QUERY_ALL_TASKS_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_QueryAllTasks_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryAllTasks_t)))
{
CFE_ES_QueryAllTasksCmd((CFE_ES_QueryAllTasks_t*)SBBuffer);
CFE_ES_QueryAllTasksCmd((CFE_ES_QueryAllTasks_t*)SBBufPtr);
}
break;

case CFE_ES_CLEAR_SYSLOG_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_ClearSyslog_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ClearSyslog_t)))
{
CFE_ES_ClearSyslogCmd((CFE_ES_ClearSyslog_t*)SBBuffer);
CFE_ES_ClearSyslogCmd((CFE_ES_ClearSyslog_t*)SBBufPtr);
}
break;

case CFE_ES_WRITE_SYSLOG_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_WriteSyslog_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_WriteSyslog_t)))
{
CFE_ES_WriteSyslogCmd((CFE_ES_WriteSyslog_t*)SBBuffer);
CFE_ES_WriteSyslogCmd((CFE_ES_WriteSyslog_t*)SBBufPtr);
}
break;

case CFE_ES_OVER_WRITE_SYSLOG_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_OverWriteSyslog_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_OverWriteSyslog_t)))
{
CFE_ES_OverWriteSyslogCmd((CFE_ES_OverWriteSyslog_t*)SBBuffer);
CFE_ES_OverWriteSyslogCmd((CFE_ES_OverWriteSyslog_t*)SBBufPtr);
}
break;

case CFE_ES_CLEAR_ER_LOG_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_ClearERLog_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ClearERLog_t)))
{
CFE_ES_ClearERLogCmd((CFE_ES_ClearERLog_t*)SBBuffer);
CFE_ES_ClearERLogCmd((CFE_ES_ClearERLog_t*)SBBufPtr);
}
break;

case CFE_ES_WRITE_ER_LOG_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_WriteERLog_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_WriteERLog_t)))
{
CFE_ES_WriteERLogCmd((CFE_ES_WriteERLog_t*)SBBuffer);
CFE_ES_WriteERLogCmd((CFE_ES_WriteERLog_t*)SBBufPtr);
}
break;

case CFE_ES_START_PERF_DATA_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_StartPerfData_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StartPerfData_t)))
{
CFE_ES_StartPerfDataCmd((CFE_ES_StartPerfData_t*)SBBuffer);
CFE_ES_StartPerfDataCmd((CFE_ES_StartPerfData_t*)SBBufPtr);
}
break;

case CFE_ES_STOP_PERF_DATA_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_StopPerfData_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StopPerfData_t)))
{
CFE_ES_StopPerfDataCmd((CFE_ES_StopPerfData_t*)SBBuffer);
CFE_ES_StopPerfDataCmd((CFE_ES_StopPerfData_t*)SBBufPtr);
}
break;

case CFE_ES_SET_PERF_FILTER_MASK_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_SetPerfFilterMask_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetPerfFilterMask_t)))
{
CFE_ES_SetPerfFilterMaskCmd((CFE_ES_SetPerfFilterMask_t*)SBBuffer);
CFE_ES_SetPerfFilterMaskCmd((CFE_ES_SetPerfFilterMask_t*)SBBufPtr);
}
break;

case CFE_ES_SET_PERF_TRIGGER_MASK_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_SetPerfTriggerMask_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetPerfTriggerMask_t)))
{
CFE_ES_SetPerfTriggerMaskCmd((CFE_ES_SetPerfTriggerMask_t*)SBBuffer);
CFE_ES_SetPerfTriggerMaskCmd((CFE_ES_SetPerfTriggerMask_t*)SBBufPtr);
}
break;

case CFE_ES_RESET_PR_COUNT_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_ResetPRCount_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ResetPRCount_t)))
{
CFE_ES_ResetPRCountCmd((CFE_ES_ResetPRCount_t*)SBBuffer);
CFE_ES_ResetPRCountCmd((CFE_ES_ResetPRCount_t*)SBBufPtr);
}
break;

case CFE_ES_SET_MAX_PR_COUNT_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_SetMaxPRCount_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetMaxPRCount_t)))
{
CFE_ES_SetMaxPRCountCmd((CFE_ES_SetMaxPRCount_t*)SBBuffer);
CFE_ES_SetMaxPRCountCmd((CFE_ES_SetMaxPRCount_t*)SBBufPtr);
}
break;

case CFE_ES_DELETE_CDS_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_DeleteCDS_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_DeleteCDS_t)))
{
CFE_ES_DeleteCDSCmd((CFE_ES_DeleteCDS_t*)SBBuffer);
CFE_ES_DeleteCDSCmd((CFE_ES_DeleteCDS_t*)SBBufPtr);
}
break;

case CFE_ES_SEND_MEM_POOL_STATS_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_SendMemPoolStats_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SendMemPoolStats_t)))
{
CFE_ES_SendMemPoolStatsCmd((CFE_ES_SendMemPoolStats_t*)SBBuffer);
CFE_ES_SendMemPoolStatsCmd((CFE_ES_SendMemPoolStats_t*)SBBufPtr);
}
break;

case CFE_ES_DUMP_CDS_REGISTRY_CC:
if (CFE_ES_VerifyCmdLength(&SBBuffer->Msg, sizeof(CFE_ES_DumpCDSRegistry_t)))
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_DumpCDSRegistry_t)))
{
CFE_ES_DumpCDSRegistryCmd((CFE_ES_DumpCDSRegistry_t*)SBBuffer);
CFE_ES_DumpCDSRegistryCmd((CFE_ES_DumpCDSRegistry_t*)SBBufPtr);
}
break;

Expand Down Expand Up @@ -744,7 +744,7 @@ int32 CFE_ES_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data)
** Send housekeeping telemetry packet.
*/
CFE_SB_TimeStampMsg(&CFE_ES_TaskData.HkPacket.TlmHeader.Msg);
CFE_SB_SendMsg(&CFE_ES_TaskData.HkPacket.TlmHeader.Msg);
CFE_SB_TransmitMsg(&CFE_ES_TaskData.HkPacket.TlmHeader.Msg, true);

/*
** This command does not affect the command execution counter.
Expand Down Expand Up @@ -1143,7 +1143,7 @@ int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOne_t *data)
** Send application status telemetry packet.
*/
CFE_SB_TimeStampMsg(&CFE_ES_TaskData.OneAppPacket.TlmHeader.Msg);
Result = CFE_SB_SendMsg(&CFE_ES_TaskData.OneAppPacket.TlmHeader.Msg);
Result = CFE_SB_TransmitMsg(&CFE_ES_TaskData.OneAppPacket.TlmHeader.Msg, true);
if ( Result == CFE_SUCCESS )
{
CFE_ES_TaskData.CommandCounter++;
Expand Down Expand Up @@ -1811,7 +1811,7 @@ int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStats_t *data)
** Send memory statistics telemetry packet.
*/
CFE_SB_TimeStampMsg(&CFE_ES_TaskData.MemStatsPacket.TlmHeader.Msg);
CFE_SB_SendMsg(&CFE_ES_TaskData.MemStatsPacket.TlmHeader.Msg);
CFE_SB_TransmitMsg(&CFE_ES_TaskData.MemStatsPacket.TlmHeader.Msg, true);

CFE_ES_TaskData.CommandCounter++;
CFE_EVS_SendEvent(CFE_ES_TLM_POOL_STATS_INFO_EID, CFE_EVS_EventType_DEBUG,
Expand Down
2 changes: 1 addition & 1 deletion fsw/cfe-core/src/es/cfe_es_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ extern CFE_ES_TaskData_t CFE_ES_TaskData;
*/
void CFE_ES_TaskMain(void);
int32 CFE_ES_TaskInit(void);
void CFE_ES_TaskPipe(CFE_SB_Buffer_t *SBBuffer);
void CFE_ES_TaskPipe(CFE_SB_Buffer_t *SBBufPtr);


/*
Expand Down
Loading

0 comments on commit 36ce14d

Please sign in to comment.