void Ut_CFE_SB_SetTotalMsgLengthHook(CFE_SB_MsgPtr_t MsgPtr,uint16 TotalLength) { #ifdef MESSAGE_FORMAT_IS_CCSDS CCSDS_WR_LEN(MsgPtr->Hdr,TotalLength); #endif }/* end Ut_CFE_SB_SetTotalMsgLengthHook */
/****************************************************************************** ** Function: CFE_SB_SetUserDataLength() ** ** Purpose: ** Set the length field in the hdr, given the user data length. ** ** Arguments: ** MsgPtr - Pointer to a CFE_SB_Msg_t ** DataLength - Length of the user data ** ** Return: ** (none) */ void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr,uint16 DataLength) { #ifdef MESSAGE_FORMAT_IS_CCSDS uint32 TotalMsgSize, HdrSize; CFE_SB_MsgId_t MsgId; MsgId = CCSDS_RD_SID(MsgPtr->Hdr); HdrSize = CFE_SB_MsgHdrSize(MsgId); TotalMsgSize = HdrSize + DataLength; CCSDS_WR_LEN(MsgPtr->Hdr,TotalMsgSize); #endif }/* end CFE_SB_SetUserDataLength */
void Ut_CFE_SB_SetUserDataLengthHook(CFE_SB_MsgPtr_t MsgPtr,uint16 DataLength) { #ifdef MESSAGE_FORMAT_IS_CCSDS uint32 TotalMsgSize, HdrSize; CFE_SB_MsgId_t MsgId; MsgId = (CFE_SB_MsgId_t)MsgPtr->Hdr.StreamId; TotalMsgSize = CFE_SB_GetTotalMsgLength(MsgPtr); HdrSize = CFE_SB_MsgHdrSize(MsgId); TotalMsgSize = HdrSize + DataLength; CCSDS_WR_LEN(MsgPtr->Hdr,TotalMsgSize); #endif }/* end Ut_CFE_SB_SetUserDataLengthHook */
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() */