Skip to content

Commit

Permalink
Fix nasa#711, Minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Jun 11, 2020
1 parent aa0ad2b commit 129164b
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 13 deletions.
6 changes: 2 additions & 4 deletions fsw/cfe-core/src/msg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ set(MODULE_SRCS
if (MISSION_INCLUDE_CCSDSEXT_HEADER)
list(APPEND MODULE_SRCS
src/cfe_msg_ccsdsext.c
src/cfe_msg_initdefaulthdr_v2.c
)
src/cfe_msg_initdefaulthdr_v2.c)
else (MISSION_INCLUDE_CCSDSEXT_HEADER)
list(APPEND MODULE_SRCS
src/cfe_msg_initdefaulthdr_v1.c
)
src/cfe_msg_initdefaulthdr_v1.c)
endif (MISSION_INCLUDE_CCSDSEXT_HEADER)

add_library(${MODULE_NAME} STATIC ${MODULE_SRCS})
Expand Down
14 changes: 7 additions & 7 deletions fsw/cfe-core/src/msg/src/cfe_msg_ccsdsext.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ 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);
CFE_MSG_SetSystem(MsgPtr, (CFE_MSG_System_t)CFE_MISSION_SPACECRAFT_ID);
}

/******************************************************************************
Expand Down Expand Up @@ -188,7 +188,7 @@ int32 CFE_MSG_GetSubsystem(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_Subsystem_t
return CFE_MSG_BAD_ARGUMENT;
}

CFE_MSG_GetHeaderField(MsgPtr->CCSDS.Ext.Subsystem, Subsystem, CFE_MSG_SUBSYSTEM_MASK);
CFE_MSG_GetHeaderField(MsgPtr->CCSDS.Ext.Subsystem, Subsystem, CFE_MSG_SUBSYS_MASK);

return CFE_SUCCESS;
}
Expand All @@ -198,12 +198,12 @@ int32 CFE_MSG_GetSubsystem(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_Subsystem_t
*/
int32 CFE_MSG_SetSubsystem(CFE_MSG_Message_t *MsgPtr, CFE_MSG_Subsystem_t Subsystem)
{
if (MsgPtr == NULL || ((Subsystem & CFE_MSG_SUBSYSTEM_MASK) != 0))
if (MsgPtr == NULL || ((Subsystem & CFE_MSG_SUBSYS_MASK) != 0))
{
return CFE_MSG_BAD_ARGUMENT;
}

CFE_MSG_SetHeaderField(MsgPtr->CCSDS.Ext.Subsystem, Subsystem, CFE_MSG_SUBSYSTEM_MASK);
CFE_MSG_SetHeaderField(MsgPtr->CCSDS.Ext.Subsystem, Subsystem, CFE_MSG_SUBSYS_MASK);

return CFE_SUCCESS;
}
Expand All @@ -219,7 +219,7 @@ int32 CFE_MSG_GetSystem(const CFE_MSG_Message_t *MsgPtr, CFE_MSG_System_t *Syste
return CFE_MSG_BAD_ARGUMENT;
}

*System = (MSGPtr->CCSDS.Ext.SystemId[0] << 8) + MsgPtr->CCSDS.Ext.SystemId[1];
*System = (MsgPtr->CCSDS.Ext.SystemId[0] << 8) + MsgPtr->CCSDS.Ext.SystemId[1];

return CFE_SUCCESS;
}
Expand All @@ -234,8 +234,8 @@ int32 CFE_MSG_SetSystem(CFE_MSG_Message_t *MsgPtr, CFE_MSG_System_t System)
return CFE_MSG_BAD_ARGUMENT;
}

MSGPtr->CCSDS.Ext.SystemId[0] = (System >> 8) & 0xFF;
MSGPtr->CCSDS.Ext.SystemId[1] = System & 0xFF;
MsgPtr->CCSDS.Ext.SystemId[0] = (System >> 8) & 0xFF;
MsgPtr->CCSDS.Ext.SystemId[1] = System & 0xFF;

return CFE_SUCCESS;
}
35 changes: 35 additions & 0 deletions fsw/cfe-core/src/msg/src/cfe_msg_initdefaulthdr_v2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
** GSC-18128-1, "Core Flight Executive Version 6.7"
**
** Copyright (c) 2006-2019 United States Government as represented by
** the Administrator of the National Aeronautics and Space Administration.
** All Rights Reserved.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/

/******************************************************************************
* Message default header initialization - implementation without CCSDS
* extended header
*/
#include "cfe_msg_hdr.h"
#include "cfe_msg_defaults.h"

/******************************************************************************
* Top level message initialization - See header file for details
*/
void CFE_MSG_InitDefaultHdr(CFE_MSG_Message_t *MsgPtr)
{
CFE_MSG_SetDefaultCCSDSPri(MsgPtr);
CFE_MSG_SetDefaultCCSDSExt(MsgPtr);
}
4 changes: 2 additions & 2 deletions fsw/cfe-core/src/msg/src/cfe_msg_msgid_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int32 CFE_MSG_GetMsgId(const CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t *MsgId)
{
msgidval |= CFE_MSG_MSGID_TYPE_MASK;
}
msgidval |= (MsgPtr->CCSDS.Ext.APIDQSubsystem[1] << 8) & CFE_MSG_MSGID_SUBSYS_MASK;
msgidval |= (MsgPtr->CCSDS.Ext.Subsystem[1] << 8) & CFE_MSG_MSGID_SUBSYS_MASK;

*MsgId = CFE_SB_ValueToMsgId(msgidval);

Expand All @@ -94,7 +94,7 @@ int32 CFE_MSG_SetMsgId(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId)
(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);
MsgPtr->CCSDS.Ext.Subsystem[1] = ((msgidval & CFE_MSG_MSGID_SUBSYS_MASK) >> 8);

/* Set type, ignores return since no failure action */
if ((msgidval & CFE_MSG_MSGID_TYPE_MASK) != 0)
Expand Down

0 comments on commit 129164b

Please sign in to comment.