From 746aadd6dd40b97754380b5e789980ab556e5f67 Mon Sep 17 00:00:00 2001 From: Avi Date: Mon, 24 Oct 2022 10:55:39 +1000 Subject: [PATCH] Fix #16, Move Table Header definitions from sc_app.h to sc_tbldefs.h --- .vscode/settings.json | 6 +++++ fsw/src/sc_app.h | 54 ---------------------------------------- fsw/src/sc_tbldefs.h | 57 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 54 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..570cd1b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.associations": { + "sc_utils.h": "c", + "sc_test_utils.h": "c" + } +} \ No newline at end of file diff --git a/fsw/src/sc_app.h b/fsw/src/sc_app.h index 6dd8fea..d13c6e7 100644 --- a/fsw/src/sc_app.h +++ b/fsw/src/sc_app.h @@ -184,9 +184,6 @@ void SC_RegisterManageCmds(void); #define SC_BYTES_IN_WORD 4 /**< \brief Number of bytes in "word" used to define table lengths */ -#define SC_ATS_HEADER_SIZE (sizeof(SC_AtsEntryHeader_t)) /**< \brief ATS header size in bytes */ -#define SC_RTS_HEADER_SIZE (sizeof(SC_RtsEntryHeader_t)) /**< \brief RTS header size in bytes */ - #define SC_ATS_BUFF_SIZE32 (SC_ATS_BUFF_SIZE / 2) /**< \brief ATS buffer number of 32-bit elements */ #define SC_RTS_BUFF_SIZE32 (SC_RTS_BUFF_SIZE / 2) /**< \brief RTS buffer number of 32-bit elements */ #define SC_APPEND_BUFF_SIZE32 (SC_APPEND_BUFF_SIZE / 2) /**< \brief Append buffer number of 32-bit elements */ @@ -225,57 +222,6 @@ void SC_RegisterManageCmds(void); #define SC_RTS_ID_TO_INDEX(id) ((id)-1) /**< \brief Convert RTS ID to index */ #define SC_RTS_INDEX_TO_ID(index) ((index) + 1) /**< \brief Convert RTS table index to ID */ -/** - * \brief ATS Table Entry Header Type - */ -typedef struct -{ - uint16 Pad; /**< \brief Structure padding */ - - uint16 CmdNumber; /**< \brief command number, range = 1 to SC_MAX_ATS_CMDS */ - - uint16 TimeTag_MS; /**< \brief Time tag most significant 16 bits */ - uint16 TimeTag_LS; /**< \brief Time tag least significant 16 bits */ - - /* - * Note: the command packet data is variable length, - * the command packet header (not shown here), - * comes directly after the time tag - */ -} SC_AtsEntryHeader_t; - -/** - * \brief ATS header and message header - */ -typedef struct -{ - SC_AtsEntryHeader_t Header; /**< \brief ATS header */ - CFE_MSG_Message_t Msg; /**< \brief MSG header */ -} SC_AtsEntry_t; - -/** - * \brief RTS Command Header Type - */ -typedef struct -{ - SC_RelTimeTag_t TimeTag; /**< \brief Relative time tag */ - - /* - * Note: the command packet data is variable length, - * the command packet header (not shown here), - * comes directly after Time tag. - */ -} SC_RtsEntryHeader_t; - -/** - * \brief RTS header and message header - */ -typedef struct -{ - SC_RtsEntryHeader_t Header; /**< \brief RTS header */ - CFE_MSG_Message_t Msg; /**< \brief MSG header */ -} SC_RtsEntry_t; - /** * \brief SC Operational Data Structure * diff --git a/fsw/src/sc_tbldefs.h b/fsw/src/sc_tbldefs.h index 93083c7..741d299 100644 --- a/fsw/src/sc_tbldefs.h +++ b/fsw/src/sc_tbldefs.h @@ -30,6 +30,12 @@ #include "cfe.h" #include "sc_platform_cfg.h" +/************************************************************************* + * Macro Definitions + *************************************************************************/ +#define SC_ATS_HEADER_SIZE (sizeof(SC_AtsEntryHeader_t)) /**< \brief ATS header size in bytes */ +#define SC_RTS_HEADER_SIZE (sizeof(SC_RtsEntryHeader_t)) /**< \brief RTS header size in bytes */ + /** * \defgroup cfscstblids ID definitions for cFE Table Services manage table request command * \{ @@ -107,4 +113,55 @@ typedef struct uint16 UseCtr; /**< \brief how many times RTS is run */ } SC_RtsInfoEntry_t; +/** + * \brief ATS Table Entry Header Type + */ +typedef struct +{ + uint16 Pad; /**< \brief Structure padding */ + + uint16 CmdNumber; /**< \brief command number, range = 1 to SC_MAX_ATS_CMDS */ + + uint16 TimeTag_MS; /**< \brief Time tag most significant 16 bits */ + uint16 TimeTag_LS; /**< \brief Time tag least significant 16 bits */ + + /* + * Note: the command packet data is variable length, + * the command packet header (not shown here), + * comes directly after the time tag + */ +} SC_AtsEntryHeader_t; + +/** + * \brief ATS header and message header + */ +typedef struct +{ + SC_AtsEntryHeader_t Header; /**< \brief ATS header */ + CFE_MSG_Message_t Msg; /**< \brief MSG header */ +} SC_AtsEntry_t; + +/** + * \brief RTS Command Header Type + */ +typedef struct +{ + SC_RelTimeTag_t TimeTag; /**< \brief Relative time tag */ + + /* + * Note: the command packet data is variable length, + * the command packet header (not shown here), + * comes directly after Time tag. + */ +} SC_RtsEntryHeader_t; + +/** + * \brief RTS header and message header + */ +typedef struct +{ + SC_RtsEntryHeader_t Header; /**< \brief RTS header */ + CFE_MSG_Message_t Msg; /**< \brief MSG header */ +} SC_RtsEntry_t; + #endif