From 1d33e2fd894293717fffecd0cef189f1b435c2ed Mon Sep 17 00:00:00 2001 From: Justin Figueroa Date: Tue, 6 Dec 2022 11:22:25 -0500 Subject: [PATCH] Fix #54, Moves interface definition files to inc --- CMakeLists.txt | 7 +- fsw/{src => inc}/hs_events.h | 0 fsw/inc/hs_extern_typedefs.h | 93 +++++++++++++++++++++ fsw/{src => inc}/hs_msg.h | 0 fsw/{src => inc}/hs_msgdefs.h | 0 fsw/{platform_inc => inc}/hs_msgids.h | 0 fsw/{mission_inc => inc}/hs_perfids.h | 0 fsw/{platform_inc => inc}/hs_platform_cfg.h | 0 fsw/{src => inc}/hs_tbldefs.h | 0 fsw/src/hs_app.h | 2 +- fsw/src/hs_tbl.h | 61 -------------- fsw/tables/hs_amt.c | 2 +- fsw/tables/hs_emt.c | 2 +- fsw/tables/hs_mat.c | 2 +- fsw/tables/hs_xct.c | 2 +- unit-test/CMakeLists.txt | 4 +- 16 files changed, 104 insertions(+), 71 deletions(-) rename fsw/{src => inc}/hs_events.h (100%) create mode 100644 fsw/inc/hs_extern_typedefs.h rename fsw/{src => inc}/hs_msg.h (100%) rename fsw/{src => inc}/hs_msgdefs.h (100%) rename fsw/{platform_inc => inc}/hs_msgids.h (100%) rename fsw/{mission_inc => inc}/hs_perfids.h (100%) rename fsw/{platform_inc => inc}/hs_platform_cfg.h (100%) rename fsw/{src => inc}/hs_tbldefs.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index c186dc7..0935511 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,5 @@ project(CFS_HS C) -include_directories(fsw/src) -include_directories(fsw/mission_inc) -include_directories(fsw/platform_inc) - set(APP_SRC_FILES fsw/src/hs_monitors.c fsw/src/hs_utils.c @@ -15,6 +11,9 @@ set(APP_SRC_FILES # Create the app module add_cfe_app(hs ${APP_SRC_FILES}) +# This permits direct access to public headers in the fsw/inc directory +target_include_directories(hs PUBLIC fsw/inc) + set(APP_TABLE_FILES fsw/tables/hs_mat.c fsw/tables/hs_xct.c diff --git a/fsw/src/hs_events.h b/fsw/inc/hs_events.h similarity index 100% rename from fsw/src/hs_events.h rename to fsw/inc/hs_events.h diff --git a/fsw/inc/hs_extern_typedefs.h b/fsw/inc/hs_extern_typedefs.h new file mode 100644 index 0000000..7a7b898 --- /dev/null +++ b/fsw/inc/hs_extern_typedefs.h @@ -0,0 +1,93 @@ +/************************************************************************ + * 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 + * + * Declarations and prototypes for fm_extern_typedefs module + */ + +#ifndef HS_EXTERN_TYPEDEFS_H +#define HS_EXTERN_TYPEDEFS_H + +#include "cfe.h" +#include "hs_platform_cfg.h" + +/************************************************************************* + * Type Definitions + *************************************************************************/ + +/* +** In the following definitions, NullTerm may have a differing size for alignment purposes +** specifically it must be 32 bits in the XCT to align Resource Type, while it can be 16 bits +** in the other two. +*/ + +/** + * \brief Application Monitor Table (AMT) Entry + */ +typedef struct +{ + char AppName[OS_MAX_API_NAME]; /**< \brief Name of application to be monitored */ + uint16 NullTerm; /**< \brief Buffer of nulls to terminate string */ + uint16 CycleCount; /**< \brief Number of cycles before application is missing */ + uint16 ActionType; /**< \brief Action to take if application is missing */ +} HS_AMTEntry_t; + +/** + * \brief Event Monitor Table (EMT) Entry + */ +typedef struct +{ + char AppName[OS_MAX_API_NAME]; /**< \brief Name of application generating event */ + uint16 NullTerm; /**< \brief Buffer of nulls to terminate string */ + uint16 EventID; /**< \brief Event number of monitored event */ + uint16 ActionType; /**< \brief Action to take if event is received */ +} HS_EMTEntry_t; + +/** + * \brief Execution Counters Table (XCT) Entry + */ +typedef struct +{ + char ResourceName[OS_MAX_API_NAME]; /**< \brief Name of resource being monitored */ + uint32 NullTerm; /**< \brief Buffer of nulls to terminate string */ + uint32 ResourceType; /**< \brief Type of execution counter */ +} HS_XCTEntry_t; + +/** + * \brief Message Action Table buffer + */ +typedef union +{ + uint8 Message[HS_MAX_MSG_ACT_SIZE]; /**< \brief Raw message array for sizing */ + CFE_SB_Buffer_t Buffer; /**< \brief Message Buffer for alignment */ +} HS_MATMsgBuf_t; + +/** + * \brief Message Actions Table (MAT) Entry + */ +typedef struct +{ + uint16 EnableState; /**< \brief If entry contains message */ + uint16 Cooldown; /**< \brief Minimum rate at which message can be sent */ + HS_MATMsgBuf_t MsgBuf; /**< \brief Message to be sent */ +} HS_MATEntry_t; + +#endif /* HS_EXTERN_TYPEDEFS_H */ \ No newline at end of file diff --git a/fsw/src/hs_msg.h b/fsw/inc/hs_msg.h similarity index 100% rename from fsw/src/hs_msg.h rename to fsw/inc/hs_msg.h diff --git a/fsw/src/hs_msgdefs.h b/fsw/inc/hs_msgdefs.h similarity index 100% rename from fsw/src/hs_msgdefs.h rename to fsw/inc/hs_msgdefs.h diff --git a/fsw/platform_inc/hs_msgids.h b/fsw/inc/hs_msgids.h similarity index 100% rename from fsw/platform_inc/hs_msgids.h rename to fsw/inc/hs_msgids.h diff --git a/fsw/mission_inc/hs_perfids.h b/fsw/inc/hs_perfids.h similarity index 100% rename from fsw/mission_inc/hs_perfids.h rename to fsw/inc/hs_perfids.h diff --git a/fsw/platform_inc/hs_platform_cfg.h b/fsw/inc/hs_platform_cfg.h similarity index 100% rename from fsw/platform_inc/hs_platform_cfg.h rename to fsw/inc/hs_platform_cfg.h diff --git a/fsw/src/hs_tbldefs.h b/fsw/inc/hs_tbldefs.h similarity index 100% rename from fsw/src/hs_tbldefs.h rename to fsw/inc/hs_tbldefs.h diff --git a/fsw/src/hs_app.h b/fsw/src/hs_app.h index 806c56c..de15237 100644 --- a/fsw/src/hs_app.h +++ b/fsw/src/hs_app.h @@ -32,7 +32,7 @@ #include "hs_tbl.h" #include "cfe.h" #include "cfe_msgids.h" -#include "cfe_platform_cfg.h" +#include "hs_extern_typedefs.h" /************************************************************************ * Macro Definitions diff --git a/fsw/src/hs_tbl.h b/fsw/src/hs_tbl.h index c73e1d3..b73ee02 100644 --- a/fsw/src/hs_tbl.h +++ b/fsw/src/hs_tbl.h @@ -47,65 +47,4 @@ #define HS_EMT_ACT_MSG(num) (HS_EMT_ACT_LAST_NONMSG + 1 + (num)) /**\}*/ -/************************************************************************* - * Type Definitions - *************************************************************************/ - -/* -** In the following definitions, NullTerm may have a differing size for alignment purposes -** specifically it must be 32 bits in the XCT to align Resource Type, while it can be 16 bits -** in the other two. -*/ - -/** - * \brief Application Monitor Table (AMT) Entry - */ -typedef struct -{ - char AppName[OS_MAX_API_NAME]; /**< \brief Name of application to be monitored */ - uint16 NullTerm; /**< \brief Buffer of nulls to terminate string */ - uint16 CycleCount; /**< \brief Number of cycles before application is missing */ - uint16 ActionType; /**< \brief Action to take if application is missing */ -} HS_AMTEntry_t; - -/** - * \brief Event Monitor Table (EMT) Entry - */ -typedef struct -{ - char AppName[OS_MAX_API_NAME]; /**< \brief Name of application generating event */ - uint16 NullTerm; /**< \brief Buffer of nulls to terminate string */ - uint16 EventID; /**< \brief Event number of monitored event */ - uint16 ActionType; /**< \brief Action to take if event is received */ -} HS_EMTEntry_t; - -/** - * \brief Execution Counters Table (XCT) Entry - */ -typedef struct -{ - char ResourceName[OS_MAX_API_NAME]; /**< \brief Name of resource being monitored */ - uint32 NullTerm; /**< \brief Buffer of nulls to terminate string */ - uint32 ResourceType; /**< \brief Type of execution counter */ -} HS_XCTEntry_t; - -/** - * \brief Message Action Table buffer - */ -typedef union -{ - uint8 Message[HS_MAX_MSG_ACT_SIZE]; /**< \brief Raw message array for sizing */ - CFE_SB_Buffer_t Buffer; /**< \brief Message Buffer for alignment */ -} HS_MATMsgBuf_t; - -/** - * \brief Message Actions Table (MAT) Entry - */ -typedef struct -{ - uint16 EnableState; /**< \brief If entry contains message */ - uint16 Cooldown; /**< \brief Minimum rate at which message can be sent */ - HS_MATMsgBuf_t MsgBuf; /**< \brief Message to be sent */ -} HS_MATEntry_t; - #endif diff --git a/fsw/tables/hs_amt.c b/fsw/tables/hs_amt.c index 9e6c6d9..a774f7e 100644 --- a/fsw/tables/hs_amt.c +++ b/fsw/tables/hs_amt.c @@ -26,7 +26,7 @@ ** Includes *************************************************************************/ #include "cfe.h" -#include "hs_tbl.h" +#include "hs_extern_typedefs.h" #include "hs_tbldefs.h" #include "cfe_tbl_filedef.h" diff --git a/fsw/tables/hs_emt.c b/fsw/tables/hs_emt.c index bc1325e..9275506 100644 --- a/fsw/tables/hs_emt.c +++ b/fsw/tables/hs_emt.c @@ -26,7 +26,7 @@ ** Includes *************************************************************************/ #include "cfe.h" -#include "hs_tbl.h" +#include "hs_extern_typedefs.h" #include "hs_tbldefs.h" #include "cfe_tbl_filedef.h" diff --git a/fsw/tables/hs_mat.c b/fsw/tables/hs_mat.c index 6b2ca68..387351b 100644 --- a/fsw/tables/hs_mat.c +++ b/fsw/tables/hs_mat.c @@ -26,7 +26,7 @@ ** Includes *************************************************************************/ #include "cfe.h" -#include "hs_tbl.h" +#include "hs_extern_typedefs.h" #include "hs_tbldefs.h" #include "cfe_tbl_filedef.h" diff --git a/fsw/tables/hs_xct.c b/fsw/tables/hs_xct.c index 9d2c365..fbfa7d8 100644 --- a/fsw/tables/hs_xct.c +++ b/fsw/tables/hs_xct.c @@ -26,7 +26,7 @@ ** Includes *************************************************************************/ #include "cfe.h" -#include "hs_tbl.h" +#include "hs_extern_typedefs.h" #include "hs_tbldefs.h" #include "cfe_tbl_filedef.h" diff --git a/unit-test/CMakeLists.txt b/unit-test/CMakeLists.txt index 15408fe..8ac80b2 100644 --- a/unit-test/CMakeLists.txt +++ b/unit-test/CMakeLists.txt @@ -19,8 +19,10 @@ add_cfe_coverage_stubs("hs_internal" # Link with the cfe core stubs and unit test assert libs target_link_libraries(coverage-hs_internal-stubs ut_core_api_stubs ut_assert) -# Include and expose unit test utilities includes +# Include and expose unit test utilities, fsw/inc, and fsw/src includes target_include_directories(coverage-hs_internal-stubs PUBLIC utilities) +target_include_directories(coverage-hs_internal-stubs PUBLIC ../fsw/inc) +target_include_directories(coverage-hs_internal-stubs PUBLIC ../fsw/src) # Generate a dedicated "testrunner" executable for each test file # Accomplish this by cycling through all the app's source files, there must be