Skip to content

Commit

Permalink
Fix nasa#54, Moves interface definition files to inc
Browse files Browse the repository at this point in the history
  • Loading branch information
chillfig committed Dec 19, 2022
1 parent 919896a commit 2abcb0a
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 71 deletions.
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
File renamed without changes.
93 changes: 93 additions & 0 deletions fsw/inc/hs_extern_typedefs.h
Original file line number Diff line number Diff line change
@@ -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 */
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion fsw/src/hs_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
61 changes: 0 additions & 61 deletions fsw/src/hs_tbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion fsw/tables/hs_amt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion fsw/tables/hs_emt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 2 additions & 1 deletion fsw/tables/hs_mat.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
** Includes
*************************************************************************/
#include "cfe.h"
#include "hs_tbl.h"
// #include "hs_tbl.h"
#include "hs_extern_typedefs.h"
#include "hs_tbldefs.h"
#include "cfe_tbl_filedef.h"

Expand Down
2 changes: 1 addition & 1 deletion fsw/tables/hs_xct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 3 additions & 1 deletion unit-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2abcb0a

Please sign in to comment.