Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #60, Moves custom commands and EIDs to public interface #61

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
245 changes: 245 additions & 0 deletions fsw/inc/hs_custom.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
/************************************************************************
* NASA Docket No. GSC-18,920-1, and identified as “Core Flight
* System (cFS) Health & Safety (HS) Application version 2.4.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 Health and Safety (HS) mission specific
* custom function interface
*/
#ifndef HS_CUSTOM_H
#define HS_CUSTOM_H

/*************************************************************************
* Includes
************************************************************************/
#include "cfe.h"

/*************************************************************************
* Constants
************************************************************************/
#define HS_UTIL_DIAG_REPORTS 4

/**
* \ingroup cfshscmdcodes
*
* Custom command codes must not conflict with those in hs_msgdefs.h
* \{
*/

/**
* \brief Report Util Diagnostics
*
* \par Description
* Reports the Utilization Diagnostics
*
* \par Command Structure
* #HS_NoArgsCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
* the following telemetry:
* - #HS_HkPacket_t.CmdCount will increment
* - The #HS_UTIL_DIAG_REPORT_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
*
* \par Evidence of failure may be found in the following telemetry:
* - #HS_HkPacket_t.CmdErrCount will increment
*
* \par Criticality
* None
*/
#define HS_REPORT_DIAG_CC 12

/**
* \brief Set Utilization Calibration Parameters
*
* \par Description
* Sets the Utilization Calibration Parameter
*
* \par Command Structure
* #HS_SetUtilParamsCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
* the following telemetry:
* - #HS_HkPacket_t.CmdCount will increment
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Command packet length not as expected
* - Any parameter is set to 0.
*
* \par Evidence of failure may be found in the following telemetry:
* - #HS_HkPacket_t.CmdErrCount will increment
*
* \par Criticality
* None
*/
#define HS_SET_UTIL_PARAMS_CC 13

/**
* \brief Set Utilization Diagnostics Parameter
*
* \par Description
* Sets the Utilization Diagnostics parameter
*
* \par Command Structure
* #HS_SetUtilDiagCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
* the following telemetry:
* - #HS_HkPacket_t.CmdCount will increment
*
* \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:
* - #HS_HkPacket_t.CmdErrCount will increment
*
* \par Criticality
* None
*/
#define HS_SET_UTIL_DIAG_CC 14

/**\}*/

/**
* \ingroup cfshsevents
*
* Custom Event IDs must not conflict with those in hs_events.h
* \{
*/

/**
* \brief HS CPU Utilization Monitoring Create Child Task Failed Event ID
*
* \par Type: ERROR
*
* \par Cause:
*
* This event message is issued when CFS Health and Safety
* is unable to create its child task via the #CFE_ES_CreateChildTask
* API
*/
#define HS_CR_CHILD_TASK_ERR_EID 101

/**
* \brief HS CPU Utilization Monitoring Register Sync Callback Failed Event ID
*
* \par Type: ERROR
*
* \par Cause:
*
* This event message is issued when CFS Health and Safety
* is unable to create its sync callback via the #CFE_TIME_RegisterSynchCallback
* API
*/
#define HS_CR_SYNC_CALLBACK_ERR_EID 102

/**
* \brief HS Report Diagnostics Command Event ID
*
* \par Type: INFORMATION
*
* \par Cause:
*
* This event message is issued when CFS Health and Safety receives the #HS_REPORT_DIAG_CC command.
*/
#define HS_UTIL_DIAG_REPORT_EID 103

/**
* \brief HS Set Utilization Paramaters Command Event ID
*
* \par Type: Debug
*
* \par Cause:
*
* This event message is issued when CFS Health and Safety successfully processes the #HS_SET_UTIL_PARAMS_CC command.
*/
#define HS_SET_UTIL_PARAMS_DBG_EID 104

/**
* \brief HS Set Utilization Parameters Zero Value Event ID
*
* \par Type: Error
*
* \par Cause:
*
* This event message is issued when CFS Health and Safety fails to processes the #HS_SET_UTIL_PARAMS_CC command.
* due to a 0 as at least one of the parameters.
*/
#define HS_SET_UTIL_PARAMS_ERR_EID 105

/**
* \brief HS Set Utilization Diagnostics Command Event ID
*
* \par Type: Debug
*
* \par Cause:
*
* This event message is issued when CFS Health and Safety successfully processes the #HS_SET_UTIL_DIAG_CC command.
*/
#define HS_SET_UTIL_DIAG_DBG_EID 106

/**\}*/

/*************************************************************************
* Command Structure Definitions
************************************************************************/

/**
* \ingroup cfshscmdstructs
* \{
*/

/**
* \brief Set Utilitiliztion Parameters Command
*
* See #HS_SET_UTIL_PARAMS_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */

int32 Mult1; /**< \brief Multiplier 1 parameter */
int32 Div; /**< \brief Divisior parameter */
int32 Mult2; /**< \brief Multiplier 2 parameter */
} HS_SetUtilParamsCmd_t;

/**
* \brief Set Utilization Diagnostics Command
*
* See #HS_SET_UTIL_DIAG_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */

uint32 Mask; /**< \brief Utilization Diagnostics Mask */
} HS_SetUtilDiagCmd_t;

/**\}*/

#endif
2 changes: 1 addition & 1 deletion fsw/src/hs_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "hs_msgids.h"
#include "hs_perfids.h"
#include "hs_monitors.h"
#include "hs_custom.h"
#include "hs_custom_internal.h"
#include "hs_version.h"
#include "hs_cmds.h"
#include "hs_verify.h"
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/hs_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*************************************************************************/
#include "hs_app.h"
#include "hs_cmds.h"
#include "hs_custom.h"
#include "hs_custom_internal.h"
#include "hs_monitors.h"
#include "hs_msgids.h"
#include "hs_events.h"
Expand Down
1 change: 1 addition & 0 deletions fsw/src/hs_custom.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "hs_msg.h"
#include "hs_utils.h"
#include "hs_custom.h"
#include "hs_custom_internal.h"
#include "hs_events.h"
#include "hs_monitors.h"
#include "hs_perfids.h"
Expand Down
Loading