Skip to content

Commit

Permalink
Merge pull request #56 from chillfig/inc
Browse files Browse the repository at this point in the history
Fix #55, Moves interface definition files to inc
  • Loading branch information
dzbaker authored Dec 22, 2022
2 parents 358fc48 + 6cd1c24 commit de6ef27
Show file tree
Hide file tree
Showing 15 changed files with 700 additions and 99 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_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
Expand All @@ -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
Expand Down
File renamed without changes.
120 changes: 120 additions & 0 deletions fsw/inc/lc_extern_typedefs.h
Original file line number Diff line number Diff line change
@@ -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 */
File renamed without changes.
202 changes: 202 additions & 0 deletions fsw/inc/lc_msg.h
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit de6ef27

Please sign in to comment.