From 6cd1c24df0e0b356c884428330e087474fdec256 Mon Sep 17 00:00:00 2001 From: Justin Figueroa Date: Tue, 6 Dec 2022 11:25:09 -0500 Subject: [PATCH] Fix #55, Moves interface definition files to inc --- CMakeLists.txt | 7 +- fsw/{src => inc}/lc_events.h | 0 fsw/inc/lc_extern_typedefs.h | 120 +++++++ fsw/{mission_inc => inc}/lc_mission_cfg.h | 0 fsw/inc/lc_msg.h | 202 +++++++++++ fsw/inc/lc_msgdefs.h | 362 ++++++++++++++++++++ fsw/{platform_inc => inc}/lc_msgids.h | 0 fsw/{mission_inc => inc}/lc_perfids.h | 0 fsw/{platform_inc => inc}/lc_platform_cfg.h | 0 fsw/{src => inc}/lc_tbldefs.h | 6 +- fsw/src/lc_app.h | 10 - fsw/src/lc_tbl.h | 80 +---- fsw/tables/lc_def_adt.c | 4 +- fsw/tables/lc_def_wdt.c | 4 +- unit-test/CMakeLists.txt | 4 +- 15 files changed, 700 insertions(+), 99 deletions(-) rename fsw/{src => inc}/lc_events.h (100%) create mode 100644 fsw/inc/lc_extern_typedefs.h rename fsw/{mission_inc => inc}/lc_mission_cfg.h (100%) create mode 100644 fsw/inc/lc_msg.h create mode 100644 fsw/inc/lc_msgdefs.h rename fsw/{platform_inc => inc}/lc_msgids.h (100%) rename fsw/{mission_inc => inc}/lc_perfids.h (100%) rename fsw/{platform_inc => inc}/lc_platform_cfg.h (100%) rename fsw/{src => inc}/lc_tbldefs.h (95%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69b1dd6..3820585 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,5 @@ project(CFS_LC C) -include_directories(fsw/src) -include_directories(fsw/mission_inc) -include_directories(fsw/platform_inc) - set(APP_SRC_FILES fsw/src/lc_custom.c fsw/src/lc_app.c @@ -16,6 +12,9 @@ set(APP_SRC_FILES # Create the app module add_cfe_app(lc ${APP_SRC_FILES}) +# This permits direct access to public headers in the fsw/inc directory +target_include_directories(lc PUBLIC fsw/inc) + set(APP_TABLE_FILES fsw/tables/lc_def_wdt.c fsw/tables/lc_def_adt.c diff --git a/fsw/src/lc_events.h b/fsw/inc/lc_events.h similarity index 100% rename from fsw/src/lc_events.h rename to fsw/inc/lc_events.h diff --git a/fsw/inc/lc_extern_typedefs.h b/fsw/inc/lc_extern_typedefs.h new file mode 100644 index 0000000..396a55d --- /dev/null +++ b/fsw/inc/lc_extern_typedefs.h @@ -0,0 +1,120 @@ +/************************************************************************ + * 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 LC_EXTERN_TYPEDEFS_H +#define LC_EXTERN_TYPEDEFS_H + +#include "cfe.h" + +/** + * \name LC Table Name Strings + * \{ + */ +#define LC_WDT_TABLENAME "LC_WDT" +#define LC_ADT_TABLENAME "LC_ADT" +#define LC_WRT_TABLENAME "LC_WRT" +#define LC_ART_TABLENAME "LC_ART" +/**\}*/ + +/** + * \brief Actionpoint Definition Table (ADT) Entry + */ +typedef struct +{ + uint8 DefaultState; /**< \brief Default state for this AP (enumerated) + States are defined in lc_msgdefs.h */ + uint8 MaxPassiveEvents; /**< \brief Max number of events before filter + - RTS not started because AP is passive */ + uint8 MaxPassFailEvents; /**< \brief Max number of events before filter + - AP result transition from pass to fail */ + uint8 MaxFailPassEvents; /**< \brief Max number of events before filter + - AP result transition from fail to pass */ + uint16 RTSId; /**< \brief RTS to request if this AP fails */ + uint16 MaxFailsBeforeRTS; /**< \brief How may consecutive failures before + an RTS request is issued */ + + uint16 RPNEquation[LC_MAX_RPN_EQU_SIZE]; /**< \brief Reverse Polish Equation that + specifies when this actionpoint + should fail */ + + uint16 EventType; /**< \brief Event type used for event msg if AP fails: + #CFE_EVS_EventType_INFORMATION, + #CFE_EVS_EventType_DEBUG, + #CFE_EVS_EventType_ERROR, + or #CFE_EVS_EventType_CRITICAL */ + + uint16 EventID; /**< \brief Event ID used for event msg if AP fails + See lc_events.h for those already in use */ + + char EventText[LC_MAX_ACTION_TEXT]; /**< \brief Text used for the event msg when + this AP fails */ +} LC_ADTEntry_t; + +/** + * \brief Alignment union + * + * A union type provides a way to have many different data types occupy + * the same memory and legally alias each other. + * + * This is used to store the watch data points, as they may be 8, 16, or 32 + * bits and this is defined in the table / not known until runtime. + */ +typedef union +{ + uint32 Unsigned32; + int32 Signed32; + float Float32; + uint16 Unsigned16; + int16 Signed16; + uint8 Unsigned8; + int8 Signed8; + uint8 RawByte[4]; +} LC_MultiType_t; + +/** + * \brief Watchpoint Definition Table (WDT) Entry + */ +typedef struct +{ + uint8 DataType; /**< \brief Watchpoint Data Type (enumerated) */ + uint8 OperatorID; /**< \brief Comparison type (enumerated) */ + CFE_SB_MsgId_t MessageID; /**< \brief Message ID for the message containing + the watchpoint */ + uint32 WatchpointOffset; /**< \brief Byte offset from the beginning of + the message (including any headers) + to the watchpoint */ + uint32 BitMask; /**< \brief Value to be masked with watchpoint + data prior to comparison */ + LC_MultiType_t ComparisonValue; /**< \brief Value watchpoint data is compared + against */ + uint32 ResultAgeWhenStale; /**< \brief Number of LC Sample Actionpoint + commands that must be processed after + comparison before result goes stale */ + uint32 CustomFuncArgument; /**< \brief Data passed to the custom function + when Operator_ID is set to + #LC_OPER_CUSTOM */ +} LC_WDTEntry_t; + +#endif /* LC_EXTERN_TYPEDEFS_H */ \ No newline at end of file diff --git a/fsw/mission_inc/lc_mission_cfg.h b/fsw/inc/lc_mission_cfg.h similarity index 100% rename from fsw/mission_inc/lc_mission_cfg.h rename to fsw/inc/lc_mission_cfg.h diff --git a/fsw/inc/lc_msg.h b/fsw/inc/lc_msg.h new file mode 100644 index 0000000..8b9abba --- /dev/null +++ b/fsw/inc/lc_msg.h @@ -0,0 +1,202 @@ +/************************************************************************ + * NASA Docket No. GSC-18,921-1, and identified as “CFS Limit Checker + * Application version 2.2.1” + * + * Copyright (c) 2021 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 + * Specification for the CFS Limit Checker (LC) command and telemetry + * message data types. + * + * @note + * Constants and enumerated types related to these message structures + * are defined in lc_msgdefs.h. They are kept separate to allow easy + * integration with ASIST RDL files which can't handle typedef + * declarations (see the main comment block in lc_msgdefs.h for more + * info). + */ +#ifndef LC_MSG_H +#define LC_MSG_H + +/************************************************************************ + * Includes + ************************************************************************/ +#include "cfe.h" +#include "lc_msgdefs.h" + +/************************************************************************ + * Type Definitions + ************************************************************************/ + +/** + * \defgroup cfslccmdstructs CFS Limit Checker Command Structures + * \{ + */ + +/** + * \brief No Arguments Command + * + * For command details see #LC_NOOP_CC, #LC_RESET_CC + * Also see #LC_SEND_HK_MID + */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command Header */ +} LC_NoArgsCmd_t; + +/** + * \brief Set LC Application State Command + * + * For command details see #LC_SET_LC_STATE_CC + */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command Header */ + + uint16 NewLCState; /**< \brief New LC application state */ + uint16 Padding; /**< \brief Structure padding */ +} LC_SetLCState_t; + +/** + * \brief Set AP (Actionpoint) State Command + * + * For command details see #LC_SET_AP_STATE_CC + */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command Header */ + + uint16 APNumber; /**< \brief Which actionpoint(s) to change */ + uint16 NewAPState; /**< \brief New actionpoint state */ +} LC_SetAPState_t; + +/** + * \brief Set AP (Actionpoint) Permanently Off + * + * For command details see #LC_SET_AP_PERMOFF_CC + */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command Header */ + + uint16 APNumber; /**< \brief Which actionpoint to change */ + uint16 Padding; /**< \brief Structure padding */ +} LC_SetAPPermOff_t; + +/** + * \brief Reset AP (Actionpoint) Statistics + * + * For command details see #LC_RESET_AP_STATS_CC + */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command Header */ + + uint16 APNumber; /**< \brief Which actionpoint(s) to change */ + uint16 Padding; /**< \brief Structure padding */ +} LC_ResetAPStats_t; + +/** + * \brief Reset WP (Watchpoint) Statistics + * + * For command details see #LC_RESET_WP_STATS_CC + */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command Header */ + + uint16 WPNumber; /**< \brief Which watchpoint(s) to change */ + uint16 Padding; /**< \brief Structure padding */ +} LC_ResetWPStats_t; + +/** + * \brief Sample AP (Actionpoint) Request + * + * See #LC_SAMPLE_AP_MID + */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command Header */ + + uint16 StartIndex; /**< \brief Start actionpoint to sample */ + uint16 EndIndex; /**< \brief End actionpoint to sample */ + + uint16 UpdateAge; /**< \brief Update WP results age (T or F) */ + uint16 Padding; /**< \brief Structure padding */ +} LC_SampleAP_t; + +/** + * \brief Send Command to Start a Stored Command RTS + * + * This is a local declaration of the command message structure + * to initiate an RTS and has been placed here to allow the + * the LC application to be built without including headers from + * any other applications (like Stored Commanding). + * A mission may choose to remove this and use a message + * structure declared elsewhere instead. + * + * This also applies to the LC_RTS_REQ_MID and LC_RTS_REQ_CC + * constants (see lc_mission_cfg.h). + */ +typedef struct +{ + CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command Header */ + + uint16 RTSId; /**< \brief RTS Id to start */ +} LC_RTSRequest_t; + +/**\}*/ + +/** + * \defgroup cfslctlm CFS Limit Checker Telemetry + * \{ + */ + +/** + * \brief Housekeeping Packet Structure + */ +typedef struct +{ + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ + + uint8 CmdCount; /**< \brief LC Application Command Counter */ + uint8 CmdErrCount; /**< \brief LC Application Command Error Counter */ + uint8 CurrentLCState; /**< \brief Current LC application operating state */ + + uint8 Pad8; /**< \brief Structure padding */ + + uint8 WPResults[LC_HKWR_NUM_BYTES]; /**< \brief Packed watchpoint results data, 2 bits per watchpoint */ + uint8 APResults[LC_HKAR_NUM_BYTES]; /**< \brief Packed actionpoint results data, 4 bits per actionpoint */ + + uint16 PassiveRTSExecCount; /**< \brief Total count of RTS sequences not initiated because the LC state is + * set to #LC_STATE_PASSIVE or the state of the actionpoint that failed + * is set to #LC_APSTATE_PASSIVE + */ + + uint16 WPsInUse; /**< \brief How many watchpoints are currently in effect */ + uint16 ActiveAPs; /**< \brief How many actionpoints are currently active */ + + uint16 Pad16; /**< \brief Structure padding */ + + uint32 APSampleCount; /**< \brief Total count of Actionpoints sampled */ + uint32 MonitoredMsgCount; /**< \brief Total count of messages monitored for watchpoints */ + uint32 RTSExecCount; /**< \brief Total count of RTS sequences initiated */ +} LC_HkPacket_t; + +/**\}*/ + +#endif diff --git a/fsw/inc/lc_msgdefs.h b/fsw/inc/lc_msgdefs.h new file mode 100644 index 0000000..5eb530d --- /dev/null +++ b/fsw/inc/lc_msgdefs.h @@ -0,0 +1,362 @@ +/************************************************************************ + * NASA Docket No. GSC-18,921-1, and identified as “CFS Limit Checker + * Application version 2.2.1” + * + * Copyright (c) 2021 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 + * Specification for the CFS Limit Checker (LC) command and telemetry + * message constant definitions. + * + * @note + * These Macro definitions have been put in this file (instead of + * lc_msg.h) so this file can be included directly into ASIST build + * test scripts. ASIST RDL files can accept C language \#defines but + * can't handle type definitions. As a result: DO NOT PUT ANY + * TYPEDEFS OR STRUCTURE DEFINITIONS IN THIS FILE! + * ADD THEM TO lc_msg.h IF NEEDED! + */ +#ifndef LC_MSGDEFS_H +#define LC_MSGDEFS_H + +/************************************************************************ + * Includes + ************************************************************************/ +#include "lc_platform_cfg.h" + +/************************************************************************ + * Macro Definitions + ************************************************************************/ + +/** + * \name LC Application States + * \{ + */ +#define LC_STATE_ACTIVE 1 /**< \brief LC Application State Active */ +#define LC_STATE_PASSIVE 2 /**< \brief LC Application State Pasive */ +#define LC_STATE_DISABLED 3 /**< \brief LC Application State Disabled */ +#define LC_STATE_FROM_CDS 4 /**< \brief Used for reset processing, not valid state */ +/**\}*/ + +/** + * \name Actionpoint States + * \{ + */ +#define LC_ACTION_NOT_USED 0xFF /**< \brief Actionpoint unused, not valid command argument */ +#define LC_APSTATE_ACTIVE 1 /**< \brief Actionpoint state active */ +#define LC_APSTATE_PASSIVE 2 /**< \brief Actionpoint state passive */ +#define LC_APSTATE_DISABLED 3 /**< \brief Actionpoint state disabled */ +#define LC_APSTATE_PERMOFF 4 /**< \brief Actionpoint state permanently off, see #LC_SET_AP_PERMOFF_CC */ +/**\}*/ + +/** + * \name Special Values for Commands + * \{ + */ +#define LC_ALL_ACTIONPOINTS 0xFFFF /**< \brief Special number indicating all actionpoints */ +#define LC_ALL_WATCHPOINTS 0xFFFF /**< \brief Special number indicating all watchpoints */ +/**\}*/ + +/** + * \name Housekeeping Packed Watch Results + * \{ + */ +#define LC_HKWR_FALSE 0x00 /**< \brief Two bit value used for FALSE */ +#define LC_HKWR_TRUE 0x01 /**< \brief Two bit value used for TRUE */ +#define LC_HKWR_ERROR 0x02 /**< \brief Two bit value used for ERROR */ +#define LC_HKWR_STALE 0x03 /**< \brief Two bit value used for STALE */ +/**\}*/ + +/** + * \name Housekeeping Packed Action Results + * \{ + */ +#define LC_HKAR_PASS 0x00 /**< \brief Two bit value used for PASS */ +#define LC_HKAR_FAIL 0x01 /**< \brief Two bit value used for FAIL */ +#define LC_HKAR_ERROR 0x02 /**< \brief Two bit value used for ERROR */ +#define LC_HKAR_STALE 0x03 /**< \brief Two bit value used for STALE */ +/**\}*/ + +/** + * \name Housekeeping Packed Action Results, State Identifiers + * \{ + */ +#define LC_HKAR_STATE_NOT_USED 0x00 /**< \brief Two bit value used for NOT USED and PERMOFF */ +#define LC_HKAR_STATE_ACTIVE 0x01 /**< \brief Two bit value used for ACTIVE */ +#define LC_HKAR_STATE_PASSIVE 0x02 /**< \brief Two bit value used for PASSIVE */ +#define LC_HKAR_STATE_DISABLED 0x03 /**< \brief Two bit value used for DISABLED */ +/**\}*/ + +/** + * \name Housekeeping Packed Results, Array Sizes + * \{ + */ +#define LC_HKWR_NUM_BYTES \ + (((LC_MAX_WATCHPOINTS + 15) / 16) * 4) /**< \brief 2 bits per WP and keeping \ + * array on longword boundary \ + */ + +#define LC_HKAR_NUM_BYTES \ + (((LC_MAX_ACTIONPOINTS + 7) / 8) * 4) /**< \brief 4 bits per AP and keeping \ + * array on longword boundary \ + */ +/**\}*/ + +/** + * \defgroup cfslccmdcodes CFS Limit Checker Command Codes + * \{ + */ + +/** + * \brief Noop + * + * \par Description + * Implements the Noop command that insures the LC task is alive + * + * \par Command Structure + * #LC_NoArgsCmd_t + * + * \par Command Verification + * Successful execution of this command may be verified with + * the following telemetry: + * - #LC_HkPacket_t.CmdCount will increment + * - The #LC_NOOP_INF_EID informational event message will be + * generated when the command is received + * + * \par Error Conditions + * This command may fail for the following reason(s): + * - Command packet length not as expected + * + * \par Evidence of failure may be found in the following telemetry: + * - #LC_HkPacket_t.CmdErrCount will increment + * - Error specific event message #LC_LEN_ERR_EID + * + * \par Criticality + * None + * + * \sa #LC_RESET_CC + */ +#define LC_NOOP_CC 0 + +/** + * \brief Reset Counters + * + * \par Description + * Resets the LC housekeeping counters + * + * \par Command Structure + * #LC_NoArgsCmd_t + * + * \par Command Verification + * Successful execution of this command may be verified with + * the following telemetry: + * - #LC_HkPacket_t.CmdCount will be cleared + * - The #LC_RESET_DBG_EID debug event message will be + * generated when the command is executed + * + * \par Error Conditions + * This command may fail for the following reason(s): + * - Command packet length not as expected + * + * \par Evidence of failure may be found in the following telemetry: + * - #LC_HkPacket_t.CmdErrCount will increment + * - Error specific event message #LC_LEN_ERR_EID + * + * \par Criticality + * None + * + * \sa #LC_NOOP_CC + */ +#define LC_RESET_CC 1 + +/** + * \brief Set LC Application State + * + * \par Description + * Sets the operational state of the LC application + * + * \par Command Structure + * #LC_SetLCState_t + * + * \par Command Verification + * Successful execution of this command may be verified with + * the following telemetry: + * - #LC_HkPacket_t.CmdCount will increment + * - #LC_HkPacket_t.CurrentLCState will be set to the new state + * - The #LC_LCSTATE_INF_EID informational event message will be + * generated when the command is executed + * + * \par Error Conditions + * This command may fail for the following reason(s): + * - Command packet length not as expected + * - Invalid new state specified in command message + * + * \par Evidence of failure may be found in the following telemetry: + * - #LC_HkPacket_t.CmdErrCount will increment + * - Error specific event message #LC_LEN_ERR_EID + * - Error specific event message #LC_LCSTATE_ERR_EID + * + * \par Criticality + * None + * + */ +#define LC_SET_LC_STATE_CC 2 + +/** + * \brief Set AP State + * + * \par Description + * Set actionpoint state + * + * \par Command Structure + * #LC_SetAPState_t + * + * \par Command Verification + * Successful execution of this command may be verified with + * the following telemetry: + * - #LC_HkPacket_t.CmdCount will increment + * - The #LC_APSTATE_INF_EID informational event message will be + * generated when the command is executed + * + * \par Error Conditions + * This command may fail for the following reason(s): + * - Command packet length not as expected + * - Invalid actionpoint state specified in command message + * - Actionpoint number specified in command message is + * out of range + * - Actionpoint current state is either #LC_ACTION_NOT_USED + * or #LC_APSTATE_PERMOFF + * + * \par Evidence of failure may be found in the following telemetry: + * - #LC_HkPacket_t.CmdErrCount will increment + * - Error specific event message #LC_LEN_ERR_EID + * - Error specific event message #LC_APSTATE_NEW_ERR_EID + * - Error specific event message #LC_APSTATE_APNUM_ERR_EID + * - Error specific event message #LC_APSTATE_CURR_ERR_EID + * + * \par Criticality + * None + * + */ +#define LC_SET_AP_STATE_CC 3 + +/** + * \brief Set AP Permanently Off + * + * \par Description + * Set the specified actionpoint's state to #LC_APSTATE_PERMOFF + * + * \par Command Structure + * #LC_SetAPPermOff_t + * + * \par Command Verification + * Successful execution of this command may be verified with + * the following telemetry: + * - #LC_HkPacket_t.CmdCount will increment + * - The #LC_APOFF_INF_EID informational event message will be + * generated when the command is executed + * + * \par Error Conditions + * This command may fail for the following reason(s): + * - Command packet length not as expected + * - Actionpoint number specified in command message is + * out of range + * - Actionpoint current state is not #LC_APSTATE_DISABLED + * + * \par Evidence of failure may be found in the following telemetry: + * - #LC_HkPacket_t.CmdErrCount will increment + * - Error specific event message #LC_LEN_ERR_EID + * - Error specific event message #LC_APOFF_APNUM_ERR_EID + * - Error specific event message #LC_APOFF_CURR_ERR_EID + * + * \par Criticality + * None + * + */ +#define LC_SET_AP_PERMOFF_CC 4 + +/** + * \brief Reset AP Statistics + * + * \par Description + * Resets actionpoint statistics + * + * \par Command Structure + * #LC_ResetAPStats_t + * + * \par Command Verification + * Successful execution of this command may be verified with + * the following telemetry: + * - #LC_HkPacket_t.CmdCount will increment + * - The #LC_APSTATS_INF_EID informational event message will be + * generated when the command is executed + * + * \par Error Conditions + * This command may fail for the following reason(s): + * - Command packet length not as expected + * - Actionpoint number specified in command message is + * out of range + * + * \par Evidence of failure may be found in the following telemetry: + * - #LC_HkPacket_t.CmdErrCount will increment + * - Error specific event message #LC_LEN_ERR_EID + * - Error specific event message #LC_APSTATS_APNUM_ERR_EID + * + * \par Criticality + * None + * + * \sa #LC_RESET_WP_STATS_CC + */ +#define LC_RESET_AP_STATS_CC 5 + +/** + * \brief Reset WP Statistics + * + * \par Description + * Resets watchpoint statistics + * + * \par Command Structure + * #LC_ResetWPStats_t + * + * \par Command Verification + * Successful execution of this command may be verified with + * the following telemetry: + * - #LC_HkPacket_t.CmdCount will increment + * - The #LC_WPSTATS_INF_EID informational event message will be + * generated when the command is executed + * + * \par Error Conditions + * This command may fail for the following reason(s): + * - Command packet length not as expected + * - Watchpoint number specified in command message is + * out of range + * + * \par Evidence of failure may be found in the following telemetry: + * - #LC_HkPacket_t.CmdErrCount will increment + * - Error specific event message #LC_LEN_ERR_EID + * - Error specific event message #LC_WPSTATS_WPNUM_ERR_EID + * + * \par Criticality + * None + * + * \sa #LC_RESET_AP_STATS_CC + */ +#define LC_RESET_WP_STATS_CC 6 + +/**\}*/ + +#endif diff --git a/fsw/platform_inc/lc_msgids.h b/fsw/inc/lc_msgids.h similarity index 100% rename from fsw/platform_inc/lc_msgids.h rename to fsw/inc/lc_msgids.h diff --git a/fsw/mission_inc/lc_perfids.h b/fsw/inc/lc_perfids.h similarity index 100% rename from fsw/mission_inc/lc_perfids.h rename to fsw/inc/lc_perfids.h diff --git a/fsw/platform_inc/lc_platform_cfg.h b/fsw/inc/lc_platform_cfg.h similarity index 100% rename from fsw/platform_inc/lc_platform_cfg.h rename to fsw/inc/lc_platform_cfg.h diff --git a/fsw/src/lc_tbldefs.h b/fsw/inc/lc_tbldefs.h similarity index 95% rename from fsw/src/lc_tbldefs.h rename to fsw/inc/lc_tbldefs.h index 1772671..1a6b2de 100644 --- a/fsw/src/lc_tbldefs.h +++ b/fsw/inc/lc_tbldefs.h @@ -23,7 +23,11 @@ * constant definitions. * * @note - * DO NOT PUT ANY TYPEDEFS OR STRUCTURE DEFINITIONS IN THIS FILE! + * These Macro definitions have been put in this file (instead of + * lc_tbl.h) so this file can be included directly into ASIST build + * test scripts. ASIST RDL files can accept C language \#defines but + * can't handle type definitions. As a result: DO NOT PUT ANY + * TYPEDEFS OR STRUCTURE DEFINITIONS IN THIS FILE! * ADD THEM TO lc_tbl.h IF NEEDED! */ #ifndef LC_TBLDEFS_H diff --git a/fsw/src/lc_app.h b/fsw/src/lc_app.h index 951d494..9fcb5ad 100644 --- a/fsw/src/lc_app.h +++ b/fsw/src/lc_app.h @@ -36,16 +36,6 @@ * Macro Definitions ************************************************************************/ -/** - * \name LC Table Name Strings - * \{ - */ -#define LC_WDT_TABLENAME "LC_WDT" -#define LC_ADT_TABLENAME "LC_ADT" -#define LC_WRT_TABLENAME "LC_WRT" -#define LC_ART_TABLENAME "LC_ART" -/**\}*/ - /** * \name LC CDS Buffer Strings * \{ diff --git a/fsw/src/lc_tbl.h b/fsw/src/lc_tbl.h index 302dfe4..517c53b 100644 --- a/fsw/src/lc_tbl.h +++ b/fsw/src/lc_tbl.h @@ -35,90 +35,12 @@ #include "cfe.h" #include "lc_platform_cfg.h" #include "lc_tbldefs.h" +#include "lc_extern_typedefs.h" /************************************************************************* * Type Definitions *************************************************************************/ -/** - * \brief Alignment union - * - * A union type provides a way to have many different data types occupy - * the same memory and legally alias each other. - * - * This is used to store the watch data points, as they may be 8, 16, or 32 - * bits and this is defined in the table / not known until runtime. - */ -typedef union -{ - uint32 Unsigned32; - int32 Signed32; - float Float32; - uint16 Unsigned16; - int16 Signed16; - uint8 Unsigned8; - int8 Signed8; - uint8 RawByte[4]; -} LC_MultiType_t; - -/** - * \brief Watchpoint Definition Table (WDT) Entry - */ -typedef struct -{ - uint8 DataType; /**< \brief Watchpoint Data Type (enumerated) */ - uint8 OperatorID; /**< \brief Comparison type (enumerated) */ - CFE_SB_MsgId_t MessageID; /**< \brief Message ID for the message containing - the watchpoint */ - uint32 WatchpointOffset; /**< \brief Byte offset from the beginning of - the message (including any headers) - to the watchpoint */ - uint32 BitMask; /**< \brief Value to be masked with watchpoint - data prior to comparison */ - LC_MultiType_t ComparisonValue; /**< \brief Value watchpoint data is compared - against */ - uint32 ResultAgeWhenStale; /**< \brief Number of LC Sample Actionpoint - commands that must be processed after - comparison before result goes stale */ - uint32 CustomFuncArgument; /**< \brief Data passed to the custom function - when Operator_ID is set to - #LC_OPER_CUSTOM */ -} LC_WDTEntry_t; - -/** - * \brief Actionpoint Definition Table (ADT) Entry - */ -typedef struct -{ - uint8 DefaultState; /**< \brief Default state for this AP (enumerated) - States are defined in lc_msgdefs.h */ - uint8 MaxPassiveEvents; /**< \brief Max number of events before filter - - RTS not started because AP is passive */ - uint8 MaxPassFailEvents; /**< \brief Max number of events before filter - - AP result transition from pass to fail */ - uint8 MaxFailPassEvents; /**< \brief Max number of events before filter - - AP result transition from fail to pass */ - uint16 RTSId; /**< \brief RTS to request if this AP fails */ - uint16 MaxFailsBeforeRTS; /**< \brief How may consecutive failures before - an RTS request is issued */ - - uint16 RPNEquation[LC_MAX_RPN_EQU_SIZE]; /**< \brief Reverse Polish Equation that - specifies when this actionpoint - should fail */ - - uint16 EventType; /**< \brief Event type used for event msg if AP fails: - #CFE_EVS_EventType_INFORMATION, - #CFE_EVS_EventType_DEBUG, - #CFE_EVS_EventType_ERROR, - or #CFE_EVS_EventType_CRITICAL */ - - uint16 EventID; /**< \brief Event ID used for event msg if AP fails - See lc_events.h for those already in use */ - - char EventText[LC_MAX_ACTION_TEXT]; /**< \brief Text used for the event msg when - this AP fails */ -} LC_ADTEntry_t; - /** * \brief Watchpoint Transition Structure */ diff --git a/fsw/tables/lc_def_adt.c b/fsw/tables/lc_def_adt.c index 7c8ad7f..1314dc8 100644 --- a/fsw/tables/lc_def_adt.c +++ b/fsw/tables/lc_def_adt.c @@ -38,8 +38,8 @@ #include "cfe_tbl_filedef.h" #include "lc_platform_cfg.h" #include "lc_msgdefs.h" -#include "lc_tbl.h" -#include "lc_app.h" +#include "lc_extern_typedefs.h" +#include "lc_tbldefs.h" #include "lc_events.h" /************************************************************************* diff --git a/fsw/tables/lc_def_wdt.c b/fsw/tables/lc_def_wdt.c index bf11073..f56676b 100644 --- a/fsw/tables/lc_def_wdt.c +++ b/fsw/tables/lc_def_wdt.c @@ -34,8 +34,8 @@ #include "cfe_tbl_filedef.h" #include "lc_platform_cfg.h" #include "lc_msgdefs.h" -#include "lc_tbl.h" -#include "lc_app.h" +#include "lc_extern_typedefs.h" +#include "lc_tbldefs.h" /************************************************************************* ** Examples diff --git a/unit-test/CMakeLists.txt b/unit-test/CMakeLists.txt index 4aed619..332d8c0 100644 --- a/unit-test/CMakeLists.txt +++ b/unit-test/CMakeLists.txt @@ -20,8 +20,10 @@ add_cfe_coverage_stubs("lc_internal" # Link with the cfe core stubs and unit test assert libs target_link_libraries(coverage-lc_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-lc_internal-stubs PUBLIC utilities) +target_include_directories(coverage-lc_internal-stubs PUBLIC ../fsw/inc) +target_include_directories(coverage-lc_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