Example #1
0
void *Ut_CFE_SB_GetUserDataHook(CFE_SB_MsgPtr_t MsgPtr)
{
#ifdef MESSAGE_FORMAT_IS_CCSDS
    uint8           *BytePtr;
    CFE_SB_MsgId_t  MsgId;
    uint16          HdrSize;

    BytePtr = (uint8 *)MsgPtr;
    MsgId   = (CFE_SB_MsgId_t)MsgPtr->Hdr.StreamId;
    HdrSize = CFE_SB_MsgHdrSize(MsgId);

    return (BytePtr + HdrSize);
#endif
}/* end Ut_CFE_SB_GetUserDataHook */
Example #2
0
/******************************************************************************
**  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 */
Example #3
0
/******************************************************************************
**  Function:  CFE_SB_GetUserDataLength()
**
**  Purpose:
**    Get the length of the user data of a message (total size - hdrs).
**
**  Arguments:
**    MsgPtr - Pointer to a CFE_SB_Msg_t
**
**  Return:
**    Size of the message minus the headers
*/
uint16 CFE_SB_GetUserDataLength(CFE_SB_MsgPtr_t MsgPtr)
{
#ifdef MESSAGE_FORMAT_IS_CCSDS
    uint16 TotalMsgSize;
    uint16 HdrSize;

    CFE_SB_MsgId_t MsgId;
    MsgId = CCSDS_RD_SID(MsgPtr->Hdr);
    TotalMsgSize = CFE_SB_GetTotalMsgLength(MsgPtr);
    HdrSize = CFE_SB_MsgHdrSize(MsgId);

    return (TotalMsgSize - HdrSize);
#endif
}/* end CFE_SB_GetUserDataLength */
Example #4
0
/******************************************************************************
**  Function:  CFE_SB_GetUserData()
**
**  Purpose:
**    Get a pointer to the user data portion of a message.
**
**  Arguments:
**    MsgPtr - Pointer to a CFE_SB_Msg_t
**
**  Return:
**    Pointer to the first byte after the headers
*/
void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr)
{
#ifdef MESSAGE_FORMAT_IS_CCSDS
    uint8           *BytePtr;
    CFE_SB_MsgId_t  MsgId;
    uint16          HdrSize;

    BytePtr = (uint8 *)MsgPtr;
    MsgId = CCSDS_RD_SID(MsgPtr->Hdr);
    HdrSize = CFE_SB_MsgHdrSize(MsgId);

    return (BytePtr + HdrSize);
#endif
}/* end CFE_SB_GetUserData */
Example #5
0
uint16 Ut_CFE_SB_GetUserDataLengthHook(CFE_SB_MsgPtr_t MsgPtr)
{
#ifdef MESSAGE_FORMAT_IS_CCSDS
    uint16 TotalMsgSize;
    uint16 HdrSize;

    CFE_SB_MsgId_t MsgId;
    MsgId = (CFE_SB_MsgId_t)MsgPtr->Hdr.StreamId;

    TotalMsgSize = CFE_SB_GetTotalMsgLength(MsgPtr);
    HdrSize = CFE_SB_MsgHdrSize(MsgId);

    return (TotalMsgSize - HdrSize);
#endif
}/* end Ut_CFE_SB_GetUserDataLengthHook */
Example #6
0
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 */