Skip to content

Commit

Permalink
Fix nasa#711, Applied style
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Jun 10, 2020
1 parent 47aa6a7 commit 84569de
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 86 deletions.
18 changes: 9 additions & 9 deletions fsw/cfe-core/src/msg/inc_private/cfe_msg_defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@

/* Backwards compatibility - TODO could just force users to define */
#ifndef CFE_PLATFORM_DEFAULT_APID
#define CFE_PLATFORM_DEFAULT_APID 0 /**< \brief Default APID, for bits not in MsgId */
#define CFE_PLATFORM_DEFAULT_APID 0 /**< \brief Default APID, for bits not in MsgId */
#endif

#ifndef CFE_MISSION_CCSDSVER
#ifdef MESSAGE_FORMAT_IS_CCSDS_VER_2
#define CFE_MISSION_CCSDSVER 1 /**< \brief Default CCSDS Version, cFS Ver 2 historically = 1 */
#else
#define CFE_MISSION_CCSDSVER 0 /**< \brief Default CCSDS Version, cFS Ver 1 historically = 0 */
#endif
#ifdef MESSAGE_FORMAT_IS_CCSDS_VER_2
#define CFE_MISSION_CCSDSVER 1 /**< \brief Default CCSDS Version, cFS Ver 2 historically = 1 */
#else
#define CFE_MISSION_CCSDSVER 0 /**< \brief Default CCSDS Version, cFS Ver 1 historically = 0 */
#endif
#endif

#ifndef CFE_PLATFORM_DEFAULT_SUBSYS
#define CFE_PLATFORM_DEFAULT_SUBSYS 0 /**< \brief Default SubSystem, for bits not in MsgId */
#endif
#define CFE_PLATFORM_DEFAULT_SUBSYS 0 /**< \brief Default SubSystem, for bits not in MsgId */
#endif

#ifndef CFE_PLATFORM_EDSVER
#define CFE_PLATFORM_EDSVER 1 /**< \brief Default EDS version, cFS historically = 1 */
#define CFE_PLATFORM_EDSVER 1 /**< \brief Default EDS version, cFS historically = 1 */
#endif

/*****************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions fsw/cfe-core/src/msg/inc_private/cfe_msg_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
* Defines
*/
/* TODO error bits won't fit a new module */
#define CFE_MSG_BAD_ARGUMENT CFE_SB_BAD_ARGUMENT /**< \brief Error - bad argument */
#define CFE_MSG_BAD_ARGUMENT CFE_SB_BAD_ARGUMENT /**< \brief Error - bad argument */
#define CFE_MSG_NOT_IMPLEMENTED CFE_SB_NOT_IMPLEMENTED /**< \brief Error - not implemented */
#define CFE_MSG_WRONG_MSG_TYPE CFE_SB_WRONG_MSG_TYPE /**< \brief Error - wrong type */
#define CFE_MSG_WRONG_MSG_TYPE CFE_SB_WRONG_MSG_TYPE /**< \brief Error - wrong type */

/*****************************************************************************/
/**
Expand Down
3 changes: 1 addition & 2 deletions fsw/cfe-core/src/msg/inc_public/cfe_msg_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ int32 CFE_MSG_SetEndian(CFE_MSG_Message_t *MsgPtr, CFE_MSG_Endian_t Endian);

// TODO playback, subsystem, system


/*****************************************************************************/
/**
* \brief Calculates and sets the checksum of a message
Expand Down Expand Up @@ -436,7 +435,7 @@ int32 CFE_MSG_SetFcnCode(CFE_MSG_Message_t *MsgPtr, CFE_MSG_FcnCode_t FcnCode);
*
* \par Assumptions, External Events, and Notes:
* - If the underlying implementation of messages does not
* include a function code field, then this routine will
* include a function code field, then this routine will
* set FcnCode to zero and return #CFE_MSG_WRONG_MSG_TYPE
*
* \param[in] MsgPtr A pointer to the buffer that contains the message.
Expand Down
33 changes: 16 additions & 17 deletions fsw/cfe-core/src/msg/inc_public/cfe_msg_typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
/*
* Types
*/
typedef uint32 CFE_MSG_Size_t; /**< \brief Message size (CCSDS needs uint32 for max size) */
typedef uint32 CFE_MSG_Checksum_t; /**< \brief Message checksum (Oversized to avoid redefine) */
typedef uint16 CFE_MSG_FcnCode_t; /**< \brief Message function code */
typedef uint32 CFE_MSG_Size_t; /**< \brief Message size (CCSDS needs uint32 for max size) */
typedef uint32 CFE_MSG_Checksum_t; /**< \brief Message checksum (Oversized to avoid redefine) */
typedef uint16 CFE_MSG_FcnCode_t; /**< \brief Message function code */
typedef uint16 CFE_MSG_HeaderVersion_t; /**< \brief Message header version */
typedef uint16 CFE_MSG_ApId_t; /**< \brief Message application ID */
typedef uint16 CFE_MSG_ApId_t; /**< \brief Message application ID */
typedef uint16 CFE_MSG_SequenceCount_t; /**< \brief Message sequence count */
typedef uint16 CFE_MSG_EDSVersion_t; /**< \brief Message EDS version */
typedef uint16 CFE_MSG_Subsystem_t; /**< \brief Message subsystem */
Expand All @@ -50,33 +50,32 @@ typedef enum
CFE_MSG_Type_Invalid, /**< \brief Message type invalid, undefined, not implemented */
CFE_MSG_Type_Cmd, /**< \brief Command message type */
CFE_MSG_Type_Tlm /**< \brief Telemetry message type */
}
CFE_MSG_Type_t;
} CFE_MSG_Type_t;

/** \brief Segmentation flags */
typedef enum
{
CFE_MSG_SegFlag_Invalid, /**< \brief Invalid segmentation flag */
CFE_MSG_SegFlag_Continue, /**< \brief Continuation segment of User Data */
CFE_MSG_SegFlag_First, /**< \brief First segment of User Data */
CFE_MSG_SegFlag_Last, /**< \brief Last segment of User Data */
CFE_MSG_SegFlag_Unsegmented /**< \brief Unsegemented data */
CFE_MSG_SegFlag_Invalid, /**< \brief Invalid segmentation flag */
CFE_MSG_SegFlag_Continue, /**< \brief Continuation segment of User Data */
CFE_MSG_SegFlag_First, /**< \brief First segment of User Data */
CFE_MSG_SegFlag_Last, /**< \brief Last segment of User Data */
CFE_MSG_SegFlag_Unsegmented /**< \brief Unsegemented data */
} CFE_MSG_SegmentationFlag_t;

/** \brief Endian flag */
typedef enum
{
CFE_MSG_Endian_Invalid, /**< \brief Invalid endian setting */
CFE_MSG_Endian_Big, /**< \brief Big endian */
CFE_MSG_Endian_Little /**< \brief Littne endian */
CFE_MSG_Endian_Invalid, /**< \brief Invalid endian setting */
CFE_MSG_Endian_Big, /**< \brief Big endian */
CFE_MSG_Endian_Little /**< \brief Littne endian */
} CFE_MSG_Endian_t;

/** \brief Playback flag */
typedef enum
{
CFE_MSG_PlayFlag_Invalid, /**< \brief Invalid playback setting */
CFE_MSG_PlayFlag_Original, /**< \brief Original */
CFE_MSG_PlayFlag_Playback /**< \brief Playback */
CFE_MSG_PlayFlag_Invalid, /**< \brief Invalid playback setting */
CFE_MSG_PlayFlag_Original, /**< \brief Original */
CFE_MSG_PlayFlag_Playback /**< \brief Playback */
} CFE_MSG_PlayFlag_t;

#endif /* _cfe_msg_typedefs_ */
1 change: 0 additions & 1 deletion fsw/cfe-core/src/msg/src/cfe_msg_ccsdsext.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,4 @@ void CFE_MSG_SetDefaultCCSDSExt(CFE_MSG_Message_t *MsgPtr)
/* Default bits of the subsystem, for whatever isn't set by MsgId */
CFE_MSG_SetSubsystem(MsgPtr, (CFE_MSG_Subsystem_t)CFE_PLATFORM_DEFAULT_SUBSYS);
CFE_MSB_SetSystem(MsgPtr, (CFE_MSG_System_t)CFE_MISSION_SPACECRAFT_ID);

}
11 changes: 3 additions & 8 deletions fsw/cfe-core/src/msg/src/cfe_msg_ccsdspri.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ void CFE_MSG_SetDefaultCCSDSPri(CFE_MSG_Message_t *MsgPtr)

/* Default to complete packets */
CFE_MSG_SetSegmentationFlag(MsgPtr, CFE_MSG_SegFlag_Unsegmented);

}

/******************************************************************************
Expand All @@ -75,7 +74,6 @@ int32 CFE_MSG_GetHeaderVersion(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_HeaderVe
*Version >>= CFE_MSG_CCSDSVER_SHIFT;

return CFE_SUCCESS;

}

/******************************************************************************
Expand Down Expand Up @@ -191,7 +189,6 @@ int32 CFE_MSG_GetApId(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_ApId_t *ApId)
CFE_MSG_GetHeaderField(MsgPtr->CCSDS.Pri.StreamId, ApId, CFE_MSG_APID_MASK);

return CFE_SUCCESS;

}

/******************************************************************************
Expand Down Expand Up @@ -224,7 +221,7 @@ int32 CFE_MSG_GetSegmentationFlag(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_Segme

CFE_MSG_GetHeaderField(MsgPtr->CCSDS.Pri.Sequence, &rawval, CFE_MSG_SEGFLG_MASK);

switch(rawval)
switch (rawval)
{
case CFE_MSG_SEGFLG_CNT:
*SegFlag = CFE_MSG_SegFlag_Continue;
Expand All @@ -241,7 +238,6 @@ int32 CFE_MSG_GetSegmentationFlag(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_Segme
}

return CFE_SUCCESS;

}

/******************************************************************************
Expand All @@ -250,14 +246,14 @@ int32 CFE_MSG_GetSegmentationFlag(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_Segme
int32 CFE_MSG_SetSegmentationFlag(CFE_MSG_Message_t *MsgPtr, CFE_MSG_SegmentationFlag_t SegFlag)
{
uint16 rawval = 0;
int32 status = CFE_SUCCESS;
int32 status = CFE_SUCCESS;

if (MsgPtr == NULL)
{
return CFE_MSG_BAD_ARGUMENT;
}

switch(SegFlag)
switch (SegFlag)
{
case CFE_MSG_SegFlag_Continue:
rawval = CFE_MSG_SEGFLG_CNT;
Expand Down Expand Up @@ -295,7 +291,6 @@ int32 CFE_MSG_GetSequenceCount(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_Sequence
CFE_MSG_GetHeaderField(MsgPtr->CCSDS.Pri.Sequence, SeqCnt, CFE_MSG_SEQCNT_MASK);

return CFE_SUCCESS;

}

/******************************************************************************
Expand Down
6 changes: 3 additions & 3 deletions fsw/cfe-core/src/msg/src/cfe_msg_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

/******************************************************************************
* Message initialization
* Message initialization
*/
#include "cfe_msg_api.h"
#include "cfe_msg_priv.h"
Expand All @@ -32,15 +32,15 @@
int32 CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_MSG_Size_t Size, bool Clear)
{

if (MsgPtr == NULL )
if (MsgPtr == NULL)
{
return CFE_MSG_BAD_ARGUMENT;
}

/* Clear and set defaults if request */
if (Clear)
{
memset(MsgPtr, 0, Size);
memset(MsgPtr, 0, Size);
CFE_MSG_InitDefaultHdr(MsgPtr);
}

Expand Down
2 changes: 1 addition & 1 deletion fsw/cfe-core/src/msg/src/cfe_msg_initdefaulthdr_v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@
*/
void CFE_MSG_InitDefaultHdr(CFE_MSG_Message_t *MsgPtr)
{
CFE_MSG_SetDefaultCCSDSPri(MsgPtr);
CFE_MSG_SetDefaultCCSDSPri(MsgPtr);
}
2 changes: 1 addition & 1 deletion fsw/cfe-core/src/msg/src/cfe_msg_msgid_v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int32 CFE_MSG_GetMsgId(const CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t *MsgId)
}

msgidval = (MsgPtr->CCSDS.Pri.StreamId[0] << 8) + MsgPtr->CCSDS.Pri.StreamId[1];
*MsgId = CFE_SB_ValueToMsgId(msgidval);
*MsgId = CFE_SB_ValueToMsgId(msgidval);

return CFE_SUCCESS;
}
Expand Down
10 changes: 5 additions & 5 deletions fsw/cfe-core/src/msg/src/cfe_msg_msgid_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
#include "cfe_error.h"

/* cFS MsgId definitions */
#define CFE_MSG_MSGID_APID_MASK 0x007F /**< \brief CCSDS ApId mask for MsgId */
#define CFE_MSG_MSGID_TYPE_MASK 0x0080 /**< \brief Message type mask for MsgId, set = cmd */
#define CFE_MSG_MSGID_APID_MASK 0x007F /**< \brief CCSDS ApId mask for MsgId */
#define CFE_MSG_MSGID_TYPE_MASK 0x0080 /**< \brief Message type mask for MsgId, set = cmd */
#define CFE_MSG_MSGID_SUBSYS_MASK 0xFF00 /**< \brief Subsystem mask for MsgId */

/******************************************************************************
Expand All @@ -53,7 +53,7 @@ int32 CFE_MSG_GetMsgId(const CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t *MsgId)
{

CFE_SB_MsgId_Atom_t msgidval;
CFE_MSG_Type_t type;
CFE_MSG_Type_t type;

if (MsgPtr == NULL || MsgId == NULL)
{
Expand Down Expand Up @@ -90,8 +90,8 @@ int32 CFE_MSG_SetMsgId(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId)
}

/* Clear and set PID_MSGID_MASK bits */
MsgPtr->CCSDS.Pri.StreamId[1] = (MsgPtr->CCSDS.Pri.StreamId[1] & ~CFE_MSG_MSGID_APID_MASK) |
(msgidval & CFE_MSG_MSGID_APID_MASK);
MsgPtr->CCSDS.Pri.StreamId[1] =
(MsgPtr->CCSDS.Pri.StreamId[1] & ~CFE_MSG_MSGID_APID_MASK) | (msgidval & CFE_MSG_MSGID_APID_MASK);

/* Set APIDQ Subsystem bits */
MsgPtr->CCSDS.Ext.APIDQSubsystem[1] = ((msgidval & CFE_MSG_MSGID_SUBSYS_MASK) >> 8);
Expand Down
18 changes: 9 additions & 9 deletions fsw/cfe-core/src/msg/src/cfe_msg_sechdr_checksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
CFE_MSG_Checksum_t CFE_MSG_ComputeCheckSum(const CFE_MSG_Message_t *MsgPtr)
{

uint32 PktLen = 0;
const uint8 *BytePtr = MsgPtr->Byte;
CFE_MSG_Checksum_t chksum = 0;
uint32 PktLen = 0;
const uint8 * BytePtr = MsgPtr->Byte;
CFE_MSG_Checksum_t chksum = 0;

if (CFE_MSG_GetSize(MsgPtr, &PktLen) == CFE_SUCCESS)
{
Expand All @@ -56,10 +56,10 @@ CFE_MSG_Checksum_t CFE_MSG_ComputeCheckSum(const CFE_MSG_Message_t *MsgPtr)
*/
int32 CFE_MSG_GenerateChecksum(CFE_MSG_Message_t *MsgPtr)
{
uint32 status;
CFE_MSG_Type_t type;
bool hassechdr = false;
CFE_MSG_CommandHeader_t *cmd = (CFE_MSG_CommandHeader_t *)MsgPtr;
uint32 status;
CFE_MSG_Type_t type;
bool hassechdr = false;
CFE_MSG_CommandHeader_t *cmd = (CFE_MSG_CommandHeader_t *)MsgPtr;

if (MsgPtr == NULL)
{
Expand Down Expand Up @@ -91,9 +91,9 @@ int32 CFE_MSG_GenerateChecksum(CFE_MSG_Message_t *MsgPtr)
int32 CFE_MSG_ValidateChecksum(const CFE_MSG_Message_t *MsgPtr, bool *IsValid)
{

uint32 status;
uint32 status;
CFE_MSG_Type_t type;
bool hassechdr = false;
bool hassechdr = false;

if (MsgPtr == NULL || IsValid == NULL)
{
Expand Down
18 changes: 9 additions & 9 deletions fsw/cfe-core/src/msg/src/cfe_msg_sechdr_fc.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@
#include "cfe_msg_api.h"
#include "cfe_msg_priv.h"

#define CFE_MSG_FC_MASK 0x7F /**< \brief Function code mask */
#define CFE_MSG_FC_MASK 0x7F /**< \brief Function code mask */

/******************************************************************************
* Get function code - See API and header file for details
* cFS default secondary header implementation
*/
int32 CFE_MSG_GetFcnCode(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_FcnCode_t *FcnCode)
{
uint32 status;
CFE_MSG_Type_t type;
bool hassechdr = false;
CFE_MSG_CommandHeader_t *cmd = (CFE_MSG_CommandHeader_t *)MsgPtr;
uint32 status;
CFE_MSG_Type_t type;
bool hassechdr = false;
CFE_MSG_CommandHeader_t *cmd = (CFE_MSG_CommandHeader_t *)MsgPtr;

if (MsgPtr == NULL || FcnCode == NULL)
{
Expand Down Expand Up @@ -63,10 +63,10 @@ int32 CFE_MSG_GetFcnCode(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_FcnCode_t *Fcn
*/
int32 CFE_MSG_SetFcnCode(CFE_MSG_Message_t *MsgPtr, uint16 FcnCode)
{
uint32 status;
CFE_MSG_Type_t type;
bool hassechdr = false;
CFE_MSG_CommandHeader_t *cmd = (CFE_MSG_CommandHeader_t *)MsgPtr;
uint32 status;
CFE_MSG_Type_t type;
bool hassechdr = false;
CFE_MSG_CommandHeader_t *cmd = (CFE_MSG_CommandHeader_t *)MsgPtr;

if (MsgPtr == NULL || ((FcnCode & ~CFE_MSG_FC_MASK) != 0))
{
Expand Down
19 changes: 9 additions & 10 deletions fsw/cfe-core/src/msg/src/cfe_msg_sechdr_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
int32 CFE_MSG_SetMsgTime(CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t NewTime)
{

uint32 status;
CFE_MSG_Type_t type;
bool hassechdr = false;
CFE_MSG_TelemetryHeader_t *tlm = (CFE_MSG_TelemetryHeader_t *)MsgPtr;
uint32 status;
CFE_MSG_Type_t type;
bool hassechdr = false;
CFE_MSG_TelemetryHeader_t *tlm = (CFE_MSG_TelemetryHeader_t *)MsgPtr;

if (MsgPtr == NULL)
{
Expand Down Expand Up @@ -69,10 +69,10 @@ int32 CFE_MSG_SetMsgTime(CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t NewTime)
int32 CFE_MSG_GetMsgTime(const CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t *Time)
{

uint32 status;
CFE_MSG_Type_t type;
bool hassechdr = false;
CFE_MSG_TelemetryHeader_t *tlm = (CFE_MSG_TelemetryHeader_t *)MsgPtr;
uint32 status;
CFE_MSG_Type_t type;
bool hassechdr = false;
CFE_MSG_TelemetryHeader_t *tlm = (CFE_MSG_TelemetryHeader_t *)MsgPtr;

if (MsgPtr == NULL || Time == NULL)
{
Expand All @@ -90,8 +90,7 @@ int32 CFE_MSG_GetMsgTime(const CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t *Ti

/* Get big endian time fields with default 32/16 layout */
Time->Subseconds = (tlm->Sec.Time[4] << 24) + (tlm->Sec.Time[5] << 16);
Time->Seconds = (tlm->Sec.Time[0] << 24) + (tlm->Sec.Time[1] << 16) +
(tlm->Sec.Time[2] << 8) + tlm->Sec.Time[4];
Time->Seconds = (tlm->Sec.Time[0] << 24) + (tlm->Sec.Time[1] << 16) + (tlm->Sec.Time[2] << 8) + tlm->Sec.Time[4];

return CFE_SUCCESS;
}
Loading

0 comments on commit 84569de

Please sign in to comment.