Skip to content

Commit

Permalink
Fix nasa#711, Update defines (and location), error return from MSG_Init
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Aug 7, 2020
1 parent 778943d commit 3ff06f3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
9 changes: 9 additions & 0 deletions fsw/cfe-core/src/inc/cfe_msg_typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@
* Includes
*/
#include "common_types.h"
#include "cfe_error.h"

/*
* 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_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 */

/*
* Types
Expand Down
13 changes: 0 additions & 13 deletions modules/msg/private_inc/cfe_msg_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,6 @@
* Includes
*/
#include "common_types.h"
#include "cfe_error.h"

/*
* Types
*/

/*
* 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_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 */

/*****************************************************************************/
/**
Expand Down
4 changes: 1 addition & 3 deletions modules/msg/src/cfe_msg_ccsdsext.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

/******************************************************************************
* Message CCSDS extended header initializations
* Message CCSDS extended header implementations
*/
#include "cfe_msg_api.h"
#include "cfe_msg_priv.h"
Expand All @@ -29,9 +29,7 @@
/* 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_SHIFT 10 /**< \brief CCSDS endian shift */
#define CFE_MSG_ENDIAN_MASK 0x0400 /**< \brief CCSDS endiam mask, little endian when set */
#define CFE_MSG_PLAYBACK_SHIFT 9 /**< \brief CCSDS playback shift */
#define CFE_MSG_PLAYBACK_MASK 0x0200 /**< \brief CCSDS playback flag, playback when set */
#define CFE_MSG_SUBSYS_MASK 0x01FF /**< \brief CCSDS Subsystem mask */

Expand Down
13 changes: 9 additions & 4 deletions modules/msg/src/cfe_msg_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
int32 CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_MSG_Size_t Size, bool Clear)
{

int32 status;

if (MsgPtr == NULL)
{
return CFE_MSG_BAD_ARGUMENT;
Expand All @@ -44,9 +46,12 @@ int32 CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_MSG_Size
CFE_MSG_InitDefaultHdr(MsgPtr);
}

/* Only set bits impacted by input */
CFE_MSG_SetMsgId(MsgPtr, MsgId);
CFE_MSG_SetSize(MsgPtr, Size);
/* Set values input */
status = CFE_MSG_SetMsgId(MsgPtr, MsgId);
if (status == CFE_SUCCESS)
{
status = CFE_MSG_SetSize(MsgPtr, Size);
}

return CFE_SUCCESS;
return status;
}

0 comments on commit 3ff06f3

Please sign in to comment.