From 8ee7c02e97ba81cb1f3adddbe2cbf3810326cd41 Mon Sep 17 00:00:00 2001 From: Stanislav Pankevich Date: Fri, 10 Jan 2020 09:16:27 +0100 Subject: [PATCH 01/15] CMake: use a dedicated variable to hold a path to the CFS source folder This is needed when CFE's root CMakeLists.txt is not the highest level CMakeLists.txt in the project. --- CMakeLists.txt | 5 +++-- cmake/mission_build.cmake | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09ad95ef5..a552d0181 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Add a path for any locally-supplied CMake modules # These would typically be a part of any custom PSPs in use. # (this is not required, and the directory can be empty/nonexistent) -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../psp/cmake/Modules" ${CMAKE_MODULE_PATH}) +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../psp/cmake/Modules" ${CMAKE_MODULE_PATH}) # The minimum CMake version is chosen because 2.6.4 is what is # included by default with RHEL/Centos 5.x @@ -59,7 +59,8 @@ cmake_minimum_required(VERSION 2.6.4) # that the subdirectories will at least use the "C" language, so # indicate that now. Doing this early initializes the CFLAGS # so they won't change later. -project(CFETOP C) +# Note: this line defines the CFE_SOURCE_DIR variable. +project(CFE C) # Allow unit tests to be added by any recipe enable_testing() diff --git a/cmake/mission_build.cmake b/cmake/mission_build.cmake index a362647ab..343f1ae02 100644 --- a/cmake/mission_build.cmake +++ b/cmake/mission_build.cmake @@ -36,7 +36,7 @@ function(initialize_globals) # this is the parent (mission) build and variable values must be determined # Obtain the "real" top-level source directory and set it in parent scope if (NOT DEFINED MISSION_SOURCE_DIR) - get_filename_component(MISSION_SOURCE_DIR "${CMAKE_SOURCE_DIR}/.." ABSOLUTE) + get_filename_component(MISSION_SOURCE_DIR "${CFE_SOURCE_DIR}/.." ABSOLUTE) set(MISSION_SOURCE_DIR ${MISSION_SOURCE_DIR} CACHE PATH "Top level mission source directory") endif(NOT DEFINED MISSION_SOURCE_DIR) @@ -211,13 +211,13 @@ function(prepare) file(WRITE "${CMAKE_BINARY_DIR}/doc/mission-content.doxyfile" ${MISSION_DOXYFILE_USER_CONTENT}) - configure_file("${CMAKE_SOURCE_DIR}/cmake/cfe-common.doxyfile.in" + configure_file("${CFE_SOURCE_DIR}/cmake/cfe-common.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/cfe-common.doxyfile") - configure_file("${CMAKE_SOURCE_DIR}/cmake/osal-common.doxyfile.in" + configure_file("${CFE_SOURCE_DIR}/cmake/osal-common.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/osal-common.doxyfile") - configure_file("${CMAKE_SOURCE_DIR}/cmake/mission-detaildesign.doxyfile.in" + configure_file("${CFE_SOURCE_DIR}/cmake/mission-detaildesign.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/mission-detaildesign.doxyfile") # The user guide should include the doxygen from the _public_ API files from CFE + OSAL @@ -247,10 +247,10 @@ function(prepare) set(OSALGUIDE_PREDEFINED "MESSAGE_FORMAT_IS_CCSDS") - configure_file("${CMAKE_SOURCE_DIR}/cmake/cfe-usersguide.doxyfile.in" + configure_file("${CFE_SOURCE_DIR}/cmake/cfe-usersguide.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/cfe-usersguide.doxyfile") - configure_file("${CMAKE_SOURCE_DIR}/cmake/osalguide.doxyfile.in" + configure_file("${CFE_SOURCE_DIR}/cmake/osalguide.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/osalguide.doxyfile") add_custom_target(mission-doc @@ -302,7 +302,7 @@ function(prepare) add_custom_target(mission-version COMMAND ${CMAKE_COMMAND} -D BIN=${CMAKE_BINARY_DIR} - -P ${CMAKE_SOURCE_DIR}/cmake/version.cmake + -P ${CFE_SOURCE_DIR}/cmake/version.cmake WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) @@ -345,8 +345,8 @@ function(process_arch TARGETSYSTEM) # Find the toolchain file - allow a file in the mission defs dir to supercede one in the compile dir if (EXISTS ${MISSION_DEFS}/toolchain-${CURRSYS}.cmake) set(TOOLCHAIN_FILE ${MISSION_DEFS}/toolchain-${CURRSYS}.cmake) - elseif(EXISTS ${CMAKE_SOURCE_DIR}/cmake/toolchain-${CURRSYS}.cmake) - set(TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain-${CURRSYS}.cmake) + elseif(EXISTS ${CFE_SOURCE_DIR}/cmake/toolchain-${CURRSYS}.cmake) + set(TOOLCHAIN_FILE ${CFE_SOURCE_DIR}/cmake/toolchain-${CURRSYS}.cmake) else() message(FATAL_ERROR "Unable to find toolchain file for ${CURRSYS}") endif() @@ -365,7 +365,7 @@ function(process_arch TARGETSYSTEM) -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${SELECTED_TOOLCHAIN_FILE} - ${CMAKE_SOURCE_DIR} + ${CFE_SOURCE_DIR} WORKING_DIRECTORY "${ARCH_BINARY_DIR}" RESULT_VARIABLE From f5e4c505a693fcf2e9bee00b3c5462a93d3ba138 Mon Sep 17 00:00:00 2001 From: dmknutsen Date: Mon, 30 Mar 2020 10:57:39 -0400 Subject: [PATCH 02/15] Fixes #88, updates comments to note that the length limit of OS_MAX_PATH_LEN and OS_MAX_API_NAME includes null terminator --- cmake/sample_defs/default_osconfig.h | 6 +++--- fsw/cfe-core/src/inc/cfe_fs.h | 2 +- fsw/cfe-core/src/inc/cfe_sb.h | 3 ++- fsw/cfe-core/src/inc/cfe_tbl_events.h | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cmake/sample_defs/default_osconfig.h b/cmake/sample_defs/default_osconfig.h index 3d5bbe6f8..53a7ca0d7 100644 --- a/cmake/sample_defs/default_osconfig.h +++ b/cmake/sample_defs/default_osconfig.h @@ -44,7 +44,7 @@ #define OS_MAX_MUTEXES 20 /* -** Maximum length for an absolute path name +** Maximum length (including terminator) for an absolute path name */ #define OS_MAX_PATH_LEN 64 @@ -56,7 +56,7 @@ #define OS_MAX_LOCAL_PATH_LEN (OS_MAX_PATH_LEN + OS_FS_PHYS_NAME_LEN) /* -** The maxium length allowed for a object (task,queue....) name +** The maxium length allowed for a object name (task, queue, etc.), including terminating null */ #define OS_MAX_API_NAME 20 @@ -66,7 +66,7 @@ #define OS_MAX_FILE_NAME 20 /* -** These defines are for OS_printf +** Buffer for OS_printf, includes terminator. Longer messages will be truncated */ #define OS_BUFFER_SIZE 172 #define OS_BUFFER_MSG_DEPTH 100 diff --git a/fsw/cfe-core/src/inc/cfe_fs.h b/fsw/cfe-core/src/inc/cfe_fs.h index dde2169db..e7fcf2d6a 100644 --- a/fsw/cfe-core/src/inc/cfe_fs.h +++ b/fsw/cfe-core/src/inc/cfe_fs.h @@ -286,7 +286,7 @@ int32 CFE_FS_GetUncompressedFile(char *OutputNameBuffer, uint32 OutputNameBuffer ** \par Assumptions, External Events, and Notes: ** -# The paths and filenames used here are the standard unix style ** filenames separated by "/" characters. -** -# The extracted filename is no longer than #OS_MAX_PATH_LEN +** -# The extracted filename (including terminator) is no longer than #OS_MAX_PATH_LEN ** ** \param[in] OriginalPath The original path. ** \param[out] FileNameOnly The filename that is extracted from the path. diff --git a/fsw/cfe-core/src/inc/cfe_sb.h b/fsw/cfe-core/src/inc/cfe_sb.h index d71096acd..10d87c243 100644 --- a/fsw/cfe-core/src/inc/cfe_sb.h +++ b/fsw/cfe-core/src/inc/cfe_sb.h @@ -188,7 +188,8 @@ typedef struct { ** ** \param[in] PipeName A string to be used to identify this pipe in error messages ** and routing information telemetry. The string must be no -** longer than #OS_MAX_API_NAME. Longer strings will be truncated. +** longer than #OS_MAX_API_NAME (including terminator). +** Longer strings will be truncated. ** ** \param[out] *PipeIdPtr The identifier for the created pipe. ** diff --git a/fsw/cfe-core/src/inc/cfe_tbl_events.h b/fsw/cfe-core/src/inc/cfe_tbl_events.h index d69523cd5..5b1ea91c4 100644 --- a/fsw/cfe-core/src/inc/cfe_tbl_events.h +++ b/fsw/cfe-core/src/inc/cfe_tbl_events.h @@ -313,7 +313,7 @@ ** ** -# The filename was misspelled ** -# The path to the file was incorrect -** -# The length of the filename and/or path exceeds the +** -# The length (including terminator) of the filename and/or path exceeds the ** allowable length (see #OS_MAX_PATH_LEN and #OS_MAX_FILE_NAME, respectively) ** ** The \c Status field in the event message indicates the error code returned by the #OS_open From 07c4caea3f85ed37341ac0c149eb7e42c76fcfcb Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Tue, 31 Mar 2020 08:45:36 -0400 Subject: [PATCH 03/15] Fix #344, Remove mission/platform include dirs --- fsw/mission_inc/cfe_mission_cfg.h | 737 -------- fsw/mission_inc/cfe_perfids.h | 65 - fsw/platform_inc/cpu1/cfe_msgids.h | 102 -- fsw/platform_inc/cpu1/cfe_platform_cfg.h | 2106 ---------------------- 4 files changed, 3010 deletions(-) delete mode 100644 fsw/mission_inc/cfe_mission_cfg.h delete mode 100644 fsw/mission_inc/cfe_perfids.h delete mode 100644 fsw/platform_inc/cpu1/cfe_msgids.h delete mode 100644 fsw/platform_inc/cpu1/cfe_platform_cfg.h diff --git a/fsw/mission_inc/cfe_mission_cfg.h b/fsw/mission_inc/cfe_mission_cfg.h deleted file mode 100644 index 7a3811139..000000000 --- a/fsw/mission_inc/cfe_mission_cfg.h +++ /dev/null @@ -1,737 +0,0 @@ -/* -** 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: cfe_mission_cfg.h -** -** Purpose: -** This header file contains the mission configuration parameters and -** typedefs with mission scope. -** -** Notes: -** The impact of changing these configurations from their default value is -** not yet documented. Changing these values may impact the performance -** and functionality of the system. -** -** Author: R.McGraw/SSI -** -******************************************************************************/ - -#ifndef _cfe_mission_cfg_ -#define _cfe_mission_cfg_ - - -/** -** \cfemissioncfg Spacecraft ID -** -** \par Description: -** This defines the value that is returned by the call to -** CFE_PSP_GetSpacecraftId. -** -** \par Limits -** The cFE does not place a limit on this configuration paramter. -** CCSDS allocates 8 bits for this field in the standard VCDU. -*/ -#define CFE_MISSION_SPACECRAFT_ID 0x42 - - -/** -** \cfemissioncfg cFE SB message format -** -** \par Description: -** Dictates the message format used by the cFE. -** -** \par Limits -** All versions of the cFE currently support only CCSDS as the message format -** Defining only MESSAGE_FORMAT_IS_CCSDS implements the 11 bit APID format in the primary header -** Also defining MESSAGE_FORMAT_IS_CCSDS_VER_2 implements the APID extended header format -** MESSAGE_FORMAT_IS_CCSDS must be defined for all cFE deployments. MESSAGE_FORMAT_IS_CCSDS_VER_2 is optional -*/ -#define MESSAGE_FORMAT_IS_CCSDS -/* #define MESSAGE_FORMAT_IS_CCSDS_VER_2 */ -#undef MESSAGE_FORMAT_IS_CCSDS_VER_2 - - - -/** \name Packet timestamp format identifiers */ -/** \{ */ -#define CFE_MISSION_SB_TIME_32_16_SUBS 1 /**< \brief 32 bits seconds + 16 bits subseconds (units = 2^^-16) */ -#define CFE_MISSION_SB_TIME_32_32_SUBS 2 /**< \brief 32 bits seconds + 32 bits subseconds (units = 2^^-32) */ -#define CFE_MISSION_SB_TIME_32_32_M_20 3 /**< \brief 32 bits seconds + 20 bits microsecs + 12 bits reserved */ -/** \} */ - -/** -** \cfemissioncfg Packet Timestamp Format Selection -** -** \par Description: -** Defines the size, format and contents of the telemetry packet timestamp. -** -** \par Limits -** Must be defined as one of the supported formats listed above -*/ -#define CFE_MISSION_SB_PACKET_TIME_FORMAT CFE_MISSION_SB_TIME_32_16_SUBS - - -/** -** \cfesbcfg Maximum SB Message Size -** -** \par Description: -** The following definition dictates the maximum message size allowed on -** the software bus. SB checks the pkt length field in the header of all -** messages sent. If the pkt length field indicates the message is larger -** than this define, SB sends an event and rejects the send. -** -** -** \par Limits -** This parameter has a lower limit of 6 (CCSDS primary header size). There -** are no restrictions on the upper limit however, the maximum message size is -** system dependent and should be verified. Total message size values that are -** checked against this configuration are defined by a 16 bit data word. -*/ -#define CFE_MISSION_SB_MAX_SB_MSG_SIZE 32768 - - -/** -** \cfetimecfg Default Time Format -** -** \par Description: -** The following definitions select either UTC or TAI as the default -** (mission specific) time format. Although it is possible for an -** application to request time in a specific format, most callers -** should use CFE_TIME_GetTime(), which returns time in the default -** format. This avoids having to modify each individual caller -** when the default choice is changed. -** -** -** \par Limits -** if CFE_MISSION_TIME_CFG_DEFAULT_TAI is defined as TRUE then CFE_MISSION_TIME_CFG_DEFAULT_UTC must be -** defined as FALSE. -** if CFE_MISSION_TIME_CFG_DEFAULT_TAI is defined as FALSE then CFE_MISSION_TIME_CFG_DEFAULT_UTC must be -** defined as TRUE. -*/ -#define CFE_MISSION_TIME_CFG_DEFAULT_TAI TRUE -#define CFE_MISSION_TIME_CFG_DEFAULT_UTC FALSE - - -/** -** \cfetimecfg Default Time Format -** -** \par Description: -** The following definition enables the use of a simulated time at -** the tone signal using a software bus message. -** -** -** \par Limits -** Not Applicable -*/ -#define CFE_MISSION_TIME_CFG_FAKE_TONE TRUE - - -/** -** \cfetimecfg Default Time and Tone Order -** -** \par Description: -** Time Services may be configured to expect the time at the tone -** data packet to either precede or follow the tone signal. If the -** time at the tone data packet follows the tone signal, then the -** data within the packet describes what the time "was" at the tone. -** If the time at the tone data packet precedes the tone signal, then -** the data within the packet describes what the time "will be" at -** the tone. One, and only one, of the following symbols must be set to TRUE: -** - CFE_MISSION_TIME_AT_TONE_WAS -** - CFE_MISSION_TIME_AT_TONE_WILL_BE -** Note: If Time Services is defined as using a simulated tone signal -** (see #CFE_MISSION_TIME_CFG_FAKE_TONE above), then the tone data packet -** must follow the tone signal. -** -** \par Limits -** Either CFE_MISSION_TIME_AT_TONE_WAS or CFE_MISSION_TIME_AT_TONE_WILL_BE must be set to TRUE. -** They may not both be TRUE and they may not both be FALSE. -*/ -#define CFE_MISSION_TIME_AT_TONE_WAS TRUE -#define CFE_MISSION_TIME_AT_TONE_WILL_BE FALSE - -/** -** \cfetimecfg Min and Max Time Elapsed -** -** \par Description: -** Based on the definition of Time and Tone Order -** (CFE_MISSION_TIME_AT_TONE_WAS/WILL_BE) either the "time at the tone" signal or -** data packet will follow the other. This definition sets the valid window -** of time for the second of the pair to lag behind the first. Time -** Services will invalidate both the tone and packet if the second does not -** arrive within this window following the first. -** -** For example, if the data packet follows the tone, it might be valid for -** the data packet to arrive between zero and 100,000 micro-seconds after -** the tone. But, if the tone follows the the packet, it might be valid -** only if the packet arrived between 200,000 and 700,000 micro-seconds -** before the tone. -** -** Note: units are in micro-seconds -** -** -** \par Limits -** 0 to 999,999 decimal -*/ -#define CFE_MISSION_TIME_MIN_ELAPSED 0 -#define CFE_MISSION_TIME_MAX_ELAPSED 200000 - - -/** -** \cfetimecfg Default Time Values -** -** \par Description: -** Default time values are provided to avoid problems due to time -** calculations performed after startup but before commands can be -** processed. For example, if the default time format is UTC then -** it is important that the sum of MET and STCF always exceed the -** value of Leap Seconds to prevent the UTC time calculation -** (time = MET + STCF - Leap Seconds) from resulting in a negative -** (very large) number.

-** Some past missions have also created known (albeit wrong) default -** timestamps. For example, assume the epoch is defined as Jan 1, 1970 -** and further assume the default time values are set to create a timestamp -** of Jan 1, 2000. Even though the year 2000 timestamps are wrong, it -** may be of value to keep the time within some sort of bounds acceptable -** to the software.

-** Note: Sub-second units are in micro-seconds (0 to 999,999) and -** all values must be defined -** -** \par Limits -** Not Applicable -*/ -#define CFE_MISSION_TIME_DEF_MET_SECS 1000 -#define CFE_MISSION_TIME_DEF_MET_SUBS 0 - -#define CFE_MISSION_TIME_DEF_STCF_SECS 1000000 -#define CFE_MISSION_TIME_DEF_STCF_SUBS 0 - -#define CFE_MISSION_TIME_DEF_LEAPS 32 - -#define CFE_MISSION_TIME_DEF_DELAY_SECS 0 -#define CFE_MISSION_TIME_DEF_DELAY_SUBS 1000 - - -/** -** \cfetimecfg Default EPOCH Values -** -** \par Description: -** Default ground time epoch values -** Note: these values are used only by the CFE_TIME_Print() API function -** -** \par Limits -** Year - must be within 136 years -** Day - Jan 1 = 1, Feb 1 = 32, etc. -** Hour - 0 to 23 -** Minute - 0 to 59 -** Second - 0 to 59 -*/ -#define CFE_MISSION_TIME_EPOCH_YEAR 1980 -#define CFE_MISSION_TIME_EPOCH_DAY 1 -#define CFE_MISSION_TIME_EPOCH_HOUR 0 -#define CFE_MISSION_TIME_EPOCH_MINUTE 0 -#define CFE_MISSION_TIME_EPOCH_SECOND 0 - - -/** -** \cfetimecfg Time File System Factor -** -** \par Description: -** Define the s/c vs file system time conversion constant... -** -** Note: this value is intended for use only by CFE TIME API functions to -** convert time values based on the ground system epoch (s/c time) to -** and from time values based on the file system epoch (fs time). -** -** FS time = S/C time + factor -** S/C time = FS time - factor -** -** Worksheet: -** -** S/C epoch = Jan 1, 2005 (LRO ground system epoch) -** FS epoch = Jan 1, 1980 (vxWorks DOS file system epoch) -** -** Delta = 25 years, 0 days, 0 hours, 0 minutes, 0 seconds -** -** Leap years = 1980, 1984, 1988, 1992, 1996, 2000, 2004 -** (divisible by 4 -- except if by 100 -- unless also by 400) -** -** 1 year = 31,536,000 seconds -** 1 day = 86,400 seconds -** 1 hour = 3,600 seconds -** 1 minute = 60 seconds -** -** 25 years = 788,400,000 seconds -** 7 extra leap days = 604,800 seconds -** -** total delta = 789,004,800 seconds -** -** \par Limits -** Not Applicable -*/ -#define CFE_MISSION_TIME_FS_FACTOR 789004800 - - -/** -** \cfeescfg Maximum Length of CDS Name -** -** \par Description: -** Indicates the maximum length (in characters) of the CDS name ('CDSName') -** portion of a Full CDS Name of the following form: -** "ApplicationName.CDSName" -** -** -** \par Limits -** Not Applicable -*/ -#define CFE_MISSION_ES_CDS_MAX_NAME_LENGTH 16 - - - -/** -** \cfeevscfg Maximum Event Message Length -** -** \par Description: -** Indicates the maximum length (in characers) of the formatted text -** string portion of an event message -** -** \par Limits -** Not Applicable -*/ -#define CFE_MISSION_EVS_MAX_MESSAGE_LENGTH 122 - - -/** \name Checksum/CRC algorithm identifiers */ -/** \{ */ -#define CFE_MISSION_ES_CRC_8 1 /**< \brief CRC ( 8 bit additive - returns 32 bit total) (Currently not implemented) */ -#define CFE_MISSION_ES_CRC_16 2 /**< \brief CRC (16 bit additive - returns 32 bit total) */ -#define CFE_MISSION_ES_CRC_32 3 /**< \brief CRC (32 bit additive - returns 32 bit total) (Currently not implemented) */ -/** \} */ - -/** -** \cfeescfg Mission Default CRC algorithm -** -** \par Description: -** Indicates the which CRC algorithm should be used as the default -** for verifying the contents of Critical Data Stores and when calculating -** Table Image data integrity values. -** -** \par Limits -** Currently only CFE_MISSION_ES_CRC_16 is supported (see #CFE_MISSION_ES_CRC_16) -*/ -#define CFE_MISSION_ES_DEFAULT_CRC CFE_MISSION_ES_CRC_16 - - -/** -** \cfetblcfg Maximum Table Name Length -** -** \par Description: -** Indicates the maximum length (in characers) of the table name -** ('TblName') portion of a Full Table Name of the following -** form: "ApplicationName.TblName" -** -** \par Limits -** Not Applicable -*/ -#define CFE_MISSION_TBL_MAX_NAME_LENGTH 16 - - -/** -** \cfemissioncfg cFE Message ID Base Numbers -** -** \par Description: -** Message Id base numbers for the cFE messages -** These will now differ in format when using CCSDS version 2 as they will no longer -** include the Secondary Header Flag and CCSDS version bits. -** -** NOTES: cFE MsgIds are the sum of the base numbers and the portable msg -** numbers. -** -** For MESSAGE_FORMAT_IS_CCSDS_VER_2 These base MsgIds values are dependent on the -** values returned by the following SB Macros to form a 16 bit message ID (default -** macro definitions are in cfe_sb_msg_id_utils.h, default values below are -** representative of default macro definitions) : -** CFE_SB_CMD_MESSAGE_TYPE, CFE_SB_RD_APID_FROM_MSGID -** CFE_SB_RD_SUBSYS_ID_FROM_MSGID and CFE_SB_RD_TYPE_FROM_MSGID -** -** \par Limits -** Must be less than CFE_PLATFORM_SB_HIGHEST_VALID_MSGID -*/ -#ifndef MESSAGE_FORMAT_IS_CCSDS_VER_2 -#define CFE_MISSION_CMD_MID_BASE1 0x1800 -#define CFE_MISSION_TLM_MID_BASE1 0x0800 -#else -#define CFE_MISSION_CMD_MID_BASE1 0x0080 -#define CFE_MISSION_TLM_MID_BASE1 0x0000 -#endif - -#define CFE_MISSION_CMD_APPID_BASE1 1 -#define CFE_MISSION_TLM_APPID_BASE1 0 - -#ifndef MESSAGE_FORMAT_IS_CCSDS_VER_2 -#define CFE_MISSION_CMD_MID_BASE_GLOB 0x1860 -#define CFE_MISSION_TLM_MID_BASE_GLOB 0x0860 -#else -#define CFE_MISSION_CMD_MID_BASE_GLOB 0x00E0 -#define CFE_MISSION_TLM_MID_BASE_GLOB 0x0060 -#endif - - - -/** -** \cfemissioncfg cFE Portable Message Numbers for Commands -** -** \par Description: -** Portable message numbers for the cFE command messages -** NOTE: cFE MsgIds are the sum of the base numbers and the portable msg -** numbers. -** -** \par Limits -** Not Applicable -*/ -#define CFE_MISSION_EVS_CMD_MSG 1 - /* Offset 2 is available */ -#define CFE_MISSION_SB_CMD_MSG 3 -#define CFE_MISSION_TBL_CMD_MSG 4 -#define CFE_MISSION_TIME_CMD_MSG 5 -#define CFE_MISSION_ES_CMD_MSG 6 - -#define CFE_MISSION_ES_SEND_HK_MSG 8 -#define CFE_MISSION_EVS_SEND_HK_MSG 9 - /* Offset 10 is available */ -#define CFE_MISSION_SB_SEND_HK_MSG 11 -#define CFE_MISSION_TBL_SEND_HK_MSG 12 -#define CFE_MISSION_TIME_SEND_HK_MSG 13 - -#define CFE_MISSION_TIME_TONE_CMD_MSG 16 -#define CFE_MISSION_TIME_1HZ_CMD_MSG 17 - - -/** -** \cfemissioncfg cFE Portable Message Numbers for Global Messages -** -** \par Description: -** Portable message numbers for the cFE global messages -** NOTE: cFE MsgIds are the sum of the base numbers and the portable msg -** numbers. -** -** \par Limits -** Not Applicable -*/ -#define CFE_MISSION_TIME_DATA_CMD_MSG 0 -#define CFE_MISSION_TIME_SEND_CMD_MSG 2 - - -/** -** \cfemissioncfg cFE Portable Message Numbers for Telemetry -** -** \par Description: -** Portable message numbers for the cFE telemetry messages -** NOTE: cFE MsgIds are the sum of the base numbers and the portable msg -** numbers. -** -** \par Limits -** Not Applicable -*/ -#define CFE_MISSION_ES_HK_TLM_MSG 0 -#define CFE_MISSION_EVS_HK_TLM_MSG 1 - /* Offset 2 is available */ -#define CFE_MISSION_SB_HK_TLM_MSG 3 -#define CFE_MISSION_TBL_HK_TLM_MSG 4 -#define CFE_MISSION_TIME_HK_TLM_MSG 5 -#define CFE_MISSION_TIME_DIAG_TLM_MSG 6 - -#define CFE_MISSION_EVS_LONG_EVENT_MSG_MSG 8 -#define CFE_MISSION_EVS_SHORT_EVENT_MSG_MSG 9 -#define CFE_MISSION_SB_STATS_TLM_MSG 10 -#define CFE_MISSION_ES_APP_TLM_MSG 11 -#define CFE_MISSION_TBL_REG_TLM_MSG 12 -#define CFE_MISSION_SB_ALLSUBS_TLM_MSG 13 -#define CFE_MISSION_SB_ONESUB_TLM_MSG 14 -#define CFE_MISSION_ES_SHELL_TLM_MSG 15 -#define CFE_MISSION_ES_MEMSTATS_TLM_MSG 16 - -/** -** \cfeescfg Mission Max Apps in a message -** -** \par Description: -** Indicates the maximum number of apps in a telemetry housekeeping message -** -** This affects the layout of command/telemetry messages but does not affect run -** time behavior or internal allocation. -** -** \par Limits -** All CPUs within the same SB domain (mission) must share the same definition -** Note this affects the size of messages, so it must not cause any message -** to exceed the max length. -*/ -#define CFE_MISSION_ES_MAX_APPLICATIONS 16 - - -/** -** \cfeescfg Define Max Shell Command Size for messages -** -** \par Description: -** Defines the maximum size in characters of the shell command. -** -** This affects the layout of command/telemetry messages but does not affect run -** time behavior or internal allocation. -** -** \par Limits -** All CPUs within the same SB domain (mission) must share the same definition -** Note this affects the size of messages, so it must not cause any message -** to exceed the max length. -** -*/ -#define CFE_MISSION_ES_MAX_SHELL_CMD 64 - - -/** -** \cfeescfg Define Shell Command Telemetry Pkt Segment Size for messages -** -** \par Description: -** Defines the size of the shell command tlm packet segments.The shell command -** output size is dependant on the shell command itself. If the shell output -** size is greater than the size of the packet defined here, the fsw will -** generate a series of tlm packets (of the size defined here) that can be -** reconstructed by the ground system. -** -** This affects the layout of command/telemetry messages but does not affect run -** time behavior or internal allocation. -** -** \par Limits -** All CPUs within the same SB domain (mission) must share the same definition -** Note this affects the size of messages, so it must not cause any message -** to exceed the max length. -** -*/ -#define CFE_MISSION_ES_MAX_SHELL_PKT 64 - -/** -** \cfeescfg Define Max Number of Performance IDs for messages -** -** \par Description: -** Defines the maximum number of perf ids allowed in command/telemetry messages -** -** This affects the layout of command/telemetry messages but does not affect run -** time behavior or internal allocation. -** -** \par Limits -** All CPUs within the same SB domain (mission) must share the same definition -** Note this affects the size of messages, so it must not cause any message -** to exceed the max length. -** -*/ -#define CFE_MISSION_ES_PERF_MAX_IDS 128 - -/** -** \cfetblcfg Maximum Length of Full Table Name in messages -** -** \par Description: -** Indicates the maximum length (in characters) of the entire table name -** within software bus messages -** This affects the layout of command/telemetry messages but does not affect run -** time behavior or internal allocation. -** -** \par Limits -** All CPUs within the same SB domain (mission) must share the same definition -** Note this affects the size of messages, so it must not cause any message -** to exceed the max length. -** -*/ -#define CFE_MISSION_TBL_MAX_FULL_NAME_LEN (CFE_MISSION_TBL_MAX_NAME_LENGTH + CFE_MISSION_MAX_API_LEN + 2) - -/** -** \cfesbcfg Maximum Number of pipes that SB command/telemetry messages may hold -** -** \par Description: -** Dictates the maximum number of unique Pipes the SB message defintions will hold. -** -** This affects the layout of command/telemetry messages but does not affect run -** time behavior or internal allocation. -** -** \par Limits -** All CPUs within the same SB domain (mission) must share the same definition -** Note this affects the size of messages, so it must not cause any message -** to exceed the max length. -** -*/ -#define CFE_MISSION_SB_MAX_PIPES 64 - - -/** -** \cfemissioncfg cFE Maximum length for filenames in messages -** -** \par Description: -** The value of this constant dictates the size of filenames within SB messages. -** This is typically the same as OS_MAX_PATH_LEN but that is OSAL dependent -- -** and as such it definable on a per-processor/OS basis and hence may be different -** across multiple processors. Since this defines a message format, it must be -** consistent across ALL processors exchanging SB messages. -** -** This affects the layout of command/telemetry messages but does not affect run -** time behavior or internal allocation. -** -** \par Limits -** All CPUs within the same SB domain (mission) must share the same definition -** Note this affects the size of messages, so it must not cause any message -** to exceed the max length. -** -*/ -#define CFE_MISSION_MAX_PATH_LEN 64 - -/** -** \cfemissioncfg cFE Maximum length for API names in messages -** -** \par Description: -** The value of this constant dictates the size of API names within SB messages. -** This is typically the same as OS_MAX_API_LEN but that is OSAL dependent -- -** and as such it definable on a per-processor/OS basis and hence may be different -** across multiple processors. -** -** This affects the layout of command/telemetry messages but does not affect run -** time behavior or internal allocation. -** -** \par Limits -** All CPUs within the same SB domain (mission) must share the same definition -** Note this affects the size of messages, so it must not cause any message -** to exceed the max length. -** -*/ -#define CFE_MISSION_MAX_API_LEN 20 - -/** -** \cfeescfg Maximum Length of Full CDS Name in messages -** -** \par Description: -** Indicates the maximum length (in characters) of the entire CDS name -** of the following form: "ApplicationName.CDSName" -** -** This affects the layout of command/telemetry messages but does not affect run -** time behavior or internal allocation. -** -** \par Limits -** All CPUs within the same SB domain (mission) must share the same definition -** Note this affects the size of messages, so it must not cause any message -** to exceed the max length. -*/ -#define CFE_MISSION_ES_CDS_MAX_NAME_LEN (CFE_MISSION_ES_CDS_MAX_NAME_LENGTH + CFE_MISSION_MAX_API_LEN + 2) - - -/* - * Compatibility layer for CFE release 6.6 - * During development of CFE 6.6 a naming convention was introduced such - * that all mission-wide / global symbols use a CFE_MISSION_ prefix. - * - * The following section provides a mapping from the historical name to - * the new name for compatibility with existing code. The code can then be - * compiled with the CFE_OMIT_DEPRECATED_6_6 macro defined, and an error will - * be triggered if any of the old symbol names are referenced in the code. - * - * It is expected that this compatibility layer will be removed in the next - * release following 6.6, so all code must be fixed to use the new name. - */ -#ifndef CFE_OMIT_DEPRECATED_6_6 - -#define CFE_SPACECRAFT_ID CFE_MISSION_SPACECRAFT_ID -#define CFE_SB_TIME_32_16_SUBS CFE_MISSION_SB_TIME_32_16_SUBS -#define CFE_SB_TIME_32_32_SUBS CFE_MISSION_SB_TIME_32_32_SUBS -#define CFE_SB_TIME_32_32_M_20 CFE_MISSION_SB_TIME_32_32_M_20 -#define CFE_SB_PACKET_TIME_FORMAT CFE_MISSION_SB_PACKET_TIME_FORMAT -#define CFE_SB_MAX_SB_MSG_SIZE CFE_MISSION_SB_MAX_SB_MSG_SIZE -#define CFE_TIME_CFG_DEFAULT_TAI CFE_MISSION_TIME_CFG_DEFAULT_TAI -#define CFE_TIME_CFG_DEFAULT_UTC CFE_MISSION_TIME_CFG_DEFAULT_UTC -#define CFE_TIME_CFG_FAKE_TONE CFE_MISSION_TIME_CFG_FAKE_TONE -#define CFE_TIME_AT_TONE_WAS CFE_MISSION_TIME_AT_TONE_WAS -#define CFE_TIME_AT_TONE_WILL_BE CFE_MISSION_TIME_AT_TONE_WILL_BE -#define CFE_TIME_MIN_ELAPSED CFE_MISSION_TIME_MIN_ELAPSED -#define CFE_TIME_MAX_ELAPSED CFE_MISSION_TIME_MAX_ELAPSED -#define CFE_TIME_DEF_MET_SECS CFE_MISSION_TIME_DEF_MET_SECS -#define CFE_TIME_DEF_MET_SUBS CFE_MISSION_TIME_DEF_MET_SUBS -#define CFE_TIME_DEF_STCF_SECS CFE_MISSION_TIME_DEF_STCF_SECS -#define CFE_TIME_DEF_STCF_SUBS CFE_MISSION_TIME_DEF_STCF_SUBS -#define CFE_TIME_DEF_LEAPS CFE_MISSION_TIME_DEF_LEAPS -#define CFE_TIME_DEF_DELAY_SECS CFE_MISSION_TIME_DEF_DELAY_SECS -#define CFE_TIME_DEF_DELAY_SUBS CFE_MISSION_TIME_DEF_DELAY_SUBS -#define CFE_TIME_EPOCH_YEAR CFE_MISSION_TIME_EPOCH_YEAR -#define CFE_TIME_EPOCH_DAY CFE_MISSION_TIME_EPOCH_DAY -#define CFE_TIME_EPOCH_HOUR CFE_MISSION_TIME_EPOCH_HOUR -#define CFE_TIME_EPOCH_MINUTE CFE_MISSION_TIME_EPOCH_MINUTE -#define CFE_TIME_EPOCH_SECOND CFE_MISSION_TIME_EPOCH_SECOND -#define CFE_TIME_FS_FACTOR CFE_MISSION_TIME_FS_FACTOR -#define CFE_ES_CDS_MAX_NAME_LENGTH CFE_MISSION_ES_CDS_MAX_NAME_LENGTH -#define CFE_EVS_MAX_MESSAGE_LENGTH CFE_MISSION_EVS_MAX_MESSAGE_LENGTH -#define CFE_ES_CRC_8 CFE_MISSION_ES_CRC_8 -#define CFE_ES_CRC_16 CFE_MISSION_ES_CRC_16 -#define CFE_ES_CRC_32 CFE_MISSION_ES_CRC_32 -#define CFE_ES_DEFAULT_CRC CFE_MISSION_ES_DEFAULT_CRC -#define CFE_TBL_MAX_NAME_LENGTH CFE_MISSION_TBL_MAX_NAME_LENGTH -#define CFE_CMD_MID_BASE_CPU1 CFE_MISSION_CMD_MID_BASE_CPU1 -#define CFE_TLM_MID_BASE_CPU1 CFE_MISSION_TLM_MID_BASE_CPU1 -#define CFE_CMD_APPID_BASE_CPU1 CFE_MISSION_CMD_APPID_BASE_CPU1 -#define CFE_TLM_APPID_BASE_CPU1 CFE_MISSION_TLM_APPID_BASE_CPU1 -#define CFE_CMD_MID_BASE_CPU2 CFE_MISSION_CMD_MID_BASE_CPU2 -#define CFE_TLM_MID_BASE_CPU2 CFE_MISSION_TLM_MID_BASE_CPU2 -#define CFE_CMD_APPID_BASE_CPU2 CFE_MISSION_CMD_APPID_BASE_CPU2 -#define CFE_TLM_APPID_BASE_CPU2 CFE_MISSION_TLM_APPID_BASE_CPU2 -#define CFE_CMD_MID_BASE_CPU3 CFE_MISSION_CMD_MID_BASE_CPU3 -#define CFE_TLM_MID_BASE_CPU3 CFE_MISSION_TLM_MID_BASE_CPU3 -#define CFE_CMD_APPID_BASE_CPU3 CFE_MISSION_CMD_APPID_BASE_CPU3 -#define CFE_TLM_APPID_BASE_CPU3 CFE_MISSION_TLM_APPID_BASE_CPU3 -#define CFE_CMD_MID_BASE_GLOB CFE_MISSION_CMD_MID_BASE_GLOB -#define CFE_TLM_MID_BASE_GLOB CFE_MISSION_TLM_MID_BASE_GLOB -#define CFE_EVS_CMD_MSG CFE_MISSION_EVS_CMD_MSG -#define CFE_SB_CMD_MSG CFE_MISSION_SB_CMD_MSG -#define CFE_TBL_CMD_MSG CFE_MISSION_TBL_CMD_MSG -#define CFE_TIME_CMD_MSG CFE_MISSION_TIME_CMD_MSG -#define CFE_ES_CMD_MSG CFE_MISSION_ES_CMD_MSG -#define CFE_ES_SEND_HK_MSG CFE_MISSION_ES_SEND_HK_MSG -#define CFE_EVS_SEND_HK_MSG CFE_MISSION_EVS_SEND_HK_MSG -#define CFE_SB_SEND_HK_MSG CFE_MISSION_SB_SEND_HK_MSG -#define CFE_TBL_SEND_HK_MSG CFE_MISSION_TBL_SEND_HK_MSG -#define CFE_TIME_SEND_HK_MSG CFE_MISSION_TIME_SEND_HK_MSG -#define CFE_TIME_TONE_CMD_MSG CFE_MISSION_TIME_TONE_CMD_MSG -#define CFE_TIME_1HZ_CMD_MSG CFE_MISSION_TIME_1HZ_CMD_MSG -#define CFE_TIME_DATA_CMD_MSG CFE_MISSION_TIME_DATA_CMD_MSG -#define CFE_TIME_SEND_CMD_MSG CFE_MISSION_TIME_SEND_CMD_MSG -#define CFE_ES_HK_TLM_MSG CFE_MISSION_ES_HK_TLM_MSG -#define CFE_EVS_HK_TLM_MSG CFE_MISSION_EVS_HK_TLM_MSG -#define CFE_SB_HK_TLM_MSG CFE_MISSION_SB_HK_TLM_MSG -#define CFE_TBL_HK_TLM_MSG CFE_MISSION_TBL_HK_TLM_MSG -#define CFE_TIME_HK_TLM_MSG CFE_MISSION_TIME_HK_TLM_MSG -#define CFE_TIME_DIAG_TLM_MSG CFE_MISSION_TIME_DIAG_TLM_MSG -#define CFE_EVS_EVENT_MSG_MSG CFE_MISSION_EVS_LONG_EVENT_MSG_MSG -#define CFE_SB_STATS_TLM_MSG CFE_MISSION_SB_STATS_TLM_MSG -#define CFE_ES_APP_TLM_MSG CFE_MISSION_ES_APP_TLM_MSG -#define CFE_TBL_REG_TLM_MSG CFE_MISSION_TBL_REG_TLM_MSG -#define CFE_SB_ALLSUBS_TLM_MSG CFE_MISSION_SB_ALLSUBS_TLM_MSG -#define CFE_SB_ONESUB_TLM_MSG CFE_MISSION_SB_ONESUB_TLM_MSG -#define CFE_ES_SHELL_TLM_MSG CFE_MISSION_ES_SHELL_TLM_MSG -#define CFE_ES_MEMSTATS_TLM_MSG CFE_MISSION_ES_MEMSTATS_TLM_MSG - -#endif /* CFE_OMIT_DEPRECATED_6_6 */ - - - - -#endif /* _cfe_mission_cfg_ */ - - diff --git a/fsw/mission_inc/cfe_perfids.h b/fsw/mission_inc/cfe_perfids.h deleted file mode 100644 index 34b05a182..000000000 --- a/fsw/mission_inc/cfe_perfids.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -** 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: cfe_perfids.h -** -** Purpose: This file contains the cFE performance IDs -** -** Design Notes: -** Each performance id is used to identify something that needs to be -** measured. Performance ids are limited to the range of 0 to -** CFE_PLATFORM_ES_PERF_MAX_IDS - 1. Any performance ids outside of this range -** will be ignored and will be flagged as an error. Note that -** performance ids 0-31 are reserved for the cFE Core. -** -** References: -** -*/ - -#ifndef _cfe_perfids_ -#define _cfe_perfids_ - - -#define CFE_MISSION_ES_PERF_EXIT_BIT 31 /**< \brief bit (31) is reserved by the perf utilities */ - -/** \name cFE Performance Monitor IDs (Reserved IDs 0-31) */ -/** \{ */ -#define CFE_MISSION_ES_MAIN_PERF_ID 1 /**< \brief Performance ID for Executive Services Task */ -#define CFE_MISSION_EVS_MAIN_PERF_ID 2 /**< \brief Performance ID for Events Services Task */ -#define CFE_MISSION_TBL_MAIN_PERF_ID 3 /**< \brief Performance ID for Table Services Task */ -#define CFE_MISSION_SB_MAIN_PERF_ID 4 /**< \brief Performance ID for Software Bus Services Task */ -#define CFE_MISSION_SB_MSG_LIM_PERF_ID 5 /**< \brief Performance ID for Software Bus Msg Limit Errors */ -#define CFE_MISSION_SB_PIPE_OFLOW_PERF_ID 27 /**< \brief Performance ID for Software Bus Pipe Overflow Errors */ - - -#define CFE_MISSION_TIME_MAIN_PERF_ID 6 /**< \brief Performance ID for Time Services Task */ -#define CFE_MISSION_TIME_TONE1HZISR_PERF_ID 7 /**< \brief Performance ID for 1 Hz Tone ISR */ -#define CFE_MISSION_TIME_LOCAL1HZISR_PERF_ID 8 /**< \brief Performance ID for 1 Hz Local ISR */ - -#define CFE_MISSION_TIME_SENDMET_PERF_ID 9 /**< \brief Performance ID for Time ToneSendMET */ -#define CFE_MISSION_TIME_LOCAL1HZTASK_PERF_ID 10 /**< \brief Performance ID for 1 Hz Local Task */ -#define CFE_MISSION_TIME_TONE1HZTASK_PERF_ID 11 /**< \brief Performance ID for 1 Hz Tone Task */ - - -/** \} */ - - -#endif /* _cfe_perfids_ */ diff --git a/fsw/platform_inc/cpu1/cfe_msgids.h b/fsw/platform_inc/cpu1/cfe_msgids.h deleted file mode 100644 index 9a2c6c4fe..000000000 --- a/fsw/platform_inc/cpu1/cfe_msgids.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -** 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: cfe_msgids.h -** -** Purpose: -** This header file contains the Message Id's for messages used by the -** cFE core. -** -** Author: R.McGraw/SSI -** -** Notes: -** This file should not contain messages defined by cFE external -** applications. -** -******************************************************************************/ -#ifndef _cfe_msgids_ -#define _cfe_msgids_ - -/* -** Includes -*/ - -#include "cfe_mission_cfg.h" - -/* -** cFE Command Message Id's -*/ -#define CFE_EVS_CMD_MID CFE_MISSION_CMD_MID_BASE1 + CFE_MISSION_EVS_CMD_MSG /* 0x1801 */ - /* Message ID 0x1802 is available */ -#define CFE_SB_CMD_MID CFE_MISSION_CMD_MID_BASE1 + CFE_MISSION_SB_CMD_MSG /* 0x1803 */ -#define CFE_TBL_CMD_MID CFE_MISSION_CMD_MID_BASE1 + CFE_MISSION_TBL_CMD_MSG /* 0x1804 */ -#define CFE_TIME_CMD_MID CFE_MISSION_CMD_MID_BASE1 + CFE_MISSION_TIME_CMD_MSG /* 0x1805 */ -#define CFE_ES_CMD_MID CFE_MISSION_CMD_MID_BASE1 + CFE_MISSION_ES_CMD_MSG /* 0x1806 */ - -#define CFE_ES_SEND_HK_MID CFE_MISSION_CMD_MID_BASE1 + CFE_MISSION_ES_SEND_HK_MSG /* 0x1808 */ -#define CFE_EVS_SEND_HK_MID CFE_MISSION_CMD_MID_BASE1 + CFE_MISSION_EVS_SEND_HK_MSG /* 0x1809 */ - /* Message ID 0x180A is available */ -#define CFE_SB_SEND_HK_MID CFE_MISSION_CMD_MID_BASE1 + CFE_MISSION_SB_SEND_HK_MSG /* 0x180B */ -#define CFE_TBL_SEND_HK_MID CFE_MISSION_CMD_MID_BASE1 + CFE_MISSION_TBL_SEND_HK_MSG /* 0x180C */ -#define CFE_TIME_SEND_HK_MID CFE_MISSION_CMD_MID_BASE1 + CFE_MISSION_TIME_SEND_HK_MSG /* 0x180D */ - -#define CFE_TIME_TONE_CMD_MID CFE_MISSION_CMD_MID_BASE1 + CFE_MISSION_TIME_TONE_CMD_MSG /* 0x1810 */ -#define CFE_TIME_1HZ_CMD_MID CFE_MISSION_CMD_MID_BASE1 + CFE_MISSION_TIME_1HZ_CMD_MSG /* 0x1811 */ - - -/* -** cFE Global Command Message Id's -*/ -#define CFE_TIME_DATA_CMD_MID CFE_MISSION_CMD_MID_BASE_GLOB + CFE_MISSION_TIME_DATA_CMD_MSG /* 0x1860 */ -#define CFE_TIME_SEND_CMD_MID CFE_MISSION_CMD_MID_BASE_GLOB + CFE_MISSION_TIME_SEND_CMD_MSG /* 0x1862 */ - - -/* -** CFE Telemetry Message Id's -*/ -#define CFE_ES_HK_TLM_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_ES_HK_TLM_MSG /* 0x0800 */ -#define CFE_EVS_HK_TLM_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_EVS_HK_TLM_MSG /* 0x0801 */ - /* Message ID 0x0802 is available */ -#define CFE_SB_HK_TLM_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_SB_HK_TLM_MSG /* 0x0803 */ -#define CFE_TBL_HK_TLM_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_TBL_HK_TLM_MSG /* 0x0804 */ -#define CFE_TIME_HK_TLM_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_TIME_HK_TLM_MSG /* 0x0805 */ -#define CFE_TIME_DIAG_TLM_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_TIME_DIAG_TLM_MSG /* 0x0806 */ -#define CFE_EVS_LONG_EVENT_MSG_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_EVS_LONG_EVENT_MSG_MSG /* 0x0808 */ -#define CFE_EVS_SHORT_EVENT_MSG_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_EVS_SHORT_EVENT_MSG_MSG /* 0x0809 */ -#define CFE_SB_STATS_TLM_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_SB_STATS_TLM_MSG /* 0x080A */ -#define CFE_ES_APP_TLM_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_ES_APP_TLM_MSG /* 0x080B */ -#define CFE_TBL_REG_TLM_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_TBL_REG_TLM_MSG /* 0x080C */ -#define CFE_SB_ALLSUBS_TLM_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_SB_ALLSUBS_TLM_MSG /* 0x080D */ -#define CFE_SB_ONESUB_TLM_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_SB_ONESUB_TLM_MSG /* 0x080E */ -#define CFE_ES_SHELL_TLM_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_ES_SHELL_TLM_MSG /* 0x080F */ -#define CFE_ES_MEMSTATS_TLM_MID CFE_MISSION_TLM_MID_BASE1 + CFE_MISSION_ES_MEMSTATS_TLM_MSG /* 0x0810 */ - -/* - * MID definitions by these older names are required to make some existing apps compile - * These are deprecated and should be removed after CFE 6.6 - */ -#ifndef CFE_OMIT_DEPRECATED_6_6 - -#define CFE_EVS_EVENT_MSG_MID CFE_EVS_LONG_EVENT_MSG_MID - -#endif - -#endif diff --git a/fsw/platform_inc/cpu1/cfe_platform_cfg.h b/fsw/platform_inc/cpu1/cfe_platform_cfg.h deleted file mode 100644 index 4594ee72d..000000000 --- a/fsw/platform_inc/cpu1/cfe_platform_cfg.h +++ /dev/null @@ -1,2106 +0,0 @@ -/* -** 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: cfe_platform_cfg.h -** -** Purpose: -** This header file contains the platform configuration parameters. -** -** Notes: -** The impact of changing these configurations from their default value is -** not yet documented. Changing these values may impact the performance -** and functionality of the system. -** -** Author: R.McGraw/SSI -** -******************************************************************************/ - -#ifndef _cfe_platform_cfg_ -#define _cfe_platform_cfg_ - -/* -** Allow reference to CFE_MISSION_SPACECRAFT_ID (see CFE_TBL_VALID_ definitions below) -*/ -#include "cfe_mission_cfg.h" - -/* -** CPU Id for target Processor -*/ -#define CFE_PLATFORM_CPU_ID 1 - -/* -** CPU Name for target Processor -*/ -#define CFE_PLATFORM_CPU_NAME "CPU1" - -/** -** \cfesbcfg Maximum Number of Unique Message IDs SB Routing Table can hold -** -** \par Description: -** Dictates the maximum number of unique MsgIds the SB routing table will hold. -** This constant has a direct affect on the size of SB's tables and arrays. -** Keeping this count as low as possible will save memory. -** To see the run-time, high-water mark and the current utilization figures -** regarding this parameter, send an SB command to 'Send Statistics Pkt'. -** -** \par Limits -** This parameter has a lower limit of 1 and an upper limit of 1024. -** -*/ -#define CFE_PLATFORM_SB_MAX_MSG_IDS 256 - - -/** -** \cfesbcfg Maximum Number of Unique Pipes SB Routing Table can hold -** -** \par Description: -** Dictates the maximum number of unique Pipes the SB routing table will hold. -** This constant has a direct affect on the size of SB's tables and arrays. -** Keeping this count as low as possible will save memory. -** To see the run-time, high-water mark and the current utilization figures -** regarding this parameter, send an SB command to 'Send Statistics Pkt'. -** -** \par Limits -** This parameter has a lower limit of 1. This parameter must also be less than -** or equal to OS_MAX_QUEUES. -** -*/ -#define CFE_PLATFORM_SB_MAX_PIPES 64 - - -/** -** \cfesbcfg Maximum Number of unique local destinations a single MsgId can have -** -** \par Description: -** Dictates the maximum number of unique local destinations a single MsgId can -** have. -** -** \par Limits -** This parameter has a lower limit of 1. There are no restrictions on the upper -** limit however, the maximum number of destinations per packet is system dependent -** and should be verified. Destination number values that are checked against this -** configuration are defined by a 16 bit data word. -** -*/ -#define CFE_PLATFORM_SB_MAX_DEST_PER_PKT 16 - - -/** -** \cfesbcfg Default Subscription Message Limit -** -** \par Description: -** Dictates the default Message Limit when using the #CFE_SB_Subscribe API. This will -** limit the number of messages with a specific message ID that can be received through -** a subscription. This only changes the default; other message limits can be set on a per -** subscription basis using #CFE_SB_SubscribeEx . -** -** \par Limits -** This parameter has a lower limit of 4 and an upper limit of 65535. -** -*/ -#define CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT 4 - - -/** -** \cfesbcfg Size of the SB buffer memory pool -** -** \par Description: -** Dictates the size of the SB memory pool. For each message the SB -** sends, the SB dynamically allocates from this memory pool, the memory needed -** to process the message. The memory needed to process each message is msg -** size + msg descriptor(#CFE_SB_BufferD_t). This memory pool is also used -** to allocate destination descriptors (#CFE_SB_DestinationD_t) during the -** subscription process. -** To see the run-time, high-water mark and the current utilization figures -** regarding this parameter, send an SB command to 'Send Statistics Pkt'. -** Some memory statistics have been added to the SB housekeeping packet. -** NOTE: It is important to monitor these statistics to ensure the desired -** memory margin is met. -** -** \par Limits -** This parameter has a lower limit of 512 and an upper limit of UINT_MAX (4 Gigabytes). -** -*/ -#define CFE_PLATFORM_SB_BUF_MEMORY_BYTES 524288 - - -/** -** \cfesbcfg Maximum depth allowed when creating an SB pipe -** -** \par Description: -** The value of this constant dictates the maximum pipe depth that an -** application may request. The pipe depth is given as a paramter in the -** #CFE_SB_CreatePipe API. -** -** \par Limits -** This parameter has a lower limit of 1. There are no restrictions on the -** upper limit however, the maximum pipe depth is system dependent and should -** be verified. Pipe Depth values that are checked against this configuration -** are defined by a 16 bit data word. -*/ -#define CFE_PLATFORM_SB_MAX_PIPE_DEPTH 256 - - -/** -** \cfesbcfg Highest Valid Message Id -** -** \par Description: -** The value of this constant dictates the size of the SB message map. The SB -** message map is a lookup table that provides the routing table index for -** fast access into the routing table. The default setting of 0x1FFF was chosen -** to save memory. This reduces the message map from 128Kbytes to 16Kbytes. -** See CFE_FSW_DCR 504 for more details. -** -** If this value is different in a distributed architecture some platforms may not -** be able to subscribe to messages generated on other platforms since the message id -** would exceed the mapping table's highest index. Care would have to be taken to ensure the -** constrained platform did not subscribe to message Ids that exceed -** CFE_PLATFORM_SB_HIGHEST_VALID_MSGID -** -** The recommended case to to have this value the same across all mission platforms -** -** \par Limits -** This parameter has a lower limit of 1 and an upper limit of 0xFFFF. -*/ -#define CFE_PLATFORM_SB_HIGHEST_VALID_MSGID 0x1FFF - -/** -** \cfesbcfg Platform Endian Indicator -** -** \par Description: -** The value of this constant indicates the endianess of the target system -** -** \par Limits -** This parameter has a lower limit of 0 and an upper limit of 1. -*/ -#define CFE_PLATFORM_ENDIAN CCSDS_LITTLE_ENDIAN - -/** -** \cfesbcfg Default Routing Information Filename -** -** \par Description: -** The value of this constant defines the filename used to store the software -** bus routing information. This filename is used only when no filename is -** specified in the command. -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_SB_DEFAULT_ROUTING_FILENAME "/ram/cfe_sb_route.dat" - - -/** -** \cfesbcfg Default Pipe Information Filename -** -** \par Description: -** The value of this constant defines the filename used to store the software -** bus pipe information. This filename is used only when no filename is -** specified in the command. -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_SB_DEFAULT_PIPE_FILENAME "/ram/cfe_sb_pipe.dat" - - -/** -** \cfesbcfg Default Message Map Filename -** -** \par Description: -** The value of this constant defines the filename used to store the software -** bus message map information. This filename is used only when no filename is -** specified in the command. The message map is a lookup table (array of 16bit -** words) that has an element for each possible MsgId value and holds the -** routing table index for that MsgId. The Msg Map provides fast access to the -** destinations of a message. -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_SB_DEFAULT_MAP_FILENAME "/ram/cfe_sb_msgmap.dat" - - -/** -** \cfesbcfg SB Event Filtering -** -** \par Description: -** This group of configuration paramters dictates what SB events will be -** filtered through EVS. The filtering will begin after the SB task initializes -** and stay in effect until a cmd to EVS changes it. -** This allows the operator to set limits on the number of event messages that -** are sent during system initialization. -** NOTE: Set all unused event values and mask values to zero -** -** \par Limits -** This filtering applies only to SB events. -** These parameters have a lower limit of 0 and an upper limit of 65535. -*/ -#define CFE_PLATFORM_SB_FILTERED_EVENT1 CFE_SB_SEND_NO_SUBS_EID -#define CFE_PLATFORM_SB_FILTER_MASK1 CFE_EVS_FIRST_4_STOP - -#define CFE_PLATFORM_SB_FILTERED_EVENT2 CFE_SB_DUP_SUBSCRIP_EID -#define CFE_PLATFORM_SB_FILTER_MASK2 CFE_EVS_FIRST_4_STOP - -#define CFE_PLATFORM_SB_FILTERED_EVENT3 CFE_SB_MSGID_LIM_ERR_EID -#define CFE_PLATFORM_SB_FILTER_MASK3 CFE_EVS_FIRST_16_STOP - -#define CFE_PLATFORM_SB_FILTERED_EVENT4 CFE_SB_Q_FULL_ERR_EID -#define CFE_PLATFORM_SB_FILTER_MASK4 CFE_EVS_FIRST_16_STOP - -#define CFE_PLATFORM_SB_FILTERED_EVENT5 0 -#define CFE_PLATFORM_SB_FILTER_MASK5 CFE_EVS_NO_FILTER - -#define CFE_PLATFORM_SB_FILTERED_EVENT6 0 -#define CFE_PLATFORM_SB_FILTER_MASK6 CFE_EVS_NO_FILTER - -#define CFE_PLATFORM_SB_FILTERED_EVENT7 0 -#define CFE_PLATFORM_SB_FILTER_MASK7 CFE_EVS_NO_FILTER - -#define CFE_PLATFORM_SB_FILTERED_EVENT8 0 -#define CFE_PLATFORM_SB_FILTER_MASK8 CFE_EVS_NO_FILTER - - -/** -** \cfeescfg Define SB Memory Pool Block Sizes -** -** \par Description: -** Software Bus Memory Pool Block Sizes -** -** \par Limits -** These sizes MUST be increasing and MUST be an integral multiple of 4. -** The number of block sizes defined cannot exceed -** #CFE_ES_MAX_MEMPOOL_BLOCK_SIZES -*/ -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01 8 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 16 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 20 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 36 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 64 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 96 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 128 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 160 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 256 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 512 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 1024 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 2048 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 4096 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 8192 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 16384 -#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 32768 -#define CFE_PLATFORM_SB_MAX_BLOCK_SIZE (CFE_MISSION_SB_MAX_SB_MSG_SIZE + 40) - -/** -** \cfesbcfg Define Default Sender Information Storage Mode -** -** \par Description: -** Defines the default mode for the storing of sender information when sending -** a software bus message. If set to 1, the sender information will be stored. -** If set to 0, the sender information will not be stored. -** -** \par Limits -** There is a lower limit of 0 and an upper limit of 1 on this configuration -** paramater. -*/ -#define CFE_PLATFORM_SB_DEFAULT_REPORT_SENDER 1 - - -/** -** \cfetimecfg Time Server or Time Client Selection -** -** \par Description: -** This configuration parameter selects whether the Time task functions as a -** time "server" or "client". A time server generates the "time at the tone" -** packet which is received by time clients. -** -** \par Limits -** Enable one, and only one by defining either CFE_PLATFORM_TIME_CFG_SERVER or -** CFE_PLATFORM_TIME_CFG_CLIENT AS TRUE. The other must be defined as FALSE. -*/ -#define CFE_PLATFORM_TIME_CFG_SERVER TRUE -#define CFE_PLATFORM_TIME_CFG_CLIENT FALSE - - -/** -** \cfetimecfg Time Tone In Big-Endian Order -** -** \par Description: -** If this configuration parameter is defined, the CFE time server will -** publish time tones with payloads in big-endian order, and time clients -** will expect the tones to be in big-endian order. This is useful for -** mixed-endian environments. This will become obsolete once EDS is -** available and the CFE time tone message is defined. -*/ -#undef CFE_PLATFORM_TIME_CFG_BIGENDIAN - - -/** -** \cfetimecfg Local MET or Virtual MET Selection for Time Servers -** -** \par Description: -** Depending on the specific hardware system configuration, it may be possible -** for Time Servers to read the "local" MET from a h/w register rather than -** having to track the MET as the count of tone signal interrupts (virtual MET) -** -** Time Clients must be defined as using a virtual MET. Also, a Time Server -** cannot be defined as having both a h/w MET and an external time source (they -** both cannot synchronize to the same tone). -** -** Note: "disable" this define (set to FALSE) only for Time Servers with local hardware -** that supports a h/w MET that is synchronized to the tone signal !!! -** -** \par Limits -** Only applies if #CFE_PLATFORM_TIME_CFG_SERVER is set to TRUE. -*/ -#define CFE_PLATFORM_TIME_CFG_VIRTUAL TRUE - - -/** -** \cfetimecfg Include or Exclude the Primary/Redundant Tone Selection Cmd -** -** \par Description: -** Depending on the specific hardware system configuration, it may be possible -** to switch between a primary and redundant tone signal. If supported by -** hardware, this definitions will enable command interfaces to select the -** active tone signal. Both Time Clients and Time Servers support this feature. -** Note: Set the CFE_PLATFORM_TIME_CFG_SIGNAL define to TRUE to enable tone signal commands. -** -** \par Limits -** Not Applicable -*/ -#define CFE_PLATFORM_TIME_CFG_SIGNAL FALSE - - -/** -** \cfetimecfg Include or Exclude the Internal/External Time Source Selection Cmd -** -** \par Description: -** By default, Time Servers maintain time using an internal MET which may be a -** h/w register or software counter, depending on available hardware. The -** following definition enables command interfaces to switch between an -** internal MET, or external time data received from one of several supported -** external time sources. Only a Time Server may be configured to use external -** time data. -** Note: Set the CFE_PLATFORM_TIME_CFG_SOURCE define to TRUE to include the Time Source -** Selection Command (command allows selection between the internal -** or external time source). Then choose the external source with the -** CFE_TIME_CFG_SRC_??? define. -** -** \par Limits -** Only applies if #CFE_PLATFORM_TIME_CFG_SERVER is set to TRUE. -*/ -#define CFE_PLATFORM_TIME_CFG_SOURCE FALSE - - -/** -** \cfetimecfg Choose the External Time Source for Server only -** -** \par Description: -** If #CFE_PLATFORM_TIME_CFG_SOURCE is set to TRUE, then one of the following external time -** source types must also be set to TRUE. Do not set any of the external time -** source types to TRUE unless #CFE_PLATFORM_TIME_CFG_SOURCE is set to TRUE. -** -** \par Limits -** -# If #CFE_PLATFORM_TIME_CFG_SOURCE is set to TRUE then one and only one of the following -** three external time sources can and must be set TRUE: -** #CFE_PLATFORM_TIME_CFG_SRC_MET, #CFE_PLATFORM_TIME_CFG_SRC_GPS, #CFE_PLATFORM_TIME_CFG_SRC_TIME -** -# Only applies if #CFE_PLATFORM_TIME_CFG_SERVER is set to TRUE. -*/ -#define CFE_PLATFORM_TIME_CFG_SRC_MET FALSE -#define CFE_PLATFORM_TIME_CFG_SRC_GPS FALSE -#define CFE_PLATFORM_TIME_CFG_SRC_TIME FALSE - - -/** -** \cfetimecfg Define the Max Delta Limits for Time Servers using an Ext Time Source -** -** \par Description: -** If #CFE_PLATFORM_TIME_CFG_SOURCE is set to TRUE and one of the external time sources is -** also set to TRUE, then the delta time limits for range checking is used. -** -** When a new time value is received from an external source, the value is -** compared against the "expected" time value. If the delta exceeds the -** following defined amount, then the new time data will be ignored. This range -** checking is only performed after the clock state has been commanded to -** "valid". Until then, external time data is accepted unconditionally. -** -** \par Limits -** Applies only if both #CFE_PLATFORM_TIME_CFG_SERVER and #CFE_PLATFORM_TIME_CFG_SOURCE are set -** to TRUE. -*/ -#define CFE_PLATFORM_TIME_MAX_DELTA_SECS 0 -#define CFE_PLATFORM_TIME_MAX_DELTA_SUBS 500000 - - -/** -** \cfetimecfg Define the Local Clock Rollover Value in seconds and subseconds -** -** \par Description: -** Specifies the capability of the local clock. Indicates the time at which -** the local clock rolls over. -** -** \par Limits -** Not Applicable -*/ -#define CFE_PLATFORM_TIME_MAX_LOCAL_SECS 27 -#define CFE_PLATFORM_TIME_MAX_LOCAL_SUBS 0 - - -/** -** \cfetimecfg Define Timing Limits From One Tone To The Next -** -** \par Description: -** Defines limits to the timing of the 1Hz tone signal. A tone signal is valid -** only if it arrives within one second (plus or minus the tone limit) from -** the previous tone signal.Units are microseconds as measured with the local -** clock. -** -** \par Limits -** Not Applicable -*/ -#define CFE_PLATFORM_TIME_CFG_TONE_LIMIT 20000 - - - -/** -** \cfetimecfg Define Time to Start Flywheel Since Last Tone -** -** \par Description: -** Define time to enter flywheel mode (in seconds since last tone data update) -** Units are microseconds as measured with the local clock. -** -** \par Limits -** Not Applicable -*/ -#define CFE_PLATFORM_TIME_CFG_START_FLY 2 - - -/** -** \cfetimecfg Define Periodic Time to Update Local Clock Tone Latch -** -** \par Description: -** Define Periodic Time to Update Local Clock Tone Latch. Applies only when -** in flywheel mode. This define dicates the period at which the simulated -** 'last tone' time is updated. Units are seconds. -** -** \par Limits -** Not Applicable -*/ -#define CFE_PLATFORM_TIME_CFG_LATCH_FLY 8 - - -/** -** \cfeescfg Define Max Number of Applications -** -** \par Description: -** Defines the maximum number of applications that can be loaded into the -** system. This number does not include child tasks. -** -** \par Limits -** There is a lower limit of 6. The lower limit corresponds to the cFE internal -** applications. There are no restrictions on the upper limit however, the -** maximum number of applications is system dependent and should be verified. -** AppIDs that are checked against this configuration are defined by a 32 bit -** data word. -*/ -#define CFE_PLATFORM_ES_MAX_APPLICATIONS 32 - - -/** -** \cfeescfg Define Max Number of Shared libraries -** -** \par Description: -** Defines the maximum number of cFE Shared libraries that can be loaded into -** the system. -** -** \par Limits -** There is a lower limit of 1. There are no restrictions on the upper limit -** however, the maximum number of libraries is system dependent and should be -** verified. -*/ -#define CFE_PLATFORM_ES_MAX_LIBRARIES 10 - -/** -** \cfeescfg Define Max Number of ER (Exception and Reset) log entries -** -** \par Description: -** Defines the maximum number of ER (Exception and Reset) log entries -** -** \par Limits -** There is a lower limit of 1. There are no restrictions on the upper limit -** however, the maximum number of log entries is system dependent and should be -** verified. -*/ -#define CFE_PLATFORM_ES_ER_LOG_ENTRIES 20 - -/** \cfeescfg Maximum size of CPU Context in ES Error Log -** -** \par Description: -** This should be large enough to accommodate the CPU context -** information supplied by the PSP on the given platform. -** -** \par Limits: -** Must be greater than zero and a multiple of sizeof(uint32). -** Limited only by the available memory and the number of entries -** in the error log. Any context information beyond this size will -** be truncated. -*/ -#define CFE_PLATFORM_ES_ER_LOG_MAX_CONTEXT_SIZE 128 - - -/** -** \cfeescfg Define Size of the cFE System Log. -** -** \par Description: -** Defines the size in bytes of the cFE system log. The system log holds -** variable length strings that are terminated by a linefeed and null -** character. -** -** \par Limits -** There is a lower limit of 512. There are no restrictions on the upper limit -** however, the maximum system log size is system dependent and should be -** verified. -*/ -#define CFE_PLATFORM_ES_SYSTEM_LOG_SIZE 3072 - - -/** -** \cfeescfg Define Number of entries in the ES Object table -** -** \par Description: -** Defines the number of entries in the ES Object table. This table controls -** the core cFE startup. -** -** \par Limits -** There is a lower limit of 15. There are no restrictions on the upper limit -** however, the maximum object table size is system dependent and should be -** verified. -*/ -#define CFE_PLATFORM_ES_OBJECT_TABLE_SIZE 30 - - -/** -** \cfeescfg Define Max Number of Generic Counters -** -** \par Description: -** Defines the maximum number of Generic Counters that can be registered. -** -** \par Limits -** This parameter has a lower limit of 1 and an upper limit of 65535. -*/ -#define CFE_PLATFORM_ES_MAX_GEN_COUNTERS 8 - - -/** -** \cfeescfg Define ES Application Control Scan Rate -** -** \par Description: -** ES Application Control Scan Rate. This parameter controls the speed that ES -** scans the Application Table looking for App Delete/Restart/Reload requests. -** All Applications are deleted, restarted, or reloaded by the ES Application. -** ES will periodically scan for control requests to process. The scan rate is -** controlled by this parameter, which is given in milliseconds. A value of -** 1000 means that ES will scan the Application Table once per second. Be -** careful not to set the value of this too low, because ES will use more CPU -** cycles scanning the table. -** -** \par Limits -** There is a lower limit of 100 and an upper limit of 20000 on this -** configuration paramater. millisecond units. -*/ -#define CFE_PLATFORM_ES_APP_SCAN_RATE 1000 - - -/** -** \cfeescfg Define ES Application Kill Timeout -** -** \par Description: -** ES Application Kill Timeout. This parameter controls the number of -** "scan periods" that ES will wait for an application to Exit after getting -** the signal Delete, Reload or Restart. The sequence works as follows: -** -# ES will set the control request for an App to Delete/Restart/Reload and -** set this kill timer to the value in this parameter. -** -# If the App is reponding and Calls it's RunLoop function, it will drop out -** of it's main loop and call CFE_ES_ExitApp. Once it calls Exit App, then -** ES can delete, restart, or reload the app the next time it scans the app -** table. -** -# If the App is not responding, the ES App will decrement this Kill Timeout -** value each time it runs. If the timeout value reaches zero, ES will kill -** the app. -** -** The Kill timeout value depends on the #CFE_PLATFORM_ES_APP_SCAN_RATE. If the Scan Rate -** is 1000, or 1 second, and this #CFE_PLATFORM_ES_APP_KILL_TIMEOUT is set to 5, then it -** will take 5 seconds to kill a non-responding App. -** If the Scan Rate is 250, or 1/4 second, and the #CFE_PLATFORM_ES_APP_KILL_TIMEOUT is -** set to 2, then it will take 1/2 second to time out. -** -** \par Limits -** There is a lower limit of 1 and an upper limit of 100 on this configuration -** paramater. Units are number of #CFE_PLATFORM_ES_APP_SCAN_RATE cycles. -*/ -#define CFE_PLATFORM_ES_APP_KILL_TIMEOUT 5 - - -/** -** \cfeescfg ES Ram Disk Sector Size -** -** \par Description: -** Defines the ram disk sector size. The ram disk is 1 of 4 memory areas that -** are preserved on a processor reset. -** NOTE: Changing this value changes memory allocation, and may -** require changes to platform specific values (in CFE_PSP) such as -** USER_RESERVED_MEM in VxWorks depending on the memory areas -** being used for preserved data and on OS specific behavior. -** -** \par Limits -** There is a lower limit of 128. There are no restrictions on the upper limit -** however, the maximum RAM disk sector size is system dependent and should be -** verified. -*/ -#define CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE 512 - - -/** -** \cfeescfg ES Ram Disk Number of Sectors -** -** \par Description: -** Defines the ram disk number of sectors. The ram disk is one of four memory -** areas that are preserved on a processor reset. -** NOTE: Changing this value changes memory allocation, and may -** require changes to platform specific values (in CFE_PSP) such as -** USER_RESERVED_MEM in VxWorks depending on the memory areas -** being used for preserved data and on OS specific behavior. -** -** \par Limits -** There is a lower limit of 128. There are no restrictions on the upper limit -** however, the maximum number of RAM sectors is system dependent and should be -** verified. -*/ -#define CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS 4096 - -/** -** \cfeescfg Percentage of Ram Disk Reserved for Decompressing Apps -** -** \par Description: -** The #CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED parameter is used to make sure that the -** Volatile ( RAM ) Disk has a defined amount of free space during a processor -** reset. The cFE uses the Volatile disk to decompress cFE applications during -** system startup. If this Volatile disk happens to get filled with logs and -** misc files, then a processor reset may not work, because there will be no -** room to decompress cFE apps. To solve that problem, this parameter sets the -** "Low Water Mark" for disk space on a Processor reset. It should be set to -** allow the largest cFE Application to be decompressed. -** During a Processor reset, if there is not sufficient space left on the disk, -** it will be re-formatted in order to clear up some space. -** -** This feature can be turned OFF by setting the parameter to 0. -** -** \par Limits -** There is a lower limit of 0 and an upper limit of 75 on this configuration -** paramater.Units are percentage. A setting of zero will turn this feature -** off. -*/ -#define CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED 30 - - -/** -** \cfeescfg RAM Disk Mount string -** -** \par Description: -** The #CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING parameter is used to set the cFE mount path -** for the CFE RAM disk. This is a parameter for missions that do not want to -** use the default value of "/ram", or for missions that need to have a different -** value for different CPUs or Spacecraft. -** Note that the vxWorks OSAL cannot currently handle names that have more than one -** path separator in it. The names "/ram", "/ramdisk", "/disk123" will all work, but -** "/disks/ram" will not. -** Multiple separators can be used with the posix or RTEMS ports. -** -*/ -#define CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING "/ram" - - -/** -** \cfeescfg Define Critical Data Store Size -** -** \par Description: -** Defines the Critical Data Store (CDS) area size in bytes size. The CDS is -** one of four memory areas that are preserved during a processor reset. -** NOTE: Changing this value changes memory allocation, and may -** require changes to platform specific values (in CFE_PSP) such as -** USER_RESERVED_MEM in VxWorks depending on the memory areas -** being used for preserved data and on OS specific behavior. -** -** \par Limits -** There is a lower limit of 8192 and an upper limit of UINT_MAX (4 Gigabytes) -** on this configuration paramater. -*/ -#define CFE_PLATFORM_ES_CDS_SIZE ( 128 * 1024 ) - - -/** -** \cfeescfg Define User Reserved Memory Size -** -** \par Description: -** User Reserved Memory Size. This is the size in bytes of the cFE User -** reserved Memory area. This is a block of memory that is available for cFE -** application use. The address is obtained by calling -** #CFE_PSP_GetUserReservedArea. The User Reserved Memory is one of four memory -** areas that are preserved during a processor reset. -** NOTE: Changing this value changes memory allocation, and may -** require changes to platform specific values (in CFE_PSP) such as -** USER_RESERVED_MEM in VxWorks depending on the memory areas -** being used for preserved data and on OS specific behavior. -** -** \par Limits -** There is a lower limit of 1024 and an upper limit of UINT_MAX (4 Gigabytes) -** on this configuration paramater. -*/ -#define CFE_PLATFORM_ES_USER_RESERVED_SIZE ( 1024 * 1024 ) - - -/** -** \cfeescfg Define ES Reset Area Size -** -** \par Description: -** The ES Reset Area Size. This is the size in bytes of the cFE Reset variable -** and log area. This is a block of memory used by the cFE to store the system -** log ER Log and critical reset variables. This is 4 of 4 of the memory areas -** that are preserved during a processor reset. -** Note: This area must be sized large enough to hold all of the data -** structures. It should be automatically sized based on the #CFE_ES_ResetData_t -** type, but circular dependancies in the headers prevent it from being defined -** this way. -** NOTE: Changing this value changes memory allocation, and may -** require changes to platform specific values (in CFE_PSP) such as -** USER_RESERVED_MEM in VxWorks depending on the memory areas -** being used for preserved data and on OS specific behavior. -** -** \par Limits -** There is a lower limit of 153600 (150KBytes) and an upper limit of UINT_MAX -** (4 Gigabytes) on this configuration paramater. -*/ -#define CFE_PLATFORM_ES_RESET_AREA_SIZE ( 170 * 1024 ) - -/** -** \cfeescfg Define Memory Pool Alignment Size -** -** \par Description: -** Ensures that buffers obtained from a memory pool are aligned -** to a certain minimum block size. Note the allocator will always -** align to the minimum required by the CPU architecture. This may -** be set greater than the CPU requirement as desired for optimal -** performance. -** -** For some architectures/applications it may be beneficial to set this -** to the cache line size of the target CPU, or to use special SIMD -** instructions that require a more stringent memory alignment. -** -** \par Limits -** This must always be a power of 2, as it is used as a binary address mask. -*/ -#define CFE_PLATFORM_ES_MEMPOOL_ALIGN_SIZE_MIN 4 - - -/** -** \cfeescfg ES Nonvolatile Startup Filename -** -** \par Description: -** The value of this constant defines the path and name of the file that -** contains a list of modules that will be loaded and started by the cFE after -** the cFE finishes its startup sequence. -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_ES_NONVOL_STARTUP_FILE "/cf/apps/cfe_es_startup.scr" - - -/** -** \cfeescfg ES Volatile Startup Filename -** -** \par Description: -** The value of this constant defines the path and name of the file that -** contains a list of modules that will be loaded and started by the cFE after -** the cFE finishes its startup sequence. -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_ES_VOLATILE_STARTUP_FILE "/ram/apps/cfe_es_startup.scr" - -/** -** \cfeescfg Default Shell Filename -** -** \par Description: -** The value of this constant defines the filename used to store the shell -** output after a shell command is received by ES. This file contains the -** entire shell output. The fsw also sends the shell output in series of fixed -** size telemetry packets. This filename is used only when no filename -** is specified in the shell command. -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_ES_DEFAULT_SHELL_FILENAME "/ram/ShellCmd.out" - - -/** -** \cfeescfg Define Max Shell Command Size -** -** \par Description: -** Defines the maximum size in characters of the shell command. -** -** \par Limits -** There is a lower limit of 64 and an upper limit of #OS_MAX_CMD_LEN. Units are -** characters. -*/ -#define CFE_PLATFORM_ES_MAX_SHELL_CMD 64 - - -/** -** \cfeescfg Define Shell Command Telemetry Pkt Segment Size -** -** \par Description: -** Defines the size of the shell command tlm packet segments.The shell command -** output size is dependant on the shell command itself. If the shell output -** size is greater than the size of the packet defined here, the fsw will -** generate a series of tlm packets (of the size defined here) that can be -** reconstructed by the ground system. -** -** \par Limits -** There is a lower limit of 32 and an upper limit of #CFE_SB_MAX_SB_MSG_SIZE. -*/ -#define CFE_PLATFORM_ES_MAX_SHELL_PKT 64 - -/** -** \cfeescfg Define OS Task Delay Value for ES Shell Command -** -** \par Description: -** This parameter defines the length of time (in milliseconds) ES will -** delay when sending shell command packets over the software bus to not -** flood the pipe on large messages. -** -** Note: The milliseconds passed into OS_TaskDelay are converted into the -** units the underlying OS uses to measure time passing. Many platforms -** limit the precision of this value however, a delay may not be -** needed at all in which the value may be set to zero. -** -** \par Limits -** Not Applicable -*/ -#define CFE_PLATFORM_ES_SHELL_OS_DELAY_MILLISEC 200 - -/** -** \cfeescfg Default Application Information Filename -** -** \par Description: -** The value of this constant defines the filename used to store information -** pertaining to all of the Applications that are registered with Executive -** Services. This filename is used only when no filename is specified in the -** the command to query all system apps. -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_ES_DEFAULT_APP_LOG_FILE "/ram/cfe_es_app_info.log" - -/** -** \cfeescfg Default Application Information Filename -** -** \par Description: -** The value of this constant defines the filename used to store information -** pertaining to all of the Applications that are registered with Executive -** Services. This filename is used only when no filename is specified in the -** the command to query all system tasks. -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_ES_DEFAULT_TASK_LOG_FILE "/ram/cfe_es_task_info.log" - -/** -** \cfeescfg Default System Log Filename -** -** \par Description: -** The value of this constant defines the filename used to store important -** information (as ASCII text strings) that might not be able to be sent in an -** Event Message. This filename is used only when no filename is specified in -** the command to dump the system log. No file specified in the cmd means the -** first character in the cmd filename is a NULL terminator (zero). -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_ES_DEFAULT_SYSLOG_FILE "/ram/cfe_es_syslog.log" - -/** -** \cfeescfg Default Exception and Reset (ER) Log Filename -** -** \par Description: -** The value of this constant defines the filename used to store the -** Exception and Reset (ER) Log. This filename is used only when no filename is -** specified in the command to dump the ER log. No file specified in the cmd -** means the first character in the cmd filename is a NULL terminator (zero). -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_ES_DEFAULT_ER_LOG_FILE "/ram/cfe_erlog.log" - -/** -** \cfeescfg Default Performance Data Filename -** -** \par Description: -** The value of this constant defines the filename used to store the -** Performance Data. This filename is used only when no filename is specified -** in the command to stop performance data collecting. -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME "/ram/cfe_es_perf.dat" - - -/** -** \cfeescfg Default Critical Data Store Registry Filename -** -** \par Description: -** The value of this constant defines the filename used to store the -** Critical Data Store Registry. This filename is used only when no filename is -** specified in the command to stop performance data collecting. -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_ES_DEFAULT_CDS_REG_DUMP_FILE "/ram/cfe_cds_reg.log" - -/** -** \cfeescfg Define Default System Log Mode -** -** \par Description: -** Defines the default mode for the operation of the ES System log. The log may -** operate in either Overwrite mode = 0, where once the log becomes full the -** oldest message in the log will be overwritten, or Discard mode = 1, where -** once the log becomes full the contents of the log are preserved and the new -** event is discarded. This constant may hold a value of either 0 or 1 -** depending on the desired default log mode. Overwrite Mode = 0, Discard -** Mode = 1. -** -** \par Limits -** There is a lower limit of 0 and an upper limit of 1 on this configuration -** paramater. -*/ -#define CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE 1 - -/** -** \cfeescfg Define Max Number of Performance IDs -** -** \par Description: -** Defines the maximum number of perf ids allowed. -** -** -** \par Limits -** This number must always be divisible by 32. There is a lower limit of 32 and -** an upper limit of 512 on this configuration paramater. -*/ -#define CFE_PLATFORM_ES_PERF_MAX_IDS 128 - -/** -** \cfeescfg Define Max Size of Performance Data Buffer -** -** \par Description: -** Defines the maximum size of the performance data buffer. Units are number of -** performance data entries. An entry is defined by a 32 bit data word followed -** by a 64 bit time stamp. -** -** \par Limits -** There is a lower limit of 1025. There are no restrictions on the upper limit -** however, the maximum buffer size size is system dependent and should be verified. -** The units are number of entries. An entry is defined by a 32 bit data word followed -** by a 64 bit time stamp. -*/ -#define CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE 10000 - - -/** -** \cfeescfg Define Filter Mask Setting for Disabling All Performance Entries -** -** \par Description: -** Defines the filter mask for disabling all performance entries. The value is a -** bit mask. For each bit, 0 means the corresponding entry is disabled and -** 1 means it is enabled. -*/ -#define CFE_PLATFORM_ES_PERF_FILTMASK_NONE 0 - -/** -** \cfeescfg Define Filter Mask Setting for Enabling All Performance Entries -** -** \par Description: -** Defines the filter mask for enabling all performance entries. The value is a -** bit mask. For each bit, 0 means the corresponding entry is disabled and -** 1 means it is enabled. -*/ -#define CFE_PLATFORM_ES_PERF_FILTMASK_ALL ~CFE_PLATFORM_ES_PERF_FILTMASK_NONE - -/** -** \cfeescfg Define Default Filter Mask Setting for Performance Data Buffer -** -** \par Description: -** Defines the default filter mask for the performance data buffer. The value is a -** bit mask. For each bit, 0 means the corresponding entry is disabled and 1 -** means it is enabled. -** -*/ -#define CFE_PLATFORM_ES_PERF_FILTMASK_INIT CFE_PLATFORM_ES_PERF_FILTMASK_ALL - - -/** -** \cfeescfg Define Default Filter Trigger Setting for Disabling All Performance Entries -** -** \par Description: -** Defines the default trigger mask for disabling all performance data entries. The value -** is a bit mask. For each bit, 0 means the trigger for the corresponding entry is -** disabled and 1 means it is enabled. -** -*/ -#define CFE_PLATFORM_ES_PERF_TRIGMASK_NONE 0 - -/** -** \cfeescfg Define Filter Trigger Setting for Enabling All Performance Entries -** -** \par Description: -** Defines the trigger mask for enabling all performance data entries. The value is -** a bit mask. For each bit, 0 means the trigger for the corresponding entry is -** disabled and 1 means it is enabled. -** -*/ -#define CFE_PLATFORM_ES_PERF_TRIGMASK_ALL ~CFE_PLATFORM_ES_PERF_TRIGMASK_NONE - -/** -** \cfeescfg Define Default Filter Trigger Setting for Performance Data Buffer -** -** \par Description: -** Defines the default trigger mask for the performance data buffer. The value is a -** 32-bit mask. For each bit, 0 means the trigger for the corresponding entry is -** disabled and 1 means it is enabled. -** -*/ -#define CFE_PLATFORM_ES_PERF_TRIGMASK_INIT CFE_PLATFORM_ES_PERF_TRIGMASK_NONE - -/** -** \cfeescfg Define Performance Analyzer Child Task Priority -** -** \par Description: -** This parameter defines the priority of the child task spawed by the -** Executive Services to write performance data to a file. Lower numbers -** are higher priority, with 1 being the highest priority in the case of a -** child task. -** -** \par Limits -** Valid range for a child task is 1 to 255 however, the priority cannot -** be higher (lower number) than the ES parent application priority. -*/ -#define CFE_PLATFORM_ES_PERF_CHILD_PRIORITY 200 - -/** -** \cfeescfg Define Performance Analyzer Child Task Stack Size -** -** \par Description: -** This parameter defines the stack size of the child task spawed by the -** Executive Services to write performance data to a file. -** -** \par Limits -** It is recommended this parameter be greater than or equal to 4KB. This parameter -** is limited by the maximum value allowed by the data type. In this case, the data -** type is an unsigned 32-bit integer, so the valid range is 0 to 0xFFFFFFFF. -*/ -#define CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE 4096 - -/** -** \cfeescfg Define Performance Analyzer Child Task Delay -** -** \par Description: -** This parameter defines the delay time (in milliseconds) between performance -** data file writes performed by the Executive Services Performace Analyzer -** Child Task. -** -** \par Limits -** It is recommended this parameter be greater than or equal to 20ms. This parameter -** is limited by the maximum value allowed by the data type. In this case, the data -** type is an unsigned 32-bit integer, so the valid range is 0 to 0xFFFFFFFF. -*/ -#define CFE_PLATFORM_ES_PERF_CHILD_MS_DELAY 20 - -/** -** \cfeescfg Define Performance Analyzer Child Task Number of Entries Between Delay -** -** \par Description: -** This parameter defines the number of performace analyzer entries the Performace -** Analyzer Child Task will write to the file between delays. -** -*/ -#define CFE_PLATFORM_ES_PERF_ENTRIES_BTWN_DLYS 50 - -/** -** \cfeescfg Define Default Stack Size for an Application -** -** \par Description: -** This parameter defines a default stack size. This parameter is used by the -** cFE Core Applications. -** -** \par Limits -** There is a lower limit of 2048. There are no restrictions on the upper limit -** however, the maximum stack size size is system dependent and should be verified. -** Most operating systems provide tools for measuring the amount of stack used by a -** task during operation. It is always a good idea to verify that no more than 1/2 -** of the stack is used. -*/ -#define CFE_PLATFORM_ES_DEFAULT_STACK_SIZE 8192 - -/** -** \cfeescfg Define cFE Core Exception Function -** -** \par Description: -** This parameter defines the function-to-call when a CPU or floating point exception -** occurs. The parameter is defaulted to call the ES API function #CFE_ES_ProcessCoreException -** which handles the logging and reset from a system or cFE core exception. -** -** Note: Exception interrupts are trapped at the Platform Support Package (PSP) -** layer. In order to initiate the cFE platform defined response to an exception, this -** platform defined callback function must be prototyped and called from the PSP -** exception hook API function #CFE_PSP_ExceptionHook. For example: -** -** -- cfe_psp.h -- -** -** .... Prototype for exception ISR function implemented in CFE .... -** -** typedef void (*System_ExceptionFunc_t)(uint32 HostTaskId, -** const char *ReasonString, -** const uint32 *ContextPointer, -** uint32 ContextSize); -** -** -- cfe_pspexception.c -- -** -** .... Setup function pointer to CFE exception ISR callback .... -** -** static const System_ExceptionFunc_t CFE_ExceptionCallback = CFE_PLATFORM_ES_EXCEPTION_FUNCTION; -** -** void CFE_PSP_ExceptionHook (int task_id, int vector, uint8 *pEsf ) -** { -** .... platform-specific logic .... -** -** .... Use function pointer to call cFE routine to finish processing the exception .... -** -** CFE_ExceptionCallback((uint32)task_id, -** CFE_PSP_ExceptionReasonString, -** (uint32 *)&CFE_PSP_ExceptionContext, -** sizeof(CFE_PSP_ExceptionContext_t)); -** -** } -** -** \par Limits -** Must be a valid function name. -*/ -#define CFE_PLATFORM_ES_EXCEPTION_FUNCTION CFE_ES_ProcessCoreException - -/** -** \cfeescfg Define EVS Task Priority -** -** \par Description: -** Defines the cFE_EVS Task priority. -** -** \par Limits -** Not Applicable -*/ -#define CFE_PLATFORM_EVS_START_TASK_PRIORITY 61 - -/** -** \cfeescfg Define EVS Task Stack Size -** -** \par Description: -** Defines the cFE_EVS Task Stack Size -** -** \par Limits -** There is a lower limit of 2048 on this configuration paramater. There -** are no restrictions on the upper limit however, the maximum stack size size -** is system dependent and should be verified. Most operating systems provide -** tools for measuring the amount of stack used by a task during operation. It -** is always a good idea to verify that no more than 1/2 of the stack is used. -*/ -#define CFE_PLATFORM_EVS_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE - -/** -** \cfeescfg Define SB Task Priority -** -** \par Description: -** Defines the cFE_SB Task priority. -** -** \par Limits -** Not Applicable -*/ -#define CFE_PLATFORM_SB_START_TASK_PRIORITY 64 - -/** -** \cfeescfg Define SB Task Stack Size -** -** \par Description: -** Defines the cFE_SB Task Stack Size -** -** \par Limits -** There is a lower limit of 2048 on this configuration paramater. There -** are no restrictions on the upper limit however, the maximum stack size size -** is system dependent and should be verified. Most operating systems provide -** tools for measuring the amount of stack used by a task during operation. It -** is always a good idea to verify that no more than 1/2 of the stack is used. -*/ -#define CFE_PLATFORM_SB_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE - -/** -** \cfeescfg Define ES Task Priority -** -** \par Description: -** Defines the cFE_ES Task priority. -** -** \par Limits -** Not Applicable -*/ -#define CFE_PLATFORM_ES_START_TASK_PRIORITY 68 - -/** -** \cfeescfg Define ES Task Stack Size -** -** \par Description: -** Defines the cFE_ES Task Stack Size -** -** \par Limits -** There is a lower limit of 2048 on this configuration paramater. There -** are no restrictions on the upper limit however, the maximum stack size size -** is system dependent and should be verified. Most operating systems provide -** tools for measuring the amount of stack used by a task during operation. It -** is always a good idea to verify that no more than 1/2 of the stack is used. -*/ -#define CFE_PLATFORM_ES_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE - -/** -** \cfetimecfg Define TIME Task Priorities -** -** \par Description: -** Defines the cFE_TIME Task priority. -** Defines the cFE_TIME Tone Task priority. -** Defines the cFE_TIME 1HZ Task priority. -** -** \par Limits -** There is a lower limit of zero and an upper limit of 255 on these -** configuration paramaters. Remember that the meaning of each task -** priority is inverted -- a "lower" number has a "higher" priority. -*/ -#define CFE_PLATFORM_TIME_START_TASK_PRIORITY 60 -#define CFE_PLATFORM_TIME_TONE_TASK_PRIORITY 25 -#define CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY 25 - -/** -** \cfetimecfg Define TIME Task Stack Sizes -** -** \par Description: -** Defines the cFE_TIME Main Task Stack Size -** Defines the cFE_TIME Tone Task Stack Size -** Defines the cFE_TIME 1HZ Task Stack Size -** -** \par Limits -** There is a lower limit of 2048 on these configuration paramaters. There -** are no restrictions on the upper limit however, the maximum stack size size -** is system dependent and should be verified. Most operating systems provide -** tools for measuring the amount of stack used by a task during operation. It -** is always a good idea to verify that no more than 1/2 of the stack is used. -*/ -#define CFE_PLATFORM_TIME_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE -#define CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE 4096 -#define CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE 8192 - -/** -** \cfeescfg Define TBL Task Priority -** -** \par Description: -** Defines the cFE_TBL Task priority. -** -** \par Limits -** Not Applicable -*/ -#define CFE_PLATFORM_TBL_START_TASK_PRIORITY 70 - -/** -** \cfeescfg Define TBL Task Stack Size -** -** \par Description: -** Defines the cFE_TBL Task Stack Size -** -** \par Limits -** There is a lower limit of 2048 on this configuration paramater. There -** are no restrictions on the upper limit however, the maximum stack size size -** is system dependent and should be verified. Most operating systems provide -** tools for measuring the amount of stack used by a task during operation. It -** is always a good idea to verify that no more than 1/2 of the stack is used. -*/ -#define CFE_PLATFORM_TBL_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE - -/** -** \cfeescfg Define Maximum Number of Registered CDS Blocks -** -** \par Description: -** Maximum number of registered CDS Blocks -** -** \par Limits -** There is a lower limit of 8. There are no restrictions on the upper limit -** however, the maximum number of CDS entries is system dependent and -** should be verified. -*/ -#define CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES 512 - - -/** -** \cfeescfg Define Number of Processor Resets Before a Power On Reset -** -** \par Description: -** Number of Processor Resets before a Power On Reset is called. If set to 2, -** then 2 processor resets will occur, and the 3rd processor reset will be a -** power on reset instead. -** -** \par Limits -** There is a lower limit of 0. There are no restrictions on the upper limit -** however, the maximum number of processor resets may be system dependent and -** should be verified. -*/ -#define CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS 2 - - -/** -** \cfeescfg Define Default ES Memory Pool Block Sizes -** -** \par Description: -** Default Intermediate ES Memory Pool Block Sizes. If an application -** is using the CFE_ES Memory Pool APIs (#CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, -** #CFE_ES_GetPoolBuf and #CFE_ES_PutPoolBuf) but finds these sizes -** inappropriate for their use, they may wish to use the #CFE_ES_PoolCreateEx -** API to specify their own intermediate block sizes -** -** \par Limits -** These sizes MUST be increasing and MUST be an integral multiple of 4. Also, -** CFE_PLATFORM_ES_MAX_BLOCK_SIZE must be larger than CFE_MISSION_SB_MAX_SB_MSG_SIZE and both -** CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE and CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE. Note that if Table -** Services have been removed from the CFE, the table size limits are still -** enforced although the table size definitions may be reduced. Refer to the CFS -** Deployment Guide for information about removing CFE Table Services from the CFE. -*/ -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01 8 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 16 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 32 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 48 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 64 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 96 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 128 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 160 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 256 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 512 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 1024 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 2048 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 4096 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 8192 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 16384 -#define CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 32768 -#define CFE_PLATFORM_ES_MAX_BLOCK_SIZE 80000 - - -/** -** \cfeescfg Define ES Critical Data Store Memory Pool Block Sizes -** -** \par Description: -** Intermediate ES Critical Data Store Memory Pool Block Sizes -** -** \par Limits -** These sizes MUST be increasing and MUST be an integral multiple of 4. -*/ -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_01 8 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 16 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 32 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 48 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 64 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 96 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 128 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 160 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 256 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 512 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 1024 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 2048 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 4096 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 8192 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 16384 -#define CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 32768 -#define CFE_PLATFORM_ES_CDS_MAX_BLOCK_SIZE 80000 - - - -/** -** \cfeevscfg Define Maximum Number of Event Filters per Application -** -** \par Description: -** Maximum number of events that may be filtered per application. -** -** \par Limits -** There are no restrictions on the lower and upper limits however, -** the maximum number of event filters is system dependent and should be -** verified. -*/ -#define CFE_PLATFORM_EVS_MAX_EVENT_FILTERS 8 - - -/** -** \cfeevscfg Enable or Disable EVS Local Event Log -** -** \par Description: -** The CFE_PLATFORM_EVS_LOG_ON configuration parameter must be defined to enable EVS -** event logging. In order to disable the local event log this definition needs -** to be commented out. -** -** \par Limits -** Not Applicable -*/ -#define CFE_PLATFORM_EVS_LOG_ON - - -/** -** \cfeevscfg Default Event Log Filename -** -** \par Description: -** The value of this constant defines the filename used to store the Event -** Services local event log. This filename is used only when no filename is -** specified in the command to dump the event log. -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_EVS_DEFAULT_LOG_FILE "/ram/cfe_evs.log" - - -/** -** \cfeevscfg Maximum Number of Events in EVS Local Event Log -** -** \par Description: -** Dictates the EVS local event log capacity. Units are the number of events. -** -** \par Limits -** There are no restrictions on the lower and upper limits however, -** the maximum log size is system dependent and should be verified. -*/ -#define CFE_PLATFORM_EVS_LOG_MAX 20 - - -/** -** \cfeevscfg Default EVS Application Data Filename -** -** \par Description: -** The value of this constant defines the filename used to store the EVS -** Application Data(event counts/filtering information). This filename is -** used only when no filename is specified in the command to dump the event -** log. -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_EVS_DEFAULT_APP_DATA_FILE "/ram/cfe_evs_app.dat" - - -/** -** \cfeevscfg Default EVS Output Port State -** -** \par Description: -** Defines the default port state (enabled or deisabled) for the four output -** ports defined within the Event Service. Port 1 is usually the uart output -** terminal. To enable a port, set the proper bit to a 1. Bit 0 is port 1, -** bit 1 is port2 etc. -** -** \par Limits -** The valid settings are 0x0 to 0xF. -*/ -#define CFE_PLATFORM_EVS_PORT_DEFAULT 0x0001 - - -/** -** \cfeevscfg Default EVS Event Type Filter Mask -** -** \par Description: -** Defines a state of on or off for all four event types. The term event -** 'type' refers to the criticality level and may be Debug, Informational, -** Error or Critical. Each event type has a bit position. (bit 0 = Debug, -** bit 1 = Info, bit 2 = Error, bit 3 = Critical). This is a global setting, -** meaning it applies to all applications. To filter an event type, set its -** bit to zero. For example, -** 0xE means Debug = OFF, Info = ON, Error = ON, Critical = ON -** -** \par Limits -** The valid settings are 0x0 to 0xF. -*/ -#define CFE_PLATFORM_EVS_DEFAULT_TYPE_FLAG 0xE - - - -/** -** \cfeevscfg Default EVS Local Event Log Mode -** -** \par Description: -** Defines a state of overwrite(0) or discard(1) for the operation of the -** EVS local event log. The log may operate in either Overwrite mode = 0, -** where once the log becomes full the oldest event in the log will be -** overwritten, or Discard mode = 1, where once the log becomes full the -** contents of the log are preserved and the new event is discarded. -** Overwrite Mode = 0, Discard Mode = 1. -** -** \par Limits -** The valid settings are 0 or 1 -*/ -#define CFE_PLATFORM_EVS_DEFAULT_LOG_MODE 1 - - -/** -** \cfeevscfg Default EVS Message Format Mode -** -** \par Description: -** Defines the default message format (long or short) for event messages being -** sent to the ground. Choose between #CFE_EVS_MsgFormat_LONG or -** #CFE_EVS_MsgFormat_SHORT. -** -** \par Limits -** The valid settings are #CFE_EVS_MsgFormat_LONG or #CFE_EVS_MsgFormat_SHORT -*/ -#define CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE CFE_EVS_MsgFormat_LONG - - - -/* Platform Configuration Parameters for Table Service (TBL) */ - -/** -** \cfetblcfg Size of Table Services Table Memory Pool -** -** \par Description: -** Defines the TOTAL size of the memory pool that cFE Table Services allocates -** from the system. The size must be large enough to provide memory for each -** registered table, the inactive buffers for double buffered tables and for -** the shared inactive buffers for single buffered tables. -** -** \par Limits -** The cFE does not place a limit on the size of this parameter. -*/ -#define CFE_PLATFORM_TBL_BUF_MEMORY_BYTES 524288 - -/** -** \cfetblcfg Maximum Size Allowed for a Double Buffered Table -** -** \par Description: -** Defines the maximum allowed size (in bytes) of a double buffered table. -** -** \par Limits -** The cFE does not place a limit on the size of this parameter but it must be -** less than half of #CFE_PLATFORM_TBL_BUF_MEMORY_BYTES. -*/ -#define CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE 16384 - -/** -** \cfetblcfg Maximum Size Allowed for a Single Buffered Table -** -** \par Description: -** Defines the maximum allowed size (in bytes) of a single buffered table. -** \b NOTE: This size determines the size of all shared table buffers. -** Therefore, this size will be multiplied by #CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS -** below when allocating memory for shared tables. -** -** \par Limits -** The cFE does not place a limit on the size of this parameter but it must be -** small enough to allow for #CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS number of tables -** to fit into #CFE_PLATFORM_TBL_BUF_MEMORY_BYTES. -*/ -#define CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE 16384 - -/** -** \cfetblcfg Maximum Number of Tables Allowed to be Registered -** -** \par Description: -** Defines the maximum number of tables supported by this processor's Table Services. -** -** \par Limits -** This number must be less than 32767. It should be recognized that this parameter -** determines the size of the Table Registry. An excessively high number will waste -** memory. -*/ -#define CFE_PLATFORM_TBL_MAX_NUM_TABLES 128 - -/** -** \cfetblcfg Maximum Number of Critical Tables that can be Registered -** -** \par Description: -** Defines the maximum number of critical tables supported by this processor's Table Services. -** -** \par Limits -** This number must be less than 32767. It should be recognized that this parameter -** determines the size of the Critical Table Registry which is maintained in the Critical -** Data Store. An excessively high number will waste Critical Data Store memory. Therefore, -** this number must not exceed the value defined in CFE_ES_CDS_MAX_CRITICAL_TABLES. -*/ -#define CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES 32 - -/** -** \cfetblcfg Maximum Number of Table Handles -** -** \par Description: -** Defines the maximum number of Table Handles. -** -** \par Limits -** This number must be less than 32767. This number must be at least as big as -** the number of tables (#CFE_PLATFORM_TBL_MAX_NUM_TABLES) and should be set higher if tables -** are shared between applications. -*/ -#define CFE_PLATFORM_TBL_MAX_NUM_HANDLES 256 - -/** -** \cfetblcfg Maximum Number of Simultaneous Loads to Support -** -** \par Description: -** Defines the maximum number of single buffered tables that can be -** loaded simultaneously. This number is used to determine the number -** of shared buffers to allocate. -** -** \par Limits -** This number must be less than 32767. An excessively high number will -** degrade system performance and waste memory. A number less than 5 is -** suggested but not required. -*/ -#define CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS 4 - -/** -** \cfetblcfg Maximum Number of Simultaneous Table Validations -** -** \par Description: -** Defines the maximum number of pending validations that -** the Table Services can handle at any one time. When a -** table has a validation function, a validation request is -** made of the application to perform that validation. This -** number determines how many of those requests can be -** outstanding at any one time. -** -** \par Limits -** This number must be less than 32767. An excessively high number will -** degrade system performance and waste memory. A number less than 20 is -** suggested but not required. -*/ -#define CFE_PLATFORM_TBL_MAX_NUM_VALIDATIONS 10 - -/** -** \cfetblcfg Default Filename for a Table Registry Dump -** -** \par Description: -** Defines the file name used to store the table registry when -** no filename is specified in the dump registry command. -** -** \par Limits -** The length of each string, including the NULL terminator cannot exceed the -** #OS_MAX_PATH_LEN value. -*/ -#define CFE_PLATFORM_TBL_DEFAULT_REG_DUMP_FILE "/ram/cfe_tbl_reg.log" - -/** -** \cfetblcfg Number of Spacecraft ID's specified for validation -** -** \par Description: -** Defines the number of specified spacecraft ID values that -** are verified during table loads. If the number is zero -** then no validation of the spacecraft ID field in the table -** file header is performed when tables are loaded. Non-zero -** values indicate how many values from the list of spacecraft -** ID's defined below are compared to the spacecraft ID field -** in the table file header. The ELF2CFETBL tool may be used -** to create table files with specified spacecraft ID values. -** -** \par Limits -** This number must be greater than or equal to zero and -** less than or equal to 2. -*/ -#define CFE_PLATFORM_TBL_VALID_SCID_COUNT 0 - -/* macro to construct 32 bit value from 4 chars */ -#define CFE_PLATFORM_TBL_U32FROM4CHARS( _C1, _C2, _C3, _C4 ) \ - ( (uint32)(_C1) << 24 | \ - (uint32)(_C2) << 16 | \ - (uint32)(_C3) << 8 | \ - (uint32)(_C4) ) - -/** -** \cfetblcfg Spacecraft ID values used for table load validation -** -** \par Description: -** Defines the spacecraft ID values used for validating the -** spacecraft ID field in the table file header. To be valid, -** the spacecraft ID specified in the table file header must -** match one of the values defined here. -** -** \par Limits -** This value can be any 32 bit unsigned integer. -*/ -#define CFE_PLATFORM_TBL_VALID_SCID_1 (CFE_MISSION_SPACECRAFT_ID) -#define CFE_PLATFORM_TBL_VALID_SCID_2 (CFE_PLATFORM_TBL_U32FROM4CHARS('a', 'b', 'c', 'd')) - -/** -** \cfetblcfg Number of Processor ID's specified for validation -** -** \par Description: -** Defines the number of specified processor ID values that -** are verified during table loads. If the number is zero -** then no validation of the processor ID field in the table -** file header is performed when tables are loaded. Non-zero -** values indicate how many values from the list of processor -** ID's defined below are compared to the processor ID field -** in the table file header. The ELF2CFETBL tool may be used -** to create table files with specified processor ID values. -** -** \par Limits -** This number must be greater than or equal to zero and -** less than or equal to 4. -*/ -#define CFE_PLATFORM_TBL_VALID_PRID_COUNT 0 - -/** -** \cfetblcfg Processor ID values used for table load validation -** -** \par Description: -** Defines the processor ID values used for validating the -** processor ID field in the table file header. To be valid, -** the spacecraft ID specified in the table file header must -** match one of the values defined here. -** -** \par Limits -** This value can be any 32 bit unsigned integer. -*/ -#define CFE_PLATFORM_TBL_VALID_PRID_1 (CFE_PLATFORM_CPU_ID) -#define CFE_PLATFORM_TBL_VALID_PRID_2 (CFE_PLATFORM_TBL_U32FROM4CHARS('a', 'b', 'c', 'd')) -#define CFE_PLATFORM_TBL_VALID_PRID_3 0 -#define CFE_PLATFORM_TBL_VALID_PRID_4 0 - -/** \cfeescfg Mission specific version number for cFE -** -** \par Description: -** The cFE version number consists of four parts: -** major version number, minor version number, revision -** number and mission specific revision number. The mission -** specific revision number is defined here and the other -** parts are defined in "cfe_version.h". -** -** \par Limits: -** Must be defined as a numeric value that is greater than -** or equal to zero. -*/ -#define CFE_MISSION_REV 0 - -/** \cfeescfg Poll timer for startup sync delay -** -** \par Description: -** During startup, some tasks may need to synchronize their own initialization -** with the initialization of other applications in the system. -** -** CFE ES implements an API to accomplish this, that performs a task delay (sleep) -** while polling the overall system state until other tasks are ready. -** -** This value controls the amount of time that the CFE_ES_ApplicationSyncDelay -** will sleep between each check of the system state. This should be large enough -** to allow other tasks to run, but not so large as to noticeably delay the startup -** completion. -** -** Units are in milliseconds -** -** \par Limits: -** Must be defined as an integer value that is greater than -** or equal to zero. -*/ -#define CFE_PLATFORM_ES_STARTUP_SYNC_POLL_MSEC 50 - -/** \cfeescfg CFE core application startup timeout -** -** \par Description: -** The upper limit for the amount of time that the cFE core applications -** (ES, SB, EVS, TIME, TBL) are each alloted to reach their respective -** "ready" states. -** -** The CFE "main" thread starts individual tasks for each of the core applications -** (except FS). Each of these must perform some initialization work before the -** next core application can be started, so the main thread waits to ensure that the -** application has reached the "ready" state before starting the next application. -** -** If any core application fails to start, then it indicates a major problem with -** the system and startup is aborted. -** -** Units are in milliseconds -** -** \par Limits: -** Must be defined as an integer value that is greater than -** or equal to zero. -** -*/ -#define CFE_PLATFORM_CORE_MAX_STARTUP_MSEC 30000 - -/** \cfeescfg Startup script timeout -** -** \par Description: -** The upper limit for the total amount of time that all apps listed in the CFE ES startup -** script may take to all become ready. -** -** Unlike the "core" app timeout, this is a soft limit; if the alloted time is exceeded, -** it probably indicates an issue with one of the apps, but does not cause CFE ES to take -** any additional action other than logging the event to the syslog. -** -** Units are in milliseconds -** -** \par Limits: -** Must be defined as an integer value that is greater than -** or equal to zero. - */ -#define CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC 1000 - - -/* - * Compatibility layer for CFE release 6.6 - * During development of CFE 6.6 a naming convention was introduced such - * that all platform-specific symbols use a CFE_PLATFORM_ prefix. - * - * The following section provides a mapping from the historical name to - * the new name for compatibility with existing code. The code can then be - * compiled with the CFE_OMIT_DEPRECATED_6_6 macro defined, and an error will - * be triggered if any of the old symbol names are referenced in the code. - * - * It is expected that this compatibility layer will be removed in the next - * release following 6.6, so all code must be fixed to use the new name. - */ -#ifndef CFE_OMIT_DEPRECATED_6_6 - -#define CFE_CPU_ID CFE_PLATFORM_CPU_ID -#define CFE_CPU_NAME CFE_PLATFORM_CPU_NAME -#define CFE_SB_MAX_MSG_IDS CFE_PLATFORM_SB_MAX_MSG_IDS -#define CFE_SB_MAX_PIPES CFE_PLATFORM_SB_MAX_PIPES -#define CFE_SB_MAX_DEST_PER_PKT CFE_PLATFORM_SB_MAX_DEST_PER_PKT -#define CFE_SB_DEFAULT_MSG_LIMIT CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT -#define CFE_SB_BUF_MEMORY_BYTES CFE_PLATFORM_SB_BUF_MEMORY_BYTES -#define CFE_SB_MAX_PIPE_DEPTH CFE_PLATFORM_SB_MAX_PIPE_DEPTH -#define CFE_SB_HIGHEST_VALID_MSGID CFE_PLATFORM_SB_HIGHEST_VALID_MSGID -#define CFE_SB_DEFAULT_ROUTING_FILENAME CFE_PLATFORM_SB_DEFAULT_ROUTING_FILENAME -#define CFE_SB_DEFAULT_PIPE_FILENAME CFE_PLATFORM_SB_DEFAULT_PIPE_FILENAME -#define CFE_SB_DEFAULT_MAP_FILENAME CFE_PLATFORM_SB_DEFAULT_MAP_FILENAME -#define CFE_SB_FILTERED_EVENT1 CFE_PLATFORM_SB_FILTERED_EVENT1 -#define CFE_SB_FILTER_MASK1 CFE_PLATFORM_SB_FILTER_MASK1 -#define CFE_SB_FILTERED_EVENT2 CFE_PLATFORM_SB_FILTERED_EVENT2 -#define CFE_SB_FILTER_MASK2 CFE_PLATFORM_SB_FILTER_MASK2 -#define CFE_SB_FILTERED_EVENT3 CFE_PLATFORM_SB_FILTERED_EVENT3 -#define CFE_SB_FILTER_MASK3 CFE_PLATFORM_SB_FILTER_MASK3 -#define CFE_SB_FILTERED_EVENT4 CFE_PLATFORM_SB_FILTERED_EVENT4 -#define CFE_SB_FILTER_MASK4 CFE_PLATFORM_SB_FILTER_MASK4 -#define CFE_SB_FILTERED_EVENT5 CFE_PLATFORM_SB_FILTERED_EVENT5 -#define CFE_SB_FILTER_MASK5 CFE_PLATFORM_SB_FILTER_MASK5 -#define CFE_SB_FILTERED_EVENT6 CFE_PLATFORM_SB_FILTERED_EVENT6 -#define CFE_SB_FILTER_MASK6 CFE_PLATFORM_SB_FILTER_MASK6 -#define CFE_SB_FILTERED_EVENT7 CFE_PLATFORM_SB_FILTERED_EVENT7 -#define CFE_SB_FILTER_MASK7 CFE_PLATFORM_SB_FILTER_MASK7 -#define CFE_SB_FILTERED_EVENT8 CFE_PLATFORM_SB_FILTERED_EVENT8 -#define CFE_SB_FILTER_MASK8 CFE_PLATFORM_SB_FILTER_MASK8 -#define CFE_SB_MEM_BLOCK_SIZE_01 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01 -#define CFE_SB_MEM_BLOCK_SIZE_02 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 -#define CFE_SB_MEM_BLOCK_SIZE_03 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_03 -#define CFE_SB_MEM_BLOCK_SIZE_04 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_04 -#define CFE_SB_MEM_BLOCK_SIZE_05 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_05 -#define CFE_SB_MEM_BLOCK_SIZE_06 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_06 -#define CFE_SB_MEM_BLOCK_SIZE_07 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_07 -#define CFE_SB_MEM_BLOCK_SIZE_08 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_08 -#define CFE_SB_MEM_BLOCK_SIZE_09 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_09 -#define CFE_SB_MEM_BLOCK_SIZE_10 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_10 -#define CFE_SB_MEM_BLOCK_SIZE_11 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_11 -#define CFE_SB_MEM_BLOCK_SIZE_12 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_12 -#define CFE_SB_MEM_BLOCK_SIZE_13 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_13 -#define CFE_SB_MEM_BLOCK_SIZE_14 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_14 -#define CFE_SB_MEM_BLOCK_SIZE_15 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_15 -#define CFE_SB_MEM_BLOCK_SIZE_16 CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16 -#define CFE_SB_MAX_BLOCK_SIZE CFE_PLATFORM_SB_MAX_BLOCK_SIZE -#define CFE_SB_DEFAULT_REPORT_SENDER CFE_PLATFORM_SB_DEFAULT_REPORT_SENDER -#define CFE_TIME_CFG_SERVER CFE_PLATFORM_TIME_CFG_SERVER -#define CFE_TIME_CFG_CLIENT CFE_PLATFORM_TIME_CFG_CLIENT -#define CFE_TIME_CFG_VIRTUAL CFE_PLATFORM_TIME_CFG_VIRTUAL -#define CFE_TIME_CFG_SIGNAL CFE_PLATFORM_TIME_CFG_SIGNAL -#define CFE_TIME_CFG_SOURCE CFE_PLATFORM_TIME_CFG_SOURCE -#define CFE_TIME_CFG_SRC_MET CFE_PLATFORM_TIME_CFG_SRC_MET -#define CFE_TIME_CFG_SRC_GPS CFE_PLATFORM_TIME_CFG_SRC_GPS -#define CFE_TIME_CFG_SRC_TIME CFE_PLATFORM_TIME_CFG_SRC_TIME -#define CFE_TIME_MAX_DELTA_SECS CFE_PLATFORM_TIME_MAX_DELTA_SECS -#define CFE_TIME_MAX_DELTA_SUBS CFE_PLATFORM_TIME_MAX_DELTA_SUBS -#define CFE_TIME_MAX_LOCAL_SECS CFE_PLATFORM_TIME_MAX_LOCAL_SECS -#define CFE_TIME_MAX_LOCAL_SUBS CFE_PLATFORM_TIME_MAX_LOCAL_SUBS -#define CFE_TIME_CFG_TONE_LIMIT CFE_PLATFORM_TIME_CFG_TONE_LIMIT -#define CFE_TIME_CFG_START_FLY CFE_PLATFORM_TIME_CFG_START_FLY -#define CFE_TIME_CFG_LATCH_FLY CFE_PLATFORM_TIME_CFG_LATCH_FLY -#define CFE_ES_MAX_APPLICATIONS CFE_PLATFORM_ES_MAX_APPLICATIONS -#define CFE_ES_MAX_LIBRARIES CFE_PLATFORM_ES_MAX_LIBRARIES -#define CFE_ES_ER_LOG_ENTRIES CFE_PLATFORM_ES_ER_LOG_ENTRIES -#define CFE_ES_ER_LOG_MAX_CONTEXT_SIZE CFE_PLATFORM_ES_ER_LOG_MAX_CONTEXT_SIZE -#define CFE_ES_SYSTEM_LOG_SIZE CFE_PLATFORM_ES_SYSTEM_LOG_SIZE -#define CFE_ES_OBJECT_TABLE_SIZE CFE_PLATFORM_ES_OBJECT_TABLE_SIZE -#define CFE_ES_MAX_GEN_COUNTERS CFE_PLATFORM_ES_MAX_GEN_COUNTERS -#define CFE_ES_APP_SCAN_RATE CFE_PLATFORM_ES_APP_SCAN_RATE -#define CFE_ES_APP_KILL_TIMEOUT CFE_PLATFORM_ES_APP_KILL_TIMEOUT -#define CFE_ES_RAM_DISK_SECTOR_SIZE CFE_PLATFORM_ES_RAM_DISK_SECTOR_SIZE -#define CFE_ES_RAM_DISK_NUM_SECTORS CFE_PLATFORM_ES_RAM_DISK_NUM_SECTORS -#define CFE_ES_RAM_DISK_PERCENT_RESERVED CFE_PLATFORM_ES_RAM_DISK_PERCENT_RESERVED -#define CFE_ES_RAM_DISK_MOUNT_STRING CFE_PLATFORM_ES_RAM_DISK_MOUNT_STRING -#define CFE_ES_CDS_SIZE CFE_PLATFORM_ES_CDS_SIZE -#define CFE_ES_USER_RESERVED_SIZE CFE_PLATFORM_ES_USER_RESERVED_SIZE -#define CFE_ES_RESET_AREA_SIZE CFE_PLATFORM_ES_RESET_AREA_SIZE -#define CFE_ES_NONVOL_STARTUP_FILE CFE_PLATFORM_ES_NONVOL_STARTUP_FILE -#define CFE_ES_VOLATILE_STARTUP_FILE CFE_PLATFORM_ES_VOLATILE_STARTUP_FILE -#define CFE_ES_DEFAULT_SHELL_FILENAME CFE_PLATFORM_ES_DEFAULT_SHELL_FILENAME -#define CFE_ES_MAX_SHELL_CMD CFE_PLATFORM_ES_MAX_SHELL_CMD -#define CFE_ES_MAX_SHELL_PKT CFE_PLATFORM_ES_MAX_SHELL_PKT -#define CFE_ES_DEFAULT_APP_LOG_FILE CFE_PLATFORM_ES_DEFAULT_APP_LOG_FILE -#define CFE_ES_DEFAULT_TASK_LOG_FILE CFE_PLATFORM_ES_DEFAULT_TASK_LOG_FILE -#define CFE_ES_DEFAULT_SYSLOG_FILE CFE_PLATFORM_ES_DEFAULT_SYSLOG_FILE -#define CFE_ES_DEFAULT_ER_LOG_FILE CFE_PLATFORM_ES_DEFAULT_ER_LOG_FILE -#define CFE_ES_DEFAULT_PERF_DUMP_FILENAME CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME -#define CFE_ES_DEFAULT_CDS_REG_DUMP_FILE CFE_PLATFORM_ES_DEFAULT_CDS_REG_DUMP_FILE -#define CFE_ES_DEFAULT_SYSLOG_MODE CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE -#define CFE_ES_PERF_MAX_IDS CFE_PLATFORM_ES_PERF_MAX_IDS -#define CFE_ES_PERF_DATA_BUFFER_SIZE CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE -#define CFE_ES_PERF_FILTMASK_NONE CFE_PLATFORM_ES_PERF_FILTMASK_NONE -#define CFE_ES_PERF_FILTMASK_ALL CFE_PLATFORM_ES_PERF_FILTMASK_ALL -#define CFE_ES_PERF_FILTMASK_INIT CFE_PLATFORM_ES_PERF_FILTMASK_INIT -#define CFE_ES_PERF_TRIGMASK_NONE CFE_PLATFORM_ES_PERF_TRIGMASK_NONE -#define CFE_ES_PERF_TRIGMASK_ALL CFE_PLATFORM_ES_PERF_TRIGMASK_ALL -#define CFE_ES_PERF_TRIGMASK_INIT CFE_PLATFORM_ES_PERF_TRIGMASK_INIT -#define CFE_ES_PERF_CHILD_PRIORITY CFE_PLATFORM_ES_PERF_CHILD_PRIORITY -#define CFE_ES_PERF_CHILD_STACK_SIZE CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE -#define CFE_ES_PERF_CHILD_MS_DELAY CFE_PLATFORM_ES_PERF_CHILD_MS_DELAY -#define CFE_ES_PERF_ENTRIES_BTWN_DLYS CFE_PLATFORM_ES_PERF_ENTRIES_BTWN_DLYS -#define CFE_ES_DEFAULT_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE -#define CFE_ES_EXCEPTION_FUNCTION CFE_PLATFORM_ES_EXCEPTION_FUNCTION -#define CFE_EVS_START_TASK_PRIORITY CFE_PLATFORM_EVS_START_TASK_PRIORITY -#define CFE_EVS_START_TASK_STACK_SIZE CFE_PLATFORM_EVS_START_TASK_STACK_SIZE -#define CFE_SB_START_TASK_PRIORITY CFE_PLATFORM_SB_START_TASK_PRIORITY -#define CFE_SB_START_TASK_STACK_SIZE CFE_PLATFORM_SB_START_TASK_STACK_SIZE -#define CFE_ES_START_TASK_PRIORITY CFE_PLATFORM_ES_START_TASK_PRIORITY -#define CFE_ES_START_TASK_STACK_SIZE CFE_PLATFORM_ES_START_TASK_STACK_SIZE -#define CFE_TIME_START_TASK_PRIORITY CFE_PLATFORM_TIME_START_TASK_PRIORITY -#define CFE_TIME_TONE_TASK_PRIORITY CFE_PLATFORM_TIME_TONE_TASK_PRIORITY -#define CFE_TIME_1HZ_TASK_PRIORITY CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY -#define CFE_TIME_START_TASK_STACK_SIZE CFE_PLATFORM_TIME_START_TASK_STACK_SIZE -#define CFE_TIME_TONE_TASK_STACK_SIZE CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE -#define CFE_TIME_1HZ_TASK_STACK_SIZE CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE -#define CFE_TBL_START_TASK_PRIORITY CFE_PLATFORM_TBL_START_TASK_PRIORITY -#define CFE_TBL_START_TASK_STACK_SIZE CFE_PLATFORM_TBL_START_TASK_STACK_SIZE -#define CFE_ES_CDS_MAX_NUM_ENTRIES CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES -#define CFE_ES_MAX_PROCESSOR_RESETS CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS -#define CFE_ES_MEM_BLOCK_SIZE_01 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_01 -#define CFE_ES_MEM_BLOCK_SIZE_02 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_02 -#define CFE_ES_MEM_BLOCK_SIZE_03 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_03 -#define CFE_ES_MEM_BLOCK_SIZE_04 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_04 -#define CFE_ES_MEM_BLOCK_SIZE_05 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_05 -#define CFE_ES_MEM_BLOCK_SIZE_06 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_06 -#define CFE_ES_MEM_BLOCK_SIZE_07 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_07 -#define CFE_ES_MEM_BLOCK_SIZE_08 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_08 -#define CFE_ES_MEM_BLOCK_SIZE_09 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_09 -#define CFE_ES_MEM_BLOCK_SIZE_10 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_10 -#define CFE_ES_MEM_BLOCK_SIZE_11 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_11 -#define CFE_ES_MEM_BLOCK_SIZE_12 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_12 -#define CFE_ES_MEM_BLOCK_SIZE_13 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_13 -#define CFE_ES_MEM_BLOCK_SIZE_14 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_14 -#define CFE_ES_MEM_BLOCK_SIZE_15 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_15 -#define CFE_ES_MEM_BLOCK_SIZE_16 CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16 -#define CFE_ES_MAX_BLOCK_SIZE CFE_PLATFORM_ES_MAX_BLOCK_SIZE -#define CFE_ES_CDS_MEM_BLOCK_SIZE_01 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_01 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_02 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_02 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_03 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_03 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_04 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_04 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_05 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_05 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_06 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_06 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_07 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_07 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_08 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_08 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_09 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_09 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_10 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_10 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_11 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_11 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_12 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_12 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_13 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_13 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_14 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_14 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_15 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_15 -#define CFE_ES_CDS_MEM_BLOCK_SIZE_16 CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16 -#define CFE_ES_CDS_MAX_BLOCK_SIZE CFE_PLATFORM_ES_CDS_MAX_BLOCK_SIZE -#define CFE_EVS_MAX_EVENT_FILTERS CFE_PLATFORM_EVS_MAX_EVENT_FILTERS -#define CFE_EVS_LOG_ON CFE_PLATFORM_EVS_LOG_ON -#define CFE_EVS_DEFAULT_LOG_FILE CFE_PLATFORM_EVS_DEFAULT_LOG_FILE -#define CFE_EVS_LOG_MAX CFE_PLATFORM_EVS_LOG_MAX -#define CFE_EVS_DEFAULT_APP_DATA_FILE CFE_PLATFORM_EVS_DEFAULT_APP_DATA_FILE -#define CFE_EVS_PORT_DEFAULT CFE_PLATFORM_EVS_PORT_DEFAULT -#define CFE_EVS_DEFAULT_TYPE_FLAG CFE_PLATFORM_EVS_DEFAULT_TYPE_FLAG -#define CFE_EVS_DEFAULT_LOG_MODE CFE_PLATFORM_EVS_DEFAULT_LOG_MODE -#define CFE_EVS_DEFAULT_MSG_FORMAT_MODE CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE -#define CFE_TBL_BUF_MEMORY_BYTES CFE_PLATFORM_TBL_BUF_MEMORY_BYTES -#define CFE_TBL_MAX_DBL_TABLE_SIZE CFE_PLATFORM_TBL_MAX_DBL_TABLE_SIZE -#define CFE_TBL_MAX_SNGL_TABLE_SIZE CFE_PLATFORM_TBL_MAX_SNGL_TABLE_SIZE -#define CFE_TBL_MAX_NUM_TABLES CFE_PLATFORM_TBL_MAX_NUM_TABLES -#define CFE_TBL_MAX_CRITICAL_TABLES CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES -#define CFE_TBL_MAX_NUM_HANDLES CFE_PLATFORM_TBL_MAX_NUM_HANDLES -#define CFE_TBL_MAX_SIMULTANEOUS_LOADS CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS -#define CFE_TBL_MAX_NUM_VALIDATIONS CFE_PLATFORM_TBL_MAX_NUM_VALIDATIONS -#define CFE_TBL_DEFAULT_REG_DUMP_FILE CFE_PLATFORM_TBL_DEFAULT_REG_DUMP_FILE -#define CFE_TBL_VALID_SCID_COUNT CFE_PLATFORM_TBL_VALID_SCID_COUNT -#define CFE_TBL_U32FROM4CHARS CFE_PLATFORM_TBL_U32FROM4CHARS -#define CFE_TBL_VALID_SCID_1 CFE_PLATFORM_TBL_VALID_SCID_1 -#define CFE_TBL_VALID_SCID_2 CFE_PLATFORM_TBL_VALID_SCID_2 -#define CFE_TBL_VALID_PRID_COUNT CFE_PLATFORM_TBL_VALID_PRID_COUNT -#define CFE_TBL_VALID_PRID_1 CFE_PLATFORM_TBL_VALID_PRID_1 -#define CFE_TBL_VALID_PRID_2 CFE_PLATFORM_TBL_VALID_PRID_2 -#define CFE_TBL_VALID_PRID_3 CFE_PLATFORM_TBL_VALID_PRID_3 -#define CFE_TBL_VALID_PRID_4 CFE_PLATFORM_TBL_VALID_PRID_4 -#define CFE_ES_STARTUP_SYNC_POLL_MSEC CFE_PLATFORM_ES_STARTUP_SYNC_POLL_MSEC -#define CFE_CORE_MAX_STARTUP_MSEC CFE_PLATFORM_CORE_MAX_STARTUP_MSEC -#define CFE_ES_STARTUP_SCRIPT_TIMEOUT_MSEC CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC - -/* - * This was previously configurable, now fixed. - * Keeping it here will trigger a "redefined" warning if some mission - * had configured it as "false" for some reason. - */ -#define CFE_TIME_ENA_1HZ_CMD_PKT TRUE - -#endif /* CFE_OMIT_DEPRECATED_6_6 */ - -#endif /* _cfe_platform_cfg_ */ - From fe700b7f7669eb0de960d2bfb98025c521c8580b Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Thu, 2 Apr 2020 11:31:01 -0400 Subject: [PATCH 04/15] Fix #580, Deprecate CFE_OS_ abstracted error codes Added CFE_OMIT_DEPRECATED_6_7 just to be consistent Also fix #552 - removes non-existent codes --- cmake/sample_defs/global_build_options.cmake | 2 +- fsw/cfe-core/src/inc/cfe_error.h | 55 ++++++++++---------- fsw/cfe-core/unit-test/sb_UT.c | 4 +- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/cmake/sample_defs/global_build_options.cmake b/cmake/sample_defs/global_build_options.cmake index 2f49e0dda..642b00082 100644 --- a/cmake/sample_defs/global_build_options.cmake +++ b/cmake/sample_defs/global_build_options.cmake @@ -19,7 +19,7 @@ set(OMIT_DEPRECATED $ENV{OMIT_DEPRECATED} CACHE STRING "Omit deprecated elements") if (OMIT_DEPRECATED) message (STATUS "OMIT_DEPRECATED=true: Not including deprecated elements in build") - add_definitions(-DCFE_OMIT_DEPRECATED_6_6 -DOSAL_OMIT_DEPRECATED) + add_definitions(-DCFE_OMIT_DEPRECATED_6_7 -DCFE_OMIT_DEPRECATED_6_6 -DOSAL_OMIT_DEPRECATED) else() message (STATUS "OMIT_DEPRECATED=false: Deprecated elements included in build") endif (OMIT_DEPRECATED) diff --git a/fsw/cfe-core/src/inc/cfe_error.h b/fsw/cfe-core/src/inc/cfe_error.h index 03f4e1ea3..1f47ba605 100644 --- a/fsw/cfe-core/src/inc/cfe_error.h +++ b/fsw/cfe-core/src/inc/cfe_error.h @@ -783,37 +783,38 @@ */ #define CFE_FS_NOT_IMPLEMENTED ((int32)0xc600ffff) +#ifndef CFE_OMIT_DEPRECATED_6_7 /* ************* OSAPI STATUS CODES ************* */ -#define CFE_OS_ERROR (OS_ERROR) /**< @copydoc OS_ERROR */ -#define CFE_OS_INVALID_POINTER (OS_INVALID_POINTER) /**< @copydoc OS_INVALID_POINTER */ -#define CFE_OS_ERROR_ADDRESS_MISALIGNED (OS_ERROR_ADDRESS_MISALIGNED) /**< @copydoc OS_ERROR_ADDRESS_MISALIGNED */ -#define CFE_OS_ERROR_TIMEOUT (OS_ERROR_TIMEOUT) /**< @copydoc OS_ERROR_TIMEOUT */ -#define CFE_OS_INVALID_INT_NUM (OS_INVALID_INT_NUM) /**< @copydoc OS_INVALID_INT_NUM */ -#define CFE_OS_SEM_FAILURE (OS_SEM_FAILURE) /**< @copydoc OS_SEM_FAILURE */ -#define CFE_OS_SEM_TIMEOUT (OS_SEM_TIMEOUT) /**< @copydoc OS_SEM_TIMEOUT */ -#define CFE_OS_QUEUE_EMPTY (OS_QUEUE_EMPTY) /**< @copydoc OS_QUEUE_EMPTY */ -#define CFE_OS_QUEUE_FULL (OS_QUEUE_FULL) /**< @copydoc OS_QUEUE_FULL */ -#define CFE_OS_QUEUE_TIMEOUT (OS_QUEUE_TIMEOUT) /**< @copydoc OS_QUEUE_TIMEOUT */ -#define CFE_OS_QUEUE_INVALID_SIZE (OS_QUEUE_INVALID_SIZE) /**< @copydoc OS_QUEUE_INVALID_SIZE */ -#define CFE_OS_QUEUE_ID_ERROR (OS_QUEUE_ID_ERROR) /**< @copydoc OS_QUEUE_ID_ERROR */ -#define CFE_OS_ERR_NAME_TOO_LONG (OS_ERR_NAME_TOO_LONG) /**< @copydoc OS_ERR_NAME_TOO_LONG */ -#define CFE_OS_ERR_NO_FREE_IDS (OS_ERR_NO_FREE_IDS) /**< @copydoc OS_ERR_NO_FREE_IDS */ -#define CFE_OS_ERR_NAME_TAKEN (OS_ERR_NAME_TAKEN) /**< @copydoc OS_ERR_NAME_TAKEN */ -#define CFE_OS_ERR_INVALID_ID (OS_ERR_INVALID_ID) /**< @copydoc OS_ERR_INVALID_ID */ -#define CFE_OS_ERR_NAME_NOT_FOUND (OS_ERR_NAME_NOT_FOUND) /**< @copydoc OS_ERR_NAME_NOT_FOUND */ -#define CFE_OS_ERR_SEM_NOT_FULL (OS_ERR_SEM_NOT_FULL) /**< @copydoc OS_ERR_SEM_NOT_FULL */ -#define CFE_OS_ERR_INVALID_PRIORITY (OS_ERR_INVALID_PRIORITY) /**< @copydoc OS_ERR_INVALID_PRIORITY */ -#define CFE_OS_ERROR_TASK_ID (OS_ERROR_TASK_ID) /**< @brief This doesn't actually exist */ -#define CFE_OS_SEM_UNAVAILABLE (OS_SEM_UNAVAILABLE) /**< @brief This doesn't actually exist */ -#define CFE_OS_FS_ERROR (OS_FS_ERROR) /**< @copydoc OS_FS_ERROR */ -#define CFE_OS_FS_ERR_INVALID_POINTER (OS_FS_ERR_INVALID_POINTER) /**< @copydoc OS_FS_ERR_INVALID_POINTER */ -#define CFE_OS_FS_ERR_PATH_TOO_LONG (OS_FS_ERR_PATH_TOO_LONG) /**< @copydoc OS_FS_ERR_PATH_TOO_LONG */ -#define CFE_OS_FS_ERR_NAME_TOO_LONG (OS_FS_ERR_NAME_TOO_LONG) /**< @copydoc OS_FS_ERR_NAME_TOO_LONG */ -#define CFE_OS_FS_ERR_DRIVE_NOT_CREATED (OS_FS_ERR_DRIVE_NOT_CREATED) /**< @copydoc OS_FS_ERR_DRIVE_NOT_CREATED */ -#define CFE_OSAPI_NOT_IMPLEMENTED (OS_FS_UNIMPLEMENTED) /**< @copydoc OS_FS_UNIMPLEMENTED */ +#define CFE_OS_ERROR (OS_ERROR) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_INVALID_POINTER (OS_INVALID_POINTER) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_ERROR_ADDRESS_MISALIGNED (OS_ERROR_ADDRESS_MISALIGNED) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_ERROR_TIMEOUT (OS_ERROR_TIMEOUT) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_INVALID_INT_NUM (OS_INVALID_INT_NUM) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_SEM_FAILURE (OS_SEM_FAILURE) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_SEM_TIMEOUT (OS_SEM_TIMEOUT) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_QUEUE_EMPTY (OS_QUEUE_EMPTY) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_QUEUE_FULL (OS_QUEUE_FULL) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_QUEUE_TIMEOUT (OS_QUEUE_TIMEOUT) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_QUEUE_INVALID_SIZE (OS_QUEUE_INVALID_SIZE) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_QUEUE_ID_ERROR (OS_QUEUE_ID_ERROR) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_ERR_NAME_TOO_LONG (OS_ERR_NAME_TOO_LONG) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_ERR_NO_FREE_IDS (OS_ERR_NO_FREE_IDS) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_ERR_NAME_TAKEN (OS_ERR_NAME_TAKEN) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_ERR_INVALID_ID (OS_ERR_INVALID_ID) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_ERR_NAME_NOT_FOUND (OS_ERR_NAME_NOT_FOUND) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_ERR_SEM_NOT_FULL (OS_ERR_SEM_NOT_FULL) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_ERR_INVALID_PRIORITY (OS_ERR_INVALID_PRIORITY) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_FS_ERROR (OS_FS_ERROR) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_FS_ERR_INVALID_POINTER (OS_FS_ERR_INVALID_POINTER) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_FS_ERR_PATH_TOO_LONG (OS_FS_ERR_PATH_TOO_LONG) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_FS_ERR_NAME_TOO_LONG (OS_FS_ERR_NAME_TOO_LONG) /**< @brief DEPRECATED @deprecated */ +#define CFE_OS_FS_ERR_DRIVE_NOT_CREATED (OS_FS_ERR_DRIVE_NOT_CREATED) /**< @brief DEPRECATED @deprecated */ +#define CFE_OSAPI_NOT_IMPLEMENTED (OS_FS_UNIMPLEMENTED) /**< @brief DEPRECATED @deprecated */ + +#endif /* CFE_OMIT_DEPRECATED_6_7 */ /* ************* SOFTWARE BUS SERVICES STATUS CODES ************* diff --git a/fsw/cfe-core/unit-test/sb_UT.c b/fsw/cfe-core/unit-test/sb_UT.c index 2c1f4cd7a..bdb03c755 100644 --- a/fsw/cfe-core/unit-test/sb_UT.c +++ b/fsw/cfe-core/unit-test/sb_UT.c @@ -9813,8 +9813,8 @@ void Test_OS_MutSem_ErrLogic(void) #endif SB_ResetUnitTest(); - UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, CFE_OS_SEM_FAILURE); - UT_SetDeferredRetcode(UT_KEY(OS_MutSemGive), 2, CFE_OS_SEM_FAILURE); + UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, OS_SEM_FAILURE); + UT_SetDeferredRetcode(UT_KEY(OS_MutSemGive), 2, OS_SEM_FAILURE); CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe"); CFE_SB_Subscribe(MsgId, PipeId); ExpRtn = 3; From 627a969aa390dfe8d4268b633e71ae1fc40a42fb Mon Sep 17 00:00:00 2001 From: Jake Hageman Date: Fri, 1 Nov 2019 14:23:38 -0400 Subject: [PATCH 05/15] Fix #335: Shell unsigned pkt length bug --- fsw/cfe-core/src/es/cfe_es_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsw/cfe-core/src/es/cfe_es_shell.c b/fsw/cfe-core/src/es/cfe_es_shell.c index c1a2202a7..72a0ea1bc 100644 --- a/fsw/cfe-core/src/es/cfe_es_shell.c +++ b/fsw/cfe-core/src/es/cfe_es_shell.c @@ -170,7 +170,7 @@ int32 CFE_ES_ShellOutputCommand(const char * CmdString, const char *Filename) /* start processing the chunks. We want to have one packet left so we are sure this for loop * won't run over */ - for (CurrFilePtr=0; CurrFilePtr < (FileSize - CFE_MISSION_ES_MAX_SHELL_PKT); CurrFilePtr += CFE_MISSION_ES_MAX_SHELL_PKT) + for (CurrFilePtr=0; (CurrFilePtr + CFE_MISSION_ES_MAX_SHELL_PKT) < FileSize ; CurrFilePtr += CFE_MISSION_ES_MAX_SHELL_PKT) { OS_read(fd, CFE_ES_TaskData.ShellPacket.Payload.ShellOutput, CFE_MISSION_ES_MAX_SHELL_PKT); From bf24986542b6e729c04f0d2d374a7cdbd2b886a6 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 9 Apr 2020 16:33:43 -0400 Subject: [PATCH 06/15] Fix #295, Move app table management to background task Create a new background job to handle the maintenance tasks that had been performed in the ES main task as part of the CFE_ES_ScanAppTable() routine. All app state changes, including those invoked by messages, are now handled by this job. This also slightly changes the semantics of CFE_ES_RunLoop and CFE_ES_ExitApp. Now, the CFE_ES_RunLoop routine no longer requires a RunStatus buffer. Instead, the only thing that matters is the RunStatus value that is eventually passed to CFE_ES_ExitApp after the shutdown is complete. This should be mostly backward compatible, as the recommended app pattern would pass the same value to both functions. This commit also fixes #480, as the value passed to CFE_ES_ExitApp will not override a request that was already pending. --- fsw/cfe-core/src/es/cfe_es_api.c | 462 ++++++++---------- fsw/cfe-core/src/es/cfe_es_apps.c | 338 +++++++------ fsw/cfe-core/src/es/cfe_es_apps.h | 40 +- fsw/cfe-core/src/es/cfe_es_backgroundtask.c | 6 + fsw/cfe-core/src/es/cfe_es_task.c | 19 +- fsw/cfe-core/src/es/cfe_es_task.h | 5 + fsw/cfe-core/src/inc/cfe_es_extern_typedefs.h | 19 +- fsw/cfe-core/unit-test/es_UT.c | 75 ++- 8 files changed, 509 insertions(+), 455 deletions(-) diff --git a/fsw/cfe-core/src/es/cfe_es_api.c b/fsw/cfe-core/src/es/cfe_es_api.c index 44e528037..b863f1f69 100644 --- a/fsw/cfe-core/src/es/cfe_es_api.c +++ b/fsw/cfe-core/src/es/cfe_es_api.c @@ -19,10 +19,10 @@ */ /* -** File: +** File: ** cfe_es_api.c ** -** Purpose: +** Purpose: ** This file implements the cFE Executive Services API functions. ** ** References: @@ -73,7 +73,7 @@ int32 CFE_ES_GetResetType(uint32 *ResetSubtypePtr) int32 CFE_ES_ResetCFE(uint32 ResetType) { int32 ReturnCode; - + if ( ResetType == CFE_PSP_RST_TYPE_PROCESSOR ) { /* @@ -82,10 +82,10 @@ int32 CFE_ES_ResetCFE(uint32 ResetType) CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount++; /* - ** Before doing a Processor reset, check to see + ** Before doing a Processor reset, check to see ** if the maximum number has been exceeded */ - if ( CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount > + if ( CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount > CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount ) { CFE_ES_WriteToSysLog("POWER ON RESET due to max proc resets (Commanded).\n"); @@ -98,7 +98,7 @@ int32 CFE_ES_ResetCFE(uint32 ResetType) CFE_PSP_RST_SUBTYPE_RESET_COMMAND, "POWER ON RESET due to max proc resets (Commanded).", NULL,0 ); /* - ** Call the BSP reset routine + ** Call the BSP reset routine */ CFE_PSP_Restart(CFE_PSP_RST_TYPE_POWERON); } @@ -121,12 +121,12 @@ int32 CFE_ES_ResetCFE(uint32 ResetType) ** Call the BSP reset routine */ CFE_PSP_Restart(CFE_PSP_RST_TYPE_PROCESSOR); - + } /* end if */ - - /* - ** If the BSP routine is not implemented, - ** it will return. + + /* + ** If the BSP routine is not implemented, + ** it will return. */ ReturnCode = CFE_ES_NOT_IMPLEMENTED; } @@ -146,10 +146,10 @@ int32 CFE_ES_ResetCFE(uint32 ResetType) ** Call the BSP reset routine */ CFE_PSP_Restart(CFE_PSP_RST_TYPE_POWERON); - - /* - ** If the BSP routine is not implemented, - ** it will return. + + /* + ** If the BSP routine is not implemented, + ** it will return. */ ReturnCode = CFE_ES_NOT_IMPLEMENTED; } @@ -160,49 +160,8 @@ int32 CFE_ES_ResetCFE(uint32 ResetType) } return(ReturnCode); - -} /* End of CFE_ES_ResetCFE() */ - -/* - * Function: CFE_ES_SetAppState - * - * Purpose: Internal ES function to set the state of an app. This performs - * any necessary internal housekeeping related to the state change, - * and provides a single place to keep logic for state entry/exit. - * - * The typical progression of APP states: - * - * UNDEFINED -> EARLY_INIT -> LATE_INIT -> RUNNING -> WAITING - * - * State can go to "STOPPED" (the last state) from any state. This is used for error conditions. - * - * NOTE: This is an ES internal function and must only be called when the ES global state is already locked. - * - */ -void CFE_ES_SetAppState(uint32 AppID, uint32 TargetState) -{ - CFE_ES_AppRecord_t *AppState = &CFE_ES_Global.AppTable[AppID]; - - if (TargetState >= CFE_ES_AppState_MAX) - { - /* Caller error - invalid state */ - return; - } - - /* - * States should not move backward under normal circumstances. - * - * This relational comparison depends on the app states being defined in logical order - * (they should be) - */ - if (TargetState != CFE_ES_AppState_UNDEFINED && AppState->AppState >= TargetState) - { - /* Do nothing */ - return; - } - AppState->AppState = TargetState; -} +} /* End of CFE_ES_ResetCFE() */ /* ** Function: CFE_ES_RestartApp - See API and header file for details @@ -215,7 +174,7 @@ int32 CFE_ES_RestartApp(uint32 AppID) { CFE_ES_LockSharedData(__func__,__LINE__); - + /* ** Check to see if the App is an external cFE App. */ @@ -223,23 +182,21 @@ int32 CFE_ES_RestartApp(uint32 AppID) { CFE_ES_SysLogWrite_Unsync ("CFE_ES_DeleteApp: Cannot Restart a CORE Application: %s.\n", CFE_ES_Global.AppTable[AppID].StartParams.Name ); - ReturnCode = CFE_ES_ERR_APPID; + ReturnCode = CFE_ES_ERR_APPID; } else if ( CFE_ES_Global.AppTable[AppID].AppState != CFE_ES_AppState_RUNNING ) { CFE_ES_SysLogWrite_Unsync ("CFE_ES_RestartApp: Cannot Restart Application %s, It is not running.\n", CFE_ES_Global.AppTable[AppID].StartParams.Name); - ReturnCode = CFE_ES_ERR_APPID; + ReturnCode = CFE_ES_ERR_APPID; } else { CFE_ES_SysLogWrite_Unsync("CFE_ES_RestartApp: Restart Application %s Initiated\n", CFE_ES_Global.AppTable[AppID].StartParams.Name); CFE_ES_Global.AppTable[AppID].ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; - CFE_ES_SetAppState(AppID, CFE_ES_AppState_WAITING); - CFE_ES_Global.AppTable[AppID].ControlReq.AppTimer = CFE_PLATFORM_ES_APP_KILL_TIMEOUT; } - + CFE_ES_UnlockSharedData(__func__,__LINE__); } else /* App ID is not valid */ @@ -264,22 +221,22 @@ int32 CFE_ES_ReloadApp(uint32 AppID, const char *AppFileName) os_fstat_t FileStatus; CFE_ES_LockSharedData(__func__,__LINE__); - + /* ** Check to see if the App is an external cFE App. */ if ( CFE_ES_Global.AppTable[AppID].Type == CFE_ES_AppType_CORE ) { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_DeleteApp: Cannot Reload a CORE Application: %s.\n", + CFE_ES_SysLogWrite_Unsync ("CFE_ES_DeleteApp: Cannot Reload a CORE Application: %s.\n", CFE_ES_Global.AppTable[AppID].StartParams.Name ); - ReturnCode = CFE_ES_ERR_APPID; + ReturnCode = CFE_ES_ERR_APPID; } else if ( CFE_ES_Global.AppTable[AppID].AppState != CFE_ES_AppState_RUNNING ) { CFE_ES_SysLogWrite_Unsync ("CFE_ES_ReloadApp: Cannot Reload Application %s, It is not running.\n", CFE_ES_Global.AppTable[AppID].StartParams.Name); - ReturnCode = CFE_ES_ERR_APPID; - } + ReturnCode = CFE_ES_ERR_APPID; + } else { /* @@ -287,12 +244,10 @@ int32 CFE_ES_ReloadApp(uint32 AppID, const char *AppFileName) */ if (OS_stat(AppFileName, &FileStatus) == OS_SUCCESS) { - CFE_ES_SysLogWrite_Unsync("CFE_ES_ReloadApp: Reload Application %s Initiated. New filename = %s\n", + CFE_ES_SysLogWrite_Unsync("CFE_ES_ReloadApp: Reload Application %s Initiated. New filename = %s\n", CFE_ES_Global.AppTable[AppID].StartParams.Name, AppFileName); strncpy((char *)CFE_ES_Global.AppTable[AppID].StartParams.FileName, AppFileName, OS_MAX_PATH_LEN); CFE_ES_Global.AppTable[AppID].ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; - CFE_ES_SetAppState(AppID, CFE_ES_AppState_WAITING); - CFE_ES_Global.AppTable[AppID].ControlReq.AppTimer = CFE_PLATFORM_ES_APP_KILL_TIMEOUT; } else { @@ -302,9 +257,9 @@ int32 CFE_ES_ReloadApp(uint32 AppID, const char *AppFileName) ReturnCode = CFE_ES_FILE_IO_ERR; } } - + CFE_ES_UnlockSharedData(__func__,__LINE__); - + return(ReturnCode); } /* End of CFE_ES_ReloadApp() */ @@ -317,33 +272,31 @@ int32 CFE_ES_DeleteApp(uint32 AppID) int32 ReturnCode = CFE_SUCCESS; CFE_ES_LockSharedData(__func__,__LINE__); - + /* ** Check to see if the App is an external cFE App. */ if ( CFE_ES_Global.AppTable[AppID].Type == CFE_ES_AppType_CORE ) { - CFE_ES_SysLogWrite_Unsync ("CFE_ES_DeleteApp: Cannot Delete a CORE Application: %s.\n", + CFE_ES_SysLogWrite_Unsync ("CFE_ES_DeleteApp: Cannot Delete a CORE Application: %s.\n", CFE_ES_Global.AppTable[AppID].StartParams.Name ); - ReturnCode = CFE_ES_ERR_APPID; + ReturnCode = CFE_ES_ERR_APPID; } else if ( CFE_ES_Global.AppTable[AppID].AppState != CFE_ES_AppState_RUNNING ) { CFE_ES_SysLogWrite_Unsync ("CFE_ES_DeleteApp: Cannot Delete Application %s, It is not running.\n", CFE_ES_Global.AppTable[AppID].StartParams.Name); - ReturnCode = CFE_ES_ERR_APPID; + ReturnCode = CFE_ES_ERR_APPID; } else { CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteApp: Delete Application %s Initiated\n", - CFE_ES_Global.AppTable[AppID].StartParams.Name); + CFE_ES_Global.AppTable[AppID].StartParams.Name); CFE_ES_Global.AppTable[AppID].ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; - CFE_ES_SetAppState(AppID, CFE_ES_AppState_WAITING); - CFE_ES_Global.AppTable[AppID].ControlReq.AppTimer = CFE_PLATFORM_ES_APP_KILL_TIMEOUT; } - + CFE_ES_UnlockSharedData(__func__,__LINE__); - + return(ReturnCode); } /* End of CFE_ES_DeleteApp() */ @@ -359,15 +312,12 @@ void CFE_ES_ExitApp(uint32 ExitStatus) CFE_ES_LockSharedData(__func__,__LINE__); /* - * This should only be called with an ExitStatus of either APP_EXIT or APP_ERROR. - * Anything else is invalid and indicates a bug in the caller. In particular, - * if called with APP_RUN then this creates an invalid state (see bug #58). + * This should only be called with a valid ExitStatus, anything else is invalid + * and indicates a bug in the caller. */ - if (ExitStatus != CFE_ES_RunStatus_APP_EXIT && - ExitStatus != CFE_ES_RunStatus_APP_ERROR && - ExitStatus != CFE_ES_RunStatus_CORE_APP_INIT_ERROR && - ExitStatus != CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR) + if (ExitStatus == CFE_ES_RunStatus_UNDEFINED || + ExitStatus >= CFE_ES_RunStatus_MAX) { CFE_ES_SysLogWrite_Unsync ("CFE_ES_ExitApp: Called with invalid status (%u).\n", (unsigned int)ExitStatus); @@ -379,8 +329,20 @@ void CFE_ES_ExitApp(uint32 ExitStatus) ReturnCode = CFE_ES_GetAppIDInternal(&AppID); if ( ReturnCode == CFE_SUCCESS ) { - /* Set the status in the global table */ - CFE_ES_Global.AppTable[AppID].ControlReq.AppControlRequest = ExitStatus; + /* + * Set the status in the global table. + * + * The passed-in status should only be stored if there was no already-pending + * request from a ground command or other source, such as an exception, etc. + * + * If a control request is already pending, it is assumed that this exit is + * part of an orderly shutdown caused by that request, and therefore it + * should not be overwritten here. + */ + if (CFE_ES_Global.AppTable[AppID].ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_RUN) + { + CFE_ES_Global.AppTable[AppID].ControlReq.AppControlRequest = ExitStatus; + } /* ** Check to see if the App is an external cFE App. @@ -394,16 +356,16 @@ void CFE_ES_ExitApp(uint32 ExitStatus) { CFE_ES_SysLogWrite_Unsync ("CFE_ES_ExitApp: CORE Application %s Had an Init Error.\n", CFE_ES_Global.AppTable[AppID].StartParams.Name ); - + /* - ** Unlock the ES Shared data before calling ResetCFE + ** Unlock the ES Shared data before calling ResetCFE */ CFE_ES_UnlockSharedData(__func__,__LINE__); - - + + /* ** Do a Processor Reset the cFE - */ + */ ReturnCode = CFE_ES_ResetCFE(CFE_PSP_RST_TYPE_PROCESSOR); /* @@ -415,44 +377,45 @@ void CFE_ES_ExitApp(uint32 ExitStatus) (unsigned int) ReturnCode); return; - + } else if ( ExitStatus == CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR ) { CFE_ES_SysLogWrite_Unsync ("CFE_ES_ExitApp: CORE Application %s Had a Runtime Error.\n", - CFE_ES_Global.AppTable[AppID].StartParams.Name ); - + CFE_ES_Global.AppTable[AppID].StartParams.Name ); + /* ** Unlock the ES Shared data before killing the main task */ CFE_ES_UnlockSharedData(__func__,__LINE__); - + /* ** Exit this task */ - OS_TaskExit(); - + OS_TaskExit(); + /* ** Code will not return, except under unit test */ return; } - else + else { CFE_ES_SysLogWrite_Unsync ("CFE_ES_ExitApp, Cannot Exit CORE Application %s\n", - CFE_ES_Global.AppTable[AppID].StartParams.Name ); + CFE_ES_Global.AppTable[AppID].StartParams.Name ); } - + } else /* It is an external App */ { - + CFE_ES_SysLogWrite_Unsync ("Application %s called CFE_ES_ExitApp\n", CFE_ES_Global.AppTable[AppID].StartParams.Name); - CFE_ES_SetAppState(AppID, CFE_ES_AppState_STOPPED); + + CFE_ES_Global.AppTable[AppID].AppState = CFE_ES_AppState_STOPPED; /* - ** Unlock the ES Shared data before suspending the app + ** Unlock the ES Shared data before suspending the app */ CFE_ES_UnlockSharedData(__func__,__LINE__); @@ -466,11 +429,11 @@ void CFE_ES_ExitApp(uint32 ExitStatus) } } /* end if */ - + } /* end if ReturnCode == CFE_SUCCESS */ CFE_ES_UnlockSharedData(__func__,__LINE__); - + } /* End of CFE_ES_ExitApp() */ /* @@ -481,8 +444,35 @@ bool CFE_ES_RunLoop(uint32 *RunStatus) bool ReturnCode; int32 Status; uint32 AppID; - uint32 TaskID; - + CFE_ES_AppRecord_t *AppRecPtr; + + /* + * call CFE_ES_IncrementTaskCounter() so this is + * recorded as task activity for outgoing telemetry. + * + * This will update the counter for whatever task context + * is calling this API, which is expected to be the main + * task of the app. This can be done outside of any lock + * because each task has its own counter which is only updated + * by itself. + */ + CFE_ES_IncrementTaskCounter(); + + /* + * This API should generally only be called with the status as CFE_ES_RunStatus_APP_RUN. + * Anything else gets an immediate "false" return which should cause the caller to + * break out of its main loop. There is no need to take the lock or do any other + * accounting in that case. + * + * Note that the RunStatus really doesn't add much value here, so this also allows + * this function to be called with NULL, with the possibility of phasing this out + * entirely. + */ + if ( RunStatus != NULL && *RunStatus != CFE_ES_RunStatus_APP_RUN ) + { + return false; + } + CFE_ES_LockSharedData(__func__,__LINE__); /* @@ -492,77 +482,44 @@ bool CFE_ES_RunLoop(uint32 *RunStatus) if ( Status == CFE_SUCCESS ) { - - /* - ** Get the Task ID for the main task - */ - OS_ConvertToArrayIndex(CFE_ES_Global.AppTable[AppID].TaskInfo.MainTaskId, &TaskID); - - /* - ** Increment the execution counter for the main task - */ - CFE_ES_Global.TaskTable[TaskID].ExecutionCounter++; - - /* - ** Validate RunStatus - */ - if ( *RunStatus == CFE_ES_RunStatus_APP_RUN || *RunStatus == CFE_ES_RunStatus_APP_EXIT || *RunStatus == CFE_ES_RunStatus_APP_ERROR ) - { - /* - ** Look up the system control request - */ - if ( *RunStatus == CFE_ES_RunStatus_APP_RUN ) - { - /* - ** App state must be RUNNING (no-op if already set to running) - */ - CFE_ES_SetAppState(AppID, CFE_ES_AppState_RUNNING); - - if ( CFE_ES_Global.AppTable[AppID].ControlReq.AppControlRequest != CFE_ES_RunStatus_APP_RUN ) - { - /* - ** We have an external request to stop - */ - ReturnCode = false; - - } - else - { - /* - ** Everything is OK - */ - ReturnCode = true; - } - } - else - { - /* - ** Application wants to exit, so let it + AppRecPtr = &CFE_ES_Global.AppTable[AppID]; + + /* + ** App state must be RUNNING (no-op if already set to running) + */ + if (AppRecPtr->AppState < CFE_ES_AppState_RUNNING) + { + AppRecPtr->AppState = CFE_ES_AppState_RUNNING; + } + + /* + * Check if the control request is also set to "RUN" + * Anything else should also return false, so the the loop will exit. + */ + if ( AppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_RUN ) + { + ReturnCode = true; + } + else + { + /* + * Just in case, also output the status, just in case the app looks at this. */ - CFE_ES_Global.AppTable[AppID].ControlReq.AppControlRequest = *RunStatus; - ReturnCode = false; - } - } - else - { - /* - ** Not a supported RunStatus code, the app will abort - */ - CFE_ES_SysLogWrite_Unsync("CFE_ES_RunLoop Error: Invalid RunStatus:%d!\n",(int)(*RunStatus)); - CFE_ES_Global.AppTable[AppID].ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; - ReturnCode = false; - - } /* End if *RunStatus == CFE_ES_RunStatus_APP_RUN .. */ - + if (RunStatus != NULL) + { + *RunStatus = AppRecPtr->ControlReq.AppControlRequest; + } + ReturnCode = false; + } } else { - /* - ** Cannot do anything without the AppID - */ - CFE_ES_SysLogWrite_Unsync("CFE_ES_RunLoop Error: Cannot get AppID for the caller: RC = %08X\n",(unsigned int)Status); - ReturnCode = false; - + /* + * Cannot do anything without the AppID + */ + CFE_ES_SysLogWrite_Unsync("CFE_ES_RunLoop Error: Cannot get AppID for the caller: RC = %08X\n",(unsigned int)Status); + ReturnCode = false; + } /* end if Status == CFE_SUCCESS */ CFE_ES_UnlockSharedData(__func__,__LINE__); @@ -627,7 +584,10 @@ int32 CFE_ES_WaitForSystemState(uint32 MinSystemState, uint32 TimeOutMillisecond * apps to add an explicit state change call, but it makes sense because if this was not done an app could * be waiting for itself (which will always time out). */ - CFE_ES_SetAppState(AppID, RequiredAppState); + if (CFE_ES_Global.AppTable[AppID].AppState < RequiredAppState) + { + CFE_ES_Global.AppTable[AppID].AppState = RequiredAppState; + } } CFE_ES_UnlockSharedData(__func__,__LINE__); @@ -683,7 +643,7 @@ int32 CFE_ES_RegisterApp(void) CFE_ES_LockSharedData(__func__,__LINE__); /* - ** Register the task + ** Register the task */ Result = OS_TaskRegister(); @@ -693,8 +653,8 @@ int32 CFE_ES_RegisterApp(void) } else { - /* - ** Cannot create a syslog entry here because it requires the task to + /* + ** Cannot create a syslog entry here because it requires the task to ** be registered */ Result = CFE_ES_ERR_APP_REGISTER; @@ -704,11 +664,11 @@ int32 CFE_ES_RegisterApp(void) ** Set the default exception environment */ CFE_PSP_SetDefaultExceptionEnvironment(); - + CFE_ES_UnlockSharedData(__func__,__LINE__); return(Result); - + } /* End of CFE_ES_RegisterApp() */ @@ -737,9 +697,9 @@ int32 CFE_ES_GetAppIDByName(uint32 *AppIdPtr, const char *AppName) } } } /* end for */ - + CFE_ES_UnlockSharedData(__func__,__LINE__); - + return(Result); } /* End of CFE_ES_GetAppIDByName() */ @@ -757,7 +717,7 @@ int32 CFE_ES_GetAppID(uint32 *AppIdPtr) Result = CFE_ES_GetAppIDInternal(AppIdPtr); CFE_ES_UnlockSharedData(__func__,__LINE__); - + return(Result); } /* End of CFE_ES_GetAppID() */ @@ -788,7 +748,7 @@ int32 CFE_ES_GetAppName(char *AppName, uint32 AppId, uint32 BufferLength) { Result = CFE_ES_ERR_APPID; } - + CFE_ES_UnlockSharedData(__func__,__LINE__); /* @@ -803,7 +763,7 @@ int32 CFE_ES_GetAppName(char *AppName, uint32 AppId, uint32 BufferLength) { AppName[0] = 0; } - + return(Result); } /* End of CFE_ES_GetAppName() */ @@ -908,7 +868,7 @@ int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, uint32 OSTaskId) CFE_ES_SysLogWrite_Unsync("CFE_ES_GetTaskInfo: Task ID Not Active: %u\n",(unsigned int)OSTaskId); ReturnCode = CFE_ES_ERR_TASKID; } - + CFE_ES_UnlockSharedData(__func__,__LINE__); return(ReturnCode); @@ -960,11 +920,11 @@ int32 CFE_ES_CreateChildTask(uint32 *TaskIdPtr, CFE_ES_WriteToSysLog("CFE_ES_CreateChildTask: Function Pointer Parameter is NULL for Task '%s' (ID %d).\n",TaskName,(int)(*TaskIdPtr)); ReturnCode = CFE_ES_BAD_ARGUMENT; } - else + else { - + CFE_ES_LockSharedData(__func__,__LINE__); - + /* ** Get the AppID of the calling Application */ @@ -986,7 +946,7 @@ int32 CFE_ES_CreateChildTask(uint32 *TaskIdPtr, { /* ** Truncate the priority if needed - */ + */ if ( Priority > 255 ) { Priority = 255; @@ -1011,7 +971,7 @@ int32 CFE_ES_CreateChildTask(uint32 *TaskIdPtr, strncpy((char *)CFE_ES_Global.TaskTable[TaskId].TaskName,TaskName,OS_MAX_API_NAME); CFE_ES_Global.TaskTable[TaskId].TaskName[OS_MAX_API_NAME - 1] = '\0'; CFE_ES_Global.RegisteredTasks++; - + ReturnCode = CFE_SUCCESS; } else @@ -1019,20 +979,20 @@ int32 CFE_ES_CreateChildTask(uint32 *TaskIdPtr, CFE_ES_SysLogWrite_Unsync("CFE_ES_CreateChildTask: Error calling OS_TaskCreate for Task '%s' RC = 0x%08X\n",TaskName,(unsigned int)Result); ReturnCode = CFE_ES_ERR_CHILD_TASK_CREATE; } - } + } else { CFE_ES_SysLogWrite_Unsync("CFE_ES_CreateChildTask: Error: Cannot call from a Child Task (for Task '%s').\n",TaskName); ReturnCode = CFE_ES_ERR_CHILD_TASK_CREATE; - + } /* end if Calling task is a main task */ - + }/* end If AppID is valid */ - + CFE_ES_UnlockSharedData(__func__,__LINE__); } /* end if parameter checking */ - + return(ReturnCode); } /* End of CFE_ES_CreateChildTask() */ @@ -1049,23 +1009,23 @@ int32 CFE_ES_RegisterChildTask(void) CFE_ES_LockSharedData(__func__,__LINE__); /* - ** Register the task with the OS + ** Register the task with the OS */ Result = OS_TaskRegister(); if (Result != OS_SUCCESS) { - /* - ** Cannot create a syslog entry here because it requires the task to + /* + ** Cannot create a syslog entry here because it requires the task to ** be registered */ ReturnCode = CFE_ES_ERR_CHILD_TASK_REGISTER; } else - { + { ReturnCode = CFE_SUCCESS; } - + /* ** Set the default exception environment */ @@ -1088,7 +1048,7 @@ void CFE_ES_IncrementTaskCounter(void) { CFE_ES_Global.TaskTable[TaskId].ExecutionCounter++; } - + } /* End of CFE_ES_ExitChildTask() */ @@ -1111,7 +1071,7 @@ int32 CFE_ES_DeleteChildTask(uint32 OSTaskId) if (OS_ConvertToArrayIndex(OSTaskId, &TaskId) == OS_SUCCESS) { CFE_ES_LockSharedData(__func__,__LINE__); - + /* ** Make sure the task is active/valid */ @@ -1132,11 +1092,11 @@ int32 CFE_ES_DeleteChildTask(uint32 OSTaskId) ** Error, the task Id is an App Main Task ID */ TaskIsMain = true; - break; + break; } /* end if */ } /* end if */ } /* end for */ - + if ( TaskIsMain == false ) { /* @@ -1180,11 +1140,11 @@ int32 CFE_ES_DeleteChildTask(uint32 OSTaskId) */ CFE_ES_SysLogWrite_Unsync("CFE_ES_DeleteChildTask Error: Task ID is not active: %u\n",(unsigned int)OSTaskId ); ReturnCode = CFE_ES_ERR_TASKID; - + } /* end if */ - + CFE_ES_UnlockSharedData(__func__,__LINE__); - + } else { @@ -1193,7 +1153,7 @@ int32 CFE_ES_DeleteChildTask(uint32 OSTaskId) */ CFE_ES_WriteToSysLog("CFE_ES_DeleteChildTask Error: Invalid Task ID: %u\n",(unsigned int)OSTaskId ); ReturnCode = CFE_ES_ERR_TASKID; - + } return(ReturnCode); @@ -1209,17 +1169,17 @@ void CFE_ES_ExitChildTask(void) { uint32 TaskId; uint32 ParentTaskId; - uint32 AppId; + uint32 AppId; uint32 ReturnCode; CFE_ES_LockSharedData(__func__,__LINE__); /* - ** Check to see if this is being called from a cFE Application's + ** Check to see if this is being called from a cFE Application's ** main task. */ TaskId = OS_TaskGetId(); - + ReturnCode = CFE_ES_GetAppIDInternal(&AppId); if ( ReturnCode == CFE_SUCCESS ) { @@ -1247,7 +1207,7 @@ void CFE_ES_ExitChildTask(void) */ return; } - + } else { @@ -1255,13 +1215,13 @@ void CFE_ES_ExitChildTask(void) } } else - { + { CFE_ES_SysLogWrite_Unsync("CFE_ES_ExitChildTask Error Calling CFE_ES_GetAppID. Task ID = %d, RC = 0x%08X\n", (int)TaskId, (unsigned int)ReturnCode ); } /* end if GetAppId */ CFE_ES_UnlockSharedData(__func__,__LINE__); - + } /* End of CFE_ES_ExitChildTask() */ @@ -1355,9 +1315,9 @@ uint32 CFE_ES_CalculateCRC(const void *DataPtr, uint32 DataLength, uint32 InputC for ( i = 0 ; i < DataLength ; i++, BufPtr++) { - /* - * It is assumed that the supplied buffer is in a - * directly-accessible memory space that does not + /* + * It is assumed that the supplied buffer is in a + * directly-accessible memory space that does not * require special logic to access */ ByteValue = *BufPtr; @@ -1389,13 +1349,13 @@ int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, int32 BlockSize, cons int32 Status; size_t NameLen = 0; uint32 ThisAppId = 0; - + char AppName[OS_MAX_API_NAME] = {"UNKNOWN"}; char CDSName[CFE_ES_CDS_MAX_FULL_NAME_LEN] = {""}; /* Check to make sure calling application is legit */ Status = CFE_ES_CDS_ValidateAppID(&ThisAppId); - + if ( Status != CFE_SUCCESS ) /* Application ID was invalid */ { CFE_ES_WriteToSysLog("CFE_CDS:Register-Bad AppId(%d)\n", (int)ThisAppId); @@ -1454,7 +1414,7 @@ int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, int32 BlockSize, cons "%s Failed to Register CDS '%s', Status=0x%08X", AppName, Name, (unsigned int)Status); } - + return Status; } /* End of CFE_ES_RegisterCDS */ @@ -1467,9 +1427,9 @@ int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, int32 BlockSize, cons int32 CFE_ES_CopyToCDS(CFE_ES_CDSHandle_t Handle, void *DataToCopy) { int32 Status; - + Status = CFE_ES_CDSBlockWrite(CFE_ES_Global.CDSVars.Registry[Handle].MemHandle, DataToCopy); - + return Status; } /* End of CFE_ES_CopyToCDS() */ @@ -1482,9 +1442,9 @@ int32 CFE_ES_CopyToCDS(CFE_ES_CDSHandle_t Handle, void *DataToCopy) int32 CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Handle) { int32 Status; - + Status = CFE_ES_CDSBlockRead(RestoreToMemory, CFE_ES_Global.CDSVars.Registry[Handle].MemHandle); - + return Status; } /* End of CFE_ES_RestoreFromCDS() */ @@ -1535,7 +1495,7 @@ int32 CFE_ES_DeleteGenCounter(uint32 CounterId) int32 Status = CFE_ES_BAD_ARGUMENT; - if(CounterId < CFE_PLATFORM_ES_MAX_GEN_COUNTERS) + if(CounterId < CFE_PLATFORM_ES_MAX_GEN_COUNTERS) { CFE_ES_Global.CounterTable[CounterId].RecordUsed = false; CFE_ES_Global.CounterTable[CounterId].Counter = 0; @@ -1563,7 +1523,7 @@ int32 CFE_ES_IncrementGenCounter(uint32 CounterId) Status = CFE_SUCCESS; } return Status; - + } /* End of CFE_ES_IncrementGenCounter() */ /* @@ -1629,7 +1589,7 @@ int32 CFE_ES_GetGenCounterIDByName(uint32 *CounterIdPtr, const char *CounterName } } } /* end for */ - + return(Result); } /* End of CFE_ES_GetGenCounterIDByName() */ @@ -1700,7 +1660,7 @@ void CFE_ES_LockSharedData(const char *FunctionName, int32 LineNumber) uint32 AppId; Status = OS_MutSemTake(CFE_ES_Global.SharedDataMutex); - if (Status != OS_SUCCESS) + if (Status != OS_SUCCESS) { CFE_ES_GetAppIDInternal(&AppId); @@ -1737,7 +1697,7 @@ void CFE_ES_UnlockSharedData(const char *FunctionName, int32 LineNumber) uint32 AppId; Status = OS_MutSemGive(CFE_ES_Global.SharedDataMutex); - if (Status != OS_SUCCESS) + if (Status != OS_SUCCESS) { CFE_ES_GetAppIDInternal(&AppId); @@ -1767,7 +1727,7 @@ void CFE_ES_ProcessCoreException(uint32 HostTaskId, const char *ReasonStrin CFE_ES_TaskInfo_t EsTaskInfo; uint32 FoundExceptionTask = 0; uint32 ExceptionTaskID = 0; - + /* ** If a loadable cFE Application caused the reset and it's ** exception action is set to Restart the App rather than cause a @@ -1777,7 +1737,7 @@ void CFE_ES_ProcessCoreException(uint32 HostTaskId, const char *ReasonStrin /* ** We have the Host Task Id ( vxWorks, RTEMS, etc ). Search ** the OSAPI to see if a match can be found. - */ + */ for ( i = 0; i < OS_MAX_TASKS; i++ ) { if (CFE_ES_Global.TaskTable[i].RecordUsed == true) @@ -1801,14 +1761,14 @@ void CFE_ES_ProcessCoreException(uint32 HostTaskId, const char *ReasonStrin Status = CFE_ES_GetTaskInfo( &EsTaskInfo, ExceptionTaskID ); /* ** The App ID was found, now see if the ExceptionAction is set for a reset - */ + */ if ( Status == CFE_SUCCESS ) { if ( CFE_ES_Global.AppTable[EsTaskInfo.AppId].StartParams.ExceptionAction == CFE_ES_ExceptionAction_RESTART_APP ) { /* - ** Log the Application reset + ** Log the Application reset */ CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_ES_APP_RESTART, CFE_PSP_RST_SUBTYPE_EXCEPTION, (char *)ReasonString, @@ -1817,41 +1777,41 @@ void CFE_ES_ProcessCoreException(uint32 HostTaskId, const char *ReasonStrin /* ** Finally restart the App! This call is just a request ** to ES. - */ + */ CFE_ES_RestartApp(EsTaskInfo.AppId ); - + /* ** Return to avoid the Processor Restart Logic */ return; } /* end if ExceptionAction */ - + } /* end if */ - + } /* End if FoundExceptionTask */ - + /* ** If we made it here, which means that we need to do a processor reset */ /* - ** Before doing a Processor reset, check to see + ** Before doing a Processor reset, check to see ** if the maximum number has been exceeded */ - if ( CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount >= + if ( CFE_ES_ResetDataPtr->ResetVars.ProcessorResetCount >= CFE_ES_ResetDataPtr->ResetVars.MaxProcessorResetCount ) { /* ** Log the reset in the ER Log. The log will be wiped out, but it's good to have ** the entry just in case something fails. */ - CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, + CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, CFE_PSP_RST_SUBTYPE_EXCEPTION, (char *)ReasonString, ContextPointer, ContextSize ); /* - ** Call the BSP reset routine to do a Poweron Reset + ** Call the BSP reset routine to do a Poweron Reset */ CFE_PSP_Restart(CFE_PSP_RST_TYPE_POWERON); @@ -1867,15 +1827,15 @@ void CFE_ES_ProcessCoreException(uint32 HostTaskId, const char *ReasonStrin /* ** Log the reset in the ER Log */ - CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_PROCESSOR, + CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_EXCEPTION, (char *)ReasonString, ContextPointer, ContextSize ); /* ** Need to do a processor reset - */ + */ CFE_PSP_Restart(CFE_PSP_RST_TYPE_PROCESSOR); } /* end if */ - + } /* End of CFE_ES_ProcessCoreException */ diff --git a/fsw/cfe-core/src/es/cfe_es_apps.c b/fsw/cfe-core/src/es/cfe_es_apps.c index 579d50eeb..0fe030b50 100644 --- a/fsw/cfe-core/src/es/cfe_es_apps.c +++ b/fsw/cfe-core/src/es/cfe_es_apps.c @@ -19,10 +19,10 @@ */ /* -** File: +** File: ** cfe_es_apps.c -** -** Purpose: +** +** Purpose: ** This file contains functions for starting cFE applications from a filesystem. ** ** References: @@ -33,13 +33,14 @@ ** */ -/* +/* ** Includes */ #include "private/cfe_private.h" #include "cfe_es.h" -#include "cfe_psp.h" +#include "cfe_psp.h" #include "cfe_es_global.h" +#include "cfe_es_task.h" #include "cfe_es_apps.h" #include "cfe_es_log.h" @@ -68,16 +69,16 @@ */ /* -** Name: +** Name: ** CFE_ES_StartApplications ** -** Purpose: +** Purpose: ** This routine loads/starts cFE applications. ** */ void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath ) { - char ES_AppLoadBuffer[ES_START_BUFF_SIZE]; /* A buffer of for a line in a file */ + char ES_AppLoadBuffer[ES_START_BUFF_SIZE]; /* A buffer of for a line in a file */ const char *TokenList[CFE_ES_STARTSCRIPT_MAX_TOKENS_PER_LINE]; uint32 NumTokens; uint32 BuffLen = 0; /* Length of the current buffer */ @@ -100,18 +101,18 @@ void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath ) if ( AppFile >= 0 ) { - CFE_ES_WriteToSysLog ("ES Startup: Opened ES App Startup file: %s\n", + CFE_ES_WriteToSysLog ("ES Startup: Opened ES App Startup file: %s\n", CFE_PLATFORM_ES_VOLATILE_STARTUP_FILE); FileOpened = true; } - else + else { CFE_ES_WriteToSysLog ("ES Startup: Cannot Open Volatile Startup file, Trying Nonvolatile.\n"); FileOpened = false; } } /* end if */ - + /* ** This if block covers two cases: A Power on reset, and a Processor reset when ** the startup file on the volatile file system could not be opened. @@ -128,25 +129,25 @@ void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath ) CFE_ES_WriteToSysLog ("ES Startup: Opened ES App Startup file: %s\n",StartFilePath); FileOpened = true; } - else + else { CFE_ES_WriteToSysLog ("ES Startup: Error, Can't Open ES App Startup file: %s EC = 0x%08X\n", StartFilePath, (unsigned int)AppFile ); FileOpened = false; } - + } - + /* ** If the file is opened in either the Nonvolatile or the Volatile disk, process it. */ if ( FileOpened == true) { memset(ES_AppLoadBuffer,0x0,ES_START_BUFF_SIZE); - BuffLen = 0; + BuffLen = 0; NumTokens = 0; TokenList[0] = ES_AppLoadBuffer; - + /* ** Parse the lines from the file. If it has an error ** or reaches EOF, then abort the loop. @@ -188,7 +189,7 @@ void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath ) else { LineTooLong = true; - } + } BuffLen++; if ( NumTokens < (CFE_ES_STARTSCRIPT_MAX_TOKENS_PER_LINE-1)) @@ -218,7 +219,7 @@ void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath ) else { if ( LineTooLong == true ) - { + { /* ** The was too big for the buffer */ @@ -250,7 +251,7 @@ void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath ) ** close the file */ OS_close(AppFile); - + } } @@ -308,30 +309,30 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens) { CFE_ES_WriteToSysLog("ES Startup: Loading file: %s, APP: %s\n", FileName, AppName); - + /* ** Validate Some parameters ** Exception action should be 0 ( Restart App ) or ** 1 ( Processor reset ). If it's non-zero, assume it means ** reset CPU. */ - if ( ExceptionAction > CFE_ES_ExceptionAction_RESTART_APP ) + if ( ExceptionAction > CFE_ES_ExceptionAction_RESTART_APP ) ExceptionAction = CFE_ES_ExceptionAction_PROC_RESTART; /* - ** Now create the application + ** Now create the application */ - CreateStatus = CFE_ES_AppCreate(&ApplicationId, FileName, - EntryPoint, AppName, (uint32) Priority, + CreateStatus = CFE_ES_AppCreate(&ApplicationId, FileName, + EntryPoint, AppName, (uint32) Priority, (uint32) StackSize, (uint32) ExceptionAction ); } else if(strcmp(EntryType,"CFE_LIB")==0) - { + { CFE_ES_WriteToSysLog("ES Startup: Loading shared library: %s\n",FileName); - + /* ** Now load the library */ - CreateStatus = CFE_ES_LoadLibrary(&ApplicationId, FileName, + CreateStatus = CFE_ES_LoadLibrary(&ApplicationId, FileName, EntryPoint, AppName); } @@ -573,7 +574,7 @@ int32 CFE_ES_AppCreate(uint32 *ApplicationIdPtr, ** Fill out the Task State info */ CFE_ES_Global.AppTable[i].ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - CFE_ES_Global.AppTable[i].ControlReq.AppTimer = 0; + CFE_ES_Global.AppTable[i].ControlReq.AppTimerMsec = 0; /* ** Create the primary task for the newly loaded task @@ -642,7 +643,7 @@ int32 CFE_ES_AppCreate(uint32 *ApplicationIdPtr, (unsigned int) ReturnCode); } } - + return(CFE_SUCCESS); } /* End If OS_TaskCreate */ @@ -928,67 +929,114 @@ int32 CFE_ES_LoadLibrary(uint32 *LibraryIdPtr, /* **--------------------------------------------------------------------------------------- -** Name: CFE_ES_ScanAppTable +** Name: CFE_ES_RunAppTableScan ** ** Purpose: This function scans the ES Application table and acts on the changes ** in application states. This is where the external cFE Applications are ** restarted, reloaded, or deleted. **--------------------------------------------------------------------------------------- */ -void CFE_ES_ScanAppTable(void) +bool CFE_ES_RunAppTableScan(uint32 ElapsedTime, void *Arg) { uint32 i; - + CFE_ES_AppRecord_t *AppPtr; + CFE_ES_AppTableScanState_t *State = (CFE_ES_AppTableScanState_t *)Arg; + + if (State->PendingAppStateChanges == 0) + { + /* + * If the command count changes, then a scan becomes due immediately. + */ + if (State->LastScanCommandCount == CFE_ES_TaskData.CommandCounter && + State->BackgroundScanTimer > ElapsedTime) + { + /* no action at this time, background scan is not due yet */ + State->BackgroundScanTimer -= ElapsedTime; + return false; + } + } + + /* + * Every time a scan is initiated (for any reason) + * reset the background scan timer to the full value, + * and take a snapshot of the the command counter. + */ + State->BackgroundScanTimer = CFE_PLATFORM_ES_APP_SCAN_RATE; + State->LastScanCommandCount = CFE_ES_TaskData.CommandCounter; + State->PendingAppStateChanges = 0; + + /* + * Scan needs to be done with the table locked, + * as these state changes need to be done atomically + * with respect to other tasks that also access/update + * the state. + */ + CFE_ES_LockSharedData(__func__,__LINE__); + /* ** Scan the ES Application table. Skip entries that are: - ** - Not in use, or + ** - Not in use, or ** - cFE Core apps, or ** - Currently running */ for ( i = 0; i < CFE_PLATFORM_ES_MAX_APPLICATIONS; i++ ) { - /* - * NOTE: The table is *NOT* locked at the time of this call. - * This is a race condition bug. - */ - if (CFE_ES_Global.AppTable[i].Type == CFE_ES_AppType_EXTERNAL) - { - - /* - ** Process the External cFE App according to it's state. - */ - if ( CFE_ES_Global.AppTable[i].AppState == CFE_ES_AppState_WAITING ) - { - /* - ** If the timeout value is zero, take the action to delete/restart/reload the app - */ - if ( CFE_ES_Global.AppTable[i].ControlReq.AppTimer <= 0 ) - { - CFE_ES_ProcessControlRequest(i); - } - else - { - #ifdef ES_APP_DEBUG - OS_printf("%d..\n",(int)CFE_ES_Global.AppTable[i].ControlReq.AppTimer); - #endif - CFE_ES_Global.AppTable[i].ControlReq.AppTimer --; - - } - - } - else if ( CFE_ES_Global.AppTable[i].AppState == CFE_ES_AppState_STOPPED ) - { - /* - ** The App is stopped and ready to get deleted/restarted/reloaded - */ - CFE_ES_ProcessControlRequest(i); - - } /* end if */ - - } /* end if */ + AppPtr = &CFE_ES_Global.AppTable[i]; + + if (AppPtr->Type == CFE_ES_AppType_EXTERNAL) + { + if (AppPtr->AppState > CFE_ES_AppState_RUNNING) + { + /* + * Increment the "pending" counter which reflects + * the number of apps that are in some phase of clean up. + */ + ++State->PendingAppStateChanges; + + /* + * Decrement the wait timer, if active. + * When the timeout value becomes zero, take the action to delete/restart/reload the app + */ + if ( AppPtr->ControlReq.AppTimerMsec > ElapsedTime ) + { + AppPtr->ControlReq.AppTimerMsec -= ElapsedTime; + } + else + { + AppPtr->ControlReq.AppTimerMsec = 0; + + /* + * Temporarily unlock the table, and invoke the + * control request function for this app. + */ + CFE_ES_UnlockSharedData(__func__,__LINE__); + CFE_ES_ProcessControlRequest(i); + CFE_ES_LockSharedData(__func__,__LINE__); + } /* end if */ + } + else if (AppPtr->AppState == CFE_ES_AppState_RUNNING && + AppPtr->ControlReq.AppControlRequest > CFE_ES_RunStatus_APP_RUN) + { + /* this happens after a command arrives to restart/reload/delete an app */ + /* switch to WAITING state, and set the timer for transition */ + AppPtr->AppState = CFE_ES_AppState_WAITING; + AppPtr->ControlReq.AppTimerMsec = CFE_PLATFORM_ES_APP_KILL_TIMEOUT * CFE_PLATFORM_ES_APP_SCAN_RATE; + } + + + } /* end if */ } /* end for loop */ + CFE_ES_UnlockSharedData(__func__,__LINE__); + + /* + * This state machine is considered active if there are any + * pending app state changes. Returning "true" will cause this job + * to be called from the background task at a faster interval. + */ + return (State->PendingAppStateChanges != 0); + } /* End Function */ @@ -1001,22 +1049,22 @@ void CFE_ES_ScanAppTable(void) */ void CFE_ES_ProcessControlRequest(uint32 AppID) { - + int32 Status; CFE_ES_AppStartParams_t AppStartParams; uint32 NewAppId; - + /* ** First get a copy of the Apps Start Parameters */ memcpy(&AppStartParams, &(CFE_ES_Global.AppTable[AppID].StartParams), sizeof(CFE_ES_AppStartParams_t)); - + /* ** Now, find out what kind of Application control is being requested */ switch ( CFE_ES_Global.AppTable[AppID].ControlReq.AppControlRequest ) { - + case CFE_ES_RunStatus_APP_EXIT: /* ** Kill the app, and dont restart it @@ -1025,16 +1073,16 @@ void CFE_ES_ProcessControlRequest(uint32 AppID) if ( Status == CFE_SUCCESS ) { - CFE_EVS_SendEvent(CFE_ES_EXIT_APP_INF_EID, CFE_EVS_EventType_INFORMATION, + CFE_EVS_SendEvent(CFE_ES_EXIT_APP_INF_EID, CFE_EVS_EventType_INFORMATION, "Exit Application %s Completed.",AppStartParams.Name); } else { - CFE_EVS_SendEvent(CFE_ES_EXIT_APP_ERR_EID, CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(CFE_ES_EXIT_APP_ERR_EID, CFE_EVS_EventType_ERROR, "Exit Application %s Failed: CleanUpApp Error 0x%08X.",AppStartParams.Name, (unsigned int)Status); } break; - + case CFE_ES_RunStatus_APP_ERROR: /* ** Kill the app, and dont restart it @@ -1042,17 +1090,17 @@ void CFE_ES_ProcessControlRequest(uint32 AppID) Status = CFE_ES_CleanUpApp(AppID); if ( Status == CFE_SUCCESS ) - { - CFE_EVS_SendEvent(CFE_ES_ERREXIT_APP_INF_EID, CFE_EVS_EventType_INFORMATION, + { + CFE_EVS_SendEvent(CFE_ES_ERREXIT_APP_INF_EID, CFE_EVS_EventType_INFORMATION, "Exit Application %s on Error Completed.",AppStartParams.Name); } else { - CFE_EVS_SendEvent(CFE_ES_ERREXIT_APP_ERR_EID, CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(CFE_ES_ERREXIT_APP_ERR_EID, CFE_EVS_EventType_ERROR, "Exit Application %s on Error Failed: CleanUpApp Error 0x%08X.",AppStartParams.Name, (unsigned int)Status); } break; - + case CFE_ES_RunStatus_SYS_DELETE: /* ** Kill the app, and dont restart it @@ -1060,17 +1108,17 @@ void CFE_ES_ProcessControlRequest(uint32 AppID) Status = CFE_ES_CleanUpApp(AppID); if ( Status == CFE_SUCCESS ) - { - CFE_EVS_SendEvent(CFE_ES_STOP_INF_EID, CFE_EVS_EventType_INFORMATION, + { + CFE_EVS_SendEvent(CFE_ES_STOP_INF_EID, CFE_EVS_EventType_INFORMATION, "Stop Application %s Completed.",AppStartParams.Name); } else { - CFE_EVS_SendEvent(CFE_ES_STOP_ERR3_EID, CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(CFE_ES_STOP_ERR3_EID, CFE_EVS_EventType_ERROR, "Stop Application %s Failed: CleanUpApp Error 0x%08X.",AppStartParams.Name, (unsigned int)Status); } break; - + case CFE_ES_RunStatus_SYS_RESTART: /* ** Kill the app @@ -1082,31 +1130,31 @@ void CFE_ES_ProcessControlRequest(uint32 AppID) /* ** And start it back up again */ - Status = CFE_ES_AppCreate(&NewAppId, (char *)AppStartParams.FileName, - (char *)AppStartParams.EntryPoint, - (char *)AppStartParams.Name, - AppStartParams.Priority, - AppStartParams.StackSize, + Status = CFE_ES_AppCreate(&NewAppId, (char *)AppStartParams.FileName, + (char *)AppStartParams.EntryPoint, + (char *)AppStartParams.Name, + AppStartParams.Priority, + AppStartParams.StackSize, AppStartParams.ExceptionAction); - + if ( Status == CFE_SUCCESS ) { - CFE_EVS_SendEvent(CFE_ES_RESTART_APP_INF_EID, CFE_EVS_EventType_INFORMATION, + CFE_EVS_SendEvent(CFE_ES_RESTART_APP_INF_EID, CFE_EVS_EventType_INFORMATION, "Restart Application %s Completed.", AppStartParams.Name); } else { - CFE_EVS_SendEvent(CFE_ES_RESTART_APP_ERR3_EID, CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(CFE_ES_RESTART_APP_ERR3_EID, CFE_EVS_EventType_ERROR, "Restart Application %s Failed: AppCreate Error 0x%08X.", AppStartParams.Name, (unsigned int)Status); } } else { - CFE_EVS_SendEvent(CFE_ES_RESTART_APP_ERR4_EID, CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(CFE_ES_RESTART_APP_ERR4_EID, CFE_EVS_EventType_ERROR, "Restart Application %s Failed: CleanUpApp Error 0x%08X.", AppStartParams.Name, (unsigned int)Status); } break; - + case CFE_ES_RunStatus_SYS_RELOAD: /* ** Kill the app @@ -1118,36 +1166,36 @@ void CFE_ES_ProcessControlRequest(uint32 AppID) /* ** And start it back up again */ - Status = CFE_ES_AppCreate(&NewAppId, (char *)AppStartParams.FileName, - (char *)AppStartParams.EntryPoint, - (char *)AppStartParams.Name, - AppStartParams.Priority, - AppStartParams.StackSize, + Status = CFE_ES_AppCreate(&NewAppId, (char *)AppStartParams.FileName, + (char *)AppStartParams.EntryPoint, + (char *)AppStartParams.Name, + AppStartParams.Priority, + AppStartParams.StackSize, AppStartParams.ExceptionAction); if ( Status == CFE_SUCCESS ) { - CFE_EVS_SendEvent(CFE_ES_RELOAD_APP_INF_EID, CFE_EVS_EventType_INFORMATION, + CFE_EVS_SendEvent(CFE_ES_RELOAD_APP_INF_EID, CFE_EVS_EventType_INFORMATION, "Reload Application %s Completed.", AppStartParams.Name); } else { - CFE_EVS_SendEvent(CFE_ES_RELOAD_APP_ERR3_EID, CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(CFE_ES_RELOAD_APP_ERR3_EID, CFE_EVS_EventType_ERROR, "Reload Application %s Failed: AppCreate Error 0x%08X.", AppStartParams.Name, (unsigned int)Status); } } else { - CFE_EVS_SendEvent(CFE_ES_RELOAD_APP_ERR4_EID, CFE_EVS_EventType_ERROR, + CFE_EVS_SendEvent(CFE_ES_RELOAD_APP_ERR4_EID, CFE_EVS_EventType_ERROR, "Reload Application %s Failed: CleanUpApp Error 0x%08X.", AppStartParams.Name, (unsigned int)Status); } - + break; - + case CFE_ES_RunStatus_SYS_EXCEPTION: - - CFE_EVS_SendEvent(CFE_ES_PCR_ERR1_EID, CFE_EVS_EventType_ERROR, + + CFE_EVS_SendEvent(CFE_ES_PCR_ERR1_EID, CFE_EVS_EventType_ERROR, "ES_ProcControlReq: Invalid State (EXCEPTION) Application %s.", - AppStartParams.Name); + AppStartParams.Name); /* * Bug #58: This message/event keeps repeating itself indefinitely. * @@ -1156,10 +1204,10 @@ void CFE_ES_ProcessControlRequest(uint32 AppID) */ CFE_ES_Global.AppTable[AppID].ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; break; - + default: - - CFE_EVS_SendEvent(CFE_ES_PCR_ERR2_EID, CFE_EVS_EventType_ERROR, + + CFE_EVS_SendEvent(CFE_ES_PCR_ERR2_EID, CFE_EVS_EventType_ERROR, "ES_ProcControlReq: Unknown State ( %d ) Application %s.", (int)CFE_ES_Global.AppTable[AppID].ControlReq.AppControlRequest, AppStartParams.Name); @@ -1171,9 +1219,9 @@ void CFE_ES_ProcessControlRequest(uint32 AppID) */ CFE_ES_Global.AppTable[AppID].ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; break; - - } - + + } + } /* End Function */ /* @@ -1194,23 +1242,23 @@ int32 CFE_ES_CleanUpApp(uint32 AppId) OS_printf("------------- Starting App Cleanup: AppID = %d -----------\n",AppId); CFE_ES_ListResourcesDebug(); #endif - + /* ** Call the Table Clean up function */ #ifndef EXCLUDE_CFE_TBL CFE_TBL_CleanUpApp(AppId); -#endif +#endif /* ** Call the Software Bus clean up function */ CFE_SB_CleanUpApp(AppId); - + /* ** Call the TIME Clean up function */ CFE_TIME_CleanUpApp(AppId); - + /* ** Call the EVS Clean up function */ @@ -1220,17 +1268,17 @@ int32 CFE_ES_CleanUpApp(uint32 AppId) CFE_ES_WriteToSysLog("CFE_ES_CleanUpApp: Call to CFE_EVS_CleanUpApp returned Error: 0x%08X\n",(unsigned int)Status); ReturnCode = CFE_ES_APP_CLEANUP_ERR; } - - + + /* ** Delete the ES Resources */ CFE_ES_LockSharedData(__func__,__LINE__); - + /* ** Get Main Task ID */ - MainTaskId = CFE_ES_Global.AppTable[AppId].TaskInfo.MainTaskId; + MainTaskId = CFE_ES_Global.AppTable[AppId].TaskInfo.MainTaskId; /* ** Delete all of the OS resources, close files, and delete the main task @@ -1241,7 +1289,7 @@ int32 CFE_ES_CleanUpApp(uint32 AppId) CFE_ES_SysLogWrite_Unsync("CFE_ES_CleanUpApp: CleanUpTaskResources for Task ID:%d returned Error: 0x%08X\n", (int)MainTaskId, (unsigned int)Status); ReturnCode = CFE_ES_APP_CLEANUP_ERR; - + } /* @@ -1253,7 +1301,7 @@ int32 CFE_ES_CleanUpApp(uint32 AppId) if ((CFE_ES_Global.TaskTable[i].RecordUsed == true) && (CFE_ES_Global.TaskTable[i].AppId == AppId) && (CFE_ES_Global.TaskTable[i].TaskId != MainTaskId)) - { + { Status = CFE_ES_CleanupTaskResources(CFE_ES_Global.TaskTable[i].TaskId); if ( Status != CFE_SUCCESS ) { @@ -1281,19 +1329,19 @@ int32 CFE_ES_CleanUpApp(uint32 AppId) } CFE_ES_Global.RegisteredExternalApps--; } - + CFE_ES_Global.AppTable[AppId].AppState = CFE_ES_AppState_UNDEFINED; - #ifdef ES_APP_DEBUG - OS_TaskDelay(1000); + #ifdef ES_APP_DEBUG + OS_TaskDelay(1000); CFE_ES_ListResourcesDebug(); printf("--------- Finished CFE_ES_CleanUpApp-------------\n"); - #endif + #endif CFE_ES_UnlockSharedData(__func__,__LINE__); - + return(ReturnCode); - + } /* end function */ @@ -1540,9 +1588,9 @@ void CFE_ES_GetAppInfoInternal(uint32 AppId, CFE_ES_AppInfo_t *AppInfoPtr ) int32 ReturnCode; OS_module_prop_t ModuleInfo; uint32 TaskIndex; - uint32 i; - - + uint32 i; + + CFE_ES_LockSharedData(__func__,__LINE__); AppInfoPtr->AppId = AppId; @@ -1556,29 +1604,29 @@ void CFE_ES_GetAppInfoInternal(uint32 AppId, CFE_ES_AppInfo_t *AppInfoPtr ) CFE_ES_Global.AppTable[AppId].StartParams.EntryPoint, sizeof(AppInfoPtr->EntryPoint) - 1); AppInfoPtr->EntryPoint[sizeof(AppInfoPtr->EntryPoint) - 1] = '\0'; - + strncpy((char *)AppInfoPtr->FileName, (char *)CFE_ES_Global.AppTable[AppId].StartParams.FileName, sizeof(AppInfoPtr->FileName) - 1); AppInfoPtr->FileName[sizeof(AppInfoPtr->FileName) - 1] = '\0'; - + AppInfoPtr->ModuleId = CFE_ES_Global.AppTable[AppId].StartParams.ModuleId; AppInfoPtr->StackSize = CFE_ES_Global.AppTable[AppId].StartParams.StackSize; CFE_SB_SET_MEMADDR(AppInfoPtr->StartAddress, CFE_ES_Global.AppTable[AppId].StartParams.StartAddress); AppInfoPtr->ExceptionAction = CFE_ES_Global.AppTable[AppId].StartParams.ExceptionAction; AppInfoPtr->Priority = CFE_ES_Global.AppTable[AppId].StartParams.Priority; - - AppInfoPtr->MainTaskId = CFE_ES_Global.AppTable[AppId].TaskInfo.MainTaskId; + + AppInfoPtr->MainTaskId = CFE_ES_Global.AppTable[AppId].TaskInfo.MainTaskId; strncpy((char *)AppInfoPtr->MainTaskName, (char *)CFE_ES_Global.AppTable[AppId].TaskInfo.MainTaskName, sizeof(AppInfoPtr->MainTaskName) - 1); AppInfoPtr->MainTaskName[sizeof(AppInfoPtr->MainTaskName) - 1] = '\0'; - + /* ** Calculate the number of child tasks */ - AppInfoPtr->NumOfChildTasks = 0; + AppInfoPtr->NumOfChildTasks = 0; for (i=0; iMainTaskId ) { AppInfoPtr->NumOfChildTasks++; @@ -1593,7 +1641,7 @@ void CFE_ES_GetAppInfoInternal(uint32 AppId, CFE_ES_AppInfo_t *AppInfoPtr ) AppInfoPtr->ExecutionCounter = CFE_ES_Global.TaskTable[TaskIndex].ExecutionCounter; } - /* + /* ** Get the address information from the OSAL */ ReturnCode = OS_ModuleInfo ( AppInfoPtr->ModuleId, &ModuleInfo ); @@ -1608,7 +1656,7 @@ void CFE_ES_GetAppInfoInternal(uint32 AppId, CFE_ES_AppInfo_t *AppInfoPtr ) CFE_SB_SET_MEMADDR(AppInfoPtr->DataSize, ModuleInfo.addr.data_size); CFE_SB_SET_MEMADDR(AppInfoPtr->BSSAddress, ModuleInfo.addr.bss_address); CFE_SB_SET_MEMADDR(AppInfoPtr->BSSSize, ModuleInfo.addr.bss_size); - } + } else { AppInfoPtr->AddressesAreValid = false; @@ -1619,7 +1667,7 @@ void CFE_ES_GetAppInfoInternal(uint32 AppId, CFE_ES_AppInfo_t *AppInfoPtr ) AppInfoPtr->BSSAddress = 0; AppInfoPtr->BSSSize = 0; } - + CFE_ES_UnlockSharedData(__func__,__LINE__); diff --git a/fsw/cfe-core/src/es/cfe_es_apps.h b/fsw/cfe-core/src/es/cfe_es_apps.h index fe1715c84..b9a2254c4 100644 --- a/fsw/cfe-core/src/es/cfe_es_apps.h +++ b/fsw/cfe-core/src/es/cfe_es_apps.h @@ -19,7 +19,7 @@ */ /* -** File: +** File: ** cfe_es_apps.h ** ** Purpose: @@ -58,8 +58,8 @@ */ typedef struct { - uint32 AppControlRequest; /* What the App should be doing next */ - int32 AppTimer; /* Countdown timer for killing an app */ + uint32 AppControlRequest; /* What the App should be doing next */ + int32 AppTimerMsec; /* Countdown timer for killing an app, in milliseconds */ } CFE_ES_ControlReq_t; @@ -80,13 +80,13 @@ typedef struct uint16 ExceptionAction; uint16 Priority; - + } CFE_ES_AppStartParams_t; /* ** CFE_ES_MainTaskInfo_t is a structure of information about the main ** task and child tasks in a cFE application. This structure is just used in the -** cFE_ES_AppRecord_t structure. +** cFE_ES_AppRecord_t structure. */ typedef struct { @@ -106,7 +106,7 @@ typedef struct CFE_ES_AppStartParams_t StartParams; /* The start parameters for an App */ CFE_ES_ControlReq_t ControlReq; /* The Control Request Record for External cFE Apps */ CFE_ES_MainTaskInfo_t TaskInfo; /* Information about the Tasks */ - + } CFE_ES_AppRecord_t; @@ -121,8 +121,8 @@ typedef struct uint32 TaskId; /* Task ID */ uint32 ExecutionCounter; /* The execution counter for the Child task */ char TaskName[OS_MAX_API_NAME]; /* Task Name */ - - + + } CFE_ES_TaskRecord_t; /* @@ -135,6 +135,19 @@ typedef struct char LibName[OS_MAX_API_NAME]; /* Library Name */ } CFE_ES_LibRecord_t; +/* +** CFE_ES_AppTableScanState_t is an internal structure used to keep state of +** the background app table scan/cleanup process +*/ +typedef struct +{ + uint32 PendingAppStateChanges; + uint32 BackgroundScanTimer; + uint8 LastScanCommandCount; +} CFE_ES_AppTableScanState_t; + + + /*****************************************************************************/ /* ** Function prototypes @@ -150,13 +163,6 @@ void CFE_ES_StartApplications(uint32 ResetType, const char *StartFilePath ); */ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens); -/* - * Internal function to set the state of an app - * All state changes should go through this function rather than directly writing to the control block - */ -void CFE_ES_SetAppState(uint32 AppID, uint32 TargetState); - - /* ** Internal function to create/start a new cFE app ** based on the parameters passed in @@ -190,7 +196,7 @@ int32 CFE_ES_AppDumpAllInfo(void); /* ** Scan the Application Table for actions to take */ -void CFE_ES_ScanAppTable(void); +bool CFE_ES_RunAppTableScan(uint32 ElapsedTime, void *Arg); /* ** Perform the requested control action for an application @@ -208,7 +214,7 @@ int32 CFE_ES_CleanUpApp(uint32 AppId); int32 CFE_ES_CleanupTaskResources(uint32 TaskId); /* -** Debug function to print out resource utilization +** Debug function to print out resource utilization */ int32 CFE_ES_ListResourcesDebug(void); diff --git a/fsw/cfe-core/src/es/cfe_es_backgroundtask.c b/fsw/cfe-core/src/es/cfe_es_backgroundtask.c index 174c2952c..5582fa8da 100644 --- a/fsw/cfe-core/src/es/cfe_es_backgroundtask.c +++ b/fsw/cfe-core/src/es/cfe_es_backgroundtask.c @@ -71,6 +71,12 @@ typedef struct */ const CFE_ES_BackgroundJobEntry_t CFE_ES_BACKGROUND_JOB_TABLE[] = { + { /* ES app table background scan */ + .RunFunc = CFE_ES_RunAppTableScan, + .JobArg = &CFE_ES_TaskData.BackgroundAppScanState, + .ActivePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE / 4, + .IdlePeriod = CFE_PLATFORM_ES_APP_SCAN_RATE + }, { /* Performance Log Data Dump to file */ .RunFunc = CFE_ES_RunPerfLogDump, .JobArg = &CFE_ES_TaskData.BackgroundPerfDumpState, diff --git a/fsw/cfe-core/src/es/cfe_es_task.c b/fsw/cfe-core/src/es/cfe_es_task.c index bb5dc5fdf..ce216dad1 100644 --- a/fsw/cfe-core/src/es/cfe_es_task.c +++ b/fsw/cfe-core/src/es/cfe_es_task.c @@ -80,7 +80,6 @@ CFE_ES_TaskData_t CFE_ES_TaskData; void CFE_ES_TaskMain(void) { int32 Status; - uint32 TimeOut = CFE_PLATFORM_ES_APP_SCAN_RATE; uint32 AppRunStatus = CFE_ES_RunStatus_APP_RUN; @@ -139,21 +138,14 @@ void CFE_ES_TaskMain(void) */ Status = CFE_SB_RcvMsg(&CFE_ES_TaskData.MsgPtr, CFE_ES_TaskData.CmdPipe, - TimeOut); + CFE_SB_PEND_FOREVER); /* ** Performance Time Stamp Entry */ CFE_ES_PerfLogEntry(CFE_MISSION_ES_MAIN_PERF_ID); - /* - ** Scan the App table for Application Deletion requests - */ - if ( Status == CFE_SB_TIME_OUT ) - { - CFE_ES_ScanAppTable(); - } - else if (Status == CFE_SUCCESS) + if (Status == CFE_SUCCESS) { /* ** Process Software Bus message. @@ -161,9 +153,10 @@ void CFE_ES_TaskMain(void) CFE_ES_TaskPipe(CFE_ES_TaskData.MsgPtr); /* - ** Scan the App Table for changes after processing a command - */ - CFE_ES_ScanAppTable(); + * Wake up the background task, which includes the + * scanning of the ES app table for entries that may need cleanup + */ + CFE_ES_BackgroundWakeup(); } else { diff --git a/fsw/cfe-core/src/es/cfe_es_task.h b/fsw/cfe-core/src/es/cfe_es_task.h index 78b933261..d90a11a42 100644 --- a/fsw/cfe-core/src/es/cfe_es_task.h +++ b/fsw/cfe-core/src/es/cfe_es_task.h @@ -113,6 +113,11 @@ typedef struct */ CFE_ES_PerfDumpGlobal_t BackgroundPerfDumpState; + /* + * Persistent state data associated with background app table scans + */ + CFE_ES_AppTableScanState_t BackgroundAppScanState; + } CFE_ES_TaskData_t; /* diff --git a/fsw/cfe-core/src/inc/cfe_es_extern_typedefs.h b/fsw/cfe-core/src/inc/cfe_es_extern_typedefs.h index b84f3a143..2a5ce3f28 100644 --- a/fsw/cfe-core/src/inc/cfe_es_extern_typedefs.h +++ b/fsw/cfe-core/src/inc/cfe_es_extern_typedefs.h @@ -116,6 +116,10 @@ typedef uint8 CFE_ES_AppType_Enum_t; */ enum CFE_ES_RunStatus { + /** + * @brief Reserved value, should not be used + */ + CFE_ES_RunStatus_UNDEFINED = 0, /** * @brief Indicates that the Application should continue to run @@ -160,7 +164,13 @@ enum CFE_ES_RunStatus /** * @brief Indicates that the Core Application had a runtime failure */ - CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR = 9 + CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR = 9, + + /** + * @brief Reserved value, marker for the maximum state + */ + CFE_ES_RunStatus_MAX + }; /** @@ -211,7 +221,12 @@ enum CFE_ES_SystemState /** * @brief reserved for future use, all apps would be STOPPED */ - CFE_ES_SystemState_SHUTDOWN = 6 + CFE_ES_SystemState_SHUTDOWN = 6, + + /** + * @brief Reserved value, marker for the maximum state + */ + CFE_ES_SystemState_MAX }; /** diff --git a/fsw/cfe-core/unit-test/es_UT.c b/fsw/cfe-core/unit-test/es_UT.c index 065f3a061..b8a765330 100644 --- a/fsw/cfe-core/unit-test/es_UT.c +++ b/fsw/cfe-core/unit-test/es_UT.c @@ -1324,13 +1324,14 @@ void TestApps(void) CFE_ES_Global.AppTable[Id].Type = CFE_ES_AppType_EXTERNAL; CFE_ES_Global.AppTable[Id].AppState = CFE_ES_AppState_WAITING; CFE_ES_Global.AppTable[Id].ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - CFE_ES_Global.AppTable[Id].ControlReq.AppTimer = 0; - CFE_ES_ScanAppTable(); + CFE_ES_Global.AppTable[Id].ControlReq.AppTimerMsec = 0; + memset(&CFE_ES_TaskData.BackgroundAppScanState, 0, sizeof(CFE_ES_TaskData.BackgroundAppScanState)); + CFE_ES_RunAppTableScan(0, &CFE_ES_TaskData.BackgroundAppScanState); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID) && - CFE_ES_Global.AppTable[Id].ControlReq.AppTimer == 0 && + CFE_ES_Global.AppTable[Id].ControlReq.AppTimerMsec == 0 && CFE_ES_Global.AppTable[Id].ControlReq.AppControlRequest == CFE_ES_RunStatus_SYS_DELETE, - "CFE_ES_ScanAppTable", + "CFE_ES_RunAppTableScan", "Waiting; process control request"); /* Test scanning and acting on the application table where the timer @@ -1342,12 +1343,12 @@ void TestApps(void) CFE_ES_Global.AppTable[Id].Type = CFE_ES_AppType_EXTERNAL; CFE_ES_Global.AppTable[Id].AppState = CFE_ES_AppState_WAITING; CFE_ES_Global.AppTable[Id].ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; - CFE_ES_Global.AppTable[Id].ControlReq.AppTimer = 5; - CFE_ES_ScanAppTable(); + CFE_ES_Global.AppTable[Id].ControlReq.AppTimerMsec = 5000; + CFE_ES_RunAppTableScan(1000, &CFE_ES_TaskData.BackgroundAppScanState); UT_Report(__FILE__, __LINE__, - CFE_ES_Global.AppTable[Id].ControlReq.AppTimer == 4 && + CFE_ES_Global.AppTable[Id].ControlReq.AppTimerMsec == 4000 && CFE_ES_Global.AppTable[Id].ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_EXIT, - "CFE_ES_ScanAppTable", + "CFE_ES_RunAppTableScan", "Decrement timer"); /* Test scanning and acting on the application table where the application @@ -1359,13 +1360,13 @@ void TestApps(void) CFE_ES_Global.AppTable[Id].Type = CFE_ES_AppType_EXTERNAL; CFE_ES_Global.AppTable[Id].AppState = CFE_ES_AppState_STOPPED; CFE_ES_Global.AppTable[Id].ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - CFE_ES_Global.AppTable[Id].ControlReq.AppTimer = 0; - CFE_ES_ScanAppTable(); + CFE_ES_Global.AppTable[Id].ControlReq.AppTimerMsec = 0; + CFE_ES_RunAppTableScan(0, &CFE_ES_TaskData.BackgroundAppScanState); UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID) && CFE_ES_Global.AppTable[Id].ControlReq.AppControlRequest == CFE_ES_RunStatus_SYS_DELETE && - CFE_ES_Global.AppTable[Id].ControlReq.AppTimer == 0, - "CFE_ES_ScanAppTable", + CFE_ES_Global.AppTable[Id].ControlReq.AppTimerMsec == 0, + "CFE_ES_RunAppTableScan", "Stopped; process control request"); /* Test scanning and acting on the application table where the application @@ -1376,13 +1377,13 @@ void TestApps(void) Id = ES_UT_OSALID_TO_ARRAYIDX(TestObjId); CFE_ES_Global.AppTable[Id].Type = CFE_ES_AppType_EXTERNAL; CFE_ES_Global.AppTable[Id].AppState = CFE_ES_AppState_EARLY_INIT; - CFE_ES_Global.AppTable[Id].ControlReq.AppTimer = 5; + CFE_ES_Global.AppTable[Id].ControlReq.AppTimerMsec = 5000; - CFE_ES_ScanAppTable(); + CFE_ES_RunAppTableScan(0, &CFE_ES_TaskData.BackgroundAppScanState); UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0 && - CFE_ES_Global.AppTable[Id].ControlReq.AppTimer == 5, - "CFE_ES_ScanAppTable", + CFE_ES_Global.AppTable[Id].ControlReq.AppTimerMsec == 5000, + "CFE_ES_RunAppTableScan", "Initializing; process control request"); /* Test a control action request on an application with an @@ -1968,12 +1969,12 @@ void TestApps(void) Id = ES_UT_OSALID_TO_ARRAYIDX(TestObjId); CFE_ES_Global.AppTable[Id].Type = CFE_ES_AppType_CORE; CFE_ES_Global.AppTable[Id].AppState = CFE_ES_AppState_WAITING; - CFE_ES_Global.AppTable[Id].ControlReq.AppTimer = 0; - CFE_ES_ScanAppTable(); + CFE_ES_Global.AppTable[Id].ControlReq.AppTimerMsec = 0; + CFE_ES_RunAppTableScan(0, &CFE_ES_TaskData.BackgroundAppScanState); UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0 && - CFE_ES_Global.AppTable[Id].ControlReq.AppTimer == 0, - "CFE_ES_ScanAppTable", + CFE_ES_Global.AppTable[Id].ControlReq.AppTimerMsec == 0, + "CFE_ES_RunAppTableScan", "Waiting; process control request"); CFE_ES_Global.TaskTable[Id].RecordUsed = false; @@ -1985,12 +1986,12 @@ void TestApps(void) Id = ES_UT_OSALID_TO_ARRAYIDX(TestObjId); CFE_ES_Global.AppTable[Id].Type = CFE_ES_AppType_EXTERNAL; CFE_ES_Global.AppTable[Id].AppState = CFE_ES_AppState_RUNNING; - CFE_ES_Global.AppTable[Id].ControlReq.AppTimer = 0; - CFE_ES_ScanAppTable(); + CFE_ES_Global.AppTable[Id].ControlReq.AppTimerMsec = 0; + CFE_ES_RunAppTableScan(0, &CFE_ES_TaskData.BackgroundAppScanState); UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0 && - CFE_ES_Global.AppTable[Id].ControlReq.AppTimer == 0, - "CFE_ES_ScanAppTable", + CFE_ES_Global.AppTable[Id].ControlReq.AppTimerMsec == 0, + "CFE_ES_RunAppTableScan", "Running; process control request"); CFE_ES_Global.TaskTable[Id].RecordUsed = false; @@ -4467,12 +4468,14 @@ void TestAPI(void) /* Test exiting an app with an exit error */ /* Note - this exit code of 1000 is invalid, which causes - * an extra message to be logged in syslog about this */ + * an extra message to be logged in syslog about this. This + * should also be stored in the AppControlRequest as APP_ERROR. */ ES_ResetUnitTest(); OS_TaskCreate(&TestObjId, "UT", NULL, NULL, 0, 0, 0); Id = ES_UT_OSALID_TO_ARRAYIDX(TestObjId); CFE_ES_Global.TaskTable[Id].AppId = Id; CFE_ES_Global.TaskTable[Id].RecordUsed = true; + CFE_ES_Global.AppTable[Id].ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; CFE_ES_Global.AppTable[Id].Type = CFE_ES_AppType_EXTERNAL; CFE_ES_Global.AppTable[Id].AppState = CFE_ES_AppState_STOPPED; CFE_ES_Global.AppTable[Id].Type = CFE_ES_AppType_CORE; @@ -4482,6 +4485,10 @@ void TestAPI(void) UT_GetStubCount(UT_KEY(OS_printf)) == 2, "CFE_ES_ExitApp", "Application exit error"); + UtAssert_True(CFE_ES_Global.AppTable[Id].ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_ERROR, + "CFE_ES_ExitApp - AppControlRequest (%u) == CFE_ES_RunStatus_APP_ERROR (%u)", + (unsigned int)CFE_ES_Global.AppTable[Id].ControlReq.AppControlRequest, + (unsigned int)CFE_ES_RunStatus_APP_ERROR); #if 0 /* Can't cover this path since it contains a while(1) (i.e., @@ -4548,9 +4555,9 @@ void TestAPI(void) CFE_ES_Global.AppTable[Id].AppState = CFE_ES_AppState_RUNNING; CFE_ES_Global.TaskTable[Id].RecordUsed = false; CFE_ES_Global.TaskTable[Id].AppId = Id; - RunStatus = CFE_ES_RunStatus_APP_EXIT; + RunStatus = CFE_ES_RunStatus_APP_RUN; CFE_ES_Global.AppTable[Id].ControlReq.AppControlRequest = - CFE_ES_RunStatus_APP_EXIT; + CFE_ES_RunStatus_APP_RUN; UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", @@ -4571,6 +4578,20 @@ void TestAPI(void) "CFE_ES_RunLoop", "Invalid run status"); + /* Test run loop with a NULL run status */ + ES_ResetUnitTest(); + OS_TaskCreate(&TestObjId, "UT", NULL, NULL, 0, 0, 0); + Id = ES_UT_OSALID_TO_ARRAYIDX(TestObjId); + CFE_ES_Global.AppTable[Id].AppState = CFE_ES_AppState_RUNNING; + CFE_ES_Global.TaskTable[Id].RecordUsed = true; + CFE_ES_Global.TaskTable[Id].AppId = Id; + CFE_ES_Global.AppTable[Id].ControlReq.AppControlRequest = + CFE_ES_RunStatus_APP_RUN; + UT_Report(__FILE__, __LINE__, + CFE_ES_RunLoop(NULL), + "CFE_ES_RunLoop", + "Nominal, NULL output pointer"); + /* Test run loop with startup sync code */ ES_ResetUnitTest(); OS_TaskCreate(&TestObjId, "UT", NULL, NULL, 0, 0, 0); From 79e4bfbc2ec79fc996db2c5d71e74607b5a6b4f8 Mon Sep 17 00:00:00 2001 From: dmknutsen Date: Mon, 13 Apr 2020 10:58:54 -0400 Subject: [PATCH 07/15] Fixes #494, Updates CFE_SB_GetLastSenderID to check if message has been sent on pipe --- fsw/cfe-core/src/inc/cfe_error.h | 10 +++++ fsw/cfe-core/src/sb/cfe_sb_api.c | 20 +++++++--- fsw/cfe-core/unit-test/sb_UT.c | 67 +++++++++++++++++++++++++++++--- fsw/cfe-core/unit-test/sb_UT.h | 21 ++++++++++ 4 files changed, 107 insertions(+), 11 deletions(-) diff --git a/fsw/cfe-core/src/inc/cfe_error.h b/fsw/cfe-core/src/inc/cfe_error.h index 03f4e1ea3..066f6353b 100644 --- a/fsw/cfe-core/src/inc/cfe_error.h +++ b/fsw/cfe-core/src/inc/cfe_error.h @@ -979,6 +979,16 @@ #define CFE_SB_BUFFER_INVALID ((int32)0xca00000e) +/** + * @brief No Message Recieved + * + * When trying to determine the last senders ID, this return + * value indicates that there was not a message recived on the pipe. + * + */ +#define CFE_SB_NO_MSG_RECV ((int32)0xca00000f) + + /** * @brief Not Implemented * diff --git a/fsw/cfe-core/src/sb/cfe_sb_api.c b/fsw/cfe-core/src/sb/cfe_sb_api.c index 5495c1784..ad668533a 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_api.c +++ b/fsw/cfe-core/src/sb/cfe_sb_api.c @@ -1651,12 +1651,20 @@ uint32 CFE_SB_GetLastSenderId(CFE_SB_SenderId_t **Ptr,CFE_SB_PipeId_t PipeId) /* Get ptr to buffer descriptor for the last msg received on the given pipe */ Ptr2BufDescriptor = CFE_SB.PipeTbl[PipeId].CurrentBuff; - /* Set the receivers pointer to the adr of 'Sender' struct in buf descriptor */ - *Ptr = (CFE_SB_SenderId_t *) &Ptr2BufDescriptor -> Sender; - - CFE_SB_UnlockSharedData(__func__,__LINE__); - - return CFE_SUCCESS; + if ( Ptr2BufDescriptor == NULL ) + { + *Ptr = NULL; + CFE_SB.PipeTbl[PipeId].LastSender = CFE_SB_INVALID_MSG_ID; + CFE_SB_UnlockSharedData(__func__,__LINE__); + return CFE_SB_NO_MSG_RECV; + } + else + { + /* Set the receivers pointer to the adr of 'Sender' struct in buf descriptor */ + *Ptr = (CFE_SB_SenderId_t *) &Ptr2BufDescriptor -> Sender; + CFE_SB_UnlockSharedData(__func__,__LINE__); + return CFE_SUCCESS; + } }/* end CFE_SB_GetLastSenderId */ diff --git a/fsw/cfe-core/unit-test/sb_UT.c b/fsw/cfe-core/unit-test/sb_UT.c index 2c1f4cd7a..ac334f6d2 100644 --- a/fsw/cfe-core/unit-test/sb_UT.c +++ b/fsw/cfe-core/unit-test/sb_UT.c @@ -7531,6 +7531,7 @@ void Test_RcvMsg_API(void) Test_RcvMsg_GetLastSenderNull(); Test_RcvMsg_GetLastSenderInvalidPipe(); Test_RcvMsg_GetLastSenderInvalidCaller(); + Test_RcvMsg_GetLastSenderNoValidSender(); Test_RcvMsg_GetLastSenderSuccess(); Test_RcvMsg_Timeout(); Test_RcvMsg_PipeReadError(); @@ -7876,10 +7877,8 @@ void Test_RcvMsg_GetLastSenderInvalidCaller(void) "GetLastSenderId invalid caller test"); } /* end Test_RcvMsg_GetLastSenderInvalidCaller */ -/* -** Test successful receive last message request -*/ -void Test_RcvMsg_GetLastSenderSuccess(void) + +void Test_RcvMsg_GetLastSenderNoValidSender(void) { CFE_SB_PipeId_t PipeId; CFE_SB_SenderId_t *GLSPtr; @@ -7888,12 +7887,70 @@ void Test_RcvMsg_GetLastSenderSuccess(void) int32 ActRtn; int32 TestStat = CFE_PASS; +#ifdef UT_VERBOSE + UT_Text("Begin Test for GetLastSender No Valid Sender"); +#endif + + SB_ResetUnitTest(); + CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe"); + ActRtn = CFE_SB_GetLastSenderId(&GLSPtr, PipeId); + ExpRtn = CFE_SB_NO_MSG_RECV; + + if (ActRtn != ExpRtn) + { + snprintf(cMsg, UT_MAX_MESSAGE_LENGTH, + "Unexpected return in GetLastSenderId No Valid Sender test, " + "exp=0x%lx, act=0x%lx", + (unsigned long) ExpRtn, (unsigned long) ActRtn); + UT_Text(cMsg); + TestStat = CFE_FAIL; + } + + ExpRtn = 1; + ActRtn = UT_GetNumEventsSent(); + + if (ActRtn != ExpRtn) + { + snprintf(cMsg, UT_MAX_MESSAGE_LENGTH, + "Unexpected rtn from UT_GetNumEventsSent, exp=%ld, act=%ld", + (long) ExpRtn, (long) ActRtn); + UT_Text(cMsg); + TestStat = CFE_FAIL; + } + + CFE_SB_DeletePipe(PipeId); + UT_Report(__FILE__, __LINE__, + TestStat, "Test_RcvMsg_API", + "GetLastSenderId No Valid Sender test"); + +} /* end Test_RcvMsg_GetLastSenderNoValidSender */ + + +/* +** Test successful receive last message request +*/ +void Test_RcvMsg_GetLastSenderSuccess(void) +{ + CFE_SB_PipeId_t PipeId; + CFE_SB_SenderId_t *GLSPtr; + SB_UT_Test_Tlm_t TlmPkt; + CFE_SB_MsgPtr_t TlmPktPtr = (CFE_SB_MsgPtr_t) &TlmPkt; + CFE_SB_MsgPtr_t PtrToMsg; + uint32 PipeDepth = 10; + int32 ExpRtn; + int32 ActRtn; + int32 TestStat = CFE_PASS; + #ifdef UT_VERBOSE UT_Text("Begin Test for GetLastSender Success"); #endif SB_ResetUnitTest(); CFE_SB_CreatePipe(&PipeId, PipeDepth, "RcvMsgTestPipe"); + CFE_SB_InitMsg(&TlmPkt, SB_UT_TLM_MID, sizeof(TlmPkt), true); + CFE_SB_Subscribe(SB_UT_TLM_MID, PipeId); + CFE_SB_SendMsg(TlmPktPtr); + CFE_SB_RcvMsg(&PtrToMsg, PipeId,CFE_SB_PEND_FOREVER); ActRtn = CFE_SB_GetLastSenderId(&GLSPtr, PipeId); ExpRtn = CFE_SUCCESS; @@ -7907,7 +7964,7 @@ void Test_RcvMsg_GetLastSenderSuccess(void) TestStat = CFE_FAIL; } - ExpRtn = 1; + ExpRtn = 3; ActRtn = UT_GetNumEventsSent(); if (ActRtn != ExpRtn) diff --git a/fsw/cfe-core/unit-test/sb_UT.h b/fsw/cfe-core/unit-test/sb_UT.h index b07154e30..94831a53b 100644 --- a/fsw/cfe-core/unit-test/sb_UT.h +++ b/fsw/cfe-core/unit-test/sb_UT.h @@ -2946,6 +2946,27 @@ void Test_RcvMsg_GetLastSenderInvalidPipe(void); ******************************************************************************/ void Test_RcvMsg_GetLastSenderInvalidCaller(void); +/*****************************************************************************/ +/** +** \brief Test receive last message response when there is no last sender +** +** \par Description +** This function tests the receive last message response when no last +** sender. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns +** This function does not return a value. +** +** \sa #UT_Text, #SB_ResetUnitTest, #CFE_SB_CreatePipe, +** \sa #CFE_SB_GetLastSenderId, #UT_GetNumEventsSent, #UT_EventIsInHistory, +** \sa #CFE_SB_DeletePipe, #UT_Report +** +******************************************************************************/ +void Test_RcvMsg_GetLastSenderNoValidSender(void); + /*****************************************************************************/ /** ** \brief Test successful receive last message request From 537f9b8bd8bbed41c825219bb852e5b40b469735 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 15 Apr 2020 11:43:25 -0400 Subject: [PATCH 08/15] Fix #263, Expose CFE_SB_IsValidMsgId() API This also more properly defines the the CFE_SB_INVALID_MSG_ID macro for external use going forward. --- fsw/cfe-core/src/inc/cfe_sb.h | 41 ++++++++++++++++++++++-- fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c | 12 +++++++ fsw/cfe-core/src/sb/cfe_sb_priv.h | 13 -------- 3 files changed, 51 insertions(+), 15 deletions(-) diff --git a/fsw/cfe-core/src/inc/cfe_sb.h b/fsw/cfe-core/src/inc/cfe_sb.h index d71096acd..7af492f26 100644 --- a/fsw/cfe-core/src/inc/cfe_sb.h +++ b/fsw/cfe-core/src/inc/cfe_sb.h @@ -53,7 +53,30 @@ #define CFE_SB_SUBSCRIPTION 0 /**< \brief Subtype specifier used in #CFE_SB_SingleSubscriptionTlm_t by SBN App */ #define CFE_SB_UNSUBSCRIPTION 1 /**< \brief Subtype specified used in #CFE_SB_SingleSubscriptionTlm_t by SBN App */ -#define CFE_SB_INVALID_MSG_ID 0xFFFF /**< \brief Initializer for #CFE_SB_MsgId_t values that will not match any real MsgId */ +/* ------------------------------------------------------ */ +/* Macro Constants for use with the CFE_SB_MsgId_t type */ +/* ------------------------------------------------------ */ + +/** + * \brief Reserved value for CFE_SB_MsgId_t that will not match any valid MsgId + * + * This rvalue macro can be used for static/compile-time data initialization to ensure that + * the initialized value does not alias to a valid MsgId object. + */ +#define CFE_SB_MSGID_RESERVED ((CFE_SB_MsgId_t)(-1)) + +/** + * \brief A literal of the CFE_SB_MsgId_t type representing an invalid ID + * + * This value should be used for runtime initialization of CFE_SB_MsgId_t values. + * + * \note This may be a compound literal in a future revision. Per C99, compound + * literals are lvalues, not rvalues, so this value should not be used in + * static/compile-time data initialization. For static data initialization + * purposes (rvalue), #CFE_SB_MSGID_RESERVED should be used instead. + * However, in the current implementation, they are equivalent. + */ +#define CFE_SB_INVALID_MSG_ID CFE_SB_MSGID_RESERVED /* ** Macro Definitions @@ -1278,7 +1301,21 @@ bool CFE_SB_ValidateChecksum(CFE_SB_MsgPtr_t MsgPtr); /*****************************************************************************/ /** - * \brief Identifies whether a two #CFE_SB_MsgId_t values are equal + * \brief Identifies whether a given CFE_SB_MsgId_t is valid + * + * \par Description + * Implements a basic sanity check on the value provided + * + * \return Boolean message ID validity indicator + * \retval true Message ID is within the valid range + * \retval false Message ID is not within the valid range + */ +bool CFE_SB_IsValidMsgId(CFE_SB_MsgId_t MsgId); + + +/*****************************************************************************/ +/** + * \brief Identifies whether two #CFE_SB_MsgId_t values are equal * * \par Description * In cases where the #CFE_SB_MsgId_t type is not a simple integer diff --git a/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c b/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c index 6b2132565..3c9a5ef74 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c +++ b/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c @@ -185,3 +185,15 @@ void CFE_SB_SetMsgId(CFE_SB_MsgPtr_t MsgPtr, #endif }/* end CFE_SB_SetMsgId */ + +/* + * Function: CFE_SB_IsValidMsgId - See API and header file for details + */ +bool CFE_SB_IsValidMsgId(CFE_SB_MsgId_t MsgId) +{ + return (!CFE_SB_MsgId_Equal(MsgId, CFE_SB_INVALID_MSG_ID) && + CFE_SB_MsgIdToValue(MsgId) <= CFE_SB_HIGHEST_VALID_MSGID); +} /* end CFE_SB_IsValidMsgId */ + + + diff --git a/fsw/cfe-core/src/sb/cfe_sb_priv.h b/fsw/cfe-core/src/sb/cfe_sb_priv.h index 4952dfee3..8b9b4c806 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_priv.h +++ b/fsw/cfe-core/src/sb/cfe_sb_priv.h @@ -472,19 +472,6 @@ extern cfe_sb_t CFE_SB; * or use case is legitimate. * --------------------------------------------------------- */ -/** - * @brief Identifies whether a given CFE_SB_MsgId_t is valid - * - * Implements a basic sanity check on the value provided - * - * @returns true if sanity checks passed, false otherwise. - */ -static inline bool CFE_SB_IsValidMsgId(CFE_SB_MsgId_t MsgId) -{ - /* cppcheck-suppress redundantCondition */ - return (MsgId != CFE_SB_INVALID_MSG_ID && MsgId <= CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); -} - /** * @brief Identifies whether a given CFE_SB_MsgKey_t is valid * From 51c599c6f88b68da411ff55536ca87fe6490c2b0 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Mon, 13 Apr 2020 15:23:53 -0400 Subject: [PATCH 09/15] Fix #245, Consistent use of MsgId type Make CFE core apps consistent in their use of the CFE_SB_MsgId type and with the CFE SB API. This employs the CFE SB API whenever any of the following needs to happen: - Use of a CFE_SB_MsgId_t value within a printf (event, syslog, etc). - Initialization of a CFE_SB_MsgId_t from an integer value - Comparison of two CFE_SB_MsgId_t values - Checking if a CFE_SB_MsgId_t value is within the valid set A few new macros are introduced, mainly because the inline functions that already existed for this purpose cannot be used where evaluation must be done at compile time (e.g. constants, struct initialization). These are initially just typecasts, but could become more interesting in future revisions. --- fsw/cfe-core/src/es/cfe_es_task.c | 31 +-- fsw/cfe-core/src/evs/cfe_evs_task.c | 20 +- fsw/cfe-core/src/evs/cfe_evs_utils.c | 6 +- fsw/cfe-core/src/inc/cfe_sb.h | 33 ++- fsw/cfe-core/src/inc/cfe_sb_msg.h | 2 +- fsw/cfe-core/src/sb/cfe_sb_api.c | 69 ++++--- fsw/cfe-core/src/sb/cfe_sb_init.c | 2 +- fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c | 25 +-- fsw/cfe-core/src/sb/cfe_sb_priv.c | 2 +- fsw/cfe-core/src/sb/cfe_sb_task.c | 39 ++-- fsw/cfe-core/src/tbl/cfe_tbl_internal.c | 4 +- fsw/cfe-core/src/tbl/cfe_tbl_task.c | 24 ++- fsw/cfe-core/src/time/cfe_time_task.c | 28 +-- fsw/cfe-core/src/time/cfe_time_utils.c | 12 +- fsw/cfe-core/unit-test/es_UT.c | 57 +++--- fsw/cfe-core/unit-test/evs_UT.c | 62 +++--- fsw/cfe-core/unit-test/sb_UT.c | 249 ++++++++++++++--------- fsw/cfe-core/unit-test/sb_UT.h | 4 +- fsw/cfe-core/unit-test/tbl_UT.c | 24 +-- fsw/cfe-core/unit-test/time_UT.c | 48 ++--- fsw/cfe-core/unit-test/ut_support.c | 2 +- fsw/cfe-core/ut-stubs/ut_sb_stubs.c | 29 +-- 22 files changed, 457 insertions(+), 315 deletions(-) diff --git a/fsw/cfe-core/src/es/cfe_es_task.c b/fsw/cfe-core/src/es/cfe_es_task.c index bb5dc5fdf..3d37b012e 100644 --- a/fsw/cfe-core/src/es/cfe_es_task.c +++ b/fsw/cfe-core/src/es/cfe_es_task.c @@ -251,23 +251,30 @@ int32 CFE_ES_TaskInit(void) /* ** Initialize housekeeping packet (clear user data area) */ - CFE_SB_InitMsg(&CFE_ES_TaskData.HkPacket, CFE_ES_HK_TLM_MID, sizeof(CFE_ES_TaskData.HkPacket), true); + CFE_SB_InitMsg(&CFE_ES_TaskData.HkPacket, + CFE_SB_ValueToMsgId(CFE_ES_HK_TLM_MID), + sizeof(CFE_ES_TaskData.HkPacket), true); /* ** Initialize shell output packet (clear user data area) */ - CFE_SB_InitMsg(&CFE_ES_TaskData.ShellPacket, CFE_ES_SHELL_TLM_MID, sizeof(CFE_ES_TaskData.ShellPacket), true); + CFE_SB_InitMsg(&CFE_ES_TaskData.ShellPacket, + CFE_SB_ValueToMsgId(CFE_ES_SHELL_TLM_MID), + sizeof(CFE_ES_TaskData.ShellPacket), true); /* ** Initialize single application telemetry packet */ - CFE_SB_InitMsg(&CFE_ES_TaskData.OneAppPacket, CFE_ES_APP_TLM_MID, sizeof(CFE_ES_TaskData.OneAppPacket), true); + CFE_SB_InitMsg(&CFE_ES_TaskData.OneAppPacket, + CFE_SB_ValueToMsgId(CFE_ES_APP_TLM_MID), + sizeof(CFE_ES_TaskData.OneAppPacket), true); /* ** Initialize memory pool statistics telemetry packet */ - CFE_SB_InitMsg(&CFE_ES_TaskData.MemStatsPacket, CFE_ES_MEMSTATS_TLM_MID, - sizeof(CFE_ES_TaskData.MemStatsPacket), true); + CFE_SB_InitMsg(&CFE_ES_TaskData.MemStatsPacket, + CFE_SB_ValueToMsgId(CFE_ES_MEMSTATS_TLM_MID), + sizeof(CFE_ES_TaskData.MemStatsPacket), true); /* ** Create Software Bus message pipe @@ -282,7 +289,7 @@ int32 CFE_ES_TaskInit(void) /* ** Subscribe to Housekeeping request commands */ - Status = CFE_SB_SubscribeEx(CFE_ES_SEND_HK_MID, CFE_ES_TaskData.CmdPipe, + Status = CFE_SB_SubscribeEx(CFE_SB_ValueToMsgId(CFE_ES_SEND_HK_MID), CFE_ES_TaskData.CmdPipe, CFE_SB_Default_Qos, CFE_ES_TaskData.LimitHK); if ( Status != CFE_SUCCESS ) { @@ -293,8 +300,8 @@ int32 CFE_ES_TaskInit(void) /* ** Subscribe to ES task ground command packets */ - Status = CFE_SB_SubscribeEx(CFE_ES_CMD_MID, CFE_ES_TaskData.CmdPipe, - CFE_SB_Default_Qos, CFE_ES_TaskData.LimitCmd); + Status = CFE_SB_SubscribeEx(CFE_SB_ValueToMsgId(CFE_ES_CMD_MID), CFE_ES_TaskData.CmdPipe, + CFE_SB_Default_Qos, CFE_ES_TaskData.LimitCmd); if ( Status != CFE_SUCCESS ) { CFE_ES_WriteToSysLog("ES:Cannot Subscribe to ES ground commands, RC = 0x%08X\n", (unsigned int)Status); @@ -427,7 +434,7 @@ void CFE_ES_TaskPipe(CFE_SB_MsgPtr_t Msg) uint16 CommandCode; MessageID = CFE_SB_GetMsgId(Msg); - switch (MessageID) + switch (CFE_SB_MsgIdToValue(MessageID)) { /* ** Housekeeping telemetry request @@ -622,7 +629,7 @@ void CFE_ES_TaskPipe(CFE_SB_MsgPtr_t Msg) default: CFE_EVS_SendEvent(CFE_ES_CC1_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid ground command code: ID = 0x%X, CC = %d", - (unsigned int)MessageID, (int)CommandCode); + (unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode); CFE_ES_TaskData.CommandErrorCounter++; break; } @@ -632,7 +639,7 @@ void CFE_ES_TaskPipe(CFE_SB_MsgPtr_t Msg) CFE_EVS_SendEvent(CFE_ES_MID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command pipe message ID: 0x%X", - (unsigned int)MessageID); + (unsigned int)CFE_SB_MsgIdToValue(MessageID)); CFE_ES_TaskData.CommandErrorCounter++; break; } @@ -1692,7 +1699,7 @@ bool CFE_ES_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) CFE_EVS_SendEvent(CFE_ES_LEN_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid cmd length: ID = 0x%X, CC = %d, Exp Len = %d, Len = %d", - (unsigned int)MessageID, (int)CommandCode, (int)ExpectedLength, (int)ActualLength); + (unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode, (int)ExpectedLength, (int)ActualLength); result = false; CFE_ES_TaskData.CommandErrorCounter++; } diff --git a/fsw/cfe-core/src/evs/cfe_evs_task.c b/fsw/cfe-core/src/evs/cfe_evs_task.c index d987cf91d..22ad6a2d0 100644 --- a/fsw/cfe-core/src/evs/cfe_evs_task.c +++ b/fsw/cfe-core/src/evs/cfe_evs_task.c @@ -88,7 +88,7 @@ int32 CFE_EVS_EarlyInit ( void ) CFE_EVS_GlobalData.EVS_AppID = CFE_EVS_UNDEF_APPID; /* Initialize housekeeping packet */ - CFE_SB_InitMsg(&CFE_EVS_GlobalData.EVS_TlmPkt, CFE_EVS_HK_TLM_MID, + CFE_SB_InitMsg(&CFE_EVS_GlobalData.EVS_TlmPkt, CFE_SB_ValueToMsgId(CFE_EVS_HK_TLM_MID), sizeof(CFE_EVS_GlobalData.EVS_TlmPkt), false); /* Elements stored in the hk packet that have non-zero default values */ @@ -315,7 +315,7 @@ int32 CFE_EVS_TaskInit ( void ) } /* Subscribe to command and telemetry requests coming in on the command pipe */ - Status = CFE_SB_SubscribeEx(CFE_EVS_CMD_MID, CFE_EVS_GlobalData.EVS_CommandPipe, + Status = CFE_SB_SubscribeEx(CFE_SB_ValueToMsgId(CFE_EVS_CMD_MID), CFE_EVS_GlobalData.EVS_CommandPipe, CFE_SB_Default_Qos, CFE_EVS_MSG_LIMIT); if (Status != CFE_SUCCESS) { @@ -323,7 +323,7 @@ int32 CFE_EVS_TaskInit ( void ) return Status; } - Status = CFE_SB_SubscribeEx(CFE_EVS_SEND_HK_MID, CFE_EVS_GlobalData.EVS_CommandPipe, + Status = CFE_SB_SubscribeEx(CFE_SB_ValueToMsgId(CFE_EVS_SEND_HK_MID), CFE_EVS_GlobalData.EVS_CommandPipe, CFE_SB_Default_Qos, CFE_EVS_MSG_LIMIT); if (Status != CFE_SUCCESS) { @@ -354,8 +354,12 @@ int32 CFE_EVS_TaskInit ( void ) */ void CFE_EVS_ProcessCommandPacket ( CFE_SB_MsgPtr_t EVS_MsgPtr ) { + CFE_SB_MsgId_t MessageID; + + MessageID = CFE_SB_GetMsgId(EVS_MsgPtr); + /* Process all SB messages */ - switch (CFE_SB_GetMsgId(EVS_MsgPtr)) + switch (CFE_SB_MsgIdToValue(MessageID)) { case CFE_EVS_CMD_MID: /* EVS task specific command */ @@ -372,7 +376,7 @@ void CFE_EVS_ProcessCommandPacket ( CFE_SB_MsgPtr_t EVS_MsgPtr ) CFE_EVS_GlobalData.EVS_TlmPkt.Payload.CommandErrorCounter++; EVS_SendEvent(CFE_EVS_ERR_MSGID_EID, CFE_EVS_EventType_ERROR, "Invalid command packet, Message ID = 0x%08X", - (unsigned int)CFE_SB_GetMsgId(EVS_MsgPtr)); + (unsigned int)CFE_SB_MsgIdToValue(MessageID)); break; } @@ -573,7 +577,8 @@ void CFE_EVS_ProcessGroundCommand ( CFE_SB_MsgPtr_t EVS_MsgPtr ) EVS_SendEvent(CFE_EVS_ERR_CC_EID, CFE_EVS_EventType_ERROR, "Invalid command code -- ID = 0x%08x, CC = %d", - (unsigned int)CFE_SB_GetMsgId(EVS_MsgPtr), (int)CFE_SB_GetCmdCode(EVS_MsgPtr)); + (unsigned int)CFE_SB_MsgIdToValue(CFE_SB_GetMsgId(EVS_MsgPtr)), + (int)CFE_SB_GetCmdCode(EVS_MsgPtr)); Status = CFE_STATUS_BAD_COMMAND_CODE; break; @@ -618,7 +623,8 @@ bool CFE_EVS_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) EVS_SendEvent(CFE_EVS_LEN_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid cmd length: ID = 0x%X, CC = %d, Exp Len = %d, Len = %d", - (unsigned int)MessageID, (int)CommandCode, (int)ExpectedLength, (int)ActualLength); + (unsigned int)CFE_SB_MsgIdToValue(MessageID), + (int)CommandCode, (int)ExpectedLength, (int)ActualLength); result = false; } diff --git a/fsw/cfe-core/src/evs/cfe_evs_utils.c b/fsw/cfe-core/src/evs/cfe_evs_utils.c index caa9ef079..9acc0836a 100644 --- a/fsw/cfe-core/src/evs/cfe_evs_utils.c +++ b/fsw/cfe-core/src/evs/cfe_evs_utils.c @@ -364,7 +364,8 @@ void EVS_GenerateEventTelemetry(uint32 AppID, uint16 EventID, uint16 EventType, int ExpandedLength; /* Initialize EVS event packets */ - CFE_SB_InitMsg(&LongEventTlm, CFE_EVS_LONG_EVENT_MSG_MID, sizeof(LongEventTlm), true); + CFE_SB_InitMsg(&LongEventTlm, CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID), + sizeof(LongEventTlm), true); LongEventTlm.Payload.PacketID.EventID = EventID; LongEventTlm.Payload.PacketID.EventType = EventType; @@ -408,7 +409,8 @@ void EVS_GenerateEventTelemetry(uint32 AppID, uint16 EventID, uint16 EventType, * * This goes out on a separate message ID. */ - CFE_SB_InitMsg(&ShortEventTlm, CFE_EVS_SHORT_EVENT_MSG_MID, sizeof(ShortEventTlm), true); + CFE_SB_InitMsg(&ShortEventTlm, CFE_SB_ValueToMsgId(CFE_EVS_SHORT_EVENT_MSG_MID), + sizeof(ShortEventTlm), true); CFE_SB_SetMsgTime((CFE_SB_Msg_t *) &ShortEventTlm, *TimeStamp); ShortEventTlm.Payload.PacketID = LongEventTlm.Payload.PacketID; CFE_SB_SendMsg((CFE_SB_Msg_t *) &ShortEventTlm); diff --git a/fsw/cfe-core/src/inc/cfe_sb.h b/fsw/cfe-core/src/inc/cfe_sb.h index 7af492f26..bfa0ab593 100644 --- a/fsw/cfe-core/src/inc/cfe_sb.h +++ b/fsw/cfe-core/src/inc/cfe_sb.h @@ -57,13 +57,37 @@ /* Macro Constants for use with the CFE_SB_MsgId_t type */ /* ------------------------------------------------------ */ +/** + * \brief Translation macro to convert from MsgId integer values to opaque/abstract API values + * + * This conversion exists in macro form to allow compile-time evaluation for constants, and + * should not be used directly in application code. + * + * For applications, use the CFE_SB_ValueToMsgId() inline function instead. + * + * \sa CFE_SB_ValueToMsgId() + */ +#define CFE_SB_MSGID_WRAP_VALUE(val) ((CFE_SB_MsgId_t)(val)) + +/** + * \brief Translation macro to convert to MsgId integer values from opaque/abstract API values + * + * This conversion exists in macro form to allow compile-time evaluation for constants, and + * should not be used directly in application code. + * + * For applications, use the CFE_SB_MsgIdToValue() inline function instead. + * + * \sa CFE_SB_MsgIdToValue() + */ +#define CFE_SB_MSGID_UNWRAP_VALUE(mid) ((CFE_SB_MsgId_Atom_t)(mid)) + /** * \brief Reserved value for CFE_SB_MsgId_t that will not match any valid MsgId * * This rvalue macro can be used for static/compile-time data initialization to ensure that * the initialized value does not alias to a valid MsgId object. */ -#define CFE_SB_MSGID_RESERVED ((CFE_SB_MsgId_t)(-1)) +#define CFE_SB_MSGID_RESERVED CFE_SB_MSGID_WRAP_VALUE(-1) /** * \brief A literal of the CFE_SB_MsgId_t type representing an invalid ID @@ -1333,7 +1357,7 @@ bool CFE_SB_IsValidMsgId(CFE_SB_MsgId_t MsgId); */ static inline bool CFE_SB_MsgId_Equal(CFE_SB_MsgId_t MsgId1, CFE_SB_MsgId_t MsgId2) { - return (MsgId1 == MsgId2); + return CFE_SB_MSGID_UNWRAP_VALUE(MsgId1) == CFE_SB_MSGID_UNWRAP_VALUE(MsgId2); } /*****************************************************************************/ @@ -1364,7 +1388,7 @@ static inline bool CFE_SB_MsgId_Equal(CFE_SB_MsgId_t MsgId1, CFE_SB_MsgId_t MsgI */ static inline CFE_SB_MsgId_Atom_t CFE_SB_MsgIdToValue(CFE_SB_MsgId_t MsgId) { - return MsgId; + return CFE_SB_MSGID_UNWRAP_VALUE(MsgId); } /*****************************************************************************/ @@ -1393,7 +1417,8 @@ static inline CFE_SB_MsgId_Atom_t CFE_SB_MsgIdToValue(CFE_SB_MsgId_t MsgId) */ static inline CFE_SB_MsgId_t CFE_SB_ValueToMsgId(CFE_SB_MsgId_Atom_t MsgIdValue) { - return MsgIdValue; + CFE_SB_MsgId_t Result = CFE_SB_MSGID_WRAP_VALUE(MsgIdValue); + return Result; } /**@}*/ diff --git a/fsw/cfe-core/src/inc/cfe_sb_msg.h b/fsw/cfe-core/src/inc/cfe_sb_msg.h index 7dc289106..c43f5b838 100644 --- a/fsw/cfe-core/src/inc/cfe_sb_msg.h +++ b/fsw/cfe-core/src/inc/cfe_sb_msg.h @@ -681,7 +681,7 @@ typedef struct{ ** Structure of one element of the map information in response to #CFE_SB_SEND_MAP_INFO_CC */ typedef struct{ - CFE_SB_MsgId_Atom_t MsgId;/**< \brief Message Id which has been subscribed to */ + CFE_SB_MsgId_t MsgId;/**< \brief Message Id which has been subscribed to */ CFE_SB_MsgRouteIdx_Atom_t Index;/**< \brief Routing table index where pipe destinations are found */ }CFE_SB_MsgMapFileEntry_t; diff --git a/fsw/cfe-core/src/sb/cfe_sb_api.c b/fsw/cfe-core/src/sb/cfe_sb_api.c index 5495c1784..46010bbe5 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_api.c +++ b/fsw/cfe-core/src/sb/cfe_sb_api.c @@ -741,8 +741,8 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB.HKTlmMsg.Payload.SubscribeErrorCounter++; CFE_SB_UnlockSharedData(__func__,__LINE__); CFE_EVS_SendEventWithAppID(CFE_SB_SUB_INV_PIPE_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, - "Subscribe Err:Invalid Pipe Id,Msg=0x%x,PipeId=%d,App %s",(unsigned int)MsgId,(int)PipeId, - CFE_SB_GetAppTskName(TskId,FullName)); + "Subscribe Err:Invalid Pipe Id,Msg=0x%x,PipeId=%d,App %s",(unsigned int)CFE_SB_MsgIdToValue(MsgId), + (int)PipeId, CFE_SB_GetAppTskName(TskId,FullName)); return CFE_SB_BAD_ARGUMENT; }/* end if */ @@ -752,7 +752,7 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_UnlockSharedData(__func__,__LINE__); CFE_EVS_SendEventWithAppID(CFE_SB_SUB_INV_CALLER_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Subscribe Err:Caller(%s) is not the owner of pipe %d,Msg=0x%x", - CFE_SB_GetAppTskName(TskId,FullName),(int)PipeId,(unsigned int)MsgId); + CFE_SB_GetAppTskName(TskId,FullName),(int)PipeId,(unsigned int)CFE_SB_MsgIdToValue(MsgId)); return CFE_SB_BAD_ARGUMENT; }/* end if */ @@ -763,7 +763,8 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_UnlockSharedData(__func__,__LINE__); CFE_EVS_SendEventWithAppID(CFE_SB_SUB_ARG_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Subscribe Err:Bad Arg,MsgId 0x%x,PipeId %d,app %s,scope %d", - (unsigned int)MsgId,(int)PipeId,CFE_SB_GetAppTskName(TskId,FullName),Scope); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + (int)PipeId,CFE_SB_GetAppTskName(TskId,FullName),Scope); return CFE_SB_BAD_ARGUMENT; }/* end if */ @@ -776,7 +777,8 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_UnlockSharedData(__func__,__LINE__); CFE_EVS_SendEventWithAppID(CFE_SB_DUP_SUBSCRIP_EID,CFE_EVS_EventType_INFORMATION,CFE_SB.AppId, "Duplicate Subscription,MsgId 0x%x on %s pipe,app %s", - (unsigned int)MsgId,PipeName,CFE_SB_GetAppTskName(TskId,FullName)); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + PipeName,CFE_SB_GetAppTskName(TskId,FullName)); return CFE_SUCCESS; }/* end if */ @@ -811,7 +813,9 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_UnlockSharedData(__func__,__LINE__); CFE_EVS_SendEventWithAppID(CFE_SB_MAX_MSGS_MET_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Subscribe Err:Max Msgs(%d)In Use,MsgId 0x%x,pipe %s,app %s", - CFE_PLATFORM_SB_MAX_MSG_IDS,(unsigned int)MsgId,PipeName,CFE_SB_GetAppTskName(TskId,FullName)); + CFE_PLATFORM_SB_MAX_MSG_IDS, + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + PipeName,CFE_SB_GetAppTskName(TskId,FullName)); return CFE_SB_MAX_MSGS_MET; }/* end if */ @@ -835,8 +839,9 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_UnlockSharedData(__func__,__LINE__); CFE_EVS_SendEventWithAppID(CFE_SB_MAX_DESTS_MET_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Subscribe Err:Max Dests(%d)In Use For Msg 0x%x,pipe %s,app %s", - CFE_PLATFORM_SB_MAX_DEST_PER_PKT,(unsigned int)MsgId,PipeName, - CFE_SB_GetAppTskName(TskId,FullName)); + CFE_PLATFORM_SB_MAX_DEST_PER_PKT, + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + PipeName, CFE_SB_GetAppTskName(TskId,FullName)); return CFE_SB_MAX_DESTS_MET; }/* end if */ @@ -845,7 +850,8 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, if(DestBlkPtr == NULL){ CFE_SB_UnlockSharedData(__func__,__LINE__); CFE_EVS_SendEventWithAppID(CFE_SB_DEST_BLK_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, - "Subscribe Err:Request for Destination Blk failed for Msg 0x%x", (unsigned int)MsgId); + "Subscribe Err:Request for Destination Blk failed for Msg 0x%x", + (unsigned int)CFE_SB_MsgIdToValue(MsgId)); return CFE_SB_BUF_ALOC_ERR; }/* end if */ @@ -880,7 +886,8 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, Stat = CFE_SB_SendMsg((CFE_SB_Msg_t *)&CFE_SB.SubRprtMsg); CFE_EVS_SendEventWithAppID(CFE_SB_SUBSCRIPTION_RPT_EID,CFE_EVS_EventType_DEBUG,CFE_SB.AppId, "Sending Subscription Report Msg=0x%x,Pipe=%d,Stat=0x%x", - (unsigned int)MsgId,(int)PipeId,(unsigned int)Stat); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + (int)PipeId,(unsigned int)Stat); CFE_SB_LockSharedData(__func__,__LINE__);/* to prevent back-to-back unlock */ }/* end if */ @@ -889,7 +896,8 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_EVS_SendEventWithAppID(CFE_SB_SUBSCRIPTION_RCVD_EID,CFE_EVS_EventType_DEBUG,CFE_SB.AppId, "Subscription Rcvd:MsgId 0x%x on %s(%d),app %s", - (unsigned int)MsgId,PipeName,(int)PipeId,CFE_SB_GetAppTskName(TskId,FullName)); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + PipeName,(int)PipeId,CFE_SB_GetAppTskName(TskId,FullName)); return CFE_SUCCESS; @@ -1020,7 +1028,8 @@ int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId,CFE_SB_PipeId_t PipeId, CFE_SB_UnlockSharedData(__func__,__LINE__); CFE_EVS_SendEventWithAppID(CFE_SB_UNSUB_INV_PIPE_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Unsubscribe Err:Invalid Pipe Id Msg=0x%x,Pipe=%d,app=%s", - (unsigned int)MsgId,(int)PipeId,CFE_SB_GetAppTskName(TskId,FullName)); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + (int)PipeId,CFE_SB_GetAppTskName(TskId,FullName)); return CFE_SB_BAD_ARGUMENT; }/* end if */ @@ -1029,7 +1038,8 @@ int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId,CFE_SB_PipeId_t PipeId, CFE_SB_UnlockSharedData(__func__,__LINE__); CFE_EVS_SendEventWithAppID(CFE_SB_UNSUB_INV_CALLER_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Unsubscribe Err:Caller(%s) is not the owner of pipe %d,Msg=0x%x", - CFE_SB_GetAppTskName(TskId,FullName),(int)PipeId,(unsigned int)MsgId); + CFE_SB_GetAppTskName(TskId,FullName),(int)PipeId, + (unsigned int)CFE_SB_MsgIdToValue(MsgId)); return CFE_SB_BAD_ARGUMENT; }/* end if */ @@ -1041,7 +1051,8 @@ int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId,CFE_SB_PipeId_t PipeId, CFE_SB_UnlockSharedData(__func__,__LINE__); CFE_EVS_SendEventWithAppID(CFE_SB_UNSUB_ARG_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "UnSubscribe Err:Bad Arg,MsgId 0x%x,PipeId %d,app %s,scope %d", - (unsigned int)MsgId,(int)PipeId,CFE_SB_GetAppTskName(TskId,FullName),(int)Scope); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + (int)PipeId,CFE_SB_GetAppTskName(TskId,FullName),(int)Scope); return CFE_SB_BAD_ARGUMENT; }/* end if */ @@ -1059,7 +1070,8 @@ int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId,CFE_SB_PipeId_t PipeId, CFE_EVS_SendEventWithAppID(CFE_SB_UNSUB_NO_SUBS_EID,CFE_EVS_EventType_INFORMATION,CFE_SB.AppId, "Unsubscribe Err:No subs for Msg 0x%x on %s,app %s", - (unsigned int)MsgId,PipeName,CFE_SB_GetAppTskName(TskId,FullName)); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + PipeName,CFE_SB_GetAppTskName(TskId,FullName)); return CFE_SUCCESS; }/* end if */ @@ -1094,7 +1106,8 @@ int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId,CFE_SB_PipeId_t PipeId, CFE_EVS_SendEventWithAppID(CFE_SB_SUBSCRIPTION_REMOVED_EID,CFE_EVS_EventType_DEBUG,CFE_SB.AppId, "Subscription Removed:Msg 0x%x on pipe %d,app %s", - (unsigned int)MsgId,(int)PipeId,CFE_SB_GetAppTskName(TskId,FullName)); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + (int)PipeId,CFE_SB_GetAppTskName(TskId,FullName)); return CFE_SUCCESS; @@ -1205,7 +1218,8 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, CFE_SB_UnlockSharedData(__func__,__LINE__); CFE_EVS_SendEventWithAppID(CFE_SB_SEND_INV_MSGID_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Send Err:Invalid MsgId(0x%x)in msg,App %s", - (unsigned int)MsgId,CFE_SB_GetAppTskName(TskId,FullName)); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + CFE_SB_GetAppTskName(TskId,FullName)); return CFE_SB_BAD_ARGUMENT; }/* end if */ @@ -1223,7 +1237,8 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, CFE_SB_UnlockSharedData(__func__,__LINE__); CFE_EVS_SendEventWithAppID(CFE_SB_MSG_TOO_BIG_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Send Err:Msg Too Big MsgId=0x%x,app=%s,size=%d,MaxSz=%d", - (unsigned int)MsgId,CFE_SB_GetAppTskName(TskId,FullName),(int)TotalMsgSize,CFE_MISSION_SB_MAX_SB_MSG_SIZE); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + CFE_SB_GetAppTskName(TskId,FullName),(int)TotalMsgSize,CFE_MISSION_SB_MAX_SB_MSG_SIZE); return CFE_SB_MSG_TOO_BIG; }/* end if */ @@ -1252,7 +1267,8 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, CFE_EVS_SendEventWithAppID(CFE_SB_SEND_NO_SUBS_EID,CFE_EVS_EventType_INFORMATION,CFE_SB.AppId, "No subscribers for MsgId 0x%x,sender %s", - (unsigned int)MsgId,CFE_SB_GetAppTskName(TskId,FullName)); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + CFE_SB_GetAppTskName(TskId,FullName)); /* clear the bit so the task may send this event again */ CFE_SB_FinishSendEvent(TskId,CFE_SB_SEND_NO_SUBS_EID_BIT); @@ -1277,7 +1293,8 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, CFE_EVS_SendEventWithAppID(CFE_SB_GET_BUF_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Send Err:Request for Buffer Failed. MsgId 0x%x,app %s,size %d", - (unsigned int)MsgId,CFE_SB_GetAppTskName(TskId,FullName),(int)TotalMsgSize); + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + CFE_SB_GetAppTskName(TskId,FullName),(int)TotalMsgSize); /* clear the bit so the task may send this event again */ CFE_SB_FinishSendEvent(TskId,CFE_SB_GET_BUF_ERR_EID_BIT); @@ -1427,8 +1444,8 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, CFE_EVS_SendEventWithAppID(CFE_SB_MSGID_LIM_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Msg Limit Err,MsgId 0x%x,pipe %s,sender %s", - (unsigned int)RtgTblPtr->MsgId, PipeName, - CFE_SB_GetAppTskName(TskId,FullName)); + (unsigned int)CFE_SB_MsgIdToValue(RtgTblPtr->MsgId), + PipeName, CFE_SB_GetAppTskName(TskId,FullName)); /* clear the bit so the task may send this event again */ CFE_SB_FinishSendEvent(TskId,CFE_SB_MSGID_LIM_ERR_EID_BIT); @@ -1446,8 +1463,8 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, CFE_EVS_SendEventWithAppID(CFE_SB_Q_FULL_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Pipe Overflow,MsgId 0x%x,pipe %s,sender %s", - (unsigned int)RtgTblPtr->MsgId, PipeName, - CFE_SB_GetAppTskName(TskId,FullName)); + (unsigned int)CFE_SB_MsgIdToValue(RtgTblPtr->MsgId), + PipeName, CFE_SB_GetAppTskName(TskId,FullName)); /* clear the bit so the task may send this event again */ CFE_SB_FinishSendEvent(TskId,CFE_SB_Q_FULL_ERR_EID_BIT); @@ -1462,8 +1479,8 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, CFE_EVS_SendEventWithAppID(CFE_SB_Q_WR_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId, "Pipe Write Err,MsgId 0x%x,pipe %s,sender %s,stat 0x%x", - (unsigned int)RtgTblPtr->MsgId, PipeName, - CFE_SB_GetAppTskName(TskId,FullName), + (unsigned int)CFE_SB_MsgIdToValue(RtgTblPtr->MsgId), + PipeName, CFE_SB_GetAppTskName(TskId,FullName), (unsigned int)SBSndErr.EvtBuf[i].ErrStat); /* clear the bit so the task may send this event again */ diff --git a/fsw/cfe-core/src/sb/cfe_sb_init.c b/fsw/cfe-core/src/sb/cfe_sb_init.c index 8c79870e9..72eee8dc9 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_init.c +++ b/fsw/cfe-core/src/sb/cfe_sb_init.c @@ -123,7 +123,7 @@ int32 CFE_SB_EarlyInit (void) { /* Initialize the SB Statistics Pkt */ CFE_SB_InitMsg(&CFE_SB.StatTlmMsg, - CFE_SB_STATS_TLM_MID, + CFE_SB_ValueToMsgId(CFE_SB_STATS_TLM_MID), sizeof(CFE_SB.StatTlmMsg), true); diff --git a/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c b/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c index 3c9a5ef74..b77c5cc6d 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c +++ b/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c @@ -110,7 +110,7 @@ */ CFE_SB_MsgKey_t CFE_SB_ConvertMsgIdtoMsgKey( CFE_SB_MsgId_t MsgId) { - return CFE_SB_ValueToMsgKey(MsgId); + return CFE_SB_ValueToMsgKey(CFE_SB_MsgIdToValue(MsgId)); }/* CFE_SB_ConvertMsgIdtoMsgKey */ /* @@ -118,24 +118,24 @@ CFE_SB_MsgKey_t CFE_SB_ConvertMsgIdtoMsgKey( CFE_SB_MsgId_t MsgId) */ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr) { - CFE_SB_MsgId_t MsgId = 0; + CFE_SB_MsgId_Atom_t MsgIdVal = 0; #ifdef MESSAGE_FORMAT_IS_CCSDS #ifndef MESSAGE_FORMAT_IS_CCSDS_VER_2 - MsgId = CCSDS_RD_SID(MsgPtr->Hdr); + MsgIdVal = CCSDS_RD_SID(MsgPtr->Hdr); #else uint32 SubSystemId; - MsgId = CCSDS_RD_APID(MsgPtr->Hdr); /* Primary header APID */ + MsgIdVal = CCSDS_RD_APID(MsgPtr->Hdr); /* Primary header APID */ if ( CCSDS_RD_TYPE(MsgPtr->Hdr) == CCSDS_CMD) - MsgId = MsgId | CFE_SB_CMD_MESSAGE_TYPE; + MsgIdVal = MsgIdVal | CFE_SB_CMD_MESSAGE_TYPE; /* Add in the SubSystem ID as needed */ SubSystemId = CCSDS_RD_SUBSYSTEM_ID(MsgPtr->SpacePacket.ApidQ); - MsgId = (MsgId | (SubSystemId << 8)); + MsgIdVal = (MsgIdVal | (SubSystemId << 8)); /* Example code to add in the System ID as needed. */ /* The default is to init this field to the Spacecraft ID but ignore for routing. */ @@ -143,12 +143,12 @@ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr) /* prohibitively large routing and index tables. */ /* uint16 SystemId; */ /* SystemId = CCSDS_RD_SYSTEM_ID(HdrPtr->ApidQ); */ -/* MsgId = (MsgId | (SystemId << 16)); */ +/* MsgIdVal = (MsgIdVal | (SystemId << 16)); */ #endif #endif -return MsgId; +return CFE_SB_ValueToMsgId(MsgIdVal); }/* end CFE_SB_GetMsgId */ @@ -159,16 +159,17 @@ return MsgId; void CFE_SB_SetMsgId(CFE_SB_MsgPtr_t MsgPtr, CFE_SB_MsgId_t MsgId) { + CFE_SB_MsgId_Atom_t MsgIdVal = CFE_SB_MsgIdToValue(MsgId); #ifndef MESSAGE_FORMAT_IS_CCSDS_VER_2 - CCSDS_WR_SID(MsgPtr->Hdr, MsgId); + CCSDS_WR_SID(MsgPtr->Hdr, MsgIdVal); #else CCSDS_WR_VERS(MsgPtr->SpacePacket.Hdr, 1); /* Set the stream ID APID in the primary header. */ - CCSDS_WR_APID(MsgPtr->SpacePacket.Hdr, CFE_SB_RD_APID_FROM_MSGID(MsgId) ); + CCSDS_WR_APID(MsgPtr->SpacePacket.Hdr, CFE_SB_RD_APID_FROM_MSGID(MsgIdVal) ); - CCSDS_WR_TYPE(MsgPtr->SpacePacket.Hdr, CFE_SB_RD_TYPE_FROM_MSGID(MsgId) ); + CCSDS_WR_TYPE(MsgPtr->SpacePacket.Hdr, CFE_SB_RD_TYPE_FROM_MSGID(MsgIdVal) ); CCSDS_CLR_SEC_APIDQ(MsgPtr->SpacePacket.ApidQ); @@ -179,7 +180,7 @@ void CFE_SB_SetMsgId(CFE_SB_MsgPtr_t MsgPtr, CCSDS_WR_PLAYBACK(MsgPtr->SpacePacket.ApidQ, false); - CCSDS_WR_SUBSYSTEM_ID(MsgPtr->SpacePacket.ApidQ, CFE_SB_RD_SUBSYS_ID_FROM_MSGID(MsgId)); + CCSDS_WR_SUBSYSTEM_ID(MsgPtr->SpacePacket.ApidQ, CFE_SB_RD_SUBSYS_ID_FROM_MSGID(MsgIdVal)); CCSDS_WR_SYSTEM_ID(MsgPtr->SpacePacket.ApidQ, CFE_SPACECRAFT_ID); diff --git a/fsw/cfe-core/src/sb/cfe_sb_priv.c b/fsw/cfe-core/src/sb/cfe_sb_priv.c index c5dd0af79..a92eb18ed 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_priv.c +++ b/fsw/cfe-core/src/sb/cfe_sb_priv.c @@ -676,7 +676,7 @@ uint8 CFE_SB_GetPktType(CFE_SB_MsgId_t MsgId) { #ifdef MESSAGE_FORMAT_IS_CCSDS - CFE_SB_MsgId_Atom_t Val = MsgId; + CFE_SB_MsgId_Atom_t Val = CFE_SB_MsgIdToValue(MsgId); #ifndef MESSAGE_FORMAT_IS_CCSDS_VER_2 return CFE_TST(Val,12); diff --git a/fsw/cfe-core/src/sb/cfe_sb_task.c b/fsw/cfe-core/src/sb/cfe_sb_task.c index 808343a99..88e4cece2 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_task.c +++ b/fsw/cfe-core/src/sb/cfe_sb_task.c @@ -217,17 +217,17 @@ int32 CFE_SB_AppInit(void){ CFE_ES_WriteToSysLog("SB:Registered %d events for filtering\n",(int)CfgFileEventsToFilter); CFE_SB_InitMsg(&CFE_SB.HKTlmMsg, - CFE_SB_HK_TLM_MID, + CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID), sizeof(CFE_SB.HKTlmMsg), true); CFE_SB_InitMsg(&CFE_SB.PrevSubMsg, - CFE_SB_ALLSUBS_TLM_MID, + CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID), sizeof(CFE_SB.PrevSubMsg), true); CFE_SB_InitMsg(&CFE_SB.SubRprtMsg, - CFE_SB_ONESUB_TLM_MID, + CFE_SB_ValueToMsgId(CFE_SB_ONESUB_TLM_MID), sizeof(CFE_SB.SubRprtMsg), true); @@ -250,14 +250,14 @@ int32 CFE_SB_AppInit(void){ return Status; }/* end if */ - Status = CFE_SB_Subscribe(CFE_SB_CMD_MID,CFE_SB.CmdPipe); + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_SB_CMD_MID),CFE_SB.CmdPipe); if(Status != CFE_SUCCESS){ CFE_ES_WriteToSysLog("SB:Subscribe to Cmds Failed:RC=0x%08X\n",(unsigned int)Status); return Status; }/* end if */ - Status = CFE_SB_Subscribe(CFE_SB_SEND_HK_MID,CFE_SB.CmdPipe); + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_SB_SEND_HK_MID),CFE_SB.CmdPipe); if(Status != CFE_SUCCESS){ CFE_ES_WriteToSysLog("SB:Subscribe to HK Request Failed:RC=0x%08X\n",(unsigned int)Status); @@ -323,7 +323,8 @@ bool CFE_SB_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) CFE_EVS_SendEvent(CFE_SB_LEN_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid cmd length: ID = 0x%X, CC = %d, Exp Len = %d, Len = %d", - (unsigned int)MessageID, (int)CommandCode, (int)ExpectedLength, (int)ActualLength); + (unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode, + (int)ExpectedLength, (int)ActualLength); result = false; ++CFE_SB.HKTlmMsg.Payload.CommandErrorCounter; } @@ -347,7 +348,11 @@ bool CFE_SB_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) ** none */ void CFE_SB_ProcessCmdPipePkt(void) { - switch(CFE_SB_GetMsgId(CFE_SB.CmdPipePktPtr)){ + CFE_SB_MsgId_t MessageID; + + MessageID = CFE_SB_GetMsgId(CFE_SB.CmdPipePktPtr); + + switch(CFE_SB_MsgIdToValue(MessageID)){ case CFE_SB_SEND_HK_MID: /* Note: Command counter not incremented for this command */ @@ -446,7 +451,7 @@ void CFE_SB_ProcessCmdPipePkt(void) { default: CFE_EVS_SendEvent(CFE_SB_BAD_MSGID_EID,CFE_EVS_EventType_ERROR, "Invalid Cmd, Unexpected Msg Id: 0x%04x", - (unsigned int)CFE_SB_GetMsgId(CFE_SB.CmdPipePktPtr)); + (unsigned int)CFE_SB_MsgIdToValue(MessageID)); CFE_SB.HKTlmMsg.Payload.CommandErrorCounter++; break; @@ -606,7 +611,8 @@ int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRoute_t *data) (CFE_SB_ValidatePipeId(PipeId) != CFE_SUCCESS)) { CFE_EVS_SendEvent(CFE_SB_ENBL_RTE3_EID,CFE_EVS_EventType_ERROR, - "Enbl Route Cmd:Invalid Param.Msg 0x%x,Pipe %d",(unsigned int)MsgId,(int)PipeId); + "Enbl Route Cmd:Invalid Param.Msg 0x%x,Pipe %d", + (unsigned int)CFE_SB_MsgIdToValue(MsgId),(int)PipeId); CFE_SB.HKTlmMsg.Payload.CommandErrorCounter++; /* * returning "success" here as there is no other recourse; @@ -618,7 +624,8 @@ int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRoute_t *data) DestPtr = CFE_SB_GetDestPtr(CFE_SB_ConvertMsgIdtoMsgKey(MsgId), PipeId); if(DestPtr == NULL){ CFE_EVS_SendEvent(CFE_SB_ENBL_RTE1_EID,CFE_EVS_EventType_ERROR, - "Enbl Route Cmd:Route does not exist.Msg 0x%x,Pipe %d",(unsigned int)MsgId,(int)PipeId); + "Enbl Route Cmd:Route does not exist.Msg 0x%x,Pipe %d", + (unsigned int)CFE_SB_MsgIdToValue(MsgId),(int)PipeId); CFE_SB.HKTlmMsg.Payload.CommandErrorCounter++; /* * returning "success" here as there is no other recourse; @@ -629,7 +636,8 @@ int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRoute_t *data) DestPtr->Active = CFE_SB_ACTIVE; CFE_EVS_SendEvent(CFE_SB_ENBL_RTE2_EID,CFE_EVS_EventType_DEBUG, - "Enabling Route,Msg 0x%x,Pipe %d",(unsigned int)MsgId,(int)PipeId); + "Enabling Route,Msg 0x%x,Pipe %d", + (unsigned int)CFE_SB_MsgIdToValue(MsgId),(int)PipeId); CFE_SB.HKTlmMsg.Payload.CommandCounter++; @@ -667,7 +675,8 @@ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRoute_t *data) if(!CFE_SB_IsValidMsgId(MsgId) || (CFE_SB_ValidatePipeId(PipeId) != CFE_SUCCESS)){ CFE_EVS_SendEvent(CFE_SB_DSBL_RTE3_EID,CFE_EVS_EventType_ERROR, - "Disable Route Cmd:Invalid Param.Msg 0x%x,Pipe %d",(unsigned int)MsgId,(int)PipeId); + "Disable Route Cmd:Invalid Param.Msg 0x%x,Pipe %d", + (unsigned int)CFE_SB_MsgIdToValue(MsgId),(int)PipeId); CFE_SB.HKTlmMsg.Payload.CommandErrorCounter++; /* * returning "success" here as there is no other recourse; @@ -679,7 +688,8 @@ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRoute_t *data) DestPtr = CFE_SB_GetDestPtr(CFE_SB_ConvertMsgIdtoMsgKey(MsgId), PipeId); if(DestPtr == NULL){ CFE_EVS_SendEvent(CFE_SB_DSBL_RTE1_EID,CFE_EVS_EventType_ERROR, - "Disable Route Cmd:Route does not exist,Msg 0x%x,Pipe %d",(unsigned int)MsgId,(int)PipeId); + "Disable Route Cmd:Route does not exist,Msg 0x%x,Pipe %d", + (unsigned int)CFE_SB_MsgIdToValue(MsgId),(int)PipeId); CFE_SB.HKTlmMsg.Payload.CommandErrorCounter++; /* * returning "success" here as there is no other recourse; @@ -691,7 +701,8 @@ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRoute_t *data) DestPtr->Active = CFE_SB_INACTIVE; CFE_EVS_SendEvent(CFE_SB_DSBL_RTE2_EID,CFE_EVS_EventType_DEBUG, - "Route Disabled,Msg 0x%x,Pipe %d",(unsigned int)MsgId,(int)PipeId); + "Route Disabled,Msg 0x%x,Pipe %d", + (unsigned int)CFE_SB_MsgIdToValue(MsgId),(int)PipeId); CFE_SB.HKTlmMsg.Payload.CommandCounter++; return CFE_SUCCESS; diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_internal.c b/fsw/cfe-core/src/tbl/cfe_tbl_internal.c index 68e563c4d..5a4cf0b9d 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_internal.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_internal.c @@ -145,14 +145,14 @@ int32 CFE_TBL_EarlyInit (void) ** Initialize housekeeping packet (clear user data area)... */ CFE_SB_InitMsg(&CFE_TBL_TaskData.HkPacket, - CFE_TBL_HK_TLM_MID, + CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID), sizeof(CFE_TBL_TaskData.HkPacket), true); /* ** Initialize table registry report packet (clear user data area)... */ CFE_SB_InitMsg(&CFE_TBL_TaskData.TblRegPacket, - CFE_TBL_REG_TLM_MID, + CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID), sizeof(CFE_TBL_TaskData.TblRegPacket), true); /* Initialize memory partition and allocate shared table buffers. */ diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_task.c b/fsw/cfe-core/src/tbl/cfe_tbl_task.c index ae8de62eb..f1cc34fde 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_task.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_task.c @@ -54,14 +54,14 @@ CFE_TBL_TaskData_t CFE_TBL_TaskData; * For generic message entries, which only have a MID and a handler function (no command payload) */ #define CFE_TBL_MESSAGE_ENTRY(mid,handlerfunc) \ - { mid, 0, sizeof(CCSDS_CommandPacket_t), (CFE_TBL_MsgProcFuncPtr_t)handlerfunc, CFE_TBL_MSG_MSGTYPE } + { CFE_SB_MSGID_WRAP_VALUE(mid), 0, sizeof(CCSDS_CommandPacket_t), (CFE_TBL_MsgProcFuncPtr_t)handlerfunc, CFE_TBL_MSG_MSGTYPE } /* * Macros to assist in building the CFE_TBL_CmdHandlerTbl - * For command handler entries, which have a command code, payload type, and a handler function */ #define CFE_TBL_COMMAND_ENTRY(ccode,paramtype,handlerfunc) \ - { CFE_TBL_CMD_MID, ccode, sizeof(paramtype), (CFE_TBL_MsgProcFuncPtr_t)handlerfunc, CFE_TBL_CMD_MSGTYPE } + { CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_CMD_MID), ccode, sizeof(paramtype), (CFE_TBL_MsgProcFuncPtr_t)handlerfunc, CFE_TBL_CMD_MSGTYPE } /* Constant Data */ @@ -83,7 +83,7 @@ const CFE_TBL_CmdHandlerTblRec_t CFE_TBL_CmdHandlerTbl[] = CFE_TBL_COMMAND_ENTRY( CFE_TBL_ABORT_LOAD_CC, CFE_TBL_AbortLoad_t, CFE_TBL_AbortLoadCmd), /* list terminator (keep last) */ - { 0, 0, 0, NULL, CFE_TBL_TERM_MSGTYPE } + { CFE_SB_MSGID_RESERVED, 0, 0, NULL, CFE_TBL_TERM_MSGTYPE } }; @@ -192,7 +192,7 @@ int32 CFE_TBL_TaskInit(void) /* ** Subscribe to Housekeeping request commands */ - Status = CFE_SB_Subscribe(CFE_TBL_SEND_HK_MID, CFE_TBL_TaskData.CmdPipe); + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TBL_SEND_HK_MID), CFE_TBL_TaskData.CmdPipe); if(Status != CFE_SUCCESS) { @@ -203,7 +203,7 @@ int32 CFE_TBL_TaskInit(void) /* ** Subscribe to Table task ground command packets */ - Status = CFE_SB_Subscribe(CFE_TBL_CMD_MID, CFE_TBL_TaskData.CmdPipe); + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TBL_CMD_MID), CFE_TBL_TaskData.CmdPipe); if(Status != CFE_SUCCESS) { @@ -247,12 +247,12 @@ void CFE_TBL_InitData(void) /* Initialize Packet Headers */ CFE_SB_InitMsg(&CFE_TBL_TaskData.HkPacket, - CFE_TBL_HK_TLM_MID, + CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID), sizeof(CFE_TBL_TaskData.HkPacket), true); CFE_SB_InitMsg(&CFE_TBL_TaskData.TblRegPacket, - CFE_TBL_REG_TLM_MID, + CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID), sizeof(CFE_TBL_TaskData.TblRegPacket), true); @@ -286,7 +286,8 @@ void CFE_TBL_TaskPipe(CFE_SB_Msg_t *MessagePtr) { CFE_EVS_SendEvent( CFE_TBL_LEN_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid msg length -- ID = 0x%04X, CC = %d, Len = %d (!= %d)", - (unsigned int)MessageID, (int)CommandCode, (int)ActualLength, + (unsigned int)CFE_SB_MsgIdToValue(MessageID), + (int)CommandCode, (int)ActualLength, (int)CFE_TBL_CmdHandlerTbl[CmdIndx].ExpectedLength ); } @@ -311,7 +312,8 @@ void CFE_TBL_TaskPipe(CFE_SB_Msg_t *MessagePtr) { CFE_EVS_SendEvent(CFE_TBL_CC1_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command code -- ID = 0x%04X, CC = %d", - (unsigned int)MessageID, (int)CommandCode); + (unsigned int)CFE_SB_MsgIdToValue(MessageID), + (int)CommandCode); /* Update the command error counter */ CFE_TBL_TaskData.CommandErrorCounter++; @@ -320,7 +322,7 @@ void CFE_TBL_TaskPipe(CFE_SB_Msg_t *MessagePtr) { CFE_EVS_SendEvent(CFE_TBL_MID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid message ID -- ID = 0x%04X", - (unsigned int)MessageID); + (unsigned int)CFE_SB_MsgIdToValue(MessageID)); /* ** Note: we only increment the command error counter when ** processing messages with command codes @@ -347,7 +349,7 @@ int16 CFE_TBL_SearchCmdHndlrTbl( CFE_SB_MsgId_t MessageID, uint16 CommandCode ) TblIndx++; /* Check to see if we found a matching Message ID */ - if ((CFE_TBL_CmdHandlerTbl[TblIndx].MsgId == MessageID) && + if (CFE_SB_MsgId_Equal(CFE_TBL_CmdHandlerTbl[TblIndx].MsgId, MessageID) && (CFE_TBL_CmdHandlerTbl[TblIndx].MsgTypes != CFE_TBL_TERM_MSGTYPE)) { /* Flag any found message IDs so that if there is an error, */ diff --git a/fsw/cfe-core/src/time/cfe_time_task.c b/fsw/cfe-core/src/time/cfe_time_task.c index aa6d475a4..f56c396d9 100644 --- a/fsw/cfe-core/src/time/cfe_time_task.c +++ b/fsw/cfe-core/src/time/cfe_time_task.c @@ -274,7 +274,7 @@ int32 CFE_TIME_TaskInit(void) }/* end if */ - Status = CFE_SB_Subscribe(CFE_TIME_SEND_HK_MID, + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_SEND_HK_MID), CFE_TIME_TaskData.CmdPipe); if(Status != CFE_SUCCESS) { @@ -287,12 +287,12 @@ int32 CFE_TIME_TaskInit(void) ** Subscribe to time at the tone "signal" commands... */ #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) - Status = CFE_SB_Subscribe(CFE_TIME_TONE_CMD_MID, + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), CFE_TIME_TaskData.CmdPipe); #endif #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - Status = CFE_SB_SubscribeLocal(CFE_TIME_TONE_CMD_MID, + Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), CFE_TIME_TaskData.CmdPipe,4); #endif if(Status != CFE_SUCCESS) @@ -306,12 +306,12 @@ int32 CFE_TIME_TaskInit(void) ** Subscribe to time at the tone "data" commands... */ #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) - Status = CFE_SB_Subscribe(CFE_TIME_DATA_CMD_MID, + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), CFE_TIME_TaskData.CmdPipe); #endif #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - Status = CFE_SB_SubscribeLocal(CFE_TIME_DATA_CMD_MID, + Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), CFE_TIME_TaskData.CmdPipe,4); #endif if(Status != CFE_SUCCESS) @@ -325,12 +325,12 @@ int32 CFE_TIME_TaskInit(void) ** Subscribe to 1Hz signal commands... */ #if (CFE_PLATFORM_TIME_CFG_CLIENT == true) - Status = CFE_SB_Subscribe(CFE_TIME_1HZ_CMD_MID, + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), CFE_TIME_TaskData.CmdPipe); #endif #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - Status = CFE_SB_SubscribeLocal(CFE_TIME_1HZ_CMD_MID, + Status = CFE_SB_SubscribeLocal(CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), CFE_TIME_TaskData.CmdPipe,4); #endif @@ -345,7 +345,7 @@ int32 CFE_TIME_TaskInit(void) ** Subscribe to time at the tone "request data" commands... */ #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - Status = CFE_SB_Subscribe(CFE_TIME_SEND_CMD_MID, + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_SEND_CMD_MID), CFE_TIME_TaskData.CmdPipe); if(Status != CFE_SUCCESS) { @@ -357,7 +357,7 @@ int32 CFE_TIME_TaskInit(void) /* ** Subscribe to Time task ground command packets... */ - Status = CFE_SB_Subscribe(CFE_TIME_CMD_MID, + Status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CFE_TIME_CMD_MID), CFE_TIME_TaskData.CmdPipe); if(Status != CFE_SUCCESS) { @@ -442,7 +442,8 @@ bool CFE_TIME_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) CFE_EVS_SendEvent(CFE_TIME_LEN_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid cmd length: ID = 0x%X, CC = %d, Exp Len = %d, Len = %d", - (unsigned int)MessageID, (int)CommandCode, (int)ExpectedLength, (int)ActualLength); + (unsigned int)CFE_SB_MsgIdToValue(MessageID), + (int)CommandCode, (int)ExpectedLength, (int)ActualLength); result = false; ++CFE_TIME_TaskData.CommandErrorCounter; } @@ -464,7 +465,7 @@ void CFE_TIME_TaskPipe(CFE_SB_MsgPtr_t MessagePtr) uint16 CommandCode; MessageID = CFE_SB_GetMsgId(MessagePtr); - switch (MessageID) + switch (CFE_SB_MsgIdToValue(MessageID)) { /* ** Housekeeping telemetry request... @@ -634,7 +635,8 @@ void CFE_TIME_TaskPipe(CFE_SB_MsgPtr_t MessagePtr) CFE_TIME_TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_CC_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command code -- ID = 0x%X, CC = %d", - (unsigned int)MessageID, (int)CommandCode); + (unsigned int)CFE_SB_MsgIdToValue(MessageID), + (int)CommandCode); break; } /* switch (CFE_TIME_CMD_MID -- command code)*/ break; @@ -647,7 +649,7 @@ void CFE_TIME_TaskPipe(CFE_SB_MsgPtr_t MessagePtr) */ CFE_EVS_SendEvent(CFE_TIME_ID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid message ID -- ID = 0x%X", - (unsigned int)MessageID); + (unsigned int)CFE_SB_MsgIdToValue(MessageID)); break; } /* switch (message ID) */ diff --git a/fsw/cfe-core/src/time/cfe_time_utils.c b/fsw/cfe-core/src/time/cfe_time_utils.c index 8ae75243d..6e2cb80d7 100644 --- a/fsw/cfe-core/src/time/cfe_time_utils.c +++ b/fsw/cfe-core/src/time/cfe_time_utils.c @@ -389,21 +389,21 @@ void CFE_TIME_InitData(void) ** Initialize housekeeping packet (clear user data area)... */ CFE_SB_InitMsg(&CFE_TIME_TaskData.HkPacket, - CFE_TIME_HK_TLM_MID, + CFE_SB_ValueToMsgId(CFE_TIME_HK_TLM_MID), sizeof(CFE_TIME_TaskData.HkPacket), true); /* ** Initialize diagnostic packet (clear user data area)... */ CFE_SB_InitMsg(&CFE_TIME_TaskData.DiagPacket, - CFE_TIME_DIAG_TLM_MID, + CFE_SB_ValueToMsgId(CFE_TIME_DIAG_TLM_MID), sizeof(CFE_TIME_TaskData.DiagPacket), true); /* ** Initialize "time at the tone" signal command packet... */ CFE_SB_InitMsg(&CFE_TIME_TaskData.ToneSignalCmd, - CFE_TIME_TONE_CMD_MID, + CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), sizeof(CFE_TIME_TaskData.ToneSignalCmd), true); /* @@ -411,7 +411,7 @@ void CFE_TIME_InitData(void) */ #if (CFE_PLATFORM_TIME_CFG_SERVER == true) CFE_SB_InitMsg(&CFE_TIME_TaskData.ToneDataCmd, - CFE_TIME_DATA_CMD_MID, + CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), sizeof(CFE_TIME_TaskData.ToneDataCmd), true); #endif @@ -420,7 +420,7 @@ void CFE_TIME_InitData(void) */ #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) CFE_SB_InitMsg(&CFE_TIME_TaskData.ToneSendCmd, - CFE_TIME_SEND_CMD_MID, + CFE_SB_ValueToMsgId(CFE_TIME_SEND_CMD_MID), sizeof(CFE_TIME_TaskData.ToneSendCmd), true); #endif @@ -428,7 +428,7 @@ void CFE_TIME_InitData(void) ** Initialize local 1Hz "wake-up" command packet (optional)... */ CFE_SB_InitMsg(&CFE_TIME_TaskData.Local1HzCmd, - CFE_TIME_1HZ_CMD_MID, + CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), sizeof(CFE_TIME_TaskData.Local1HzCmd), true); return; diff --git a/fsw/cfe-core/unit-test/es_UT.c b/fsw/cfe-core/unit-test/es_UT.c index 065f3a061..46b403450 100644 --- a/fsw/cfe-core/unit-test/es_UT.c +++ b/fsw/cfe-core/unit-test/es_UT.c @@ -68,141 +68,142 @@ char StartupScript[MAX_STARTUP_SCRIPT]; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_NOOP_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_NOOP_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RESET_COUNTERS_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_RESET_COUNTERS_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RESTART_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_RESTART_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_SHELL_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_SHELL_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_START_APP_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_START_APP_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_STOP_APP_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_STOP_APP_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RESTART_APP_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_RESTART_APP_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RELOAD_APP_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_RELOAD_APP_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_QUERY_ONE_CC = { - .MsgId = CFE_ES_CMD_MID, - .CommandCode = CFE_ES_QUERY_ONE_CC }; + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), + .CommandCode = CFE_ES_QUERY_ONE_CC +}; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_QUERY_ALL_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_QUERY_ALL_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_QUERY_ALL_TASKS_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_CLEAR_SYSLOG_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_CLEAR_SYSLOG_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_WRITE_SYSLOG_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_OVER_WRITE_SYSLOG_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_CLEAR_ER_LOG_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_CLEAR_ER_LOG_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_WRITE_ER_LOG_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_START_PERF_DATA_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_STOP_PERF_DATA_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_SET_PERF_FILTER_MASK_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_SET_PERF_TRIGGER_MASK_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_RESET_PR_COUNT_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_RESET_PR_COUNT_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_SET_MAX_PR_COUNT_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_SET_MAX_PR_COUNT_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_DELETE_CDS_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_DELETE_CDS_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_SEND_MEM_POOL_STATS_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_DUMP_CDS_REGISTRY_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_CMD_INVALID_CC = { - .MsgId = CFE_ES_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_CMD_MID), .CommandCode = CFE_ES_DUMP_CDS_REGISTRY_CC + 2 }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_ES_SEND_HK = { - .MsgId = CFE_ES_SEND_HK_MID + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_ES_SEND_HK_MID) }; diff --git a/fsw/cfe-core/unit-test/evs_UT.c b/fsw/cfe-core/unit-test/evs_UT.c index e85679ee0..7d2259f15 100644 --- a/fsw/cfe-core/unit-test/evs_UT.c +++ b/fsw/cfe-core/unit-test/evs_UT.c @@ -61,135 +61,135 @@ static const char *EVS_SYSLOG_MSGS[] = static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_NOOP_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_NOOP_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_RESET_COUNTERS_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_RESET_COUNTERS_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ENABLE_EVENT_TYPE_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_ENABLE_EVENT_TYPE_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DISABLE_EVENT_TYPE_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_DISABLE_EVENT_TYPE_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_SET_EVENT_FORMAT_MODE_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_SET_EVENT_FORMAT_MODE_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENT_TYPE_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_ENABLE_APP_EVENT_TYPE_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENT_TYPE_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_DISABLE_APP_EVENT_TYPE_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ENABLE_APP_EVENTS_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_ENABLE_APP_EVENTS_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DISABLE_APP_EVENTS_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_DISABLE_APP_EVENTS_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_RESET_APP_COUNTER_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_RESET_APP_COUNTER_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_SET_FILTER_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_SET_FILTER_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ENABLE_PORTS_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_ENABLE_PORTS_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DISABLE_PORTS_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_DISABLE_PORTS_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_RESET_FILTER_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_RESET_FILTER_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_RESET_ALL_FILTERS_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_RESET_ALL_FILTERS_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_ADD_EVENT_FILTER_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_ADD_EVENT_FILTER_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_DELETE_EVENT_FILTER_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_DELETE_EVENT_FILTER_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_WRITE_APP_DATA_FILE_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_WRITE_APP_DATA_FILE_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_WRITE_LOG_DATA_FILE_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_WRITE_LOG_DATA_FILE_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_SET_LOG_MODE_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_SET_LOG_MODE_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_CLEAR_LOG_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = CFE_EVS_CLEAR_LOG_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_INVALID_MID = { - .MsgId = 0xFFFF, + .MsgId = CFE_SB_MSGID_RESERVED, .CommandCode = 0 }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_CMD_INVALID_CC = { - .MsgId = CFE_EVS_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_CMD_MID), .CommandCode = 0x7F }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_SEND_HK = { - .MsgId = CFE_EVS_SEND_HK_MID + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SEND_HK_MID) }; static const UT_SoftwareBusSnapshot_Entry_t UT_EVS_LONGFMT_SNAPSHOTDATA = { - .MsgId = CFE_EVS_LONG_EVENT_MSG_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID), .SnapshotOffset = offsetof(CFE_EVS_LongEventTlm_t, Payload.PacketID.EventID), .SnapshotSize = sizeof(uint16) }; static const UT_SoftwareBusSnapshot_Entry_t UT_EVS_SHORTFMT_SNAPSHOTDATA = { - .MsgId = CFE_EVS_SHORT_EVENT_MSG_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SHORT_EVENT_MSG_MID), .SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.PacketID.EventID), .SnapshotSize = sizeof(uint16) }; @@ -892,14 +892,14 @@ void Test_Format(void) CFE_EVS_PacketID_t CapturedMsg; UT_SoftwareBusSnapshot_Entry_t LongFmtSnapshotData = { - .MsgId = CFE_EVS_LONG_EVENT_MSG_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID), .SnapshotBuffer = &CapturedMsg, .SnapshotOffset = offsetof(CFE_EVS_LongEventTlm_t, Payload.PacketID), .SnapshotSize = sizeof(CapturedMsg) }; UT_SoftwareBusSnapshot_Entry_t ShortFmtSnapshotData = { - .MsgId = CFE_EVS_SHORT_EVENT_MSG_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SHORT_EVENT_MSG_MID), .SnapshotBuffer = &CapturedMsg, .SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.PacketID), .SnapshotSize = sizeof(CapturedMsg) @@ -1052,7 +1052,7 @@ void Test_Ports(void) CFE_EVS_BitMaskCmd_t bitmaskcmd; UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = { - .MsgId = CFE_EVS_LONG_EVENT_MSG_MID + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID) }; #ifdef UT_VERBOSE @@ -1922,7 +1922,7 @@ void Test_EventCmd(void) CFE_EVS_AppNameCmd_t appnamecmd; UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = { - .MsgId = CFE_EVS_LONG_EVENT_MSG_MID + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID) }; #ifdef UT_VERBOSE @@ -2663,7 +2663,7 @@ void Test_Misc(void) char msg[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH + 2]; UT_SoftwareBusSnapshot_Entry_t HK_SnapshotData = { - .MsgId = CFE_EVS_HK_TLM_MID + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_HK_TLM_MID) }; diff --git a/fsw/cfe-core/unit-test/sb_UT.c b/fsw/cfe-core/unit-test/sb_UT.c index 2c1f4cd7a..a517498f2 100644 --- a/fsw/cfe-core/unit-test/sb_UT.c +++ b/fsw/cfe-core/unit-test/sb_UT.c @@ -40,6 +40,66 @@ */ #include "sb_UT.h" +/* + * MSG ID constants for unit testing: + * Unit test cases should not directly use integer MsgId values + * + * The following constants are of the CFE_SB_MsgId_t type + */ + +const CFE_SB_MsgId_t SB_UT_CMD_MID = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE); +const CFE_SB_MsgId_t SB_UT_TLM_MID = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE); + +const CFE_SB_MsgId_t SB_UT_CMD_MID1 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE+1); +const CFE_SB_MsgId_t SB_UT_CMD_MID2 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE+2); +const CFE_SB_MsgId_t SB_UT_CMD_MID3 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE+3); +const CFE_SB_MsgId_t SB_UT_CMD_MID4 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE+4); +const CFE_SB_MsgId_t SB_UT_CMD_MID5 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE+5); +const CFE_SB_MsgId_t SB_UT_CMD_MID6 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_CMD_MID_VALUE_BASE+6); + +const CFE_SB_MsgId_t SB_UT_TLM_MID1 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE+1); +const CFE_SB_MsgId_t SB_UT_TLM_MID2 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE+2); +const CFE_SB_MsgId_t SB_UT_TLM_MID3 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE+3); +const CFE_SB_MsgId_t SB_UT_TLM_MID4 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE+4); +const CFE_SB_MsgId_t SB_UT_TLM_MID5 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE+5); +const CFE_SB_MsgId_t SB_UT_TLM_MID6 = CFE_SB_MSGID_WRAP_VALUE(SB_UT_TLM_MID_VALUE_BASE+6); + +/* + * A MsgId value which still qualifies as valid + * + * This is a "borderline" value to test the limits of the validity checking + * The specific value depends on how MsgId is actually defined internally + */ +const CFE_SB_MsgId_t SB_UT_LAST_VALID_MID = CFE_SB_MSGID_WRAP_VALUE(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); + +/* + * A MsgId value which still qualifies as valid + * + * This is a "borderline" value to test the limits of the validity checking + * The specific value depends on how MsgId is actually defined internally + */ +const CFE_SB_MsgId_t SB_UT_FIRST_VALID_MID = CFE_SB_MSGID_WRAP_VALUE(0); + +/* + * A MsgId value which is in the middle of the valid range + * + * The specific value depends on how MsgId is actually defined internally + */ +const CFE_SB_MsgId_t SB_UT_INTERMEDIATE_VALID_MID = CFE_SB_MSGID_WRAP_VALUE(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID / 2 + 1); + +/* + * A MsgId value which is not valid but also not equal to CFE_SB_INVALID_MSG_ID + * Like CFE_SB_INVALID_MSG_ID, this should also _not_ pass the validity check. + */ +const CFE_SB_MsgId_t SB_UT_ALTERNATE_INVALID_MID = CFE_SB_MSGID_WRAP_VALUE(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1); + + +/* + * A MsgId value which is valid per CCSDS but does not have the secondary header bit set + */ +const CFE_SB_MsgId_t SB_UT_BARE_MID3 = CFE_SB_MSGID_WRAP_VALUE(0x0003); + + static char cMsg[UT_MAX_MESSAGE_LENGTH]; /* @@ -1029,7 +1089,7 @@ void Test_SB_Cmds_Noop(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&NoParamCmd, CFE_SB_CMD_MID, sizeof(NoParamCmd), true); + CFE_SB_InitMsg(&NoParamCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(NoParamCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &NoParamCmd, CFE_SB_NOOP_CC); CFE_SB.CmdPipePktPtr = (CFE_SB_MsgPtr_t) &NoParamCmd; CFE_SB_ProcessCmdPipePkt(); @@ -1071,7 +1131,7 @@ void Test_SB_Cmds_RstCtrs(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&NoParamCmd, CFE_SB_CMD_MID, sizeof(NoParamCmd), true); + CFE_SB_InitMsg(&NoParamCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(NoParamCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &NoParamCmd, CFE_SB_RESET_COUNTERS_CC); CFE_SB.CmdPipePktPtr = (CFE_SB_MsgPtr_t) &NoParamCmd; CFE_SB_ProcessCmdPipePkt(); @@ -1113,7 +1173,7 @@ void Test_SB_Cmds_Stats(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&NoParamCmd, CFE_SB_CMD_MID, sizeof(NoParamCmd), true); + CFE_SB_InitMsg(&NoParamCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(NoParamCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &NoParamCmd, CFE_SB_SEND_SB_STATS_CC); CFE_SB.CmdPipePktPtr = (CFE_SB_MsgPtr_t) &NoParamCmd; CFE_SB_ProcessCmdPipePkt(); @@ -1162,7 +1222,7 @@ void Test_SB_Cmds_RoutingInfoDef(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(WriteFileCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &WriteFileCmd, CFE_SB_SEND_ROUTING_INFO_CC); @@ -1242,7 +1302,7 @@ void Test_SB_Cmds_RoutingInfoSpec(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(WriteFileCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &WriteFileCmd, CFE_SB_SEND_ROUTING_INFO_CC); @@ -1287,7 +1347,7 @@ void Test_SB_Cmds_RoutingInfoCreateFail(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(WriteFileCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &WriteFileCmd, CFE_SB_SEND_ROUTING_INFO_CC); @@ -1476,7 +1536,7 @@ void Test_SB_Cmds_PipeInfoDef(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(WriteFileCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &WriteFileCmd, CFE_SB_SEND_PIPE_INFO_CC); @@ -1535,7 +1595,7 @@ void Test_SB_Cmds_PipeInfoSpec(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(WriteFileCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &WriteFileCmd, CFE_SB_SEND_PIPE_INFO_CC); @@ -1744,12 +1804,12 @@ void Test_SB_Cmds_MapInfoDef(void) CFE_SB_PipeId_t PipeId1; CFE_SB_PipeId_t PipeId2; CFE_SB_PipeId_t PipeId3; - CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID + 1; - CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID + 2; - CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID + 3; - CFE_SB_MsgId_t MsgId3 = SB_UT_TLM_MID + 4; - CFE_SB_MsgId_t MsgId4 = SB_UT_TLM_MID + 5; - CFE_SB_MsgId_t MsgId5 = SB_UT_TLM_MID + 6; + CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID1; + CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID2; + CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID3; + CFE_SB_MsgId_t MsgId3 = SB_UT_TLM_MID4; + CFE_SB_MsgId_t MsgId4 = SB_UT_TLM_MID5; + CFE_SB_MsgId_t MsgId5 = SB_UT_TLM_MID6; uint16 PipeDepth = 10; int32 ExpRtn; int32 ActRtn; @@ -1760,7 +1820,7 @@ void Test_SB_Cmds_MapInfoDef(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(WriteFileCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &WriteFileCmd, CFE_SB_SEND_MAP_INFO_CC); @@ -1832,7 +1892,7 @@ void Test_SB_Cmds_MapInfoSpec(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&WriteFileCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(WriteFileCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &WriteFileCmd, CFE_SB_SEND_MAP_INFO_CC); @@ -1973,12 +2033,12 @@ void Test_SB_Cmds_MapInfoWriteFail(void) CFE_SB_PipeId_t PipeId1; CFE_SB_PipeId_t PipeId2; CFE_SB_PipeId_t PipeId3; - CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID + 1; - CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID + 2; - CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID + 3; - CFE_SB_MsgId_t MsgId3 = SB_UT_TLM_MID + 4; - CFE_SB_MsgId_t MsgId4 = SB_UT_TLM_MID + 5; - CFE_SB_MsgId_t MsgId5 = SB_UT_TLM_MID + 6; + CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID1; + CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID2; + CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID3; + CFE_SB_MsgId_t MsgId3 = SB_UT_TLM_MID4; + CFE_SB_MsgId_t MsgId4 = SB_UT_TLM_MID5; + CFE_SB_MsgId_t MsgId5 = SB_UT_TLM_MID6; uint16 PipeDepth = 10; int32 ExpRtn; int32 ActRtn; @@ -2073,7 +2133,7 @@ void Test_SB_Cmds_EnRouteValParam(void) SB_ResetUnitTest(); CFE_SB_CreatePipe(&PipeId, PipeDepth, "EnRouteTestPipe"); CFE_SB_Subscribe(MsgId, PipeId); - CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(EnDisRouteCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &EnDisRouteCmd, CFE_SB_ENABLE_ROUTE_CC); @@ -2139,7 +2199,7 @@ void Test_SB_Cmds_EnRouteNonExist(void) CFE_SB_CreatePipe(&PipeId1, PipeDepth, "EnRouteTestPipe1"); CFE_SB_CreatePipe(&PipeId2, PipeDepth, "EnRouteTestPipe2"); CFE_SB_Subscribe(MsgId, PipeId1); - CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(EnDisRouteCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &EnDisRouteCmd, CFE_SB_ENABLE_ROUTE_CC); @@ -2199,11 +2259,11 @@ void Test_SB_Cmds_EnRouteInvParam(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(EnDisRouteCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &EnDisRouteCmd, CFE_SB_ENABLE_ROUTE_CC); - EnDisRouteCmd.Payload.MsgId = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID; + EnDisRouteCmd.Payload.MsgId = SB_UT_LAST_VALID_MID; EnDisRouteCmd.Payload.Pipe = 3; CFE_SB.CmdPipePktPtr = (CFE_SB_MsgPtr_t) &EnDisRouteCmd; CFE_SB_ProcessCmdPipePkt(); @@ -2245,7 +2305,7 @@ void Test_SB_Cmds_EnRouteInvParam2(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(EnDisRouteCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &EnDisRouteCmd, CFE_SB_ENABLE_ROUTE_CC); @@ -2292,11 +2352,11 @@ void Test_SB_Cmds_EnRouteInvParam3(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(EnDisRouteCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &EnDisRouteCmd, CFE_SB_ENABLE_ROUTE_CC); - EnDisRouteCmd.Payload.MsgId = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1; + EnDisRouteCmd.Payload.MsgId = SB_UT_ALTERNATE_INVALID_MID; EnDisRouteCmd.Payload.Pipe = 0; CFE_SB.CmdPipePktPtr = (CFE_SB_MsgPtr_t) &EnDisRouteCmd; CFE_SB_ProcessCmdPipePkt(); @@ -2343,7 +2403,7 @@ void Test_SB_Cmds_DisRouteValParam(void) SB_ResetUnitTest(); CFE_SB_CreatePipe(&PipeId, PipeDepth, "DisRouteTestPipe"); CFE_SB_Subscribe(MsgId, PipeId); - CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(EnDisRouteCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &EnDisRouteCmd, CFE_SB_DISABLE_ROUTE_CC); @@ -2408,7 +2468,7 @@ void Test_SB_Cmds_DisRouteNonExist(void) CFE_SB_CreatePipe(&PipeId1, PipeDepth, "DisRouteTestPipe1"); CFE_SB_CreatePipe(&PipeId2, PipeDepth, "DisRouteTestPipe2"); CFE_SB_Subscribe(MsgId, PipeId1); - CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(EnDisRouteCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &EnDisRouteCmd, CFE_SB_DISABLE_ROUTE_CC); @@ -2468,11 +2528,11 @@ void Test_SB_Cmds_DisRouteInvParam(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(EnDisRouteCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &EnDisRouteCmd, CFE_SB_DISABLE_ROUTE_CC); - EnDisRouteCmd.Payload.MsgId = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID; + EnDisRouteCmd.Payload.MsgId = SB_UT_LAST_VALID_MID; EnDisRouteCmd.Payload.Pipe = 3; CFE_SB.CmdPipePktPtr = (CFE_SB_MsgPtr_t) &EnDisRouteCmd; CFE_SB_ProcessCmdPipePkt(); @@ -2514,7 +2574,7 @@ void Test_SB_Cmds_DisRouteInvParam2(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(EnDisRouteCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &EnDisRouteCmd, CFE_SB_DISABLE_ROUTE_CC); @@ -2561,11 +2621,11 @@ void Test_SB_Cmds_DisRouteInvParam3(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&EnDisRouteCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(EnDisRouteCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &EnDisRouteCmd, CFE_SB_DISABLE_ROUTE_CC); - EnDisRouteCmd.Payload.MsgId = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1; + EnDisRouteCmd.Payload.MsgId = SB_UT_ALTERNATE_INVALID_MID; EnDisRouteCmd.Payload.Pipe = 0; CFE_SB.CmdPipePktPtr = (CFE_SB_MsgPtr_t) &EnDisRouteCmd; CFE_SB_ProcessCmdPipePkt(); @@ -2607,7 +2667,7 @@ void Test_SB_Cmds_SendHK(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&NoParamCmd, CFE_SB_SEND_HK_MID, + CFE_SB_InitMsg(&NoParamCmd, CFE_SB_ValueToMsgId(CFE_SB_SEND_HK_MID), sizeof(NoParamCmd), true); CFE_SB.CmdPipePktPtr = (CFE_SB_MsgPtr_t) &NoParamCmd; @@ -2644,7 +2704,7 @@ void Test_SB_Cmds_SendPrevSubs(void) CFE_SB_SendPrevSubs_t NoParamCmd; CFE_SB_PipeId_t PipeId1; CFE_SB_PipeId_t PipeId2; - CFE_SB_MsgId_t MsgId = 0x0003; + CFE_SB_MsgId_t MsgId = SB_UT_BARE_MID3; uint16 MsgLim = 4; uint16 PipeDepth = 50; int32 i; @@ -2658,7 +2718,7 @@ void Test_SB_Cmds_SendPrevSubs(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&NoParamCmd, CFE_SB_CMD_MID, sizeof(CFE_SB_SendPrevSubs_t), true); + CFE_SB_InitMsg(&NoParamCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(CFE_SB_SendPrevSubs_t), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &NoParamCmd, CFE_SB_SEND_PREV_SUBS_CC); CFE_SB.CmdPipePktPtr = (CFE_SB_MsgPtr_t) &NoParamCmd; CFE_SB_CreatePipe(&PipeId1, PipeDepth, "TestPipe1"); @@ -2679,7 +2739,7 @@ void Test_SB_Cmds_SendPrevSubs(void) if (i != CFE_SB_ALLSUBS_TLM_MID) { NumEvts += 2; - ActRtn = CFE_SB_Subscribe(i, PipeId1); + ActRtn = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(i), PipeId1); ExpRtn = CFE_SUCCESS; if (ActRtn != ExpRtn) @@ -2714,7 +2774,7 @@ void Test_SB_Cmds_SendPrevSubs(void) */ for (; i < CFE_SB_SUB_ENTRIES_PER_PKT * 3; i++) { - ActRtn = CFE_SB_Subscribe(i, PipeId1); + ActRtn = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(i), PipeId1); ExpRtn = CFE_SUCCESS; NumEvts += 2; @@ -2792,7 +2852,7 @@ void Test_SB_Cmds_SubRptOn(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&NoParamCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&NoParamCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(NoParamCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &NoParamCmd, CFE_SB_ENABLE_SUB_REPORTING_CC); @@ -2830,7 +2890,7 @@ void Test_SB_Cmds_SubRptOff(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&NoParamCmd, CFE_SB_CMD_MID, + CFE_SB_InitMsg(&NoParamCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(NoParamCmd), true); CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &NoParamCmd, CFE_SB_DISABLE_SUB_REPORTING_CC); @@ -2868,7 +2928,7 @@ void Test_SB_Cmds_UnexpCmdCode(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&NoParamCmd, CFE_SB_CMD_MID, sizeof(NoParamCmd), true); + CFE_SB_InitMsg(&NoParamCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(NoParamCmd), true); /* Use a command code known to be invalid */ CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &NoParamCmd, 99); @@ -2911,7 +2971,7 @@ void Test_SB_Cmds_BadCmdLength(void) int32 TestStat = CFE_PASS; SB_ResetUnitTest(); - CFE_SB_InitMsg(&EnableRouteCmd, CFE_SB_CMD_MID, sizeof(EnableRouteCmd) - 1, true); + CFE_SB_InitMsg(&EnableRouteCmd, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(EnableRouteCmd) - 1, true); /* Use a command code known to be invalid */ CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &EnableRouteCmd, CFE_SB_ENABLE_ROUTE_CC); @@ -3466,10 +3526,10 @@ void Test_DeletePipe_NoSubs(void) void Test_DeletePipe_WithSubs(void) { CFE_SB_PipeId_t PipedId; - CFE_SB_MsgId_t MsgId0 = SB_UT_CMD_MID + 1; - CFE_SB_MsgId_t MsgId1 = SB_UT_CMD_MID + 2; - CFE_SB_MsgId_t MsgId2 = SB_UT_CMD_MID + 3; - CFE_SB_MsgId_t MsgId3 = SB_UT_CMD_MID + 4; + CFE_SB_MsgId_t MsgId0 = SB_UT_CMD_MID1; + CFE_SB_MsgId_t MsgId1 = SB_UT_CMD_MID2; + CFE_SB_MsgId_t MsgId2 = SB_UT_CMD_MID3; + CFE_SB_MsgId_t MsgId3 = SB_UT_CMD_MID4; uint16 PipeDepth = 10; int32 ExpRtn; int32 ActRtn; @@ -3657,10 +3717,10 @@ void Test_DeletePipe_InvalidPipeOwner(void) void Test_DeletePipe_WithAppid(void) { CFE_SB_PipeId_t PipedId; - CFE_SB_MsgId_t MsgId0 = SB_UT_CMD_MID + 1; - CFE_SB_MsgId_t MsgId1 = SB_UT_CMD_MID + 2; - CFE_SB_MsgId_t MsgId2 = SB_UT_CMD_MID + 3; - CFE_SB_MsgId_t MsgId3 = SB_UT_CMD_MID + 4; + CFE_SB_MsgId_t MsgId0 = SB_UT_CMD_MID1; + CFE_SB_MsgId_t MsgId1 = SB_UT_CMD_MID2; + CFE_SB_MsgId_t MsgId2 = SB_UT_CMD_MID3; + CFE_SB_MsgId_t MsgId3 = SB_UT_CMD_MID4; uint32 AppId = 0; uint16 PipeDepth = 10; int32 ExpRtn; @@ -4406,7 +4466,7 @@ void Test_Subscribe_SubscribeEx(void) void Test_Subscribe_InvalidPipeId(void) { CFE_SB_PipeId_t PipeId = 2; - CFE_SB_MsgId_t MsgId = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1; + CFE_SB_MsgId_t MsgId = SB_UT_ALTERNATE_INVALID_MID; int32 ExpRtn; int32 ActRtn; int32 TestStat = CFE_PASS; @@ -4457,7 +4517,7 @@ void Test_Subscribe_InvalidPipeId(void) void Test_Subscribe_InvalidMsgId(void) { CFE_SB_PipeId_t PipeId; - CFE_SB_MsgId_t MsgId = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1; + CFE_SB_MsgId_t MsgId = SB_UT_ALTERNATE_INVALID_MID; uint16 PipeDepth = 10; int32 ExpRtn; int32 ActRtn; @@ -4810,7 +4870,7 @@ void Test_Subscribe_MaxMsgIdCount(void) for (i = 0; i < CFE_PLATFORM_SB_MAX_MSG_IDS + 1; i++) { - ActRtn = CFE_SB_Subscribe(i, PipeId2); + ActRtn = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(i), PipeId2); if (i < CFE_PLATFORM_SB_MAX_MSG_IDS) { @@ -4854,9 +4914,9 @@ void Test_Subscribe_SendPrevSubs(void) CFE_SB_PipeId_t PipeId0; CFE_SB_PipeId_t PipeId1; CFE_SB_PipeId_t PipeId2; - CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID + 1; - CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID + 2; - CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID + 3; + CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID1; + CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID2; + CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID3; uint16 PipeDepth = 50; int32 ExpRtn; int32 ActRtn; @@ -4921,9 +4981,9 @@ void Test_Subscribe_FindGlobalMsgIdCnt(void) CFE_SB_PipeId_t PipeId0; CFE_SB_PipeId_t PipeId1; CFE_SB_PipeId_t PipeId2; - CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID + 1; - CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID + 2; - CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID + 3; + CFE_SB_MsgId_t MsgId0 = SB_UT_TLM_MID1; + CFE_SB_MsgId_t MsgId1 = SB_UT_TLM_MID2; + CFE_SB_MsgId_t MsgId2 = SB_UT_TLM_MID3; uint16 PipeDepth = 50; uint16 MsgLim = 4; int32 ExpRtn; @@ -5260,7 +5320,7 @@ void Test_Unsubscribe_API(void) void Test_Unsubscribe_Basic(void) { CFE_SB_PipeId_t TestPipe; - CFE_SB_MsgId_t MsgId = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID / 2 + 1; + CFE_SB_MsgId_t MsgId = SB_UT_INTERMEDIATE_VALID_MID; uint16 PipeDepth = 50; int32 ExpRtn; int32 ActRtn; @@ -5329,7 +5389,7 @@ void Test_Unsubscribe_Local(void) CFE_SB_CreatePipe(&TestPipe, PipeDepth, "TestPipe"); CFE_SB_Subscribe(MsgId, TestPipe); ExpRtn = CFE_SUCCESS; - ActRtn = CFE_SB_UnsubscribeLocal(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID, TestPipe); + ActRtn = CFE_SB_UnsubscribeLocal(SB_UT_LAST_VALID_MID, TestPipe); if (ActRtn != ExpRtn) { @@ -5387,7 +5447,7 @@ void Test_Unsubscribe_InvalParam(void) /* Perform test using a bad message ID */ ExpRtn = CFE_SB_BAD_ARGUMENT; - ActRtn = CFE_SB_Unsubscribe(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1, TestPipe); + ActRtn = CFE_SB_Unsubscribe(SB_UT_ALTERNATE_INVALID_MID, TestPipe); if (ActRtn != ExpRtn) { @@ -5416,7 +5476,7 @@ void Test_Unsubscribe_InvalParam(void) { /* Perform test using a bad scope value */ ExpRtn = CFE_SB_BAD_ARGUMENT; - ActRtn = CFE_SB_UnsubscribeFull(0, TestPipe, CFE_SB_LOCAL + 1, + ActRtn = CFE_SB_UnsubscribeFull(SB_UT_FIRST_VALID_MID, TestPipe, CFE_SB_LOCAL + 1, CallerId); if (ActRtn != ExpRtn) @@ -5439,7 +5499,7 @@ void Test_Unsubscribe_InvalParam(void) SavedPipeId = CFE_SB.PipeTbl[0].PipeId; CFE_SB.PipeTbl[0].PipeId = CFE_PLATFORM_SB_MAX_PIPES; CFE_SB.PipeTbl[0].InUse = 1; - ActRtn = CFE_SB_Unsubscribe(0, CFE_PLATFORM_SB_MAX_PIPES); + ActRtn = CFE_SB_Unsubscribe(SB_UT_FIRST_VALID_MID, CFE_PLATFORM_SB_MAX_PIPES); if (ActRtn != ExpRtn) { @@ -5502,7 +5562,7 @@ void Test_Unsubscribe_NoMatch(void) CFE_SB_CreatePipe(&TestPipe, PipeDepth, "TestPipe"); CFE_SB_Subscribe(MsgId, TestPipe); ExpRtn = CFE_SUCCESS; - ActRtn = CFE_SB_Unsubscribe(MsgId + 1, TestPipe); + ActRtn = CFE_SB_Unsubscribe(SB_UT_TLM_MID1, TestPipe); if (ActRtn != ExpRtn) { @@ -5971,10 +6031,10 @@ void Test_SendMsg_InvalidMsgId(void) #endif SB_ResetUnitTest(); - CFE_SB_InitMsg(&TlmPkt, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1, + CFE_SB_InitMsg(&TlmPkt, SB_UT_ALTERNATE_INVALID_MID, sizeof(TlmPkt), true); - CFE_SB_SetMsgId(TlmPktPtr, 0xFFFF); + CFE_SB_SetMsgId(TlmPktPtr, CFE_SB_INVALID_MSG_ID); CCSDS_WR_APID(TlmPktPtr->Hdr, 0x7FF ); @@ -7344,7 +7404,7 @@ void Test_SendMsg_InvalidMsgId_ZeroCopy(void) } else { - CFE_SB_InitMsg(TlmPktPtr, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1, + CFE_SB_InitMsg(TlmPktPtr, SB_UT_ALTERNATE_INVALID_MID, sizeof(SB_UT_Test_Tlm_t), true); ActRtn = CFE_SB_SendMsgFull(TlmPktPtr, CFE_SB_INCREMENT_TLM, CFE_SB_SEND_ZEROCOPY); @@ -8090,7 +8150,8 @@ void Test_RcvMsg_PendForever(void) if (PtrToMsg != NULL) { snprintf(cMsg, UT_MAX_MESSAGE_LENGTH, - "Received Msg 0x%x", (unsigned int)CFE_SB_GetMsgId(PtrToMsg)); + "Received Msg 0x%x", + (unsigned int)CFE_SB_MsgIdToValue(CFE_SB_GetMsgId(PtrToMsg))); #ifdef UT_VERBOSE UT_Text(cMsg); #endif @@ -8308,7 +8369,7 @@ void Test_CFE_SB_InitMsg_True(void) /* Set entire cmd packet to all f's */ memset(SBCmdPtr, 0xff, sizeof(SBCmd)); - CFE_SB_InitMsg(SBCmdPtr, CFE_SB_CMD_MID, sizeof(SBCmd), true); + CFE_SB_InitMsg(SBCmdPtr, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(SBCmd), true); result = SBCmd.Cmd32Param1 == 0 && SBCmd.Cmd16Param1 == 0 && SBCmd.Cmd16Param2 == 0 && @@ -8345,7 +8406,7 @@ void Test_CFE_SB_InitMsg_False(void) SBCmd.Cmd8Param2 == 0xff && SBCmd.Cmd8Param3 == 0xff && SBCmd.Cmd8Param4 == 0xff; - CFE_SB_InitMsg(SBCmdPtr, CFE_SB_CMD_MID, sizeof(SBCmd), false); + CFE_SB_InitMsg(SBCmdPtr, CFE_SB_ValueToMsgId(CFE_SB_CMD_MID), sizeof(SBCmd), false); UT_Report(__FILE__, __LINE__, result, "SB_TestInitMsg_False", "Leave message content"); @@ -8595,6 +8656,7 @@ void Test_CFE_SB_SetGetMsgId(void) SB_UT_Test_Cmd_t SBCmd; CFE_SB_MsgPtr_t SBCmdPtr = (CFE_SB_MsgPtr_t) &SBCmd; CFE_SB_MsgId_t MsgIdReturned; + CFE_SB_MsgId_t MsgIdSet; uint32 TestStat; uint32 i; @@ -8608,15 +8670,16 @@ void Test_CFE_SB_SetGetMsgId(void) /* Set entire command packet to all f's */ memset(SBCmdPtr, 0xff, sizeof(SBCmd)); - CFE_SB_SetMsgId(SBCmdPtr, CFE_SB_CMD_MID); + MsgIdSet = CFE_SB_ValueToMsgId(CFE_SB_CMD_MID); + CFE_SB_SetMsgId(SBCmdPtr, MsgIdSet); MsgIdReturned = CFE_SB_GetMsgId(SBCmdPtr); - if (MsgIdReturned != CFE_SB_CMD_MID) + if (!CFE_SB_MsgId_Equal(MsgIdReturned, MsgIdSet)) { snprintf(cMsg, UT_MAX_MESSAGE_LENGTH, "CFE_SB_GetMsgId returned 0x%lx, expected 0x%lx", - (unsigned long) MsgIdReturned, - (unsigned long) CFE_SB_CMD_MID); + (unsigned long) CFE_SB_MsgIdToValue(MsgIdReturned), + (unsigned long) CFE_SB_MsgIdToValue(MsgIdSet)); UT_Text(cMsg); TestStat = CFE_FAIL; } @@ -8635,9 +8698,11 @@ void Test_CFE_SB_SetGetMsgId(void) /* Looping through every value from 0 to 0xffff */ for (i = 0; i <= 0xFFFF; i++) { - CFE_SB_SetMsgId(SBCmdPtr, i); + MsgIdSet = CFE_SB_ValueToMsgId(i); + CFE_SB_SetMsgId(SBCmdPtr, MsgIdSet); + MsgIdReturned = CFE_SB_GetMsgId(SBCmdPtr); - if (CFE_SB_GetMsgId(SBCmdPtr) != i) + if (!CFE_SB_MsgId_Equal(MsgIdReturned, MsgIdSet)) { break; } @@ -9444,7 +9509,7 @@ void Test_CFE_SB_ChecksumUtils(void) TestStat = CFE_PASS; /* Initialize pkt, setting data to zero */ - CFE_SB_InitMsg(SBCmdPtr, 0x1805, sizeof(SBCmd), true); + CFE_SB_InitMsg(SBCmdPtr, CFE_SB_ValueToMsgId(0x1805), sizeof(SBCmd), true); CCSDS_WR_SID( (*((CCSDS_PriHdr_t*) SBCmdPtr)), 0x1805 ); @@ -9502,7 +9567,7 @@ void Test_CFE_SB_ChecksumUtils(void) TestStat = CFE_PASS; /* Initialize pkt, setting data to zero */ - CFE_SB_InitMsg(SBNoSecHdrPktPtr, 0x1005, + CFE_SB_InitMsg(SBNoSecHdrPktPtr, CFE_SB_ValueToMsgId(0x1005), sizeof(SBNoSecHdrPkt), true); @@ -9557,7 +9622,7 @@ void Test_CFE_SB_ChecksumUtils(void) TestStat = CFE_PASS; /* Initialize pkt, setting data to zero */ - CFE_SB_InitMsg(SBTlmPtr, 0x0805, sizeof(SBTlm), true); + CFE_SB_InitMsg(SBTlmPtr, CFE_SB_ValueToMsgId(0x0805), sizeof(SBTlm), true); /* Set checksum field */ CFE_SB_GenerateChecksum(SBTlmPtr); @@ -9582,7 +9647,7 @@ void Test_CFE_SB_ChecksumUtils(void) /* Change 1 byte in pkt and verify checksum is no longer valid. * Increment MsgId by 1 to 0x0806. Validation expected to return false */ - CFE_SB_SetMsgId(SBTlmPtr, 0x1806); + CFE_SB_SetMsgId(SBTlmPtr, CFE_SB_ValueToMsgId(0x1806)); RtnFrmValidate = CFE_SB_ValidateChecksum(SBTlmPtr); ExpRtnFrmVal = false; @@ -9605,7 +9670,7 @@ void Test_CFE_SB_ChecksumUtils(void) TestStat = CFE_PASS; /* Initialize pkt, setting data to zero */ - CFE_SB_InitMsg(SBNoSecHdrPktPtr, 0x0005, + CFE_SB_InitMsg(SBNoSecHdrPktPtr, CFE_SB_ValueToMsgId(0x0005), sizeof(SBNoSecHdrPkt), true); /* Setting checksum field */ @@ -9632,7 +9697,7 @@ void Test_CFE_SB_ChecksumUtils(void) * Increment MsgId by 1 to 0x0006. Validation expected to * return false */ - CFE_SB_SetMsgId(SBNoSecHdrPktPtr, 0x0006); + CFE_SB_SetMsgId(SBNoSecHdrPktPtr, CFE_SB_ValueToMsgId(0x0006)); RtnFrmValidate = CFE_SB_ValidateChecksum(SBNoSecHdrPktPtr); ExpRtnFrmVal = false; @@ -9664,7 +9729,7 @@ void Test_CFE_SB_ValidateMsgId(void) SB_ResetUnitTest(); /* Validate Msg Id */ - MsgId = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID; + MsgId = SB_UT_LAST_VALID_MID; ActualReturn = CFE_SB_ValidateMsgId(MsgId); UT_Report(__FILE__, __LINE__, @@ -9673,7 +9738,7 @@ void Test_CFE_SB_ValidateMsgId(void) "Testing validation for a valid MsgId"); /* Test for invalid msg id */ - MsgId = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1; + MsgId = SB_UT_ALTERNATE_INVALID_MID; ActualReturn = CFE_SB_ValidateMsgId(MsgId); UT_Report(__FILE__, __LINE__, @@ -10018,7 +10083,7 @@ void Test_CFE_SB_Buffers(void) SB_ResetUnitTest(); CFE_SB.StatTlmMsg.Payload.MemInUse = 0; CFE_SB.StatTlmMsg.Payload.PeakMemInUse = ExpRtn; - bd = CFE_SB_GetBufferFromPool(0, 0); + bd = CFE_SB_GetBufferFromPool(SB_UT_FIRST_VALID_MID, 0); ActRtn = CFE_SB.StatTlmMsg.Payload.PeakMemInUse; if (ActRtn != ExpRtn) @@ -10196,7 +10261,7 @@ void Test_CFE_SB_BadPipeInfo(void) TestStat = CFE_PASS; ExpRtn = CFE_SB_BAD_ARGUMENT; - ActRtn = CFE_SB_SubscribeFull(0 ,0, CFE_SB_Default_Qos, + ActRtn = CFE_SB_SubscribeFull(SB_UT_FIRST_VALID_MID ,0, CFE_SB_Default_Qos, CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT, 2); if (ActRtn != ExpRtn) @@ -10249,7 +10314,7 @@ void Test_SB_SendMsgPaths(void) /* Test inhibiting sending a "no subscriptions for a message ID" message */ SB_ResetUnitTest(); - CFE_SB_InitMsg(&NoParamCmd, CFE_SB_SEND_HK_MID, + CFE_SB_InitMsg(&NoParamCmd, CFE_SB_ValueToMsgId(CFE_SB_SEND_HK_MID), sizeof(NoParamCmd), true); CFE_SB.CmdPipePktPtr = (CFE_SB_MsgPtr_t) &NoParamCmd; CFE_SB.StopRecurseFlags[1] |= CFE_BIT(CFE_SB_SEND_NO_SUBS_EID_BIT); @@ -10569,7 +10634,7 @@ void Test_RcvMsg_UnsubResubPath(void) { snprintf(cMsg, UT_MAX_MESSAGE_LENGTH, "Received Msg 0x%x", - (unsigned int) CFE_SB_GetMsgId(PtrToMsg)); + (unsigned int) CFE_SB_MsgIdToValue(CFE_SB_GetMsgId(PtrToMsg))); #ifdef UT_VERBOSE UT_Text(cMsg); #endif diff --git a/fsw/cfe-core/unit-test/sb_UT.h b/fsw/cfe-core/unit-test/sb_UT.h index b07154e30..b5e12ed3d 100644 --- a/fsw/cfe-core/unit-test/sb_UT.h +++ b/fsw/cfe-core/unit-test/sb_UT.h @@ -88,8 +88,8 @@ typedef struct { uint16 Tlm16Param2; } SB_UT_TstPktWoSecHdr_t; -#define SB_UT_CMD_MID CFE_MISSION_CMD_MID_BASE1 + 1 -#define SB_UT_TLM_MID CFE_MISSION_TLM_MID_BASE1 + 1 +#define SB_UT_CMD_MID_VALUE_BASE CFE_MISSION_CMD_MID_BASE1 + 1 +#define SB_UT_TLM_MID_VALUE_BASE CFE_MISSION_TLM_MID_BASE1 + 1 /* SB unit test functions */ /*****************************************************************************/ diff --git a/fsw/cfe-core/unit-test/tbl_UT.c b/fsw/cfe-core/unit-test/tbl_UT.c index d878ccb2c..c972db553 100644 --- a/fsw/cfe-core/unit-test/tbl_UT.c +++ b/fsw/cfe-core/unit-test/tbl_UT.c @@ -61,22 +61,22 @@ void **ArrayOfPtrsToTblPtrs[2]; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TBL_CMD_NOOP_CC = { - .MsgId = CFE_TBL_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_CMD_MID), .CommandCode = CFE_TBL_NOOP_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TBL_CMD_RESET_COUNTERS_CC = { - .MsgId = CFE_TBL_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_CMD_MID), .CommandCode = CFE_TBL_RESET_COUNTERS_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TBL_INVALID_MID = { - .MsgId = 0xFFFF, + .MsgId = CFE_SB_MSGID_RESERVED, .CommandCode = 0 }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TBL_CMD_INVALID_CC = { - .MsgId = CFE_TBL_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_CMD_MID), .CommandCode = 0x7F }; @@ -378,7 +378,7 @@ void Test_CFE_TBL_InitData(void) UT_SetDataBuffer(UT_KEY(CFE_SB_SetMsgId), MsgIdBuf, sizeof(MsgIdBuf), false); CFE_TBL_InitData(); UT_Report(__FILE__, __LINE__, - MsgIdBuf[1] == CFE_TBL_REG_TLM_MID && + CFE_SB_MsgId_Equal(MsgIdBuf[1], CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID)) && UT_GetStubCount(UT_KEY(CFE_SB_SetMsgId)) == 2, "CFE_TBL_SearchCmdHndlrTbl", "Initialize data"); @@ -399,7 +399,7 @@ void Test_CFE_TBL_SearchCmdHndlrTbl(void) /* Test successfully finding a matching message ID and command code */ UT_InitData(); - MsgID = CFE_TBL_CMD_MID; + MsgID = CFE_SB_ValueToMsgId(CFE_TBL_CMD_MID); CmdCode = CFE_TBL_NOOP_CC; UT_Report(__FILE__, __LINE__, CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, @@ -411,7 +411,7 @@ void Test_CFE_TBL_SearchCmdHndlrTbl(void) */ UT_InitData(); TblIndex = 0; - MsgID = CFE_TBL_SEND_HK_MID; + MsgID = CFE_SB_ValueToMsgId(CFE_TBL_SEND_HK_MID); UT_Report(__FILE__, __LINE__, CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, "CFE_TBL_SearchCmdHndlrTbl", @@ -422,7 +422,7 @@ void Test_CFE_TBL_SearchCmdHndlrTbl(void) */ UT_InitData(); TblIndex = CFE_TBL_BAD_CMD_CODE; - MsgID = CFE_TBL_CMD_MID; + MsgID = CFE_SB_ValueToMsgId(CFE_TBL_CMD_MID); CmdCode = 0xffff; UT_Report(__FILE__, __LINE__, CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, @@ -432,7 +432,7 @@ void Test_CFE_TBL_SearchCmdHndlrTbl(void) /* Test with a message ID that does not match */ UT_InitData(); TblIndex = CFE_TBL_BAD_MSG_ID; - MsgID = 0xffff; + MsgID = CFE_SB_INVALID_MSG_ID; UT_Report(__FILE__, __LINE__, CFE_TBL_SearchCmdHndlrTbl(MsgID, CmdCode) == TblIndex, "CFE_TBL_SearchCmdHndlrTbl", @@ -2713,7 +2713,7 @@ void Test_CFE_TBL_NotifyByMessage(void) /* Test successful notification */ UT_InitData(); EventsCorrect = (UT_GetNumEventsSent() == 0); - RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, 1, 1, 1); + RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1); UT_Report(__FILE__, __LINE__, RtnCode == CFE_SUCCESS && EventsCorrect, "CFE_TBL_NotifyByMessage", @@ -2725,7 +2725,7 @@ void Test_CFE_TBL_NotifyByMessage(void) UT_InitData(); CFE_TBL_TaskData.Registry[0].OwnerAppId = CFE_TBL_NOT_OWNED; EventsCorrect = (UT_GetNumEventsSent() == 0); - RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, 1, 1, 1); + RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1); UT_Report(__FILE__, __LINE__, RtnCode == CFE_TBL_ERR_NO_ACCESS && EventsCorrect, "CFE_TBL_NotifyByMessage", @@ -2735,7 +2735,7 @@ void Test_CFE_TBL_NotifyByMessage(void) UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, CFE_ES_ERR_APPID); EventsCorrect = (UT_GetNumEventsSent() == 0); - RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, 1, 1, 1); + RtnCode = CFE_TBL_NotifyByMessage(App1TblHandle1, CFE_SB_ValueToMsgId(1), 1, 1); UT_Report(__FILE__, __LINE__, RtnCode == CFE_ES_ERR_APPID && EventsCorrect, "CFE_TBL_NotifyByMessage", diff --git a/fsw/cfe-core/unit-test/time_UT.c b/fsw/cfe-core/unit-test/time_UT.c index 7e1d9e94d..4b8097cc6 100644 --- a/fsw/cfe-core/unit-test/time_UT.c +++ b/fsw/cfe-core/unit-test/time_UT.c @@ -56,116 +56,116 @@ const char *TIME_SYSLOG_MSGS[] = static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_SEND_HK = { - .MsgId = CFE_TIME_SEND_HK_MID + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_SEND_HK_MID) }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_TONE_CMD = { - .MsgId = CFE_TIME_TONE_CMD_MID + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_TONE_CMD_MID) }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_DATA_CMD = { - .MsgId = CFE_TIME_DATA_CMD_MID + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_DATA_CMD_MID) }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_1HZ_CMD = { - .MsgId = CFE_TIME_1HZ_CMD_MID + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_1HZ_CMD_MID) }; #if (CFE_PLATFORM_TIME_CFG_SERVER == true) static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_SEND_CMD = { - .MsgId = CFE_TIME_SEND_CMD_MID + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_SEND_CMD_MID) }; #endif static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_NOOP_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_NOOP_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_RESET_COUNTERS_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_RESET_COUNTERS_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SEND_DIAGNOSTIC_TLM_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SEND_DIAGNOSTIC_TLM_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_STATE_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_STATE_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_SOURCE_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_SOURCE_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_SIGNAL_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_SIGNAL_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_ADD_DELAY_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_ADD_DELAY_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SUB_DELAY_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SUB_DELAY_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_TIME_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_TIME_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_MET_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_MET_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_STCF_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_STCF_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_LEAP_SECONDS_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_LEAP_SECONDS_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_ADD_ADJUST_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_ADD_ADJUST_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SUB_ADJUST_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SUB_ADJUST_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_ADD_1HZ_ADJUSTMENT_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_ADD_1HZ_ADJUSTMENT_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SUB_1HZ_ADJUSTMENT_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SUB_1HZ_ADJUSTMENT_CC }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_INVALID_MID = { - .MsgId = 0xFFFF, + .MsgId = CFE_SB_MSGID_RESERVED, .CommandCode = 0 }; static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_INVALID_CC = { - .MsgId = CFE_TIME_CMD_MID, + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = 0x7F }; @@ -1889,7 +1889,7 @@ void Test_PipeCmds(void) UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = { - .MsgId = CFE_TIME_HK_TLM_MID + .MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_HK_TLM_MID) }; #if (CFE_PLATFORM_TIME_CFG_SERVER == true) diff --git a/fsw/cfe-core/unit-test/ut_support.c b/fsw/cfe-core/unit-test/ut_support.c index f1a363716..f8fa5d153 100644 --- a/fsw/cfe-core/unit-test/ut_support.c +++ b/fsw/cfe-core/unit-test/ut_support.c @@ -258,7 +258,7 @@ int32 UT_SoftwareBusSnapshotHook(void *UserObj, int32 StubRetcode, uint32 CallCo } if (MsgPtr != NULL && Snapshot != NULL && - Snapshot->MsgId == CFE_SB_GetMsgId((CFE_SB_MsgPtr_t)MsgPtr)) + CFE_SB_MsgId_Equal(Snapshot->MsgId, CFE_SB_GetMsgId((CFE_SB_MsgPtr_t)MsgPtr))) { ++Snapshot->Count; if (Snapshot->SnapshotSize > 0 && Snapshot->SnapshotBuffer != NULL) diff --git a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c index b410d1b88..71cce5a05 100644 --- a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c @@ -273,28 +273,29 @@ uint16 CFE_SB_GetCmdCode(CFE_SB_MsgPtr_t MsgPtr) ******************************************************************************/ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr) { - CFE_SB_MsgId_t MsgId = 0; + CFE_SB_MsgId_t Result = CFE_SB_INVALID_MSG_ID; + CFE_SB_MsgId_Atom_t MsgIdVal = 0; UT_DEFAULT_IMPL(CFE_SB_GetMsgId); - if (UT_Stub_CopyToLocal(UT_KEY(CFE_SB_GetMsgId), &MsgId, sizeof(MsgId)) < sizeof(MsgId)) + if (UT_Stub_CopyToLocal(UT_KEY(CFE_SB_GetMsgId), &Result, sizeof(Result)) < sizeof(Result)) { #ifdef MESSAGE_FORMAT_IS_CCSDS #ifndef MESSAGE_FORMAT_IS_CCSDS_VER_2 - MsgId = CCSDS_RD_SID(MsgPtr->Hdr); + MsgIdVal = CCSDS_RD_SID(MsgPtr->Hdr); #else uint32 SubSystemId; - MsgId = CCSDS_RD_APID(MsgPtr->Hdr); /* Primary header APID */ + MsgIdVal = CCSDS_RD_APID(MsgPtr->Hdr); /* Primary header APID */ if ( CCSDS_RD_TYPE(MsgPtr->Hdr) == CCSDS_CMD) - MsgId = MsgId | CFE_SB_CMD_MESSAGE_TYPE; + MsgIdVal = MsgIdVal | CFE_SB_CMD_MESSAGE_TYPE; /* Add in the SubSystem ID as needed */ SubSystemId = CCSDS_RD_SUBSYSTEM_ID(MsgPtr->SpacePacket.ApidQ); - MsgId = (MsgId | (SubSystemId << 8)); + MsgIdVal = (MsgIdVal | (SubSystemId << 8)); /* Example code to add in the System ID as needed. */ /* The default is to init this field to the Spacecraft ID but ignore for routing. */ @@ -302,13 +303,14 @@ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr) /* prohibitively large routing and index tables. */ /* uint16 SystemId; */ /* SystemId = CCSDS_RD_SYSTEM_ID(HdrPtr->ApidQ); */ -/* MsgId = (MsgId | (SystemId << 16)) */ +/* MsgIdVal = (MsgIdVal | (SystemId << 16)) */ #endif #endif + Result = CFE_SB_ValueToMsgId(MsgIdVal); } -return MsgId; + return Result; } /*****************************************************************************/ @@ -491,15 +493,16 @@ void CFE_SB_SetMsgId(CFE_SB_MsgPtr_t MsgPtr, CFE_SB_MsgId_t MsgId) { UT_DEFAULT_IMPL(CFE_SB_SetMsgId); UT_Stub_CopyFromLocal(UT_KEY(CFE_SB_SetMsgId), (uint8*)&MsgId, sizeof(MsgId)); -#ifndef MESSAGE_FORMAT_IS_CCSDS_VER_2 - CCSDS_WR_SID(MsgPtr->Hdr, MsgId); + CFE_SB_MsgId_Atom_t MsgIdVal = CFE_SB_MsgIdToValue(MsgId); +#ifndef MESSAGE_FORMAT_IS_CCSDS_VER_2 + CCSDS_WR_SID(MsgPtr->Hdr, MsgIdVal); #else CCSDS_WR_VERS(MsgPtr->SpacePacket.Hdr, 1); /* Set the stream ID APID in the primary header. */ - CCSDS_WR_APID(MsgPtr->SpacePacket.Hdr, CFE_SB_RD_APID_FROM_MSGID(MsgId) ); + CCSDS_WR_APID(MsgPtr->SpacePacket.Hdr, CFE_SB_RD_APID_FROM_MSGID(MsgIdVal) ); - CCSDS_WR_TYPE(MsgPtr->SpacePacket.Hdr, CFE_SB_RD_TYPE_FROM_MSGID(MsgId) ); + CCSDS_WR_TYPE(MsgPtr->SpacePacket.Hdr, CFE_SB_RD_TYPE_FROM_MSGID(MsgIdVal) ); CCSDS_CLR_SEC_APIDQ(MsgPtr->SpacePacket.ApidQ); @@ -510,7 +513,7 @@ void CFE_SB_SetMsgId(CFE_SB_MsgPtr_t MsgPtr, CFE_SB_MsgId_t MsgId) CCSDS_WR_PLAYBACK(MsgPtr->SpacePacket.ApidQ, false); - CCSDS_WR_SUBSYSTEM_ID(MsgPtr->SpacePacket.ApidQ, CFE_SB_RD_SUBSYS_ID_FROM_MSGID(MsgId)); + CCSDS_WR_SUBSYSTEM_ID(MsgPtr->SpacePacket.ApidQ, CFE_SB_RD_SUBSYS_ID_FROM_MSGID(MsgIdVal)); CCSDS_WR_SYSTEM_ID(MsgPtr->SpacePacket.ApidQ, CFE_SPACECRAFT_ID); From 9a6950b81ee9cffa878a3e9082ddfc87179a4841 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 21 Apr 2020 14:28:30 -0400 Subject: [PATCH 10/15] Fix #632, Infer OSAL_SYSTEM_BSPTYPE from CFE_SYSTEM_PSP_NAME Normally the CFE PSP uses/links with an OSAL BSP of the same name. This removes the need to explicitly specify OSAL_SYSTEM_BSPTYPE in the toolchain file, as it can be reliably inferred. --- cmake/arch_build.cmake | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/cmake/arch_build.cmake b/cmake/arch_build.cmake index 3ca4bd343..32d6ed50c 100644 --- a/cmake/arch_build.cmake +++ b/cmake/arch_build.cmake @@ -272,21 +272,19 @@ function(prepare) add_definitions(-DSIMULATION=${SIMULATION}) endif (SIMULATION) - # Check that PSPNAME, BSPTYPE, and OSTYPE are set properly for this arch - if (NOT CFE_SYSTEM_PSPNAME OR NOT OSAL_SYSTEM_OSTYPE) + # Check that PSPNAME is set properly for this arch + if (NOT CFE_SYSTEM_PSPNAME) if (CMAKE_CROSSCOMPILING) - message(FATAL_ERROR "Cross-compile toolchain ${CMAKE_TOOLCHAIN_FILE} must define CFE_SYSTEM_PSPNAME and OSAL_SYSTEM_OSTYPE") + message(FATAL_ERROR "Cross-compile toolchain ${CMAKE_TOOLCHAIN_FILE} must define CFE_SYSTEM_PSPNAME") elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") # Export the variables determined here up to the parent scope SET(CFE_SYSTEM_PSPNAME "pc-linux" PARENT_SCOPE) - SET(OSAL_SYSTEM_BSPTYPE "pc-linux" PARENT_SCOPE) - SET(OSAL_SYSTEM_OSTYPE "posix" PARENT_SCOPE) else () # Not cross compiling and host system is not recognized - message(FATAL_ERROR "Do not know how to set CFE_SYSTEM_PSPNAME and OSAL_SYSTEM_OSTYPE on ${CMAKE_SYSTEM_NAME} system") + message(FATAL_ERROR "Do not know how to set CFE_SYSTEM_PSPNAME on ${CMAKE_SYSTEM_NAME} system") endif() - endif (NOT CFE_SYSTEM_PSPNAME OR NOT OSAL_SYSTEM_OSTYPE) + endif (NOT CFE_SYSTEM_PSPNAME) # Truncate the global TGTSYS_LIST to be only the target architecture set(TGTSYS_LIST ${TARGETSYSTEM} PARENT_SCOPE) @@ -318,9 +316,22 @@ function(process_arch SYSVAR) endif(NOT TGTNAME) list(APPEND INSTALL_TARGET_LIST ${TGTNAME}) endforeach() + + # Assume use of an OSAL BSP of the same name as the CFE PSP + # This can be overridden by the PSP-specific build_options but normally this is expected. + set(CFE_PSP_EXPECTED_OSAL_BSPTYPE ${CFE_SYSTEM_PSPNAME}) # Include any specific compiler flags or config from the selected PSP include(${MISSION_SOURCE_DIR}/psp/fsw/${CFE_SYSTEM_PSPNAME}/make/build_options.cmake) + + if (NOT DEFINED OSAL_SYSTEM_BSPTYPE) + # Implicitly use the OSAL BSP that corresponds with the CFE PSP + set(OSAL_SYSTEM_BSPTYPE ${CFE_PSP_EXPECTED_OSAL_BSPTYPE}) + elseif (NOT OSAL_SYSTEM_BSPTYPE STREQUAL CFE_PSP_EXPECTED_OSAL_BSPTYPE) + # Generate a warning about the BSPTYPE not being expected. + # Not calling this a fatal error because it could possibly be intended during development + message(WARNING "Mismatched PSP/BSP: ${CFE_SYSTEM_PSPNAME} implies ${CFE_PSP_EXPECTED_OSAL_BSPTYPE}, but ${OSAL_SYSTEM_BSPTYPE} is configured") + endif() # The "inc" directory in the binary dir contains the generated wrappers, if any include_directories(${MISSION_BINARY_DIR}/inc) From e636967f12bac81b93294866ff4d218962d7f6f2 Mon Sep 17 00:00:00 2001 From: dmknutsen Date: Tue, 31 Mar 2020 14:44:52 -0400 Subject: [PATCH 11/15] Fixes #240, removes MESSAGE_FORMAT_IS_CCSDS ifdefs from code --- cmake/mission_build.cmake | 7 ----- cmake/sample_defs/sample_mission_cfg.h | 6 ++-- fsw/cfe-core/src/inc/cfe_sb.h | 31 +++++++++----------- fsw/cfe-core/src/sb/cfe_sb_init.c | 2 -- fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c | 3 -- fsw/cfe-core/src/sb/cfe_sb_priv.c | 2 -- fsw/cfe-core/src/sb/cfe_sb_util.c | 37 ------------------------ fsw/cfe-core/src/sb/cfe_sb_verify.h | 4 --- fsw/cfe-core/ut-stubs/ut_sb_stubs.c | 2 -- 9 files changed, 16 insertions(+), 78 deletions(-) diff --git a/cmake/mission_build.cmake b/cmake/mission_build.cmake index 446860bd6..d09ee5b45 100644 --- a/cmake/mission_build.cmake +++ b/cmake/mission_build.cmake @@ -232,13 +232,6 @@ function(prepare) "${osal_MISSION_DIR}/src/os/inc/*.h") string(REPLACE ";" " \\\n" MISSION_OSAL_HEADERFILES "${MISSION_OSAL_HEADERFILES}") - # PREDEFINED - set(USERGUIDE_PREDEFINED - "MESSAGE_FORMAT_IS_CCSDS") - - set(OSALGUIDE_PREDEFINED - "MESSAGE_FORMAT_IS_CCSDS") - configure_file("${CFE_SOURCE_DIR}/cmake/cfe-usersguide.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/cfe-usersguide.doxyfile") diff --git a/cmake/sample_defs/sample_mission_cfg.h b/cmake/sample_defs/sample_mission_cfg.h index 22bc47658..979da27a7 100644 --- a/cmake/sample_defs/sample_mission_cfg.h +++ b/cmake/sample_defs/sample_mission_cfg.h @@ -60,11 +60,9 @@ ** ** \par Limits ** All versions of the cFE currently support only CCSDS as the message format -** Defining only MESSAGE_FORMAT_IS_CCSDS implements the 11 bit APID format in the primary header -** Also defining MESSAGE_FORMAT_IS_CCSDS_VER_2 implements the APID extended header format -** MESSAGE_FORMAT_IS_CCSDS must be defined for all cFE deployments. MESSAGE_FORMAT_IS_CCSDS_VER_2 is optional +** Defining MESSAGE_FORMAT_IS_CCSDS_VER_2 implements the APID extended header format +** MESSAGE_FORMAT_IS_CCSDS_VER_2 is optional */ -#define MESSAGE_FORMAT_IS_CCSDS /* #define MESSAGE_FORMAT_IS_CCSDS_VER_2 */ #undef MESSAGE_FORMAT_IS_CCSDS_VER_2 diff --git a/fsw/cfe-core/src/inc/cfe_sb.h b/fsw/cfe-core/src/inc/cfe_sb.h index ce5703b4e..fa3a26d10 100644 --- a/fsw/cfe-core/src/inc/cfe_sb.h +++ b/fsw/cfe-core/src/inc/cfe_sb.h @@ -98,26 +98,23 @@ /* ** Type Definitions */ -#ifdef MESSAGE_FORMAT_IS_CCSDS - - /** \brief Generic Software Bus Message Type Definition */ - typedef union { - CCSDS_PriHdr_t Hdr; /**< \brief CCSDS Primary Header #CCSDS_PriHdr_t */ - CCSDS_SpacePacket_t SpacePacket; - uint32 Dword; /**< \brief Forces minimum of 32-bit alignment for this object */ - uint8 Byte[sizeof(CCSDS_PriHdr_t)]; /**< \brief Allows byte-level access */ - }CFE_SB_Msg_t; - - /** \brief Generic Software Bus Command Header Type Definition */ - typedef CCSDS_CommandPacket_t CFE_SB_CmdHdr_t; - /** \brief Generic Software Bus Telemetry Header Type Definition */ - typedef CCSDS_TelemetryPacket_t CFE_SB_TlmHdr_t; +/** \brief Generic Software Bus Message Type Definition */ +typedef union { + CCSDS_PriHdr_t Hdr; /**< \brief CCSDS Primary Header #CCSDS_PriHdr_t */ + CCSDS_SpacePacket_t SpacePacket; + uint32 Dword; /**< \brief Forces minimum of 32-bit alignment for this object */ + uint8 Byte[sizeof(CCSDS_PriHdr_t)]; /**< \brief Allows byte-level access */ +}CFE_SB_Msg_t; + +/** \brief Generic Software Bus Command Header Type Definition */ +typedef CCSDS_CommandPacket_t CFE_SB_CmdHdr_t; - #define CFE_SB_CMD_HDR_SIZE (sizeof(CFE_SB_CmdHdr_t))/**< \brief Size of #CFE_SB_CmdHdr_t in bytes */ - #define CFE_SB_TLM_HDR_SIZE (sizeof(CFE_SB_TlmHdr_t))/**< \brief Size of #CFE_SB_TlmHdr_t in bytes */ +/** \brief Generic Software Bus Telemetry Header Type Definition */ +typedef CCSDS_TelemetryPacket_t CFE_SB_TlmHdr_t; -#endif /* MESSAGE_FORMAT_IS_CCSDS */ +#define CFE_SB_CMD_HDR_SIZE (sizeof(CFE_SB_CmdHdr_t))/**< \brief Size of #CFE_SB_CmdHdr_t in bytes */ +#define CFE_SB_TLM_HDR_SIZE (sizeof(CFE_SB_TlmHdr_t))/**< \brief Size of #CFE_SB_TlmHdr_t in bytes */ /** \brief CFE_SB_TimeOut_t to primitive type definition ** diff --git a/fsw/cfe-core/src/sb/cfe_sb_init.c b/fsw/cfe-core/src/sb/cfe_sb_init.c index 8c79870e9..0acf5f19d 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_init.c +++ b/fsw/cfe-core/src/sb/cfe_sb_init.c @@ -216,7 +216,6 @@ void CFE_SB_InitPipeTbl(void){ */ void CFE_SB_InitMsgMap(void){ -#ifdef MESSAGE_FORMAT_IS_CCSDS CFE_SB_MsgKey_Atom_t KeyVal; for (KeyVal=0; KeyVal < CFE_SB_MAX_NUMBER_OF_MSG_KEYS; KeyVal++) @@ -229,7 +228,6 @@ void CFE_SB_InitMsgMap(void){ #else /* VER_2 is the same now but will change for larger and/or distributed systems */ CFE_ES_WriteToSysLog("SB internal message format: Space Packet Protocol version 2 (extended hdr)\n"); #endif -#endif }/* end CFE_SB_InitMsgMap */ diff --git a/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c b/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c index 6d5913b40..f4c711752 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c +++ b/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c @@ -122,8 +122,6 @@ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr) { CFE_SB_MsgId_t MsgId = 0; -#ifdef MESSAGE_FORMAT_IS_CCSDS - #ifndef MESSAGE_FORMAT_IS_CCSDS_VER_2 MsgId = CCSDS_RD_SID(MsgPtr->Hdr); #else @@ -147,7 +145,6 @@ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr) /* SystemId = CCSDS_RD_SYSTEM_ID(HdrPtr->ApidQ); */ /* MsgId = (MsgId | (SystemId << 16)); */ -#endif #endif return MsgId; diff --git a/fsw/cfe-core/src/sb/cfe_sb_priv.c b/fsw/cfe-core/src/sb/cfe_sb_priv.c index e0723bfe9..f1b4a3724 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_priv.c +++ b/fsw/cfe-core/src/sb/cfe_sb_priv.c @@ -551,9 +551,7 @@ int32 CFE_SB_DuplicateSubscribeCheck(CFE_SB_MsgKey_t MsgKey, */ void CFE_SB_SetMsgSeqCnt(CFE_SB_MsgPtr_t MsgPtr,uint32 Count){ -#ifdef MESSAGE_FORMAT_IS_CCSDS CCSDS_WR_SEQ(MsgPtr->Hdr,Count); -#endif }/* end CFE_SB_SetMsgSeqCnt */ diff --git a/fsw/cfe-core/src/sb/cfe_sb_util.c b/fsw/cfe-core/src/sb/cfe_sb_util.c index daf01bea7..ab49485d8 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_util.c +++ b/fsw/cfe-core/src/sb/cfe_sb_util.c @@ -97,8 +97,6 @@ void CFE_SB_InitMsg(void *MsgPtr, uint16 CFE_SB_MsgHdrSize(const CFE_SB_Msg_t *MsgPtr) { -#ifdef MESSAGE_FORMAT_IS_CCSDS - uint16 size; const CCSDS_PriHdr_t *HdrPtr; @@ -121,8 +119,6 @@ uint16 CFE_SB_MsgHdrSize(const CFE_SB_Msg_t *MsgPtr) return size; -#endif - }/* end CFE_SB_MsgHdrSize */ @@ -131,7 +127,6 @@ uint16 CFE_SB_MsgHdrSize(const CFE_SB_Msg_t *MsgPtr) */ void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr) { -#ifdef MESSAGE_FORMAT_IS_CCSDS uint8 *BytePtr; uint16 HdrSize; @@ -139,7 +134,6 @@ void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr) HdrSize = CFE_SB_MsgHdrSize(MsgPtr); return (BytePtr + HdrSize); -#endif }/* end CFE_SB_GetUserData */ @@ -148,7 +142,6 @@ void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr) */ uint16 CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr) { -#ifdef MESSAGE_FORMAT_IS_CCSDS uint16 TotalMsgSize; uint16 HdrSize; @@ -156,7 +149,6 @@ uint16 CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr) HdrSize = CFE_SB_MsgHdrSize(MsgPtr); return (TotalMsgSize - HdrSize); -#endif }/* end CFE_SB_GetUserDataLength */ @@ -165,15 +157,12 @@ uint16 CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr) */ void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr, uint16 DataLength) { -#ifdef MESSAGE_FORMAT_IS_CCSDS - uint32 TotalMsgSize, HdrSize; HdrSize = CFE_SB_MsgHdrSize(MsgPtr); TotalMsgSize = HdrSize + DataLength; CCSDS_WR_LEN(MsgPtr->Hdr,TotalMsgSize); -#endif }/* end CFE_SB_SetUserDataLength */ @@ -182,11 +171,9 @@ void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr, uint16 DataLength) */ uint16 CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr) { -#ifdef MESSAGE_FORMAT_IS_CCSDS return CCSDS_RD_LEN(MsgPtr->Hdr); -#endif }/* end CFE_SB_GetTotalMsgLength */ @@ -195,11 +182,9 @@ uint16 CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr) */ void CFE_SB_SetTotalMsgLength(CFE_SB_MsgPtr_t MsgPtr,uint16 TotalLength) { -#ifdef MESSAGE_FORMAT_IS_CCSDS CCSDS_WR_LEN(MsgPtr->Hdr,TotalLength); -#endif }/* end CFE_SB_SetTotalMsgLength */ @@ -212,8 +197,6 @@ CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_SB_MsgPtr_t MsgPtr) uint32 LocalSecs32 = 0; uint32 LocalSubs32 = 0; - #ifdef MESSAGE_FORMAT_IS_CCSDS - #if (CFE_MISSION_SB_PACKET_TIME_FORMAT == CFE_MISSION_SB_TIME_32_16_SUBS) uint16 LocalSubs16; #endif @@ -249,8 +232,6 @@ CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_SB_MsgPtr_t MsgPtr) #endif } - #endif - /* return the packet time converted to CFE_TIME_SysTime_t format */ TimeFromMsg.Seconds = LocalSecs32; TimeFromMsg.Subseconds = LocalSubs32; @@ -267,8 +248,6 @@ int32 CFE_SB_SetMsgTime(CFE_SB_MsgPtr_t MsgPtr, CFE_TIME_SysTime_t NewTime) { int32 Result = CFE_SB_WRONG_MSG_TYPE; - #ifdef MESSAGE_FORMAT_IS_CCSDS - CFE_SB_TlmHdr_t *TlmHdrPtr; /* declare format specific vars */ @@ -310,8 +289,6 @@ int32 CFE_SB_SetMsgTime(CFE_SB_MsgPtr_t MsgPtr, CFE_TIME_SysTime_t NewTime) #endif } - #endif - return Result; }/* end CFE_SB_SetMsgTime */ @@ -332,8 +309,6 @@ void CFE_SB_TimeStampMsg(CFE_SB_MsgPtr_t MsgPtr) */ uint16 CFE_SB_GetCmdCode(CFE_SB_MsgPtr_t MsgPtr) { -#ifdef MESSAGE_FORMAT_IS_CCSDS - CFE_SB_CmdHdr_t *CmdHdrPtr; /* if msg type is telemetry or there is no secondary hdr, return 0 */ @@ -345,8 +320,6 @@ uint16 CFE_SB_GetCmdCode(CFE_SB_MsgPtr_t MsgPtr) CmdHdrPtr = (CFE_SB_CmdHdr_t *)MsgPtr; return CCSDS_RD_FC(CmdHdrPtr->Sec); - -#endif }/* end CFE_SB_GetCmdCode */ @@ -356,8 +329,6 @@ uint16 CFE_SB_GetCmdCode(CFE_SB_MsgPtr_t MsgPtr) int32 CFE_SB_SetCmdCode(CFE_SB_MsgPtr_t MsgPtr, uint16 CmdCode) { -#ifdef MESSAGE_FORMAT_IS_CCSDS - CFE_SB_CmdHdr_t *CmdHdrPtr; /* if msg type is telemetry or there is no secondary hdr... */ @@ -372,8 +343,6 @@ int32 CFE_SB_SetCmdCode(CFE_SB_MsgPtr_t MsgPtr, return CFE_SUCCESS; -#endif - }/* end CFE_SB_SetCmdCode */ @@ -382,7 +351,6 @@ int32 CFE_SB_SetCmdCode(CFE_SB_MsgPtr_t MsgPtr, */ uint16 CFE_SB_GetChecksum(CFE_SB_MsgPtr_t MsgPtr) { -#ifdef MESSAGE_FORMAT_IS_CCSDS CFE_SB_CmdHdr_t *CmdHdrPtr; @@ -396,7 +364,6 @@ uint16 CFE_SB_GetChecksum(CFE_SB_MsgPtr_t MsgPtr) return CCSDS_RD_CHECKSUM(CmdHdrPtr->Sec); -#endif }/* end CFE_SB_GetChecksum */ @@ -405,7 +372,6 @@ uint16 CFE_SB_GetChecksum(CFE_SB_MsgPtr_t MsgPtr) */ void CFE_SB_GenerateChecksum(CFE_SB_MsgPtr_t MsgPtr) { -#ifdef MESSAGE_FORMAT_IS_CCSDS CCSDS_CommandPacket_t *CmdPktPtr; @@ -418,7 +384,6 @@ void CFE_SB_GenerateChecksum(CFE_SB_MsgPtr_t MsgPtr) CCSDS_LoadCheckSum(CmdPktPtr); -#endif }/* end CFE_SB_GenerateChecksum */ @@ -427,7 +392,6 @@ void CFE_SB_GenerateChecksum(CFE_SB_MsgPtr_t MsgPtr) */ bool CFE_SB_ValidateChecksum(CFE_SB_MsgPtr_t MsgPtr) { -#ifdef MESSAGE_FORMAT_IS_CCSDS CCSDS_CommandPacket_t *CmdPktPtr; @@ -440,7 +404,6 @@ bool CFE_SB_ValidateChecksum(CFE_SB_MsgPtr_t MsgPtr) return CCSDS_ValidCheckSum (CmdPktPtr); -#endif }/* end CFE_SB_ValidateChecksum */ diff --git a/fsw/cfe-core/src/sb/cfe_sb_verify.h b/fsw/cfe-core/src/sb/cfe_sb_verify.h index 1dff17f93..311e8f6ba 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_verify.h +++ b/fsw/cfe-core/src/sb/cfe_sb_verify.h @@ -80,10 +80,6 @@ #error CFE_PLATFORM_SB_BUF_MEMORY_BYTES cannot be greater than UINT32_MAX (4 Gigabytes)! #endif -#ifndef MESSAGE_FORMAT_IS_CCSDS - #error There is no message format (MESSAGE_FORMAT_IS_CCSDS) specified! -#endif - #ifndef CFE_MISSION_SB_PACKET_TIME_FORMAT #error CFE_MISSION_SB_PACKET_TIME_FORMAT must be defined! #elif ((CFE_MISSION_SB_PACKET_TIME_FORMAT != CFE_MISSION_SB_TIME_32_16_SUBS) && \ diff --git a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c index d2189eb6e..3fd31b43c 100644 --- a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c @@ -279,7 +279,6 @@ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr) if (UT_Stub_CopyToLocal(UT_KEY(CFE_SB_GetMsgId), &MsgId, sizeof(MsgId)) < sizeof(MsgId)) { -#ifdef MESSAGE_FORMAT_IS_CCSDS #ifndef MESSAGE_FORMAT_IS_CCSDS_VER_2 MsgId = CCSDS_RD_SID(MsgPtr->Hdr); @@ -303,7 +302,6 @@ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr) /* uint16 SystemId; */ /* SystemId = CCSDS_RD_SYSTEM_ID(HdrPtr->ApidQ); */ /* MsgId = (MsgId | (SystemId << 16)) */ -#endif #endif } From b1ef9fc6cbb0d0a465546ed767e4c5abec133765 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Mon, 27 Apr 2020 12:37:14 -0400 Subject: [PATCH 12/15] Fix #644, Append directory properties The set_directory_properties() function overwrites existing properties. Normally the properties were empty but the global_build_options.cmake might make it non-empty (e.g. OMIT_DEPRECATED). Using set_property() signature instead has an option to APPEND rather than overwrite. --- cmake/arch_build.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/arch_build.cmake b/cmake/arch_build.cmake index 32d6ed50c..e33f93a80 100644 --- a/cmake/arch_build.cmake +++ b/cmake/arch_build.cmake @@ -358,7 +358,7 @@ function(process_arch SYSVAR) get_target_property(OSAL_INCLUDE_DIRECTORIES osal INTERFACE_INCLUDE_DIRECTORIES) if (OSAL_COMPILE_DEFINITIONS) - set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "${OSAL_COMPILE_DEFINITIONS}") + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "${OSAL_COMPILE_DEFINITIONS}") endif (OSAL_COMPILE_DEFINITIONS) if (OSAL_INCLUDE_DIRECTORIES) include_directories(${OSAL_INCLUDE_DIRECTORIES}) From fb88b531404e944766cf7a6ed4eca3c63ac3a634 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Mon, 27 Apr 2020 13:09:33 -0400 Subject: [PATCH 13/15] HOTFIX: Use CFE_PLATFORM_SB_HIGHEST_VALID_MSGID The CFE_SB_HIGHEST_VALID_MSGID symbol is deprecated. --- fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c b/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c index d0803238a..a4e6c25bd 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c +++ b/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c @@ -226,7 +226,7 @@ uint32 CFE_SB_GetPktType(CFE_SB_MsgId_t MsgId) bool CFE_SB_IsValidMsgId(CFE_SB_MsgId_t MsgId) { return (!CFE_SB_MsgId_Equal(MsgId, CFE_SB_INVALID_MSG_ID) && - CFE_SB_MsgIdToValue(MsgId) <= CFE_SB_HIGHEST_VALID_MSGID); + CFE_SB_MsgIdToValue(MsgId) <= CFE_PLATFORM_SB_HIGHEST_VALID_MSGID); } /* end CFE_SB_IsValidMsgId */ From 690576a669f0eb561eb21894e973ea3a7fc7b7cd Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Mon, 27 Apr 2020 14:15:23 -0400 Subject: [PATCH 14/15] HOTFIX: Add osconfig.h to doxygen path to resolve references --- cmake/mission_build.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/mission_build.cmake b/cmake/mission_build.cmake index d09ee5b45..d415bc426 100644 --- a/cmake/mission_build.cmake +++ b/cmake/mission_build.cmake @@ -229,7 +229,8 @@ function(prepare) # OSAL API GUIDE include PUBLIC API file(GLOB MISSION_OSAL_HEADERFILES - "${osal_MISSION_DIR}/src/os/inc/*.h") + "${osal_MISSION_DIR}/src/os/inc/*.h" + "${MISSION_SOURCE_DIR}/cfe/cmake/sample_defs/*osconfig.h") string(REPLACE ";" " \\\n" MISSION_OSAL_HEADERFILES "${MISSION_OSAL_HEADERFILES}") configure_file("${CFE_SOURCE_DIR}/cmake/cfe-usersguide.doxyfile.in" From 963ba099d177aec63afb7c27e9d17446f50f0088 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Mon, 27 Apr 2020 17:33:37 -0400 Subject: [PATCH 15/15] Increase version to 6.7.14. Update Readme content and version history format. --- README.md | 137 +++++++++++++++++------------ fsw/cfe-core/src/inc/cfe_version.h | 2 +- 2 files changed, 80 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index 4a14f0aa7..87aa0a1a0 100644 --- a/README.md +++ b/README.md @@ -6,64 +6,85 @@ This repository contains NASA's Core Flight Executive (cFE), which is a framewor This is a collection of services and associated framework to be located in the `cfe` subdirectory of a cFS Mission Tree. The Core Flight System is bundled at https://github.com/nasa/cFS, which includes build and execution instructions. -## Version Notes -- 6.7.13: DEVELOPMENT - - RTEMS builds without error. - - Use the INTERFACE_COMPILE_DEFINITIONS and INTERFACE_INCLUDE_DIRECTORIES properties from the osal target and apply them to the entire CFE build as a directory-scope property. No impact until these are set in OSAL. - - Minor other updates (see https://github.com/nasa/cFE/pull/615) -- 6.7.12: DEVELOPMENT - - Cmd code (and checksum) are always in the same place (matches GSFC spec for command secondary header) - - No impact to behavior. Previously the perf log dump file frequently contained errors due to out of order or otherwise corrupted entries, which is now fixed. - - Minor other updates (see https://github.com/nasa/cFE/pull/586) -- 6.7.11: DEVELOPMENT - - Improve documentation - - Update makefile to report branch coverage - - Minor other updates (see https://github.com/nasa/cFE/pull/566) -- 6.7.10: DEVELOPMENT - - Fix potential unit test problems with name collisions - - Improve documentation - - Minor other updates (see https://github.com/nasa/cFE/pull/563) -- 6.7.9: DEVELOPMENT - - No longer requires sed "hack" to change the setting in default_config.h - - Minor other updates (see https://github.com/nasa/cFE/pull/544) -- 6.7.8: DEVELOPMENT - - Updates and cleaned up documentation and requirements - - Fixes incorrect debug messages - - Decrease child task count when one is deleted - - Minor other updates (see https://github.com/nasa/cFE/pull/530) -- 6.7.7: DEVELOPMENT - - Adds a new function, CFE_SB_GetPipeIdByName, which retrieves the pipe ID given a name of a pipe. - - Improvement in error reporting when using a pipe name that is already in use, or when the queue limit has been reached. - - Added userguide and osalguide to the local target list to avoid makefile warning - - Minor other updates (see https://github.com/nasa/cFE/pull/511) -- 6.7.6: DEVELOPMENT - - Adds OMIT_DEPRECATED prep flag - - Adds and enforces strict warnings - - Software Bus now increments sequence counter even if there are no subscribers - - Warning, comment, and code coverage cleanup (see https://github.com/nasa/cFE/pull/490) -- 6.7.5: DEVELOPMENT - - Added CI static analysis check - - Resolved static analysis warnings - - Minor other updates (see https://github.com/nasa/cFE/pull/479) -- 6.7.4: DEVELOPMENT - - Minor updates (see https://github.com/nasa/cFE/pull/448) -- 6.7.3: DEVELOPMENT - - Minor updates (see https://github.com/nasa/cFE/pull/413) -- 6.7.2: DEVELOPMENT - - Minor bugs and enhancements (see https://github.com/nasa/cFE/pull/388) -- 6.7.1: DEVELOPMENT - - Minor bug fixes (see https://github.com/nasa/cFE/pull/378) - - Fix strlen in CFE_ES_TaskInit https://github.com/nasa/cFE/pull/23 -- **6.7.0 OFFICIAL RELEASE**: - - This is a point release from an internal repository - - Changes are detailed in [cFS repo](https://github.com/nasa/cFS) release documentation - - Apache 2.0 -- **6.6.0a OFFICIAL RELEASE**: - - This is a point release from an internal repository - - Apache 2.0 - - Additional release notes are found in [release notes](https://github.com/nasa/cFE/blob/v6.6.0a/docs/cFE_release_notes.md) - - See the [version description document](https://github.com/nasa/cFE/blob/v6.6.0a/docs/cFE_6_6_0_version_description.pdf) for the full document - - Test results can be found in [test results](https://github.com/nasa/cFE/tree/v6.6.0a/test-and-ground/test-review-packages/Results) +## Version History + +#### Development Build: 6.7.14 +- Exposes the `CFE_SB_IsValidMsgId()` for application usage. +- `CFE_SB_GetLastSenderID` will now detect if it is being called prior to a message being sent on a given pipe. +- Mismatches between PSP/BSP/OS are now detected and warned about during make prep. Only the `CFE_SYSTEM_PSPNAME` is actually required to be specified for a CFE build now. Others can be omitted. +- See https://github.com/nasa/cFE/pull/635 for more details + +#### Development Build: 6.7.13 +- RTEMS builds without error. +- Use the INTERFACE_COMPILE_DEFINITIONS and INTERFACE_INCLUDE_DIRECTORIES properties from the osal target and apply them to the entire CFE build as a directory-scope property. No impact until these are set in OSAL. +- Minor other updates (see https://github.com/nasa/cFE/pull/615) + +#### Development Build: 6.7.12 +- Cmd code (and checksum) are always in the same place (matches GSFC spec for command secondary header) +- No impact to behavior. Previously the perf log dump file frequently contained errors due to out of order or otherwise corrupted entries, which is now fixed. +- Minor other updates (see https://github.com/nasa/cFE/pull/586) + +#### Development Build: 6.7.11 +- Improve documentation +- Update makefile to report branch coverage +- Minor other updates (see https://github.com/nasa/cFE/pull/566) + +#### Development Build: 6.7.10 +- Fix potential unit test problems with name collisions +- Improve documentation +- Minor other updates (see https://github.com/nasa/cFE/pull/563) + +#### Development Build: 6.7.9 +- No longer requires sed "hack" to change the setting in default_config.h +- Minor other updates (see https://github.com/nasa/cFE/pull/544) + +#### Development Build: 6.7.8 +- Updates and cleaned up documentation and requirements +- Fixes incorrect debug messages +- Decrease child task count when one is deleted +- Minor other updates (see https://github.com/nasa/cFE/pull/530) + +#### Development Build: 6.7.7 +- Adds a new function, CFE_SB_GetPipeIdByName, which retrieves the pipe ID given a name of a pipe. +- Improvement in error reporting when using a pipe name that is already in use, or when the queue limit has been reached. +- Added userguide and osalguide to the local target list to avoid makefile warning +- Minor other updates (see https://github.com/nasa/cFE/pull/511) + +#### Development Build: 6.7.6 +- Adds OMIT_DEPRECATED prep flag +- Adds and enforces strict warnings +- Software Bus now increments sequence counter even if there are no subscribers +- Warning, comment, and code coverage cleanup (see https://github.com/nasa/cFE/pull/490) + +#### Development Build: 6.7.5 +- Added CI static analysis check +- Resolved static analysis warnings +- Minor other updates (see https://github.com/nasa/cFE/pull/479) + +#### Development Build: 6.7.4 +- Minor updates (see https://github.com/nasa/cFE/pull/448) + +#### Development Build: 6.7.3 +- Minor updates (see https://github.com/nasa/cFE/pull/413) + +#### Development Build: 6.7.2 +- Minor bugs and enhancements (see https://github.com/nasa/cFE/pull/388) + +#### Development Build: 6.7.1 +- Fix strlen in CFE_ES_TaskInit https://github.com/nasa/cFE/pull/23 +- Minor bug fixes (see https://github.com/nasa/cFE/pull/378) + +### ***OFFICIAL RELEASE: 6.7.0*** +- This is a point release from an internal repository +- Changes are detailed in [cFS repo](https://github.com/nasa/cFS) release documentation +- Apache 2.0 + +### ***OFFICIAL RELEASE: 6.6.0a*** +- This is a point release from an internal repository +- Apache 2.0 +- Additional release notes are found in [release notes](https://github.com/nasa/cFE/blob/v6.6.0a/docs/cFE_release_notes.md) +- See the [version description document](https://github.com/nasa/cFE/blob/v6.6.0a/docs/cFE_6_6_0_version_description.pdf) for the full document +- Test results can be found in [test results](https://github.com/nasa/cFE/tree/v6.6.0a/test-and-ground/test-review-packages/Results) ## Known issues diff --git a/fsw/cfe-core/src/inc/cfe_version.h b/fsw/cfe-core/src/inc/cfe_version.h index 927f22a7a..a505c7129 100644 --- a/fsw/cfe-core/src/inc/cfe_version.h +++ b/fsw/cfe-core/src/inc/cfe_version.h @@ -95,7 +95,7 @@ */ #define CFE_MAJOR_VERSION 6 #define CFE_MINOR_VERSION 7 -#define CFE_REVISION 13 +#define CFE_REVISION 14 #endif /* _cfe_version_ */