Skip to content

Commit

Permalink
WIP nasa#777 - replaced CFE_SB_InitMsg, CFE_SB_Msg_t
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Nov 2, 2020
1 parent 55f22a5 commit 9717fab
Show file tree
Hide file tree
Showing 36 changed files with 459 additions and 442 deletions.
20 changes: 10 additions & 10 deletions docs/cFE Application Developers Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ FILE: xx_app.c
void XX_AppMain(void)
{
uint32 RunStatus = CFE_ES_RunStatus_APP_RUN;
CFE_SB_Msg_t *MsgPtr;
CFE_MSG_Message_t *MsgPtr;
int32 Result = CFE_SUCCESS;
/* Register application */
Expand Down Expand Up @@ -1798,8 +1798,8 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */
/*
** Send housekeeping SB Message after time tagging it with current time
*/
CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &SAMPLE_AppData.HkPacket);
CFE_SB_SendMsg((CFE_SB_Msg_t *) &SAMPLE_AppData.HkPacket);
CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &SAMPLE_AppData.HkPacket);
CFE_SB_SendMsg((CFE_MSG_Message_t *) &SAMPLE_AppData.HkPacket);
...
}
```
Expand All @@ -1815,8 +1815,8 @@ FILE: sample_app.h
typedef struct
{
...
CFE_SB_Msg_t *MsgPtr;
CFE_SB_PipeId_t CmdPipe;
CFE_MSG_Message_t *MsgPtr;
CFE_SB_PipeId_t CmdPipe;
...
} SAMPLE_AppData_t;
```
Expand Down Expand Up @@ -1944,9 +1944,9 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */
** Get a SB Message block of memory and initialize it
*/
SAMPLE_AppData.BigPktPtr = (SAMPLE_BigPkt_t *)CFE_SB_ZeroCopyGetPtr(SAMPLE_BIGPKT_MSGLEN);
CFE_MSG_Init((CFE_SB_Msg_t *) SAMPLE_AppData.BigPktPtr,
SAMPLE_BIG_TLM_MID,
SAMPLE_BIGPKT_MSGLEN);
CFE_MSG_Init((CFE_MSG_Message_t *) SAMPLE_AppData.BigPktPtr,
SAMPLE_BIG_TLM_MID,
SAMPLE_BIGPKT_MSGLEN);
/*
** ...Fill Packet with Data...
Expand All @@ -1955,8 +1955,8 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */
/*
** Send SB Message after time tagging it with current time
*/
CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) SAMPLE_AppData.BigPktPtr);
CFE_SB_ZeroCopySend((CFE_SB_Msg_t *) SAMPLE_AppData.BigPktPtr);
CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) SAMPLE_AppData.BigPktPtr);
CFE_SB_ZeroCopySend((CFE_MSG_Message_t *) SAMPLE_AppData.BigPktPtr);
/* SAMPLE_AppData.BigPktPtr is no longer a valid pointer */
...
}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/cfe_sb.dox
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@
can get confusing. How can I be sure that the correct address is given for this
parameter.
</B><TR><TD WIDTH="5%"> &nbsp; <TD WIDTH="95%">
Typically a caller declares a ptr of type CFE_SB_Msg_t (i.e. CFE_SB_Msg_t *Ptr)
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 pointer (&Ptr) as this parameter. After a successful
call to #CFE_SB_RcvMsg, Ptr will point to the first byte of the software bus message
header. This should be used as a read-only pointer. In systems with an MMU, writes
Expand Down
22 changes: 11 additions & 11 deletions fsw/cfe-core/src/es/cfe_es_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,21 +252,21 @@ int32 CFE_ES_TaskInit(void)
/*
** Initialize housekeeping packet (clear user data area)
*/
CFE_MSG_Init(&CFE_ES_TaskData.HkPacket,
CFE_MSG_Init(&CFE_ES_TaskData.HkPacket.TlmHeader.BaseMsg,
CFE_SB_ValueToMsgId(CFE_ES_HK_TLM_MID),
sizeof(CFE_ES_TaskData.HkPacket));

/*
** Initialize single application telemetry packet
*/
CFE_MSG_Init(&CFE_ES_TaskData.OneAppPacket,
CFE_MSG_Init(&CFE_ES_TaskData.OneAppPacket.TlmHeader.BaseMsg,
CFE_SB_ValueToMsgId(CFE_ES_APP_TLM_MID),
sizeof(CFE_ES_TaskData.OneAppPacket));

/*
** Initialize memory pool statistics telemetry packet
*/
CFE_MSG_Init(&CFE_ES_TaskData.MemStatsPacket,
CFE_MSG_Init(&CFE_ES_TaskData.MemStatsPacket.TlmHeader.BaseMsg,
CFE_SB_ValueToMsgId(CFE_ES_MEMSTATS_TLM_MID),
sizeof(CFE_ES_TaskData.MemStatsPacket));

Expand Down Expand Up @@ -434,7 +434,7 @@ int32 CFE_ES_TaskInit(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

void CFE_ES_TaskPipe(CFE_SB_Msg_t *MsgPtr)
void CFE_ES_TaskPipe(CFE_MSG_Message_t *MsgPtr)
{
CFE_SB_MsgId_t MessageID;
uint16 CommandCode;
Expand Down Expand Up @@ -745,8 +745,8 @@ int32 CFE_ES_HousekeepingCmd(const CFE_SB_CmdHdr_t *data)
/*
** Send housekeeping telemetry packet.
*/
CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_ES_TaskData.HkPacket);
CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_ES_TaskData.HkPacket);
CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.HkPacket);
CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.HkPacket);

/*
** This command does not affect the command execution counter.
Expand Down Expand Up @@ -1144,8 +1144,8 @@ int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOne_t *data)
/*
** Send application status telemetry packet.
*/
CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_ES_TaskData.OneAppPacket);
Result = CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_ES_TaskData.OneAppPacket);
CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.OneAppPacket);
Result = CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.OneAppPacket);
if ( Result == CFE_SUCCESS )
{
CFE_ES_TaskData.CommandCounter++;
Expand Down Expand Up @@ -1641,7 +1641,7 @@ int32 CFE_ES_WriteERLogCmd(const CFE_ES_WriteERLog_t *data)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

bool CFE_ES_VerifyCmdLength(CFE_SB_Msg_t *MsgPtr, uint16 ExpectedLength)
bool CFE_ES_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, uint16 ExpectedLength)
{
bool result = true;
uint16 ActualLength = CFE_SB_GetTotalMsgLength(MsgPtr);
Expand Down Expand Up @@ -1807,8 +1807,8 @@ int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStats_t *data)
/*
** Send memory statistics telemetry packet.
*/
CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_ES_TaskData.MemStatsPacket);
CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_ES_TaskData.MemStatsPacket);
CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.MemStatsPacket);
CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.MemStatsPacket);

CFE_ES_TaskData.CommandCounter++;
CFE_EVS_SendEvent(CFE_ES_TLM_POOL_STATS_INFO_EID, CFE_EVS_EventType_DEBUG,
Expand Down
8 changes: 4 additions & 4 deletions fsw/cfe-core/src/es/cfe_es_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ typedef struct
/*
** ES Task operational data (not reported in housekeeping)
*/
CFE_SB_Msg_t *MsgPtr;
CFE_SB_PipeId_t CmdPipe;
CFE_MSG_Message_t *MsgPtr;
CFE_SB_PipeId_t CmdPipe;

/*
** ES Task initialization data (not reported in housekeeping)
Expand Down Expand Up @@ -160,7 +160,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 *MsgPtr);
void CFE_ES_TaskPipe(CFE_MSG_Message_t *MsgPtr);


/*
Expand Down Expand Up @@ -204,7 +204,7 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistry_t *data);
** Message Handler Helper Functions
*/
bool CFE_ES_ValidateHandle(CFE_ES_MemHandle_t Handle);
bool CFE_ES_VerifyCmdLength(CFE_SB_Msg_t *MsgPtr, uint16 ExpectedLength);
bool CFE_ES_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, uint16 ExpectedLength);
void CFE_ES_FileWriteByteCntErr(const char *Filename,uint32 Requested,uint32 Actual);

/*************************************************************************/
Expand Down
20 changes: 10 additions & 10 deletions fsw/cfe-core/src/evs/cfe_evs_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ CFE_EVS_GlobalData_t CFE_EVS_GlobalData;
/*
** Local function prototypes.
*/
void CFE_EVS_ProcessGroundCommand (CFE_SB_Msg_t *MsgPtr);
bool CFE_EVS_VerifyCmdLength(CFE_SB_Msg_t *MsgPtr, uint16 ExpectedLength);
void CFE_EVS_ProcessGroundCommand(CFE_MSG_Message_t *MsgPtr);
bool CFE_EVS_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, uint16 ExpectedLength);

/* Function Definitions */

Expand Down Expand Up @@ -86,7 +86,7 @@ int32 CFE_EVS_EarlyInit ( void )
memset(&CFE_EVS_GlobalData, 0, sizeof(CFE_EVS_GlobalData_t));

/* Initialize housekeeping packet */
CFE_MSG_Init(&CFE_EVS_GlobalData.EVS_TlmPkt, CFE_SB_ValueToMsgId(CFE_EVS_HK_TLM_MID),
CFE_MSG_Init(&CFE_EVS_GlobalData.EVS_TlmPkt.TlmHeader.BaseMsg, CFE_SB_ValueToMsgId(CFE_EVS_HK_TLM_MID),
sizeof(CFE_EVS_GlobalData.EVS_TlmPkt));

/* Elements stored in the hk packet that have non-zero default values */
Expand Down Expand Up @@ -212,8 +212,8 @@ int32 CFE_EVS_CleanUpApp(CFE_ES_ResourceID_t AppID)
*/
void CFE_EVS_TaskMain(void)
{
int32 Status;
CFE_SB_Msg_t *MsgPtr; /* Pointer to SB message */
int32 Status;
CFE_MSG_Message_t *MsgPtr; /* Pointer to SB message */

CFE_ES_PerfLogEntry(CFE_MISSION_EVS_MAIN_PERF_ID);

Expand Down Expand Up @@ -352,7 +352,7 @@ int32 CFE_EVS_TaskInit ( void )
** Assumptions and Notes:
**
*/
void CFE_EVS_ProcessCommandPacket(CFE_SB_Msg_t *MsgPtr)
void CFE_EVS_ProcessCommandPacket(CFE_MSG_Message_t *MsgPtr)
{
CFE_SB_MsgId_t MessageID;

Expand Down Expand Up @@ -396,7 +396,7 @@ void CFE_EVS_ProcessCommandPacket(CFE_SB_Msg_t *MsgPtr)
** Assumptions and Notes:
**
*/
void CFE_EVS_ProcessGroundCommand(CFE_SB_Msg_t *MsgPtr)
void CFE_EVS_ProcessGroundCommand(CFE_MSG_Message_t *MsgPtr)
{
/* status will get reset if it passes length check */
int32 Status = CFE_STATUS_WRONG_MSG_LENGTH;
Expand Down Expand Up @@ -608,7 +608,7 @@ void CFE_EVS_ProcessGroundCommand(CFE_SB_Msg_t *MsgPtr)
** Assumptions and Notes:
**
*/
bool CFE_EVS_VerifyCmdLength(CFE_SB_Msg_t *MsgPtr, uint16 ExpectedLength)
bool CFE_EVS_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, uint16 ExpectedLength)
{
bool result = true;
uint16 ActualLength = CFE_SB_GetTotalMsgLength(MsgPtr);
Expand Down Expand Up @@ -725,9 +725,9 @@ int32 CFE_EVS_ReportHousekeepingCmd (const CFE_SB_CmdHdr_t *data)
AppTlmDataPtr->AppMessageSentCounter = 0;
}

CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_EVS_GlobalData.EVS_TlmPkt);
CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_EVS_GlobalData.EVS_TlmPkt);

CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_EVS_GlobalData.EVS_TlmPkt);
CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_EVS_GlobalData.EVS_TlmPkt);

return CFE_STATUS_NO_COUNTER_INCREMENT;
} /* End of CFE_EVS_ReportHousekeepingCmd() */
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 @@ -140,7 +140,7 @@ extern CFE_EVS_GlobalData_t CFE_EVS_GlobalData;
* Functions used within this module and by the unit test
*/
extern int32 CFE_EVS_TaskInit (void);
extern void CFE_EVS_ProcessCommandPacket(CFE_SB_Msg_t *MsgPtr);
extern void CFE_EVS_ProcessCommandPacket(CFE_MSG_Message_t *MsgPtr);

/*
* EVS Message Handler Functions
Expand Down
14 changes: 8 additions & 6 deletions fsw/cfe-core/src/evs/cfe_evs_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1
int ExpandedLength;

/* Initialize EVS event packets */
CFE_MSG_Init(&LongEventTlm, CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID), sizeof(LongEventTlm));
CFE_MSG_Init(&LongEventTlm.TlmHeader.BaseMsg, CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID),
sizeof(LongEventTlm));
LongEventTlm.Payload.PacketID.EventID = EventID;
LongEventTlm.Payload.PacketID.EventType = EventType;

Expand All @@ -427,7 +428,7 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1
LongEventTlm.Payload.PacketID.ProcessorID = CFE_PSP_GetProcessorId();

/* Set the packet timestamp */
CFE_SB_SetMsgTime((CFE_SB_Msg_t *) &LongEventTlm, *TimeStamp);
CFE_SB_SetMsgTime((CFE_MSG_Message_t *) &LongEventTlm, *TimeStamp);

/* Write event to the event log */
EVS_AddLog(&LongEventTlm);
Expand All @@ -438,7 +439,7 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1
if (CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode == CFE_EVS_MsgFormat_LONG)
{
/* Send long event via SoftwareBus */
CFE_SB_SendMsg((CFE_SB_Msg_t *) &LongEventTlm);
CFE_SB_SendMsg((CFE_MSG_Message_t *) &LongEventTlm);
}
else if (CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode == CFE_EVS_MsgFormat_SHORT)
{
Expand All @@ -448,10 +449,11 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1
*
* This goes out on a separate message ID.
*/
CFE_MSG_Init(&ShortEventTlm, CFE_SB_ValueToMsgId(CFE_EVS_SHORT_EVENT_MSG_MID), sizeof(ShortEventTlm));
CFE_SB_SetMsgTime((CFE_SB_Msg_t *) &ShortEventTlm, *TimeStamp);
CFE_MSG_Init(&ShortEventTlm.TlmHeader.BaseMsg, CFE_SB_ValueToMsgId(CFE_EVS_SHORT_EVENT_MSG_MID),
sizeof(ShortEventTlm));
CFE_SB_SetMsgTime((CFE_MSG_Message_t *) &ShortEventTlm, *TimeStamp);
ShortEventTlm.Payload.PacketID = LongEventTlm.Payload.PacketID;
CFE_SB_SendMsg((CFE_SB_Msg_t *) &ShortEventTlm);
CFE_SB_SendMsg((CFE_MSG_Message_t *) &ShortEventTlm);
}

/* Increment message send counters (prevent rollover) */
Expand Down
8 changes: 4 additions & 4 deletions fsw/cfe-core/src/inc/cfe_es_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ typedef struct CFE_ES_OneAppTlm_Payload

typedef struct CFE_ES_OneAppTlm
{
uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; /**< \brief cFE Software Bus Telemetry Message Header */
CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */
CFE_ES_OneAppTlm_Payload_t Payload;
} CFE_ES_OneAppTlm_t;

Expand All @@ -1407,7 +1407,7 @@ typedef struct CFE_ES_PoolStatsTlm_Payload

typedef struct CFE_ES_MemStatsTlm
{
uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; /**< \brief cFE Software Bus Telemetry Message Header */
CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */
CFE_ES_PoolStatsTlm_Payload_t Payload;
} CFE_ES_MemStatsTlm_t;

Expand Down Expand Up @@ -1504,8 +1504,8 @@ typedef struct CFE_ES_HousekeepingTlm_Payload

typedef struct CFE_ES_HousekeepingTlm
{
uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; /**< \brief cFE Software Bus Telemetry Message Header */
CFE_ES_HousekeepingTlm_Payload_t Payload;
CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */
CFE_ES_HousekeepingTlm_Payload_t Payload;

} CFE_ES_HousekeepingTlm_t;

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

typedef struct CFE_EVS_HousekeepingTlm {
uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE];
CFE_SB_TlmHdr_t TlmHeader;
CFE_EVS_HousekeepingTlm_Payload_t Payload;
} CFE_EVS_HousekeepingTlm_t;

Expand Down Expand Up @@ -1224,13 +1224,13 @@ typedef struct CFE_EVS_ShortEventTlm_Payload {
} CFE_EVS_ShortEventTlm_Payload_t;

typedef struct CFE_EVS_LongEventTlm {
uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE];
CFE_SB_TlmHdr_t TlmHeader;
CFE_EVS_LongEventTlm_Payload_t Payload;

} CFE_EVS_LongEventTlm_t;

typedef struct CFE_EVS_ShortEventTlm {
uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE];
CFE_SB_TlmHdr_t TlmHeader;
CFE_EVS_ShortEventTlm_Payload_t Payload;

} CFE_EVS_ShortEventTlm_t;
Expand Down
Loading

0 comments on commit 9717fab

Please sign in to comment.