uint16 Ut_CFE_SB_MsgHdrSizeHook(CFE_SB_MsgId_t MsgId) { #ifdef MESSAGE_FORMAT_IS_CCSDS uint16 size; CCSDS_PriHdr_t CCSDSPriHdr; CCSDS_WR_SID(CCSDSPriHdr,MsgId); /* if secondary hdr is not present... */ if(CCSDS_RD_SHDR(CCSDSPriHdr) == 0){ size = sizeof(CCSDS_PriHdr_t); }else if(CCSDS_RD_TYPE(CCSDSPriHdr) == CCSDS_CMD){ size = CFE_SB_CMD_HDR_SIZE; }else{ size = CFE_SB_TLM_HDR_SIZE; } return size; #endif }/* end Ut_CFE_SB_MsgHdrSizeHook */
void Ut_CFE_SB_SetMsgIdHook(CFE_SB_MsgPtr_t MsgPtr, CFE_SB_MsgId_t MsgId) { #ifdef MESSAGE_FORMAT_IS_CCSDS CCSDS_WR_SID(MsgPtr->Hdr,MsgId); #endif }/* end Ut_CFE_SB_SetMsgIdHook */
void CCSDS_InitPkt (CCSDS_PriHdr_t *PktPtr, uint16 StreamId, uint16 Length, boolean Clear ) { uint16 SeqCount; /* Save the sequence count in case it must be preserved. */ SeqCount = CCSDS_RD_SEQ(*PktPtr); /* Zero the entire packet if needed. */ if (Clear) memset((void *)PktPtr, 0, Length); /* Clear the primary header. */ CCSDS_CLR_PRI_HDR(*PktPtr); /* Set the stream ID and length fields in the primary header. */ CCSDS_WR_SID(*PktPtr, StreamId); CCSDS_WR_LEN(*PktPtr, Length); /* Restore the sequence count if needed. */ if (!Clear) CCSDS_WR_SEQ(*PktPtr, SeqCount); } /* END CCSDS_InitPkt() */
/** ** \brief CFE_SB_SetMsgId stub function ** ** \par Description ** This function is used to mimic the response of the cFE SB function ** CFE_SB_SetMsgId. ** ** \par Assumptions, External Events, and Notes: ** None ** ** \returns ** This function does not return a value. ** ******************************************************************************/ void CFE_SB_SetMsgId(CFE_SB_MsgPtr_t MsgPtr, CFE_SB_MsgId_t MsgId) { SetMsgIdRtn.value = MsgId; SetMsgIdRtn.count++; CCSDS_WR_SID(MsgPtr->Hdr, MsgId); }