From e01ab2360b0f983942531980af70697c9e58be42 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Sun, 11 Apr 2021 13:39:47 -0400 Subject: [PATCH] CFS-41, Add EVS Files --- .gitignore | 2 +- README.md | 2 +- modules/core_api/fsw/inc/cfe_evs.h | 331 ++++++++++++++++++ .../core_api/fsw/inc/cfe_evs_api_typedefs.h | 67 ++++ .../core_api/fsw/inc/cfe_evs_core_internal.h | 91 +++++ .../fsw/inc/cfe_evs_extern_typedefs.h | 179 ++++++++++ .../fsw/inc/cfe_evs_log_typedef.h | 51 +++ 7 files changed, 721 insertions(+), 2 deletions(-) create mode 100644 modules/core_api/fsw/inc/cfe_evs.h create mode 100644 modules/core_api/fsw/inc/cfe_evs_api_typedefs.h create mode 100644 modules/core_api/fsw/inc/cfe_evs_core_internal.h create mode 100644 modules/core_api/fsw/inc/cfe_evs_extern_typedefs.h create mode 100644 modules/core_private/fsw/inc/cfe_evs_log_typedef.h diff --git a/.gitignore b/.gitignore index 1ad79ec2e..70428b516 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ # But not these files... !/.gitignore - +!/ReadMe.md # EVS diff --git a/README.md b/README.md index 240b7c71d..d9187d90e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The corresponding, fully-working cFE instance matching the code in this branch c ### How to add your review comments -Navigate to the ["files changed" tab](https://github.com/nasa/cFE/pull/1283/files) in the [nasa/cFE#1283](https://github.com/nasa/cFE/pull/1283) pull request. +Navigate to the ["files changed" tab](https://github.com/nasa/cFE/pull/1294/files) in the [nasa/cFE#1294](https://github.com/nasa/cFE/pull/1294) pull request. github-review-instructions-1of2 diff --git a/modules/core_api/fsw/inc/cfe_evs.h b/modules/core_api/fsw/inc/cfe_evs.h new file mode 100644 index 000000000..b6c8f6b1b --- /dev/null +++ b/modules/core_api/fsw/inc/cfe_evs.h @@ -0,0 +1,331 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-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 + * + * Title: Event Services API Application Library Header File + * + * Purpose: + * Unit specification for Event services library functions and macros. + * + * Design Notes: + * + * References: + * Flight Software Branch C Coding Standard Version 1.0a + */ + +#ifndef CFE_EVS_H +#define CFE_EVS_H + +/********************************** Include Files ************************************/ +#include "common_types.h" /* Basic data types */ +#include "cfe_error.h" +#include "cfe_evs_api_typedefs.h" +#include "cfe_es_api_typedefs.h" +#include "cfe_time_api_typedefs.h" + +/* +** Utility macros to make for simpler/more compact/readable code. +*/ +#define CFE_EVS_Send(E, T, ...) CFE_EVS_SendEvent((E), CFE_EVS_EventType_##T, __VA_ARGS__) +#define CFE_EVS_SendDbg(E, ...) CFE_EVS_Send(E, DEBUG, __VA_ARGS__) +#define CFE_EVS_SendInfo(E, ...) CFE_EVS_Send(E, INFORMATION, __VA_ARGS__) +#define CFE_EVS_SendErr(E, ...) CFE_EVS_Send(E, ERROR, __VA_ARGS__) +#define CFE_EVS_SendCrit(E, ...) CFE_EVS_Send(E, CRITICAL, __VA_ARGS__) + +/****************** Function Prototypes **********************/ + +/** @defgroup CFEAPIEVSReg cFE Registration APIs + * @{ + */ + +/** +** \brief Register an application for receiving event services +** +** \par Description +** This routine registers an application with event services and allocates/initializes +** the internal data structures used to support this application's events. An application +** may not send events unless it has called this routine. The routine also accepts a filter +** array structure for applications requiring event filtering. In the current implementation +** of the EVS, only the binary filtering scheme is supported. See section TBD of the cFE +** Application Programmer's Guide for a description of the behavior of binary filters. +** Applications may call #CFE_EVS_Register more than once, but each call will wipe out all +** filters registered by previous calls (filter registration is NOT cumulative). +** +** \par Assumptions, External Events, and Notes: +** Note: Event filters can be added, deleted or modified by ground commands. All filtering +** schemes include a default setting that results in no filtering (such as #CFE_EVS_NO_FILTER +** for binary filters). +** +** Filter Scheme: Binary
+** Code: CFE_EVS_EventFilter_BINARY
+** Filter Structure: +** \code +** typedef struct CFE_EVS_BinFilter { +** uint16 EventID, +** uint16 Mask ; +** } CFE_EVS_BinFilter_t; +** \endcode +** +** \param[in] Filters Pointer to an array of event message filters, or NULL if no filtering is desired. +** The structure of an event message filter depends on the FilterScheme selected. +** (see Filter Schemes mentioned above) +** +** \param[in] NumFilteredEvents The number of event message filters included in this call. This must be less than +** or equal to the maximum number of events allowed per application +*(#CFE_PLATFORM_EVS_MAX_EVENT_FILTERS). +** +** \param[in] FilterScheme The event filtering scheme that this application will use. For the first +** implementation of the event services, only filter type #CFE_EVS_EventFilter_BINARY +** will be supported. +** +** \return Execution status below or from #CFE_ES_GetAppID, see \ref CFEReturnCodes +** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS +** \retval #CFE_EVS_APP_FILTER_OVERLOAD \copybrief CFE_EVS_APP_FILTER_OVERLOAD +** \retval #CFE_EVS_UNKNOWN_FILTER \copybrief CFE_EVS_UNKNOWN_FILTER +** \retval #CFE_EVS_APP_ILLEGAL_APP_ID \copybrief CFE_EVS_APP_ILLEGAL_APP_ID +** +** \sa #CFE_EVS_Unregister +** +**/ +CFE_Status_t CFE_EVS_Register(const void *Filters, /* Pointer to an array of filters */ + uint16 NumFilteredEvents, /* How many elements in the array? */ + uint16 FilterScheme); /* Filtering Algorithm to be implemented */ + +/** +** \brief Cleanup internal structures used by the event manager for the calling Application. +** +** \par Description +** This routine un-registers the calling application from receiving event services +** and removes and deletes the calling applications filters and counters from the +** internal event service filter and counter tables if registered. Applications +** must call this routine as part of their orderly shutdown process. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \return Execution status below or from #CFE_ES_GetAppID/#CFE_ES_PutPoolBuf, see \ref CFEReturnCodes +** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS +** \retval #CFE_EVS_APP_NOT_REGISTERED \copybrief CFE_EVS_APP_NOT_REGISTERED +** \retval #CFE_EVS_APP_ILLEGAL_APP_ID \copybrief CFE_EVS_APP_ILLEGAL_APP_ID +** +** \sa #CFE_EVS_Register +** +**/ +CFE_Status_t CFE_EVS_Unregister(void); +/**@}*/ + +/** @defgroup CFEAPIEVSSend cFE Send Event APIs + * @{ + */ + +/** +** \brief Generate a software event. +** +** \par Description +** This routine generates a software event message. If the EventID is not filtered, +** the event will be sent as a software bus message, optionally logged in the local +** event log, and optionally sent as an ASCII text string out the enabled output port(s). +** +** \par Assumptions, External Events, and Notes: +** This API only works within the context of a registered application or core service. +** For messages outside the context of a registered appliction (for example early +** in app initialization or if registration fails) #CFE_ES_WriteToSysLog can be used +** for reporting. +** +** \param[in] EventID A numeric literal used to uniquely identify an application event. +** The \c EventID is defined and supplied by the application sending the event. +** +** \param[in] EventType A numeric literal used to classify an event, one of: +** \arg #CFE_EVS_EventType_DEBUG +** \arg #CFE_EVS_EventType_INFORMATION +** \arg #CFE_EVS_EventType_ERROR +** \arg #CFE_EVS_EventType_CRITICAL +** +** \param[in] Spec A pointer to a null terminated text string describing the output format +** for the event. This is the same type of format string used for the ANSI +** \c printf function. Nominally the post-conversion string is limited to 80 +** characters, but this limit is configurable through the parameter +** #CFE_MISSION_EVS_MAX_MESSAGE_LENGTH. Characters beyond the limit will be truncated. +** Do not use floating point conversions (%f, %e, %E, %g, and %G) in the format +** string unless your application will be running in a system that supports +** floating point arithmetic. Do not use non-printable characters (\\t, \\n, etc.) +** in the format string; they will mess up the formatting when the events are +** displayed on the ground system. +** +** \return Execution status, see \ref CFEReturnCodes +** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS +** \retval #CFE_EVS_APP_NOT_REGISTERED \copybrief CFE_EVS_APP_NOT_REGISTERED +** \retval #CFE_EVS_APP_ILLEGAL_APP_ID \copybrief CFE_EVS_APP_ILLEGAL_APP_ID +** +** \sa #CFE_EVS_SendEventWithAppID, #CFE_EVS_SendTimedEvent +** +**/ +CFE_Status_t CFE_EVS_SendEvent(uint16 EventID, uint16 EventType, const char *Spec, ...) OS_PRINTF(3, 4); + +/** +** \brief Generate a software event given the specified Application ID. +** +** \par Description +** This routine generates a software event message. If the EventID is not filtered, +** the event will be sent as a software bus message, optionally logged in the local +** event log, and optionally sent as an ASCII text string out the enabled output port(s). +** Note that this function should really only be used from within an API in order to +** preserve the context of an Application's event. In general, #CFE_EVS_SendEvent should be used. +** +** \par Assumptions, External Events, and Notes: +** The Application ID must correspond to a registered application or core service. +** For messages outside the context of a registered appliction (for example early +** in app initialization or if registration fails) #CFE_ES_WriteToSysLog can be used +** for reporting. +** +** \param[in] EventID A numeric literal used to uniquely identify an application event. +** The \c EventID is defined and supplied by the application sending the event. +** +** \param[in] EventType A numeric literal used to classify an event, one of: +** \arg #CFE_EVS_EventType_DEBUG +** \arg #CFE_EVS_EventType_INFORMATION +** \arg #CFE_EVS_EventType_ERROR +** \arg #CFE_EVS_EventType_CRITICAL +** +** \param[in] AppID The Application ID from which the event message should appear. +** +** \param[in] Spec A pointer to a null terminated text string describing the output format +** for the event. This is the same type of format string used for the ANSI +** \c printf function. Nominally the post-conversion string is limited to 80 +** characters, but this limit is configurable through the parameter +** #CFE_MISSION_EVS_MAX_MESSAGE_LENGTH. Characters beyond the limit will be truncated. +** Do not use floating point conversions (%f, %e, %E, %g, and %G) in the format +** string unless your application will be running in a system that supports +** floating point arithmetic. Do not use non-printable characters (\\t, \\n, etc.) +** in the format string; they will mess up the formatting when the events are +** displayed on the ground system. +** +** \return Execution status, see \ref CFEReturnCodes +** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS +** \retval #CFE_EVS_APP_NOT_REGISTERED \copybrief CFE_EVS_APP_NOT_REGISTERED +** \retval #CFE_EVS_APP_ILLEGAL_APP_ID \copybrief CFE_EVS_APP_ILLEGAL_APP_ID +** +** \sa #CFE_EVS_SendEvent, #CFE_EVS_SendTimedEvent +** +**/ +CFE_Status_t CFE_EVS_SendEventWithAppID(uint16 EventID, uint16 EventType, CFE_ES_AppId_t AppID, const char *Spec, ...) + OS_PRINTF(4, 5); + +/** +** \brief Generate a software event with a specific time tag. +** +** \par Description +** This routine is the same as #CFE_EVS_SendEvent except that the caller specifies the event time +** instead of having the EVS use the current spacecraft time. This routine should be used in +** situations where an error condition is detected at one time, but the event message is reported +** at a later time. +** +** \par Assumptions, External Events, and Notes: +** This API only works within the context of a registered application or core service. +** For messages outside the context of a registered appliction (for example early +** in app initialization or if registration fails) #CFE_ES_WriteToSysLog can be used +** for reporting. +** +** \param[in] Time The time to include in the event. This will usually be a time returned +** by the function #CFE_TIME_GetTime. +** +** \param[in] EventID A numeric literal used to uniquely identify an application event. +** The \c EventID is defined and supplied by the application sending the event. +** +** \param[in] EventType A numeric literal used to classify an event, one of: +** \arg #CFE_EVS_EventType_DEBUG +** \arg #CFE_EVS_EventType_INFORMATION +** \arg #CFE_EVS_EventType_ERROR +** \arg #CFE_EVS_EventType_CRITICAL +** +** \param[in] Spec A pointer to a null terminated text string describing the output format +** for the event. This is the same type of format string used for the ANSI +** \c printf function. Nominally the post-conversion string is limited to 80 +** characters, but this limit is configurable through the parameter +** #CFE_MISSION_EVS_MAX_MESSAGE_LENGTH. Characters beyond the limit will be truncated. +** Do not use floating point conversions (%f, %e, %E, %g, and %G) in the format +** string unless your application will be running in a system that supports +** floating point arithmetic. Do not use non-printable characters (\\t, \\n, etc.) +** in the format string; they will mess up the formatting when the events are +** displayed on the ground system. +** +** \return Execution status, see \ref CFEReturnCodes +** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS +** \retval #CFE_EVS_APP_NOT_REGISTERED \copybrief CFE_EVS_APP_NOT_REGISTERED +** \retval #CFE_EVS_APP_ILLEGAL_APP_ID \copybrief CFE_EVS_APP_ILLEGAL_APP_ID +** +** \sa #CFE_EVS_SendEvent, #CFE_EVS_SendEventWithAppID +** +**/ +CFE_Status_t CFE_EVS_SendTimedEvent(CFE_TIME_SysTime_t Time, uint16 EventID, uint16 EventType, const char *Spec, ...) + OS_PRINTF(4, 5); +/**@}*/ + +/** @defgroup CFEAPIEVSResetFilter cFE Reset Event Filter APIs + * @{ + */ + +/** +** \brief Resets the calling application's event filter for a single event ID. +** +** \par Description +** The effect of resetting an event filter depends on the filter scheme. +** The #CFE_EVS_EventFilter_BINARY scheme resets the filter counter for the specified Event ID. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \param[in] EventID A numeric literal used to uniquely identify an application event. +** The \c EventID is defined and supplied by the application sending the event. +** +** \return Execution status below or from #CFE_ES_GetAppID, see \ref CFEReturnCodes +** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS +** \retval #CFE_EVS_APP_NOT_REGISTERED \copybrief CFE_EVS_APP_NOT_REGISTERED +** \retval #CFE_EVS_APP_ILLEGAL_APP_ID \copybrief CFE_EVS_APP_ILLEGAL_APP_ID +** +** \sa #CFE_EVS_ResetAllFilters +** +**/ +CFE_Status_t CFE_EVS_ResetFilter(int16 EventID); + +/** +** \brief Resets all of the calling application's event filters. +** +** \par Description +** This routine resets all the calling application's event filter counters to zero, providing a +** quick and convenient method for resetting event filters. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \return Execution status below or from #CFE_ES_GetAppID, see \ref CFEReturnCodes +** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS +** \retval #CFE_EVS_APP_NOT_REGISTERED \copybrief CFE_EVS_APP_NOT_REGISTERED +** \retval #CFE_EVS_APP_ILLEGAL_APP_ID \copybrief CFE_EVS_APP_ILLEGAL_APP_ID +** +** \sa #CFE_EVS_ResetFilter +** +**/ +CFE_Status_t CFE_EVS_ResetAllFilters(void); +/**@}*/ + +#endif /* CFE_EVS_H */ diff --git a/modules/core_api/fsw/inc/cfe_evs_api_typedefs.h b/modules/core_api/fsw/inc/cfe_evs_api_typedefs.h new file mode 100644 index 000000000..eb787cdf2 --- /dev/null +++ b/modules/core_api/fsw/inc/cfe_evs_api_typedefs.h @@ -0,0 +1,67 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-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 + * + * Title: Event Services API Application Library Header File + * + * Purpose: + * Unit specification for Event services library functions and macros. + * + * Design Notes: + * + * References: + * Flight Software Branch C Coding Standard Version 1.0a + */ + +#ifndef CFE_EVS_API_TYPEDEFS_H +#define CFE_EVS_API_TYPEDEFS_H + +/********************************** Include Files ************************************/ +#include "common_types.h" /* Basic data types */ +#include "cfe_evs_extern_typedefs.h" + +/** \name Common Event Filter Mask Values */ +/** \{ */ +#define CFE_EVS_NO_FILTER 0x0000 /**< \brief Stops any filtering. All messages are sent. */ +#define CFE_EVS_FIRST_ONE_STOP 0xFFFF /**< \brief Sends the first event. All remaining messages are filtered. */ +#define CFE_EVS_FIRST_TWO_STOP 0xFFFE /**< \brief Sends the first 2 events. All remaining messages are filtered. */ +#define CFE_EVS_FIRST_4_STOP 0xFFFC /**< \brief Sends the first 4 events. All remaining messages are filtered. */ +#define CFE_EVS_FIRST_8_STOP 0xFFF8 /**< \brief Sends the first 8 events. All remaining messages are filtered. */ +#define CFE_EVS_FIRST_16_STOP 0xFFF0 /**< \brief Sends the first 16 events. All remaining messages are filtered. */ +#define CFE_EVS_FIRST_32_STOP 0xFFE0 /**< \brief Sends the first 32 events. All remaining messages are filtered. */ +#define CFE_EVS_FIRST_64_STOP 0xFFC0 /**< \brief Sends the first 64 events. All remaining messages are filtered. */ +#define CFE_EVS_EVERY_OTHER_ONE 0x0001 /**< \brief Sends every other event. */ +#define CFE_EVS_EVERY_OTHER_TWO 0x0002 /**< \brief Sends two, filters one, sends two, filters one, etc */ +#define CFE_EVS_EVERY_FOURTH_ONE 0x0003 /**< \brief Sends every fourth event message. All others are filtered. */ +/** \} */ + +/****************** Structure Definitions *********************/ + +/** \brief Event message filter defintion structure */ +typedef struct CFE_EVS_BinFilter +{ + uint16 EventID; /**< \brief Numerical event identifier */ + uint16 Mask; /**< \brief Binary filter mask value */ + +} CFE_EVS_BinFilter_t; + +#endif /* CFE_EVS_API_TYPEDEFS_H */ diff --git a/modules/core_api/fsw/inc/cfe_evs_core_internal.h b/modules/core_api/fsw/inc/cfe_evs_core_internal.h new file mode 100644 index 000000000..694833da3 --- /dev/null +++ b/modules/core_api/fsw/inc/cfe_evs_core_internal.h @@ -0,0 +1,91 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-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 + * + * Title: Event Services API Application Library Header File + * + * Purpose: + * Unit specification for Event services library functions and macros. + * + * Design Notes: + * + * References: + * Flight Software Branch C Coding Standard Version 1.0a + */ + +#ifndef CFE_EVS_CORE_INTERNAL_H +#define CFE_EVS_CORE_INTERNAL_H + +#include "common_types.h" +#include "cfe_es_extern_typedefs.h" + +/* + * The internal APIs prototyped within this block are only intended to be invoked from + * other CFE core apps. They still need to be prototyped in the shared header such that + * they can be called from other core modules, but applications should not call these. + */ + +/** @defgroup CFEAPIEVSCoreInternal cFE Internal Event Services APIs, internal to CFE core + * @{ + */ + +/*****************************************************************************/ +/** +** \brief Entry Point for cFE Core Application +** +** \par Description +** This is the entry point to the cFE EVS Core Application. +** +** \par Assumptions, External Events, and Notes: +** None +** +******************************************************************************/ +extern void CFE_EVS_TaskMain(void); + +/*****************************************************************************/ +/** +** \brief Initializes the cFE core module API Library +** +** \par Description +** Initializes the cFE core module API Library +** +** \par Assumptions, External Events, and Notes: +** -# This function MUST be called before any module API's are called. +** +******************************************************************************/ +extern int32 CFE_EVS_EarlyInit(void); + +/*****************************************************************************/ +/** +** \brief Removes EVS resources associated with specified Application +** +** \par Description +** This function is called by cFE Executive Services to cleanup after +** an Application has been terminated. It frees resources +** that have been allocated to the specified Application. +** +******************************************************************************/ +extern int32 CFE_EVS_CleanUpApp(CFE_ES_AppId_t AppId); + +/**@}*/ + +#endif /* CFE_EVS_CORE_INTERNAL_H */ diff --git a/modules/core_api/fsw/inc/cfe_evs_extern_typedefs.h b/modules/core_api/fsw/inc/cfe_evs_extern_typedefs.h new file mode 100644 index 000000000..6259b5b37 --- /dev/null +++ b/modules/core_api/fsw/inc/cfe_evs_extern_typedefs.h @@ -0,0 +1,179 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-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 cfe_evs_extern_typedefs module + */ + +#ifndef CFE_EVS_EXTERN_TYPEDEFS_H +#define CFE_EVS_EXTERN_TYPEDEFS_H + +/* This header may be generated from an EDS file, + * tools are available and the feature is enabled */ +#ifdef CFE_EDS_ENABLED_BUILD + +/* Use the EDS generated version of these types */ +#include "cfe_evs_eds_typedefs.h" + +#else +/* Use the local definitions of these types */ + +#include "common_types.h" + +/** + * @brief Label definitions associated with CFE_EVS_MsgFormat_Enum_t + */ +enum CFE_EVS_MsgFormat +{ + + /** + * @brief Short Format Messages + */ + CFE_EVS_MsgFormat_SHORT = 0, + + /** + * @brief Long Format Messages + */ + CFE_EVS_MsgFormat_LONG = 1 +}; + +/** + * @brief Identifies format of log messages + * + * @sa enum CFE_EVS_MsgFormat + */ +typedef uint8 CFE_EVS_MsgFormat_Enum_t; + +/** + * @brief Label definitions associated with CFE_EVS_LogMode_Enum_t + */ +enum CFE_EVS_LogMode +{ + + /** + * @brief Overwrite Log Mode + */ + CFE_EVS_LogMode_OVERWRITE = 0, + + /** + * @brief Discard Log Mode + */ + CFE_EVS_LogMode_DISCARD = 1 +}; + +/** + * @brief Identifies handling of log messages after storage is filled + * + * @sa enum CFE_EVS_LogMode + */ +typedef uint8 CFE_EVS_LogMode_Enum_t; + +/** + * @brief Label definitions associated with CFE_EVS_EventType_Enum_t + */ +enum CFE_EVS_EventType +{ + + /** + * @brief Events that are intended only for debugging, not nominal operations + */ + CFE_EVS_EventType_DEBUG = 1, + + /** + * @brief Events that identify a state change or action that is not an error + */ + CFE_EVS_EventType_INFORMATION = 2, + + /** + * @brief Events that identify an error but are not catastrophic (e.g. - bad command + */ + CFE_EVS_EventType_ERROR = 3, + + /** + * @brief Events that identify errors that are unrecoverable autonomously + */ + CFE_EVS_EventType_CRITICAL = 4 +}; + +/** + * @brief Identifies type of event message + * + * @sa enum CFE_EVS_EventType + */ +typedef uint16 CFE_EVS_EventType_Enum_t; + +/** + * @brief Label definitions associated with CFE_EVS_EventFilter_Enum_t + */ +enum CFE_EVS_EventFilter +{ + + /** + * @brief Binary event filter + */ + CFE_EVS_EventFilter_BINARY = 0 +}; + +/** + * @brief Identifies event filter schemes + * + * @sa enum CFE_EVS_EventFilter + */ +typedef uint8 CFE_EVS_EventFilter_Enum_t; + +/** + * @brief Label definitions associated with CFE_EVS_EventOutput_Enum_t + */ +enum CFE_EVS_EventOutput +{ + + /** + * @brief Output Port 1 + */ + CFE_EVS_EventOutput_PORT1 = 1, + + /** + * @brief Output Port 2 + */ + CFE_EVS_EventOutput_PORT2 = 2, + + /** + * @brief Output Port 3 + */ + CFE_EVS_EventOutput_PORT3 = 3, + + /** + * @brief Output Port 4 + */ + CFE_EVS_EventOutput_PORT4 = 4 +}; + +/** + * @brief Identifies event output port + * + * @sa enum CFE_EVS_EventOutput + */ +typedef uint8 CFE_EVS_EventOutput_Enum_t; + +#endif /* CFE_EDS_ENABLED_BUILD */ + +#endif /* CFE_EVS_EXTERN_TYPEDEFS_H */ diff --git a/modules/core_private/fsw/inc/cfe_evs_log_typedef.h b/modules/core_private/fsw/inc/cfe_evs_log_typedef.h new file mode 100644 index 000000000..66da533b0 --- /dev/null +++ b/modules/core_private/fsw/inc/cfe_evs_log_typedef.h @@ -0,0 +1,51 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-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 + * + * Definition of the CFE_EVS_Log structure type. + * This was moved into its own header file since it is referenced by multiple CFE core apps. + */ + +#ifndef CFE_EVS_LOG_TYPEDEF_H +#define CFE_EVS_LOG_TYPEDEF_H + +#include "common_types.h" +#include "cfe_platform_cfg.h" + +#include "cfe_evs_msg.h" /* Required for CFE_EVS_LongEventTlm_t definition */ + +/* +** \brief EVS Log type definition. This is declared here so ES can include it +** in the reset area structure +*/ +typedef struct +{ + uint16 Next; /**< \brief Index of the next entry in the local event log */ + uint16 LogCount; /**< \brief Local Event Kog counter */ + uint8 LogFullFlag; /**< \brief Local Event Log full flag */ + uint8 LogMode; /**< \brief Local Event Logging mode (overwrite/discard) */ + uint16 LogOverflowCounter; /**< \brief Local Event Log overflow counter */ + CFE_EVS_LongEventTlm_t LogEntry[CFE_PLATFORM_EVS_LOG_MAX]; /**< \brief The actual Local Event Log entry */ + +} CFE_EVS_Log_t; + +#endif /* CFE_EVS_LOG_TYPEDEF_H */