Skip to content

Commit

Permalink
Fix nasa#711, Add MsgId V2 and extended header source selection
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Aug 7, 2020
1 parent fb0d4cc commit 778943d
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 13 deletions.
25 changes: 21 additions & 4 deletions modules/msg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,39 @@ set(${DEP}_SRC
src/cfe_msg_ccsdspri.c
src/cfe_msg_init.c
src/cfe_msg_msgid_shared.c
src/cfe_msg_msgid_v1.c
src/cfe_msg_sechdr_checksum.c
src/cfe_msg_sechdr_fc.c
src/cfe_msg_sechdr_time.c
)

# Source selection for if CCSDS extended header is included
# Source selection for if CCSDS extended header is included, and MsgId version use
if (MISSION_INCLUDE_CCSDSEXT_HEADER)
message(STATUS "CCSDS primary and extended header included in message header")
list(APPEND ${DEP}_SRC
src/cfe_msg_ccsdsext.c
src/cfe_msg_initdefaulthdr_v2.c)
src/cfe_msg_initdefaulthdr_priext.c)
if (MISSION_MSGID_V2) # MsgId v2 or v1 can be used with extended headers
message(STATUS "Message Id version 2 in use (MsgId V2)")
list(APPEND ${DEP}_SRC
src/cfe_msg_msgid_v2.c)
else (MISSION_MSGID_V2)
message(STATUS "Message Id version 1 in use (MsgId V1)")
list(APPEND ${DEP}_SRC
src/cfe_msg_msgid_v1.c)
endif (MISSION_MSGID_V2)
else (MISSION_INCLUDE_CCSDSEXT_HEADER)
message(STATUS "CCSDS primary header included in message header (not including CCSDS extended header)")
message(STATUS "Message Id version 1 in use (MsgId V1)")
list(APPEND ${DEP}_SRC
src/cfe_msg_initdefaulthdr_v1.c)
src/cfe_msg_initdefaulthdr_pri.c
src/cfe_msg_msgid_v1.c)
if (MISSION_MSGID_V2)
message(FATAL_ERROR "Message Id (MsgId) version 2 can only be used if MISSION_INCLUDE_CCSDSEXT_HEADER is set")
endif (MISSION_MSGID_V2)
endif (MISSION_INCLUDE_CCSDSEXT_HEADER)

# Source selection for v1 and v2 message header definition

# Module library
add_library(${DEP} STATIC ${${DEP}_SRC})

Expand Down
9 changes: 8 additions & 1 deletion modules/msg/mission_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@
#
###########################################################

# Extended header inclusion selection
if (MISSION_INCLUDE_CCSDSEXT_HEADER)
set(MSG_HDR_FILE "default_cfe_msg_hdr_priext.h")
else (MISSION_INCLUDE_CCSDSEXT_HEADER)
set(MSG_HDR_FILE "default_cfe_msg_hdr_pri.h")
endif (MISSION_INCLUDE_CCSDSEXT_HEADER)

# Generate the header definition files, use local default for this module)
generate_config_includefile(
FILE_NAME "cfe_msg_hdr.h"
FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/mission_inc/default_cfe_msg_hdr.h"
FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/mission_inc/${MSG_HDR_FILE}"
)

generate_config_includefile(
Expand Down
85 changes: 85 additions & 0 deletions modules/msg/mission_inc/default_cfe_msg_hdr_pri.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
** 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.
*/

/******************************************************************************
* Define cFS standard full header
* - Avoid direct access for portability, use APIs
* - Used to construct message structures
*/

#ifndef _cfe_msg_hdr_
#define _cfe_msg_hdr_

/*
* Include Files
*/

#include "common_types.h"
#include "ccsds_hdr.h"
#include "cfe_msg_sechdr.h"

/*
* Type Definitions
*/

/**********************************************************************
* Structure definitions for full header
*
* These are based on historically supported definitions and not
* an open source standard.
*/

/**
* \brief Full CCSDS header
*/
typedef struct{
CCSDS_PrimaryHeader_t Pri; /**< \brief CCSDS Primary Header */
} CCSDS_SpacePacket_t;

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

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

} CFE_MSG_CommandHeader_t;

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

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 */
} CFE_MSG_Message_t;

#endif /* _cfe_msg_hdr_ */
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,12 @@
* an open source standard.
*/

/* TODO recommand a msg/inc_public_v1 and 2 version of this file,
* create an interface library (header only)
* use cmake target_include_directories and inherit dependencies
* to avoid the ifdef here, requires rework of how includes are
* inherited for libs (just link the interface library)
*/
/**
* \brief Full CCSDS header
*/
typedef struct{
CCSDS_PrimaryHeader_t Pri; /**< \brief CCSDS Primary Header */
#ifdef MESSAGE_FORMAT_IS_CCSDS_VER_2
CCSDS_ExtendedHeader_t Ext; /**< \brief CCSDS Extended Header */
#endif
} CCSDS_SpacePacket_t;

/**
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 778943d

Please sign in to comment.