diff --git a/CMakeLists.txt b/CMakeLists.txt index fd53722c..0dc89ecc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,11 +14,16 @@ set(APP_SRC_FILES fsw/src/cf_codec.c fsw/src/cf_cmd.c fsw/src/cf_crc.c - fsw/src/cf_dispatch.c fsw/src/cf_timer.c fsw/src/cf_utils.c ) +if (CFE_EDS_ENABLED_BUILD) + list(APPEND APP_SRC_FILES fsw/src/cf_eds_dispatch.c) +else() + list(APPEND APP_SRC_FILES fsw/src/cf_dispatch.c) +endif() + # Create the app module add_cfe_app(cf ${APP_SRC_FILES}) diff --git a/config/default_cf_extern_typedefs.h b/config/default_cf_extern_typedefs.h index 75db27be..0e5cd044 100644 --- a/config/default_cf_extern_typedefs.h +++ b/config/default_cf_extern_typedefs.h @@ -29,6 +29,28 @@ /* constants such as CF_FILENAME_MAX_LEN are in mission_cfg.h */ #include "cf_mission_cfg.h" +#ifdef CFE_EDS_ENABLED_BUILD + +#include "cf_eds_typedefs.h" + +typedef CF_QueueIdx_Enum_t CF_QueueIdx_t; +#define CF_QueueIdx_NUM (1 + CF_QueueIdx_Enum_t_MAX) +#define CF_GetSet_ValueID_MAX (1 + CF_GetSet_ValueID_Enum_t_MAX) + +typedef CF_EntityId_Atom_t CF_EntityId_t; +typedef CF_TransactionSeq_Atom_t CF_TransactionSeq_t; + +typedef CF_CFDP_Enum_t CF_CFDP_Class_t; +typedef CF_GetSet_ValueID_Enum_t CF_GetSet_ValueID_t; + +typedef BASE_TYPES_PathName_String_t CF_PathName_t; +typedef BASE_TYPES_FileName_String_t CF_FileName_t; + +#define CF_FILENAME_MAX_NAME ((int)sizeof(CF_FileName_t)) +#define CF_FILENAME_MAX_LEN ((int)sizeof(CF_PathName_t)) + +#else + /** * @brief Values for CFDP file transfer class * @@ -113,4 +135,6 @@ typedef uint32 CF_EntityId_t; */ typedef uint32 CF_TransactionSeq_t; +#endif + #endif /* CF_EXTERN_TYPEDEFS_H */ diff --git a/eds/cf.xml b/eds/cf.xml new file mode 100644 index 00000000..b018fa56 --- /dev/null +++ b/eds/cf.xml @@ -0,0 +1,1266 @@ + + + + + + + + + + + + + + @par Description + The max size of the transaction sequence number as expected for all CFDP packets. + CF supports the spec's variable size of TSN, where the actual size is + selected at runtime, and therefore the size in CFDP PDUs may be smaller + than the size specified here. This type only establishes the maximum + size (and therefore maximum value) that a TSN may be. + + @note This type is used in several CF commands, and so changing the size + of this type will affect the following structure: + CF_Transaction_Payload_t, any command that selects a transaction based on TSN + + @par Limits + Must be one of uint8, uint16, uint32, uint64. + + + + + + + + + + + + + + + + + + + + + Specifically these are used for the "key" field within CF_GetParamCmd_t and + CF_SetParamCmd_t message structures. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \cfcmd No Operation + + \par Description + No-operation command for aliveness verification and version reporting + + \par Command Structure + #CF_NoArgsCmd_t + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_NOOP + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + + + + + + + + \cfcmd Reset counters + + \par Description + Resets the requested housekeeping counters + + \par Command Structure + #CF_UnionArgsCmd_t where byte[0] specifies the counters type, byte[1-3] don't care: + - 0 = all counters + - 1 = command counters + - 2 = fault counters + - 3 = up counters + - 4 = down counters + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_RESET + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Invalid counter type, #CF_EID_ERR_CMD_RESET_INVALID + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + + + + + + + + + + + \cfcmd Transmit file + + \par Description + Requests transmission of a file + + \par Command Structure + #CF_TxFileCmd_t + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_TX_FILE + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Invalid parameter, #CF_EID_ERR_CMD_BAD_PARAM + - Transaction initialization failure, #CF_EID_ERR_CMD_TX_FILE + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_PLAYBACK_DIR_CC + + + + + + + + + + + + \cfcmd Playback a directory + + \par Description + Transmits all the files in a directory + + \par Command Structure + #CF_PlaybackDirCmd_t - note it's currently a typedef of CF_TxFileCmd_t, where + the source filename and destination filename are directories + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_PLAYBACK_DIR + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Invalid parameter, #CF_EID_ERR_CMD_BAD_PARAM + - Playback initialization failure, #CF_EID_ERR_CMD_PLAYBACK_DIR + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_TX_FILE_CC + + + + + + + + + + + + \cfcmd Freeze a channel + + \par Description + Disables the transmission of all PDUs and disables tick processing (timeouts, ACK/NAK, etc) + for the specified channel, will still consume all received messages. Note + this could cause failures for class 2 transactions in progress. + + \par Command Structure + #CF_UnionArgsCmd_t where byte[0] specifies the channel number or all channels + - 255 = all channels + - else = single channel + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_FREEZE + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM + - Command processing failure, #CF_EID_ERR_CMD_FREEZE + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_THAW_CC + + + + + + + + + + + + \cfcmd Thaw a channel + + \par Description + Enables the transmission of all PDUs and resumes tick processing (timeouts, ACK/NAK, etc) + for the specified channel, note received messages are consumed either way. + + \par Command Structure + #CF_UnionArgsCmd_t where byte[0] specifies the channel number or all channels + - 255 = all channels + - else = single channel + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_THAW + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM + - Command processing failure, #CF_EID_ERR_CMD_THAW + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_FREEZE_CC + + + + + + + + + + + + \cfcmd Suspend a transaction + + \par Description + Disables the transmission of all PDUs and disables tick processing (timeouts, ACK/NAK, etc) on a single + transaction, all channels and transactions, or all transactions on a specific channel. + Will still consume all received messages. Note suspension is tracked per transaction, + whereas freeze/thaw are tracked per channel. + + \par Command Structure + #CF_TransactionCmd_t + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_SUSPRES + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Transaction not found using compound key, #CF_EID_ERR_CMD_TRANS_NOT_FOUND + - Invalid channel number, #CF_EID_ERR_CMD_TSN_CHAN_INVALID + - Already in requested state, #CF_EID_ERR_CMD_SUSPRES_SAME + - No matching transaction, #CF_EID_ERR_CMD_SUSPRES_CHAN + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_RESUME_CC, #CF_CANCEL_CC, #CF_ABANDON_CC + + + + + + + + + + + + \cfcmd Resume a transaction + + \par Description + Enables the transmission of all PDUs and resumes tick processing (timeouts, ACK/NAK, etc) on a single + transaction, all channels and transactions, or all transactions on a specific channel. + Note a suspended transaction still consume all received messages. Note suspension is tracked per + transaction, whereas freeze/thaw are tracked per channel. + + \par Command Structure + #CF_TransactionCmd_t + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_SUSPRES + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Transaction not found using compound key, #CF_EID_ERR_CMD_TRANS_NOT_FOUND + - Invalid channel number, #CF_EID_ERR_CMD_TSN_CHAN_INVALID + - Already in requested state, #CF_EID_ERR_CMD_SUSPRES_SAME + - No matching transaction, #CF_EID_ERR_CMD_SUSPRES_CHAN + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_SUSPEND_CC, #CF_CANCEL_CC, #CF_ABANDON_CC + + + + + + + + + + + + \cfcmd Cancel a transaction + + \par Description + Cancel transaction processing by taking steps to close out cleanly (based on transaction + type and direction) for a single transaction, all channels and transactions, + or all transactions on a specific channel. + + \par Command Structure + #CF_TransactionCmd_t + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_CANCEL + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Transaction not found using compound key, #CF_EID_ERR_CMD_TRANS_NOT_FOUND + - Invalid channel number, #CF_EID_ERR_CMD_TSN_CHAN_INVALID + - No matching transaction, #CF_EID_ERR_CMD_CANCEL_CHAN + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_SUSPEND_CC, #CF_RESUME_CC, #CF_ABANDON_CC + + + + + + + + + + + + \cfcmd Abandon a transaction + + \par Description + Abandon transaction processing with an immediate reset (no close out attempted) + for a single transaction, all channels and transactions, + or all transactions on a specific channel. + + \par Command Structure + #CF_TransactionCmd_t + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_ABANDON + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Transaction not found using compound key, #CF_EID_ERR_CMD_TRANS_NOT_FOUND + - Invalid channel number, #CF_EID_ERR_CMD_TSN_CHAN_INVALID + - No matching transaction, #CF_EID_ERR_CMD_ABANDON_CHAN + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_SUSPEND_CC, #CF_RESUME_CC, #CF_CANCEL_CC + + + + + + + + + + + + \cfcmd Set parameter + + \par Description + Sets a configuration parameter + + \par Command Structure + #CF_SetParamCmd_t + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_GETSET1 + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Invalid configuration parameter key, #CF_EID_ERR_CMD_GETSET_PARAM + - Invalid channel number, #CF_EID_ERR_CMD_GETSET_CHAN + - Parameter value failed validation, #CF_EID_ERR_CMD_GETSET_VALIDATE + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_GET_MIB_PARAM_CC + + + + + + + + + + + + \cfcmd Get parameter + + \par Description + Gets a configuration parameter + + \par Command Structure + #CF_GetParamCmd_t + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_GETSET2 + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Invalid configuration parameter key, #CF_EID_ERR_CMD_GETSET_PARAM + - Invalid channel number, #CF_EID_ERR_CMD_GETSET_CHAN + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_SET_MIB_PARAM_CC + + + + + + + + + + + + \cfcmd Write queue + + \par Description + Writes requested queue(s) to a file + + \par Command Structure + #CF_WriteQueueCmd_t + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_WQ + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Invalid parameter combination, #CF_EID_ERR_CMD_WQ_ARGS + - Invalid channel number, #CF_EID_ERR_CMD_WQ_CHAN + - Open file to write failed, #CF_EID_ERR_CMD_WQ_OPEN + - Write RX data failed, #CF_EID_ERR_CMD_WQ_WRITEQ_RX + - Write RX history data failed, #CF_EID_ERR_CMD_WQ_WRITEHIST_RX + - Write TX data failed, #CF_EID_ERR_CMD_WQ_WRITEQ_TX + - Write TX history data failed, #CF_EID_ERR_CMD_WQ_WRITEHIST_TX + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_PURGE_QUEUE_CC + + + + + + + + + + + + \cfcmd Enable dequeue + + \par Description + Enables the sending of file data PDUs. + + \par Command Structure + #CF_UnionArgsCmd_t where byte[0] specifies the channel number or all channels + - 255 = all channels + - else = single channel + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_ENABLE_DEQUEUE + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM + - Enable dequeue failed, #CF_EID_ERR_CMD_ENABLE_DEQUEUE + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_DISABLE_DEQUEUE_CC + + + + + + + + + + + + \cfcmd Disable dequeue + + \par Description + Disables the sending of file data PDUs. + + \par Command Structure + #CF_UnionArgsCmd_t where byte[0] specifies the channel number or all channels + - 255 = all channels + - else = single channel + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_DISABLE_DEQUEUE + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM + - Disable dequeue failed, #CF_EID_INF_CMD_DISABLE_DEQUEUE + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_ENABLE_DEQUEUE_CC + + + + + + + + + + + + \cfcmd Enable directory polling + + \par Description + Enables the processing of polling directories + + \par Command Structure + #CF_UnionArgsCmd_t + + byte[0] specifies the channel number or all channels + - 255 = all channels + - else = single channel + + byte[1] specifies the polling directory index + - 255 = all polling directories + - else = single polling directory index + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_ENABLE_POLLDIR + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM + - Invalid polling directory index, #CF_EID_ERR_CMD_POLLDIR_INVALID + - Enable directory polling failed, #CF_EID_ERR_CMD_ENABLE_POLLDIR + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_DISABLE_DIR_POLLING_CC + + + + + + + + + + + + \cfcmd Disable directory polling + + \par Description + Disable the processing of polling directories + + \par Command Structure + #CF_UnionArgsCmd_t + + byte[0] specifies the channel number or all channels + - 255 = all channels + - else = single channel + + byte[1] specifies the polling directory index + - 255 = all polling directories + - else = single polling directory index + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_DISABLE_POLLDIR + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM + - Invalid polling directory index, #CF_EID_ERR_CMD_POLLDIR_INVALID + - Disable directory polling failed, #CF_EID_ERR_CMD_DISABLE_POLLDIR + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_ENABLE_DIR_POLLING_CC + + + + + + + + + + + + \cfcmd Purge queue + + \par Description + Purge the requested queue + + \par Command Structure + #CF_UnionArgsCmd_t + + byte[0] specifies the channel number or all channels + - 255 = all channels + - else = single channel + + byte[1] specifies the queue + - 0 = Pending queue + - 1 = History queue + - 2 = Both pending and history queue + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_PURGE_QUEUE + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Invalid channel number, #CF_EID_ERR_CMD_CHAN_PARAM + - Invalid purge queue argument, #CF_EID_ERR_CMD_PURGE_ARG + - Purge queue failed, #CF_EID_ERR_CMD_PURGE_QUEUE + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_WRITE_QUEUE_CC + + + + + + + + + + + + \cfcmd Enable engine + + \par Description + Reinitialize engine and enable processing. Note configuration table updates + are not processed while the engine is enabled. + + \par Command Structure + #CF_NoArgsCmd_t + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_ENABLE_ENGINE + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Engine initialization failed, #CF_EID_ERR_CMD_ENABLE_ENGINE + - Engine already enabled, #CF_EID_ERR_CMD_ENG_ALREADY_ENA + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_ENABLE_ENGINE_CC + + + + + + + + + \cfcmd Disable engine + + \par Description + Disable engine processing. Note configuration table updates + can be performed while the engine is disabled, and when the engine is + re-enabled the new configuration will take affect. + + \par Command Structure + #CF_NoArgsCmd_t + + \par Command Verification + Successful execution of this command may be verified with + the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment + - #CF_EID_INF_CMD_DISABLE_ENGINE + + \par Error Conditions + This command may fail for the following reason(s): + - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN + - Engine already disabled, #CF_EID_ERR_CMD_ENG_ALREADY_DIS + + \par Evidence of failure may be found in the following telemetry: + - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment + + \par Criticality + None + + \sa #CF_DISABLE_ENGINE_CC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fsw/src/cf_eds_dispatch.c b/fsw/src/cf_eds_dispatch.c new file mode 100644 index 00000000..9ca2b97c --- /dev/null +++ b/fsw/src/cf_eds_dispatch.c @@ -0,0 +1,81 @@ +#include "cf_app.h" +#include "cf_events.h" +#include "cf_dispatch.h" +#include "cf_cmd.h" + +#include "cf_eds_dictionary.h" +#include "cf_eds_dispatcher.h" + +#include "cfe_msg.h" + +static const CF_Application_Component_Telecommand_DispatchTable_t CF_TC_DISPATCH_TABLE = { + .CMD = + { + + .AbandonCmd_indication = CF_AbandonCmd, + .CancelCmd_indication = CF_CancelCmd, + .DisableDequeueCmd_indication = CF_DisableDequeueCmd, + .DisableDirPollingCmd_indication = CF_DisableDirPollingCmd, + .DisableEngineCmd_indication = CF_DisableEngineCmd, + .EnableDequeueCmd_indication = CF_EnableDequeueCmd, + .EnableDirPollingCmd_indication = CF_EnableDirPollingCmd, + .EnableEngineCmd_indication = CF_EnableEngineCmd, + .FreezeCmd_indication = CF_FreezeCmd, + .GetParamCmd_indication = CF_GetParamCmd, + .NoopCmd_indication = CF_NoopCmd, + .PlaybackDirCmd_indication = CF_PlaybackDirCmd, + .PurgeQueueCmd_indication = CF_PurgeQueueCmd, + .ResetCmd_indication = CF_ResetCmd, + .ResumeCmd_indication = CF_ResumeCmd, + .SetParamCmd_indication = CF_SetParamCmd, + .SuspendCmd_indication = CF_SuspendCmd, + .ThawCmd_indication = CF_ThawCmd, + .TxFileCmd_indication = CF_TxFileCmd, + .WriteQueueCmd_indication = CF_WriteQueueCmd, + }, + .SEND_HK = {.indication = CF_SendHkCmd}, + .WAKE_UP = {.indication = CF_WakeupCmd}}; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* */ +/* CF_TaskPipe() -- Process command pipe message */ +/* */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +void CF_AppPipe(const CFE_SB_Buffer_t *SbBufPtr) +{ + CFE_Status_t status; + CFE_SB_MsgId_t MsgId; + CFE_MSG_Size_t MsgSize; + CFE_MSG_FcnCode_t MsgFc; + + status = CF_Application_Component_Telecommand_Dispatch(CFE_SB_Telecommand_indication_Command_ID, SbBufPtr, + &CF_TC_DISPATCH_TABLE); + + if (status != CFE_SUCCESS) + { + CFE_MSG_GetMsgId(&SbBufPtr->Msg, &MsgId); + ++CF_AppData.hk.Payload.counters.err; + + if (status == CFE_STATUS_UNKNOWN_MSG_ID) + { + CFE_EVS_SendEvent(CF_EID_ERR_INVALID_MID, CFE_EVS_EventType_ERROR, + "L%d TO: Invalid Msg ID Rcvd 0x%x status=0x%08x", __LINE__, + (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)status); + } + else if (status == CFE_STATUS_WRONG_MSG_LENGTH) + { + CFE_MSG_GetSize(&SbBufPtr->Msg, &MsgSize); + CFE_MSG_GetFcnCode(&SbBufPtr->Msg, &MsgFc); + CFE_EVS_SendEvent(CF_CMD_LEN_ERR_EID, CFE_EVS_EventType_ERROR, + "Invalid length for command: ID = 0x%X, CC = %d, length = %u", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), (int)MsgFc, (unsigned int)MsgSize); + } + else + { + CFE_MSG_GetFcnCode(&SbBufPtr->Msg, &MsgFc); + CFE_EVS_SendEvent(CF_CC_ERR_EID, CFE_EVS_EventType_ERROR, + "L%d TO: Invalid Function Code Rcvd In Ground Command 0x%x", __LINE__, + (unsigned int)MsgFc); + } + } +} diff --git a/mission_build.cmake b/mission_build.cmake index 0dcdff61..aa9204c2 100644 --- a/mission_build.cmake +++ b/mission_build.cmake @@ -31,7 +31,9 @@ if (CFE_EDS_ENABLED_BUILD) # In an EDS-based build, these files come generated from the EDS tool set(CF_CFGFILE_SRC_cf_interface_cfg "cf_eds_designparameters.h") set(CF_CFGFILE_SRC_cf_fcncodes "cf_eds_cc.h") + set(CF_CFGFILE_SRC_cf_msgdefs "cf_eds_typedefs.h") set(CF_CFGFILE_SRC_cf_msgstruct "cf_eds_typedefs.h") + set(CF_CFGFILE_SRC_cf_tbldefs "cf_eds_typedefs.h") set(CF_CFGFILE_SRC_cf_tblstruct "cf_eds_typedefs.h") endif(CFE_EDS_ENABLED_BUILD) diff --git a/unit-test/cf_eds_dispatch_tests.c b/unit-test/cf_eds_dispatch_tests.c new file mode 100644 index 00000000..cb9e1fe3 --- /dev/null +++ b/unit-test/cf_eds_dispatch_tests.c @@ -0,0 +1,70 @@ +/************************************************************************ + * 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. + ************************************************************************/ + +/* cf testing includes */ +#include "cf_test_utils.h" +#include "cf_dispatch.h" +#include "cf_eds_dispatcher.h" +#include "cf_cmd.h" +#include "cf_msgids.h" +#include "cf_events.h" + + +/* UT includes */ +#include "uttest.h" +#include "utassert.h" +#include "utstubs.h" + +void cf_dispatch_tests_Setup(void) +{ + cf_tests_Setup(); +} + +void cf_dispatch_tests_Teardown(void) +{ + cf_tests_Teardown(); +} + +/* +********************************************************************************** +** TEST CASE FUNCTIONS +********************************************************************************** +*/ + +void Test_CF_AppPipe(void) +{ + /* + * Test Case For: + * void CF_AppPipe + */ + CFE_SB_Buffer_t UtBuf; + + UT_SetDeferredRetcode(UT_KEY(CFE_MSG_EdsDispatch), 1, CFE_SUCCESS); + + memset(&UtBuf, 0, sizeof(UtBuf)); + UtAssert_VOIDCALL(CF_AppPipe(&UtBuf)); +} + +/* + * Register the test cases to execute with the unit test tool + */ +void UtTest_Setup(void) +{ + UtTest_Add(Test_CF_AppPipe, cf_dispatch_tests_Setup, cf_dispatch_tests_Teardown, "Test_CF_AppPipe"); +}