Skip to content

Commit

Permalink
WIP nasa#1009 - started change to CFE_SB_Buffer_t
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Nov 16, 2020
1 parent 6a7e6c3 commit 6c64889
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 86 deletions.
114 changes: 57 additions & 57 deletions fsw/cfe-core/src/es/cfe_es_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ CFE_ES_TaskData_t CFE_ES_TaskData;

void CFE_ES_TaskMain(void)
{
int32 Status;
uint32 AppRunStatus = CFE_ES_RunStatus_APP_RUN;
CFE_SB_Msg_t *SBMsgPtr;
int32 Status;
uint32 AppRunStatus = CFE_ES_RunStatus_APP_RUN;
CFE_SB_Buffer_t *SBBuffer;

/*
** 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(&SBMsgPtr, CFE_ES_TaskData.CmdPipe, CFE_SB_PEND_FOREVER);
Status = CFE_SB_RcvMsg(&SBBuffer, 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(SBMsgPtr);
CFE_ES_TaskPipe(SBBuffer);

/*
* 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_Msg_t *SBMsgPtr)
void CFE_ES_TaskPipe(CFE_SB_Buffer_t *SBBuffer)
{
CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
CFE_MSG_FcnCode_t CommandCode = 0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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_Msg_t *SBMsgPtr);
void CFE_ES_TaskPipe(CFE_SB_Buffer_t *SBBuffer);


/*
Expand Down
37 changes: 17 additions & 20 deletions fsw/cfe-core/src/inc/cfe_sb.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,17 @@ typedef union CFE_SB_Msg {
CFE_MSG_Message_t Msg; /**< \brief Base message type without enforced alignment */
long long int LongInt; /**< \brief Align to support Long Integer */
long double LongDouble; /**< \brief Align to support Long Double */
} CFE_SB_Msg_t;
} CFE_SB_Buffer_t;

#if 0 /* TODO deprecate */
/** \brief Aligned Software Bus command header */
typedef union CFE_SB_CmdHdr {
CFE_MSG_CommandHeader_t Cmd;
CFE_MSG_Message_t BaseMsg;
} CFE_SB_CmdHdr_t;

/** \brief Aligned Software Bus telemetry header */
typedef union CFE_SB_TlmHdr {
CFE_MSG_TelemetryHeader_t Tlm;
CFE_MSG_Message_t BaseMsg;
} CFE_SB_TlmHdr_t;
/** \brief Deperecated type to minimize required changes */
typedef CFE_SB_Buffer_t CFE_SB_Msg_t;

/** \brief Deperecated type to minimize required changes */
typedef CFE_MSG_CommandHeader_t CFE_SB_CmdHdr_t;

/** \brief Deperecated type to minimize required changes */
typedef CFE_MSG_TelemetryHeader_t CFE_SB_TlmHdr_t;
#endif

#define CFE_SB_CMD_HDR_SIZE (sizeof(CFE_MSG_CommandHeader_t))/**< \brief Size of command header */
Expand Down Expand Up @@ -611,8 +608,8 @@ CFE_Status_t CFE_SB_PassMsg(CFE_MSG_Message_t *MsgPtr);
** for CFE_SUCCESS before processing the message.
**
** \param[in, out] BufPtr A pointer to a message pointer.
** Typically a caller declares a ptr of type CFE_SB_Msg_t
** (i.e. CFE_SB_Msg_t *Ptr) then gives the address of that
** Typically a caller declares a ptr of type CFE_SB_Buffer_t
** (i.e. CFE_SB_Buffer_t *Ptr) then gives the address of that
** pointer (&Ptr) as this parmeter. After a successful
** receipt of a message, *BufPtr will point to the first
** byte of the software bus message header. This should be
Expand All @@ -639,7 +636,7 @@ CFE_Status_t CFE_SB_PassMsg(CFE_MSG_Message_t *MsgPtr);
**
** \sa #CFE_SB_SendMsg, #CFE_SB_ZeroCopySend
**/
CFE_Status_t CFE_SB_RcvMsg(CFE_SB_Msg_t **BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut);
CFE_Status_t CFE_SB_RcvMsg(CFE_SB_Buffer_t **BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut);
/**@}*/

/** @defgroup CFEAPISBZeroCopy cFE Zero Copy Message APIs
Expand Down Expand Up @@ -680,8 +677,8 @@ CFE_Status_t CFE_SB_RcvMsg(CFE_SB_Msg_t **BufPtr, CFE_SB_PipeId_t PipeId, int32
**
** \sa #CFE_SB_ZeroCopyReleasePtr, #CFE_SB_ZeroCopySend
**/
CFE_SB_Msg_t *CFE_SB_ZeroCopyGetPtr(uint16 MsgSize,
CFE_SB_ZeroCopyHandle_t *BufferHandle);
CFE_SB_Buffer_t *CFE_SB_ZeroCopyGetPtr(uint16 MsgSize,
CFE_SB_ZeroCopyHandle_t *BufferHandle);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -710,7 +707,7 @@ CFE_SB_Msg_t *CFE_SB_ZeroCopyGetPtr(uint16 MsgSize,
**
** \sa #CFE_SB_ZeroCopyGetPtr, #CFE_SB_ZeroCopySend
**/
CFE_Status_t CFE_SB_ZeroCopyReleasePtr(CFE_SB_Msg_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle);
CFE_Status_t CFE_SB_ZeroCopyReleasePtr(CFE_SB_Buffer_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -750,7 +747,7 @@ CFE_Status_t CFE_SB_ZeroCopyReleasePtr(CFE_SB_Msg_t *Ptr2Release, CFE_SB_ZeroCop
**
** \sa #CFE_SB_SendMsg, #CFE_SB_RcvMsg, #CFE_SB_ZeroCopyReleasePtr, #CFE_SB_ZeroCopyGetPtr
**/
CFE_Status_t CFE_SB_ZeroCopySend(CFE_SB_Msg_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle);
CFE_Status_t CFE_SB_ZeroCopySend(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t BufferHandle);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -792,7 +789,7 @@ CFE_Status_t CFE_SB_ZeroCopySend(CFE_SB_Msg_t *MsgPtr, CFE_SB_ZeroCopyHandle_t B
**
** \sa #CFE_SB_PassMsg, #CFE_SB_ZeroCopySend, #CFE_SB_ZeroCopyReleasePtr, #CFE_SB_ZeroCopyGetPtr
**/
CFE_Status_t CFE_SB_ZeroCopyPass(CFE_SB_Msg_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle);
CFE_Status_t CFE_SB_ZeroCopyPass(CFE_SB_Buffer_t *BufPtr, CFE_SB_ZeroCopyHandle_t BufferHandle);
/**@}*/

/** @defgroup CFEAPISBSetMessage cFE Setting Message Characteristics APIs
Expand Down
Loading

0 comments on commit 6c64889

Please sign in to comment.