Skip to content

Commit

Permalink
Fix #166, 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 26, 2023
1 parent 20e4792 commit 9a1f5ca
Show file tree
Hide file tree
Showing 25 changed files with 1,096 additions and 515 deletions.
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ endforeach()

set(APP_SRC_FILES
fsw/src/to_lab_app.c
fsw/src/to_lab_cmds.c
fsw/src/to_lab_dispatch.c
)

# Create the app module
add_cfe_app(to_lab ${APP_SRC_FILES})
add_cfe_tables(to_lab fsw/tables/to_lab_sub.c)

target_include_directories(to_lab PUBLIC
fsw/mission_inc
fsw/platform_inc
)
target_include_directories(to_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 @@
###########################################################
#
# TO_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 TO_LAB configuration
set(TO_LAB_PLATFORM_CONFIG_FILE_LIST
to_lab_internal_cfg.h
to_lab_platform_cfg.h
to_lab_perfids.h
to_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(TO_LAB_CFGFILE ${TO_LAB_PLATFORM_CONFIG_FILE_LIST})
generate_config_includefile(
FILE_NAME "${TO_LAB_CFGFILE}"
FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${TO_LAB_CFGFILE}"
)
endforeach()
46 changes: 46 additions & 0 deletions config/default_to_lab_fcncodes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/************************************************************************
* 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 TO_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 TO_LAB_FCNCODES_H
#define TO_LAB_FCNCODES_H

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

/*
** TO_LAB command codes
*/
#define TO_LAB_NOOP_CC 0 /* no-op command */
#define TO_LAB_RESET_STATUS_CC 1 /* reset status */
#define TO_LAB_ADD_PKT_CC 2 /* add packet */
#define TO_LAB_SEND_DATA_TYPES_CC 3 /* send data types */
#define TO_LAB_REMOVE_PKT_CC 4 /* remove packet */
#define TO_LAB_REMOVE_ALL_PKT_CC 5 /* remove all packet */
#define TO_LAB_OUTPUT_ENABLE_CC 6 /* output enable */

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

/**
* @brief The base UDP port number that TO_LAB will send to
*/
#define TO_LAB_TLM_PORT 1235

/**
* @brief The maximum number of subscriptions that TO_LAB can subscribe to
*/
#define TO_LAB_MAX_SUBSCRIPTIONS 32

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

/*****************************************************************************/

#define TO_LAB_TASK_MSEC 500 /* run at 2 Hz */

/**
* Depth of pipe for commands to the TO_LAB application itself
*/
#define TO_LAB_CMD_PIPE_DEPTH 8

/**
* Depth of pipe for telemetry forwarded through the TO_LAB application
*/
#define TO_LAB_TLM_PIPE_DEPTH OS_QUEUE_MAX_DEPTH

#endif
36 changes: 36 additions & 0 deletions config/default_to_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
*
* TO_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 TO_LAB_MISSION_CFG_H
#define TO_LAB_MISSION_CFG_H

#include "to_lab_interface_cfg.h"

#endif
38 changes: 38 additions & 0 deletions config/default_to_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 TO_LAB command and telemetry
* message data types.
*
* This is a compatibility header for the "to_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 TO_LAB_MSG_H
#define TO_LAB_MSG_H

#include "to_lab_interface_cfg.h"
#include "to_lab_msgdefs.h"
#include "to_lab_msgstruct.h"

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

#include "common_types.h"
#include "cfe_sb_extern_typedefs.h"
#include "to_lab_fcncodes.h"

typedef struct
{
uint8 CommandCounter;
uint8 CommandErrorCounter;
uint8 spareToAlign[2];
} TO_LAB_HkTlm_Payload_t;

typedef struct
{
uint16 synch;
uint8 bl1, bl2; /* boolean */
int8 b1, b2, b3, b4;
int16 w1, w2;
int32 dw1, dw2;
float f1, f2;
double df1, df2;
char str[10];
} TO_LAB_DataTypes_Payload_t;

typedef struct
{
CFE_SB_MsgId_t Stream;
CFE_SB_Qos_t Flags;
uint8 BufLimit;
} TO_LAB_AddPacket_Payload_t;

typedef struct
{
CFE_SB_MsgId_t Stream;
} TO_LAB_RemovePacket_Payload_t;

typedef struct
{
char dest_IP[16];
} TO_LAB_EnableOutput_Payload_t;

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

/**
* @file
* Define TO Lab Message IDs
* TO_LAB Application Message IDs
*/
#ifndef TO_LAB_MSGIDS_H
#define TO_LAB_MSGIDS_H
Expand Down
Loading

0 comments on commit 9a1f5ca

Please sign in to comment.