From 91143ba2332a38b3a155ef792022af8501edbcd4 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 18 Sep 2026 13:17:18 -0400 Subject: [PATCH 1/3] Fix #521, command compatibility layer for CF Adds an argument translator for CF commands using the previous definitions. All commands which had the definition modified as part of #516 are changed to point at a compatibility shim instead of invoking the command directly. New (temporary) command codes are added to invoke the "non-shim" command directly. This should all be considered deprecated from the start and removed in a future update. This is purely to preserve compatibility with existing scripts. --- CMakeLists.txt | 1 + config/default_cf_fcncode_values.h | 69 ++-- config/default_cf_msgdefs.h | 78 +++++ config/default_cf_msgstruct.h | 187 +++++++++++ fsw/inc/cf_fcncodes.h | 57 ++-- fsw/src/cf_cmd_compat.c | 456 ++++++++++++++++++++++++++ fsw/src/cf_cmd_compat.h | 232 +++++++++++++ fsw/src/cf_dispatch.c | 122 ++++--- unit-test/CMakeLists.txt | 38 ++- unit-test/cf_dispatch_tests.c | 5 +- unit-test/stubs/cf_cmd_compat_stubs.c | 299 +++++++++++++++++ 11 files changed, 1443 insertions(+), 101 deletions(-) create mode 100644 fsw/src/cf_cmd_compat.c create mode 100644 fsw/src/cf_cmd_compat.h create mode 100644 unit-test/stubs/cf_cmd_compat_stubs.c diff --git a/CMakeLists.txt b/CMakeLists.txt index afe3f570..5a6fd3c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ if (CFE_EDS_ENABLED) list(APPEND APP_SRC_FILES fsw/src/cf_eds_dispatch.c) else() list(APPEND APP_SRC_FILES fsw/src/cf_dispatch.c) + list(APPEND APP_SRC_FILES fsw/src/cf_cmd_compat.c) endif() # Create the app module diff --git a/config/default_cf_fcncode_values.h b/config/default_cf_fcncode_values.h index 6193c599..8c142809 100644 --- a/config/default_cf_fcncode_values.h +++ b/config/default_cf_fcncode_values.h @@ -35,28 +35,55 @@ #define CF_CCVAL(x) CF_FunctionCode_##x +/* + * For the interim release, the pre-existing function codes will point + * to the compatibility shim for CF commands. This shim will convert the + * arguments into the new form and invoke the new command. The new commands + * have the command code shifted up by 30. + */ enum CF_FunctionCode { - CF_FunctionCode_NOOP = 0, - CF_FunctionCode_RESET_COUNTERS = 1, - CF_FunctionCode_TX_FILE = 2, - CF_FunctionCode_PLAYBACK_DIR = 3, - CF_FunctionCode_FREEZE = 4, - CF_FunctionCode_THAW = 5, - CF_FunctionCode_SUSPEND = 6, - CF_FunctionCode_RESUME = 7, - CF_FunctionCode_CANCEL = 8, - CF_FunctionCode_ABANDON = 9, - CF_FunctionCode_SET_PARAM = 10, - CF_FunctionCode_GET_PARAM = 11, - CF_FunctionCode_WRITE_QUEUE = 15, - CF_FunctionCode_ENABLE_DEQUEUE = 16, - CF_FunctionCode_DISABLE_DEQUEUE = 17, - CF_FunctionCode_ENABLE_DIR_POLLING = 18, - CF_FunctionCode_DISABLE_DIR_POLLING = 19, - CF_FunctionCode_PURGE_QUEUE = 21, - CF_FunctionCode_ENABLE_ENGINE = 22, - CF_FunctionCode_DISABLE_ENGINE = 23, + CF_FunctionCode_NOOP = 0, + CF_FunctionCode_RESET_COUNTERS_COMPAT = 1, + CF_FunctionCode_TX_FILE_COMPAT = 2, + CF_FunctionCode_PLAYBACK_DIR_COMPAT = 3, + CF_FunctionCode_FREEZE_COMPAT = 4, + CF_FunctionCode_THAW_COMPAT = 5, + CF_FunctionCode_SUSPEND_COMPAT = 6, + CF_FunctionCode_RESUME_COMPAT = 7, + CF_FunctionCode_CANCEL_COMPAT = 8, + CF_FunctionCode_ABANDON_COMPAT = 9, + CF_FunctionCode_SET_PARAM_COMPAT = 10, + CF_FunctionCode_GET_PARAM_COMPAT = 11, + CF_FunctionCode_WRITE_QUEUE_COMPAT = 15, + CF_FunctionCode_ENABLE_DEQUEUE_COMPAT = 16, + CF_FunctionCode_DISABLE_DEQUEUE_COMPAT = 17, + CF_FunctionCode_ENABLE_DIR_POLLING_COMPAT = 18, + CF_FunctionCode_DISABLE_DIR_POLLING_COMPAT = 19, + CF_FunctionCode_PURGE_QUEUE_COMPAT = 21, + + /* NOTE: these commands did not change (they have no args) */ + CF_FunctionCode_ENABLE_ENGINE = 22, + CF_FunctionCode_DISABLE_ENGINE = 23, + + CF_FunctionCode_RESET_COUNTERS = 31, + CF_FunctionCode_TX_FILE = 32, + CF_FunctionCode_PLAYBACK_DIR = 33, + CF_FunctionCode_FREEZE = 34, + CF_FunctionCode_THAW = 35, + CF_FunctionCode_SUSPEND = 36, + CF_FunctionCode_RESUME = 37, + CF_FunctionCode_CANCEL = 38, + CF_FunctionCode_ABANDON = 39, + CF_FunctionCode_SET_PARAM = 40, + CF_FunctionCode_GET_PARAM = 41, + CF_FunctionCode_WRITE_QUEUE = 45, + CF_FunctionCode_ENABLE_DEQUEUE = 46, + CF_FunctionCode_DISABLE_DEQUEUE = 47, + CF_FunctionCode_ENABLE_DIR_POLLING = 48, + CF_FunctionCode_DISABLE_DIR_POLLING = 49, + CF_FunctionCode_PURGE_QUEUE = 51, + }; -#endif \ No newline at end of file +#endif diff --git a/config/default_cf_msgdefs.h b/config/default_cf_msgdefs.h index 0074d55d..8b383f08 100644 --- a/config/default_cf_msgdefs.h +++ b/config/default_cf_msgdefs.h @@ -211,6 +211,16 @@ typedef struct CF_EotPacket_Payload * \{ */ +/** + * \brief Command payload argument union to support 4 uint8's, 2 uint16's or 1 uint32 + */ +typedef union CF_UnionArgs_CompatPayload +{ + uint32 dword; /**< \brief Generic uint32 argument */ + uint16 hword[2]; /**< \brief Generic uint16 array of arguments */ + uint8 byte[4]; /**< \brief Generic uint8 array of arguments */ +} CF_UnionArgs_CompatPayload_t; + /** * \brief Enum labels for use for Reset cmd */ @@ -335,6 +345,17 @@ typedef struct CF_GetParam_Payload CF_ChannelSelect_t chan_num; /**< \brief Channel number */ } CF_GetParam_Payload_t; +/** + * \brief Get parameter command structure + * + * For command details see #CF_GET_PARAM_CC + */ +typedef struct CF_GetParam_CompatPayload +{ + uint8 key; /**< \brief Parameter key, see #CF_GetSet_ValueID_t */ + uint8 chan_num; /**< \brief Channel number */ +} CF_GetParam_CompatPayload_t; + /** * \brief Set parameter command structure * @@ -348,6 +369,19 @@ typedef struct CF_SetParam_Payload uint8 spare[2]; /**< \brief Alignment spare, uint32 multiple */ } CF_SetParam_Payload_t; +/** + * \brief Set parameter command structure + * + * For command details see #CF_SET_PARAM_CC + */ +typedef struct CF_SetParam_CompatPayload +{ + uint32 value; /**< \brief Parameter value to set */ + uint8 key; /**< \brief Parameter key, see #CF_GetSet_ValueID_t */ + uint8 chan_num; /**< \brief Channel number */ + uint8 spare[2]; /**< \brief Alignment spare, uint32 multiple */ +} CF_SetParam_CompatPayload_t; + /** * \brief Transmit file command structure * @@ -364,6 +398,22 @@ typedef struct CF_TxFile_Payload char dst_filename[CF_FILENAME_MAX_LEN]; /**< \brief Destination file/directory name */ } CF_TxFile_Payload_t; +/** + * \brief Transmit file command structure + * + * For command details see #CF_TX_FILE_CC + */ +typedef struct CF_TxFile_CompatPayload +{ + uint8 cfdp_class; /**< \brief CFDP class: 0=class 1, 1=class 2 */ + uint8 keep; /**< \brief Keep file flag: 1=keep, else delete */ + uint8 chan_num; /**< \brief Channel number */ + uint8 priority; /**< \brief Priority: 0=highest priority */ + CF_EntityId_t dest_id; /**< \brief Destination entity id */ + char src_filename[CF_FILENAME_MAX_LEN]; /**< \brief Source file/directory name */ + char dst_filename[CF_FILENAME_MAX_LEN]; /**< \brief Destination file/directory name */ +} CF_TxFile_CompatPayload_t; + /** * \brief Write Queue command structure * @@ -379,6 +429,21 @@ typedef struct CF_WriteQueue_Payload char filename[CF_FILENAME_MAX_LEN]; /**< \brief Filename written to */ } CF_WriteQueue_Payload_t; +/** + * \brief Write Queue command structure + * + * For command details see #CF_WRITE_QUEUE_CC + */ +typedef struct CF_WriteQueue_CompatPayload +{ + uint8 type; /**< \brief Transaction direction: all=0, up=1, down=2 */ + uint8 chan; /**< \brief Channel number */ + uint8 queue; /**< \brief Queue type: 0=pending, 1=active, 2=history, 3=all */ + uint8 spare; /**< \brief Alignment spare, puts filename on 32-bit boundary */ + + char filename[CF_FILENAME_MAX_LEN]; /**< \brief Filename written to */ +} CF_WriteQueue_CompatPayload_t; + /** * \brief Transaction command structure * @@ -394,6 +459,19 @@ typedef struct CF_Transaction_Payload uint8 spare[2]; /**< \brief Alignment spare for 32-bit multiple */ } CF_Transaction_Payload_t; +/** + * \brief Transaction command structure + * + * For command details see #CF_SUSPEND_CC, #CF_RESUME_CC, #CF_CANCEL_CC, #CF_ABANDON_CC + */ +typedef struct CF_Transaction_CompatPayload +{ + CF_TransactionSeq_t ts; /**< \brief Transaction sequence number */ + CF_EntityId_t eid; /**< \brief Entity id */ + uint8 chan; /**< \brief Channel number: 254=use ts, 255=all channels, else channel */ + uint8 spare[3]; /**< \brief Alignment spare for 32-bit multiple */ +} CF_Transaction_CompatPayload_t; + /**\}*/ /** diff --git a/config/default_cf_msgstruct.h b/config/default_cf_msgstruct.h index dd60de22..e988c459 100644 --- a/config/default_cf_msgstruct.h +++ b/config/default_cf_msgstruct.h @@ -107,6 +107,17 @@ typedef struct CF_ResetCountersCmd CF_ResetCountersCmd_Payload_t Payload; /**< \brief Command arguments */ } CF_ResetCountersCmd_t; +/** + * \brief Reset command structure + * + * For command details see #CF_RESET_CC + */ +typedef struct CF_ResetCountersCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_UnionArgs_CompatPayload_t Payload; /**< \brief Generic command arguments */ +} CF_ResetCountersCompatCmd_t; + /** * \brief Freeze command structure * @@ -118,6 +129,17 @@ typedef struct CF_FreezeCmd CF_ChannelSelect_Payload_t Payload; /**< \brief Command arguments */ } CF_FreezeCmd_t; +/** + * \brief Freeze command structure + * + * For command details see #CF_FREEZE_CC + */ +typedef struct CF_FreezeCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_UnionArgs_CompatPayload_t Payload; /**< \brief Generic command arguments */ +} CF_FreezeCompatCmd_t; + /** * \brief Thaw command structure * @@ -129,6 +151,17 @@ typedef struct CF_ThawCmd CF_ChannelSelect_Payload_t Payload; /**< \brief Command arguments */ } CF_ThawCmd_t; +/** + * \brief Thaw command structure + * + * For command details see #CF_THAW_CC + */ +typedef struct CF_ThawCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_UnionArgs_CompatPayload_t Payload; /**< \brief Generic command arguments */ +} CF_ThawCompatCmd_t; + /** * \brief EnableDequeue command structure * @@ -140,6 +173,17 @@ typedef struct CF_EnableDequeueCmd CF_ChannelSelect_Payload_t Payload; /**< \brief Command arguments */ } CF_EnableDequeueCmd_t; +/** + * \brief EnableDequeue command structure + * + * For command details see #CF_ENABLE_DEQUEUE_CC + */ +typedef struct CF_EnableDequeueCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_UnionArgs_CompatPayload_t Payload; /**< \brief Generic command arguments */ +} CF_EnableDequeueCompatCmd_t; + /** * \brief DisableDequeue command structure * @@ -151,6 +195,17 @@ typedef struct CF_DisableDequeueCmd CF_ChannelSelect_Payload_t Payload; /**< \brief Command arguments */ } CF_DisableDequeueCmd_t; +/** + * \brief DisableDequeue command structure + * + * For command details see #CF_DISABLE_DEQUEUE_CC + */ +typedef struct CF_DisableDequeueCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_UnionArgs_CompatPayload_t Payload; /**< \brief Generic command arguments */ +} CF_DisableDequeueCompatCmd_t; + /** * \brief EnableDirPolling command structure * @@ -162,6 +217,17 @@ typedef struct CF_EnableDirPollingCmd CF_PollDirSelect_Payload_t Payload; /**< \brief Command arguments */ } CF_EnableDirPollingCmd_t; +/** + * \brief EnableDirPolling command structure + * + * For command details see #CF_ENABLE_DIR_POLLING_CC + */ +typedef struct CF_EnableDirPollingCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_UnionArgs_CompatPayload_t Payload; /**< \brief Generic command arguments */ +} CF_EnableDirPollingCompatCmd_t; + /** * \brief DisableDirPolling command structure * @@ -173,6 +239,17 @@ typedef struct CF_DisableDirPollingCmd CF_PollDirSelect_Payload_t Payload; /**< \brief Command arguments */ } CF_DisableDirPollingCmd_t; +/** + * \brief DisableDirPolling command structure + * + * For command details see #CF_DISABLE_DIR_POLLING_CC + */ +typedef struct CF_DisableDirPollingCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_UnionArgs_CompatPayload_t Payload; /**< \brief Generic command arguments */ +} CF_DisableDirPollingCompatCmd_t; + /** * \brief PurgeQueue command structure * @@ -184,6 +261,17 @@ typedef struct CF_PurgeQueueCmd CF_QueueSelect_Payload_t Payload; /**< \brief Command arguments */ } CF_PurgeQueueCmd_t; +/** + * \brief PurgeQueue command structure + * + * For command details see #CF_PURGE_QUEUE_CC + */ +typedef struct CF_PurgeQueueCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_UnionArgs_CompatPayload_t Payload; /**< \brief Generic command arguments */ +} CF_PurgeQueueCompatCmd_t; + /** * \brief Get parameter command structure * @@ -195,6 +283,17 @@ typedef struct CF_GetParamCmd CF_GetParam_Payload_t Payload; } CF_GetParamCmd_t; +/** + * \brief Get parameter command structure + * + * For command details see #CF_GET_PARAM_CC + */ +typedef struct CF_GetParamCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_GetParam_CompatPayload_t Payload; +} CF_GetParamCompatCmd_t; + /** * \brief Set parameter command structure * @@ -206,6 +305,17 @@ typedef struct CF_SetParamCmd CF_SetParam_Payload_t Payload; } CF_SetParamCmd_t; +/** + * \brief Set parameter command structure + * + * For command details see #CF_SET_PARAM_CC + */ +typedef struct CF_SetParamCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_SetParam_CompatPayload_t Payload; +} CF_SetParamCompatCmd_t; + /** * \brief Transmit file command structure * @@ -217,6 +327,17 @@ typedef struct CF_TxFileCmd CF_TxFile_Payload_t Payload; } CF_TxFileCmd_t; +/** + * \brief Transmit file command structure + * + * For command details see #CF_TX_FILE_CC + */ +typedef struct CF_TxFileCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_TxFile_CompatPayload_t Payload; +} CF_TxFileCompatCmd_t; + /** * \brief Write Queue command structure * @@ -228,6 +349,17 @@ typedef struct CF_WriteQueueCmd CF_WriteQueue_Payload_t Payload; } CF_WriteQueueCmd_t; +/** + * \brief Write Queue command structure + * + * For command details see #CF_WRITE_QUEUE_CC + */ +typedef struct CF_WriteQueueCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_WriteQueue_CompatPayload_t Payload; +} CF_WriteQueueCompatCmd_t; + /** * \brief Playback directory command structure * @@ -239,6 +371,17 @@ typedef struct CF_PlaybackDirCmd CF_TxFile_Payload_t Payload; } CF_PlaybackDirCmd_t; +/** + * \brief Playback directory command structure + * + * For command details see #CF_PLAYBACK_DIR_CC + */ +typedef struct CF_PlaybackDirCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_TxFile_CompatPayload_t Payload; +} CF_PlaybackDirCompatCmd_t; + /** * \brief Suspend command structure * @@ -250,6 +393,17 @@ typedef struct CF_SuspendCmd CF_Transaction_Payload_t Payload; } CF_SuspendCmd_t; +/** + * \brief Suspend command structure + * + * For command details see #CF_SUSPEND_CC + */ +typedef struct CF_SuspendCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_Transaction_CompatPayload_t Payload; +} CF_SuspendCompatCmd_t; + /** * \brief Resume command structure * @@ -261,6 +415,17 @@ typedef struct CF_ResumeCmd CF_Transaction_Payload_t Payload; } CF_ResumeCmd_t; +/** + * \brief Resume command structure + * + * For command details see #CF_RESUME_CC + */ +typedef struct CF_ResumeCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_Transaction_CompatPayload_t Payload; +} CF_ResumeCompatCmd_t; + /** * \brief Cancel command structure * @@ -272,6 +437,17 @@ typedef struct CF_CancelCmd CF_Transaction_Payload_t Payload; } CF_CancelCmd_t; +/** + * \brief Cancel command structure + * + * For command details see #CF_CANCEL_CC + */ +typedef struct CF_CancelCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_Transaction_CompatPayload_t Payload; +} CF_CancelCompatCmd_t; + /** * \brief Abandon command structure * @@ -283,6 +459,17 @@ typedef struct CF_AbandonCmd CF_Transaction_Payload_t Payload; } CF_AbandonCmd_t; +/** + * \brief Abandon command structure + * + * For command details see #CF_ABANDON_CC + */ +typedef struct CF_AbandonCompatCmd +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ + CF_Transaction_CompatPayload_t Payload; +} CF_AbandonCompatCmd_t; + /** * \brief Send Housekeeping Command * diff --git a/fsw/inc/cf_fcncodes.h b/fsw/inc/cf_fcncodes.h index e3c3a3ce..f2c4b703 100644 --- a/fsw/inc/cf_fcncodes.h +++ b/fsw/inc/cf_fcncodes.h @@ -98,7 +98,8 @@ * \par Criticality * None */ -#define CF_RESET_CC CF_CCVAL(RESET_COUNTERS) +#define CF_RESET_CC CF_CCVAL(RESET_COUNTERS) +#define CF_RESET_COMPAT_CC CF_CCVAL(RESET_COUNTERS_COMPAT) /** * \brief Transmit file @@ -129,7 +130,8 @@ * * \sa #CF_PLAYBACK_DIR_CC */ -#define CF_TX_FILE_CC CF_CCVAL(TX_FILE) +#define CF_TX_FILE_CC CF_CCVAL(TX_FILE) +#define CF_TX_FILE_COMPAT_CC CF_CCVAL(TX_FILE_COMPAT) /** * \brief Playback a directory @@ -161,7 +163,8 @@ * * \sa #CF_TX_FILE_CC */ -#define CF_PLAYBACK_DIR_CC CF_CCVAL(PLAYBACK_DIR) +#define CF_PLAYBACK_DIR_CC CF_CCVAL(PLAYBACK_DIR) +#define CF_PLAYBACK_DIR_COMPAT_CC CF_CCVAL(PLAYBACK_DIR_COMPAT) /** * \brief Freeze a channel @@ -196,7 +199,8 @@ * * \sa #CF_THAW_CC */ -#define CF_FREEZE_CC CF_CCVAL(FREEZE) +#define CF_FREEZE_CC CF_CCVAL(FREEZE) +#define CF_FREEZE_COMPAT_CC CF_CCVAL(FREEZE_COMPAT) /** * \brief Thaw a channel @@ -230,7 +234,8 @@ * * \sa #CF_FREEZE_CC */ -#define CF_THAW_CC CF_CCVAL(THAW) +#define CF_THAW_CC CF_CCVAL(THAW) +#define CF_THAW_COMPAT_CC CF_CCVAL(THAW_COMPAT) /** * \brief Suspend a transaction @@ -266,7 +271,8 @@ * * \sa #CF_RESUME_CC, #CF_CANCEL_CC, #CF_ABANDON_CC */ -#define CF_SUSPEND_CC CF_CCVAL(SUSPEND) +#define CF_SUSPEND_CC CF_CCVAL(SUSPEND) +#define CF_SUSPEND_COMPAT_CC CF_CCVAL(SUSPEND_COMPAT) /** * \brief Resume a transaction @@ -302,7 +308,8 @@ * * \sa #CF_SUSPEND_CC, #CF_CANCEL_CC, #CF_ABANDON_CC */ -#define CF_RESUME_CC CF_CCVAL(RESUME) +#define CF_RESUME_CC CF_CCVAL(RESUME) +#define CF_RESUME_COMPAT_CC CF_CCVAL(RESUME_COMPAT) /** * \brief Cancel a transaction @@ -336,7 +343,8 @@ * * \sa #CF_SUSPEND_CC, #CF_RESUME_CC, #CF_ABANDON_CC */ -#define CF_CANCEL_CC CF_CCVAL(CANCEL) +#define CF_CANCEL_CC CF_CCVAL(CANCEL) +#define CF_CANCEL_COMPAT_CC CF_CCVAL(CANCEL_COMPAT) /** * \brief Abandon a transaction @@ -370,7 +378,8 @@ * * \sa #CF_SUSPEND_CC, #CF_RESUME_CC, #CF_CANCEL_CC */ -#define CF_ABANDON_CC CF_CCVAL(ABANDON) +#define CF_ABANDON_CC CF_CCVAL(ABANDON) +#define CF_ABANDON_COMPAT_CC CF_CCVAL(ABANDON_COMPAT) /** * \brief Set parameter @@ -402,7 +411,8 @@ * * \sa #CF_GET_PARAM_CC */ -#define CF_SET_PARAM_CC CF_CCVAL(SET_PARAM) +#define CF_SET_PARAM_CC CF_CCVAL(SET_PARAM) +#define CF_SET_PARAM_COMPAT_CC CF_CCVAL(SET_PARAM_COMPAT) /** * \brief Get parameter @@ -433,7 +443,8 @@ * * \sa #CF_SET_PARAM_CC */ -#define CF_GET_PARAM_CC CF_CCVAL(GET_PARAM) +#define CF_GET_PARAM_CC CF_CCVAL(GET_PARAM) +#define CF_GET_PARAM_COMPAT_CC CF_CCVAL(GET_PARAM_COMPAT) /** * \brief Write queue @@ -469,7 +480,8 @@ * * \sa #CF_PURGE_QUEUE_CC */ -#define CF_WRITE_QUEUE_CC CF_CCVAL(WRITE_QUEUE) +#define CF_WRITE_QUEUE_CC CF_CCVAL(WRITE_QUEUE) +#define CF_WRITE_QUEUE_COMPAT_CC CF_CCVAL(WRITE_QUEUE_COMPAT) /** * \brief Enable dequeue @@ -502,7 +514,8 @@ * * \sa #CF_DISABLE_DEQUEUE_CC */ -#define CF_ENABLE_DEQUEUE_CC CF_CCVAL(ENABLE_DEQUEUE) +#define CF_ENABLE_DEQUEUE_CC CF_CCVAL(ENABLE_DEQUEUE) +#define CF_ENABLE_DEQUEUE_COMPAT_CC CF_CCVAL(ENABLE_DEQUEUE_COMPAT) /** * \brief Disable dequeue @@ -535,7 +548,8 @@ * * \sa #CF_ENABLE_DEQUEUE_CC */ -#define CF_DISABLE_DEQUEUE_CC CF_CCVAL(DISABLE_DEQUEUE) +#define CF_DISABLE_DEQUEUE_CC CF_CCVAL(DISABLE_DEQUEUE) +#define CF_DISABLE_DEQUEUE_COMPAT_CC CF_CCVAL(DISABLE_DEQUEUE_COMPAT) /** * \brief Enable directory polling @@ -574,7 +588,8 @@ * * \sa #CF_DISABLE_DIR_POLLING_CC */ -#define CF_ENABLE_DIR_POLLING_CC CF_CCVAL(ENABLE_DIR_POLLING) +#define CF_ENABLE_DIR_POLLING_CC CF_CCVAL(ENABLE_DIR_POLLING) +#define CF_ENABLE_DIR_POLLING_COMPAT_CC CF_CCVAL(ENABLE_DIR_POLLING_COMPAT) /** * \brief Disable directory polling @@ -613,7 +628,8 @@ * * \sa #CF_ENABLE_DIR_POLLING_CC */ -#define CF_DISABLE_DIR_POLLING_CC CF_CCVAL(DISABLE_DIR_POLLING) +#define CF_DISABLE_DIR_POLLING_CC CF_CCVAL(DISABLE_DIR_POLLING) +#define CF_DISABLE_DIR_POLLING_COMPAT_CC CF_CCVAL(DISABLE_DIR_POLLING_COMPAT) /** * \brief Purge queue @@ -653,7 +669,8 @@ * * \sa #CF_WRITE_QUEUE_CC */ -#define CF_PURGE_QUEUE_CC CF_CCVAL(PURGE_QUEUE) +#define CF_PURGE_QUEUE_CC CF_CCVAL(PURGE_QUEUE) +#define CF_PURGE_QUEUE_COMPAT_CC CF_CCVAL(PURGE_QUEUE_COMPAT) /** * \brief Enable engine @@ -685,7 +702,8 @@ * * \sa #CF_DISABLE_ENGINE_CC */ -#define CF_ENABLE_ENGINE_CC CF_CCVAL(ENABLE_ENGINE) +#define CF_ENABLE_ENGINE_CC CF_CCVAL(ENABLE_ENGINE) +#define CF_ENABLE_ENGINE_COMPAT_CC CF_CCVAL(ENABLE_ENGINE_COMPAT) /** * \brief Disable engine @@ -717,7 +735,8 @@ * * \sa #CF_DISABLE_ENGINE_CC */ -#define CF_DISABLE_ENGINE_CC CF_CCVAL(DISABLE_ENGINE) +#define CF_DISABLE_ENGINE_CC CF_CCVAL(DISABLE_ENGINE) +#define CF_DISABLE_ENGINE_COMPAT_CC CF_CCVAL(DISABLE_ENGINE_COMPAT) /** \brief Command code limit used for validity check and array sizing */ #define CF_NUM_COMMANDS 24 diff --git a/fsw/src/cf_cmd_compat.c b/fsw/src/cf_cmd_compat.c new file mode 100644 index 00000000..38ad4498 --- /dev/null +++ b/fsw/src/cf_cmd_compat.c @@ -0,0 +1,456 @@ +/************************************************************************ + * 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 + * + * The CF Application command handling source file + * + * All ground commands are processed in this file. All supporting functions + * necessary to process the commands are also here. + */ + +#include "cf_app.h" +#include "cf_eventids.h" +#include "cf_cmd.h" +#include "cf_cmd_compat.h" + +#define CF_CMD_COMPAT_COMPOUND_KEY (254) +#define CF_CMD_COMPAT_ALL_CHANNELS (255) +#define CF_CMD_COMPAT_ALL_POLLDIRS (CF_ALL_CHANNELS) + +/*---------------------------------------------------------------- + * + * Local helper function + * Convert the old-style uint8 chan number to the CF_ChannelSelect_t value that correlates + * + *-----------------------------------------------------------------*/ +static CF_ChannelSelect_t CF_Translate_CompatChannel(uint8 input) +{ + if (input == CF_CMD_COMPAT_COMPOUND_KEY || input == CF_CMD_COMPAT_ALL_CHANNELS) + { + return CF_ALL_CHANNELS; + } + + if (input <= CF_NUM_CHANNELS) + { + return CF_ChannelSelect_FromInt(input + 1); + } + + /* invalid value, keep it as is for event reporting */ + return CF_ChannelSelect_FromInt(input); +} + +/*---------------------------------------------------------------- + * + * Local helper function + * Convert the old-style uint8 poll dir idx to the CF_PollIdxSelect_t value that correlates + * + *-----------------------------------------------------------------*/ +static CF_PollIdxSelect_t CF_Translate_CompatPollDir(uint8 input) +{ + if (input == CF_CMD_COMPAT_ALL_POLLDIRS) + { + return 0; + } + + if (input <= CF_MAX_POLLING_DIR_PER_CHAN) + { + return (input + 1); + } + + /* invalid value, keep it as is for event reporting */ + return (input); +} + +/*---------------------------------------------------------------- + * + * Local helper function + * Convert the old-style uint8 key to the CF_GetSet_ValueID_Enum_t value that correlates + * + *-----------------------------------------------------------------*/ +static CF_GetSet_ValueID_Enum_t CF_Translate_CompatValueID(uint8 input) +{ + CF_GetSet_ValueID_Enum_t key; + + /* 0 is now reserved. All valid values shifted up by 1. */ + key = input; + if (key < CF_GetSet_ValueID_MAX) + { + ++key; + } + return key; +} + +/*---------------------------------------------------------------- + * + * Local helper function + * Convert the old-style Transaction specifier payload + * Most args are compatible, but the "compound key" is now a separate flag. + * + *-----------------------------------------------------------------*/ +static void CF_Translate_Transaction_CompatPayload(CF_Transaction_Payload_t *output, + const CF_Transaction_CompatPayload_t *input) +{ + output->ts = input->ts; + output->eid = input->eid; + if (input->chan == CF_CMD_COMPAT_COMPOUND_KEY) + { + output->use_ts_eid = 1; + output->chan_num = CF_ALL_CHANNELS; + } + else + { + output->chan_num = CF_Translate_CompatChannel(input->chan); + } +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_ResetCountersCompatCmd(const CF_ResetCountersCompatCmd_t *msg) +{ + CF_ResetCountersCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + newcmd.Payload.ResetType = msg->Payload.byte[0]; /* reset type selector is compatible */ + + return CF_ResetCountersCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_TxFileCompatCmd(const CF_TxFileCompatCmd_t *msg) +{ + CF_TxFileCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + + newcmd.Payload.cfdp_class = msg->Payload.cfdp_class; + newcmd.Payload.keep = msg->Payload.keep; + newcmd.Payload.chan_num = CF_Translate_CompatChannel(msg->Payload.chan_num); + newcmd.Payload.priority = msg->Payload.priority; + newcmd.Payload.dest_id = msg->Payload.dest_id; + strncpy(newcmd.Payload.src_filename, msg->Payload.src_filename, sizeof(newcmd.Payload.src_filename)); + strncpy(newcmd.Payload.dst_filename, msg->Payload.dst_filename, sizeof(newcmd.Payload.dst_filename)); + + return CF_TxFileCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_PlaybackDirCompatCmd(const CF_PlaybackDirCompatCmd_t *msg) +{ + CF_PlaybackDirCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + + newcmd.Payload.cfdp_class = msg->Payload.cfdp_class; + newcmd.Payload.keep = msg->Payload.keep; + newcmd.Payload.chan_num = CF_Translate_CompatChannel(msg->Payload.chan_num); + newcmd.Payload.priority = msg->Payload.priority; + newcmd.Payload.dest_id = msg->Payload.dest_id; + strncpy(newcmd.Payload.src_filename, msg->Payload.src_filename, sizeof(newcmd.Payload.src_filename)); + strncpy(newcmd.Payload.dst_filename, msg->Payload.dst_filename, sizeof(newcmd.Payload.dst_filename)); + + return CF_PlaybackDirCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_FreezeCompatCmd(const CF_FreezeCompatCmd_t *msg) +{ + CF_FreezeCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + newcmd.Payload.ChannelSelect = CF_Translate_CompatChannel(msg->Payload.byte[0]); + + return CF_FreezeCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_ThawCompatCmd(const CF_ThawCompatCmd_t *msg) +{ + CF_ThawCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + newcmd.Payload.ChannelSelect = CF_Translate_CompatChannel(msg->Payload.byte[0]); + + return CF_ThawCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_SuspendCompatCmd(const CF_SuspendCompatCmd_t *msg) +{ + CF_SuspendCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + CF_Translate_Transaction_CompatPayload(&newcmd.Payload, &msg->Payload); + + return CF_SuspendCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_ResumeCompatCmd(const CF_ResumeCompatCmd_t *msg) +{ + CF_ResumeCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + CF_Translate_Transaction_CompatPayload(&newcmd.Payload, &msg->Payload); + + return CF_ResumeCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_CancelCompatCmd(const CF_CancelCompatCmd_t *msg) +{ + CF_CancelCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + CF_Translate_Transaction_CompatPayload(&newcmd.Payload, &msg->Payload); + + return CF_CancelCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_AbandonCompatCmd(const CF_AbandonCompatCmd_t *msg) +{ + CF_AbandonCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + CF_Translate_Transaction_CompatPayload(&newcmd.Payload, &msg->Payload); + + return CF_AbandonCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_EnableDequeueCompatCmd(const CF_EnableDequeueCompatCmd_t *msg) +{ + CF_EnableDequeueCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + newcmd.Payload.ChannelSelect = CF_Translate_CompatChannel(msg->Payload.byte[0]); + + return CF_EnableDequeueCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_DisableDequeueCompatCmd(const CF_DisableDequeueCompatCmd_t *msg) +{ + CF_DisableDequeueCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + newcmd.Payload.ChannelSelect = CF_Translate_CompatChannel(msg->Payload.byte[0]); + + return CF_DisableDequeueCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_EnableDirPollingCompatCmd(const CF_EnableDirPollingCompatCmd_t *msg) +{ + CF_EnableDirPollingCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + newcmd.Payload.ChannelSelect = CF_Translate_CompatChannel(msg->Payload.byte[0]); + newcmd.Payload.PollDirIndx = CF_Translate_CompatPollDir(msg->Payload.byte[1]); + + return CF_EnableDirPollingCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_DisableDirPollingCompatCmd(const CF_DisableDirPollingCompatCmd_t *msg) +{ + CF_DisableDirPollingCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + newcmd.Payload.ChannelSelect = CF_Translate_CompatChannel(msg->Payload.byte[0]); + newcmd.Payload.PollDirIndx = CF_Translate_CompatPollDir(msg->Payload.byte[1]); + + return CF_DisableDirPollingCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_PurgeQueueCompatCmd(const CF_PurgeQueueCompatCmd_t *msg) +{ + CF_PurgeQueueCmd_t newcmd; + uint8 queueidx; + + memset(&newcmd, 0, sizeof(newcmd)); + newcmd.Payload.ChannelSelect = CF_Translate_CompatChannel(msg->Payload.byte[0]); + + /* byte 1 specified the queue, only pending(0) and history(1) as options. 2=all */ + queueidx = msg->Payload.byte[1]; + if (queueidx < CF_QueueSelect_MAX) + { + /* history(1) and all(2) are shifted an extra value to match */ + if (queueidx != 0) + { + ++queueidx; + } + queueidx = (queueidx + 1) % CF_QueueSelect_MAX; + } + newcmd.Payload.QueueSelect = queueidx; + + return CF_PurgeQueueCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_WriteQueueCompatCmd(const CF_WriteQueueCompatCmd_t *msg) +{ + CF_WriteQueueCmd_t newcmd; + uint8 queueidx; + + memset(&newcmd, 0, sizeof(newcmd)); + + newcmd.Payload.dir_type = msg->Payload.type; /* direction is compatible */ + newcmd.Payload.chan_num = CF_Translate_CompatChannel(msg->Payload.chan); + queueidx = msg->Payload.queue; /* Queue type: 0=pending, 1=active, 2=history, 3=all */ + if (queueidx <= CF_QueueSelect_MAX) + { + /* we need to "roll" the value - 0 is now all, instead of 3. */ + queueidx = (queueidx + 1) % CF_QueueSelect_MAX; + } + newcmd.Payload.queue = queueidx; + + return CF_WriteQueueCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_SetParamCompatCmd(const CF_SetParamCompatCmd_t *msg) +{ + CF_SetParamCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + + newcmd.Payload.value = msg->Payload.value; + newcmd.Payload.key = CF_Translate_CompatValueID(msg->Payload.key); + newcmd.Payload.chan_num = CF_Translate_CompatChannel(msg->Payload.chan_num); + + return CF_SetParamCmd(&newcmd); +} + +/*---------------------------------------------------------------- + * + * Application-scope internal function + * See description in cf_cmd.h for argument/return detail + * This is the entry point function invoked from the SB command handler + * + *-----------------------------------------------------------------*/ +CFE_Status_t CF_GetParamCompatCmd(const CF_GetParamCompatCmd_t *msg) +{ + CF_GetParamCmd_t newcmd; + + memset(&newcmd, 0, sizeof(newcmd)); + + newcmd.Payload.key = CF_Translate_CompatValueID(msg->Payload.key); + newcmd.Payload.chan_num = CF_Translate_CompatChannel(msg->Payload.chan_num); + + return CF_GetParamCmd(&newcmd); +} diff --git a/fsw/src/cf_cmd_compat.h b/fsw/src/cf_cmd_compat.h new file mode 100644 index 00000000..3d1d103f --- /dev/null +++ b/fsw/src/cf_cmd_compat.h @@ -0,0 +1,232 @@ +/************************************************************************ + * 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 + * + * CF command processing function declarations + * This implements a compatibility layer to allow a smoother transition + * between command definitions. The goal is to employ consistent patterns + * across all CMD/TLM where resources are identified by integers of a consistent + * range and definition. Specifically, the integer value of "0" will be reserved + * to indicate "all" for a given resource, or considered invalid if the command + * cannot be applied to all resources. + * + * Because this shifts values for what was previously considered valid (e.g. passing + * 0 now means all where it previously meant channel 0), the code here implements + * a translation layer for old command definitions. These will rewrite the command + * to be in the new format. + * + * This entire source module should be considered deprecated and will be removed + * in an upcoming release. + */ + +#ifndef CF_CMD_COMPAT_H +#define CF_CMD_COMPAT_H + +#include "cfe.h" +#include "cf_app.h" +#include "cf_utils.h" + +/************************************************************************/ +/** @brief The reset counters command. + * + * @par Description + * This function has a signature the same of all cmd_ functions. + * Resets the given counter, or all. + * Increments the command accept or reject counter. If the command + * counters are reset, then there is no increment. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_ResetCountersCompatCmd(const CF_ResetCountersCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Ground command to start a file transfer. + * + * @par Description + * This function has a signature the same of all cmd_ functions. + * Increments the command accept or reject counter. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + * + */ +CFE_Status_t CF_TxFileCompatCmd(const CF_TxFileCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Ground command to start directory playback. + * + * @par Description + * This function has a signature the same of all cmd_ functions. + * Increments the command accept or reject counter. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_PlaybackDirCompatCmd(const CF_PlaybackDirCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Freeze a channel. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_FreezeCompatCmd(const CF_FreezeCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Thaw a channel. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_ThawCompatCmd(const CF_ThawCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Handle transaction suspend command. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_SuspendCompatCmd(const CF_SuspendCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Handle transaction resume command. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_ResumeCompatCmd(const CF_ResumeCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Handle a cancel ground command. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_CancelCompatCmd(const CF_CancelCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Handle an abandon ground command. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_AbandonCompatCmd(const CF_AbandonCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Handle an enable dequeue ground command. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_EnableDequeueCompatCmd(const CF_EnableDequeueCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Handle a disable dequeue ground command. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_DisableDequeueCompatCmd(const CF_DisableDequeueCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Enable a polling dir ground command. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_EnableDirPollingCompatCmd(const CF_EnableDirPollingCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Disable a polling dir ground command. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_DisableDirPollingCompatCmd(const CF_DisableDirPollingCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Ground command to purge either the history or pending queues. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_PurgeQueueCompatCmd(const CF_PurgeQueueCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Ground command to write a file with queue information. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_WriteQueueCompatCmd(const CF_WriteQueueCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Ground command to set a configuration parameter. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_SetParamCompatCmd(const CF_SetParamCompatCmd_t *msg); + +/************************************************************************/ +/** @brief Ground command to get a configuration parameter. + * + * @par Assumptions, External Events, and Notes: + * msg must not be NULL. + * + * @param msg Pointer to command message + */ +CFE_Status_t CF_GetParamCompatCmd(const CF_GetParamCompatCmd_t *msg); + +#endif diff --git a/fsw/src/cf_dispatch.c b/fsw/src/cf_dispatch.c index ed7e0abc..e72ae3f5 100644 --- a/fsw/src/cf_dispatch.c +++ b/fsw/src/cf_dispatch.c @@ -29,6 +29,7 @@ #include "cf_app.h" #include "cf_eventids.h" #include "cf_cmd.h" +#include "cf_cmd_compat.h" #include "cfe.h" #include @@ -44,49 +45,83 @@ void CF_ProcessGroundCommand(const CFE_SB_Buffer_t *BufPtr) typedef void (*const handler_fn_t)(const void *); static handler_fn_t fns[] = { - [CF_NOOP_CC] = (handler_fn_t)CF_NoopCmd, - [CF_RESET_CC] = (handler_fn_t)CF_ResetCountersCmd, - [CF_TX_FILE_CC] = (handler_fn_t)CF_TxFileCmd, - [CF_PLAYBACK_DIR_CC] = (handler_fn_t)CF_PlaybackDirCmd, - [CF_FREEZE_CC] = (handler_fn_t)CF_FreezeCmd, - [CF_THAW_CC] = (handler_fn_t)CF_ThawCmd, - [CF_SUSPEND_CC] = (handler_fn_t)CF_SuspendCmd, - [CF_RESUME_CC] = (handler_fn_t)CF_ResumeCmd, - [CF_CANCEL_CC] = (handler_fn_t)CF_CancelCmd, - [CF_ABANDON_CC] = (handler_fn_t)CF_AbandonCmd, - [CF_SET_PARAM_CC] = (handler_fn_t)CF_SetParamCmd, - [CF_GET_PARAM_CC] = (handler_fn_t)CF_GetParamCmd, - [CF_WRITE_QUEUE_CC] = (handler_fn_t)CF_WriteQueueCmd, - [CF_ENABLE_DEQUEUE_CC] = (handler_fn_t)CF_EnableDequeueCmd, - [CF_DISABLE_DEQUEUE_CC] = (handler_fn_t)CF_DisableDequeueCmd, - [CF_ENABLE_DIR_POLLING_CC] = (handler_fn_t)CF_EnableDirPollingCmd, - [CF_DISABLE_DIR_POLLING_CC] = (handler_fn_t)CF_DisableDirPollingCmd, - [CF_PURGE_QUEUE_CC] = (handler_fn_t)CF_PurgeQueueCmd, - [CF_ENABLE_ENGINE_CC] = (handler_fn_t)CF_EnableEngineCmd, - [CF_DISABLE_ENGINE_CC] = (handler_fn_t)CF_DisableEngineCmd, + [CF_NOOP_CC] = (handler_fn_t)CF_NoopCmd, + [CF_RESET_COMPAT_CC] = (handler_fn_t)CF_ResetCountersCompatCmd, + [CF_TX_FILE_COMPAT_CC] = (handler_fn_t)CF_TxFileCompatCmd, + [CF_PLAYBACK_DIR_COMPAT_CC] = (handler_fn_t)CF_PlaybackDirCompatCmd, + [CF_FREEZE_COMPAT_CC] = (handler_fn_t)CF_FreezeCompatCmd, + [CF_THAW_COMPAT_CC] = (handler_fn_t)CF_ThawCompatCmd, + [CF_SUSPEND_COMPAT_CC] = (handler_fn_t)CF_SuspendCompatCmd, + [CF_RESUME_COMPAT_CC] = (handler_fn_t)CF_ResumeCompatCmd, + [CF_CANCEL_COMPAT_CC] = (handler_fn_t)CF_CancelCompatCmd, + [CF_ABANDON_COMPAT_CC] = (handler_fn_t)CF_AbandonCompatCmd, + [CF_SET_PARAM_COMPAT_CC] = (handler_fn_t)CF_SetParamCompatCmd, + [CF_GET_PARAM_COMPAT_CC] = (handler_fn_t)CF_GetParamCompatCmd, + [CF_WRITE_QUEUE_COMPAT_CC] = (handler_fn_t)CF_WriteQueueCompatCmd, + [CF_ENABLE_DEQUEUE_COMPAT_CC] = (handler_fn_t)CF_EnableDequeueCompatCmd, + [CF_DISABLE_DEQUEUE_COMPAT_CC] = (handler_fn_t)CF_DisableDequeueCompatCmd, + [CF_ENABLE_DIR_POLLING_COMPAT_CC] = (handler_fn_t)CF_EnableDirPollingCompatCmd, + [CF_DISABLE_DIR_POLLING_COMPAT_CC] = (handler_fn_t)CF_DisableDirPollingCompatCmd, + [CF_PURGE_QUEUE_COMPAT_CC] = (handler_fn_t)CF_PurgeQueueCompatCmd, + [CF_ENABLE_ENGINE_CC] = (handler_fn_t)CF_EnableEngineCmd, + [CF_DISABLE_ENGINE_CC] = (handler_fn_t)CF_DisableEngineCmd, + [CF_RESET_CC] = (handler_fn_t)CF_ResetCountersCmd, + [CF_TX_FILE_CC] = (handler_fn_t)CF_TxFileCmd, + [CF_PLAYBACK_DIR_CC] = (handler_fn_t)CF_PlaybackDirCmd, + [CF_FREEZE_CC] = (handler_fn_t)CF_FreezeCmd, + [CF_THAW_CC] = (handler_fn_t)CF_ThawCmd, + [CF_SUSPEND_CC] = (handler_fn_t)CF_SuspendCmd, + [CF_RESUME_CC] = (handler_fn_t)CF_ResumeCmd, + [CF_CANCEL_CC] = (handler_fn_t)CF_CancelCmd, + [CF_ABANDON_CC] = (handler_fn_t)CF_AbandonCmd, + [CF_SET_PARAM_CC] = (handler_fn_t)CF_SetParamCmd, + [CF_GET_PARAM_CC] = (handler_fn_t)CF_GetParamCmd, + [CF_WRITE_QUEUE_CC] = (handler_fn_t)CF_WriteQueueCmd, + [CF_ENABLE_DEQUEUE_CC] = (handler_fn_t)CF_EnableDequeueCmd, + [CF_DISABLE_DEQUEUE_CC] = (handler_fn_t)CF_DisableDequeueCmd, + [CF_ENABLE_DIR_POLLING_CC] = (handler_fn_t)CF_EnableDirPollingCmd, + [CF_DISABLE_DIR_POLLING_CC] = (handler_fn_t)CF_DisableDirPollingCmd, + [CF_PURGE_QUEUE_CC] = (handler_fn_t)CF_PurgeQueueCmd, }; static const uint16 expected_lengths[] = { - [CF_NOOP_CC] = sizeof(CF_NoopCmd_t), - [CF_RESET_CC] = sizeof(CF_ResetCountersCmd_t), - [CF_TX_FILE_CC] = sizeof(CF_TxFileCmd_t), - [CF_PLAYBACK_DIR_CC] = sizeof(CF_PlaybackDirCmd_t), - [CF_FREEZE_CC] = sizeof(CF_FreezeCmd_t), - [CF_THAW_CC] = sizeof(CF_ThawCmd_t), - [CF_SUSPEND_CC] = sizeof(CF_SuspendCmd_t), - [CF_RESUME_CC] = sizeof(CF_ResumeCmd_t), - [CF_CANCEL_CC] = sizeof(CF_CancelCmd_t), - [CF_ABANDON_CC] = sizeof(CF_AbandonCmd_t), - [CF_SET_PARAM_CC] = sizeof(CF_SetParamCmd_t), - [CF_GET_PARAM_CC] = sizeof(CF_GetParamCmd_t), - [CF_WRITE_QUEUE_CC] = sizeof(CF_WriteQueueCmd_t), - [CF_ENABLE_DEQUEUE_CC] = sizeof(CF_EnableDequeueCmd_t), - [CF_DISABLE_DEQUEUE_CC] = sizeof(CF_DisableDequeueCmd_t), - [CF_ENABLE_DIR_POLLING_CC] = sizeof(CF_EnableDirPollingCmd_t), - [CF_DISABLE_DIR_POLLING_CC] = sizeof(CF_DisableDirPollingCmd_t), - [CF_PURGE_QUEUE_CC] = sizeof(CF_PurgeQueueCmd_t), - [CF_ENABLE_ENGINE_CC] = sizeof(CF_EnableEngineCmd_t), - [CF_DISABLE_ENGINE_CC] = sizeof(CF_DisableEngineCmd_t), + [CF_NOOP_CC] = sizeof(CF_NoopCmd_t), + [CF_RESET_COMPAT_CC] = sizeof(CF_ResetCountersCompatCmd_t), + [CF_TX_FILE_COMPAT_CC] = sizeof(CF_TxFileCompatCmd_t), + [CF_PLAYBACK_DIR_COMPAT_CC] = sizeof(CF_PlaybackDirCompatCmd_t), + [CF_FREEZE_COMPAT_CC] = sizeof(CF_FreezeCompatCmd_t), + [CF_THAW_COMPAT_CC] = sizeof(CF_ThawCompatCmd_t), + [CF_SUSPEND_COMPAT_CC] = sizeof(CF_SuspendCompatCmd_t), + [CF_RESUME_COMPAT_CC] = sizeof(CF_ResumeCompatCmd_t), + [CF_CANCEL_COMPAT_CC] = sizeof(CF_CancelCompatCmd_t), + [CF_ABANDON_COMPAT_CC] = sizeof(CF_AbandonCompatCmd_t), + [CF_SET_PARAM_COMPAT_CC] = sizeof(CF_SetParamCompatCmd_t), + [CF_GET_PARAM_COMPAT_CC] = sizeof(CF_GetParamCompatCmd_t), + [CF_WRITE_QUEUE_COMPAT_CC] = sizeof(CF_WriteQueueCompatCmd_t), + [CF_ENABLE_DEQUEUE_COMPAT_CC] = sizeof(CF_EnableDequeueCompatCmd_t), + [CF_DISABLE_DEQUEUE_COMPAT_CC] = sizeof(CF_DisableDequeueCompatCmd_t), + [CF_ENABLE_DIR_POLLING_COMPAT_CC] = sizeof(CF_EnableDirPollingCompatCmd_t), + [CF_DISABLE_DIR_POLLING_COMPAT_CC] = sizeof(CF_DisableDirPollingCompatCmd_t), + [CF_PURGE_QUEUE_COMPAT_CC] = sizeof(CF_PurgeQueueCompatCmd_t), + [CF_ENABLE_ENGINE_CC] = sizeof(CF_EnableEngineCmd_t), + [CF_DISABLE_ENGINE_CC] = sizeof(CF_DisableEngineCmd_t), + [CF_RESET_CC] = sizeof(CF_ResetCountersCmd_t), + [CF_TX_FILE_CC] = sizeof(CF_TxFileCmd_t), + [CF_PLAYBACK_DIR_CC] = sizeof(CF_PlaybackDirCmd_t), + [CF_FREEZE_CC] = sizeof(CF_FreezeCmd_t), + [CF_THAW_CC] = sizeof(CF_ThawCmd_t), + [CF_SUSPEND_CC] = sizeof(CF_SuspendCmd_t), + [CF_RESUME_CC] = sizeof(CF_ResumeCmd_t), + [CF_CANCEL_CC] = sizeof(CF_CancelCmd_t), + [CF_ABANDON_CC] = sizeof(CF_AbandonCmd_t), + [CF_SET_PARAM_CC] = sizeof(CF_SetParamCmd_t), + [CF_GET_PARAM_CC] = sizeof(CF_GetParamCmd_t), + [CF_WRITE_QUEUE_CC] = sizeof(CF_WriteQueueCmd_t), + [CF_ENABLE_DEQUEUE_CC] = sizeof(CF_EnableDequeueCmd_t), + [CF_DISABLE_DEQUEUE_CC] = sizeof(CF_DisableDequeueCmd_t), + [CF_ENABLE_DIR_POLLING_CC] = sizeof(CF_EnableDirPollingCmd_t), + [CF_DISABLE_DIR_POLLING_CC] = sizeof(CF_DisableDirPollingCmd_t), + [CF_PURGE_QUEUE_CC] = sizeof(CF_PurgeQueueCmd_t), }; CFE_MSG_FcnCode_t cmd = 0; @@ -94,7 +129,7 @@ void CF_ProcessGroundCommand(const CFE_SB_Buffer_t *BufPtr) CFE_MSG_GetFcnCode(&BufPtr->Msg, &cmd); - if (cmd < (sizeof(expected_lengths) / sizeof(expected_lengths[0]))) + if (cmd < (sizeof(expected_lengths) / sizeof(expected_lengths[0])) && fns[cmd] != NULL) { CFE_MSG_GetSize(&BufPtr->Msg, &len); @@ -102,10 +137,7 @@ void CF_ProcessGroundCommand(const CFE_SB_Buffer_t *BufPtr) if (len == expected_lengths[cmd]) { /* if valid, process command */ - if (fns[cmd]) - { - fns[cmd](BufPtr); - } + fns[cmd](BufPtr); } else { diff --git a/unit-test/CMakeLists.txt b/unit-test/CMakeLists.txt index 41548a20..dd01eac1 100644 --- a/unit-test/CMakeLists.txt +++ b/unit-test/CMakeLists.txt @@ -34,10 +34,7 @@ # All "stubs" files in here should be auto-generated using UtAssert generate_stubs.pl tool # From the top-level directory of CF these can be regenerated with a command like: # ../../osal/ut_assert/scripts/generate_stubs.pl ./unit-test/stubs fsw/src/*.h -add_cfe_coverage_stubs(cf_internal - utilities/cf_test_utils.c - utilities/cf_test_alt_handler.c - +set(CF_UT_STUB_SRC_LIST stubs/cf_app_global.c stubs/cf_app_stubs.c stubs/cf_cfdp_handlers.c @@ -61,6 +58,18 @@ add_cfe_coverage_stubs(cf_internal stubs/cf_utils_stubs.c ) +# cmd compatibility shim only enabled in non-EDS build +if (NOT CFE_EDS_ENABLED) + list(APPEND CF_UT_STUB_SRC_LIST stubs/cf_cmd_compat_stubs.c) +endif() + +add_cfe_coverage_stubs(cf_internal + utilities/cf_test_utils.c + utilities/cf_test_alt_handler.c + ${CF_UT_STUB_SRC_LIST} +) + + target_link_libraries(coverage-cf_internal-stubs ut_core_api_stubs ut_assert) target_include_directories(coverage-cf_internal-stubs PUBLIC utilities) target_include_directories(coverage-cf_internal-stubs PUBLIC ../fsw/inc) @@ -75,17 +84,20 @@ foreach(SRCFILE ${APP_SRC_FILES}) # extension, this will be used as the base name of the unit test file. get_filename_component(UNIT_NAME "${SRCFILE}" NAME_WE) - # Use the module name to make the tests' name by adding _tests to the end - set(TESTS_NAME "${UNIT_NAME}_tests") + # Skip UT for compatibility shims. These are deprecated. + if (NOT UNIT_NAME MATCHES "compat$") + # Use the module name to make the tests' name by adding _tests to the end + set(TESTS_NAME "${UNIT_NAME}_tests") - # Get the tests' sourcefile name with unit test path and extension - set(TESTS_SOURCE_FILE "${PROJECT_SOURCE_DIR}/unit-test/${TESTS_NAME}.c") + # Get the tests' sourcefile name with unit test path and extension + set(TESTS_SOURCE_FILE "${PROJECT_SOURCE_DIR}/unit-test/${TESTS_NAME}.c") - # Create the coverage test executable - # Note: This renders a target named "coverage-cf-${UNIT_NAME}-testrunner" - add_cfe_coverage_test(cf "${UNIT_NAME}" "${TESTS_SOURCE_FILE}" "${CFS_CF_SOURCE_DIR}/${SRCFILE}") + # Create the coverage test executable + # Note: This renders a target named "coverage-cf-${UNIT_NAME}-testrunner" + add_cfe_coverage_test(cf "${UNIT_NAME}" "${TESTS_SOURCE_FILE}" "${CFS_CF_SOURCE_DIR}/${SRCFILE}") - # CF test cases should be linked with stubs for other internal CF units - add_cfe_coverage_dependency(cf "${UNIT_NAME}" cf_internal) + # CF test cases should be linked with stubs for other internal CF units + add_cfe_coverage_dependency(cf "${UNIT_NAME}" cf_internal) + endif() endforeach() diff --git a/unit-test/cf_dispatch_tests.c b/unit-test/cf_dispatch_tests.c index 0c3c8e26..adc41ddb 100644 --- a/unit-test/cf_dispatch_tests.c +++ b/unit-test/cf_dispatch_tests.c @@ -183,11 +183,10 @@ void Test_CF_ProcessGroundCommand_ReceivesCmdCode_0x0C_AndDoNothingBecause_fns_1 /* Assert */ UtAssert_STUB_COUNT(CFE_MSG_GetFcnCode, 1); - UtAssert_STUB_COUNT(CFE_MSG_GetSize, 1); - UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); + UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); /* Assert for incremented counter */ UtAssert_UINT32_EQ(CF_AppData.counters.cmd, 0); - UtAssert_UINT32_EQ(CF_AppData.counters.err, 0); + UtAssert_UINT32_EQ(CF_AppData.counters.err, 1); } /******************************************************************************* diff --git a/unit-test/stubs/cf_cmd_compat_stubs.c b/unit-test/stubs/cf_cmd_compat_stubs.c new file mode 100644 index 00000000..ef147523 --- /dev/null +++ b/unit-test/stubs/cf_cmd_compat_stubs.c @@ -0,0 +1,299 @@ +/************************************************************************ + * 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 + * + * Auto-Generated stub implementations for functions defined in cf_cmd_compat header + */ + +#include "cf_cmd_compat.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for CF_AbandonCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_AbandonCompatCmd(const CF_AbandonCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_AbandonCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_AbandonCompatCmd, const CF_AbandonCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_AbandonCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_AbandonCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_CancelCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_CancelCompatCmd(const CF_CancelCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_CancelCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_CancelCompatCmd, const CF_CancelCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_CancelCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_CancelCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_DisableDequeueCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_DisableDequeueCompatCmd(const CF_DisableDequeueCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_DisableDequeueCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_DisableDequeueCompatCmd, const CF_DisableDequeueCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_DisableDequeueCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_DisableDequeueCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_DisableDirPollingCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_DisableDirPollingCompatCmd(const CF_DisableDirPollingCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_DisableDirPollingCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_DisableDirPollingCompatCmd, const CF_DisableDirPollingCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_DisableDirPollingCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_DisableDirPollingCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_EnableDequeueCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_EnableDequeueCompatCmd(const CF_EnableDequeueCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_EnableDequeueCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_EnableDequeueCompatCmd, const CF_EnableDequeueCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_EnableDequeueCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_EnableDequeueCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_EnableDirPollingCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_EnableDirPollingCompatCmd(const CF_EnableDirPollingCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_EnableDirPollingCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_EnableDirPollingCompatCmd, const CF_EnableDirPollingCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_EnableDirPollingCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_EnableDirPollingCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_FreezeCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_FreezeCompatCmd(const CF_FreezeCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_FreezeCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_FreezeCompatCmd, const CF_FreezeCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_FreezeCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_FreezeCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_GetParamCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_GetParamCompatCmd(const CF_GetParamCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_GetParamCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_GetParamCompatCmd, const CF_GetParamCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_GetParamCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_GetParamCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_PlaybackDirCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_PlaybackDirCompatCmd(const CF_PlaybackDirCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_PlaybackDirCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_PlaybackDirCompatCmd, const CF_PlaybackDirCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_PlaybackDirCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_PlaybackDirCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_PurgeQueueCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_PurgeQueueCompatCmd(const CF_PurgeQueueCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_PurgeQueueCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_PurgeQueueCompatCmd, const CF_PurgeQueueCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_PurgeQueueCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_PurgeQueueCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_ResetCountersCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_ResetCountersCompatCmd(const CF_ResetCountersCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_ResetCountersCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_ResetCountersCompatCmd, const CF_ResetCountersCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_ResetCountersCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_ResetCountersCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_ResumeCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_ResumeCompatCmd(const CF_ResumeCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_ResumeCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_ResumeCompatCmd, const CF_ResumeCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_ResumeCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_ResumeCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_SetParamCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_SetParamCompatCmd(const CF_SetParamCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_SetParamCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_SetParamCompatCmd, const CF_SetParamCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_SetParamCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_SetParamCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_SuspendCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_SuspendCompatCmd(const CF_SuspendCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_SuspendCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_SuspendCompatCmd, const CF_SuspendCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_SuspendCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_SuspendCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_ThawCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_ThawCompatCmd(const CF_ThawCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_ThawCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_ThawCompatCmd, const CF_ThawCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_ThawCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_ThawCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_TxFileCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_TxFileCompatCmd(const CF_TxFileCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_TxFileCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_TxFileCompatCmd, const CF_TxFileCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_TxFileCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_TxFileCompatCmd, CFE_Status_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CF_WriteQueueCompatCmd() + * ---------------------------------------------------- + */ +CFE_Status_t CF_WriteQueueCompatCmd(const CF_WriteQueueCompatCmd_t *msg) +{ + UT_GenStub_SetupReturnBuffer(CF_WriteQueueCompatCmd, CFE_Status_t); + + UT_GenStub_AddParam(CF_WriteQueueCompatCmd, const CF_WriteQueueCompatCmd_t *, msg); + + UT_GenStub_Execute(CF_WriteQueueCompatCmd, Basic, NULL); + + return UT_GenStub_GetReturnValue(CF_WriteQueueCompatCmd, CFE_Status_t); +} From 0a62283ef6022d6a9c3245a4f15257e0b4c2d995 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 1 Oct 2026 14:45:28 -0400 Subject: [PATCH 2/3] Fix #521, correction to polldir compat value --- fsw/src/cf_cmd_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsw/src/cf_cmd_compat.c b/fsw/src/cf_cmd_compat.c index 38ad4498..8e8fcf93 100644 --- a/fsw/src/cf_cmd_compat.c +++ b/fsw/src/cf_cmd_compat.c @@ -33,7 +33,7 @@ #define CF_CMD_COMPAT_COMPOUND_KEY (254) #define CF_CMD_COMPAT_ALL_CHANNELS (255) -#define CF_CMD_COMPAT_ALL_POLLDIRS (CF_ALL_CHANNELS) +#define CF_CMD_COMPAT_ALL_POLLDIRS (CF_CMD_COMPAT_ALL_CHANNELS) /*---------------------------------------------------------------- * From 0945c5af4d7149d6fd32b403a4de16e10e615738 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 2 Oct 2026 13:09:40 -0400 Subject: [PATCH 3/3] Fix #521, correct for compound key channel Remove compound key check in channel translation (does not apply outside of transactions) --- fsw/src/cf_cmd_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsw/src/cf_cmd_compat.c b/fsw/src/cf_cmd_compat.c index 8e8fcf93..b156db4d 100644 --- a/fsw/src/cf_cmd_compat.c +++ b/fsw/src/cf_cmd_compat.c @@ -43,7 +43,7 @@ *-----------------------------------------------------------------*/ static CF_ChannelSelect_t CF_Translate_CompatChannel(uint8 input) { - if (input == CF_CMD_COMPAT_COMPOUND_KEY || input == CF_CMD_COMPAT_ALL_CHANNELS) + if (input == CF_CMD_COMPAT_ALL_CHANNELS) { return CF_ALL_CHANNELS; }