diff --git a/.github/workflows/build-documentation.yml b/.github/workflows/build-documentation.yml
index 8f21c97..c104d27 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 30359cf..d9d60fc 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 96019a3..e1c5669 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 1d156e8..ffb8a13 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,8 +15,7 @@ set(APP_SRC_FILES
fsw/src/fm_app.c
fsw/src/fm_cmds.c
fsw/src/fm_child.c
- fsw/src/fm_dispatch.c
- fsw/src/fm_tbl.c
+ fsw/src/fm_table_utils.c
)
# If compression features are enabled, choose the adapter based on the selected implementation
@@ -41,6 +40,16 @@ else()
endif()
+if (CFE_EDS_ENABLED)
+ list(APPEND APP_SRC_FILES
+ fsw/src/fm_eds_dispatch.c
+ )
+else()
+ list(APPEND APP_SRC_FILES
+ fsw/src/fm_dispatch.c
+ )
+endif()
+
# Create the app module
add_cfe_app(fm ${APP_SRC_FILES} ${FM_OPTION_SRC_FILES})
diff --git a/arch_build.cmake b/arch_build.cmake
new file mode 100644
index 0000000..7fedf2e
--- /dev/null
+++ b/arch_build.cmake
@@ -0,0 +1,19 @@
+###########################################################
+#
+# FM App platform build setup
+#
+# This file is evaluated as part of the "prepare" stage
+# and can be used to set up prerequisites for the build,
+# such as generating header files
+#
+###########################################################
+
+# The list of header files that control the FM configuration
+set(FM_PLATFORM_CONFIG_FILE_LIST
+ fm_internal_cfg_values.h
+ fm_platform_cfg.h
+ fm_msgid_values.h
+ fm_msgids.h
+)
+
+generate_configfile_set(${FM_PLATFORM_CONFIG_FILE_LIST})
\ No newline at end of file
diff --git a/config/default_fm_extern_typedefs.h b/config/default_fm_extern_typedefs.h
new file mode 100644
index 0000000..75628e2
--- /dev/null
+++ b/config/default_fm_extern_typedefs.h
@@ -0,0 +1,64 @@
+/************************************************************************
+ * 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.
+ ************************************************************************/
+
+#ifndef DEFAULT_FM_EXTERN_TYPEDEFS_H
+#define DEFAULT_FM_EXTERN_TYPEDEFS_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "cfe.h"
+
+/**
+ * \brief FM free space table entry state definitions
+ */
+#define FM_TABLE_ENTRY_DISABLED 0
+#define FM_TABLE_ENTRY_ENABLED 1
+
+
+/* ======== */
+/* Typedefs */
+/* ======== */
+
+/**
+ * \brief FM enum used for verifying file name states
+ */
+typedef enum
+{
+ FM_NAME_IS_INVALID = 0,
+ FM_NAME_IS_NOT_IN_USE = 1,
+ FM_NAME_IS_FILE_OPEN = 2,
+ FM_NAME_IS_FILE_CLOSED = 3,
+ FM_NAME_IS_DIRECTORY = 4,
+} FM_FileNameStates_Enum_t;
+
+/**
+ * \brief FM enum used for verifying file states
+ */
+typedef enum
+{
+ FM_FILE_CLOSED, /**< \brief FM File Is Closed */
+ FM_FILE_EXISTS, /**< \brief FM File Exists */
+ FM_FILE_NOEXIST, /**< \brief FM File Does Not Exist */
+ FM_FILE_NOTOPEN, /**< \brief FM File Is Not Open */
+ FM_DIR_EXISTS, /**< \brief FM Directory Exists */
+ FM_DIR_NOEXIST /**< \brief FM Directory Does Not Exist */
+} FM_FileStates_Enum_t;
+
+#endif // DEFAULT_FM_EXTERN_TYPEDEFS_H
diff --git a/config/default_fm_fcncode_values.h b/config/default_fm_fcncode_values.h
new file mode 100644
index 0000000..5f17124
--- /dev/null
+++ b/config/default_fm_fcncode_values.h
@@ -0,0 +1,64 @@
+/************************************************************************
+ * 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 File Manager (FM) 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 DEFAULT_FM_FCNCODE_VALUES_H
+#define DEFAULT_FM_FCNCODE_VALUES_H
+
+/* ====== */
+/* Macros */
+/* ====== */
+
+#define FM_CCVAL(x) FM_FunctionCode_##x
+
+/* ================ */
+/* Type Definitions */
+/* ================ */
+
+enum FM_FunctionCode
+{
+ FM_FunctionCode_NOOP = 0,
+ FM_FunctionCode_RESET_COUNTERS = 1,
+ FM_FunctionCode_COPY_FILE = 2,
+ FM_FunctionCode_MOVE_FILE = 3,
+ FM_FunctionCode_RENAME_FILE = 4,
+ FM_FunctionCode_DELETE_FILE = 5,
+ FM_FunctionCode_DELETE_ALL_FILES = 7,
+ FM_FunctionCode_DECOMPRESS_FILE = 8,
+ FM_FunctionCode_CONCAT_FILES = 9,
+ FM_FunctionCode_GET_FILE_INFO = 10,
+ FM_FunctionCode_GET_OPEN_FILES = 11,
+ FM_FunctionCode_CREATE_DIRECTORY = 12,
+ FM_FunctionCode_DELETE_DIRECTORY = 13,
+ FM_FunctionCode_GET_DIR_LIST_FILE = 14,
+ FM_FunctionCode_GET_DIR_LIST_PKT = 15,
+ FM_FunctionCode_MONITOR_FILESYSTEM_SPACE = 16,
+ FM_FunctionCode_SET_TABLE_STATE = 17,
+ FM_FunctionCode_SET_PERMISSIONS = 19,
+};
+
+#endif /* DEFAULT_FM_FCNCODE_VALUES_H */
\ No newline at end of file
diff --git a/config/default_fm_interface_cfg_values.h b/config/default_fm_interface_cfg_values.h
new file mode 100644
index 0000000..1c0c358
--- /dev/null
+++ b/config/default_fm_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
+ * CFS File Manager (FM) 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_FM_INTERFACE_CFG_VALUES_H
+#define DEFAULT_FM_INTERFACE_CFG_VALUES_H
+
+/** \brief Generates default configuration values */
+#define FM_INTERFACE_CFGVAL(x) DEFAULT_FM_INTERFACE_##x
+
+#endif /* DEFAULT_FM_INTERFACE_CFG_VALUES_H */
\ No newline at end of file
diff --git a/config/default_fm_internal_cfg_values.h b/config/default_fm_internal_cfg_values.h
new file mode 100644
index 0000000..c8ae5e7
--- /dev/null
+++ b/config/default_fm_internal_cfg_values.h
@@ -0,0 +1,34 @@
+/************************************************************************
+ * 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 File Manager (FM) Application Private Config Definitions
+ *
+ * @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_FM_INTERNAL_CFG_VALUES_H
+#define DEFAULT_FM_INTERNAL_CFG_VALUES_H
+
+/** \brief Generates default configuration values */
+#define FM_INTERNAL_CFGVAL(x) DEFAULT_FM_INTERNAL_##x
+
+#endif /* DEFAULT_FM_INTERNAL_CFG_VALUES_H */
\ No newline at end of file
diff --git a/config/default_fm_mission_cfg.h b/config/default_fm_mission_cfg.h
new file mode 100644
index 0000000..702211a
--- /dev/null
+++ b/config/default_fm_mission_cfg.h
@@ -0,0 +1,37 @@
+/************************************************************************
+ * 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
+ *
+ * FM Application Mission Configuration Header File
+ *
+ * This is a compatibility header for the "mission_cfg.h" file that has
+ * traditionally provided public config definitions for each CFS app.
+ *
+ * @note This file may be overridden/superceded by mission-provided definitions
+ * either by overriding this header or by generating definitions from a command/data
+ * dictionary tool.
+ */
+
+#ifndef DEFAULT_FM_MISSION_CFG_H
+#define DEFAULT_FM_MISSION_CFG_H
+
+#include "fm_interface_cfg.h"
+
+#endif /* DEFAULT_FM_MISSION_CFG_H */
\ No newline at end of file
diff --git a/config/default_fm_msg.h b/config/default_fm_msg.h
new file mode 100644
index 0000000..b870150
--- /dev/null
+++ b/config/default_fm_msg.h
@@ -0,0 +1,41 @@
+/************************************************************************
+ * 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 File Manager (FM) command and telemetry
+ * message data types.
+ *
+ * This is a compatibility header for the "fm_msg.h" file that has
+ * traditionally provided the message definitions for cFS apps.
+ *
+ * @note This file may be overridden/superceded by mission-provided defintions
+ * either by overriding this header or by generating definitions from a command/data
+ * dictionary tool.
+ */
+#ifndef DEFAULT_FM_MSG_H
+#define DEFAULT_FM_MSG_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "fm_msgdefs.h"
+#include "fm_msgstruct.h"
+
+#endif /* DEFAULT_FM_MSG_H */
\ No newline at end of file
diff --git a/config/default_fm_msgdefs.h b/config/default_fm_msgdefs.h
new file mode 100644
index 0000000..82b20e6
--- /dev/null
+++ b/config/default_fm_msgdefs.h
@@ -0,0 +1,274 @@
+/************************************************************************
+ * 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 File Manager (FM) command and telemetry
+ * message payload content definitions.
+ */
+#ifndef DEFAULT_FM_MSGDEFS_H
+#define DEFAULT_FM_MSGDEFS_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "fm_interface_cfg.h" /* For FM_DIR_LIST_PKT_ENTRIES */
+#include "fm_fcncodes.h" /* For command codes and any other definitions for message interpretation */
+#include "fm_tbldefs.h" /* For FM_TABLE_ENTRY_COUNT */
+#include "fm_extern_typedefs.h"
+
+/* ======== */
+/* Typedefs */
+/* ======== */
+
+/* Command Payloads */
+
+/**
+ * \defgroup cfsfmcmd CFS File Manager Commands
+ * \{
+ */
+
+/**
+ * \brief Copy/Move File command payload structure
+ *
+ * Contains a source and target file name and an overwrite flag
+ *
+ * Used by #FM_COPY_FILE_CC, #FM_MOVE_FILE_CC
+ */
+typedef struct
+{
+ uint16 Overwrite; /**< \brief Allow overwrite */
+ char Source[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Source filename */
+ char Target[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Target filename */
+} FM_OvwSourceTargetFilename_Payload_t;
+
+/**
+ * \brief Source and Target filename command payload structure
+ *
+ * Used by #FM_RENAME_FILE_CC, #FM_DECOMPRESS_FILE_CC
+ */
+typedef struct
+{
+ char Source[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Source filename */
+ char Target[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Target filename */
+} FM_SourceTargetFileName_Payload_t;
+
+/**
+ * \brief Single filename command payload structure
+ *
+ * Used by #FM_DELETE_FILE_CC
+ */
+typedef struct
+{
+ char Filename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Delete filename */
+} FM_SingleFilename_Payload_t;
+
+/**
+ * \brief Single directory command payload structure
+ *
+ * Used by #FM_DELETE_ALL_FILES_CC, #FM_CREATE_DIRECTORY_CC, #FM_DELETE_DIRECTORY_CC
+ */
+typedef struct
+{
+ char Directory[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Directory name */
+} FM_DirectoryName_Payload_t;
+
+/**
+ * \brief Two source, one target filename command payload structure
+ *
+ * Used by #FM_CONCAT_FILES_CC
+ */
+typedef struct
+{
+ char Source1[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Source 1 filename */
+ char Source2[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Source 2 filename */
+ char Target[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Target filename */
+} FM_TwoSourceOneTarget_Payload_t;
+
+/**
+ * \brief Filename and CRC command payload structure
+ *
+ * Used by #FM_GET_FILE_INFO_CC
+ */
+typedef struct
+{
+ char Filename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename */
+ uint32 FileInfoCRC; /**< \brief File info CRC method */
+} FM_FilenameAndCRC_Payload_t;
+
+/**
+ * \brief Get Directory and output to file command payload
+ *
+ * Contains a directory and output file name, with optional flags
+ * Used by #FM_GET_DIR_LIST_FILE_CC
+ */
+typedef struct
+{
+ char Directory[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Directory name */
+ char Filename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Filename */
+ uint8 GetSizeTimeMode; /**< \brief Option to query size, time, and mode of files (CPU intensive) */
+ uint8 Spare01[3]; /**< \brief Padding to 32 bit boundary */
+} FM_GetDirectoryToFile_Payload_t;
+
+/**
+ * \brief Get Directory and output to message command payload
+ *
+ * Contains a directory and position offset, with optional flags
+ * Used by #FM_GET_DIR_LIST_PKT_CC
+ */
+typedef struct
+{
+ char Directory[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Directory name */
+ uint32 DirListOffset; /**< \brief Index of 1st dir entry to put in packet */
+ uint8 GetSizeTimeMode; /**< \brief Option to query size, time, and mode of files (CPU intensive) */
+ uint8 Spare01[3]; /**< \brief Padding to 32 bit boundary */
+} FM_GetDirectoryToPkt_Payload_t;
+
+/**
+ * \brief Table Index and State command payload structure
+ *
+ * Used by #FM_SET_TABLE_STATE_CC
+ */
+typedef struct
+{
+ uint32 TableEntryIndex; /**< \brief Table entry index */
+ uint32 TableEntryState; /**< \brief New table entry state */
+} FM_TableIndexAndState_Payload_t;
+
+/**
+ * \brief File name and mode command payload structure
+ *
+ * Used by #FM_SET_PERMISSIONS_CC
+ */
+typedef struct
+{
+ char FileName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief File name of the permissions to set */
+ uint32 Mode; /**< \brief Permissions, passed directly to OS_chmod */
+} FM_FilenameAndMode_Payload_t;
+
+/**\}*/
+
+/* Telemetry Payloads */
+
+/**
+ * \defgroup cfsfmtlm CFS File Manager Telemetry
+ * \{
+ */
+
+/**
+ * \brief Get Directory Listing entry structure
+ */
+typedef struct
+{
+ char EntryName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Directory Listing Filename */
+ uint32 EntrySize; /**< \brief Directory Listing File Size */
+ uint32 ModifyTime; /**< \brief Directory Listing File Last Modification Times */
+ uint32 Mode; /**< \brief Mode of the file (Permissions from #OS_FILESTAT_MODE) */
+} FM_DirListEntry_t;
+
+/**
+ * \brief Get Directory Listing telemetry payload
+ */
+typedef struct
+{
+ char DirName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Directory Name */
+ uint32 TotalFiles; /**< \brief Number of files in the directory */
+ uint32 PacketFiles; /**< \brief Number of files in this packet */
+ uint32 FirstFile; /**< \brief Index into directory files of first packet file */
+ FM_DirListEntry_t FileList[FM_DIR_LIST_PKT_ENTRIES]; /**< \brief Directory listing file data */
+} FM_DirListPkt_Payload_t;
+
+/**
+ * \brief Get File Info telemetry payload
+ */
+typedef struct
+{
+ uint8 FileStatus; /**< \brief Status indicating whether the file is open or closed */
+ uint8 CRC_Computed; /**< \brief Flag indicating whether a CRC was computed or not */
+ uint8 Spare[2]; /**< \brief Structure padding */
+ uint32 CRC; /**< \brief CRC value if computed */
+ uint32 FileSize; /**< \brief File Size */
+ uint32 LastModifiedTime; /**< \brief Last Modification Time of File */
+ uint32 Mode; /**< \brief Mode of the file (Permissions) */
+ char Filename[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Name of File */
+} FM_FileInfoPkt_Payload_t;
+
+/**
+ * \brief Get Open Files list entry structure
+ */
+typedef struct
+{
+ char LogicalName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Logical filename */
+ char AppName[CFE_MISSION_MAX_API_LEN]; /**< \brief Application that opened file */
+} FM_OpenFilesEntry_t;
+
+/**
+ * \brief Get Open Files telemetry payload
+ */
+typedef struct
+{
+ uint32 NumOpenFiles; /**< \brief Number of files opened via cFE */
+ FM_OpenFilesEntry_t OpenFilesList[CFE_MISSION_MAX_NUM_FILES]; /**< \brief List of files opened via cFE */
+} FM_OpenFilesPkt_Payload_t;
+
+/**
+ * \brief Monitor filesystem list entry structure
+ */
+typedef struct
+{
+ uint8 ReportType;
+ uint8 Padding[7]; /**< \brief Padding to align Name (and subsequent members) to 64-bit boundaries */
+ char Name[CFE_MISSION_MAX_PATH_LEN]; /**< \brief File system name */
+ uint64 Blocks; /**< \brief Block count from last check/poll, 0 if unknown */
+ uint64 Bytes; /**< \brief Byte count from last check/poll, 0 if unknown */
+} FM_MonitorReportEntry_t;
+
+/**
+ * \brief Monitor filesystem telemetry payload
+ */
+typedef struct
+{
+ FM_MonitorReportEntry_t FileSys[FM_TABLE_ENTRY_COUNT]; /**< \brief Array of file system free space entries */
+} FM_MonitorReportPkt_Payload_t;
+
+/**
+ * \brief Housekeeping telemetry payload
+ */
+typedef struct
+{
+ uint8 CommandCounter; /**< \brief Application command counter */
+ uint8 CommandErrCounter; /**< \brief Application command error counter */
+ uint8 Spare; /**< \brief Placeholder for unused command warning counter */
+
+ uint8 NumOpenFiles; /**< \brief Number of open files in the system */
+
+ uint8 ChildCmdCounter; /**< \brief Child task command counter */
+ uint8 ChildCmdErrCounter; /**< \brief Child task command error counter */
+ uint8 ChildCmdWarnCounter; /**< \brief Child task command warning counter */
+
+ uint8 ChildQueueCount; /**< \brief Number of pending commands in queue */
+
+ uint8 ChildCurrentCC; /**< \brief Command code currently executing */
+ uint8 ChildPreviousCC; /**< \brief Command code previously executed */
+} FM_HkTlm_Payload_t;
+
+/**\}*/
+
+#endif
+/* DEFAULT_FM_MSGDEFS_H */
diff --git a/config/default_fm_msgid_values.h b/config/default_fm_msgid_values.h
new file mode 100644
index 0000000..bbe0b01
--- /dev/null
+++ b/config/default_fm_msgid_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
+ * CFS File Manager (FM) Application Message IDs
+ */
+#ifndef DEFAULT_FM_MSGIDS_VALUES_H
+#define DEFAULT_FM_MSGIDS_VALUES_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "fm_topicids.h"
+#include "cfe_core_api_base_msgids.h"
+
+/* ====== */
+/* Macros */
+/* ====== */
+
+#define FM_CMD_PLATFORM_MIDVAL(x) CFE_PLATFORM_CMD_TOPICID_TO_MIDV(FM_MISSION_##x##_TOPICID)
+#define FM_TLM_PLATFORM_MIDVAL(x) CFE_PLATFORM_TLM_TOPICID_TO_MIDV(FM_MISSION_##x##_TOPICID)
+
+#endif /* DEFAULT_FM_MSGIDS_VALUES_H */
\ No newline at end of file
diff --git a/fsw/inc/fm_msgids.h b/config/default_fm_msgids.h
similarity index 53%
rename from fsw/inc/fm_msgids.h
rename to config/default_fm_msgids.h
index 9bc76e2..0458ad7 100644
--- a/fsw/inc/fm_msgids.h
+++ b/config/default_fm_msgids.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -19,19 +18,29 @@
/**
* @file
- * Specification for the CFS FM application software bus
- * message identifiers
+ * CFS File Manager (FM) Application Message IDs
*/
-#ifndef FM_MSGIDS_H
-#define FM_MSGIDS_H
+#ifndef DEFAULT_FM_MSGIDS_H
+#define DEFAULT_FM_MSGIDS_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "cfe_core_api_base_msgids.h"
+#include "fm_msgid_values.h"
+
+/* ====== */
+/* Macros */
+/* ====== */
/**
* \defgroup cfsfmcmdmid CFS File Manager Command Message IDs
* \{
*/
-#define FM_CMD_MID 0x188C /** < \brief FM ground commands */
-#define FM_SEND_HK_MID 0x188D /** < \brief FM send housekeeping */
+#define FM_CMD_MID FM_CMD_PLATFORM_MIDVAL(CMD)
+#define FM_SEND_HK_MID FM_CMD_PLATFORM_MIDVAL(SEND_HK)
/**\}*/
@@ -40,12 +49,12 @@
* \{
*/
-#define FM_HK_TLM_MID 0x088A /** < \brief FM housekeeping */
-#define FM_FILE_INFO_TLM_MID 0x088B /** < \brief FM get file info */
-#define FM_DIR_LIST_TLM_MID 0x088C /** < \brief FM get dir list */
-#define FM_OPEN_FILES_TLM_MID 0x088D /** < \brief FM get open files */
-#define FM_FREE_SPACE_TLM_MID 0x088E /** < \brief FM get free space */
+#define FM_HK_TLM_MID FM_TLM_PLATFORM_MIDVAL(HK_TLM)
+#define FM_FILE_INFO_TLM_MID FM_TLM_PLATFORM_MIDVAL(FILE_INFO_TLM)
+#define FM_DIR_LIST_TLM_MID FM_TLM_PLATFORM_MIDVAL(DIR_LIST_TLM)
+#define FM_OPEN_FILES_TLM_MID FM_TLM_PLATFORM_MIDVAL(OPEN_FILES_TLM)
+#define FM_MONITOR_TLM_MID FM_TLM_PLATFORM_MIDVAL(MONITOR_TLM)
/**\}*/
-#endif
+#endif /* DEFAULT_FM_MSGIDS_H */
diff --git a/config/default_fm_msgstruct.h b/config/default_fm_msgstruct.h
new file mode 100644
index 0000000..53c9da9
--- /dev/null
+++ b/config/default_fm_msgstruct.h
@@ -0,0 +1,309 @@
+/************************************************************************
+ * 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 File Manager (FM) command and telemetry
+ * message data types.
+ *
+ * @note
+ * Constants and enumerated types related to these message structures
+ * are defined in fm_msgdefs.h.
+ */
+
+#ifndef DEFAULT_FM_MSGSTRUCT_H
+#define DEFAULT_FM_MSGSTRUCT_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "cfe.h"
+#include "fm_msgdefs.h"
+
+/* ======== */
+/* Typedefs */
+/* ======== */
+
+
+/**
+ * \defgroup cfsfmcmdstructs CFS File Manager Command Structures
+ * \{
+ */
+
+/* Command Packets */
+
+/**
+ * \brief Housekeeping Request command packet structure
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+} FM_SendHkCmd_t;
+
+/**
+ * \brief No-Operation command packet structure
+ *
+ * For command details see #FM_NOOP_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+} FM_NoopCmd_t;
+
+/**
+ * \brief Reset Counters command packet structure
+ *
+ * For command details see #FM_RESET_COUNTERS_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+} FM_ResetCountersCmd_t;
+
+/**
+ * \brief Copy File command packet structure
+ *
+ * For command details see #FM_COPY_FILE_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_OvwSourceTargetFilename_Payload_t Payload; /** \brief Command payload */
+} FM_CopyFileCmd_t;
+
+/**
+ * \brief Move File command packet structure
+ *
+ * For command details see #FM_MOVE_FILE_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_OvwSourceTargetFilename_Payload_t Payload; /** \brief Command payload */
+} FM_MoveFileCmd_t;
+
+/**
+ * \brief Rename File command packet structure
+ *
+ * For command details see #FM_RENAME_FILE_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_SourceTargetFileName_Payload_t Payload; /** \brief Command payload */
+} FM_RenameFileCmd_t;
+
+/**
+ * \brief Delete File command packet structure
+ *
+ * For command details see #FM_DELETE_FILE_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_SingleFilename_Payload_t Payload; /** \brief Command Payload */
+} FM_DeleteFileCmd_t;
+
+/**
+ * \brief Delete All command packet structure
+ *
+ * For command details see #FM_DELETE_ALL_FILES_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_DirectoryName_Payload_t Payload; /** \brief Command Payload */
+} FM_DeleteAllFilesCmd_t;
+
+/**
+ * \brief Decompress File command packet structure
+ *
+ * For command details see #FM_DECOMPRESS_FILE_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_SourceTargetFileName_Payload_t Payload; /** \brief Command Payload */
+} FM_DecompressFileCmd_t;
+
+/**
+ * \brief Concatenate Files command packet structure
+ *
+ * For command details see #FM_CONCAT_FILES_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_TwoSourceOneTarget_Payload_t Payload; /** \brief Command Payload */
+} FM_ConcatFilesCmd_t;
+
+/**
+ * \brief Get File Info command packet structure
+ *
+ * For command details see #FM_GET_FILE_INFO_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_FilenameAndCRC_Payload_t Payload; /** \brief Command Payload */
+} FM_GetFileInfoCmd_t;
+
+/**
+ * \brief Get Open Files command packet structure
+ *
+ * For command details see #FM_GET_OPEN_FILES_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+} FM_GetOpenFilesCmd_t;
+
+/**
+ * \brief Create Directory command packet structure
+ *
+ * For command details see #FM_CREATE_DIRECTORY_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_DirectoryName_Payload_t Payload; /** \brief Command Payload */
+} FM_CreateDirectoryCmd_t;
+
+/**
+ * \brief Delete Directory command packet structure
+ *
+ * For command details see #FM_DELETE_DIRECTORY_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_DirectoryName_Payload_t Payload; /** \brief Command Payload */
+} FM_DeleteDirectoryCmd_t;
+
+/**
+ * \brief Get DIR List to File command packet structure
+ *
+ * For command details see #FM_GET_DIR_LIST_FILE_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_GetDirectoryToFile_Payload_t Payload; /** \brief Command Payload */
+} FM_GetDirListFileCmd_t;
+
+/**
+ * \brief Get DIR List to Packet command packet structure
+ *
+ * For command details see #FM_GET_DIR_LIST_PKT_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_GetDirectoryToPkt_Payload_t Payload; /** \brief Command Payload */
+} FM_GetDirListPktCmd_t;
+
+/**
+ * \brief Get Free Space command packet structure
+ *
+ * For command details see #FM_MONITOR_FILESYSTEM_SPACE_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+} FM_MonitorFilesystemSpaceCmd_t;
+
+/**
+ * \brief Set Table State command packet structure
+ *
+ * For command details see #FM_SET_TABLE_STATE_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_TableIndexAndState_Payload_t Payload; /** \brief Command Payload */
+} FM_SetTableStateCmd_t;
+
+/**
+ * \brief Set Permissions for a file
+ *
+ * For command details see #FM_SET_PERMISSIONS_CC
+ */
+typedef struct
+{
+ CFE_MSG_CommandHeader_t CommandHeader; /** \brief Command header */
+ FM_FilenameAndMode_Payload_t Payload;
+} FM_SetPermissionsCmd_t;
+
+/**\}*/
+
+/* Telemetry Packets */
+
+/**
+ * \defgroup cfsfmtlmstructs CFS File Manager Telemetry Structures
+ * \{
+ */
+
+/**
+ * \brief Get Directory Listing telemetry packet
+ */
+typedef struct
+{
+ CFE_MSG_TelemetryHeader_t TelemetryHeader; /** \brief Telemetry Header */
+ FM_DirListPkt_Payload_t Payload; /** \brief Telemetry Payload */
+} FM_DirListPkt_t;
+
+/**
+ * \brief Get File Info telemetry packet
+ */
+typedef struct
+{
+ CFE_MSG_TelemetryHeader_t TelemetryHeader; /** \brief Telemetry Header */
+ FM_FileInfoPkt_Payload_t Payload; /** \brief Telemetry Payload */
+} FM_FileInfoPkt_t;
+
+/**
+ * \brief Get Open Files telemetry packet
+ */
+typedef struct
+{
+ CFE_MSG_TelemetryHeader_t TelemetryHeader; /** \brief Telemetry Header */
+ FM_OpenFilesPkt_Payload_t Payload; /** \brief Telemetry Payload */
+} FM_OpenFilesPkt_t;
+
+/**
+ * \brief Monitor filesystem telemetry packet
+ */
+typedef struct
+{
+ CFE_MSG_TelemetryHeader_t TelemetryHeader; /** \brief Telemetry Header */
+ FM_MonitorReportPkt_Payload_t Payload; /** \brief Telemetry Payload */
+} FM_MonitorReportPkt_t;
+
+/**
+ * \brief Housekeeping telemetry packet
+ */
+typedef struct
+{
+ CFE_MSG_TelemetryHeader_t TelemetryHeader; /** \brief Telemetry Header */
+ FM_HkTlm_Payload_t Payload; /** \brief Telemetry Payload */
+} FM_HkTlm_t;
+
+/**\}*/
+
+#endif /* DEFAULT_FM_MSGSTRUCT_H */
\ No newline at end of file
diff --git a/fsw/inc/fm_perfids.h b/config/default_fm_perfids.h
similarity index 77%
rename from fsw/inc/fm_perfids.h
rename to config/default_fm_perfids.h
index 43484cf..c6115d9 100644
--- a/fsw/inc/fm_perfids.h
+++ b/config/default_fm_perfids.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,11 +20,11 @@
* @file
* Specification for the CFS File Manager (FM) Application Performance IDs
*/
-#ifndef FM_PERFIDS_H
-#define FM_PERFIDS_H
+#ifndef DEFAULT_FM_PERFIDS_H
+#define DEFAULT_FM_PERFIDS_H
/**
- * \defgroup cfsfmmissioncfg CFS File Manager Mission Configuration
+ * \defgroup cfsfmperfids CFS File Manager Performance Monitor IDs
* \{
*/
@@ -34,4 +33,4 @@
/**\}*/
-#endif
+#endif /* DEFAULT_FM_PERFIDS_H */
\ No newline at end of file
diff --git a/config/default_fm_platform_cfg.h b/config/default_fm_platform_cfg.h
new file mode 100644
index 0000000..6ea08dd
--- /dev/null
+++ b/config/default_fm_platform_cfg.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
+ * Specification for the CFS File Manager constants that can
+ * be configured from one platform to another.
+ * This file is maintained for backward compatibility.
+ */
+
+#ifndef DEFAULT_FM_PLATFORM_CFG_H
+#define DEFAULT_FM_PLATFORM_CFG_H
+
+#include "fm_mission_cfg.h"
+#include "fm_internal_cfg.h"
+
+#endif /* DEFAULT_FM_PLATFORM_CFG_H */
\ No newline at end of file
diff --git a/config/default_fm_tbl.h b/config/default_fm_tbl.h
new file mode 100644
index 0000000..021d7b4
--- /dev/null
+++ b/config/default_fm_tbl.h
@@ -0,0 +1,54 @@
+/************************************************************************
+ * 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 File Manager (FM) table structures
+ *
+ * @note
+ * Constants and enumerated types related to these table structures
+ * are defined in fm_tbldefs.h.
+ */
+
+#ifndef DEFAULT_FM_TBL_H
+#define DEFAULT_FM_TBL_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "fm_tbldefs.h"
+#include "fm_tblstruct.h"
+
+/**
+ * \brief Table Data Validation Error Code
+ *
+ * \par Description:
+ * Table data is verified during the table load process. Should
+ * the validation process fail, this value will be returned by
+ * FM to cFE Table Services and displayed in an event message.
+ *
+ * \par Limits:
+ * FM requires that this value be defined, but otherwise places
+ * no limits on the definition. Refer to cFE Table Services
+ * for limits related to error return values.
+ */
+#define FM_TABLE_VALIDATION_ERR (-1)
+
+
+#endif /* DEFAULT_FM_TBL_H */
\ No newline at end of file
diff --git a/config/default_fm_tbldefs.h b/config/default_fm_tbldefs.h
new file mode 100644
index 0000000..2b35369
--- /dev/null
+++ b/config/default_fm_tbldefs.h
@@ -0,0 +1,102 @@
+/************************************************************************
+ * 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 File Manager (FM) table related
+ * constant definitions.
+ *
+ * @note
+ * These Macro definitions have been put in this file (instead of
+ * fm_tbl.h)
+ */
+
+#ifndef DEFAULT_FM_TBLDEFS_H
+#define DEFAULT_FM_TBLDEFS_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "cfe.h"
+
+/* ======== */
+/* Typedefs */
+/* ======== */
+
+typedef enum
+{
+ /**
+ * Table entry is not used, these entries are ignored
+ */
+ FM_MonitorTableEntry_Type_UNUSED = 0,
+
+ /**
+ * Monitor the free space on given volume
+ *
+ * The given path will be passed to OS_FileSysStatVolume() and the results
+ * will be reported in the generated TLM entry.
+ */
+ FM_MonitorTableEntry_Type_VOLUME_FREE_SPACE = 1,
+
+ /**
+ * Estimate the sum of space used by files within specified directory
+ *
+ * The given path will be opened as a directory. The size of each regular
+ * file present in that directory will be summed to produce an estimate of the
+ * total space associated with that directory.
+ *
+ * Note that this yields only an estimate, as there can be discrepancies
+ * between the file size as observed by this method and the actual disk blocks
+ * used by a given file.
+ */
+ FM_MonitorTableEntry_Type_DIRECTORY_ESTIMATE = 2
+} FM_MonitorTableEntryType_Enum_t;
+
+/* ======== */
+/* Payloads */
+/* ======== */
+
+/**
+ * \brief Monitor table entry
+ */
+typedef struct
+{
+ /**
+ * Table entry type.
+ *
+ * This should be one of the enumeration values in FM_MonitorTableEntryType_Enum_t.
+ * It is defined as a uint8 in this table to ensure a consistent size.
+ */
+ uint8_t Type;
+
+ /**
+ * Boolean flag indicating whether this entry is active or not
+ */
+ uint8_t Enabled;
+
+ /**
+ * Location to monitor
+ *
+ * The interpretation of this string depends on Type
+ * See description of the FM_MonitorTableEntryType_Enum_t for how this is to be set
+ */
+ char Name[CFE_MISSION_MAX_PATH_LEN];
+} FM_MonitorTableEntry_t;
+
+#endif /* DEFAULT_FM_TBLDEFS_H */
\ No newline at end of file
diff --git a/config/default_fm_tblstruct.h b/config/default_fm_tblstruct.h
new file mode 100644
index 0000000..2001075
--- /dev/null
+++ b/config/default_fm_tblstruct.h
@@ -0,0 +1,56 @@
+/************************************************************************
+ * 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 File Manager (FM) table structures
+ *
+ * Provides default definitions for HK table structures
+ *
+ * @note This file may be overridden/superceded by mission-provided defintions
+ * either by overriding this header or by generating definitions from a command/data
+ * dictionary tool.
+ */
+
+#ifndef DEFAULT_FM_TBLSTRUCT_H
+#define DEFAULT_FM_TBLSTRUCT_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "fm_interface_cfg.h"
+#include "fm_tbldefs.h"
+
+/* ====== */
+/* Macros */
+/* ====== */
+
+/* ================== */
+/* Table Structure(s) */
+/* ================== */
+
+/**
+ * \brief Get Free Space table definition
+ */
+typedef struct
+{
+ FM_MonitorTableEntry_t Entries[FM_TABLE_ENTRY_COUNT]; /** \brief One entry for each monitor */
+} FM_MonitorTable_t;
+
+#endif /* DEFAULT_FM_TBLSTRUCT_H */
\ No newline at end of file
diff --git a/config/default_fm_topicid_values.h b/config/default_fm_topicid_values.h
new file mode 100644
index 0000000..277001f
--- /dev/null
+++ b/config/default_fm_topicid_values.h
@@ -0,0 +1,29 @@
+/************************************************************************
+ * 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
+ * File Manager (FM) Application Topic IDs
+ */
+
+#ifndef DEFAULT_FM_TOPICIDS_VALUES_H
+#define DEFAULT_FM_TOPICIDS_VALUES_H
+
+#define FM_MISSION_TIDVAL(x) DEFAULT_FM_MISSION_##x##_TOPICID
+
+#endif /* DEFAULT_FM_TOPICIDS_VALUES_H */
\ No newline at end of file
diff --git a/config/eds_fm_extern_typedefs.h b/config/eds_fm_extern_typedefs.h
new file mode 100644
index 0000000..c248114
--- /dev/null
+++ b/config/eds_fm_extern_typedefs.h
@@ -0,0 +1,44 @@
+/************************************************************************
+ * 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.
+ ************************************************************************/
+
+#ifndef EDS_FM_EXTERN_TYPEDEFS_H
+#define EDS_FM_EXTERN_TYPEDEFS_H
+
+#include "common_types.h"
+#include "fm_eds_typedefs.h"
+
+#define FM_NAME_IS_INVALID EdsLabel_FM_FileNameStates_IS_INVALID
+#define FM_NAME_IS_NOT_IN_USE EdsLabel_FM_FileNameStates_IS_NOT_IN_USE
+#define FM_NAME_IS_FILE_OPEN EdsLabel_FM_FileNameStates_IS_FILE_OPEN
+#define FM_NAME_IS_FILE_CLOSED EdsLabel_FM_FileNameStates_IS_FILE_CLOSED
+#define FM_NAME_IS_DIRECTORY EdsLabel_FM_FileNameStates_IS_DIRECTORY
+
+#define FM_FILE_CLOSED EdsLabel_FM_FileStates_FILE_CLOSED
+#define FM_FILE_EXISTS EdsLabel_FM_FileStates_FILE_EXISTS
+#define FM_FILE_NOEXIST EdsLabel_FM_FileStates_FILE_NOEXIST
+#define FM_FILE_NOTOPEN EdsLabel_FM_FileStates_FILE_NOTOPEN
+#define FM_DIR_EXISTS EdsLabel_FM_FileStates_DIR_EXISTS
+#define FM_DIR_NOEXIST EdsLabel_FM_FileStates_DIR_NOEXIST
+
+#define FM_TABLE_ENTRY_DISABLED EdsLabel_FM_TableEntryState_DISABLED
+#define FM_TABLE_ENTRY_ENABLED EdsLabel_FM_TableEntryState_ENABLED
+
+
+
+
+#endif /* EDS_FM_EXTERN_TYPEDEFS_H */
\ No newline at end of file
diff --git a/config/eds_fm_fcncode_values.h b/config/eds_fm_fcncode_values.h
new file mode 100644
index 0000000..ec59f36
--- /dev/null
+++ b/config/eds_fm_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
+ * Specification for the CFE File Manager (FM) 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_FM_FCNCODE_VALUES_H
+#define EDS_FM_FCNCODE_VALUES_H
+
+#include "fm_eds_cc.h"
+
+/************************************************************************
+ * Macro Definitions
+ ************************************************************************/
+
+#define FM_CCVAL(x) EDS_CONTAINER_FM_##x##_CC
+
+#endif
diff --git a/config/eds_fm_interface_cfg_values.h b/config/eds_fm_interface_cfg_values.h
new file mode 100644
index 0000000..6a99d93
--- /dev/null
+++ b/config/eds_fm_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
+ * FM 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 definitions
+ * either by overriding this header or by generating definitions from a command/data
+ * dictionary tool.
+ */
+#ifndef EDS_FM_INTERFACE_CFG_VALUES_H
+#define EDS_FM_INTERFACE_CFG_VALUES_H
+
+#include "fm_eds_designparameters.h"
+
+#define FM_INTERFACE_CFGVAL(x) EdsParam_FM_##x
+
+#endif /* EDS_FM_INTERFACE_CFG_VALUES_H */
\ No newline at end of file
diff --git a/config/eds_fm_msgdefs.h b/config/eds_fm_msgdefs.h
new file mode 100644
index 0000000..20a94b1
--- /dev/null
+++ b/config/eds_fm_msgdefs.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
+ * Specification for the FM command and telemetry
+ * message payload and constant definitions.
+ */
+#ifndef EDS_FM_MSGDEFS_H
+#define EDS_FM_MSGDEFS_H
+
+#include "fm_eds_typedefs.h"
+#include "fm_fcncodes.h"
+
+#endif
\ No newline at end of file
diff --git a/config/eds_fm_msgstruct.h b/config/eds_fm_msgstruct.h
new file mode 100644
index 0000000..440d8cc
--- /dev/null
+++ b/config/eds_fm_msgstruct.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
+ * Specification for the FM command and telemetry
+ * message data types.
+ */
+#ifndef EDS_FM_MSGSTRUCT_H
+#define EDS_FM_MSGSTRUCT_H
+
+/************************************************************************
+ * Includes
+ ************************************************************************/
+#include "fm_eds_typedefs.h"
+
+#endif /* EDS_FM_MSGSTRUCT_H */
\ No newline at end of file
diff --git a/config/eds_fm_tbldefs.h b/config/eds_fm_tbldefs.h
new file mode 100644
index 0000000..a37f1e7
--- /dev/null
+++ b/config/eds_fm_tbldefs.h
@@ -0,0 +1,33 @@
+/************************************************************************
+ * 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 FM table related
+ * constant definitions.
+ */
+#ifndef EDS_FM_TBLDEFS_H
+#define EDS_FM_TBLDEFS_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "fm_eds_typedefs.h"
+
+#endif
\ No newline at end of file
diff --git a/config/eds_fm_tblstruct.h b/config/eds_fm_tblstruct.h
new file mode 100644
index 0000000..c26a0d0
--- /dev/null
+++ b/config/eds_fm_tblstruct.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
+ * Specification for the FM table structures
+ */
+#ifndef EDS_FM_TBLSTRUCT_H
+#define EDS_FM_TBLSTRUCT_H
+
+/************************************************************************
+ * Includes
+ ************************************************************************/
+#include "fm_eds_typedefs.h"
+
+#endif /* EDS_FM_TBLSTRUCT_H */
\ No newline at end of file
diff --git a/config/eds_fm_topicid_values.h b/config/eds_fm_topicid_values.h
new file mode 100644
index 0000000..448156f
--- /dev/null
+++ b/config/eds_fm_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
+ * Specification for the FM topic ID values
+ */
+#ifndef EDS_FM_TOPICID_VALUES_H
+#define EDS_FM_TOPICID_VALUES_H
+
+#include "cfe_mission_eds_designparameters.h"
+
+#define FM_MISSION_TIDVAL(x) EdsParam_CFE_MISSION_FM_##x##_TOPICID
+
+#endif /* EDS_FM_TOPICID_VALUES_H */
\ No newline at end of file
diff --git a/docs/dox_src/CMakeLists.txt b/docs/dox_src/CMakeLists.txt
index 28bb6cd..1c9dff7 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(FM_DOCS NONE)
# generate the configuration files
diff --git a/docs/dox_src/cfs_fm.dox b/docs/dox_src/cfs_fm.dox
index 6b3cc38..7e54862 100644
--- a/docs/dox_src/cfs_fm.dox
+++ b/docs/dox_src/cfs_fm.dox
@@ -177,10 +177,10 @@
The directory listing file is written as a binary file and contains a cFE file header at the top of
the file contiguously followed by a directory listing status data structure containing an echo of the
- command specified directory name (#OS_MAX_PATH_LEN), directory size in bytes (uint32), total number of
+ command specified directory name (#CFE_MISSION_MAX_PATH_LEN), directory size in bytes (uint32), total number of
file contained in the directory (uint32), and the number of file names written in the directory listing
file (uint32). The directory listing is then written contiguously one entry at a time. Each entry in
- the directory listing includes for each file in the directory, the name of the file(#OS_MAX_PATH_LEN),
+ the directory listing includes for each file in the directory, the name of the file(#CFE_MISSION_MAX_PATH_LEN),
file size in bytes (uint32), and last modification time of the file (uint32). File systems use specific
time epochs for their time tagging of files. Since spacecraft systems rarely use an epoch that matches
a particular file system, a function is used to convert the file system time (in seconds) to spacecraft
@@ -268,7 +268,7 @@
Is there a limit to the number of files that can be open at one time?
There are two levels of limit to the number of open files. The first limit
- is defined by the CFE-OSAL configuration element #OS_MAX_NUM_OPEN_FILES and
+ is defined by the CFE-OSAL configuration element #CFE_MISSION_MAX_NUM_FILES and
must be less than or equal to the second limit which is a value defined in
a manner specific to the selected operating system. Note also that certain
directory access functions (reading directory entries, etc) require opening
diff --git a/docs/dox_src/fm-common.doxyfile.in b/docs/dox_src/fm-common.doxyfile.in
index 85ffcb7..47b9887 100644
--- a/docs/dox_src/fm-common.doxyfile.in
+++ b/docs/dox_src/fm-common.doxyfile.in
@@ -4,6 +4,7 @@
# Include front material followed by everything in fsw
INPUT += @fm_MISSION_DIR@/docs/dox_src/cfs_fm.dox
+INPUT += @fm_MISSION_DIR@/config
INPUT += @fm_MISSION_DIR@/fsw
IMAGE_PATH += @fm_MISSION_DIR@/docs/dox_src
diff --git a/eds/fm.xml b/eds/fm.xml
new file mode 100644
index 0000000..c702d69
--- /dev/null
+++ b/eds/fm.xml
@@ -0,0 +1,1325 @@
+
+
+
+
+
+
+
+
+
+
+ Monitor the free space on given volume
+ The given path will be passed to OS_FileSysStatVolume() and the results
+ will be reported in the generated TLM entry.
+
+
+
+
+ Estimate the sum of space used by files within specified directory
+ The given path will be opened as a directory. The size of each regular
+ file present in that directory will be summed to produce an estimate of the
+ total space associated with that directory.
+ Note that this yields only an estimate, as there can be discrepancies
+ between the file size as observed by this method and the actual disk blocks
+ used by a given file.
+
+
+
+
+
+
+
+
+ Table entry type.
+ This should be one of the enumeration values in FM_MonitorTableEntry_Type_t.
+ It is defined as a uint8 in this table to ensure a consistent size.
+
+
+
+
+
+ Location to monitor
+ The interpretation of this string depends on Type
+ See description of the FM_MonitorTableEntry_Type_t for how this is to be set
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Single directory command payload structure
+ Used by #FM_DELETE_ALL_FILES_CC, #FM_CREATE_DIRECTORY_CC, #FM_DELETE_DIRECTORY_CC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Filename and CRC command payload structure
+ Used by #FM_GET_FILE_INFO_CC
+
+
+
+
+
+
+
+
+ File name and mode command payload structure
+ Used by #FM_SET_PERMISSIONS_CC
+
+
+
+
+
+
+
+
+ Get Directory and output to file command payload
+ Contains a directory and output file name, with optional flags
+ Used by #FM_GET_DIR_LIST_FILE_CC
+
+
+
+
+
+
+
+
+
+ Get Directory and output to message command payload
+ Contains a directory and position offset, with optional flags
+ Used by #FM_GET_DIR_LIST_PKT_CC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Copy/Move File command payload structure
+ Contains a source and target file name and an overwrite flag
+ Used by #FM_COPY_FILE_CC, #FM_MOVE_FILE_CC
+
+
+
+
+
+
+
+
+
+ Single filename command payload structure
+ Used by #FM_DELETE_FILE_CC
+
+
+
+
+
+
+
+ Source and Target filename command payload structure
+ Used by #FM_RENAME_FILE_CC, #FM_DECOMPRESS_FILE_CC
+
+
+
+
+
+
+
+
+ Table Index and State command payload structure
+ Used by #FM_SET_TABLE_STATE_CC
+
+
+
+
+
+
+
+
+ Two source, one target filename command payload structure
+ Used by #FM_CONCAT_FILES_CC
+
+
+
+
+
+
+
+
+
+
+
+ \fmcmd No Operation
+
+ \par Description
+ This command performs no operation other than to generate an
+ informational event that also contains software version data.
+ The command is most often used as a general aliveness test by
+ demonstrating that the application can receive commands and
+ generate telemetry.
+
+ \par Command Packet Structure
+ #FM_NoopCmd_t
+
+ \par Command Success Verification
+ - Informational event #FM_NOOP_INF_EID will be sent
+ - Command success counter /FM_CMDPC will increment
+
+ \par Command Error Conditions
+ - Invalid command packet length
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC will increment
+ - Error event #FM_NOOP_PKT_ERR_EID will be sent
+
+ \par Criticality
+ - There are no critical issues related to this command.
+
+
+
+
+
+
+
+ \fmcmd Reset Counters
+
+ \par Description
+ This command resets the following housekeeping telemetry:
+ - Command success counter /FM_CMDPC
+ - Command error counter /FM_CMDEC
+ - Command warning counter /FM_WarnCtr
+ - Child cmd success counter /FM_ChildCMDPC
+ - Child cmd error counter /FM_ChildCMDEC
+ - Child cmd warning counter /FM_ChildWarnCtr
+
+ \fmcmdmnemonic \FM_ResetCtrs
+
+ \par Command Packet Structure
+ #FM_ResetCmd_t
+
+ \par Command Success Verification
+ - Command counters will be set to zero (see description)
+ - Debug event #FM_RESET_CMD_EID will be sent
+
+ \par Command Error Conditions
+ - Invalid command packet length
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC will increment
+ - Error event #FM_RESET_PKT_ERR_EID will be sent
+
+ \par Criticality
+ - There are no critical issues related to this command.
+
+
+
+
+
+
+
+ \fmcmd Copy File
+
+ \par Description
+ This command copies the source file to the target file.
+ The source must be an existing file and the target must not be a
+ directory name.
+ If the Overwrite command argument is TRUE, then the target may be
+ an existing file, provided that the file is closed.
+ If the Overwrite command argument is FALSE, then the target must not exist.
+ The source and target may be on different file systems.
+ Because of the possibility that this command might take a very long time
+ to complete, command argument validation will be done immediately but
+ copying the file will be performed by a lower priority child task.
+ As such, the command result for this function only refers to the result
+ of command argument verification and being able to place the command on
+ the child task interface queue.
+
+ \fmcmdmnemonic \FM_Copy
+
+ \par Command Packet Structure
+ #FM_CopyFileCmd_t
+
+ \par Command Success Verification
+ - Command success counter /FM_CMDPC will increment after validation
+ - Child cmd success counter /FM_ChildCMDPC will increment after completion
+ - Debug event #FM_COPY_CMD_EID will be sent
+
+ \par Command Error Conditions
+ - Invalid command packet length
+ - Overwrite is not TRUE (one) or FALSE (zero)
+ - Source filename is invalid
+ - Source file does not exist
+ - Source filename is a directory
+ - Target filename is invalid
+ - Target file already exists
+ - Target filename is a directory
+ - Child task interface queue is full
+ - Child task interface logic is broken
+ - Failure of OS copy function
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC may increment
+ - Child cmd error counter /FM_ChildCMDEC may increment
+ - Error event #FM_COPY_PKT_ERR_EID may be sent
+ - Error event #FM_COPY_OVR_ERR_EID may be sent
+ - Error event #FM_COPY_SRC_ERR_EID may be sent
+ - Error event #FM_COPY_TGT_ERR_EID may be sent
+ - Error event #FM_COPY_CHILD_ERR_EID may be sent
+ - Error event #FM_COPY_OS_ERR_EID may be sent
+
+ \par Criticality
+ Copying files may consume file space needed by other
+ critical tasks. Also, copying very large files may
+ consume more CPU resource than anticipated.
+
+ \sa #FM_MOVE_CC, #FM_RENAME_CC
+
+
+
+
+
+
+
+
+
+
+ \fmcmd Move File
+
+ \par Description
+ This command moves the source file to the target file.
+ The source must be an existing file and the target must not be a
+ directory name.
+ If the Overwrite command argument is TRUE, then the target may be
+ an existing file, provided that the file is closed.
+ If the Overwrite command argument is FALSE, then the target must not exist.
+ Source and target must both be on the same file system.
+ The move command does not actually move any file data.
+ The command modifies the file system directory structure to
+ create a different file entry for the same file data.
+ If the user wishes to move a file across file systems, he
+ must first copy the file and then delete the original.
+
+ \fmcmdmnemonic \FM_Move
+
+ \par Command Packet Structure
+ #FM_MoveFileCmd_t
+
+ \par Command Success Verification
+ - Command success counter /FM_CMDPC will increment
+ - Debug event #FM_MOVE_CMD_EID will be sent
+
+ \par Command Error Conditions
+ - Invalid command packet length
+ - Overwrite is not TRUE (one) or FALSE (zero)
+ - Source filename is invalid
+ - Source file does not exist
+ - Source filename is a directory
+ - Target filename is invalid
+ - Target file already exists
+ - Target filename is a directory
+ - Failure of OS move function
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC will increment
+ - Error event #FM_MOVE_PKT_ERR_EID may be sent
+ - Error event #FM_MOVE_OVR_ERR_EID may be sent
+ - Error event #FM_MOVE_SRC_ERR_EID may be sent
+ - Error event #FM_MOVE_TGT_ERR_EID may be sent
+ - Error event #FM_MOVE_OS_ERR_EID may be sent
+
+ \par Criticality
+ - There are no critical issues related to this command.
+
+ \sa #FM_COPY_CC, #FM_RENAME_CC
+
+
+
+
+
+
+
+
+
+
+ \fmcmd Rename File
+
+ \par Description
+ This command renames the source file to the target file.
+ Source must be an existing file and target must not exist.
+ Source and target must both be on the same file system.
+ The rename command does not actually move any file data.
+ The command modifies the file system directory structure to
+ create a different file entry for the same file data.
+ If the user wishes to rename a file across file systems, he
+ must first copy the file and then delete the original.
+
+ \fmcmdmnemonic \FM_Rename
+
+ \par Command Packet Structure
+ #FM_RenameFileCmd_t
+
+ \par Command Success Verification
+ - Command success counter /FM_CMDPC will increment
+ - Debug event #FM_RENAME_CMD_EID will be sent
+
+ \par Command Error Conditions
+ - Invalid command packet length
+ - Source filename is invalid
+ - Source file does not exist
+ - Source filename is a directory
+ - Target filename is invalid
+ - Target file already exists
+ - Target filename is a directory
+ - Failure of OS rename function
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC will increment
+ - Error event #FM_RENAME_PKT_ERR_EID may be sent
+ - Error event #FM_RENAME_SRC_ERR_EID may be sent
+ - Error event #FM_RENAME_TGT_ERR_EID may be sent
+ - Error event #FM_RENAME_OS_ERR_EID may be sent
+
+ \par Criticality
+ - There are no critical issues related to this command.
+
+ \sa #FM_COPY_CC, #FM_MOVE_CC
+
+
+
+
+
+
+
+
+
+
+ \fmcmd Delete File
+
+ \par Description
+ This command deletes the source file.
+ Source must be an existing file that is not open.
+
+ \fmcmdmnemonic \FM_Delete
+
+ \par Command Packet Structure
+ #FM_DeleteFileCmd_t
+
+ \par Command Success Verification
+ - Command success counter /FM_CMDPC will increment
+ - Debug event #FM_DELETE_CMD_EID will be sent
+
+ \par Command Error Conditions
+ - Invalid command packet length
+ - Filename is invalid
+ - File does not exist
+ - File is open
+ - Filename is a directory
+ - Failure of OS delete function
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC will increment
+ - Error event #FM_DELETE_PKT_ERR_EID may be sent
+ - Error event #FM_DELETE_SRC_ERR_EID may be sent
+ - Error event #FM_DELETE_OS_ERR_EID may be sent
+
+ \par Criticality
+ The FM application does not provide a method to restore deleted
+ files. Critical data may be lost when deleting files.
+
+ \sa #FM_DELETE_ALL_CC, #FM_DELETE_DIR_CC
+
+
+
+
+
+
+
+
+
+
+ \fmcmd Delete All Files
+
+ \par Description
+ This command deletes all files in the source directory.
+ Source must be an existing directory.
+ Open files and sub-directories are not deleted.
+ Because of the possibility that this command might take a very long time
+ to complete, command argument validation will be done immediately but
+ reading the directory and deleting each file will be performed by a
+ lower priority child task.
+ As such, the return value for this function only refers to the result
+ of command argument verification and being able to place the command on
+ the child task interface queue.
+
+ \fmcmdmnemonic \FM_DeleteAll
+
+ \par Command Packet Structure
+ #FM_DeleteAllCmd_t
+
+ \par Command Success Verification
+ - Command success counter /FM_CMDPC will increment after validation
+ - Child cmd success counter /FM_ChildCMDPC will increment after completion
+ - Debug event #FM_DELETE_ALL_CMD_EID will be sent
+
+ \par Command Error Conditions
+ - Invalid command packet length
+ - Invalid directory name
+ - Directory does not exist
+ - Directory name + separator + filename is too long
+ - Failure of OS delete function
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC may increment
+ - Child cmd error counter /FM_ChildCMDEC may increment
+ - Error event #FM_DELETE_ALL_PKT_ERR_EID may be sent
+ - Error event #FM_DELETE_ALL_SRC_ERR_EID may be sent
+ - Error event #FM_DELETE_ALL_CHILD_ERR_EID may be sent
+ - Error event #FM_DELETE_ALL_OS_ERR_EID may be sent
+
+ \par Command Warning Conditions
+ - Directory entry is not a file (sub-directory)
+ - Directory entry is an open file
+
+ \par Command Warning Verification
+ - Warning counter /FM_WarnCtr will increment
+ - Informational event #FM_DELETE_ALL_WARNING_EID will be sent
+
+ \par Criticality
+ The FM application does not provide a method to restore deleted
+ files. Critical data may be lost when deleting files. Also,
+ deleting a very large number of files may consume more CPU resource
+ than anticipated.
+
+ \sa #FM_DELETE_CC, #FM_DELETE_DIR_CC
+
+
+
+
+
+
+
+
+
+
+ \fmcmd Decompress File
+
+ \par Description
+ This command invokes a CFE function to decompress the source
+ file into the target file.
+ Source must be an existing file and target must not exist.
+ Source and target may be on different file systems.
+ Because of the possibility that this command might take a very long time
+ to complete, command argument validation will be done immediately but
+ decompressing the source file into the target file will be performed by
+ a lower priority child task.
+ As such, the return value for this function only refers to the result
+ of command argument verification and being able to place the command on
+ the child task interface queue.
+
+ \fmcmdmnemonic \FM_Decompress
+
+ \par Command Packet Structure
+ #FM_DecompressCmd_t
+
+ \par Command Success Verification
+ - Command success counter /FM_CMDPC will increment after validation
+ - Child cmd success counter /FM_ChildCMDPC will increment after completion
+ - Debug event #FM_DECOM_CMD_EID will be sent
+
+ \par Command Error Conditions
+ - Invalid command packet length
+ - Invalid source filename
+ - Source file does not exist
+ - Invalid target filename
+ - Target file does exist
+ - Failure of CFE_FS_Decompress function
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC may increment
+ - Child cmd error counter /FM_ChildCMDEC may increment
+ - Error event #FM_DECOM_PKT_ERR_EID may be sent
+ - Error event #FM_DECOM_SRC_ERR_EID may be sent
+ - Error event #FM_DECOM_TGT_ERR_EID may be sent
+ - Error event #FM_DECOM_CFE_ERR_EID may be sent
+
+ \par Criticality
+ Decompressing a very large file may consume more CPU resource than
+ anticipated.
+
+
+
+
+
+
+
+
+
+
+ \fmcmd Concatenate Files
+
+ \par Description
+ This command concatenates two source files into the target
+ file.
+ Sources must both be existing files and target must not exist.
+ Sources and target may be on different file systems.
+ Because of the possibility that this command might take a very long time
+ to complete, command argument validation will be done immediately but
+ copying the first source file to the target file and then appending the
+ second source file to the target file will be performed by a lower priority
+ child task.
+ As such, the return value for this function only refers to the result
+ of command argument verification and being able to place the command on
+ the child task interface queue.
+
+ \fmcmdmnemonic \FM_Concat
+
+ \par Command Packet Structure
+ #FM_ConcatCmd_t
+
+ \par Command Success Verification
+ - Command success counter /FM_CMDPC will increment after validation
+ - Child cmd success counter /FM_ChildCMDPC will increment after completion
+ - Debug event #FM_CONCAT_CMD_EID will be sent
+
+ \par Command Error Conditions
+ - Invalid command packet length
+ - Invalid source filename
+ - Source file does not exist
+ - Invalid target filename
+ - Target file does exist
+ - Failure of OS function (copy, open, read, write, etc.)
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC may increment
+ - Child cmd error counter /FM_ChildCMDEC may increment
+ - Error event #FM_CONCAT_PKT_ERR_EID may be sent
+ - Error event #FM_CONCAT_SRC1_ERR_EID may be sent
+ - Error event #FM_CONCAT_SRC2_ERR_EID may be sent
+ - Error event #FM_CONCAT_TGT_ERR_EID may be sent
+ - Error event #FM_CONCAT_OS_ERR_EID may be sent
+
+ \par Criticality
+ Concatenating very large files may consume more CPU resource
+ than anticipated.
+
+ \sa #FM_COPY_CC
+
+
+
+
+
+
+
+
+
+
+ \fmcmd Get File Information
+
+ \par Description
+ This command creates an FM file information telemetry packet
+ for the source file.
+ The file information packet includes status that indicates
+ whether source is a file that is open or closed, a directory,
+ or does not exist.
+ The file information data also includes a CRC, file size,
+ last modify time and the source name.
+ Because of the possibility that this command might take a very long time
+ to complete, command argument validation will be done immediately but
+ collecting the status data and calculating the CRC will be performed by
+ a lower priority child task.
+ As such, the return value for this function only refers to the result
+ of command argument verification and being able to place the command on
+ the child task interface queue.
+
+ \fmcmdmnemonic \FM_GetFileInfo
+
+ \par Command Packet Structure
+ #FM_GetFileInfoCmd_t
+
+ \par Command Success Verification
+ - Command success counter /FM_CMDPC will increment after validation
+ - Child cmd success counter /FM_ChildCMDPC will increment after completion
+ - Debug event #FM_GET_FILE_INFO_CMD_EID will be sent
+
+ \par Command Error Conditions
+ - Invalid command packet length
+ - Invalid source filename
+ - Failure of OS_stat function
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC may increment
+ - Child cmd error counter /FM_ChildCMDEC may increment
+ - Error event #FM_GET_FILE_INFO_PKT_ERR_EID may be sent
+ - Error event #FM_GET_FILE_INFO_SRC_ERR_EID may be sent
+ - Error event #FM_GET_FILE_INFO_CHILD_ERR_EID may be sent
+
+ \par Criticality
+ Calculating the CRC for a very large file may consume more CPU resource than
+ anticipated.
+
+ \sa #FM_GET_OPEN_FILES_CC, #FM_GET_DIR_FILE_CC, #FM_GET_DIR_PKT_CC
+
+
+
+
+
+
+
+
+
+
+ \fmcmd Get Open Files Listing
+
+ \par Description
+ This command creates an FM open files telemetry packet.
+ The open files packet includes the number of open files and
+ for each open file, the name of the file and the name of the
+ application that has the file opened.
+
+ \fmcmdmnemonic \FM_GetOpenFiles
+
+ \par Command Packet Structure
+ #FM_GetOpenFilesCmd_t
+
+ \par Command Success Verification
+ - Command success counter /FM_CMDPC will increment
+ - Debug event #FM_GET_OPEN_FILES_CMD_EID will be sent
+
+ \par Command Error Conditions
+ - Invalid command packet length
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC will increment
+ - Error event #FM_GET_OPEN_FILES_PKT_ERR_EID will be sent
+
+ \par Criticality
+ - There are no critical issues related to this command.
+
+ \sa #FM_GET_FILE_INFO_CC, #FM_GET_DIR_FILE_CC, #FM_GET_DIR_PKT_CC
+
+
+
+
+
+
+
+ \fmcmd Create Directory
+
+ \par Description
+ This command creates the source directory.
+ Source must be a valid directory name that does not exist.
+
+ \fmcmdmnemonic \FM_CreateDir
+
+ \par Command Packet Structure
+ #FM_CreateDirCmd_t
+
+ \par Command Success Verification
+ - Command success counter /FM_CMDPC will increment
+ - Debug event #FM_CREATE_DIR_CMD_EID will be sent
+
+ \par Command Error Conditions
+ - Invalid command packet length
+ - Invalid directory name
+ - Directory name already exists
+ - Failure of OS_mkdir function
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC will increment
+ - Error event #FM_CREATE_DIR_PKT_ERR_EID may be sent
+ - Error event #FM_CREATE_DIR_SRC_ERR_EID may be sent
+ - Error event #FM_CREATE_DIR_OS_ERR_EID may be sent
+
+ \par Criticality
+ - There are no critical issues related to this command.
+
+ \sa #FM_DELETE_DIR_CC
+
+
+
+
+
+
+
+
+
+
+ \fmcmd Remove Directory
+
+ \par Description
+ This command deletes the source directory, it does
+ not delete the contents of the directory.
+ Source must be a valid directory name that exists.
+
+ \fmcmdmnemonic \FM_DeleteDir
+
+ \par Command Packet Structure
+ #FM_DeleteDirCmd_t
+
+ \par Command Success Verification
+ - Command success counter /FM_CMDPC will increment
+ - Debug event #FM_DELETE_DIR_CMD_EID will be sent
+
+ \par Command Error Conditions
+ - Invalid command packet length
+ - Invalid directory name
+ - Directory does not exist
+ - Directory is not empty
+ - Failure of OS function (OS_opendir, OS_rmdir)
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC will increment
+ - Error event #FM_DELETE_DIR_PKT_ERR_EID may be sent
+ - Error event #FM_DELETE_DIR_SRC_ERR_EID may be sent
+ - Error event #FM_DELETE_DIR_EMPTY_ERR_EID may be sent
+ - Error event #FM_DELETE_DIR_OS_ERR_EID may be sent
+
+ \par Criticality
+ The unexpected loss of a directory may affect a critical
+ tasks ability to store data.
+
+ \sa #FM_CREATE_DIR_CC
+
+
+
+
+
+
+
+
+
+
+ \fmcmd Get Directory Listing to a File
+
+ \par Description
+ This command writes a listing of the contents of the source
+ directory to the target file.
+ If the target filename buffer is empty, then the default
+ target filename #FM_PLATFORM_DIR_LIST_FILE_DEFNAME is used.
+ The command will overwrite a previous copy of the target
+ file, if one exists.
+ Because of the possibility that this command might take a very long time
+ to complete, command argument validation will be done immediately but
+ reading the directory will be performed by a lower priority child task.
+ As such, the return value for this function only refers to the result
+ of command argument verification and being able to place the command on
+ the child task interface queue.
+
+ \fmcmdmnemonic \FM_GetDirFile
+
+ \par Command Packet Structure
+ #FM_GetDirFileCmd_t
+
+ \par Command Success Verification
+ - Command success counter /FM_CMDPC will increment after validation
+ - Child cmd success counter /FM_ChildCMDPC will increment after completion
+ - Debug event #FM_GET_DIR_FILE_CMD_EID will be sent
+
+ \par Command Error Conditions
+ - Invalid command packet length
+ - Invalid source directory name
+ - Source directory does not exist
+ - Directory name + separator is too long
+ - Directory name + directory entry is too long
+ - Invalid target filename
+ - Target file is already open
+ - Failure of OS function (OS_opendir, OS_creat, OS_write)
+
+ \par Command Failure Verification
+ - Command error counter /FM_CMDEC may increment
+ - Child cmd error counter /FM_ChildCMDEC may increment
+ - Error event #FM_GET_DIR_FILE_PKT_ERR_EID may be sent
+ - Error event #FM_GET_DIR_FILE_SRC_ERR_EID may be sent
+ - Error event #FM_GET_DIR_FILE_TGT_ERR_EID may be sent
+ - Error event #FM_GET_DIR_FILE_WARNING_EID may be sent
+ - Error event #FM_GET_DIR_FILE_OS_ERR_EID may be sent
+
+ \par Criticality
+ Reading a directory that contains thousands of files may consume more CPU
+ resource than anticipated.
+
+ \sa #FM_GET_DIR_PKT_CC
+
+
+
+
+
+
+
+
+
+
+ \fmcmd Get Directory Listing to a Packet
+
+ \par Description
+ This command creates a telemetry packet #FM_DirListPkt_t that
+ contains a listing of the entries in the specified directory.
+ Since the packet will likely hold fewer entries than will be
+ possible in a directory, the command also provides an index
+ argument to define which entry in the directory is the first
+ entry reported in the telemetry packet.
+ After reading the directory list and skipping entries until
+ reaching the index of the first entry reported, the remaining
+ entries in the packet are filled sequentially until either
+ the packet is full or until there are no more entries in the
+ directory.
+ The first entry index is zero based - thus, when the first
+ entry index is zero the first directory entry will be the
+ first packet entry.
+ The number of entries per packet #FM_DIR_LIST_PKT_ENTRIES
+ is a platform configuration definition.
+ Because of the possibility that this command might take a very long time
+ to complete, command argument validation will be done immediately but
+ reading the directory will be performed by a lower priority child task.
+ As such, the return value for this function only refers to the result
+ of command argument verification and being able to place the command on
+ the child task interface queue.
+
+ \fmcmdmnemonic \FM_GetDirPkt
+
+ \par Command Packet Structure
+ #FM_GetDirPktCmd_t
+
+ \par Command Verification
+ Successful execution of this command may be verified with
+ the following telemetry:
+ - Command success counter /FM_CMDPC will increment after validation
+ - Child cmd success counter /FM_ChildCMDPC will increment after completion
+ - The #FM_DirListPkt_t telemetry packet will be sent
+ - The #FM_GET_DIR_PKT_CMD_EID debug event will be sent
+
+ \par Error Conditions
+ This command may fail for the following reason(s):
+ - OS error received opening directory
+ - OS error received requesting directory size
+ - OS error received closing directory
+ - Invalid directory pathname received
+ - Command packet length not as expected
+
+ \par Evidence of failure may be found in the following telemetry:
+ - Command error counter /FM_CMDEC may increment
+ - Child cmd error counter /FM_ChildCMDEC may increment
+ - Error event #FM_GET_DIR_PKT_PKT_ERR_EID may be sent
+ - Error event #FM_GET_DIR_PKT_SRC_ERR_EID may be sent
+ - Error event #FM_GET_DIR_PKT_CHILD_ERR_EID may be sent
+ - Error event #FM_GET_DIR_PKT_OS_ERR_EID may be sent
+
+ \par Criticality
+ Reading a directory that contains thousands of files may consume more CPU
+ resource than anticipated.
+
+ \sa #FM_GET_DIR_FILE_CC
+
+
+
+
+
+
+
+
+
+
+ \brief Monitor Filesystem Space
+
+ \par Description
+ This command queries the specified location for each of the
+ enabled entries in the file system monitor table. The data
+ is then placed in a telemetry packet and sent to ground.
+
+ \par Command Packet Structure
+ #FM_MonitorFilesystemSpaceCmd_t
+
+ \par Evidence of success may be found in the following telemetry:
+ - #FM_HkTlm_t.CommandCounter will increment
+ - Debug event #FM_MONITOR_FILESYSTEM_SPACE_CMD_EID will be sent
+ - Telemetry packet #FM_MonitorReportPkt_t will be sent
+
+ \par Error Conditions
+ - Invalid command packet length
+ - Free space table is not loaded
+
+ \par Evidence of failure may be found in the following telemetry:
+ - #FM_HkTlm_t.CommandErrCounter will increment
+ - Error event #FM_GET_FREE_SPACE_PKT_ERR_EID may be sent
+ - Error event #FM_GET_FREE_SPACE_TBL_ERR_EID may be sent
+
+ \par Criticality
+ - There are no critical issues related to this command.
+
+
+
+
+
+
+
+ \fmcmd Set Free Space Table Entry State
+
+ \par Description
+ This command enables or disables a single entry in the FM
+ file system free space table. Only table entries that are
+ currently enabled or disabled may be modified by command.
+ Unused table entries cannot be modified.
+
+ \fmcmdmnemonic \FM_SetTableState
+
+ \par Command Packet Structure
+ #FM_SetTableStateCmd_t
+
+ \par Evidence of success may be found in the following telemetry:
+ - Command success counter /FM_CMDPC will increment
+ - Informational event #FM_SET_TABLE_STATE_CMD_EID will be sent
+
+ \par Error Conditions
+ - Invalid command packet length
+ - FM file system free space table has not yet been loaded
+ - Invalid command argument, table entry index arg is out of range
+ - Invalid command argument, entry state arg is not enable/disable
+ - Invalid current table entry state, entry is unused
+
+ \par Evidence of failure may be found in the following telemetry:
+ - Command error counter /FM_CMDEC will increment
+ - Error event #FM_SET_TABLE_STATE_PKT_ERR_EID may be sent
+ - Error event #FM_SET_TABLE_STATE_TBL_ERR_EID may be sent
+ - Error event #FM_SET_TABLE_STATE_ARG_ERR_EID may be sent
+ - Error event #FM_SET_TABLE_STATE_UNUSED_ERR_EID may be sent
+
+ \par Criticality
+ - There are no critical issues related to this command.
+
+
+
+
+
+
+
+
+
+
+ \fmcmd Delete File (internal)
+
+ \par Description
+ This is a special version of the #FM_DELETE_CC command for
+ use when the command is sent by another application, rather
+ than from the ground. This version of the command will not
+ generate a success event, nor will the command increment the
+ command success counter. The intent is to avoid confusion
+ resulting from telemetry representing the results of delete
+ commands sent by other applications and those sent from the
+ ground. Refer to #FM_DELETE_CC command for use details.
+
+ \sa #FM_DELETE_CC
+
+
+
+
+
+
+
+
+
+
+ \fmcmd Set Permissions of a file
+
+ \par Description
+ This command sets the permissions for a file. This is a direct interface
+ to OS_chmod in the OSAL. OS_chmod accepts a uint32 to set the file's mode.
+ The mode value also contains the type of file (regular or directory, etc) so
+ care should be taken to not change the file type from regular to directory or vice-versa.
+ Examples for a regular file:
+
+ 0100700 (Decimal: 33216) - Read, Write and Execute
+ 0100600 (Decimal: 33152) - Read, and Write
+ 0100400 (Decimal: 33024) - Read Only
+
+ Examples for a directory:
+ 0040700 (Decimal: 16832) - Read, Write and Execute
+ 0040600 (Decimal: 16786) - Read, and Write
+ 0040400 (Decimal: 16640) - Read Only
+
+ S_IFMT 0170000 bit mask for the file type bit field
+ S_IFSOCK 0140000 socket
+ S_IFLNK 0120000 symbolic link
+ S_IFREG 0100000 regular file
+ S_IFBLK 0060000 block device
+ S_IFDIR 0040000 directory
+ S_IFCHR 0020000 character device
+ S_IFIFO 0010000 FIFO
+
+ \fmcmdmnemonic \FM_SetFilePerm
+
+ \par Command Packet Structure
+ #FM_SetPermCmd_t
+
+ \par Error Conditions
+ - Invalid command packet length
+ - Error from call to OS_chmod
+
+ \par Evidence of failure may be found in the following telemetry:
+ - Command error counter /FM_CMDEC will increment
+ - Error event #FM_SET_PERM_ERR_EID may be sent
+ - Error event #FM_SET_PERM_CMD_EID may be sent
+ - Error event #FM_SET_PERM_OS_ERR_EID may be sent
+
+ \par Criticality
+ - There are no critical issues related to this command.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fsw/inc/fm_events.h b/fsw/inc/fm_eventids.h
similarity index 92%
rename from fsw/inc/fm_events.h
rename to fsw/inc/fm_eventids.h
index b8713d2..5b214e6 100644
--- a/fsw/inc/fm_events.h
+++ b/fsw/inc/fm_eventids.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,8 +20,8 @@
* @file
* Specification for the CFS File Manager Event Identifiers.
*/
-#ifndef FM_EVENTS_H
-#define FM_EVENTS_H
+#ifndef FM_EVENTIDS_H
+#define FM_EVENTIDS_H
/**
* \defgroup cfsfmevents CFS File Manager Event IDs
@@ -203,16 +202,16 @@
#define FM_NOOP_INF_EID 12
/**
- * \brief FM No-op Command Length Invalid Event ID
+ * \brief FM Command Message Length Invalid Event ID
*
* \par Type: ERROR
*
- * \par Cause
+ * \par Cause:
*
- * This event message is generated upon receipt of a /FM_Noop
- * command packet with an invalid length.
+ * This event message is issued when command message is received with a message
+ * length that doesn't match the expected value.
*/
-#define FM_NOOP_PKT_ERR_EID 13
+#define FM_CMD_LEN_ERR_EID 13
/**
* \brief FM Reset Counters Command Event ID
@@ -226,18 +225,6 @@
*/
#define FM_RESET_INF_EID 14
-/**
- * \brief FM Reset Counters Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_ResetCtrs
- * command packet with an invalid length.
- */
-#define FM_RESET_PKT_ERR_EID 15
-
/**
* \brief FM Copy File Command Event ID
*
@@ -253,19 +240,7 @@
* occur until some time after the command was invoked. However, this
* event message does signal the actual completion of the command.
*/
-#define FM_COPY_CMD_INF_EID 16
-
-/**
- * \brief FM Copy File Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_Copy
- * command packet with an invalid length.
- */
-#define FM_COPY_PKT_ERR_EID 17
+#define FM_COPY_CMD_INF_EID 15
/**
* \brief FM Copy File Command Overwrite Invalid Event ID
@@ -278,7 +253,7 @@
* command packet with an invalid overwrite argument. Overwrite
* must be set to TRUE (one) or FALSE (zero).
*/
-#define FM_COPY_OVR_ERR_EID 18
+#define FM_COPY_OVR_ERR_EID 16
/**
* \brief FM Copy File Command OS Error Event ID
@@ -295,7 +270,7 @@
* sufficient free space for this operation. Then refer to the OS
* specific return value.
*/
-#define FM_COPY_OS_ERR_EID 19
+#define FM_COPY_OS_ERR_EID 17
/**
* \brief FM Move File Command Event ID
@@ -307,19 +282,7 @@
* This event message signals the successful completion of a
* /FM_Move command.
*/
-#define FM_MOVE_CMD_INF_EID 20
-
-/**
- * \brief FM Move File Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_Move
- * command packet with an invalid length.
- */
-#define FM_MOVE_PKT_ERR_EID 21
+#define FM_MOVE_CMD_INF_EID 18
/**
* \brief FM Move File Command Overwrite Invalid Event ID
@@ -332,7 +295,7 @@
* command packet with an invalid overwrite argument. Overwrite
* must be set to TRUE (one) or FALSE (zero).
*/
-#define FM_MOVE_OVR_ERR_EID 22
+#define FM_MOVE_OVR_ERR_EID 19
/**
* \brief FM Move File Command OS Error Event ID
@@ -349,7 +312,7 @@
* sufficient free space for this operation. Then refer to the OS
* specific return value.
*/
-#define FM_MOVE_OS_ERR_EID 23
+#define FM_MOVE_OS_ERR_EID 20
/**
* \brief FM Rename File Command Event ID
@@ -361,19 +324,7 @@
* This event message signals the successful completion of a
* /FM_Rename command.
*/
-#define FM_RENAME_CMD_INF_EID 24
-
-/**
- * \brief FM Rename File Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_Rename
- * command packet with an invalid length.
- */
-#define FM_RENAME_PKT_ERR_EID 25
+#define FM_RENAME_CMD_INF_EID 21
/**
* \brief FM Rename File Command Overwrite Invalid Event ID
@@ -386,7 +337,7 @@
* command packet with an invalid overwrite argument. Overwrite
* must be set to TRUE (one) or FALSE (zero).
*/
-#define FM_RENAME_OVR_ERR_EID 26
+#define FM_RENAME_OVR_ERR_EID 22
/**
* \brief FM Rename File Command OS Error Event ID
@@ -403,7 +354,7 @@
* sufficient free space for this operation. Then refer to the OS
* specific return value.
*/
-#define FM_RENAME_OS_ERR_EID 27
+#define FM_RENAME_OS_ERR_EID 23
/**
* \brief FM Delete File Command Event ID
@@ -415,19 +366,7 @@
* This event message signals the successful completion of a
* /FM_Delete command.
*/
-#define FM_DELETE_CMD_INF_EID 28
-
-/**
- * \brief FM Delete File Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_Delete
- * command packet with an invalid length.
- */
-#define FM_DELETE_PKT_ERR_EID 29
+#define FM_DELETE_CMD_INF_EID 24
/**
* \brief FM Delete File Command OS Error Event ID
@@ -442,7 +381,7 @@
* OS-specific return value for an indication of what might have
* caused this error.
*/
-#define FM_DELETE_OS_ERR_EID 30
+#define FM_DELETE_OS_ERR_EID 25
/**
* \brief FM Delete All Files Command Event ID
@@ -459,7 +398,7 @@
* occur until some time after the command was invoked. However, this
* event message does signal the actual completion of the command.
*/
-#define FM_DELETE_ALL_CMD_INF_EID 31
+#define FM_DELETE_ALL_CMD_INF_EID 26
/**
* \brief FM Delete All Files Unable To Delete All Event ID
@@ -471,7 +410,7 @@
* This general event message is issued if for any reason some files
* could not be deleted.
*/
-#define FM_DELETE_ALL_FILES_ND_WARNING_EID 32
+#define FM_DELETE_ALL_FILES_ND_WARNING_EID 27
/**
* \brief FM Delete All Files Directories Skipped Event ID
@@ -483,19 +422,7 @@
* This general event message is issued if for any reason a directory
* skipped when processing a /FM_DeleteAll command.
*/
-#define FM_DELETE_ALL_SKIP_WARNING_EID 33
-
-/**
- * \brief FM Delete All Files Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_DeleteAll
- * command packet with an invalid length.
- */
-#define FM_DELETE_ALL_PKT_ERR_EID 34
+#define FM_DELETE_ALL_SKIP_WARNING_EID 28
/**
* \brief FM Delete All Files Command OS Error Event ID
@@ -510,7 +437,7 @@
* return value for an indication of what might have caused this
* error.
*/
-#define FM_DELETE_ALL_OS_ERR_EID 35
+#define FM_DELETE_ALL_OS_ERR_EID 29
/**
* \brief FM Decompress File Command Event ID
@@ -527,19 +454,7 @@
* occur until some time after the command was invoked. However, this
* event message does signal the actual completion of the command.
*/
-#define FM_DECOM_CMD_INF_EID 36
-
-/**
- * \brief FM Decompress File Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_Decompress
- * command packet with an invalid length.
- */
-#define FM_DECOM_PKT_ERR_EID 37
+#define FM_DECOM_CMD_INF_EID 30
/**
* \brief FM Decompress File Decompression Failed Event ID
@@ -554,7 +469,7 @@
* specific return value for an indication of what might have caused
* this particular error.
*/
-#define FM_DECOM_CFE_ERR_EID 38
+#define FM_DECOM_CFE_ERR_EID 31
/**
* \brief FM Concat Files Command Event ID
@@ -571,19 +486,7 @@
* occur until some time after the command was invoked. However, this
* event message does signal the actual completion of the command.
*/
-#define FM_CONCAT_CMD_INF_EID 39
-
-/**
- * \brief FM Concat Files Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_Concat
- * command packet with an invalid length.
- */
-#define FM_CONCAT_PKT_ERR_EID 40
+#define FM_CONCAT_CMD_INF_EID 32
/**
* \brief FM Concat Files Copy Failed Event ID
@@ -601,7 +504,7 @@
* specific return value for an indication of what might have caused
* this particular error.
*/
-#define FM_CONCAT_OSCPY_ERR_EID 41
+#define FM_CONCAT_OSCPY_ERR_EID 33
/**
* \brief FM Concat Files Command Open Second Source File Failed Event ID
@@ -619,7 +522,7 @@
* specific return value for an indication of what might have caused
* this particular error.
*/
-#define FM_CONCAT_OPEN_SRC2_ERR_EID 42
+#define FM_CONCAT_OPEN_SRC2_ERR_EID 34
/**
* \brief FM Concat Files Command Open Target File Failed Event ID
@@ -637,7 +540,7 @@
* specific return value for an indication of what might have caused
* this particular error.
*/
-#define FM_CONCAT_OPEN_TGT_ERR_EID 43
+#define FM_CONCAT_OPEN_TGT_ERR_EID 35
/**
* \brief FM Concat Files Command Read Second Source File Failed Event ID
@@ -654,7 +557,7 @@
* specific return value for an indication of what might have caused
* this particular error.
*/
-#define FM_CONCAT_OSRD_ERR_EID 44
+#define FM_CONCAT_OSRD_ERR_EID 36
/**
* \brief FM Concat Files Command Write Target File Failed Event ID
@@ -671,7 +574,7 @@
* specific return value for an indication of what might have caused
* this particular error.
*/
-#define FM_CONCAT_OSWR_ERR_EID 45
+#define FM_CONCAT_OSWR_ERR_EID 37
/**
* \brief FM Get File Info Command Event ID
@@ -688,7 +591,7 @@
* occur until some time after the command was invoked. However, this
* event message does signal the actual completion of the command.
*/
-#define FM_GET_FILE_INFO_CMD_INF_EID 46
+#define FM_GET_FILE_INFO_CMD_INF_EID 38
/**
* \brief FM Get File Info Unable To Compute CRC File State Invalid Event ID
@@ -706,7 +609,7 @@
* specific return value for an indication of what might have caused
* this particular error.
*/
-#define FM_GET_FILE_INFO_STATE_WARNING_EID 47
+#define FM_GET_FILE_INFO_STATE_WARNING_EID 39
/**
* \brief FM Get File Info Unable To Compute CRC, CRC Type Invalid Event ID
@@ -724,7 +627,7 @@
* specific return value for an indication of what might have caused
* this particular error.
*/
-#define FM_GET_FILE_INFO_TYPE_WARNING_EID 48
+#define FM_GET_FILE_INFO_TYPE_WARNING_EID 40
/**
* \brief FM Get File Info Unable To Compute CRC File Open Failed Event ID
@@ -742,7 +645,7 @@
* specific return value for an indication of what might have caused
* this particular error.
*/
-#define FM_GET_FILE_INFO_OPEN_ERR_EID 49
+#define FM_GET_FILE_INFO_OPEN_ERR_EID 41
/**
* \brief FM Get File Info Unable To Compute CRC File Read Failed Event ID
@@ -760,19 +663,7 @@
* specific return value for an indication of what might have caused
* this particular error.
*/
-#define FM_GET_FILE_INFO_READ_WARNING_EID 50
-
-/**
- * \brief FM Get File Info Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_GetFileInfo
- * command packet with an invalid length.
- */
-#define FM_GET_FILE_INFO_PKT_ERR_EID 51
+#define FM_GET_FILE_INFO_READ_WARNING_EID 42
/**
* \brief FM Get File Info Command Filename Invalid Event ID
@@ -784,7 +675,7 @@
* This event message is generated upon receipt of a /FM_GetFileInfo
* command packet with an invalid filename.
*/
-#define FM_GET_FILE_INFO_SRC_ERR_EID 52
+#define FM_GET_FILE_INFO_SRC_ERR_EID 43
/**
* \brief FM Get Open Files Command Event ID
@@ -796,19 +687,7 @@
* This event message signals the successful completion of a
* /FM_GetOpenFiles command.
*/
-#define FM_GET_OPEN_FILES_CMD_INF_EID 53
-
-/**
- * \brief FM Get Open Files Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_GetOpenFiles
- * command packet with an invalid length.
- */
-#define FM_GET_OPEN_FILES_PKT_ERR_EID 54
+#define FM_GET_OPEN_FILES_CMD_INF_EID 44
/**
* \brief FM Create Directory Command Event ID
@@ -820,19 +699,7 @@
* This event message signals the successful completion of a
* /FM_CreateDir command.
*/
-#define FM_CREATE_DIR_CMD_INF_EID 55
-
-/**
- * \brief FM Create Directory Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_CreateDir
- * command packet with an invalid length.
- */
-#define FM_CREATE_DIR_PKT_ERR_EID 56
+#define FM_CREATE_DIR_CMD_INF_EID 45
/**
* \brief FM Create Directory Command OS Error Event ID
@@ -846,7 +713,7 @@
* indicated that the directory name is unused and appears to be
* valid. Refer to the OS specific return value.
*/
-#define FM_CREATE_DIR_OS_ERR_EID 57
+#define FM_CREATE_DIR_OS_ERR_EID 46
/**
* \brief FM Delete Directory Command Event ID
@@ -858,19 +725,7 @@
* This event message signals the successful completion of a
* /FM_DeleteDir command.
*/
-#define FM_DELETE_DIR_CMD_INF_EID 58
-
-/**
- * \brief FM Delete Directory Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_DeleteDir
- * command packet with an invalid length.
- */
-#define FM_DELETE_DIR_PKT_ERR_EID 59
+#define FM_DELETE_DIR_CMD_INF_EID 47
/**
* \brief FM Delete Directory Command Failed Directory Not Empty Event ID
@@ -882,7 +737,7 @@
* This event message is generated upon receipt of a /FM_DeleteDir
* command packet that references a directory that is not empty.
*/
-#define FM_DELETE_DIR_EMPTY_ERR_EID 60
+#define FM_DELETE_DIR_EMPTY_ERR_EID 48
/**
* \brief FM Delete Directory, Direcotry Open Failed Event ID
@@ -896,7 +751,7 @@
* indicated that the directory exists and appears to be valid.
* Refer to the OS specific return values.
*/
-#define FM_DELETE_OPENDIR_OS_ERR_EID 61
+#define FM_DELETE_OPENDIR_OS_ERR_EID 49
/**
* \brief FM Delete Directory Remove Directory Failed Event ID
@@ -910,7 +765,7 @@
* indicated that the directory exists and appears to be valid.
* Refer to the OS specific return values.
*/
-#define FM_DELETE_RMDIR_OS_ERR_EID 62
+#define FM_DELETE_RMDIR_OS_ERR_EID 50
/**
* \brief FM Directory List To File Command Event ID
@@ -927,19 +782,7 @@
* occur until some time after the command was invoked. However, this
* event message does signal the actual completion of the command.
*/
-#define FM_GET_DIR_FILE_CMD_INF_EID 63
-
-/**
- * \brief FM Directory List To File Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_GetDirFile
- * command packet with an invalid length.
- */
-#define FM_GET_DIR_FILE_PKT_ERR_EID 64
+#define FM_GET_DIR_FILE_CMD_INF_EID 51
/**
* \brief FM Directory List To File Command Combined Path and Name Too Long Event ID
@@ -957,7 +800,7 @@
* The /FM_GetDirFile command handler will not write information
* regarding this directory entry to the output file.
*/
-#define FM_GET_DIR_FILE_WARNING_EID 65
+#define FM_GET_DIR_FILE_WARNING_EID 52
/**
* \brief FM Directory List To File Directory Open Failed Event ID
@@ -974,7 +817,7 @@
* sufficient free space for this operation. Then refer to the OS
* specific return values.
*/
-#define FM_GET_DIR_FILE_OSOPENDIR_ERR_EID 66
+#define FM_GET_DIR_FILE_OSOPENDIR_ERR_EID 53
/**
* \brief FM Directory List To File Write Blank Stats Failed Event ID
@@ -992,7 +835,7 @@
* sufficient free space for this operation. Then refer to the OS
* specific return values.
*/
-#define FM_GET_DIR_FILE_WRBLANK_ERR_EID 67
+#define FM_GET_DIR_FILE_WRBLANK_ERR_EID 54
/**
* \brief FM Directory List To File Write Header Failed Event ID
@@ -1010,7 +853,7 @@
* sufficient free space for this operation. Then refer to the OS
* specific return values.
*/
-#define FM_GET_DIR_FILE_WRHDR_ERR_EID 68
+#define FM_GET_DIR_FILE_WRHDR_ERR_EID 55
/**
* \brief FM Directory List To File Create File Failed Event ID
@@ -1028,7 +871,7 @@
* sufficient free space for this operation. Then refer to the OS
* specific return values.
*/
-#define FM_GET_DIR_FILE_OSCREAT_ERR_EID 69
+#define FM_GET_DIR_FILE_OSCREAT_ERR_EID 56
/**
* \brief FM Directory List To File Write Entry Failed Event ID
@@ -1046,7 +889,7 @@
* sufficient free space for this operation. Then refer to the OS
* specific return values.
*/
-#define FM_GET_DIR_FILE_WRENTRY_ERR_EID 70
+#define FM_GET_DIR_FILE_WRENTRY_ERR_EID 57
/**
* \brief FM Directory List To File Write Update Stats Failed Event ID
@@ -1064,7 +907,7 @@
* sufficient free space for this operation. Then refer to the OS
* specific return values.
*/
-#define FM_GET_DIR_FILE_UPSTATS_ERR_EID 71
+#define FM_GET_DIR_FILE_UPSTATS_ERR_EID 58
/**
* \brief FM Directory List To Packet Command Event ID
@@ -1081,7 +924,7 @@
* occur until some time after the command was invoked. However, this
* event message does signal the actual completion of the command.
*/
-#define FM_GET_DIR_PKT_CMD_INF_EID 72
+#define FM_GET_DIR_PKT_CMD_INF_EID 59
/**
* \brief FM Directory List To Packet Command Directory and Entry Too Long Event ID
@@ -1096,19 +939,7 @@
* might arise, but since we are copying both strings into a fixed
* length buffer, we must first verify the length.
*/
-#define FM_GET_DIR_PKT_WARNING_EID 73
-
-/**
- * \brief FM Directory List To Packet Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_GetDirPkt
- * command packet with an invalid length.
- */
-#define FM_GET_DIR_PKT_PKT_ERR_EID 74
+#define FM_GET_DIR_PKT_WARNING_EID 60
/**
* \brief FM Directory List To Packet Directory Open Failed Event ID
@@ -1121,7 +952,7 @@
* function call. The string data identifies the name of the
* directory or the directory entry.
*/
-#define FM_GET_DIR_PKT_OS_ERR_EID 75
+#define FM_GET_DIR_PKT_OS_ERR_EID 61
/**
* \brief FM Monitor Filesystem Command Event ID
@@ -1133,19 +964,7 @@
* This event message signals the successful completion of a
* /FM_MonitorFilesystemSpace command.
*/
-#define FM_MONITOR_FILESYSTEM_SPACE_CMD_INF_EID 76
-
-/**
- * \brief FM Get Free Space Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_GetFreeSpace
- * command packet with an invalid length.
- */
-#define FM_GET_FREE_SPACE_PKT_ERR_EID 77
+#define FM_MONITOR_FILESYSTEM_SPACE_CMD_INF_EID 62
/**
* \brief FM Get Free Space Table Not Loaded Event ID
@@ -1158,7 +977,7 @@
* command packet when the FM file system free space table has not yet
* been loaded.
*/
-#define FM_GET_FREE_SPACE_TBL_ERR_EID 78
+#define FM_GET_FREE_SPACE_TBL_ERR_EID 63
/**
* \brief FM Set Table State Command Event ID
@@ -1170,19 +989,7 @@
* This event message signals the successful completion of a
* /FM_SetTableState command.
*/
-#define FM_SET_TABLE_STATE_CMD_EID 79
-
-/**
- * \brief FM Set Table State Command Length Invalid Event ID
- *
- * \par Type: ERROR
- *
- * \par Cause
- *
- * This event message is generated upon receipt of a /FM_SetTableState
- * command packet with an invalid length.
- */
-#define FM_SET_TABLE_STATE_PKT_ERR_EID 80
+#define FM_SET_TABLE_STATE_CMD_EID 64
/**
* \brief FM Set Table State Command Table Not Loaded Event ID
@@ -1195,7 +1002,7 @@
* command packet when the FM file system free space table has not yet
* been loaded.
*/
-#define FM_SET_TABLE_STATE_TBL_ERR_EID 81
+#define FM_SET_TABLE_STATE_TBL_ERR_EID 65
/**
* \brief FM Set Table State Command Index Invalid Event ID
@@ -1207,7 +1014,7 @@
* This event message is generated upon receipt of a FM_SetTableState
* command packet with an invalid table index argument.
*/
-#define FM_SET_TABLE_STATE_ARG_IDX_ERR_EID 82
+#define FM_SET_TABLE_STATE_ARG_IDX_ERR_EID 66
/**
* \brief FM Set Table State Command State Invalid Event ID
@@ -1219,7 +1026,7 @@
* This event message is generated upon receipt of a FM_SetTableState
* command packet with an invalid entry state argument.
*/
-#define FM_SET_TABLE_STATE_ARG_STATE_ERR_EID 83
+#define FM_SET_TABLE_STATE_ARG_STATE_ERR_EID 67
/**
* \brief FM Set Table State Command Unused Entry Event ID
@@ -1231,7 +1038,7 @@
* This event message is generated upon receipt of a /FM_SetTableState
* command packet that references an unused free space table entry.
*/
-#define FM_SET_TABLE_STATE_UNUSED_ERR_EID 84
+#define FM_SET_TABLE_STATE_UNUSED_ERR_EID 68
/**
* \brief FM Free Space Table Verification Failed Empty Name Event ID
@@ -1254,7 +1061,7 @@
* attempt to load a new table fails verification, the FM application will continue
* to use the previous table.
*/
-#define FM_TABLE_VERIFY_EMPTY_ERR_EID 85
+#define FM_TABLE_VERIFY_EMPTY_ERR_EID 69
/**
* \brief FM Free Space Table Verification Failed Name Too Long Event ID
@@ -1277,7 +1084,7 @@
* attempt to load a new table fails verification, the FM application will continue
* to use the previous table.
*/
-#define FM_TABLE_VERIFY_TOOLONG_ERR_EID 86
+#define FM_TABLE_VERIFY_TOOLONG_ERR_EID 70
/**
* \brief FM Free Space Table Verification Failed State Invalid Event ID
@@ -1300,7 +1107,7 @@
* attempt to load a new table fails verification, the FM application will continue
* to use the previous table.
*/
-#define FM_TABLE_VERIFY_BAD_STATE_ERR_EID 88
+#define FM_TABLE_VERIFY_BAD_STATE_ERR_EID 71
/**
* \brief FM Child Task Initialization Complete Event ID
@@ -1312,7 +1119,7 @@
* This event message signals the successful completion of the initialization
* process for the FM child task.
*/
-#define FM_CHILD_INIT_EID 89
+#define FM_CHILD_INIT_EID 72
/**
* \brief FM Child Task Initialization Create Semaphore Failed Event ID
@@ -1326,7 +1133,7 @@
* handed off to the child task for execution, will now be processed by the main FM
* application.
*/
-#define FM_CHILD_INIT_SEM_ERR_EID 90
+#define FM_CHILD_INIT_SEM_ERR_EID 73
/**
* \brief FM Child Task Initialization Create Queue Count Semaphore Failed Event ID
@@ -1339,7 +1146,7 @@
* semphore for the FM child task. Commands which would have otherwise been handed off
* to the child task for execution, will now be processed by the main FM application.
*/
-#define FM_CHILD_INIT_QSEM_ERR_EID 91
+#define FM_CHILD_INIT_QSEM_ERR_EID 74
/**
* \brief FM Child Task Initialization Create Task Failed Event ID
@@ -1352,7 +1159,7 @@
* priority FM child task. Commands which would have otherwise been handed off
* to the child task for execution, will now be processed by the main FM application.
*/
-#define FM_CHILD_INIT_CREATE_ERR_EID 92
+#define FM_CHILD_INIT_CREATE_ERR_EID 75
/**
* \brief FM Child Task Termination Error Empty Queue Event ID
@@ -1366,7 +1173,7 @@
* indicating that the handshake between the main task and child task was
* broken.
*/
-#define FM_CHILD_TERM_EMPTYQ_ERR_EID 93
+#define FM_CHILD_TERM_EMPTYQ_ERR_EID 76
/**
* \brief FM Child Task Termination Error Invalid Queue Index Event ID
@@ -1379,7 +1186,7 @@
* and has terminated. The error occurred because the child read index was
* invalid (larger than the child queue depth).
*/
-#define FM_CHILD_TERM_QIDX_ERR_EID 94
+#define FM_CHILD_TERM_QIDX_ERR_EID 77
/**
* \brief FM Child Task Termination Error Semaphore Take Failed Event ID
@@ -1392,7 +1199,7 @@
* and has terminated. The error occurred when trying to take the child
* handshake semaphore.
*/
-#define FM_CHILD_TERM_SEM_ERR_EID 95
+#define FM_CHILD_TERM_SEM_ERR_EID 78
/**
* \brief FM Child Task Command Code Invalid Event ID
@@ -1407,7 +1214,7 @@
* or there has been some sort of data corruption that affected the interface data.
* It may be necessary to restart the FM application to resync the handshake interface.
*/
-#define FM_CHILD_EXE_ERR_EID 96
+#define FM_CHILD_EXE_ERR_EID 79
/**
* \brief FM Free Space Table Validation Results Event ID
@@ -1421,7 +1228,7 @@
* when the default table is loaded at startup and also whenever a table validate
* command (that targets this table) is processed.
*/
-#define FM_TABLE_VERIFY_EID 97
+#define FM_TABLE_VERIFY_EID 80
/**
* \brief FM Set Permissions Command Length Invalid Event ID
@@ -1433,7 +1240,7 @@
* This event message is generated upon receipt of a /FM_SetPermissions
* command packet with an invalid length.
*/
-#define FM_SET_PERM_ERR_EID 98
+#define FM_SET_PERM_ERR_EID 81
/**
* \brief FM Set Permissions Command Event ID
@@ -1445,7 +1252,7 @@
* This event message signals the successful completion of a
* /FM_SetPerm command.
*/
-#define FM_SET_PERM_CMD_INF_EID 99
+#define FM_SET_PERM_CMD_INF_EID 82
/**
* \brief FM Set Permissions Command Chmod Error Event ID
@@ -1457,7 +1264,7 @@
* This event message is generated upon receipt of a /FM_SetPerm
* command packet with an invalid length.
*/
-#define FM_SET_PERM_OS_ERR_EID 100
+#define FM_SET_PERM_OS_ERR_EID 83
/**
* \brief FM Free Space Table Verification Failed Null Pointer Detected
@@ -1469,7 +1276,7 @@
* This event message occurs when the FM validate table callback function
* receives a NULL pointer as the input argument.
*/
-#define FM_TABLE_VERIFY_NULL_PTR_ERR_EID 101
+#define FM_TABLE_VERIFY_NULL_PTR_ERR_EID 84
/**
* \brief FM Main Loop Software Bus Returned NULL On Success Event ID
@@ -1481,7 +1288,7 @@
* This event message occurs if the Software Bus returns a success status
* in the main loop but provided a NULL pointer as the return argument.
*/
-#define FM_SB_RECEIVE_NULL_PTR_ERR_EID 102
+#define FM_SB_RECEIVE_NULL_PTR_ERR_EID 85
/**
* \brief FM Get Free Space Get File System Stats Failed Event ID
@@ -1493,7 +1300,7 @@
* This event message occurs if the free space for a file system cannot be read
* when processing the #FM_MonitorFilesystemSpaceCmd command.
*/
-#define FM_OS_SYS_STAT_ERR_EID 103
+#define FM_OS_SYS_STAT_ERR_EID 86
/**
* \brief FM Directory Size Estimate Failed Event ID
@@ -1505,7 +1312,7 @@
* This event message occurs if the system encounters an error during
* calculation of a directory size estimate
*/
-#define FM_DIRECTORY_ESTIMATE_ERR_EID 104
+#define FM_DIRECTORY_ESTIMATE_ERR_EID 87
/** -------------------------------------------------------------
* NOTE: From here on, the event IDs will take the form of a
@@ -3462,4 +3269,4 @@
/**\}*/
-#endif
+#endif /* FM_EVENTIDS_H */
\ No newline at end of file
diff --git a/fsw/inc/fm_extern_typedefs.h b/fsw/inc/fm_extern_typedefs.h
deleted file mode 100644
index a8485eb..0000000
--- a/fsw/inc/fm_extern_typedefs.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/************************************************************************
- * NASA Docket No. GSC-18,447-1, and identified as “CFS CFDP (CF)
- * Application version 3.0.0”
- *
- * Copyright (c) 2019 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
- *
- * Declarations and prototypes for fm_extern_typedefs module
- */
-
-#ifndef FM_EXTERN_TYPEDEFS_H
-#define FM_EXTERN_TYPEDEFS_H
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM filename status definitions */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#define FM_NAME_IS_INVALID 0
-#define FM_NAME_IS_NOT_IN_USE 1
-#define FM_NAME_IS_FILE_OPEN 2
-#define FM_NAME_IS_FILE_CLOSED 3
-#define FM_NAME_IS_DIRECTORY 4
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM free space table entry state definitions */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#define FM_TABLE_ENTRY_DISABLED 0
-#define FM_TABLE_ENTRY_ENABLED 1
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM directory entry definitions */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#define FM_THIS_DIRECTORY "."
-#define FM_PARENT_DIRECTORY ".."
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM argument to not calculate CRC during Get File Info command */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#define FM_IGNORE_CRC 0
-
-#endif /* FM_EXTERN_TYPEDEFS_H */
\ No newline at end of file
diff --git a/fsw/inc/fm_msgdefs.h b/fsw/inc/fm_fcncodes.h
similarity index 79%
rename from fsw/inc/fm_msgdefs.h
rename to fsw/inc/fm_fcncodes.h
index fb8622a..b8d3cd7 100644
--- a/fsw/inc/fm_msgdefs.h
+++ b/fsw/inc/fm_fcncodes.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -19,11 +18,26 @@
/**
* @file
- * Specification for the CFS FM command and telemetry message
- * macro definitions.
+ * Specification for the CFS File Manager (FM) 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 FM_MSGDEFS_H
-#define FM_MSGDEFS_H
+
+#ifndef FM_FCNCODES_H
+#define FM_FCNCODES_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "fm_fcncode_values.h"
+
+/* ====== */
+/* Macros */
+/* ====== */
/**
* \defgroup cfsfmcmdcodes CFS File Manager Command Codes
@@ -45,30 +59,29 @@
*
* \par Command Success Verification
* - Informational event #FM_NOOP_INF_EID will be sent
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment
*
* \par Command Error Conditions
* - Invalid command packet length
*
* \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter will increment
- * - Error event #FM_NOOP_PKT_ERR_EID will be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter will increment
*
* \par Criticality
* - There are no critical issues related to this command.
*/
-#define FM_NOOP_CC 0
+#define FM_NOOP_CC FM_CCVAL(NOOP)
/**
* \brief Reset Counters
*
* \par Description
* This command resets the following housekeeping telemetry:
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdWarnCounter
+ * - #FM_HkTlm_Payload_t.CommandCounter
+ * - #FM_HkTlm_Payload_t.CommandErrCounter
+ * - #FM_HkTlm_Payload_t.ChildCmdCounter
+ * - #FM_HkTlm_Payload_t.ChildCmdErrCounter
+ * - #FM_HkTlm_Payload_t.ChildCmdWarnCounter
*
* \par Command Packet Structure
* #FM_ResetCountersCmd_t
@@ -81,14 +94,13 @@
* - Invalid command packet length
*
* \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter will increment
- * - Error event #FM_RESET_PKT_ERR_EID will be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter will increment
*
* \par Criticality
* - There are no critical issues related to this command.
*
*/
-#define FM_RESET_COUNTERS_CC 1
+#define FM_RESET_COUNTERS_CC FM_CCVAL(RESET_COUNTERS)
/**
* \brief Copy File
@@ -113,8 +125,8 @@
* #FM_CopyFileCmd_t
*
* \par Command Success Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter will increment after completion
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment after validation
+ * - #FM_HkTlm_Payload_t.ChildCmdCounter will increment after completion
* - Informational event #FM_COPY_CMD_INF_EID will be sent
*
* \par Command Error Conditions
@@ -131,9 +143,8 @@
* - Failure of OS copy function
*
* \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter may increment
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter may increment
- * - Error event #FM_COPY_PKT_ERR_EID may be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter may increment
+ * - #FM_HkTlm_Payload_t.ChildCmdErrCounter may increment
* - Error event #FM_COPY_OVR_ERR_EID may be sent
* - Error event #FM_COPY_SRC_INVALID_ERR_EID may be sent
* - Error event #FM_COPY_SRC_DNE_ERR_EID may be sent
@@ -153,7 +164,7 @@
*
* \sa #FM_MOVE_FILE_CC, #FM_RENAME_FILE_CC
*/
-#define FM_COPY_FILE_CC 2
+#define FM_COPY_FILE_CC FM_CCVAL(COPY_FILE)
/**
* \brief Move File
@@ -180,48 +191,47 @@
* the child task interface queue.
*
**
- *
- * \par Command Packet Structure
- * #FM_MoveFileCmd_t
- *
- * \par Command Success Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter will increment after completion
- * - Informational event #FM_MOVE_CMD_INF_EID will be sent
- *
- * \par Command Error Conditions
- * - Invalid command packet length
- * - Overwrite is not TRUE (one) or FALSE (zero)
- * - Source filename is invalid
- * - Source file does not exist
- * - Source filename is a directory
- * - Target filename is invalid
- * - Target file already exists
- * - Target filename is a directory
- * - Failure of OS move function
- *
- * \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter may increment
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter may increment
- * - Error event #FM_MOVE_PKT_ERR_EID may be sent
- * - Error event #FM_MOVE_OVR_ERR_EID may be sent
- * - Error event #FM_MOVE_SRC_INVALID_ERR_EID may be sent
- * - Error event #FM_MOVE_SRC_DNE_ERR_EID may be sent
- * - Error event #FM_MOVE_SRC_ISDIR_ERR_EID may be sent
- * - Error event #FM_MOVE_TGT_INVALID_ERR_EID may be sent
- * - Error event #FM_MOVE_TGT_EXIST_ERR_EID may be sent
- * - Error event #FM_MOVE_TGT_ISDIR_ERR_EID may be sent
- * - Error event #FM_MOVE_CHILD_DISABLED_ERR_EID may be sent
- * - Error event #FM_MOVE_CHILD_FULL_ERR_EID may be sent
- * - Error event #FM_MOVE_CHILD_BROKEN_ERR_EID may be sent
- * - Error event #FM_MOVE_OS_ERR_EID may be sent
- *
- * \par Criticality
- * - There are no critical issues related to this command.
- *
- * \sa #FM_COPY_FILE_CC, #FM_RENAME_FILE_CC
- */
-#define FM_MOVE_FILE_CC 3
+*
+* \par Command Packet Structure
+* #FM_MoveFileCmd_t
+*
+* \par Command Success Verification
+* - #FM_HkTlm_Payload_t.CommandCounter will increment after validation
+* - #FM_HkTlm_Payload_t.ChildCmdCounter will increment after completion
+* - Informational event #FM_MOVE_CMD_INF_EID will be sent
+*
+* \par Command Error Conditions
+* - Invalid command packet length
+* - Overwrite is not TRUE (one) or FALSE (zero)
+* - Source filename is invalid
+* - Source file does not exist
+* - Source filename is a directory
+* - Target filename is invalid
+* - Target file already exists
+* - Target filename is a directory
+* - Failure of OS move function
+*
+* \par Command Failure Verification
+* - #FM_HkTlm_Payload_t.CommandErrCounter may increment
+* - #FM_HkTlm_Payload_t.ChildCmdErrCounter may increment
+* - Error event #FM_MOVE_OVR_ERR_EID may be sent
+* - Error event #FM_MOVE_SRC_INVALID_ERR_EID may be sent
+* - Error event #FM_MOVE_SRC_DNE_ERR_EID may be sent
+* - Error event #FM_MOVE_SRC_ISDIR_ERR_EID may be sent
+* - Error event #FM_MOVE_TGT_INVALID_ERR_EID may be sent
+* - Error event #FM_MOVE_TGT_EXIST_ERR_EID may be sent
+* - Error event #FM_MOVE_TGT_ISDIR_ERR_EID may be sent
+* - Error event #FM_MOVE_CHILD_DISABLED_ERR_EID may be sent
+* - Error event #FM_MOVE_CHILD_FULL_ERR_EID may be sent
+* - Error event #FM_MOVE_CHILD_BROKEN_ERR_EID may be sent
+* - Error event #FM_MOVE_OS_ERR_EID may be sent
+*
+* \par Criticality
+* - There are no critical issues related to this command.
+*
+* \sa #FM_COPY_FILE_CC, #FM_RENAME_FILE_CC
+*/
+#define FM_MOVE_FILE_CC FM_CCVAL(MOVE_FILE)
/**
* \brief Rename File
@@ -247,8 +257,8 @@
* #FM_RenameFileCmd_t
*
* \par Command Success Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter will increment after completion
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment after validation
+ * - #FM_HkTlm_Payload_t.ChildCmdCounter will increment after completion
* - Informational event #FM_RENAME_CMD_INF_EID will be sent
*
* \par Command Error Conditions
@@ -262,9 +272,8 @@
* - Failure of OS rename function
*
* \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter may increment
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter may increment
- * - Error event #FM_RENAME_PKT_ERR_EID may be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter may increment
+ * - #FM_HkTlm_Payload_t.ChildCmdErrCounter may increment
* - Error event #FM_RENAME_SRC_INVALID_ERR_EID may be sent
* - Error event #FM_RENAME_SRC_DNE_ERR_EID may be sent
* - Error event #FM_RENAME_SRC_ISDIR_ERR_EID may be sent
@@ -281,7 +290,7 @@
*
* \sa #FM_COPY_FILE_CC, #FM_MOVE_FILE_CC
*/
-#define FM_RENAME_FILE_CC 4
+#define FM_RENAME_FILE_CC FM_CCVAL(RENAME_FILE)
/**
* \brief Delete File
@@ -301,8 +310,8 @@
* #FM_DeleteFileCmd_t
*
* \par Command Success Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter will increment after completion
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment after validation
+ * - #FM_HkTlm_Payload_t.ChildCmdCounter will increment after completion
* - Informational event #FM_DELETE_CMD_INF_EID will be sent
*
* \par Command Error Conditions
@@ -314,9 +323,8 @@
* - Failure of OS delete function
*
* \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter will increment
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter may increment
- * - Error event #FM_DELETE_PKT_ERR_EID may be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter will increment
+ * - #FM_HkTlm_Payload_t.ChildCmdErrCounter may increment
* - Error event #FM_DELETE_SRC_INVALID_ERR_EID may be sent
* - Error event #FM_DELETE_SRC_DNE_ERR_EID may be sent
* - Error event #FM_DELETE_SRC_ISDIR_ERR_EID may be sent
@@ -332,7 +340,7 @@
*
* \sa #FM_DELETE_ALL_FILES_CC, #FM_DELETE_DIRECTORY_CC
*/
-#define FM_DELETE_FILE_CC 5
+#define FM_DELETE_FILE_CC FM_CCVAL(DELETE_FILE)
/**
* \brief Delete All Files
@@ -354,8 +362,8 @@
* #FM_DeleteAllFilesCmd_t
*
* \par Command Success Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter will increment after completion
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment after validation
+ * - #FM_HkTlm_Payload_t.ChildCmdCounter will increment after completion
* - Informational event #FM_DELETE_ALL_CMD_INF_EID will be sent
*
* \par Command Warning Conditions
@@ -363,7 +371,7 @@
* - Directory entry is an open file
*
* \par Command Warning Verification
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdWarnCounter will increment
+ * - #FM_HkTlm_Payload_t.ChildCmdWarnCounter will increment
* - Informational event #FM_DELETE_ALL_FILES_ND_WARNING_EID may be sent
* - Informational event #FM_DELETE_ALL_SKIP_WARNING_EID may be sent
*
@@ -375,9 +383,8 @@
* - Failure of OS delete function
*
* \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter may increment
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter may increment
- * - Error event #FM_DELETE_ALL_PKT_ERR_EID may be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter may increment
+ * - #FM_HkTlm_Payload_t.ChildCmdErrCounter may increment
* - Error event #FM_DELETE_ALL_SRC_INVALID_ERR_EID may be sent
* - Error event #FM_DELETE_ALL_SRC_DNE_ERR_EID may be sent
* - Error event #FM_DELETE_ALL_SRC_FILE_ERR_EID may be sent
@@ -394,7 +401,7 @@
*
* \sa #FM_DELETE_FILE_CC, #FM_DELETE_DIRECTORY_CC
*/
-#define FM_DELETE_ALL_FILES_CC 7
+#define FM_DELETE_ALL_FILES_CC FM_CCVAL(DELETE_ALL_FILES)
/**
* \brief Decompress File
@@ -421,8 +428,8 @@
* #FM_DecompressFileCmd_t
*
* \par Command Success Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter will increment after completion
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment after validation
+ * - #FM_HkTlm_Payload_t.ChildCmdCounter will increment after completion
* - Informational event #FM_DECOM_CMD_INF_EID will be sent
*
* \par Command Error Conditions
@@ -434,9 +441,8 @@
* - Failure of CFE_FS_Decompress function
*
* \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter may increment
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter may increment
- * - Error event #FM_DECOM_PKT_ERR_EID may be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter may increment
+ * - #FM_HkTlm_Payload_t.ChildCmdErrCounter may increment
* - Error event #FM_DECOM_SRC_INVALID_ERR_EID may be sent
* - Error event #FM_DECOM_SRC_DNE_ERR_EID may be sent
* - Error event #FM_DECOM_SRC_ISDIR_ERR_EID may be sent
@@ -453,7 +459,7 @@
* Decompressing a very large file may consume more CPU resource than
* anticipated.
*/
-#define FM_DECOMPRESS_FILE_CC 8
+#define FM_DECOMPRESS_FILE_CC FM_CCVAL(DECOMPRESS_FILE)
/**
* \brief Concatenate Files
@@ -477,8 +483,8 @@
* #FM_ConcatFilesCmd_t
*
* \par Command Success Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter will increment after completion
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment after validation
+ * - #FM_HkTlm_Payload_t.ChildCmdCounter will increment after completion
* - Informational event #FM_CONCAT_CMD_INF_EID will be sent
*
* \par Command Error Conditions
@@ -490,9 +496,8 @@
* - Failure of OS function (copy, open, read, write, etc.)
*
* \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter may increment
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter may increment
- * - Error event #FM_CONCAT_PKT_ERR_EID may be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter may increment
+ * - #FM_HkTlm_Payload_t.ChildCmdErrCounter may increment
* - Error event #FM_CONCAT_OSCPY_ERR_EID may be sent
* - Error event #FM_CONCAT_OPEN_SRC2_ERR_EID may be sent
* - Error event #FM_CONCAT_OPEN_TGT_ERR_EID may be sent
@@ -519,7 +524,7 @@
*
* \sa #FM_COPY_FILE_CC
*/
-#define FM_CONCAT_FILES_CC 9
+#define FM_CONCAT_FILES_CC FM_CCVAL(CONCAT_FILES)
/**
* \brief Get File Information
@@ -545,8 +550,8 @@
* #FM_GetFileInfoCmd_t
*
* \par Command Success Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter will increment after completion
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment after validation
+ * - #FM_HkTlm_Payload_t.ChildCmdCounter will increment after completion
* - Informational event #FM_GET_FILE_INFO_CMD_INF_EID will be sent
*
* \par Command Warning Conditions
@@ -555,7 +560,7 @@
* - CRC cannot be calculated because file cannot be read
*
* \par Command Warning Verification
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdWarnCounter will increment
+ * - #FM_HkTlm_Payload_t.ChildCmdWarnCounter will increment
* - Informational event #FM_GET_FILE_INFO_STATE_WARNING_EID may be sent
* - Informational event #FM_GET_FILE_INFO_TYPE_WARNING_EID may be sent
* - Informational event #FM_GET_FILE_INFO_READ_WARNING_EID may be sent
@@ -566,10 +571,9 @@
* - Failure of OS_stat function
*
* \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter may increment
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter may increment
+ * - #FM_HkTlm_Payload_t.CommandErrCounter may increment
+ * - #FM_HkTlm_Payload_t.ChildCmdErrCounter may increment
* - Error event #FM_GET_FILE_INFO_OPEN_ERR_EID may be sent
- * - Error event #FM_GET_FILE_INFO_PKT_ERR_EID may be sent
* - Error event #FM_GET_FILE_INFO_SRC_ERR_EID may be sent
* - Error event #FM_FILE_INFO_CHILD_DISABLED_ERR_EID may be sent
* - Error event #FM_FILE_INFO_CHILD_FULL_ERR_EID may be sent
@@ -581,7 +585,7 @@
*
* \sa #FM_GET_OPEN_FILES_CC, #FM_GET_DIR_LIST_FILE_CC, #FM_GET_DIR_LIST_PKT_CC
*/
-#define FM_GET_FILE_INFO_CC 10
+#define FM_GET_FILE_INFO_CC FM_CCVAL(GET_FILE_INFO)
/**
* \brief Get Open Files Listing
@@ -596,22 +600,21 @@
* #FM_GetOpenFilesCmd_t
*
* \par Command Success Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment
* - Informational event #FM_GET_OPEN_FILES_CMD_INF_EID will be sent
*
* \par Command Error Conditions
* - Invalid command packet length
*
* \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter will increment
- * - Error event #FM_GET_OPEN_FILES_PKT_ERR_EID will be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter will increment
*
* \par Criticality
* - There are no critical issues related to this command.
*
* \sa #FM_GET_FILE_INFO_CC, #FM_GET_DIR_LIST_FILE_CC, #FM_GET_DIR_LIST_PKT_CC
*/
-#define FM_GET_OPEN_FILES_CC 11
+#define FM_GET_OPEN_FILES_CC FM_CCVAL(GET_OPEN_FILES)
/**
* \brief Create Directory
@@ -631,8 +634,8 @@
* #FM_CreateDirectoryCmd_t
*
* \par Command Success Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter will increment after completion
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment after validation
+ * - #FM_HkTlm_Payload_t.ChildCmdCounter will increment after completion
* - Informational event #FM_CREATE_DIR_CMD_INF_EID will be sent
*
* \par Command Error Conditions
@@ -642,9 +645,8 @@
* - Failure of OS_mkdir function
*
* \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter will increment
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter may increment
- * - Error event #FM_CREATE_DIR_PKT_ERR_EID may be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter will increment
+ * - #FM_HkTlm_Payload_t.ChildCmdErrCounter may increment
* - Error event #FM_CREATE_DIR_SRC_INVALID_ERR_EID may be sent
* - Error event #FM_CREATE_DIR_SRC_DNE_ERR_EID may be sent
* - Error event #FM_CREATE_DIR_SRC_ISDIR_ERR_EID may be sent
@@ -658,7 +660,7 @@
*
* \sa #FM_DELETE_DIRECTORY_CC
*/
-#define FM_CREATE_DIRECTORY_CC 12
+#define FM_CREATE_DIRECTORY_CC FM_CCVAL(CREATE_DIRECTORY)
/**
* \brief Remove Directory
@@ -679,8 +681,8 @@
* #FM_DeleteDirectoryCmd_t
*
* \par Command Success Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter will increment after completion
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment after validation
+ * - #FM_HkTlm_Payload_t.ChildCmdCounter will increment after completion
* - Informational event #FM_DELETE_DIR_CMD_INF_EID will be sent
*
* \par Command Error Conditions
@@ -691,9 +693,8 @@
* - Failure of OS function (OS_opendir, OS_rmdir)
*
* \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter will increment
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter may increment
- * - Error event #FM_DELETE_DIR_PKT_ERR_EID may be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter will increment
+ * - #FM_HkTlm_Payload_t.ChildCmdErrCounter may increment
* - Error event #FM_DELETE_DIR_EMPTY_ERR_EID may be sent
* - Error event #FM_DELETE_OPENDIR_OS_ERR_EID may be sent
* - Error event #FM_DELETE_RMDIR_OS_ERR_EID may be sent
@@ -710,7 +711,7 @@
*
* \sa #FM_CREATE_DIRECTORY_CC
*/
-#define FM_DELETE_DIRECTORY_CC 13
+#define FM_DELETE_DIRECTORY_CC FM_CCVAL(DELETE_DIRECTORY)
/**
* \brief Get Directory Listing to a File
@@ -734,15 +735,15 @@
* #FM_GetDirListFileCmd_t
*
* \par Command Success Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter will increment after completion
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment after validation
+ * - #FM_HkTlm_Payload_t.ChildCmdCounter will increment after completion
* - Informational event #FM_GET_DIR_FILE_CMD_INF_EID will be sent
*
* \par Command Warning Conditions
* - Combined directory and entry name is too long
*
* \par Command Warning Verification
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdWarnCounter will increment
+ * - #FM_HkTlm_Payload_t.ChildCmdWarnCounter will increment
* - Informational event #FM_GET_DIR_FILE_WARNING_EID may be sent
*
* \par Command Error Conditions
@@ -756,9 +757,8 @@
* - Failure of OS function (OS_opendir, OS_creat, OS_write)
*
* \par Command Failure Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter may increment
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter may increment
- * - Error event #FM_GET_DIR_FILE_PKT_ERR_EID may be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter may increment
+ * - #FM_HkTlm_Payload_t.ChildCmdErrCounter may increment
* - Error event #FM_GET_DIR_FILE_OSOPENDIR_ERR_EID may be sent
* - Error event #FM_GET_DIR_FILE_WRBLANK_ERR_EID may be sent
* - Error event #FM_GET_DIR_FILE_WRHDR_ERR_EID may be sent
@@ -780,7 +780,7 @@
*
* \sa #FM_GET_DIR_LIST_PKT_CC
*/
-#define FM_GET_DIR_LIST_FILE_CC 14
+#define FM_GET_DIR_LIST_FILE_CC FM_CCVAL(GET_DIR_LIST_FILE)
/**
* \brief Get Directory Listing to a Packet
@@ -816,8 +816,8 @@
* \par Command Verification
* Successful execution of this command may be verified with
* the following telemetry:
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter will increment after completion
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment after validation
+ * - #FM_HkTlm_Payload_t.ChildCmdCounter will increment after completion
* - The #FM_DirListPkt_t telemetry packet will be sent
* - The #FM_GET_DIR_PKT_CMD_INF_EID informational event will be sent
*
@@ -825,7 +825,7 @@
* - Combined directory and entry name is too long
*
* \par Command Warning Verification
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdWarnCounter will increment
+ * - #FM_HkTlm_Payload_t.ChildCmdWarnCounter will increment
* - Informational event #FM_GET_DIR_PKT_WARNING_EID may be sent
*
* \par Error Conditions
@@ -837,9 +837,8 @@
* - Command packet length not as expected
*
* \par Evidence of failure may be found in the following telemetry:
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter may increment
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter may increment
- * - Error event #FM_GET_DIR_PKT_PKT_ERR_EID may be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter may increment
+ * - #FM_HkTlm_Payload_t.ChildCmdErrCounter may increment
* - Error event #FM_GET_DIR_PKT_OS_ERR_EID may be sent
* - Error event #FM_GET_DIR_PKT_SRC_INVALID_ERR_EID may be sent
* - Error event #FM_GET_DIR_PKT_SRC_DNE_ERR_EID may be sent
@@ -854,7 +853,7 @@
*
* \sa #FM_GET_DIR_LIST_FILE_CC
*/
-#define FM_GET_DIR_LIST_PKT_CC 15
+#define FM_GET_DIR_LIST_PKT_CC FM_CCVAL(GET_DIR_LIST_PKT)
/**
* \brief Monitor Filesystem Space
@@ -868,7 +867,7 @@
* #FM_MonitorFilesystemSpaceCmd_t
*
* \par Evidence of success may be found in the following telemetry:
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment
* - Informational event #FM_MONITOR_FILESYSTEM_SPACE_CMD_INF_EID will be sent
* - Telemetry packet #FM_MonitorReportPkt_t will be sent
*
@@ -877,14 +876,13 @@
* - Free space table is not loaded
*
* \par Evidence of failure may be found in the following telemetry:
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter will increment
- * - Error event #FM_GET_FREE_SPACE_PKT_ERR_EID may be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter will increment
* - Error event #FM_GET_FREE_SPACE_TBL_ERR_EID may be sent
*
* \par Criticality
* - There are no critical issues related to this command.
*/
-#define FM_MONITOR_FILESYSTEM_SPACE_CC 16
+#define FM_MONITOR_FILESYSTEM_SPACE_CC FM_CCVAL(MONITOR_FILESYSTEM_SPACE)
/**
* \brief Set Free Space Table Entry State
@@ -899,7 +897,7 @@
* #FM_SetTableStateCmd_t
*
* \par Evidence of success may be found in the following telemetry:
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment
* - Informational event #FM_SET_TABLE_STATE_CMD_EID will be sent
*
* \par Error Conditions
@@ -910,8 +908,7 @@
* - Invalid current table entry state, entry is unused
*
* \par Evidence of failure may be found in the following telemetry:
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter will increment
- * - Error event #FM_SET_TABLE_STATE_PKT_ERR_EID may be sent
+ * - #FM_HkTlm_Payload_t.CommandErrCounter will increment
* - Error event #FM_SET_TABLE_STATE_TBL_ERR_EID may be sent
* - Error event #FM_SET_TABLE_STATE_ARG_IDX_ERR_EID may be sent
* - Error event #FM_SET_TABLE_STATE_ARG_STATE_ERR_EID may be sent
@@ -920,7 +917,7 @@
* \par Criticality
* - There are no critical issues related to this command.
*/
-#define FM_SET_TABLE_STATE_CC 17
+#define FM_SET_TABLE_STATE_CC FM_CCVAL(SET_TABLE_STATE)
/**
* \brief Set Permissions of a file
@@ -946,8 +943,8 @@
* #FM_SetPermissionsCmd_t
*
* \par Command Success Verification
- * - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdCounter will increment after completion
+ * - #FM_HkTlm_Payload_t.CommandCounter will increment after validation
+ * - #FM_HkTlm_Payload_t.ChildCmdCounter will increment after completion
* - Informational event #FM_SET_PERM_CMD_INF_EID will be sent
*
* \par Error Conditions
@@ -955,15 +952,18 @@
* - Error from call to OS_chmod
*
* \par Evidence of failure may be found in the following telemetry:
- * - #FM_HousekeepingPkt_Payload_t.CommandErrCounter may increment
- * - #FM_HousekeepingPkt_Payload_t.ChildCmdErrCounter may increment
+ * - #FM_HkTlm_Payload_t.CommandErrCounter may increment
+ * - #FM_HkTlm_Payload_t.ChildCmdErrCounter may increment
* - Error event #FM_SET_PERM_ERR_EID may be sent
* - Error event #FM_SET_PERM_OS_ERR_EID may be sent
*
* \par Criticality
* - There are no critical issues related to this command.
*/
-#define FM_SET_PERMISSIONS_CC 19
+#define FM_SET_PERMISSIONS_CC FM_CCVAL(SET_PERMISSIONS)
+
+/** \brief Command code limit used for validity check and array sizing */
+#define FM_NUM_COMMANDS (FM_SET_PERMISSIONS_CC + 1)
/**\}*/
diff --git a/fsw/inc/fm_interface_cfg.h b/fsw/inc/fm_interface_cfg.h
new file mode 100644
index 0000000..2f0bd87
--- /dev/null
+++ b/fsw/inc/fm_interface_cfg.h
@@ -0,0 +1,125 @@
+/************************************************************************
+ * 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 File Manager (FM) Application Public Definitions
+ *
+ * @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 FM_INTERFACE_CFG_H
+#define FM_INTERFACE_CFG_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "fm_interface_cfg_values.h"
+
+/* ====== */
+/* Macros */
+/* ====== */
+
+/**
+ * \defgroup cfsfmmissioncfg CFS File Manager Interface Configuration
+ * \{
+ */
+
+
+/**
+ * \brief Directory List Telemetry Packet Entry Count
+ *
+ * \par Description:
+ * This definition sets the number of directory entries contained
+ * in the Directory List telemetry packet. The command handler will
+ * read directory entries until reaching the index of the start entry
+ * (set via command argument) and then continue to read
+ * directory entries and populate the telemtry packet until there are
+ * either no more unread directory entries or until the telemetry
+ * packet is full.
+ *
+ * \par Limits:
+ * The FM application limits this value to be no less than 10 and
+ * and no greater than 100. The number of directory entries in the
+ * telemetry packet will in large part determine the packet size.
+ */
+#define FM_DIR_LIST_PKT_ENTRIES FM_INTERFACE_CFGVAL(DIR_LIST_PKT_ENTRIES)
+#define DEFAULT_FM_INTERFACE_DIR_LIST_PKT_ENTRIES 20
+
+/**
+ * \brief Maximum Directory List Output File Entries
+ *
+ * \par Description:
+ * This definition sets the upper limit for the number of directory
+ * entries that may be written to a Directory List output file.
+ * Directory List files are variable length, based on the number of
+ * directory entries actually written to the file. There may zero
+ * entries written to the file if the directory is empty. For most
+ * environments, this definition will play no role at all, as it
+ * will be set to a number much larger than the count of files that
+ * will ever exist in any directory at one time.
+ *
+ * \par Limits:
+ * The FM application limits this value to be no less than 100 and
+ * no greater than 10000.
+ */
+#define FM_DIR_LIST_FILE_ENTRIES FM_INTERFACE_CFGVAL(DIR_LIST_FILE_ENTRIES)
+#define DEFAULT_FM_INTERFACE_DIR_LIST_FILE_ENTRIES 3000
+
+/**
+ * \brief Directory List Output File Header Sub-Type
+ *
+ * \par Description:
+ * This definition sets the cFE File Header sub-type value for FM
+ * Directory List data files. The value may be used to differentiate
+ * FM Directory List files from other data files.
+ *
+ * \par Limits:
+ * The FM application places no limits on this unsigned 32 bit value.
+ */
+#define FM_DIR_LIST_FILE_SUBTYPE FM_INTERFACE_CFGVAL(DIR_LIST_FILE_SUBTYPE)
+#define DEFAULT_FM_INTERFACE_DIR_LIST_FILE_SUBTYPE 12345
+
+/**
+ * \brief FM argument to not calculate CRC during Get File Info command
+ */
+#define FM_IGNORE_CRC FM_INTERFACE_CFGVAL(IGNORE_CRC)
+#define DEFAULT_FM_INTERFACE_IGNORE_CRC 0
+
+/**
+ * \brief Number of Free Space Table Entries
+ *
+ * \par Description:
+ * This value defines the number of entries in both the FM file system
+ * free space table and the FM file system free space telemetry packet.
+ * Note: this value does not define the number of file systems present
+ * or supported by the CFE-OSAL, the value only defines the number of
+ * file systems for which FM may be enabled to report free space data.
+ *
+ * \par Limits:
+ * FM limits this value to be not less than 1 and not greater than 32.
+ */
+#define FM_TABLE_ENTRY_COUNT FM_INTERFACE_CFGVAL(TABLE_ENTRY_COUNT)
+#define DEFAULT_FM_INTERFACE_TABLE_ENTRY_COUNT 8
+
+/**\}*/
+
+#endif // FM_INTERFACE_CFG_H
\ No newline at end of file
diff --git a/fsw/inc/fm_platform_cfg.h b/fsw/inc/fm_internal_cfg.h
similarity index 67%
rename from fsw/inc/fm_platform_cfg.h
rename to fsw/inc/fm_internal_cfg.h
index edb9158..6a8c565 100644
--- a/fsw/inc/fm_platform_cfg.h
+++ b/fsw/inc/fm_internal_cfg.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -19,22 +18,45 @@
/**
* @file
- * Specification for the CFS FM application constants
- * that can be configured from one platform to another
+ * CFS File Manager (FM) 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 FM_PLATFORM_CFG_H
-#define FM_PLATFORM_CFG_H
+
+#ifndef FM_INTERNAL_CFG_H
+#define FM_INTERNAL_CFG_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "cfe.h"
+#include "fm_internal_cfg_values.h"
+
+/* ====== */
+/* Macros */
+/* ====== */
/**
- * \defgroup cfsfmplatformcfg CFS File Manager Platform Configuration
+ * \defgroup cfsfmplatformcfg CFS File Manager Internal Configuration
* \{
*/
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM platform configuration parameters - application definitions */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/**
+ * \brief FM directory entry definitions
+ */
+#define FM_THIS_DIRECTORY FM_INTERNAL_CFGVAL(THIS_DIRECTORY)
+#define DEFAULT_FM_INTERNAL_THIS_DIRECTORY "."
+#define FM_PARENT_DIRECTORY FM_INTERNAL_CFGVAL(PARENT_DIRECTORY)
+#define DEFAULT_FM_INTERNAL_PARENT_DIRECTORY ".."
/**
* \brief File Manager Application Name
@@ -51,7 +73,8 @@
* no limits on the definition. Refer to CFE Executive Services
* for specific information on limits related to application names.
*/
-#define FM_APP_NAME "FM"
+#define FM_APP_NAME FM_INTERNAL_CFGVAL(APP_NAME)
+#define DEFAULT_FM_INTERNAL_APP_NAME "FM"
/**
* \brief File Manager Command Pipe Name
@@ -65,7 +88,8 @@
* no limits on the definition. Refer to CFE Software Bus Services
* for specific information on limits related to pipe names.
*/
-#define FM_APP_PIPE_NAME "FM_CMD_PIPE"
+#define FM_APP_PIPE_NAME FM_INTERNAL_CFGVAL(APP_PIPE_NAME)
+#define DEFAULT_FM_INTERNAL_APP_PIPE_NAME "FM_CMD_PIPE"
/**
* \brief File Manager Command Pipe Depth
@@ -80,7 +104,8 @@
* It is recommended that this value be no less than 4 and
* no greater than 20 packets, but this is not enforced by FM.
*/
-#define FM_APP_PIPE_DEPTH 10
+#define FM_APP_PIPE_DEPTH FM_INTERNAL_CFGVAL(APP_PIPE_DEPTH)
+#define DEFAULT_FM_INTERNAL_APP_PIPE_DEPTH 10
/**
* \brief Mission specific version number for FM application
@@ -96,138 +121,8 @@
* Must be defined as a numeric value that is greater than
* or equal to zero.
*/
-#define FM_MISSION_REV 0
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM platform configuration parameters - output file definitions */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/**
- * \brief Default Directory List Output Filename
- *
- * \par Description:
- * This definition is the default output filename used by the Get
- * Directory List to File command handler when the output filename
- * is not provided. The default filename is used whenever the
- * commanded output filename is the empty string.
- *
- * \par Limits:
- * The FM application does not place a limit on this configuration
- * parameter, however the symbol must be defined and the name will
- * be subject to the same verification tests as a commanded output
- * filename. Set this parameter to the empty string if no default
- * filename is desired.
- */
-#define FM_DIR_LIST_FILE_DEFNAME "/ram/fm_dirlist.out"
-
-/**
- * \brief Maximum Directory List Output File Entries
- *
- * \par Description:
- * This definition sets the upper limit for the number of directory
- * entries that may be written to a Directory List output file.
- * Directory List files are variable length, based on the number of
- * directory entries actually written to the file. There may zero
- * entries written to the file if the directory is empty. For most
- * environments, this definition will play no role at all, as it
- * will be set to a number much larger than the count of files that
- * will ever exist in any directory at one time.
- *
- * \par Limits:
- * The FM application limits this value to be no less than 100 and
- * no greater than 10000.
- */
-#define FM_DIR_LIST_FILE_ENTRIES 3000
-
-/**
- * \brief Directory List Output File Header Sub-Type
- *
- * \par Description:
- * This definition sets the cFE File Header sub-type value for FM
- * Directory List data files. The value may be used to differentiate
- * FM Directory List files from other data files.
- *
- * \par Limits:
- * The FM application places no limits on this unsigned 32 bit value.
- */
-#define FM_DIR_LIST_FILE_SUBTYPE 12345
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM platform configuration parameters - TLM packet definitions */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/**
- * \brief Directory List Telemetry Packet Entry Count
- *
- * \par Description:
- * This definition sets the number of directory entries contained
- * in the Directory List telemetry packet. The command handler will
- * read directory entries until reaching the index of the start entry
- * (set via command argument) and then continue to read
- * directory entries and populate the telemtry packet until there are
- * either no more unread directory entries or until the telemetry
- * packet is full.
- *
- * \par Limits:
- * The FM application limits this value to be no less than 10 and
- * and no greater than 100. The number of directory entries in the
- * telemetry packet will in large part determine the packet size.
- */
-#define FM_DIR_LIST_PKT_ENTRIES 20
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM platform configuration parameters - child task definitions */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/**
- * \brief Child Task File I/O Control Settings
- *
- * \par Description:
- * These definitions control the amount of file data that the FM child task
- * will process before giving up the CPU to allow other tasks time to run.
- *
- * FM_CHILD_FILE_BLOCK_SIZE defines the size of each block of file data that
- * the FM child task will read or write. This value also defines the size
- * of the FM child task I/O buffer that exists in global memory.
- *
- * FM_CHILD_FILE_LOOP_COUNT defines the number of file data blocks that may
- * be processed before the FM child task sleeps (gives up the CPU).
- *
- * FM_CHILD_FILE_SLEEP_MS defines the length of time (in milli-secs) before
- * the FM child task wakes (re-acquires the CPU). Note that many platforms
- * will limit the precision of this value.
- *
- * Thus the combination of the 3 values control CPU use by the FM child task.
- * Using a smaller block size minimizes the amount of RAM used by the file
- * I/O buffer, but at the expense of file efficiency. Adjust each of the
- * values such that the combination is appropriate for the target platform.
- *
- * For example, if the block size is 2048 and the loop count is 16 and the
- * sleep time is 20, then while processing a 1 Mbyte file there will be
- * 32 sleep cycles of 20ms each, for a total task delay of 0.64 seconds.
- *
- * \par Limits:
- * FM_CHILD_FILE_BLOCK_SIZE: The FM application limits this value to be no
- * less than 256 bytes and no greater than 32KB.
- *
- * FM_CHILD_FILE_LOOP_COUNT: The FM application limits this value to be
- * non-zero. There is no upper limit - a very large number effectively
- * means that the FM child task will not surrender the CPU to other lower
- * priority tasks.
- *
- * FM_CHILD_FILE_SLEEP_MS: The FM application limits this value to be no
- * no greater than 100 ms. The value zero generally means a very short
- * task delay - refer to the target platform documentation for specifics.
- */
-#define FM_CHILD_FILE_BLOCK_SIZE 2048
-#define FM_CHILD_FILE_LOOP_COUNT 16
-#define FM_CHILD_FILE_SLEEP_MS 20
+#define FM_MISSION_REV FM_INTERNAL_CFGVAL(MISSION_REV)
+#define DEFAULT_FM_INTERNAL_MISSION_REV 0
/**
* \brief Child file stat sleep
@@ -262,8 +157,10 @@
* The default is zero unless the mission needs require them to be changed.
*
*/
-#define FM_CHILD_STAT_SLEEP_MS 0
-#define FM_CHILD_STAT_SLEEP_FILECOUNT 0
+#define FM_CHILD_STAT_SLEEP_MS FM_INTERNAL_CFGVAL(CHILD_STAT_SLEEP_MS)
+#define DEFAULT_FM_INTERNAL_CHILD_STAT_SLEEP_MS 0
+#define FM_CHILD_STAT_SLEEP_FILECOUNT FM_INTERNAL_CFGVAL(CHILD_STAT_SLEEP_FILECOUNT)
+#define DEFAULT_FM_INTERNAL_CHILD_STAT_SLEEP_FILECOUNT 0
/**
* \brief Child Task Command Queue Entry Count
@@ -282,7 +179,8 @@
* passing command arguments from the parent to the child task. The upper
* limit is arbitrary.
*/
-#define FM_CHILD_QUEUE_DEPTH 3
+#define FM_CHILD_QUEUE_DEPTH FM_INTERNAL_CFGVAL(CHILD_QUEUE_DEPTH)
+#define DEFAULT_FM_INTERNAL_CHILD_QUEUE_DEPTH 3
/**
* \brief Child Task Name - cFE object name
@@ -296,7 +194,8 @@
* no limits on the definition. Refer to CFE Executive Services
* for specific information on limits related to object names.
*/
-#define FM_CHILD_TASK_NAME "FM_CHILD_TASK"
+#define FM_CHILD_TASK_NAME FM_INTERNAL_CFGVAL(CHILD_TASK_NAME)
+#define DEFAULT_FM_INTERNAL_CHILD_TASK_NAME "FM_CHILD_TASK"
/**
* \brief Child Task Stack Size
@@ -312,7 +211,8 @@
* and no greater than 20480. These limits are purely arbitrary
* and may need to be modified for specific platforms.
*/
-#define FM_CHILD_TASK_STACK_SIZE 20480
+#define FM_CHILD_TASK_STACK_SIZE FM_INTERNAL_CFGVAL(CHILD_TASK_STACK_SIZE)
+#define DEFAULT_FM_INTERNAL_CHILD_TASK_STACK_SIZE 20480
/**
* \brief Child Task Execution Priority
@@ -335,7 +235,8 @@
* parent defeats the purpose of having a child task to run in
* the background.
*/
-#define FM_CHILD_TASK_PRIORITY 205
+#define FM_CHILD_TASK_PRIORITY FM_INTERNAL_CFGVAL(CHILD_TASK_PRIORITY)
+#define DEFAULT_FM_INTERNAL_CHILD_TASK_PRIORITY 205
/**
* \brief Child Task Semaphore Name - cFE object name
@@ -350,16 +251,68 @@
* no limits on the definition. Refer to CFE Executive Services
* for specific information on limits related to object names.
*/
-#define FM_CHILD_SEM_NAME "FM_CHILD_SEM"
+#define FM_CHILD_SEM_NAME FM_INTERNAL_CFGVAL(CHILD_SEM_NAME)
+#define DEFAULT_FM_INTERNAL_CHILD_SEM_NAME "FM_CHILD_SEM"
+
+/**
+ * \brief Child Task File I/O Control Settings
+ *
+ * \par Description:
+ * These definitions control the amount of file data that the FM child task
+ * will process before giving up the CPU to allow other tasks time to run.
+ *
+ * FM_CHILD_FILE_BLOCK_SIZE defines the size of each block of file data that
+ * the FM child task will read or write. This value also defines the size
+ * of the FM child task I/O buffer that exists in global memory.
+ *
+ * FM_CHILD_FILE_LOOP_COUNT defines the number of file data blocks that may
+ * be processed before the FM child task sleeps (gives up the CPU).
+ *
+ * FM_CHILD_FILE_SLEEP_MS defines the length of time (in milli-secs) before
+ * the FM child task wakes (re-acquires the CPU). Note that many platforms
+ * will limit the precision of this value.
+ *
+ * Thus the combination of the 3 values control CPU use by the FM child task.
+ * Using a smaller block size minimizes the amount of RAM used by the file
+ * I/O buffer, but at the expense of file efficiency. Adjust each of the
+ * values such that the combination is appropriate for the target platform.
+ *
+ * For example, if the block size is 2048 and the loop count is 16 and the
+ * sleep time is 20, then while processing a 1 Mbyte file there will be
+ * 32 sleep cycles of 20ms each, for a total task delay of 0.64 seconds.
+ *
+ * \par Limits:
+ * FM_CHILD_FILE_BLOCK_SIZE: The FM application limits this value to be no
+ * less than 256 bytes and no greater than 32KB.
+ *
+ * FM_CHILD_FILE_LOOP_COUNT: The FM application limits this value to be
+ * non-zero. There is no upper limit - a very large number effectively
+ * means that the FM child task will not surrender the CPU to other lower
+ * priority tasks.
+ *
+ * FM_CHILD_FILE_SLEEP_MS: The FM application limits this value to be no
+ * no greater than 100 ms. The value zero generally means a very short
+ * task delay - refer to the target platform documentation for specifics.
+ */
+#define FM_CHILD_FILE_BLOCK_SIZE FM_INTERNAL_CFGVAL(CHILD_FILE_BLOCK_SIZE)
+#define DEFAULT_FM_INTERNAL_CHILD_FILE_BLOCK_SIZE 2048
+#define FM_CHILD_FILE_LOOP_COUNT FM_INTERNAL_CFGVAL(CHILD_FILE_LOOP_COUNT)
+#define DEFAULT_FM_INTERNAL_CHILD_FILE_LOOP_COUNT 16
+#define FM_CHILD_FILE_SLEEP_MS FM_INTERNAL_CFGVAL(CHILD_FILE_SLEEP_MS)
+#define DEFAULT_FM_INTERNAL_CHILD_FILE_SLEEP_MS 20
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM platform configuration parameters - table definitions */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * \brief Wakeup for FM
+ *
+ * \par Description
+ * Wakes up FM every 1 second for routine maintenance whether a
+ * message was received or not.
+ */
+#define FM_SB_TIMEOUT FM_INTERNAL_CFGVAL(SB_TIMEOUT)
+#define DEFAULT_FM_INTERNAL_SB_TIMEOUT 1000
/**
- * \brief Free Space Table Name - cFE object name
+ * \brief Monitor Table Name - cFE object name
*
* \par Description:
* Table object name is required during table creation.
@@ -369,7 +322,8 @@
* no limits on the definition. Refer to CFE Table Services
* for specific information on limits related to table names.
*/
-#define FM_TABLE_CFE_NAME "FreeSpace"
+#define FM_TABLE_CFE_NAME FM_INTERNAL_CFGVAL(TABLE_CFE_NAME)
+#define DEFAULT_FM_INTERNAL_TABLE_CFE_NAME "Monitor"
/**
* \brief Monitor Table Name - filename with path
@@ -382,7 +336,8 @@
* no limits on the definition. If the named table does not
* exist or fails validation, the table load will fail.
*/
-#define FM_TABLE_DEF_NAME "/cf/fm_monitor.tbl"
+#define FM_TABLE_DEF_NAME FM_INTERNAL_CFGVAL(TABLE_DEF_NAME)
+#define DEFAULT_FM_INTERNAL_TABLE_DEF_NAME "/cf/fm_monitor.tbl"
/**
* \brief Monitor Table Name - filename without path
@@ -397,7 +352,8 @@
* valid then the make process may fail, or the table file may
* be unloadable to the target hardware.
*/
-#define FM_TABLE_FILENAME "fm_monitor.tbl"
+#define FM_TABLE_FILENAME FM_INTERNAL_CFGVAL(TABLE_FILENAME)
+#define DEFAULT_FM_INTERNAL_TABLE_FILENAME "fm_monitor.tbl"
/**
* \brief Free Space Table Description
@@ -412,38 +368,28 @@
* no limits on the definition. Refer to cFE Table Services
* for limits related to table descriptive text.
*/
-#define FM_TABLE_DEF_DESC "FM File System Free Space Table"
-
-/**
- * \brief Number of Free Space Table Entries
- *
- * \par Description:
- * This value defines the number of entries in both the FM file system
- * free space table and the FM file system free space telemetry packet.
- * Note: this value does not define the number of file systems present
- * or supported by the CFE-OSAL, the value only defines the number of
- * file systems for which FM may be enabled to report free space data.
- *
- * \par Limits:
- * FM limits this value to be not less than 1 and not greater than 32.
- */
-#define FM_TABLE_ENTRY_COUNT 8
+#define FM_TABLE_DEF_DESC FM_INTERNAL_CFGVAL(TABLE_DEF_DESC)
+#define DEFAULT_FM_INTERNAL_TABLE_DEF_DESC "FM File System Free Space Table"
/**
- * \brief Table Data Validation Error Code
+ * \brief Default Directory List Output Filename
*
* \par Description:
- * Table data is verified during the table load process. Should
- * the validation process fail, this value will be returned by
- * FM to cFE Table Services and displayed in an event message.
+ * This definition is the default output filename used by the Get
+ * Directory List to File command handler when the output filename
+ * is not provided. The default filename is used whenever the
+ * commanded output filename is the empty string.
*
* \par Limits:
- * FM requires that this value be defined, but otherwise places
- * no limits on the definition. Refer to cFE Table Services
- * for limits related to error return values.
+ * The FM application does not place a limit on this configuration
+ * parameter, however the symbol must be defined and the name will
+ * be subject to the same verification tests as a commanded output
+ * filename. Set this parameter to the empty string if no default
+ * filename is desired.
*/
-#define FM_TABLE_VALIDATION_ERR (-1)
+#define FM_DIR_LIST_FILE_DEFNAME FM_INTERNAL_CFGVAL(DIR_LIST_FILE_DEFNAME)
+#define DEFAULT_FM_INTERNAL_DIR_LIST_FILE_DEFNAME "/ram/fm_dirlist.out"
/**\}*/
-#endif
+#endif // FM_INTERNAL_CFG_H
\ No newline at end of file
diff --git a/fsw/inc/fm_msg.h b/fsw/inc/fm_msg.h
deleted file mode 100644
index 6d942be..0000000
--- a/fsw/inc/fm_msg.h
+++ /dev/null
@@ -1,674 +0,0 @@
-/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.1”
- *
- * Copyright (c) 2021 United States Government as represented by the
- * Administrator of the National Aeronautics and Space Administration.
- * All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License. You may obtain
- * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ************************************************************************/
-
-/**
- * @file
- * Specification for the CFS FM command and telemetry messages.
- */
-#ifndef FM_MSG_H
-#define FM_MSG_H
-
-#include
-#include
-#include
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM -- command packet structures */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/**
- * \defgroup cfsfmcmdstructs CFS File Manager Command Structures
- * \{
- */
-
-/**
- * \brief Housekeeping Request command packet structure
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-} FM_SendHkCmd_t;
-
-/**
- * \brief No-Operation command packet structure
- *
- * For command details see #FM_NOOP_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-} FM_NoopCmd_t;
-
-/**
- * \brief Reset Counters command packet structure
- *
- * For command details see #FM_RESET_COUNTERS_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-} FM_ResetCountersCmd_t;
-
-/**
- * \brief Copy/Move File command payload structure
- *
- * Contains a source and target file name and an overwrite flag
- *
- * Used by #FM_COPY_FILE_CC, #FM_MOVE_FILE_CC
- */
-typedef struct
-{
- uint16 Overwrite; /**< \brief Allow overwrite */
- char Source[OS_MAX_PATH_LEN]; /**< \brief Source filename */
- char Target[OS_MAX_PATH_LEN]; /**< \brief Target filename */
-} FM_OvwSourceTargetFilename_Payload_t;
-
-/**
- * \brief Copy File command packet structure
- *
- * For command details see #FM_COPY_FILE_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_OvwSourceTargetFilename_Payload_t Payload; /**< \brief Command payload */
-} FM_CopyFileCmd_t;
-
-/**
- * \brief Move File command packet structure
- *
- * For command details see #FM_MOVE_FILE_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_OvwSourceTargetFilename_Payload_t Payload; /**< \brief Command payload */
-} FM_MoveFileCmd_t;
-
-/**
- * \brief Source and Target filename command payload structure
- *
- * Used by #FM_RENAME_FILE_CC, #FM_DECOMPRESS_FILE_CC
- */
-typedef struct
-{
- char Source[OS_MAX_PATH_LEN]; /**< \brief Source filename */
- char Target[OS_MAX_PATH_LEN]; /**< \brief Target filename */
-} FM_SourceTargetFileName_Payload_t;
-
-/**
- * \brief Rename File command packet structure
- *
- * For command details see #FM_RENAME_FILE_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_SourceTargetFileName_Payload_t Payload; /**< \brief Command payload */
-} FM_RenameFileCmd_t;
-
-/**
- * \brief Single filename command payload structure
- *
- * Used by #FM_DELETE_FILE_CC
- */
-typedef struct
-{
- char Filename[OS_MAX_PATH_LEN]; /**< \brief Delete filename */
-} FM_SingleFilename_Payload_t;
-
-/**
- * \brief Delete File command packet structure
- *
- * For command details see #FM_DELETE_FILE_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_SingleFilename_Payload_t Payload; /**< \brief Command Payload */
-} FM_DeleteFileCmd_t;
-
-/**
- * \brief Single directory command payload structure
- *
- * Used by #FM_DELETE_ALL_FILES_CC, #FM_CREATE_DIRECTORY_CC, #FM_DELETE_DIRECTORY_CC
- */
-typedef struct
-{
- char Directory[OS_MAX_PATH_LEN]; /**< \brief Directory name */
-} FM_DirectoryName_Payload_t;
-
-/**
- * \brief Delete All command packet structure
- *
- * For command details see #FM_DELETE_ALL_FILES_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_DirectoryName_Payload_t Payload; /**< \brief Command Payload */
-} FM_DeleteAllFilesCmd_t;
-
-/**
- * \brief Decompress File command packet structure
- *
- * For command details see #FM_DECOMPRESS_FILE_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_SourceTargetFileName_Payload_t Payload; /**< \brief Command Payload */
-} FM_DecompressFileCmd_t;
-
-/**
- * \brief Two source, one target filename command payload structure
- *
- * Used by #FM_CONCAT_FILES_CC
- */
-typedef struct
-{
- char Source1[OS_MAX_PATH_LEN]; /**< \brief Source 1 filename */
- char Source2[OS_MAX_PATH_LEN]; /**< \brief Source 2 filename */
- char Target[OS_MAX_PATH_LEN]; /**< \brief Target filename */
-} FM_TwoSourceOneTarget_Payload_t;
-
-/**
- * \brief Concatenate Files command packet structure
- *
- * For command details see #FM_CONCAT_FILES_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_TwoSourceOneTarget_Payload_t Payload; /**< \brief Command Payload */
-} FM_ConcatFilesCmd_t;
-
-/**
- * \brief Filename and CRC command payload structure
- *
- * Used by #FM_GET_FILE_INFO_CC
- */
-typedef struct
-{
- char Filename[OS_MAX_PATH_LEN]; /**< \brief Filename */
- uint32 FileInfoCRC; /**< \brief File info CRC method */
-} FM_FilenameAndCRC_Payload_t;
-
-/**
- * \brief Get File Info command packet structure
- *
- * For command details see #FM_GET_FILE_INFO_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_FilenameAndCRC_Payload_t Payload; /**< \brief Command Payload */
-} FM_GetFileInfoCmd_t;
-
-/**
- * \brief Get Open Files command packet structure
- *
- * For command details see #FM_GET_OPEN_FILES_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-} FM_GetOpenFilesCmd_t;
-
-/**
- * \brief Create Directory command packet structure
- *
- * For command details see #FM_CREATE_DIRECTORY_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_DirectoryName_Payload_t Payload; /**< \brief Command Payload */
-} FM_CreateDirectoryCmd_t;
-
-/**
- * \brief Delete Directory command packet structure
- *
- * For command details see #FM_DELETE_DIRECTORY_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_DirectoryName_Payload_t Payload; /**< \brief Command Payload */
-} FM_DeleteDirectoryCmd_t;
-
-/**
- * \brief Get Directory and output to file command payload
- *
- * Contains a directory and output file name, with optional flags
- * Used by #FM_GET_DIR_LIST_FILE_CC
- */
-typedef struct
-{
- char Directory[OS_MAX_PATH_LEN]; /**< \brief Directory name */
- char Filename[OS_MAX_PATH_LEN]; /**< \brief Filename */
- uint8 GetSizeTimeMode; /**< \brief Option to query size, time, and mode of files (CPU intensive) */
- uint8 Spare01[3]; /**< \brief Padding to 32 bit boundary */
-} FM_GetDirectoryToFile_Payload_t;
-
-/**
- * \brief Get DIR List to File command packet structure
- *
- * For command details see #FM_GET_DIR_LIST_FILE_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_GetDirectoryToFile_Payload_t Payload; /**< \brief Command Payload */
-} FM_GetDirListFileCmd_t;
-
-/**
- * \brief Get Directory and output to message command payload
- *
- * Contains a directory and position offset, with optional flags
- * Used by #FM_GET_DIR_LIST_PKT_CC
- */
-typedef struct
-{
- char Directory[OS_MAX_PATH_LEN]; /**< \brief Directory name */
- uint32 DirListOffset; /**< \brief Index of 1st dir entry to put in packet */
- uint8 GetSizeTimeMode; /**< \brief Option to query size, time, and mode of files (CPU intensive) */
- uint8 Spare01[3]; /**< \brief Padding to 32 bit boundary */
-} FM_GetDirectoryToPkt_Payload_t;
-
-/**
- * \brief Get DIR List to Packet command packet structure
- *
- * For command details see #FM_GET_DIR_LIST_PKT_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_GetDirectoryToPkt_Payload_t Payload; /**< \brief Command Payload */
-} FM_GetDirListPktCmd_t;
-
-/**
- * \brief Get Free Space command packet structure
- *
- * For command details see #FM_MONITOR_FILESYSTEM_SPACE_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-} FM_MonitorFilesystemSpaceCmd_t;
-
-/**
- * \brief Table Index and State command payload structure
- *
- * Used by #FM_SET_TABLE_STATE_CC
- */
-typedef struct
-{
- uint32 TableEntryIndex; /**< \brief Table entry index */
- uint32 TableEntryState; /**< \brief New table entry state */
-} FM_TableIndexAndState_Payload_t;
-
-/**
- * \brief Set Table State command packet structure
- *
- * For command details see #FM_SET_TABLE_STATE_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_TableIndexAndState_Payload_t Payload; /**< \brief Command Payload */
-} FM_SetTableStateCmd_t;
-
-/**
- * \brief File name and mode command payload structure
- *
- * Used by #FM_SET_PERMISSIONS_CC
- */
-typedef struct
-{
- char FileName[OS_MAX_PATH_LEN]; /**< \brief File name of the permissions to set */
- uint32 Mode; /**< \brief Permissions, passed directly to OS_chmod */
-} FM_FilenameAndMode_Payload_t;
-
-/**
- * \brief Set Permissions for a file
- *
- * For command details see #FM_SET_PERMISSIONS_CC
- */
-typedef struct
-{
- CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
-
- FM_FilenameAndMode_Payload_t Payload;
-} FM_SetPermissionsCmd_t;
-
-/**\}*/
-
-/**
- * \defgroup cfsfmtlm CFS File Manager Telemetry
- * \{
- */
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM -- get directory listing telemetry structures */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/**
- * \brief Get Directory Listing entry structure
- */
-typedef struct
-{
- char EntryName[OS_MAX_PATH_LEN]; /**< \brief Directory Listing Filename */
- uint32 EntrySize; /**< \brief Directory Listing File Size */
- uint32 ModifyTime; /**< \brief Directory Listing File Last Modification Times */
- uint32 Mode; /**< \brief Mode of the file (Permissions from #OS_FILESTAT_MODE) */
-} FM_DirListEntry_t;
-
-/**
- * \brief Get Directory Listing telemetry payload
- */
-typedef struct
-{
- char DirName[OS_MAX_PATH_LEN]; /**< \brief Directory Name */
- uint32 TotalFiles; /**< \brief Number of files in the directory */
- uint32 PacketFiles; /**< \brief Number of files in this packet */
- uint32 FirstFile; /**< \brief Index into directory files of first packet file */
- FM_DirListEntry_t FileList[FM_DIR_LIST_PKT_ENTRIES]; /**< \brief Directory listing file data */
-} FM_DirListPkt_Payload_t;
-
-/**
- * \brief Get Directory Listing telemetry packet
- */
-typedef struct
-{
- CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry Header */
-
- FM_DirListPkt_Payload_t Payload; /**< \brief Telemetry Payload */
-} FM_DirListPkt_t;
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM -- get directory listing to file structures */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/**
- * \brief Get Directory Listing file statistics structure
- */
-typedef struct
-{
- char DirName[OS_MAX_PATH_LEN]; /**< \brief Directory name */
- uint32 DirEntries; /**< \brief Number of entries in the directory */
- uint32 FileEntries; /**< \brief Number of entries written to output file */
-} FM_DirListFileStats_t;
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM -- get file information telemetry structure */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/**
- * \brief Get File Info telemetry payload
- */
-typedef struct
-{
- uint8 FileStatus; /**< \brief Status indicating whether the file is open or closed */
- uint8 CRC_Computed; /**< \brief Flag indicating whether a CRC was computed or not */
- uint8 Spare[2]; /**< \brief Structure padding */
- uint32 CRC; /**< \brief CRC value if computed */
- uint32 FileSize; /**< \brief File Size */
- uint32 LastModifiedTime; /**< \brief Last Modification Time of File */
- uint32 Mode; /**< \brief Mode of the file (Permissions) */
- char Filename[OS_MAX_PATH_LEN]; /**< \brief Name of File */
-} FM_FileInfoPkt_Payload_t;
-
-/**
- * \brief Get File Info telemetry packet
- */
-typedef struct
-{
- CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry Header */
-
- FM_FileInfoPkt_Payload_t Payload; /**< \brief Telemetry Payload */
-} FM_FileInfoPkt_t;
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM -- get open files list telemetry structures */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/**
- * \brief Get Open Files list entry structure
- */
-typedef struct
-{
- char LogicalName[OS_MAX_PATH_LEN]; /**< \brief Logical filename */
- char AppName[OS_MAX_API_NAME]; /**< \brief Application that opened file */
-} FM_OpenFilesEntry_t;
-
-/**
- * \brief Get Open Files telemetry payload
- */
-typedef struct
-{
- uint32 NumOpenFiles; /**< \brief Number of files opened via cFE */
- FM_OpenFilesEntry_t OpenFilesList[OS_MAX_NUM_OPEN_FILES]; /**< \brief List of files opened via cFE */
-} FM_OpenFilesPkt_Payload_t;
-
-/**
- * \brief Get Open Files telemetry packet
- */
-typedef struct
-{
- CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry Header */
-
- FM_OpenFilesPkt_Payload_t Payload; /**< \brief Telemetry Payload */
-} FM_OpenFilesPkt_t;
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM -- monitor filesystem telemetry structures */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/**
- * \brief Monitor filesystem list entry structure
- */
-typedef struct
-{
- uint8 ReportType;
- uint8 Padding[7]; /**< \brief Padding to align Name (and subsequent members) to 64-bit boundaries */
- char Name[OS_MAX_PATH_LEN]; /**< \brief File system name */
- uint64 Blocks; /**< \brief Block count from last check/poll, 0 if unknown */
- uint64 Bytes; /**< \brief Byte count from last check/poll, 0 if unknown */
-} FM_MonitorReportEntry_t;
-
-/**
- * \brief Monitor filesystem telemetry payload
- */
-typedef struct
-{
- FM_MonitorReportEntry_t FileSys[FM_TABLE_ENTRY_COUNT]; /**< \brief Array of file system free space entries */
-} FM_MonitorReportPkt_Payload_t;
-
-/**
- * \brief Monitor filesystem telemetry packet
- */
-typedef struct
-{
- CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry Header */
-
- FM_MonitorReportPkt_Payload_t Payload; /**< \brief Telemetry Payload */
-} FM_MonitorReportPkt_t;
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM -- housekeeping telemetry structure */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/**
- * \brief Housekeeping telemetry payload
- */
-typedef struct
-{
- uint8 CommandCounter; /**< \brief Application command counter */
- uint8 CommandErrCounter; /**< \brief Application command error counter */
- uint8 Spare; /**< \brief Placeholder for unused command warning counter */
-
- uint8 NumOpenFiles; /**< \brief Number of open files in the system */
-
- uint8 ChildCmdCounter; /**< \brief Child task command counter */
- uint8 ChildCmdErrCounter; /**< \brief Child task command error counter */
- uint8 ChildCmdWarnCounter; /**< \brief Child task command warning counter */
-
- uint8 ChildQueueCount; /**< \brief Number of pending commands in queue */
-
- uint8 ChildCurrentCC; /**< \brief Command code currently executing */
- uint8 ChildPreviousCC; /**< \brief Command code previously executed */
-} FM_HousekeepingPkt_Payload_t;
-
-/**
- * \brief Housekeeping telemetry packet
- */
-typedef struct
-{
- CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry Header */
-
- FM_HousekeepingPkt_Payload_t Payload; /**< \brief Telemetry Payload */
-} FM_HousekeepingPkt_t;
-
-/**\}*/
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM -- monitor filesyste table structures */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-typedef enum
-{
- /**
- * Table entry is not used, these entries are ignored
- */
- FM_MonitorTableEntry_Type_UNUSED = 0,
-
- /**
- * Monitor the free space on given volume
- *
- * The given path will be passed to OS_FileSysStatVolume() and the results
- * will be reported in the generated TLM entry.
- */
- FM_MonitorTableEntry_Type_VOLUME_FREE_SPACE = 1,
-
- /**
- * Estimate the sum of space used by files within specified directory
- *
- * The given path will be opened as a directory. The size of each regular
- * file present in that directory will be summed to produce an estimate of the
- * total space associated with that directory.
- *
- * Note that this yields only an estimate, as there can be discrepancies
- * between the file size as observed by this method and the actual disk blocks
- * used by a given file.
- */
- FM_MonitorTableEntry_Type_DIRECTORY_ESTIMATE = 2
-} FM_MonitorTableEntry_Type_t;
-
-/**
- * \brief Monitor table entry
- */
-typedef struct
-{
- /**
- * Table entry type.
- *
- * This should be one of the enumeration values in FM_MonitorTableEntry_Type_t.
- * It is defined as a uint8 in this table to ensure a consistent size.
- */
- uint8_t Type;
-
- /**
- * Boolean flag indicating whether this entry is active or not
- */
- uint8_t Enabled;
-
- /**
- * Location to monitor
- *
- * The interpretation of this string depends on Type
- * See description of the FM_MonitorTableEntry_Type_t for how this is to be set
- */
- char Name[OS_MAX_PATH_LEN];
-} FM_MonitorTableEntry_t;
-
-/**
- * \brief Get Free Space table definition
- */
-typedef struct
-{
- FM_MonitorTableEntry_t Entries[FM_TABLE_ENTRY_COUNT]; /**< \brief One entry for each monitor */
-} FM_MonitorTable_t;
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM -- child task interface command queue entry */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/**
- * \brief Child Task Interface command queue entry structure
- */
-typedef struct
-{
- CFE_MSG_FcnCode_t CommandCode; /**< \brief Command code - identifies the command */
- uint16 Padding1; /**< \brief Structure padding to align to 32-bit boundaries */
- uint32 DirListOffset; /**< \brief Starting entry for dir list commands */
- uint32 FileInfoState; /**< \brief File info state */
- uint32 FileInfoSize; /**< \brief File info size */
- uint32 FileInfoTime; /**< \brief File info time */
- uint32 FileInfoCRC; /**< \brief File info CRC method */
- char Source1[OS_MAX_PATH_LEN]; /**< \brief First source file or directory name command argument */
- char Source2[OS_MAX_PATH_LEN]; /**< \brief Second source filename command argument */
- char Target[OS_MAX_PATH_LEN]; /**< \brief Target filename command argument */
- uint8 GetSizeTimeMode; /**< \brief Whether to invoke stat call for size and time (CPU intensive) */
- uint8 Padding2[3]; /**< \brief Structure padding to align to 32-bit boundaries */
- uint32 Mode; /**< \brief File Mode */
-} FM_ChildQueueEntry_t;
-
-#endif
diff --git a/fsw/inc/fm_topicids.h b/fsw/inc/fm_topicids.h
new file mode 100644
index 0000000..ccc7e7a
--- /dev/null
+++ b/fsw/inc/fm_topicids.h
@@ -0,0 +1,53 @@
+/************************************************************************
+ * 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
+ * File Manager (FM) Application Topic IDs
+ */
+
+#ifndef FM_TOPICIDS_H
+#define FM_TOPICIDS_H
+
+/* ======== */
+/* Includes */
+/* ======== */
+
+#include "fm_topicid_values.h"
+
+/* ====== */
+/* Macros */
+/* ====== */
+
+#define FM_MISSION_CMD_TOPICID FM_MISSION_TIDVAL(CMD)
+#define DEFAULT_FM_MISSION_CMD_TOPICID 0x8C
+#define FM_MISSION_SEND_HK_TOPICID FM_MISSION_TIDVAL(SEND_HK)
+#define DEFAULT_FM_MISSION_SEND_HK_TOPICID 0x8D
+
+#define FM_MISSION_HK_TLM_TOPICID FM_MISSION_TIDVAL(HK_TLM)
+#define DEFAULT_FM_MISSION_HK_TLM_TOPICID 0x8A
+#define FM_MISSION_FILE_INFO_TLM_TOPICID FM_MISSION_TIDVAL(FILE_INFO_TLM)
+#define DEFAULT_FM_MISSION_FILE_INFO_TLM_TOPICID 0x8B
+#define FM_MISSION_DIR_LIST_TLM_TOPICID FM_MISSION_TIDVAL(DIR_LIST_TLM)
+#define DEFAULT_FM_MISSION_DIR_LIST_TLM_TOPICID 0x8C
+#define FM_MISSION_OPEN_FILES_TLM_TOPICID FM_MISSION_TIDVAL(OPEN_FILES_TLM)
+#define DEFAULT_FM_MISSION_OPEN_FILES_TLM_TOPICID 0x8D
+#define FM_MISSION_MONITOR_TLM_TOPICID FM_MISSION_TIDVAL(MONITOR_TLM)
+#define DEFAULT_FM_MISSION_MONITOR_TLM_TOPICID 0x8E
+
+#endif // FM_TOPICIDS_H
\ No newline at end of file
diff --git a/fsw/src/fm_app.c b/fsw/src/fm_app.c
index c049c59..9c33a23 100644
--- a/fsw/src/fm_app.c
+++ b/fsw/src/fm_app.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -35,16 +34,17 @@
#include "fm_msgdefs.h"
#include "fm_msgids.h"
#include "fm_app.h"
-#include "fm_tbl.h"
+#include "fm_table_utils.h"
#include "fm_child.h"
#include "fm_cmds.h"
#include "fm_cmd_utils.h"
#include "fm_dispatch.h"
-#include "fm_events.h"
+#include "fm_eventids.h"
#include "fm_perfids.h"
#include "fm_platform_cfg.h"
#include "fm_version.h"
#include "fm_verify.h"
+#include "fm_compression.h"
#include
@@ -54,7 +54,7 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-FM_GlobalData_t FM_GlobalData;
+FM_AppData_t FM_AppData;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
@@ -96,7 +96,7 @@ void FM_AppMain(void)
CFE_ES_PerfLogExit(FM_APPMAIN_PERF_ID);
/* Wait for the next Software Bus message */
- Result = CFE_SB_ReceiveBuffer(&BufPtr, FM_GlobalData.CmdPipe, FM_SB_TIMEOUT);
+ Result = CFE_SB_ReceiveBuffer(&BufPtr, FM_AppData.CmdPipe, FM_SB_TIMEOUT);
/* Performance Log (start time counter) */
CFE_ES_PerfLogEntry(FM_APPMAIN_PERF_ID);
@@ -106,7 +106,7 @@ void FM_AppMain(void)
if (BufPtr != NULL)
{
/* Process Software Bus message */
- FM_ProcessPkt(BufPtr);
+ FM_TaskPipe(BufPtr);
}
else
{
@@ -118,15 +118,7 @@ void FM_AppMain(void)
RunStatus = CFE_ES_RunStatus_APP_ERROR;
}
}
- else if (Result == CFE_SB_TIME_OUT)
- {
- /* Allow cFE the chance to manage tables. This is typically done
- * during the housekeeping cycle, but if housekeeping is done at
- * less than a 1Hz rate the table management is done here as well. */
- FM_ReleaseTablePointers();
- FM_AcquireTablePointers();
- }
- else
+ else if (Result != CFE_SB_TIME_OUT && Result != CFE_SB_NO_MESSAGE)
{
/* Process Software Bus error */
CFE_EVS_SendEvent(FM_SB_RECEIVE_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -171,7 +163,12 @@ CFE_Status_t FM_AppInit(void)
CFE_Status_t Result = CFE_SUCCESS;
/* Initialize global data */
- memset(&FM_GlobalData, 0, sizeof(FM_GlobalData));
+ memset(&FM_AppData, 0, sizeof(FM_AppData));
+
+ /* Initialize housekeeping telemetry message */
+ CFE_MSG_Init(CFE_MSG_PTR(FM_AppData.HkTlm.TelemetryHeader),
+ CFE_SB_ValueToMsgId(FM_HK_TLM_MID),
+ sizeof(FM_HkTlm_t));
/* Register for event services */
Result = CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY);
@@ -183,7 +180,7 @@ CFE_Status_t FM_AppInit(void)
else
{
/* Create Software Bus message pipe */
- Result = CFE_SB_CreatePipe(&FM_GlobalData.CmdPipe, FM_APP_PIPE_DEPTH, FM_APP_PIPE_NAME);
+ Result = CFE_SB_CreatePipe(&FM_AppData.CmdPipe, FM_APP_PIPE_DEPTH, FM_APP_PIPE_NAME);
if (Result != CFE_SUCCESS)
{
CFE_EVS_SendEvent(FM_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR, "%s create SB input pipe: result = 0x%08X",
@@ -192,7 +189,7 @@ CFE_Status_t FM_AppInit(void)
else
{
/* Subscribe to Housekeeping request commands */
- Result = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(FM_SEND_HK_MID), FM_GlobalData.CmdPipe);
+ Result = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(FM_SEND_HK_MID), FM_AppData.CmdPipe);
if (Result != CFE_SUCCESS)
{
@@ -206,7 +203,7 @@ CFE_Status_t FM_AppInit(void)
if (Result == CFE_SUCCESS)
{
/* Subscribe to FM ground command packets */
- Result = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(FM_CMD_MID), FM_GlobalData.CmdPipe);
+ Result = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(FM_CMD_MID), FM_AppData.CmdPipe);
if (Result != CFE_SUCCESS)
{
@@ -240,43 +237,3 @@ CFE_Status_t FM_AppInit(void)
return Result;
}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM application -- housekeeping request packet processor */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-void FM_SendHkCmd(const CFE_SB_Buffer_t *BufPtr)
-{
- FM_HousekeepingPkt_Payload_t *PayloadPtr;
-
- FM_ReleaseTablePointers();
-
- FM_AcquireTablePointers();
-
- /* Initialize housekeeping telemetry message */
- CFE_MSG_Init(CFE_MSG_PTR(FM_GlobalData.HousekeepingPkt.TelemetryHeader), CFE_SB_ValueToMsgId(FM_HK_TLM_MID),
- sizeof(FM_HousekeepingPkt_t));
-
- PayloadPtr = &FM_GlobalData.HousekeepingPkt.Payload;
-
- /* Report application command counters */
- PayloadPtr->CommandCounter = FM_GlobalData.CommandCounter;
- PayloadPtr->CommandErrCounter = FM_GlobalData.CommandErrCounter;
-
- PayloadPtr->NumOpenFiles = FM_GetOpenFilesData(NULL);
-
- /* Report child task command counters */
- PayloadPtr->ChildCmdCounter = FM_GlobalData.ChildCmdCounter;
- PayloadPtr->ChildCmdErrCounter = FM_GlobalData.ChildCmdErrCounter;
- PayloadPtr->ChildCmdWarnCounter = FM_GlobalData.ChildCmdWarnCounter;
-
- PayloadPtr->ChildQueueCount = FM_GlobalData.ChildQueueCount;
-
- /* Report current and previous commands executed by the child task */
- PayloadPtr->ChildCurrentCC = FM_GlobalData.ChildCurrentCC;
- PayloadPtr->ChildPreviousCC = FM_GlobalData.ChildPreviousCC;
-
- CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_GlobalData.HousekeepingPkt.TelemetryHeader));
- CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_GlobalData.HousekeepingPkt.TelemetryHeader), true);
-}
diff --git a/fsw/src/fm_app.h b/fsw/src/fm_app.h
index 7ec7bcb..b2040b6 100644
--- a/fsw/src/fm_app.h
+++ b/fsw/src/fm_app.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -17,88 +16,62 @@
* limitations under the License.
************************************************************************/
-/**
- * @file
- * Unit specification for the CFS File Manager Application.
- */
#ifndef FM_APP_H
#define FM_APP_H
-#include "cfe.h"
-#include "fm_msg.h"
+/* ======= */
+/* Include */
+/* ======= */
+
+#include "fm_tblstruct.h"
+#include "fm_internal_cfg.h"
+#include "fm_msgstruct.h"
+#include "fm_child.h"
#include "fm_compression.h"
+#include "cfe.h"
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM -- application global constants */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* ======= */
+/* Globals */
+/* ======= */
/**
- * \brief Wakeup for FM
- *
- * \par Description
- * Wakes up FM every 1 second for routine maintenance whether a
- * message was received or not.
+ * \brief Get Directory Listing file statistics structure
*/
-#define FM_SB_TIMEOUT 1000
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM -- application global data structure */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+typedef struct
+{
+ char DirName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Directory name */
+ uint32 DirEntries; /**< \brief Number of entries in the directory */
+ uint32 FileEntries; /**< \brief Number of entries written to output file */
+} FM_DirListFileStats_t;
/**
* \brief Application global data structure
*/
typedef struct
{
- FM_MonitorTable_t *MonitorTablePtr; /**< \brief File System Table Pointer */
- CFE_TBL_Handle_t MonitorTableHandle; /**< \brief File System Table Handle */
-
- CFE_SB_PipeId_t CmdPipe; /**< \brief cFE software bus command pipe */
-
- CFE_ES_TaskId_t ChildTaskID; /**< \brief Child task ID */
- osal_id_t ChildSemaphore; /**< \brief Child task wakeup counting semaphore */
- osal_id_t ChildQueueCountSem; /**< \brief Child queue counter mutex semaphore */
-
- uint8 ChildCmdCounter; /**< \brief Child task command success counter */
- uint8 ChildCmdErrCounter; /**< \brief Child task command error counter */
- uint8 ChildCmdWarnCounter; /**< \brief Child task command warning counter */
-
- uint8 ChildWriteIndex; /**< \brief Array index for next write to command args */
- uint8 ChildReadIndex; /**< \brief Array index for next read from command args */
- uint8 ChildQueueCount; /**< \brief Number of pending commands in queue */
-
- uint8 CommandCounter; /**< \brief Application command success counter */
- uint8 CommandErrCounter; /**< \brief Application command error counter */
- uint8 Spare8a; /**< \brief Placeholder for unused command warning counter */
-
- uint8 ChildCurrentCC; /**< \brief Command code currently executing */
- uint8 ChildPreviousCC; /**< \brief Command code previously executed */
- uint8 Spare8b; /**< \brief Structure alignment spare */
-
- uint32 FileStatTime; /**< \brief Modify time from most recent OS_stat */
- uint32 FileStatSize; /**< \brief File size from most recent OS_stat */
- uint32 FileStatMode; /**< \brief File mode from most recent OS_stat (OS_FILESTAT_MODE) */
-
- FM_DirListFileStats_t DirListFileStats; /**< \brief Get dir list to file statistics structure */
-
- FM_DirListPkt_t DirListPkt; /**< \brief Get dir list to packet telemetry packet */
-
- FM_MonitorReportPkt_t
- MonitorReportPkt; /**< \brief Telemetry packet reporting status of items in the monitor table */
-
- FM_FileInfoPkt_t FileInfoPkt; /**< \brief Get file info telemetry packet */
-
- FM_OpenFilesPkt_t OpenFilesPkt; /**< \brief Get open files telemetry packet */
-
- FM_HousekeepingPkt_t HousekeepingPkt; /**< \brief Application housekeeping telemetry packet */
-
- char ChildBuffer[FM_CHILD_FILE_BLOCK_SIZE]; /**< \brief Child task file I/O buffer */
-
- FM_ChildQueueEntry_t ChildQueue[FM_CHILD_QUEUE_DEPTH]; /**< \brief Child task command queue */
+ FM_MonitorTable_t *MonitorTablePtr; /** \brief File System Table Pointer */
+ CFE_TBL_Handle_t MonitorTableHandle; /** \brief File System Table Handle */
+ CFE_SB_PipeId_t CmdPipe; /** \brief cFE software bus command pipe */
+ CFE_ES_TaskId_t ChildTaskID; /** \brief Child task ID */
+ osal_id_t ChildSemaphore; /** \brief Child task wakeup counting semaphore */
+ osal_id_t ChildQueueCountSem; /** \brief Child queue counter mutex semaphore */
+ uint8 ChildWriteIndex; /** \brief Array index for next write to command args */
+ uint8 ChildReadIndex; /** \brief Array index for next read from command args */
+
+ uint8 Spare8a; /** \brief Placeholder for unused command warning counter */
+ uint8 Spare8b; /** \brief Structure alignment spare */
+
+ uint32 FileStatTime; /** \brief Modify time from most recent OS_stat */
+ uint32 FileStatSize; /** \brief File size from most recent OS_stat */
+ uint32 FileStatMode; /** \brief File mode from most recent OS_stat (OS_FILESTAT_MODE) */
+ FM_DirListFileStats_t DirListFileStats; /** \brief Get dir list to file statistics structure */
+ FM_DirListPkt_t DirListPkt; /** \brief Get dir list to packet telemetry packet */
+ FM_MonitorReportPkt_t MonitorReportPkt; /** \brief Telemetry packet reporting status of items in the monitor table */
+ FM_FileInfoPkt_t FileInfoPkt; /** \brief Get file info telemetry packet */
+ FM_OpenFilesPkt_t OpenFilesPkt; /** \brief Get open files telemetry packet */
+ FM_HkTlm_t HkTlm; /** \brief Application housekeeping telemetry packet */
+ char ChildBuffer[FM_CHILD_FILE_BLOCK_SIZE]; /** \brief Child task file I/O buffer */
+ FM_ChildQueueEntry_t ChildQueue[FM_CHILD_QUEUE_DEPTH]; /** \brief Child task command queue */
/**
* \brief State of the embedded decompression routine
@@ -111,7 +84,7 @@ typedef struct
* This depends on the compression option and may be NULL
*/
FM_Compressor_State_t *CompressorStatePtr;
-} FM_GlobalData_t;
+} FM_AppData_t;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
@@ -134,7 +107,7 @@ typedef struct
*
* \par Assumptions, External Events, and Notes: None
*
- * \sa #FM_AppInit, #CFE_ES_RunLoop, #FM_ProcessPkt
+ * \sa #FM_AppInit, #CFE_ES_RunLoop, #FM_TaskPipe
*/
void FM_AppMain(void);
@@ -160,25 +133,6 @@ void FM_AppMain(void);
*/
CFE_Status_t FM_AppInit(void);
-/**
- * \brief Housekeeping Request Command Handler
- *
- * \par Description
- *
- * Allow CFE Table Services the opportunity to manage the File System
- * Free Space Table. This provides a mechanism to receive table updates.
- *
- * Populate the FM application Housekeeping Telemetry packet. Timestamp
- * the packet and send it to ground via the Software Bus.
- *
- * \par Assumptions, External Events, and Notes: None
- *
- * \param [in] BufPtr Pointer to Software Bus command packet.
- *
- * \sa #FM_SendHkCmd_t, #FM_HousekeepingPkt_t
- */
-void FM_SendHkCmd(const CFE_SB_Buffer_t *BufPtr);
-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* FM application global data structure instance */
@@ -186,6 +140,6 @@ void FM_SendHkCmd(const CFE_SB_Buffer_t *BufPtr);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** \brief File Manager global */
-extern FM_GlobalData_t FM_GlobalData;
+extern FM_AppData_t FM_AppData;
#endif
diff --git a/fsw/src/fm_child.c b/fsw/src/fm_child.c
index 5469118..6aaa72f 100644
--- a/fsw/src/fm_child.c
+++ b/fsw/src/fm_child.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,15 @@
#include "fm_msg.h"
#include "fm_msgdefs.h"
#include "fm_msgids.h"
-#include "fm_events.h"
+#include "fm_eventids.h"
#include "fm_app.h"
#include "fm_child.h"
#include "fm_cmds.h"
#include "fm_cmd_utils.h"
#include "fm_perfids.h"
#include "fm_platform_cfg.h"
-#include "fm_verify.h"
+#include "fm_extern_typedefs.h"
+#include "fm_compression.h"
#include
@@ -56,13 +56,13 @@
CFE_Status_t FM_ChildInit(void)
{
- int32 TaskTextLen = OS_MAX_PATH_LEN;
- char TaskText[OS_MAX_PATH_LEN] = "\0";
+ int32 TaskTextLen = CFE_MISSION_MAX_PATH_LEN;
+ char TaskText[CFE_MISSION_MAX_PATH_LEN] = "\0";
CFE_Status_t Result = CFE_SUCCESS;
uint32 TaskEID = 0;
/* Create counting semaphore (given by parent to wake-up child) */
- Result = OS_CountSemCreate(&FM_GlobalData.ChildSemaphore, FM_CHILD_SEM_NAME, 0, 0);
+ Result = OS_CountSemCreate(&FM_AppData.ChildSemaphore, FM_CHILD_SEM_NAME, 0, 0);
if (Result != CFE_SUCCESS)
{
TaskEID = FM_CHILD_INIT_SEM_ERR_EID;
@@ -72,7 +72,7 @@ CFE_Status_t FM_ChildInit(void)
else
{
/* Create mutex semaphore (protect access to ChildQueueCount) */
- Result = OS_MutSemCreate(&FM_GlobalData.ChildQueueCountSem, FM_QUEUE_SEM_NAME, 0);
+ Result = OS_MutSemCreate(&FM_AppData.ChildQueueCountSem, FM_QUEUE_SEM_NAME, 0);
if (Result != CFE_SUCCESS)
{
@@ -83,7 +83,7 @@ CFE_Status_t FM_ChildInit(void)
else
{
/* Create child task (low priority command handler) */
- Result = CFE_ES_CreateChildTask(&FM_GlobalData.ChildTaskID, FM_CHILD_TASK_NAME, FM_ChildTask, 0,
+ Result = CFE_ES_CreateChildTask(&FM_AppData.ChildTaskID, FM_CHILD_TASK_NAME, FM_ChildTask, 0,
FM_CHILD_TASK_STACK_SIZE, FM_CHILD_TASK_PRIORITY, 0);
if (Result != CFE_SUCCESS)
{
@@ -123,7 +123,7 @@ void FM_ChildTask(void)
FM_ChildLoop();
/* Clear the semaphore ID */
- FM_GlobalData.ChildSemaphore = OS_OBJECT_ID_UNDEFINED;
+ FM_AppData.ChildSemaphore = OS_OBJECT_ID_UNDEFINED;
/* This call allows cFE to clean-up system resources */
CFE_ES_ExitChildTask();
@@ -143,7 +143,7 @@ void FM_ChildLoop(void)
while (Result == CFE_SUCCESS)
{
/* Pend on the "handshake" semaphore */
- Result = OS_CountSemTake(FM_GlobalData.ChildSemaphore);
+ Result = OS_CountSemTake(FM_AppData.ChildSemaphore);
/* Mark the period when this task is active */
CFE_ES_PerfLogEntry(FM_CHILD_TASK_PERF_ID);
@@ -151,19 +151,19 @@ void FM_ChildLoop(void)
if (Result == CFE_SUCCESS)
{
/* Make sure the parent/child handshake is not broken */
- if (FM_GlobalData.ChildQueueCount == 0)
+ if (FM_AppData.HkTlm.Payload.ChildQueueCount == 0)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
CFE_EVS_SendEvent(FM_CHILD_TERM_EMPTYQ_ERR_EID, CFE_EVS_EventType_ERROR, "%s empty queue", TaskText);
/* Set result that will terminate child task run loop */
Result = OS_ERROR;
}
- else if (FM_GlobalData.ChildReadIndex >= FM_CHILD_QUEUE_DEPTH)
+ else if (FM_AppData.ChildReadIndex >= FM_CHILD_QUEUE_DEPTH)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
CFE_EVS_SendEvent(FM_CHILD_TERM_QIDX_ERR_EID, CFE_EVS_EventType_ERROR,
- "%s invalid queue index: index = %d", TaskText, (int)FM_GlobalData.ChildReadIndex);
+ "%s invalid queue index: index = %d", TaskText, (int)FM_AppData.ChildReadIndex);
/* Set result that will terminate child task run loop */
Result = OS_ERROR;
@@ -193,7 +193,7 @@ void FM_ChildLoop(void)
void FM_ChildProcess(void)
{
const char * TaskText = "Child Task";
- FM_ChildQueueEntry_t *CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildReadIndex];
+ FM_ChildQueueEntry_t *CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildReadIndex];
/* Invoke the command-specific handler */
switch (CmdArgs->CommandCode)
@@ -251,24 +251,24 @@ void FM_ChildProcess(void)
break;
default:
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
CFE_EVS_SendEvent(FM_CHILD_EXE_ERR_EID, CFE_EVS_EventType_ERROR,
"%s execution error: invalid command code: cc = %d", TaskText, (int)CmdArgs->CommandCode);
break;
}
/* Update the handshake queue read index */
- FM_GlobalData.ChildReadIndex++;
+ FM_AppData.ChildReadIndex++;
- if (FM_GlobalData.ChildReadIndex >= FM_CHILD_QUEUE_DEPTH)
+ if (FM_AppData.ChildReadIndex >= FM_CHILD_QUEUE_DEPTH)
{
- FM_GlobalData.ChildReadIndex = 0;
+ FM_AppData.ChildReadIndex = 0;
}
/* Prevent parent/child updating queue counter at same time */
- OS_MutSemTake(FM_GlobalData.ChildQueueCountSem);
- FM_GlobalData.ChildQueueCount--;
- OS_MutSemGive(FM_GlobalData.ChildQueueCountSem);
+ OS_MutSemTake(FM_AppData.ChildQueueCountSem);
+ FM_AppData.HkTlm.Payload.ChildQueueCount--;
+ OS_MutSemGive(FM_AppData.ChildQueueCountSem);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -283,14 +283,14 @@ void FM_ChildCopyCmd(const FM_ChildQueueEntry_t *CmdArgs)
int32 OS_Status = OS_SUCCESS;
/* Report current child task activity */
- FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = CmdArgs->CommandCode;
/* Note the order of the arguments to OS_cp (src,tgt) */
OS_Status = OS_cp(CmdArgs->Source1, CmdArgs->Target);
if (OS_Status != OS_SUCCESS)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_COPY_OS_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -299,7 +299,7 @@ void FM_ChildCopyCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
else
{
- FM_GlobalData.ChildCmdCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter++;
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_COPY_CMD_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command: src = %s, tgt = %s", CmdText,
@@ -307,8 +307,8 @@ void FM_ChildCopyCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
/* Report previous child task activity */
- FM_GlobalData.ChildPreviousCC = CmdArgs->CommandCode;
- FM_GlobalData.ChildCurrentCC = 0;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -323,13 +323,13 @@ void FM_ChildMoveCmd(const FM_ChildQueueEntry_t *CmdArgs)
int32 OS_Status = OS_SUCCESS;
/* Report current child task activity */
- FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = CmdArgs->CommandCode;
OS_Status = OS_mv(CmdArgs->Source1, CmdArgs->Target);
if (OS_Status != OS_SUCCESS)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_MOVE_OS_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -338,7 +338,7 @@ void FM_ChildMoveCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
else
{
- FM_GlobalData.ChildCmdCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter++;
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_MOVE_CMD_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command: src = %s, tgt = %s", CmdText,
@@ -346,8 +346,8 @@ void FM_ChildMoveCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
/* Report previous child task activity */
- FM_GlobalData.ChildPreviousCC = CmdArgs->CommandCode;
- FM_GlobalData.ChildCurrentCC = 0;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -362,13 +362,13 @@ void FM_ChildRenameCmd(const FM_ChildQueueEntry_t *CmdArgs)
int32 OS_Status = OS_SUCCESS;
/* Report current child task activity */
- FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = CmdArgs->CommandCode;
OS_Status = OS_rename(CmdArgs->Source1, CmdArgs->Target);
if (OS_Status != OS_SUCCESS)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_RENAME_OS_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -377,7 +377,7 @@ void FM_ChildRenameCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
else
{
- FM_GlobalData.ChildCmdCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter++;
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_RENAME_CMD_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command: src = %s, tgt = %s",
@@ -385,8 +385,8 @@ void FM_ChildRenameCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
/* Report previous child task activity */
- FM_GlobalData.ChildPreviousCC = CmdArgs->CommandCode;
- FM_GlobalData.ChildCurrentCC = 0;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -401,13 +401,13 @@ void FM_ChildDeleteCmd(const FM_ChildQueueEntry_t *CmdArgs)
int32 OS_Status = OS_SUCCESS;
/* Report current child task activity */
- FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = CmdArgs->CommandCode;
OS_Status = OS_remove(CmdArgs->Source1);
if (OS_Status != OS_SUCCESS)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_DELETE_OS_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -416,7 +416,7 @@ void FM_ChildDeleteCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
else
{
- FM_GlobalData.ChildCmdCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter++;
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_DELETE_CMD_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command: file = %s", CmdText,
@@ -424,8 +424,8 @@ void FM_ChildDeleteCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
/* Report previous child task activity */
- FM_GlobalData.ChildPreviousCC = CmdArgs->CommandCode;
- FM_GlobalData.ChildCurrentCC = 0;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -439,13 +439,13 @@ void FM_ChildDeleteAllFilesCmd(FM_ChildQueueEntry_t *CmdArgs)
const char *CmdText = "Delete All Files";
osal_id_t DirId = OS_OBJECT_ID_UNDEFINED;
os_dirent_t DirEntry;
- int32 OS_Status = OS_SUCCESS;
- uint32 FilenameState = FM_NAME_IS_INVALID;
- uint32 NameLength = 0;
+ int32 OS_Status;
+ uint32 FilenameState;
+ uint32 NameLength;
uint32 DeleteCount = 0;
uint32 FilesNotDeletedCount = 0;
uint32 DirectoriesSkippedCount = 0;
- char Filename[2 * OS_MAX_PATH_LEN] = "";
+ char Filename[2 * CFE_MISSION_MAX_PATH_LEN] = "";
/*
** Command argument usage for this command:
@@ -460,14 +460,14 @@ void FM_ChildDeleteAllFilesCmd(FM_ChildQueueEntry_t *CmdArgs)
memset(&DirEntry, 0, sizeof(DirEntry));
/* Report current child task activity */
- FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = CmdArgs->CommandCode;
/* Open directory so that we can read from it */
OS_Status = OS_DirectoryOpen(&DirId, Directory);
if (OS_Status != OS_SUCCESS)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_DELETE_ALL_OS_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -488,14 +488,14 @@ void FM_ChildDeleteAllFilesCmd(FM_ChildQueueEntry_t *CmdArgs)
/* Construct full path filename */
NameLength = snprintf(Filename, sizeof(Filename), "%s%s", DirWithSep, OS_DIRENTRY_NAME(DirEntry));
- if (NameLength >= OS_MAX_PATH_LEN)
+ if (NameLength >= CFE_MISSION_MAX_PATH_LEN)
{
FilesNotDeletedCount++;
}
else
{
/* What kind of directory entry is this? */
- FilenameState = FM_GetFilenameState(Filename, OS_MAX_PATH_LEN, false);
+ FilenameState = FM_GetFilenameState(Filename, CFE_MISSION_MAX_PATH_LEN, false);
/* FilenameState cannot have a value beyond five macros in cases below */
switch (FilenameState)
@@ -553,7 +553,7 @@ void FM_ChildDeleteAllFilesCmd(FM_ChildQueueEntry_t *CmdArgs)
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_DELETE_ALL_CMD_INF_EID, CFE_EVS_EventType_INFORMATION,
"%s command: deleted %d files: dir = %s", CmdText, (int)DeleteCount, Directory);
- FM_GlobalData.ChildCmdCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter++;
if (FilesNotDeletedCount > 0)
{
@@ -561,7 +561,7 @@ void FM_ChildDeleteAllFilesCmd(FM_ChildQueueEntry_t *CmdArgs)
CFE_EVS_SendEvent(FM_DELETE_ALL_FILES_ND_WARNING_EID, CFE_EVS_EventType_INFORMATION,
"%s command: one or more files could not be deleted. Files may be open : dir = %s",
CmdText, Directory);
- FM_GlobalData.ChildCmdWarnCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdWarnCounter++;
}
if (DirectoriesSkippedCount > 0)
@@ -569,14 +569,14 @@ void FM_ChildDeleteAllFilesCmd(FM_ChildQueueEntry_t *CmdArgs)
/* If errors occurred, report generic event(s) */
CFE_EVS_SendEvent(FM_DELETE_ALL_SKIP_WARNING_EID, CFE_EVS_EventType_INFORMATION,
"%s command: one or more directories skipped : dir = %s", CmdText, Directory);
- FM_GlobalData.ChildCmdWarnCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdWarnCounter++;
}
} /* end if OS_Status != OS_SUCCESS */
/* Report previous child task activity */
- FM_GlobalData.ChildPreviousCC = CmdArgs->CommandCode;
- FM_GlobalData.ChildCurrentCC = 0;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -591,14 +591,14 @@ void FM_ChildDecompressFileCmd(const FM_ChildQueueEntry_t *CmdArgs)
CFE_Status_t CFE_Status = CFE_SUCCESS;
/* Report current child task activity */
- FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = CmdArgs->CommandCode;
/* Decompress source file into target file */
- CFE_Status = FM_Decompress_Impl(FM_GlobalData.DecompressorStatePtr, CmdArgs->Source1, CmdArgs->Target);
+ CFE_Status = FM_Decompress_Impl(FM_AppData.DecompressorStatePtr, CmdArgs->Source1, CmdArgs->Target);
if (CFE_Status != CFE_SUCCESS)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_DECOM_CFE_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -607,7 +607,7 @@ void FM_ChildDecompressFileCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
else
{
- FM_GlobalData.ChildCmdCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter++;
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_DECOM_CMD_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command: src = %s, tgt = %s",
@@ -615,8 +615,8 @@ void FM_ChildDecompressFileCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
/* Report previous child task activity */
- FM_GlobalData.ChildPreviousCC = CmdArgs->CommandCode;
- FM_GlobalData.ChildCurrentCC = 0;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -629,23 +629,23 @@ void FM_ChildConcatFilesCmd(const FM_ChildQueueEntry_t *CmdArgs)
{
const char *CmdText = "Concat Files";
bool ConcatResult = false;
- bool CopyInProgress = false;
- int32 LoopCount = 0;
- int32 OS_Status = OS_SUCCESS;
+ bool CopyInProgress;
+ int32 LoopCount;
+ int32 OS_Status;
osal_id_t FileHandleSrc = OS_OBJECT_ID_UNDEFINED;
osal_id_t FileHandleTgt = OS_OBJECT_ID_UNDEFINED;
- int32 BytesRead = 0;
- int32 BytesWritten = 0;
+ int32 BytesRead;
+ int32 BytesWritten;
/* Report current child task activity */
- FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = CmdArgs->CommandCode;
/* Copy source file #1 to the target file */
OS_Status = OS_cp(CmdArgs->Source1, CmdArgs->Target);
if (OS_Status != OS_SUCCESS)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_CONCAT_OSCPY_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -659,7 +659,7 @@ void FM_ChildConcatFilesCmd(const FM_ChildQueueEntry_t *CmdArgs)
if (OS_Status != OS_SUCCESS)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_CONCAT_OPEN_SRC2_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -673,7 +673,7 @@ void FM_ChildConcatFilesCmd(const FM_ChildQueueEntry_t *CmdArgs)
if (OS_Status != OS_SUCCESS)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_CONCAT_OPEN_TGT_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -690,7 +690,7 @@ void FM_ChildConcatFilesCmd(const FM_ChildQueueEntry_t *CmdArgs)
while (CopyInProgress)
{
- BytesRead = OS_read(FileHandleSrc, FM_GlobalData.ChildBuffer, FM_CHILD_FILE_BLOCK_SIZE);
+ BytesRead = OS_read(FileHandleSrc, FM_AppData.ChildBuffer, FM_CHILD_FILE_BLOCK_SIZE);
if (BytesRead == 0)
{
@@ -698,7 +698,7 @@ void FM_ChildConcatFilesCmd(const FM_ChildQueueEntry_t *CmdArgs)
CopyInProgress = false;
ConcatResult = true;
- FM_GlobalData.ChildCmdCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter++;
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_CONCAT_CMD_INF_EID, CFE_EVS_EventType_INFORMATION,
@@ -708,7 +708,7 @@ void FM_ChildConcatFilesCmd(const FM_ChildQueueEntry_t *CmdArgs)
else if (BytesRead < 0)
{
CopyInProgress = false;
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_CONCAT_OSRD_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -718,12 +718,12 @@ void FM_ChildConcatFilesCmd(const FM_ChildQueueEntry_t *CmdArgs)
else
{
/* Write source file #2 to target file */
- BytesWritten = OS_write(FileHandleTgt, FM_GlobalData.ChildBuffer, BytesRead);
+ BytesWritten = OS_write(FileHandleTgt, FM_AppData.ChildBuffer, BytesRead);
if (BytesWritten != BytesRead)
{
CopyInProgress = false;
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_CONCAT_OSWR_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -758,8 +758,8 @@ void FM_ChildConcatFilesCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
/* Report previous child task activity */
- FM_GlobalData.ChildPreviousCC = CmdArgs->CommandCode;
- FM_GlobalData.ChildCurrentCC = 0;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -771,17 +771,17 @@ void FM_ChildConcatFilesCmd(const FM_ChildQueueEntry_t *CmdArgs)
void FM_ChildFileInfoCmd(FM_ChildQueueEntry_t *CmdArgs)
{
const char *CmdText = "Get File Info";
- bool GettingCRC = false;
+ bool GettingCRC;
uint32 CurrentCRC = 0;
int32 LoopCount = 0;
- int32 BytesRead = 0;
+ int32 BytesRead;
osal_id_t FileHandle = OS_OBJECT_ID_UNDEFINED;
- int32 Status = 0;
+ int32 Status;
FM_FileInfoPkt_Payload_t *ReportPtr;
/* Report current child task activity */
- FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = CmdArgs->CommandCode;
/*
** Command argument usage for this command:
@@ -794,55 +794,55 @@ void FM_ChildFileInfoCmd(FM_ChildQueueEntry_t *CmdArgs)
*/
/* Initialize file info packet (set all data to zero) */
- CFE_MSG_Init(CFE_MSG_PTR(FM_GlobalData.FileInfoPkt.TelemetryHeader), CFE_SB_ValueToMsgId(FM_FILE_INFO_TLM_MID),
+ CFE_MSG_Init(CFE_MSG_PTR(FM_AppData.FileInfoPkt.TelemetryHeader), CFE_SB_ValueToMsgId(FM_FILE_INFO_TLM_MID),
sizeof(FM_FileInfoPkt_t));
- ReportPtr = &FM_GlobalData.FileInfoPkt.Payload;
+ ReportPtr = &FM_AppData.FileInfoPkt.Payload;
/* Report directory or filename state, name, size and time */
ReportPtr->FileStatus = (uint8)CmdArgs->FileInfoState;
- snprintf(ReportPtr->Filename, OS_MAX_PATH_LEN, "%s", CmdArgs->Source1);
+ snprintf(ReportPtr->Filename, CFE_MISSION_MAX_PATH_LEN, "%s", CmdArgs->Source1);
ReportPtr->FileSize = CmdArgs->FileInfoSize;
ReportPtr->LastModifiedTime = CmdArgs->FileInfoTime;
ReportPtr->Mode = CmdArgs->Mode;
/* Validate CRC algorithm */
- if (CmdArgs->FileInfoCRC != FM_IGNORE_CRC)
+ if (CmdArgs->FileInfoCRC != DEFAULT_FM_INTERFACE_IGNORE_CRC)
{
if (CmdArgs->FileInfoState != FM_NAME_IS_FILE_CLOSED)
{
/* Can only calculate CRC for closed files */
- FM_GlobalData.ChildCmdWarnCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdWarnCounter++;
CFE_EVS_SendEvent(FM_GET_FILE_INFO_STATE_WARNING_EID, CFE_EVS_EventType_INFORMATION,
"%s warning: unable to compute CRC: invalid file state = %d, file = %s", CmdText,
(int)CmdArgs->FileInfoState, CmdArgs->Source1);
- CmdArgs->FileInfoCRC = FM_IGNORE_CRC;
+ CmdArgs->FileInfoCRC = DEFAULT_FM_INTERFACE_IGNORE_CRC;
}
else if ((CmdArgs->FileInfoCRC != CFE_ES_CrcType_CRC_8) && (CmdArgs->FileInfoCRC != CFE_ES_CrcType_CRC_16) &&
(CmdArgs->FileInfoCRC != CFE_ES_CrcType_CRC_32))
{
/* Can only calculate CRC using known algorithms */
- FM_GlobalData.ChildCmdWarnCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdWarnCounter++;
CFE_EVS_SendEvent(FM_GET_FILE_INFO_TYPE_WARNING_EID, CFE_EVS_EventType_INFORMATION,
"%s warning: unable to compute CRC: invalid CRC type = %d, file = %s", CmdText,
(int)CmdArgs->FileInfoCRC, CmdArgs->Source1);
- CmdArgs->FileInfoCRC = FM_IGNORE_CRC;
+ CmdArgs->FileInfoCRC = DEFAULT_FM_INTERFACE_IGNORE_CRC;
}
}
/* Compute CRC */
- if (CmdArgs->FileInfoCRC != FM_IGNORE_CRC)
+ if (CmdArgs->FileInfoCRC != DEFAULT_FM_INTERFACE_IGNORE_CRC)
{
Status = OS_OpenCreate(&FileHandle, CmdArgs->Source1, OS_FILE_FLAG_NONE, OS_READ_ONLY);
if (Status != OS_SUCCESS)
{
- FM_GlobalData.ChildCmdWarnCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdWarnCounter++;
/* Send CRC failure event (warning) */
CFE_EVS_SendEvent(FM_GET_FILE_INFO_OPEN_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -858,7 +858,7 @@ void FM_ChildFileInfoCmd(FM_ChildQueueEntry_t *CmdArgs)
while (GettingCRC)
{
- BytesRead = OS_read(FileHandle, FM_GlobalData.ChildBuffer, FM_CHILD_FILE_BLOCK_SIZE);
+ BytesRead = OS_read(FileHandle, FM_AppData.ChildBuffer, FM_CHILD_FILE_BLOCK_SIZE);
if (BytesRead == 0)
{
@@ -878,7 +878,7 @@ void FM_ChildFileInfoCmd(FM_ChildQueueEntry_t *CmdArgs)
OS_close(FileHandle);
/* Send CRC failure event (warning) */
- FM_GlobalData.ChildCmdWarnCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdWarnCounter++;
CFE_EVS_SendEvent(FM_GET_FILE_INFO_READ_WARNING_EID, CFE_EVS_EventType_INFORMATION,
"%s warning: unable to compute CRC: OS_read result = %d, file = %s", CmdText,
(int)BytesRead, CmdArgs->Source1);
@@ -887,7 +887,7 @@ void FM_ChildFileInfoCmd(FM_ChildQueueEntry_t *CmdArgs)
{
/* Continue CRC calculation */
CurrentCRC =
- CFE_ES_CalculateCRC(FM_GlobalData.ChildBuffer, BytesRead, CurrentCRC, CmdArgs->FileInfoCRC);
+ CFE_ES_CalculateCRC(FM_AppData.ChildBuffer, BytesRead, CurrentCRC, CmdArgs->FileInfoCRC);
}
/* Avoid CPU hogging */
@@ -909,18 +909,18 @@ void FM_ChildFileInfoCmd(FM_ChildQueueEntry_t *CmdArgs)
}
/* Timestamp and send file info telemetry packet */
- CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_GlobalData.FileInfoPkt.TelemetryHeader));
- CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_GlobalData.FileInfoPkt.TelemetryHeader), true);
+ CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_AppData.FileInfoPkt.TelemetryHeader));
+ CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_AppData.FileInfoPkt.TelemetryHeader), true);
- FM_GlobalData.ChildCmdCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter++;
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_GET_FILE_INFO_CMD_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command: file = %s", CmdText,
CmdArgs->Source1);
/* Report previous child task activity */
- FM_GlobalData.ChildPreviousCC = CmdArgs->CommandCode;
- FM_GlobalData.ChildCurrentCC = 0;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -935,13 +935,13 @@ void FM_ChildCreateDirectoryCmd(const FM_ChildQueueEntry_t *CmdArgs)
int32 OS_Status = OS_SUCCESS;
/* Report current child task activity */
- FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = CmdArgs->CommandCode;
OS_Status = OS_mkdir(CmdArgs->Source1, 0);
if (OS_Status != OS_SUCCESS)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_CREATE_DIR_OS_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -950,7 +950,7 @@ void FM_ChildCreateDirectoryCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
else
{
- FM_GlobalData.ChildCmdCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter++;
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_CREATE_DIR_CMD_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command: src = %s", CmdText,
@@ -958,8 +958,8 @@ void FM_ChildCreateDirectoryCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
/* Report previous child task activity */
- FM_GlobalData.ChildPreviousCC = CmdArgs->CommandCode;
- FM_GlobalData.ChildCurrentCC = 0;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -979,7 +979,7 @@ void FM_ChildDeleteDirectoryCmd(const FM_ChildQueueEntry_t *CmdArgs)
memset(&DirEntry, 0, sizeof(DirEntry));
/* Report current child task activity */
- FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = CmdArgs->CommandCode;
/* Open the dir so we can see if it is empty */
OS_Status = OS_DirectoryOpen(&DirId, CmdArgs->Source1);
@@ -990,7 +990,7 @@ void FM_ChildDeleteDirectoryCmd(const FM_ChildQueueEntry_t *CmdArgs)
"%s error: OS_DirectoryOpen failed: dir = %s", CmdText, CmdArgs->Source1);
RemoveTheDir = false;
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
}
else
{
@@ -1004,7 +1004,7 @@ void FM_ChildDeleteDirectoryCmd(const FM_ChildQueueEntry_t *CmdArgs)
"%s error: directory is not empty: dir = %s", CmdText, CmdArgs->Source1);
RemoveTheDir = false;
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
}
}
@@ -1023,7 +1023,7 @@ void FM_ChildDeleteDirectoryCmd(const FM_ChildQueueEntry_t *CmdArgs)
"%s error: OS_rmdir failed: result = %d, dir = %s", CmdText, (int)OS_Status,
CmdArgs->Source1);
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
}
else
{
@@ -1031,13 +1031,13 @@ void FM_ChildDeleteDirectoryCmd(const FM_ChildQueueEntry_t *CmdArgs)
CFE_EVS_SendEvent(FM_DELETE_DIR_CMD_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command: src = %s", CmdText,
CmdArgs->Source1);
- FM_GlobalData.ChildCmdCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter++;
}
}
/* Report previous child task activity */
- FM_GlobalData.ChildPreviousCC = CmdArgs->CommandCode;
- FM_GlobalData.ChildCurrentCC = 0;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -1049,13 +1049,13 @@ void FM_ChildDeleteDirectoryCmd(const FM_ChildQueueEntry_t *CmdArgs)
void FM_ChildDirListFileCmd(const FM_ChildQueueEntry_t *CmdArgs)
{
const char *CmdText = "Directory List to File";
- bool Result = false;
+ bool Result;
osal_id_t FileHandle = OS_OBJECT_ID_UNDEFINED;
osal_id_t DirId = OS_OBJECT_ID_UNDEFINED;
int32 Status = 0;
/* Report current child task activity */
- FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = CmdArgs->CommandCode;
/*
** Command argument usage for this command:
@@ -1071,7 +1071,7 @@ void FM_ChildDirListFileCmd(const FM_ChildQueueEntry_t *CmdArgs)
if (Status != OS_SUCCESS)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_GET_DIR_FILE_OSOPENDIR_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -1096,8 +1096,8 @@ void FM_ChildDirListFileCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
/* Report previous child task activity */
- FM_GlobalData.ChildPreviousCC = CmdArgs->CommandCode;
- FM_GlobalData.ChildCurrentCC = 0;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -1109,14 +1109,14 @@ void FM_ChildDirListFileCmd(const FM_ChildQueueEntry_t *CmdArgs)
void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs)
{
const char * CmdText = "Directory List to Packet";
- char LogicalName[OS_MAX_PATH_LEN] = "\0";
- bool StillProcessing = true;
+ char LogicalName[CFE_MISSION_MAX_PATH_LEN] = "\0";
+ bool StillProcessing;
osal_id_t DirId = OS_OBJECT_ID_UNDEFINED;
os_dirent_t DirEntry;
- int32 ListIndex = 0;
+ int32 ListIndex;
FM_DirListEntry_t *ListEntry = NULL;
- size_t PathLength = 0;
- size_t EntryLength = 0;
+ size_t PathLength;
+ size_t EntryLength;
int32 FilesTillSleep = FM_CHILD_STAT_SLEEP_FILECOUNT;
int32 Status;
@@ -1125,7 +1125,7 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs)
memset(&DirEntry, 0, sizeof(DirEntry));
/* Report current child task activity */
- FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = CmdArgs->CommandCode;
/*
** Command argument usage for this command:
@@ -1135,14 +1135,14 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs)
** CmdArgs->Source2 = directory name plus separator
** CmdArgs->DirListOffset = index of 1st reported dir entry
*/
- PathLength = OS_strnlen(CmdArgs->Source2, OS_MAX_PATH_LEN);
+ PathLength = OS_strnlen(CmdArgs->Source2, CFE_MISSION_MAX_PATH_LEN);
/* Open source directory for reading directory list */
Status = OS_DirectoryOpen(&DirId, CmdArgs->Source1);
if (Status != OS_SUCCESS)
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_GET_DIR_PKT_OS_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -1151,12 +1151,12 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs)
else
{
/* Initialize the directory list telemetry packet */
- CFE_MSG_Init(CFE_MSG_PTR(FM_GlobalData.DirListPkt.TelemetryHeader), CFE_SB_ValueToMsgId(FM_DIR_LIST_TLM_MID),
+ CFE_MSG_Init(CFE_MSG_PTR(FM_AppData.DirListPkt.TelemetryHeader), CFE_SB_ValueToMsgId(FM_DIR_LIST_TLM_MID),
sizeof(FM_DirListPkt_t));
- ReportPtr = &FM_GlobalData.DirListPkt.Payload;
+ ReportPtr = &FM_AppData.DirListPkt.Payload;
- snprintf(ReportPtr->DirName, OS_MAX_PATH_LEN, "%s", CmdArgs->Source1);
+ snprintf(ReportPtr->DirName, CFE_MISSION_MAX_PATH_LEN, "%s", CmdArgs->Source1);
ReportPtr->FirstFile = CmdArgs->DirListOffset;
StillProcessing = true;
@@ -1185,7 +1185,7 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs)
ListIndex = ReportPtr->PacketFiles;
ListEntry = &ReportPtr->FileList[ListIndex];
- EntryLength = OS_strnlen(OS_DIRENTRY_NAME(DirEntry), OS_MAX_FILE_NAME);
+ EntryLength = OS_strnlen(OS_DIRENTRY_NAME(DirEntry), CFE_MISSION_MAX_FILE_LEN);
/* Verify combined directory plus filename length */
if ((PathLength + EntryLength) < sizeof(LogicalName))
@@ -1205,7 +1205,7 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
else
{
- FM_GlobalData.ChildCmdWarnCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdWarnCounter++;
/* Send command warning event (info) */
CFE_EVS_SendEvent(FM_GET_DIR_PKT_WARNING_EID, CFE_EVS_EventType_INFORMATION,
@@ -1219,19 +1219,19 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs)
OS_DirectoryClose(DirId);
/* Timestamp and send directory listing telemetry packet */
- CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_GlobalData.DirListPkt.TelemetryHeader));
- CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_GlobalData.DirListPkt.TelemetryHeader), true);
+ CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_AppData.DirListPkt.TelemetryHeader));
+ CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_AppData.DirListPkt.TelemetryHeader), true);
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_GET_DIR_PKT_CMD_INF_EID, CFE_EVS_EventType_INFORMATION,
"%s command: offset = %d, dir = %s", CmdText, (int)CmdArgs->DirListOffset, CmdArgs->Source1);
- FM_GlobalData.ChildCmdCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter++;
}
/* Report previous child task activity */
- FM_GlobalData.ChildPreviousCC = CmdArgs->CommandCode;
- FM_GlobalData.ChildCurrentCC = 0;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -1241,14 +1241,14 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void FM_ChildSetPermissionsCmd(const FM_ChildQueueEntry_t *CmdArgs)
{
- int32 OS_Status = OS_SUCCESS;
+ int32 OS_Status;
const char *CmdText = "Set Permissions";
OS_Status = OS_chmod(CmdArgs->Source1, CmdArgs->Mode);
if (OS_Status == OS_SUCCESS)
{
- FM_GlobalData.ChildCmdCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter++;
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_SET_PERM_CMD_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command: file = %s, access = %d",
@@ -1256,7 +1256,7 @@ void FM_ChildSetPermissionsCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
else
{
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send OS error message */
CFE_EVS_SendEvent(FM_SET_PERM_OS_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -1265,8 +1265,8 @@ void FM_ChildSetPermissionsCmd(const FM_ChildQueueEntry_t *CmdArgs)
}
/* Report previous child task activity */
- FM_GlobalData.ChildPreviousCC = CmdArgs->CommandCode;
- FM_GlobalData.ChildCurrentCC = 0;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = CmdArgs->CommandCode;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -1281,8 +1281,8 @@ bool FM_ChildDirListFileInit(osal_id_t *FileHandlePtr, const char *Directory, co
bool CommandResult = true;
CFE_FS_Header_t FileHeader;
osal_id_t FileHandle = OS_OBJECT_ID_UNDEFINED;
- int32 BytesWritten = 0;
- int32 Status = 0;
+ int32 BytesWritten;
+ int32 Status;
/* Initialize the standard cFE File Header for the Directory Listing File */
CFE_FS_InitHeader(&FileHeader, CmdText, FM_DIR_LIST_FILE_SUBTYPE);
@@ -1297,12 +1297,12 @@ bool FM_ChildDirListFileInit(osal_id_t *FileHandlePtr, const char *Directory, co
if (BytesWritten == sizeof(CFE_FS_Header_t))
{
/* Initialize directory statistics structure */
- memset(&FM_GlobalData.DirListFileStats, 0, sizeof(FM_GlobalData.DirListFileStats));
- strncpy(FM_GlobalData.DirListFileStats.DirName, Directory, OS_MAX_PATH_LEN - 1);
- FM_GlobalData.DirListFileStats.DirName[OS_MAX_PATH_LEN - 1] = '\0';
+ memset(&FM_AppData.DirListFileStats, 0, sizeof(FM_AppData.DirListFileStats));
+ strncpy(FM_AppData.DirListFileStats.DirName, Directory, CFE_MISSION_MAX_PATH_LEN - 1);
+ FM_AppData.DirListFileStats.DirName[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
/* Write blank FM directory statistics structure as a placeholder */
- BytesWritten = OS_write(FileHandle, &FM_GlobalData.DirListFileStats, sizeof(FM_DirListFileStats_t));
+ BytesWritten = OS_write(FileHandle, &FM_AppData.DirListFileStats, sizeof(FM_DirListFileStats_t));
if (BytesWritten == sizeof(FM_DirListFileStats_t))
{
/* Return output file handle */
@@ -1311,7 +1311,7 @@ bool FM_ChildDirListFileInit(osal_id_t *FileHandlePtr, const char *Directory, co
else
{
CommandResult = false;
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_GET_DIR_FILE_WRBLANK_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -1322,7 +1322,7 @@ bool FM_ChildDirListFileInit(osal_id_t *FileHandlePtr, const char *Directory, co
else
{
CommandResult = false;
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_GET_DIR_FILE_WRHDR_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -1339,7 +1339,7 @@ bool FM_ChildDirListFileInit(osal_id_t *FileHandlePtr, const char *Directory, co
else
{
CommandResult = false;
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_GET_DIR_FILE_OSCREAT_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -1356,7 +1356,7 @@ bool FM_ChildDirListFileInit(osal_id_t *FileHandlePtr, const char *Directory, co
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void FM_ChildDirListFileLoop(osal_id_t DirId, osal_id_t FileHandle, const char *Directory, const char *DirWithSep,
- const char *Filename, uint8 getSizeTimeMode)
+ const char *Filename, uint8 GetSizeTimeMode)
{
const char * CmdText = "Directory List to File";
size_t WriteLength = sizeof(FM_DirListEntry_t);
@@ -1364,18 +1364,18 @@ void FM_ChildDirListFileLoop(osal_id_t DirId, osal_id_t FileHandle, const char *
bool CommandResult = true;
uint32 DirEntries = 0;
uint32 FileEntries = 0;
- size_t EntryLength = 0;
- size_t PathLength = 0;
- int32 BytesWritten = 0;
+ size_t EntryLength;
+ size_t PathLength;
+ int32 BytesWritten;
int32 FilesTillSleep = FM_CHILD_STAT_SLEEP_FILECOUNT;
- int32 Status = 0;
- char TempName[OS_MAX_PATH_LEN] = "\0";
+ int32 Status;
+ char TempName[CFE_MISSION_MAX_PATH_LEN] = "\0";
os_dirent_t DirEntry;
FM_DirListEntry_t DirListData;
memset(&DirEntry, 0, sizeof(DirEntry));
- PathLength = OS_strnlen(DirWithSep, OS_MAX_PATH_LEN);
+ PathLength = OS_strnlen(DirWithSep, CFE_MISSION_MAX_PATH_LEN);
/* Until end of directory entries or output file write error */
while ((CommandResult == true) && (ReadingDirectory == true))
@@ -1396,10 +1396,10 @@ void FM_ChildDirListFileLoop(osal_id_t DirId, osal_id_t FileHandle, const char *
/* Count all files - write limited number */
if (FileEntries < FM_DIR_LIST_FILE_ENTRIES)
{
- EntryLength = OS_strnlen(OS_DIRENTRY_NAME(DirEntry), OS_MAX_FILE_NAME);
+ EntryLength = OS_strnlen(OS_DIRENTRY_NAME(DirEntry), CFE_MISSION_MAX_FILE_LEN);
/*
- * DirListData.EntryName and TempName are both OS_MAX_PATH_LEN, DirEntry name is OS_MAX_FILE_NAME,
+ * DirListData.EntryName and TempName are both CFE_MISSION_MAX_PATH_LEN, DirEntry name is CFE_MISSION_MAX_FILE_LEN,
* so limiting test is PathLength and EntryLength together
*/
if ((PathLength + EntryLength) < sizeof(TempName))
@@ -1417,7 +1417,7 @@ void FM_ChildDirListFileLoop(osal_id_t DirId, osal_id_t FileHandle, const char *
memset(&DirListData, 0, sizeof(DirListData));
strncpy(DirListData.EntryName, OS_DIRENTRY_NAME(DirEntry), sizeof(DirListData.EntryName) - 1);
- FM_ChildSleepStat(TempName, &DirListData, &FilesTillSleep, getSizeTimeMode);
+ FM_ChildSleepStat(TempName, &DirListData, &FilesTillSleep, GetSizeTimeMode);
/* Write directory list file entry to output file */
BytesWritten = OS_write(FileHandle, &DirListData, WriteLength);
@@ -1429,7 +1429,7 @@ void FM_ChildDirListFileLoop(osal_id_t DirId, osal_id_t FileHandle, const char *
else
{
CommandResult = false;
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_GET_DIR_FILE_WRENTRY_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -1439,7 +1439,7 @@ void FM_ChildDirListFileLoop(osal_id_t DirId, osal_id_t FileHandle, const char *
}
else
{
- FM_GlobalData.ChildCmdWarnCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdWarnCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_GET_DIR_FILE_WARNING_EID, CFE_EVS_EventType_INFORMATION,
@@ -1454,20 +1454,20 @@ void FM_ChildDirListFileLoop(osal_id_t DirId, osal_id_t FileHandle, const char *
if ((CommandResult == true) && (DirEntries != 0))
{
/* Update entries found in directory vs entries written to file */
- FM_GlobalData.DirListFileStats.DirEntries = DirEntries;
- FM_GlobalData.DirListFileStats.FileEntries = FileEntries;
+ FM_AppData.DirListFileStats.DirEntries = DirEntries;
+ FM_AppData.DirListFileStats.FileEntries = FileEntries;
/* Back up to the start of the statistics data */
OS_lseek(FileHandle, sizeof(CFE_FS_Header_t), OS_SEEK_SET);
/* Write an updated version of the statistics data */
WriteLength = sizeof(FM_DirListFileStats_t);
- BytesWritten = OS_write(FileHandle, &FM_GlobalData.DirListFileStats, WriteLength);
+ BytesWritten = OS_write(FileHandle, &FM_AppData.DirListFileStats, WriteLength);
if (BytesWritten != WriteLength)
{
CommandResult = false;
- FM_GlobalData.ChildCmdErrCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter++;
/* Send command failure event (error) */
CFE_EVS_SendEvent(FM_GET_DIR_FILE_UPSTATS_ERR_EID, CFE_EVS_EventType_ERROR,
@@ -1479,7 +1479,7 @@ void FM_ChildDirListFileLoop(osal_id_t DirId, osal_id_t FileHandle, const char *
/* Send command completion event (info) */
if (CommandResult == true)
{
- FM_GlobalData.ChildCmdCounter++;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter++;
CFE_EVS_SendEvent(FM_GET_DIR_FILE_CMD_INF_EID, CFE_EVS_EventType_INFORMATION,
"%s command: wrote %d of %d names: dir = %s, filename = %s", CmdText, (int)FileEntries,
@@ -1525,10 +1525,10 @@ int32 FM_ChildSizeTimeMode(const char *Filename, uint32 *FileSize, uint32 *FileT
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void FM_ChildSleepStat(const char *Filename, FM_DirListEntry_t *DirListData, int32 *FilesTillSleep,
- bool getSizeTimeMode)
+ bool GetSizeTimeMode)
{
/* Check if command requested size and time */
- if (getSizeTimeMode == true)
+ if (GetSizeTimeMode == true)
{
if (*FilesTillSleep <= 0)
{
diff --git a/fsw/src/fm_child.h b/fsw/src/fm_child.h
index 8e636b1..1118cb1 100644
--- a/fsw/src/fm_child.h
+++ b/fsw/src/fm_child.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,26 @@
#include "cfe.h"
#include "fm_msg.h"
+/**
+ * \brief Child Task Interface command queue entry structure
+ */
+typedef struct
+{
+ CFE_MSG_FcnCode_t CommandCode; /** \brief Command code - identifies the command */
+ uint16 Padding1; /** \brief Structure padding to align to 32-bit boundaries */
+ uint32 DirListOffset; /** \brief Starting entry for dir list commands */
+ uint32 FileInfoState; /** \brief File info state */
+ uint32 FileInfoSize; /** \brief File info size */
+ uint32 FileInfoTime; /** \brief File info time */
+ uint32 FileInfoCRC; /** \brief File info CRC method */
+ char Source1[CFE_MISSION_MAX_PATH_LEN]; /** \brief First source file or directory name command argument */
+ char Source2[CFE_MISSION_MAX_PATH_LEN]; /** \brief Second source filename command argument */
+ char Target[CFE_MISSION_MAX_PATH_LEN]; /** \brief Target filename command argument */
+ uint8 GetSizeTimeMode; /** \brief Whether to invoke stat call for size and time (CPU intensive) */
+ uint8 Padding2[3]; /** \brief Structure padding to align to 32-bit boundaries */
+ uint32 Mode; /** \brief File Mode */
+} FM_ChildQueueEntry_t;
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* FM child task global function prototypes */
diff --git a/fsw/src/fm_cmd_utils.c b/fsw/src/fm_cmd_utils.c
index 08f214e..fd29ed6 100644
--- a/fsw/src/fm_cmd_utils.c
+++ b/fsw/src/fm_cmd_utils.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,7 +30,8 @@
#include "fm_cmd_utils.h"
#include "fm_child.h"
#include "fm_perfids.h"
-#include "fm_events.h"
+#include "fm_eventids.h"
+#include "fm_extern_typedefs.h"
#include
#include
@@ -80,14 +80,14 @@ static void LoadOpenFileData(osal_id_t ObjId, void *CallbackArg)
{
if (OS_FDGetInfo(ObjId, &FdProp) == OS_SUCCESS)
{
- strncpy(OpenFilesData[OpenFileCount].LogicalName, FdProp.Path, OS_MAX_PATH_LEN);
+ strncpy(OpenFilesData[OpenFileCount].LogicalName, FdProp.Path, CFE_MISSION_MAX_PATH_LEN);
/* Get the name of the application that opened the file */
memset(&TaskInfo, 0, sizeof(TaskInfo));
if (OS_TaskGetInfo(FdProp.User, &TaskInfo) == OS_SUCCESS)
{
- strncpy(OpenFilesData[OpenFileCount].AppName, (char *)TaskInfo.name, OS_MAX_API_NAME);
+ strncpy(OpenFilesData[OpenFileCount].AppName, (char *)TaskInfo.name, CFE_MISSION_MAX_API_LEN);
}
}
}
@@ -132,12 +132,12 @@ static void SearchOpenFileData(osal_id_t ObjId, void *CallbackArg)
}
}
-uint32 FM_GetFilenameState(const char *Filename, size_t BufferSize, bool FileInfoCmd)
+FM_FileNameStates_Enum_t FM_GetFilenameState(const char *Filename, size_t BufferSize, bool FileInfoCmd)
{
- os_fstat_t FileStatus;
- uint32 FilenameState = FM_NAME_IS_INVALID;
- bool FilenameIsValid = false;
- int32 StringLength;
+ os_fstat_t FileStatus;
+ FM_FileNameStates_Enum_t FilenameState = FM_NAME_IS_INVALID;
+ bool FilenameIsValid = false;
+ int32 StringLength;
memset(&FileStatus, 0, sizeof(FileStatus));
@@ -188,9 +188,9 @@ uint32 FM_GetFilenameState(const char *Filename, size_t BufferSize, bool FileInf
/* Save the last modify time and file size for File Info commands */
if (FileInfoCmd)
{
- FM_GlobalData.FileStatTime = OS_FILESTAT_TIME(FileStatus);
- FM_GlobalData.FileStatSize = OS_FILESTAT_SIZE(FileStatus);
- FM_GlobalData.FileStatMode = OS_FILESTAT_MODE(FileStatus);
+ FM_AppData.FileStatTime = OS_FILESTAT_TIME(FileStatus);
+ FM_AppData.FileStatSize = OS_FILESTAT_SIZE(FileStatus);
+ FM_AppData.FileStatMode = OS_FILESTAT_MODE(FileStatus);
}
}
else
@@ -201,9 +201,9 @@ uint32 FM_GetFilenameState(const char *Filename, size_t BufferSize, bool FileInf
/* Save the last modify time and file size for File Info commands */
if (FileInfoCmd)
{
- FM_GlobalData.FileStatSize = 0;
- FM_GlobalData.FileStatTime = 0;
- FM_GlobalData.FileStatMode = 0;
+ FM_AppData.FileStatSize = 0;
+ FM_AppData.FileStatTime = 0;
+ FM_AppData.FileStatMode = 0;
}
}
}
@@ -217,10 +217,10 @@ uint32 FM_GetFilenameState(const char *Filename, size_t BufferSize, bool FileInf
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-uint32 FM_VerifyNameValid(const char *Name, size_t BufferSize, uint32 EventID, const char *CmdText)
+FM_FileNameStates_Enum_t FM_VerifyNameValid(const char *Name, size_t BufferSize, uint32 EventID, const char *CmdText)
{
- char LocalFile[1 + OS_MAX_PATH_LEN];
- uint32 FilenameState = FM_NAME_IS_INVALID;
+ char LocalFile[1 + CFE_MISSION_MAX_PATH_LEN];
+ FM_FileNameStates_Enum_t FilenameState = FM_NAME_IS_INVALID;
/* Looking for filename state != FM_NAME_IS_INVALID */
FilenameState = FM_GetFilenameState(Name, BufferSize, true);
@@ -244,14 +244,14 @@ uint32 FM_VerifyNameValid(const char *Name, size_t BufferSize, uint32 EventID, c
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_VerifyFileState(FM_File_States State, const char *Filename, size_t BufferSize, uint32 EventID,
+bool FM_VerifyFileState(FM_FileStates_Enum_t State, const char *Filename, size_t BufferSize, uint32 EventID,
const char *CmdText)
{
bool Result = false;
uint32 FilenameState = FM_NAME_IS_INVALID;
uint32 ErrorCode = FM_FNAME_INVALID_EID_OFFSET;
const char *ErrorDesc = "";
- char LocalFile[1 + OS_MAX_PATH_LEN];
+ char LocalFile[1 + CFE_MISSION_MAX_PATH_LEN];
/* Get state of the filename */
FilenameState = FM_GetFilenameState(Filename, BufferSize, false);
@@ -425,10 +425,10 @@ bool FM_VerifyChildTask(uint32 EventID, const char *CmdText)
bool Result = false;
/* Copy of child queue count that child task cannot change */
- uint8 LocalQueueCount = FM_GlobalData.ChildQueueCount;
+ uint8 LocalQueueCount = FM_AppData.HkTlm.Payload.ChildQueueCount;
/* Verify child task is active and queue interface is healthy */
- if (!OS_ObjectIdDefined(FM_GlobalData.ChildSemaphore))
+ if (!OS_ObjectIdDefined(FM_AppData.ChildSemaphore))
{
CFE_EVS_SendEvent((EventID + FM_CHILD_DISABLED_EID_OFFSET), CFE_EVS_EventType_ERROR,
"%s error: child task is disabled", CmdText);
@@ -444,18 +444,18 @@ bool FM_VerifyChildTask(uint32 EventID, const char *CmdText)
/* Queue full - cannot add another command */
Result = false;
}
- else if ((LocalQueueCount > FM_CHILD_QUEUE_DEPTH) || (FM_GlobalData.ChildWriteIndex >= FM_CHILD_QUEUE_DEPTH))
+ else if ((LocalQueueCount > FM_CHILD_QUEUE_DEPTH) || (FM_AppData.ChildWriteIndex >= FM_CHILD_QUEUE_DEPTH))
{
CFE_EVS_SendEvent((EventID + FM_CHILD_BROKEN_EID_OFFSET), CFE_EVS_EventType_ERROR,
"%s error: child task interface is broken: count = %d, index = %d", CmdText, LocalQueueCount,
- FM_GlobalData.ChildWriteIndex);
+ FM_AppData.ChildWriteIndex);
/* Queue broken - cannot add another command */
Result = false;
}
else
{
- memset(&FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex], 0, sizeof(FM_GlobalData.ChildQueue[0]));
+ memset(&FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex], 0, sizeof(FM_AppData.ChildQueue[0]));
/* OK to add another command to the queue */
Result = true;
@@ -473,23 +473,23 @@ bool FM_VerifyChildTask(uint32 EventID, const char *CmdText)
void FM_InvokeChildTask(void)
{
/* Update callers queue index */
- FM_GlobalData.ChildWriteIndex++;
+ FM_AppData.ChildWriteIndex++;
- if (FM_GlobalData.ChildWriteIndex >= FM_CHILD_QUEUE_DEPTH)
+ if (FM_AppData.ChildWriteIndex >= FM_CHILD_QUEUE_DEPTH)
{
- FM_GlobalData.ChildWriteIndex = 0;
+ FM_AppData.ChildWriteIndex = 0;
}
/* Prevent parent/child updating queue counter at same time */
- OS_MutSemTake(FM_GlobalData.ChildQueueCountSem);
- FM_GlobalData.ChildQueueCount++;
- OS_MutSemGive(FM_GlobalData.ChildQueueCountSem);
+ OS_MutSemTake(FM_AppData.ChildQueueCountSem);
+ FM_AppData.HkTlm.Payload.ChildQueueCount++;
+ OS_MutSemGive(FM_AppData.ChildQueueCountSem);
/* Does the child task still have a semaphore? */
- if (OS_ObjectIdDefined(FM_GlobalData.ChildSemaphore))
+ if (OS_ObjectIdDefined(FM_AppData.ChildSemaphore))
{
/* Signal child task to call command handler */
- OS_CountSemGive(FM_GlobalData.ChildSemaphore);
+ OS_CountSemGive(FM_AppData.ChildSemaphore);
}
}
@@ -508,7 +508,7 @@ void FM_AppendPathSep(char *Directory, uint32 BufferSize)
*/
size_t StringLength = 0;
- StringLength = OS_strnlen(Directory, OS_MAX_PATH_LEN);
+ StringLength = OS_strnlen(Directory, CFE_MISSION_MAX_PATH_LEN);
/* Do nothing if string already ends with a path separator */
if ((StringLength != 0) && (Directory[StringLength - 1] != '/'))
@@ -570,7 +570,7 @@ CFE_Status_t FM_GetDirectorySpaceEstimate(const char *Directory, uint64 *BlockCo
os_fstat_t FileStat;
osal_status_t OS_Status;
CFE_Status_t Result;
- char FullPath[OS_MAX_PATH_LEN];
+ char FullPath[CFE_MISSION_MAX_PATH_LEN];
uint64 TotalBytes;
size_t DirLen;
@@ -578,7 +578,7 @@ CFE_Status_t FM_GetDirectorySpaceEstimate(const char *Directory, uint64 *BlockCo
memset(&DirEntry, 0, sizeof(DirEntry));
snprintf(FullPath, sizeof(FullPath), "%s", Directory);
- DirLen = OS_strnlen(FullPath, OS_MAX_PATH_LEN);
+ DirLen = OS_strnlen(FullPath, CFE_MISSION_MAX_PATH_LEN);
if (DirLen < (sizeof(FullPath) - 2))
{
FullPath[DirLen] = '/';
diff --git a/fsw/src/fm_cmd_utils.h b/fsw/src/fm_cmd_utils.h
index d89dade..062a4d4 100644
--- a/fsw/src/fm_cmd_utils.h
+++ b/fsw/src/fm_cmd_utils.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -22,28 +21,17 @@
* Specification for the CFS File Manager command utility
* functions.
*/
+
#ifndef FM_CMD_UTILS_H
#define FM_CMD_UTILS_H
-#include "cfe.h"
-#include "fm_msg.h"
-
-/************************************************************************
- * Type Definitions
- ************************************************************************/
+/* ======== */
+/* Includes */
+/* ======== */
-/**
- * \brief FM enum used for verifying file states
- */
-typedef enum
-{
- FM_FILE_CLOSED, /**< \brief FM File Is Closed */
- FM_FILE_EXISTS, /**< \brief FM File Exists */
- FM_FILE_NOEXIST, /**< \brief FM File Does Not Exist */
- FM_FILE_NOTOPEN, /**< \brief FM File Is Not Open */
- FM_DIR_EXISTS, /**< \brief FM Directory Exists */
- FM_DIR_NOEXIST /**< \brief FM Directory Does Not Exist */
-} FM_File_States;
+#include "cfe.h"
+#include "fm_msgdefs.h"
+#include "fm_internal_cfg.h"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
@@ -114,7 +102,7 @@ uint32 FM_GetOpenFilesData(FM_OpenFilesEntry_t *OpenFilesData);
*
* \sa #OS_stat, #OS_FDGetInfo
*/
-uint32 FM_GetFilenameState(const char *Filename, size_t BufferSize, bool FileInfoCmd);
+FM_FileNameStates_Enum_t FM_GetFilenameState(const char *Filename, size_t BufferSize, bool FileInfoCmd);
/**
* \brief Verify Name Function
@@ -139,7 +127,7 @@ uint32 FM_GetFilenameState(const char *Filename, size_t BufferSize, bool FileInf
*
* \sa #FM_GetFilenameState
*/
-uint32 FM_VerifyNameValid(const char *Name, size_t BufferSize, uint32 EventID, const char *CmdText);
+FM_FileNameStates_Enum_t FM_VerifyNameValid(const char *Name, size_t BufferSize, uint32 EventID, const char *CmdText);
/**
* \brief Verify File State Function
@@ -162,7 +150,7 @@ uint32 FM_VerifyNameValid(const char *Name, size_t BufferSize, uint32 EventID, c
*
* \sa #FM_GetFilenameState
*/
-bool FM_VerifyFileState(FM_File_States State, const char *Filename, size_t BufferSize, uint32 EventID,
+bool FM_VerifyFileState(FM_FileStates_Enum_t State, const char *Filename, size_t BufferSize, uint32 EventID,
const char *CmdText);
/**
diff --git a/fsw/src/fm_cmds.c b/fsw/src/fm_cmds.c
index 8e16167..1c60540 100644
--- a/fsw/src/fm_cmds.c
+++ b/fsw/src/fm_cmds.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,66 +23,79 @@
* Provides functions for the execution of the FM ground commands
*/
+#include "fm_tbl.h"
#include "cfe.h"
#include "fm_msg.h"
#include "fm_msgdefs.h"
#include "fm_msgids.h"
-#include "fm_events.h"
+#include "fm_eventids.h"
#include "fm_app.h"
+#include "fm_extern_typedefs.h"
#include "fm_cmds.h"
#include "fm_cmd_utils.h"
#include "fm_perfids.h"
#include "fm_platform_cfg.h"
#include "fm_version.h"
-#include "fm_verify.h"
#include
-/**
- * \brief Internal Macro to access the internal payload structure of a message
- *
- * This is done as a macro so it can be applied consistently to all
- * message processing functions, based on the way FM defines its messages.
- */
-#define FM_GET_CMD_PAYLOAD(ptr, type) (&((const type *)(ptr))->Payload)
-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
-/* FM command handler -- NOOP */
+/* FM application -- housekeeping request packet processor */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_NoopCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_SendHkCmd(const FM_SendHkCmd_t* Msg)
{
- const char *CmdText = "No-op";
+ CFE_TBL_Manage(FM_AppData.MonitorTableHandle);
+
+ FM_AppData.HkTlm.Payload.NumOpenFiles = FM_GetOpenFilesData(NULL);
- CFE_EVS_SendEvent(FM_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command: FM version %d.%d.%d.%d", CmdText,
- FM_MAJOR_VERSION, FM_MINOR_VERSION, FM_REVISION, FM_MISSION_REV);
+ CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_AppData.HkTlm.TelemetryHeader));
+ CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_AppData.HkTlm.TelemetryHeader), true);
- return true;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
-/* FM command handler -- Reset Counters */
+/* FM command handler -- NOOP */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_NoopCmd(const FM_NoopCmd_t* Msg)
{
- const char *CmdText = "Reset Counters";
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ CFE_EVS_SendEvent(FM_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION,
+ "No-op command: FM version %d.%d.%d.%d",
+ FM_MAJOR_VERSION,
+ FM_MINOR_VERSION,
+ FM_REVISION,
+ FM_MISSION_REV);
+
+ return CFE_SUCCESS;
+}
- FM_GlobalData.CommandCounter = 0;
- FM_GlobalData.CommandErrCounter = 0;
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* */
+/* FM command handler -- Reset Counters */
+/* */
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+CFE_Status_t FM_ResetCountersCmd(const FM_ResetCountersCmd_t* Msg)
+{
+ FM_AppData.HkTlm.Payload.CommandCounter = 0;
+ FM_AppData.HkTlm.Payload.CommandErrCounter = 0;
- FM_GlobalData.ChildCmdCounter = 0;
- FM_GlobalData.ChildCmdErrCounter = 0;
- FM_GlobalData.ChildCmdWarnCounter = 0;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter = 0;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter = 0;
+ FM_AppData.HkTlm.Payload.ChildCmdWarnCounter = 0;
/* Send command completion event (debug) */
- CFE_EVS_SendEvent(FM_RESET_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command", CmdText);
+ CFE_EVS_SendEvent(FM_RESET_INF_EID, CFE_EVS_EventType_INFORMATION,
+ "Reset Counters command");
- return true;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -92,13 +104,13 @@ bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_CopyFileCmd(const FM_CopyFileCmd_t* Msg)
{
FM_ChildQueueEntry_t *CmdArgs = NULL;
const char * CmdText = "Copy File";
bool CommandResult;
- const FM_OvwSourceTargetFilename_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_CopyFileCmd_t);
+ const FM_OvwSourceTargetFilename_Payload_t *CmdPtr = &Msg->Payload;
/* Verify that overwrite argument is valid */
CommandResult = FM_VerifyOverwrite(CmdPtr->Overwrite, FM_COPY_OVR_ERR_EID, CmdText);
@@ -131,21 +143,27 @@ bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr)
/* Prepare command for child task execution */
if (CommandResult == true)
{
- CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex];
+ CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex];
/* Set handshake queue command args */
CmdArgs->CommandCode = FM_COPY_FILE_CC;
- strncpy(CmdArgs->Source1, CmdPtr->Source, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source1[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source1, CmdPtr->Source, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source1[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
- strncpy(CmdArgs->Target, CmdPtr->Target, OS_MAX_PATH_LEN - 1);
- CmdArgs->Target[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Target, CmdPtr->Target, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Target[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
/* Invoke lower priority child task */
FM_InvokeChildTask();
+
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -154,13 +172,13 @@ bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_MoveFileCmd(const FM_MoveFileCmd_t* Msg)
{
FM_ChildQueueEntry_t *CmdArgs = NULL;
const char * CmdText = "Move File";
bool CommandResult;
- const FM_OvwSourceTargetFilename_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_MoveFileCmd_t);
+ const FM_OvwSourceTargetFilename_Payload_t *CmdPtr = &Msg->Payload;
/* Verify that overwrite argument is valid */
CommandResult = FM_VerifyOverwrite(CmdPtr->Overwrite, FM_MOVE_OVR_ERR_EID, CmdText);
@@ -193,22 +211,28 @@ bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr)
/* Prepare command for child task execution */
if (CommandResult == true)
{
- CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex];
+ CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex];
/* Set handshake queue command args */
CmdArgs->CommandCode = FM_MOVE_FILE_CC;
- strncpy(CmdArgs->Source1, CmdPtr->Source, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source1[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source1, CmdPtr->Source, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source1[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
- strncpy(CmdArgs->Target, CmdPtr->Target, OS_MAX_PATH_LEN - 1);
- CmdArgs->Target[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Target, CmdPtr->Target, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Target[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
/* Invoke lower priority child task */
FM_InvokeChildTask();
+
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -217,13 +241,13 @@ bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_RenameFileCmd(const FM_RenameFileCmd_t* Msg)
{
FM_ChildQueueEntry_t *CmdArgs = NULL;
const char * CmdText = "Rename File";
bool CommandResult;
- const FM_SourceTargetFileName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_RenameFileCmd_t);
+ const FM_SourceTargetFileName_Payload_t *CmdPtr = &Msg->Payload;
/* Verify that source file exists and is not a directory */
CommandResult = FM_VerifyFileExists(CmdPtr->Source, sizeof(CmdPtr->Source), FM_RENAME_SRC_BASE_EID, CmdText);
@@ -243,22 +267,28 @@ bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr)
/* Prepare command for child task execution */
if (CommandResult == true)
{
- CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex];
+ CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex];
/* Set handshake queue command args */
CmdArgs->CommandCode = FM_RENAME_FILE_CC;
- strncpy(CmdArgs->Source1, CmdPtr->Source, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source1[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source1, CmdPtr->Source, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source1[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
- strncpy(CmdArgs->Target, CmdPtr->Target, OS_MAX_PATH_LEN - 1);
- CmdArgs->Target[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Target, CmdPtr->Target, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Target[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
/* Invoke lower priority child task */
FM_InvokeChildTask();
+
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -267,13 +297,13 @@ bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_DeleteFileCmd(const FM_DeleteFileCmd_t* Msg)
{
FM_ChildQueueEntry_t *CmdArgs = NULL;
const char * CmdText = "Delete File";
bool CommandResult;
- const FM_SingleFilename_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_DeleteFileCmd_t);
+ const FM_SingleFilename_Payload_t *CmdPtr = &Msg->Payload;
/* Verify that file exists, is not a directory and is not open */
CommandResult = FM_VerifyFileClosed(CmdPtr->Filename, sizeof(CmdPtr->Filename), FM_DELETE_SRC_BASE_EID, CmdText);
@@ -287,18 +317,24 @@ bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr)
/* Prepare command for child task execution */
if (CommandResult == true)
{
- CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex];
+ CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex];
/* Set handshake queue command args - might be global or internal CC */
- CFE_MSG_GetFcnCode(&BufPtr->Msg, &CmdArgs->CommandCode);
- strncpy(CmdArgs->Source1, CmdPtr->Filename, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source1[OS_MAX_PATH_LEN - 1] = '\0';
+ CmdArgs->CommandCode = FM_DELETE_FILE_CC;
+ strncpy(CmdArgs->Source1, CmdPtr->Filename, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source1[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
/* Invoke lower priority child task */
FM_InvokeChildTask();
+
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -307,14 +343,14 @@ bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_DeleteAllFilesCmd(const FM_DeleteAllFilesCmd_t* Msg)
{
const char * CmdText = "Delete All Files";
- char DirWithSep[OS_MAX_PATH_LEN] = "\0";
+ char DirWithSep[CFE_MISSION_MAX_PATH_LEN] = "\0";
FM_ChildQueueEntry_t *CmdArgs = NULL;
bool CommandResult;
- const FM_DirectoryName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_DeleteAllFilesCmd_t);
+ const FM_DirectoryName_Payload_t *CmdPtr = &Msg->Payload;
/* Verify that the directory exists */
CommandResult =
@@ -323,9 +359,9 @@ bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr)
if (CommandResult == true)
{
/* Append a path separator to the end of the directory name */
- strncpy(DirWithSep, CmdPtr->Directory, OS_MAX_PATH_LEN - 1);
- DirWithSep[OS_MAX_PATH_LEN - 1] = '\0';
- FM_AppendPathSep(DirWithSep, OS_MAX_PATH_LEN);
+ strncpy(DirWithSep, CmdPtr->Directory, CFE_MISSION_MAX_PATH_LEN - 1);
+ DirWithSep[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
+ FM_AppendPathSep(DirWithSep, CFE_MISSION_MAX_PATH_LEN);
/* Check for lower priority child task availability */
CommandResult = FM_VerifyChildTask(FM_DELETE_ALL_CHILD_BASE_EID, CmdText);
@@ -334,21 +370,27 @@ bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr)
/* Prepare command for child task execution */
if (CommandResult == true)
{
- CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex];
+ CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex];
/* Set handshake queue command args */
CmdArgs->CommandCode = FM_DELETE_ALL_FILES_CC;
- strncpy(CmdArgs->Source1, CmdPtr->Directory, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source1[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source1, CmdPtr->Directory, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source1[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
- strncpy(CmdArgs->Source2, DirWithSep, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source2[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source2, DirWithSep, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source2[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
/* Invoke lower priority child task */
FM_InvokeChildTask();
+
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -357,13 +399,13 @@ bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_DecompressFileCmd(const FM_DecompressFileCmd_t* Msg)
{
const char * CmdText = "Decompress File";
FM_ChildQueueEntry_t *CmdArgs = NULL;
bool CommandResult;
- const FM_SourceTargetFileName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_DecompressFileCmd_t);
+ const FM_SourceTargetFileName_Payload_t *CmdPtr = &Msg->Payload;
/* Verify that source file exists, is not a directory and is not open */
CommandResult = FM_VerifyFileClosed(CmdPtr->Source, sizeof(CmdPtr->Source), FM_DECOM_SRC_BASE_EID, CmdText);
@@ -383,18 +425,24 @@ bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr)
/* Prepare command for child task execution */
if (CommandResult == true)
{
- CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex];
+ CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex];
/* Set handshake queue command args */
CmdArgs->CommandCode = FM_DECOMPRESS_FILE_CC;
- snprintf(CmdArgs->Source1, OS_MAX_PATH_LEN, "%s", CmdPtr->Source);
- snprintf(CmdArgs->Target, OS_MAX_PATH_LEN, "%s", CmdPtr->Target);
+ snprintf(CmdArgs->Source1, CFE_MISSION_MAX_PATH_LEN, "%s", CmdPtr->Source);
+ snprintf(CmdArgs->Target, CFE_MISSION_MAX_PATH_LEN, "%s", CmdPtr->Target);
/* Invoke lower priority child task */
FM_InvokeChildTask();
+
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -403,13 +451,13 @@ bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_ConcatFilesCmd(const FM_ConcatFilesCmd_t* Msg)
{
const char * CmdText = "Concat Files";
FM_ChildQueueEntry_t *CmdArgs = NULL;
bool CommandResult;
- const FM_TwoSourceOneTarget_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_ConcatFilesCmd_t);
+ const FM_TwoSourceOneTarget_Payload_t *CmdPtr = &Msg->Payload;
/* Verify that source file #1 exists, is not a directory and is not open */
CommandResult = FM_VerifyFileClosed(CmdPtr->Source1, sizeof(CmdPtr->Source1), FM_CONCAT_SRC1_BASE_EID, CmdText);
@@ -435,22 +483,28 @@ bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr)
/* Prepare command for child task execution */
if (CommandResult == true)
{
- CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex];
+ CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex];
/* Set handshake queue command args */
CmdArgs->CommandCode = FM_CONCAT_FILES_CC;
- strncpy(CmdArgs->Source1, CmdPtr->Source1, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source1[OS_MAX_PATH_LEN - 1] = '\0';
- strncpy(CmdArgs->Source2, CmdPtr->Source2, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source2[OS_MAX_PATH_LEN - 1] = '\0';
- strncpy(CmdArgs->Target, CmdPtr->Target, OS_MAX_PATH_LEN - 1);
- CmdArgs->Target[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source1, CmdPtr->Source1, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source1[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source2, CmdPtr->Source2, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source2[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Target, CmdPtr->Target, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Target[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
/* Invoke lower priority child task */
FM_InvokeChildTask();
+
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -459,14 +513,14 @@ bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_GetFileInfoCmd(const FM_GetFileInfoCmd_t* Msg)
{
const char * CmdText = "Get File Info";
FM_ChildQueueEntry_t *CmdArgs = NULL;
bool CommandResult = true;
uint32 FilenameState = FM_NAME_IS_INVALID;
- const FM_FilenameAndCRC_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_GetFileInfoCmd_t);
+ const FM_FilenameAndCRC_Payload_t *CmdPtr = &Msg->Payload;
/* Verify that the source name is valid for a file or directory */
FilenameState =
@@ -486,26 +540,32 @@ bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr)
/* Prepare command for child task execution */
if (CommandResult == true)
{
- CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex];
+ CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex];
/* Set handshake queue command args */
CmdArgs->CommandCode = FM_GET_FILE_INFO_CC;
- strncpy(CmdArgs->Source1, CmdPtr->Filename, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source1[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source1, CmdPtr->Filename, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source1[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
CmdArgs->FileInfoState = FilenameState;
CmdArgs->FileInfoCRC = CmdPtr->FileInfoCRC;
/* Global data set during call to FM_VerifyNameValid */
- CmdArgs->FileInfoSize = FM_GlobalData.FileStatSize;
- CmdArgs->FileInfoTime = FM_GlobalData.FileStatTime;
- CmdArgs->Mode = FM_GlobalData.FileStatMode;
+ CmdArgs->FileInfoSize = FM_AppData.FileStatSize;
+ CmdArgs->FileInfoTime = FM_AppData.FileStatTime;
+ CmdArgs->Mode = FM_AppData.FileStatMode;
/* Invoke lower priority child task */
FM_InvokeChildTask();
+
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -514,15 +574,15 @@ bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_GetOpenFilesCmd(const FM_GetOpenFilesCmd_t* Msg)
{
const char *CmdText = "Get Open Files";
uint32 NumOpenFiles = 0;
- FM_OpenFilesPkt_Payload_t *ReportPtr = &FM_GlobalData.OpenFilesPkt.Payload;
+ FM_OpenFilesPkt_Payload_t *ReportPtr = &FM_AppData.OpenFilesPkt.Payload;
/* Initialize open files telemetry packet */
- CFE_MSG_Init(CFE_MSG_PTR(FM_GlobalData.OpenFilesPkt.TelemetryHeader), CFE_SB_ValueToMsgId(FM_OPEN_FILES_TLM_MID),
+ CFE_MSG_Init(CFE_MSG_PTR(FM_AppData.OpenFilesPkt.TelemetryHeader), CFE_SB_ValueToMsgId(FM_OPEN_FILES_TLM_MID),
sizeof(FM_OpenFilesPkt_t));
/* Get list of open files and count */
@@ -531,13 +591,15 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr)
ReportPtr->NumOpenFiles = NumOpenFiles;
/* Timestamp and send open files telemetry packet */
- CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_GlobalData.OpenFilesPkt.TelemetryHeader));
- CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_GlobalData.OpenFilesPkt.TelemetryHeader), true);
+ CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_AppData.OpenFilesPkt.TelemetryHeader));
+ CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_AppData.OpenFilesPkt.TelemetryHeader), true);
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_GET_OPEN_FILES_CMD_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command", CmdText);
- return true;
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -546,13 +608,13 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_CreateDirectoryCmd(const FM_CreateDirectoryCmd_t* Msg)
{
FM_ChildQueueEntry_t *CmdArgs = NULL;
const char * CmdText = "Create Directory";
bool CommandResult;
- const FM_DirectoryName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_CreateDirectoryCmd_t);
+ const FM_DirectoryName_Payload_t *CmdPtr = &Msg->Payload;
/* Verify that the directory name is not already in use */
CommandResult =
@@ -567,18 +629,24 @@ bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr)
/* Prepare command for child task execution */
if (CommandResult == true)
{
- CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex];
+ CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex];
/* Set handshake queue command args */
CmdArgs->CommandCode = FM_CREATE_DIRECTORY_CC;
- strncpy(CmdArgs->Source1, CmdPtr->Directory, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source1[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source1, CmdPtr->Directory, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source1[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
/* Invoke lower priority child task */
FM_InvokeChildTask();
+
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -587,13 +655,13 @@ bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_DeleteDirectoryCmd(const FM_DeleteDirectoryCmd_t* Msg)
{
FM_ChildQueueEntry_t *CmdArgs = NULL;
const char * CmdText = "Delete Directory";
bool CommandResult;
- const FM_DirectoryName_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_DeleteDirectoryCmd_t);
+ const FM_DirectoryName_Payload_t *CmdPtr = &Msg->Payload;
/* Verify that the directory exists */
CommandResult =
@@ -608,18 +676,24 @@ bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr)
/* Prepare command for child task execution */
if (CommandResult == true)
{
- CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex];
+ CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex];
/* Set handshake queue command args */
CmdArgs->CommandCode = FM_DELETE_DIRECTORY_CC;
- strncpy(CmdArgs->Source1, CmdPtr->Directory, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source1[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source1, CmdPtr->Directory, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source1[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
/* Invoke lower priority child task */
FM_InvokeChildTask();
+
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -628,15 +702,15 @@ bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_GetDirListFileCmd(const FM_GetDirListFileCmd_t* Msg)
{
const char * CmdText = "Directory List to File";
- char DirWithSep[OS_MAX_PATH_LEN] = "\0";
- char Filename[OS_MAX_PATH_LEN] = "\0";
+ char DirWithSep[CFE_MISSION_MAX_PATH_LEN] = "\0";
+ char Filename[CFE_MISSION_MAX_PATH_LEN] = "\0";
FM_ChildQueueEntry_t *CmdArgs = NULL;
bool CommandResult;
- const FM_GetDirectoryToFile_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_GetDirListFileCmd_t);
+ const FM_GetDirectoryToFile_Payload_t *CmdPtr = &Msg->Payload;
/* Verify that source directory exists */
CommandResult =
@@ -669,30 +743,36 @@ bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr)
/* Prepare command for child task execution */
if (CommandResult == true)
{
- CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex];
+ CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex];
/* Append a path separator to the end of the directory name */
- strncpy(DirWithSep, CmdPtr->Directory, OS_MAX_PATH_LEN - 1);
- DirWithSep[OS_MAX_PATH_LEN - 1] = '\0';
- FM_AppendPathSep(DirWithSep, OS_MAX_PATH_LEN);
+ strncpy(DirWithSep, CmdPtr->Directory, CFE_MISSION_MAX_PATH_LEN - 1);
+ DirWithSep[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
+ FM_AppendPathSep(DirWithSep, CFE_MISSION_MAX_PATH_LEN);
/* Set handshake queue command args */
CmdArgs->CommandCode = FM_GET_DIR_LIST_FILE_CC;
CmdArgs->GetSizeTimeMode = CmdPtr->GetSizeTimeMode;
- strncpy(CmdArgs->Source1, CmdPtr->Directory, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source1[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source1, CmdPtr->Directory, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source1[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
- strncpy(CmdArgs->Source2, DirWithSep, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source2[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source2, DirWithSep, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source2[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
- strncpy(CmdArgs->Target, Filename, OS_MAX_PATH_LEN - 1);
- CmdArgs->Target[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Target, Filename, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Target[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
/* Invoke lower priority child task */
FM_InvokeChildTask();
+
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -701,14 +781,14 @@ bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_GetDirListPktCmd(const FM_GetDirListPktCmd_t* Msg)
{
const char * CmdText = "Directory List to Packet";
- char DirWithSep[OS_MAX_PATH_LEN] = "\0";
+ char DirWithSep[CFE_MISSION_MAX_PATH_LEN] = "\0";
FM_ChildQueueEntry_t *CmdArgs = NULL;
bool CommandResult;
- const FM_GetDirectoryToPkt_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_GetDirListPktCmd_t);
+ const FM_GetDirectoryToPkt_Payload_t *CmdPtr = &Msg->Payload;
/* Verify that source directory exists */
CommandResult =
@@ -723,28 +803,34 @@ bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr)
/* Prepare command for child task execution */
if (CommandResult == true)
{
- CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex];
+ CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex];
/* Append a path separator to the end of the directory name */
- strncpy(DirWithSep, CmdPtr->Directory, OS_MAX_PATH_LEN - 1);
- DirWithSep[OS_MAX_PATH_LEN - 1] = '\0';
- FM_AppendPathSep(DirWithSep, OS_MAX_PATH_LEN);
+ strncpy(DirWithSep, CmdPtr->Directory, CFE_MISSION_MAX_PATH_LEN - 1);
+ DirWithSep[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
+ FM_AppendPathSep(DirWithSep, CFE_MISSION_MAX_PATH_LEN);
/* Set handshake queue command args */
CmdArgs->CommandCode = FM_GET_DIR_LIST_PKT_CC;
CmdArgs->GetSizeTimeMode = CmdPtr->GetSizeTimeMode;
- strncpy(CmdArgs->Source1, CmdPtr->Directory, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source1[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source1, CmdPtr->Directory, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source1[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
- strncpy(CmdArgs->Source2, DirWithSep, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source2[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source2, DirWithSep, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source2[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
CmdArgs->DirListOffset = CmdPtr->DirListOffset;
/* Invoke lower priority child task */
FM_InvokeChildTask();
+
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -753,33 +839,39 @@ bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_MonitorFilesystemSpaceCmd(const FM_MonitorFilesystemSpaceCmd_t* Msg)
{
const char *CmdText = "Get Free Space";
bool CommandResult = true;
- uint32 i = 0;
+ uint32 i;
int32 OpResult;
+ CFE_Status_t Status;
const FM_MonitorTableEntry_t *MonitorPtr;
FM_MonitorReportEntry_t * ReportPtr;
+ /* Acquire pointer to file system free space table, also locks table */
+ Status = CFE_TBL_GetAddress((void *)&FM_AppData.MonitorTablePtr, FM_AppData.MonitorTableHandle);
+
/* Verify that we have a pointer to the file system table data */
- if (FM_GlobalData.MonitorTablePtr == NULL)
+ if (Status == CFE_TBL_ERR_NEVER_LOADED)
{
- CommandResult = false;
+ /* Make sure we don't try to use the empty table buffer */
+ FM_AppData.MonitorTablePtr = NULL;
+ CommandResult = false;
CFE_EVS_SendEvent(FM_GET_FREE_SPACE_TBL_ERR_EID, CFE_EVS_EventType_ERROR,
"%s error: file system free space table is not loaded", CmdText);
}
else
{
/* Initialize the file system free space telemetry packet */
- CFE_MSG_Init(CFE_MSG_PTR(FM_GlobalData.MonitorReportPkt.TelemetryHeader),
- CFE_SB_ValueToMsgId(FM_FREE_SPACE_TLM_MID), sizeof(FM_MonitorReportPkt_t));
+ CFE_MSG_Init(CFE_MSG_PTR(FM_AppData.MonitorReportPkt.TelemetryHeader),
+ CFE_SB_ValueToMsgId(FM_MONITOR_TLM_MID), sizeof(FM_MonitorReportPkt_t));
/* Process enabled file system table entries */
- MonitorPtr = FM_GlobalData.MonitorTablePtr->Entries;
- ReportPtr = FM_GlobalData.MonitorReportPkt.Payload.FileSys;
+ MonitorPtr = FM_AppData.MonitorTablePtr->Entries;
+ ReportPtr = FM_AppData.MonitorReportPkt.Payload.FileSys;
for (i = 0; i < FM_TABLE_ENTRY_COUNT; i++)
{
if (MonitorPtr->Type != FM_MonitorTableEntry_Type_UNUSED)
@@ -825,15 +917,30 @@ bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr)
}
/* Timestamp and send file system free space telemetry packet */
- CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_GlobalData.MonitorReportPkt.TelemetryHeader));
- CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_GlobalData.MonitorReportPkt.TelemetryHeader), true);
+ CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_AppData.MonitorReportPkt.TelemetryHeader));
+ CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_AppData.MonitorReportPkt.TelemetryHeader), true);
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_MONITOR_FILESYSTEM_SPACE_CMD_INF_EID, CFE_EVS_EventType_INFORMATION, "%s command",
CmdText);
+
+ /* Release pointer to file system free space table */
+ CFE_TBL_ReleaseAddress(FM_AppData.MonitorTableHandle);
+
+ /* Prevent table pointer use while released */
+ FM_AppData.MonitorTablePtr = NULL;
+ }
+
+ if (CommandResult == true)
+ {
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -842,18 +949,23 @@ bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_SetTableStateCmd(const FM_SetTableStateCmd_t* Msg)
{
const char *CmdText = "Set Table State";
bool CommandResult = true;
+ CFE_Status_t Status;
- const FM_TableIndexAndState_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_SetTableStateCmd_t);
+ const FM_TableIndexAndState_Payload_t *CmdPtr = &Msg->Payload;
- if (FM_GlobalData.MonitorTablePtr == NULL)
+ /* Acquire pointer to file system free space table */
+ Status = CFE_TBL_GetAddress((void *)&FM_AppData.MonitorTablePtr, FM_AppData.MonitorTableHandle);
+ if (Status == CFE_TBL_ERR_NEVER_LOADED)
{
+ /* Make sure we don't try to use the empty table buffer */
+ FM_AppData.MonitorTablePtr = NULL;
+
/* File system table has not been loaded */
CommandResult = false;
-
CFE_EVS_SendEvent(FM_SET_TABLE_STATE_TBL_ERR_EID, CFE_EVS_EventType_ERROR,
"%s error: file system free space table is not loaded", CmdText);
}
@@ -874,7 +986,7 @@ bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr)
CFE_EVS_SendEvent(FM_SET_TABLE_STATE_ARG_STATE_ERR_EID, CFE_EVS_EventType_ERROR,
"%s error: invalid command argument: state = %d", CmdText, (int)CmdPtr->TableEntryState);
}
- else if (FM_GlobalData.MonitorTablePtr->Entries[CmdPtr->TableEntryIndex].Type == FM_MonitorTableEntry_Type_UNUSED)
+ else if (FM_AppData.MonitorTablePtr->Entries[CmdPtr->TableEntryIndex].Type == FM_MonitorTableEntry_Type_UNUSED)
{
/* Current table entry state must not be unused */
CommandResult = false;
@@ -886,10 +998,10 @@ bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr)
else
{
/* Update the table entry state as commanded */
- FM_GlobalData.MonitorTablePtr->Entries[CmdPtr->TableEntryIndex].Enabled = CmdPtr->TableEntryState;
+ FM_AppData.MonitorTablePtr->Entries[CmdPtr->TableEntryIndex].Enabled = CmdPtr->TableEntryState;
/* Notify cFE that we have modified the table data */
- CFE_TBL_Modified(FM_GlobalData.MonitorTableHandle);
+ CFE_TBL_Modified(FM_AppData.MonitorTableHandle);
/* Send command completion event (info) */
CFE_EVS_SendEvent(FM_SET_TABLE_STATE_CMD_EID, CFE_EVS_EventType_INFORMATION,
@@ -897,7 +1009,22 @@ bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr)
(int)CmdPtr->TableEntryState);
}
- return CommandResult;
+ /* Release pointer to file system free space table */
+ CFE_TBL_ReleaseAddress(FM_AppData.MonitorTableHandle);
+
+ /* Prevent table pointer use while released */
+ FM_AppData.MonitorTablePtr = NULL;
+
+ if (CommandResult == true)
+ {
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
+ }
+
+ return CFE_SUCCESS;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -906,14 +1033,14 @@ bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_SetPermissionsCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_SetPermissionsCmd(const FM_SetPermissionsCmd_t* Msg)
{
FM_ChildQueueEntry_t *CmdArgs = NULL;
const char * CmdText = "Set Permissions";
bool CommandResult = true;
uint32 FilenameState = FM_NAME_IS_INVALID;
- const FM_FilenameAndMode_Payload_t *CmdPtr = FM_GET_CMD_PAYLOAD(BufPtr, FM_SetPermissionsCmd_t);
+ const FM_FilenameAndMode_Payload_t *CmdPtr = &Msg->Payload;
FilenameState = FM_VerifyNameValid(CmdPtr->FileName, sizeof(CmdPtr->FileName), 0, CmdText);
@@ -931,16 +1058,22 @@ bool FM_SetPermissionsCmd(const CFE_SB_Buffer_t *BufPtr)
/* Prepare command for child task execution */
if (CommandResult == true)
{
- CmdArgs = &FM_GlobalData.ChildQueue[FM_GlobalData.ChildWriteIndex];
+ CmdArgs = &FM_AppData.ChildQueue[FM_AppData.ChildWriteIndex];
/* Set handshake queue command args */
CmdArgs->CommandCode = FM_SET_PERMISSIONS_CC;
- strncpy(CmdArgs->Source1, CmdPtr->FileName, OS_MAX_PATH_LEN - 1);
- CmdArgs->Source1[OS_MAX_PATH_LEN - 1] = '\0';
+ strncpy(CmdArgs->Source1, CmdPtr->FileName, CFE_MISSION_MAX_PATH_LEN - 1);
+ CmdArgs->Source1[CFE_MISSION_MAX_PATH_LEN - 1] = '\0';
CmdArgs->Mode = CmdPtr->Mode;
/* Invoke lower priority child task */
FM_InvokeChildTask();
+
+ FM_AppData.HkTlm.Payload.CommandCounter++;
+ }
+ else
+ {
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
}
- return CommandResult;
+ return CFE_SUCCESS;
}
diff --git a/fsw/src/fm_cmds.h b/fsw/src/fm_cmds.h
index 44a204a..fbf14e9 100644
--- a/fsw/src/fm_cmds.h
+++ b/fsw/src/fm_cmds.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,7 +23,8 @@
#ifndef FM_CMDS_H
#define FM_CMDS_H
-#include "cfe.h"
+#include "cfe_error.h"
+#include "fm_msg.h"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
@@ -32,6 +32,25 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * \brief Housekeeping Request Command Handler
+ *
+ * \par Description
+ *
+ * Allow CFE Table Services the opportunity to manage the File System
+ * Free Space Table. This provides a mechanism to receive table updates.
+ *
+ * Populate the FM application Housekeeping Telemetry packet. Timestamp
+ * the packet and send it to ground via the Software Bus.
+ *
+ * \par Assumptions, External Events, and Notes: None
+ *
+ * \param [in] Msg Pointer to Software Bus command packet.
+ *
+ * \sa #FM_SendHkCmd_t, #FM_HkTlm_t
+ */
+CFE_Status_t FM_SendHkCmd(const FM_SendHkCmd_t* Msg);
+
/**
* \brief Move File Command Handler Function
*
@@ -41,7 +60,7 @@
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -49,7 +68,7 @@
*
* \sa #FM_NOOP_CC, #FM_NoopCmd_t
*/
-bool FM_NoopCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_NoopCmd(const FM_NoopCmd_t* Msg);
/**
* \brief Reset Counters Command Handler Function
@@ -59,7 +78,7 @@ bool FM_NoopCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -67,7 +86,7 @@ bool FM_NoopCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_RESET_COUNTERS_CC, #FM_ResetCountersCmd_t
*/
-bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_ResetCountersCmd(const FM_ResetCountersCmd_t* Msg);
/**
* \brief Copy File Command Handler Function
@@ -85,7 +104,7 @@ bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -93,7 +112,7 @@ bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_COPY_FILE_CC, #FM_CopyFileCmd_t
*/
-bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_CopyFileCmd(const FM_CopyFileCmd_t* Msg);
/**
* \brief Move File Command Handler Function
@@ -104,7 +123,7 @@ bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -112,7 +131,7 @@ bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_MOVE_FILE_CC, #FM_MoveFileCmd_t
*/
-bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_MoveFileCmd(const FM_MoveFileCmd_t* Msg);
/**
* \brief Rename File Command Handler Function
@@ -123,7 +142,7 @@ bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -131,7 +150,7 @@ bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_RENAME_FILE_CC, #FM_RenameFileCmd_t
*/
-bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_RenameFileCmd(const FM_RenameFileCmd_t* Msg);
/**
* \brief Delete File Command Handler Function
@@ -141,7 +160,7 @@ bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -149,7 +168,7 @@ bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_DELETE_FILE_CC, #FM_DeleteFileCmd_t
*/
-bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_DeleteFileCmd(const FM_DeleteFileCmd_t* Msg);
/**
* \brief Delete All Files Command Handler Function
@@ -167,7 +186,7 @@ bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -175,7 +194,7 @@ bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_DELETE_ALL_FILES_CC, #FM_DeleteAllFilesCmd_t
*/
-bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_DeleteAllFilesCmd(const FM_DeleteAllFilesCmd_t* Msg);
/**
* \brief Decompress Files Command Handler Function
@@ -194,7 +213,7 @@ bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -202,7 +221,7 @@ bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_DECOMPRESS_FILE_CC, #FM_DecompressFileCmd_t
*/
-bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_DecompressFileCmd(const FM_DecompressFileCmd_t* Msg);
/**
* \brief Concatenate Files Command Handler Function
@@ -222,7 +241,7 @@ bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -230,7 +249,7 @@ bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_CONCAT_FILES_CC, #FM_ConcatFilesCmd_t
*/
-bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_ConcatFilesCmd(const FM_ConcatFilesCmd_t* Msg);
/**
* \brief Get File Information Command Handler Function
@@ -249,7 +268,7 @@ bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -257,7 +276,7 @@ bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_GET_FILE_INFO_CC, #FM_GetFileInfoCmd_t, #FM_FileInfoPkt_t
*/
-bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_GetFileInfoCmd(const FM_GetFileInfoCmd_t* Msg);
/**
* \brief Get Open Files List Command Handler Function
@@ -268,7 +287,7 @@ bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -276,7 +295,7 @@ bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_GET_OPEN_FILES_CC, #FM_GetOpenFilesCmd_t, #FM_OpenFilesPkt_t
*/
-bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_GetOpenFilesCmd(const FM_GetOpenFilesCmd_t* Msg);
/**
* \brief Create Directory Command Handler Function
@@ -286,7 +305,7 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -294,7 +313,7 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_CREATE_DIRECTORY_CC, #FM_CreateDirectoryCmd_t
*/
-bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_CreateDirectoryCmd(const FM_CreateDirectoryCmd_t* Msg);
/**
* \brief Delete Directory Command Handler Function
@@ -304,7 +323,7 @@ bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -312,7 +331,7 @@ bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_DELETE_DIRECTORY_CC, #FM_DeleteDirectoryCmd_t
*/
-bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_DeleteDirectoryCmd(const FM_DeleteDirectoryCmd_t* Msg);
/**
* \brief Get Directory List to Packet Command Handler Function
@@ -330,7 +349,7 @@ bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -339,7 +358,7 @@ bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr);
* \sa #FM_GET_DIR_LIST_FILE_CC, #FM_GetDirListFileCmd_t,
* #FM_DirListFileStats_t, FM_DirListEntry_t
*/
-bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_GetDirListFileCmd(const FM_GetDirListFileCmd_t* Msg);
/**
* \brief Get Directory List to Packet Command Handler Function
@@ -358,7 +377,7 @@ bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -366,7 +385,7 @@ bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_GET_DIR_LIST_PKT_CC, #FM_GetDirListPktCmd_t, #FM_DirListPkt_t
*/
-bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_GetDirListPktCmd(const FM_GetDirListPktCmd_t* Msg);
/**
* \brief Monitor Filesystem Command Handler Function
@@ -378,7 +397,7 @@ bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -386,7 +405,7 @@ bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_MONITOR_FILESYSTEM_SPACE_CC, #FM_MonitorFilesystemSpaceCmd_t, #FM_MonitorReportPkt_t
*/
-bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_MonitorFilesystemSpaceCmd(const FM_MonitorFilesystemSpaceCmd_t* Msg);
/**
* \brief Set Table Entry State Command Handler Function
@@ -397,7 +416,7 @@ bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -405,7 +424,7 @@ bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_SET_TABLE_STATE_CC, #FM_SetTableStateCmd_t, #FM_MonitorTableEntry_t
*/
-bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_SetTableStateCmd(const FM_SetTableStateCmd_t* Msg);
/**
* \brief Set File Permissions of a file
@@ -415,7 +434,7 @@ bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus command packet.
+ * \param [in] Msg Pointer to Software Bus command packet.
*
* \return Boolean command success response
* \retval true Command successful
@@ -423,6 +442,6 @@ bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr);
*
* \sa #FM_SET_PERMISSIONS_CC, #FM_SetPermissionsCmd_t, #FM_SET_PERM_CMD_INF_EID, #FM_SET_PERM_ERR_EID
*/
-bool FM_SetPermissionsCmd(const CFE_SB_Buffer_t *BufPtr);
+CFE_Status_t FM_SetPermissionsCmd(const FM_SetPermissionsCmd_t* Msg);
#endif
diff --git a/fsw/src/fm_compression.h b/fsw/src/fm_compression.h
index 481f820..a170018 100644
--- a/fsw/src/fm_compression.h
+++ b/fsw/src/fm_compression.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -28,10 +27,12 @@
#ifndef FM_COMPRESSION_H
#define FM_COMPRESSION_H
-#include
-#include
+/* ======== */
+/* Includes */
+/* ======== */
#include "cfe.h"
+#include "fm_internal_cfg.h"
/**
* @brief The state object for a compressor
@@ -49,6 +50,10 @@ typedef struct FM_Compressor_State FM_Compressor_State_t;
*/
typedef struct FM_Decompressor_State FM_Decompressor_State_t;
+/* =================== */
+/* Function Prototypes */
+/* =================== */
+
/**
* @brief Initialize the compression/decompression service
*
diff --git a/fsw/src/fm_compression_fslib.c b/fsw/src/fm_compression_fslib.c
index 68dcc99..9b0c8a6 100644
--- a/fsw/src/fm_compression_fslib.c
+++ b/fsw/src/fm_compression_fslib.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -54,7 +53,7 @@ static FM_Decompressor_State_t FM_FSLIB_DecompressState;
CFE_Status_t FM_CompressionService_Init(void)
{
memset(&FM_FSLIB_DecompressState, 0, sizeof(FM_FSLIB_DecompressState));
- FM_GlobalData.DecompressorStatePtr = &FM_FSLIB_DecompressState;
+ FM_AppData.DecompressorStatePtr = &FM_FSLIB_DecompressState;
return CFE_SUCCESS;
}
diff --git a/fsw/src/fm_compression_none.c b/fsw/src/fm_compression_none.c
index a094649..b6927a9 100644
--- a/fsw/src/fm_compression_none.c
+++ b/fsw/src/fm_compression_none.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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/fm_compression_zlib.c b/fsw/src/fm_compression_zlib.c
index 66f0ea4..897c9a4 100644
--- a/fsw/src/fm_compression_zlib.c
+++ b/fsw/src/fm_compression_zlib.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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/fm_dispatch.c b/fsw/src/fm_dispatch.c
index 3626d14..5dcd7ec 100644
--- a/fsw/src/fm_dispatch.c
+++ b/fsw/src/fm_dispatch.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -34,9 +33,10 @@
#include "fm_msg.h"
#include "fm_msgdefs.h"
#include "fm_msgids.h"
-#include "fm_events.h"
+#include "fm_eventids.h"
#include "fm_cmds.h"
#include "fm_app.h"
+#include "fm_fcncodes.h"
#include "cfe.h"
@@ -46,388 +46,34 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-bool FM_IsValidCmdPktLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength, uint32 EventID, const char *CmdText)
+bool FM_VerifyCmdLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength)
{
- bool FunctionResult = true;
- size_t ActualLength = 0;
+ bool result = true;
+ size_t ActualLength = 0;
+ CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID;
+ CFE_MSG_FcnCode_t FcnCode = 0;
CFE_MSG_GetSize(MsgPtr, &ActualLength);
- /* Verify command packet length */
- if (ActualLength != ExpectedLength)
+ /*
+ ** Verify the command packet length.
+ */
+ if (ExpectedLength != ActualLength)
{
- FunctionResult = false;
+ CFE_MSG_GetMsgId(MsgPtr, &MsgId);
+ CFE_MSG_GetFcnCode(MsgPtr, &FcnCode);
- CFE_EVS_SendEvent(EventID, CFE_EVS_EventType_ERROR,
- "%s error: invalid command packet length: expected = %d, actual = %d", CmdText,
- (int)ExpectedLength, (int)ActualLength);
- }
-
- return FunctionResult;
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- NOOP */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_NoopVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify message length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_NoopCmd_t), FM_NOOP_PKT_ERR_EID, "No-op"))
- {
- return false;
- }
-
- return FM_NoopCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Reset Counters */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_ResetCountersVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify message length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_ResetCountersCmd_t), FM_RESET_PKT_ERR_EID, "Reset Counters"))
- {
- return false;
- }
-
- return FM_ResetCountersCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Copy File */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_CopyFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_CopyFileCmd_t), FM_COPY_PKT_ERR_EID, "Copy File"))
- {
- return false;
- }
-
- return FM_CopyFileCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Move File */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_MoveFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_MoveFileCmd_t), FM_MOVE_PKT_ERR_EID, "Move File"))
- {
- return false;
- }
-
- return FM_MoveFileCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Rename File */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_RenameFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_RenameFileCmd_t), FM_RENAME_PKT_ERR_EID, "Rename File"))
- {
- return false;
- }
-
- return FM_RenameFileCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Delete File */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_DeleteFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_DeleteFileCmd_t), FM_DELETE_PKT_ERR_EID, "Delete File"))
- {
- return false;
- }
-
- return FM_DeleteFileCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Delete All Files */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_DeleteAllFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify message length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_DeleteAllFilesCmd_t), FM_DELETE_ALL_PKT_ERR_EID,
- "Delete All Files"))
- {
- return false;
- }
-
- return FM_DeleteAllFilesCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Decompress File */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_DecompressFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_DecompressFileCmd_t), FM_DECOM_PKT_ERR_EID, "Decompress File"))
- {
- return false;
- }
-
- return FM_DecompressFileCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Concatenate Files */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_ConcatFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_ConcatFilesCmd_t), FM_CONCAT_PKT_ERR_EID, "Concat Files"))
- {
- return false;
- }
-
- return FM_ConcatFilesCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Get File Info */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_GetFileInfoVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_GetFileInfoCmd_t), FM_GET_FILE_INFO_PKT_ERR_EID,
- "Get File Info"))
- {
- return false;
- }
-
- return FM_GetFileInfoCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Get List of Open Files */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_GetOpenFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_GetOpenFilesCmd_t), FM_GET_OPEN_FILES_PKT_ERR_EID,
- "Get Open Files"))
- {
- return false;
- }
-
- return FM_GetOpenFilesCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Create Directory */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_CreateDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_CreateDirectoryCmd_t), FM_CREATE_DIR_PKT_ERR_EID,
- "Create Directory"))
- {
- return false;
- }
-
- return FM_CreateDirectoryCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Delete Directory */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_DeleteDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_DeleteDirectoryCmd_t), FM_DELETE_DIR_PKT_ERR_EID,
- "Delete Directory"))
- {
- return false;
- }
-
- return FM_DeleteDirectoryCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Get List of Directory Entries (to file) */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_GetDirListFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_GetDirListFileCmd_t), FM_GET_DIR_FILE_PKT_ERR_EID,
- "Directory List to File"))
- {
- return false;
- }
-
- return FM_GetDirListFileCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Get List of Directory Entries (to pkt) */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_GetDirListPktVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_GetDirListPktCmd_t), FM_GET_DIR_PKT_PKT_ERR_EID,
- "Directory List to Packet"))
- {
- return false;
- }
-
- return FM_GetDirListPktCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Get File System Free Space */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_MonitorFilesystemSpaceVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_MonitorFilesystemSpaceCmd_t), FM_GET_FREE_SPACE_PKT_ERR_EID,
- "Get Free Space"))
- {
- return false;
- }
-
- return FM_MonitorFilesystemSpaceCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Set Table Entry Enable/Disable State */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_SetTableStateVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_SetTableStateCmd_t), FM_SET_TABLE_STATE_PKT_ERR_EID,
- "Set Table State"))
- {
- return false;
- }
-
- return FM_SetTableStateCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Set Permissions for a file */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-bool FM_SetPermissionsVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_SetPermissionsCmd_t), FM_SET_PERM_ERR_EID, "Set Permissions"))
- {
- return false;
- }
+ CFE_EVS_SendEvent(FM_CMD_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
+ "Invalid Msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u",
+ (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, (unsigned int)ActualLength,
+ (unsigned int)ExpectedLength);
- return FM_SetPermissionsCmd(BufPtr);
-}
+ result = false;
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM command handler -- Send Housekeeping */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void FM_SendHkVerifyDispatch(const CFE_SB_Buffer_t *BufPtr)
-{
- /* Verify command packet length */
- if (!FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_SendHkCmd_t), FM_HKREQ_LEN_ERR_EID, "HK Request"))
- {
- return;
+ ++FM_AppData.HkTlm.Payload.CommandErrCounter;
}
- FM_SendHkCmd(BufPtr);
-}
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* */
-/* FM application -- input packet processor */
-/* */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void FM_ProcessPkt(const CFE_SB_Buffer_t *BufPtr)
-{
- CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
-
- CFE_MSG_GetMsgId(&BufPtr->Msg, &MessageID);
-
- switch (CFE_SB_MsgIdToValue(MessageID))
- {
- /* Housekeeping request */
- case FM_SEND_HK_MID:
- FM_SendHkVerifyDispatch(BufPtr);
- break;
-
- /* FM ground commands */
- case FM_CMD_MID:
- FM_ProcessCmd(BufPtr);
- break;
-
- default:
- CFE_EVS_SendEvent(FM_MID_ERR_EID, CFE_EVS_EventType_ERROR,
- "Main loop error: invalid message ID: mid = 0x%08lX",
- (unsigned long)CFE_SB_MsgIdToValue(MessageID));
- break;
- }
+ return result;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -435,106 +81,177 @@ void FM_ProcessPkt(const CFE_SB_Buffer_t *BufPtr)
/* FM application -- command packet processor */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-void FM_ProcessCmd(const CFE_SB_Buffer_t *BufPtr)
+void FM_ProcessGroundCommand(const CFE_SB_Buffer_t *BufPtr)
{
- bool Result;
CFE_MSG_FcnCode_t CommandCode = 0;
CFE_MSG_GetFcnCode(&BufPtr->Msg, &CommandCode);
-
- /* Invoke specific command handler */
switch (CommandCode)
{
case FM_NOOP_CC:
- Result = FM_NoopVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_NoopCmd_t)))
+ {
+ FM_NoopCmd((FM_NoopCmd_t*) BufPtr);
+ }
break;
case FM_RESET_COUNTERS_CC:
- Result = FM_ResetCountersVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_ResetCountersCmd_t)))
+ {
+ FM_ResetCountersCmd((FM_ResetCountersCmd_t*) BufPtr);
+ }
break;
case FM_COPY_FILE_CC:
- Result = FM_CopyFileVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_CopyFileCmd_t)))
+ {
+ FM_CopyFileCmd((FM_CopyFileCmd_t*) BufPtr);
+ }
break;
case FM_MOVE_FILE_CC:
- Result = FM_MoveFileVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_MoveFileCmd_t)))
+ {
+ FM_MoveFileCmd((FM_MoveFileCmd_t*) BufPtr);
+ }
break;
case FM_RENAME_FILE_CC:
- Result = FM_RenameFileVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_RenameFileCmd_t)))
+ {
+ FM_RenameFileCmd((FM_RenameFileCmd_t*) BufPtr);
+ }
break;
case FM_DELETE_FILE_CC:
- Result = FM_DeleteFileVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_DeleteFileCmd_t)))
+ {
+ FM_DeleteFileCmd((FM_DeleteFileCmd_t*) BufPtr);
+ }
break;
case FM_DELETE_ALL_FILES_CC:
- Result = FM_DeleteAllFilesVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_DeleteAllFilesCmd_t)))
+ {
+ FM_DeleteAllFilesCmd((FM_DeleteAllFilesCmd_t*) BufPtr);
+ }
break;
case FM_DECOMPRESS_FILE_CC:
- Result = FM_DecompressFileVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_DecompressFileCmd_t)))
+ {
+ FM_DecompressFileCmd((FM_DecompressFileCmd_t*) BufPtr);
+ }
break;
case FM_CONCAT_FILES_CC:
- Result = FM_ConcatFilesVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_ConcatFilesCmd_t)))
+ {
+ FM_ConcatFilesCmd((FM_ConcatFilesCmd_t*) BufPtr);
+ }
break;
case FM_GET_FILE_INFO_CC:
- Result = FM_GetFileInfoVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_GetFileInfoCmd_t)))
+ {
+ FM_GetFileInfoCmd((FM_GetFileInfoCmd_t*) BufPtr);
+ }
break;
case FM_GET_OPEN_FILES_CC:
- Result = FM_GetOpenFilesVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_GetOpenFilesCmd_t)))
+ {
+ FM_GetOpenFilesCmd((FM_GetOpenFilesCmd_t*) BufPtr);
+ }
break;
case FM_CREATE_DIRECTORY_CC:
- Result = FM_CreateDirectoryVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_CreateDirectoryCmd_t)))
+ {
+ FM_CreateDirectoryCmd((FM_CreateDirectoryCmd_t*) BufPtr);
+ }
break;
case FM_DELETE_DIRECTORY_CC:
- Result = FM_DeleteDirectoryVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_DeleteDirectoryCmd_t)))
+ {
+ FM_DeleteDirectoryCmd((FM_DeleteDirectoryCmd_t*) BufPtr);
+ }
break;
case FM_GET_DIR_LIST_FILE_CC:
- Result = FM_GetDirListFileVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_GetDirListFileCmd_t)))
+ {
+ FM_GetDirListFileCmd((FM_GetDirListFileCmd_t*) BufPtr);
+ }
break;
case FM_GET_DIR_LIST_PKT_CC:
- Result = FM_GetDirListPktVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_GetDirListPktCmd_t)))
+ {
+ FM_GetDirListPktCmd((FM_GetDirListPktCmd_t*) BufPtr);
+ }
break;
case FM_MONITOR_FILESYSTEM_SPACE_CC:
- Result = FM_MonitorFilesystemSpaceVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_MonitorFilesystemSpaceCmd_t)))
+ {
+ FM_MonitorFilesystemSpaceCmd((FM_MonitorFilesystemSpaceCmd_t*) BufPtr);
+ }
break;
case FM_SET_TABLE_STATE_CC:
- Result = FM_SetTableStateVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_SetTableStateCmd_t)))
+ {
+ FM_SetTableStateCmd((FM_SetTableStateCmd_t*) BufPtr);
+ }
break;
case FM_SET_PERMISSIONS_CC:
- Result = FM_SetPermissionsVerifyDispatch(BufPtr);
+ if (FM_VerifyCmdLength(&BufPtr->Msg, sizeof(FM_SetPermissionsCmd_t)))
+ {
+ FM_SetPermissionsCmd((FM_SetPermissionsCmd_t*) BufPtr);
+ }
break;
default:
- Result = false;
- CFE_EVS_SendEvent(FM_CC_ERR_EID, CFE_EVS_EventType_ERROR, "Main loop error: invalid command code: cc = %d",
- CommandCode);
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
+ CFE_EVS_SendEvent(FM_CC_ERR_EID, CFE_EVS_EventType_ERROR,
+ "Invalid ground command code: cc = %d",
+ CommandCode);
break;
}
+}
- if (Result)
- {
- /* Increment command success counter */
- if (CommandCode != FM_RESET_COUNTERS_CC)
- {
- FM_GlobalData.CommandCounter++;
- }
- }
- else
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* */
+/* FM application -- input packet processor */
+/* */
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+void FM_TaskPipe(const CFE_SB_Buffer_t *BufPtr)
+{
+ CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
+
+ CFE_MSG_GetMsgId(&BufPtr->Msg, &MessageID);
+
+ switch (CFE_SB_MsgIdToValue(MessageID))
{
- /* Increment command error counter */
- FM_GlobalData.CommandErrCounter++;
+ /* FM ground commands */
+ case FM_CMD_MID:
+ FM_ProcessGroundCommand(BufPtr);
+ break;
+
+ /* Housekeeping request */
+ case FM_SEND_HK_MID:
+ FM_SendHkCmd((const FM_SendHkCmd_t *)BufPtr);
+ break;
+
+ default:
+ FM_AppData.HkTlm.Payload.CommandErrCounter++;
+ CFE_EVS_SendEvent(FM_MID_ERR_EID, CFE_EVS_EventType_ERROR,
+ "Invalid command pipe message ID: 0x%08lX",
+ (unsigned long)CFE_SB_MsgIdToValue(MessageID));
+ break;
}
-}
+}
\ No newline at end of file
diff --git a/fsw/src/fm_dispatch.h b/fsw/src/fm_dispatch.h
index f998068..bd1c39b 100644
--- a/fsw/src/fm_dispatch.h
+++ b/fsw/src/fm_dispatch.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -28,76 +27,49 @@
#include "fm_msg.h"
/**
- * \brief Process Input Command Packets
+ * \brief Verify Command Packet Length Function
*
* \par Description
+ * This function is invoked from each of the command handlers to verify the
+ * length of the command packet.
*
- * Branch to appropriate input packet handler: HK request or FM commands.
- *
- * \par Assumptions, External Events, and Notes: None
+ * \par Assumptions, External Events, and Notes:
*
- * \param [in] BufPtr Pointer to Software Bus message buffer.
+ * \param [in] MsgPtr Pointer to Message
+ * \param [in] ExpectedLength Expected packet length (command specific)
*
- * \sa #FM_SendHkCmd, #FM_ProcessCmd
+ * \return Boolean valid packet length response
+ * \retval true Packet length valid
+ * \retval false Packet length invalid
*/
-void FM_ProcessPkt(const CFE_SB_Buffer_t *BufPtr);
+bool FM_VerifyCmdLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength);
/**
- * \brief Process FM Ground Commands
+ * \brief Process Input Command Packets
*
* \par Description
*
- * Branch to the command specific handlers for FM ground commands.
+ * Branch to appropriate input packet handler: HK request or FM commands.
*
* \par Assumptions, External Events, and Notes: None
*
- * \param [in] BufPtr Pointer to Software Bus message buffer.
+ * \param [in] BufPtr Pointer to Software Bus message buffer.
+ *
+ * \sa #FM_SendHkCmd, #FM_ProcessGroundCommand
*/
-void FM_ProcessCmd(const CFE_SB_Buffer_t *BufPtr);
+void FM_TaskPipe(const CFE_SB_Buffer_t *BufPtr);
/**
- * \brief Verify Command Packet Length Function
+ * \brief Process FM Ground Commands
*
* \par Description
- * This function is invoked from each of the command handlers to verify the
- * length of the command packet.
*
- * \par Assumptions, External Events, and Notes:
+ * Branch to the command specific handlers for FM ground commands.
*
- * \param [in] MsgPtr Pointer to Message
- * \param [in] ExpectedLength Expected packet length (command specific)
- * \param [in] EventID Error event ID (command specific)
- * \param [in] CmdText Error event text (command specific)
+ * \par Assumptions, External Events, and Notes: None
*
- * \return Boolean valid packet length response
- * \retval true Packet length valid
- * \retval false Packet length invalid
- */
-bool FM_IsValidCmdPktLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength, uint32 EventID,
- const char *CmdText);
-
-/*
- * Internal dispatch function for each command -
- * These are declared here so they can be directly invoked by the unit test for coverage
+ * \param [in] BufPtr Pointer to Software Bus message buffer.
*/
-bool FM_NoopVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_ResetCountersVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_CopyFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_MoveFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_RenameFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_DeleteFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_DeleteAllFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_DecompressFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_ConcatFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_GetFileInfoVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_GetOpenFilesVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_CreateDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_DeleteDirectoryVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_GetDirListFileVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_GetDirListPktVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_MonitorFilesystemSpaceVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_SetTableStateVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-bool FM_SetPermissionsVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
-void FM_SendHkVerifyDispatch(const CFE_SB_Buffer_t *BufPtr);
+void FM_ProcessGroundCommand(const CFE_SB_Buffer_t *BufPtr);
#endif
diff --git a/fsw/src/fm_eds_dispatch.c b/fsw/src/fm_eds_dispatch.c
new file mode 100644
index 0000000..f6d6718
--- /dev/null
+++ b/fsw/src/fm_eds_dispatch.c
@@ -0,0 +1,114 @@
+/*******************************************************************************
+**
+** GSC-18128-1, "Core Flight Executive Version 6.7"
+**
+** Copyright (c) 2006-2019 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: fm_eds_dispatch.c
+**
+** Purpose:
+** This file contains the source code for the Command Ingest task.
+**
+*******************************************************************************/
+
+/*
+** Include Files:
+*/
+
+#include "fm_app.h"
+#include "fm_cmds.h"
+#include "fm_dispatch.h"
+#include "fm_eventids.h"
+#include "fm_msgids.h"
+#include "fm_msg.h"
+
+#include "fm_eds_dispatcher.h"
+#include "fm_eds_dictionary.h"
+
+/*
+ * Define a lookup table for FM lab command codes
+ */
+/* clang-format off */
+static const EdsDispatchTable_EdsComponent_FM_Application_CFE_SB_Telecommand_t FM_TC_DISPATCH_TABLE =
+{
+ .CMD =
+ {
+ .NoopCmd_indication = FM_NoopCmd,
+ .ResetCountersCmd_indication = FM_ResetCountersCmd,
+ .SendHkCmd_indication = FM_SendHkCmd,
+ .CopyFileCmd_indication = FM_CopyFileCmd,
+ .MoveFileCmd_indication = FM_MoveFileCmd,
+ .RenameFileCmd_indication = FM_RenameFileCmd,
+ .DeleteFileCmd_indication = FM_DeleteFileCmd,
+ .DeleteAllFilesCmd_indication = FM_DeleteAllFilesCmd,
+ .DecompressFileCmd_indication = FM_DecompressFileCmd,
+ .ConcatFilesCmd_indication = FM_ConcatFilesCmd,
+ .GetFileInfoCmd_indication = FM_GetFileInfoCmd,
+ .GetOpenFilesCmd_indication = FM_GetOpenFilesCmd,
+ .CreateDirectoryCmd_indication = FM_CreateDirectoryCmd,
+ .DeleteDirectoryCmd_indication = FM_DeleteDirectoryCmd,
+ .GetDirListFileCmd_indication = FM_GetDirListFileCmd,
+ .GetDirListPktCmd_indication = FM_GetDirListPktCmd,
+ .MonitorFilesystemSpaceCmd_indication = FM_MonitorFilesystemSpaceCmd,
+ .SetTableStateCmd_indication = FM_SetTableStateCmd,
+ .SetPermissionsCmd_indication = FM_SetPermissionsCmd,
+ },
+ .SEND_HK =
+ {
+ .indication = FM_SendHkCmd
+ }
+};
+/* clang-format on */
+
+/* ==================== */
+/* Function Definitions */
+/* ==================== */
+
+void FM_TaskPipe(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_FM_Application_Telecommand(BufPtr, &FM_TC_DISPATCH_TABLE);
+
+ if (Status != CFE_SUCCESS)
+ {
+ CFE_MSG_GetMsgId(&BufPtr->Msg, &MsgId);
+ CFE_MSG_GetSize(&BufPtr->Msg, &MsgSize);
+ CFE_MSG_GetFcnCode(&BufPtr->Msg, &MsgFc);
+ ++FM_AppData.HkTlm.Payload.CommandErrCounter;
+
+ if (Status == CFE_STATUS_UNKNOWN_MSG_ID)
+ {
+ CFE_EVS_SendEvent(FM_MID_ERR_EID, CFE_EVS_EventType_ERROR,
+ "FM: invalid command packet,MID = 0x%x", (unsigned int)CFE_SB_MsgIdToValue(MsgId));
+ }
+ else if (Status == CFE_STATUS_WRONG_MSG_LENGTH)
+ {
+ CFE_EVS_SendEvent(FM_CMD_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
+ "FM: Invalid Msg length: ID = 0x%X, CC = %u, Len = %u",
+ (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)MsgFc, (unsigned int)MsgSize);
+ }
+ else
+ {
+ CFE_EVS_SendEvent(FM_CC_ERR_EID, CFE_EVS_EventType_ERROR,
+ "FM: Invalid ground command code: CC = %d", (int)MsgFc);
+ }
+ }
+}
diff --git a/fsw/src/fm_tbl.c b/fsw/src/fm_table_utils.c
similarity index 90%
rename from fsw/src/fm_tbl.c
rename to fsw/src/fm_table_utils.c
index ff8c4c3..4653438 100644
--- a/fsw/src/fm_tbl.c
+++ b/fsw/src/fm_table_utils.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,8 +26,9 @@
#include "fm_platform_cfg.h"
#include "fm_app.h"
+#include "fm_table_utils.h"
+#include "fm_eventids.h"
#include "fm_tbl.h"
-#include "fm_events.h"
#include
@@ -43,17 +43,17 @@ CFE_Status_t FM_TableInit(void)
CFE_Status_t Status;
/* Initialize file system free space table pointer */
- FM_GlobalData.MonitorTablePtr = NULL;
+ FM_AppData.MonitorTablePtr = NULL;
/* Register the file system free space table - this must succeed! */
- Status = CFE_TBL_Register(&FM_GlobalData.MonitorTableHandle, FM_TABLE_CFE_NAME, sizeof(FM_MonitorTable_t),
+ Status = CFE_TBL_Register(&FM_AppData.MonitorTableHandle, FM_TABLE_CFE_NAME, sizeof(FM_MonitorTable_t),
(CFE_TBL_OPT_SNGL_BUFFER | CFE_TBL_OPT_LOAD_DUMP),
(CFE_TBL_CallbackFuncPtr_t)FM_ValidateTable);
if (Status == CFE_SUCCESS)
{
/* Make an attempt to load the default table data - OK if this fails */
- CFE_TBL_Load(FM_GlobalData.MonitorTableHandle, CFE_TBL_SRC_FILE, FM_TABLE_DEF_NAME);
+ CFE_TBL_Load(FM_AppData.MonitorTableHandle, CFE_TBL_SRC_FILE, FM_TABLE_DEF_NAME);
/* Allow cFE a chance to dump, update, etc. */
FM_AcquireTablePointers();
@@ -194,15 +194,15 @@ void FM_AcquireTablePointers(void)
CFE_Status_t Status;
/* Allow cFE an opportunity to make table updates */
- CFE_TBL_Manage(FM_GlobalData.MonitorTableHandle);
+ CFE_TBL_Manage(FM_AppData.MonitorTableHandle);
/* Acquire pointer to file system free space table */
- Status = CFE_TBL_GetAddress((void *)&FM_GlobalData.MonitorTablePtr, FM_GlobalData.MonitorTableHandle);
+ Status = CFE_TBL_GetAddress((void *)&FM_AppData.MonitorTablePtr, FM_AppData.MonitorTableHandle);
if (Status == CFE_TBL_ERR_NEVER_LOADED)
{
/* Make sure we don't try to use the empty table buffer */
- FM_GlobalData.MonitorTablePtr = NULL;
+ FM_AppData.MonitorTablePtr = NULL;
}
}
@@ -215,8 +215,8 @@ void FM_AcquireTablePointers(void)
void FM_ReleaseTablePointers(void)
{
/* Release pointer to file system free space table */
- CFE_TBL_ReleaseAddress(FM_GlobalData.MonitorTableHandle);
+ CFE_TBL_ReleaseAddress(FM_AppData.MonitorTableHandle);
/* Prevent table pointer use while released */
- FM_GlobalData.MonitorTablePtr = NULL;
+ FM_AppData.MonitorTablePtr = NULL;
}
diff --git a/fsw/src/fm_tbl.h b/fsw/src/fm_table_utils.h
similarity index 92%
rename from fsw/src/fm_tbl.h
rename to fsw/src/fm_table_utils.h
index 5c7a1b8..90c8137 100644
--- a/fsw/src/fm_tbl.h
+++ b/fsw/src/fm_table_utils.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,11 +20,11 @@
* @file
* Unit specification for the CFS File Manager table structures.
*/
-#ifndef FM_TBL_H
-#define FM_TBL_H
+#ifndef FM_TABLE_UTILS_H
+#define FM_TABLE_UTILS_H
#include "cfe.h"
-#include "fm_msg.h"
+#include "fm_tbl.h"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
@@ -83,7 +82,7 @@ CFE_Status_t FM_ValidateTable(FM_MonitorTable_t *TablePtr);
*
* \par Assumptions, External Events, and Notes:
*
- * \sa #FM_GlobalData_t
+ * \sa #FM_AppData_t
*/
void FM_AcquireTablePointers(void);
@@ -99,7 +98,7 @@ void FM_AcquireTablePointers(void);
*
* \par Assumptions, External Events, and Notes:
*
- * \sa #FM_GlobalData_t
+ * \sa #FM_AppData_t
*/
void FM_ReleaseTablePointers(void);
diff --git a/fsw/src/fm_verify.h b/fsw/src/fm_verify.h
index bcb7a05..0ff9837 100644
--- a/fsw/src/fm_verify.h
+++ b/fsw/src/fm_verify.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,10 +23,11 @@
#ifndef FM_VERIFY_H
#define FM_VERIFY_H
-/* Need definition of OS_MAX_NUM_OPEN_FILES */
#include "cfe.h"
-
+#include "fm_mission_cfg.h"
#include "fm_platform_cfg.h"
+#include "fm_tbl.h"
+#include "fm_msg.h"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
diff --git a/fsw/src/fm_version.h b/fsw/src/fm_version.h
index 647eeeb..d20edd2 100644
--- a/fsw/src/fm_version.h
+++ b/fsw/src/fm_version.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -32,9 +31,9 @@
* \{
*/
-#define FM_MAJOR_VERSION 2 /**< \brief Major version number */
-#define FM_MINOR_VERSION 6 /**< \brief Minor version number */
-#define FM_REVISION 99 /**< \brief Revision number */
+#define FM_MAJOR_VERSION 7 /**< \brief Major version number */
+#define FM_MINOR_VERSION 0 /**< \brief Minor version number */
+#define FM_REVISION 0 /**< \brief Revision number */
/**\}*/
diff --git a/fsw/tables/fm_monitor.c b/fsw/tables/fm_monitor.c
index ed9b034..bf8232e 100644
--- a/fsw/tables/fm_monitor.c
+++ b/fsw/tables/fm_monitor.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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 @@
#include "cfe_tbl_filedef.h"
#include "fm_platform_cfg.h"
#include "fm_msg.h"
+#include "fm_tblstruct.h"
+#include "fm_tbl.h"
/*
** FM file system free space table header
diff --git a/mission_build.cmake b/mission_build.cmake
index fc4929a..0cc2325 100644
--- a/mission_build.cmake
+++ b/mission_build.cmake
@@ -1,4 +1,30 @@
-# App specific mission scope configuration
+###########################################################
+#
+# FM app mission build setup
+#
+# This file is evaluated as part of the "prepare" stage
+# and can be used to set up prerequisites for the build,
+# such as generating header files
+#
+###########################################################
# Add stand alone documentation
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/docs/dox_src ${MISSION_BINARY_DIR}/docs/fm-usersguide)
+
+# The list of header files that control the FM configuration
+set(FM_MISSION_CONFIG_FILE_LIST
+ fm_fcncode_values.h
+ fm_interface_cfg_values.h
+ fm_mission_cfg.h
+ fm_msg.h
+ fm_msgdefs.h
+ fm_msgstruct.h
+ fm_perfids.h
+ fm_tbl.h
+ fm_tbldefs.h
+ fm_tblstruct.h
+ fm_topicid_values.h
+ fm_extern_typedefs.h
+)
+
+generate_configfile_set(${FM_MISSION_CONFIG_FILE_LIST})
\ No newline at end of file
diff --git a/unit-test/CMakeLists.txt b/unit-test/CMakeLists.txt
index 57328fa..3d66b80 100644
--- a/unit-test/CMakeLists.txt
+++ b/unit-test/CMakeLists.txt
@@ -17,7 +17,7 @@ add_cfe_coverage_stubs("fm_internal"
stubs/fm_dispatch_stubs.c
stubs/fm_app_stubs.c
stubs/fm_child_stubs.c
- stubs/fm_tbl_stubs.c
+ stubs/fm_table_utils_stubs.c
)
# Link with the cfe core stubs and unit test assert libs
diff --git a/unit-test/fm_app_tests.c b/unit-test/fm_app_tests.c
index 0cb160a..c93a28c 100644
--- a/unit-test/fm_app_tests.c
+++ b/unit-test/fm_app_tests.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -38,16 +37,15 @@
#include "fm_msgdefs.h"
#include "fm_msgids.h"
#include "fm_app.h"
-#include "fm_tbl.h"
+#include "fm_table_utils.h"
#include "fm_child.h"
#include "fm_cmds.h"
#include "fm_cmd_utils.h"
#include "fm_dispatch.h"
-#include "fm_events.h"
+#include "fm_eventids.h"
#include "fm_perfids.h"
#include "fm_platform_cfg.h"
#include "fm_version.h"
-#include "fm_verify.h"
#include "fm_app.h"
#include "fm_test_utils.h"
#include
@@ -117,10 +115,16 @@ void Test_FM_AppMain_SBReceiveBufferIsTimeOut(void)
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 2);
UtAssert_STUB_COUNT(CFE_ES_ExitApp, 1);
UtAssert_STUB_COUNT(CFE_SB_ReceiveBuffer, 1);
- UtAssert_STUB_COUNT(FM_ReleaseTablePointers, 1);
- UtAssert_STUB_COUNT(FM_AcquireTablePointers, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventID, FM_EXIT_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventType, CFE_EVS_EventType_ERROR);
+
+ /* Arrange */
+ UT_SetDefaultReturnValue(UT_KEY(CFE_ES_RunLoop), true);
+ UT_SetDeferredRetcode(UT_KEY(CFE_ES_RunLoop), 2, false);
+ UT_SetDefaultReturnValue(UT_KEY(CFE_SB_ReceiveBuffer), CFE_SB_NO_MESSAGE);
+
+ /* Act */
+ UtAssert_VOIDCALL(FM_AppMain());
}
void Test_FM_AppMain_ReceiveBufferSuccessBufPtrIsNull(void)
@@ -286,49 +290,6 @@ void Test_FM_AppInit_TableInitSuccess(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
}
-/* ********************************
- * Report HK Tests
- * *******************************/
-void Test_FM_SendHkCmd(void)
-{
- FM_HousekeepingPkt_Payload_t *ReportPtr;
-
- /* Arrange */
- UT_SetDefaultReturnValue(UT_KEY(FM_GetOpenFilesData), 0);
-
- /* Set non-zero values to assert */
- FM_GlobalData.CommandCounter = 1;
- FM_GlobalData.CommandErrCounter = 2;
- FM_GlobalData.ChildCmdCounter = 3;
- FM_GlobalData.ChildCmdErrCounter = 4;
- FM_GlobalData.ChildCmdWarnCounter = 5;
- FM_GlobalData.ChildQueueCount = 6;
- FM_GlobalData.ChildCurrentCC = 7;
- FM_GlobalData.ChildPreviousCC = 8;
-
- /* Act */
- UtAssert_VOIDCALL(FM_SendHkCmd(NULL));
-
- /* Assert */
- UtAssert_STUB_COUNT(FM_ReleaseTablePointers, 1);
- UtAssert_STUB_COUNT(FM_AcquireTablePointers, 1);
- UtAssert_STUB_COUNT(CFE_MSG_Init, 1);
- UtAssert_STUB_COUNT(FM_GetOpenFilesData, 1);
- UtAssert_STUB_COUNT(CFE_SB_TimeStampMsg, 1);
- UtAssert_STUB_COUNT(CFE_SB_TransmitMsg, 1);
-
- ReportPtr = &FM_GlobalData.HousekeepingPkt.Payload;
- UtAssert_INT32_EQ(ReportPtr->CommandCounter, FM_GlobalData.CommandCounter);
- UtAssert_INT32_EQ(ReportPtr->CommandErrCounter, FM_GlobalData.CommandErrCounter);
- UtAssert_INT32_EQ(ReportPtr->NumOpenFiles, 0);
- UtAssert_INT32_EQ(ReportPtr->ChildCmdCounter, FM_GlobalData.ChildCmdCounter);
- UtAssert_INT32_EQ(ReportPtr->ChildCmdErrCounter, FM_GlobalData.ChildCmdErrCounter);
- UtAssert_INT32_EQ(ReportPtr->ChildCmdWarnCounter, FM_GlobalData.ChildCmdWarnCounter);
- UtAssert_INT32_EQ(ReportPtr->ChildQueueCount, FM_GlobalData.ChildQueueCount);
- UtAssert_INT32_EQ(ReportPtr->ChildCurrentCC, FM_GlobalData.ChildCurrentCC);
- UtAssert_INT32_EQ(ReportPtr->ChildPreviousCC, FM_GlobalData.ChildPreviousCC);
-}
-
/* * * * * * * * * * * * * *
* Add Method Tests
* * * * * * * * * * * * * */
@@ -367,11 +328,6 @@ void add_FM_AppInit_tests(void)
UtTest_Add(Test_FM_AppInit_TableInitSuccess, FM_Test_Setup, FM_Test_Teardown, "Test_FM_AppInit_TableInitSuccess");
}
-void add_FM_SendHkCmd_tests(void)
-{
- UtTest_Add(Test_FM_SendHkCmd, FM_Test_Setup, FM_Test_Teardown, "Test_FM_SendHkCmd_Return");
-}
-
/*
* Register the test cases to execute with the unit test tool
*/
@@ -379,5 +335,4 @@ void UtTest_Setup(void)
{
add_FM_AppInit_tests();
add_FM_AppMain_tests();
- add_FM_SendHkCmd_tests();
}
diff --git a/unit-test/fm_child_tests.c b/unit-test/fm_child_tests.c
index 40a18f6..12b4914 100644
--- a/unit-test/fm_child_tests.c
+++ b/unit-test/fm_child_tests.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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 @@
#include "fm_msg.h"
#include "fm_msgdefs.h"
#include "fm_msgids.h"
-#include "fm_events.h"
+#include "fm_eventids.h"
#include "fm_app.h"
#include "fm_child.h"
#include "fm_cmds.h"
#include "fm_cmd_utils.h"
#include "fm_perfids.h"
#include "fm_platform_cfg.h"
-#include "fm_verify.h"
+#include "fm_extern_typedefs.h"
/*
* UT Testing
@@ -56,12 +55,12 @@
void UT_FM_Child_Cmd_Assert(int32 cmd_ctr, int32 cmderr_ctr, int32 cmdwarn_ctr, int32 previous_cc)
{
- UtAssert_INT32_EQ(FM_GlobalData.ChildCmdCounter, cmd_ctr);
- UtAssert_INT32_EQ(FM_GlobalData.ChildCmdErrCounter, cmderr_ctr);
- UtAssert_INT32_EQ(FM_GlobalData.ChildCmdWarnCounter, cmdwarn_ctr);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildCmdCounter, cmd_ctr);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildCmdErrCounter, cmderr_ctr);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildCmdWarnCounter, cmdwarn_ctr);
- UtAssert_INT32_EQ(FM_GlobalData.ChildPreviousCC, previous_cc);
- UtAssert_INT32_EQ(FM_GlobalData.ChildCurrentCC, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildPreviousCC, previous_cc);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildCurrentCC, 0);
}
/*********************************************************************************
@@ -120,7 +119,7 @@ void Test_FM_ChildInit_ReturnSuccess(void)
void Test_FM_ChildTask_ChildLoopCalled(void)
{
/* Arrange */
- FM_GlobalData.ChildSemaphore = FM_UT_OBJID_1;
+ FM_AppData.ChildSemaphore = FM_UT_OBJID_1;
UT_SetDefaultReturnValue(UT_KEY(OS_CountSemTake), !CFE_SUCCESS);
@@ -144,15 +143,15 @@ void Test_FM_ChildTask_ChildLoopCalled(void)
void Test_FM_ChildProcess_ChildReadIndexGreaterChildQDepth(void)
{
/* Arrange */
- FM_GlobalData.ChildReadIndex = FM_CHILD_QUEUE_DEPTH - 1;
- FM_GlobalData.ChildQueue[FM_GlobalData.ChildReadIndex].CommandCode = -1;
+ FM_AppData.ChildReadIndex = FM_CHILD_QUEUE_DEPTH - 1;
+ FM_AppData.ChildQueue[FM_AppData.ChildReadIndex].CommandCode = -1;
/* Act */
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
UT_FM_Child_Cmd_Assert(0, 1, 0, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildReadIndex, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildReadIndex, 0);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
@@ -162,13 +161,13 @@ void Test_FM_ChildProcess_ChildReadIndexGreaterChildQDepth(void)
void Test_FM_ChildProcess_FMCopyCC(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = FM_COPY_FILE_CC;
+ FM_AppData.ChildQueue[0].CommandCode = FM_COPY_FILE_CC;
/* Act */
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
- UT_FM_Child_Cmd_Assert(1, 0, 0, FM_GlobalData.ChildQueue[0].CommandCode);
+ UT_FM_Child_Cmd_Assert(1, 0, 0, FM_AppData.ChildQueue[0].CommandCode);
UtAssert_STUB_COUNT(OS_cp, 1);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
@@ -179,13 +178,13 @@ void Test_FM_ChildProcess_FMCopyCC(void)
void Test_FM_ChildProcess_FMMoveCC(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = FM_MOVE_FILE_CC;
+ FM_AppData.ChildQueue[0].CommandCode = FM_MOVE_FILE_CC;
/* Act */
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
- UT_FM_Child_Cmd_Assert(1, 0, 0, FM_GlobalData.ChildQueue[0].CommandCode);
+ UT_FM_Child_Cmd_Assert(1, 0, 0, FM_AppData.ChildQueue[0].CommandCode);
UtAssert_STUB_COUNT(OS_mv, 1);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
@@ -196,13 +195,13 @@ void Test_FM_ChildProcess_FMMoveCC(void)
void Test_FM_ChildProcess_FMRenameCC(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = FM_RENAME_FILE_CC;
+ FM_AppData.ChildQueue[0].CommandCode = FM_RENAME_FILE_CC;
/* Act */
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
- UT_FM_Child_Cmd_Assert(1, 0, 0, FM_GlobalData.ChildQueue[0].CommandCode);
+ UT_FM_Child_Cmd_Assert(1, 0, 0, FM_AppData.ChildQueue[0].CommandCode);
UtAssert_STUB_COUNT(OS_rename, 1);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
@@ -213,13 +212,13 @@ void Test_FM_ChildProcess_FMRenameCC(void)
void Test_FM_ChildProcess_FMDeleteCC(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = FM_DELETE_FILE_CC;
+ FM_AppData.ChildQueue[0].CommandCode = FM_DELETE_FILE_CC;
/* Act */
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
- UT_FM_Child_Cmd_Assert(1, 0, 0, FM_GlobalData.ChildQueue[0].CommandCode);
+ UT_FM_Child_Cmd_Assert(1, 0, 0, FM_AppData.ChildQueue[0].CommandCode);
UtAssert_STUB_COUNT(OS_remove, 1);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
@@ -230,7 +229,7 @@ void Test_FM_ChildProcess_FMDeleteCC(void)
void Test_FM_ChildProcess_FMDeleteAllCC(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = FM_DELETE_ALL_FILES_CC;
+ FM_AppData.ChildQueue[0].CommandCode = FM_DELETE_ALL_FILES_CC;
UT_SetDefaultReturnValue(UT_KEY(OS_DirectoryOpen), !OS_SUCCESS);
@@ -238,7 +237,7 @@ void Test_FM_ChildProcess_FMDeleteAllCC(void)
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
- UT_FM_Child_Cmd_Assert(0, 1, 0, FM_GlobalData.ChildQueue[0].CommandCode);
+ UT_FM_Child_Cmd_Assert(0, 1, 0, FM_AppData.ChildQueue[0].CommandCode);
UtAssert_STUB_COUNT(OS_DirectoryOpen, 1);
UtAssert_STUB_COUNT(OS_DirectoryClose, 0);
@@ -250,7 +249,7 @@ void Test_FM_ChildProcess_FMDeleteAllCC(void)
void Test_FM_ChildProcess_FMDecompressCC(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = FM_DECOMPRESS_FILE_CC;
+ FM_AppData.ChildQueue[0].CommandCode = FM_DECOMPRESS_FILE_CC;
UT_SetDefaultReturnValue(UT_KEY(FM_Decompress_Impl), !CFE_SUCCESS);
@@ -258,7 +257,7 @@ void Test_FM_ChildProcess_FMDecompressCC(void)
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
- UT_FM_Child_Cmd_Assert(0, 1, 0, FM_GlobalData.ChildQueue[0].CommandCode);
+ UT_FM_Child_Cmd_Assert(0, 1, 0, FM_AppData.ChildQueue[0].CommandCode);
UtAssert_STUB_COUNT(FM_Decompress_Impl, 1);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
@@ -269,8 +268,8 @@ void Test_FM_ChildProcess_FMDecompressCC(void)
void Test_FM_ChildProcess_FMConcatCC(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = FM_CONCAT_FILES_CC;
- FM_GlobalData.ChildCurrentCC = 1;
+ FM_AppData.ChildQueue[0].CommandCode = FM_CONCAT_FILES_CC;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 1;
UT_SetDefaultReturnValue(UT_KEY(OS_cp), !OS_SUCCESS);
@@ -278,7 +277,7 @@ void Test_FM_ChildProcess_FMConcatCC(void)
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
- UT_FM_Child_Cmd_Assert(0, 1, 0, FM_GlobalData.ChildQueue[0].CommandCode);
+ UT_FM_Child_Cmd_Assert(0, 1, 0, FM_AppData.ChildQueue[0].CommandCode);
UtAssert_STUB_COUNT(OS_cp, 1);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
@@ -289,8 +288,8 @@ void Test_FM_ChildProcess_FMConcatCC(void)
void Test_FM_ChildProcess_FMCreateDirCC(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = FM_CREATE_DIRECTORY_CC;
- FM_GlobalData.ChildCurrentCC = 1;
+ FM_AppData.ChildQueue[0].CommandCode = FM_CREATE_DIRECTORY_CC;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 1;
UT_SetDefaultReturnValue(UT_KEY(OS_mkdir), !OS_SUCCESS);
@@ -298,7 +297,7 @@ void Test_FM_ChildProcess_FMCreateDirCC(void)
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
- UT_FM_Child_Cmd_Assert(0, 1, 0, FM_GlobalData.ChildQueue[0].CommandCode);
+ UT_FM_Child_Cmd_Assert(0, 1, 0, FM_AppData.ChildQueue[0].CommandCode);
UtAssert_STUB_COUNT(OS_mkdir, 1);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
@@ -309,8 +308,8 @@ void Test_FM_ChildProcess_FMCreateDirCC(void)
void Test_FM_ChildProcess_FMDeleteDirCC(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = FM_DELETE_DIRECTORY_CC;
- FM_GlobalData.ChildCurrentCC = 1;
+ FM_AppData.ChildQueue[0].CommandCode = FM_DELETE_DIRECTORY_CC;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 1;
UT_SetDefaultReturnValue(UT_KEY(OS_DirectoryOpen), !OS_SUCCESS);
@@ -318,7 +317,7 @@ void Test_FM_ChildProcess_FMDeleteDirCC(void)
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
- UT_FM_Child_Cmd_Assert(0, 1, 0, FM_GlobalData.ChildQueue[0].CommandCode);
+ UT_FM_Child_Cmd_Assert(0, 1, 0, FM_AppData.ChildQueue[0].CommandCode);
UtAssert_STUB_COUNT(OS_DirectoryOpen, 1);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
@@ -329,10 +328,10 @@ void Test_FM_ChildProcess_FMDeleteDirCC(void)
void Test_FM_ChildProcess_FMGetFileInfoCC(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = FM_GET_FILE_INFO_CC;
- FM_GlobalData.ChildQueue[0].FileInfoCRC = !FM_IGNORE_CRC;
- FM_GlobalData.ChildQueue[0].FileInfoState = FM_NAME_IS_FILE_OPEN;
- FM_GlobalData.ChildCurrentCC = 1;
+ FM_AppData.ChildQueue[0].CommandCode = FM_GET_FILE_INFO_CC;
+ FM_AppData.ChildQueue[0].FileInfoCRC = !DEFAULT_FM_INTERFACE_IGNORE_CRC;
+ FM_AppData.ChildQueue[0].FileInfoState = FM_NAME_IS_FILE_OPEN;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 1;
UT_SetDefaultReturnValue(UT_KEY(CFE_MSG_Init), CFE_SUCCESS);
@@ -340,7 +339,7 @@ void Test_FM_ChildProcess_FMGetFileInfoCC(void)
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
- UT_FM_Child_Cmd_Assert(1, 0, 1, FM_GlobalData.ChildQueue[0].CommandCode);
+ UT_FM_Child_Cmd_Assert(1, 0, 1, FM_AppData.ChildQueue[0].CommandCode);
UtAssert_STUB_COUNT(CFE_MSG_Init, 1);
UtAssert_STUB_COUNT(CFE_SB_TransmitMsg, 1);
@@ -354,8 +353,8 @@ void Test_FM_ChildProcess_FMGetFileInfoCC(void)
void Test_FM_ChildProcess_FMGetDirListsFileCC(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = FM_GET_DIR_LIST_FILE_CC;
- FM_GlobalData.ChildCurrentCC = 1;
+ FM_AppData.ChildQueue[0].CommandCode = FM_GET_DIR_LIST_FILE_CC;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 1;
UT_SetDefaultReturnValue(UT_KEY(OS_DirectoryOpen), !OS_SUCCESS);
@@ -363,7 +362,7 @@ void Test_FM_ChildProcess_FMGetDirListsFileCC(void)
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
- UT_FM_Child_Cmd_Assert(0, 1, 0, FM_GlobalData.ChildQueue[0].CommandCode);
+ UT_FM_Child_Cmd_Assert(0, 1, 0, FM_AppData.ChildQueue[0].CommandCode);
UtAssert_STUB_COUNT(OS_DirectoryOpen, 1);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
@@ -374,8 +373,8 @@ void Test_FM_ChildProcess_FMGetDirListsFileCC(void)
void Test_FM_ChildProcess_FMGetDirListsPktCC(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = FM_GET_DIR_LIST_PKT_CC;
- FM_GlobalData.ChildCurrentCC = 1;
+ FM_AppData.ChildQueue[0].CommandCode = FM_GET_DIR_LIST_PKT_CC;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 1;
UT_SetDefaultReturnValue(UT_KEY(OS_DirectoryRead), !OS_SUCCESS);
@@ -383,7 +382,7 @@ void Test_FM_ChildProcess_FMGetDirListsPktCC(void)
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
- UT_FM_Child_Cmd_Assert(1, 0, 0, FM_GlobalData.ChildQueue[0].CommandCode);
+ UT_FM_Child_Cmd_Assert(1, 0, 0, FM_AppData.ChildQueue[0].CommandCode);
UtAssert_STUB_COUNT(OS_DirectoryOpen, 1);
UtAssert_STUB_COUNT(OS_DirectoryRead, 1);
@@ -397,8 +396,8 @@ void Test_FM_ChildProcess_FMGetDirListsPktCC(void)
void Test_FM_ChildProcess_FMSetFilePermCC(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = FM_SET_PERMISSIONS_CC;
- FM_GlobalData.ChildCurrentCC = 1;
+ FM_AppData.ChildQueue[0].CommandCode = FM_SET_PERMISSIONS_CC;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 1;
UT_SetDefaultReturnValue(UT_KEY(OS_chmod), !OS_SUCCESS);
@@ -406,7 +405,7 @@ void Test_FM_ChildProcess_FMSetFilePermCC(void)
UtAssert_VOIDCALL(FM_ChildProcess());
/* Assert */
- UT_FM_Child_Cmd_Assert(0, 1, 0, FM_GlobalData.ChildQueue[0].CommandCode);
+ UT_FM_Child_Cmd_Assert(0, 1, 0, FM_AppData.ChildQueue[0].CommandCode);
UtAssert_STUB_COUNT(OS_chmod, 1);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
@@ -417,7 +416,7 @@ void Test_FM_ChildProcess_FMSetFilePermCC(void)
void Test_FM_ChildProcess_DefaultSwitch(void)
{
/* Arrange */
- FM_GlobalData.ChildQueue[0].CommandCode = -1;
+ FM_AppData.ChildQueue[0].CommandCode = -1;
/* Act */
UtAssert_VOIDCALL(FM_ChildProcess());
@@ -912,7 +911,7 @@ void Test_FM_ChildDecompressFileCmd_FSDecompressSuccess(void)
/* Arrange */
FM_ChildQueueEntry_t queue_entry = {.CommandCode = FM_DECOMPRESS_FILE_CC};
- FM_GlobalData.ChildCurrentCC = 1;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 1;
/* Act */
UtAssert_VOIDCALL(FM_ChildDecompressFileCmd(&queue_entry));
@@ -931,7 +930,7 @@ void Test_FM_ChildDecompressFileCmd_FSDecompressNotSuccess(void)
/* Arrange */
FM_ChildQueueEntry_t queue_entry = {.CommandCode = FM_DECOMPRESS_FILE_CC};
- FM_GlobalData.ChildCurrentCC = 1;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 1;
UT_SetDefaultReturnValue(UT_KEY(FM_Decompress_Impl), !CFE_SUCCESS);
/* Act */
@@ -954,7 +953,7 @@ void Test_FM_ChildConcatFilesCmd_OSCpNotSuccess(void)
/* Arrange */
FM_ChildQueueEntry_t queue_entry = {.CommandCode = FM_CONCAT_FILES_CC, .Source1 = "source1", .Source2 = "source2"};
- FM_GlobalData.ChildCurrentCC = 1;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 1;
UT_SetDefaultReturnValue(UT_KEY(OS_cp), !OS_SUCCESS);
/* Act */
@@ -1117,7 +1116,7 @@ void Test_FM_ChildFileInfoCmd_FileInfoCRCEqualIgnoreCRC(void)
FM_ChildQueueEntry_t queue_entry = {.CommandCode = FM_GET_FILE_INFO_CC,
.Source1 = "source1",
.Source2 = "source2",
- .FileInfoCRC = FM_IGNORE_CRC,
+ .FileInfoCRC = DEFAULT_FM_INTERFACE_IGNORE_CRC,
.FileInfoState = FM_NAME_IS_FILE_CLOSED};
/* Act */
@@ -1611,7 +1610,7 @@ void Test_FM_ChildDirListPktCmd_OSDirReadNotSuccess(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_PKT_CMD_INF_EID);
- ReportPtr = &FM_GlobalData.DirListPkt.Payload;
+ ReportPtr = &FM_AppData.DirListPkt.Payload;
UtAssert_UINT32_EQ(ReportPtr->PacketFiles, 0);
}
@@ -1639,7 +1638,7 @@ void Test_FM_ChildDirListPktCmd_DirEntryNameThisDirectory(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_PKT_CMD_INF_EID);
- ReportPtr = &FM_GlobalData.DirListPkt.Payload;
+ ReportPtr = &FM_AppData.DirListPkt.Payload;
UtAssert_UINT32_EQ(ReportPtr->PacketFiles, 0);
}
@@ -1667,7 +1666,7 @@ void Test_FM_ChildDirListPktCmd_DirEntryNameParentDirectory(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_PKT_CMD_INF_EID);
- ReportPtr = &FM_GlobalData.DirListPkt.Payload;
+ ReportPtr = &FM_AppData.DirListPkt.Payload;
UtAssert_UINT32_EQ(ReportPtr->PacketFiles, 0);
}
@@ -1695,7 +1694,7 @@ void Test_FM_ChildDirListPktCmd_DirListOffsetNotExceeded(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_PKT_CMD_INF_EID);
- ReportPtr = &FM_GlobalData.DirListPkt.Payload;
+ ReportPtr = &FM_AppData.DirListPkt.Payload;
UtAssert_UINT32_EQ(ReportPtr->FirstFile, 1);
UtAssert_UINT32_EQ(ReportPtr->TotalFiles, 1);
UtAssert_UINT32_EQ(ReportPtr->PacketFiles, 0);
@@ -1729,7 +1728,7 @@ void Test_FM_ChildDirListPktCmd_DirListOffsetExceeded(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_PKT_CMD_INF_EID);
- ReportPtr = &FM_GlobalData.DirListPkt.Payload;
+ ReportPtr = &FM_AppData.DirListPkt.Payload;
UtAssert_UINT32_EQ(ReportPtr->FirstFile, 0);
UtAssert_UINT32_EQ(ReportPtr->TotalFiles, sizeof(direntry) / sizeof(direntry[0]));
UtAssert_UINT32_EQ(ReportPtr->PacketFiles, FM_DIR_LIST_PKT_ENTRIES);
@@ -1760,7 +1759,7 @@ void Test_FM_ChildDirListPktCmd_PathAndEntryLengthGreaterMaxPathLength(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_PKT_WARNING_EID);
- ReportPtr = &FM_GlobalData.DirListPkt.Payload;
+ ReportPtr = &FM_AppData.DirListPkt.Payload;
UtAssert_UINT32_EQ(ReportPtr->FirstFile, 0);
UtAssert_UINT32_EQ(ReportPtr->TotalFiles, 1);
UtAssert_UINT32_EQ(ReportPtr->PacketFiles, 0);
@@ -1828,7 +1827,7 @@ void Test_FM_ChildDirListFileInit_OSOpenCreateFail(void)
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_FILE_OSCREAT_ERR_EID);
- UtAssert_INT32_EQ(FM_GlobalData.ChildCmdErrCounter, 1);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildCmdErrCounter, 1);
}
void Test_FM_ChildDirListFileInit_FSWriteHeaderNotSameSizeFSHeadert(void)
@@ -1923,8 +1922,8 @@ void Test_FM_ChildDirListFileLoop_OSDirReadNotSuccess(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_FILE_CMD_INF_EID);
- UtAssert_UINT32_EQ(FM_GlobalData.DirListFileStats.DirEntries, 0);
- UtAssert_UINT32_EQ(FM_GlobalData.DirListFileStats.FileEntries, 0);
+ UtAssert_UINT32_EQ(FM_AppData.DirListFileStats.DirEntries, 0);
+ UtAssert_UINT32_EQ(FM_AppData.DirListFileStats.FileEntries, 0);
}
void Test_FM_ChildDirListFileLoop_OSDirEntryNameIsThisDirectory(void)
@@ -1948,8 +1947,8 @@ void Test_FM_ChildDirListFileLoop_OSDirEntryNameIsThisDirectory(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_FILE_CMD_INF_EID);
- UtAssert_UINT32_EQ(FM_GlobalData.DirListFileStats.DirEntries, 0);
- UtAssert_UINT32_EQ(FM_GlobalData.DirListFileStats.FileEntries, 0);
+ UtAssert_UINT32_EQ(FM_AppData.DirListFileStats.DirEntries, 0);
+ UtAssert_UINT32_EQ(FM_AppData.DirListFileStats.FileEntries, 0);
}
void Test_FM_ChildDirListFileLoop_OSDirEntryNameIsParentDirectory(void)
@@ -1977,7 +1976,7 @@ void Test_FM_ChildDirListFileLoop_OSDirEntryNameIsParentDirectory(void)
void Test_FM_ChildDirListFileLoop_PathLengthAndEntryLengthGreaterMaxPathLen(void)
{
/* Arrange */
- char dirwithsep[OS_MAX_PATH_LEN];
+ char dirwithsep[CFE_MISSION_MAX_PATH_LEN];
os_dirent_t direntry = {.FileName = "directory_nam"};
memset(dirwithsep, 0xFF, sizeof(dirwithsep));
@@ -2001,8 +2000,8 @@ void Test_FM_ChildDirListFileLoop_PathLengthAndEntryLengthGreaterMaxPathLen(void
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventType, CFE_EVS_EventType_INFORMATION);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventID, FM_GET_DIR_FILE_CMD_INF_EID);
- UtAssert_INT32_EQ(FM_GlobalData.DirListFileStats.DirEntries, 1);
- UtAssert_INT32_EQ(FM_GlobalData.DirListFileStats.FileEntries, 0);
+ UtAssert_INT32_EQ(FM_AppData.DirListFileStats.DirEntries, 1);
+ UtAssert_INT32_EQ(FM_AppData.DirListFileStats.FileEntries, 0);
}
void Test_FM_ChildDirListFileLoop_FileEntriesGreaterFMDirListFileEntries(void)
@@ -2026,8 +2025,8 @@ void Test_FM_ChildDirListFileLoop_FileEntriesGreaterFMDirListFileEntries(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_FILE_CMD_INF_EID);
- UtAssert_INT32_EQ(FM_GlobalData.DirListFileStats.DirEntries, entrycnt);
- UtAssert_INT32_EQ(FM_GlobalData.DirListFileStats.FileEntries, FM_DIR_LIST_FILE_ENTRIES);
+ UtAssert_INT32_EQ(FM_AppData.DirListFileStats.DirEntries, entrycnt);
+ UtAssert_INT32_EQ(FM_AppData.DirListFileStats.FileEntries, FM_DIR_LIST_FILE_ENTRIES);
}
void Test_FM_ChildDirListFileLoop_BytesWrittenNotEqualWriteLength(void)
@@ -2052,8 +2051,8 @@ void Test_FM_ChildDirListFileLoop_BytesWrittenNotEqualWriteLength(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_FILE_UPSTATS_ERR_EID);
- UtAssert_INT32_EQ(FM_GlobalData.DirListFileStats.DirEntries, 1);
- UtAssert_INT32_EQ(FM_GlobalData.DirListFileStats.FileEntries, 1);
+ UtAssert_INT32_EQ(FM_AppData.DirListFileStats.DirEntries, 1);
+ UtAssert_INT32_EQ(FM_AppData.DirListFileStats.FileEntries, 1);
}
void Test_FM_ChildDirListFileLoop_BytesWrittenNotEqualWriteLengthInLoop(void)
@@ -2078,8 +2077,8 @@ void Test_FM_ChildDirListFileLoop_BytesWrittenNotEqualWriteLengthInLoop(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_DIR_FILE_WRENTRY_ERR_EID);
- UtAssert_INT32_EQ(FM_GlobalData.DirListFileStats.DirEntries, 0);
- UtAssert_INT32_EQ(FM_GlobalData.DirListFileStats.FileEntries, 0);
+ UtAssert_INT32_EQ(FM_AppData.DirListFileStats.DirEntries, 0);
+ UtAssert_INT32_EQ(FM_AppData.DirListFileStats.FileEntries, 0);
}
/* ****************
@@ -2142,7 +2141,7 @@ void Test_FM_ChildLoop_CountSemTakeNotSuccess(void)
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_CHILD_TERM_SEM_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
- UtAssert_INT32_EQ(FM_GlobalData.ChildCmdErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildCmdErrCounter, 0);
}
void Test_FM_ChildLoop_ChildQCountEqualZero(void)
@@ -2155,14 +2154,14 @@ void Test_FM_ChildLoop_ChildQCountEqualZero(void)
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_CHILD_TERM_EMPTYQ_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
- UtAssert_INT32_EQ(FM_GlobalData.ChildCmdErrCounter, 1);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildCmdErrCounter, 1);
}
void Test_FM_ChildLoop_ChildReadIndexEqualChildQDepth(void)
{
/* Arrange */
- FM_GlobalData.ChildQueueCount = 1;
- FM_GlobalData.ChildReadIndex = FM_CHILD_QUEUE_DEPTH;
+ FM_AppData.HkTlm.Payload.ChildQueueCount = 1;
+ FM_AppData.ChildReadIndex = FM_CHILD_QUEUE_DEPTH;
/* Act */
UtAssert_VOIDCALL(FM_ChildLoop());
@@ -2172,17 +2171,17 @@ void Test_FM_ChildLoop_ChildReadIndexEqualChildQDepth(void)
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_CHILD_TERM_QIDX_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
- UtAssert_INT32_EQ(FM_GlobalData.ChildCmdErrCounter, 1);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildCmdErrCounter, 1);
}
void Test_FM_ChildLoop_CountSemTakeSuccessDefault(void)
{
/* Arrange */
- FM_GlobalData.ChildQueueCount = 1;
- FM_GlobalData.ChildReadIndex = 0;
+ FM_AppData.HkTlm.Payload.ChildQueueCount = 1;
+ FM_AppData.ChildReadIndex = 0;
FM_ChildQueueEntry_t queue_entry = {.CommandCode = -1};
- FM_GlobalData.ChildQueue[0] = queue_entry;
+ FM_AppData.ChildQueue[0] = queue_entry;
UT_SetDeferredRetcode(UT_KEY(OS_CountSemTake), 2, !CFE_SUCCESS);
/* Act */
@@ -2195,7 +2194,7 @@ void Test_FM_ChildLoop_CountSemTakeSuccessDefault(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventID, FM_CHILD_TERM_SEM_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventType, CFE_EVS_EventType_ERROR);
- UtAssert_INT32_EQ(FM_GlobalData.ChildCmdErrCounter, 1);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildCmdErrCounter, 1);
}
/* ****************
diff --git a/unit-test/fm_cmd_utils_tests.c b/unit-test/fm_cmd_utils_tests.c
index f02022e..12562da 100644
--- a/unit-test/fm_cmd_utils_tests.c
+++ b/unit-test/fm_cmd_utils_tests.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,7 +26,8 @@
#include "fm_app.h"
#include "fm_child.h"
#include "fm_perfids.h"
-#include "fm_events.h"
+#include "fm_eventids.h"
+#include "fm_extern_typedefs.h"
/*
* UT Assert
@@ -128,7 +128,7 @@ void Test_FM_GetOpenFilesData(void)
* *************************/
void Test_FM_GetFilenameState(void)
{
- char filename[OS_MAX_FILE_NAME] = {0};
+ char filename[CFE_MISSION_MAX_FILE_LEN] = {0};
os_fstat_t fstat;
osal_id_t id = OS_OBJECT_ID_UNDEFINED;
OS_file_prop_t file_prop;
@@ -148,25 +148,25 @@ void Test_FM_GetFilenameState(void)
/* OS_stat failure, file info false */
UT_SetDeferredRetcode(UT_KEY(OS_stat), 1, !OS_SUCCESS);
- FM_GlobalData.FileStatSize = 1;
+ FM_AppData.FileStatSize = 1;
UtAssert_UINT32_EQ(FM_GetFilenameState(filename, sizeof(filename), false), FM_NAME_IS_NOT_IN_USE);
- UtAssert_UINT32_EQ(FM_GlobalData.FileStatSize, 1);
+ UtAssert_UINT32_EQ(FM_AppData.FileStatSize, 1);
/* OS_stat failure, file info true */
UT_SetDeferredRetcode(UT_KEY(OS_stat), 1, !OS_SUCCESS);
UtAssert_UINT32_EQ(FM_GetFilenameState(filename, sizeof(filename), true), FM_NAME_IS_NOT_IN_USE);
- UtAssert_UINT32_EQ(FM_GlobalData.FileStatSize, 0);
+ UtAssert_UINT32_EQ(FM_AppData.FileStatSize, 0);
/* File is directory, file info true */
fstat.FileModeBits = OS_FILESTAT_MODE_DIR;
fstat.FileSize = 2;
UT_SetDataBuffer(UT_KEY(OS_stat), &fstat, sizeof(fstat), false);
UtAssert_UINT32_EQ(FM_GetFilenameState(filename, sizeof(filename), true), FM_NAME_IS_DIRECTORY);
- UtAssert_UINT32_EQ(FM_GlobalData.FileStatSize, 2);
+ UtAssert_UINT32_EQ(FM_AppData.FileStatSize, 2);
/* File is file, file info false, no objects */
UtAssert_UINT32_EQ(FM_GetFilenameState(filename, sizeof(filename), false), FM_NAME_IS_FILE_CLOSED);
- UtAssert_UINT32_EQ(FM_GlobalData.FileStatSize, 2);
+ UtAssert_UINT32_EQ(FM_AppData.FileStatSize, 2);
/* File is file, undefined object */
UT_SetDataBuffer(UT_KEY(OS_ForEachObject), &id, sizeof(id), false);
@@ -194,7 +194,7 @@ void Test_FM_GetFilenameState(void)
* *************************/
void Test_FM_VerifyNameValid(void)
{
- char filename[OS_MAX_FILE_NAME] = "Filename";
+ char filename[CFE_MISSION_MAX_FILE_LEN] = "Filename";
uint32 eventid = 1;
/* Filename not in use */
@@ -214,7 +214,7 @@ void Test_FM_VerifyNameValid(void)
* *************************/
void Test_FM_VerifyFileState(void)
{
- char filename[OS_MAX_FILE_NAME] = "Filename";
+ char filename[CFE_MISSION_MAX_FILE_LEN] = "Filename";
osal_id_t id = OS_OBJECT_ID_UNDEFINED;
OS_file_prop_t file_prop;
@@ -239,7 +239,7 @@ void Test_FM_VerifyFileState(void)
* *************************/
void Test_FM_VerifyFileClosed(void)
{
- char filename[OS_MAX_FILE_NAME] = "Filename";
+ char filename[CFE_MISSION_MAX_FILE_LEN] = "Filename";
os_fstat_t fstat = {.FileModeBits = OS_FILESTAT_MODE_DIR};
osal_id_t id = OS_OBJECT_ID_UNDEFINED;
OS_file_prop_t file_prop;
@@ -282,7 +282,7 @@ void Test_FM_VerifyFileClosed(void)
* *************************/
void Test_FM_VerifyFileExists(void)
{
- char filename[OS_MAX_FILE_NAME] = "Filename";
+ char filename[CFE_MISSION_MAX_FILE_LEN] = "Filename";
os_fstat_t fstat = {.FileModeBits = OS_FILESTAT_MODE_DIR};
osal_id_t id = OS_OBJECT_ID_UNDEFINED;
OS_file_prop_t file_prop;
@@ -324,7 +324,7 @@ void Test_FM_VerifyFileExists(void)
* *************************/
void Test_FM_VerifyFileNoExist(void)
{
- char filename[OS_MAX_FILE_NAME] = "Filename";
+ char filename[CFE_MISSION_MAX_FILE_LEN] = "Filename";
os_fstat_t fstat = {.FileModeBits = OS_FILESTAT_MODE_DIR};
osal_id_t id = OS_OBJECT_ID_UNDEFINED;
OS_file_prop_t file_prop;
@@ -367,7 +367,7 @@ void Test_FM_VerifyFileNoExist(void)
* *************************/
void Test_FM_VerifyFileNotOpen(void)
{
- char filename[OS_MAX_FILE_NAME] = "Filename";
+ char filename[CFE_MISSION_MAX_FILE_LEN] = "Filename";
os_fstat_t fstat = {.FileModeBits = OS_FILESTAT_MODE_DIR};
osal_id_t id = OS_OBJECT_ID_UNDEFINED;
OS_file_prop_t file_prop;
@@ -409,7 +409,7 @@ void Test_FM_VerifyFileNotOpen(void)
* *************************/
void Test_FM_VerifyDirExists(void)
{
- char filename[OS_MAX_FILE_NAME] = "Filename";
+ char filename[CFE_MISSION_MAX_FILE_LEN] = "Filename";
os_fstat_t fstat = {.FileModeBits = OS_FILESTAT_MODE_DIR};
osal_id_t id = OS_OBJECT_ID_UNDEFINED;
OS_file_prop_t file_prop;
@@ -452,7 +452,7 @@ void Test_FM_VerifyDirExists(void)
* *************************/
void Test_FM_VerifyDirNoExist(void)
{
- char filename[OS_MAX_FILE_NAME] = "Filename";
+ char filename[CFE_MISSION_MAX_FILE_LEN] = "Filename";
os_fstat_t fstat = {.FileModeBits = OS_FILESTAT_MODE_DIR};
osal_id_t id = OS_OBJECT_ID_UNDEFINED;
OS_file_prop_t file_prop;
@@ -501,27 +501,27 @@ void Test_FM_VerifyChildTask(void)
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_CHILD_DISABLED_EID_OFFSET);
/* LocalQueueCount equal to FM_CHILD_QUEUE_DEPTH */
- FM_GlobalData.ChildSemaphore = FM_UT_OBJID_1;
- FM_GlobalData.ChildQueueCount = FM_CHILD_QUEUE_DEPTH;
+ FM_AppData.ChildSemaphore = FM_UT_OBJID_1;
+ FM_AppData.HkTlm.Payload.ChildQueueCount = FM_CHILD_QUEUE_DEPTH;
UtAssert_BOOL_FALSE(FM_VerifyChildTask(0, "Cmd Text"));
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 2);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventID, FM_CHILD_Q_FULL_EID_OFFSET);
/* LocalQueueCount greater than FM_CHILD_QUEUE_DEPTH */
- FM_GlobalData.ChildQueueCount = FM_CHILD_QUEUE_DEPTH + 1;
+ FM_AppData.HkTlm.Payload.ChildQueueCount = FM_CHILD_QUEUE_DEPTH + 1;
UtAssert_BOOL_FALSE(FM_VerifyChildTask(0, "Cmd Text"));
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 3);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[2].EventID, FM_CHILD_BROKEN_EID_OFFSET);
/* ChildWriteIndex equal to FM_CHILD_QUEUE_DEPTH */
- FM_GlobalData.ChildQueueCount = FM_CHILD_QUEUE_DEPTH - 1;
- FM_GlobalData.ChildWriteIndex = FM_CHILD_QUEUE_DEPTH;
+ FM_AppData.HkTlm.Payload.ChildQueueCount = FM_CHILD_QUEUE_DEPTH - 1;
+ FM_AppData.ChildWriteIndex = FM_CHILD_QUEUE_DEPTH;
UtAssert_BOOL_FALSE(FM_VerifyChildTask(0, "Cmd Text"));
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 4);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[3].EventID, FM_CHILD_BROKEN_EID_OFFSET);
/* Success */
- FM_GlobalData.ChildWriteIndex = FM_CHILD_QUEUE_DEPTH - 1;
+ FM_AppData.ChildWriteIndex = FM_CHILD_QUEUE_DEPTH - 1;
UtAssert_BOOL_TRUE(FM_VerifyChildTask(0, "Cmd Text"));
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 4);
}
@@ -532,18 +532,18 @@ void Test_FM_VerifyChildTask(void)
void Test_FM_InvokeChildTask(void)
{
/* Conditions true */
- FM_GlobalData.ChildWriteIndex = FM_CHILD_QUEUE_DEPTH - 1;
- FM_GlobalData.ChildSemaphore = FM_UT_OBJID_1;
+ FM_AppData.ChildWriteIndex = FM_CHILD_QUEUE_DEPTH - 1;
+ FM_AppData.ChildSemaphore = FM_UT_OBJID_1;
UtAssert_VOIDCALL(FM_InvokeChildTask());
- UtAssert_INT32_EQ(FM_GlobalData.ChildWriteIndex, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueueCount, 1);
+ UtAssert_INT32_EQ(FM_AppData.ChildWriteIndex, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildQueueCount, 1);
UtAssert_STUB_COUNT(OS_CountSemGive, 1);
/* Conditions false */
- FM_GlobalData.ChildSemaphore = OS_OBJECT_ID_UNDEFINED;
+ FM_AppData.ChildSemaphore = OS_OBJECT_ID_UNDEFINED;
UtAssert_VOIDCALL(FM_InvokeChildTask());
- UtAssert_INT32_EQ(FM_GlobalData.ChildWriteIndex, 1);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueueCount, 2);
+ UtAssert_INT32_EQ(FM_AppData.ChildWriteIndex, 1);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildQueueCount, 2);
UtAssert_STUB_COUNT(OS_CountSemGive, 1);
}
@@ -613,7 +613,7 @@ void Test_FM_GetDirectorySpaceEstimate(void)
uint64 blocks;
os_dirent_t direntry = {.FileName = "f1"};
os_fstat_t fstat;
- char longname[OS_MAX_PATH_LEN + 5];
+ char longname[CFE_MISSION_MAX_PATH_LEN + 5];
memset(&fstat, 0, sizeof(fstat));
diff --git a/unit-test/fm_cmds_tests.c b/unit-test/fm_cmds_tests.c
index b707584..79e9123 100644
--- a/unit-test/fm_cmds_tests.c
+++ b/unit-test/fm_cmds_tests.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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 @@
#include "fm_msg.h"
#include "fm_msgdefs.h"
#include "fm_msgids.h"
-#include "fm_events.h"
+#include "fm_eventids.h"
#include "fm_app.h"
#include "fm_child.h"
#include "fm_cmds.h"
#include "fm_cmd_utils.h"
#include "fm_perfids.h"
#include "fm_platform_cfg.h"
-#include "fm_verify.h"
+#include "fm_extern_typedefs.h"
#include
/*
@@ -61,31 +60,18 @@ uint8 call_count_CFE_EVS_SendEvent;
void Test_FM_NoopCmd_Success(void)
{
- int32 strCmpResult;
- char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
- snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s command: FM version %%d.%%d.%%d.%%d");
+ CFE_Status_t Status;
+ FM_NoopCmd_t NoopCmd;
- bool Result = FM_NoopCmd(&UT_CmdBuf.Buf);
+ memset(&NoopCmd, 0, sizeof(NoopCmd));
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_NoopCmd(&NoopCmd);
- /* Assert */
- UtAssert_True(Result == true, "FM_NoopCmd returned true");
-
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);
-
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_NOOP_INF_EID);
-
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
+ /* Verify results */
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
-
- UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);
-}
-
-void add_FM_NoopCmd_tests(void)
-{
- UtTest_Add(Test_FM_NoopCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_NoopCmd_Success");
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
+ FM_Test_Verify_Event(0, FM_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op command: FM version %d.%d.%d.%d");
}
/****************************/
@@ -94,44 +80,31 @@ void add_FM_NoopCmd_tests(void)
void Test_FM_ResetCountersCmd_Success(void)
{
- int32 strCmpResult;
- char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
- bool Result;
- snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s command");
+ CFE_Status_t Status;
+ FM_ResetCountersCmd_t ResetCountersCmd;
- FM_GlobalData.CommandCounter = 1;
- FM_GlobalData.CommandErrCounter = 1;
- FM_GlobalData.ChildCmdCounter = 1;
- FM_GlobalData.ChildCmdErrCounter = 1;
- FM_GlobalData.ChildCmdWarnCounter = 1;
+ memset(&ResetCountersCmd, 0, sizeof(ResetCountersCmd));
- Result = FM_ResetCountersCmd(&UT_CmdBuf.Buf);
+ FM_AppData.HkTlm.Payload.CommandCounter = 1;
+ FM_AppData.HkTlm.Payload.CommandErrCounter = 1;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter = 1;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter = 1;
+ FM_AppData.HkTlm.Payload.ChildCmdWarnCounter = 1;
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_ResetCountersCmd(&ResetCountersCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_ResetCountersCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildCmdCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildCmdErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.ChildCmdWarnCounter, 0);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_RESET_INF_EID);
-
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
-
- strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
-
- UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);
-
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 0);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildCmdCounter, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildCmdErrCounter, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildCmdWarnCounter, 0);
-}
-
-void add_FM_ResetCountersCmd_tests(void)
-{
- UtTest_Add(Test_FM_ResetCountersCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_ResetCountersCmd_Success");
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
+ FM_Test_Verify_Event(0, FM_RESET_INF_EID, CFE_EVS_EventType_INFORMATION,
+ "Reset Counters command");
}
/****************************/
@@ -140,15 +113,15 @@ void add_FM_ResetCountersCmd_tests(void)
void Test_FM_CopyFileCmd_Success(void)
{
- FM_OvwSourceTargetFilename_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_CopyFileCmd_t CopyFileCmd;
- CmdPtr = &UT_CmdBuf.CopyFileCmd.Payload;
+ memset(&CopyFileCmd, 0, sizeof(CopyFileCmd));
- strncpy(CmdPtr->Source, "src1", sizeof(CmdPtr->Source) - 1);
- strncpy(CmdPtr->Target, "tgt", sizeof(CmdPtr->Target) - 1);
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ strncpy(CopyFileCmd.Payload.Source, "src1", sizeof(CopyFileCmd.Payload.Source) - 1);
+ strncpy(CopyFileCmd.Payload.Target, "tgt", sizeof(CopyFileCmd.Payload.Target) - 1);
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyOverwrite), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), true);
@@ -156,23 +129,24 @@ void Test_FM_CopyFileCmd_Success(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_CopyFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_CopyFileCmd(&CopyFileCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_CopyFileCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_COPY_FILE_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_COPY_FILE_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_CopyFileCmd_BadOverwrite(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_CopyFileCmd_t CopyFileCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&CopyFileCmd, 0, sizeof(CopyFileCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyOverwrite), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), true);
@@ -180,23 +154,24 @@ void Test_FM_CopyFileCmd_BadOverwrite(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_CopyFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_CopyFileCmd(&CopyFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_CopyFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_CopyFileCmd_SourceNotExist(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_CopyFileCmd_t CopyFileCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&CopyFileCmd, 0, sizeof(CopyFileCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyOverwrite), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), false);
@@ -204,23 +179,24 @@ void Test_FM_CopyFileCmd_SourceNotExist(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_CopyFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_CopyFileCmd(&CopyFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_CopyFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_CopyFileCmd_NoOverwriteTargetExists(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_CopyFileCmd_t CopyFileCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&CopyFileCmd, 0, sizeof(CopyFileCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyOverwrite), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), true);
@@ -228,27 +204,25 @@ void Test_FM_CopyFileCmd_NoOverwriteTargetExists(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_CopyFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_CopyFileCmd(&CopyFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_CopyFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_CopyFileCmd_OverwriteFileOpen(void)
{
- FM_OvwSourceTargetFilename_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_CopyFileCmd_t CopyFileCmd;
- CmdPtr = &UT_CmdBuf.CopyFileCmd.Payload;
+ memset(&CopyFileCmd, 0, sizeof(CopyFileCmd));
- CmdPtr->Overwrite = 1;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ CopyFileCmd.Payload.Overwrite = 1;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyOverwrite), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), true);
@@ -256,23 +230,24 @@ void Test_FM_CopyFileCmd_OverwriteFileOpen(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_CopyFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_CopyFileCmd(&CopyFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_CopyFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_CopyFileCmd_NoChildTask(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_CopyFileCmd_t CopyFileCmd;
+
+ memset(&CopyFileCmd, 0, sizeof(CopyFileCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyOverwrite), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), true);
@@ -280,33 +255,13 @@ void Test_FM_CopyFileCmd_NoChildTask(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false);
- Result = FM_CopyFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_CopyFileCmd(&CopyFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_CopyFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
-}
-
-void add_FM_CopyFileCmd_tests(void)
-{
- UtTest_Add(Test_FM_CopyFileCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_CopyFileCmd_Success");
-
- UtTest_Add(Test_FM_CopyFileCmd_BadOverwrite, FM_Test_Setup, FM_Test_Teardown, "Test_FM_CopyFileCmd_BadOverwrite");
-
- UtTest_Add(Test_FM_CopyFileCmd_SourceNotExist, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_CopyFileCmd_SourceNotExist");
-
- UtTest_Add(Test_FM_CopyFileCmd_NoOverwriteTargetExists, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_CopyFileCmd_NoOverwriteTargetExists");
-
- UtTest_Add(Test_FM_CopyFileCmd_OverwriteFileOpen, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_CopyFileCmd_OverwriteFileOpen");
-
- UtTest_Add(Test_FM_CopyFileCmd_NoChildTask, FM_Test_Setup, FM_Test_Teardown, "Test_FM_CopyFileCmd_NoChildTask");
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
/****************************/
@@ -315,10 +270,13 @@ void add_FM_CopyFileCmd_tests(void)
void Test_FM_MoveFileCmd_Success(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_MoveFileCmd_t MoveFileCmd;
+
+ memset(&MoveFileCmd, 0, sizeof(MoveFileCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyOverwrite), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), true);
@@ -326,23 +284,24 @@ void Test_FM_MoveFileCmd_Success(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_MoveFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_MoveFileCmd(&MoveFileCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_MoveFileCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_MOVE_FILE_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_MOVE_FILE_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_MoveFileCmd_BadOverwrite(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_MoveFileCmd_t MoveFileCmd;
+
+ memset(&MoveFileCmd, 0, sizeof(MoveFileCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyOverwrite), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), true);
@@ -350,23 +309,24 @@ void Test_FM_MoveFileCmd_BadOverwrite(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_MoveFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_MoveFileCmd(&MoveFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_MoveFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_MoveFileCmd_SourceNotExist(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_MoveFileCmd_t MoveFileCmd;
+
+ memset(&MoveFileCmd, 0, sizeof(MoveFileCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyOverwrite), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), false);
@@ -374,23 +334,24 @@ void Test_FM_MoveFileCmd_SourceNotExist(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_MoveFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_MoveFileCmd(&MoveFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_MoveFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_MoveFileCmd_NoOverwriteTargetExists(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_MoveFileCmd_t MoveFileCmd;
+
+ memset(&MoveFileCmd, 0, sizeof(MoveFileCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyOverwrite), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), true);
@@ -398,27 +359,25 @@ void Test_FM_MoveFileCmd_NoOverwriteTargetExists(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_MoveFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_MoveFileCmd(&MoveFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_MoveFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_MoveFileCmd_OverwriteFileOpen(void)
{
- FM_OvwSourceTargetFilename_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_MoveFileCmd_t MoveFileCmd;
- CmdPtr = &UT_CmdBuf.MoveFileCmd.Payload;
+ memset(&MoveFileCmd, 0, sizeof(MoveFileCmd));
- CmdPtr->Overwrite = 1;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ MoveFileCmd.Payload.Overwrite = 1;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyOverwrite), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), true);
@@ -426,23 +385,24 @@ void Test_FM_MoveFileCmd_OverwriteFileOpen(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_MoveFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_MoveFileCmd(&MoveFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_MoveFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_MoveFileCmd_NoChildTask(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_MoveFileCmd_t MoveFileCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&MoveFileCmd, 0, sizeof(MoveFileCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyOverwrite), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), true);
@@ -450,33 +410,13 @@ void Test_FM_MoveFileCmd_NoChildTask(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false);
- Result = FM_MoveFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_MoveFileCmd(&MoveFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_MoveFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
-}
-
-void add_FM_MoveFileCmd_tests(void)
-{
- UtTest_Add(Test_FM_MoveFileCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_MoveFileCmd_Success");
-
- UtTest_Add(Test_FM_MoveFileCmd_BadOverwrite, FM_Test_Setup, FM_Test_Teardown, "Test_FM_MoveFileCmd_BadOverwrite");
-
- UtTest_Add(Test_FM_MoveFileCmd_SourceNotExist, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_MoveFileCmd_SourceNotExist");
-
- UtTest_Add(Test_FM_MoveFileCmd_NoOverwriteTargetExists, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_MoveFileCmd_NoOverwriteTargetExists");
-
- UtTest_Add(Test_FM_MoveFileCmd_OverwriteFileOpen, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_MoveFileCmd_OverwriteFileOpen");
-
- UtTest_Add(Test_FM_MoveFileCmd_NoChildTask, FM_Test_Setup, FM_Test_Teardown, "Test_FM_MoveFileCmd_NoChildTask");
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
/****************************/
@@ -485,109 +425,97 @@ void add_FM_MoveFileCmd_tests(void)
void Test_FM_RenameFileCmd_Success(void)
{
- FM_SourceTargetFileName_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_RenameFileCmd_t RenameFileCmd;
- CmdPtr = &UT_CmdBuf.RenameFileCmd.Payload;
+ memset(&RenameFileCmd, 0, sizeof(RenameFileCmd));
- strncpy(CmdPtr->Source, "src1", sizeof(CmdPtr->Source) - 1);
- strncpy(CmdPtr->Target, "tgt", sizeof(CmdPtr->Target) - 1);
+ strncpy(RenameFileCmd.Payload.Source, "src1", sizeof(RenameFileCmd.Payload.Source) - 1);
+ strncpy(RenameFileCmd.Payload.Target, "tgt", sizeof(RenameFileCmd.Payload.Target) - 1);
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_RenameFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_RenameFileCmd(&RenameFileCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_RenameFileCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_RENAME_FILE_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_RENAME_FILE_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_RenameFileCmd_SourceNotExist(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_RenameFileCmd_t RenameFileCmd;
+
+ memset(&RenameFileCmd, 0, sizeof(RenameFileCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_RenameFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_RenameFileCmd(&RenameFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_RenameFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_RenameFileCmd_TargetExists(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_RenameFileCmd_t RenameFileCmd;
+
+ memset(&RenameFileCmd, 0, sizeof(RenameFileCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_RenameFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_RenameFileCmd(&RenameFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_RenameFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_RenameFileCmd_NoChildTask(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_RenameFileCmd_t RenameFileCmd;
+
+ memset(&RenameFileCmd, 0, sizeof(RenameFileCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false);
- Result = FM_RenameFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_RenameFileCmd(&RenameFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_RenameFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
-}
-
-void add_FM_RenameFileCmd_tests(void)
-{
- UtTest_Add(Test_FM_RenameFileCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_RenameFileCmd_Success");
-
- UtTest_Add(Test_FM_RenameFileCmd_SourceNotExist, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_RenameFileCmd_SourceNotExist");
-
- UtTest_Add(Test_FM_RenameFileCmd_TargetExists, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_RenameFileCmd_TargetExists");
-
- UtTest_Add(Test_FM_RenameFileCmd_NoChildTask, FM_Test_Setup, FM_Test_Teardown, "Test_FM_RenameFileCmd_NoChildTask");
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
/****************************/
@@ -596,10 +524,13 @@ void add_FM_RenameFileCmd_tests(void)
void Test_FM_DeleteFileCmd_Success(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_DeleteFileCmd_t DeleteFileCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&DeleteFileCmd, 0, sizeof(DeleteFileCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
CFE_MSG_FcnCode_t forced_CmdCode = FM_DELETE_FILE_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &forced_CmdCode, sizeof(forced_CmdCode), false);
@@ -607,23 +538,24 @@ void Test_FM_DeleteFileCmd_Success(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_DeleteFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_DeleteFileCmd(&DeleteFileCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_DeleteFileCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_DELETE_FILE_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_DELETE_FILE_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_DeleteFileCmd_FileNotClosed(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_DeleteFileCmd_t DeleteFileCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&DeleteFileCmd, 0, sizeof(DeleteFileCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
CFE_MSG_FcnCode_t forced_CmdCode = FM_DELETE_FILE_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &forced_CmdCode, sizeof(forced_CmdCode), false);
@@ -631,23 +563,24 @@ void Test_FM_DeleteFileCmd_FileNotClosed(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_DeleteFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_DeleteFileCmd(&DeleteFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_DeleteFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_DeleteFileCmd_NoChildTask(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_DeleteFileCmd_t DeleteFileCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&DeleteFileCmd, 0, sizeof(DeleteFileCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
CFE_MSG_FcnCode_t forced_CmdCode = FM_DELETE_FILE_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &forced_CmdCode, sizeof(forced_CmdCode), false);
@@ -655,25 +588,13 @@ void Test_FM_DeleteFileCmd_NoChildTask(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false);
- Result = FM_DeleteFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_DeleteFileCmd(&DeleteFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_DeleteFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
-}
-
-void add_FM_DeleteFileCmd_tests(void)
-{
- UtTest_Add(Test_FM_DeleteFileCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_DeleteFileCmd_Success");
-
- UtTest_Add(Test_FM_DeleteFileCmd_FileNotClosed, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_DeleteFileCmd_FileNotClosed");
-
- UtTest_Add(Test_FM_DeleteFileCmd_NoChildTask, FM_Test_Setup, FM_Test_Teardown, "Test_FM_DeleteFileCmd_NoChildTask");
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
/****************************/
@@ -682,85 +603,71 @@ void add_FM_DeleteFileCmd_tests(void)
void Test_FM_DeleteAllFilesCmd_Success(void)
{
- FM_DirectoryName_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_DeleteAllFilesCmd_t DeleteAllFilesCmd;
- CmdPtr = &UT_CmdBuf.DeleteAllFilesCmd.Payload;
+ memset(&DeleteAllFilesCmd, 0, sizeof(DeleteAllFilesCmd));
- strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1);
+ strncpy(DeleteAllFilesCmd.Payload.Directory, "dir", sizeof(DeleteAllFilesCmd.Payload.Directory) - 1);
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_DeleteAllFilesCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_DeleteAllFilesCmd(&DeleteAllFilesCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_DeleteAllFilesCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_DELETE_ALL_FILES_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_DELETE_ALL_FILES_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_DeleteAllFilesCmd_DirNoExist(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_DeleteAllFilesCmd_t DeleteAllFilesCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&DeleteAllFilesCmd, 0, sizeof(DeleteAllFilesCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_DeleteAllFilesCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_DeleteAllFilesCmd(&DeleteAllFilesCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_DeleteAllFilesCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_DeleteAllFilesCmd_NoChildTask(void)
{
- FM_DirectoryName_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_DeleteAllFilesCmd_t DeleteAllFilesCmd;
- CmdPtr = &UT_CmdBuf.DeleteAllFilesCmd.Payload;
+ memset(&DeleteAllFilesCmd, 0, sizeof(DeleteAllFilesCmd));
- strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1);
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ strncpy(DeleteAllFilesCmd.Payload.Directory, "dir", sizeof(DeleteAllFilesCmd.Payload.Directory) - 1);
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false);
- Result = FM_DeleteAllFilesCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_DeleteAllFilesCmd(&DeleteAllFilesCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_DeleteAllFilesCmd returned false");
-
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
-}
-
-void add_FM_DeleteAllFilesCmd_tests(void)
-{
- UtTest_Add(Test_FM_DeleteAllFilesCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_DeleteAllFilesCmd_Success");
-
- UtTest_Add(Test_FM_DeleteAllFilesCmd_DirNoExist, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_DeleteAllFilesCmd_DirNoExist");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtTest_Add(Test_FM_DeleteAllFilesCmd_NoChildTask, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_DeleteAllFilesCmd_NoChildTask");
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
/****************************/
@@ -769,104 +676,94 @@ void add_FM_DeleteAllFilesCmd_tests(void)
void Test_FM_DecompressFileCmd_Success(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_DecompressFileCmd_t DecompressFileCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&DecompressFileCmd, 0, sizeof(DecompressFileCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_DecompressFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_DecompressFileCmd(&DecompressFileCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_DecompressFileCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_DECOMPRESS_FILE_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_DECOMPRESS_FILE_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_DecompressFileCmd_SourceFileOpen(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_DecompressFileCmd_t DecompressFileCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&DecompressFileCmd, 0, sizeof(DecompressFileCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_DecompressFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_DecompressFileCmd(&DecompressFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_DecompressFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_DecompressFileCmd_TargetFileExists(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_DecompressFileCmd_t DecompressFileCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&DecompressFileCmd, 0, sizeof(DecompressFileCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_DecompressFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_DecompressFileCmd(&DecompressFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_DecompressFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_DecompressFileCmd_NoChildTask(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_DecompressFileCmd_t DecompressFileCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&DecompressFileCmd, 0, sizeof(DecompressFileCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false);
- Result = FM_DecompressFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_DecompressFileCmd(&DecompressFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_DecompressFileCmd returned false");
-
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
-}
-
-void add_FM_DecompressFileCmd_tests(void)
-{
- UtTest_Add(Test_FM_DecompressFileCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_DecompressFileCmd_Success");
-
- UtTest_Add(Test_FM_DecompressFileCmd_SourceFileOpen, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_DecompressFileCmd_SourceFileOpen");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtTest_Add(Test_FM_DecompressFileCmd_TargetFileExists, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_DecompressFileCmd_TargetFileExists");
-
- UtTest_Add(Test_FM_DecompressFileCmd_NoChildTask, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_DecompressFileCmd_NoChildTask");
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
/****************************/
@@ -875,133 +772,122 @@ void add_FM_DecompressFileCmd_tests(void)
void Test_FM_ConcatFilesCmd_Success(void)
{
- FM_TwoSourceOneTarget_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_ConcatFilesCmd_t ConcatFilesCmd;
- CmdPtr = &UT_CmdBuf.ConcatFilesCmd.Payload;
+ memset(&ConcatFilesCmd, 0, sizeof(ConcatFilesCmd));
- strncpy(CmdPtr->Source1, "src1", sizeof(CmdPtr->Source1) - 1);
- strncpy(CmdPtr->Source2, "src2", sizeof(CmdPtr->Source2) - 1);
- strncpy(CmdPtr->Target, "tgt", sizeof(CmdPtr->Target) - 1);
+ strncpy(ConcatFilesCmd.Payload.Source1, "src1", sizeof(ConcatFilesCmd.Payload.Source1) - 1);
+ strncpy(ConcatFilesCmd.Payload.Source2, "src2", sizeof(ConcatFilesCmd.Payload.Source2) - 1);
+ strncpy(ConcatFilesCmd.Payload.Target, "tgt", sizeof(ConcatFilesCmd.Payload.Target) - 1);
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_ConcatFilesCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_ConcatFilesCmd(&ConcatFilesCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_ConcatFilesCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_CONCAT_FILES_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_CONCAT_FILES_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_ConcatFilesCmd_SourceFile1NotClosed(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_ConcatFilesCmd_t ConcatFilesCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&ConcatFilesCmd, 0, sizeof(ConcatFilesCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_ConcatFilesCmd(&UT_CmdBuf.Buf);
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_ConcatFilesCmd(&ConcatFilesCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_ConcatFilesCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_ConcatFilesCmd_SourceFile2NotClosed(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_ConcatFilesCmd_t ConcatFilesCmd;
+
+ memset(&ConcatFilesCmd, 0, sizeof(ConcatFilesCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), true);
UT_SetDeferredRetcode(UT_KEY(FM_VerifyFileClosed), 2, false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_ConcatFilesCmd(&UT_CmdBuf.Buf);
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_ConcatFilesCmd(&ConcatFilesCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_ConcatFilesCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_ConcatFilesCmd_TargetFileExists(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_ConcatFilesCmd_t ConcatFilesCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&ConcatFilesCmd, 0, sizeof(ConcatFilesCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_ConcatFilesCmd(&UT_CmdBuf.Buf);
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_ConcatFilesCmd(&ConcatFilesCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_ConcatFilesCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_ConcatFilesCmd_NoChildTask(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_ConcatFilesCmd_t ConcatFilesCmd;
+
+ memset(&ConcatFilesCmd, 0, sizeof(ConcatFilesCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileClosed), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNoExist), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false);
- Result = FM_ConcatFilesCmd(&UT_CmdBuf.Buf);
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_ConcatFilesCmd(&ConcatFilesCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_ConcatFilesCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
-}
-
-void add_FM_ConcatFilesCmd_tests(void)
-{
- UtTest_Add(Test_FM_ConcatFilesCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_ConcatFilesCmd_Success");
-
- UtTest_Add(Test_FM_ConcatFilesCmd_SourceFile1NotClosed, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ConcatFilesCmd_SourceFile1NotClosed");
-
- UtTest_Add(Test_FM_ConcatFilesCmd_SourceFile2NotClosed, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ConcatFilesCmd_SourceFile2NotClosed");
-
- UtTest_Add(Test_FM_ConcatFilesCmd_TargetFileExists, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ConcatFilesCmd_TargetFileExists");
-
- UtTest_Add(Test_FM_ConcatFilesCmd_NoChildTask, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ConcatFilesCmd_NoChildTask");
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
/****************************/
@@ -1010,81 +896,70 @@ void add_FM_ConcatFilesCmd_tests(void)
void Test_FM_GetFileInfoCmd_Success(void)
{
- FM_FilenameAndCRC_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_GetFileInfoCmd_t GetFileInfoCmd;
- CmdPtr = &UT_CmdBuf.GetFileInfoCmd.Payload;
+ memset(&GetFileInfoCmd, 0, sizeof(GetFileInfoCmd));
- strncpy(CmdPtr->Filename, "file", sizeof(CmdPtr->Filename) - 1);
+ strncpy(GetFileInfoCmd.Payload.Filename, "file", sizeof(GetFileInfoCmd.Payload.Filename) - 1);
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyNameValid), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_GetFileInfoCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_GetFileInfoCmd(&GetFileInfoCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_GetFileInfoCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_GET_FILE_INFO_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_GET_FILE_INFO_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_GetFileInfoCmd_InvalidName(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_GetFileInfoCmd_t GetFileInfoCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&GetFileInfoCmd, 0, sizeof(GetFileInfoCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyNameValid), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_GetFileInfoCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_GetFileInfoCmd(&GetFileInfoCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_GetFileInfoCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_GetFileInfoCmd_NoChildTask(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_GetFileInfoCmd_t GetFileInfoCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&GetFileInfoCmd, 0, sizeof(GetFileInfoCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyNameValid), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false);
- Result = FM_GetFileInfoCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_GetFileInfoCmd(&GetFileInfoCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_GetFileInfoCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
-}
-
-void add_FM_GetFileInfoCmd_tests(void)
-{
- UtTest_Add(Test_FM_GetFileInfoCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_GetFileInfoCmd_Success");
-
- UtTest_Add(Test_FM_GetFileInfoCmd_InvalidName, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_GetFileInfoCmd_InvalidName");
-
- UtTest_Add(Test_FM_GetFileInfoCmd_NoChildTask, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_GetFileInfoCmd_NoChildTask");
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
/****************************/
@@ -1093,31 +968,20 @@ void add_FM_GetFileInfoCmd_tests(void)
void Test_FM_GetOpenFilesCmd_Success(void)
{
- int32 strCmpResult;
- char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
- snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s command");
+ CFE_Status_t Status;
+ FM_GetOpenFilesCmd_t GetOpenFilesCmd;
- bool Result = FM_GetOpenFilesCmd(&UT_CmdBuf.Buf);
+ memset(&GetOpenFilesCmd, 0, sizeof(GetOpenFilesCmd));
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_GetOpenFilesCmd(&GetOpenFilesCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_GetOpenFilesCmd returned true");
-
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);
-
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_OPEN_FILES_CMD_INF_EID);
-
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
-
- strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);
-}
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
-void add_FM_GetOpenFilesCmd_tests(void)
-{
- UtTest_Add(Test_FM_GetOpenFilesCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_GetOpenFilesCmd_Success");
+ FM_Test_Verify_Event(0, FM_GET_OPEN_FILES_CMD_INF_EID, CFE_EVS_EventType_INFORMATION,
+ "%s command");
}
/****************************/
@@ -1126,81 +990,69 @@ void add_FM_GetOpenFilesCmd_tests(void)
void Test_FM_CreateDirectoryCmd_Success(void)
{
- FM_DirectoryName_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_CreateDirectoryCmd_t CreateDirectoryCmd;
- CmdPtr = &UT_CmdBuf.CreateDirectoryCmd.Payload;
+ memset(&CreateDirectoryCmd, 0, sizeof(CreateDirectoryCmd));
- strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1);
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ strncpy(CreateDirectoryCmd.Payload.Directory, "dir", sizeof(CreateDirectoryCmd.Payload.Directory) - 1);
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirNoExist), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_CreateDirectoryCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_CreateDirectoryCmd(&CreateDirectoryCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_CreateDirectoryCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_CREATE_DIRECTORY_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_CREATE_DIRECTORY_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_CreateDirectoryCmd_DirExists(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_CreateDirectoryCmd_t CreateDirectoryCmd;
+
+ memset(&CreateDirectoryCmd, 0, sizeof(CreateDirectoryCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirNoExist), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_CreateDirectoryCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_CreateDirectoryCmd(&CreateDirectoryCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_CreateDirectoryCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_CreateDirectoryCmd_NoChildTask(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_CreateDirectoryCmd_t CreateDirectoryCmd;
+
+ memset(&CreateDirectoryCmd, 0, sizeof(CreateDirectoryCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirNoExist), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false);
- Result = FM_CreateDirectoryCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_CreateDirectoryCmd(&CreateDirectoryCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_CreateDirectoryCmd returned false");
-
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
-}
-
-void add_FM_CreateDirectoryCmd_tests(void)
-{
- UtTest_Add(Test_FM_CreateDirectoryCmd_Success, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_CreateDirectoryCmd_Success");
-
- UtTest_Add(Test_FM_CreateDirectoryCmd_DirExists, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_CreateDirectoryCmd_DirExists");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtTest_Add(Test_FM_CreateDirectoryCmd_NoChildTask, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_CreateDirectoryCmd_NoChildTask");
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
/****************************/
@@ -1209,81 +1061,69 @@ void add_FM_CreateDirectoryCmd_tests(void)
void Test_FM_DeleteDirectoryCmd_Success(void)
{
- FM_DirectoryName_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_DeleteDirectoryCmd_t DeleteDirectoryCmd;
- CmdPtr = &UT_CmdBuf.DeleteDirectoryCmd.Payload;
+ memset(&DeleteDirectoryCmd, 0, sizeof(DeleteDirectoryCmd));
- strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1);
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ strncpy(DeleteDirectoryCmd.Payload.Directory, "dir", sizeof(DeleteDirectoryCmd.Payload.Directory) - 1);
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_DeleteDirectoryCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_DeleteDirectoryCmd(&DeleteDirectoryCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_DeleteDirectoryCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_DELETE_DIRECTORY_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_DELETE_DIRECTORY_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_DeleteDirectoryCmd_DirNoExist(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_DeleteDirectoryCmd_t DeleteDirectoryCmd;
+
+ memset(&DeleteDirectoryCmd, 0, sizeof(DeleteDirectoryCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_DeleteDirectoryCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_DeleteDirectoryCmd(&DeleteDirectoryCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_DeleteDirectoryCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_DeleteDirectoryCmd_NoChildTask(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_DeleteDirectoryCmd_t DeleteDirectoryCmd;
+
+ memset(&DeleteDirectoryCmd, 0, sizeof(DeleteDirectoryCmd));
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false);
- Result = FM_DeleteDirectoryCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_DeleteDirectoryCmd(&DeleteDirectoryCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_DeleteDirectoryCmd returned false");
-
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
-}
-
-void add_FM_DeleteDirectoryCmd_tests(void)
-{
- UtTest_Add(Test_FM_DeleteDirectoryCmd_Success, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_DeleteDirectoryCmd_Success");
-
- UtTest_Add(Test_FM_DeleteDirectoryCmd_DirNoExist, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_DeleteDirectoryCmd_DirNoExist");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtTest_Add(Test_FM_DeleteDirectoryCmd_NoChildTask, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_DeleteDirectoryCmd_NoChildTask");
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
/****************************/
@@ -1292,151 +1132,127 @@ void add_FM_DeleteDirectoryCmd_tests(void)
void Test_FM_GetDirListFileCmd_Success(void)
{
- FM_GetDirectoryToFile_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_GetDirListFileCmd_t GetDirListFileCmd;
- CmdPtr = &UT_CmdBuf.GetDirListFileCmd.Payload;
+ memset(&GetDirListFileCmd, 0, sizeof(GetDirListFileCmd));
- strncpy(CmdPtr->Filename, "file", sizeof(CmdPtr->Filename) - 1);
- strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1);
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ strncpy(GetDirListFileCmd.Payload.Filename, "file", sizeof(GetDirListFileCmd.Payload.Filename) - 1);
+ strncpy(GetDirListFileCmd.Payload.Directory, "dir", sizeof(GetDirListFileCmd.Payload.Directory) - 1);
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_GetDirListFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_GetDirListFileCmd(&GetDirListFileCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_GetDirListFileCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_GET_DIR_LIST_FILE_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_GET_DIR_LIST_FILE_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_GetDirListFileCmd_SuccessDefaultPath(void)
{
- FM_GetDirectoryToFile_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_GetDirListFileCmd_t GetDirListFileCmd;
- CmdPtr = &UT_CmdBuf.GetDirListFileCmd.Payload;
+ memset(&GetDirListFileCmd, 0, sizeof(GetDirListFileCmd));
- strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1);
- CmdPtr->Filename[0] = '\0';
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ strncpy(GetDirListFileCmd.Payload.Directory, "dir", sizeof(GetDirListFileCmd.Payload.Directory) - 1);
+ GetDirListFileCmd.Payload.Filename[0] = '\0';
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_GetDirListFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_GetDirListFileCmd(&GetDirListFileCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_GetDirListFileCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_GET_DIR_LIST_FILE_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_GET_DIR_LIST_FILE_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_GetDirListFileCmd_SourceNotExist(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_GetDirListFileCmd_t GetDirListFileCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&GetDirListFileCmd, 0, sizeof(GetDirListFileCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_GetDirListFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_GetDirListFileCmd(&GetDirListFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_GetDirListFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_GetDirListFileCmd_TargetFileOpen(void)
{
- FM_GetDirectoryToFile_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_GetDirListFileCmd_t GetDirListFileCmd;
- CmdPtr = &UT_CmdBuf.GetDirListFileCmd.Payload;
+ memset(&GetDirListFileCmd, 0, sizeof(GetDirListFileCmd));
- strncpy(CmdPtr->Filename, "file", sizeof(CmdPtr->Filename) - 1);
- strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1);
+ strncpy(GetDirListFileCmd.Payload.Filename, "file", sizeof(GetDirListFileCmd.Payload.Filename) - 1);
+ strncpy(GetDirListFileCmd.Payload.Directory, "dir", sizeof(GetDirListFileCmd.Payload.Directory) - 1);
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_GetDirListFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_GetDirListFileCmd(&GetDirListFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_GetDirListFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_GetDirListFileCmd_NoChildTask(void)
{
- FM_GetDirectoryToFile_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_GetDirListFileCmd_t GetDirListFileCmd;
- CmdPtr = &UT_CmdBuf.GetDirListFileCmd.Payload;
+ memset(&GetDirListFileCmd, 0, sizeof(GetDirListFileCmd));
- strncpy(CmdPtr->Filename, "file", sizeof(CmdPtr->Filename) - 1);
- strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1);
+ strncpy(GetDirListFileCmd.Payload.Filename, "file", sizeof(GetDirListFileCmd.Payload.Filename) - 1);
+ strncpy(GetDirListFileCmd.Payload.Directory, "dir", sizeof(GetDirListFileCmd.Payload.Directory) - 1);
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyFileNotOpen), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false);
- Result = FM_GetDirListFileCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_GetDirListFileCmd(&GetDirListFileCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_GetDirListFileCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
-}
-
-void add_FM_GetDirListFileCmd_tests(void)
-{
- UtTest_Add(Test_FM_GetDirListFileCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_GetDirListFileCmd_Success");
-
- UtTest_Add(Test_FM_GetDirListFileCmd_SuccessDefaultPath, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_GetDirListFileCmd_SuccessDefaultPath");
-
- UtTest_Add(Test_FM_GetDirListFileCmd_SourceNotExist, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_GetDirListFileCmd_SourceNotExist");
-
- UtTest_Add(Test_FM_GetDirListFileCmd_TargetFileOpen, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_GetDirListFileCmd_TargetFileOpen");
-
- UtTest_Add(Test_FM_GetDirListFileCmd_NoChildTask, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_GetDirListFileCmd_NoChildTask");
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
/****************************/
@@ -1445,81 +1261,70 @@ void add_FM_GetDirListFileCmd_tests(void)
void Test_FM_GetDirListPktCmd_Success(void)
{
- FM_GetDirectoryToPkt_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_GetDirListPktCmd_t GetDirListPktCmd;
- CmdPtr = &UT_CmdBuf.GetDirListPktCmd.Payload;
+ memset(&GetDirListPktCmd, 0, sizeof(GetDirListPktCmd));
- strncpy(CmdPtr->Directory, "dir", sizeof(CmdPtr->Directory) - 1);
+ strncpy(GetDirListPktCmd.Payload.Directory, "dir", sizeof(GetDirListPktCmd.Payload.Directory) - 1);
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_GetDirListPktCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_GetDirListPktCmd(&GetDirListPktCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_GetDirListPktCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_GET_DIR_LIST_PKT_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_GET_DIR_LIST_PKT_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_GetDirListPktCmd_SourceNotExist(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_GetDirListPktCmd_t GetDirListPktCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&GetDirListPktCmd, 0, sizeof(GetDirListPktCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_GetDirListPktCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_GetDirListPktCmd(&GetDirListPktCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_GetDirListPktCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_GetDirListPktCmd_NoChildTask(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_GetDirListPktCmd_t GetDirListPktCmd;
- FM_GlobalData.ChildWriteIndex = 0;
- FM_GlobalData.ChildQueue[0].CommandCode = 0;
+ memset(&GetDirListPktCmd, 0, sizeof(GetDirListPktCmd));
+
+ FM_AppData.ChildWriteIndex = 0;
+ FM_AppData.ChildQueue[0].CommandCode = 0;
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), false);
- Result = FM_GetDirListPktCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_GetDirListPktCmd(&GetDirListPktCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_GetDirListPktCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
-}
-
-void add_FM_GetDirListPktCmd_tests(void)
-{
- UtTest_Add(Test_FM_GetDirListPktCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_GetDirListPktCmd_Success");
-
- UtTest_Add(Test_FM_GetDirListPktCmd_SourceNotExist, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_GetDirListPktCmd_SourceNotExist");
-
- UtTest_Add(Test_FM_GetDirListPktCmd_NoChildTask, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_GetDirListPktCmd_NoChildTask");
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void UT_Handler_MonitorSpace(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context)
@@ -1538,21 +1343,22 @@ void UT_Handler_MonitorSpace(void *UserObj, UT_EntryKey_t FuncKey, const UT_Stub
void Test_FM_MonitorFilesystemSpaceCmd_Success(void)
{
+ FM_MonitorFilesystemSpaceCmd_t MonitorFilesystemSpaceCmd;
FM_MonitorReportPkt_Payload_t *ReportPtr;
- int32 strCmpResult;
- char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
uint8 call_count_CFE_SB_TransmitMsg;
- snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s command");
+
FM_MonitorTable_t Table;
uint64 RefVal1;
uint64 RefVal2;
+ void *TablePtr;
RefVal1 = 20;
RefVal2 = 10;
memset(&Table, 0, sizeof(Table));
+ memset(&MonitorFilesystemSpaceCmd, 0, sizeof(MonitorFilesystemSpaceCmd));
Table.Entries[0].Type = FM_MonitorTableEntry_Type_VOLUME_FREE_SPACE;
Table.Entries[0].Enabled = FM_TABLE_ENTRY_ENABLED;
@@ -1561,7 +1367,8 @@ void Test_FM_MonitorFilesystemSpaceCmd_Success(void)
Table.Entries[2].Type = FM_MonitorTableEntry_Type_VOLUME_FREE_SPACE;
Table.Entries[2].Enabled = FM_TABLE_ENTRY_DISABLED;
- FM_GlobalData.MonitorTablePtr = &Table;
+ TablePtr = &Table;
+ UT_SetDataBuffer(UT_KEY(CFE_TBL_GetAddress), &TablePtr, sizeof(TablePtr), false);
UT_SetHandlerFunction(UT_KEY(FM_GetVolumeFreeSpace), UT_Handler_MonitorSpace, &RefVal1);
UT_SetHandlerFunction(UT_KEY(FM_GetDirectorySpaceEstimate), UT_Handler_MonitorSpace, &RefVal2);
@@ -1569,157 +1376,109 @@ void Test_FM_MonitorFilesystemSpaceCmd_Success(void)
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyDirExists), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- UtAssert_BOOL_TRUE(FM_MonitorFilesystemSpaceCmd(&UT_CmdBuf.Buf));
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_MONITOR_FILESYSTEM_SPACE_CMD_INF_EID);
-
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
-
- strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
-
- UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);
+ FM_MonitorFilesystemSpaceCmd(&MonitorFilesystemSpaceCmd);
call_count_CFE_SB_TransmitMsg = UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg));
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(call_count_CFE_SB_TransmitMsg, 1);
- ReportPtr = &FM_GlobalData.MonitorReportPkt.Payload;
+ ReportPtr = &FM_AppData.MonitorReportPkt.Payload;
UtAssert_UINT32_EQ(ReportPtr->FileSys[0].Bytes, 2000);
UtAssert_UINT32_EQ(ReportPtr->FileSys[0].Blocks, 20);
UtAssert_UINT32_EQ(ReportPtr->FileSys[1].Bytes, 1000);
UtAssert_UINT32_EQ(ReportPtr->FileSys[1].Blocks, 10);
UtAssert_UINT32_EQ(ReportPtr->FileSys[2].Bytes, 0);
UtAssert_UINT32_EQ(ReportPtr->FileSys[2].Blocks, 0);
+
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
+ FM_Test_Verify_Event(0, FM_MONITOR_FILESYSTEM_SPACE_CMD_INF_EID, CFE_EVS_EventType_INFORMATION,
+ "%s command");
}
void Test_FM_MonitorFilesystemSpaceCmd_NullFreeSpaceTable(void)
{
- int32 strCmpResult;
- char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
+ FM_MonitorFilesystemSpaceCmd_t MonitorFilesystemSpaceCmd;
uint8 call_count_CFE_SB_TransmitMsg;
- snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH,
- "%%s error: file system free space table is not loaded");
-
- FM_GlobalData.MonitorTablePtr = NULL;
-
- UtAssert_BOOL_FALSE(FM_MonitorFilesystemSpaceCmd(&UT_CmdBuf.Buf));
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
- call_count_CFE_SB_TransmitMsg = UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg));
-
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_GET_FREE_SPACE_TBL_ERR_EID);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
+ memset(&MonitorFilesystemSpaceCmd, 0, sizeof(MonitorFilesystemSpaceCmd));
- strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
+ UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 1, CFE_TBL_ERR_NEVER_LOADED);
- UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);
+ FM_MonitorFilesystemSpaceCmd(&MonitorFilesystemSpaceCmd);
+ call_count_CFE_SB_TransmitMsg = UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg));
UtAssert_INT32_EQ(call_count_CFE_SB_TransmitMsg, 0);
+
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
+ FM_Test_Verify_Event(0, FM_GET_FREE_SPACE_TBL_ERR_EID, CFE_EVS_EventType_ERROR,
+ "%s error: file system free space table is not loaded");
}
void Test_FM_MonitorFilesystemSpaceCmd_ImplCallFails(void)
{
+ FM_MonitorFilesystemSpaceCmd_t MonitorFilesystemSpaceCmd;
FM_MonitorReportPkt_Payload_t *ReportPtr;
FM_MonitorTable_t Table;
uint8 call_count_CFE_SB_TransmitMsg;
-
- int32 strCmpResult;
- char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
- char ExpectedEventString2[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
-
- snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH,
- "Could not get file system free space for %%s. Returned 0x%%08X");
- snprintf(ExpectedEventString2, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s command");
+ void *TablePtr;
memset(&Table, 0, sizeof(Table));
+ memset(&MonitorFilesystemSpaceCmd, 0, sizeof(MonitorFilesystemSpaceCmd));
+
Table.Entries[0].Type = FM_MonitorTableEntry_Type_VOLUME_FREE_SPACE;
Table.Entries[0].Enabled = true;
- FM_GlobalData.MonitorTablePtr = &Table;
+ TablePtr = &Table;
+ UT_SetDataBuffer(UT_KEY(CFE_TBL_GetAddress), &TablePtr, sizeof(TablePtr), false);
UT_SetDefaultReturnValue(UT_KEY(FM_GetVolumeFreeSpace), CFE_STATUS_EXTERNAL_RESOURCE_FAIL);
/* Assert */
- UtAssert_BOOL_FALSE(FM_MonitorFilesystemSpaceCmd(&UT_CmdBuf.Buf));
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
-
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_MONITOR_FILESYSTEM_SPACE_CMD_INF_EID);
-
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
-
- strCmpResult = strncmp(ExpectedEventString2, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
-
- UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);
+ FM_MonitorFilesystemSpaceCmd(&MonitorFilesystemSpaceCmd);
call_count_CFE_SB_TransmitMsg = UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg));
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(call_count_CFE_SB_TransmitMsg, 1);
- ReportPtr = &FM_GlobalData.MonitorReportPkt.Payload;
+ ReportPtr = &FM_AppData.MonitorReportPkt.Payload;
UtAssert_ZERO(ReportPtr->FileSys[0].Blocks);
UtAssert_ZERO(ReportPtr->FileSys[0].Bytes);
+
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
+ FM_Test_Verify_Event(0, FM_MONITOR_FILESYSTEM_SPACE_CMD_INF_EID, CFE_EVS_EventType_INFORMATION,
+ "%s command");
}
void Test_FM_MonitorFilesystemSpaceCmd_NotImpl(void)
{
+ FM_MonitorFilesystemSpaceCmd_t MonitorFilesystemSpaceCmd;
FM_MonitorReportPkt_Payload_t *ReportPtr;
uint8 call_count_CFE_SB_TransmitMsg;
FM_MonitorTable_t Table;
-
- int32 strCmpResult;
- char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
- char ExpectedEventString2[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
-
- snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH,
- "Could not get file system free space for %%s. Returned 0x%%08X");
- snprintf(ExpectedEventString2, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s command");
+ void *TablePtr;
memset(&Table, 0, sizeof(Table));
+ memset(&MonitorFilesystemSpaceCmd, 0, sizeof(MonitorFilesystemSpaceCmd));
+
Table.Entries[0].Type = 142;
Table.Entries[0].Enabled = true;
- FM_GlobalData.MonitorTablePtr = &Table;
-
- /* Assert */
- UtAssert_BOOL_FALSE(FM_MonitorFilesystemSpaceCmd(&UT_CmdBuf.Buf));
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
-
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_MONITOR_FILESYSTEM_SPACE_CMD_INF_EID);
-
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
+ TablePtr = &Table;
+ UT_SetDataBuffer(UT_KEY(CFE_TBL_GetAddress), &TablePtr, sizeof(TablePtr), false);
- strCmpResult = strncmp(ExpectedEventString2, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
- UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);
+ /* Assert */
+ FM_MonitorFilesystemSpaceCmd(&MonitorFilesystemSpaceCmd);
call_count_CFE_SB_TransmitMsg = UT_GetStubCount(UT_KEY(CFE_SB_TransmitMsg));
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(call_count_CFE_SB_TransmitMsg, 1);
- ReportPtr = &FM_GlobalData.MonitorReportPkt.Payload;
+ ReportPtr = &FM_AppData.MonitorReportPkt.Payload;
UtAssert_ZERO(ReportPtr->FileSys[0].Blocks);
UtAssert_ZERO(ReportPtr->FileSys[0].Bytes);
-}
-
-void add_FM_MonitorFilesystemSpaceCmd_tests(void)
-{
- UtTest_Add(Test_FM_MonitorFilesystemSpaceCmd_Success, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_MonitorFilesystemSpaceCmd_Success");
- UtTest_Add(Test_FM_MonitorFilesystemSpaceCmd_NullFreeSpaceTable, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_MonitorFilesystemSpaceCmd_NullFreeSpaceTable");
-
- UtTest_Add(Test_FM_MonitorFilesystemSpaceCmd_ImplCallFails, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_MonitorFilesystemSpaceCmd_ImplCallFails");
-
- UtTest_Add(Test_FM_MonitorFilesystemSpaceCmd_NotImpl, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_MonitorFilesystemSpaceCmd_NotImpl");
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
+ FM_Test_Verify_Event(0, FM_MONITOR_FILESYSTEM_SPACE_CMD_INF_EID, CFE_EVS_EventType_INFORMATION,
+ "%s command");
}
/****************************/
@@ -1728,194 +1487,132 @@ void add_FM_MonitorFilesystemSpaceCmd_tests(void)
void Test_FM_SetTableStateCmd_Success(void)
{
- FM_TableIndexAndState_Payload_t *CmdPtr;
- FM_MonitorTable_t Table;
-
- CmdPtr = &UT_CmdBuf.SetTableStateCmd.Payload;
-
- CmdPtr->TableEntryState = FM_TABLE_ENTRY_ENABLED;
- CmdPtr->TableEntryIndex = 0;
-
- int32 strCmpResult;
- char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
- snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s command: index = %%d, state = %%d");
+ CFE_Status_t Status;
+ FM_SetTableStateCmd_t SetTableStateCmd;
+ FM_MonitorTable_t Table;
+ void *TablePtr;
memset(&Table, 0, sizeof(Table));
+ memset(&SetTableStateCmd, 0, sizeof(SetTableStateCmd));
- Table.Entries[0].Type = FM_MonitorTableEntry_Type_VOLUME_FREE_SPACE;
- FM_GlobalData.MonitorTablePtr = &Table;
+ SetTableStateCmd.Payload.TableEntryState = FM_TABLE_ENTRY_ENABLED;
+ SetTableStateCmd.Payload.TableEntryIndex = 0;
- UtAssert_BOOL_TRUE(FM_SetTableStateCmd(&UT_CmdBuf.Buf));
+ Table.Entries[0].Type = FM_MonitorTableEntry_Type_VOLUME_FREE_SPACE;
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_SET_TABLE_STATE_CMD_EID);
+ TablePtr = &Table;
+ UT_SetDataBuffer(UT_KEY(CFE_TBL_GetAddress), &TablePtr, sizeof(TablePtr), false);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_INFORMATION);
+ Status = FM_SetTableStateCmd(&SetTableStateCmd);
- strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);
+ UtAssert_INT32_EQ(Table.Entries[0].Enabled, FM_TABLE_ENTRY_ENABLED);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);
- UtAssert_INT32_EQ(FM_GlobalData.MonitorTablePtr->Entries[0].Enabled, FM_TABLE_ENTRY_ENABLED);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
+ FM_Test_Verify_Event(0, FM_SET_TABLE_STATE_CMD_EID, CFE_EVS_EventType_INFORMATION,
+ "%s command: index = %d, state = %d");
}
void Test_FM_SetTableStateCmd_NullFreeSpaceTable(void)
{
- FM_TableIndexAndState_Payload_t *CmdPtr;
- bool Result;
-
- CmdPtr = &UT_CmdBuf.SetTableStateCmd.Payload;
+ CFE_Status_t Status;
+ FM_SetTableStateCmd_t SetTableStateCmd;
- CmdPtr->TableEntryState = FM_TABLE_ENTRY_ENABLED;
- CmdPtr->TableEntryIndex = 0;
+ memset(&SetTableStateCmd, 0, sizeof(SetTableStateCmd));
- int32 strCmpResult;
- char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
- snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH,
- "%%s error: file system free space table is not loaded");
+ SetTableStateCmd.Payload.TableEntryState = FM_TABLE_ENTRY_ENABLED;
+ SetTableStateCmd.Payload.TableEntryIndex = 0;
- FM_GlobalData.MonitorTablePtr = NULL;
+ FM_AppData.MonitorTablePtr = NULL;
+ UT_SetDeferredRetcode(UT_KEY(CFE_TBL_GetAddress), 1, CFE_TBL_ERR_NEVER_LOADED);
- Result = FM_SetTableStateCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_SetTableStateCmd(&SetTableStateCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_SetTableStateCmd returned false");
-
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_SET_TABLE_STATE_TBL_ERR_EID);
-
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
-
- strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
+ FM_Test_Verify_Event(0, FM_SET_TABLE_STATE_TBL_ERR_EID, CFE_EVS_EventType_ERROR,
+ "%s error: file system free space table is not loaded");
}
void Test_FM_SetTableStateCmd_TableEntryIndexTooLarge(void)
{
- FM_TableIndexAndState_Payload_t *CmdPtr;
- FM_MonitorTable_t Table;
- bool Result;
-
- CmdPtr = &UT_CmdBuf.SetTableStateCmd.Payload;
-
- CmdPtr->TableEntryState = FM_TABLE_ENTRY_ENABLED;
- CmdPtr->TableEntryIndex = FM_TABLE_ENTRY_COUNT;
-
- int32 strCmpResult;
- char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
- snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH,
- "%%s error: invalid command argument: index = %%d");
+ CFE_Status_t Status;
+ FM_SetTableStateCmd_t SetTableStateCmd;
+ FM_MonitorTable_t Table;
+ void *TablePtr;
memset(&Table, 0, sizeof(Table));
+ memset(&SetTableStateCmd, 0, sizeof(SetTableStateCmd));
- FM_GlobalData.MonitorTablePtr = &Table;
+ SetTableStateCmd.Payload.TableEntryState = FM_TABLE_ENTRY_ENABLED;
+ SetTableStateCmd.Payload.TableEntryIndex = FM_TABLE_ENTRY_COUNT;
- Result = FM_SetTableStateCmd(&UT_CmdBuf.Buf);
+ TablePtr = &Table;
+ UT_SetDataBuffer(UT_KEY(CFE_TBL_GetAddress), &TablePtr, sizeof(TablePtr), false);
- /* Assert */
- UtAssert_True(Result == false, "FM_SetTableStateCmd returned false");
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_SET_TABLE_STATE_ARG_IDX_ERR_EID);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
+ Status = FM_SetTableStateCmd(&SetTableStateCmd);
- strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
-
- UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);
+ /* Assert */
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
+ FM_Test_Verify_Event(0, FM_SET_TABLE_STATE_ARG_IDX_ERR_EID, CFE_EVS_EventType_ERROR,
+ "%s error: invalid command argument: index = %d");
}
void Test_FM_SetTableStateCmd_BadNewState(void)
{
- FM_TableIndexAndState_Payload_t *CmdPtr;
- FM_MonitorTable_t Table;
- bool Result;
-
- CmdPtr = &UT_CmdBuf.SetTableStateCmd.Payload;
-
- CmdPtr->TableEntryState = 55;
- CmdPtr->TableEntryIndex = 0;
-
- int32 strCmpResult;
- char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
- snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH,
- "%%s error: invalid command argument: state = %%d");
+ CFE_Status_t Status;
+ FM_SetTableStateCmd_t SetTableStateCmd;
+ FM_MonitorTable_t Table;
+ void *TablePtr;
memset(&Table, 0, sizeof(Table));
+ memset(&SetTableStateCmd, 0, sizeof(SetTableStateCmd));
- FM_GlobalData.MonitorTablePtr = &Table;
-
- Result = FM_SetTableStateCmd(&UT_CmdBuf.Buf);
+ SetTableStateCmd.Payload.TableEntryState = 55;
+ SetTableStateCmd.Payload.TableEntryIndex = 0;
- /* Assert */
- UtAssert_True(Result == false, "FM_SetTableStateCmd returned false");
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_SET_TABLE_STATE_ARG_STATE_ERR_EID);
+ TablePtr = &Table;
+ UT_SetDataBuffer(UT_KEY(CFE_TBL_GetAddress), &TablePtr, sizeof(TablePtr), false);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
+ Status = FM_SetTableStateCmd(&SetTableStateCmd);
- strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
-
- UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);
+ /* Assert */
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
+ FM_Test_Verify_Event(0, FM_SET_TABLE_STATE_ARG_STATE_ERR_EID, CFE_EVS_EventType_ERROR,
+ "%s error: invalid command argument: state = %d");
}
void Test_FM_SetTableStateCmd_BadCurrentState(void)
{
- FM_TableIndexAndState_Payload_t *CmdPtr;
- FM_MonitorTable_t Table;
+ CFE_Status_t Status;
+ FM_SetTableStateCmd_t SetTableStateCmd;
+ FM_MonitorTable_t Table;
+ void *TablePtr;
- CmdPtr = &UT_CmdBuf.SetTableStateCmd.Payload;
-
- CmdPtr->TableEntryState = FM_TABLE_ENTRY_DISABLED;
- CmdPtr->TableEntryIndex = 0;
-
- int32 strCmpResult;
- char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
- snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH,
- "%%s error: cannot modify unused table entry: index = %%d");
+ SetTableStateCmd.Payload.TableEntryState = FM_TABLE_ENTRY_DISABLED;
+ SetTableStateCmd.Payload.TableEntryIndex = 0;
memset(&Table, 0, sizeof(Table));
+ memset(&SetTableStateCmd, 0, sizeof(SetTableStateCmd));
- FM_GlobalData.MonitorTablePtr = &Table;
-
- UtAssert_BOOL_FALSE(FM_SetTableStateCmd(&UT_CmdBuf.Buf));
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_SET_TABLE_STATE_UNUSED_ERR_EID);
+ TablePtr = &Table;
+ UT_SetDataBuffer(UT_KEY(CFE_TBL_GetAddress), &TablePtr, sizeof(TablePtr), false);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
+ Status = FM_SetTableStateCmd(&SetTableStateCmd);
- strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);
-
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 1);
-}
-
-void add_FM_SetTableStateCmd_tests(void)
-{
- UtTest_Add(Test_FM_SetTableStateCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_SetTableStateCmd_Success");
-
- UtTest_Add(Test_FM_SetTableStateCmd_NullFreeSpaceTable, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_SetTableStateCmd_NullFreeSpaceTable");
-
- UtTest_Add(Test_FM_SetTableStateCmd_TableEntryIndexTooLarge, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_SetTableStateCmd_TableEntryIndexTooLarge");
-
- UtTest_Add(Test_FM_SetTableStateCmd_BadNewState, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_SetTableStateCmd_BadNewState");
-
- UtTest_Add(Test_FM_SetTableStateCmd_BadCurrentState, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_SetTableStateCmd_BadCurrentState");
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
+ FM_Test_Verify_Event(0, FM_SET_TABLE_STATE_UNUSED_ERR_EID, CFE_EVS_EventType_ERROR,
+ "%s error: cannot modify unused table entry: index = %d");
}
/****************************/
@@ -1924,71 +1621,89 @@ void add_FM_SetTableStateCmd_tests(void)
void Test_FM_SetPermissionsCmd_Success(void)
{
- FM_FilenameAndMode_Payload_t *CmdPtr;
- bool Result;
+ CFE_Status_t Status;
+ FM_SetPermissionsCmd_t SetPermissionsCmd;
- CmdPtr = &UT_CmdBuf.SetPermissionsCmd.Payload;
+ memset(&SetPermissionsCmd, 0, sizeof(SetPermissionsCmd));
- strncpy(CmdPtr->FileName, "file", sizeof(CmdPtr->FileName) - 1);
+ strncpy(SetPermissionsCmd.Payload.FileName, "file", sizeof(SetPermissionsCmd.Payload.FileName) - 1);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyNameValid), true);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_SetPermissionsCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_SetPermissionsCmd(&SetPermissionsCmd);
/* Assert */
- UtAssert_True(Result == true, "FM_SetPermissionsCmd returned true");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, FM_SET_PERMISSIONS_CC);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, FM_SET_PERMISSIONS_CC);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_SetPermissionsCmd_BadName(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_SetPermissionsCmd_t SetPermissionsCmd;
+
+ memset(&SetPermissionsCmd, 0, sizeof(SetPermissionsCmd));
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyNameValid), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_SetPermissionsCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_SetPermissionsCmd(&SetPermissionsCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_SetPermissionsCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
void Test_FM_SetPermissionsCmd_NoChildTask(void)
{
- bool Result;
+ CFE_Status_t Status;
+ FM_SetPermissionsCmd_t SetPermissionsCmd;
+
+ memset(&SetPermissionsCmd, 0, sizeof(SetPermissionsCmd));
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyNameValid), false);
UT_SetDefaultReturnValue(UT_KEY(FM_VerifyChildTask), true);
- Result = FM_SetPermissionsCmd(&UT_CmdBuf.Buf);
-
- call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
+ Status = FM_SetPermissionsCmd(&SetPermissionsCmd);
/* Assert */
- UtAssert_True(Result == false, "FM_SetPermissionsCmd returned false");
+ UtAssert_EQ(CFE_Status_t, Status, CFE_SUCCESS);
- UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, 0);
- UtAssert_INT32_EQ(FM_GlobalData.ChildQueue[0].CommandCode, 0);
+ UtAssert_INT32_EQ(FM_AppData.ChildQueue[0].CommandCode, 0);
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
}
-void add_FM_SetPermissionsCmd_tests(void)
+/* ********************************
+ * Report HK Tests
+ * *******************************/
+void Test_FM_SendHkCmd(void)
{
- UtTest_Add(Test_FM_SetPermissionsCmd_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_SetPermissionsCmd_Success");
+ /* Arrange */
+ UT_SetDefaultReturnValue(UT_KEY(FM_GetOpenFilesData), 0);
+
+ /* Set non-zero values to assert */
+ FM_AppData.HkTlm.Payload.CommandCounter = 1;
+ FM_AppData.HkTlm.Payload.CommandErrCounter = 2;
+ FM_AppData.HkTlm.Payload.ChildCmdCounter = 3;
+ FM_AppData.HkTlm.Payload.ChildCmdErrCounter = 4;
+ FM_AppData.HkTlm.Payload.ChildCmdWarnCounter = 5;
+ FM_AppData.HkTlm.Payload.ChildQueueCount = 6;
+ FM_AppData.HkTlm.Payload.ChildCurrentCC = 7;
+ FM_AppData.HkTlm.Payload.ChildPreviousCC = 8;
- UtTest_Add(Test_FM_SetPermissionsCmd_BadName, FM_Test_Setup, FM_Test_Teardown, "Test_FM_SetPermissionsCmd_BadName");
+ /* Act */
+ UtAssert_VOIDCALL(FM_SendHkCmd(NULL));
- UtTest_Add(Test_FM_SetPermissionsCmd_NoChildTask, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_SetPermissionsCmd_NoChildTask");
+ /* Assert */
+ UtAssert_STUB_COUNT(CFE_TBL_Manage, 1);
+ UtAssert_STUB_COUNT(FM_GetOpenFilesData, 1);
+ UtAssert_STUB_COUNT(CFE_SB_TimeStampMsg, 1);
+ UtAssert_STUB_COUNT(CFE_SB_TransmitMsg, 1);
}
/*
@@ -1996,22 +1711,68 @@ void add_FM_SetPermissionsCmd_tests(void)
*/
void UtTest_Setup(void)
{
- add_FM_NoopCmd_tests();
- add_FM_ResetCountersCmd_tests();
- add_FM_CopyFileCmd_tests();
- add_FM_MoveFileCmd_tests();
- add_FM_RenameFileCmd_tests();
- add_FM_DeleteFileCmd_tests();
- add_FM_DeleteAllFilesCmd_tests();
- add_FM_DecompressFileCmd_tests();
- add_FM_ConcatFilesCmd_tests();
- add_FM_GetFileInfoCmd_tests();
- add_FM_GetOpenFilesCmd_tests();
- add_FM_CreateDirectoryCmd_tests();
- add_FM_DeleteDirectoryCmd_tests();
- add_FM_GetDirListFileCmd_tests();
- add_FM_GetDirListPktCmd_tests();
- add_FM_MonitorFilesystemSpaceCmd_tests();
- add_FM_SetTableStateCmd_tests();
- add_FM_SetPermissionsCmd_tests();
+ ADD_TEST(Test_FM_SendHkCmd);
+ ADD_TEST(Test_FM_NoopCmd_Success);
+ ADD_TEST(Test_FM_ResetCountersCmd_Success);
+ ADD_TEST(Test_FM_CopyFileCmd_Success);
+ ADD_TEST(Test_FM_CopyFileCmd_BadOverwrite);
+ ADD_TEST(Test_FM_CopyFileCmd_SourceNotExist);
+ ADD_TEST(Test_FM_CopyFileCmd_NoOverwriteTargetExists);
+ ADD_TEST(Test_FM_CopyFileCmd_OverwriteFileOpen);
+ ADD_TEST(Test_FM_CopyFileCmd_NoChildTask);
+ ADD_TEST(Test_FM_MoveFileCmd_Success);
+ ADD_TEST(Test_FM_MoveFileCmd_BadOverwrite);
+ ADD_TEST(Test_FM_MoveFileCmd_SourceNotExist);
+ ADD_TEST(Test_FM_MoveFileCmd_NoOverwriteTargetExists);
+ ADD_TEST(Test_FM_MoveFileCmd_OverwriteFileOpen);
+ ADD_TEST(Test_FM_MoveFileCmd_NoChildTask);
+ ADD_TEST(Test_FM_RenameFileCmd_Success);
+ ADD_TEST(Test_FM_RenameFileCmd_SourceNotExist);
+ ADD_TEST(Test_FM_RenameFileCmd_TargetExists);
+ ADD_TEST(Test_FM_RenameFileCmd_NoChildTask);
+ ADD_TEST(Test_FM_DeleteFileCmd_Success);
+ ADD_TEST(Test_FM_DeleteFileCmd_FileNotClosed);
+ ADD_TEST(Test_FM_DeleteFileCmd_NoChildTask);
+ ADD_TEST(Test_FM_DeleteAllFilesCmd_Success);
+ ADD_TEST(Test_FM_DeleteAllFilesCmd_DirNoExist);
+ ADD_TEST(Test_FM_DeleteAllFilesCmd_NoChildTask);
+ ADD_TEST(Test_FM_DecompressFileCmd_Success);
+ ADD_TEST(Test_FM_DecompressFileCmd_SourceFileOpen);
+ ADD_TEST(Test_FM_DecompressFileCmd_TargetFileExists);
+ ADD_TEST(Test_FM_DecompressFileCmd_NoChildTask);
+ ADD_TEST(Test_FM_ConcatFilesCmd_Success);
+ ADD_TEST(Test_FM_ConcatFilesCmd_SourceFile1NotClosed);
+ ADD_TEST(Test_FM_ConcatFilesCmd_SourceFile2NotClosed);
+ ADD_TEST(Test_FM_ConcatFilesCmd_TargetFileExists);
+ ADD_TEST(Test_FM_ConcatFilesCmd_NoChildTask);
+ ADD_TEST(Test_FM_GetFileInfoCmd_Success);
+ ADD_TEST(Test_FM_GetFileInfoCmd_InvalidName);
+ ADD_TEST(Test_FM_GetFileInfoCmd_NoChildTask);
+ ADD_TEST(Test_FM_GetOpenFilesCmd_Success);
+ ADD_TEST(Test_FM_CreateDirectoryCmd_Success);
+ ADD_TEST(Test_FM_CreateDirectoryCmd_DirExists);
+ ADD_TEST(Test_FM_CreateDirectoryCmd_NoChildTask);
+ ADD_TEST(Test_FM_DeleteDirectoryCmd_Success);
+ ADD_TEST(Test_FM_DeleteDirectoryCmd_DirNoExist);
+ ADD_TEST(Test_FM_DeleteDirectoryCmd_NoChildTask);
+ ADD_TEST(Test_FM_GetDirListFileCmd_Success);
+ ADD_TEST(Test_FM_GetDirListFileCmd_SuccessDefaultPath);
+ ADD_TEST(Test_FM_GetDirListFileCmd_SourceNotExist);
+ ADD_TEST(Test_FM_GetDirListFileCmd_TargetFileOpen);
+ ADD_TEST(Test_FM_GetDirListFileCmd_NoChildTask);
+ ADD_TEST(Test_FM_GetDirListPktCmd_Success);
+ ADD_TEST(Test_FM_GetDirListPktCmd_SourceNotExist);
+ ADD_TEST(Test_FM_GetDirListPktCmd_NoChildTask);
+ ADD_TEST(Test_FM_MonitorFilesystemSpaceCmd_Success);
+ ADD_TEST(Test_FM_MonitorFilesystemSpaceCmd_NullFreeSpaceTable);
+ ADD_TEST(Test_FM_MonitorFilesystemSpaceCmd_ImplCallFails);
+ ADD_TEST(Test_FM_MonitorFilesystemSpaceCmd_NotImpl);
+ ADD_TEST(Test_FM_SetTableStateCmd_Success);
+ ADD_TEST(Test_FM_SetTableStateCmd_NullFreeSpaceTable);
+ ADD_TEST(Test_FM_SetTableStateCmd_TableEntryIndexTooLarge);
+ ADD_TEST(Test_FM_SetTableStateCmd_BadNewState);
+ ADD_TEST(Test_FM_SetTableStateCmd_BadCurrentState);
+ ADD_TEST(Test_FM_SetPermissionsCmd_Success);
+ ADD_TEST(Test_FM_SetPermissionsCmd_BadName);
+ ADD_TEST(Test_FM_SetPermissionsCmd_NoChildTask);
}
diff --git a/unit-test/fm_dispatch_tests.c b/unit-test/fm_dispatch_tests.c
index 0e19861..1d27e56 100644
--- a/unit-test/fm_dispatch_tests.c
+++ b/unit-test/fm_dispatch_tests.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -37,11 +36,13 @@
#include "fm_msg.h"
#include "fm_msgdefs.h"
#include "fm_msgids.h"
-#include "fm_events.h"
+#include "fm_eventids.h"
#include "fm_dispatch.h"
#include "fm_cmds.h"
#include "fm_app.h"
#include "fm_test_utils.h"
+#include "fm_topicids.h"
+#include "fm_fcncodes.h"
#include
#include
#include "cfe.h"
@@ -50,931 +51,558 @@
* TEST CASE FUNCTIONS
*********************************************************************************/
+/* ********************************
+ * Verify Command Length Tests
+ * *******************************/
+
+void Test_FM_VerifyCmdLength_Nominal(void)
+{
+ bool Result;
+ size_t ExpectedLen;
+ CFE_SB_MsgId_t MsgId;
+ CFE_MSG_FcnCode_t FcnCode;
+
+ /* Set up values for test */
+ ExpectedLen = sizeof(FM_NoopCmd_t);
+ MsgId = CFE_SB_MSGID_C(FM_MISSION_CMD_TOPICID);
+ FcnCode = FM_NOOP_CC;
+
+ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &ExpectedLen, sizeof(size_t),
+ false);
+ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(CFE_SB_MsgId_t),
+ false);
+ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode,
+ sizeof(CFE_MSG_FcnCode_t), false);
+
+ /* Run function under test */
+ Result = FM_VerifyCmdLength(NULL, sizeof(FM_NoopCmd_t));
+
+ /* Evaluate run */
+ UtAssert_BOOL_TRUE(Result);
+
+ UtAssert_EQ(uint8, FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_EQ(uint8, FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
+
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
+}
+
+void Test_FM_VerifyCmdLength_InvalidSize(void)
+{
+ size_t ExpectedLen;
+ CFE_SB_MsgId_t MsgId;
+ CFE_MSG_FcnCode_t FcnCode;
+
+ /* Set up values for test */
+ /* Since every case in the switch statement has a conditional this needs to call each one */
+ for (FcnCode = 0; FcnCode < FM_NUM_COMMANDS; ++FcnCode)
+ {
+ FM_Test_Setup();
+
+ FM_AppData.HkTlm.Payload.CommandErrCounter = 0;
+
+ ExpectedLen = 1;
+ MsgId = CFE_SB_MSGID_C(FM_MISSION_CMD_TOPICID);
+
+ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &ExpectedLen, sizeof(size_t),
+ false);
+ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(CFE_SB_MsgId_t),
+ false);
+ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode,
+ sizeof(CFE_MSG_FcnCode_t), false);
+ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &FcnCode,
+ sizeof(CFE_MSG_FcnCode_t), false);
+
+ /* Run function under test */
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
+
+ UtAssert_EQ(uint8, FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_EQ(uint8, FM_AppData.HkTlm.Payload.CommandErrCounter, 1);
+
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
+
+ if (context_CFE_EVS_SendEvent[0].EventID != FM_CC_ERR_EID)
+ {
+ FM_Test_Verify_Event(0, FM_CMD_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
+ "Invalid Msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u");
+ }
+ }
+}
+
/* ********************************
* Process Command Tests
* *******************************/
-void Test_FM_ProcessCmd_NoopCmdCCReturn(void)
+void Test_FM_ProcessGroundCommand_NoopCmdCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_NOOP_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_NoopCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_NoopCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_NoopCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_ResetCountersCCReturn(void)
+void Test_FM_ProcessGroundCommand_ResetCountersCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_RESET_COUNTERS_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_ResetCountersCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_ResetCountersCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_ResetCountersCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 0);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_CopyFileCCReturn(void)
+void Test_FM_ProcessGroundCommand_CopyFileCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_COPY_FILE_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_CopyFileCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_CopyFileCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_CopyFileCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_MoveFileCCReturn(void)
+void Test_FM_ProcessGroundCommand_MoveFileCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_MOVE_FILE_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_MoveFileCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_MoveFileCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_MoveFileCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_RenameFileCCReturn(void)
+void Test_FM_ProcessGroundCommand_RenameFileCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_RENAME_FILE_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_RenameFileCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_RenameFileCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_RenameFileCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_DeleteFileCCReturn(void)
+void Test_FM_ProcessGroundCommand_DeleteFileCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_DELETE_FILE_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_DeleteFileCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_DeleteFileCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_DeleteFileCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_DeleteAllFilesCCReturn(void)
+void Test_FM_ProcessGroundCommand_DeleteAllFilesCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_DELETE_ALL_FILES_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_DeleteAllFilesCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_DeleteAllFilesCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_DeleteAllFilesCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_DecompressFileCCReturn(void)
+void Test_FM_ProcessGroundCommand_DecompressFileCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_DECOMPRESS_FILE_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_DecompressFileCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_DecompressFileCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_DecompressFileCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_ConcatFilesCCReturn(void)
+void Test_FM_ProcessGroundCommand_ConcatFilesCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_CONCAT_FILES_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_ConcatFilesCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_ConcatFilesCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_ConcatFilesCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_GetFileInfoCCReturn(void)
+void Test_FM_ProcessGroundCommand_GetFileInfoCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_GET_FILE_INFO_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_GetFileInfoCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_GetFileInfoCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_GetFileInfoCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_GetOpenFilesCCReturn(void)
+void Test_FM_ProcessGroundCommand_GetOpenFilesCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_GET_OPEN_FILES_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_GetOpenFilesCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_GetOpenFilesCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_GetOpenFilesCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_CreateDirectoryCCReturn(void)
+void Test_FM_ProcessGroundCommand_CreateDirectoryCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_CREATE_DIRECTORY_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_CreateDirectoryCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_CreateDirectoryCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_CreateDirectoryCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_DeleteDirectoryCCReturn(void)
+void Test_FM_ProcessGroundCommand_DeleteDirectoryCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_DELETE_DIRECTORY_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_DeleteDirectoryCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_DeleteDirectoryCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_DeleteDirectoryCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_GetDirListFileCCReturn(void)
+void Test_FM_ProcessGroundCommand_GetDirListFileCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_GET_DIR_LIST_FILE_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_GetDirListFileCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListFileCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_GetDirListFileCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_GetDirListPktCCReturn(void)
+void Test_FM_ProcessGroundCommand_GetDirListPktCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_GET_DIR_LIST_PKT_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_GetDirListPktCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListPktCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_GetDirListPktCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_MonitorFilesystemSpaceCCReturn(void)
+void Test_FM_ProcessGroundCommand_MonitorFilesystemSpaceCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_MONITOR_FILESYSTEM_SPACE_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_MonitorFilesystemSpaceCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_MonitorFilesystemSpaceCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_MonitorFilesystemSpaceCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_SetTableStateCCReturn(void)
+void Test_FM_ProcessGroundCommand_SetTableStateCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_SET_TABLE_STATE_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_SetTableStateCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_SetTableStateCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_SetTableStateCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_SetPermissionsCCReturn(void)
+void Test_FM_ProcessGroundCommand_SetPermissionsCCReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
-
fcn_code = FM_SET_PERMISSIONS_CC;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
+
length = sizeof(FM_SetPermissionsCmd_t);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UT_SetDefaultReturnValue(UT_KEY(FM_SetPermissionsCmd), true);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
UtAssert_STUB_COUNT(FM_SetPermissionsCmd, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 0);
}
-void Test_FM_ProcessCmd_DefaultReturn(void)
+void Test_FM_ProcessGroundCommand_DefaultReturn(void)
{
/* Arrange */
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
-
- memset(&utbuf, 0, sizeof(utbuf));
fcn_code = -1;
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessCmd(&utbuf));
+ UtAssert_VOIDCALL(FM_ProcessGroundCommand(NULL));
/* Assert */
- UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
- UtAssert_INT32_EQ(FM_GlobalData.CommandCounter, 0);
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 1);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_CC_ERR_EID);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
-}
-
-void add_FM_ProcessCmd_tests(void)
-{
- UtTest_Add(Test_FM_ProcessCmd_NoopCmdCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_NoopCmd_Return");
-
- UtTest_Add(Test_FM_ProcessCmd_ResetCountersCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_NResetCountersCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_CopyFileCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_CopyFileCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_MoveFileCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_MoveFileCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_RenameFileCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_RenameFileCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_DeleteFileCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_DeleteFileCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_DeleteAllFilesCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_DeleteAllFilesCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_DecompressFileCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_DecompressFileCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_ConcatFilesCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_ConcatFilesCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_GetFileInfoCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_GetFileInfoCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_GetOpenFilesCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_GetOpenFilesCCReturn");
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandCounter, 0);
+ UtAssert_INT32_EQ(FM_AppData.HkTlm.Payload.CommandErrCounter, 1);
- UtTest_Add(Test_FM_ProcessCmd_CreateDirectoryCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_CreateDirectoryCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_DeleteDirectoryCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_DeleteDirectoryCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_GetDirListFileCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_GetDirListFIleCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_GetDirListPktCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_GetDirListPktCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_MonitorFilesystemSpaceCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_MonitorFilesystemSpaceCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_SetTableStateCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_SetTableStateCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_SetPermissionsCCReturn, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessCmd_SetPermissionsCCReturn");
-
- UtTest_Add(Test_FM_ProcessCmd_DefaultReturn, FM_Test_Setup, FM_Test_Teardown, "Test_FM_ProcessCmd_DefaultReturn");
+ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
+ FM_Test_Verify_Event(0, FM_CC_ERR_EID, CFE_EVS_EventType_ERROR,
+ "Invalid ground command code: cc = %d");
}
/* ********************************
- * ProcessPkt Tests
+ * TaskPipe Tests
* ********************************/
-void Test_FM_ProcessPkt_CheckMessageReturnHKRequest(void)
+void Test_FM_TaskPipe_SendHkCmd(void)
{
/* Arrange */
- CFE_SB_MsgId_t msgid = CFE_SB_ValueToMsgId(FM_SEND_HK_MID);
- CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
- size_t length;
-
- memset(&utbuf, 0, sizeof(utbuf));
+ CFE_SB_MsgId_t msgid;
msgid = CFE_SB_ValueToMsgId(FM_SEND_HK_MID);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &msgid, sizeof(msgid), false);
- fcn_code = 0;
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
- length = sizeof(FM_SendHkCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessPkt(&utbuf));
+ UtAssert_VOIDCALL(FM_TaskPipe(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
+ UtAssert_STUB_COUNT(FM_SendHkCmd, 1);
}
-void Test_FM_ProcessPkt_CheckMessageReturnGroundCommand(void)
+void Test_FM_TaskPipe_ProcessGroundCommand(void)
{
/* Arrange */
- CFE_SB_MsgId_t msgid = CFE_SB_ValueToMsgId(FM_CMD_MID);
+ CFE_SB_MsgId_t msgid;
CFE_MSG_FcnCode_t fcn_code;
- CFE_SB_Buffer_t utbuf;
+ size_t length;
- memset(&utbuf, 0, sizeof(utbuf));
+ fcn_code = FM_NOOP_CC;
+ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
- fcn_code = -1;
+ length = sizeof(FM_NoopCmd_t);
+ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
+
+ msgid = CFE_SB_ValueToMsgId(FM_CMD_MID);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &msgid, sizeof(msgid), false);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetFcnCode), &fcn_code, sizeof(fcn_code), false);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessPkt(&utbuf));
+ UtAssert_VOIDCALL(FM_TaskPipe(NULL));
/* Assert */
- UtAssert_INT32_EQ(FM_GlobalData.CommandErrCounter, 1);
- UtAssert_STUB_COUNT(CFE_MSG_GetFcnCode, 1);
- UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_CC_ERR_EID);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
+ UtAssert_STUB_COUNT(FM_NoopCmd, 1);
}
-void Test_FM_ProcessPkt_CheckDefaultSwitchMessage(void)
+void Test_FM_TaskPipe_CheckDefaultSwitchMessage(void)
{
/* Arrange */
CFE_SB_MsgId_t msgid = CFE_SB_INVALID_MSG_ID;
- CFE_SB_Buffer_t utbuf;
-
- memset(&utbuf, 0, sizeof(utbuf));
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &msgid, sizeof(msgid), false);
/* Act */
- UtAssert_VOIDCALL(FM_ProcessPkt(&utbuf));
+ UtAssert_VOIDCALL(FM_TaskPipe(NULL));
/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_MID_ERR_EID);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
-}
-
-/* * * * * * * * * * * * * *
- * Add Method Tests
- * * * * * * * * * * * * * */
-void add_FM_ProcessPkt_tests(void)
-{
- UtTest_Add(Test_FM_ProcessPkt_CheckMessageReturnHKRequest, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessPkt_ReportHK");
-
- UtTest_Add(Test_FM_ProcessPkt_CheckMessageReturnGroundCommand, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessPkt_CheckMessageReturnGroundCommand");
-
- UtTest_Add(Test_FM_ProcessPkt_CheckDefaultSwitchMessage, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ProcessPkt_CheckDefaultSwitchMessage");
-}
-
-/*****************
- * IsValidCmdPktLength Tests
- ****************/
-void Test_FM_IsValidCmdPktLength(void)
-{
- size_t length = 5;
- uint32 eventid = 1;
-
- /* Matching length */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_IsValidCmdPktLength(NULL, length, 1, "Cmd Text"));
- UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0);
-
- /* Mismatched length */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_IsValidCmdPktLength(NULL, length + 1, eventid, "Cmd Text"));
- UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, eventid);
- UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
-}
-
-/*****************
- * Bad Length Tests for each command
- ****************/
-
-void Test_FM_NoopVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_NoopCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_NoopVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_NoopCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_NoopVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_ResetCountersVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_ResetCountersCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_ResetCountersVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_ResetCountersCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_ResetCountersVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_CopyFileVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_CopyFileCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_CopyFileVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_CopyFileCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_CopyFileVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_MoveFileVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_MoveFileCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_MoveFileVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_MoveFileCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_MoveFileVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_RenameFileVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_RenameFileCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_RenameFileVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_RenameFileCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_RenameFileVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_DeleteFileVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_DeleteFileCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_DeleteFileVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_DeleteFileCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_DeleteFileVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_DeleteAllFilesVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_DeleteAllFilesCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_DeleteAllFilesVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_DeleteAllFilesCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_DeleteAllFilesVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_DecompressFileVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_DecompressFileCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_DecompressFileVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_DecompressFileCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_DecompressFileVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_ConcatFilesVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_ConcatFilesCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_ConcatFilesVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_ConcatFilesCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_ConcatFilesVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_GetFileInfoVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_GetFileInfoCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_GetFileInfoVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_GetFileInfoCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_GetFileInfoVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_GetOpenFilesVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_GetOpenFilesCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_GetOpenFilesVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_GetOpenFilesCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_GetOpenFilesVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_CreateDirectoryVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_CreateDirectoryCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_CreateDirectoryVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_CreateDirectoryCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_CreateDirectoryVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_DeleteDirectoryVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_DeleteDirectoryCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_DeleteDirectoryVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_DeleteDirectoryCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_DeleteDirectoryVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_GetDirListFileVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListFileCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_GetDirListFileVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_GetDirListFileCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_GetDirListFileVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_GetDirListPktVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_GetDirListPktCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_GetDirListPktVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_GetDirListPktCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_GetDirListPktVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_MonitorFilesystemSpaceVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_MonitorFilesystemSpaceCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_MonitorFilesystemSpaceVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_MonitorFilesystemSpaceCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_MonitorFilesystemSpaceVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_SetTableStateVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_SetTableStateCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_SetTableStateVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_SetTableStateCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_SetTableStateVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_SetPermissionsVerifyDispatch(void)
-{
- size_t length;
-
- UT_SetDefaultReturnValue(UT_KEY(FM_SetPermissionsCmd), true);
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_FALSE(FM_SetPermissionsVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_SetPermissionsCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_BOOL_TRUE(FM_SetPermissionsVerifyDispatch(&UT_CmdBuf.Buf));
-}
-
-void Test_FM_SendHkVerifyDispatch(void)
-{
- size_t length;
-
- length = 1; /* bad size for any message */
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_VOIDCALL(FM_SendHkVerifyDispatch(&UT_CmdBuf.Buf));
-
- length = sizeof(FM_SendHkCmd_t);
- UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &length, sizeof(length), false);
- UtAssert_VOIDCALL(FM_SendHkVerifyDispatch(&UT_CmdBuf.Buf));
+ FM_Test_Verify_Event(0, FM_MID_ERR_EID, CFE_EVS_EventType_ERROR,
+ "Invalid command pipe message ID: 0x%08lX");
}
/*
@@ -982,53 +610,28 @@ void Test_FM_SendHkVerifyDispatch(void)
*/
void UtTest_Setup(void)
{
- add_FM_ProcessPkt_tests();
- add_FM_ProcessCmd_tests();
-
- UtTest_Add(Test_FM_IsValidCmdPktLength, FM_Test_Setup, FM_Test_Teardown, "Test_FM_IsValidCmdPktLength");
-
- UtTest_Add(Test_FM_NoopVerifyDispatch, FM_Test_Setup, FM_Test_Teardown, "Test_FM_NoopVerifyDispatch");
- UtTest_Add(Test_FM_ResetCountersVerifyDispatch, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_ResetCountersVerifyDispatch");
- UtTest_Add(Test_FM_CopyFileVerifyDispatch, FM_Test_Setup, FM_Test_Teardown, "Test_FM_CopyFileVerifyDispatch");
-
- UtTest_Add(Test_FM_MoveFileVerifyDispatch, FM_Test_Setup, FM_Test_Teardown, "Test_FM_MoveFileVerifyDispatch");
-
- UtTest_Add(Test_FM_RenameFileVerifyDispatch, FM_Test_Setup, FM_Test_Teardown, "Test_FM_RenameFileVerifyDispatch");
- UtTest_Add(Test_FM_DeleteFileVerifyDispatch, FM_Test_Setup, FM_Test_Teardown, "Test_FM_DeleteFileVerifyDispatch");
- UtTest_Add(Test_FM_DeleteAllFilesVerifyDispatch, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_DeleteAllFilesVerifyDispatch");
-
- UtTest_Add(Test_FM_DecompressFileVerifyDispatch, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_DecompressFileVerifyDispatch");
-
- UtTest_Add(Test_FM_ConcatFilesVerifyDispatch, FM_Test_Setup, FM_Test_Teardown, "Test_FM_ConcatFilesVerifyDispatch");
-
- UtTest_Add(Test_FM_GetFileInfoVerifyDispatch, FM_Test_Setup, FM_Test_Teardown, "Test_FM_GetFileInfoVerifyDispatch");
-
- UtTest_Add(Test_FM_GetOpenFilesVerifyDispatch, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_GetOpenFilesVerifyDispatch");
-
- UtTest_Add(Test_FM_CreateDirectoryVerifyDispatch, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_CreateDirectoryVerifyDispatch");
-
- UtTest_Add(Test_FM_DeleteDirectoryVerifyDispatch, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_DeleteDirectoryVerifyDispatch");
-
- UtTest_Add(Test_FM_GetDirListFileVerifyDispatch, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_GetDirListFileVerifyDispatch");
-
- UtTest_Add(Test_FM_GetDirListPktVerifyDispatch, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_GetDirListPktVerifyDispatch");
-
- UtTest_Add(Test_FM_MonitorFilesystemSpaceVerifyDispatch, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_MonitorFilesystemSpaceVerifyDispatch");
-
- UtTest_Add(Test_FM_SetTableStateVerifyDispatch, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_SetTableStateVerifyDispatch");
-
- UtTest_Add(Test_FM_SetPermissionsVerifyDispatch, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_SetPermissionsVerifyDispatch");
-
- UtTest_Add(Test_FM_SendHkVerifyDispatch, FM_Test_Setup, FM_Test_Teardown, "Test_FM_SendHkVerifyDispatch");
+ ADD_TEST(Test_FM_VerifyCmdLength_Nominal);
+ ADD_TEST(Test_FM_VerifyCmdLength_InvalidSize);
+ ADD_TEST(Test_FM_ProcessGroundCommand_NoopCmdCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_ResetCountersCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_CopyFileCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_MoveFileCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_RenameFileCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_DeleteFileCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_DeleteAllFilesCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_DecompressFileCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_ConcatFilesCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_GetFileInfoCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_GetOpenFilesCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_CreateDirectoryCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_DeleteDirectoryCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_GetDirListFileCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_GetDirListPktCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_MonitorFilesystemSpaceCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_SetTableStateCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_SetPermissionsCCReturn);
+ ADD_TEST(Test_FM_ProcessGroundCommand_DefaultReturn);
+ ADD_TEST(Test_FM_TaskPipe_SendHkCmd);
+ ADD_TEST(Test_FM_TaskPipe_ProcessGroundCommand);
+ ADD_TEST(Test_FM_TaskPipe_CheckDefaultSwitchMessage);
}
diff --git a/unit-test/fm_eds_dispatch_tests.c b/unit-test/fm_eds_dispatch_tests.c
new file mode 100644
index 0000000..cf417b3
--- /dev/null
+++ b/unit-test/fm_eds_dispatch_tests.c
@@ -0,0 +1,73 @@
+/************************************************************************
+ * 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
+ * Coverage Unit Test cases for the fm_app implementations
+ */
+
+/*
+ * Includes
+ */
+/*
+ * UT includes
+ */
+#include "uttest.h"
+#include "utassert.h"
+#include "utstubs.h"
+
+/* fm testing */
+#include "cfe.h"
+#include "fm_msg.h"
+#include "fm_msgdefs.h"
+#include "fm_msgids.h"
+#include "fm_eventids.h"
+#include "fm_dispatch.h"
+#include "fm_cmds.h"
+#include "fm_app.h"
+#include "fm_test_utils.h"
+#include "fm_eds_dispatcher.h"
+#include
+#include
+
+/*
+**********************************************************************************
+** TEST CASE FUNCTIONS
+**********************************************************************************
+*/
+void Test_FM_TaskPipe(void)
+{
+ /*
+ * Test Case For:
+ * void CS_AppPipe
+ */
+ CFE_SB_Buffer_t UtBuf;
+
+ UT_SetDeferredRetcode(UT_KEY(CFE_EDSMSG_Dispatch), 1, CFE_SUCCESS);
+
+ memset(&UtBuf, 0, sizeof(UtBuf));
+ UtAssert_VOIDCALL(FM_TaskPipe(&UtBuf));
+}
+
+/*
+ * Register the test cases to execute with the unit test tool
+ */
+void UtTest_Setup(void)
+{
+ UtTest_Add(Test_FM_TaskPipe, FM_Test_Setup, FM_Test_Teardown, "Test_FM_TaskPipe");
+}
diff --git a/unit-test/fm_tbl_tests.c b/unit-test/fm_table_utils_tests.c
similarity index 93%
rename from unit-test/fm_tbl_tests.c
rename to unit-test/fm_table_utils_tests.c
index 3d42048..22356c3 100644
--- a/unit-test/fm_tbl_tests.c
+++ b/unit-test/fm_table_utils_tests.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,8 +24,10 @@
#include "cfe.h"
#include "fm_platform_cfg.h"
#include "fm_app.h"
+#include "fm_table_utils.h"
+#include "fm_eventids.h"
#include "fm_tbl.h"
-#include "fm_events.h"
+#include "fm_extern_typedefs.h"
#include
@@ -112,7 +113,7 @@ void Test_FM_ValidateTable_Success(void)
{
Table.Entries[i].Enabled = FM_TABLE_ENTRY_ENABLED;
}
- snprintf(Table.Entries[i].Name, OS_MAX_PATH_LEN, "Test");
+ snprintf(Table.Entries[i].Name, CFE_MISSION_MAX_PATH_LEN, "Test");
}
snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH,
@@ -180,7 +181,7 @@ void Test_FM_ValidateTable_UnusedEntry(void)
{
Table.Entries[i].Enabled = FM_TABLE_ENTRY_ENABLED;
}
- snprintf(Table.Entries[i].Name, OS_MAX_PATH_LEN, "Test");
+ snprintf(Table.Entries[i].Name, CFE_MISSION_MAX_PATH_LEN, "Test");
}
Table.Entries[0].Type = FM_MonitorTableEntry_Type_UNUSED;
@@ -226,7 +227,7 @@ void Test_FM_ValidateTable_BadEntryState(void)
Table.Entries[i].Enabled = FM_TABLE_ENTRY_ENABLED;
}
- snprintf(Table.Entries[i].Name, OS_MAX_PATH_LEN, "Test");
+ snprintf(Table.Entries[i].Name, CFE_MISSION_MAX_PATH_LEN, "Test");
}
Table.Entries[0].Type = 99;
@@ -340,7 +341,7 @@ void Test_FM_ValidateTable_NameTooLong(void)
Table.Entries[i].Enabled = FM_TABLE_ENTRY_ENABLED;
}
- snprintf(Table.Entries[i].Name, OS_MAX_PATH_LEN, "Test");
+ snprintf(Table.Entries[i].Name, CFE_MISSION_MAX_PATH_LEN, "Test");
}
memset(Table.Entries[0].Name, 'A', sizeof(Table.Entries[0].Name));
@@ -384,11 +385,11 @@ void Test_FM_AcquireTablePointers_Success(void)
UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_SUCCESS);
- FM_GlobalData.MonitorTablePtr = &Table;
+ FM_AppData.MonitorTablePtr = &Table;
- FM_AcquireTablePointers();
+ UtAssert_VOIDCALL(FM_AcquireTablePointers());
- UtAssert_NOT_NULL(FM_GlobalData.MonitorTablePtr);
+ UtAssert_NOT_NULL(FM_AppData.MonitorTablePtr);
}
void Test_FM_AcquireTablePointers_Fail(void)
@@ -397,22 +398,20 @@ void Test_FM_AcquireTablePointers_Fail(void)
UT_SetDefaultReturnValue(UT_KEY(CFE_TBL_GetAddress), CFE_TBL_ERR_NEVER_LOADED);
- FM_GlobalData.MonitorTablePtr = &Table;
+ FM_AppData.MonitorTablePtr = &Table;
- FM_AcquireTablePointers();
+ UtAssert_VOIDCALL(FM_AcquireTablePointers());
- UtAssert_NULL(FM_GlobalData.MonitorTablePtr);
+ UtAssert_NULL(FM_AppData.MonitorTablePtr);
}
void Test_FM_ReleaseTablePointers(void)
{
FM_MonitorTable_t Table;
- FM_GlobalData.MonitorTablePtr = &Table;
+ FM_AppData.MonitorTablePtr = &Table;
- FM_ReleaseTablePointers();
-
- UtAssert_NULL(FM_GlobalData.MonitorTablePtr);
+ UtAssert_VOIDCALL(FM_ReleaseTablePointers());
}
/*
@@ -437,10 +436,7 @@ void UtTest_Setup(void)
UtTest_Add(Test_FM_ValidateTable_NameTooLong, FM_Test_Setup, FM_Test_Teardown, "Test_FM_ValidateTable_NameTooLong");
- UtTest_Add(Test_FM_AcquireTablePointers_Success, FM_Test_Setup, FM_Test_Teardown,
- "Test_FM_AcquireTablePointers_Success");
-
+ UtTest_Add(Test_FM_AcquireTablePointers_Success, FM_Test_Setup, FM_Test_Teardown, "Test_FM_AcquireTablePointers_Success");
UtTest_Add(Test_FM_AcquireTablePointers_Fail, FM_Test_Setup, FM_Test_Teardown, "Test_FM_AcquireTablePointers_Fail");
-
UtTest_Add(Test_FM_ReleaseTablePointers, FM_Test_Setup, FM_Test_Teardown, "Test_FM_ReleaseTablePointers");
}
diff --git a/unit-test/stubs/fm_app_stubs.c b/unit-test/stubs/fm_app_stubs.c
index 25fe2f9..38f5c77 100644
--- a/unit-test/stubs/fm_app_stubs.c
+++ b/unit-test/stubs/fm_app_stubs.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -50,15 +49,3 @@ void FM_AppMain(void)
UT_GenStub_Execute(FM_AppMain, Basic, NULL);
}
-
-/*
- * ----------------------------------------------------
- * Generated stub function for FM_SendHkCmd()
- * ----------------------------------------------------
- */
-void FM_SendHkCmd(const CFE_SB_Buffer_t *BufPtr)
-{
- UT_GenStub_AddParam(FM_SendHkCmd, const CFE_SB_Buffer_t *, BufPtr);
-
- UT_GenStub_Execute(FM_SendHkCmd, Basic, NULL);
-}
diff --git a/unit-test/stubs/fm_child_stubs.c b/unit-test/stubs/fm_child_stubs.c
index f5d1519..a85bd49 100644
--- a/unit-test/stubs/fm_child_stubs.c
+++ b/unit-test/stubs/fm_child_stubs.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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/fm_cmd_utils_handlers.c b/unit-test/stubs/fm_cmd_utils_handlers.c
index 376a351..346747e 100644
--- a/unit-test/stubs/fm_cmd_utils_handlers.c
+++ b/unit-test/stubs/fm_cmd_utils_handlers.c
@@ -1,7 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
+ * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco"
*
- * Copyright (c) 2020 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/fm_cmd_utils_stubs.c b/unit-test/stubs/fm_cmd_utils_stubs.c
index a5f134c..ea58233 100644
--- a/unit-test/stubs/fm_cmd_utils_stubs.c
+++ b/unit-test/stubs/fm_cmd_utils_stubs.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -72,17 +71,17 @@ CFE_Status_t FM_GetDirectorySpaceEstimate(const char *Directory, uint64 *BlockCo
* Generated stub function for FM_GetFilenameState()
* ----------------------------------------------------
*/
-uint32 FM_GetFilenameState(const char *Filename, size_t BufferSize, bool FileInfoCmd)
+FM_FileNameStates_Enum_t FM_GetFilenameState(const char *Filename, size_t BufferSize, bool FileInfoCmd)
{
- UT_GenStub_SetupReturnBuffer(FM_GetFilenameState, uint32);
+ UT_GenStub_SetupReturnBuffer(FM_GetFilenameState, FM_FileNameStates_Enum_t);
UT_GenStub_AddParam(FM_GetFilenameState, const char *, Filename);
- UT_GenStub_AddParam(FM_GetFilenameState, uint32, BufferSize);
+ UT_GenStub_AddParam(FM_GetFilenameState, size_t, BufferSize);
UT_GenStub_AddParam(FM_GetFilenameState, bool, FileInfoCmd);
UT_GenStub_Execute(FM_GetFilenameState, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_GetFilenameState, uint32);
+ return UT_GenStub_GetReturnValue(FM_GetFilenameState, FM_FileNameStates_Enum_t);
}
/*
@@ -157,7 +156,7 @@ bool FM_VerifyDirExists(const char *Directory, size_t BufferSize, uint32 EventID
UT_GenStub_SetupReturnBuffer(FM_VerifyDirExists, bool);
UT_GenStub_AddParam(FM_VerifyDirExists, const char *, Directory);
- UT_GenStub_AddParam(FM_VerifyDirExists, uint32, BufferSize);
+ UT_GenStub_AddParam(FM_VerifyDirExists, size_t, BufferSize);
UT_GenStub_AddParam(FM_VerifyDirExists, uint32, EventID);
UT_GenStub_AddParam(FM_VerifyDirExists, const char *, CmdText);
@@ -176,7 +175,7 @@ bool FM_VerifyDirNoExist(const char *Name, size_t BufferSize, uint32 EventID, co
UT_GenStub_SetupReturnBuffer(FM_VerifyDirNoExist, bool);
UT_GenStub_AddParam(FM_VerifyDirNoExist, const char *, Name);
- UT_GenStub_AddParam(FM_VerifyDirNoExist, uint32, BufferSize);
+ UT_GenStub_AddParam(FM_VerifyDirNoExist, size_t, BufferSize);
UT_GenStub_AddParam(FM_VerifyDirNoExist, uint32, EventID);
UT_GenStub_AddParam(FM_VerifyDirNoExist, const char *, CmdText);
@@ -195,7 +194,7 @@ bool FM_VerifyFileClosed(const char *Filename, size_t BufferSize, uint32 EventID
UT_GenStub_SetupReturnBuffer(FM_VerifyFileClosed, bool);
UT_GenStub_AddParam(FM_VerifyFileClosed, const char *, Filename);
- UT_GenStub_AddParam(FM_VerifyFileClosed, uint32, BufferSize);
+ UT_GenStub_AddParam(FM_VerifyFileClosed, size_t, BufferSize);
UT_GenStub_AddParam(FM_VerifyFileClosed, uint32, EventID);
UT_GenStub_AddParam(FM_VerifyFileClosed, const char *, CmdText);
@@ -214,7 +213,7 @@ bool FM_VerifyFileExists(const char *Filename, size_t BufferSize, uint32 EventID
UT_GenStub_SetupReturnBuffer(FM_VerifyFileExists, bool);
UT_GenStub_AddParam(FM_VerifyFileExists, const char *, Filename);
- UT_GenStub_AddParam(FM_VerifyFileExists, uint32, BufferSize);
+ UT_GenStub_AddParam(FM_VerifyFileExists, size_t, BufferSize);
UT_GenStub_AddParam(FM_VerifyFileExists, uint32, EventID);
UT_GenStub_AddParam(FM_VerifyFileExists, const char *, CmdText);
@@ -233,7 +232,7 @@ bool FM_VerifyFileNoExist(const char *Filename, size_t BufferSize, uint32 EventI
UT_GenStub_SetupReturnBuffer(FM_VerifyFileNoExist, bool);
UT_GenStub_AddParam(FM_VerifyFileNoExist, const char *, Filename);
- UT_GenStub_AddParam(FM_VerifyFileNoExist, uint32, BufferSize);
+ UT_GenStub_AddParam(FM_VerifyFileNoExist, size_t, BufferSize);
UT_GenStub_AddParam(FM_VerifyFileNoExist, uint32, EventID);
UT_GenStub_AddParam(FM_VerifyFileNoExist, const char *, CmdText);
@@ -252,7 +251,7 @@ bool FM_VerifyFileNotOpen(const char *Filename, size_t BufferSize, uint32 EventI
UT_GenStub_SetupReturnBuffer(FM_VerifyFileNotOpen, bool);
UT_GenStub_AddParam(FM_VerifyFileNotOpen, const char *, Filename);
- UT_GenStub_AddParam(FM_VerifyFileNotOpen, uint32, BufferSize);
+ UT_GenStub_AddParam(FM_VerifyFileNotOpen, size_t, BufferSize);
UT_GenStub_AddParam(FM_VerifyFileNotOpen, uint32, EventID);
UT_GenStub_AddParam(FM_VerifyFileNotOpen, const char *, CmdText);
@@ -266,14 +265,14 @@ bool FM_VerifyFileNotOpen(const char *Filename, size_t BufferSize, uint32 EventI
* Generated stub function for FM_VerifyFileState()
* ----------------------------------------------------
*/
-bool FM_VerifyFileState(FM_File_States State, const char *Filename, size_t BufferSize, uint32 EventID,
+bool FM_VerifyFileState(FM_FileStates_Enum_t State, const char *Filename, size_t BufferSize, uint32 EventID,
const char *CmdText)
{
UT_GenStub_SetupReturnBuffer(FM_VerifyFileState, bool);
- UT_GenStub_AddParam(FM_VerifyFileState, FM_File_States, State);
+ UT_GenStub_AddParam(FM_VerifyFileState, FM_FileStates_Enum_t, State);
UT_GenStub_AddParam(FM_VerifyFileState, const char *, Filename);
- UT_GenStub_AddParam(FM_VerifyFileState, uint32, BufferSize);
+ UT_GenStub_AddParam(FM_VerifyFileState, size_t, BufferSize);
UT_GenStub_AddParam(FM_VerifyFileState, uint32, EventID);
UT_GenStub_AddParam(FM_VerifyFileState, const char *, CmdText);
@@ -287,18 +286,18 @@ bool FM_VerifyFileState(FM_File_States State, const char *Filename, size_t Buffe
* Generated stub function for FM_VerifyNameValid()
* ----------------------------------------------------
*/
-uint32 FM_VerifyNameValid(const char *Name, size_t BufferSize, uint32 EventID, const char *CmdText)
+FM_FileNameStates_Enum_t FM_VerifyNameValid(const char *Name, size_t BufferSize, uint32 EventID, const char *CmdText)
{
- UT_GenStub_SetupReturnBuffer(FM_VerifyNameValid, uint32);
+ UT_GenStub_SetupReturnBuffer(FM_VerifyNameValid, FM_FileNameStates_Enum_t);
UT_GenStub_AddParam(FM_VerifyNameValid, const char *, Name);
- UT_GenStub_AddParam(FM_VerifyNameValid, uint32, BufferSize);
+ UT_GenStub_AddParam(FM_VerifyNameValid, size_t, BufferSize);
UT_GenStub_AddParam(FM_VerifyNameValid, uint32, EventID);
UT_GenStub_AddParam(FM_VerifyNameValid, const char *, CmdText);
UT_GenStub_Execute(FM_VerifyNameValid, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_VerifyNameValid, uint32);
+ return UT_GenStub_GetReturnValue(FM_VerifyNameValid, FM_FileNameStates_Enum_t);
}
/*
diff --git a/unit-test/stubs/fm_cmds_stubs.c b/unit-test/stubs/fm_cmds_stubs.c
index 1699822..5ff7991 100644
--- a/unit-test/stubs/fm_cmds_stubs.c
+++ b/unit-test/stubs/fm_cmds_stubs.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,15 +30,15 @@
* Generated stub function for FM_ConcatFilesCmd()
* ----------------------------------------------------
*/
-bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_ConcatFilesCmd(const FM_ConcatFilesCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_ConcatFilesCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_ConcatFilesCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_ConcatFilesCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_ConcatFilesCmd, const FM_ConcatFilesCmd_t *, Msg);
UT_GenStub_Execute(FM_ConcatFilesCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_ConcatFilesCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_ConcatFilesCmd, CFE_Status_t);
}
/*
@@ -47,15 +46,15 @@ bool FM_ConcatFilesCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_CopyFileCmd()
* ----------------------------------------------------
*/
-bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_CopyFileCmd(const FM_CopyFileCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_CopyFileCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_CopyFileCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_CopyFileCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_CopyFileCmd, const FM_CopyFileCmd_t *, Msg);
UT_GenStub_Execute(FM_CopyFileCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_CopyFileCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_CopyFileCmd, CFE_Status_t);
}
/*
@@ -63,15 +62,15 @@ bool FM_CopyFileCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_CreateDirectoryCmd()
* ----------------------------------------------------
*/
-bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_CreateDirectoryCmd(const FM_CreateDirectoryCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_CreateDirectoryCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_CreateDirectoryCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_CreateDirectoryCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_CreateDirectoryCmd, const FM_CreateDirectoryCmd_t *, Msg);
UT_GenStub_Execute(FM_CreateDirectoryCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_CreateDirectoryCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_CreateDirectoryCmd, CFE_Status_t);
}
/*
@@ -79,15 +78,15 @@ bool FM_CreateDirectoryCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_DecompressFileCmd()
* ----------------------------------------------------
*/
-bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_DecompressFileCmd(const FM_DecompressFileCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_DecompressFileCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_DecompressFileCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_DecompressFileCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_DecompressFileCmd, const FM_DecompressFileCmd_t *, Msg);
UT_GenStub_Execute(FM_DecompressFileCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_DecompressFileCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_DecompressFileCmd, CFE_Status_t);
}
/*
@@ -95,15 +94,15 @@ bool FM_DecompressFileCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_DeleteAllFilesCmd()
* ----------------------------------------------------
*/
-bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_DeleteAllFilesCmd(const FM_DeleteAllFilesCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_DeleteAllFilesCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_DeleteAllFilesCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_DeleteAllFilesCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_DeleteAllFilesCmd, const FM_DeleteAllFilesCmd_t *, Msg);
UT_GenStub_Execute(FM_DeleteAllFilesCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_DeleteAllFilesCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_DeleteAllFilesCmd, CFE_Status_t);
}
/*
@@ -111,15 +110,15 @@ bool FM_DeleteAllFilesCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_DeleteDirectoryCmd()
* ----------------------------------------------------
*/
-bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_DeleteDirectoryCmd(const FM_DeleteDirectoryCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_DeleteDirectoryCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_DeleteDirectoryCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_DeleteDirectoryCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_DeleteDirectoryCmd, const FM_DeleteDirectoryCmd_t *, Msg);
UT_GenStub_Execute(FM_DeleteDirectoryCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_DeleteDirectoryCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_DeleteDirectoryCmd, CFE_Status_t);
}
/*
@@ -127,15 +126,15 @@ bool FM_DeleteDirectoryCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_DeleteFileCmd()
* ----------------------------------------------------
*/
-bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_DeleteFileCmd(const FM_DeleteFileCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_DeleteFileCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_DeleteFileCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_DeleteFileCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_DeleteFileCmd, const FM_DeleteFileCmd_t *, Msg);
UT_GenStub_Execute(FM_DeleteFileCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_DeleteFileCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_DeleteFileCmd, CFE_Status_t);
}
/*
@@ -143,15 +142,15 @@ bool FM_DeleteFileCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_GetDirListFileCmd()
* ----------------------------------------------------
*/
-bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_GetDirListFileCmd(const FM_GetDirListFileCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_GetDirListFileCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_GetDirListFileCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_GetDirListFileCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_GetDirListFileCmd, const FM_GetDirListFileCmd_t *, Msg);
UT_GenStub_Execute(FM_GetDirListFileCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_GetDirListFileCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_GetDirListFileCmd, CFE_Status_t);
}
/*
@@ -159,15 +158,15 @@ bool FM_GetDirListFileCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_GetDirListPktCmd()
* ----------------------------------------------------
*/
-bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_GetDirListPktCmd(const FM_GetDirListPktCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_GetDirListPktCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_GetDirListPktCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_GetDirListPktCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_GetDirListPktCmd, const FM_GetDirListPktCmd_t *, Msg);
UT_GenStub_Execute(FM_GetDirListPktCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_GetDirListPktCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_GetDirListPktCmd, CFE_Status_t);
}
/*
@@ -175,15 +174,15 @@ bool FM_GetDirListPktCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_GetFileInfoCmd()
* ----------------------------------------------------
*/
-bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_GetFileInfoCmd(const FM_GetFileInfoCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_GetFileInfoCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_GetFileInfoCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_GetFileInfoCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_GetFileInfoCmd, const FM_GetFileInfoCmd_t *, Msg);
UT_GenStub_Execute(FM_GetFileInfoCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_GetFileInfoCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_GetFileInfoCmd, CFE_Status_t);
}
/*
@@ -191,15 +190,15 @@ bool FM_GetFileInfoCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_GetOpenFilesCmd()
* ----------------------------------------------------
*/
-bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_GetOpenFilesCmd(const FM_GetOpenFilesCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_GetOpenFilesCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_GetOpenFilesCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_GetOpenFilesCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_GetOpenFilesCmd, const FM_GetOpenFilesCmd_t *, Msg);
UT_GenStub_Execute(FM_GetOpenFilesCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_GetOpenFilesCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_GetOpenFilesCmd, CFE_Status_t);
}
/*
@@ -207,15 +206,15 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_MonitorFilesystemSpaceCmd()
* ----------------------------------------------------
*/
-bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_MonitorFilesystemSpaceCmd(const FM_MonitorFilesystemSpaceCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_MonitorFilesystemSpaceCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_MonitorFilesystemSpaceCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_MonitorFilesystemSpaceCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_MonitorFilesystemSpaceCmd, const FM_MonitorFilesystemSpaceCmd_t *, Msg);
UT_GenStub_Execute(FM_MonitorFilesystemSpaceCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_MonitorFilesystemSpaceCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_MonitorFilesystemSpaceCmd, CFE_Status_t);
}
/*
@@ -223,15 +222,15 @@ bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_MoveFileCmd()
* ----------------------------------------------------
*/
-bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_MoveFileCmd(const FM_MoveFileCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_MoveFileCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_MoveFileCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_MoveFileCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_MoveFileCmd, const FM_MoveFileCmd_t *, Msg);
UT_GenStub_Execute(FM_MoveFileCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_MoveFileCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_MoveFileCmd, CFE_Status_t);
}
/*
@@ -239,15 +238,15 @@ bool FM_MoveFileCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_NoopCmd()
* ----------------------------------------------------
*/
-bool FM_NoopCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_NoopCmd(const FM_NoopCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_NoopCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_NoopCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_NoopCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_NoopCmd, const FM_NoopCmd_t *, Msg);
UT_GenStub_Execute(FM_NoopCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_NoopCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_NoopCmd, CFE_Status_t);
}
/*
@@ -255,15 +254,15 @@ bool FM_NoopCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_RenameFileCmd()
* ----------------------------------------------------
*/
-bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_RenameFileCmd(const FM_RenameFileCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_RenameFileCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_RenameFileCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_RenameFileCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_RenameFileCmd, const FM_RenameFileCmd_t *, Msg);
UT_GenStub_Execute(FM_RenameFileCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_RenameFileCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_RenameFileCmd, CFE_Status_t);
}
/*
@@ -271,15 +270,31 @@ bool FM_RenameFileCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_ResetCountersCmd()
* ----------------------------------------------------
*/
-bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_ResetCountersCmd(const FM_ResetCountersCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_ResetCountersCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_ResetCountersCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_ResetCountersCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_ResetCountersCmd, const FM_ResetCountersCmd_t *, Msg);
UT_GenStub_Execute(FM_ResetCountersCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_ResetCountersCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_ResetCountersCmd, CFE_Status_t);
+}
+
+/*
+ * ----------------------------------------------------
+ * Generated stub function for FM_SendHkCmd()
+ * ----------------------------------------------------
+ */
+CFE_Status_t FM_SendHkCmd(const FM_SendHkCmd_t *Msg)
+{
+ UT_GenStub_SetupReturnBuffer(FM_SendHkCmd, CFE_Status_t);
+
+ UT_GenStub_AddParam(FM_SendHkCmd, const FM_SendHkCmd_t *, Msg);
+
+ UT_GenStub_Execute(FM_SendHkCmd, Basic, NULL);
+
+ return UT_GenStub_GetReturnValue(FM_SendHkCmd, CFE_Status_t);
}
/*
@@ -287,15 +302,15 @@ bool FM_ResetCountersCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_SetPermissionsCmd()
* ----------------------------------------------------
*/
-bool FM_SetPermissionsCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_SetPermissionsCmd(const FM_SetPermissionsCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_SetPermissionsCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_SetPermissionsCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_SetPermissionsCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_SetPermissionsCmd, const FM_SetPermissionsCmd_t *, Msg);
UT_GenStub_Execute(FM_SetPermissionsCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_SetPermissionsCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_SetPermissionsCmd, CFE_Status_t);
}
/*
@@ -303,13 +318,13 @@ bool FM_SetPermissionsCmd(const CFE_SB_Buffer_t *BufPtr)
* Generated stub function for FM_SetTableStateCmd()
* ----------------------------------------------------
*/
-bool FM_SetTableStateCmd(const CFE_SB_Buffer_t *BufPtr)
+CFE_Status_t FM_SetTableStateCmd(const FM_SetTableStateCmd_t *Msg)
{
- UT_GenStub_SetupReturnBuffer(FM_SetTableStateCmd, bool);
+ UT_GenStub_SetupReturnBuffer(FM_SetTableStateCmd, CFE_Status_t);
- UT_GenStub_AddParam(FM_SetTableStateCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_SetTableStateCmd, const FM_SetTableStateCmd_t *, Msg);
UT_GenStub_Execute(FM_SetTableStateCmd, Basic, NULL);
- return UT_GenStub_GetReturnValue(FM_SetTableStateCmd, bool);
+ return UT_GenStub_GetReturnValue(FM_SetTableStateCmd, CFE_Status_t);
}
diff --git a/unit-test/stubs/fm_compression_stubs.c b/unit-test/stubs/fm_compression_stubs.c
index e6ce024..2b8e6f8 100644
--- a/unit-test/stubs/fm_compression_stubs.c
+++ b/unit-test/stubs/fm_compression_stubs.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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/fm_dispatch_stubs.c b/unit-test/stubs/fm_dispatch_stubs.c
index 1927dca..b2a943d 100644
--- a/unit-test/stubs/fm_dispatch_stubs.c
+++ b/unit-test/stubs/fm_dispatch_stubs.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -28,43 +27,41 @@
/*
* ----------------------------------------------------
- * Generated stub function for FM_IsValidCmdPktLength()
+ * Generated stub function for FM_ProcessGroundCommand()
* ----------------------------------------------------
*/
-bool FM_IsValidCmdPktLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength, uint32 EventID, const char *CmdText)
+void FM_ProcessGroundCommand(const CFE_SB_Buffer_t *BufPtr)
{
- UT_GenStub_SetupReturnBuffer(FM_IsValidCmdPktLength, bool);
+ UT_GenStub_AddParam(FM_ProcessGroundCommand, const CFE_SB_Buffer_t *, BufPtr);
- UT_GenStub_AddParam(FM_IsValidCmdPktLength, const CFE_MSG_Message_t *, MsgPtr);
- UT_GenStub_AddParam(FM_IsValidCmdPktLength, size_t, ExpectedLength);
- UT_GenStub_AddParam(FM_IsValidCmdPktLength, uint32, EventID);
- UT_GenStub_AddParam(FM_IsValidCmdPktLength, const char *, CmdText);
-
- UT_GenStub_Execute(FM_IsValidCmdPktLength, Basic, NULL);
-
- return UT_GenStub_GetReturnValue(FM_IsValidCmdPktLength, bool);
+ UT_GenStub_Execute(FM_ProcessGroundCommand, Basic, NULL);
}
/*
* ----------------------------------------------------
- * Generated stub function for FM_ProcessCmd()
+ * Generated stub function for FM_TaskPipe()
* ----------------------------------------------------
*/
-void FM_ProcessCmd(const CFE_SB_Buffer_t *BufPtr)
+void FM_TaskPipe(const CFE_SB_Buffer_t *BufPtr)
{
- UT_GenStub_AddParam(FM_ProcessCmd, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_AddParam(FM_TaskPipe, const CFE_SB_Buffer_t *, BufPtr);
- UT_GenStub_Execute(FM_ProcessCmd, Basic, NULL);
+ UT_GenStub_Execute(FM_TaskPipe, Basic, NULL);
}
/*
* ----------------------------------------------------
- * Generated stub function for FM_ProcessPkt()
+ * Generated stub function for FM_VerifyCmdLength()
* ----------------------------------------------------
*/
-void FM_ProcessPkt(const CFE_SB_Buffer_t *BufPtr)
+bool FM_VerifyCmdLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength)
{
- UT_GenStub_AddParam(FM_ProcessPkt, const CFE_SB_Buffer_t *, BufPtr);
+ UT_GenStub_SetupReturnBuffer(FM_VerifyCmdLength, bool);
+
+ UT_GenStub_AddParam(FM_VerifyCmdLength, const CFE_MSG_Message_t *, MsgPtr);
+ UT_GenStub_AddParam(FM_VerifyCmdLength, size_t, ExpectedLength);
+
+ UT_GenStub_Execute(FM_VerifyCmdLength, Basic, NULL);
- UT_GenStub_Execute(FM_ProcessPkt, Basic, NULL);
+ return UT_GenStub_GetReturnValue(FM_VerifyCmdLength, bool);
}
diff --git a/unit-test/stubs/fm_global_stubs.c b/unit-test/stubs/fm_global_stubs.c
index 86e600a..49b41c5 100644
--- a/unit-test/stubs/fm_global_stubs.c
+++ b/unit-test/stubs/fm_global_stubs.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,4 +24,4 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-FM_GlobalData_t FM_GlobalData;
+FM_AppData_t FM_AppData;
diff --git a/unit-test/stubs/fm_tbl_stubs.c b/unit-test/stubs/fm_table_utils_stubs.c
similarity index 91%
rename from unit-test/stubs/fm_tbl_stubs.c
rename to unit-test/stubs/fm_table_utils_stubs.c
index b2cdb76..e6434fa 100644
--- a/unit-test/stubs/fm_tbl_stubs.c
+++ b/unit-test/stubs/fm_table_utils_stubs.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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,10 +19,10 @@
/**
* @file
*
- * Auto-Generated stub implementations for functions defined in fm_tbl header
+ * Auto-Generated stub implementations for functions defined in fm_table_utils header
*/
-#include "fm_tbl.h"
+#include "fm_table_utils.h"
#include "utgenstub.h"
/*
diff --git a/unit-test/utilities/fm_test_utils.c b/unit-test/utilities/fm_test_utils.c
index 42059fc..6b65398 100644
--- a/unit-test/utilities/fm_test_utils.c
+++ b/unit-test/utilities/fm_test_utils.c
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -22,6 +21,7 @@
* Test utility implementations
*/
#include
+#include
#include "fm_app.h"
/* UT includes */
@@ -34,8 +34,6 @@
#define UT_MAX_SENDEVENT_DEPTH 4
CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent[UT_MAX_SENDEVENT_DEPTH];
-UT_CmdBuf_t UT_CmdBuf;
-
void UT_Handler_CFE_EVS_SendEvent(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context, va_list va)
{
uint16 CallCount;
@@ -60,13 +58,27 @@ void UT_Handler_CFE_EVS_SendEvent(void *UserObj, UT_EntryKey_t FuncKey, const UT
}
}
+void FM_Test_Verify_Event(uint8 IssuedOrder, uint16 EventId, uint16 EventType, const char* EventText)
+{
+ CFE_EVS_SendEvent_context_t *ctxt = &context_CFE_EVS_SendEvent[IssuedOrder];
+
+ UtAssert_INT32_EQ(ctxt->EventID, EventId);
+ UtAssert_INT32_EQ(ctxt->EventType, EventType);
+
+ UtAssert_StrnCmp(EventText,
+ ctxt->Spec,
+ CFE_MISSION_EVS_MAX_MESSAGE_LENGTH,
+ "Event string expected: '%s'\nEvent string received: '%s'",
+ EventText,
+ ctxt->Spec);
+}
+
void FM_Test_Setup(void)
{
UT_ResetState(0);
- memset(&FM_GlobalData, 0, sizeof(FM_GlobalData));
+ memset(&FM_AppData, 0, sizeof(FM_AppData));
memset(context_CFE_EVS_SendEvent, 0, sizeof(context_CFE_EVS_SendEvent));
- memset(&UT_CmdBuf, 0, sizeof(UT_CmdBuf));
/* Register custom handlers */
UT_SetVaHandlerFunction(UT_KEY(CFE_EVS_SendEvent), UT_Handler_CFE_EVS_SendEvent, NULL);
diff --git a/unit-test/utilities/fm_test_utils.h b/unit-test/utilities/fm_test_utils.h
index eed6ff8..09ece84 100644
--- a/unit-test/utilities/fm_test_utils.h
+++ b/unit-test/utilities/fm_test_utils.h
@@ -1,8 +1,7 @@
/************************************************************************
- * NASA Docket No. GSC-18,918-1, and identified as “Core Flight
- * Software System (cFS) File Manager Application Version 2.6.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.
*
@@ -28,6 +27,18 @@
#include "fm_msg.h"
#include "utstubs.h"
+/* ====== */
+/* Macros */
+/* ====== */
+
+#define ADD_TEST(test) UtTest_Add(test, FM_Test_Setup, FM_Test_Teardown, #test)
+#define FM_UT_OBJID_1 OS_ObjectIdFromInteger(1)
+#define FM_UT_OBJID_2 OS_ObjectIdFromInteger(2)
+
+/* ======== */
+/* Typedefs */
+/* ======== */
+
typedef struct
{
uint16 EventID;
@@ -37,36 +48,11 @@ typedef struct
extern CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent[];
-/* Command buffer typedef for any handler */
-typedef union
-{
- CFE_SB_Buffer_t Buf;
- FM_SendHkCmd_t SendHkCmd;
- FM_NoopCmd_t NoopCmd;
- FM_ResetCountersCmd_t ResetCountersCmd;
- FM_CopyFileCmd_t CopyFileCmd;
- FM_MoveFileCmd_t MoveFileCmd;
- FM_RenameFileCmd_t RenameFileCmd;
- FM_DeleteFileCmd_t DeleteFileCmd;
- FM_DeleteAllFilesCmd_t DeleteAllFilesCmd;
- FM_DecompressFileCmd_t DecompressFileCmd;
- FM_ConcatFilesCmd_t ConcatFilesCmd;
- FM_GetFileInfoCmd_t GetFileInfoCmd;
- FM_GetOpenFilesCmd_t GetOpenFilesCmd;
- FM_CreateDirectoryCmd_t CreateDirectoryCmd;
- FM_DeleteDirectoryCmd_t DeleteDirectoryCmd;
- FM_GetDirListFileCmd_t GetDirListFileCmd;
- FM_GetDirListPktCmd_t GetDirListPktCmd;
- FM_MonitorFilesystemSpaceCmd_t GetFreeSpaceCmd;
- FM_SetTableStateCmd_t SetTableStateCmd;
- FM_SetPermissionsCmd_t SetPermissionsCmd;
-} UT_CmdBuf_t;
-
-extern UT_CmdBuf_t UT_CmdBuf;
+/* =================== */
+/* Function Prototypes */
+/* =================== */
-/* Unit test osal ID, generic w/ no type */
-#define FM_UT_OBJID_1 OS_ObjectIdFromInteger(1)
-#define FM_UT_OBJID_2 OS_ObjectIdFromInteger(2)
+void FM_Test_Verify_Event(uint8 IssuedOrder, uint16 EventId, uint16 EventType, const char* EventText);
void FM_Test_Setup(void);