Skip to content

Commit

Permalink
Merge pull request nasa#76 from jphickey/fix-9-cfe-msg-ptr
Browse files Browse the repository at this point in the history
Fix nasa#9, use CFE_MSG_PTR macro
  • Loading branch information
dzbaker authored Feb 23, 2023
2 parents a9ba195 + fc92438 commit 76915e9
Show file tree
Hide file tree
Showing 13 changed files with 374 additions and 236 deletions.
12 changes: 11 additions & 1 deletion fsw/inc/hs_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@
************************************************************************/
#define HS_UTIL_DIAG_REPORTS 4

/**
* \brief No Arguments Command
*
* For command details see #HS_REPORT_DIAG_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} HS_ReportDiagCmd_t;

/**
* \ingroup cfshscmdcodes
*
Expand All @@ -49,7 +59,7 @@
* Reports the Utilization Diagnostics
*
* \par Command Structure
* #HS_NoArgsCmd_t
* #HS_ReportDiagCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
Expand Down
123 changes: 115 additions & 8 deletions fsw/inc/hs_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,112 @@
/**
* \brief No Arguments Command
*
* For command details see #HS_NOOP_CC, #HS_RESET_CC, #HS_ENABLE_APPMON_CC, #HS_DISABLE_APPMON_CC,
* #HS_ENABLE_EVENTMON_CC, #HS_DISABLE_EVENTMON_CC, #HS_ENABLE_ALIVENESS_CC, #HS_DISABLE_ALIVENESS_CC,
* #HS_RESET_RESETS_PERFORMED_CC
* Also see #HS_SEND_HK_MID
* For command details see #HS_NOOP_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */
} HS_NoArgsCmd_t;
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} HS_NoopCmd_t;

/**
* \brief No Arguments Command
*
* For command details see #HS_RESET_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} HS_ResetCmd_t;

/**
* \brief No Arguments Command
*
* For command details see #HS_ENABLE_APP_MON_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} HS_EnableAppMonCmd_t;

/**
* \brief No Arguments Command
*
* For command details see #HS_DISABLE_APP_MON_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} HS_DisableAppMonCmd_t;

/**
* \brief No Arguments Command
*
* For command details see #HS_ENABLE_EVENT_MON_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} HS_EnableEventMonCmd_t;

/**
* \brief No Arguments Command
*
* For command details see #HS_DISABLE_EVENT_MON_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} HS_DisableEventMonCmd_t;

/**
* \brief No Arguments Command
*
* For command details see #HS_ENABLE_ALIVENESS_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} HS_EnableAlivenessCmd_t;

/**
* \brief No Arguments Command
*
* For command details see #HS_DISABLE_ALIVENESS_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} HS_DisableAlivenessCmd_t;

/**
* \brief No Arguments Command
*
* For command details see #HS_RESET_RESETS_PERFORMED_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} HS_ResetResetsPerformedCmd_t;

/**
* \brief No Arguments Command
*
* For command details see #HS_RESET_RESETS_PERFORMED_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} HS_EnableCpuHogCmd_t;

/**
* \brief No Arguments Command
*
* For command details see #HS_RESET_RESETS_PERFORMED_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} HS_DisableCpuHogCmd_t;

/**
* \brief Set Max Resets Command
Expand All @@ -71,12 +168,22 @@ typedef struct
*/
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */

uint16 MaxResets; /**< \brief Maximum Resets */
uint16 Padding; /**< \brief Structure padding */
} HS_SetMaxResetsCmd_t;

/**
* \brief No Arguments Command
*
* For command details see #HS_SEND_HK_MID
*/
typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} HS_SendHkCmd_t;

/**\}*/

/**
Expand All @@ -89,7 +196,7 @@ typedef struct
*/
typedef struct
{
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */
CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry Header */

uint8 CmdCount; /**< \brief HS Application Command Counter */
uint8 CmdErrCount; /**< \brief HS Application Command Error Counter */
Expand Down
46 changes: 23 additions & 23 deletions fsw/inc/hs_msgdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
* Implements the Noop command that insures the HS task is alive
*
* \par Command Structure
* #HS_NoArgsCmd_t
* #HS_NoopCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
Expand Down Expand Up @@ -104,7 +104,7 @@
* Resets the HS housekeeping counters
*
* \par Command Structure
* #HS_NoArgsCmd_t
* #HS_ResetCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
Expand Down Expand Up @@ -135,7 +135,7 @@
* Enables the Applications Monitor
*
* \par Command Structure
* #HS_NoArgsCmd_t
* #HS_EnableAppMonCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
Expand All @@ -156,9 +156,9 @@
* \par Criticality
* None
*
* \sa #HS_DISABLE_APPMON_CC
* \sa #HS_DISABLE_APP_MON_CC
*/
#define HS_ENABLE_APPMON_CC 2
#define HS_ENABLE_APP_MON_CC 2

/**
* \brief Disable Applications Monitor
Expand All @@ -167,7 +167,7 @@
* Disables the Applications Monitor
*
* \par Command Structure
* #HS_NoArgsCmd_t
* #HS_DisableAppMonCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
Expand All @@ -188,9 +188,9 @@
* \par Criticality
* None
*
* \sa #HS_ENABLE_APPMON_CC
* \sa #HS_ENABLE_APP_MON_CC
*/
#define HS_DISABLE_APPMON_CC 3
#define HS_DISABLE_APP_MON_CC 3

/**
* \brief Enable Events Monitor
Expand All @@ -199,7 +199,7 @@
* Enables the Events Monitor
*
* \par Command Structure
* #HS_NoArgsCmd_t
* #HS_EnableEventMonCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
Expand All @@ -220,9 +220,9 @@
* \par Criticality
* None
*
* \sa #HS_DISABLE_EVENTMON_CC
* \sa #HS_DISABLE_EVENT_MON_CC
*/
#define HS_ENABLE_EVENTMON_CC 4
#define HS_ENABLE_EVENT_MON_CC 4

/**
* \brief Disable Events Monitor
Expand All @@ -231,7 +231,7 @@
* Disables the Events Monitor
*
* \par Command Structure
* #HS_NoArgsCmd_t
* #HS_DisableEventMonCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
Expand All @@ -252,9 +252,9 @@
* \par Criticality
* None
*
* \sa #HS_ENABLE_EVENTMON_CC
* \sa #HS_ENABLE_EVENT_MON_CC
*/
#define HS_DISABLE_EVENTMON_CC 5
#define HS_DISABLE_EVENT_MON_CC 5

/**
* \brief Enable Aliveness Indicator
Expand All @@ -263,7 +263,7 @@
* Enables the Aliveness Indicator UART output
*
* \par Command Structure
* #HS_NoArgsCmd_t
* #HS_EnableAlivenessCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
Expand Down Expand Up @@ -295,7 +295,7 @@
* Disables the Aliveness Indicator UART output
*
* \par Command Structure
* #HS_NoArgsCmd_t
* #HS_DisableAlivenessCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
Expand Down Expand Up @@ -327,7 +327,7 @@
* Resets the count of HS performed resets maintained by HS
*
* \par Command Structure
* #HS_NoArgsCmd_t
* #HS_ResetResetsPerformedCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
Expand Down Expand Up @@ -391,7 +391,7 @@
* Enables the CPU Hogging Indicator Event Message
*
* \par Command Structure
* #HS_NoArgsCmd_t
* #HS_EnableCpuHogCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
Expand All @@ -412,9 +412,9 @@
* \par Criticality
* None
*
* \sa #HS_DISABLE_CPUHOG_CC
* \sa #HS_DISABLE_CPU_HOG_CC
*/
#define HS_ENABLE_CPUHOG_CC 10
#define HS_ENABLE_CPU_HOG_CC 10

/**
* \brief Disable CPU Hogging Indicator
Expand All @@ -423,7 +423,7 @@
* Disables the CPU Hogging Indicator Event Message
*
* \par Command Structure
* #HS_NoArgsCmd_t
* #HS_DisableCpuHogCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
Expand All @@ -444,9 +444,9 @@
* \par Criticality
* None
*
* \sa #HS_ENABLE_CPUHOG_CC
* \sa #HS_ENABLE_CPU_HOG_CC
*/
#define HS_DISABLE_CPUHOG_CC 11
#define HS_DISABLE_CPU_HOG_CC 11

/**\}*/

Expand Down
3 changes: 2 additions & 1 deletion fsw/src/hs_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ int32 HS_SbInit(void)
int32 Status;

/* Initialize housekeeping packet */
CFE_MSG_Init(&HS_AppData.HkPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(HS_HK_TLM_MID), sizeof(HS_HkPacket_t));
CFE_MSG_Init(CFE_MSG_PTR(HS_AppData.HkPacket.TelemetryHeader), CFE_SB_ValueToMsgId(HS_HK_TLM_MID),
sizeof(HS_HkPacket_t));

/* Create Command Pipe */
Status = CFE_SB_CreatePipe(&HS_AppData.CmdPipe, HS_CMD_PIPE_DEPTH, HS_CMD_PIPE_NAME);
Expand Down
Loading

0 comments on commit 76915e9

Please sign in to comment.