Skip to content

Commit

Permalink
Fix #147, reorganize source files
Browse files Browse the repository at this point in the history
Organize source files into a directory and naming pattern that is
compliant with the CFE current recommended practice.

Configurable items are moved to the respective header files and
documentation is added to indicate what they do.
  • Loading branch information
jphickey committed Oct 25, 2023
1 parent ed38aa2 commit 04e089e
Show file tree
Hide file tree
Showing 20 changed files with 738 additions and 223 deletions.
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ project(CFS_CI_LAB C)

set(APP_SRC_FILES
fsw/src/ci_lab_app.c
fsw/src/ci_lab_cmds.c
fsw/src/ci_lab_dispatch.c
)

# Create the app module
add_cfe_app(ci_lab ${APP_SRC_FILES})

target_include_directories(ci_lab PUBLIC
fsw/mission_inc
fsw/platform_inc
)
target_include_directories(ci_lab PUBLIC fsw/inc)
27 changes: 27 additions & 0 deletions arch_build.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
###########################################################
#
# CI_LAB 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 CI_LAB configuration
set(CI_LAB_PLATFORM_CONFIG_FILE_LIST
ci_lab_internal_cfg.h
ci_lab_platform_cfg.h
ci_lab_perfids.h
ci_lab_msgids.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(CI_LAB_CFGFILE ${CI_LAB_PLATFORM_CONFIG_FILE_LIST})
generate_config_includefile(
FILE_NAME "${CI_LAB_CFGFILE}"
FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${CI_LAB_CFGFILE}"
)
endforeach()
41 changes: 41 additions & 0 deletions config/default_ci_lab_fcncodes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/************************************************************************
* 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 CI_LAB command function codes
*
* @note
* 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 CI_LAB_FCNCODES_H
#define CI_LAB_FCNCODES_H

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

/*
** CI_LAB command codes
*/
#define CI_LAB_NOOP_CC 0
#define CI_LAB_RESET_COUNTERS_CC 1

#endif
50 changes: 50 additions & 0 deletions config/default_ci_lab_interface_cfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/************************************************************************
* 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
* CI_LAB 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 CI_LAB_INTERFACE_CFG_H
#define CI_LAB_INTERFACE_CFG_H

/**
* @brief The base UDP port where CI_LAB will listen for incoming messages
*
* In order to allow multiple instances of CFE to run on the same host, the
* processor number - 1 is added to this value. This, if this is set to
* "1234", then the following ports will be used at runtime:
*
* Processor 1: port 1234
* Processor 2: port 1235
* Processor 3: port 1236
*
* And so forth for however many processor numbers exist in the system
*/
#define CI_LAB_BASE_UDP_PORT 1234

#endif
50 changes: 50 additions & 0 deletions config/default_ci_lab_internal_cfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/************************************************************************
* 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
* CI_LAB 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 CI_LAB_INTERNAL_CFG_H
#define CI_LAB_INTERNAL_CFG_H

/**
* @brief The size of the input buffer
*
* This definition controls the maximum size message that can be ingested
* from the UDP socket
*/
#define CI_LAB_MAX_INGEST 768

/**
* @brief The depth of the command input pipe
*
* This controls the depth of the SB input pipe
*/
#define CI_LAB_PIPE_DEPTH 32

#endif
36 changes: 36 additions & 0 deletions config/default_ci_lab_mission_cfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/************************************************************************
* 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
*
* CI_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 CI_LAB_MISSION_CFG_H
#define CI_LAB_MISSION_CFG_H

#include "ci_lab_interface_cfg.h"

#endif
38 changes: 38 additions & 0 deletions config/default_ci_lab_msg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/************************************************************************
* 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 CI_LAB command and telemetry
* message data types.
*
* This is a compatibility header for the "ci_lab_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 CI_LAB_MSG_H
#define CI_LAB_MSG_H

#include "ci_lab_interface_cfg.h"
#include "ci_lab_msgdefs.h"
#include "ci_lab_msgstruct.h"

#endif
48 changes: 48 additions & 0 deletions config/default_ci_lab_msgdefs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/************************************************************************
* 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 CI_LAB command and telemetry
* message constant definitions.
*
* For CI_LAB this is only the function/command code definitions
*/
#ifndef CI_LAB_MSGDEFS_H
#define CI_LAB_MSGDEFS_H

#include "ci_lab_fcncodes.h"

/*************************************************************************/
/*
** Payload definition (CI_LAB housekeeping)...
*/
typedef struct
{
uint8 CommandErrorCounter;
uint8 CommandCounter;
uint8 EnableChecksums;
uint8 SocketConnected;
uint8 Spare1[8];
uint32 IngestPackets;
uint32 IngestErrors;
uint32 Spare2;

} CI_LAB_HkTlm_Payload_t;

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

/**
* @file
* Define CI Lab Message IDs
* CI_LAB Application Message IDs
*/
#ifndef CI_LAB_MSGIDS_H
#define CI_LAB_MSGIDS_H
Expand Down
Loading

0 comments on commit 04e089e

Please sign in to comment.