Skip to content

Commit

Permalink
Fix #112, reorganize headers
Browse files Browse the repository at this point in the history
Follow the header file convention documented in CFE
  • Loading branch information
jphickey committed Oct 12, 2023
1 parent fb6a45f commit 67050c5
Show file tree
Hide file tree
Showing 25 changed files with 832 additions and 418 deletions.
40 changes: 40 additions & 0 deletions arch_build.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
###########################################################
#
# SC App platform build setup
#
# This file is evaluated as part of the "prepare" stage
# and can be used to set up prerequisites for the build,
# such as generating header files
#
###########################################################

# The list of header files that control the SC configuration
set(SC_PLATFORM_CONFIG_FILE_LIST
sc_internal_cfg.h
sc_msgids.h
sc_perfids.h
sc_platform_cfg.h
)

if (CFE_EDS_ENABLED_BUILD)

# In an EDS-based build, msgids come generated from the EDS tool
set(SC_CFGFILE_SRC_sc_msgids "${CMAKE_CURRENT_LIST_DIR}/config/sc_eds_msg_topicids.h")

endif(CFE_EDS_ENABLED_BUILD)

# Create wrappers around the all the config header files
# This makes them individually overridable by the missions, without modifying
# the distribution default copies
foreach(SC_CFGFILE ${SC_PLATFORM_CONFIG_FILE_LIST})
get_filename_component(CFGKEY "${SC_CFGFILE}" NAME_WE)
if (DEFINED SC_CFGFILE_SRC_${CFGKEY})
set(DEFAULT_SOURCE "${SC_CFGFILE_SRC_${CFGKEY}}")
else()
set(DEFAULT_SOURCE "${CMAKE_CURRENT_LIST_DIR}/config/default_${SC_CFGFILE}")
endif()
generate_config_includefile(
FILE_NAME "${SC_CFGFILE}"
FALLBACK_FILE ${DEFAULT_SOURCE}
)
endforeach()
72 changes: 6 additions & 66 deletions fsw/inc/sc_msgdefs.h → config/default_sc_fcncodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,75 +19,15 @@

/**
* @file
* Specification for the CFS Stored Command (SC) command and telemetry
* message constant definitions.
* Specification for the CFS Stored Command (SC) command function codes
*
* @note
* DO NOT PUT ANY TYPEDEFS OR STRUCTURE DEFINITIONS IN THIS FILE!
* ADD THEM TO sc_msg.h IF NEEDED!
* This file should be strictly limited to the command/function code (CC)
* macro definitions. Other definitions such as enums, typedefs, or other
* macros should be placed in the msgdefs.h or msg.h files.
*/
#ifndef SC_MSGDEFS_H
#define SC_MSGDEFS_H

/************************************************************************
* Macro Definitions
************************************************************************/

/**
* \name Which processor runs next
* \{
*/
#define SC_ATP 0 /**< \brief ATP process next */
#define SC_RTP 1 /**< \brief RTP process next */
#define SC_NONE 0xFF /**< \brief No pending process */
/**\}*/

#define SC_MAX_TIME 0xFFFFFFFF /**< \brief Maximum time in SC */

/**
* \name ATS/RTS Cmd Status macros
* \{
*/
#define SC_EMPTY 0 /**< \brief the object is not loaded */
#define SC_LOADED 1 /**< \brief the object is loaded */
#define SC_IDLE 2 /**< \brief the object is not executing */
#define SC_EXECUTED 3 /**< \brief the object has completed executing */
#define SC_SKIPPED 4 /**< \brief the object (ats command) was skipped */
#define SC_EXECUTING 5 /**< \brief the object is currently executing */
#define SC_FAILED_CHECKSUM 6 /**< \brief the object failed a checksum test */
#define SC_FAILED_DISTRIB 7 /**< \brief the object could not be sent on the SWB */
#define SC_STARTING 8 /**< \brief used when an inline switch is executed */
/**\}*/

/**
* \name Defines for each ATS
* \{
*/
#define SC_NO_ATS 0 /**<\ brief No ATS */
#define SC_ATSA 1 /**< \brief ATS A */
#define SC_ATSB 2 /**< \brief ATS B */
/**\}*/

/**
* \name constants for config parameters for which TIME to use
* \{
*/
#define SC_USE_CFE_TIME 0 /**< \brief Use cFE configured time */
#define SC_USE_TAI 1 /**< \brief Use TAI Time */
#define SC_USE_UTC 2 /**< \brief USE UTC Time */
/**\}*/

#define SC_INVALID_RTS_NUMBER 0 /**< \brief Invalid RTS number */

#define SC_NUMBER_OF_ATS 2 /**< \brief the number of Absolute Time Sequences */

/**
* \name SC Continue Flags
* \{
*/
#define SC_CONTINUE_TRUE 1 /**< \brief Continue on failure */
#define SC_CONTINUE_FALSE 0 /**< \brief Do not continue on failure */
/**\}*/
#ifndef SC_FCNCODES_H
#define SC_FCNCODES_H

/**
* \defgroup cfssccmdcodes CFS Stored Command Command Codes
Expand Down
72 changes: 72 additions & 0 deletions config/default_sc_interface_cfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/************************************************************************
* NASA Docket No. GSC-18,924-1, and identified as “Core Flight
* System (cFS) Stored Command Application version 3.1.1”
*
* Copyright (c) 2021 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.
************************************************************************/

/**
* @file
* CFS Stored Command (SC) Application Public Definitions
*
* This provides default values for configurable items that affect
* the interface(s) of this module. This includes the CMD/TLM message
* interface, tables definitions, and any other data products that
* serve to exchange information with other entities.
*
* @note This file may be overridden/superceded by mission-provided defintions
* either by overriding this header or by generating definitions from a command/data
* dictionary tool.
*/
#ifndef SC_INTERFACE_CFG_H
#define SC_INTERFACE_CFG_H

/**
* \brief Minimum Packet Size
*
* \par Description:
* This parameter specifies the minumum size in bytes for an ATS or RTS command.
* \par Limits:
* This parameter must be greater than or equal to CFE_SB_CMD_HDR_SIZE and
* less than or equal to CFE_MISSION_SB_MAX_SB_MSG_SIZE.
*/
#define SC_PACKET_MIN_SIZE 8

/**
* \brief Maximum Packet Size
*
* \par Description:
* This parameter specifies the maximum size in bytes for an ATS or RTS command.
* \par Limits:
* This parameter must be greater than or equal to SC_PACKET_MIN_SIZE and
* less than or equal to CFE_MISSION_SB_MAX_SB_MSG_SIZE.
*/
#define SC_PACKET_MAX_SIZE 256

#define SC_NUMBER_OF_ATS 2 /**< \brief the number of Absolute Time Sequences */

/**
* \brief Number of RTS's
*
* \par Description:
* The number of RTS's allowed in the system
*
* \par Limits:
* This parameter can't be larger than 999.This parameter will dicate the size of
* The RTS Info Table.
*/
#define SC_NUMBER_OF_RTS 64

#endif
74 changes: 36 additions & 38 deletions fsw/inc/sc_platform_cfg.h → config/default_sc_internal_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@

/**
* @file
* This file contains the platform configuration parameters used by
* Stored Command
* CFS Stored Command (SC) Application Private Config Definitions
*
* This provides default values for configurable items that are internal
* to this module and do NOT affect the interface(s) of this module. Changes
* to items in this file only affect the local module and will be transparent
* to external entities that are using the public interface(s).
*
* @note This file may be overridden/superceded by mission-provided defintions
* either by overriding this header or by generating definitions from a command/data
* dictionary tool.
*/
#ifndef SC_PLATFORM_CFG_H
#define SC_PLATFORM_CFG_H
#ifndef SC_INTERNAL_CFG_H
#define SC_INTERNAL_CFG_H

/**
* \defgroup cfsscplatformcfg CFS Stored Command Platform Configuration
Expand Down Expand Up @@ -77,18 +85,6 @@
*/
#define SC_MAX_CMDS_PER_SEC 8

/**
* \brief Number of RTS's
*
* \par Description:
* The number of RTS's allowed in the system
*
* \par Limits:
* This parameter can't be larger than 999.This parameter will dicate the size of
* The RTS Info Table.
*/
#define SC_NUMBER_OF_RTS 64

/**
* \brief Max buffer size for an ATS in uint16s
*
Expand Down Expand Up @@ -145,28 +141,6 @@
*/
#define SC_LAST_RTS_WITH_EVENTS 20

/**
* \brief Minimum Packet Size
*
* \par Description:
* This parameter specifies the minumum size in bytes for an ATS or RTS command.
* \par Limits:
* This parameter must be greater than or equal to CFE_SB_CMD_HDR_SIZE and
* less than or equal to CFE_MISSION_SB_MAX_SB_MSG_SIZE.
*/
#define SC_PACKET_MIN_SIZE 8

/**
* \brief Maximum Packet Size
*
* \par Description:
* This parameter specifies the maximum size in bytes for an ATS or RTS command.
* \par Limits:
* This parameter must be greater than or equal to SC_PACKET_MIN_SIZE and
* less than or equal to CFE_MISSION_SB_MAX_SB_MSG_SIZE.
*/
#define SC_PACKET_MAX_SIZE 256

/**
* \brief Command Pipe Depth
*
Expand Down Expand Up @@ -374,6 +348,30 @@
* Must be SC_USE_CFE_TIME, SC_USE_TAI, or SC_USE_UTC */
#define SC_TIME_TO_USE SC_USE_CFE_TIME

/**
* \brief Autostart RTS ID after power on
*
* \par Description:
* The specified RTS will be automatically invoked after a power-on
* May be configured as 0 to disable
*
* \par Limits:
* Must be a valid RTS ID or 0
*/
#define RTS_ID_AUTO_POWER_ON 1

/**
* \brief Autostart RTS ID after processor reset
*
* \par Description:
* The specified RTS will be automatically invoked after a processor reset
* May be configured as 0 to disable
*
* \par Limits:
* Must be a valid RTS ID or 0
*/
#define RTS_ID_AUTO_PROCESSOR 2

/**
* \brief Mission specific version number for SC application
*
Expand Down
37 changes: 37 additions & 0 deletions config/default_sc_mission_cfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/************************************************************************
* NASA Docket No. GSC-18,924-1, and identified as “Core Flight
* System (cFS) Stored Command Application version 3.1.1”
*
* Copyright (c) 2021 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.
************************************************************************/

/**
* @file
*
* CFS Stored Command (SC) Application Mission Configuration Header File
*
* This is a compatibility header for the "mission_cfg.h" file that has
* traditionally provided public config definitions for each CFS app.
*
* @note This file may be overridden/superceded by mission-provided defintions
* either by overriding this header or by generating definitions from a command/data
* dictionary tool.
*/
#ifndef SC_MISSION_CFG_H
#define SC_MISSION_CFG_H

#include "sc_interface_cfg.h"

#endif
39 changes: 39 additions & 0 deletions config/default_sc_msg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/************************************************************************
* NASA Docket No. GSC-18,924-1, and identified as “Core Flight
* System (cFS) Stored Command Application version 3.1.1”
*
* Copyright (c) 2021 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.
************************************************************************/

/**
* @file
* Specification for the CFS Stored Command (SC) command and telemetry
* message data types.
*
* This is a compatibility header for the "sc_msg.h" file that has
* traditionally provided the message definitions for cFS apps.
*
* @note This file may be overridden/superceded by mission-provided defintions
* either by overriding this header or by generating definitions from a command/data
* dictionary tool.
*/
#ifndef SC_MSG_H
#define SC_MSG_H

#include "sc_interface_cfg.h"
#include "sc_msgdefs.h"
#include "sc_msgstruct.h"

#endif
Loading

0 comments on commit 67050c5

Please sign in to comment.