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 Aug 7, 2020
1 parent 4e15ff2 commit 16f742c
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 68 deletions.
32 changes: 18 additions & 14 deletions modules/msg/mission_inc/default_cfe_msg_hdr_pri.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,37 +49,41 @@
/**
* \brief Full CCSDS header
*/
typedef struct{
CCSDS_PrimaryHeader_t Pri; /**< \brief CCSDS Primary Header */
typedef struct
{
CCSDS_PrimaryHeader_t Pri; /**< \brief CCSDS Primary Header */
} CCSDS_SpacePacket_t;

/**
* \brief cFS command header
*/
typedef struct {
typedef struct
{

CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS header */
CFE_MSG_CommandSecondaryHeader_t Sec; /**< \brief Secondary header */
CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS header */
CFE_MSG_CommandSecondaryHeader_t Sec; /**< \brief Secondary header */

} CFE_MSG_CommandHeader_t;
} CFE_MSG_CommandHeader_t;

/**
* \brief cFS telemetry header
*/
typedef struct {
typedef struct
{

CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS header */
CFE_MSG_TelemetrySecondaryHeader_t Sec; /**< \brief Secondary header */
CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS header */
CFE_MSG_TelemetrySecondaryHeader_t Sec; /**< \brief Secondary header */

} CFE_MSG_TelemetryHeader_t;

/**
* \brief cFS Generic packet header
*/
typedef union {
CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS Header (Pri or Pri + Ext) */
uint64 LongLong; /**< \brief Force 64-bit alignment */
uint8 Byte[sizeof(CCSDS_SpacePacket_t)]; /**< \brief Byte level access */
typedef union
{
CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS Header (Pri or Pri + Ext) */
uint64 LongLong; /**< \brief Force 64-bit alignment */
uint8 Byte[sizeof(CCSDS_SpacePacket_t)]; /**< \brief Byte level access */
} CFE_MSG_Message_t;

#endif /* _cfe_msg_hdr_ */
#endif /* _cfe_msg_hdr_ */
34 changes: 19 additions & 15 deletions modules/msg/mission_inc/default_cfe_msg_hdr_priext.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,38 +49,42 @@
/**
* \brief Full CCSDS header
*/
typedef struct{
CCSDS_PrimaryHeader_t Pri; /**< \brief CCSDS Primary Header */
CCSDS_ExtendedHeader_t Ext; /**< \brief CCSDS Extended Header */
typedef struct
{
CCSDS_PrimaryHeader_t Pri; /**< \brief CCSDS Primary Header */
CCSDS_ExtendedHeader_t Ext; /**< \brief CCSDS Extended Header */
} CCSDS_SpacePacket_t;

/**
* \brief cFS command header
*/
typedef struct {
typedef struct
{

CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS header */
CFE_MSG_CommandSecondaryHeader_t Sec; /**< \brief Secondary header */
CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS header */
CFE_MSG_CommandSecondaryHeader_t Sec; /**< \brief Secondary header */

} CFE_MSG_CommandHeader_t;
} CFE_MSG_CommandHeader_t;

/**
* \brief cFS telemetry header
*/
typedef struct {
typedef struct
{

CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS header */
CFE_MSG_TelemetrySecondaryHeader_t Sec; /**< \brief Secondary header */
CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS header */
CFE_MSG_TelemetrySecondaryHeader_t Sec; /**< \brief Secondary header */

} CFE_MSG_TelemetryHeader_t;

/**
* \brief cFS Generic packet header
*/
typedef union {
CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS Header (Pri or Pri + Ext) */
uint64 LongLong; /**< \brief Force 64-bit alignment */
uint8 Byte[sizeof(CCSDS_SpacePacket_t)]; /**< \brief Byte level access */
typedef union
{
CCSDS_SpacePacket_t CCSDS; /**< \brief CCSDS Header (Pri or Pri + Ext) */
uint64 LongLong; /**< \brief Force 64-bit alignment */
uint8 Byte[sizeof(CCSDS_SpacePacket_t)]; /**< \brief Byte level access */
} CFE_MSG_Message_t;

#endif /* _cfe_msg_hdr_ */
#endif /* _cfe_msg_hdr_ */
36 changes: 19 additions & 17 deletions modules/msg/mission_inc/default_cfe_msg_sechdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@
/* TODO eventually these go away w/ single framework implementation */
/* CCSDS_TIME_SIZE is specific to the selected CFE_SB time format */
#if (CFE_MISSION_SB_PACKET_TIME_FORMAT == CFE_MISSION_SB_TIME_32_16_SUBS)
/* 32 bits seconds + 16 bits subseconds */
#define CCSDS_TIME_SIZE 6
/* 32 bits seconds + 16 bits subseconds */
#define CCSDS_TIME_SIZE 6
#elif (CFE_MISSION_SB_PACKET_TIME_FORMAT == CFE_MISSION_SB_TIME_32_32_SUBS)
/* 32 bits seconds + 32 bits subseconds */
#define CCSDS_TIME_SIZE 8
/* 32 bits seconds + 32 bits subseconds */
#define CCSDS_TIME_SIZE 8
#elif (CFE_MISSION_SB_PACKET_TIME_FORMAT == CFE_MISSION_SB_TIME_32_32_M_20)
/* 32 bits seconds + 20 bits microsecs + 12 bits reserved */
#define CCSDS_TIME_SIZE 8
/* 32 bits seconds + 20 bits microsecs + 12 bits reserved */
#define CCSDS_TIME_SIZE 8
#else
/* unknown format */
#error unable to define CCSDS_TIME_SIZE!
/* unknown format */
#error unable to define CCSDS_TIME_SIZE!
#endif

/*
Expand All @@ -68,24 +68,26 @@
/**
* \brief cFS command secondary header
*/
typedef struct {
typedef struct
{

uint8 FunctionCode; /**< \brief Command Function Code */
/* bits shift ---------description-------- */
/* 0x7F 0 Command function code */
/* 0x80 7 Reserved */
uint8 FunctionCode; /**< \brief Command Function Code */
/* bits shift ---------description-------- */
/* 0x7F 0 Command function code */
/* 0x80 7 Reserved */

uint8 Checksum; /**< \brief Command checksum (all bits, 0xFF) */
uint8 Checksum; /**< \brief Command checksum (all bits, 0xFF) */

} CFE_MSG_CommandSecondaryHeader_t;

/**
* \brief cFS telemetry secondary header
*/
typedef struct {
typedef struct
{

uint8 Time[CCSDS_TIME_SIZE]; /**< \brief Time sized for selected format */
uint8 Time[CCSDS_TIME_SIZE]; /**< \brief Time sized for selected format */

} CFE_MSG_TelemetrySecondaryHeader_t;

#endif /* _cfe_msg_sechdr_ */
#endif /* _cfe_msg_sechdr_ */
10 changes: 5 additions & 5 deletions modules/msg/src/cfe_msg_ccsdsext.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
#include "cfe_error.h"

/* CCSDS Extended definitions */
#define CFE_MSG_EDSVER_SHIFT 11 /**< \brief CCSDS EDS version shift */
#define CFE_MSG_EDSVER_MASK 0xF800 /**< \brief CCSDS EDS version mask */
#define CFE_MSG_ENDIAN_MASK 0x0400 /**< \brief CCSDS endiam mask, little endian when set */
#define CFE_MSG_PLAYBACK_MASK 0x0200 /**< \brief CCSDS playback flag, playback when set */
#define CFE_MSG_SUBSYS_MASK 0x01FF /**< \brief CCSDS Subsystem mask */
#define CFE_MSG_EDSVER_SHIFT 11 /**< \brief CCSDS EDS version shift */
#define CFE_MSG_EDSVER_MASK 0xF800 /**< \brief CCSDS EDS version mask */
#define CFE_MSG_ENDIAN_MASK 0x0400 /**< \brief CCSDS endiam mask, little endian when set */
#define CFE_MSG_PLAYBACK_MASK 0x0200 /**< \brief CCSDS playback flag, playback when set */
#define CFE_MSG_SUBSYS_MASK 0x01FF /**< \brief CCSDS Subsystem mask */

/******************************************************************************
* CCSDS extended header initialization - See header file for details
Expand Down
2 changes: 1 addition & 1 deletion modules/msg/src/cfe_msg_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int32 CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_MSG_Size

/* Set values input */
status = CFE_MSG_SetMsgId(MsgPtr, MsgId);
if (status == CFE_SUCCESS)
if (status == CFE_SUCCESS)
{
status = CFE_MSG_SetSize(MsgPtr, Size);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/msg/src/cfe_msg_msgid_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int32 CFE_MSG_SetMsgId(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId)

CFE_SB_MsgId_Atom_t msgidval = CFE_SB_MsgIdToValue(MsgId);

if (MsgPtr == NULL || msgidval > CFE_PLATFORM_SB_HIGHEST_VALID_MSGID)
if (MsgPtr == NULL || msgidval > CFE_PLATFORM_SB_HIGHEST_VALID_MSGID)
{
return CFE_MSG_BAD_ARGUMENT;
}
Expand Down
12 changes: 6 additions & 6 deletions modules/msg/unit-test-coverage/test_cfe_msg_ccsdspri.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void Test_MSG_Type(void)
void Test_MSG_HeaderVersion(void)
{
CFE_MSG_Message_t msg;
CFE_MSG_HeaderVersion_t input[] = {0, TEST_CCSDSVER_MAX/2, TEST_CCSDSVER_MAX};
CFE_MSG_HeaderVersion_t input[] = {0, TEST_CCSDSVER_MAX / 2, TEST_CCSDSVER_MAX};
CFE_MSG_HeaderVersion_t actual = TEST_CCSDSVER_MAX;
int i;

Expand Down Expand Up @@ -228,7 +228,7 @@ void Test_MSG_HeaderVersion(void)
void Test_MSG_HasSecondaryHeader(void)
{
CFE_MSG_Message_t msg;
bool actual = true;
bool actual = true;

UT_Text("Bad parameter tests, Null pointers");
memset(&msg, 0, sizeof(msg));
Expand Down Expand Up @@ -276,7 +276,7 @@ void Test_MSG_HasSecondaryHeader(void)
void Test_MSG_ApId(void)
{
CFE_MSG_Message_t msg;
CFE_MSG_ApId_t input[] = {0, TEST_APID_MAX/2, TEST_APID_MAX};
CFE_MSG_ApId_t input[] = {0, TEST_APID_MAX / 2, TEST_APID_MAX};
CFE_MSG_ApId_t actual = TEST_APID_MAX;
int i;

Expand Down Expand Up @@ -336,8 +336,8 @@ void Test_MSG_ApId(void)
void Test_MSG_SegmentationFlag(void)
{
CFE_MSG_Message_t msg;
CFE_MSG_SegmentationFlag_t input[] = {CFE_MSG_SegFlag_Continue, CFE_MSG_SegFlag_First,
CFE_MSG_SegFlag_Last, CFE_MSG_SegFlag_Unsegmented};
CFE_MSG_SegmentationFlag_t input[] = {CFE_MSG_SegFlag_Continue, CFE_MSG_SegFlag_First, CFE_MSG_SegFlag_Last,
CFE_MSG_SegFlag_Unsegmented};
CFE_MSG_SegmentationFlag_t actual = CFE_MSG_SegFlag_Invalid;
int i;

Expand Down Expand Up @@ -397,7 +397,7 @@ void Test_MSG_SegmentationFlag(void)
void Test_MSG_SequenceCount(void)
{
CFE_MSG_Message_t msg;
CFE_MSG_ApId_t input[] = {0, TEST_SEQUENCE_MAX/2, TEST_SEQUENCE_MAX};
CFE_MSG_ApId_t input[] = {0, TEST_SEQUENCE_MAX / 2, TEST_SEQUENCE_MAX};
CFE_MSG_ApId_t actual = TEST_SEQUENCE_MAX;
int i;

Expand Down
4 changes: 2 additions & 2 deletions modules/msg/unit-test-coverage/test_cfe_msg_msgid_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
void Test_MSG_GetTypeFromMsgId(void)
{
CFE_MSG_Message_t msg;
CFE_SB_MsgId_t msgid = CFE_SB_ValueToMsgId(0);
CFE_MSG_Type_t actual = CFE_MSG_Type_Invalid;
CFE_SB_MsgId_t msgid = CFE_SB_ValueToMsgId(0);
CFE_MSG_Type_t actual = CFE_MSG_Type_Invalid;

UT_Text("Bad parameter tests, Null pointer");
memset(&msg, 0, sizeof(msg));
Expand Down
4 changes: 2 additions & 2 deletions modules/msg/unit-test-coverage/test_msg_not.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ unsigned int Test_MSG_NotZero(const CFE_MSG_Message_t *MsgPtr)
bits |= MSG_QOS_FLAG;

/* Secondary */
CFE_MSG_GetFcnCode(MsgPtr, &fcncode); // TODO check status
CFE_MSG_GetFcnCode(MsgPtr, &fcncode); // TODO check status
if (fcncode != 0)
bits |= MSG_FCNCODE_FLAG;
CFE_MSG_GetSource(MsgPtr, &source);
Expand Down Expand Up @@ -164,7 +164,7 @@ unsigned int Test_MSG_NotF(const CFE_MSG_Message_t *MsgPtr)
bits |= MSG_QOS_FLAG;

/* Secondary */
CFE_MSG_GetFcnCode(MsgPtr, &fcncode); // TODO check status
CFE_MSG_GetFcnCode(MsgPtr, &fcncode); // TODO check status
if (fcncode != 0xFF)
bits |= MSG_FCNCODE_FLAG;
CFE_MSG_GetSource(MsgPtr, &source);
Expand Down
10 changes: 5 additions & 5 deletions modules/msg/unit-test-coverage/test_msg_not.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
#define MSG_LENGTH_FLAG 0x00040

/* Extended */
#define MSG_EDSVER_FLAG 0x00080
#define MSG_ENDIAN_FLAG 0x00100
#define MSG_PBACK_FLAG 0x00200
#define MSG_SUBSYS_FLAG 0x00400
#define MSG_SYSTEM_FLAG 0x00800
#define MSG_EDSVER_FLAG 0x00080
#define MSG_ENDIAN_FLAG 0x00100
#define MSG_PBACK_FLAG 0x00200
#define MSG_SUBSYS_FLAG 0x00400
#define MSG_SYSTEM_FLAG 0x00800

/* Secondary */
#define MSG_CKSUM_FLAG 0x01000
Expand Down

0 comments on commit 16f742c

Please sign in to comment.