Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #56, cmd and tlm messages use payload sub-structure #58

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/dox_src/cfs_md.dox
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
<B> (Q)
Which MD telemetry can be used to confirm that dwell packet processing is proceeding?
</B> <BR> <BR> <I>
#MD_HkTlm_t.Countdown should change each time a Wakeup Message is received
#MD_HkTlm_Payload_t.Countdown should change each time a Wakeup Message is received
for all dwell streams that are being actively processed.
</I>

Expand Down Expand Up @@ -333,9 +333,9 @@
1) An information event, #MD_JAM_DWELL_INF_EID, will be issued showing the table number and
entry number affected.
2) The following housekeeping parameters for the corresponding dwell table may be affected:
- #MD_HkTlm_t.DwellTblAddrCount
- #MD_HkTlm_t.NumWaitsPerPkt
- #MD_HkTlm_t.ByteCount
- #MD_HkTlm_Payload_t.DwellTblAddrCount
- #MD_HkTlm_Payload_t.NumWaitsPerPkt
- #MD_HkTlm_Payload_t.ByteCount

</I>

Expand Down
93 changes: 66 additions & 27 deletions fsw/inc/md_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,41 @@ typedef struct
char SymName[OS_MAX_SYM_LEN]; /**< \brief Symbol name string */
} MD_SymAddr_t;

/**
* \brief Start and Stop Dwell Commands Payload
*/
typedef struct
{
uint16 TableMask; /**< \brief 0x0001=TBL1 bit, 0x0002=TBL2 bit, 0x0004=TBL3 bit, etc. */
uint16 Padding; /**< \brief structure padding */
} MD_CmdStartStop_Payload_t;

/**
* \brief Jam Dwell Command Payload
*/
typedef struct
{
uint16 TableId; /**< \brief Table Id: 1..#MD_NUM_DWELL_TABLES */
uint16 EntryId; /**< \brief Address index: 1..#MD_DWELL_TABLE_SIZE */
uint16 FieldLength; /**< \brief Length of Dwell Field : 0, 1, 2, or 4 */
uint16 DwellDelay; /**< \brief Dwell Delay (number of task wakeup calls before following dwell) */
MD_SymAddr_t DwellAddress; /**< \brief Dwell Address in #MD_SymAddr_t format */
} MD_CmdJam_Payload_t;

#if MD_SIGNATURE_OPTION == 1

/**
* \brief Set Signature Command Payload
*/
typedef struct
{
uint16 TableId; /**< \brief Table Id: 1..MD_NUM_DWELL_TABLES */
uint16 Padding; /**< \brief Padding */
char Signature[MD_SIGNATURE_FIELD_LENGTH]; /**< \brief Sigature */
} MD_CmdSetSignature_Payload_t;

#endif

/**
* \brief Generic "no arguments" command
*
Expand All @@ -70,10 +105,8 @@ typedef struct
*/
typedef struct
{
CFE_MSG_CommandHeader_t Header; /**< \brief Command header */

uint16 TableMask; /**< \brief 0x0001=TBL1 bit, 0x0002=TBL2 bit, 0x0004=TBL3 bit, etc. */
uint16 Padding; /**< \brief structure padding */
CFE_MSG_CommandHeader_t Header; /**< \brief Command header */
MD_CmdStartStop_Payload_t Payload;
} MD_CmdStartStop_t;

/**
Expand All @@ -84,12 +117,7 @@ typedef struct
typedef struct
{
CFE_MSG_CommandHeader_t Header; /**< \brief Command header */

uint16 TableId; /**< \brief Table Id: 1..#MD_NUM_DWELL_TABLES */
uint16 EntryId; /**< \brief Address index: 1..#MD_DWELL_TABLE_SIZE */
uint16 FieldLength; /**< \brief Length of Dwell Field : 0, 1, 2, or 4 */
uint16 DwellDelay; /**< \brief Dwell Delay (number of task wakeup calls before following dwell) */
MD_SymAddr_t DwellAddress; /**< \brief Dwell Address in #MD_SymAddr_t format */
MD_CmdJam_Payload_t Payload;
} MD_CmdJam_t;

#if MD_SIGNATURE_OPTION == 1
Expand All @@ -101,11 +129,8 @@ typedef struct
*/
typedef struct
{
CFE_MSG_CommandHeader_t Header; /**< \brief Command Header */

uint16 TableId; /**< \brief Table Id: 1..MD_NUM_DWELL_TABLES */
uint16 Padding; /**< \brief Padding */
char Signature[MD_SIGNATURE_FIELD_LENGTH]; /**< \brief Sigature */
CFE_MSG_CommandHeader_t Header; /**< \brief Command Header */
MD_CmdSetSignature_Payload_t Payload;
} MD_CmdSetSignature_t;

#endif
Expand All @@ -118,12 +143,10 @@ typedef struct
*/

/**
* \brief Memory Dwell HK Telemetry format
* \brief Memory Dwell HK Telemetry Payload
*/
typedef struct
{
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */

uint8 InvalidCmdCntr; /**< \brief Count of invalid commands received */
uint8 ValidCmdCntr; /**< \brief Count of valid commands received */
uint16 DwellEnabledMask; /**< \brief Dwell table enable bitmask 0x0001=TBL1, etc */
Expand All @@ -135,20 +158,13 @@ typedef struct
uint16 DwellTblEntry[MD_NUM_DWELL_TABLES]; /**< \brief Next dwell table entry to be processed */

uint16 Countdown[MD_NUM_DWELL_TABLES]; /**< \brief Current value of countdown timer */
} MD_HkTlm_t;
} MD_HkTlm_Payload_t;

/**
* \brief Memory Dwell Housekeeping telemetry packet length
*/
#define MD_HK_TLM_LNGTH sizeof(MD_HkTlm_t)

/**
* \brief Memory Dwell Telemetry Packet format
* \brief Memory Dwell Telemetry Packet Payload
*/
typedef struct
{
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */

uint8 TableId; /**< \brief TableId from 1 to #MD_NUM_DWELL_TABLES */
uint8 AddrCount; /**< \brief Number of addresses being sent - 1..#MD_DWELL_TABLE_SIZE valid */
uint16 ByteCount; /**< \brief Number of bytes of dwell data contained in packet */
Expand All @@ -159,6 +175,29 @@ typedef struct
#endif

uint8 Data[MD_DWELL_TABLE_SIZE * 4]; /**< \brief Dwell data (can be variable size based on dfn) */
} MD_DwellPkt_Payload_t;

/**
* \brief Memory Dwell HK Telemetry format
*/
typedef struct
{
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */
MD_HkTlm_Payload_t Payload;
} MD_HkTlm_t;

/**
* \brief Memory Dwell Housekeeping telemetry packet length
*/
#define MD_HK_TLM_LNGTH sizeof(MD_HkTlm_t)

/**
* \brief Memory Dwell Telemetry Packet format
*/
typedef struct
{
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */
MD_DwellPkt_Payload_t Payload;
} MD_DwellPkt_t;

/**
Expand Down
34 changes: 17 additions & 17 deletions fsw/inc/md_msgdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* \par Command Verification
* Successful execution of this command may be verified with the
* following telemetry:
* - #MD_HkTlm_t.ValidCmdCntr will increment
* - #MD_HkTlm_Payload_t.ValidCmdCntr will increment
* - The #MD_NOOP_INF_EID informational event message will
* be generated
*
Expand All @@ -58,7 +58,7 @@
*
* Evidence of an unexpected command length error may be found
* in the following telemetry:
* - #MD_HkTlm_t.InvalidCmdCntr will increment.
* - #MD_HkTlm_Payload_t.InvalidCmdCntr will increment.
* - The #MD_CMD_LEN_ERR_EID error event message will be issued.
*
* \par Criticality
Expand All @@ -81,8 +81,8 @@
* \par Command Verification
* Successful execution of this command may be verified with
* the following telemetry:
* - #MD_HkTlm_t.ValidCmdCntr will be set to zero.
* - #MD_HkTlm_t.InvalidCmdCntr will be set to zero.
* - #MD_HkTlm_Payload_t.ValidCmdCntr will be set to zero.
* - #MD_HkTlm_Payload_t.InvalidCmdCntr will be set to zero.
* - The #MD_RESET_CNTRS_DBG_EID debug event message will be generated.
*
* \par Error Conditions
Expand All @@ -91,7 +91,7 @@
*
* Evidence of an unexpected command length error may be found
* in the following telemetry:
* - #MD_HkTlm_t.InvalidCmdCntr will increment.
* - #MD_HkTlm_Payload_t.InvalidCmdCntr will increment.
* - The #MD_CMD_LEN_ERR_EID error event message will be issued.
*
* \par Criticality
Expand Down Expand Up @@ -144,8 +144,8 @@
* \par Command Verification
* Successful execution of this command may be verified with
* the following telemetry:
* - #MD_HkTlm_t.ValidCmdCntr will increment.
* - #MD_HkTlm_t.DwellEnabledMask will be enabled (bit 1 = TBL1, etc)
* - #MD_HkTlm_Payload_t.ValidCmdCntr will increment.
* - #MD_HkTlm_Payload_t.DwellEnabledMask will be enabled (bit 1 = TBL1, etc)
* - The #MD_START_DWELL_INF_EID informational event message
* will be issued.
*
Expand All @@ -156,12 +156,12 @@
*
* Evidence of an unexpected command length error may be found
* in the following telemetry:
* - #MD_HkTlm_t.InvalidCmdCntr increments.
* - #MD_HkTlm_Payload_t.InvalidCmdCntr increments.
* - The #MD_CMD_LEN_ERR_EID error event message is issued.
*
* Evidence of an invalid value for Dwell Table mask argument may be found
* in the following telemetry:
* - #MD_HkTlm_t.InvalidCmdCntr increments.
* - #MD_HkTlm_Payload_t.InvalidCmdCntr increments.
* - The #MD_EMPTY_TBLMASK_ERR_EID error event message is issued.
*
**
Expand Down Expand Up @@ -197,8 +197,8 @@
* \par Command Verification
* Successful execution of this command may be verified with
* the following telemetry:
* - #MD_HkTlm_t.ValidCmdCntr increments.
* - #MD_HkTlm_t.DwellEnabledMask will be disabled (bit 1 = TBL1, etc)
* - #MD_HkTlm_Payload_t.ValidCmdCntr increments.
* - #MD_HkTlm_Payload_t.DwellEnabledMask will be disabled (bit 1 = TBL1, etc)
* - The #MD_STOP_DWELL_INF_EID informational event message is issued.
*
* \par Error Conditions
Expand All @@ -208,12 +208,12 @@
*
* Evidence of an unexpected command length error may be found
* in the following telemetry:
* - #MD_HkTlm_t.InvalidCmdCntr increments.
* - #MD_HkTlm_Payload_t.InvalidCmdCntr increments.
* - The #MD_CMD_LEN_ERR_EID error event message is issued.
*
* Evidence of an invalid value for Dwell Table argument may be found
* in the following telemetry:
* - #MD_HkTlm_t.InvalidCmdCntr increments.
* - #MD_HkTlm_Payload_t.InvalidCmdCntr increments.
* - The #MD_EMPTY_TBLMASK_ERR_EID error event message is issued.
*
* \par Criticality
Expand Down Expand Up @@ -247,7 +247,7 @@
* \par Command Verification
* Nominal successful execution of this command may be verified with
* the following telemetry:
* - #MD_HkTlm_t.ValidCmdCntr increments.
* - #MD_HkTlm_Payload_t.ValidCmdCntr increments.
* - The #MD_JAM_DWELL_INF_EID or #MD_JAM_NULL_DWELL_INF_EID informational event message is issued.
*
* \par Error Conditions
Expand All @@ -261,7 +261,7 @@
* - Specified Dwell Address is not properly aligned for the specified Dwell Length
* (Event message #MD_JAM_ADDR_NOT_32BIT_ERR_EID or #MD_JAM_ADDR_NOT_16BIT_ERR_EID is issued)
*
* Any time the command fails, #MD_HkTlm_t.InvalidCmdCntr increments.
* Any time the command fails, #MD_HkTlm_Payload_t.InvalidCmdCntr increments.
*
* \par Criticality
* None.
Expand All @@ -282,14 +282,14 @@
* \par Command Verification
* Successful execution of this command may be verified with
* the following telemetry:
* - #MD_HkTlm_t.ValidCmdCntr will increment.
* - #MD_HkTlm_Payload_t.ValidCmdCntr will increment.
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Unexpected command length. (Event message #MD_CMD_LEN_ERR_EID is issued)
* - Dwell Table ID is invalid. (Event message #MD_INVALID_SIGNATURE_TABLE_ERR_EID is issued)
*
* Any time the command fails, #MD_HkTlm_t.InvalidCmdCntr increments.
* Any time the command fails, #MD_HkTlm_Payload_t.InvalidCmdCntr increments.
*
* \par Criticality
* None.
Expand Down
20 changes: 10 additions & 10 deletions fsw/src/md_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ CFE_Status_t MD_InitSoftwareBusServices(void)
MD_DWELL_PKT_LNGTH); /* this is max pkt size */

#if MD_SIGNATURE_OPTION == 1
MD_AppData.MD_DwellPkt[TblIndex].Signature[0] = '\0';
MD_AppData.MD_DwellPkt[TblIndex].Payload.Signature[0] = '\0';
#endif
}

Expand Down Expand Up @@ -664,8 +664,8 @@ void MD_HkStatus()

/* Assign values for command counters */

HkPktPtr->ValidCmdCntr = MD_AppData.CmdCounter;
HkPktPtr->InvalidCmdCntr = MD_AppData.ErrCounter;
HkPktPtr->Payload.ValidCmdCntr = MD_AppData.CmdCounter;
HkPktPtr->Payload.InvalidCmdCntr = MD_AppData.ErrCounter;

for (TblIndex = 0; TblIndex < MD_NUM_DWELL_TABLES; TblIndex++)
{
Expand All @@ -686,15 +686,15 @@ void MD_HkStatus()
/*
** Insert current values for each dwell stream
*/
HkPktPtr->DwellTblAddrCount[TblIndex] = ThisDwellTablePtr->AddrCount;
HkPktPtr->NumWaitsPerPkt[TblIndex] = ThisDwellTablePtr->Rate;
HkPktPtr->DwellPktOffset[TblIndex] = ThisDwellTablePtr->PktOffset;
HkPktPtr->ByteCount[TblIndex] = ThisDwellTablePtr->DataSize;
HkPktPtr->DwellTblEntry[TblIndex] = ThisDwellTablePtr->CurrentEntry;
HkPktPtr->Countdown[TblIndex] = ThisDwellTablePtr->Countdown;
HkPktPtr->Payload.DwellTblAddrCount[TblIndex] = ThisDwellTablePtr->AddrCount;
HkPktPtr->Payload.NumWaitsPerPkt[TblIndex] = ThisDwellTablePtr->Rate;
HkPktPtr->Payload.DwellPktOffset[TblIndex] = ThisDwellTablePtr->PktOffset;
HkPktPtr->Payload.ByteCount[TblIndex] = ThisDwellTablePtr->DataSize;
HkPktPtr->Payload.DwellTblEntry[TblIndex] = ThisDwellTablePtr->CurrentEntry;
HkPktPtr->Payload.Countdown[TblIndex] = ThisDwellTablePtr->Countdown;
}

HkPktPtr->DwellEnabledMask = MemDwellEnableBits;
HkPktPtr->Payload.DwellEnabledMask = MemDwellEnableBits;

/*
** Send housekeeping telemetry packet...
Expand Down
Loading