Skip to content

Commit

Permalink
Fix #394, revert merge of PR #383.
Browse files Browse the repository at this point in the history
This reverts commit 4e97d3b, reversing
changes made to 913b5fc.
  • Loading branch information
dzbaker committed Jul 11, 2023
1 parent 0f18ae4 commit efa3da4
Show file tree
Hide file tree
Showing 18 changed files with 555 additions and 556 deletions.
96 changes: 52 additions & 44 deletions fsw/inc/cf_msg.h

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions fsw/src/cf_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ CF_AppData_t CF_AppData;
*-----------------------------------------------------------------*/
void CF_HkCmd(void)
{
CFE_MSG_SetMsgTime(&CF_AppData.HkPacket.tlm_header.Msg, CFE_TIME_GetTime());
/* return value ignored */ CFE_SB_TransmitMsg(&CF_AppData.HkPacket.tlm_header.Msg, true);
CFE_MSG_SetMsgTime(&CF_AppData.hk.tlm_header.Msg, CFE_TIME_GetTime());
/* return value ignored */ CFE_SB_TransmitMsg(&CF_AppData.hk.tlm_header.Msg, true);
}

/*----------------------------------------------------------------
Expand Down Expand Up @@ -205,7 +205,7 @@ CFE_Status_t CF_Init(void)

CF_AppData.run_status = CFE_ES_RunStatus_APP_RUN;

CFE_MSG_Init(&CF_AppData.HkPacket.tlm_header.Msg, CFE_SB_ValueToMsgId(CF_HK_TLM_MID), sizeof(CF_AppData.HkPacket));
CFE_MSG_Init(&CF_AppData.hk.tlm_header.Msg, CFE_SB_ValueToMsgId(CF_HK_TLM_MID), sizeof(CF_AppData.hk));

status = CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY);
if (status != CFE_SUCCESS)
Expand Down Expand Up @@ -301,7 +301,7 @@ void CF_ProcessMsg(CFE_SB_Buffer_t *msg)
break;

default:
++CF_AppData.HkPacket.CommandErrorCounter;
++CF_AppData.hk.counters.err;
CFE_EVS_SendEvent(CF_EID_ERR_INIT_CMD_LENGTH, CFE_EVS_EventType_ERROR,
"CF: invalid command packet id=0x%lx", (unsigned long)CFE_SB_MsgIdToValue(msg_id));
break;
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/cf_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
*/
typedef struct
{
CF_HkPacket_t HkPacket;
CF_HkPacket_t hk;

uint32 run_status;

Expand Down
34 changes: 17 additions & 17 deletions fsw/src/cf_cfdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ CFE_Status_t CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph)
{
CFE_EVS_SendEvent(CF_EID_ERR_PDU_TRUNCATION, CFE_EVS_EventType_ERROR,
"CF: PDU rejected due to EID/seq number field truncation");
++CF_AppData.HkPacket.channel_hk[chan_num].counters.recv.error;
++CF_AppData.hk.channel_hk[chan_num].counters.recv.error;
ret = CF_ERROR;
}
/*
Expand All @@ -611,7 +611,7 @@ CFE_Status_t CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph)
{
CFE_EVS_SendEvent(CF_EID_ERR_PDU_LARGE_FILE, CFE_EVS_EventType_ERROR,
"CF: PDU with large file bit received (unsupported)");
++CF_AppData.HkPacket.channel_hk[chan_num].counters.recv.error;
++CF_AppData.hk.channel_hk[chan_num].counters.recv.error;
ret = CF_ERROR;
}
else
Expand All @@ -625,13 +625,13 @@ CFE_Status_t CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph)
{
CFE_EVS_SendEvent(CF_EID_ERR_PDU_SHORT_HEADER, CFE_EVS_EventType_ERROR, "CF: PDU too short (%lu received)",
(unsigned long)CF_CODEC_GET_SIZE(ph->pdec));
++CF_AppData.HkPacket.channel_hk[chan_num].counters.recv.error;
++CF_AppData.hk.channel_hk[chan_num].counters.recv.error;
ret = CF_SHORT_PDU_ERROR;
}
else
{
/* PDU is ok, so continue processing */
++CF_AppData.HkPacket.channel_hk[chan_num].counters.recv.pdu;
++CF_AppData.hk.channel_hk[chan_num].counters.recv.pdu;
}
}

Expand All @@ -656,7 +656,7 @@ CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph)
CFE_EVS_SendEvent(CF_EID_ERR_PDU_MD_SHORT, CFE_EVS_EventType_ERROR,
"CF: metadata packet too short: %lu bytes received",
(unsigned long)CF_CODEC_GET_SIZE(ph->pdec));
++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error;
++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error;
ret = CF_PDU_METADATA_ERROR;
}
else
Expand All @@ -678,7 +678,7 @@ CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph)
CFE_EVS_SendEvent(CF_EID_ERR_PDU_INVALID_SRC_LEN, CFE_EVS_EventType_ERROR,
"CF: metadata PDU rejected due to invalid length in source filename of 0x%02x",
md->source_filename.length);
++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error;
++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error;
ret = CF_PDU_METADATA_ERROR;
}
else
Expand All @@ -690,7 +690,7 @@ CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph)
CFE_EVS_SendEvent(CF_EID_ERR_PDU_INVALID_DST_LEN, CFE_EVS_EventType_ERROR,
"CF: metadata PDU rejected due to invalid length in dest filename of 0x%02x",
md->dest_filename.length);
++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error;
++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error;
ret = CF_PDU_METADATA_ERROR;
}
else
Expand Down Expand Up @@ -735,7 +735,7 @@ CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph)
CFE_EVS_SendEvent(CF_EID_ERR_PDU_FD_SHORT, CFE_EVS_EventType_ERROR,
"CF: filedata PDU too short: %lu bytes received", (unsigned long)CF_CODEC_GET_SIZE(ph->pdec));
CF_CFDP_SetTxnStatus(t, CF_TxnStatus_PROTOCOL_ERROR);
++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error;
++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error;
ret = CF_SHORT_PDU_ERROR;
}
else if (ph->pdu_header.segment_meta_flag)
Expand All @@ -744,7 +744,7 @@ CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph)
CFE_EVS_SendEvent(CF_EID_ERR_PDU_FD_UNSUPPORTED, CFE_EVS_EventType_ERROR,
"CF: filedata PDU with segment metadata received");
CF_CFDP_SetTxnStatus(t, CF_TxnStatus_PROTOCOL_ERROR);
++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error;
++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error;
ret = CF_ERROR;
}

Expand Down Expand Up @@ -850,7 +850,7 @@ CFE_Status_t CF_CFDP_RecvNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph)
*-----------------------------------------------------------------*/
void CF_CFDP_RecvDrop(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph)
{
++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.dropped;
++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.dropped;
}

/*----------------------------------------------------------------
Expand Down Expand Up @@ -918,14 +918,14 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph)
{
CFE_EVS_SendEvent(CF_EID_ERR_CFDP_IDLE_MD, CFE_EVS_EventType_ERROR,
"CF: got invalid md PDU -- abandoning transaction");
++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error;
++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error;
/* leave state as idle, which will reset below */
}
break;
default:
CFE_EVS_SendEvent(CF_EID_ERR_CFDP_FD_UNHANDLED, CFE_EVS_EventType_ERROR,
"CF: unhandled file directive code 0x%02x in idle state", fdh->directive_code);
++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error;
++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error;
break;
}
}
Expand Down Expand Up @@ -1327,7 +1327,7 @@ static CFE_Status_t CF_CFDP_PlaybackDir_Initiate(CF_Playback_t *p, const char *s
{
CFE_EVS_SendEvent(CF_EID_ERR_CFDP_OPENDIR, CFE_EVS_EventType_ERROR,
"CF: failed to open playback directory %s, error=%ld", src_filename, (long)ret);
++CF_AppData.HkPacket.channel_hk[chan].counters.fault.directory_read;
++CF_AppData.hk.channel_hk[chan].counters.fault.directory_read;
}
else
{
Expand Down Expand Up @@ -1482,7 +1482,7 @@ static void CF_CFDP_ProcessPlaybackDirectories(CF_Channel_t *c)
{
CF_CFDP_ProcessPlaybackDirectory(c, &c->playback[i]);
CF_CFDP_UpdatePollPbCounted(&c->playback[i], c->playback[i].busy,
&CF_AppData.HkPacket.channel_hk[chan_index].playback_counter);
&CF_AppData.hk.channel_hk[chan_index].playback_counter);
}
}

Expand Down Expand Up @@ -1551,7 +1551,7 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c)
count_check = 1;
}

CF_CFDP_UpdatePollPbCounted(&p->pb, count_check, &CF_AppData.HkPacket.channel_hk[chan_index].poll_counter);
CF_CFDP_UpdatePollPbCounted(&p->pb, count_check, &CF_AppData.hk.channel_hk[chan_index].poll_counter);
}
}

Expand All @@ -1576,7 +1576,7 @@ void CF_CFDP_CycleEngine(void)
/* consume all received messages, even if channel is frozen */
CF_CFDP_ReceiveMessage(c);

if (!CF_AppData.HkPacket.channel_hk[i].frozen)
if (!CF_AppData.hk.channel_hk[i].frozen)
{
/* handle ticks before tx cycle. Do this because there may be a limited number of TX messages available
* this cycle, and it's important to respond to class 2 ACK/NAK more than it is to send new filedata
Expand Down Expand Up @@ -1829,7 +1829,7 @@ void CF_CFDP_DisableEngine(void)
}

/* finally all queue counters must be reset */
memset(&CF_AppData.HkPacket.channel_hk[i].q_size, 0, sizeof(CF_AppData.HkPacket.channel_hk[i].q_size));
memset(&CF_AppData.hk.channel_hk[i].q_size, 0, sizeof(CF_AppData.hk.channel_hk[i].q_size));

CFE_SB_DeletePipe(c->pipe);
}
Expand Down
6 changes: 3 additions & 3 deletions fsw/src/cf_cfdp_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph,
}
else
{
++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.spurious;
++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious;
CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_DC_INV, CFE_EVS_EventType_ERROR,
"CF R%d(%lu:%lu): received PDU with invalid directive code %d for sub-state %d",
(t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid,
Expand All @@ -74,7 +74,7 @@ void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph,
}
else
{
++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.dropped;
++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.dropped;
}
}

Expand Down Expand Up @@ -118,7 +118,7 @@ void CF_CFDP_S_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph,
}
else
{
++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.spurious;
++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious;
CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_DC_INV, CFE_EVS_EventType_ERROR,
"CF S%d(%lu:%lu): received PDU with invalid directive code %d for sub-state %d",
(t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid,
Expand Down
Loading

0 comments on commit efa3da4

Please sign in to comment.