Skip to content

Commit

Permalink
Fix nasa#150, implement header file convention for SCH_LAB
Browse files Browse the repository at this point in the history
Move configurable header files into a separate directory with names
according to the pattern documented in CFE.
  • Loading branch information
jphickey committed Oct 6, 2023
1 parent 82645f5 commit 14ce0f9
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 24 deletions.
40 changes: 40 additions & 0 deletions config/default_sch_lab_mission_cfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/************************************************************************
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
*
* Copyright (c) 2020 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 SCH_LAB 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 SCH_LAB_MISSION_CFG_H
#define SCH_LAB_MISSION_CFG_H

/*
* Currently this file is not necessary for SCH_LAB.
* It exists as a placeholder for future use.
*/


#endif
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
/**
* @file
* Define SCH Lab Performance IDs
*
* These ID values need to be unique across a CFS deployment, so they may be customized
* as needed to avoid collision with other apps.
*/
#ifndef SCH_LAB_PERFIDS_H
#define SCH_LAB_PERFIDS_H
Expand Down
43 changes: 43 additions & 0 deletions config/default_sch_lab_platform_cfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/************************************************************************
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
*
* Copyright (c) 2020 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 SCH_LAB Application Platform Configuration Header File
*
* This is a compatibility header for the "platform_cfg.h" file that has
* traditionally provided both public and private config definitions
* for each CFS app.
*
* These definitions are now provided in two separate files, one for
* the public/mission scope and one for internal scope.
*
* @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 SCH_LAB_PLATFORM_CFG_H
#define SCH_LAB_PLATFORM_CFG_H

/*
* Currently this file is not necessary for SCH_LAB.
* It exists as a placeholder for future use.
*/

#endif
33 changes: 33 additions & 0 deletions config/default_sch_lab_tbl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/************************************************************************
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
*
* Copyright (c) 2020 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 SCH_LAB table structures
*
* @note
* Constants and enumerated types related to these table structures
* are defined in sch_lab_tbldefs.h.
*/
#ifndef SCH_LAB_TBL_H
#define SCH_LAB_TBL_H

#include "sch_lab_tbldefs.h"
#include "sch_lab_tblstruct.h"

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@

/**
* @file
* This file contains the schedule tables for the SCH Lab app.
* It is intended to go in the platform include directory so the SCH_LAB
* app source code does not have to be modified.
* Specification for the CFS SCH_LAB table related data structures and
* constant definitions.
*
* The structure definitions in this file are closely related to the implementation
* of the application. Any modification to these structures will likely need
* a correpsonding update to the source code.
*/
#ifndef SCH_LAB_TABLE_H
#define SCH_LAB_TABLE_H
#ifndef SCH_LAB_TBLDEFS_H
#define SCH_LAB_TBLDEFS_H

#include "cfe_sb_extern_typedefs.h" /* for CFE_SB_MsgId_t */
#include "cfe_msg_api_typedefs.h" /* For CFE_MSG_FcnCode_t */
Expand All @@ -34,14 +37,13 @@
*/
#define SCH_LAB_END_OF_TABLE 0
#define SCH_LAB_MAX_SCHEDULE_ENTRIES 32
#define SCH_TBL_DEFAULT_FILE "/cf/sch_lab_table.tbl"

#define SCH_MAX_MSG_WORDS 32

#ifdef SOFTWARE_BIG_BIT_ORDER
#ifdef SOFTWARE_BIG_BIT_ORDER
#define SCH_PACK_32BIT(value) \
(uint16)((value & 0xFFFF0000) >> 16), (uint16)(value & 0x0000FFFF)
#else
(uint16)((value & 0xFFFF0000) >> 16), (uint16)(value & 0x0000FFFF)
#else
#define SCH_PACK_32BIT(value) \
(uint16)(value & 0x0000FFFF), (uint16)((value & 0xFFFF0000) >> 16)
#endif
Expand Down
42 changes: 42 additions & 0 deletions config/default_sch_lab_tblstruct.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/************************************************************************
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
*
* Copyright (c) 2020 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 SCH_LAB table encapsulation structures
*
* Provides default definitions for SCH_LAB table structures
*
* @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 SCH_LAB_TBLSTRUCT_H
#define SCH_LAB_TBLSTRUCT_H

#include "sch_lab_tbldefs.h"


/*
* There is no extra encapsulation here, this header only
* defines the default file name to use for the SCH table
*/
#define SCH_TBL_DEFAULT_FILE "/cf/sch_lab_table.tbl"


#endif
6 changes: 1 addition & 5 deletions fsw/src/sch_lab_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@

#include "sch_lab_perfids.h"
#include "sch_lab_version.h"

/*
** SCH Lab Schedule table from the platform inc directory
*/
#include "sch_lab_table.h"
#include "sch_lab_tbl.h"

/*
** Global Structure
Expand Down
11 changes: 1 addition & 10 deletions fsw/tables/sch_lab_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
************************************************************************/

#include "cfe_tbl_filedef.h" /* Required to obtain the CFE_TBL_FILEDEF macro definition */
#include "sch_lab_table.h"
#include "sch_lab_tbl.h"
#include "cfe_sb.h" /* Required to use the CFE_SB_MSGID_WRAP_VALUE macro */

#ifdef HAVE_CI_LAB
Expand Down Expand Up @@ -52,15 +52,6 @@
#include "lc_msgids.h"
#endif


/*
** Include headers for message IDs here
*/
#include "ci_lab_msgids.h"
#include "to_lab_msgids.h"

#include "sample_app_msgids.h"

/*
** SCH Lab schedule table
** When populating this table:
Expand Down
36 changes: 36 additions & 0 deletions mission_build.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
###########################################################
#
# SCH_LAB mission 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 SCH_LAB configuration
set(SCH_LAB_MISSION_CONFIG_FILE_LIST
sch_lab_mission_cfg.h
sch_lab_perfids.h
sch_lab_tbldefs.h
sch_lab_tbl.h
sch_lab_tblstruct.h
)

# Create wrappers around the all the config header files
# This makes them individually overridable by the missions, without modifying
# the distribution default copies
foreach(SCH_LAB_CFGFILE ${SCH_LAB_MISSION_CONFIG_FILE_LIST})
get_filename_component(CFGKEY "${SCH_LAB_CFGFILE}" NAME_WE)
if (DEFINED SCH_LAB_CFGFILE_SRC_${CFGKEY})
set(DEFAULT_SOURCE GENERATED_FILE "${SCH_LAB_CFGFILE_SRC_${CFGKEY}}")
else()
set(DEFAULT_SOURCE FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${SCH_LAB_CFGFILE}")
endif()
if (DEFAULT_SOURCE)
generate_config_includefile(
FILE_NAME "${SCH_LAB_CFGFILE}"
${DEFAULT_SOURCE}
)
endif()
endforeach()

0 comments on commit 14ce0f9

Please sign in to comment.