Skip to content

Commit

Permalink
Merge pull request #426 from jphickey/fix-422-dispatcher
Browse files Browse the repository at this point in the history
Fix #422, implement dispatcher pattern for CF
  • Loading branch information
jphickey committed Jan 11, 2024
2 parents 0a9d4a1 + 989274c commit ab17422
Show file tree
Hide file tree
Showing 25 changed files with 1,012 additions and 701 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ 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
)
Expand Down
45 changes: 44 additions & 1 deletion config/default_cf_extern_typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
#ifndef CF_EXTERN_TYPEDEFS_H
#define CF_EXTERN_TYPEDEFS_H

#include "cf_platform_cfg.h"
/* constants such as CF_FILENAME_MAX_LEN are in mission_cfg.h */
#include "cf_mission_cfg.h"

/**
* @brief Values for CFDP file transfer class
Expand Down Expand Up @@ -70,4 +71,46 @@ typedef struct CF_TxnFilenames
char dst_filename[CF_FILENAME_MAX_LEN];
} CF_TxnFilenames_t;

/**
* @brief Entity id size
*
* @par Description:
* The maximum size of the entity id as expected for all CFDP packets.
* CF supports the spec's variable size of EID, 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 an EID may be.
*
* @note This type is used in several CF commands, and so changing the size
* of this type will affect the following structs:
* CF_ConfigTable_t, configuration table - will change size of file
* CF_ConfigPacket_t, set config params command
* CF_TxFileCmd_t, transmit file command
* CF_PlaybackDirCmd_t, equivalent to above
* CF_Transaction_Payload_t, any command that selects a transaction based on EID
*
* @par Limits
* Must be one of uint8, uint16, uint32, uint64.
*/
typedef uint32 CF_EntityId_t;

/**
* @brief transaction sequence number size
*
* @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.
*/
typedef uint32 CF_TransactionSeq_t;

#endif /* CF_EXTERN_TYPEDEFS_H */
8 changes: 4 additions & 4 deletions config/default_cf_fcncodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ typedef enum
* \par Criticality
* None
*
* \sa #CF_GET_MIB_PARAM_CC
* \sa #CF_GET_PARAM_CC
*/
CF_SET_MIB_PARAM_CC = 10,
CF_SET_PARAM_CC = 10,

/**
* \brief Get parameter
Expand Down Expand Up @@ -431,9 +431,9 @@ typedef enum
* \par Criticality
* None
*
* \sa #CF_SET_MIB_PARAM_CC
* \sa #CF_SET_PARAM_CC
*/
CF_GET_MIB_PARAM_CC = 11,
CF_GET_PARAM_CC = 11,

/**
* \brief Write queue
Expand Down
80 changes: 0 additions & 80 deletions config/default_cf_interface_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,48 +41,6 @@
* \{
*/

/**
* @brief Entity id size
*
* @par Description:
* The maximum size of the entity id as expected for all CFDP packets.
* CF supports the spec's variable size of EID, 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 an EID may be.
*
* @note This type is used in several CF commands, and so changing the size
* of this type will affect the following structs:
* CF_ConfigTable_t, configuration table - will change size of file
* CF_ConfigPacket_t, set config params command
* CF_TxFileCmd_t, transmit file command
* CF_PlaybackDirCmd_t, equivalent to above
* CF_Transaction_Payload_t, any command that selects a transaction based on EID
*
* @par Limits
* Must be one of uint8, uint16, uint32, uint64.
*/
typedef uint32 CF_EntityId_t;

/**
* @brief transaction sequence number size
*
* @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.
*/
typedef uint32 CF_TransactionSeq_t;

/**
* @brief Number of channels
*
Expand All @@ -108,20 +66,6 @@ typedef uint32 CF_TransactionSeq_t;
*/
#define CF_NAK_MAX_SEGMENTS (58)

/**
* @brief Total number of chunks (tx, rx, all channels)
*
* @par Description:
* Must be equal to the sum of all values input in CF_CHANNEL_NUM_RX_CHUNKS_PER_TRANSACTION
* and CF_CHANNEL_NUM_TX_CHUNKS_PER_TRANSACTION.
*
* @par Limits:
*
*/
/* CF_TOTAL_CHUNKS must be equal to the total number of chunks per rx/tx transactions per channel */
/* (in other words, the summation of all elements in CF_CHANNEL_NUM_R/TX_CHUNKS_PER_TRANSACTION */
#define CF_TOTAL_CHUNKS (CF_NAK_MAX_SEGMENTS * 4)

/**
* @brief Max number of polling directories per channel.
*
Expand Down Expand Up @@ -158,14 +102,6 @@ typedef uint32 CF_TransactionSeq_t;
*/
#define CF_FILENAME_MAX_NAME CFE_MISSION_MAX_FILE_LEN

/**
* @brief Maximum file path (not including file name)
*
* @par Limits:
*
*/
#define CF_FILENAME_MAX_PATH (CFE_MISSION_MAX_PATH_LEN - CFE_MISSION_MAX_FILE_LEN)

/**
* @brief Max filename and path length.
*
Expand Down Expand Up @@ -196,22 +132,6 @@ typedef uint32 CF_TransactionSeq_t;
*/
#define CF_PDU_ENCAPSULATION_EXTRA_TRAILING_BYTES 0

/**
* \brief Mission specific version number
*
* \par Description:
* An application version number consists of four parts:
* major version number, minor version number, revision
* number and mission specific revision number. The mission
* specific revision number is defined here such
* that missions can manage as a configuration definition
*
* \par Limits:
* Must be defined as a numeric value that is greater than
* or equal to zero.
*/
#define CF_MISSION_REV 0

/**\}*/

#endif
8 changes: 8 additions & 0 deletions config/default_cf_mission_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,12 @@

#include "cf_interface_cfg.h"

/**
* @brief Maximum file path (not including file name)
*
* @par Limits:
*
*/
#define CF_FILENAME_MAX_PATH (CFE_MISSION_MAX_PATH_LEN - CFE_MISSION_MAX_FILE_LEN)

#endif
4 changes: 2 additions & 2 deletions config/default_cf_msgdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ typedef enum
/**
* \brief Get parameter command structure
*
* For command details see #CF_GET_MIB_PARAM_CC
* For command details see #CF_GET_PARAM_CC
*/
typedef struct CF_GetParam_Payload
{
Expand All @@ -223,7 +223,7 @@ typedef struct CF_GetParam_Payload
/**
* \brief Set parameter command structure
*
* For command details see #CF_SET_MIB_PARAM_CC
* For command details see #CF_SET_PARAM_CC
*/
typedef struct CF_SetParam_Payload
{
Expand Down
24 changes: 22 additions & 2 deletions config/default_cf_msgstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ typedef struct CF_PurgeQueueCmd
/**
* \brief Get parameter command structure
*
* For command details see #CF_GET_MIB_PARAM_CC
* For command details see #CF_GET_PARAM_CC
*/
typedef struct CF_GetParamCmd
{
Expand All @@ -198,7 +198,7 @@ typedef struct CF_GetParamCmd
/**
* \brief Set parameter command structure
*
* For command details see #CF_SET_MIB_PARAM_CC
* For command details see #CF_SET_PARAM_CC
*/
typedef struct CF_SetParamCmd
{
Expand Down Expand Up @@ -283,6 +283,26 @@ typedef struct CF_AbandonCmd
CF_Transaction_Payload_t Payload;
} CF_AbandonCmd_t;

/**
* \brief Send Housekeeping Command
*
* Internal notification from SCH with no payload
*/
typedef struct CF_SendHkCmd
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} CF_SendHkCmd_t;

/**
* \brief Wake Up Command
*
* Internal notification from SCH with no payload
*/
typedef struct CF_WakeupCmd
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} CF_WakeupCmd_t;

/**\}*/

#endif
30 changes: 30 additions & 0 deletions config/default_cf_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,34 @@
#include "cf_mission_cfg.h"
#include "cf_internal_cfg.h"

/**
* @brief Total number of chunks (tx, rx, all channels)
*
* @par Description:
* Must be equal to the sum of all values input in CF_CHANNEL_NUM_RX_CHUNKS_PER_TRANSACTION
* and CF_CHANNEL_NUM_TX_CHUNKS_PER_TRANSACTION.
*
* @par Limits:
*
*/
/* CF_TOTAL_CHUNKS must be equal to the total number of chunks per rx/tx transactions per channel */
/* (in other words, the summation of all elements in CF_CHANNEL_NUM_R/TX_CHUNKS_PER_TRANSACTION */
#define CF_TOTAL_CHUNKS (CF_NAK_MAX_SEGMENTS * 4)

/**
* \brief Mission specific version number
*
* \par Description:
* An application version number consists of four parts:
* major version number, minor version number, revision
* number and mission specific revision number. The mission
* specific revision number is defined here such
* that missions can manage as a configuration definition
*
* \par Limits:
* Must be defined as a numeric value that is greater than
* or equal to zero.
*/
#define CF_MISSION_REV 0

#endif
4 changes: 2 additions & 2 deletions docs/dox_src/cfs_cf.dox
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ CF_UnionArgs_Payload_t;
<H2> Set MIB Parameter Command </H2>

The CF Set MIB Parameter command is sent to CF using message ID #CF_CMD_MID
with command code #CF_SET_MIB_PARAM_CC. This command is used to change the
with command code #CF_SET_PARAM_CC. This command is used to change the
flight engine Message Information Base (MIB). The MIB is a term used in the
CCSDS blue book that can be interpreted as the engine configuration
parameters. The command has two command parameters, Param indicates which
Expand Down Expand Up @@ -1001,7 +1001,7 @@ CF_UnionArgs_Payload_t;
<H2> Get MIB Parameter Command </H2>

The CF Set MIB Parameter command is sent to CF using message ID #CF_CMD_MID
with command code #CF_GET_MIB_PARAM_CC. This command is used to view a single
with command code #CF_GET_PARAM_CC. This command is used to view a single
Message Information Base (MIB) parameter. The MIB is a term used in the CCSDS
blue book that can be interpreted as the engine configuration parameters.

Expand Down
4 changes: 2 additions & 2 deletions fsw/inc/cf_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
*
* Invalid message ID received on the software bus pipe
*/
#define CF_EID_ERR_INIT_CMD_LENGTH (28)
#define CF_EID_ERR_INVALID_MID (28)

/**
* \brief CF SB Receive Buffer Failed Event ID
Expand Down Expand Up @@ -372,7 +372,7 @@
*
* Can be induced via various off-nominal conditions - such as sending a META-data PDU
* with an invalid file destination.
*
*
*/
#define CF_EID_DBG_RESET_FREED_XACT (59)

Expand Down
Loading

0 comments on commit ab17422

Please sign in to comment.