diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml index b8a9b02..109e1b5 100644 --- a/.github/workflows/build-documentation.yml +++ b/.github/workflows/build-documentation.yml @@ -2,7 +2,15 @@ name: Build and Deploy Documentation on: push: + branches: + - dev + - main pull_request: + types: + - opened + - reopened + - synchronize + workflow_dispatch: jobs: build-documentation: diff --git a/.github/workflows/build-run-app.yml b/.github/workflows/build-run-app.yml index 52bbb8c..b780d37 100644 --- a/.github/workflows/build-run-app.yml +++ b/.github/workflows/build-run-app.yml @@ -2,7 +2,15 @@ name: Build and Run on: push: + branches: + - dev + - main pull_request: + types: + - opened + - reopened + - synchronize + workflow_dispatch: jobs: build-run: diff --git a/.github/workflows/codeql-build.yml b/.github/workflows/codeql-build.yml index 01523b0..a6089a7 100644 --- a/.github/workflows/codeql-build.yml +++ b/.github/workflows/codeql-build.yml @@ -2,8 +2,15 @@ name: CodeQl Analysis on: push: + branches: + - dev + - main pull_request: - + types: + - opened + - reopened + - synchronize + workflow_dispatch: jobs: codeql: diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml index b9d1f11..441199a 100644 --- a/.github/workflows/format-check.yml +++ b/.github/workflows/format-check.yml @@ -2,8 +2,11 @@ name: Format Check # Run on all push and pull requests on: - push: pull_request: + types: + - opened + - reopened + - synchronize jobs: format-check: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index fa6bb81..800c300 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -3,7 +3,15 @@ name: Static Analysis # Run on all push and pull requests on: push: + branches: + - dev + - main pull_request: + types: + - opened + - reopened + - synchronize + workflow_dispatch: jobs: static-analysis: diff --git a/.github/workflows/unit-test-coverage.yml b/.github/workflows/unit-test-coverage.yml index d67e62b..5056711 100644 --- a/.github/workflows/unit-test-coverage.yml +++ b/.github/workflows/unit-test-coverage.yml @@ -2,7 +2,15 @@ name: Unit Test and Coverage on: push: + branches: + - dev + - main pull_request: + types: + - opened + - reopened + - synchronize + workflow_dispatch: jobs: unit-test-coverage: diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f0ab7a..efd70de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,9 +8,14 @@ set(APP_SRC_FILES fsw/src/sc_state.c fsw/src/sc_loads.c fsw/src/sc_cmds.c - fsw/src/sc_dispatch.c ) +if (CFE_EDS_ENABLED) + list(APPEND APP_SRC_FILES fsw/src/sc_eds_dispatch.c) +else() + list(APPEND APP_SRC_FILES fsw/src/sc_dispatch.c) +endif() + # Create the app module add_cfe_app(sc ${APP_SRC_FILES}) @@ -18,9 +23,11 @@ add_cfe_app(sc ${APP_SRC_FILES}) target_include_directories(sc PUBLIC fsw/inc) set(APP_TABLE_FILES - fsw/tables/sc_rts001.c fsw/tables/sc_ats1.c + fsw/tables/sc_rts001.c fsw/tables/sc_rts002.c + fsw/tables/sc_rts003.c + fsw/tables/sc_rts004.c ) add_cfe_tables(sc ${APP_TABLE_FILES}) diff --git a/arch_build.cmake b/arch_build.cmake index 32b1b2c..f976176 100644 --- a/arch_build.cmake +++ b/arch_build.cmake @@ -10,31 +10,11 @@ # 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_internal_cfg_values.h sc_platform_cfg.h + sc_perfids.h + sc_msgids.h + sc_msgid_values.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 GENERATED_FILE "${SC_CFGFILE_SRC_${CFGKEY}}") - else() - set(DEFAULT_SOURCE FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${SC_CFGFILE}") - endif() - generate_config_includefile( - FILE_NAME "${SC_CFGFILE}" - ${DEFAULT_SOURCE} - ) -endforeach() +generate_configfile_set(${SC_PLATFORM_CONFIG_FILE_LIST}) diff --git a/config/default_sc_extern_typedefs.h b/config/default_sc_extern_typedefs.h index f54a195..20f30c8 100644 --- a/config/default_sc_extern_typedefs.h +++ b/config/default_sc_extern_typedefs.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -27,6 +26,41 @@ #include "common_types.h" +/** + * ATS/RTS Cmd Status Enumeratoion + */ +enum SC_Status +{ + SC_Status_EMPTY, /**< \brief the object is not loaded */ + SC_Status_LOADED, /**< \brief the object is loaded */ + SC_Status_IDLE, /**< \brief the object is not executing */ + SC_Status_EXECUTED, /**< \brief the object has completed executing */ + SC_Status_SKIPPED, /**< \brief the object (ats command) was skipped */ + SC_Status_EXECUTING, /**< \brief the object is currently executing */ + SC_Status_FAILED_CHECKSUM, /**< \brief the object failed a checksum test */ + SC_Status_FAILED_DISTRIB, /**< \brief the object could not be sent on the SWB */ + SC_Status_STARTING /**< \brief used when an inline switch is executed */ +}; + +typedef uint8 SC_Status_Enum_t; + +#ifndef SC_OMIT_DEPRECATED +/** + * \name Old-style ATS/RTS Cmd Status macros + * \{ + */ +#define SC_EMPTY SC_Status_EMPTY +#define SC_LOADED SC_Status_LOADED +#define SC_IDLE SC_Status_IDLE +#define SC_EXECUTED SC_Status_EXECUTED +#define SC_SKIPPED SC_Status_SKIPPED +#define SC_EXECUTING SC_Status_EXECUTING +#define SC_FAILED_CHECKSUM SC_Status_FAILED_CHECKSUM +#define SC_FAILED_DISTRIB SC_Status_FAILED_DISTRIB +#define SC_STARTING SC_Status_STARTING +/**\}*/ +#endif + /** * @brief An identifier for RTS's * diff --git a/config/default_sc_fcncode_values.h b/config/default_sc_fcncode_values.h new file mode 100644 index 0000000..d7ceb02 --- /dev/null +++ b/config/default_sc_fcncode_values.h @@ -0,0 +1,51 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) Application Message IDs header file + */ +#ifndef DEFAULT_SC_FCNCODE_VALUES_H +#define DEFAULT_SC_FCNCODE_VALUES_H + +#define SC_CCVAL(x) SC_FunctionCode_##x + +enum SC_FunctionCode +{ + SC_FunctionCode_NOOP = 0, + SC_FunctionCode_RESET_COUNTERS = 1, + SC_FunctionCode_SET_APP_STATE = 2, + SC_FunctionCode_SET_FILTER_FILE = 3, + SC_FunctionCode_SET_FILTER_TYPE = 4, + SC_FunctionCode_SET_FILTER_PARMS = 5, + SC_FunctionCode_SET_DEST_TYPE = 6, + SC_FunctionCode_SET_DEST_STATE = 7, + SC_FunctionCode_SET_DEST_PATH = 8, + SC_FunctionCode_SET_DEST_BASE = 9, + SC_FunctionCode_SET_DEST_EXT = 10, + SC_FunctionCode_SET_DEST_SIZE = 11, + SC_FunctionCode_SET_DEST_AGE = 12, + SC_FunctionCode_SET_DEST_COUNT = 13, + SC_FunctionCode_CLOSE_FILE = 14, + SC_FunctionCode_GET_FILE_INFO = 15, + SC_FunctionCode_ADD_MID = 16, + SC_FunctionCode_REMOVE_MID = 17, + SC_FunctionCode_CLOSE_ALL = 18, +}; + +#endif diff --git a/config/default_sc_interface_cfg_values.h b/config/default_sc_interface_cfg_values.h new file mode 100644 index 0000000..e29c380 --- /dev/null +++ b/config/default_sc_interface_cfg_values.h @@ -0,0 +1,39 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) 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 DEFAULT_SC_INTERFACE_CFG_VALUES_H +#define DEFAULT_SC_INTERFACE_CFG_VALUES_H + +/* Use the default configuration value for all */ +#define SC_INTERFACE_CFGVAL(x) DEFAULT_SC_INTERFACE_##x + +#endif diff --git a/config/default_sc_internal_cfg_values.h b/config/default_sc_internal_cfg_values.h new file mode 100644 index 0000000..9bc913c --- /dev/null +++ b/config/default_sc_internal_cfg_values.h @@ -0,0 +1,38 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) 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 DEFAULT_SC_INTERNAL_CFG_H +#define DEFAULT_SC_INTERNAL_CFG_H + +/* Use the default configuration value for all */ +#define SC_INTERNAL_CFGVAL(x) DEFAULT_SC_INTERNAL_##x + +#endif diff --git a/config/default_sc_mission_cfg.h b/config/default_sc_mission_cfg.h index 958e21c..588ea13 100644 --- a/config/default_sc_mission_cfg.h +++ b/config/default_sc_mission_cfg.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -29,8 +28,8 @@ * 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 +#ifndef DEFAULT_SC_MISSION_CFG_H +#define DEFAULT_SC_MISSION_CFG_H #include "sc_interface_cfg.h" diff --git a/config/default_sc_msg.h b/config/default_sc_msg.h index 3d7079f..2f91d62 100644 --- a/config/default_sc_msg.h +++ b/config/default_sc_msg.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -29,11 +28,15 @@ * either by overriding this header or by generating definitions from a command/data * dictionary tool. */ -#ifndef SC_MSG_H -#define SC_MSG_H +#ifndef DEFAULT_SC_MSG_H +#define DEFAULT_SC_MSG_H #include "sc_interface_cfg.h" +#include "sc_fcncodes.h" #include "sc_msgdefs.h" #include "sc_msgstruct.h" +#define SC_MAX_TIME 0xFFFFFFFF /**< \brief Maximum time in SC */ +#define SC_MAX_WAKEUP_CNT 0xFFFFFFFF /**< \brief Maximum wakeup count in SC */ + #endif diff --git a/config/default_sc_msgdefs.h b/config/default_sc_msgdefs.h index 9d4de42..8ccf003 100644 --- a/config/default_sc_msgdefs.h +++ b/config/default_sc_msgdefs.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -24,54 +23,13 @@ * * For SC this is only the function/command code definitions */ -#ifndef SC_MSGDEFS_H -#define SC_MSGDEFS_H +#ifndef DEFAULT_SC_MSGDEFS_H +#define DEFAULT_SC_MSGDEFS_H #include "common_types.h" #include "sc_extern_typedefs.h" #include "sc_fcncodes.h" -/************************************************************************ - * Macro Definitions - ************************************************************************/ - -#define SC_NUMBER_OF_RTS_IN_UINT16 16 /**< \brief Number of RTS represented in a uint16 */ - -/** - * ATS/RTS Cmd Status Enumeratoion - */ -enum SC_Status -{ - SC_Status_EMPTY, /**< \brief the object is not loaded */ - SC_Status_LOADED, /**< \brief the object is loaded */ - SC_Status_IDLE, /**< \brief the object is not executing */ - SC_Status_EXECUTED, /**< \brief the object has completed executing */ - SC_Status_SKIPPED, /**< \brief the object (ats command) was skipped */ - SC_Status_EXECUTING, /**< \brief the object is currently executing */ - SC_Status_FAILED_CHECKSUM, /**< \brief the object failed a checksum test */ - SC_Status_FAILED_DISTRIB, /**< \brief the object could not be sent on the SWB */ - SC_Status_STARTING /**< \brief used when an inline switch is executed */ -}; - -typedef uint8 SC_Status_Enum_t; - -#ifndef SC_OMIT_DEPRECATED -/** - * \name Old-style ATS/RTS Cmd Status macros - * \{ - */ -#define SC_EMPTY SC_Status_EMPTY -#define SC_LOADED SC_Status_LOADED -#define SC_IDLE SC_Status_IDLE -#define SC_EXECUTED SC_Status_EXECUTED -#define SC_SKIPPED SC_Status_SKIPPED -#define SC_EXECUTING SC_Status_EXECUTING -#define SC_FAILED_CHECKSUM SC_Status_FAILED_CHECKSUM -#define SC_FAILED_DISTRIB SC_Status_FAILED_DISTRIB -#define SC_STARTING SC_Status_STARTING -/**\}*/ -#endif - /************************************************************************ * Macro Definitions ************************************************************************/ @@ -100,9 +58,6 @@ typedef uint8 SC_Process_Enum_t; /**\}*/ #endif -#define SC_MAX_TIME 0xFFFFFFFF /**< \brief Maximum time in SC */ -#define SC_MAX_WAKEUP_CNT 0xFFFFFFFF /**< \brief Maximum wakeup count in SC */ - /** * Enumeration for ATS identifiers * @@ -220,14 +175,14 @@ typedef struct uint32 NextRtsWakeupCnt; /**< \brief Next RTS Command Absolute Wakeup Count */ uint32 NextAtsTime; /**< \brief Next ATS Command Time (seconds) */ - uint16 RtsExecutingStatus[(SC_NUMBER_OF_RTS + (SC_NUMBER_OF_RTS_IN_UINT16 - 1)) / SC_NUMBER_OF_RTS_IN_UINT16]; + uint16 RtsExecutingStatus[(SC_NUMBER_OF_RTS + 15) / 16]; /**< \brief RTS executing status bit map where each uint16 represents 16 RTS numbers. Note: array index numbers and bit numbers use base zero indexing, but RTS numbers use base one indexing. Thus, the LSB (bit zero) of uint16 array index zero represents RTS number 1, and bit one of uint16 array index zero represents RTS number 2, etc. If an RTS is IDLE, then the corresponding bit is zero. If an RTS is EXECUTING, then the corresponding bit is one. */ - uint16 RtsDisabledStatus[(SC_NUMBER_OF_RTS + (SC_NUMBER_OF_RTS_IN_UINT16 - 1)) / SC_NUMBER_OF_RTS_IN_UINT16]; + uint16 RtsDisabledStatus[(SC_NUMBER_OF_RTS + 15) / 16]; /**< \brief RTS disabled status bit map where each uint16 represents 16 RTS numbers. Note: array index numbers and bit numbers use base zero indexing, but RTS numbers use base one indexing. Thus, the LSB (bit zero) of uint16 array index zero represents RTS number 1, and bit one of uint16 array diff --git a/config/default_sc_msgid_values.h b/config/default_sc_msgid_values.h new file mode 100644 index 0000000..3428ae5 --- /dev/null +++ b/config/default_sc_msgid_values.h @@ -0,0 +1,32 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) Application Message IDs + */ +#ifndef DEFAULT_SC_MSGID_VALUES_H +#define DEFAULT_SC_MSGID_VALUES_H + +#include "cfe_core_api_base_msgids.h" +#include "sc_topicids.h" + +#define CFE_PLATFORM_SC_CMD_MIDVAL(x) CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_SC_##x##_TOPICID) +#define CFE_PLATFORM_SC_TLM_MIDVAL(x) CFE_PLATFORM_TLM_TOPICID_TO_MIDV(CFE_MISSION_SC_##x##_TOPICID) + +#endif diff --git a/config/default_sc_msgids.h b/config/default_sc_msgids.h index a302bdf..91f15c6 100644 --- a/config/default_sc_msgids.h +++ b/config/default_sc_msgids.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -21,17 +20,19 @@ * @file * CFS Stored Command (SC) Application Message IDs */ -#ifndef SC_MSGIDS_H -#define SC_MSGIDS_H +#ifndef DEFAULT_SC_MSGIDS_H +#define DEFAULT_SC_MSGIDS_H + +#include "sc_msgid_values.h" /** * \defgroup cfssccmdmid CFS Stored Command Command Message IDs * \{ */ -#define SC_CMD_MID (0x18A9) /**< \brief Msg ID for cmds to SC */ -#define SC_SEND_HK_MID (0x18AA) /**< \brief Msg ID to request SC HK */ -#define SC_WAKEUP_MID (0x18AB) /**< \brief Msg ID to receive the wakeup command */ +#define SC_CMD_MID CFE_PLATFORM_SC_CMD_MIDVAL(CMD) +#define SC_SEND_HK_MID CFE_PLATFORM_SC_CMD_MIDVAL(SEND_HK) +#define SC_WAKEUP_MID CFE_PLATFORM_SC_CMD_MIDVAL(WAKEUP) /**\}*/ @@ -40,14 +41,13 @@ * \{ */ -#define SC_HK_TLM_MID (0x08AA) /**< \brief Msg ID to send telemtry down on */ +#define SC_HK_TLM_MID CFE_PLATFORM_SC_TLM_MIDVAL(HK_TLM) /**< \brief SC Hk Telemetry Message ID ****/ /**\}*/ /* Compatibility identifiers - in case existing SCH table(s) use the old wakeup MID define */ #ifndef SC_OMIT_DEPRECATED #define SC_1HZ_WAKEUP_MID SC_WAKEUP_MID -#define SC_ONEHZ_WAKEUP_MID SC_WAKEUP_MID #endif #endif diff --git a/config/default_sc_msgstruct.h b/config/default_sc_msgstruct.h index 087df62..ed68089 100644 --- a/config/default_sc_msgstruct.h +++ b/config/default_sc_msgstruct.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -26,14 +25,14 @@ * Constants and enumerated types related to these message structures * are defined in sc_msgdefs.h. */ -#ifndef SC_MSGSTRUCT_H -#define SC_MSGSTRUCT_H +#ifndef DEFAULT_SC_MSGSTRUCT_H +#define DEFAULT_SC_MSGSTRUCT_H /************************************************************************ * Includes ************************************************************************/ -#include "sc_msgdefs.h" #include "sc_mission_cfg.h" +#include "sc_msgdefs.h" #include "cfe_msg_hdr.h" /* NOTE: The following should be just cfe_tbl_msgdefs.h, diff --git a/config/default_sc_perfids.h b/config/default_sc_perfids.h index 3cf2ea1..4b483ad 100644 --- a/config/default_sc_perfids.h +++ b/config/default_sc_perfids.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/config/default_sc_platform_cfg.h b/config/default_sc_platform_cfg.h index ac20cd2..cd72ee3 100644 --- a/config/default_sc_platform_cfg.h +++ b/config/default_sc_platform_cfg.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -33,8 +32,8 @@ * 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 DEFAULT_SC_PLATFORM_CFG_H +#define DEFAULT_SC_PLATFORM_CFG_H #include "sc_mission_cfg.h" #include "sc_internal_cfg.h" diff --git a/config/default_sc_tbl.h b/config/default_sc_tbl.h index 9fa8817..d12cfa0 100644 --- a/config/default_sc_tbl.h +++ b/config/default_sc_tbl.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -25,11 +24,32 @@ * Constants and enumerated types related to these table structures * are defined in sc_tbldefs.h. */ -#ifndef SC_TBL_H -#define SC_TBL_H +#ifndef DEFAULT_SC_TBL_H +#define DEFAULT_SC_TBL_H #include "sc_interface_cfg.h" +#include "sc_extern_typedefs.h" #include "sc_tbldefs.h" #include "sc_tblstruct.h" +/************************************************************************* + * Macro Definitions + *************************************************************************/ +#define SC_ATS_HEADER_SIZE (offsetof(SC_AtsEntry_t, Msg)) /**< \brief ATS header size in bytes */ +#define SC_RTS_HEADER_SIZE (offsetof(SC_RtsEntry_t, Msg)) /**< \brief RTS header size in bytes */ + +/** + * \defgroup cfscstblids ID definitions for cFE Table Services manage table request command + * \{ + */ +#define SC_TBL_ID_ATS_0 (1) /**< \brief ATS 0 Table ID */ +#define SC_TBL_ID_APPEND (SC_TBL_ID_ATS_0 + SC_NUMBER_OF_ATS) /**< \brief Append Table ID */ +#define SC_TBL_ID_RTS_0 (SC_TBL_ID_APPEND + 1) /**< \brief RTS 0 Table ID */ +#define SC_TBL_ID_RTS_INFO (SC_TBL_ID_RTS_0 + SC_NUMBER_OF_RTS) /**< \brief RTS Info Table ID */ +#define SC_TBL_ID_RTP_CTRL (SC_TBL_ID_RTS_INFO + 1) /**< \brief RTS Control Table ID */ +#define SC_TBL_ID_ATS_INFO (SC_TBL_ID_RTP_CTRL + 1) /**< \brief ATS Info Table ID */ +#define SC_TBL_ID_ATP_CTRL (SC_TBL_ID_ATS_INFO + 1) /**< \brief ATS Control Table ID */ +#define SC_TBL_ID_ATS_CMD_0 (SC_TBL_ID_ATP_CTRL + 1) /**< \brief ATS 0 Command Table ID */ +/**\}*/ + #endif diff --git a/config/default_sc_tbldefs.h b/config/default_sc_tbldefs.h index ad4b67c..ae77cf7 100644 --- a/config/default_sc_tbldefs.h +++ b/config/default_sc_tbldefs.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -23,32 +22,11 @@ * constant and structure definitions. * */ -#ifndef SC_TBLDEFS_H -#define SC_TBLDEFS_H +#ifndef DEFAULT_SC_TBLDEFS_H +#define DEFAULT_SC_TBLDEFS_H #include "common_types.h" #include "sc_extern_typedefs.h" -#include "cfe_msg_hdr.h" - -/************************************************************************* - * Macro Definitions - *************************************************************************/ -#define SC_ATS_HEADER_SIZE (sizeof(SC_AtsEntryHeader_t)) /**< \brief ATS header size in bytes */ -#define SC_RTS_HEADER_SIZE (sizeof(SC_RtsEntryHeader_t)) /**< \brief RTS header size in bytes */ - -/** - * \defgroup cfscstblids ID definitions for cFE Table Services manage table request command - * \{ - */ -#define SC_TBL_ID_ATS_0 (1) /**< \brief ATS 0 Table ID */ -#define SC_TBL_ID_APPEND (SC_TBL_ID_ATS_0 + SC_NUMBER_OF_ATS) /**< \brief Append Table ID */ -#define SC_TBL_ID_RTS_0 (SC_TBL_ID_APPEND + 1) /**< \brief RTS 0 Table ID */ -#define SC_TBL_ID_RTS_INFO (SC_TBL_ID_RTS_0 + SC_NUMBER_OF_RTS) /**< \brief RTS Info Table ID */ -#define SC_TBL_ID_RTP_CTRL (SC_TBL_ID_RTS_INFO + 1) /**< \brief RTS Control Table ID */ -#define SC_TBL_ID_ATS_INFO (SC_TBL_ID_RTP_CTRL + 1) /**< \brief ATS Info Table ID */ -#define SC_TBL_ID_ATP_CTRL (SC_TBL_ID_ATS_INFO + 1) /**< \brief ATS Control Table ID */ -#define SC_TBL_ID_ATS_CMD_0 (SC_TBL_ID_ATP_CTRL + 1) /**< \brief ATS 0 Command Table ID */ -/**\}*/ /************************************************************************ * Type Definitions @@ -64,6 +42,23 @@ typedef uint32 SC_AbsTimeTag_t; */ typedef uint32 SC_RelWakeupCount_t; +/** + * @brief A sequence number for commands. + * + * This value is intended to indicate the order with which commands + * are executed within an ATS + * + * @note The command number in ATS entries is strictly for command + * identification and referencing purposes. Commands do not need to + * appear in the table, nor be do they need to be numbered in order. + * + * For example, the command with SeqIndex == 3 will be the 4th command executed + * within the ATS, after sorting by time. + * + * The valid range is [0..SC_MAX_ATS_CMDS-1] + */ +typedef uint16 SC_SeqIndex_t; + /** * \brief ATS Table Entry Header Type */ @@ -115,4 +110,28 @@ typedef struct CFE_MSG_CommandHeader_t Msg; /**< \brief Command Message to be sent */ } SC_RtsEntry_t; +/** + * \brief ATS Info Table Type - One of these records are kept for each ATS + */ +typedef struct +{ + uint16 AtsUseCtr; /**< \brief How many times it has been used */ + uint16 NumberOfCommands; /**< \brief number of commands in the ATS */ + uint32 AtsSize; /**< \brief size of the ATS */ +} SC_AtsInfoTable_t; + +/** + * \brief RTS info table entry type -One of these records is kept for each RTS + */ +typedef struct +{ + SC_Status_Enum_t RtsStatus; /**< \brief status of the RTS */ + bool DisabledFlag; /**< \brief disabled/enabled flag */ + uint8 CmdCtr; /**< \brief Cmds executed in current rts */ + uint8 CmdErrCtr; /**< \brief errs in current RTS */ + uint32 NextCommandTgtWakeup; /**< \brief target wakeup count for next RTS command */ + SC_EntryOffset_t NextCommandPtr; /**< \brief where next rts cmd is */ + uint16 UseCtr; /**< \brief how many times RTS is run */ +} SC_RtsInfoEntry_t; + #endif diff --git a/config/default_sc_tblstruct.h b/config/default_sc_tblstruct.h index baee180..a76beca 100644 --- a/config/default_sc_tblstruct.h +++ b/config/default_sc_tblstruct.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -27,14 +26,41 @@ * either by overriding this header or by generating definitions from a command/data * dictionary tool. */ -#ifndef SC_TBLSTRUCT_H -#define SC_TBLSTRUCT_H +#ifndef DEFAULT_SC_TBLSTRUCT_H +#define DEFAULT_SC_TBLSTRUCT_H /************************************************************************* * Includes *************************************************************************/ +#include "common_types.h" #include "sc_tbldefs.h" #include "sc_mission_cfg.h" #include "cfe_mission_cfg.h" +/** + * \brief ATP Control Block Type + */ +typedef struct +{ + SC_Status_Enum_t AtpState; /**< \brief execution state of the ATP */ + SC_AtsNum_t CurrAtsNum; /**< \brief current ATS running if any */ + uint16 Padding; /**< \brief Structure padding to align to 32-bit boundaries */ + SC_CommandNum_t CmdNumber; /**< \brief current cmd number to run if any */ + SC_SeqIndex_t TimeIndexPtr; /**< \brief time index pointer for current cmd */ + uint16 SwitchPendFlag; /**< \brief indicates that a buffer switch is waiting */ +} SC_AtpControlBlock_t; + +/** + * \brief RTP Control Block Type + * + * \note Now there is only really one RTP + * This structure contains overall info for the next relative time + * processor. + */ +typedef struct +{ + uint16 NumRtsActive; /**< \brief number of RTSs currently active */ + SC_RtsNum_t CurrRtsNum; /**< \brief next RTS number */ +} SC_RtpControlBlock_t; + #endif diff --git a/config/default_sc_topicid_values.h b/config/default_sc_topicid_values.h new file mode 100644 index 0000000..2351e8c --- /dev/null +++ b/config/default_sc_topicid_values.h @@ -0,0 +1,28 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) Application Topic IDs + */ +#ifndef DEFAULT_SC_TOPICID_VALUES_H +#define DEFAULT_SC_TOPICID_VALUES_H + +#define CFE_MISSION_SC_TIDVAL(x) DEFAULT_CFE_MISSION_SC_##x##_TOPICID + +#endif diff --git a/config/eds_sc_extern_typedefs.h b/config/eds_sc_extern_typedefs.h new file mode 100644 index 0000000..b44741b --- /dev/null +++ b/config/eds_sc_extern_typedefs.h @@ -0,0 +1,68 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) Application table related + * constant definitions. + */ +#ifndef EDS_SC_EXTERN_TYPEDEFS_H +#define EDS_SC_EXTERN_TYPEDEFS_H + +#include "sc_eds_typedefs.h" + +typedef SC_AtsNum_Atom_t SC_AtsNum_t; +typedef SC_RtsNum_Atom_t SC_RtsNum_t; +typedef SC_CommandNum_Atom_t SC_CommandNum_t; +typedef SC_EntryOffset_Atom_t SC_EntryOffset_t; + +/** + * Convert from an ID or Number value (e.g. RTS/ATS identifier) to a native unsigned int + * + * This is mainly intended for printf()-style logging, where it should be paired + * with the "%u" conversion specifier. + */ +#define SC_IDNUM_AS_UINT(arg) ((unsigned int)(arg)) + +/** + * Convert from a native integer value (e.g. a literal) to an ID or Number value + * + * This is mainly intended for initializing values from literals or integers + * This is the inverse macro of SC_IDNUM_AS_UINT() + */ +#define SC_IDNUM_FROM_UINT(arg) ((uint16)(arg)) + +/* _INITIALIZER macros to be used in static (e.g. table) definitions that need to resolve at compile time */ +#define SC_RTS_NUM_INITIALIZER(i) SC_IDNUM_FROM_UINT(i) +#define SC_ATS_NUM_INITIALIZER(i) SC_IDNUM_FROM_UINT(i) +#define SC_COMMAND_NUM_INITIALIZER(i) SC_IDNUM_FROM_UINT(i) + +#define SC_IDNUM_EQUAL(arg1, arg2) (SC_IDNUM_AS_UINT(arg1) == SC_IDNUM_AS_UINT(arg2)) +#define SC_IDNUM_IS_NULL(arg) (SC_IDNUM_AS_UINT(arg) == 0) + +/* _C macros to be used in other places that need to resolve at runtime time - these are type safe */ +#define SC_RTS_NUM_C(i) ((SC_RtsNum_t)SC_IDNUM_FROM_UINT(i)) +#define SC_ATS_NUM_C(i) ((SC_AtsNum_t)SC_IDNUM_FROM_UINT(i)) +#define SC_COMMAND_NUM_C(i) ((SC_CommandNum_t)SC_IDNUM_FROM_UINT(i)) + +/* _NULL macros refer to a value that is always reserved */ +#define SC_RTS_NUM_NULL SC_RTS_NUM_C(0) +#define SC_ATS_NUM_NULL SC_ATS_NUM_C(0) +#define SC_COMMAND_NUM_NULL SC_COMMAND_NUM_C(0) + +#endif diff --git a/config/eds_sc_fcncode_values.h b/config/eds_sc_fcncode_values.h new file mode 100644 index 0000000..ab925fc --- /dev/null +++ b/config/eds_sc_fcncode_values.h @@ -0,0 +1,39 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) Application 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 EDS_SC_FCNCODES_H +#define EDS_SC_FCNCODES_H + +#include "sc_eds_cc.h" + +/************************************************************************ + * Macro Definitions + ************************************************************************/ + +#define SC_CCVAL(x) EDS_CONTAINER_SC_##x##_CC + +#endif diff --git a/config/eds_sc_interface_cfg_values.h b/config/eds_sc_interface_cfg_values.h new file mode 100644 index 0000000..f0fa2a7 --- /dev/null +++ b/config/eds_sc_interface_cfg_values.h @@ -0,0 +1,40 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) 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 EDS_SC_INTERFACE_CFG_VALUES_H +#define EDS_SC_INTERFACE_CFG_VALUES_H + +#include "sc_eds_designparameters.h" + +#define SC_INTERFACE_CFGVAL(x) EdsParam_SC_##x + +#endif diff --git a/config/eds_sc_msgdefs.h b/config/eds_sc_msgdefs.h new file mode 100644 index 0000000..e7804e3 --- /dev/null +++ b/config/eds_sc_msgdefs.h @@ -0,0 +1,31 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) Application command and telemetry + * message constant definitions. + */ +#ifndef EDS_SC_MSGDEFS_H +#define EDS_SC_MSGDEFS_H + +#include "sc_extern_typedefs.h" +#include "sc_eds_typedefs.h" +#include "sc_fcncodes.h" + +#endif diff --git a/config/eds_sc_msgstruct.h b/config/eds_sc_msgstruct.h new file mode 100644 index 0000000..424607f --- /dev/null +++ b/config/eds_sc_msgstruct.h @@ -0,0 +1,35 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) Application Command and Telemetry packet definition file. + * + * @note + * Constants and enumerated types related to these message structures + * are defined in cf_msgdefs.h. + */ +#ifndef EDS_SC_MSGSTRUCT_H +#define EDS_SC_MSGSTRUCT_H + +/************************************************************************ + * Includes + ************************************************************************/ +#include "sc_eds_typedefs.h" + +#endif diff --git a/config/eds_sc_tbldefs.h b/config/eds_sc_tbldefs.h new file mode 100644 index 0000000..ff5aa8e --- /dev/null +++ b/config/eds_sc_tbldefs.h @@ -0,0 +1,35 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) Application table related + * constant definitions. + */ +#ifndef EDS_SC_TBLDEFS_H +#define EDS_SC_TBLDEFS_H + +#include "sc_extern_typedefs.h" +#include "sc_eds_typedefs.h" + +typedef SC_RelWakeupCount_Atom_t SC_RelWakeupCount_t; +typedef SC_AbsTimeTag_Atom_t SC_AbsTimeTag_t; +typedef SC_RelTimeTag_Atom_t SC_RelTimeTag_t; +typedef SC_SeqIndex_Atom_t SC_SeqIndex_t; + +#endif diff --git a/config/eds_sc_tblstruct.h b/config/eds_sc_tblstruct.h new file mode 100644 index 0000000..238deea --- /dev/null +++ b/config/eds_sc_tblstruct.h @@ -0,0 +1,28 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) Application Message IDs header file + */ +#ifndef EDS_SC_TBLSTRUCT_H +#define EDS_SC_TBLSTRUCT_H + +#include "sc_eds_typedefs.h" + +#endif diff --git a/config/eds_sc_topicid_values.h b/config/eds_sc_topicid_values.h new file mode 100644 index 0000000..f7f8465 --- /dev/null +++ b/config/eds_sc_topicid_values.h @@ -0,0 +1,30 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) Application Topic IDs + */ +#ifndef EDS_SC_TOPICID_VALUES_H +#define EDS_SC_TOPICID_VALUES_H + +#include "cfe_mission_eds_designparameters.h" + +#define CFE_MISSION_SC_TIDVAL(x) EdsParam_CFE_MISSION_SC_##x##_TOPICID + +#endif diff --git a/docs/dox_src/CMakeLists.txt b/docs/dox_src/CMakeLists.txt index afe2fb0..3c7f30f 100644 --- a/docs/dox_src/CMakeLists.txt +++ b/docs/dox_src/CMakeLists.txt @@ -10,7 +10,6 @@ # case of a self-contained/standalone build) or by a separate script # (useful if integrating into a larger project with a separate doc build) -cmake_minimum_required(VERSION 3.5) project(SC_DOCS NONE) # generate the configuration files diff --git a/eds/sc.xml b/eds/sc.xml new file mode 100644 index 0000000..adba2ba --- /dev/null +++ b/eds/sc.xml @@ -0,0 +1,561 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Each BASE_TYPES/uint16 represents 16 RTS numbers. + Note: array index numbers and bit numbers use base zero indexing, but RTS numbers use base one indexing. + Thus, the LSB (bit zero) of BASE_TYPES/uint16 array index zero represents RTS number 1, and bit one of BASE_TYPES/uint16 + array index zero represents RTS number 2, etc. If an RTS is ENABLED, then the corresponding bit is zero. + If an RTS is DISABLED, then the corresponding bit is one. + + + + + Each BASE_TYPES/uint16 represents 16 RTS numbers. Note: array + index numbers and bit numbers use base zero indexing, but RTS numbers use base one indexing. Thus, + the LSB (bit zero) of BASE_TYPES/uint16 array index zero represents RTS number 1, and bit one of BASE_TYPES/uint16 array + index zero represents RTS number 2, etc. If an RTS is IDLE, then the corresponding bit is zero. + If an RTS is EXECUTING, then the corresponding bit is one. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fsw/inc/sc_eventids.h b/fsw/inc/sc_eventids.h new file mode 100644 index 0000000..50330f5 --- /dev/null +++ b/fsw/inc/sc_eventids.h @@ -0,0 +1,900 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * The CFS Data Storage (DS) Application event id header file + */ +#ifndef SC_EVENTIDS_H +#define SC_EVENTIDS_H + +/** + * \defgroup cfsdsevents CFS Data Store Event IDs + * \{ + */ + +/** + * \brief DS Initialization Event ID + * + * \par Type: INFORMATION + * + * \par Cause: + * + * This event message is issued if the Data Storage (DS) application successfully + * completes its initialization. + */ +#define SC_INIT_INF_EID 1 + +/** + * \brief DS Initialization Failed Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event message is issued when the application receives an error while + * performing cFE initialization. The value displayed is the return code + * from the function that failed. + */ +#define SC_INIT_ERR_EID 2 + +/** + * \brief DS App Termination Event ID + * + * \par Type: CRITICAL + * + * \par Cause: + * + * This event message is issued when the application performs a voluntary + * termination. The termination may be caused by a cFE command requesting + * the application be terminated - or, the cause may result from the DS + * application having received an error when invoking a cFE or O/S function + * necessary for normal operation. + */ +#define SC_EXIT_ERR_EID 3 + +/** + * \brief DS Critical Data Store Initialization Failed Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * The DS application stores the current values for Destination Filename + * sequence counts in the Critical Data Store (CDS). This ensures that DS + * will not overwrite old data storage files following a processor reset. + * This event indicates an error at startup as DS is initializing access + * to the Critical Data Store. Subsequent CDS errors are ignored by DS. + */ +#define SC_INIT_CDS_ERR_EID 6 + +/** + * \brief DS Critical Data Store Table Restore Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * If configured to make DS tables critical, the DS application will try and + * recover the table data in use prior to a processor reset. These startup + * initialization events indicate that the table data has been restored from + * the Critical Data Store (CDS). + */ +#define SC_INIT_TBL_CDS_EID 7 + +/** + * \brief DS Initialize Table Failed Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * At startup, the DS application must create both a packet filter table and + * a destination file definition table. After creating the tables, DS must + * then load default table data for each of the files. If DS is unable to + * create either table then the application will terminate. If DS is able + * to create both tables and is then unable to load both tables then DS will + * operate in a reduced function mode - thus allowing table load error + * recovery via the cFE Table Services command interface. + */ +#define SC_INIT_TBL_ERR_EID 8 + +/** + * \brief DS Destination Table Validation Results Event ID + * + * \par Type: INFORMATION + * + * \par Cause: + * + * This event describes the results of the Destination File Table validation + * function. The cFE Table Services Manager will call this function autonomously + * when the default table is loaded at startup and also whenever a table validate + * command (that targets this table) is processed. + */ +#define SC_FIL_TBL_EID 10 + +/** + * \brief DS Destination Table Validation Failed Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * These are the errors that the DS application might encounter when verifying + * the contents of a Destination File Table. Note that only the first error + * detected for each table file will result in an event being generated. The + * remaining entries are still tested to establish the result counters but no + * further error events will be generated during this call to the verify function. + */ +#define SC_FIL_TBL_ERR_EID 11 + +/** + * \brief DS Filter Table Validation Results Event ID + * + * \par Type: INFORMATION + * + * \par Cause: + * + * This event describes the results of the Packet Filter Table validation + * function. The cFE Table Services Manager will call this function autonomously + * when the default table is loaded at startup and also whenever a table validate + * command (that targets this table) is processed. + */ +#define SC_FLT_TBL_EID 12 + +/** + * \brief DS Filter Table Validation Failed Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * These are the errors that the DS application might encounter when verifying + * the contents of a Packet Filter Table. Note that only the first error + * detected for each table file will result in an event being generated. The + * remaining entries are still tested to establish the result counters but no + * further error events will be generated during this call to the verify function. + */ +#define SC_FLT_TBL_ERR_EID 13 + +/** + * \brief DS File Name Failed Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This error occurs when an attempt to create a destination filename fails. + * The expected cause of this error is for the sum of the lengths of each + * filename element to be invalid, even though each individual element + * length is valid. Note that each of the individual element strings has + * been previously verified. + * + * Note that the filename create error handler will also disable the + * destination to prevent the immediate re-occurrence of the error as more + * packets are written to this destination. + */ +#define SC_FILE_NAME_ERR_EID 14 + +/** + * \brief DS File Create Failed Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This error occurs when an attempt to create a destination file fails. + * The most common cause of this error is insufficient free space available + * on the target file system (disk). However, it is possible to specify + * a filename that is legal but still invalid (i.e. the path string has + * legal chars but does not exist). + * + * Note that the file create error handler will also disable the destination + * to prevent the immediate re-occurrence of the error as more packets are + * written to this destination. + */ +#define SC_CREATE_FILE_ERR_EID 15 + +/** + * \brief DS File Write Failed Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This error occurs when an attempt to write to a destination file fails. + * The most common cause of this error is insufficient free space available + * on the target file system (disk). Other causes for this error imply + * some sort of operational or file system failure and will require careful + * analysis. + * + * Note that the file write error handler will also close the file and + * disable the destination to prevent the immediate re-occurrence of the + * error as more packets are written to this destination. + */ +#define SC_WRITE_FILE_ERR_EID 16 + +/** + * \brief DS Invalid Command Code Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This error occurs when a DS application command is received that has + * an undefined command code (CC). Ground systems generally prevent + * these errors so the cause is more likely to result from sending "raw" + * ground commands or on-board stored commands. + */ +#define SC_CC_ERR_EID 21 + +/** + * \brief DS Housekeeping Request Invalid Length Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a HK request command. + * The cause of the failure is an invalid command packet length. + */ +#define SC_HKREQ_LEN_ERR_EID 22 + +/** + * \brief DS No-op Command Event ID + * + * \par Type: INFORMATION + * + * \par Cause: + * + * This event signals the successful execution of an application NOOP + * command. The command is used primarily as an indicator that the DS + * application can receive commands and generate telemetry. + */ +#define SC_NOOP_INF_EID 31 + +/** + * \brief DS No-op Command Invalid Length Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a NOOP command. + * The cause of the failure is an invalid command packet length. + */ +#define SC_NOOP_CMD_ERR_EID 32 + +/** + * \brief DS Reset Counters Command Event ID + * + * \par Type: INFORMATION + * + * \par Cause: + * + * This event signals the successful execution of a RESET housekeeping + * counters command. The command is used primarily to clear counters + * that have already been examined. + */ +#define SC_RESET_INF_EID 33 + +/** + * \brief DS Reset Counters Command Invalid Length Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a RESET command. + * The cause of the failure is an invalid command packet length. + */ +#define SC_RESET_CMD_ERR_EID 34 + +/** + * \brief DS Application Enable/Disable State Command Event ID + * + * \par Type: INFORMATION + * + * \par Cause: + * + * This event signals the successful execution of a command to set + * the application enable/disable state for processing data storage + * packets. The DS application is always enabled to receive and + * process commands. + */ +#define SC_ENADIS_CMD_EID 35 + +/** + * \brief DS Application Enable/Disable State Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to set the + * application enable/disable state. The cause of the failure may + * be an invalid command packet length or an invalid enable/disable + * state value. + */ +#define SC_ENADIS_CMD_ERR_EID 36 + +/** + * \brief DS Set Filter File Index Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * The Packet Filter Table consists of an array of packet structures, + * with each element in the array representing one packet message ID. + * + * Each packet structure contains an array of filter structures, and + * each filter structure contains a destination file selection. Thus, + * each packet has multiple filters and each filter selects a file. + * + * File selections are expressed as an index into the Destination File + * Table. + * + * This event signals the successful execution of a command to set the + * destination file index for a single filter entry in the Packet Filter + * Table. + */ +#define SC_FILE_CMD_EID 37 + +/** + * \brief DS Set Filter File Index Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to set the + * Destination File Table index for a Packet Filter Table entry. + * The cause of the failure may be an invalid command packet length, + * an invalid Message ID or an invalid filter parameters index. + * + * The failure may also result from not having a Packet Filter Table + * loaded at the time the command was invoked or because the message + * ID was not found in the Packet Filter Table. + */ +#define SC_FILE_CMD_ERR_EID 38 + +/** + * \brief DS Set Filter Type Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * The Packet Filter Table consists of an array of packet structures, + * with each element in the array representing one packet message ID. + * + * Each packet structure contains an array of filter structures, and + * each filter structure contains a filter type selection. Thus, each + * packet has multiple filters and each filter selects a filter type. + * + * This event signals the successful execution of a command to set the + * filter type for a single filter entry in the Packet Filter Table. + */ +#define SC_FTYPE_CMD_EID 39 + +/** + * \brief DS Set Filter Type Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to set the + * filter type for a Packet Filter Table entry. The cause of the + * failure may be an invalid command packet length, an invalid message + * ID, an invalid Filter Parameters index or an invalid filter type. + * + * The failure may also result from not having a Packet Filter Table + * loaded at the time the command was invoked or because the Message + * ID was not found in the Packet Filter Table. + */ +#define SC_FTYPE_CMD_ERR_EID 40 + +/** + * \brief DS Set Filter Parameters Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * The Packet Filter Table consists of an array of packet structures, + * with each element in the array representing one packet message ID. + * + * Each packet structure contains an array of filter structures, and + * each filter structure contains a set of filter parameters. Thus, + * each packet has multiple filters and each filter has unique filter + * parameters. + * + * This event signals the successful execution of a command to set the + * filter parameters for a single filter entry in the Packet Filter Table. + */ +#define SC_PARMS_CMD_EID 41 + +/** + * \brief DS Set Filter Parameters Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to set the + * filter parameters for a Packet Filter Table entry. The cause of + * the failure may be an invalid command packet length, an invalid + * message ID, an invalid filter parameters index or an invalid filter + * parameters value (N,X,O). + * + * The failure may also result from not having a Packet Filter Table + * loaded at the time the command was invoked or because the Message + * ID was not found in the Packet Filter Table. + */ +#define SC_PARMS_CMD_ERR_EID 42 + +/** + * \brief DS Set Filename Type Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * This event signals the successful execution of a command to set the + * filename type for a Destination File Table entry. + */ +#define SC_NTYPE_CMD_EID 43 + +/** + * \brief DS Set Filename Type Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to set the + * filename type for the selected Destination File Table entry. The + * cause of the failure may be an invalid command packet length, an + * invalid file table index or an invalid filename type. + * + * The failure may also result from not having a Destination File Table + * loaded at the time the command was invoked. + */ +#define SC_NTYPE_CMD_ERR_EID 44 + +/** + * \brief DS Set File Enable/Disable State Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * This event signals the successful execution of a command to set the + * enable/disable state for a Destination File Table entry. + */ +#define SC_STATE_CMD_EID 45 + +/** + * \brief DS Set File Enable/Disable State Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to set the + * enable/disable state for the selected Destination File Table entry. + * The cause of the failure may be an invalid command packet length, + * an invalid file table index or an invalid state selection. + * + * The failure may also result from not having a Destination File Table + * loaded at the time the command was invoked. + */ +#define SC_STATE_CMD_ERR_EID 46 + +/** + * \brief DS Set Filename Path Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * This event signals the successful execution of a command to set the + * path portion of the filename for a Destination File Table entry. + */ +#define SC_PATH_CMD_EID 47 + +/** + * \brief DS Set Filename Path Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to set the + * filename path text for a Destination File Table entry. The cause + * of the failure may be an invalid command packet length, an invalid + * file table index or invalid filename path text. + * + * The failure may also result from not having a Destination File Table + * loaded at the time the command was invoked. + */ +#define SC_PATH_CMD_ERR_EID 48 + +/** + * \brief DS Set File Basename Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * This event signals the successful execution of a command to set the + * basename portion of the filename for a Destination File Table entry. + */ +#define SC_BASE_CMD_EID 49 + +/** + * \brief DS Set File Basename Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to set the + * base filename text for a Destination File Table entry. The cause + * of the failure may be an invalid command packet length, an invalid + * file table index or invalid base filename text. + * + * The failure may also result from not having a Destination File Table + * loaded at the time the command was invoked. + */ +#define SC_BASE_CMD_ERR_EID 50 + +/** + * \brief DS Set Filename Extension Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * This event signals the successful execution of a command to set the + * extension portion of the filename for a Destination File Table entry. + */ +#define SC_EXT_CMD_EID 51 + +/** + * \brief DS Set Filename Extension Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to set the + * filename extension text for a Destination File Table entry. The + * cause of the failure may be an invalid command packet length, an + * invalid file table index or invalid filename extension text. + * + * The failure may also result from not having a Destination File Table + * loaded at the time the command was invoked. + */ +#define SC_EXT_CMD_ERR_EID 52 + +/** + * \brief DS Set Max File Size Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * This event signals the successful execution of a command to set the + * file size limit for a Destination File Table entry. + */ +#define SC_SIZE_CMD_EID 53 + +/** + * \brief DS Set Max File Size Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to set the + * file size limit for a Destination File Table entry. The cause + * of the failure may be an invalid command packet length, an invalid + * file table index or an invalid file size limit. + * + * The failure may also result from not having a Destination File Table + * loaded at the time the command was invoked. + */ +#define SC_SIZE_CMD_ERR_EID 54 + +/** + * \brief DS Set Max File Age Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * This event signals the successful execution of a command to set the + * file age limit for a Destination File Table entry. + */ +#define SC_AGE_CMD_EID 55 + +/** + * \brief DS Set Max File Age Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to set the + * file age limit for a Destination File Table entry. The cause + * of the failure may be an invalid command packet length, an invalid + * file table index or an invalid file age limit. + * + * The failure may also result from not having a Destination File Table + * loaded at the time the command was invoked. + */ +#define SC_AGE_CMD_ERR_EID 56 + +/** + * \brief DS Set Sequence Count Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * This event signals the successful execution of a command to set the + * sequence count for a Destination File Table entry. + */ +#define SC_SEQ_CMD_EID 57 + +/** + * \brief DS Set Sequence Count Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to set the + * sequence count for a Destination File Table entry. The cause + * of the failure may be an invalid command packet length, an invalid + * file table index or an invalid sequence count. + * + * The failure may also result from not having a Destination File Table + * loaded at the time the command was invoked. + */ +#define SC_SEQ_CMD_ERR_EID 58 + +/** + * \brief DS Close Destination File Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * This event signals the successful execution of a command to close + * the selected Destination File. + * + * This command will succeed if the file table index is valid, + * regardless of whether there was an open file. + */ +#define SC_CLOSE_CMD_EID 59 + +/** + * \brief DS Close Destination File Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to close the + * selected Destination File. The cause of the failure may be an + * invalid command packet length or an invalid file table index. + */ +#define SC_CLOSE_CMD_ERR_EID 60 + +/** + * \brief DS File Move Failed Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed attempt to move a Data Storage file + * from the temporary working directory it was created in, to the + * directory specified in the file definition table. The cause of the + * failure may be an invalid combined directory and filename length or + * the system file move function may have returned an error result. + */ +#define SC_MOVE_FILE_ERR_EID 61 + +/** + * \brief DS Get File Info Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * This event signals the successful execution of a command to get + * the file info diagnostic packet. + * + * This command will succeed even if the selected file does not exist. + */ +#define SC_GET_FILE_INFO_CMD_EID 62 + +/** + * \brief DS Get File Info Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to get the + * file info diagnostic packet. The cause of the failure is an + * invalid command packet length. + */ +#define SC_GET_FILE_INFO_CMD_ERR_EID 63 + +/** + * \brief DS Add Message ID to Filter Table Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * This event signals the successful execution of a command to add + * a new message ID to the Packet Filter Table. + * + * The Packet Filter Table must be loaded and have an unused entry + * available for adding the new message ID. The new message ID must + * not be zero and must not already exist in the table. + */ +#define SC_ADD_MID_CMD_EID 64 + +/** + * \brief DS Add Message ID to Filter Table Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to add a new + * message ID to the Packet Filter Table. The cause of the failure + * may be an invalid command packet length or an invalid message ID. + * + * The failure may also result from not having a Packet Filter Table + * loaded at the time the command was invoked. The loaded table + * must have an unused entry available for the new message ID and + * must not already contain the new message ID. + */ +#define SC_ADD_MID_CMD_ERR_EID 65 + +/** + * \brief DS Close All Destination Files Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * This event signals the successful execution of a command to close + * all open Destination Files. + * + * This command will succeed regardless of whether there was an open file. + */ +#define SC_CLOSE_ALL_CMD_EID 66 + +/** + * \brief DS Close All Destination Files Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to close + * all open Destination Files. The cause of the failure can only + * be an invalid command packet length. + */ +#define SC_CLOSE_ALL_CMD_ERR_EID 67 + +/** + * \brief DS File Create Invalid Name Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event is generated when SC_FileCreateName is invoked with an + * empty path name. + */ +#define SC_FILE_CREATE_EMPTY_PATH_ERR_EID 68 + +/** + * \brief DS Filter Table Name Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event is issued when an invalid filter table name is passed to + * the CFE_TBL_GetInfo. + */ +#define SC_APPHK_FILTER_TBL_ERR_EID 69 + +/** + * \brief DS Filter Table Name Create Failed Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event is issued when the filter table name is not successfully + * created (via snprintf) in the SC_SendHkCmd function. + */ +#define SC_APPHK_FILTER_TBL_PRINT_ERR_EID 70 + +/** + * \brief DS Remove Message ID from Filter Table Command Event ID + * + * \par Type: DEBUG + * + * \par Cause: + * + * This event signals the successful execution of a command to remove + * a message ID from the Packet Filter Table. + * + * The Packet Filter Table must be loaded and have a used entry + * for removing the message ID. The message ID must not be zero + * and must already exist in the table. + */ +#define SC_REMOVE_MID_CMD_EID 71 + +/** + * \brief DS Remove Message ID from Filter Table Command Invalid Event ID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals the failed execution of a command to remove a + * message ID from the Packet Filter Table. The cause of the failure + * may be an invalid command packet length or an invalid message ID. + * + * The failure may also result from not having a Packet Filter Table + * loaded at the time the command was invoked. The loaded table + * must have an entry with the indicated message ID. + */ +#define SC_REMOVE_MID_CMD_ERR_EID 72 + +/** + * \brief DS Dropped incoming message due to unrecognized MID + * + * \par Type: ERROR + * + * \par Cause: + * + * This event signals that the DS app has received messages which + * are neither DS commands nor configured for storage. These unrecognized + * messages are dropped and indicate a misconfiguration. + */ +#define SC_MID_ERR_EID 73 + +/**@}*/ + +#endif diff --git a/fsw/inc/sc_events.h b/fsw/inc/sc_events.h index 052f572..2fb9c4e 100644 --- a/fsw/inc/sc_events.h +++ b/fsw/inc/sc_events.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/config/default_sc_fcncodes.h b/fsw/inc/sc_fcncodes.h similarity index 99% rename from config/default_sc_fcncodes.h rename to fsw/inc/sc_fcncodes.h index a3c7356..2056b34 100644 --- a/config/default_sc_fcncodes.h +++ b/fsw/inc/sc_fcncodes.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -29,6 +28,8 @@ #ifndef SC_FCNCODES_H #define SC_FCNCODES_H +#include "sc_fcncode_values.h" + /** * \defgroup cfssccmdcodes CFS Stored Command Command Codes * \{ diff --git a/config/default_sc_interface_cfg.h b/fsw/inc/sc_interface_cfg.h similarity index 50% rename from config/default_sc_interface_cfg.h rename to fsw/inc/sc_interface_cfg.h index fb26f7c..fcf101a 100644 --- a/config/default_sc_interface_cfg.h +++ b/fsw/inc/sc_interface_cfg.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -33,6 +32,8 @@ #ifndef SC_INTERFACE_CFG_H #define SC_INTERFACE_CFG_H +#include "sc_interface_cfg_values.h" + /** * \brief Minimum Packet Size * @@ -42,7 +43,8 @@ * 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 +#define SC_PACKET_MIN_SIZE SC_INTERFACE_CFGVAL(PACKET_MIN_SIZE) +#define DEFAULT_SC_INTERFACE_PACKET_MIN_SIZE 8 /** * \brief Maximum Packet Size @@ -53,9 +55,11 @@ * 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_PACKET_MAX_SIZE SC_INTERFACE_CFGVAL(PACKET_MAX_SIZE) +#define DEFAULT_SC_INTERFACE_PACKET_MAX_SIZE 256 -#define SC_NUMBER_OF_ATS 2 /**< \brief the number of Absolute Time Sequences */ +#define SC_NUMBER_OF_ATS SC_INTERFACE_CFGVAL(NUMBER_OF_ATS) +#define DEFAULT_SC_INTERFACE_NUMBER_OF_ATS 2 /**< \brief the number of Absolute Time Sequences */ /** * \brief Number of RTS's @@ -67,6 +71,55 @@ * 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 +#define SC_NUMBER_OF_RTS SC_INTERFACE_CFGVAL(NUMBER_OF_RTS) +#define DEFAULT_SC_INTERFACE_NUMBER_OF_RTS 4 + +/** + * \brief Max number of commands in each ATS + * + * \par Description: + * The maximum number of commands that are allowed in each ATS + * + * \par Limits: + * This parameter can't be larger than an unsigned 16 bit + * integer (65535). + */ +#define SC_MAX_ATS_CMDS SC_INTERFACE_CFGVAL(MAX_ATS_CMDS) +#define DEFAULT_SC_INTERFACE_MAX_ATS_CMDS 1000 + +/** + * \brief Max buffer size for an ATS in uint16s + * + * \par Description: + * The max sizeof an ATS buffer in words (not bytes) + * \par Limits: + * This parameter can't be larger than an unsigned 16 bit + * integer (65535). + */ +#define SC_ATS_BUFF_SIZE SC_INTERFACE_CFGVAL(ATS_BUFF_SIZE) +#define DEFAULT_SC_INTERFACE_ATS_BUFF_SIZE 8000 + +/** + * \brief Max buffer size for an Append ATS in uint16s + * + * \par Description: + * The max sizeof an Append ATS buffer in words (not bytes) + * \par Limits: + * This parameter cannot be larger than SC_ATS_BUFF_SIZE. + */ +#define SC_APPEND_BUFF_SIZE SC_INTERFACE_CFGVAL(APPEND_BUFF_SIZE) +#define DEFAULT_SC_INTERFACE_APPEND_BUFF_SIZE 4000 /* Half of ATS_BUFF_SIZE */ + +/** + * \brief Max buffer size for an RTS in uint16s + * + * \par Description: + * The max size of an RTS buffer in WORDS (not bytes) + * \par Limits: + * This parameter can't be larger than an unsigned 16 bit + * integer (65535). + */ +#define SC_RTS_BUFF_SIZE SC_INTERFACE_CFGVAL(RTS_BUFF_SIZE) +#define DEFAULT_SC_INTERFACE_RTS_BUFF_SIZE 150 #endif diff --git a/config/default_sc_internal_cfg.h b/fsw/inc/sc_internal_cfg.h similarity index 79% rename from config/default_sc_internal_cfg.h rename to fsw/inc/sc_internal_cfg.h index b8156d6..3b5ff53 100644 --- a/config/default_sc_internal_cfg.h +++ b/fsw/inc/sc_internal_cfg.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -33,6 +32,8 @@ #ifndef SC_INTERNAL_CFG_H #define SC_INTERNAL_CFG_H +#include "sc_internal_cfg_values.h" + /** * \defgroup cfsscplatformcfg CFS Stored Command Platform Configuration * \{ @@ -68,7 +69,8 @@ * \par Limits: * Must be true or false */ -#define SC_PLATFORM_ENABLE_HEADER_UPDATE false +#define SC_PLATFORM_ENABLE_HEADER_UPDATE SC_INTERNAL_CFGVAL(PLATFORM_ENABLE_HEADER_UPDATE) +#define DEFAULT_SC_INTERNAL_PLATFORM_ENABLE_HEADER_UPDATE false /** * \brief Max number of commands per wakeup @@ -83,51 +85,8 @@ * avoid SC hogging the CPU * */ -#define SC_MAX_CMDS_PER_WAKEUP 8 - -/** - * \brief Max buffer size for an ATS in uint16s - * - * \par Description: - * The max sizeof an ATS buffer in words (not bytes) - * \par Limits: - * This parameter can't be larger than an unsigned 16 bit - * integer (65535). - */ -#define SC_ATS_BUFF_SIZE 8000 - -/** - * \brief Max buffer size for an Append ATS in uint16s - * - * \par Description: - * The max sizeof an Append ATS buffer in words (not bytes) - * \par Limits: - * This parameter cannot be larger than SC_ATS_BUFF_SIZE. - */ -#define SC_APPEND_BUFF_SIZE (SC_ATS_BUFF_SIZE / 2) - -/** - * \brief Max buffer size for an RTS in uint16s - * - * \par Description: - * The max size of an RTS buffer in WORDS (not bytes) - * \par Limits: - * This parameter can't be larger than an unsigned 16 bit - * integer (65535). - */ -#define SC_RTS_BUFF_SIZE 150 - -/** - * \brief Max number of commands in each ATS - * - * \par Description: - * The maximum number of commands that are allowed in each ATS - * - * \par Limits: - * This parameter can't be larger than an unsigned 16 bit - * integer (65535). - */ -#define SC_MAX_ATS_CMDS 1000 +#define SC_MAX_CMDS_PER_WAKEUP SC_INTERNAL_CFGVAL(MAX_CMDS_PER_WAKEUP) +#define DEFAULT_SC_INTERNAL_MAX_CMDS_PER_WAKEUP 8 /** * \brief The last RTS that will be sent with an #SC_RTS_START_INF_EID event message @@ -139,7 +98,8 @@ * \par Limits: * This parameter needs to be less than or equal to SC_NUMBER_OF_RTS */ -#define SC_LAST_RTS_WITH_EVENTS 20 +#define SC_LAST_RTS_WITH_EVENTS SC_INTERNAL_CFGVAL(LAST_RTS_WITH_EVENTS) +#define DEFAULT_SC_INTERNAL_LAST_RTS_WITH_EVENTS 3 /** * \brief Command Pipe Depth @@ -153,7 +113,8 @@ * This parameter must be greater than zero and less than or equal to * OS_QUEUE_MAX_DEPTH. */ -#define SC_PIPE_DEPTH 12 +#define SC_PIPE_DEPTH SC_INTERNAL_CFGVAL(PIPE_DEPTH) +#define DEFAULT_SC_INTERNAL_PIPE_DEPTH 12 /** * \brief ATS Table Filenames @@ -172,7 +133,8 @@ * at run time, or the table fails validation, then the table load * will fail. Refer to #OS_MAX_PATH_LEN for filename length limits. */ -#define SC_ATS_FILE_NAME "/cf/sc_ats" +#define SC_ATS_FILE_NAME SC_INTERNAL_CFGVAL(ATS_FILE_NAME) +#define DEFAULT_SC_INTERNAL_ATS_FILE_NAME "/cf/sc_ats" /** * \brief Append ATS Table Filename @@ -189,7 +151,8 @@ * at run time, or the table fails validation, then the table load * will fail. Refer to #OS_MAX_PATH_LEN for filename length limits. */ -#define SC_APPEND_FILE_NAME "/cf/sc_append.tbl" +#define SC_APPEND_FILE_NAME SC_INTERNAL_CFGVAL(APPEND_FILE_NAME) +#define DEFAULT_SC_INTERNAL_APPEND_FILE_NAME "/cf/sc_append.tbl" /** * \brief RTS Table Filenames @@ -208,7 +171,8 @@ * at run time, or the table fails validation, then the table load * will fail. Refer to #OS_MAX_PATH_LEN for filename length limits. */ -#define SC_RTS_FILE_NAME "/cf/sc_rts" +#define SC_RTS_FILE_NAME SC_INTERNAL_CFGVAL(RTS_FILE_NAME) +#define DEFAULT_SC_INTERNAL_RTS_FILE_NAME "/cf/sc_rts" /** * \brief ATS Table Object Names @@ -227,7 +191,8 @@ * limits on the definition. Refer to #CFE_MISSION_TBL_MAX_NAME_LENGTH for * specific information on limits related to table object names. */ -#define SC_ATS_TABLE_NAME "ATS_TBL" +#define SC_ATS_TABLE_NAME SC_INTERNAL_CFGVAL(ATS_TABLE_NAME) +#define DEFAULT_SC_INTERNAL_ATS_TABLE_NAME "ATS_TBL" /** * \brief Append ATS Table Object Names @@ -242,7 +207,8 @@ * limits on the definition. Refer to #CFE_MISSION_TBL_MAX_NAME_LENGTH for * specific information on limits related to table object names. */ -#define SC_APPEND_TABLE_NAME "APPEND_TBL" +#define SC_APPEND_TABLE_NAME SC_INTERNAL_CFGVAL(APPEND_TABLE_NAME) +#define DEFAULT_SC_INTERNAL_APPEND_TABLE_NAME "APPEND_TBL" /** * \brief RTS Table Object Names @@ -261,7 +227,8 @@ * limits on the definition. Refer to #CFE_MISSION_TBL_MAX_NAME_LENGTH for * specific information on limits related to table object names. */ -#define SC_RTS_TABLE_NAME "RTS_TBL" +#define SC_RTS_TABLE_NAME SC_INTERNAL_CFGVAL(RTS_TABLE_NAME) +#define DEFAULT_SC_INTERNAL_RTS_TABLE_NAME "RTS_TBL" /** * \brief Name of the RTS Infomation Table @@ -271,7 +238,8 @@ * \par Limits: * Must be less than #CFE_MISSION_TBL_MAX_NAME_LENGTH */ -#define SC_RTSINFO_TABLE_NAME "RTSINF_TBL" +#define SC_RTSINFO_TABLE_NAME SC_INTERNAL_CFGVAL(RTSINFO_TABLE_NAME) +#define DEFAULT_SC_INTERNAL_RTSINFO_TABLE_NAME "RTSINF_TBL" /** * \brief Name of the RTP Control block table @@ -281,7 +249,8 @@ * \par Limits: * Must be less than #CFE_MISSION_TBL_MAX_NAME_LENGTH */ -#define SC_RTP_CTRL_TABLE_NAME "RTPCTR_TBL" +#define SC_RTP_CTRL_TABLE_NAME SC_INTERNAL_CFGVAL(RTP_CTRL_TABLE_NAME) +#define DEFAULT_SC_INTERNAL_RTP_CTRL_TABLE_NAME "RTPCTR_TBL" /** * \brief Name of the ATS Infomation Table @@ -291,7 +260,8 @@ * \par Limits: * Must be less than #CFE_MISSION_TBL_MAX_NAME_LENGTH */ -#define SC_ATSINFO_TABLE_NAME "ATSINF_TBL" +#define SC_ATSINFO_TABLE_NAME SC_INTERNAL_CFGVAL(ATSINFO_TABLE_NAME) +#define DEFAULT_SC_INTERNAL_ATSINFO_TABLE_NAME "ATSINF_TBL" /** * \brief Name of the Append ATS Infomation Table @@ -301,7 +271,8 @@ * \par Limits: * Must be less than #CFE_MISSION_TBL_MAX_NAME_LENGTH */ -#define SC_APPENDINFO_TABLE_NAME "APPINF_TBL" +#define SC_APPENDINFO_TABLE_NAME SC_INTERNAL_CFGVAL(APPENDINFO_TABLE_NAME) +#define DEFAULT_SC_INTERNAL_APPENDINFO_TABLE_NAME "APPINF_TBL" /** * \brief Name of the ATP Control block table @@ -311,7 +282,8 @@ * \par Limits: * Must be less than #CFE_MISSION_TBL_MAX_NAME_LENGTH */ -#define SC_ATS_CTRL_TABLE_NAME "ATPCTR_TBL" +#define SC_ATS_CTRL_TABLE_NAME SC_INTERNAL_CFGVAL(ATS_CTRL_TABLE_NAME) +#define DEFAULT_SC_INTERNAL_ATS_CTRL_TABLE_NAME "ATPCTR_TBL" /** * \brief Name Prefix of ATS Cmd Status Table @@ -324,7 +296,8 @@ * \par Limits: * Total length must be less than #CFE_MISSION_TBL_MAX_NAME_LENGTH */ -#define SC_ATS_CMD_STAT_TABLE_NAME "ATSCMD_TBL" +#define SC_ATS_CMD_STAT_TABLE_NAME SC_INTERNAL_CFGVAL(ATS_CMD_STAT_TABLE_NAME) +#define DEFAULT_SC_INTERNAL_ATS_CMD_STAT_TABLE_NAME "ATSCMD_TBL" /** * \brief Defines default state of Continue-Ats-On-Checksum-Failure Flag @@ -336,7 +309,8 @@ * \par Limits: * Must be SC_AtsCont_TRUE or SC_AtsCont_FALSE */ -#define SC_CONT_ON_FAILURE_START SC_AtsCont_TRUE +#define SC_CONT_ON_FAILURE_START SC_INTERNAL_CFGVAL(CONT_ON_FAILURE_START) +#define DEFAULT_SC_INTERNAL_CONT_ON_FAILURE_START SC_AtsCont_TRUE /** * \brief Defines the TIME SC should use for its commands @@ -346,7 +320,8 @@ * * \par Limits: * Must be SC_TimeRef_USE_CFE_TIME, SC_TimeRef_USE_TAI, or SC_TimeRef_USE_UTC */ -#define SC_TIME_TO_USE SC_TimeRef_USE_CFE_TIME +#define SC_TIME_TO_USE SC_INTERNAL_CFGVAL(TIME_TO_USE) +#define DEFAULT_SC_INTERNAL_TIME_TO_USE SC_TimeRef_USE_CFE_TIME /** * \brief Autostart RTS ID after power on @@ -363,7 +338,7 @@ /** * \brief Autostart RTS ID after processor reset * - * \par Description: + * \par Description: * The specified RTS will be automatically invoked after a processor reset * May be configured as 0 to disable * @@ -386,7 +361,8 @@ * Must be defined as a numeric value that is greater than * or equal to zero. */ -#define SC_MISSION_REV 0 +#define SC_MISSION_REV SC_INTERNAL_CFGVAL(MISSION_REV) +#define DEFAULT_SC_INTERNAL_MISSION_REV 0 /**\}*/ diff --git a/fsw/inc/sc_perfids.h b/fsw/inc/sc_perfids.h new file mode 100644 index 0000000..e4c2a90 --- /dev/null +++ b/fsw/inc/sc_perfids.h @@ -0,0 +1,35 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * Define DS Performance IDs + */ +#ifndef SC_PERFIDS_H +#define SC_PERFIDS_H + +/** + * \defgroup cfsdsmissioncfg CFS Data Storage Mission Configuration + * \{ + */ + +#define SC_APPMAIN_PERF_ID 38 /**< \brief Main application performance ID */ + +/**\}*/ + +#endif diff --git a/fsw/inc/sc_topicids.h b/fsw/inc/sc_topicids.h new file mode 100644 index 0000000..00bdb72 --- /dev/null +++ b/fsw/inc/sc_topicids.h @@ -0,0 +1,52 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 constants for topic IDs + */ +#ifndef SC_TOPICIDS_H +#define SC_TOPICIDS_H + +#include "sc_topicid_values.h" + +/** + * \defgroup cfssccmdtid CFS Stored Command Command Topic IDs + * \{ + */ + +#define CFE_MISSION_SC_CMD_TOPICID CFE_MISSION_SC_TIDVAL(CMD) +#define DEFAULT_CFE_MISSION_SC_CMD_TOPICID 0xA9 +#define CFE_MISSION_SC_SEND_HK_TOPICID CFE_MISSION_SC_TIDVAL(SEND_HK) +#define DEFAULT_CFE_MISSION_SC_SEND_HK_TOPICID 0xAA +#define CFE_MISSION_SC_WAKEUP_TOPICID CFE_MISSION_SC_TIDVAL(WAKEUP) +#define DEFAULT_CFE_MISSION_SC_WAKEUP_TOPICID 0xAB + +/**\}*/ + +/** + * \defgroup cfssctlmtid CFS Stored Command Telemetry Topic IDs + * \{ + */ + +#define CFE_MISSION_SC_HK_TLM_TOPICID CFE_MISSION_SC_TIDVAL(HK_TLM) +#define DEFAULT_CFE_MISSION_SC_HK_TLM_TOPICID 0xAA + +/**\}*/ + +#endif diff --git a/fsw/src/sc_app.c b/fsw/src/sc_app.c index 2b9e12a..6955017 100644 --- a/fsw/src/sc_app.c +++ b/fsw/src/sc_app.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -98,6 +97,11 @@ void SC_AppMain(void) /* Check for Software Bus error */ if (Result == CFE_SUCCESS) { + /* + ** Get the current system time in the global SC_AppData.CurrentTime + */ + SC_GetCurrentTime(); + /* Invoke command handlers */ SC_ProcessRequest(BufPtr); } @@ -186,8 +190,8 @@ CFE_Status_t SC_AppInit(void) Result = CFE_SB_CreatePipe(&SC_OperData.CmdPipe, SC_PIPE_DEPTH, SC_CMD_PIPE_NAME); if (Result != CFE_SUCCESS) { - CFE_EVS_SendEvent(SC_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, - "Software Bus Create Pipe returned: 0x%08X", (unsigned int)Result); + CFE_EVS_SendEvent(SC_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "Software Bus Create Pipe returned: 0x%08X", + (unsigned int)Result); return Result; } @@ -286,9 +290,9 @@ CFE_Status_t SC_InitTables(void) RtsInfoPtr = SC_GetRtsInfoObject(SC_RTS_IDX_C(i)); RtsInfoPtr->NextCommandTgtWakeup = SC_MAX_WAKEUP_CNT; - RtsInfoPtr->NextCommandPtr = SC_ENTRY_OFFSET_FIRST; - RtsInfoPtr->RtsStatus = SC_Status_EMPTY; - RtsInfoPtr->DisabledFlag = true; + RtsInfoPtr->NextCommandPtr = SC_ENTRY_OFFSET_FIRST; + RtsInfoPtr->RtsStatus = SC_Status_EMPTY; + RtsInfoPtr->DisabledFlag = true; } /* Load default RTS tables */ diff --git a/fsw/src/sc_app.h b/fsw/src/sc_app.h index ff2839a..842a8bf 100644 --- a/fsw/src/sc_app.h +++ b/fsw/src/sc_app.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -31,9 +30,8 @@ #include "cfe.h" #include "sc_index_types.h" #include "sc_platform_cfg.h" -#include "sc_tbldefs.h" -#include "sc_msgdefs.h" #include "sc_msg.h" +#include "sc_tbl.h" /** * SC time accessor object @@ -48,56 +46,6 @@ typedef struct SC_TimeAccessor CFE_TIME_SysTime_t (*GetTime)(void); } SC_TimeAccessor_t; -/** - * \brief ATP Control Block Type - */ -typedef struct -{ - SC_Status_Enum_t AtpState; /**< \brief execution state of the ATP */ - SC_AtsNum_t CurrAtsNum; /**< \brief current ATS running if any */ - uint16 Padding; /**< \brief Structure padding to align to 32-bit boundaries */ - SC_CommandNum_t CmdNumber; /**< \brief current cmd number to run if any */ - SC_SeqIndex_t TimeIndexPtr; /**< \brief time index pointer for current cmd */ - uint16 SwitchPendFlag; /**< \brief indicates that a buffer switch is waiting */ -} SC_AtpControlBlock_t; - -/** - * \brief ATS Info Table Type - One of these records are kept for each ATS - */ -typedef struct -{ - uint16 AtsUseCtr; /**< \brief How many times it has been used */ - uint16 NumberOfCommands; /**< \brief number of commands in the ATS */ - uint32 AtsSize; /**< \brief size of the ATS */ -} SC_AtsInfoTable_t; - -/** - * \brief RTP Control Block Type - * - * \note Now there is only really one RTP - * This structure contains overall info for the next relative time - * processor. - */ -typedef struct -{ - uint16 NumRtsActive; /**< \brief number of RTSs currently active */ - SC_RtsNum_t CurrRtsNum; /**< \brief next RTS number */ -} SC_RtpControlBlock_t; - -/** - * \brief RTS info table entry type -One of these records is kept for each RTS - */ -typedef struct -{ - SC_Status_Enum_t RtsStatus; /**< \brief status of the RTS */ - bool DisabledFlag; /**< \brief disabled/enabled flag */ - uint8 CmdCtr; /**< \brief Cmds executed in current rts */ - uint8 CmdErrCtr; /**< \brief errs in current RTS */ - uint32 NextCommandTgtWakeup; /**< \brief target wakeup count for next RTS command */ - SC_EntryOffset_t NextCommandPtr; /**< \brief where next rts cmd is */ - uint16 UseCtr; /**< \brief how many times RTS is run */ -} SC_RtsInfoEntry_t; - /** * \brief Wakeup for SC * @@ -368,11 +316,11 @@ typedef struct bool EnableHeaderUpdate; /**< \brief whether to update headers in outgoing messages */ - uint32 NextCmdTime[2]; /**< \brief The overall next command time for ATP (0) and command wakeup count for RTP (1) */ - SC_AbsTimeTag_t CurrentTime; /**< \brief this is the current time for SC */ - uint32 CurrentWakeupCount; /**< \brief this is the current wakeup count for SC */ - SC_RtsNum_t AutoStartRTS; /**< \brief Start selected auto-exec RTS after init */ - uint16 AppendWordCount; /**< \brief Size of cmd entries in current Append ATS table */ + uint32 NextCmdTime[2]; /**< \brief The overall next command time for ATP (0) and command wakeup count for RTP (1) */ + SC_AbsTimeTag_t CurrentTime; /**< \brief this is the current time for SC */ + uint32 CurrentWakeupCount; /**< \brief this is the current wakeup count for SC */ + SC_RtsNum_t AutoStartRTS; /**< \brief Start selected auto-exec RTS after init */ + uint16 AppendWordCount; /**< \brief Size of cmd entries in current Append ATS table */ } SC_AppData_t; /************************************************************************ diff --git a/fsw/src/sc_atsrq.c b/fsw/src/sc_atsrq.c index 0efeebc..e6cbbf2 100644 --- a/fsw/src/sc_atsrq.c +++ b/fsw/src/sc_atsrq.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -47,7 +46,7 @@ /* Starts an ATS */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_StartAtsCmd(const SC_StartAtsCmd_t *Cmd) +CFE_Status_t SC_StartAtsCmd(const SC_StartAtsCmd_t *Cmd) { SC_AtsNum_t AtsNum; /* ATS ID */ SC_AtsIndex_t AtsIndex; /* ATS array index */ @@ -120,6 +119,8 @@ void SC_StartAtsCmd(const SC_StartAtsCmd_t *Cmd) SC_OperData.HkPacket.Payload.CmdErrCtr++; } /* end if */ + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -127,7 +128,7 @@ void SC_StartAtsCmd(const SC_StartAtsCmd_t *Cmd) /* Stop the currently executing ATS */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_StopAtsCmd(const SC_StopAtsCmd_t *Cmd) +CFE_Status_t SC_StopAtsCmd(const SC_StopAtsCmd_t *Cmd) { int32 Result = SC_ERROR; @@ -156,6 +157,8 @@ void SC_StopAtsCmd(const SC_StopAtsCmd_t *Cmd) SC_OperData.AtsCtrlBlckAddr->SwitchPendFlag = false; SC_OperData.HkPacket.Payload.CmdCtr++; + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -303,7 +306,7 @@ void SC_KillAts(void) /* Process an ATS Switch */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_SwitchAtsCmd(const SC_SwitchAtsCmd_t *Cmd) +CFE_Status_t SC_SwitchAtsCmd(const SC_SwitchAtsCmd_t *Cmd) { SC_AtsIndex_t NewAtsIndex; /* the index of the ats to switch to*/ SC_AtsInfoTable_t *AtsInfoPtr; @@ -351,6 +354,8 @@ void SC_SwitchAtsCmd(const SC_SwitchAtsCmd_t *Cmd) SC_OperData.AtsCtrlBlckAddr->SwitchPendFlag = false; } /* end if */ + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -500,7 +505,7 @@ bool SC_InlineSwitch(void) /* Jump an ATS forward in time */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_JumpAtsCmd(const SC_JumpAtsCmd_t *Cmd) +CFE_Status_t SC_JumpAtsCmd(const SC_JumpAtsCmd_t *Cmd) { SC_AtsEntryHeader_t * Entry; /* ATS table entry pointer */ SC_AtsCmdEntryOffsetRecord_t *CmdOffsetRec; /* ATS entry location in table */ @@ -630,6 +635,8 @@ void SC_JumpAtsCmd(const SC_JumpAtsCmd_t *Cmd) SC_OperData.HkPacket.Payload.CmdErrCtr++; } /* end if */ + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -637,7 +644,7 @@ void SC_JumpAtsCmd(const SC_JumpAtsCmd_t *Cmd) /* Continue ATS on Checksum Failure Cmd */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_ContinueAtsOnFailureCmd(const SC_ContinueAtsOnFailureCmd_t *Cmd) +CFE_Status_t SC_ContinueAtsOnFailureCmd(const SC_ContinueAtsOnFailureCmd_t *Cmd) { SC_AtsCont_Enum_t State; @@ -657,9 +664,10 @@ void SC_ContinueAtsOnFailureCmd(const SC_ContinueAtsOnFailureCmd_t *Cmd) SC_OperData.HkPacket.Payload.CmdCtr++; CFE_EVS_SendEvent(SC_CONT_CMD_INF_EID, CFE_EVS_EventType_INFORMATION, - "Continue-ATS-On-Failure command, State: %lu", - (unsigned long)State); + "Continue-ATS-On-Failure command, State: %lu", (unsigned long)State); } + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -667,7 +675,7 @@ void SC_ContinueAtsOnFailureCmd(const SC_ContinueAtsOnFailureCmd_t *Cmd) /* Append to selected ATS */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_AppendAtsCmd(const SC_AppendAtsCmd_t *Cmd) +CFE_Status_t SC_AppendAtsCmd(const SC_AppendAtsCmd_t *Cmd) { SC_AtsIndex_t AtsIndex; /* index (not ID) of target ATS */ SC_AtsInfoTable_t *AtsInfoPtr; @@ -680,7 +688,7 @@ void SC_AppendAtsCmd(const SC_AppendAtsCmd_t *Cmd) CFE_EVS_SendEvent(SC_APPEND_CMD_ARG_ERR_EID, CFE_EVS_EventType_ERROR, "Append ATS error: invalid ATS ID = %u", SC_IDNUM_AS_UINT(Cmd->Payload.AtsNum)); - return; + return CFE_SUCCESS; } /* create base zero array index from base one ID value */ @@ -728,4 +736,6 @@ void SC_AppendAtsCmd(const SC_AppendAtsCmd_t *Cmd) "Append ATS %c command: %d ATS entries appended", SC_IDX_AS_CHAR(AtsIndex), SC_OperData.HkPacket.Payload.AppendEntryCount); } + + return CFE_SUCCESS; } diff --git a/fsw/src/sc_atsrq.h b/fsw/src/sc_atsrq.h index 8d79fac..c06ef60 100644 --- a/fsw/src/sc_atsrq.h +++ b/fsw/src/sc_atsrq.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -65,7 +64,7 @@ bool SC_BeginAts(SC_AtsIndex_t AtsIndex, uint16 TimeOffset); * * \sa #SC_START_ATS_CC */ -void SC_StartAtsCmd(const SC_StartAtsCmd_t *Cmd); +CFE_Status_t SC_StartAtsCmd(const SC_StartAtsCmd_t *Cmd); /** * \brief Stop the executing ATS Command @@ -82,7 +81,7 @@ void SC_StartAtsCmd(const SC_StartAtsCmd_t *Cmd); * * \sa #SC_STOP_ATS_CC */ -void SC_StopAtsCmd(const SC_StopAtsCmd_t *Cmd); +CFE_Status_t SC_StopAtsCmd(const SC_StopAtsCmd_t *Cmd); /** * \brief Stops an ATS & clears out data @@ -116,7 +115,7 @@ void SC_KillAts(void); * * \sa #SC_SWITCH_ATS_CC */ -void SC_SwitchAtsCmd(const SC_SwitchAtsCmd_t *Cmd); +CFE_Status_t SC_SwitchAtsCmd(const SC_SwitchAtsCmd_t *Cmd); /** * \brief @@ -186,7 +185,7 @@ void SC_ServiceSwitchPend(void); * * \sa #SC_JUMP_ATS_CC */ -void SC_JumpAtsCmd(const SC_JumpAtsCmd_t *Cmd); +CFE_Status_t SC_JumpAtsCmd(const SC_JumpAtsCmd_t *Cmd); /** * \brief Lets an ATS continue if a command failed the checksum @@ -202,7 +201,7 @@ void SC_JumpAtsCmd(const SC_JumpAtsCmd_t *Cmd); * * \sa #SC_CONTINUE_ATS_ON_FAILURE_CC */ -void SC_ContinueAtsOnFailureCmd(const SC_ContinueAtsOnFailureCmd_t *Cmd); +CFE_Status_t SC_ContinueAtsOnFailureCmd(const SC_ContinueAtsOnFailureCmd_t *Cmd); /** * \brief Append to an ATS Command @@ -221,6 +220,6 @@ void SC_ContinueAtsOnFailureCmd(const SC_ContinueAtsOnFailureCmd_t *Cmd); * * \sa #SC_APPEND_ATS_CC */ -void SC_AppendAtsCmd(const SC_AppendAtsCmd_t *Cmd); +CFE_Status_t SC_AppendAtsCmd(const SC_AppendAtsCmd_t *Cmd); #endif diff --git a/fsw/src/sc_cmds.c b/fsw/src/sc_cmds.c index 6e8bda5..d59a3a5 100644 --- a/fsw/src/sc_cmds.c +++ b/fsw/src/sc_cmds.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -59,12 +58,12 @@ void SC_ProcessAtpCmd(void) SC_CommandIndex_t CmdIndex; /* ATS command index */ CFE_Status_t Result; bool AbortATS = false; - SC_AtsEntry_t *EntryPtr; + SC_AtsEntry_t * EntryPtr; CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t CommandCode = 0; bool ChecksumValid; SC_AtsCmdEntryOffsetRecord_t *CmdOffsetRec; /* ATS entry location in table */ - SC_AtsCmdStatusEntry_t *StatusEntryPtr; + SC_AtsCmdStatusEntry_t * StatusEntryPtr; /* ** The following conditions must be met before the ATS command will be @@ -288,7 +287,7 @@ void SC_ProcessAtpCmd(void) void SC_ProcessRtpCommand(void) { - SC_RtsEntry_t *EntryPtr; /* a pointer to an RTS entry header */ + SC_RtsEntry_t * EntryPtr; /* a pointer to an RTS entry header */ SC_RtsIndex_t RtsIndex; /* the RTS index for the cmd */ SC_EntryOffset_t CmdOffset; /* the location of the cmd */ CFE_Status_t Result; @@ -311,7 +310,8 @@ void SC_ProcessRtpCommand(void) RtsInfoPtr = SC_GetRtsInfoObject(RtsIndex); - if ((SC_AppData.NextCmdTime[SC_Process_RTP] <= SC_AppData.CurrentWakeupCount) && (RtsInfoPtr->RtsStatus == SC_Status_EXECUTING)) + if ((SC_AppData.NextCmdTime[SC_Process_RTP] <= SC_AppData.CurrentWakeupCount) && + (RtsInfoPtr->RtsStatus == SC_Status_EXECUTING)) { /* ** Count the command for the rate limiter @@ -441,35 +441,24 @@ void SC_SendHkPacket(void) ** Fill out the RTP control block information */ - SC_OperData.HkPacket.Payload.NumRtsActive = SC_OperData.RtsCtrlBlckAddr->NumRtsActive; - SC_OperData.HkPacket.Payload.RtsNum = SC_OperData.RtsCtrlBlckAddr->CurrRtsNum; - SC_OperData.HkPacket.Payload.NextRtsWakeupCnt = SC_AppData.NextCmdTime[SC_Process_RTP]; + SC_OperData.HkPacket.Payload.NumRtsActive = SC_OperData.RtsCtrlBlckAddr->NumRtsActive; + SC_OperData.HkPacket.Payload.RtsNum = SC_OperData.RtsCtrlBlckAddr->CurrRtsNum; + SC_OperData.HkPacket.Payload.NextRtsWakeupCnt = SC_AppData.NextCmdTime[SC_Process_RTP]; /* ** Fill out the RTS status bit mask ** First clear out the status mask */ - for (i = 0; i < (SC_NUMBER_OF_RTS + (SC_NUMBER_OF_RTS_IN_UINT16 - 1)) / SC_NUMBER_OF_RTS_IN_UINT16; i++) - { - SC_OperData.HkPacket.Payload.RtsExecutingStatus[i] = 0; - SC_OperData.HkPacket.Payload.RtsDisabledStatus[i] = 0; - - } /* end for */ + memset(SC_OperData.HkPacket.Payload.RtsExecutingStatus, 0, sizeof(SC_OperData.HkPacket.Payload.RtsExecutingStatus)); + memset(SC_OperData.HkPacket.Payload.RtsDisabledStatus, 0, sizeof(SC_OperData.HkPacket.Payload.RtsDisabledStatus)); for (i = 0; i < SC_NUMBER_OF_RTS; i++) { RtsInfoPtr = SC_GetRtsInfoObject(SC_RTS_IDX_C(i)); - if (RtsInfoPtr->DisabledFlag == true) - { - SC_OperData.HkPacket.Payload.RtsDisabledStatus[i / SC_NUMBER_OF_RTS_IN_UINT16] |= - (1 << (i % SC_NUMBER_OF_RTS_IN_UINT16)); - } - if (RtsInfoPtr->RtsStatus == SC_Status_EXECUTING) - { - SC_OperData.HkPacket.Payload.RtsExecutingStatus[i / SC_NUMBER_OF_RTS_IN_UINT16] |= - (1 << (i % SC_NUMBER_OF_RTS_IN_UINT16)); - } + SC_SET_HKTLM_RTS_MASK(SC_OperData.HkPacket.Payload.RtsDisabledStatus, i, RtsInfoPtr->DisabledFlag); + SC_SET_HKTLM_RTS_MASK(SC_OperData.HkPacket.Payload.RtsExecutingStatus, i, + (RtsInfoPtr->RtsStatus == SC_Status_EXECUTING)); } /* end for */ /* send the status packet */ @@ -482,7 +471,7 @@ void SC_SendHkPacket(void) /* Send HK Command */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_SendHkCmd(const SC_SendHkCmd_t *Cmd) +CFE_Status_t SC_SendHkCmd(const SC_SendHkCmd_t *Cmd) { SC_RtsInfoEntry_t *RtsInfoPtr; @@ -506,6 +495,8 @@ void SC_SendHkCmd(const SC_SendHkCmd_t *Cmd) /* request from health and safety for housekeeping status */ SC_SendHkPacket(); + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -514,7 +505,7 @@ void SC_SendHkCmd(const SC_SendHkCmd_t *Cmd) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_ResetCountersCmd(const SC_ResetCountersCmd_t *Cmd) +CFE_Status_t SC_ResetCountersCmd(const SC_ResetCountersCmd_t *Cmd) { CFE_EVS_SendEvent(SC_RESET_INF_EID, CFE_EVS_EventType_INFORMATION, "Reset counters command"); @@ -526,6 +517,8 @@ void SC_ResetCountersCmd(const SC_ResetCountersCmd_t *Cmd) SC_OperData.HkPacket.Payload.RtsCmdErrCtr = 0; SC_OperData.HkPacket.Payload.RtsActiveCtr = 0; SC_OperData.HkPacket.Payload.RtsActiveErrCtr = 0; + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -533,7 +526,7 @@ void SC_ResetCountersCmd(const SC_ResetCountersCmd_t *Cmd) /* Wakeup Command */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_WakeupCmd(const SC_WakeupCmd_t *Cmd) +CFE_Status_t SC_WakeupCmd(const SC_WakeupCmd_t *Cmd) { uint32 CurrentNumCmds; SC_AppData.CurrentWakeupCount++; @@ -558,11 +551,11 @@ void SC_WakeupCmd(const SC_WakeupCmd_t *Cmd) if (CurrentNumCmds == SC_OperData.NumCmdsWakeup) { SC_GetNextRtsTime(); - + SC_ProcessRtpCommand(); } - - /* + + /* * No commands could be processed */ if (CurrentNumCmds == SC_OperData.NumCmdsWakeup) @@ -572,6 +565,8 @@ void SC_WakeupCmd(const SC_WakeupCmd_t *Cmd) } SC_OperData.NumCmdsWakeup = 0; + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -579,11 +574,13 @@ void SC_WakeupCmd(const SC_WakeupCmd_t *Cmd) /* No Op Command */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_NoopCmd(const SC_NoopCmd_t *Cmd) +CFE_Status_t SC_NoopCmd(const SC_NoopCmd_t *Cmd) { SC_OperData.HkPacket.Payload.CmdCtr++; CFE_EVS_SendEvent(SC_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op command. Version %d.%d.%d.%d", SC_MAJOR_VERSION, SC_MINOR_VERSION, SC_REVISION, SC_MISSION_REV); + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -592,7 +589,7 @@ void SC_NoopCmd(const SC_NoopCmd_t *Cmd) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_ManageTableCmd(const SC_ManageTableCmd_t *Cmd) +CFE_Status_t SC_ManageTableCmd(const SC_ManageTableCmd_t *Cmd) { int32 ArrayIndex; int32 TableID = Cmd->Payload.Parameter; @@ -646,6 +643,8 @@ void SC_ManageTableCmd(const SC_ManageTableCmd_t *Cmd) } // No success/informational event is sent for this command intentionally, to avoid the risk of flooding. + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -696,8 +695,8 @@ void SC_ManageTable(SC_TableType type, int32 ArrayIndex) { CFE_Status_t Result; CFE_TBL_Handle_t TblHandle; - uint32 **TblAddr; - void *TblPtrNew; + uint32 ** TblAddr; + void * TblPtrNew; switch (type) { diff --git a/fsw/src/sc_cmds.h b/fsw/src/sc_cmds.h index 224b18a..d1f437f 100644 --- a/fsw/src/sc_cmds.h +++ b/fsw/src/sc_cmds.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -27,6 +26,7 @@ #include "common_types.h" #include "sc_msg.h" +#include "cfe_error.h" typedef enum { @@ -35,6 +35,24 @@ typedef enum APPEND } SC_TableType; +#define SC_HKTLM_MEMBER_SIZE(x) sizeof(((SC_HkTlm_Payload_t *)0)->x) + +/* Macro to set/clear bits in the HK TLM bitmask for RTS status */ +enum +{ + SC_BITS_PER_HKTLM_OCTET = SC_NUMBER_OF_RTS / SC_HKTLM_MEMBER_SIZE(RtsDisabledStatus), + SC_BITS_PER_HKTLM_WORD = SC_HKTLM_MEMBER_SIZE(RtsDisabledStatus[0]) * SC_BITS_PER_HKTLM_OCTET, +}; + +#define SC_SET_HKTLM_RTS_MASK(f, s, v) \ + do \ + { \ + if (v) \ + f[s / SC_BITS_PER_HKTLM_WORD] |= (1 << (s % SC_BITS_PER_HKTLM_WORD)); \ + else \ + f[s / SC_BITS_PER_HKTLM_WORD] &= ~(1 << (s % SC_BITS_PER_HKTLM_WORD)); \ + } while (0) + /** * \brief Table manage request command handler * @@ -52,7 +70,7 @@ typedef enum * * \sa #SC_MANAGE_TABLE_CC */ -void SC_ManageTableCmd(const SC_ManageTableCmd_t *Cmd); +CFE_Status_t SC_ManageTableCmd(const SC_ManageTableCmd_t *Cmd); /** * \brief Manage pending update to an RTS table @@ -122,7 +140,7 @@ void SC_ManageTable(SC_TableType type, int32 ArrayIndex); * * \sa #SC_NOOP_CC */ -void SC_NoopCmd(const SC_NoopCmd_t *Cmd); +CFE_Status_t SC_NoopCmd(const SC_NoopCmd_t *Cmd); /** * \brief Reset Counters Command @@ -137,7 +155,7 @@ void SC_NoopCmd(const SC_NoopCmd_t *Cmd); * * \sa #SC_RESET_COUNTERS_CC */ -void SC_ResetCountersCmd(const SC_ResetCountersCmd_t *Cmd); +CFE_Status_t SC_ResetCountersCmd(const SC_ResetCountersCmd_t *Cmd); /** * \brief Send Hk Packet to the ground @@ -152,8 +170,8 @@ void SC_ResetCountersCmd(const SC_ResetCountersCmd_t *Cmd); */ void SC_SendHkPacket(void); -void SC_SendHkCmd(const SC_SendHkCmd_t *Cmd); -void SC_WakeupCmd(const SC_WakeupCmd_t *Cmd); +CFE_Status_t SC_SendHkCmd(const SC_SendHkCmd_t *Cmd); +CFE_Status_t SC_WakeupCmd(const SC_WakeupCmd_t *Cmd); /** * \brief Process an ATS Command diff --git a/fsw/src/sc_dispatch.c b/fsw/src/sc_dispatch.c index fbd063e..67c899b 100644 --- a/fsw/src/sc_dispatch.c +++ b/fsw/src/sc_dispatch.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -85,44 +84,48 @@ bool SC_VerifyCmdLength(const CFE_MSG_Message_t *Msg, size_t ExpectedLength) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void SC_ProcessRequest(const CFE_SB_Buffer_t *BufPtr) { - CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; - - /* cast the packet header pointer on the packet buffer */ - CFE_MSG_GetMsgId(&BufPtr->Msg, &MessageID); + static CFE_SB_MsgId_t CMD_MID = CFE_SB_MSGID_RESERVED; + static CFE_SB_MsgId_t SEND_HK_MID = CFE_SB_MSGID_RESERVED; + static CFE_SB_MsgId_t WAKEUP_MID = CFE_SB_MSGID_RESERVED; - /* - ** Get the current system time in the global SC_AppData.CurrentTime - */ - SC_GetCurrentTime(); + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; - switch (CFE_SB_MsgIdToValue(MessageID)) + /* cache the local MID Values here, this avoids repeat lookups */ + if (!CFE_SB_IsValidMsgId(CMD_MID)) { - case SC_CMD_MID: - /* request from the ground */ - SC_ProcessCommand(BufPtr); - break; - - case SC_SEND_HK_MID: - if (SC_VerifyCmdLength(&BufPtr->Msg, sizeof(SC_SendHkCmd_t))) - { - SC_SendHkCmd((const SC_SendHkCmd_t *)BufPtr); - } - break; + CMD_MID = CFE_SB_ValueToMsgId(SC_CMD_MID); + SEND_HK_MID = CFE_SB_ValueToMsgId(SC_SEND_HK_MID); + WAKEUP_MID = CFE_SB_ValueToMsgId(SC_WAKEUP_MID); + } - case SC_WAKEUP_MID: - if (SC_VerifyCmdLength(&BufPtr->Msg, sizeof(SC_WakeupCmd_t))) - { - SC_WakeupCmd((const SC_WakeupCmd_t *)BufPtr); - } - break; + CFE_MSG_GetMsgId(&BufPtr->Msg, &MessageID); - default: - CFE_EVS_SendEvent(SC_MID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command pipe message ID: 0x%08lX", - (unsigned long)CFE_SB_MsgIdToValue(MessageID)); + if (CFE_SB_MsgId_Equal(MessageID, WAKEUP_MID)) + { + if (SC_VerifyCmdLength(&BufPtr->Msg, sizeof(SC_WakeupCmd_t))) + { + SC_WakeupCmd((const SC_WakeupCmd_t *)BufPtr); + } + } + else if (CFE_SB_MsgId_Equal(MessageID, SEND_HK_MID)) + { + if (SC_VerifyCmdLength(&BufPtr->Msg, sizeof(SC_SendHkCmd_t))) + { + SC_SendHkCmd((const SC_SendHkCmd_t *)BufPtr); + } + } + else if (CFE_SB_MsgId_Equal(MessageID, CMD_MID)) + { + /* request from the ground */ + SC_ProcessCommand(BufPtr); + } + else + { + CFE_EVS_SendEvent(SC_MID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command pipe message ID: 0x%08lX", + (unsigned long)CFE_SB_MsgIdToValue(MessageID)); - SC_OperData.HkPacket.Payload.CmdErrCtr++; - break; - } /* end switch */ + SC_OperData.HkPacket.Payload.CmdErrCtr++; + } } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/fsw/src/sc_dispatch.h b/fsw/src/sc_dispatch.h index 32b451f..c3bd6e4 100644 --- a/fsw/src/sc_dispatch.h +++ b/fsw/src/sc_dispatch.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/src/sc_eds_dispatch.c b/fsw/src/sc_eds_dispatch.c new file mode 100644 index 0000000..5ebf437 --- /dev/null +++ b/fsw/src/sc_eds_dispatch.c @@ -0,0 +1,113 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 Checksum (CS) Application provides the service of background + * checksumming user-defined objects in the CFS + */ +#include "cfe.h" + +#include "sc_app.h" +#include "sc_cmds.h" +#include "sc_atsrq.h" +#include "sc_rtsrq.h" +#include "sc_events.h" +#include "sc_msgids.h" +#include "sc_dispatch.h" +#include "sc_utils.h" + +#include "sc_eds_dictionary.h" +#include "sc_eds_dispatcher.h" + +/* clang-format off */ +static const EdsDispatchTable_EdsComponent_SC_Application_CFE_SB_Telecommand_t SC_TC_DISPATCH_TABLE = +{ + .CMD = + { + .NoopCmd_indication = SC_NoopCmd, + .ResetCountersCmd_indication = SC_ResetCountersCmd, + .StartAtsCmd_indication = SC_StartAtsCmd, + .StopAtsCmd_indication = SC_StopAtsCmd, + .StartRtsCmd_indication = SC_StartRtsCmd, + .StopRtsCmd_indication = SC_StopRtsCmd, + .DisableRtsCmd_indication = SC_DisableRtsCmd, + .EnableRtsCmd_indication = SC_EnableRtsCmd, + .SwitchAtsCmd_indication = SC_SwitchAtsCmd, + .JumpAtsCmd_indication = SC_JumpAtsCmd, + .ContinueAtsOnFailureCmd_indication = SC_ContinueAtsOnFailureCmd, + .AppendAtsCmd_indication = SC_AppendAtsCmd, + .ManageTableCmd_indication = SC_ManageTableCmd, + .StartRtsGrpCmd_indication = SC_StartRtsGrpCmd, + .StopRtsGrpCmd_indication = SC_StopRtsGrpCmd, + .DisableRtsGrpCmd_indication = SC_DisableRtsGrpCmd, + .EnableRtsGrpCmd_indication = SC_EnableRtsGrpCmd, + + }, + .SEND_HK = + { + .indication = SC_SendHkCmd + }, + .WAKEUP = + { + .indication = SC_WakeupCmd + } +}; +/* clang-format on */ + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* */ +/* SC_ProcessRequest() -- Process command pipe message */ +/* */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +void SC_ProcessRequest(const CFE_SB_Buffer_t *BufPtr) +{ + CFE_Status_t status; + CFE_SB_MsgId_t MsgId; + CFE_MSG_Size_t MsgSize; + CFE_MSG_FcnCode_t MsgFc; + + status = EdsDispatch_EdsComponent_SC_Application_Telecommand(BufPtr, &SC_TC_DISPATCH_TABLE); + + if (status != CFE_SUCCESS) + { + SC_OperData.HkPacket.Payload.CmdErrCtr++; + + CFE_MSG_GetMsgId(&BufPtr->Msg, &MsgId); + CFE_MSG_GetFcnCode(&BufPtr->Msg, &MsgFc); + + if (status == CFE_STATUS_VALIDATION_FAILURE || status == CFE_STATUS_UNKNOWN_MSG_ID) + { + CFE_EVS_SendEvent(SC_MID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command pipe message ID: 0x%08lX", + (unsigned long)CFE_SB_MsgIdToValue(MsgId)); + } + else if (status == CFE_STATUS_WRONG_MSG_LENGTH) + { + CFE_MSG_GetSize(&BufPtr->Msg, &MsgSize); + CFE_EVS_SendEvent(SC_CMD_LEN_ERR_EID, CFE_EVS_EventType_ERROR, + "Invalid msg length: ID = 0x%08lX, CC = %d, Len = %lu", + (unsigned long)CFE_SB_MsgIdToValue(MsgId), MsgFc, (unsigned long)MsgSize); + } + else + { + CFE_EVS_SendEvent(SC_CC_ERR_EID, CFE_EVS_EventType_ERROR, + "Invalid message recvd: ID=0x%08lX, CC=%d, status=%d", + (unsigned long)CFE_SB_MsgIdToValue(MsgId), MsgFc, (int)status); + } + } +} diff --git a/fsw/src/sc_index_types.h b/fsw/src/sc_index_types.h index 9ddf461..55968b1 100644 --- a/fsw/src/sc_index_types.h +++ b/fsw/src/sc_index_types.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -78,23 +77,6 @@ typedef uint16 SC_AtsIndex_t; */ typedef uint16 SC_CommandIndex_t; -/** - * @brief A sequence number for commands. - * - * This value is intended to indicate the order with which commands - * are executed within an ATS - * - * @note The command number in ATS entries is strictly for command - * identification and referencing purposes. Commands do not need to - * appear in the table, nor be do they need to be numbered in order. - * - * For example, the command with SeqIndex == 3 will be the 4th command executed - * within the ATS, after sorting by time. - * - * The valid range is [0..SC_MAX_ATS_CMDS-1] - */ -typedef uint16 SC_SeqIndex_t; - /* * ------------------------------------------------ * CONVERSIONS between IDs, indices, and integers diff --git a/fsw/src/sc_loads.c b/fsw/src/sc_loads.c index e779fec..eefcadf 100644 --- a/fsw/src/sc_loads.c +++ b/fsw/src/sc_loads.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -44,6 +43,16 @@ ** **************************************************************************/ +static inline int32 SC_GetAtsDupTest(SC_CommandNum_t CmdId) +{ + return SC_OperData.AtsDupTestArray[SC_IDX_AS_UINT(SC_CommandNumToIndex(CmdId))]; +} + +static inline void SC_SetAtsDupTest(SC_CommandNum_t CmdId, int32 Val) +{ + SC_OperData.AtsDupTestArray[SC_IDX_AS_UINT(SC_CommandNumToIndex(CmdId))] = Val; +} + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* Load the ATS from its table to memory */ @@ -108,8 +117,7 @@ void SC_LoadAts(SC_AtsIndex_t AtsIndex) } /* make sure the CmdPtr can fit in a whole Ats Cmd Header at the very least */ - if (!SC_IDX_WITHIN_LIMIT(AtsEntryIndex, - 1 + (SC_ATS_BUFF_SIZE32 - SC_ATS_HDR_WORDS))) /* jphfix - revisit? */ + if (!SC_IDX_WITHIN_LIMIT(AtsEntryIndex, 1 + (SC_ATS_BUFF_SIZE32 - SC_ATS_HDR_WORDS))) { /* even the smallest command will not fit in the buffer */ Result = SC_ERROR; @@ -729,7 +737,7 @@ int32 SC_VerifyAtsTable(uint32 *Buffer32, int32 BufferWords) /* Initialize all command numbers as unused */ for (i = 0; i < SC_MAX_ATS_CMDS; i++) { - SC_OperData.AtsDupTestArray[i] = SC_DUP_TEST_UNUSED; + SC_SetAtsDupTest(SC_CommandIndexToNum(SC_COMMAND_IDX_C(i)), SC_DUP_TEST_UNUSED); } while (StillProcessing) @@ -861,7 +869,7 @@ int32 SC_VerifyAtsEntry(uint32 *Buffer32, int32 EntryIndex, int32 BufferWords) "Verify ATS Table error: buffer overflow: buf index = %d, cmd num = %u, pkt len = %d", (int)EntryIndex, SC_IDNUM_AS_UINT(EntryPtr->Header.CmdNumber), (int)CommandBytes); } - else if (SC_OperData.AtsDupTestArray[SC_CommandNumToIndex(EntryPtr->Header.CmdNumber)] != SC_DUP_TEST_UNUSED) + else if (SC_GetAtsDupTest(EntryPtr->Header.CmdNumber) != SC_DUP_TEST_UNUSED) { /* Entry with duplicate command number is invalid */ Result = SC_ERROR; @@ -869,7 +877,7 @@ int32 SC_VerifyAtsEntry(uint32 *Buffer32, int32 EntryIndex, int32 BufferWords) CFE_EVS_SendEvent(SC_VERIFY_ATS_DUP_ERR_EID, CFE_EVS_EventType_ERROR, "Verify ATS Table error: dup cmd number: buf index = %d, cmd num = %u, dup index = %d", (int)EntryIndex, SC_IDNUM_AS_UINT(EntryPtr->Header.CmdNumber), - (int)SC_OperData.AtsDupTestArray[SC_CommandNumToIndex(EntryPtr->Header.CmdNumber)]); + (int)SC_GetAtsDupTest(EntryPtr->Header.CmdNumber)); } else { @@ -877,7 +885,7 @@ int32 SC_VerifyAtsEntry(uint32 *Buffer32, int32 EntryIndex, int32 BufferWords) Result = SC_ATS_HDR_NOPKT_WORDS + CommandWords; /* Mark this ATS command ID as in use at this table index */ - SC_OperData.AtsDupTestArray[SC_CommandNumToIndex(EntryPtr->Header.CmdNumber)] = EntryIndex; + SC_SetAtsDupTest(EntryPtr->Header.CmdNumber, EntryIndex); } } diff --git a/fsw/src/sc_loads.h b/fsw/src/sc_loads.h index 903f220..7977975 100644 --- a/fsw/src/sc_loads.h +++ b/fsw/src/sc_loads.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/src/sc_rtsrq.c b/fsw/src/sc_rtsrq.c index 0f9169f..a337e66 100644 --- a/fsw/src/sc_rtsrq.c +++ b/fsw/src/sc_rtsrq.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -48,7 +47,7 @@ /* Starts and RTS */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_StartRtsCmd(const SC_StartRtsCmd_t *Cmd) +CFE_Status_t SC_StartRtsCmd(const SC_StartRtsCmd_t *Cmd) { SC_RtsNum_t RtsNum; /* rts number */ SC_RtsIndex_t RtsIndex; /* rts array index */ @@ -108,7 +107,7 @@ void SC_StartRtsCmd(const SC_StartRtsCmd_t *Cmd) SC_OperData.HkPacket.Payload.RtsActiveCtr++; SC_OperData.HkPacket.Payload.CmdCtr++; - if (Cmd->Payload.RtsNum <= SC_LAST_RTS_WITH_EVENTS) + if (SC_RtsNumHasEvent(Cmd->Payload.RtsNum)) { CFE_EVS_SendEvent(SC_RTS_START_INF_EID, CFE_EVS_EventType_INFORMATION, "RTS Number %03u Started", SC_IDNUM_AS_UINT(RtsNum)); @@ -160,6 +159,8 @@ void SC_StartRtsCmd(const SC_StartRtsCmd_t *Cmd) SC_OperData.HkPacket.Payload.CmdErrCtr++; SC_OperData.HkPacket.Payload.RtsActiveErrCtr++; } + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -167,7 +168,7 @@ void SC_StartRtsCmd(const SC_StartRtsCmd_t *Cmd) /* Start a group of RTS */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_StartRtsGrpCmd(const SC_StartRtsGrpCmd_t *Cmd) +CFE_Status_t SC_StartRtsGrpCmd(const SC_StartRtsGrpCmd_t *Cmd) { SC_RtsNum_t FirstRtsNum; SC_RtsNum_t LastRtsNum; @@ -204,8 +205,8 @@ void SC_StartRtsGrpCmd(const SC_StartRtsGrpCmd_t *Cmd) RtsInfoPtr->UseCtr++; /* get absolute wakeup count for 1st cmd in the RTS */ - RtsInfoPtr->NextCommandTgtWakeup = - SC_ComputeAbsWakeup(SC_GetRtsEntryAtOffset(RtsIndex, SC_ENTRY_OFFSET_FIRST)->Header.WakeupCount); + RtsInfoPtr->NextCommandTgtWakeup = SC_ComputeAbsWakeup( + SC_GetRtsEntryAtOffset(RtsIndex, SC_ENTRY_OFFSET_FIRST)->Header.WakeupCount); /* maintain counters associated with starting RTS */ SC_OperData.RtsCtrlBlckAddr->NumRtsActive++; @@ -249,6 +250,8 @@ void SC_StartRtsGrpCmd(const SC_StartRtsGrpCmd_t *Cmd) SC_IDNUM_AS_UINT(LastRtsNum)); SC_OperData.HkPacket.Payload.CmdErrCtr++; } + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -256,7 +259,7 @@ void SC_StartRtsGrpCmd(const SC_StartRtsGrpCmd_t *Cmd) /* Stop an RTS */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_StopRtsCmd(const SC_StopRtsCmd_t *Cmd) +CFE_Status_t SC_StopRtsCmd(const SC_StopRtsCmd_t *Cmd) { SC_RtsNum_t RtsNum; /* RTS number */ SC_RtsIndex_t RtsIndex; /* RTS array index */ @@ -287,6 +290,8 @@ void SC_StopRtsCmd(const SC_StopRtsCmd_t *Cmd) SC_OperData.HkPacket.Payload.CmdErrCtr++; } /* end if */ + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -294,7 +299,7 @@ void SC_StopRtsCmd(const SC_StopRtsCmd_t *Cmd) /* Stop a group of RTS */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_StopRtsGrpCmd(const SC_StopRtsGrpCmd_t *Cmd) +CFE_Status_t SC_StopRtsGrpCmd(const SC_StopRtsGrpCmd_t *Cmd) { SC_RtsNum_t FirstRtsNum; SC_RtsNum_t LastRtsNum; @@ -339,6 +344,8 @@ void SC_StopRtsGrpCmd(const SC_StopRtsGrpCmd_t *Cmd) SC_IDNUM_AS_UINT(LastRtsNum)); SC_OperData.HkPacket.Payload.CmdErrCtr++; } + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -346,7 +353,7 @@ void SC_StopRtsGrpCmd(const SC_StopRtsGrpCmd_t *Cmd) /* Disables an RTS */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_DisableRtsCmd(const SC_DisableRtsCmd_t *Cmd) +CFE_Status_t SC_DisableRtsCmd(const SC_DisableRtsCmd_t *Cmd) { SC_RtsNum_t RtsNum; /* RTS number */ SC_RtsIndex_t RtsIndex; /* RTS array index */ @@ -367,8 +374,8 @@ void SC_DisableRtsCmd(const SC_DisableRtsCmd_t *Cmd) /* update the command status */ SC_OperData.HkPacket.Payload.CmdCtr++; - CFE_EVS_SendEvent(SC_DISABLE_RTS_INF_EID, CFE_EVS_EventType_INFORMATION, - "Disabled RTS %03u", SC_IDNUM_AS_UINT(RtsNum)); + CFE_EVS_SendEvent(SC_DISABLE_RTS_INF_EID, CFE_EVS_EventType_INFORMATION, "Disabled RTS %03u", + SC_IDNUM_AS_UINT(RtsNum)); } else { /* it is not a valid RTS id */ @@ -378,6 +385,8 @@ void SC_DisableRtsCmd(const SC_DisableRtsCmd_t *Cmd) /* update the command error status */ SC_OperData.HkPacket.Payload.CmdErrCtr++; } /* end if */ + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -385,7 +394,7 @@ void SC_DisableRtsCmd(const SC_DisableRtsCmd_t *Cmd) /* Disable a group of RTS */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_DisableRtsGrpCmd(const SC_DisableRtsGrpCmd_t *Cmd) +CFE_Status_t SC_DisableRtsGrpCmd(const SC_DisableRtsGrpCmd_t *Cmd) { SC_RtsNum_t FirstRtsNum; SC_RtsNum_t LastRtsNum; @@ -430,6 +439,8 @@ void SC_DisableRtsGrpCmd(const SC_DisableRtsGrpCmd_t *Cmd) SC_IDNUM_AS_UINT(LastRtsNum)); SC_OperData.HkPacket.Payload.CmdErrCtr++; } + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -437,7 +448,7 @@ void SC_DisableRtsGrpCmd(const SC_DisableRtsGrpCmd_t *Cmd) /* Enables an RTS */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_EnableRtsCmd(const SC_EnableRtsCmd_t *Cmd) +CFE_Status_t SC_EnableRtsCmd(const SC_EnableRtsCmd_t *Cmd) { SC_RtsNum_t RtsNum; /* RTS number */ SC_RtsIndex_t RtsIndex; /* RTS array index */ @@ -458,8 +469,8 @@ void SC_EnableRtsCmd(const SC_EnableRtsCmd_t *Cmd) /* update the command status */ SC_OperData.HkPacket.Payload.CmdCtr++; - CFE_EVS_SendEvent(SC_ENABLE_RTS_INF_EID, CFE_EVS_EventType_INFORMATION, - "Enabled RTS %03u", SC_IDNUM_AS_UINT(RtsNum)); + CFE_EVS_SendEvent(SC_ENABLE_RTS_INF_EID, CFE_EVS_EventType_INFORMATION, "Enabled RTS %03u", + SC_IDNUM_AS_UINT(RtsNum)); } else { /* it is not a valid RTS id */ @@ -470,6 +481,8 @@ void SC_EnableRtsCmd(const SC_EnableRtsCmd_t *Cmd) SC_OperData.HkPacket.Payload.CmdErrCtr++; } /* end if */ + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -477,7 +490,7 @@ void SC_EnableRtsCmd(const SC_EnableRtsCmd_t *Cmd) /* Enable a group of RTS */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void SC_EnableRtsGrpCmd(const SC_EnableRtsGrpCmd_t *Cmd) +CFE_Status_t SC_EnableRtsGrpCmd(const SC_EnableRtsGrpCmd_t *Cmd) { SC_RtsNum_t FirstRtsNum; SC_RtsNum_t LastRtsNum; @@ -522,6 +535,8 @@ void SC_EnableRtsGrpCmd(const SC_EnableRtsGrpCmd_t *Cmd) SC_IDNUM_AS_UINT(LastRtsNum)); SC_OperData.HkPacket.Payload.CmdErrCtr++; } + + return CFE_SUCCESS; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -546,7 +561,7 @@ void SC_KillRts(SC_RtsIndex_t RtsIndex) /* ** Stop the RTS from executing */ - RtsInfoPtr->RtsStatus = SC_Status_LOADED; + RtsInfoPtr->RtsStatus = SC_Status_LOADED; RtsInfoPtr->NextCommandTgtWakeup = SC_MAX_WAKEUP_CNT; /* @@ -569,9 +584,11 @@ void SC_KillRts(SC_RtsIndex_t RtsIndex) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void SC_AutoStartRts(SC_RtsNum_t RtsNum) { - SC_StartRtsCmd_t CmdPkt; /* the command packet to start an RTS */ + SC_StartRtsCmd_t CmdPkt; /* the command packet to start an RTS */ + CFE_MSG_Message_t *MsgPtr; memset(&CmdPkt, 0, sizeof(CmdPkt)); + MsgPtr = (CFE_MSG_Message_t *)&CmdPkt; /* validate RTS ID */ if (SC_RtsNumIsValid(RtsNum)) @@ -579,9 +596,9 @@ void SC_AutoStartRts(SC_RtsNum_t RtsNum) /* ** Format the command packet to start the first RTS */ - CFE_MSG_Init(CFE_MSG_PTR(CmdPkt.CommandHeader), CFE_SB_ValueToMsgId(SC_CMD_MID), sizeof(CmdPkt)); + CFE_MSG_Init(MsgPtr, CFE_SB_ValueToMsgId(SC_CMD_MID), sizeof(CmdPkt)); - CFE_MSG_SetFcnCode(CFE_MSG_PTR(CmdPkt.CommandHeader), SC_START_RTS_CC); + CFE_MSG_SetFcnCode(MsgPtr, SC_START_RTS_CC); /* ** Get the RTS ID to start. @@ -591,7 +608,7 @@ void SC_AutoStartRts(SC_RtsNum_t RtsNum) /* ** Now send the command back to SC */ - CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdPkt.CommandHeader), true); + CFE_SB_TransmitMsg(MsgPtr, true); } else { diff --git a/fsw/src/sc_rtsrq.h b/fsw/src/sc_rtsrq.h index 648d813..c833d74 100644 --- a/fsw/src/sc_rtsrq.h +++ b/fsw/src/sc_rtsrq.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -29,6 +28,7 @@ #include "common_types.h" #include "sc_index_types.h" #include "sc_msg.h" +#include "cfe_error.h" /** * \brief Start an RTS Command @@ -43,7 +43,7 @@ * * \sa #SC_START_RTS_CC */ -void SC_StartRtsCmd(const SC_StartRtsCmd_t *Cmd); +CFE_Status_t SC_StartRtsCmd(const SC_StartRtsCmd_t *Cmd); /** * \brief Start a group of RTS Command @@ -58,7 +58,7 @@ void SC_StartRtsCmd(const SC_StartRtsCmd_t *Cmd); * * \sa #SC_START_RTS_GRP_CC */ -void SC_StartRtsGrpCmd(const SC_StartRtsGrpCmd_t *Cmd); +CFE_Status_t SC_StartRtsGrpCmd(const SC_StartRtsGrpCmd_t *Cmd); /** * \brief Stop an RTS from executing Command @@ -73,7 +73,7 @@ void SC_StartRtsGrpCmd(const SC_StartRtsGrpCmd_t *Cmd); * * \sa #SC_STOP_RTS_CC */ -void SC_StopRtsCmd(const SC_StopRtsCmd_t *Cmd); +CFE_Status_t SC_StopRtsCmd(const SC_StopRtsCmd_t *Cmd); /** * \brief Stop a group of RTS from executing Command @@ -88,7 +88,7 @@ void SC_StopRtsCmd(const SC_StopRtsCmd_t *Cmd); * * \sa #SC_STOP_RTS_CC */ -void SC_StopRtsGrpCmd(const SC_StopRtsGrpCmd_t *Cmd); +CFE_Status_t SC_StopRtsGrpCmd(const SC_StopRtsGrpCmd_t *Cmd); /** * \brief Disable an RTS Command @@ -103,7 +103,7 @@ void SC_StopRtsGrpCmd(const SC_StopRtsGrpCmd_t *Cmd); * * \sa #SC_DISABLE_RTS_CC */ -void SC_DisableRtsCmd(const SC_DisableRtsCmd_t *Cmd); +CFE_Status_t SC_DisableRtsCmd(const SC_DisableRtsCmd_t *Cmd); /** * \brief Disable a group of RTS Command @@ -118,7 +118,7 @@ void SC_DisableRtsCmd(const SC_DisableRtsCmd_t *Cmd); * * \sa #SC_DISABLE_RTS_CC */ -void SC_DisableRtsGrpCmd(const SC_DisableRtsGrpCmd_t *Cmd); +CFE_Status_t SC_DisableRtsGrpCmd(const SC_DisableRtsGrpCmd_t *Cmd); /** * \brief Enable an RTS Command @@ -133,7 +133,7 @@ void SC_DisableRtsGrpCmd(const SC_DisableRtsGrpCmd_t *Cmd); * * \sa #SC_ENABLE_RTS_CC */ -void SC_EnableRtsCmd(const SC_EnableRtsCmd_t *Cmd); +CFE_Status_t SC_EnableRtsCmd(const SC_EnableRtsCmd_t *Cmd); /** * \brief Enable a group of RTS Command @@ -148,7 +148,7 @@ void SC_EnableRtsCmd(const SC_EnableRtsCmd_t *Cmd); * * \sa #SC_ENABLE_RTS_GRP_CC */ -void SC_EnableRtsGrpCmd(const SC_EnableRtsGrpCmd_t *Cmd); +CFE_Status_t SC_EnableRtsGrpCmd(const SC_EnableRtsGrpCmd_t *Cmd); /** * \brief Stops an RTS & clears out data diff --git a/fsw/src/sc_state.c b/fsw/src/sc_state.c index f82d7b8..3ddc3d6 100644 --- a/fsw/src/sc_state.c +++ b/fsw/src/sc_state.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/src/sc_state.h b/fsw/src/sc_state.h index 0127f4a..9971173 100644 --- a/fsw/src/sc_state.h +++ b/fsw/src/sc_state.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/src/sc_utils.c b/fsw/src/sc_utils.c index a5f1b21..a49aa4b 100644 --- a/fsw/src/sc_utils.c +++ b/fsw/src/sc_utils.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -47,16 +46,23 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ SC_TimeAccessor_t SC_LookupTimeAccessor(SC_TimeRef_Enum_t TimeRef) { - static const SC_TimeAccessor_t TIMEREF_LOOKUP[SC_TimeRef_MAX] = {[SC_TimeRef_USE_CFE_TIME] = {CFE_TIME_GetTime}, - [SC_TimeRef_USE_TAI] = {CFE_TIME_GetTAI}, - [SC_TimeRef_USE_UTC] = {CFE_TIME_GetUTC}}; + static const SC_TimeAccessor_t TIMEREF_LOOKUP[] = {[SC_TimeRef_USE_CFE_TIME] = {CFE_TIME_GetTime}, + [SC_TimeRef_USE_TAI] = {CFE_TIME_GetTAI}, + [SC_TimeRef_USE_UTC] = {CFE_TIME_GetUTC}}; - if (TimeRef >= SC_TimeRef_MAX) + SC_TimeAccessor_t Result = {NULL}; + + if (TimeRef < (sizeof(TIMEREF_LOOKUP) / sizeof(TIMEREF_LOOKUP[0]))) + { + Result = TIMEREF_LOOKUP[TimeRef]; + } + + if (Result.GetTime == NULL) { - TimeRef = SC_TimeRef_USE_CFE_TIME; + Result.GetTime = CFE_TIME_GetTime; } - return TIMEREF_LOOKUP[TimeRef]; + return Result; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/fsw/src/sc_utils.h b/fsw/src/sc_utils.h index 0e98f86..b4cff9a 100644 --- a/fsw/src/sc_utils.h +++ b/fsw/src/sc_utils.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/src/sc_verify.h b/fsw/src/sc_verify.h index 1469932..7b8ce8b 100644 --- a/fsw/src/sc_verify.h +++ b/fsw/src/sc_verify.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/src/sc_version.h b/fsw/src/sc_version.h index 8208b0d..f2b6f8f 100644 --- a/fsw/src/sc_version.h +++ b/fsw/src/sc_version.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -31,9 +30,9 @@ * \{ */ -#define SC_MAJOR_VERSION 3 /**< \brief Major version number */ -#define SC_MINOR_VERSION 1 /**< \brief Minor version number */ -#define SC_REVISION 99 /**< \brief Revision number */ +#define SC_MAJOR_VERSION 7 /**< \brief Major version number */ +#define SC_MINOR_VERSION 0 /**< \brief Minor version number */ +#define SC_REVISION 0 /**< \brief Revision number */ /**\}*/ diff --git a/fsw/tables/sc_ats1.c b/fsw/tables/sc_ats1.c index c903056..b6bfbea 100644 --- a/fsw/tables/sc_ats1.c +++ b/fsw/tables/sc_ats1.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -42,7 +41,7 @@ #include "cfe.h" #include "cfe_tbl_filedef.h" -#include "sc_tbldefs.h" /* defines SC table headers */ +#include "sc_tbl.h" /* defines SC table headers */ #include "sc_platform_cfg.h" /* defines table buffer size */ #include "sc_msgdefs.h" /* defines SC command code values */ #include "sc_msgids.h" /* defines SC packet msg ID's */ @@ -92,36 +91,34 @@ typedef union /* Helper macro to get size of structure elements */ #define SC_MEMBER_SIZE(member) (sizeof(((SC_AtsStruct1_t *)0)->member)) -/* Used designated initializers to be verbose, modify as needed/desired */ +/* Used designated intializers to be verbose, modify as needed/desired */ SC_AtsTable1_t SC_Ats1 = { - /* 1 */ - .ats.hdr1.CmdNumber = SC_COMMAND_NUM_INITIALIZER(1), - .ats.hdr1.TimeTag_MS = SC_CMD1_TIME >> 16, - .ats.hdr1.TimeTag_LS = SC_CMD1_TIME & 0xFFFF, - .ats.cmd1.CommandHeader = CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd1), SC_NOOP_CC, SC_NOOP_CKSUM), + .ats = {/* 1 */ + .hdr1 = {.CmdNumber = SC_COMMAND_NUM_INITIALIZER(1), + .TimeTag_MS = SC_CMD1_TIME >> 16, + .TimeTag_LS = SC_CMD1_TIME & 0xFFFF}, + .cmd1 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, 0, SC_NOOP_CC, SC_NOOP_CKSUM)}, - /* 2 */ - .ats.hdr2.CmdNumber = SC_COMMAND_NUM_INITIALIZER(2), - .ats.hdr2.TimeTag_MS = SC_CMD2_TIME >> 16, - .ats.hdr2.TimeTag_LS = SC_CMD2_TIME & 0xFFFF, - .ats.cmd2.CommandHeader = - CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd2), SC_ENABLE_RTS_CC, SC_ENABLE_RTS1_CKSUM), - .ats.cmd2.Payload.RtsNum = SC_RTS_NUM_INITIALIZER(1), + /* 2 */ + .hdr2 = {.CmdNumber = SC_COMMAND_NUM_INITIALIZER(2), + .TimeTag_MS = SC_CMD2_TIME >> 16, + .TimeTag_LS = SC_CMD2_TIME & 0xFFFF}, + .cmd2 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd2), SC_ENABLE_RTS_CC, SC_ENABLE_RTS1_CKSUM)}, - /* 3 */ - .ats.hdr3.CmdNumber = SC_COMMAND_NUM_INITIALIZER(3), - .ats.hdr3.TimeTag_MS = SC_CMD3_TIME >> 16, - .ats.hdr3.TimeTag_LS = SC_CMD3_TIME & 0xFFFF, - .ats.cmd3.CommandHeader = - CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd3), SC_START_RTS_CC, SC_START_RTS1_CKSUM), - .ats.cmd3.Payload.RtsNum = SC_RTS_NUM_INITIALIZER(1), + .cmd2.Payload = {.RtsNum = SC_RTS_NUM_INITIALIZER(1)}, - /* 4 */ - .ats.hdr4.CmdNumber = SC_COMMAND_NUM_INITIALIZER(4), - .ats.hdr4.TimeTag_MS = SC_CMD4_TIME >> 16, - .ats.hdr4.TimeTag_LS = SC_CMD4_TIME & 0xFFFF, - .ats.cmd4.CommandHeader = - CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd4), SC_RESET_COUNTERS_CC, SC_RESET_COUNTERS_CKSUM)}; + /* 3 */ + .hdr3 = {.CmdNumber = SC_COMMAND_NUM_INITIALIZER(3), + .TimeTag_MS = SC_CMD3_TIME >> 16, + .TimeTag_LS = SC_CMD3_TIME & 0xFFFF}, + .cmd3 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd3), SC_START_RTS_CC, SC_START_RTS1_CKSUM)}, + + /* 4 */ + .hdr4 = {.CmdNumber = SC_COMMAND_NUM_INITIALIZER(4), + .TimeTag_MS = SC_CMD4_TIME >> 16, + .TimeTag_LS = SC_CMD4_TIME & 0xFFFF}, + .cmd4 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd4), SC_RESET_COUNTERS_CC, + SC_RESET_COUNTERS_CKSUM)}}}; /* Macro for table structure */ -CFE_TBL_FILEDEF(SC_Ats1, SC.ATS_TBL1, SC Example ATS_TBL1, sc_ats1.tbl) +CFE_TBL_FILEDEF(SC_Ats1, SC.AtsTable1, SC Example ATS_TBL1, sc_ats1.tbl) diff --git a/fsw/tables/sc_rts001.c b/fsw/tables/sc_rts001.c index 984130b..c7eb5fa 100644 --- a/fsw/tables/sc_rts001.c +++ b/fsw/tables/sc_rts001.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -45,13 +44,13 @@ /* Checksum for each sample command */ #ifndef SC_NOOP_CKSUM -#define SC_NOOP_CKSUM (0x8F) +#define SC_NOOP_CKSUM (0x3E ^ ((SC_CMD_MID & 0xFF00) >> 8u) ^ ((SC_CMD_MID & 0x00FF))) #endif #ifndef SC_ENABLE_RTS2_CKSUM -#define SC_ENABLE_RTS2_CKSUM (0x8E) +#define SC_ENABLE_RTS2_CKSUM (0x3F ^ ((SC_CMD_MID & 0xFF00) >> 8u) ^ ((SC_CMD_MID & 0x00FF))) #endif #ifndef SC_START_RTS2_CKSUM -#define SC_START_RTS2_CKSUM (0x8D) +#define SC_START_RTS2_CKSUM (0x3C ^ ((SC_CMD_MID & 0xFF00) >> 8u) ^ ((SC_CMD_MID & 0x00FF))) #endif /* Custom table structure, modify as needed to add desired commands */ @@ -79,18 +78,16 @@ typedef union SC_RtsTable001_t SC_Rts001 = { /* 1 */ .rts.hdr1.WakeupCount = 0, - .rts.cmd1.CommandHeader = CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd1), SC_NOOP_CC, SC_NOOP_CKSUM), + .rts.cmd1 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd1), SC_NOOP_CC, SC_NOOP_CKSUM)}, /* 2 */ .rts.hdr2.WakeupCount = 5, - .rts.cmd2.CommandHeader = - CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd2), SC_ENABLE_RTS_CC, SC_ENABLE_RTS2_CKSUM), + .rts.cmd2 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd2), SC_ENABLE_RTS_CC, SC_ENABLE_RTS2_CKSUM)}, .rts.cmd2.Payload.RtsNum = SC_RTS_NUM_INITIALIZER(2), /* 3 */ .rts.hdr3.WakeupCount = 5, - .rts.cmd3.CommandHeader = - CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd3), SC_START_RTS_CC, SC_START_RTS2_CKSUM), + .rts.cmd3 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd3), SC_START_RTS_CC, SC_START_RTS2_CKSUM)}, .rts.cmd3.Payload.RtsNum = SC_RTS_NUM_INITIALIZER(2)}; /* Macro for table structure */ diff --git a/fsw/tables/sc_rts002.c b/fsw/tables/sc_rts002.c index d250eb6..a54fa5f 100644 --- a/fsw/tables/sc_rts002.c +++ b/fsw/tables/sc_rts002.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -45,7 +44,7 @@ /* Checksum for each sample command */ #ifndef SC_NOOP_CKSUM -#define SC_NOOP_CKSUM (0x8F) +#define SC_NOOP_CKSUM (0x3E ^ ((SC_CMD_MID & 0xFF00) >> 8u) ^ ((SC_CMD_MID & 0x00FF))) #endif /* Custom table structure, modify as needed to add desired commands */ @@ -72,16 +71,16 @@ typedef union /* Used designated initializers to be verbose, modify as needed/desired */ SC_RtsTable002_t SC_Rts002 = { /* 1 */ - .rts.hdr1.WakeupCount = 0, - .rts.cmd1.CommandHeader = CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd1), SC_NOOP_CC, SC_NOOP_CKSUM), + .rts.hdr1.WakeupCount = 0, + .rts.cmd1 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd1), SC_NOOP_CC, SC_NOOP_CKSUM)}, /* 2 */ - .rts.hdr2.WakeupCount = 5, - .rts.cmd2.CommandHeader = CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd2), SC_NOOP_CC, SC_NOOP_CKSUM), + .rts.hdr2.WakeupCount = 5, + .rts.cmd2 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd2), SC_NOOP_CC, SC_NOOP_CKSUM)}, /* 3 */ - .rts.hdr3.WakeupCount = 5, - .rts.cmd3.CommandHeader = CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd3), SC_NOOP_CC, SC_NOOP_CKSUM)}; + .rts.hdr3.WakeupCount = 5, + .rts.cmd3 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd3), SC_NOOP_CC, SC_NOOP_CKSUM)}}; /* Macro for table structure */ CFE_TBL_FILEDEF(SC_Rts002, SC.RTS_TBL002, SC Example RTS_TBL002, sc_rts002.tbl) diff --git a/fsw/tables/sc_rts003.c b/fsw/tables/sc_rts003.c new file mode 100644 index 0000000..0eb592e --- /dev/null +++ b/fsw/tables/sc_rts003.c @@ -0,0 +1,90 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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) sample RTS table 003 + * + * The following source code demonstrates how to create a sample + * Stored Command RTS table using the software defined command structures. + * It's also possible to create this table via alternative tools + * (ground system) and or system agnostic data definitions (XTCE/EDS/JSON). + * + * This source file creates a sample RTS table that contains only + * the following commands that are scheduled as follows: + * + * SC NOOP command, execution wakeup count relative to start of RTS = 0 + * SC Enable RTS #2 command, execution wakeup count relative to prev cmd = 5 + * SC Start RTS #2 command, execution wakeup count relative to prev cmd = 5 + */ + +#include "cfe.h" +#include "cfe_tbl_filedef.h" + +#include "sc_tbldefs.h" /* defines SC table headers */ +#include "sc_platform_cfg.h" /* defines table buffer size */ +#include "sc_msgdefs.h" /* defines SC command code values */ +#include "sc_msgids.h" /* defines SC packet msg ID's */ +#include "sc_msg.h" /* defines SC message structures */ + +/* Checksum for each sample command */ +#ifndef SC_NOOP_CKSUM +#define SC_NOOP_CKSUM (0x3E ^ ((SC_CMD_MID & 0xFF00) >> 8u) ^ ((SC_CMD_MID & 0x00FF))) +#endif + +/* Custom table structure, modify as needed to add desired commands */ +typedef struct +{ + SC_RtsEntryHeader_t hdr1; + SC_NoopCmd_t cmd1; + SC_RtsEntryHeader_t hdr2; + SC_NoopCmd_t cmd2; + SC_RtsEntryHeader_t hdr3; + SC_NoopCmd_t cmd3; +} SC_RtsStruct003_t; + +/* Define the union to size the table correctly */ +typedef union +{ + SC_RtsStruct003_t rts; + uint16 buf[SC_RTS_BUFF_SIZE]; +} SC_RtsTable003_t; + +/* Helper macro to get size of structure elements */ +#define SC_MEMBER_SIZE(member) (sizeof(((SC_RtsStruct003_t *)0)->member)) + +/* Used designated initializers to be verbose, modify as needed/desired */ +SC_RtsTable003_t SC_Rts003 = { + /* 1 */ + .rts.hdr1.WakeupCount = 0, + .rts.cmd1 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd1), SC_NOOP_CC, SC_NOOP_CKSUM)}, + + /* 2 */ + .rts.hdr2.WakeupCount = 5, + .rts.cmd2 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd2), SC_NOOP_CC, SC_NOOP_CKSUM)}, + + /* 3 */ + .rts.hdr3.WakeupCount = 5, + .rts.cmd3 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd3), SC_NOOP_CC, SC_NOOP_CKSUM)}}; + +/* Macro for table structure */ +CFE_TBL_FILEDEF(SC_Rts003, SC.RTS_TBL003, SC Example RTS_TBL003, sc_rts003.tbl) + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/fsw/tables/sc_rts004.c b/fsw/tables/sc_rts004.c new file mode 100644 index 0000000..b70b68a --- /dev/null +++ b/fsw/tables/sc_rts004.c @@ -0,0 +1,90 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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) sample RTS table 004 + * + * The following source code demonstrates how to create a sample + * Stored Command RTS table using the software defined command structures. + * It's also possible to create this table via alternative tools + * (ground system) and or system agnostic data definitions (XTCE/EDS/JSON). + * + * This source file creates a sample RTS table that contains only + * the following commands that are scheduled as follows: + * + * SC NOOP command, execution wakeup count relative to start of RTS = 0 + * SC Enable RTS #2 command, execution wakeup count relative to prev cmd = 5 + * SC Start RTS #2 command, execution wakeup count relative to prev cmd = 5 + */ + +#include "cfe.h" +#include "cfe_tbl_filedef.h" + +#include "sc_tbldefs.h" /* defines SC table headers */ +#include "sc_platform_cfg.h" /* defines table buffer size */ +#include "sc_msgdefs.h" /* defines SC command code values */ +#include "sc_msgids.h" /* defines SC packet msg ID's */ +#include "sc_msg.h" /* defines SC message structures */ + +/* Checksum for each sample command */ +#ifndef SC_NOOP_CKSUM +#define SC_NOOP_CKSUM (0x3E ^ ((SC_CMD_MID & 0xFF00) >> 8u) ^ ((SC_CMD_MID & 0x00FF))) +#endif + +/* Custom table structure, modify as needed to add desired commands */ +typedef struct +{ + SC_RtsEntryHeader_t hdr1; + SC_NoopCmd_t cmd1; + SC_RtsEntryHeader_t hdr2; + SC_NoopCmd_t cmd2; + SC_RtsEntryHeader_t hdr3; + SC_NoopCmd_t cmd3; +} SC_RtsStruct004_t; + +/* Define the union to size the table correctly */ +typedef union +{ + SC_RtsStruct004_t rts; + uint16 buf[SC_RTS_BUFF_SIZE]; +} SC_RtsTable004_t; + +/* Helper macro to get size of structure elements */ +#define SC_MEMBER_SIZE(member) (sizeof(((SC_RtsStruct004_t *)0)->member)) + +/* Used designated initializers to be verbose, modify as needed/desired */ +SC_RtsTable004_t SC_Rts004 = { + /* 1 */ + .rts.hdr1.WakeupCount = 0, + .rts.cmd1 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd1), SC_NOOP_CC, SC_NOOP_CKSUM)}, + + /* 2 */ + .rts.hdr2.WakeupCount = 5, + .rts.cmd2 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd2), SC_NOOP_CC, SC_NOOP_CKSUM)}, + + /* 3 */ + .rts.hdr3.WakeupCount = 5, + .rts.cmd3 = {CFE_MSG_CMD_HDR_INIT(SC_CMD_MID, SC_MEMBER_SIZE(cmd3), SC_NOOP_CC, SC_NOOP_CKSUM)}}; + +/* Macro for table structure */ +CFE_TBL_FILEDEF(SC_Rts004, SC.RTS_TBL004, SC Example RTS_TBL004, sc_rts004.tbl) + +/************************/ +/* End of File Comment */ +/************************/ diff --git a/mission_build.cmake b/mission_build.cmake index 9f2eb26..d9df325 100644 --- a/mission_build.cmake +++ b/mission_build.cmake @@ -14,8 +14,8 @@ add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/docs/dox_src ${MISSION_BINARY_DIR}/do # The list of header files that control the SC configuration set(SC_MISSION_CONFIG_FILE_LIST sc_extern_typedefs.h - sc_fcncodes.h - sc_interface_cfg.h + sc_fcncode_values.h + sc_interface_cfg_values.h sc_mission_cfg.h sc_msgdefs.h sc_msg.h @@ -23,30 +23,7 @@ set(SC_MISSION_CONFIG_FILE_LIST sc_tbldefs.h sc_tbl.h sc_tblstruct.h + sc_topicid_values.h ) -if (CFE_EDS_ENABLED_BUILD) - - # In an EDS-based build, these files come generated from the EDS tool - set(SC_CFGFILE_SRC_sc_interface_cfg "sc_eds_designparameters.h") - set(SC_CFGFILE_SRC_sc_fcncodes "sc_eds_cc.h") - set(SC_CFGFILE_SRC_sc_msgstruct "sc_eds_typedefs.h") - set(SC_CFGFILE_SRC_sc_tblstruct "sc_eds_typedefs.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_MISSION_CONFIG_FILE_LIST}) - get_filename_component(CFGKEY "${SC_CFGFILE}" NAME_WE) - if (DEFINED SC_CFGFILE_SRC_${CFGKEY}) - set(DEFAULT_SOURCE GENERATED_FILE "${SC_CFGFILE_SRC_${CFGKEY}}") - else() - set(DEFAULT_SOURCE FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${SC_CFGFILE}") - endif() - generate_config_includefile( - FILE_NAME "${SC_CFGFILE}" - ${DEFAULT_SOURCE} - ) -endforeach() +generate_configfile_set(${SC_MISSION_CONFIG_FILE_LIST}) diff --git a/unit-test/sc_app_tests.c b/unit-test/sc_app_tests.c index c1bfdbe..36095ea 100644 --- a/unit-test/sc_app_tests.c +++ b/unit-test/sc_app_tests.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -161,11 +160,11 @@ void SC_AppInit_Test_NominalPowerOnReset(void) UtAssert_INT32_EQ(SC_AppInit(), CFE_SUCCESS); /* Verify results */ - Expected_SC_OperData.AtsInfoHandle = 0; - Expected_SC_OperData.RtsCtrlBlckHandle = 0; - Expected_SC_OperData.AtsCtrlBlckHandle = 0; - Expected_SC_OperData.AtsCmdStatusHandle[0] = 0; - Expected_SC_OperData.AtsCmdStatusHandle[1] = 0; + memset(&Expected_SC_OperData.AtsInfoHandle, 0, sizeof(Expected_SC_OperData.AtsInfoHandle)); + memset(&Expected_SC_OperData.RtsInfoHandle, 0, sizeof(Expected_SC_OperData.RtsInfoHandle)); + memset(&Expected_SC_OperData.RtsCtrlBlckHandle, 0, sizeof(Expected_SC_OperData.RtsCtrlBlckHandle)); + memset(&Expected_SC_OperData.AtsCtrlBlckHandle, 0, sizeof(Expected_SC_OperData.AtsCtrlBlckHandle)); + memset(&Expected_SC_OperData.AtsCmdStatusHandle, 0, sizeof(Expected_SC_OperData.AtsCmdStatusHandle)); Expected_SC_OperData.HkPacket.Payload.ContinueAtsOnFailureFlag = SC_AtsCont_TRUE; @@ -226,11 +225,11 @@ void SC_AppInit_Test_Nominal(void) UtAssert_INT32_EQ(SC_AppInit(), CFE_SUCCESS); /* Verify results */ - Expected_SC_OperData.AtsInfoHandle = 0; - Expected_SC_OperData.RtsCtrlBlckHandle = 0; - Expected_SC_OperData.AtsCtrlBlckHandle = 0; - Expected_SC_OperData.AtsCmdStatusHandle[0] = 0; - Expected_SC_OperData.AtsCmdStatusHandle[1] = 0; + memset(&Expected_SC_OperData.AtsInfoHandle, 0, sizeof(Expected_SC_OperData.AtsInfoHandle)); + memset(&Expected_SC_OperData.RtsInfoHandle, 0, sizeof(Expected_SC_OperData.RtsInfoHandle)); + memset(&Expected_SC_OperData.RtsCtrlBlckHandle, 0, sizeof(Expected_SC_OperData.RtsCtrlBlckHandle)); + memset(&Expected_SC_OperData.AtsCtrlBlckHandle, 0, sizeof(Expected_SC_OperData.AtsCtrlBlckHandle)); + memset(&Expected_SC_OperData.AtsCmdStatusHandle, 0, sizeof(Expected_SC_OperData.AtsCmdStatusHandle)); UtAssert_MemCmp(&SC_OperData.CmdPipe, &Expected_SC_OperData.CmdPipe, sizeof(Expected_SC_OperData.CmdPipe), "2"); UtAssert_MemCmp(&SC_OperData.AtsInfoHandle, &Expected_SC_OperData.AtsInfoHandle, diff --git a/unit-test/sc_atsrq_tests.c b/unit-test/sc_atsrq_tests.c index 517d054..2510a75 100644 --- a/unit-test/sc_atsrq_tests.c +++ b/unit-test/sc_atsrq_tests.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test/sc_cmds_tests.c b/unit-test/sc_cmds_tests.c index d3962f3..4dc0f21 100644 --- a/unit-test/sc_cmds_tests.c +++ b/unit-test/sc_cmds_tests.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -833,10 +832,14 @@ void SC_ProcessRtpCommand_Test_RtsStatus(void) void SC_SendHkPacket_Test(void) { uint8 i; - int32 LastRtsHkIndex = 0; - SC_RtsIndex_t RtsIndex = SC_RTS_IDX_C(SC_NUMBER_OF_RTS - 1); + SC_RtsIndex_t RtsIndex = SC_RTS_IDX_C(SC_NUMBER_OF_RTS - 1); SC_RtsInfoEntry_t *RtsInfoPtr; SC_AtsInfoTable_t *AtsInfoPtr; + uint16 ExpectedRtsExecStatus[(SC_NUMBER_OF_RTS + 15) / 16]; + uint16 ExpectedRtsDisabledStatus[(SC_NUMBER_OF_RTS + 15) / 16]; + + memset(&ExpectedRtsExecStatus[0], 0u, sizeof(ExpectedRtsExecStatus)); + memset(&ExpectedRtsDisabledStatus[0], 0u, sizeof(ExpectedRtsDisabledStatus)); SC_OperData.HkPacket.Payload.CmdErrCtr = 1; SC_OperData.HkPacket.Payload.CmdCtr = 2; @@ -877,6 +880,9 @@ void SC_SendHkPacket_Test(void) RtsInfoPtr->DisabledFlag = true; RtsInfoPtr->RtsStatus = SC_Status_EXECUTING; + + SC_SET_HKTLM_RTS_MASK(ExpectedRtsDisabledStatus, i, true); + SC_SET_HKTLM_RTS_MASK(ExpectedRtsExecStatus, i, true); } RtsInfoPtr = SC_GetRtsInfoObject(RtsIndex); @@ -884,10 +890,6 @@ void SC_SendHkPacket_Test(void) RtsInfoPtr->DisabledFlag = false; RtsInfoPtr->RtsStatus = SC_Status_EMPTY; - LastRtsHkIndex = sizeof(SC_OperData.HkPacket.Payload.RtsExecutingStatus) / - sizeof(SC_OperData.HkPacket.Payload.RtsExecutingStatus[0]) - - 1; - /* Execute the function being tested */ UtAssert_VOIDCALL(SC_SendHkPacket()); @@ -923,25 +925,10 @@ void SC_SendHkPacket_Test(void) UtAssert_True(SC_OperData.HkPacket.Payload.NextAtsTime == 0, "SC_OperData.HkPacket.Payload.NextAtsTime == 0"); UtAssert_True(SC_OperData.HkPacket.Payload.NumRtsActive == 20, "SC_OperData.HkPacket.Payload.NumRtsActive == 20"); SC_Assert_ID_VALUE(SC_OperData.HkPacket.Payload.RtsNum, 21); - UtAssert_True(SC_OperData.HkPacket.Payload.NextRtsWakeupCnt == 0, "SC_OperData.HkPacket.Payload.NextRtsWakeupCnt == 0"); + UtAssert_True(SC_OperData.HkPacket.Payload.NextRtsWakeupCnt == 0, + "SC_OperData.HkPacket.Payload.NextRtsWakeupCnt == 0"); UtAssert_BOOL_TRUE(SC_OperData.HkPacket.Payload.ContinueAtsOnFailureFlag); - /* Check first element */ - UtAssert_True(SC_OperData.HkPacket.Payload.RtsExecutingStatus[0] == 65535, - "SC_OperData.HkPacket.Payload.RtsExecutingStatus[0] == 65535"); - UtAssert_True(SC_OperData.HkPacket.Payload.RtsDisabledStatus[0] == 65535, - "SC_OperData.HkPacket.Payload.RtsDisabledStatus[0] == 65535"); - - /* Check middle element */ - UtAssert_True(SC_OperData.HkPacket.Payload.RtsExecutingStatus[2] == 65535, - "SC_OperData.HkPacket.Payload.RtsExecutingStatus[2] == 65535"); - UtAssert_True(SC_OperData.HkPacket.Payload.RtsDisabledStatus[2] == 65535, - "SC_OperData.HkPacket.Payload.RtsDisabledStatus[2] == 65535"); - - /* Check last element */ - UtAssert_INT32_EQ(SC_OperData.HkPacket.Payload.RtsExecutingStatus[LastRtsHkIndex], 32767); - UtAssert_INT32_EQ(SC_OperData.HkPacket.Payload.RtsDisabledStatus[LastRtsHkIndex], 32767); - UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } @@ -1119,7 +1106,7 @@ void SC_ProcessRequest_Test_WakeupRtpExecutionTimeTooManyCmds(void) SC_AppData.NextCmdTime[SC_Process_RTP] = 0; SC_AppData.NextCmdTime[SC_Process_ATP] = 0; - SC_OperData.NumCmdsWakeup = 1000; + SC_OperData.NumCmdsWakeup = 1000; SC_OperData.AtsCtrlBlckAddr->AtpState = SC_Status_EXECUTING; /* Execute the function being tested */ @@ -1135,7 +1122,7 @@ void SC_ProcessRequest_Test_WakeupAtpExecutionTimeTooManyCmds(void) { SC_AppData.NextCmdTime[SC_Process_ATP] = 10; SC_AppData.CurrentTime = 100; - SC_OperData.NumCmdsWakeup = 1000; + SC_OperData.NumCmdsWakeup = 1000; SC_OperData.AtsCtrlBlckAddr->AtpState = SC_Status_IDLE; /* Execute the function being tested */ @@ -1680,8 +1667,7 @@ void UtTest_Setup(void) "SC_ProcessRequest_Test_HkMIDAutoStartRts"); UtTest_Add(SC_ProcessRequest_Test_HkMIDAutoStartRtsLoaded, SC_Test_Setup, SC_Test_TearDown, "SC_ProcessRequest_Test_HkMIDAutoStartRtsLoaded"); - UtTest_Add(SC_ProcessRequest_Test_WakeupNONE, SC_Test_Setup, SC_Test_TearDown, - "SC_ProcessRequest_Test_WakeupNONE"); + UtTest_Add(SC_ProcessRequest_Test_WakeupNONE, SC_Test_Setup, SC_Test_TearDown, "SC_ProcessRequest_Test_WakeupNONE"); UtTest_Add(SC_ProcessRequest_Test_WakeupRtpNotExecutionTime, SC_Test_Setup, SC_Test_TearDown, "SC_ProcessRequest_Test_WakeupRtpNotExecutionTime"); UtTest_Add(SC_ProcessRequest_Test_WakeupNoSwitchPending, SC_Test_Setup, SC_Test_TearDown, diff --git a/unit-test/sc_dispatch_tests.c b/unit-test/sc_dispatch_tests.c index 4340dd2..49049e7 100644 --- a/unit-test/sc_dispatch_tests.c +++ b/unit-test/sc_dispatch_tests.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -937,22 +936,6 @@ void UtTest_Setup(void) UtTest_Add(SC_ProcessRequest_Test_WakeupNominal, SC_Test_Setup, SC_Test_TearDown, "SC_ProcessRequest_Test_WakeupNominal"); UtTest_Add(SC_ProcessRequest_Test_MIDError, SC_Test_Setup, SC_Test_TearDown, "SC_ProcessRequest_Test_MIDError"); -#ifdef jphfix - UtTest_Add(SC_ProcessRequest_Test_HkMIDAutoStartRts, SC_Test_Setup, SC_Test_TearDown, - "SC_ProcessRequest_Test_HkMIDAutoStartRts"); - UtTest_Add(SC_ProcessRequest_Test_HkMIDAutoStartRtsLoaded, SC_Test_Setup, SC_Test_TearDown, - "SC_ProcessRequest_Test_HkMIDAutoStartRtsLoaded"); - UtTest_Add(SC_ProcessRequest_Test_WakeupNONE, SC_Test_Setup, SC_Test_TearDown, - "SC_ProcessRequest_Test_WakeupNONE"); - UtTest_Add(SC_ProcessRequest_Test_WakeupNoSwitchPending, SC_Test_Setup, SC_Test_TearDown, - "SC_ProcessRequest_Test_WakeupNoSwitchPending"); - UtTest_Add(SC_ProcessRequest_Test_WakeupAtpNotExecutionTime, SC_Test_Setup, SC_Test_TearDown, - "SC_ProcessRequest_Test_WakeupAtpNotExecutionTime"); - UtTest_Add(SC_ProcessRequest_Test_WakeupRtpExecutionTime, SC_Test_Setup, SC_Test_TearDown, - "SC_ProcessRequest_Test_WakeupRtpExecutionTime"); - UtTest_Add(SC_ProcessRequest_Test_WakeupRtpExecutionTimeTooManyCmds, SC_Test_Setup, SC_Test_TearDown, - "SC_ProcessRequest_Test_WakeupRtpExecutionTimeTooManyCmds"); -#endif UtTest_Add(SC_ProcessCommand_Test_NoopCmdNominal, SC_Test_Setup, SC_Test_TearDown, "SC_ProcessCommand_Test_NoopCmdNominal"); diff --git a/unit-test/sc_eds_dispatch_tests.c b/unit-test/sc_eds_dispatch_tests.c new file mode 100644 index 0000000..6dd47f3 --- /dev/null +++ b/unit-test/sc_eds_dispatch_tests.c @@ -0,0 +1,65 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +/* + * Includes + */ + +#include "sc_app.h" +#include "sc_cmds.h" +#include "sc_msg.h" +#include "sc_events.h" +#include "sc_utils.h" +#include "sc_dispatch.h" +#include "sc_test_utils.h" +#include "sc_eds_dispatcher.h" +#include +#include + +/* UT includes */ +#include "uttest.h" +#include "utassert.h" +#include "utstubs.h" + +/* +********************************************************************************** +** TEST CASE FUNCTIONS +********************************************************************************** +*/ + +void Test_SC_ProcessRequest(void) +{ + /* + * Test Case For: + * void SC_ProcessRequest + */ + CFE_SB_Buffer_t UtBuf; + + UT_SetDeferredRetcode(UT_KEY(CFE_EDSMSG_Dispatch), 1, CFE_SUCCESS); + + memset(&UtBuf, 0, sizeof(UtBuf)); + UtAssert_VOIDCALL(SC_ProcessRequest(&UtBuf)); +} + +/* + * Register the test cases to execute with the unit test tool + */ +void UtTest_Setup(void) +{ + UtTest_Add(Test_SC_ProcessRequest, SC_Test_Setup, SC_Test_TearDown, "Test_SC_ProcessRequest"); +} diff --git a/unit-test/sc_loads_tests.c b/unit-test/sc_loads_tests.c index 81f8974..7b593c8 100644 --- a/unit-test/sc_loads_tests.c +++ b/unit-test/sc_loads_tests.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -30,6 +29,8 @@ #include "sc_loads.h" #include "sc_msgids.h" #include "sc_events.h" +#include "sc_tbl.h" +#include "sc_msg.h" #include "sc_test_utils.h" #include #include @@ -150,8 +151,8 @@ SC_AtsEntryHeader_t *UT_SC_SetupSingleAtsEntry(SC_AtsIndex_t AtsIndex, uint16 Cm return UT_SC_AppendSingleAtsEntry(&TailPtr, CmdNumber, MsgSize); } -SC_RtsEntryHeader_t *UT_SC_SetupSingleRtsEntry(SC_RtsIndex_t RtsIndex, CFE_SB_MsgId_t MsgId, SC_RelWakeupCount_t WakeupCount, - size_t MsgSize) +SC_RtsEntryHeader_t *UT_SC_SetupSingleRtsEntry(SC_RtsIndex_t RtsIndex, CFE_SB_MsgId_t MsgId, + SC_RelWakeupCount_t WakeupCount, size_t MsgSize) { void *TailPtr; diff --git a/unit-test/sc_rtsrq_tests.c b/unit-test/sc_rtsrq_tests.c index ca49b5a..916aa23 100644 --- a/unit-test/sc_rtsrq_tests.c +++ b/unit-test/sc_rtsrq_tests.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test/sc_state_tests.c b/unit-test/sc_state_tests.c index 04153b6..7c431ba 100644 --- a/unit-test/sc_state_tests.c +++ b/unit-test/sc_state_tests.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test/sc_utils_tests.c b/unit-test/sc_utils_tests.c index f59cd21..620baee 100644 --- a/unit-test/sc_utils_tests.c +++ b/unit-test/sc_utils_tests.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -48,7 +47,7 @@ void SC_LookupTimeAccessor_Test(void) UtAssert_NOT_NULL(Accessor.Addr); Accessor.Addr = NULL; - Accessor.Obj = SC_LookupTimeAccessor(SC_TimeRef_MAX); + Accessor.Obj = SC_LookupTimeAccessor((SC_TimeRef_Enum_t)134); UtAssert_NOT_NULL(Accessor.Addr); } diff --git a/unit-test/stubs/sc_app_stubs.c b/unit-test/stubs/sc_app_stubs.c index e72f85e..88a761c 100644 --- a/unit-test/stubs/sc_app_stubs.c +++ b/unit-test/stubs/sc_app_stubs.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -47,6 +46,7 @@ CFE_Status_t SC_AppInit(void) */ void SC_AppMain(void) { + UT_GenStub_Execute(SC_AppMain, Basic, NULL); } @@ -99,6 +99,7 @@ CFE_Status_t SC_InitTables(void) */ void SC_LoadDefaultTables(void) { + UT_GenStub_Execute(SC_LoadDefaultTables, Basic, NULL); } @@ -151,5 +152,6 @@ CFE_Status_t SC_RegisterLoadableTables(void) */ void SC_RegisterManageCmds(void) { + UT_GenStub_Execute(SC_RegisterManageCmds, Basic, NULL); } diff --git a/unit-test/stubs/sc_atsrq_stubs.c b/unit-test/stubs/sc_atsrq_stubs.c index f02700f..7d49e7d 100644 --- a/unit-test/stubs/sc_atsrq_stubs.c +++ b/unit-test/stubs/sc_atsrq_stubs.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -31,11 +30,15 @@ * Generated stub function for SC_AppendAtsCmd() * ---------------------------------------------------- */ -void SC_AppendAtsCmd(const SC_AppendAtsCmd_t *Cmd) +CFE_Status_t SC_AppendAtsCmd(const SC_AppendAtsCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_AppendAtsCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_AppendAtsCmd, const SC_AppendAtsCmd_t *, Cmd); UT_GenStub_Execute(SC_AppendAtsCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_AppendAtsCmd, CFE_Status_t); } /* @@ -60,11 +63,15 @@ bool SC_BeginAts(SC_AtsIndex_t AtsIndex, uint16 TimeOffset) * Generated stub function for SC_ContinueAtsOnFailureCmd() * ---------------------------------------------------- */ -void SC_ContinueAtsOnFailureCmd(const SC_ContinueAtsOnFailureCmd_t *Cmd) +CFE_Status_t SC_ContinueAtsOnFailureCmd(const SC_ContinueAtsOnFailureCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_ContinueAtsOnFailureCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_ContinueAtsOnFailureCmd, const SC_ContinueAtsOnFailureCmd_t *, Cmd); UT_GenStub_Execute(SC_ContinueAtsOnFailureCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_ContinueAtsOnFailureCmd, CFE_Status_t); } /* @@ -86,11 +93,15 @@ bool SC_InlineSwitch(void) * Generated stub function for SC_JumpAtsCmd() * ---------------------------------------------------- */ -void SC_JumpAtsCmd(const SC_JumpAtsCmd_t *Cmd) +CFE_Status_t SC_JumpAtsCmd(const SC_JumpAtsCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_JumpAtsCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_JumpAtsCmd, const SC_JumpAtsCmd_t *, Cmd); UT_GenStub_Execute(SC_JumpAtsCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_JumpAtsCmd, CFE_Status_t); } /* @@ -100,6 +111,7 @@ void SC_JumpAtsCmd(const SC_JumpAtsCmd_t *Cmd) */ void SC_KillAts(void) { + UT_GenStub_Execute(SC_KillAts, Basic, NULL); } @@ -110,6 +122,7 @@ void SC_KillAts(void) */ void SC_ServiceSwitchPend(void) { + UT_GenStub_Execute(SC_ServiceSwitchPend, Basic, NULL); } @@ -118,11 +131,15 @@ void SC_ServiceSwitchPend(void) * Generated stub function for SC_StartAtsCmd() * ---------------------------------------------------- */ -void SC_StartAtsCmd(const SC_StartAtsCmd_t *Cmd) +CFE_Status_t SC_StartAtsCmd(const SC_StartAtsCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_StartAtsCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_StartAtsCmd, const SC_StartAtsCmd_t *, Cmd); UT_GenStub_Execute(SC_StartAtsCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_StartAtsCmd, CFE_Status_t); } /* @@ -130,11 +147,15 @@ void SC_StartAtsCmd(const SC_StartAtsCmd_t *Cmd) * Generated stub function for SC_StopAtsCmd() * ---------------------------------------------------- */ -void SC_StopAtsCmd(const SC_StopAtsCmd_t *Cmd) +CFE_Status_t SC_StopAtsCmd(const SC_StopAtsCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_StopAtsCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_StopAtsCmd, const SC_StopAtsCmd_t *, Cmd); UT_GenStub_Execute(SC_StopAtsCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_StopAtsCmd, CFE_Status_t); } /* @@ -142,9 +163,13 @@ void SC_StopAtsCmd(const SC_StopAtsCmd_t *Cmd) * Generated stub function for SC_SwitchAtsCmd() * ---------------------------------------------------- */ -void SC_SwitchAtsCmd(const SC_SwitchAtsCmd_t *Cmd) +CFE_Status_t SC_SwitchAtsCmd(const SC_SwitchAtsCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_SwitchAtsCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_SwitchAtsCmd, const SC_SwitchAtsCmd_t *, Cmd); UT_GenStub_Execute(SC_SwitchAtsCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_SwitchAtsCmd, CFE_Status_t); } diff --git a/unit-test/stubs/sc_cmds_stubs.c b/unit-test/stubs/sc_cmds_stubs.c index f9a19fe..eda8ff3 100644 --- a/unit-test/stubs/sc_cmds_stubs.c +++ b/unit-test/stubs/sc_cmds_stubs.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -68,11 +67,15 @@ void SC_ManageTable(SC_TableType type, int32 ArrayIndex) * Generated stub function for SC_ManageTableCmd() * ---------------------------------------------------- */ -void SC_ManageTableCmd(const SC_ManageTableCmd_t *Cmd) +CFE_Status_t SC_ManageTableCmd(const SC_ManageTableCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_ManageTableCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_ManageTableCmd, const SC_ManageTableCmd_t *, Cmd); UT_GenStub_Execute(SC_ManageTableCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_ManageTableCmd, CFE_Status_t); } /* @@ -80,23 +83,15 @@ void SC_ManageTableCmd(const SC_ManageTableCmd_t *Cmd) * Generated stub function for SC_NoopCmd() * ---------------------------------------------------- */ -void SC_NoopCmd(const SC_NoopCmd_t *Cmd) +CFE_Status_t SC_NoopCmd(const SC_NoopCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_NoopCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_NoopCmd, const SC_NoopCmd_t *, Cmd); UT_GenStub_Execute(SC_NoopCmd, Basic, NULL); -} -/* - * ---------------------------------------------------- - * Generated stub function for SC_WakeupCmd() - * ---------------------------------------------------- - */ -void SC_WakeupCmd(const SC_WakeupCmd_t *Cmd) -{ - UT_GenStub_AddParam(SC_WakeupCmd, const SC_WakeupCmd_t *, Cmd); - - UT_GenStub_Execute(SC_WakeupCmd, Basic, NULL); + return UT_GenStub_GetReturnValue(SC_NoopCmd, CFE_Status_t); } /* @@ -106,6 +101,7 @@ void SC_WakeupCmd(const SC_WakeupCmd_t *Cmd) */ void SC_ProcessAtpCmd(void) { + UT_GenStub_Execute(SC_ProcessAtpCmd, Basic, NULL); } @@ -116,6 +112,7 @@ void SC_ProcessAtpCmd(void) */ void SC_ProcessRtpCommand(void) { + UT_GenStub_Execute(SC_ProcessRtpCommand, Basic, NULL); } @@ -124,11 +121,15 @@ void SC_ProcessRtpCommand(void) * Generated stub function for SC_ResetCountersCmd() * ---------------------------------------------------- */ -void SC_ResetCountersCmd(const SC_ResetCountersCmd_t *Cmd) +CFE_Status_t SC_ResetCountersCmd(const SC_ResetCountersCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_ResetCountersCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_ResetCountersCmd, const SC_ResetCountersCmd_t *, Cmd); UT_GenStub_Execute(SC_ResetCountersCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_ResetCountersCmd, CFE_Status_t); } /* @@ -136,11 +137,15 @@ void SC_ResetCountersCmd(const SC_ResetCountersCmd_t *Cmd) * Generated stub function for SC_SendHkCmd() * ---------------------------------------------------- */ -void SC_SendHkCmd(const SC_SendHkCmd_t *Cmd) +CFE_Status_t SC_SendHkCmd(const SC_SendHkCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_SendHkCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_SendHkCmd, const SC_SendHkCmd_t *, Cmd); UT_GenStub_Execute(SC_SendHkCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_SendHkCmd, CFE_Status_t); } /* @@ -150,5 +155,22 @@ void SC_SendHkCmd(const SC_SendHkCmd_t *Cmd) */ void SC_SendHkPacket(void) { + UT_GenStub_Execute(SC_SendHkPacket, Basic, NULL); } + +/* + * ---------------------------------------------------- + * Generated stub function for SC_WakeupCmd() + * ---------------------------------------------------- + */ +CFE_Status_t SC_WakeupCmd(const SC_WakeupCmd_t *Cmd) +{ + UT_GenStub_SetupReturnBuffer(SC_WakeupCmd, CFE_Status_t); + + UT_GenStub_AddParam(SC_WakeupCmd, const SC_WakeupCmd_t *, Cmd); + + UT_GenStub_Execute(SC_WakeupCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_WakeupCmd, CFE_Status_t); +} diff --git a/unit-test/stubs/sc_dispatch_stubs.c b/unit-test/stubs/sc_dispatch_stubs.c index 3dc0513..46eb95f 100644 --- a/unit-test/stubs/sc_dispatch_stubs.c +++ b/unit-test/stubs/sc_dispatch_stubs.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -20,8 +19,7 @@ /** * @file * - * Auto-Generated stub implementations for functions defined in sc_dispatch - * header + * Auto-Generated stub implementations for functions defined in sc_dispatch header */ #include "sc_dispatch.h" diff --git a/unit-test/stubs/sc_global_stubs.c b/unit-test/stubs/sc_global_stubs.c index a4244c5..088ad79 100644 --- a/unit-test/stubs/sc_global_stubs.c +++ b/unit-test/stubs/sc_global_stubs.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,920-1, and identified as “Core Flight - * System (cFS) Health & Safety (HS) Application version 2.4.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test/stubs/sc_loads_stubs.c b/unit-test/stubs/sc_loads_stubs.c index 2b772ef..81a8b06 100644 --- a/unit-test/stubs/sc_loads_stubs.c +++ b/unit-test/stubs/sc_loads_stubs.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -121,6 +120,7 @@ void SC_ProcessAppend(SC_AtsIndex_t AtsIndex) */ void SC_UpdateAppend(void) { + UT_GenStub_Execute(SC_UpdateAppend, Basic, NULL); } diff --git a/unit-test/stubs/sc_rtsrq_stubs.c b/unit-test/stubs/sc_rtsrq_stubs.c index 3d0cae7..30c8344 100644 --- a/unit-test/stubs/sc_rtsrq_stubs.c +++ b/unit-test/stubs/sc_rtsrq_stubs.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -43,11 +42,15 @@ void SC_AutoStartRts(SC_RtsNum_t RtsNum) * Generated stub function for SC_DisableRtsCmd() * ---------------------------------------------------- */ -void SC_DisableRtsCmd(const SC_DisableRtsCmd_t *Cmd) +CFE_Status_t SC_DisableRtsCmd(const SC_DisableRtsCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_DisableRtsCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_DisableRtsCmd, const SC_DisableRtsCmd_t *, Cmd); UT_GenStub_Execute(SC_DisableRtsCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_DisableRtsCmd, CFE_Status_t); } /* @@ -55,11 +58,15 @@ void SC_DisableRtsCmd(const SC_DisableRtsCmd_t *Cmd) * Generated stub function for SC_DisableRtsGrpCmd() * ---------------------------------------------------- */ -void SC_DisableRtsGrpCmd(const SC_DisableRtsGrpCmd_t *Cmd) +CFE_Status_t SC_DisableRtsGrpCmd(const SC_DisableRtsGrpCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_DisableRtsGrpCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_DisableRtsGrpCmd, const SC_DisableRtsGrpCmd_t *, Cmd); UT_GenStub_Execute(SC_DisableRtsGrpCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_DisableRtsGrpCmd, CFE_Status_t); } /* @@ -67,11 +74,15 @@ void SC_DisableRtsGrpCmd(const SC_DisableRtsGrpCmd_t *Cmd) * Generated stub function for SC_EnableRtsCmd() * ---------------------------------------------------- */ -void SC_EnableRtsCmd(const SC_EnableRtsCmd_t *Cmd) +CFE_Status_t SC_EnableRtsCmd(const SC_EnableRtsCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_EnableRtsCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_EnableRtsCmd, const SC_EnableRtsCmd_t *, Cmd); UT_GenStub_Execute(SC_EnableRtsCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_EnableRtsCmd, CFE_Status_t); } /* @@ -79,11 +90,15 @@ void SC_EnableRtsCmd(const SC_EnableRtsCmd_t *Cmd) * Generated stub function for SC_EnableRtsGrpCmd() * ---------------------------------------------------- */ -void SC_EnableRtsGrpCmd(const SC_EnableRtsGrpCmd_t *Cmd) +CFE_Status_t SC_EnableRtsGrpCmd(const SC_EnableRtsGrpCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_EnableRtsGrpCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_EnableRtsGrpCmd, const SC_EnableRtsGrpCmd_t *, Cmd); UT_GenStub_Execute(SC_EnableRtsGrpCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_EnableRtsGrpCmd, CFE_Status_t); } /* @@ -103,11 +118,15 @@ void SC_KillRts(SC_RtsIndex_t RtsIndex) * Generated stub function for SC_StartRtsCmd() * ---------------------------------------------------- */ -void SC_StartRtsCmd(const SC_StartRtsCmd_t *Cmd) +CFE_Status_t SC_StartRtsCmd(const SC_StartRtsCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_StartRtsCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_StartRtsCmd, const SC_StartRtsCmd_t *, Cmd); UT_GenStub_Execute(SC_StartRtsCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_StartRtsCmd, CFE_Status_t); } /* @@ -115,11 +134,15 @@ void SC_StartRtsCmd(const SC_StartRtsCmd_t *Cmd) * Generated stub function for SC_StartRtsGrpCmd() * ---------------------------------------------------- */ -void SC_StartRtsGrpCmd(const SC_StartRtsGrpCmd_t *Cmd) +CFE_Status_t SC_StartRtsGrpCmd(const SC_StartRtsGrpCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_StartRtsGrpCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_StartRtsGrpCmd, const SC_StartRtsGrpCmd_t *, Cmd); UT_GenStub_Execute(SC_StartRtsGrpCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_StartRtsGrpCmd, CFE_Status_t); } /* @@ -127,11 +150,15 @@ void SC_StartRtsGrpCmd(const SC_StartRtsGrpCmd_t *Cmd) * Generated stub function for SC_StopRtsCmd() * ---------------------------------------------------- */ -void SC_StopRtsCmd(const SC_StopRtsCmd_t *Cmd) +CFE_Status_t SC_StopRtsCmd(const SC_StopRtsCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_StopRtsCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_StopRtsCmd, const SC_StopRtsCmd_t *, Cmd); UT_GenStub_Execute(SC_StopRtsCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_StopRtsCmd, CFE_Status_t); } /* @@ -139,9 +166,13 @@ void SC_StopRtsCmd(const SC_StopRtsCmd_t *Cmd) * Generated stub function for SC_StopRtsGrpCmd() * ---------------------------------------------------- */ -void SC_StopRtsGrpCmd(const SC_StopRtsGrpCmd_t *Cmd) +CFE_Status_t SC_StopRtsGrpCmd(const SC_StopRtsGrpCmd_t *Cmd) { + UT_GenStub_SetupReturnBuffer(SC_StopRtsGrpCmd, CFE_Status_t); + UT_GenStub_AddParam(SC_StopRtsGrpCmd, const SC_StopRtsGrpCmd_t *, Cmd); UT_GenStub_Execute(SC_StopRtsGrpCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(SC_StopRtsGrpCmd, CFE_Status_t); } diff --git a/unit-test/stubs/sc_state_stubs.c b/unit-test/stubs/sc_state_stubs.c index 87e842e..cc0380b 100644 --- a/unit-test/stubs/sc_state_stubs.c +++ b/unit-test/stubs/sc_state_stubs.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -33,6 +32,7 @@ */ void SC_GetNextAtsCommand(void) { + UT_GenStub_Execute(SC_GetNextAtsCommand, Basic, NULL); } @@ -43,6 +43,7 @@ void SC_GetNextAtsCommand(void) */ void SC_GetNextRtsCommand(void) { + UT_GenStub_Execute(SC_GetNextRtsCommand, Basic, NULL); } @@ -53,5 +54,6 @@ void SC_GetNextRtsCommand(void) */ void SC_GetNextRtsTime(void) { + UT_GenStub_Execute(SC_GetNextRtsTime, Basic, NULL); } diff --git a/unit-test/stubs/sc_utils_stubs.c b/unit-test/stubs/sc_utils_stubs.c index a609a8e..078b475 100644 --- a/unit-test/stubs/sc_utils_stubs.c +++ b/unit-test/stubs/sc_utils_stubs.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -98,6 +97,7 @@ SC_AbsTimeTag_t SC_GetAtsEntryTime(SC_AtsEntryHeader_t *Entry) */ void SC_GetCurrentTime(void) { + UT_GenStub_Execute(SC_GetCurrentTime, Basic, NULL); } diff --git a/unit-test/utilities/sc_test_utils.c b/unit-test/utilities/sc_test_utils.c index 19fb503..cef366f 100644 --- a/unit-test/utilities/sc_test_utils.c +++ b/unit-test/utilities/sc_test_utils.c @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test/utilities/sc_test_utils.h b/unit-test/utilities/sc_test_utils.h index 82c47ed..edc2ffa 100644 --- a/unit-test/utilities/sc_test_utils.h +++ b/unit-test/utilities/sc_test_utils.h @@ -1,8 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,924-1, and identified as “Core Flight - * System (cFS) Stored Command Application version 3.1.1” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2021 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. *