From 61566011b3aa4d7cfece68ff77955bb87fe0a974 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 17 Jan 2024 13:37:00 -0500 Subject: [PATCH] Fix #113, use CFE_TBL_FILEDEF macro for table definitions The FILEDEF macro is intended to allow table source files to adapt to other tools and workflows more easily. The macro should be used instead of instantiating the CFE_TBL_FileDef_t structure directly. --- fsw/tables/hs_amt.c | 5 ++--- fsw/tables/hs_mat.c | 7 +++---- fsw/tables/hs_xct.c | 5 ++--- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/fsw/tables/hs_amt.c b/fsw/tables/hs_amt.c index a09b682..7398961 100644 --- a/fsw/tables/hs_amt.c +++ b/fsw/tables/hs_amt.c @@ -31,9 +31,6 @@ #include "hs_tbldefs.h" #include "cfe_tbl_filedef.h" -CFE_TBL_FileDef_t CFE_TBL_FileDef = {"HS_AppMon_Tbl", HS_APP_NAME ".AppMon_Tbl", "HS AppMon Table", "hs_amt.tbl", - (sizeof(HS_AMTEntry_t) * HS_MAX_MONITORED_APPS)}; - HS_AMTEntry_t HS_AppMon_Tbl[HS_MAX_MONITORED_APPS] = { /* AppName NullTerm CycleCount ActionType */ @@ -70,3 +67,5 @@ HS_AMTEntry_t HS_AppMon_Tbl[HS_MAX_MONITORED_APPS] = { /* 30 */ {"", 0, 10, HS_AMT_ACT_NOACT}, /* 31 */ {"", 0, 10, HS_AMT_ACT_NOACT}, }; + +CFE_TBL_FILEDEF(HS_AppMon_Tbl, HS.AppMon_Tbl, HS AppMon Table, hs_amt.tbl) diff --git a/fsw/tables/hs_mat.c b/fsw/tables/hs_mat.c index f7b5192..3c3a29c 100644 --- a/fsw/tables/hs_mat.c +++ b/fsw/tables/hs_mat.c @@ -35,9 +35,6 @@ #include "cfe_es_msg.h" #include "cfe_msgids.h" -CFE_TBL_FileDef_t CFE_TBL_FileDef = {"HS_Default_MsgActs_Tbl", HS_APP_NAME ".MsgActs_Tbl", "HS MsgActs Table", - "hs_mat.tbl", (sizeof(HS_MATEntry_t) * HS_MAX_MSG_ACT_TYPES)}; - /* Checksum for each desired command - Note that if checksum is enabled, real values (non-zero) must be input */ #ifndef CFE_TBL_NOOP_CKSUM #define CFE_TBL_NOOP_CKSUM 0x00 @@ -66,7 +63,7 @@ typedef struct /* Helper macro to get size of structure elements */ #define HS_MEMBER_SIZE(member) (sizeof(((HS_Message *)0)->member)) -HS_MatTableEntry_t HS_Default_MsgActs_Tbl[HS_MAX_MSG_ACT_TYPES] = { +HS_MatTableEntry_t HS_MsgActs_Tbl[HS_MAX_MSG_ACT_TYPES] = { /* EnableState Cooldown Message */ /* 0 */ @@ -103,3 +100,5 @@ HS_MatTableEntry_t HS_Default_MsgActs_Tbl[HS_MAX_MSG_ACT_TYPES] = { .HsMsg.cmd1 = {CFE_MSG_CMD_HDR_INIT(CFE_TBL_CMD_MID, HS_MEMBER_SIZE(cmd1), CFE_TBL_NOOP_CC, CFE_TBL_NOOP_CKSUM)}} }; + +CFE_TBL_FILEDEF(HS_MsgActs_Tbl, HS.MsgActs_Tbl, HS MsgActs Table, hs_mat.tbl) \ No newline at end of file diff --git a/fsw/tables/hs_xct.c b/fsw/tables/hs_xct.c index 5363dc4..b2772ae 100644 --- a/fsw/tables/hs_xct.c +++ b/fsw/tables/hs_xct.c @@ -31,9 +31,6 @@ #include "hs_tbldefs.h" #include "cfe_tbl_filedef.h" -CFE_TBL_FileDef_t CFE_TBL_FileDef = {"HS_ExeCount_Tbl", HS_APP_NAME ".ExeCount_Tbl", "HS ExeCount Table", "hs_xct.tbl", - (sizeof(HS_XCTEntry_t) * HS_MAX_EXEC_CNT_SLOTS)}; - HS_XCTEntry_t HS_ExeCount_Tbl[HS_MAX_EXEC_CNT_SLOTS] = { /* ResourceName NullTerm ResourceType */ @@ -70,3 +67,5 @@ HS_XCTEntry_t HS_ExeCount_Tbl[HS_MAX_EXEC_CNT_SLOTS] = { /* 30 */ {"", 0, HS_XCT_TYPE_NOTYPE}, /* 31 */ {"", 0, HS_XCT_TYPE_NOTYPE}, }; + +CFE_TBL_FILEDEF(HS_ExeCount_Tbl, HS.ExeCount_Tbl, HS ExeCount Table, hs_xct.tbl)