Skip to content

Commit

Permalink
WIP #1009 - framework and ES
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Nov 16, 2020
1 parent 34e5510 commit c7bdbfe
Show file tree
Hide file tree
Showing 28 changed files with 366 additions and 371 deletions.
2 changes: 1 addition & 1 deletion fsw/cfe-core/src/es/cfe_es_syslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ int32 CFE_ES_SysLogDump(const char *Filename)
CFE_EVS_SendEvent(CFE_ES_SYSLOG2_EID, CFE_EVS_EventType_DEBUG,
"%s written:Size=%lu,Entries=%u",Filename,
(unsigned long)TotalSize,
(unsigned int)CFE_ES_TaskData.HkPacket.Payload.SysLogEntries);
(unsigned int)CFE_ES_TaskData.HkBuffer.HkTlm.Payload.SysLogEntries);
Status = CFE_SUCCESS;
}

Expand Down
256 changes: 127 additions & 129 deletions fsw/cfe-core/src/es/cfe_es_task.c

Large diffs are not rendered by default.

42 changes: 33 additions & 9 deletions fsw/cfe-core/src/es/cfe_es_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,32 @@ typedef struct
char DataFileName[OS_MAX_PATH_LEN];
} CFE_ES_BackgroundLogDumpGlobal_t;

/*
* Housekeeping software bus message buffer
*/
typedef struct
{
CFE_SB_Msg_t SBMsg;
CFE_ES_HousekeepingTlm_t HkTlm;
} CFE_ES_HousekeepingBuffer_t;

/*
* Single application software bus message buffer
*/
typedef struct
{
CFE_SB_Msg_t SBMsg;
CFE_ES_OneAppTlm_t OneAppTlm;
} CFE_ES_OneAppBuffer_t;

/*
* Memory stats software bus message buffer
*/
typedef struct
{
CFE_SB_Msg_t SBMsg;
CFE_ES_MemStatsTlm_t MemStatsTlm;
} CFE_ES_MemStatsBuffer_t;

/*
** Type definition (ES task global data)
Expand All @@ -103,24 +128,23 @@ typedef struct
uint8 CommandErrorCounter;

/*
** ES Task housekeeping telemetry packet
** ES Task housekeeping telemetry buffer
*/
CFE_ES_HousekeepingTlm_t HkPacket;
CFE_ES_HousekeepingBuffer_t HkBuffer;

/*
** Single application telemetry packet
** Single application telemetry buffer
*/
CFE_ES_OneAppTlm_t OneAppPacket;
CFE_ES_OneAppBuffer_t OneAppBuffer;

/*
** Single application telemetry packet
** Single application telemetry buffer
*/
CFE_ES_MemStatsTlm_t MemStatsPacket;
CFE_ES_MemStatsBuffer_t MemStatsBuffer;

/*
** ES Task operational data (not reported in housekeeping)
*/
CFE_MSG_Message_t *MsgPtr;
CFE_SB_PipeId_t CmdPipe;

/*
Expand Down Expand Up @@ -160,7 +184,7 @@ extern CFE_ES_TaskData_t CFE_ES_TaskData;
*/
void CFE_ES_TaskMain(void);
int32 CFE_ES_TaskInit(void);
void CFE_ES_TaskPipe(CFE_MSG_Message_t *MsgPtr);
void CFE_ES_TaskPipe(CFE_SB_Msg_t *SBMsgPtr);


/*
Expand All @@ -174,7 +198,7 @@ void CFE_ES_BackgroundCleanup(void);
/*
** ES Task message dispatch functions
*/
int32 CFE_ES_HousekeepingCmd(const CFE_SB_CmdHdr_t *data);
int32 CFE_ES_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data);
int32 CFE_ES_NoopCmd(const CFE_ES_Noop_t *Cmd);
int32 CFE_ES_ResetCountersCmd(const CFE_ES_ResetCounters_t *data);
int32 CFE_ES_RestartCmd(const CFE_ES_Restart_t *data);
Expand Down
4 changes: 2 additions & 2 deletions fsw/cfe-core/src/evs/cfe_evs_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ void CFE_EVS_ProcessCommandPacket(CFE_MSG_Message_t *MsgPtr)

case CFE_EVS_SEND_HK_MID:
/* Housekeeping request */
CFE_EVS_ReportHousekeepingCmd((CFE_SB_CmdHdr_t*)MsgPtr);
CFE_EVS_ReportHousekeepingCmd((CFE_MSG_CommandHeader_t *)MsgPtr);
break;

default:
Expand Down Expand Up @@ -694,7 +694,7 @@ int32 CFE_EVS_ClearLogCmd(const CFE_EVS_ClearLog_t *data)
** Assumptions and Notes:
**
*/
int32 CFE_EVS_ReportHousekeepingCmd (const CFE_SB_CmdHdr_t *data)
int32 CFE_EVS_ReportHousekeepingCmd (const CFE_MSG_CommandHeader_t *data)
{
uint32 i, j;
EVS_AppData_t *AppDataPtr;
Expand Down
2 changes: 1 addition & 1 deletion fsw/cfe-core/src/evs/cfe_evs_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ extern void CFE_EVS_ProcessCommandPacket(CFE_MSG_Message_t *MsgPtr);
/*
* EVS Message Handler Functions
*/
int32 CFE_EVS_ReportHousekeepingCmd (const CFE_SB_CmdHdr_t *data);
int32 CFE_EVS_ReportHousekeepingCmd(const CFE_MSG_CommandHeader_t *data);
int32 CFE_EVS_NoopCmd(const CFE_EVS_Noop_t *data);
int32 CFE_EVS_ClearLogCmd(const CFE_EVS_ClearLog_t *data);
int32 CFE_EVS_ResetCountersCmd(const CFE_EVS_ResetCounters_t *data);
Expand Down
12 changes: 6 additions & 6 deletions fsw/cfe-core/src/inc/cfe_es_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -1531,8 +1531,8 @@ typedef struct CFE_ES_OneAppTlm_Payload

typedef struct CFE_ES_OneAppTlm
{
CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */
CFE_ES_OneAppTlm_Payload_t Payload;
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */
CFE_ES_OneAppTlm_Payload_t Payload; /**< \brief Telemetry payload */
} CFE_ES_OneAppTlm_t;

/**
Expand All @@ -1547,8 +1547,8 @@ typedef struct CFE_ES_PoolStatsTlm_Payload

typedef struct CFE_ES_MemStatsTlm
{
CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */
CFE_ES_PoolStatsTlm_Payload_t Payload;
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */
CFE_ES_PoolStatsTlm_Payload_t Payload; /**< \brief Telemetry payload */
} CFE_ES_MemStatsTlm_t;

/*************************************************************************/
Expand Down Expand Up @@ -1644,8 +1644,8 @@ typedef struct CFE_ES_HousekeepingTlm_Payload

typedef struct CFE_ES_HousekeepingTlm
{
CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */
CFE_ES_HousekeepingTlm_Payload_t Payload;
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */
CFE_ES_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */

} CFE_ES_HousekeepingTlm_t;

Expand Down
12 changes: 6 additions & 6 deletions fsw/cfe-core/src/inc/cfe_evs_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -1181,8 +1181,8 @@ typedef struct CFE_EVS_HousekeepingTlm_Payload {
} CFE_EVS_HousekeepingTlm_Payload_t;

typedef struct CFE_EVS_HousekeepingTlm {
CFE_SB_TlmHdr_t TlmHeader;
CFE_EVS_HousekeepingTlm_Payload_t Payload;
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */
CFE_EVS_HousekeepingTlm_Payload_t Payload; /**< \brief Telemetry payload */
} CFE_EVS_HousekeepingTlm_t;

/** Telemetry packet structures */
Expand Down Expand Up @@ -1224,14 +1224,14 @@ typedef struct CFE_EVS_ShortEventTlm_Payload {
} CFE_EVS_ShortEventTlm_Payload_t;

typedef struct CFE_EVS_LongEventTlm {
CFE_SB_TlmHdr_t TlmHeader;
CFE_EVS_LongEventTlm_Payload_t Payload;
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */
CFE_EVS_LongEventTlm_Payload_t Payload; /**< \brief Telemetry payload */

} CFE_EVS_LongEventTlm_t;

typedef struct CFE_EVS_ShortEventTlm {
CFE_SB_TlmHdr_t TlmHeader;
CFE_EVS_ShortEventTlm_Payload_t Payload;
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */
CFE_EVS_ShortEventTlm_Payload_t Payload; /**< \brief Telemetry payload */

} CFE_EVS_ShortEventTlm_t;

Expand Down
38 changes: 20 additions & 18 deletions fsw/cfe-core/src/inc/cfe_sb.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,14 @@
** Type Definitions
*/

#ifndef CFE_OMIT_DEPRECATED_6_8
/** \brief Software Bus generic message */
typedef CFE_MSG_Message_t CFE_SB_Msg_t;
#endif /* CFE_OMIT_DEPRECATED_6_8 */
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;

#if 0 /* TODO deprecate */
/** \brief Aligned Software Bus command header */
typedef union CFE_SB_CmdHdr {
CFE_MSG_CommandHeader_t Cmd;
Expand All @@ -165,9 +168,10 @@ typedef union CFE_SB_TlmHdr {
CFE_MSG_TelemetryHeader_t Tlm;
CFE_MSG_Message_t BaseMsg;
} CFE_SB_TlmHdr_t;
#endif

#define CFE_SB_CMD_HDR_SIZE (sizeof(CFE_SB_CmdHdr_t))/**< \brief Size of #CFE_SB_CmdHdr_t in bytes */
#define CFE_SB_TLM_HDR_SIZE (sizeof(CFE_SB_TlmHdr_t))/**< \brief Size of #CFE_SB_TlmHdr_t in bytes */
#define CFE_SB_CMD_HDR_SIZE (sizeof(CFE_MSG_CommandHeader_t))/**< \brief Size of command header */
#define CFE_SB_TLM_HDR_SIZE (sizeof(CFE_MSG_TelemetryHeader_t))/**< \brief Size of telemetry header */

/** \brief CFE_SB_TimeOut_t to primitive type definition
**
Expand Down Expand Up @@ -548,8 +552,7 @@ CFE_Status_t CFE_SB_UnsubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeI
** of a telemetry message.
**
** \param[in] MsgPtr A pointer to the message to be sent. This must point
** to the first byte of the message header
** (#CFE_MSG_Message_t).
** to the first byte of the message header.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
Expand All @@ -559,7 +562,7 @@ CFE_Status_t CFE_SB_UnsubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeI
**
** \sa #CFE_SB_RcvMsg, #CFE_SB_ZeroCopySend, #CFE_SB_PassMsg
**/
CFE_Status_t CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr);
CFE_Status_t CFE_SB_SendMsg(CFE_SB_Msg_t *MsgPtr);

/*****************************************************************************/
/**
Expand All @@ -581,8 +584,7 @@ CFE_Status_t CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr);
** sequence counter in a telemetry message.
**
** \param[in] MsgPtr A pointer to the message to be sent. This must point
** to the first byte of the message header
** (#CFE_MSG_Message_t).
** to the first byte of the message header.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
Expand All @@ -592,7 +594,7 @@ CFE_Status_t CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr);
**
** \sa #CFE_SB_RcvMsg, #CFE_SB_ZeroCopySend, #CFE_SB_SendMsg
**/
CFE_Status_t CFE_SB_PassMsg(CFE_MSG_Message_t *MsgPtr);
CFE_Status_t CFE_SB_PassMsg(CFE_SB_Msg_t *MsgPtr);

/*****************************************************************************/
/**
Expand All @@ -609,8 +611,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_MSG_Message_t
** (i.e. CFE_MSG_Message_t *Ptr) then gives the address of that
** 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
** 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 @@ -637,7 +639,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_MSG_Message_t **BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut);
CFE_Status_t CFE_SB_RcvMsg(CFE_SB_Msg_t **BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut);
/**@}*/

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

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

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

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

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

0 comments on commit c7bdbfe

Please sign in to comment.