diff --git a/.github/workflows/codeql-build.yml b/.github/workflows/codeql-build.yml index 7a1e14b7..c3f8a8c7 100644 --- a/.github/workflows/codeql-build.yml +++ b/.github/workflows/codeql-build.yml @@ -2,7 +2,15 @@ name: "CodeQL Analysis" on: push: + branches: + - dev + - main pull_request: + types: + - opened + - reopened + - synchronize + workflow_dispatch: jobs: codeql: diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml index bf12f09e..9065a28a 100644 --- a/.github/workflows/format-check.yml +++ b/.github/workflows/format-check.yml @@ -2,8 +2,11 @@ name: Format Check # Run on all push and pull requests on: - push: pull_request: + types: + - opened + - reopened + - synchronize jobs: format-check: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index fa6bb81a..800c300f 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -3,7 +3,15 @@ name: Static Analysis # Run on all push and pull requests on: push: + branches: + - dev + - main pull_request: + types: + - opened + - reopened + - synchronize + workflow_dispatch: jobs: static-analysis: diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..dff004e6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# Ignore macOS generated files types +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db +.fuse_hidden* diff --git a/CMakeLists.txt b/CMakeLists.txt index a6d904c7..73cbb06f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,34 @@ endif() set(CFE_PSP_TARGETNAME "${CFE_SYSTEM_PSPNAME}") add_definitions(-D_CFE_PSP_) # macro to indicate PSP scope +# Read the default compile-time configuration, and update with +# any mission/project specific options in the PSP_CONFIGURATION_FILE +include("${CFEPSP_SOURCE_DIR}/default_config.cmake") + +# The user-specified file is optional, but in case the value is defined but the +# file does not exist, this should be treated as an error. +foreach(CONFIG ${PSP_CONFIGURATION_FILE}) + include(${CONFIG}) +endforeach(CONFIG PSP_CONFIGURATION_FILE) + +# Use the supplied configuration to generate the pspconfig.h file +# which can be referenced by the code. This will be stored in the top level +# "inc" directory of the binary output directory +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/inc") +configure_file( + "${CFEPSP_SOURCE_DIR}/pspconfig.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/pspconfig.gen" + @ONLY +) + +# Only copy the pspconfig.h into place if different from the existing file +# This avoids unnecessarily rebuilding all code in case cmake was re-run +# and but generated the same file. +execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CMAKE_CURRENT_BINARY_DIR}/pspconfig.gen" + "${CMAKE_CURRENT_BINARY_DIR}/inc/pspconfig.h" +) + # The "psp_module_api" defines the interface between internal PSP components add_library(psp_module_api INTERFACE) target_compile_definitions(psp_module_api INTERFACE @@ -23,9 +51,17 @@ target_include_directories(psp_module_api INTERFACE fsw/shared/inc # all PSP shared headers fsw/${CFE_PSP_TARGETNAME}/inc # all impl headers ${CFE_SOURCE_DIR}/cmake/target/inc # for sysconfig + $ # for pspconfig.h $ # use headers from OSAL ) +# Include definition of cfe_psp_backtrace.h referenced by cfe_psp_config.h for QNX PSP +if (QNX_SDP_VERSION EQUAL 800) + target_include_directories(psp_module_api INTERFACE $) +elseif (QNX_SDP_VERSION EQUAL 710) + target_include_directories(psp_module_api INTERFACE $) +endif() + # Translate the CFE_PSP_TARGETNAME to a set of additional modules to build file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/fsw/${CFE_PSP_TARGETNAME}/psp_module_list.cmake" PSP_TARGET_MODULE_LIST REGEX "^[a-zA-Z]") include("${CMAKE_CURRENT_LIST_DIR}/fsw/${CFE_PSP_TARGETNAME}/psp_conditional_modules.cmake" OPTIONAL) @@ -66,6 +102,7 @@ target_link_libraries(psp-${CFE_PSP_TARGETNAME} PRIVATE target_include_directories(psp-${CFE_PSP_TARGETNAME} INTERFACE fsw/inc + $ # for pspconfig.h ) diff --git a/cmake/Modules/Platform/VxWorks-CFE.cmake b/cmake/Modules/Platform/VxWorks-CFE.cmake index e51f7249..a98406de 100644 --- a/cmake/Modules/Platform/VxWorks-CFE.cmake +++ b/cmake/Modules/Platform/VxWorks-CFE.cmake @@ -3,48 +3,66 @@ # # The cmake distribution by default may contain a module for VxWorks, # but different link rules are needed in order to build loadable CFE apps. +# +# This supports VxWorks Downloadable Kernel Module (DKM) and +# VxWorks Real Time Process (RTP) builds. +# +# For RTP builds, use set(VXWORKS_RTP TRUE), otherwise +# this file will default to the DKM rules # ----------------------------------------------------------------- - -# Note - this is not building "shared libs" in the traditional sense, -# This property is set true which allows one to use the CMake shared library logic -# But the code is otherwise built as static -- no PIC flags set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) -set(CMAKE_EXECUTABLE_SUFFIX ".exe") -set(CMAKE_SHARED_LIBRARY_SUFFIX ".o") -set(CMAKE_SHARED_MODULE_SUFFIX ".o") -# Setting all these to empty string defeats the default behavior -# of adding an -fPIC option to shared library/module code. -set(CMAKE_DL_LIBS "") -set(CMAKE_C_COMPILE_OPTIONS_PIC "") -set(CMAKE_CXX_COMPILE_OPTIONS_PIC "") +if(VXWORKS_RTP) + # RTP Specific rules + set(CMAKE_EXECUTABLE_SUFFIX ".vxe") + set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") + set(CMAKE_SHARED_MODULE_SUFFIX ".so") + + set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") + set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") + set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") + set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") + + set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") + set(CMAKE_SHARED_MODULE_C_FLAGS "-fPIC") + set(CMAKE_SHARED_MODULE_CXX_FLAGS "") -set(CMAKE_SHARED_LIBRARY_C_FLAGS "") -set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") -set(CMAKE_SHARED_MODULE_C_FLAGS "") -set(CMAKE_SHARED_MODULE_CXX_FLAGS "") + set(CMAKE_SHARED_OBJECT_LINKER_FLAGS -shared) + set(CMAKE_C_LINK_EXECUTABLE " -o -rdynamic ") +else() + # DKM Specific rules + set(CMAKE_EXECUTABLE_SUFFIX ".exe") + set(CMAKE_SHARED_LIBRARY_SUFFIX ".o") + set(CMAKE_SHARED_MODULE_SUFFIX ".o") + # Setting all these to empty string defeats the default behavior + # of adding an -fPIC option to shared library/module code. + set(CMAKE_DL_LIBS "") + set(CMAKE_C_COMPILE_OPTIONS_PIC "") + set(CMAKE_CXX_COMPILE_OPTIONS_PIC "") + + set(CMAKE_SHARED_LIBRARY_C_FLAGS "") + set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") + set(CMAKE_SHARED_MODULE_C_FLAGS "") + set(CMAKE_SHARED_MODULE_CXX_FLAGS "") + + set(CMAKE_SHARED_OBJECT_LINKER_FLAGS -r) + set(CMAKE_C_LINK_EXECUTABLE " -o ${CMAKE_SHARED_OBJECT_LINKER_FLAGS} ") +endif() # This creates a simple relocatable object file, not a shared library -set(CMAKE_SHARED_OBJECT_LINKER_FLAGS -r) set(CMAKE_C_CREATE_SHARED_MODULE " -o ${CMAKE_SHARED_OBJECT_LINKER_FLAGS} ") set(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_MODULE}) set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_MODULE}) set(CMAKE_CXX_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_MODULE}) -set(CMAKE_C_LINK_EXECUTABLE " -o ${CMAKE_SHARED_OBJECT_LINKER_FLAGS} ") set(VXWORKS_TARGET_PATH "${WIND_HOME}/vxworks-${CMAKE_SYSTEM_VERSION}/target") set(CMAKE_FIND_ROOT_PATH "${VXWORKS_TARGET_PATH}") - set(CMAKE_SYSTEM_PREFIX_PATH "${VXWORKS_TARGET_PATH}") set(CMAKE_SYSTEM_INCLUDE_PATH "${VXWORKS_TARGET_PATH}/h") set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_SYSTEM_INCLUDE_PATH}) set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_SYSTEM_INCLUDE_PATH}) -#set(CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${VXWORKS_TARGET_PATH}/lib") -#set(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}) - -#set(CMAKE_C_FLAGS_INIT "${VXWORKS_BSP_C_FLAGS}") -#set(CMAKE_CXX_FLAGS_INIT "${VXWORKS_BSP_CXX_FLAGS}") - diff --git a/default_config.cmake b/default_config.cmake new file mode 100644 index 00000000..bfb8fd49 --- /dev/null +++ b/default_config.cmake @@ -0,0 +1,71 @@ +########################################################################## +# +# Default configuration options for PSP +# +# This file specifies the default values for various compile-time options +# supported by PSP. +# +# NOTE: +# The defaults in this file should _not_ be directly modified for tuning. +# +# Instead, use the "PSP_CONFIGURATION_FILE" CMake variable to define +# a custom file which can override/modify the configuration for the items +# which require tuning. +# +########################################################################## + +############################################################## +# Code/Feature Selection Options for the PSP implementation +############################################################## + + +# +# PSP_CONFIG_DEBUG_PRINTF +# ---------------------------------- +# +# Controls inclusion of PSP_DEBUG statements in the code +# +# If set FALSE, all PSP_DEBUG statements are compiled out. +# +# If set TRUE, all the "PSP_DEBUG" statements will be compiled in and displayed +# on the debug console. The statements may still be suppressed at runtime. +# +set(PSP_CONFIG_DEBUG_PRINTF FALSE + CACHE BOOL "Controls inclusion of PSP_DEBUG statements in the code" +) + +############################################# +# Resource Limits for the PSP +############################################# + +# The default value of debug level for PSP_DEBUG statements +set(PSP_CONFIG_DEBUG_LEVEL 1 + CACHE STRING "Default value of Debug level for PSP_DEBUG" +) + +############################################################## +# FS Mapping for the PSP implementation +############################################################## + + +# The default virtual FS mapping for the "/cf" directory, typically used for Linux and QNX +set(PSP_CONFIG_CF_VIRTUAL_MAPPING "./cf" + CACHE STRING "Default virtual FS mapping for the /cf directory" +) + +# The default virtual FS mapping for the EEPROM "/cf" directory, typically used for RTEMS +set(PSP_CONFIG_CF_EEPROM_VIRTUAL_MAPPING "/mnt/eeprom" + CACHE STRING "Default virtual FS mapping for the EEPROM /cf directory" +) + +# The default virtual FS mapping for the ROMFS "/cf" directory, typically used for VxWorks 7.x +set(PSP_CONFIG_CF_ROMFS_VIRTUAL_MAPPING "/romfs/cpu1/cf" + CACHE STRING "Default virtual FS mapping for the ROMFS /cf directory" +) + +# The default virtual FS mapping for the physical device "/cf" directory, typically used for VxWorks 6.9 (MCP750) +set(PSP_CONFIG_CF_PHY_DEV_VIRTUAL_MAPPING "CF:0" + CACHE STRING "Default virtual FS mapping for the physical device /cf directory" +) + + diff --git a/fsw/generic-qnx/CMakeLists.txt b/fsw/generic-qnx/CMakeLists.txt new file mode 100644 index 00000000..591f1f18 --- /dev/null +++ b/fsw/generic-qnx/CMakeLists.txt @@ -0,0 +1,39 @@ +###################################################################### +# +# CMAKE build recipe for generic-qnx PSP component +# +###################################################################### + +# This contains the fully platform-specific code to +# run CFE on this target. + +# Build the pc-linux implementation as a library +add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT + src/cfe_psp_exception.c + src/cfe_psp_memory.c + src/cfe_psp_ssr.c + src/cfe_psp_start.c + src/cfe_psp_support.c + src/cfe_psp_watchdog.c +) + +# The _GNU_SOURCE directive is required to call non-posix APIs +# that are specific to the Linux/glibc environment. +# Code outside the pc-linux PSP should _not_ depend on this. +target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-impl PRIVATE + _GNU_SOURCE + $ +) + +target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE + inc + $ +) + +# Include definition of cfe_psp_backtrace.h referenced by cfe_psp_config.h +if (QNX_SDP_VERSION EQUAL 800) + target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE $) +elseif (QNX_SDP_VERSION EQUAL 710) + target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE $) +endif() + diff --git a/fsw/generic-qnx/doc/.gitignore b/fsw/generic-qnx/doc/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/fsw/generic-qnx/inc/cfe_psp_config.h b/fsw/generic-qnx/inc/cfe_psp_config.h new file mode 100644 index 00000000..a0340dab --- /dev/null +++ b/fsw/generic-qnx/inc/cfe_psp_config.h @@ -0,0 +1,160 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +#ifndef CFE_PSP_CONFIG_H +#define CFE_PSP_CONFIG_H + +#include "common_types.h" +#include "cfe_psp_backtrace.h" + +#include +#include +#include + +/* +** This define sets the number of memory ranges that are defined in the memory range definition +** table. +*/ +#define CFE_PSP_MEM_TABLE_SIZE 10 + +/** + * This define sets the maximum number of exceptions + * that can be stored. + * + * It must always be a power of two. + */ +#define CFE_PSP_MAX_EXCEPTION_ENTRIES 4 +#define CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE 16 + +/* + * A random 32-bit value that is used as the "validity flag" + * of the PC-Linux boot record structure. This is simply + * a value that is unlikely to occur unless specifically set. + */ +#define CFE_PSP_BOOTRECORD_VALID ((uint32)0x2aebe984) +#define CFE_PSP_BOOTRECORD_INVALID (~CFE_PSP_BOOTRECORD_VALID) + +/* + * The amount of time to wait for an orderly shutdown + * in the event of a call to CFE_PSP_Restart() + * + * If this expires, then an abnormal exit/abort() is triggered. + */ +#define CFE_PSP_RESTART_DELAY 10000 + +/* use the "USR1" signal to wake the idle thread when an exception occurs */ +#define CFE_PSP_EXCEPTION_EVENT_SIGNAL SIGUSR1 + +/* + * The tick period that will be configured in the RTOS for the simulated + * time base, in microseconds. This in turn is used to drive the 1hz clock + * and other functions. + * + * To minimize jitter in the resulting callbacks, it should be an even + * divisor of 1000000 usec. + * + * Note - 10ms/100Hz is chosen to also allow this same timebase to be + * used to drive the CFS SCH minor frame callbacks in its default config. + */ +#define CFE_PSP_SOFT_TIMEBASE_PERIOD 10000 + +/* +** Global variables +*/ + +/* +** Typedef for the header structure on the reserved memory block +** +** Note that the structure below reserves memory sizes defined +** at compile time directly from cfe_platform_cfg.h above. +** A future enhancement should reserve blocks based on the runtime +** size in GLOBAL_CONFIGDATA. +*/ +typedef struct +{ + uint32 ValidityFlag; + uint32 NextResetType; +} CFE_PSP_ReservedMemoryBootRecord_t; + +/* + * The state of the PSP "idle task" + * + * This is the main/initial thread that runs early init, + * it is NOT an OSAL task. + * + * Once initialized, this thread goes idle and waits for + * asynchronous events to occur, and resumes with an orderly + * shutdown if requested. + */ +typedef struct +{ + pthread_t ThreadID; + volatile bool ShutdownReq; + volatile bool DeleteSharedMemReq; +} CFE_PSP_IdleTaskState_t; + +/** + * \brief The data type used by the underlying OS to represent a thread ID. + */ +typedef pthread_t CFE_PSP_Exception_SysTaskId_t; + +/** + * \brief Exception context data which is relevant for offline/post-mortem diagnosis. + * + * This may be stored in a persistent exception log file for later analysis. + */ +typedef struct +{ + struct timespec event_time; + siginfo_t si; + int32 ValidAddrs; + + /* + ** This is a variably-filled array based on the number of entries + ** reported by the module. It should be last. + */ + CFE_PSP_BacktraceEntry_t Addrs[CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE]; +} CFE_PSP_Exception_ContextDataEntry_t; + +/* +** This define sets the default core affinity for the core cFE tasks. +*/ +#if defined (OS_CORE_AFFINITY) +#define CFE_PSP_DEFAULT_CORE_AFFINITY OS_CORE_AFFINITY +#else +#define CFE_PSP_DEFAULT_CORE_AFFINITY (0) +#endif + +/* +** Watchdog minimum and maximum values ( in milliseconds ) +*/ +#define CFE_PSP_WATCHDOG_MIN (0) +#define CFE_PSP_WATCHDOG_MAX (0xFFFFFFFF) + +/* +** Number of EEPROM banks on this platform +*/ +#define CFE_PSP_NUM_EEPROM_BANKS 1 + +/* + * Information about the "idle task" -- + * this is used by exception handling to wake it when an event occurs + */ +extern CFE_PSP_IdleTaskState_t CFE_PSP_IdleTaskState; + +#endif diff --git a/fsw/generic-qnx/inc/cfe_psp_cpuset.h b/fsw/generic-qnx/inc/cfe_psp_cpuset.h new file mode 100644 index 00000000..f184c513 --- /dev/null +++ b/fsw/generic-qnx/inc/cfe_psp_cpuset.h @@ -0,0 +1,196 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +#ifndef CFE_PSP__CPUSET_H +#define CFE_PSP__CPUSET_H + +#include +#include + +#include "osconfig.h" +#include "common_types.h" + +/** + * @brief PSP cpuset affinity structure + * + * This is used to represent the cpuset/affinity required by the QNX + * operating system (struct _thread_runmask) to set the runmask and inherit mask. + * + * Applications should not directly access fields within this structure, + * as the pointer configuration may change based on the number of processors in + * the running system. + */ +typedef struct +{ + int32 size; /**< The size of the QNX run/inherit mask */ + uint32 *runmask; /**< The QNX run mask pointer */ + uint32 *inherit_mask; /**< The QNX inherit mask pointer */ + uint32 mask_data[8]; /**< The QNX run mask and inherit mask storage (supports maximum of 128 processors) */ +} CFE_PSP_cpuset_t; + +/*-------------------------------------------------------------------------------------*/ +/** + * @brief Initialize and zero the cpuset/affinity structure + * + * @param[in] cpuset The cpuset/affinity structure + * + */ +static inline void CFE_PSP_CpusetZero(CFE_PSP_cpuset_t *cpuset) +{ + int32 mask_size = RMSK_SIZE(_syspage_ptr->num_cpu); + + /* Initialize/zero cpuset structure */ + memset(cpuset, 0x0, sizeof(CFE_PSP_cpuset_t)); + + /* Set size of run mask and inherit mask */ + cpuset->size = mask_size; + + /* Set run mask and inherit mask pointers */ + cpuset->runmask = &cpuset->mask_data[0]; + cpuset->inherit_mask = &cpuset->mask_data[mask_size]; + + /* Verify that cpuset has enought storage for cpus in system */ + if (((sizeof(uint32) * 3) + (sizeof(uint32) * mask_size * 2)) > sizeof(CFE_PSP_cpuset_t)) + { + OS_printf(" Not enough storage for cpuset run and inherit mask: %s:%i \n", __func__, __LINE__); + } +} + +/*-------------------------------------------------------------------------------------*/ +/** + * @brief Set the corresponding cpu bit in the cpuset/affinity structure + * + * @param[in] cpuset The cpuset/affinity structure + * @param[in] cpu The cpu number to configure in cpuset/affinity structure + * + */ +static inline void CFE_PSP_CpusetSetCore(CFE_PSP_cpuset_t *cpuset, int cpu) +{ + RMSK_SET(cpu, cpuset->runmask); + RMSK_SET(cpu, cpuset->inherit_mask); +} + +/*-------------------------------------------------------------------------------------*/ +/** + * @brief Clear the corresponding cpu bit in the cpuset/affinity structure + * + * @param[in] cpuset The cpuset/affinity structure + * @param[in] cpu The cpu number to configure in cpuset/affinity structure + * + */ +static inline void CFE_PSP_CpusetClearCore(CFE_PSP_cpuset_t *cpuset, int cpu) +{ + RMSK_CLR(cpu, cpuset->runmask); + RMSK_CLR(cpu, cpuset->inherit_mask); +} + +/*-------------------------------------------------------------------------------------*/ +/** + * @brief Indicates if the corresponding cpu bit in the cpuset/affinity structure is set + * + * @param[in] cpuset The cpuset/affinity structure + * @param[in] cpu The cpu number to configure in cpuset/affinity structure + * + * @return uint32 Indicates if cpu number is set in cpuset/affinity structure + */ +static inline uint32 CFE_PSP_CpusetIsSetCore(CFE_PSP_cpuset_t *cpuset, int cpu) +{ + return (RMSK_ISSET(cpu, cpuset->runmask) & RMSK_ISSET(cpu, cpuset->inherit_mask)); +} + +/*-------------------------------------------------------------------------------------*/ +/** + * @brief Set the corresponding cpu bit in the runmask of the cpuset/affinity structure + * + * @param[in] cpuset The cpuset/affinity structure + * @param[in] cpu The cpu number to configure in cpuset/affinity structure + * + */ +static inline void CFE_PSP_CpusetSetCoreRunMask(CFE_PSP_cpuset_t *cpuset, int cpu) +{ + RMSK_SET(cpu, cpuset->runmask); +} + +/*-------------------------------------------------------------------------------------*/ +/** + * @brief Clear the corresponding cpu bit in the runmask of the cpuset/affinity structure + * + * @param[in] cpuset The cpuset/affinity structure + * @param[in] cpu The cpu number to configure in cpuset/affinity structure + * + */ +static inline void CFE_PSP_CpusetClearCoreRunMask(CFE_PSP_cpuset_t *cpuset, int cpu) +{ + RMSK_CLR(cpu, cpuset->runmask); +} + +/*-------------------------------------------------------------------------------------*/ +/** + * @brief Indicates if the corresponding cpu bit in the runmask of the cpuset/affinity structure is set + * + * @param[in] cpuset The cpuset/affinity structure + * @param[in] cpu The cpu number to configure in cpuset/affinity structure + * + * @return uint32 Indicates if cpu number is set in cpuset/affinity structure + */ +static inline uint32 CFE_PSP_CpusetIsSetCoreRunMask(CFE_PSP_cpuset_t *cpuset, int cpu) +{ + return (RMSK_ISSET(cpu, cpuset->runmask)); +} + +/*-------------------------------------------------------------------------------------*/ +/** + * @brief Set the corresponding cpu bit in the inherit mask of the cpuset/affinity structure + * + * @param[in] cpuset The cpuset/affinity structure + * @param[in] cpu The cpu number to configure in cpuset/affinity structure + * + */ +static inline void CFE_PSP_CpusetSetCoreInheritMask(CFE_PSP_cpuset_t *cpuset, int cpu) +{ + RMSK_SET(cpu, cpuset->inherit_mask); +} + +/*-------------------------------------------------------------------------------------*/ +/** + * @brief Clear the corresponding cpu bit in the inherit mask of the cpuset/affinity structure + * + * @param[in] cpuset The cpuset/affinity structure + * @param[in] cpu The cpu number to configure in cpuset/affinity structure + * + */ +static inline void CFE_PSP_CpusetClearCoreInheritMask(CFE_PSP_cpuset_t *cpuset, int cpu) +{ + RMSK_CLR(cpu, cpuset->inherit_mask); +} + +/*-------------------------------------------------------------------------------------*/ +/** + * @brief Indicates if the corresponding cpu bit in the inherit mask of the cpuset/affinity structure is set + * + * @param[in] cpuset The cpuset/affinity structure + * @param[in] cpu The cpu number to configure in cpuset/affinity structure + * + * @return uint32 Indicates if cpu number is set in cpuset/affinity structure + */ +static inline uint32 CFE_PSP_CpusetIsSetCoreInheritMask(CFE_PSP_cpuset_t *cpuset, int cpu) +{ + return (RMSK_ISSET(cpu, cpuset->inherit_mask)); +} + +#endif /* CFE_PSP_CPUSET_H */ diff --git a/fsw/generic-qnx/inc/psp_version.h b/fsw/generic-qnx/inc/psp_version.h new file mode 100644 index 00000000..024f6092 --- /dev/null +++ b/fsw/generic-qnx/inc/psp_version.h @@ -0,0 +1,77 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * @brief Purpose: + * @details Provide version identifiers for the cFE Platform Support Packages (PSP). + * See @ref cfsversions for version and build number and description + */ +#ifndef PSP_VERSION_H +#define PSP_VERSION_H + +/* + * Development Build Macro Definitions + */ +#define CFE_PSP_IMPL_BUILD_NUMBER 0 +#define CFE_PSP_IMPL_BUILD_BASELINE "v7.0.0" +#define CFE_PSP_BUILD_DEV_CYCLE "v7.0.0" /**< @brief Development: Release name for current development cycle */ +#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ + +/* + * Version Macros, see \ref cfsversions for definitions. + */ +#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ +#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ +#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ + +/** + * @brief Last official release. + */ +#define CFE_PSP_LAST_OFFICIAL "v7.0.0" + +/*! + * @brief Mission revision. + * + * Reserved for mission use to denote patches/customizations as needed. + * Values 1-254 are reserved for mission use to denote patches/customizations as needed. NOTE: Reserving 0 and 0xFF for + * cFS open-source development use (pending resolution of nasa/cFS#440) + */ +#define CFE_PSP_IMPL_MISSION_REV 0x0 + +/* + * Tools to construct version string + */ +#define CFE_PSP_IMPL_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer */ +#define CFE_PSP_IMPL_STR(x) \ + CFE_PSP_IMPL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer */ + +/*! @brief DEVELOPMENT Build Version Number. + * @details Baseline git tag + Number of commits since baseline. @n + * See @ref cfsversions for format differences between development and release versions. + */ +#define CFE_PSP_IMPL_VERSION CFE_PSP_IMPL_BUILD_BASELINE "+dev" CFE_PSP_IMPL_STR(CFE_PSP_IMPL_BUILD_NUMBER) + +/** + * @brief Max Version String length. + * + * Maximum length that a tblCRCTool version string can be. + * + */ +#define CFE_PSP_CFG_MAX_VERSION_STR_LEN 256 + +#endif diff --git a/fsw/generic-qnx/make/build_options.cmake b/fsw/generic-qnx/make/build_options.cmake new file mode 100644 index 00000000..f8e232b3 --- /dev/null +++ b/fsw/generic-qnx/make/build_options.cmake @@ -0,0 +1,18 @@ +########################################################################## +# +# Build options for "pc-linux" PSP +# This file specifies any global-scope compiler options when using this PSP +# +########################################################################## + +# This indicates where to install target binaries created during the build +# Note - this should be phased out in favor of the staging dir from OSAL BSP +set(INSTALL_SUBDIR "cf") + +# Some upper-level code may be gated on _QNX_OS_ being defined +# This is for compatibility with older build scripts which defined this symbol, +# but no CFE/OSAL framework code depends on this symbol. +add_definitions("-D_QNX_OS_") + +set(CFE_PSP_EXPECTED_OSAL_BSPTYPE "generic-qnx") + diff --git a/fsw/generic-qnx/psp_conditional_modules.cmake b/fsw/generic-qnx/psp_conditional_modules.cmake new file mode 100644 index 00000000..101f884c --- /dev/null +++ b/fsw/generic-qnx/psp_conditional_modules.cmake @@ -0,0 +1,6 @@ +# Selecting the backtrace module based on QNX SDP version being used +if (QNX_SDP_VERSION EQUAL 800) + list(APPEND PSP_TARGET_MODULE_LIST backtrace_libunwind) +elseif (QNX_SDP_VERSION EQUAL 710) + list(APPEND PSP_TARGET_MODULE_LIST backtrace_qnx) +endif() diff --git a/fsw/generic-qnx/psp_module_list.cmake b/fsw/generic-qnx/psp_module_list.cmake new file mode 100644 index 00000000..29ea43f3 --- /dev/null +++ b/fsw/generic-qnx/psp_module_list.cmake @@ -0,0 +1,9 @@ +# This is a list of modules that is included as a fixed/base set +# when this PSP is selected. They must exist under fsw/modules + +soft_timebase +timebase_posix_clock +ram_notimpl +port_notimpl +iodriver +endian_api diff --git a/fsw/generic-qnx/src/cfe_psp_exception.c b/fsw/generic-qnx/src/cfe_psp_exception.c new file mode 100644 index 00000000..1a64bd45 --- /dev/null +++ b/fsw/generic-qnx/src/cfe_psp_exception.c @@ -0,0 +1,336 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +/****************************************************************************** +S +** File: cfe_psp_exception.c +** +** POSIX ( Mac OS X, Linux, Cygwin ) version +** +** Purpose: +** cFE PSP Exception handling functions +** +** History: +** 2007/05/29 A. Cudmore | POSIX Version +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" +#include "cfe_psp.h" +#include "cfe_psp_config.h" +#include "cfe_psp_exceptionstorage_types.h" +#include "cfe_psp_exceptionstorage_api.h" +#include "cfe_psp_backtrace.h" + +#include +#include +#include + +/* + * A set of asynchronous signals which will be masked during other signal processing + */ +sigset_t CFE_PSP_AsyncMask; + +/*************************************************************************** + ** FUNCTIONS DEFINITIONS + ***************************************************************************/ + +/* +** +** Installed as a signal handler to log exception events. +** +*/ +void CFE_PSP_ExceptionSigHandler(int signo, siginfo_t *si, void *ctxt) +{ + CFE_PSP_Exception_LogData_t *Buffer; + int32 NumAddrs; + + /* + * Note that the time between CFE_PSP_Exception_GetNextContextBuffer() + * and CFE_PSP_Exception_WriteComplete() is sensitive in that it is + * accessing a global. + * + * Cannot use a conventional lock because this is a signal handler, the + * solution would need to involve a signal-safe spinlock and/or C11 + * atomic ops. + * + * This means if another exception occurs on another task during this + * time window, it may use the same buffer. + * + * However, exceptions should be rare enough events that this is highly + * unlikely to occur, so leaving this unhandled for now. + */ + Buffer = CFE_PSP_Exception_GetNextContextBuffer(); + if (Buffer != NULL) + { + /* + * read the clock as a timestamp - note "clock_gettime" is signal safe per POSIX, + * + * _not_ going through OSAL to read this as it may do something signal-unsafe... + * (current implementation would be safe, but it is not guaranteed to always be). + */ + clock_gettime(CLOCK_MONOTONIC, &Buffer->context_info.event_time); + memcpy(&Buffer->context_info.si, si, sizeof(Buffer->context_info.si)); + + /* Collect QNX backtrace info */ + NumAddrs = CFE_PSP_Backtrace(Buffer->context_info.Addrs, ctxt, CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE); + Buffer->context_info.ValidAddrs = NumAddrs; + + /* Set exception context size */ + Buffer->context_size = sizeof(CFE_PSP_Exception_ContextDataEntry_t); + + /* pthread_self() is signal-safe per POSIX.1-2013 */ + Buffer->sys_task_id = pthread_self(); + CFE_PSP_Exception_WriteComplete(); + } + + /* + * notify the main (idle) thread that an interesting event occurred. + * Note on this platform this cannot _directly_ invoke CFE from a signal handler. + */ + pthread_kill(CFE_PSP_IdleTaskState.ThreadID, CFE_PSP_EXCEPTION_EVENT_SIGNAL); +} + +/* +** +** An extension of CFE_PSP_ExceptionSigHandler that also +** suspends the calling task and prevents returning to the +** application. +** +** This is required for handling events like Floating Point exceptions, +** where returning to the application would resume at the same instruction +** and re-trigger the exception, resulting in a loop. +** +*/ +void CFE_PSP_ExceptionSigHandlerSuspend(int signo, siginfo_t *si, void *ctxt) +{ + /* + * Perform normal exception logging + */ + CFE_PSP_ExceptionSigHandler(signo, si, ctxt); + + /* + * calling "sigsuspend" with an empty mask should + * block this thread indefinitely. This is intended + * to replicate the behavior of vxworks which suspends + * the task after an exception. + * + * This stops execution of the thread in anticipation that it + * will be deleted by the CFE/OSAL. + */ + sigsuspend(&CFE_PSP_AsyncMask); +} + +/* + * Helper function to call sigaction() to attach a signal handler + */ +void CFE_PSP_AttachSigHandler(int signo) +{ + struct sigaction sa; + + memset(&sa, 0, sizeof(sa)); + sa.sa_mask = CFE_PSP_AsyncMask; + + if (!sigismember(&CFE_PSP_AsyncMask, signo)) + { + /* + * In the event that the handler is being installed for one of the + * synchronous events, use the CFE_PSP_ExceptionSigHandlerSuspend variant. + * + * This suspends the caller and prevents returning to the application. + */ + sa.sa_sigaction = CFE_PSP_ExceptionSigHandlerSuspend; + + /* + * add it back to the mask set. + * This is supposed to be default unless SA_NODEFER flag is set, + * but also setting it here to be sure. + */ + sigaddset(&sa.sa_mask, signo); + } + else + { + /* + * Use default handler which will return to the application + * after logging the event + */ + sa.sa_sigaction = CFE_PSP_ExceptionSigHandler; + } + sa.sa_flags = SA_SIGINFO; + + sigaction(signo, &sa, NULL); +} + +/* +** +** This is called from the CFE Main task, before any other threads +** are started. Use this opportunity to install the handler for +** CTRL+C events, which will now be treated as an exception. +** +** Not only does this clean up the code by NOT requiring a specific +** handler for CTRL+C, it also provides a way to exercise and test +** the exception handling in general, which tends to be infrequently +** invoked because otherwise it only happens with off nominal behavior. +** +** This has yet another benefit that SIGINT events will make their +** way into the exception and reset log, so it is visible why the +** CFE shut down. +*/ + +void CFE_PSP_AttachExceptions(void) +{ + /* Initialize backtrace */ + CFE_PSP_Backtrace_Init(); + + /* + * Block most other signals during handler execution. + * Exceptions are for synchronous errors SIGFPE/SIGSEGV/SIGILL/SIGBUS + */ + sigfillset(&CFE_PSP_AsyncMask); + sigdelset(&CFE_PSP_AsyncMask, SIGILL); + sigdelset(&CFE_PSP_AsyncMask, SIGFPE); + sigdelset(&CFE_PSP_AsyncMask, SIGBUS); + sigdelset(&CFE_PSP_AsyncMask, SIGSEGV); + + /* + * Install sigint_handler as the signal handler for SIGINT. + * + * In the event that the user presses CTRL+C at the console + * this will be recorded as an exception and use the general + * purpose exception processing logic to shut down CFE. + * + * Also include SIGTERM so it will invoke a graceful shutdown + */ + CFE_PSP_AttachSigHandler(SIGINT); + CFE_PSP_AttachSigHandler(SIGTERM); + + /* + * Clear any pending exceptions. + * + * This is just in case this is a PROCESSOR reset and there + * was something still in the queue from the last lifetime. + * + * It should have been logged already, but if not, then + * don't action on it now. + */ + CFE_PSP_Exception_Reset(); + + /* Display exception context entry size */ + OS_printf("CFE_PSP: %s ==> Exception Context Size: %ld \n", __func__, sizeof(CFE_PSP_Exception_ContextDataEntry_t)); +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_SetDefaultExceptionEnvironment(void) +{ + /* + * This additionally sets a handler for SIGFPE which will catch arithmetic errors + * such as divide by zero and additionally SIGILL/SIGBUS/SIGSEGV. + * + * When debugging, remove the attach sig handler call and use the default signal handler + * for the SIGILL/SIGBUS/SIGSEGV which will abort the program and generate a core file. + */ + CFE_PSP_AttachSigHandler(SIGFPE); + CFE_PSP_AttachSigHandler(SIGILL); + CFE_PSP_AttachSigHandler(SIGBUS); + CFE_PSP_AttachSigHandler(SIGSEGV); +} + +int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer, char *ReasonBuf, uint32 ReasonSize) +{ + const char *ComputedReason = "unknown"; + + /* check the "code" within the siginfo structure, which reveals more info about the FP exception */ + if (Buffer->context_info.si.si_signo == SIGFPE) + { + switch (Buffer->context_info.si.si_code) + { + case FPE_INTDIV: + ComputedReason = "Integer divide by zero"; + break; + case FPE_INTOVF: + ComputedReason = "Integer overflow"; + break; + case FPE_FLTDIV: + ComputedReason = "Floating-point divide by zero"; + break; + case FPE_FLTOVF: + ComputedReason = "Floating-point overflow"; + break; + case FPE_FLTUND: + ComputedReason = "Floating-point underflow"; + break; + case FPE_FLTRES: + ComputedReason = "Floating-point inexact result"; + break; + case FPE_FLTINV: + ComputedReason = "Invalid floating-point operation"; + break; + case FPE_FLTSUB: + ComputedReason = "Subscript out of range"; + break; + default: + ComputedReason = "Unknown SIGFPE"; + } + (void)snprintf(ReasonBuf, ReasonSize, "%s at ip 0x%lx", ComputedReason, + (unsigned long)Buffer->context_info.si.si_addr); + } + else if (Buffer->context_info.si.si_signo == SIGINT) + { + /* interrupt e.g. CTRL+C */ + (void)snprintf(ReasonBuf, ReasonSize, "Caught SIGINT"); + } + else if (Buffer->context_info.si.si_signo == SIGILL) + { + (void)snprintf(ReasonBuf, ReasonSize, "Caught SIGILL"); + } + else if (Buffer->context_info.si.si_signo == SIGBUS) + { + (void)snprintf(ReasonBuf, ReasonSize, "Caught SIGBUS"); + } + else if (Buffer->context_info.si.si_signo == SIGSEGV) + { + (void)snprintf(ReasonBuf, ReasonSize, "Caught SIGSEGV"); + } + else + { + /* + * other signal.... + * POSIX 2008 does provide a strsignal() function to get the name, but this + * is a newer spec than what is targeted by CFE, so just print the number. + */ + (void)snprintf(ReasonBuf, ReasonSize, "Caught Signal %d", Buffer->context_info.si.si_signo); + } + + return CFE_PSP_SUCCESS; +} diff --git a/fsw/generic-qnx/src/cfe_psp_memory.c b/fsw/generic-qnx/src/cfe_psp_memory.c new file mode 100644 index 00000000..0e8ad46d --- /dev/null +++ b/fsw/generic-qnx/src/cfe_psp_memory.c @@ -0,0 +1,768 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_memory.c +** +** QNX Version +** +** Purpose: +** cFE PSP Memory related functions. This is the implementation of the cFE +** memory areas that have to be preserved, and the API that is designed to allow +** access to them. It also contains memory related routines to return the +** address of the kernel code used in the cFE checksum. +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include +#include +#include +#include +#include +#include + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +/* +** Types and prototypes for this module +*/ +#include "cfe_psp.h" + +/* +** PSP Specific defines +*/ +#include "cfe_psp_config.h" +#include "cfe_psp_memory.h" + +#define CFE_PSP_KEY_FILE_NAME_LENGTH 40 + +char CdsKeyFileName[CFE_PSP_KEY_FILE_NAME_LENGTH]; +char ResetKeyFileName[CFE_PSP_KEY_FILE_NAME_LENGTH]; +char ReservedKeyFileName[CFE_PSP_KEY_FILE_NAME_LENGTH]; + +#define CFE_PSP_CDS_KEY_FILE_NAME_EXT "cdskeyfile" +#define CFE_PSP_RESET_KEY_FILE_NAME_EXT "resetkeyfile" +#define CFE_PSP_RESERVED_KEY_FILE_NAME_EXT "reservedkeyfile" + +#define CFE_PSP_CDS_KEY_FILE CdsKeyFileName +#define CFE_PSP_RESET_KEY_FILE ResetKeyFileName +#define CFE_PSP_RESERVED_KEY_FILE ReservedKeyFileName + +#include "target_config.h" + +/* + * Define the PSP-supported capacities to be the maximum allowed, +*/ +#define CFE_PSP_CDS_SIZE (GLOBAL_CONFIGDATA.CfeConfig->CdsSize) +#define CFE_PSP_RESET_AREA_SIZE (GLOBAL_CONFIGDATA.CfeConfig->ResetAreaSize) +#define CFE_PSP_USER_RESERVED_SIZE (GLOBAL_CONFIGDATA.CfeConfig->UserReservedSize) + +typedef struct +{ + CFE_PSP_ReservedMemoryBootRecord_t BootRecord; + CFE_PSP_ExceptionStorage_t ExceptionStorage; +} CFE_PSP_QnxReservedAreaFixedLayout_t; + +/* +** Internal prototypes for this module +*/ +void CFE_PSP_InitCDS(void); +void CFE_PSP_InitResetArea(void); +void CFE_PSP_InitVolatileDiskMem(void); +void CFE_PSP_InitUserReservedArea(void); +void CFE_PSP_InitKeyFileNames(char *CpuName, uint32 CpuId); + + +/* +** External Declarations +*/ +extern unsigned int _btext; +extern unsigned int _etext; + +/* +** Global variables +*/ +int ResetAreaShmId; +int CDSShmId; +int UserShmId; + +/* +** Pointer to the vxWorks USER_RESERVED_MEMORY area +** The sizes of each memory area is defined in os_processor.h for this architecture. +*/ +CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap; + +/* +********************************************************************************* +** CDS related functions +********************************************************************************* +*/ +/* +** +*/ +/****************************************************************************** +** +** Purpose: This function is used by the ES startup code to initialize the +** Critical Data store area +** +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ + +void CFE_PSP_InitCDS(void) +{ + /* + ** connect to (and possibly create) the segment: + */ + if ((CDSShmId = shm_open(CFE_PSP_CDS_KEY_FILE, O_RDWR | O_CREAT, 0644)) == -1) + { + perror("CFE_PSP - Cannot shm_open CDS Shared memory Segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); + } + + ftruncate(CDSShmId, CFE_PSP_CDS_SIZE); + + /* + ** attach to the segment to get a pointer to it: + */ + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = mmap(NULL,CFE_PSP_CDS_SIZE, (PROT_READ | PROT_WRITE), MAP_SHARED, CDSShmId, 0); + if (CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr == MAP_FAILED) + { + perror("CFE_PSP - Cannot mmap to CDS Shared memory Segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); + } + + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = CFE_PSP_CDS_SIZE; +} + +/****************************************************************************** +** +** Purpose: +** This is an internal function to delete the CDS Shared memory segment. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_DeleteCDS(void) +{ + int ReturnCode = 0; + + /* Unmapped and unlink shared memory segment */ + ReturnCode = munmap(CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr, CFE_PSP_CDS_SIZE); + if (ReturnCode == 0) + { + ReturnCode = shm_unlink(CFE_PSP_CDS_KEY_FILE); + if(ReturnCode == 0) + { + OS_printf("User CDS Area Shared memory segment removed\n"); + } + else + { + OS_printf("Error Removing User CDS Area Shared memory Segment.\n"); + } + } + else + { + OS_printf("Error Removing User CDS Area Shared memory Segment.\n"); + } +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) +{ + int32 return_code; + + if (SizeOfCDS == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *SizeOfCDS = CFE_PSP_CDS_SIZE; + return_code = CFE_PSP_SUCCESS; + } + + return return_code; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 NumBytes) +{ + uint8 *CopyPtr; + int32 return_code; + + if (PtrToDataToWrite == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE)) + { + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr += CDSOffset; + memcpy(CopyPtr, (char *)PtrToDataToWrite, NumBytes); + + return_code = CFE_PSP_SUCCESS; + } + else + { + return_code = CFE_PSP_ERROR; + } + + } /* end if PtrToDataToWrite == NULL */ + + return return_code; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumBytes) +{ + uint8 *CopyPtr; + int32 return_code; + + if (PtrToDataToRead == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE)) + { + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr += CDSOffset; + memcpy((char *)PtrToDataToRead, CopyPtr, NumBytes); + + return_code = CFE_PSP_SUCCESS; + } + else + { + return_code = CFE_PSP_ERROR; + } + + } /* end if PtrToDataToWrite == NULL */ + + return return_code; +} + +/* +********************************************************************************* +** ES Reset Area related functions +********************************************************************************* +*/ + +/****************************************************************************** +** +** Purpose: +** This function is used by the ES startup code to initialize the +** ES Reset Area. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_InitResetArea(void) +{ + size_t total_size; + size_t reset_offset; + size_t align_mask; + cpuaddr block_addr; + CFE_PSP_QnxReservedAreaFixedLayout_t *FixedBlocksPtr; + + /* + * NOTE: Historically the CFE ES reset area also contains the Exception log. + * This is now allocated as a separate structure in the PSP, but it can + * reside in this shared memory segment so it will be preserved on a processor + * reset. + */ + align_mask = sysconf(_SC_PAGESIZE) - 1; /* align blocks to whole memory pages */ + total_size = sizeof(CFE_PSP_QnxReservedAreaFixedLayout_t); + total_size = (total_size + align_mask) & ~align_mask; + reset_offset = total_size; + total_size += CFE_PSP_RESET_AREA_SIZE; + total_size = (total_size + align_mask) & ~align_mask; + + /* + ** connect to (and possibly create) the segment: + */ + if ((ResetAreaShmId = shm_open(CFE_PSP_RESET_KEY_FILE, O_RDWR | O_CREAT, 0644)) == -1) + { + perror("CFE_PSP - Cannot shm_open Reset Area Shared memory Segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); + } + + /* + ** attach to the segment to get a pointer to it: + */ + ftruncate(ResetAreaShmId, total_size); + block_addr = (cpuaddr)mmap(NULL,total_size, (PROT_READ | PROT_WRITE), MAP_SHARED, ResetAreaShmId, 0); + if (block_addr == (cpuaddr)(-1)) + { + perror("CFE_PSP - Cannot mmap to Reset Area Shared memory Segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); + } + + FixedBlocksPtr = (CFE_PSP_QnxReservedAreaFixedLayout_t *)block_addr; + block_addr += reset_offset; + + CFE_PSP_ReservedMemoryMap.BootPtr = &FixedBlocksPtr->BootRecord; + CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedBlocksPtr->ExceptionStorage; + + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void *)block_addr; + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = CFE_PSP_RESET_AREA_SIZE; +} + +/****************************************************************************** +** +** Purpose: +** This is an internal function to delete the Reset Area Shared memory segment. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_DeleteResetArea(void) +{ + int ReturnCode = 0; + + /* Unmapped and unlink shared memory segment */ + ReturnCode = munmap(CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr, CFE_PSP_RESET_AREA_SIZE); + + if (ReturnCode == 0) + { + ReturnCode = shm_unlink(CFE_PSP_RESET_KEY_FILE); + if(ReturnCode == 0) + { + OS_printf("User Reset Area Shared memory segment removed\n"); + } + else + { + OS_printf("Error Removing User Reset Area Shared memory Segment.\n"); + } + } + else + { + OS_printf("Error Removing User Reset Area Shared memory Segment.\n"); + } +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) +{ + int32 return_code; + + if (SizeOfResetArea == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToResetArea = (cpuaddr)CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr; + *SizeOfResetArea = CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize; + return_code = CFE_PSP_SUCCESS; + } + + return return_code; +} + +/* +********************************************************************************* +** ES User Reserved Area related functions +********************************************************************************* +*/ + +/* +** Purpose: +** This function is used to create unique key file names for shared memory +** segements. +*/ +void CFE_PSP_InitKeyFileNames(char *CpuName, uint32 CpuId) +{ + /* + ** Construct the key file name: + ** The name will consist of "/.key_file_name" + */ + snprintf(CdsKeyFileName, sizeof(CdsKeyFileName), "/%s.%d.%s", CpuName, CpuId, CFE_PSP_CDS_KEY_FILE_NAME_EXT); + snprintf(ResetKeyFileName, sizeof(ResetKeyFileName), "/%s.%d.%s", CpuName, CpuId, CFE_PSP_RESET_KEY_FILE_NAME_EXT); + snprintf(ReservedKeyFileName, sizeof(ReservedKeyFileName), "/%s.%d.%s", CpuName, CpuId, CFE_PSP_RESERVED_KEY_FILE_NAME_EXT); +} + +/****************************************************************************** +** +** Purpose: +** This function is used by the ES startup code to initialize the +** ES user reserved area. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_InitUserReservedArea(void) +{ + /* + ** connect to (and possibly create) the segment: + */ + if ((UserShmId = shm_open(CFE_PSP_RESERVED_KEY_FILE, O_RDWR | O_CREAT, 0644)) == -1) + { + perror("CFE_PSP - Cannot shm_open User Reserved Area Shared memory Segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); + } + + /* + ** attach to the segment to get a pointer to it: + */ + ftruncate(UserShmId, CFE_PSP_USER_RESERVED_SIZE); + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = mmap(NULL, CFE_PSP_USER_RESERVED_SIZE, + (PROT_READ | PROT_WRITE), MAP_SHARED, UserShmId, 0); + if (CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr == (void *)(-1)) + { + perror("CFE_PSP - Cannot mmap to User Reserved Area Shared memory Segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); + } + + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = CFE_PSP_USER_RESERVED_SIZE; +} + +/****************************************************************************** +** +** Purpose: +** This is an internal function to delete the User Reserved Shared memory segment. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_DeleteUserReservedArea(void) +{ + int ReturnCode = 0; + + /* Unmapped and unlink shared memory segment */ + ReturnCode = munmap(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr, CFE_PSP_USER_RESERVED_SIZE); + + if (ReturnCode == 0) + { + ReturnCode = shm_unlink(CFE_PSP_RESERVED_KEY_FILE); + if(ReturnCode == 0) + { + OS_printf("User Reserved Area Shared memory segment removed\n"); + } + else + { + OS_printf("Error Removing User Reserved Area Shared memory Segment.\n"); + } + } + else + { + OS_printf("Error Removing User Reserved Area Shared memory Segment.\n"); + } +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea) +{ + int32 return_code; + + if (SizeOfUserArea == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToUserArea = (cpuaddr)CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr; + *SizeOfUserArea = CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize; + return_code = CFE_PSP_SUCCESS; + } + + return return_code; +} + +/* +********************************************************************************* +** ES Volatile disk memory related functions +********************************************************************************* +*/ + +/****************************************************************************** +** +** Purpose: +** This function is used by the ES startup code to initialize the memory +** used by the volatile disk. On a desktop/posix platform this is currently +** a no-op, because the volatile disk is being mapped to the desktop. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_InitVolatileDiskMem(void) +{ + /* + ** Here, we want to clear out the volatile ram disk contents + ** on a power on reset + */ +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) +{ + int32 return_code; + + if (SizeOfVolDisk == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToVolDisk = (cpuaddr)CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr; + *SizeOfVolDisk = CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize; + return_code = CFE_PSP_SUCCESS; + } + + return return_code; +} + +/* +********************************************************************************* +** ES BSP Top Level Reserved memory initialization +********************************************************************************* +*/ + +/****************************************************************************** +** +** Purpose: +** This function performs the top level reserved memory initialization. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_SetupReservedMemoryMap(void) +{ + int tempFd; + + /* + ** Create the key files for the shared memory segments + ** The files are not needed, so they are closed right away. + */ + tempFd = open(CFE_PSP_CDS_KEY_FILE, O_RDONLY | O_CREAT, S_IRWXU); + close(tempFd); + tempFd = open(CFE_PSP_RESET_KEY_FILE, O_RDONLY | O_CREAT, S_IRWXU); + close(tempFd); + tempFd = open(CFE_PSP_RESERVED_KEY_FILE, O_RDONLY | O_CREAT, S_IRWXU); + close(tempFd); + + /* + * The setup of each section is done as a separate init. + * + * Any failures within these routines call exit(), so there + * is no need to check status - failure means no return. + */ + + CFE_PSP_InitCDS(); + CFE_PSP_InitResetArea(); + CFE_PSP_InitVolatileDiskMem(); + CFE_PSP_InitUserReservedArea(); + + /* + * Set up the "RAM" entry in the memory table. + * On Linux this is just encompasses the entire memory space, but an entry needs + * to exist so that CFE_PSP_ValidateMemRange() works as intended. + */ + CFE_PSP_MemRangeSet(0, CFE_PSP_MEM_RAM, 0, SIZE_MAX, CFE_PSP_MEM_SIZE_DWORD, CFE_PSP_MEM_ATTR_READWRITE); +} + +int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) +{ + /* + * Clear the segments only on a POWER ON reset + * + * Newly-created segments should already be zeroed out, + * but this ensures it. + */ + if (RestartType == CFE_PSP_RST_TYPE_POWERON) + { + OS_printf("CFE_PSP: Clearing out CFE CDS Shared memory segment.\n"); + memset(CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr, 0, CFE_PSP_CDS_SIZE); + OS_printf("CFE_PSP: Clearing out CFE Reset Shared memory segment.\n"); + memset(CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr, 0, CFE_PSP_RESET_AREA_SIZE); + OS_printf("CFE_PSP: Clearing out CFE User Reserved Shared memory segment.\n"); + memset(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr, 0, CFE_PSP_USER_RESERVED_SIZE); + + memset(CFE_PSP_ReservedMemoryMap.BootPtr, 0, sizeof(*CFE_PSP_ReservedMemoryMap.BootPtr)); + memset(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr, 0, + sizeof(*CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr)); + + /* + * If an unclean shutdown occurs, try to do a PROCESSOR reset next. + * This will attempt to preserve the exception and reset log content. + */ + CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType = CFE_PSP_RST_TYPE_PROCESSOR; + } + else + { + /* + * If an unclean shutdown occurs after a PROCESSOR reset, then next time should + * be a POWERON reset. + */ + CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType = CFE_PSP_RST_TYPE_POWERON; + } + + /* + * Reset the boot record validity flag (always). + * + * If an unclean shutdown occurs, such as a software crash or abort, this + * will remain in the shm structure and it can be detected at startup. + * + * This can be used to differentiate between an intentional and unintentional + * processor reset. + * + * If a directed shutdown occurs (via CFE_PSP_Restart) then this + * is overwritten with the valid value. + */ + CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag = CFE_PSP_BOOTRECORD_INVALID; + + return CFE_PSP_SUCCESS; +} + +/****************************************************************************** +** +** Purpose: +** This function cleans up all of the shared memory segments in the +** Linux/OSX ports. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_DeleteProcessorReservedMemory(void) +{ + CFE_PSP_DeleteCDS(); + CFE_PSP_DeleteResetArea(); + CFE_PSP_DeleteUserReservedArea(); +} + +/* +********************************************************************************* +** ES BSP kernel memory segment functions +********************************************************************************* +*/ + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *SizeOfKernelSegment) +{ + /* Check pointers */ + if (PtrToKernelSegment == NULL || SizeOfKernelSegment == NULL) + { + return CFE_PSP_ERROR; + } + + /* Set to known values */ + *PtrToKernelSegment = (cpuaddr)0x0; + *SizeOfKernelSegment = 0; + + return CFE_PSP_ERROR_NOT_IMPLEMENTED; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFESegment) +{ + int32 return_code; + + if (SizeOfCFESegment == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToCFESegment = (cpuaddr)(&_btext); + *SizeOfCFESegment = (uint32)(((cpuaddr)&_etext) - ((cpuaddr)&_btext)); + + return_code = CFE_PSP_SUCCESS; + } + + return return_code; +} diff --git a/fsw/generic-qnx/src/cfe_psp_ssr.c b/fsw/generic-qnx/src/cfe_psp_ssr.c new file mode 100644 index 00000000..280b2dff --- /dev/null +++ b/fsw/generic-qnx/src/cfe_psp_ssr.c @@ -0,0 +1,64 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_ssr.c +** +** Purpose: +** This file contains glue routines between the cFE and the OS Board Support Package ( BSP ). +** The functions here allow the cFE to interface functions that are board and OS specific +** and usually don't fit well in the OS abstraction layer. +** +** History: +** 2005/06/05 Alan Cudmore | Initial version, +** +******************************************************************************/ + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +/* +** Types and prototypes for this module +*/ +#include "cfe_psp.h" +#include "cfe_psp_config.h" + +/* +** Standard Include Files +*/ +#include +#include +#include + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName) +{ + int32 Status; + + Status = CFE_PSP_ERROR; + + return Status; +} diff --git a/fsw/generic-qnx/src/cfe_psp_start.c b/fsw/generic-qnx/src/cfe_psp_start.c new file mode 100644 index 00000000..62327390 --- /dev/null +++ b/fsw/generic-qnx/src/cfe_psp_start.c @@ -0,0 +1,601 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_start.c +** +** Purpose: +** cFE BSP main entry point. +** +** History: +** 2005/07/26 A. Cudmore | Initial version for OS X/Linux +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +#include "cfe_psp.h" +#include "cfe_psp_memory.h" +#include "cfe_psp_cpuset.h" + +/* + * The preferred way to obtain the CFE tunable values at runtime is via + * the dynamically generated configuration object. This allows a single build + * of the PSP to be completely CFE-independent. + */ +#include "target_config.h" +#include "cfe_psp_module.h" + +#define CFE_PSP_MAIN_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->SystemMain) +#define CFE_PSP_1HZ_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->System1HzISR) +#define CFE_PSP_NONVOL_STARTUP_FILE (GLOBAL_CONFIGDATA.CfeConfig->NonvolStartupFile) +#define CFE_PSP_CPU_ID (GLOBAL_CONFIGDATA.Default_CpuId) +#define CFE_PSP_CPU_NAME (GLOBAL_CONFIGDATA.Default_CpuName) +#define CFE_PSP_SPACECRAFT_ID (GLOBAL_CONFIGDATA.Default_SpacecraftId) + +/* +** Defines +*/ + +#define CFE_PSP_CPU_NAME_LENGTH 32 +#define CFE_PSP_RESET_NAME_LENGTH 10 + +/* + * Limits for task name length in kernel (fixed by Linux/glibc) + * For reference see manpage for "pthread_setname_np". + */ +#define CFE_PSP_KERNEL_NAME_LENGTH_MAX 16 + +/* +** Typedefs for this module +*/ + +/* +** Structure for the Command line parameters +*/ +typedef struct +{ + char ResetType[CFE_PSP_RESET_NAME_LENGTH]; /* Reset type can be "PO" for Power on or "PR" for Processor Reset */ + uint32 GotResetType; /* did we get the ResetType parameter ? */ + + uint32 SubType; /* Reset Sub Type ( 1 - 5 ) */ + uint32 GotSubType; /* did we get the ResetSubType parameter ? */ + + char CpuName[CFE_PSP_CPU_NAME_LENGTH]; /* CPU Name */ + uint32 GotCpuName; /* Did we get a CPU Name ? */ + + uint32 CpuId; /* CPU ID */ + uint32 GotCpuId; /* Did we get a CPU Id ?*/ + + uint32 SpacecraftId; /* Spacecraft ID */ + uint32 GotSpacecraftId; /* Did we get a Spacecraft ID */ +} CFE_PSP_CommandData_t; + +/* +** Prototypes for this module +*/ +void CFE_PSP_DisplayUsage(char *Name); +void CFE_PSP_ProcessArgumentDefaults(CFE_PSP_CommandData_t *CommandDataDefault); +int pthread_setname_np(pthread_t tid, const char* newname); +void CFE_PSP_InitKeyFileNames(char *CpuName, uint32 CpuId); + +/* +** Global variables +*/ +uint32 TimerCounter; +CFE_PSP_CommandData_t CommandData; +uint32 CFE_PSP_SpacecraftId; +uint32 CFE_PSP_CpuId; +char CFE_PSP_CpuName[CFE_PSP_CPU_NAME_LENGTH]; + +CFE_PSP_IdleTaskState_t CFE_PSP_IdleTaskState; + +/* +** getopts parameter passing options string +*/ +static const char *optString = "R:S:C:I:N:h"; + +/* +** getopts_long long form argument table +*/ +static const struct option longOpts[] = {{"reset", required_argument, NULL, 'R'}, + {"subtype", required_argument, NULL, 'S'}, + {"cpuid", required_argument, NULL, 'C'}, + {"scid", required_argument, NULL, 'I'}, + {"cpuname", required_argument, NULL, 'N'}, + {"help", no_argument, NULL, 'h'}, + {NULL, no_argument, NULL, 0}}; + +/****************************************************************************** +** +** Purpose: +** Linux Task creation event handler. +** Sets the kernel task name using a glibc-specific (non-posix) function. +** +*/ +int32 CFE_PSP_OS_EventHandler(OS_Event_t event, osal_id_t object_id, void *data) +{ + char taskname[OS_MAX_API_NAME]; + CFE_PSP_cpuset_t runmask; + + /* Intitialize and zero cpuset */ + CFE_PSP_CpusetZero(&runmask); + + memset(taskname, 0, sizeof(taskname)); + + switch (event) + { + case OS_EVENT_RESOURCE_ALLOCATED: + /* resource/id is newly allocated but not yet created. Invoked within locked region. */ + break; + case OS_EVENT_RESOURCE_CREATED: + /* resource/id has been fully created/finalized. Invoked outside locked region. */ + break; + case OS_EVENT_RESOURCE_DELETED: + /* resource/id has been deleted. Invoked outside locked region. */ + break; + case OS_EVENT_TASK_STARTUP: + { + /* New task is starting. Invoked from within the task context. */ + /* Get the name from OSAL and propagate to the pthread/system layer */ + if (OS_GetResourceName(object_id, taskname, sizeof(taskname)) == OS_SUCCESS) + { + /* + * Example mechanism for setting thread affinity + * + * Could assign based on task name, pattern within name (CFE_* on 0, + * *_CN where N is desired core), round robin or whatever the requrements are. + * + * Just assigning all "CFE_*" tasks to core zero and let the rest float. + */ + if (strncmp(taskname, "CFE_", 4) == 0) + { + /* Set the runmask and inherit mask for each processor that the current + * thread can run on. */ + CFE_PSP_CpusetSetCore(&runmask, CFE_PSP_DEFAULT_CORE_AFFINITY); + ThreadCtl(_NTO_TCTL_RUNMASK_GET_AND_SET_INHERIT, &runmask); + } + + /* + * glibc/kernel has an internal limit for this name. + * If the OSAL name is longer, just truncate it. + * Otherwise the name isn't set at all - this assumes the first + * chars of the name is better for debug than none of it. + */ + if (strlen(taskname) >= CFE_PSP_KERNEL_NAME_LENGTH_MAX) + { + taskname[CFE_PSP_KERNEL_NAME_LENGTH_MAX - 1] = 0; + } + + /* Set thread name using non-posix function provided by QNX OS extension. */ + pthread_setname_np(pthread_self(), taskname); + } + break; + } + + default: + break; + } + + return OS_SUCCESS; +} + +/****************************************************************************** +** +** Purpose: +** BSP Application entry point. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void OS_Application_Startup(void) +{ + uint32 reset_type; + uint32 reset_subtype; + osal_id_t fs_id; + int opt = 0; + int longIndex = 0; + int32 Status; + char *const *argv; + int argc; + + /* + ** Initialize the CommandData struct + */ + memset(&(CommandData), 0, sizeof(CFE_PSP_CommandData_t)); + + /* + ** Process the arguments with getopt_long(), then + ** start the cFE + */ + argc = OS_BSP_GetArgC(); + argv = OS_BSP_GetArgV(); + opt = getopt_long(argc, argv, optString, longOpts, &longIndex); + while (opt != -1) + { + switch (opt) + { + case 'R': + strncpy(CommandData.ResetType, optarg, CFE_PSP_RESET_NAME_LENGTH - 1); + CommandData.ResetType[CFE_PSP_RESET_NAME_LENGTH - 1] = 0; + + if ((strncmp(CommandData.ResetType, "PO", CFE_PSP_RESET_NAME_LENGTH) != 0) && + (strncmp(CommandData.ResetType, "PR", CFE_PSP_RESET_NAME_LENGTH) != 0)) + { + printf("\nERROR: Invalid Reset Type: %s\n\n", CommandData.ResetType); + CommandData.GotResetType = 0; + CFE_PSP_DisplayUsage(argv[0]); + break; + } + printf("CFE_PSP: Reset Type: %s\n", (char *)optarg); + CommandData.GotResetType = 1; + break; + + case 'S': + CommandData.SubType = strtol(optarg, NULL, 0); + if (CommandData.SubType < 1 || CommandData.SubType > 5) + { + printf("\nERROR: Invalid Reset SubType: %s\n\n", optarg); + CommandData.SubType = 0; + CommandData.GotSubType = 0; + CFE_PSP_DisplayUsage(argv[0]); + break; + } + printf("CFE_PSP: Reset SubType: %d\n", (int)CommandData.SubType); + CommandData.GotSubType = 1; + break; + + case 'N': + strncpy(CommandData.CpuName, optarg, CFE_PSP_CPU_NAME_LENGTH - 1); + CommandData.CpuName[CFE_PSP_CPU_NAME_LENGTH - 1] = 0; + printf("CFE_PSP: CPU Name: %s\n", CommandData.CpuName); + CommandData.GotCpuName = 1; + break; + + case 'C': + CommandData.CpuId = strtol(optarg, NULL, 0); + printf("CFE_PSP: CPU ID: %d\n", (int)CommandData.CpuId); + CommandData.GotCpuId = 1; + break; + + case 'I': + CommandData.SpacecraftId = strtol(optarg, NULL, 0); + printf("CFE_PSP: Spacecraft ID: %d\n", (int)CommandData.SpacecraftId); + CommandData.GotSpacecraftId = 1; + break; + + case 'h': + CFE_PSP_DisplayUsage(argv[0]); + break; + + default: + CFE_PSP_DisplayUsage(argv[0]); + break; + } + + opt = getopt_long(argc, argv, optString, longOpts, &longIndex); + } /* end while */ + + /* + ** Set the defaults for values that were not given for the + ** optional arguments, and check for arguments that are required. + */ + CFE_PSP_ProcessArgumentDefaults(&CommandData); + + /* + ** Assign the Spacecraft ID, CPU ID, CPU Name and CFS ID + */ + CFE_PSP_SpacecraftId = CommandData.SpacecraftId; + CFE_PSP_CpuId = CommandData.CpuId; + strncpy(CFE_PSP_CpuName, CommandData.CpuName, sizeof(CFE_PSP_CpuName) - 1); + CFE_PSP_CpuName[sizeof(CFE_PSP_CpuName) - 1] = 0; + + /* + ** Set the reset subtype + */ + reset_subtype = CommandData.SubType; + + /* + ** Initialize the OS API data structures + */ + Status = OS_API_Init(); + if (Status != OS_SUCCESS) + { + /* irrecoverable error if OS_API_Init() fails. */ + /* note: use printf here, as OS_printf may not work */ + printf("CFE_PSP: OS_API_Init() failure\n"); + CFE_PSP_Panic(Status); + } + + OS_RegisterEventHandler(CFE_PSP_OS_EventHandler); + + /* + * Init Unique PSP shared memory segments Names + */ + CFE_PSP_InitKeyFileNames(CFE_PSP_CpuName, CFE_PSP_CpuId); + + /* + * Map the PSP shared memory segments + */ + CFE_PSP_SetupReservedMemoryMap(); + + /* + * Prepare for exception handling in the idle task + */ + memset(&CFE_PSP_IdleTaskState, 0, sizeof(CFE_PSP_IdleTaskState)); + CFE_PSP_IdleTaskState.ThreadID = pthread_self(); + + /* + ** Set up the virtual FS mapping for the "/cf" directory + */ + Status = OS_FileSysAddFixedMap(&fs_id, CFE_PSP_CF_VIRTUAL_MAPPING, "/cf"); + if (Status != OS_SUCCESS) + { + /* Print for informational purposes -- + * startup can continue, but loads may fail later, depending on config. */ + OS_printf("CFE_PSP: OS_FileSysAddFixedMap() failure: %d\n", (int)Status); + } + + /* + ** Initialize the statically linked modules (if any) + ** This is only applicable to CMake build - classic build + ** does not have the logic to selectively include/exclude modules + */ + CFE_PSP_ModuleInit(); + + sleep(1); + + /* + * For informational purposes, show the state of the last exit + */ + if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID) + { + OS_printf("CFE_PSP: Normal exit from previous cFE instance\n"); + } + else if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) + { + OS_printf("CFE_PSP: Abnormal exit from previous cFE instance\n"); + } + + /* + * determine reset type... + * If not specified at the command line, then check the "boot record" + */ + reset_type = 0; + if (!CommandData.GotResetType) + { + if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID || + CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) + { + reset_type = CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType; + } + } + else if (strncmp("PR", CommandData.ResetType, 2) == 0) + { + reset_type = CFE_PSP_RST_TYPE_PROCESSOR; + } + + if (reset_type == CFE_PSP_RST_TYPE_PROCESSOR) + { + OS_printf("CFE_PSP: Starting the cFE with a PROCESSOR reset.\n"); + } + else + { + /* catch-all for anything else */ + reset_type = CFE_PSP_RST_TYPE_POWERON; + OS_printf("CFE_PSP: Starting the cFE with a POWER ON reset.\n"); + } + + /* + ** Initialize the reserved memory + */ + Status = CFE_PSP_InitProcessorReservedMemory(reset_type); + if (Status != CFE_PSP_SUCCESS) + { + OS_printf("CFE_PSP: CFE_PSP_InitProcessorReservedMemory() Failure"); + CFE_PSP_Panic(Status); + } + + /* + ** Call cFE entry point. + */ + CFE_PSP_MAIN_FUNCTION(reset_type, reset_subtype, 1, CFE_PSP_NONVOL_STARTUP_FILE); +} + +void OS_Application_Run(void) +{ + int sig; + int ret; + sigset_t sigset; + + /* + * Now that all main tasks are created, + * this original thread will exist just to service signals + * that aren't directed to a specific task. + * + * OSAL sets a very conservative signal mask that + * blocks most signals. Start by unblocking the + * ones that should be handled. + * + * Unblock SIGQUIT so the user can force exit the CFE + * by pressing CTRL+\ (default handler). Also allow + * SIGTERM for which a handler was installed in CFE_PSP_AttachExceptions() + */ + sigemptyset(&sigset); + sigaddset(&sigset, SIGQUIT); + sigaddset(&sigset, SIGTERM); + pthread_sigmask(SIG_UNBLOCK, &sigset, NULL); + + /* + * Reset to the signal for background events (SIGUSR1) + */ + sigemptyset(&sigset); + sigaddset(&sigset, CFE_PSP_EXCEPTION_EVENT_SIGNAL); + + /* + ** just wait for events to occur and notify CFE + ** + ** "shutdownreq" will become true if CFE calls CFE_PSP_Restart(), + ** indicating a request to gracefully exit and restart CFE. + */ + while (!CFE_PSP_IdleTaskState.ShutdownReq) + { + /* go idle and wait for an event */ + ret = sigwait(&sigset, &sig); + + if (ret == 0 && !CFE_PSP_IdleTaskState.ShutdownReq && sig == CFE_PSP_EXCEPTION_EVENT_SIGNAL && + GLOBAL_CFE_CONFIGDATA.SystemNotify != NULL) + { + /* notify the CFE of the event */ + GLOBAL_CFE_CONFIGDATA.SystemNotify(); + } + } + + /* + * This happens if an unhandled exception occurs, or if the user presses CTRL+C + */ + OS_printf("\nCFE_PSP: Shutdown initiated - Exiting cFE\n"); + OS_TaskDelay(100); + + /* Delete the SHM segments if flag set */ + if (CFE_PSP_IdleTaskState.DeleteSharedMemReq == true) + { + CFE_PSP_DeleteProcessorReservedMemory(); + CFE_PSP_IdleTaskState.DeleteSharedMemReq = false; + } + + OS_DeleteAllObjects(); +} + +/****************************************************************************** +** +** Purpose: +** Display program usage, and exit. +** +** Arguments: +** Name -- the name of the binary. +** +** Return: +** (none) +*/ +void CFE_PSP_DisplayUsage(char *Name) +{ + printf("usage : %s [-R ] [-S ] [-C GotSubType == 0) + { + CommandDataDefault->SubType = 1; + printf("CFE_PSP: Default Reset SubType = 1\n"); + CommandDataDefault->GotSubType = 1; + } + + if (CommandDataDefault->GotCpuId == 0) + { + CommandDataDefault->CpuId = CFE_PSP_CPU_ID; + printf("CFE_PSP: Default CPU ID = %d\n", CFE_PSP_CPU_ID); + CommandDataDefault->GotCpuId = 1; + } + + if (CommandDataDefault->GotSpacecraftId == 0) + { + CommandDataDefault->SpacecraftId = CFE_PSP_SPACECRAFT_ID; + printf("CFE_PSP: Default Spacecraft ID = %d\n", CFE_PSP_SPACECRAFT_ID); + CommandDataDefault->GotSpacecraftId = 1; + } + + if (CommandDataDefault->GotCpuName == 0) + { + strncpy(CommandDataDefault->CpuName, CFE_PSP_CPU_NAME, CFE_PSP_CPU_NAME_LENGTH - 1); + CommandDataDefault->CpuName[CFE_PSP_CPU_NAME_LENGTH - 1] = 0; + printf("CFE_PSP: Default CPU Name: %s\n", CFE_PSP_CPU_NAME); + CommandDataDefault->GotCpuName = 1; + } +} diff --git a/fsw/generic-qnx/src/cfe_psp_support.c b/fsw/generic-qnx/src/cfe_psp_support.c new file mode 100644 index 00000000..c4520140 --- /dev/null +++ b/fsw/generic-qnx/src/cfe_psp_support.c @@ -0,0 +1,172 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_support.c +** +** Purpose: +** This file contains glue routines between the cFE and the OS Board Support Package ( BSP ). +** The functions here allow the cFE to interface functions that are board and OS specific +** and usually don't fit well in the OS abstraction layer. +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include +#include + +#include "common_types.h" +#include "osapi.h" + +/* +** Types and prototypes for this module +*/ +#include "cfe_psp.h" +#include "cfe_psp_config.h" +#include "cfe_psp_memory.h" + +/* +** External Variables +*/ +extern uint32 CFE_PSP_SpacecraftId; +extern uint32 CFE_PSP_CpuId; +extern char CFE_PSP_CpuName[]; + + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_Restart(uint32 resetType) +{ + if (resetType == CFE_PSP_RST_TYPE_POWERON) + { + OS_printf("CFE_PSP: Exiting cFE with POWERON Reset status.\n"); + + /* Set flag to delete the SHM segments, so they will be recreated on next boot */ + CFE_PSP_IdleTaskState.DeleteSharedMemReq = true; + } + else + { + OS_printf("CFE_PSP: Exiting cFE with PROCESSOR Reset status.\n"); + } + + /* + * Record the reset type for the next boot. + */ + CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType = resetType; + CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag = CFE_PSP_BOOTRECORD_VALID; + + /* + * Begin process of orderly shutdown. + * + * This should cause the original thread (main task) to wake up + * and start the shutdown procedure. + */ + CFE_PSP_IdleTaskState.ShutdownReq = true; + pthread_kill(CFE_PSP_IdleTaskState.ThreadID, CFE_PSP_EXCEPTION_EVENT_SIGNAL); + + /* + * Give time for the orderly shutdown to occur. + * + * Normally during shutdown this task will be deleted, and therefore + * this does not return. + * + * However, if problems occur (e.g. deadlock) eventually this timeout + * will expire and return. + */ + OS_TaskDelay(CFE_PSP_RESTART_DELAY); + + /* Delete the SHM segments if flag set */ + if (CFE_PSP_IdleTaskState.DeleteSharedMemReq == true) + { + CFE_PSP_DeleteProcessorReservedMemory(); + CFE_PSP_IdleTaskState.DeleteSharedMemReq = false; + } + + /* + * Timeout expired without this task being deleted, so abort(). + * + * This should generate a core file to reveal what went wrong + * with normal shutdown. + */ + abort(); +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_Panic(int32 ErrorCode) +{ + OS_printf("%s called with error code = 0x%08X. Exiting.\n", __func__, (unsigned int)ErrorCode); + OS_printf("The cFE could not start.\n"); + abort(); /* abort() is preferable to exit(EXIT_FAILURE), as it may create a core file for debug */ +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size) +{ + printf("%s called -- Currently no Linux/OSX/Cygwin implementation\n", __func__); +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +uint32 CFE_PSP_GetProcessorId(void) +{ + return CFE_PSP_CpuId; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +uint32 CFE_PSP_GetSpacecraftId(void) +{ + return CFE_PSP_SpacecraftId; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +const char *CFE_PSP_GetProcessorName(void) +{ + return CFE_PSP_CpuName; +} diff --git a/fsw/generic-qnx/src/cfe_psp_watchdog.c b/fsw/generic-qnx/src/cfe_psp_watchdog.c new file mode 100644 index 00000000..09df80e2 --- /dev/null +++ b/fsw/generic-qnx/src/cfe_psp_watchdog.c @@ -0,0 +1,123 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_watchdog.c +** +** Purpose: +** This file contains glue routines between the cFE and the OS Board Support Package ( BSP ). +** The functions here allow the cFE to interface functions that are board and OS specific +** and usually don't fit well in the OS abstraction layer. +** +** History: +** 2009/07/20 A. Cudmore | Initial version, +** +*************************************************************************************************/ + +/* +** Include Files +*/ + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +/* +** System Include Files +*/ +#include +#include + +/* +** Types and prototypes for this module +*/ +#include "cfe_psp.h" +#include "cfe_psp_config.h" + +/* +** Global data +*/ + +/* +** The watchdog time in milliseconds +*/ +uint32 CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogInit(void) +{ + /* + ** Just set it to a value right now + ** The pc-linux desktop platform does not actually implement a watchdog + ** timeout ( but could with a signal ) + */ + CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogEnable(void) {} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogDisable(void) {} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogService(void) {} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +uint32 CFE_PSP_WatchdogGet(void) +{ + return CFE_PSP_WatchdogValue; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogSet(uint32 WatchdogValue) +{ + CFE_PSP_WatchdogValue = WatchdogValue; +} diff --git a/fsw/generic-vxworks-dkm/CMakeLists.txt b/fsw/generic-vxworks-dkm/CMakeLists.txt new file mode 100644 index 00000000..f40f9893 --- /dev/null +++ b/fsw/generic-vxworks-dkm/CMakeLists.txt @@ -0,0 +1,27 @@ +###################################################################### +# +# CMAKE build recipe for generic-vxworks-dkm PSP component +# +###################################################################### + +# This contains the fully platform-specific code to +# run CFE on this target. + +# Build the generic-vxworks implementation as a library +add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT + src/cfe_psp_exception.c + src/cfe_psp_memory.c + src/cfe_psp_ssr.c + src/cfe_psp_start.c + src/cfe_psp_support.c + src/cfe_psp_watchdog.c +) +target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-impl PRIVATE + $ +) + +target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE + inc + $ +) + diff --git a/fsw/generic-vxworks-dkm/README.md b/fsw/generic-vxworks-dkm/README.md new file mode 100644 index 00000000..bc3d67e1 --- /dev/null +++ b/fsw/generic-vxworks-dkm/README.md @@ -0,0 +1,131 @@ +# Generic VxWorks 7 Downloadable Kernel Mode (DKM) Platform Support Package + +This document is intended to describe what is needed to run cFS on VxWorks 7 in kernel mode, but it is not intended to be a complete guide to building and running the VxWorks image on a target. The goal is to have enough information to build the neccesary VxWorks kernel image and should include: +- VxWorks features that are needed by the cFS (TBD). +- Information about the cfeSupport.c module in the bsp-integration directory. +- How the ROMFS is used to store the cFS runtime files. +- Work to do/improvements + +# Assumptions: + +* The vxworks OSAL and generic-vxworks OSAL BSP are used. +* The cFE repository has the necessary CMake toolchain files for VxWorks DKM targets. +* A Compatible VxWorks 7 installation is available. This was tested on VxWorks 7 23.09 for the Raspberry Pi 4 and VxWorks 7 23.09 for the vxsim target. The public VxWorks SDKs may work with some modifications to work around features that were not included in the Public VxWorks SDK kernel. + +The cFS project developers have a **vxworks_support** repository available that includes VxWorks VSB and VIP configurations, scripts, and documentation to support cFS development on VxWorks. + +# How to build cFS for VxWorks 7 Kernel Mode (Version 23.09) + +These are general guidelines for being able to build the cFS with this PSP in order to run it on a generic VxWorks 7 target. + +## Install VxWorks 7 and be able to run on the selected target + +The first step (that is not covered here) is to have a working VxWorks 7 installation and be able to build and run the VxWorks kernel on your target board. At the time this guide was written, the cFS developers used VxWorks 7 23.09 and a Raspberry Pi 4 (Aarch64) target board. Before building the cFS, you should be able to: +- Build a VxWorks Source Build (VSB) project +- Configure and build a VxWorks Image Project (VIP) for your target platform +- Verify that you can run a VxWorks kernel image on the target platform. + +The cFS requires certain features in the VxWorks kernel. At a minimum the kernel configuration that was used for development will be listed in a file in the *doc* directory. Note that this configuration may have extra options that are not necessarily required by the cFS. + +## Add the cfeSupport.c file to the VIP project + +In order to have the cFE core load without unresolved symbols, you need to add the cfeSupport.c file to the VIP. This can be done by doing the following steps: +- Copy the src/bsp-integration/cfeSupport.c file to the VxWorks VIP project directory +- In the VIP directory, run the command: +``` +vip$ vxprj vip file add cfeSupport.c +``` +- Still in the VIP directory, rebuild the VIP +``` +vip$ vxprj vip build +``` + +## Configure and Build the cFS for VxWorks 7 Raspberry Pi 4 + +* Clone the correct branch of the cFS that supports VxWorks 7 and this generic-vxworks-dkm PSP +* Update/clone the submodules: +``` +git submodule update --init --recursive +``` +* Copy the cfe/cmake/sample_defs directory to the top level directory of the cfs repo: +``` +cp -a cfe/cmake/sample_defs . +``` +* Copy cfe/cmake/Makefile.sample to Makefile in the top level directory of the cfs repo: +``` +cp cfe/cmake/sample_defs/Makefile.sample Makefile +``` +* In the sample_defs directory, edit **targets.cmake** and change the **cpu1_SYSTEM** macro to **aarch64-vx7dkm**. Note that this should match the name of the toolchain file you are using. In this case the toolchain file is **toolchain-aarch64-vx7dkm.cmake**. This architecture name will be different for other targets. +``` +SET(cpu1_PROCESSORID 1) +SET(cpu1_APPLIST ci_lab to_lab sch_lab) +SET(cpu1_FILELIST cfe_es_startup.scr) +SET(cpu1_SYSTEM aarch64-vx7dkm) +``` + +* Also in the sample_defs directory, edit the **arch_build_custom.cmake** file. Currently there are several lines that need to be commented out due to differences in the compiler that is used in the VxWorks SDK. Comment out the following lines: -Werror, -Wno-format-truncation, and -Wno-stringop-truncation. +``` +add_compile_options( + -std=c99 # Target the C99 standard (without gcc extensions) + -pedantic # Issue all the warnings demanded by strict ISO C + -Wall # Warn about most questionable operations + -Wstrict-prototypes # Warn about missing prototypes + -Wwrite-strings # Warn if not treating string literals as "const" + -Wpointer-arith # Warn about suspicious pointer operations + #-Werror # Warnings are caused by Clang compiler + #-Wno-format-truncation # Inhibit printf-style format truncation warnings - Not in Clang + #-Wno-stringop-truncation # Inhibit string operation truncation warnings - Not in Clang +) +``` +Now the cFS should be ready to build for VxWorks 7 + +## Build the cFS for your target + +> [!NOTE] +> It is assumed that the cfs is cloned to ~/cfs and the VxWorks environment setup script has been run to setup the VxWorks compiler and development tools. The cFS development team uses the scripts in the vxworks_support repository to do this. + +Switch to the cFS directory that has been setup and run the make steps: +``` +$ cd ~/cfs +$ make distclean +$ make prep +$ make +$ make install +``` + +If the build completes successfully, the cFS binaries, startup script, and tables will be in: +``` +build/exe/cpu1 +``` + +## Copy the cFS runtime files to the VIP project 'romfs' directory + +Copy the **cfs/build/exe/cpu1** directory to the VIP project 'romfs' directory and rebuild the VIP project to include these files. +Note that to make this generic-vxworks-dkm work on multiple platforms, including some that may not have a configured non-volatile disk, the ROMFS feature is used to store the cFS runtime files. The cFS runtime files could be stored on a target resident file system. To use a different volume to store the cFS runtime files, you must change the folloing OSAL call in cfe_psp_start.c: +``` + Status = OS_FileSysAddFixedMap(&fs_id, "/romfs/cpu1/cf", "/cf"); +``` +The line of code above is how the cFS path "/cf" that is in the startup script and cFS configuration files gets mapped to the target file system. It will need to be changed for a different file system, cFS configuration, etc. + +## Boot the VxWorks Image and run the cFS + +The instructions to boot the image are target specific, but the goal is to boot the system and obtain a VxWorks kernel command shell. +Once this shell is working and the cFS runtime files are in the /romfs/cpu1 directory you can start the cFS with the following command: + +``` +-> cd "/romfs/cpu1" +-> startCfeCore /romfs/cpu1/core-cpu1.exe +``` + +Note that the path above is the default, so if that is unchanged the following will work: +``` +-> startCfeCore +``` + +You should see the cFS load and start the services and apps. + +# Work to do / future improvements + +In VxWorks 7, the cFS and other kernel tasks run in virtual memory space managed by VxWorks. Because of this, all memory and addressable I/O is not immediately addessable. For example, in order to access peripheral registers on a UART device, the register set must be mapped into virtual address space using the pmapGlobalMap function. Because of this, the modules in the PSP used to access memory and I/O space will be limited to what is mapped into virtual address space. + +Future improvements will include PSP modules that can be used to map additional memory and I/O space for VxWorks 7 DKM applications. diff --git a/fsw/generic-vxworks-dkm/doc/.gitignore b/fsw/generic-vxworks-dkm/doc/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/fsw/generic-vxworks-dkm/inc/cfe_psp_config.h b/fsw/generic-vxworks-dkm/inc/cfe_psp_config.h new file mode 100644 index 00000000..28df71d3 --- /dev/null +++ b/fsw/generic-vxworks-dkm/inc/cfe_psp_config.h @@ -0,0 +1,125 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +#ifndef CFE_PSP_CONFIG_H +#define CFE_PSP_CONFIG_H + +#include "common_types.h" + +#include +#include +#include +#include +#include "fppLib.h" +#include "excLib.h" +#include "taskLib.h" + +/** + * \brief Period of the VxWorks timebase, in nanoseconds + * + * This is expressed as a ratio in case it is not a whole number. + * + * Multiplying the timebase register by 60 should yield a result + * in nanoseconds, and then further dividing by the OSAL OS_time_t tick + * resolution will convert to an OS_time_t compatible value. + * + * This needs to be set to the correct timebase for the BSP + * + * Note this is distinct from the VxWorks system timer tick which runs, + * confusingly, at 60Hz or a ~16.67ms period. + */ +#define CFE_PSP_VX_TIMEBASE_PERIOD_NUMERATOR 60 +#define CFE_PSP_VX_TIMEBASE_PERIOD_DENOMINATOR 1 + +/* +** This define sets the number of memory ranges that are defined in the memory range definition +** table. +*/ +#define CFE_PSP_MEM_TABLE_SIZE 10 + +/** + * This define sets the maximum number of exceptions + * that can be stored. + * + * It must always be a power of two. + */ +#define CFE_PSP_MAX_EXCEPTION_ENTRIES 4 + +/* + * The tick period that will be configured in the RTOS for the simulated + * time base, in microseconds. This in turn is used to drive the 1hz clock + * and other functions. + * + * On the the sysClockRate runs at 60Hz so this is the same period + * that the cFE software timebase will be configured at. + */ +#define CFE_PSP_SOFT_TIMEBASE_PERIOD 16666 + +/* +** Typedef for the layout of the vxWorks boot record structure +** +** This is statically placed at the beginning of system memory (sysMemTop) +** which should be reserved in the kernel. +*/ +typedef struct +{ + uint32 bsp_reset_type; + uint32 spare1; + uint32 spare2; + uint32 spare3; +} CFE_PSP_ReservedMemoryBootRecord_t; + +/** + * \brief The data type used by the underlying OS to represent a thread ID. + */ +typedef TASK_ID CFE_PSP_Exception_SysTaskId_t; + +/* +** Global variables +*/ +typedef struct +{ + OS_time_t time_stamp; /* time from OS_GetLocalTime */ + UINT32 timebase_lower; /* Lower 32 bits of timebase as sampled by hook */ + int vector; /* vector number */ + FP_CONTEXT fp; /* floating point registers */ +} CFE_PSP_Exception_ContextDataEntry_t; + +/* +** Watchdog minimum and maximum values ( in milliseconds ) +*/ +#define CFE_PSP_WATCHDOG_MIN (0) +#define CFE_PSP_WATCHDOG_MAX (0xFFFFFFFF) + +/* +** Number of EEPROM banks on this platform +*/ +#define CFE_PSP_NUM_EEPROM_BANKS 1 + +/* + * The alignment to use for each reserved memory block. + * + * This is a mask to be applied to each block base address + * + * Chosen as the cache line size of the MCP750 processor (32 bytes) + * such that the blocks will be cached more efficiently. (Might need + * to be changed for generic support instead of PowerPC specific) + */ +#define CFE_PSP_MEMALIGN_MASK ((cpuaddr)0x1F) + +#endif diff --git a/fsw/generic-vxworks-dkm/inc/psp_version.h b/fsw/generic-vxworks-dkm/inc/psp_version.h new file mode 100644 index 00000000..024f6092 --- /dev/null +++ b/fsw/generic-vxworks-dkm/inc/psp_version.h @@ -0,0 +1,77 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * @brief Purpose: + * @details Provide version identifiers for the cFE Platform Support Packages (PSP). + * See @ref cfsversions for version and build number and description + */ +#ifndef PSP_VERSION_H +#define PSP_VERSION_H + +/* + * Development Build Macro Definitions + */ +#define CFE_PSP_IMPL_BUILD_NUMBER 0 +#define CFE_PSP_IMPL_BUILD_BASELINE "v7.0.0" +#define CFE_PSP_BUILD_DEV_CYCLE "v7.0.0" /**< @brief Development: Release name for current development cycle */ +#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ + +/* + * Version Macros, see \ref cfsversions for definitions. + */ +#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ +#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ +#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ + +/** + * @brief Last official release. + */ +#define CFE_PSP_LAST_OFFICIAL "v7.0.0" + +/*! + * @brief Mission revision. + * + * Reserved for mission use to denote patches/customizations as needed. + * Values 1-254 are reserved for mission use to denote patches/customizations as needed. NOTE: Reserving 0 and 0xFF for + * cFS open-source development use (pending resolution of nasa/cFS#440) + */ +#define CFE_PSP_IMPL_MISSION_REV 0x0 + +/* + * Tools to construct version string + */ +#define CFE_PSP_IMPL_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer */ +#define CFE_PSP_IMPL_STR(x) \ + CFE_PSP_IMPL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer */ + +/*! @brief DEVELOPMENT Build Version Number. + * @details Baseline git tag + Number of commits since baseline. @n + * See @ref cfsversions for format differences between development and release versions. + */ +#define CFE_PSP_IMPL_VERSION CFE_PSP_IMPL_BUILD_BASELINE "+dev" CFE_PSP_IMPL_STR(CFE_PSP_IMPL_BUILD_NUMBER) + +/** + * @brief Max Version String length. + * + * Maximum length that a tblCRCTool version string can be. + * + */ +#define CFE_PSP_CFG_MAX_VERSION_STR_LEN 256 + +#endif diff --git a/fsw/generic-vxworks-dkm/make/build_options.cmake b/fsw/generic-vxworks-dkm/make/build_options.cmake new file mode 100644 index 00000000..912446ae --- /dev/null +++ b/fsw/generic-vxworks-dkm/make/build_options.cmake @@ -0,0 +1,16 @@ +########################################################################## +# +# Build options for "generic-vxworks" PSP +# This file specifies any global-scope compiler options when using this PSP +# +########################################################################## +# This indicates where to install target binaries created during the build +# Note - this should be phased out in favor of the staging dir from OSAL BSP +set(INSTALL_SUBDIR "cf") + +# Some upper-level code may be gated on _VXWORKS_OS_ being defined +# This is for compatibility with older build scripts which defined this symbol, +# but no CFE/OSAL framework code depends on this symbol. +add_definitions("-D_VXWORKS_OS_") + +set(CFE_PSP_EXPECTED_OSAL_BSPTYPE "generic-vxworks") diff --git a/fsw/generic-vxworks-dkm/psp_module_list.cmake b/fsw/generic-vxworks-dkm/psp_module_list.cmake new file mode 100644 index 00000000..dd5af91b --- /dev/null +++ b/fsw/generic-vxworks-dkm/psp_module_list.cmake @@ -0,0 +1,11 @@ +# This is a list of modules that is included as a fixed/base set +# when this PSP is selected. They must exist under fsw/modules +# +soft_timebase +timebase_posix_clock +eeprom_direct +ram_direct +port_direct +iodriver +vxworks_sysmon +endian_api diff --git a/fsw/generic-vxworks-dkm/src/bsp-integration/.gitignore b/fsw/generic-vxworks-dkm/src/bsp-integration/.gitignore new file mode 100644 index 00000000..4e3b66d8 --- /dev/null +++ b/fsw/generic-vxworks-dkm/src/bsp-integration/.gitignore @@ -0,0 +1 @@ +cfeSupport.o diff --git a/fsw/generic-vxworks-dkm/src/bsp-integration/Makefile b/fsw/generic-vxworks-dkm/src/bsp-integration/Makefile new file mode 100755 index 00000000..d362cb32 --- /dev/null +++ b/fsw/generic-vxworks-dkm/src/bsp-integration/Makefile @@ -0,0 +1,4 @@ +default:: + wr-cc -dkm -Wall cfeSupport.c -o cfeSupport.o +clean:: + rm -f cfeSupport.o diff --git a/fsw/generic-vxworks-dkm/src/bsp-integration/cfeSupport.c b/fsw/generic-vxworks-dkm/src/bsp-integration/cfeSupport.c new file mode 100644 index 00000000..1df0704a --- /dev/null +++ b/fsw/generic-vxworks-dkm/src/bsp-integration/cfeSupport.c @@ -0,0 +1,179 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +/* +** cFE Support routines +** +** This module is a collection of support routines needed to run the cFE on vxWorks. +** +*/ + +#include +#include +#include "vxWorks.h" +#include "taskLib.h" +#include "sysLib.h" +#include "symLib.h" +#include "loadLib.h" +#include "ioLib.h" +#include "errnoLib.h" +#include "usrLib.h" +#include "cacheLib.h" + +/* +** Defines +*/ +#define CFE_CORE_PATH_LEN 64 +#define CFE_CORE_PATH_DEF "/romfs/cpu1/core-cpu1.exe" + +/* +** External reference to wrs_kernel_text_start and wrs_kernel_text_end +** The cFE core needs these symbols, but when the cfe-core.o is loaded as a +** dynamic module, these symbols are not in the symbol table. +*/ + +extern void *wrs_kernel_text_start; +extern void *wrs_kernel_text_end; + +/* +** External reference to the vxWorks symbol table +*/ +extern SYMTAB_ID sysSymTbl; + +/* +** Purpose: This function returns the start address of the kernel code. +** +*/ +void *GetWrsKernelTextStart(void) +{ + return (void *)&wrs_kernel_text_start; +} + +/* +** Purpose: This function returns the end address of the kernel code. +** +*/ +void *GetWrsKernelTextEnd(void) +{ + return (void *)&wrs_kernel_text_end; +} + +void showKernelCodeAddrs(void) +{ + printf("&wrs_kernel_text_start = 0x%lX\n",(unsigned long)&wrs_kernel_text_start); + printf("&wrs_kernel_text_end = 0x%lX\n",(unsigned long)&wrs_kernel_text_end); +} + +/* +** Purpose: This function unzips ( if needed ) , loads, and starts the cFE core. +** +*/ +int startCfeCore(char *cfepath) +{ + int fd; + int status; + MODULE_ID moduleID; + SYMBOL_DESC SymDesc; + char *symValue; + void (*cFEFuncPtr)(void); + char cfeCorePath[CFE_CORE_PATH_LEN]; + TASK_ID cfeTaskId; + + /* + * Copy the cFE Core path that was passed in + */ + if (cfepath != NULL) + { + snprintf(cfeCorePath, CFE_CORE_PATH_LEN, "%s", cfepath); + } + else + { + strncpy(cfeCorePath, CFE_CORE_PATH_DEF, CFE_CORE_PATH_LEN); + } + + printf("cFE Core path to load is: %s\n",cfeCorePath); + + /* + ** Open the cFE core module + */ + fd = open(cfeCorePath, O_RDONLY, 0); + if (fd < 0) + { + printf("Error: Cannot open cFE core file: %s!\n", cfeCorePath); + return -1; + } + else + { + printf("Opened %s.\n", cfeCorePath); + } + + /* + ** Load the cFE core + */ + moduleID = loadModule(fd, LOAD_ALL_SYMBOLS); + if (moduleID == NULL) + { + printf("Error: Cannot load cFE core module.\n"); + close(fd); + return -1; + } + else + { + printf("Loaded %s module OK.\n", cfeCorePath); + } + + /* + ** Close the file + */ + close(fd); + + /* + ** Lookup the cFE core entry point + */ + memset(&SymDesc, 0, sizeof(SYMBOL_DESC)); + SymDesc.mask = SYM_FIND_BY_NAME; + SymDesc.name = "OS_BSPMain"; + + status = symFind(sysSymTbl, &SymDesc); + if (status == ERROR) + { + printf("Error: Cannot locate OS_BSPMain symbol.\n"); + return -1; + } + symValue = SymDesc.value; + + /* + ** Call the cFE startup routine + */ + cFEFuncPtr = (void *)symValue; + + /* spawn the async output helper task */ + cfeTaskId = taskSpawn("CFS_IDLE", 200, 0, 16384, + (FUNCPTR)cFEFuncPtr, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + if (cfeTaskId == TASK_ID_ERROR) + { + printf("taskSpawn() Error - vxWorks errno %d\n", errno); + return(-1); + } + + /* + ** Return to the vxWorks shell + */ + return 0; +} diff --git a/fsw/generic-vxworks-dkm/src/bsp-integration/readme.txt b/fsw/generic-vxworks-dkm/src/bsp-integration/readme.txt new file mode 100644 index 00000000..2289f0f9 --- /dev/null +++ b/fsw/generic-vxworks-dkm/src/bsp-integration/readme.txt @@ -0,0 +1,21 @@ +The module cfeSupport.c contains two functions that are required to run the cFE on +VxWorks in kernel mode: +- GetWrsKernelTextStart +- GetWrsKernelTextEnd +When you load the cFE Core using the dynamic loader and you see the above functions marked as unresolved, +then the module has not been included with the VIP. + +It can be included in the VIP by adding the file to the VxWorks Image Project. I use the following command, +assuming you are in the VIP directory and have copied this file into that directory: +vxprj vip file add cfeSupport.c + +The module also has a helper function that can be used to load and start the cFS: +startCfeCore + +This function can be called from the VxWorks kernel shell command line with the path to the cFE Core: +-> startCfeCore /romfs/cpu1/core-cpu1.exe + +Note that the path "/romfs/cpu1/core-cpu1.exe" is the default and will be used if you just enter: +-> startCfeCore + + diff --git a/fsw/generic-vxworks-dkm/src/cfe_psp_exception.c b/fsw/generic-vxworks-dkm/src/cfe_psp_exception.c new file mode 100644 index 00000000..cb9c609e --- /dev/null +++ b/fsw/generic-vxworks-dkm/src/cfe_psp_exception.c @@ -0,0 +1,185 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_exception.c +** +** generic-vxworks (7.x) Version +** +** Purpose: +** cFE PSP Exception related functions. +** +** History: +** 2007/05/29 A. Cudmore | vxWorks 6.2 MCP750 version +** 2016/04/07 M.Grubb | Updated for PSP version 1.3 +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include +#include +#include "fppLib.h" +#include "excLib.h" +#include "taskLib.h" + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +#include "cfe_psp.h" +#include "cfe_psp_config.h" +#include "cfe_psp_exceptionstorage_types.h" +#include "cfe_psp_exceptionstorage_api.h" +#include "cfe_psp_memory.h" + +#include "target_config.h" + +/* +** +** LOCAL FUNCTION PROTOTYPES +** +*/ + +void CFE_PSP_ExceptionHook(TASK_ID task_id, int vector, void *vpEsf); + +/*************************************************************************** + ** FUNCTIONS DEFINITIONS + ***************************************************************************/ + +/* +** +** Purpose: This function Initializes the task exceptions and adds a hook +** into the VxWorks exception handling. The below hook is called +** for every exception that VxWorks catches. +** +** Notes: if desired - to attach a custom handler put following code in +** this function: excConnect ((VOIDFUNCPTR*)VECTOR, ExceptionHandler); +** +*/ + +void CFE_PSP_AttachExceptions(void) +{ + excHookAdd(CFE_PSP_ExceptionHook); + OS_printf("CFE_PSP: Attached cFE Exception Handler. Context Size = %lu bytes.\n", + (unsigned long)sizeof(CFE_PSP_Exception_ContextDataEntry_t)); + CFE_PSP_Exception_Reset(); +} + +/* +** +** Purpose: Make the proper call to CFE_ES_EXCEPTION_FUNCTION (defined in +** cfe_es_platform.cfg) +** +** Notes: pEsf - pointer to exception stack frame. +** fppSave - When it makes this call, it captures the last floating +** point context - which may not be valid. If a floating +** point exception occurs you can be almost 100% sure +** that this will reflect the proper context. But if another +** type of exception occurred then this has the possibility +** of not being valid. Specifically if a task that is not +** enabled for floating point causes a non-floating point +** exception, then the meaning of the floating point context +** will not be valid. If the task is enabled for floating point, +** then it will be valid. +** +*/ +void CFE_PSP_ExceptionHook(TASK_ID task_id, int vector, void *vpEsf) +{ + CFE_PSP_Exception_LogData_t *Buffer; + + Buffer = CFE_PSP_Exception_GetNextContextBuffer(); + if (Buffer != NULL) + { + /* + * Immediately get the time when exception occurred + * + * This is because the remainder of exception processing might be done + * in a cleanup job as a low priority background task, and might be + * considerably delayed from the time the actual exception occurred. + */ + OS_GetLocalTime(&Buffer->context_info.time_stamp); + + Buffer->sys_task_id = task_id; + Buffer->context_info.vector = vector; + + /* + * Save Exception Stack frame + */ + /* memcpy(&Buffer->context_info.esf, vpEsf, sizeof(Buffer->context_info.esf)); */ + + /* + * Save floating point registers + */ + fppSave(&Buffer->context_info.fp); + + /* + * Save total size of context info. + * (This PSP always fills the entire structure) + */ + Buffer->context_size = sizeof(Buffer->context_info); + + CFE_PSP_Exception_WriteComplete(); + } + + if (GLOBAL_CFE_CONFIGDATA.SystemNotify != NULL) + { + /* notify the CFE of the event */ + GLOBAL_CFE_CONFIGDATA.SystemNotify(); + } +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_SetDefaultExceptionEnvironment(void) +{ + return; +} + +/* + * Purpose: Translate a stored exception log entry into a summary string + */ +int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer, char *ReasonBuf, uint32 ReasonSize) +{ + const char *TaskName; + + /* + ** Get the vxWorks task name + */ + TaskName = taskName(Buffer->sys_task_id); + + if (TaskName == NULL) + { + TaskName = "NULL"; + } + + snprintf(ReasonBuf, ReasonSize, "Vector=0x%06X, vxWorks Task Name=%s, Task ID=0x%08X", Buffer->context_info.vector, + TaskName, Buffer->sys_task_id); + + return CFE_PSP_SUCCESS; +} diff --git a/fsw/generic-vxworks-dkm/src/cfe_psp_memory.c b/fsw/generic-vxworks-dkm/src/cfe_psp_memory.c new file mode 100644 index 00000000..717a0b20 --- /dev/null +++ b/fsw/generic-vxworks-dkm/src/cfe_psp_memory.c @@ -0,0 +1,554 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_memory.c +** +** +** Purpose: +** cFE PSP Memory related functions. This is the implementation of the cFE +** memory areas that have to be preserved, and the API that is designed to allow +** access to them. It also contains memory related routines to return the +** address of the kernel code used in the cFE checksum. +** +** History: +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +/* +** VxWorks includes +*/ +#include "vxWorks.h" +#include "userReservedMem.h" +#include +#include + +/* Note that usage of this reserved memory implementation requires the INCLUDE_USER_RESERVED_MEMORY + * component with CLEAR_USER_RESERVED_MEMORY_ON_COLD_BOOT set to FALSE */ + +/* +** Types and prototypes for this module +*/ +#include "cfe_psp.h" +#include "cfe_psp_memory.h" +#include "cfe_psp_config.h" + +/* +** Macro Definitions +*/ +#include "target_config.h" + +/* + * Define the PSP-supported capacities to be the maximum allowed, + * (since the PC-linux PSP has the advantage of abundant disk space to hold this) + */ +#define CFE_PSP_CDS_SIZE (GLOBAL_CONFIGDATA.CfeConfig->CdsSize) +#define CFE_PSP_RESET_AREA_SIZE (GLOBAL_CONFIGDATA.CfeConfig->ResetAreaSize) +#define CFE_PSP_USER_RESERVED_SIZE (GLOBAL_CONFIGDATA.CfeConfig->UserReservedSize) +#define CFE_PSP_RAM_DISK_SECTOR_SIZE (GLOBAL_CONFIGDATA.CfeConfig->RamDiskSectorSize) +#define CFE_PSP_RAM_DISK_NUM_SECTORS (GLOBAL_CONFIGDATA.CfeConfig->RamDiskTotalSectors) + +/* simple handy macro */ +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) + +typedef struct +{ + CFE_PSP_ReservedMemoryBootRecord_t BootRecord; + CFE_PSP_ExceptionStorage_t ExceptionStorage; +} CFE_PSP_VxWorksReservedAreaFixedLayout_t; + +/* +** External Declarations +*/ +extern void *GetWrsKernelTextStart(void); +extern void *GetWrsKernelTextEnd(void); + +/* +** Global variables +*/ + +/* +** Dynamic map of the reserved memory area +*/ +CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap = {0}; + +CFE_PSP_MemoryBlock_t VxWorks_ReservedMemBlock; + +/* +********************************************************************************* +** CDS related functions +********************************************************************************* +*/ + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) +{ + int32 return_code; + + if (SizeOfCDS == NULL) + { + return_code = OS_ERROR; + } + else + { + *SizeOfCDS = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize; + return_code = OS_SUCCESS; + } + return return_code; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 NumBytes) +{ + uint8 *CopyPtr; + int32 return_code; + + if (PtrToDataToWrite == NULL) + { + return_code = OS_ERROR; + } + else + { + if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) && + ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) + { + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr += CDSOffset; + memcpy((char *)CopyPtr, (char *)PtrToDataToWrite, NumBytes); + + return_code = OS_SUCCESS; + } + else + { + return_code = OS_ERROR; + } + + } /* end if PtrToDataToWrite == NULL */ + + return return_code; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumBytes) +{ + uint8 *CopyPtr; + int32 return_code; + + if (PtrToDataToRead == NULL) + { + return_code = OS_ERROR; + } + else + { + if ((CDSOffset < CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize) && + ((CDSOffset + NumBytes) <= CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize)) + { + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr += CDSOffset; + memcpy((char *)PtrToDataToRead, (char *)CopyPtr, NumBytes); + + return_code = OS_SUCCESS; + } + else + { + return_code = OS_ERROR; + } + + } /* end if PtrToDataToWrite == NULL */ + + return return_code; +} + +/* +********************************************************************************* +** ES Reset Area related functions +********************************************************************************* +*/ + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) +{ + int32 return_code; + + if (SizeOfResetArea == NULL || PtrToResetArea == NULL) + { + return_code = OS_ERROR; + } + else + { + *PtrToResetArea = (cpuaddr)(CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr); + *SizeOfResetArea = CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize; + return_code = OS_SUCCESS; + } + + return return_code; +} + +/* +********************************************************************************* +** ES User Reserved Area related functions +********************************************************************************* +*/ + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea) +{ + int32 return_code; + + if (SizeOfUserArea == NULL || PtrToUserArea == NULL) + { + return_code = OS_ERROR; + } + else + { + *PtrToUserArea = (cpuaddr)(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr); + *SizeOfUserArea = CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize; + return_code = OS_SUCCESS; + } + + return return_code; +} + +/* +********************************************************************************* +** ES Volatile disk memory related functions +********************************************************************************* +*/ + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) +{ + int32 return_code; + + if (SizeOfVolDisk == NULL || PtrToVolDisk == NULL) + { + return_code = OS_ERROR; + } + else + { + *PtrToVolDisk = (cpuaddr)(CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr); + *SizeOfVolDisk = CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize; + return_code = OS_SUCCESS; + } + + return return_code; +} + +/* +********************************************************************************* +** ES BSP Top Level Reserved memory initialization +********************************************************************************* +*/ + + +/****************************************************************************** +** +** Purpose: +** This function performs the top level reserved memory initialization. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) +{ + if (RestartType == CFE_PSP_RST_TYPE_POWERON) + { + OS_printf("CFE_PSP: Clearing Processor Reserved Memory.\n"); + memset(VxWorks_ReservedMemBlock.BlockPtr, 0, VxWorks_ReservedMemBlock.BlockSize); + /* + ** Set the default reset type in case a watchdog reset occurs + */ + CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_PROCESSOR; + } + + return OS_SUCCESS; +} + +/****************************************************************************** +** +** Purpose: +** This function performs the top level reserved memory initialization. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_SetupReservedMemoryMap(void) +{ + CFE_PSP_VxWorksReservedAreaFixedLayout_t *FixedPtr; + cpuaddr ReservedMemoryAddr; + size_t FixedSize; + size_t ResetSize; + size_t CDSSize; + size_t UserReservedSize; + size_t VolatileDiskSize; + size_t RequiredSize; + char *ReservedMemoryStart; + size_t ReservedMemorySize; + /* TODO: do we need both ReservedMemoryStart and ReservedMemoryAddr */ + + /* + ** Allocate memory for the cFE memory. Note that this is malloced on + ** the COTS board, but will be a static location in the ETU. + */ + FixedSize = sizeof(CFE_PSP_VxWorksReservedAreaFixedLayout_t); + ResetSize = CFE_PSP_RESET_AREA_SIZE; + VolatileDiskSize = (CFE_PSP_RAM_DISK_SECTOR_SIZE * CFE_PSP_RAM_DISK_NUM_SECTORS); + CDSSize = CFE_PSP_CDS_SIZE; + UserReservedSize = CFE_PSP_USER_RESERVED_SIZE; + + FixedSize = (FixedSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + ResetSize = (ResetSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + CDSSize = (CDSSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + VolatileDiskSize = (VolatileDiskSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + UserReservedSize = (UserReservedSize + CFE_PSP_MEMALIGN_MASK) & ~CFE_PSP_MEMALIGN_MASK; + + /* Calculate the required size, adding padding so that each element is aligned */ + RequiredSize = FixedSize; + RequiredSize += ResetSize; + RequiredSize += VolatileDiskSize; + RequiredSize += CDSSize; + RequiredSize += UserReservedSize; + + /* Get address and size of user reserved memory */ + + /* Since we need to have at least RequiredSize amount of reserved memory, + * we have to check if there is enough given by the userReservedGet() call. + * Since the size of user reserved memory is a static constant built into + * the kernel at build time, there is no recourse here. Either RequiredSize + * must be reduced or the kernel build must change to support more memory + * by changing the USER_RESERVED_MEM component. */ + userReservedGet(&ReservedMemoryStart, &ReservedMemorySize); + if (ReservedMemorySize < RequiredSize || ReservedMemoryStart == NULL) { + OS_printf("CFE_PSP: Error: Cannot get BSP reserved memory\n"); + abort(); + } + + OS_printf("Size of BSP reserved memory = %u bytes\n", (unsigned int)RequiredSize); + + /* with the INCLUDE_USER_RESERVED_MEMORY configuration, we don't need to allocate + * any memory here. We can just set this variable to the address given by + * userReservedGet(). */ + VxWorks_ReservedMemBlock.BlockPtr = ReservedMemoryStart; + + VxWorks_ReservedMemBlock.BlockSize = RequiredSize; + ReservedMemoryAddr = (cpuaddr)VxWorks_ReservedMemBlock.BlockPtr; + + OS_printf("CFE_PSP: Allocated %u bytes for PSP reserved memory at: 0x%08lX\n", (unsigned int)RequiredSize, + (unsigned long)ReservedMemoryAddr); + + FixedPtr = (CFE_PSP_VxWorksReservedAreaFixedLayout_t *)ReservedMemoryAddr; + + CFE_PSP_ReservedMemoryMap.BootPtr = &FixedPtr->BootRecord; + CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedPtr->ExceptionStorage; + ReservedMemoryAddr += FixedSize; + + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = CFE_PSP_RESET_AREA_SIZE; + ReservedMemoryAddr += ResetSize; + + CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize = + (CFE_PSP_RAM_DISK_SECTOR_SIZE * CFE_PSP_RAM_DISK_NUM_SECTORS); + ReservedMemoryAddr += VolatileDiskSize; + + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = CFE_PSP_CDS_SIZE; + ReservedMemoryAddr += CDSSize; + + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = (void *)ReservedMemoryAddr; + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = CFE_PSP_USER_RESERVED_SIZE; + ReservedMemoryAddr += UserReservedSize; + + /* + * displaying the final address shows how much was actually used, + * and additionally avoids a warning about the result of the final increment not being used. + * (prefer this over removing the increment, as it is safer if another block is added) + */ + OS_printf("CFE_PSP: PSP reserved memory ends at: 0x%08lX\n", (unsigned long)ReservedMemoryAddr); + + /* + * Set up the "RAM" entry in the memory table. + * On RTEMS this just encompasses the entire memory space, but an entry needs + * to exist so that CFE_PSP_ValidateMemRange() works as intended. + */ + CFE_PSP_MemRangeSet(0, CFE_PSP_MEM_RAM, 0, SIZE_MAX, CFE_PSP_MEM_SIZE_DWORD, CFE_PSP_MEM_ATTR_READWRITE); +} + +/* +********************************************************************************* +** ES BSP kernel memory segment functions +********************************************************************************* +*/ + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *SizeOfKernelSegment) +{ + int32 return_code; + cpuaddr StartAddress; + cpuaddr EndAddress; + + if (SizeOfKernelSegment == NULL || PtrToKernelSegment == NULL) + { + return_code = OS_ERROR; + } + else + { + /* + ** Get the kernel start and end + ** addresses from the BSP, because the + ** symbol table does not contain the symbols we need for this + */ + StartAddress = (cpuaddr)GetWrsKernelTextStart(); + EndAddress = (cpuaddr)GetWrsKernelTextEnd(); + + *PtrToKernelSegment = StartAddress; + *SizeOfKernelSegment = (uint32)(EndAddress - StartAddress); + + return_code = OS_SUCCESS; + } + + return return_code; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFESegment) +{ + int32 return_code; + STATUS status; + MODULE_ID cFEModuleId; + MODULE_INFO cFEModuleInfo; + cpuaddr GetModuleIdAddr; + MODULE_ID (*GetModuleIdFunc)(void); + + if (PtrToCFESegment == NULL || SizeOfCFESegment == NULL) + { + return_code = OS_ERROR; + } + else + { + /* + * First attempt to call a function called GetCfeCoreModuleID(). + * + * If CFE core was started via the "startCfeCore" routine, this + * provides the actual module ID that was loaded by that routine, + * no matter what it is actually named. This is provided by the + * support/integration code compiled directly into the VxWorks kernel + * image. + * + * The prototype should be: + * MODULE_ID GetCfeCoreModuleID(void); + */ + cFEModuleId = NULL; + GetModuleIdAddr = 0; + return_code = OS_SymbolLookup(&GetModuleIdAddr, "GetCfeCoreModuleID"); + if (return_code == OS_SUCCESS && GetModuleIdAddr != 0) + { + GetModuleIdFunc = (MODULE_ID(*)(void))GetModuleIdAddr; + cFEModuleId = GetModuleIdFunc(); + } + + /* + * If the above did not yield a valid module ID, + * then attempt to find the module ID by name. + * This assumes the core executable name as built by CMake + */ + if (cFEModuleId == NULL) + { + cFEModuleId = moduleFindByName((char *)GLOBAL_CONFIGDATA.Default_CoreFilename); + } + + if (cFEModuleId == NULL) + { + return_code = OS_ERROR; + } + else + { + status = moduleInfoGet(cFEModuleId, &cFEModuleInfo); + if (status != ERROR) + { + *PtrToCFESegment = (cpuaddr)(cFEModuleInfo.segInfo.textAddr); + *SizeOfCFESegment = (uint32)(cFEModuleInfo.segInfo.textSize); + return_code = OS_SUCCESS; + } + else + { + return_code = OS_SUCCESS; + } + } + } + + return return_code; +} diff --git a/fsw/generic-vxworks-dkm/src/cfe_psp_ssr.c b/fsw/generic-vxworks-dkm/src/cfe_psp_ssr.c new file mode 100644 index 00000000..40283654 --- /dev/null +++ b/fsw/generic-vxworks-dkm/src/cfe_psp_ssr.c @@ -0,0 +1,63 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_ssr.c +** +** Purpose: +** This file contains glue routines between the cFE and the OS Board Support Package ( BSP ). +** The functions here allow the cFE to interface functions that are board and OS specific +** and usually don't fit well in the OS abstraction layer. +** +** History: +** 2005/06/05 Alan Cudmore | Initial version, +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include +#include "vxWorks.h" + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +/* +** Types and prototypes for this module +*/ +#include "cfe_psp.h" +#include "cfe_psp_memory.h" + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName) +{ + int32 ReturnCode = CFE_PSP_SUCCESS; + + return ReturnCode; +} diff --git a/fsw/generic-vxworks-dkm/src/cfe_psp_start.c b/fsw/generic-vxworks-dkm/src/cfe_psp_start.c new file mode 100644 index 00000000..7f7ec3dc --- /dev/null +++ b/fsw/generic-vxworks-dkm/src/cfe_psp_start.c @@ -0,0 +1,169 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_start.c +** +** Purpose: +** cFE PSP main entry point. +** +** History: +** 2004/09/23 J.P. Swinski | Initial version, +** 2004/10/01 P.Kutt | Replaced OS API task delay with VxWorks functions +** since OS API is initialized later. +** 2016/04/07 M.Grubb | Updated for PSP version 1.3 +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include +#include "vxWorks.h" +#include "sysLib.h" +#include "taskLib.h" +#include "ramDrv.h" +#include "dosFsLib.h" +#include "xbdBlkDev.h" +#include "errnoLib.h" +#include "usrLib.h" +#include "cacheLib.h" + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +#include "cfe_psp.h" +#include "cfe_psp_memory.h" +#include "cfe_psp_module.h" + +/* +** External Declarations +*/ + +/* + * The preferred way to obtain the CFE tunable values at runtime is via + * the dynamically generated configuration object. This allows a single build + * of the PSP to be completely CFE-independent. + */ +#include "target_config.h" + +#define CFE_PSP_MAIN_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->SystemMain) +#define CFE_PSP_NONVOL_STARTUP_FILE (GLOBAL_CONFIGDATA.CfeConfig->NonvolStartupFile) + +/****************************************************************************** +** +** Purpose: +** Application startup entry point from OSAL BSP. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void OS_Application_Startup(void) +{ + int TicksPerSecond; + uint32 reset_type; + uint32 reset_subtype; + osal_id_t fs_id; + int32 Status; + + /* + ** Initialize the OS API + */ + Status = OS_API_Init(); + if (Status != OS_SUCCESS) + { + /* irrecoverable error if OS_API_Init() fails. */ + /* note: use printf here, as OS_printf may not work */ + printf("CFE_PSP: OS_API_Init() failure\n"); + CFE_PSP_Panic(Status); + + /* + * normally CFE_PSP_Panic() does not return, except + * during unit testing. This return avoids executing + * the rest of this function in that case. + */ + return; + } + + /* + ** Set up the virtual FS mapping for the "/cf" directory + ** Currently, the generic VxWorks 7 DKM works with a ROMFS statically + ** built into the VIP since that is easily supportable across + ** most platforms. However, this may need to change based on + ** specfic needs. + */ + Status = OS_FileSysAddFixedMap(&fs_id, CFE_PSP_CF_ROMFS_VIRTUAL_MAPPING, "/cf"); + if (Status != OS_SUCCESS) + { + /* Print for informational purposes -- + * startup can continue, but loads may fail later, depending on config. */ + OS_printf("CFE_PSP: OS_FileSysAddFixedMap() failure: %d\n", (int)Status); + } + + /* + ** Delay for one second. + */ + TicksPerSecond = sysClkRateGet(); + (void)taskDelay(TicksPerSecond); + + /* + ** Setup the pointer to the reserved area in vxWorks. + ** This must be done before any of the reset variables are used. + */ + CFE_PSP_SetupReservedMemoryMap(); + + /* + ** Initialize the statically linked modules (if any) + */ + CFE_PSP_ModuleInit(); + + /* + ** Determine Reset type by reading the hardware reset register. + ** (If any?) + */ + reset_type = CFE_PSP_RST_TYPE_POWERON; + reset_subtype = CFE_PSP_RST_SUBTYPE_POWER_CYCLE; + + /* + * If CFE fails to boot with a processor reset, + * then make sure next time it uses a power on reset. + */ + if (reset_type == CFE_PSP_RST_TYPE_PROCESSOR) + { + CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_POWERON; + } + + /* + ** Initialize the reserved memory + */ + CFE_PSP_InitProcessorReservedMemory(reset_type); + + /* + ** Call cFE entry point. This will return when cFE startup + ** is complete. + */ + CFE_PSP_MAIN_FUNCTION(reset_type, reset_subtype, 1, CFE_PSP_NONVOL_STARTUP_FILE); +} diff --git a/fsw/generic-vxworks-dkm/src/cfe_psp_support.c b/fsw/generic-vxworks-dkm/src/cfe_psp_support.c new file mode 100644 index 00000000..f48e0f28 --- /dev/null +++ b/fsw/generic-vxworks-dkm/src/cfe_psp_support.c @@ -0,0 +1,151 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_support.c +** +** Purpose: +** This file contains glue routines between the cFE and the OS Board Support Package ( BSP ). +** The functions here allow the cFE to interface functions that are board and OS specific +** and usually don't fit well in the OS abstraction layer. +** +** History: +** 2005/06/05 Alan Cudmore | Initial version, +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include +#include "vxWorks.h" +#include "sysLib.h" +#include "taskLib.h" +#include "ramDrv.h" +#include "dosFsLib.h" +#include "errnoLib.h" +#include "usrLib.h" +#include "cacheLib.h" +#include "rebootLib.h" + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +/* +** Types and prototypes for this module +*/ +#include "cfe_psp.h" +#include "cfe_psp_memory.h" + +#include "target_config.h" + +#define CFE_PSP_CPU_ID (GLOBAL_CONFIGDATA.Default_CpuId) +#define CFE_PSP_CPU_NAME (GLOBAL_CONFIGDATA.Default_CpuName) +#define CFE_PSP_SPACECRAFT_ID (GLOBAL_CONFIGDATA.Default_SpacecraftId) + +/* + * Track the overall "reserved memory block". + * This single large block is then subdivided into separate areas for CFE use. + */ +extern CFE_PSP_MemoryBlock_t VxWorks_ReservedMemBlock; + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_Restart(uint32 resetType) +{ + if (resetType == CFE_PSP_RST_TYPE_POWERON) + { + CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_POWERON; + /* Potentially flush caches here */ + reboot(BOOT_CLEAR); + } + else + { + CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_PROCESSOR; + /* Potentially flush caches here */ + reboot(BOOT_NORMAL); + } +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_Panic(int32 ErrorCode) +{ + printf("%s called with error code = 0x%08X. Exiting.\n", __func__, (unsigned int)ErrorCode); + exit(EXIT_FAILURE); +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size) +{ + if (type == 1) + { + cacheTextUpdate(address, size); + } +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +uint32 CFE_PSP_GetProcessorId(void) +{ + return CFE_PSP_CPU_ID; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +uint32 CFE_PSP_GetSpacecraftId(void) +{ + return CFE_PSP_SPACECRAFT_ID; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +const char *CFE_PSP_GetProcessorName(void) +{ + return CFE_PSP_CPU_NAME; +} diff --git a/fsw/generic-vxworks-dkm/src/cfe_psp_watchdog.c b/fsw/generic-vxworks-dkm/src/cfe_psp_watchdog.c new file mode 100644 index 00000000..a14816f9 --- /dev/null +++ b/fsw/generic-vxworks-dkm/src/cfe_psp_watchdog.c @@ -0,0 +1,269 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_watchdog.c +** +** Purpose: +** This file contains glue routines between the cFE and the OS Board Support Package ( BSP ). +** The functions here allow the cFE to interface functions that are board and OS specific +** and usually don't fit well in the OS abstraction layer. +** +** History: +** 2009/07/20 A. Cudmore | Initial version, +** +*************************************************************************************************/ + +/* +** Include Files +*/ + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +/* +** System Include Files +*/ +#include +#include +#include +#include "vxWorks.h" +#include +#include "ioLib.h" +#include "iosLib.h" +#include "fioLib.h" + +/* +** Types and prototypes for this module +*/ +#include "cfe_psp.h" +#include "cfe_psp_config.h" + +/* +** Global data +*/ + +/* +** The watchdog time in milliseconds +*/ +uint32 CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; + +/* + * File descriptor for watchdog (initialized to invalid val) + */ +int CFE_PSP_WatchdogFd = ERROR; + +/** + * Note: this implementation uses the vxbVirtualTimerWatchdog component + * which works easily on all platforms but is not as reliable as a hardware + * watchdog. As such, this watchdog cannot have the platform recover from + * hard CPU lockups. When supporting a specific platform, be sure to use + * its hardware watchdog capabilities. If there are no hardware watchdog + * capabilities, then this virtual watchdog implementation is a good option. + * + * Additionally, be sure to set VIRT_WDT_NO_REBOOT component to FALSE to + * enable reboot capabilities. This can be found in workbench by either + * searching for it in kernel config or by navigating to + * VIP -> Harware -> Watchdog -> Virtual Timer Watchdog + */ + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogInit(void) +{ + DEV_HDR *WatchdogHeader; + STATUS Status; + struct watchdog_info WatchdogInfo; + int WatchdogOptions; + + + /* check to see if the virtual watchdog device has been installed. This is + * done automatically when VIP is configured with DRV_VIRTUAL_TIMER_WATCHDOG */ + WatchdogHeader = iosDevFindExact("/watchdog/0"); + if (WatchdogHeader == NULL) + { + printf("failed to initialize watchdog driver. Be sure to add DRV_VIRTUAL_TIMER_WATCHDOG component to VxWorks VIP\n"); + return; + } + + /* create a handle to access the watchdog as a IO device. Since we will be + * writing and reading from the watchdog, we need to have read/write + * capabilities, hence the UPDATE param (see ioLib.h for more details). + * The watchdog should only be written to by the PSP so perms get set to + * read/write for user and read only otherwise. */ + CFE_PSP_WatchdogFd = open("/watchdog/0", O_RDWR, 644); + if (CFE_PSP_WatchdogFd < 0) + { + printf("failed to initialize watchdog file desc\n"); + return; + } + + /* According to the WindRiver docs on the virtual watchdog timer, the + * watchdog is activated when the file is opened. The default timeout + * is 60 seconds. Thus, to avoid having the timer expire from just + * calling CFE_PSP_WatchdogInit(), we disable the watchdog here */ + WatchdogOptions = WDIOS_DISABLECARD; + Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_SETOPTIONS, &WatchdogOptions); + if (Status != OK) { + printf("failed to initialize watchdog\n"); + close(CFE_PSP_WatchdogFd); + } + + /* watchdog command to get info about the watchdog. Stored in WatchdogInfo. + * (see watchdog.h located in VIP kernel header files for more detail). */ + Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_GETSUPPORT, &WatchdogInfo); + if (Status != OK) + { + printf("failed to get watchdog info\n"); + close(CFE_PSP_WatchdogFd); + } + else + { + printf("initialized watchdog with name: %s version: %u flags: %u\n", WatchdogInfo.name, WatchdogInfo.version, WatchdogInfo.flags); + } +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogEnable(void) +{ + STATUS Status; + int WatchdogOptions; + + if (CFE_PSP_WatchdogFd < 0) { + printf("failed to initialize watchdog beforehand\n"); + return; + } + + /* See vxbVirtualTimerWatchdog WindRiver docs for more detail */ + WatchdogOptions = WDIOS_ENABLECARD; + Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_SETOPTIONS, &WatchdogOptions); + if (Status != OK) { + printf("failed to enable watchdog\n"); + close(CFE_PSP_WatchdogFd); + } +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogDisable(void) +{ + STATUS Status; + int WatchdogOptions; + + if (CFE_PSP_WatchdogFd < 0) { + printf("failed to initialize watchdog beforehand\n"); + return; + } + + WatchdogOptions = WDIOS_DISABLECARD; + Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_SETOPTIONS, &WatchdogOptions); + if (Status != OK) { + printf("failed to disable watchdog\n"); + close(CFE_PSP_WatchdogFd); + } +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogService(void) +{ + STATUS Status; + + if (CFE_PSP_WatchdogFd < 0) { + printf("failed to initialize watchdog beforehand\n"); + return; + } + + Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_KEEPALIVE, 0); + if (Status != OK) { + printf("failed to service watchdog\n"); + close(CFE_PSP_WatchdogFd); + } +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +uint32 CFE_PSP_WatchdogGet(void) +{ + STATUS Status; + uint32 WatchdogValue; + + if (CFE_PSP_WatchdogFd < 0) { + printf("failed to initialize watchdog beforehand\n"); + return 0; + } + + WatchdogValue = 0; + Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_GETTIMEOUT, &WatchdogValue); + if (Status != OK) { + printf("failed to get watchdog timeout\n"); + close(CFE_PSP_WatchdogFd); + } + + CFE_PSP_WatchdogValue = WatchdogValue; + + return CFE_PSP_WatchdogValue; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogSet(uint32 WatchdogValue) +{ + STATUS Status; + + if (CFE_PSP_WatchdogFd < 0) { + printf("failed to initialize watchdog beforehand\n"); + return; + } + + Status = ioctl(CFE_PSP_WatchdogFd, WDIOC_SETTIMEOUT, &WatchdogValue); + if (Status != OK) { + printf("failed to set watchdog timeout\n"); + close(CFE_PSP_WatchdogFd); + } + + CFE_PSP_WatchdogValue = WatchdogValue; +} diff --git a/fsw/generic-vxworks-rtp/CMakeLists.txt b/fsw/generic-vxworks-rtp/CMakeLists.txt new file mode 100644 index 00000000..a34881ee --- /dev/null +++ b/fsw/generic-vxworks-rtp/CMakeLists.txt @@ -0,0 +1,29 @@ +###################################################################### +# +# CMAKE build recipe for mcp750-vxworks PSP component +# +###################################################################### + +# This contains the fully platform-specific code to +# run CFE on this target. + +# Build the generic-vxworks implementation as a library +add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT + src/cfe_psp_exception.c + src/cfe_psp_memory.c + src/cfe_psp_ssr.c + src/cfe_psp_start.c + src/cfe_psp_support.c + src/cfe_psp_watchdog.c + parg/parg.c +) +target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-impl PRIVATE + $ +) + +target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE + inc + parg + $ +) + diff --git a/fsw/generic-vxworks-rtp/README.md b/fsw/generic-vxworks-rtp/README.md new file mode 100644 index 00000000..247092a9 --- /dev/null +++ b/fsw/generic-vxworks-rtp/README.md @@ -0,0 +1,174 @@ +# Generic VxWorks 7 RTP Platform Support Package + +# Assumptions: + +* The vxworks-rtp OSAL and generic-vxworks-rtp OSAL BSP are used. +* The cFE repository has the necessary CMake toolchain files for VxWorks RTP targets. +* A Compatible VxWorks 7 SDK is available. This was tested on VxWorks SR0650 for the Raspberry Pi 4, the VxWorks Public SDK For the Raspberry Pi 4, and the VxWorks Public SDK for x86_64 QEMU. + +## How to build cFS for VxWorks 7 RTP Raspberry Pi 4 target (Public SDK) + +This example will focus on the VxWorks Public SDK for the Raspberry Pi 4. This SDK is available to download without a licence and can be used for non-commercial purposes. + +### Download and Prepare the VxWorks SDK + +* Download the public SDK at this URL: https://forums.windriver.com/t/vxworks-software-development-kit-sdk/43 this example is **VxWorks SDK for Raspberry Pi 4 version 1.6 24.03** +* Unpack the SDK. It is assumed that the directory will be **wrsdk-vxworks7-raspberrypi4b** +* In the directory **wrsdk-vxworks7-raspberrypi4b** edit the file **sdkenv.sh** and comment out the line that defines the CC macro: +``` +# export CC=wr-cc +export CXX=wr-c++ +export CPP=wr-cpp +``` + +This is necessary because the current toolchain file for this build depends on the environment script, and the CC definition will cause the cFS elf2cfetbl utility to not compile. An upcoming version of the toolchain file will remove the need to run the SDK setup script. + +> [!NOTE] +> Do not run the sdk setup script until the cFS repository is cloned and ready to build. + +### Copy the SDK runtime files to a Raspberry Pi SD card +As part of the setup process, the SD card must be prepared with: +* u-boot bootloader +* device tree file(s) +* VxWorks kernel +* VxWorks shared libraries and directories needed + +The setup is covered in the SDK README.md file. It is a good idea to verify that the Pi can boot and run VxWorks before moving on to build the cFS. + +### Configure and Build the cFS for the Raspberry Pi 4 + +These instructions cover running the cFS Bundle that has integrated support for VxWorks 7 RTPs. + +* Clone the correct branch of the cFS that supports VxWorks 7 RTPs +* Update/clone the submodules: +``` +git submodule update --init --recursive +``` +* Copy the cfe/cmake/sample_defs directory to the top level directory of the cfs repo: +``` +cp -a cfe/cmake/sample_defs . +``` +* Copy cfe/cmake/Makefile.sample to Makefile in the top level directory of the cfs repo: +``` +cp cfe/cmake/sample_defs/Makefile.sample Makefile +``` +* In the sample_defs directory, edit **targets.cmake** and change the **cpu1_SYSTEM** macro to **aarch-vx7rtp**. Note that this should match the name of the toolchain file you are using. In this case the toolchain file is **toolchain-aarch64-vx7rtp.cmake**. +``` +SET(cpu1_PROCESSORID 1) +SET(cpu1_APPLIST ci_lab to_lab sch_lab) +SET(cpu1_FILELIST cfe_es_startup.scr) +SET(cpu1_SYSTEM aarch64-vx7rtp) +``` + +* Also in the sample_defs directory, edit the **arch_build_custom.cmake** file. Currently there are several lines that need to be commented out due to differences in the compiler that is used in the VxWorks SDK. Comment out the following lines: -Werror, -Wno-format-truncation, and -Wno-stringop-truncation. +``` +add_compile_options( + -std=c99 # Target the C99 standard (without gcc extensions) + -pedantic # Issue all the warnings demanded by strict ISO C + -Wall # Warn about most questionable operations + -Wstrict-prototypes # Warn about missing prototypes + -Wwrite-strings # Warn if not treating string literals as "const" + -Wpointer-arith # Warn about suspicious pointer operations + #-Werror # Warnings are caused by Clang compiler + #-Wno-format-truncation # Inhibit printf-style format truncation warnings - Not in Clang + #-Wno-stringop-truncation # Inhibit string operation truncation warnings - Not in Clang +) +``` +Now the cFS should be ready to build for the Raspberry Pi 4 VxWorks 7 RTP. + +### Build the cFS for Raspberry Pi 4 VxWorks 7 RTP + +> [!NOTE] +> It is assumed that the cfs is cloned to ~/cfs, and the Rasberry Pi 4 SDK is in ~/wrsdk-vxworks7-raspberrypi4b +* Switch back to the directory where the VxWorks 7 SDK is setup. In that directory, run the **sdkenv.sh** script with the following command: +``` +cd ~/wrsdk-vxworks7-raspberrypi4b +source sdkenv.sh +``` +* Switch back to the cFS directory that has been setup and run the make steps: +``` +cd ~/cfs +make prep +make +make install +``` + +If the build completes successfully, the cFS binaries, startup script, and tables will be in: +``` +build/exe/cpu1 +``` + +### Copy the cFS runtime files to the SD card for the Raspberry Pi 4 + +* Copy the **cfs/build/exe/cpu1** directory to the Pi 4 SD card root directory. SD card should have **cpu1** at the top level. + +### Boot the Pi 4 and run the cFS RTP image + +* Insert the SD card with u-boot, the VxWorks kernel and **cpu1** directory into the Pi (The SDK card and these files need to be set up from the Public SDK instructions) +* Open a UART/minicom program to see the UART console +* Power on the Pi +* When the VxWorks shell prompt comes up, type the following: + +``` +> cmd +# cd /sd0a/cpu1 +# core-cpu1.vxe & +``` +> [!NOTE] +> You could also configure an FTP server and load the files remotely. + +You should see the cFS RTP load and start the services and apps. + +You can use commands such as "ps" to list the running RTPs, etc. For more info type: +``` +# help rtp +``` + +### Command the cFS on the Raspberry Pi 4 + +The CI_LAB and TO_LAB cFS apps use the network to communicate with the ground system via UDP packets. This was tested on a Pi4 connected via ethernet to a local LAN with a DHCP server. Once the Pi 4 boots, it will obtain an IP address and report the address on the UART contols. This can sometimes take a few minutes. + +This readme will be expanded with ore information about configuring the Pi4 for a static IP address. + +### Command line arguments + +The cFS uses a number of command line arguments to start and restart the cFS. To see a full list, type: +``` +# core-cpu1.vxe -h +``` +The most relevant options are: +* -R PO and -R PR - this is the reset type. The default reset type is PO or Power On. This reset will clear/create the shared memory segments that are used for cFS reserved memory. The PR option is for a Processor Reset. This is used to restart the cFS after it has exited and it will try to re-connect to the shared memory segments that have been created to store the cFS reserved memory. +* -F cfs1 - The -F option is for the "cfs ID". This is currently used as a prefix for the shared memory sement names that the cFS uses for reserved memory. This unique prefix allows multiple cFS RTPs to run on the same OS instance. If you start the cFS with a specific cfs ID, be sure to use it when restarting the cFS. +As an example, the cFS could be started twice with the following commands: +``` +# core-cpu1.vxe -F cfs1 & +# core-cpu1.vxe -F cfs2 & +``` +Note that application resources will have to be changed such as the socket that CI_LAB listens to and the socket that TO_LAB sends telemetry packets to. + +### Stopping the cFS + +If you wish to stop the cFS RTP without powering off the board, you can do the following in the VxWorks Shell: +* Type **ps** then note the ID of the RTP (can copy it into the clipboard): +``` +# ps +``` +* Type **rtp delete ** where the id is the ID that was copied from the previous step: +``` +# rtp delete +``` +If the network is connected a CFE_ES_RESTART command can also be sent. + + +### Work to do / Limitations + +This PSP is a starting point for a VxWorks 7 RTP port. It will be expanded over time, but it is also intended to be portable. It is expected that a project will need to customize a PSP for the target hardware and mission requirements. + +Some potential future enhancements: +* Improve the Cmake toolchain files to not depend on the VxWorks environment setup script. +* Determine how to manage the warnings in the **arch_build_custom.cmake** file. Some of the warnings can be resolved by updates to the cFS code. +* Determine if we need to replace the "parg" command line parser code. The VxWorks SDK does not provide a command line parser, but later SDKs include the open source "parg" command line parser. It was decided to include the library directly to be compatible with all versions of the SDK. We may want to write a cFS specific library and remove this third party code. It may also be desirable to promote the argument processing code to the shared directory for all PSPs. +* Design and provide kernel mode support code to launch and monitor cFS RTPs. +* Finalize the design for reserved memory. This is likely to be target specific since it relies on how the memory is managed on each target. A portable solution may be to implement the cFE reserved memory as mmapped files on a non-volatile device. +* Determine if we want to include the shared libraries on the target or link them to the cFS builds. +* Add the instructions for a build that uses a VxWorks Source Build (VSB) and VxWorks Image Project (VIP) rather than an SDK. diff --git a/fsw/generic-vxworks-rtp/doc/.gitignore b/fsw/generic-vxworks-rtp/doc/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/fsw/generic-vxworks-rtp/inc/cfe_psp_config.h b/fsw/generic-vxworks-rtp/inc/cfe_psp_config.h new file mode 100644 index 00000000..3c76b6fb --- /dev/null +++ b/fsw/generic-vxworks-rtp/inc/cfe_psp_config.h @@ -0,0 +1,206 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +#ifndef CFE_PSP_CONFIG_H +#define CFE_PSP_CONFIG_H + +#include "common_types.h" + +#include +#include +#include +#include +#include +#include + +/** + * \brief Period of the VxWorks timebase, in nanoseconds + * + * This is expressed as a ratio in case it is not a whole number. + * + * Multiplying the timebase register by 60 should yield a result + * in nanoseconds, and then further dividing by the OSAL OS_time_t tick + * resolution will convert to an OS_time_t compatible value. + * + * This needs to be set to the correct timebase for the BSP + * + * Note this is distinct from the VxWorks system timer tick which runs, + * confusingly, at 60Hz or a ~16.67ms period. + */ +#define CFE_PSP_VX_TIMEBASE_PERIOD_NUMERATOR 60 +#define CFE_PSP_VX_TIMEBASE_PERIOD_DENOMINATOR 1 + +/* +** This define sets the number of memory ranges that are defined in the memory range definition +** table. +*/ +#define CFE_PSP_MEM_TABLE_SIZE 10 + +/** + * This define sets the maximum number of exceptions + * that can be stored. + * + * It must always be a power of two. + */ +#define CFE_PSP_MAX_EXCEPTION_ENTRIES 4 +#define CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE 16 + +/* + * The tick period that will be configured in the RTOS for the simulated + * time base, in microseconds. This in turn is used to drive the 1hz clock + * and other functions. + * + * On the the sysClockRate runs at 60Hz so this is the same period + * that the cFE software timebase will be configured at. + */ +#define CFE_PSP_SOFT_TIMEBASE_PERIOD 16666 + + +/* + * A random 32-bit value that is used as the "validity flag" + * of the PC-Linux boot record structure. This is simply + * a value that is unlikely to occur unless specifically set. + */ +#define CFE_PSP_BOOTRECORD_VALID ((uint32)0x2aebe984) +#define CFE_PSP_BOOTRECORD_INVALID (~CFE_PSP_BOOTRECORD_VALID) + +/* + * The amount of time to wait for an orderly shutdown + * in the event of a call to CFE_PSP_Restart() + * + * If this expires, then an abnormal exit/abort() is triggered. + */ +#define CFE_PSP_RESTART_DELAY 10000 + +/* use the "USR1" signal to wake the idle thread when an exception occurs */ +#define CFE_PSP_EXCEPTION_EVENT_SIGNAL SIGUSR1 + + + +#define CFE_PSP_SHM_NAME_LENGTH 32 +#define CFE_PSP_CPU_NAME_LENGTH 32 +#define CFE_PSP_RESET_NAME_LENGTH 10 +#define CFE_PSP_CFS_ID_LENGTH 16 + +#define CFE_PSP_CFS_ID "cfs1" + +/* +** Typedef for the layout of the vxWorks boot record structure +** +** This is statically placed at the beginning of system memory (sysMemTop) +** which should be reserved in the kernel. +*/ +typedef struct +{ + uint32 bsp_reset_type; + uint32 ValidityFlag; + uint32 NextResetType; +} CFE_PSP_ReservedMemoryBootRecord_t; + +/* + * The state of the PSP "idle task" + * + * This is the main/initial thread that runs early init, + * it is NOT an OSAL task. + * + * Once initialized, this thread goes idle and waits for + * asynchronous events to occur, and resumes with an orderly + * shutdown if requested. + */ +typedef struct +{ + pthread_t ThreadID; + volatile bool ShutdownReq; +} CFE_PSP_IdleTaskState_t; + + +/* +** Structure for the Command line parameters +*/ +typedef struct +{ + char ResetType[CFE_PSP_RESET_NAME_LENGTH]; /* Reset type can be "PO" for Power on or "PR" for Processor Reset */ + uint32 GotResetType; /* did we get the ResetType parameter ? */ + + uint32 SubType; /* Reset Sub Type ( 1 - 5 ) */ + uint32 GotSubType; /* did we get the ResetSubType parameter ? */ + + char CpuName[CFE_PSP_CPU_NAME_LENGTH]; /* CPU Name */ + uint32 GotCpuName; /* Did we get a CPU Name ? */ + + char CfsId[CFE_PSP_CFS_ID_LENGTH]; /* CFS ID */ + uint32 GotCfsId; /* Did we get a cFS Id? */ + + uint32 CpuId; /* CPU ID */ + uint32 GotCpuId; /* Did we get a CPU Id ?*/ + + uint32 SpacecraftId; /* Spacecraft ID */ + uint32 GotSpacecraftId; /* Did we get a Spacecraft ID */ +} CFE_PSP_CommandData_t; + + +/** + * \brief The data type used by the underlying OS to represent a thread ID. + */ +typedef TASK_ID CFE_PSP_Exception_SysTaskId_t; + +/* +** Global variables +*/ + +typedef struct +{ + struct timespec event_time; + siginfo_t si; + + /* + * Note this is a variably-filled array based on the number of addresses + * reported by the library. It should be last. + */ + void *bt_addrs[CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE]; +} CFE_PSP_Exception_ContextDataEntry_t; + + +/* +** Watchdog minimum and maximum values ( in milliseconds ) +*/ +#define CFE_PSP_WATCHDOG_MIN (0) +#define CFE_PSP_WATCHDOG_MAX (0xFFFFFFFF) + +/* +** Number of EEPROM banks on this platform +*/ +#define CFE_PSP_NUM_EEPROM_BANKS 1 + +/* + * The alignment to use for each reserved memory block. + * + * This is a mask to be applied to each block base address + * + * Chosen as the cache line size of the MPC750 processor (32 bytes) + * such that the blocks will be cached more efficiently. + */ +#define CFE_PSP_MEMALIGN_MASK ((cpuaddr)0x1F) + +/* + * Information about the "idle task" -- + * this is used by exception handling to wake it when an event occurs + */ +extern CFE_PSP_IdleTaskState_t CFE_PSP_IdleTaskState; + +#endif diff --git a/fsw/generic-vxworks-rtp/inc/psp_version.h b/fsw/generic-vxworks-rtp/inc/psp_version.h new file mode 100644 index 00000000..024f6092 --- /dev/null +++ b/fsw/generic-vxworks-rtp/inc/psp_version.h @@ -0,0 +1,77 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * @brief Purpose: + * @details Provide version identifiers for the cFE Platform Support Packages (PSP). + * See @ref cfsversions for version and build number and description + */ +#ifndef PSP_VERSION_H +#define PSP_VERSION_H + +/* + * Development Build Macro Definitions + */ +#define CFE_PSP_IMPL_BUILD_NUMBER 0 +#define CFE_PSP_IMPL_BUILD_BASELINE "v7.0.0" +#define CFE_PSP_BUILD_DEV_CYCLE "v7.0.0" /**< @brief Development: Release name for current development cycle */ +#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ + +/* + * Version Macros, see \ref cfsversions for definitions. + */ +#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ +#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ +#define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ + +/** + * @brief Last official release. + */ +#define CFE_PSP_LAST_OFFICIAL "v7.0.0" + +/*! + * @brief Mission revision. + * + * Reserved for mission use to denote patches/customizations as needed. + * Values 1-254 are reserved for mission use to denote patches/customizations as needed. NOTE: Reserving 0 and 0xFF for + * cFS open-source development use (pending resolution of nasa/cFS#440) + */ +#define CFE_PSP_IMPL_MISSION_REV 0x0 + +/* + * Tools to construct version string + */ +#define CFE_PSP_IMPL_STR_HELPER(x) #x /*!< @brief Helper function to concatenate strings from integer */ +#define CFE_PSP_IMPL_STR(x) \ + CFE_PSP_IMPL_STR_HELPER(x) /*!< @brief Helper function to concatenate strings from integer */ + +/*! @brief DEVELOPMENT Build Version Number. + * @details Baseline git tag + Number of commits since baseline. @n + * See @ref cfsversions for format differences between development and release versions. + */ +#define CFE_PSP_IMPL_VERSION CFE_PSP_IMPL_BUILD_BASELINE "+dev" CFE_PSP_IMPL_STR(CFE_PSP_IMPL_BUILD_NUMBER) + +/** + * @brief Max Version String length. + * + * Maximum length that a tblCRCTool version string can be. + * + */ +#define CFE_PSP_CFG_MAX_VERSION_STR_LEN 256 + +#endif diff --git a/fsw/generic-vxworks-rtp/make/build_options.cmake b/fsw/generic-vxworks-rtp/make/build_options.cmake new file mode 100644 index 00000000..76c79a7a --- /dev/null +++ b/fsw/generic-vxworks-rtp/make/build_options.cmake @@ -0,0 +1,30 @@ +########################################################################## +# +# Build options for "generic-vxworks" PSP +# This file specifies any global-scope compiler options when using this PSP +# +########################################################################## + +# This indicates where to install target binaries created during the build +# Note - this should be phased out in favor of the staging dir from OSAL BSP +set(INSTALL_SUBDIR "cf") + +# Some upper-level code may be gated on _VXWORKS_OS_ being defined +# This is for compatibility with older build scripts which defined this symbol, +# but no CFE/OSAL framework code depends on this symbol. +add_definitions("-D_VXWORKS_OS_") + + +# Use the -specific VxWorks BSP include directory +# This needs to be globally used, not just private to the PSP, because +# some VxWorks headers reference files contained here. +# include_directories( +# ${WIND_BASE}/target/config/ +# ) + +# therefore all code compiled for this platform should always define these symbols. +# for a "generic-vxworks" PSP, so I'm trying to keep architecture specific defs out of this +add_definitions("-D__vx_sdk__") + +set(CFE_PSP_EXPECTED_OSAL_BSPTYPE "generic-vxworks-rtp") + diff --git a/fsw/generic-vxworks-rtp/parg/LICENSE b/fsw/generic-vxworks-rtp/parg/LICENSE new file mode 100644 index 00000000..0698a502 --- /dev/null +++ b/fsw/generic-vxworks-rtp/parg/LICENSE @@ -0,0 +1,18 @@ +The MIT No Attribution License (MIT-0) + +Copyright 2015-2023 Joergen Ibsen + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/fsw/generic-vxworks-rtp/parg/README.md b/fsw/generic-vxworks-rtp/parg/README.md new file mode 100644 index 00000000..1a23486a --- /dev/null +++ b/fsw/generic-vxworks-rtp/parg/README.md @@ -0,0 +1,210 @@ + +[![parg CI](https://github.com/jibsen/parg/actions/workflows/parg-ci-workflow.yaml/badge.svg)](https://github.com/jibsen/parg/actions) [![codecov](https://codecov.io/gh/jibsen/parg/branch/master/graph/badge.svg)](https://codecov.io/gh/jibsen/parg) + +About +----- + +Most command-line programs have to parse options, so there are a lot of +different solutions to this problem. Some offer many features, while others +are more basic. + +One of the simpler solutions for C is the [getopt][] function, and its +extension `getopt_long`. They iterate over the options in `argv`, returning +them one at a time on successive calls. + +One nice thing about them is that they are available on most Unix-like +operating systems (and usually accompany GCC elsewhere, like Windows). +Unfortunately, some implementation details vary between platforms. + +A potential question is what license the version you get when you include +them is available under. Some are GPL, others LGPL. There are also ports of +`getopt` that use more liberal licenses. + +`parg` is a parser for `argv` that works similarly to `getopt`, but does not +aim to be a direct replacement. It attempts to make some choices about how to +handle the extensions and idiosyncrasies of other `getopt` implementations, +and document them. + +It consists of a single source and include file, written in portable ANSI C. +It is made available under the [MIT No Attribution License](LICENSE) (MIT-0). + +[getopt]: https://en.wikipedia.org/wiki/Getopt + + +Usage +----- + +The include file `parg.h` contains documentation in the form of [doxygen][] +comments. A configuration file is included, run `doxygen` to generate +documentation in HTML format. + +You can add the source files `parg.c` and `parg.h` to your own projects. + +For CI, `parg` uses [CMake][] to provide an easy way to build and test across +various platforms and toolsets. To create a build system for the tools on your +platform, and build `parg`, use something along the lines of: + +~~~sh +mkdir build +cd build +cmake .. +cmake --build . +~~~ + +[doxygen]: http://www.doxygen.org/ +[CMake]: http://www.cmake.org/ + + +Example +------- + +Here is an example that parses command-line options using `parg_getopt()`: + +~~~c +#include +#include + +#include "parg.h" + +int main(int argc, char *argv[]) +{ + struct parg_state ps; + int c; + + parg_init(&ps); + + while ((c = parg_getopt(&ps, argc, argv, "hs:v")) != -1) { + switch (c) { + case 1: + printf("nonoption '%s'\n", ps.optarg); + break; + case 'h': + printf("Usage: testparg [-h] [-v] [-s STRING]\n"); + return EXIT_SUCCESS; + break; + case 's': + printf("option -s with argument '%s'\n", ps.optarg); + break; + case 'v': + printf("testparg 1.0.0\n"); + return EXIT_SUCCESS; + break; + case '?': + if (ps.optopt == 's') { + printf("option -s requires an argument\n"); + } + else { + printf("unknown option -%c\n", ps.optopt); + } + return EXIT_FAILURE; + break; + default: + printf("error: unhandled option -%c\n", c); + return EXIT_FAILURE; + break; + } + } + + for (c = ps.optind; c < argc; ++c) { + printf("nonoption '%s'\n", argv[c]); + } + + return EXIT_SUCCESS; +} +~~~ + + +Comparison to `getopt` +---------------------- + +### Use of global variables + +`getopt` uses global variables to store its state between calls. `parg` uses +a struct `parg_state`, which you must pass with each call. + +### Handling of nonoptions + +POSIX and BSD `getopt` return `-1` on the first nonoption argument. GNU +`getopt` by default reorders `argv` (even though it is passed as const), so +all options come first. + +`parg` does not change `argv`, and returns each nonoption as the option +argument of an option with value `1` (like GNU `getopt`, if `optstring` were +prefixed by '`-`'). + +If you wish to process all options first, and have the nonoptions ordered at +the end of `argv`, you can use `parg_reorder()`: + +~~~c + optend = parg_reorder(argc, argv, optstring, NULL); + + while ((c = parg_getopt(&ps, optend, argv, optstring)) != -1) { + /* ... */ + } + + /* elements of argv[] from optend to argc are nonoptions */ +~~~ + +### Value of `optind` on error + +When there are multiple short options in one argument, `getopt` does not +increment `optind` until the last one is processed. This makes it harder to +tell which argument an unknown option came from (if `a` is an unknown option, +`-a` and `-ab` will return '`?`' with different values in `optind`). + +`parg` always increments the `optind` value in it's state so it points to the +next `argv` element to be processed. So when `parg` returns '`?`' (or '`:`'), +the element that contains the error is `argv[optind - 1]`. + +### Value of `optopt` on error + +With `getopt_long`, it varies what the values of `optopt` and `longindex` are +when an error is found with option arguments of long options. Sometimes these +values are not documented. + +`parg` sets `optopt` to `val` if `flag` is `NULL`, and `0` otherwise (which +equals the return value on successful match), and `longindex` is set to the +index of the entry in `longopts` that matched. + +### Return value on option argument error + +When the first character of `optstring` is '`:`', it varies what `getopt` +returns on extraneous option arguments. + +In this case, `parg` returns '`?`' if no option match is found, and '`:`' if +a match is found, but is missing a required argument, or has an extraneous +argument. + + +Alternatives +------------ + +Some ports of `getopt`: + + - [Free Getopt](http://freegetopt.sourceforge.net/) + - [ya_getopt](http://github.com/kubo/ya_getopt/) + - [getopt_port](http://github.com/kimgr/getopt_port/) + +Other command-line parsing libraries that support C: + + - [Gengetopt](http://www.gnu.org/software/gengetopt/) + - [Argp](http://www.gnu.org/software/libc/manual/html_node/Argp.html) + - [popt](http://en.wikipedia.org/wiki/Popt) + - [argtable](https://www.argtable.org/) + - [optlist](http://michael.dipperstein.com/optlist/) + - [Arg_parser](http://www.nongnu.org/arg-parser/arg_parser.html) + - [Gopt](http://www.purposeful.co.uk/software/gopt/) + - [docopt](http://docopt.org/) + - [optparse](https://github.com/skeeto/optparse) + - [getopt](https://github.com/wc-duck/getopt) + - [argparse](https://github.com/cofyc/argparse) + +A few C++ command-line parsing libraries: + + - [TCLAP](http://tclap.sourceforge.net/) + - [program_options](http://www.boost.org/doc/libs/1_58_0/doc/html/program_options.html) + - [CommandLine](http://llvm.org/docs/CommandLine.html) + - [CLI11](https://github.com/CLIUtils/CLI11) + - [argparse](https://github.com/p-ranav/argparse) + - [clipp](https://github.com/muellan/clipp) + - [argh](https://github.com/adishavit/argh) diff --git a/fsw/generic-vxworks-rtp/parg/parg.c b/fsw/generic-vxworks-rtp/parg/parg.c new file mode 100644 index 00000000..bf2e88af --- /dev/null +++ b/fsw/generic-vxworks-rtp/parg/parg.c @@ -0,0 +1,366 @@ +/* + * parg - parse argv + * + * Copyright 2015-2023 Joergen Ibsen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * SPDX-License-Identifier: MIT-0 + */ + +#include "parg.h" + +#include +#include +#include + +/* + * Check if state is at end of argv. + */ +static int +is_argv_end(const struct parg_state *ps, int argc, char *const argv[]) +{ + return ps->optind >= argc || argv[ps->optind] == NULL; +} + +/* + * Match nextchar against optstring. + */ +static int +match_short(struct parg_state *ps, int argc, char *const argv[], + const char *optstring) +{ + const char *p = strchr(optstring, *ps->nextchar); + + if (p == NULL) { + ps->optopt = *ps->nextchar++; + return '?'; + } + + /* If no option argument, return option */ + if (p[1] != ':') { + return *ps->nextchar++; + } + + /* If more characters, return as option argument */ + if (ps->nextchar[1] != '\0') { + ps->optarg = &ps->nextchar[1]; + ps->nextchar = NULL; + return *p; + } + + /* If option argument is optional, return option */ + if (p[2] == ':') { + return *ps->nextchar++; + } + + /* Option argument required, so return next argv element */ + if (is_argv_end(ps, argc, argv)) { + ps->optopt = *ps->nextchar++; + return optstring[0] == ':' ? ':' : '?'; + } + + ps->optarg = argv[ps->optind++]; + ps->nextchar = NULL; + return *p; +} + +/* + * Match string at nextchar against longopts. + */ +static int +match_long(struct parg_state *ps, int argc, char *const argv[], + const char *optstring, + const struct parg_option *longopts, int *longindex) +{ + size_t len; + int num_match = 0; + int match = -1; + int i; + + len = strcspn(ps->nextchar, "="); + + for (i = 0; longopts[i].name; ++i) { + if (strncmp(ps->nextchar, longopts[i].name, len) == 0) { + match = i; + num_match++; + /* Take if exact match */ + if (longopts[i].name[len] == '\0') { + num_match = 1; + break; + } + } + } + + /* Return '?' on no or ambiguous match */ + if (num_match != 1) { + ps->optopt = 0; + ps->nextchar = NULL; + return '?'; + } + + assert(match != -1); + + if (longindex) { + *longindex = match; + } + + if (ps->nextchar[len] == '=') { + /* Option argument present, check if extraneous */ + if (longopts[match].has_arg == PARG_NOARG) { + ps->optopt = longopts[match].flag ? 0 : longopts[match].val; + ps->nextchar = NULL; + return optstring[0] == ':' ? ':' : '?'; + } + else { + ps->optarg = &ps->nextchar[len + 1]; + } + } + else if (longopts[match].has_arg == PARG_REQARG) { + /* Option argument required, so return next argv element */ + if (is_argv_end(ps, argc, argv)) { + ps->optopt = longopts[match].flag ? 0 : longopts[match].val; + ps->nextchar = NULL; + return optstring[0] == ':' ? ':' : '?'; + } + + ps->optarg = argv[ps->optind++]; + } + + ps->nextchar = NULL; + + if (longopts[match].flag != NULL) { + *longopts[match].flag = longopts[match].val; + return 0; + } + + return longopts[match].val; +} + +void +parg_init(struct parg_state *ps) +{ + ps->optarg = NULL; + ps->optind = 1; + ps->optopt = '?'; + ps->nextchar = NULL; +} + +int +parg_getopt(struct parg_state *ps, int argc, char *const argv[], + const char *optstring) +{ + return parg_getopt_long(ps, argc, argv, optstring, NULL, NULL); +} + +int +parg_getopt_long(struct parg_state *ps, int argc, char *const argv[], + const char *optstring, + const struct parg_option *longopts, int *longindex) +{ + assert(ps != NULL); + assert(argv != NULL); + assert(optstring != NULL); + + ps->optarg = NULL; + + if (argc < 2) { + return -1; + } + + /* Advance to next element if needed */ + if (ps->nextchar == NULL || *ps->nextchar == '\0') { + if (is_argv_end(ps, argc, argv)) { + return -1; + } + + ps->nextchar = argv[ps->optind++]; + + /* Check for nonoption element (including '-') */ + if (ps->nextchar[0] != '-' || ps->nextchar[1] == '\0') { + ps->optarg = ps->nextchar; + ps->nextchar = NULL; + return 1; + } + + /* Check for '--' */ + if (ps->nextchar[1] == '-') { + if (ps->nextchar[2] == '\0') { + ps->nextchar = NULL; + return -1; + } + + if (longopts != NULL) { + ps->nextchar += 2; + + return match_long(ps, argc, argv, optstring, + longopts, longindex); + } + } + + ps->nextchar++; + } + + /* Match nextchar */ + return match_short(ps, argc, argv, optstring); +} + +/* + * Reverse elements of `v` from `i` to `j`. + */ +static void +reverse(char *v[], int i, int j) +{ + while (j - i > 1) { + char *tmp = v[i]; + v[i] = v[j - 1]; + v[j - 1] = tmp; + ++i; + --j; + } +} + +/* + * Reorder elements of `argv` with no special cases. + * + * This function assumes there is no `--` element, and the last element + * is not an option missing a required argument. + * + * The algorithm is described here: + * http://hardtoc.com/2016/11/07/reordering-arguments.html + */ +static int +parg_reorder_simple(int argc, char *argv[], + const char *optstring, + const struct parg_option *longopts) +{ + struct parg_state ps; + int change; + int l = 0; + int m = 0; + int r = 0; + + if (argc < 2) { + return argc; + } + + do { + int nextind; + int c; + + parg_init(&ps); + + nextind = ps.optind; + + /* Parse until end of argument */ + do { + c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); + } while (ps.nextchar != NULL && *ps.nextchar != '\0'); + + change = 0; + + do { + /* Find next non-option */ + for (l = nextind; c != 1 && c != -1;) { + l = ps.optind; + + do { + c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); + } while (ps.nextchar != NULL && *ps.nextchar != '\0'); + } + + /* Find next option */ + for (m = l; c == 1;) { + m = ps.optind; + + do { + c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); + } while (ps.nextchar != NULL && *ps.nextchar != '\0'); + } + + /* Find next non-option */ + for (r = m; c != 1 && c != -1;) { + r = ps.optind; + + do { + c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); + } while (ps.nextchar != NULL && *ps.nextchar != '\0'); + } + + /* Find next option */ + for (nextind = r; c == 1;) { + nextind = ps.optind; + + do { + c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); + } while (ps.nextchar != NULL && *ps.nextchar != '\0'); + } + + if (m < r) { + change = 1; + reverse(argv, l, m); + reverse(argv, m, r); + reverse(argv, l, r); + } + } while (c != -1); + } while (change != 0); + + return l + (r - m); +} + +int +parg_reorder(int argc, char *argv[], + const char *optstring, + const struct parg_option *longopts) +{ + struct parg_state ps; + int lastind; + int optend; + int c; + + assert(argv != NULL); + assert(optstring != NULL); + + if (argc < 2) { + return argc; + } + + parg_init(&ps); + + /* Find end of normal arguments */ + do { + lastind = ps.optind; + + c = parg_getopt_long(&ps, argc, argv, optstring, longopts, NULL); + + /* Check for trailing option with error */ + if ((c == '?' || c == ':') && is_argv_end(&ps, argc, argv)) { + lastind = ps.optind - 1; + break; + } + } while (c != -1); + + optend = parg_reorder_simple(lastind, argv, optstring, longopts); + + /* Rotate `--` or trailing option with error into position */ + if (lastind < argc) { + reverse(argv, optend, lastind); + reverse(argv, optend, lastind + 1); + ++optend; + } + + return optend; +} diff --git a/fsw/generic-vxworks-rtp/parg/parg.h b/fsw/generic-vxworks-rtp/parg/parg.h new file mode 100644 index 00000000..d48ec128 --- /dev/null +++ b/fsw/generic-vxworks-rtp/parg/parg.h @@ -0,0 +1,204 @@ +/* + * parg - parse argv + * + * Copyright 2015-2023 Joergen Ibsen + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * SPDX-License-Identifier: MIT-0 + */ + +#ifndef PARG_H_INCLUDED +#define PARG_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +#define PARG_VER_MAJOR 1 /**< Major version number */ +#define PARG_VER_MINOR 0 /**< Minor version number */ +#define PARG_VER_PATCH 3 /**< Patch version number */ +#define PARG_VER_STRING "1.0.3" /**< Version number as a string */ + +/** + * Structure containing state between calls to parser. + * + * @see parg_init + */ +struct parg_state { + const char *optarg; /**< Pointer to option argument, if any */ + int optind; /**< Next index in argv to process */ + int optopt; /**< Option value resulting in error, if any */ + const char *nextchar; /**< Next character to process */ +}; + +/** + * Structure for supplying long options to `parg_getopt_long()`. + * + * @see parg_getopt_long + */ +struct parg_option { + const char *name; /**< Name of option */ + int has_arg; /**< Option argument status */ + int *flag; /**< Pointer to flag variable */ + int val; /**< Value of option */ +}; + +/** + * Values for `has_arg` flag in `parg_option`. + * + * @see parg_option + */ +typedef enum { + PARG_NOARG, /**< No argument */ + PARG_REQARG, /**< Required argument */ + PARG_OPTARG /**< Optional argument */ +} parg_arg_num; + +/** + * Initialize `ps`. + * + * Must be called before using state with a parser. + * + * @see parg_state + * + * @param ps pointer to state + */ +void +parg_init(struct parg_state *ps); + +/** + * Parse next short option in `argv`. + * + * Elements in `argv` that contain short options start with a single dash + * followed by one or more option characters, and optionally an option + * argument for the last option character. Examples are '`-d`', '`-ofile`', + * and '`-dofile`'. + * + * Consecutive calls to this function match the command-line arguments in + * `argv` against the short option characters in `optstring`. + * + * If an option character in `optstring` is followed by a colon, '`:`', the + * option requires an argument. If it is followed by two colons, the option + * may take an optional argument. + * + * If a match is found, `optarg` points to the option argument, if any, and + * the value of the option character is returned. + * + * If a match is found, but is missing a required option argument, `optopt` + * is set to the option character. If the first character in `optstring` is + * '`:`', then '`:`' is returned, otherwise '`?`' is returned. + * + * If no option character in `optstring` matches a short option, `optopt` + * is set to the option character, and '`?`' is returned. + * + * If an element of argv does not contain options (a nonoption element), + * `optarg` points to the element, and `1` is returned. + * + * An element consisting of a single dash, '`-`', is returned as a nonoption. + * + * Parsing stops and `-1` is returned, when the end of `argv` is reached, or + * if an element contains '`--`'. + * + * Works similarly to `getopt`, if `optstring` were prefixed by '`-`'. + * + * @param ps pointer to state + * @param argc number of elements in `argv` + * @param argv array of pointers to command-line arguments + * @param optstring string containing option characters + * @return option value on match, `1` on nonoption element, `-1` on end of + * arguments, '`?`' on unmatched option, '`?`' or '`:`' on option argument + * error + */ +int +parg_getopt(struct parg_state *ps, int argc, char *const argv[], + const char *optstring); + +/** + * Parse next long or short option in `argv`. + * + * Elements in `argv` that contain a long option start with two dashes + * followed by a string, and optionally an equal sign and an option argument. + * Examples are '`--help`' and '`--size=5`'. + * + * If no exact match is found, an unambiguous prefix of a long option will + * match. For example, if '`foo`' and '`foobar`' are valid long options, then + * '`--fo`' is ambiguous and will not match, '`--foo`' matches exactly, and + * '`--foob`' is an unambiguous prefix and will match. + * + * If a long option match is found, and `flag` is `NULL`, `val` is returned. + * + * If a long option match is found, and `flag` is not `NULL`, `val` is stored + * in the variable `flag` points to, and `0` is returned. + * + * If a long option match is found, but is missing a required option argument, + * or has an option argument even though it takes none, `optopt` is set to + * `val` if `flag` is `NULL`, and `0` otherwise. If the first character in + * `optstring` is '`:`', then '`:`' is returned, otherwise '`?`' is returned. + * + * If `longindex` is not `NULL`, the index of the entry in `longopts` that + * matched is stored there. + * + * If no long option in `longopts` matches a long option, '`?`' is returned. + * + * Handling of nonoptions and short options is like `parg_getopt()`. + * + * If no short options are required, an empty string, `""`, should be passed + * as `optstring`. + * + * Works similarly to `getopt_long`, if `optstring` were prefixed by '`-`'. + * + * @see parg_getopt + * + * @param ps pointer to state + * @param argc number of elements in `argv` + * @param argv array of pointers to command-line arguments + * @param optstring string containing option characters + * @param longopts array of `parg_option` structures + * @param longindex pointer to variable to store index of matching option in + * @return option value on match, `0` for flag option, `1` on nonoption + * element, `-1` on end of arguments, '`?`' on unmatched or ambiguous option, + * '`?`' or '`:`' on option argument error + */ +int +parg_getopt_long(struct parg_state *ps, int argc, char *const argv[], + const char *optstring, + const struct parg_option *longopts, int *longindex); + +/** + * Reorder elements of `argv` so options appear first. + * + * If there are no long options, `longopts` may be `NULL`. + * + * The return value can be used as `argc` parameter for `parg_getopt()` and + * `parg_getopt_long()`. + * + * @param argc number of elements in `argv` + * @param argv array of pointers to command-line arguments + * @param optstring string containing option characters + * @param longopts array of `parg_option` structures + * @return index of first nonoption in `argv` on success, `-1` on error + */ +int +parg_reorder(int argc, char *argv[], + const char *optstring, + const struct parg_option *longopts); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PARG_H_INCLUDED */ diff --git a/fsw/generic-vxworks-rtp/psp_module_list.cmake b/fsw/generic-vxworks-rtp/psp_module_list.cmake new file mode 100644 index 00000000..88430aa4 --- /dev/null +++ b/fsw/generic-vxworks-rtp/psp_module_list.cmake @@ -0,0 +1,14 @@ +# This is a list of modules that is included as a fixed/base set +# when this PSP is selected. They must exist under fsw/modules +# +# HLS - the vxworks_timebase only works on PowerPC platforms +# we will use the posix_clock timebase here until a +# hardware specific solution is foun +soft_timebase +timebase_posix_clock +eeprom_direct +ram_direct +port_direct +iodriver +# vxworks_sysmon +endian_api diff --git a/fsw/generic-vxworks-rtp/src/cfe_psp_exception.c b/fsw/generic-vxworks-rtp/src/cfe_psp_exception.c new file mode 100644 index 00000000..b719d157 --- /dev/null +++ b/fsw/generic-vxworks-rtp/src/cfe_psp_exception.c @@ -0,0 +1,368 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +/****************************************************************************** +S +** File: cfe_psp_exception.c +** +** POSIX (VxWorks 7 RTP) version +** +** Purpose: +** cFE PSP Exception handling functions +** +** History: +** 2007/05/29 A. Cudmore | POSIX Version +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" +#include "cfe_psp.h" +#include "cfe_psp_config.h" +#include "cfe_psp_exceptionstorage_types.h" +#include "cfe_psp_exceptionstorage_api.h" + +/* #include */ +#include + +/* + * A set of asynchronous signals which will be masked during other signal processing + */ +sigset_t CFE_PSP_AsyncMask; + +/*************************************************************************** + ** FUNCTIONS DEFINITIONS + ***************************************************************************/ + +/* +** +** Installed as a signal handler to log exception events. +** +*/ +void CFE_PSP_ExceptionSigHandler(int signo, siginfo_t *si, void *ctxt) +{ + CFE_PSP_Exception_LogData_t *Buffer; + + /* + * Note that the time between CFE_PSP_Exception_GetNextContextBuffer() + * and CFE_PSP_Exception_WriteComplete() is sensitive in that it is + * accessing a global. + * + * Cannot use a conventional lock because this is a signal handler, the + * solution would need to involve a signal-safe spinlock and/or C11 + * atomic ops. + * + * This means if another exception occurs on another task during this + * time window, it may use the same buffer. + * + * However, exceptions should be rare enough events that this is highly + * unlikely to occur, so leaving this unhandled for now. + */ + Buffer = CFE_PSP_Exception_GetNextContextBuffer(); + if (Buffer != NULL) + { + /* + * read the clock as a timestamp - note "clock_gettime" is signal safe per POSIX, + * + * _not_ going through OSAL to read this as it may do something signal-unsafe... + * (current implementation would be safe, but it is not guaranteed to always be). + */ + clock_gettime(CLOCK_MONOTONIC, &Buffer->context_info.event_time); + memcpy(&Buffer->context_info.si, si, sizeof(Buffer->context_info.si)); +#if 0 + /* + ** VxWorks todo: VxWorks does not support backtrace - try to figure out the best exception + ** strategy and implement it. At a minimum, capture the context and log it in the context data structure + */ + NumAddrs = backtrace(Buffer->context_info.bt_addrs, CFE_PSP_MAX_EXCEPTION_BACKTRACE_SIZE); + Buffer->context_size = offsetof(CFE_PSP_Exception_ContextDataEntry_t, bt_addrs[NumAddrs]); +#endif + /* pthread_self() is signal-safe per POSIX.1-2013 */ + Buffer->sys_task_id = pthread_self(); + CFE_PSP_Exception_WriteComplete(); + } + + /* + * notify the main (idle) thread that an interesting event occurred. + * Note on this platform this cannot _directly_ invoke CFE from a signal handler. + */ + pthread_kill(CFE_PSP_IdleTaskState.ThreadID, CFE_PSP_EXCEPTION_EVENT_SIGNAL); +} + +/* +** +** An extension of CFE_PSP_ExceptionSigHandler that also +** suspends the calling task and prevents returning to the +** application. +** +** This is required for handling events like Floating Point exceptions, +** where returning to the application would resume at the same instruction +** and re-trigger the exception, resulting in a loop. +** +*/ +void CFE_PSP_ExceptionSigHandlerSuspend(int signo, siginfo_t *si, void *ctxt) +{ + /* + * Perform normal exception logging + */ + CFE_PSP_ExceptionSigHandler(signo, si, ctxt); + + /* + * calling "sigsuspend" with an empty mask should + * block this thread indefinitely. This is intended + * to replicate the behavior of vxworks which suspends + * the task after an exception. + * + * This stops execution of the thread in anticipation that it + * will be deleted by the CFE/OSAL. + */ + sigsuspend(&CFE_PSP_AsyncMask); +} + +/* +** +** An extension of CFE_PSP_ExceptionSigHandler that also +** kills the calling task. In a VxWorks RTP, this allows the +** OSAL cleanup to complete so the system can restart. +** +** This is required for handling events like Floating Point exceptions, +** where returning to the application would resume at the same instruction +** and re-trigger the exception, resulting in a loop. +** +*/ +void CFE_PSP_ExceptionSigHandlerKill(int signo, siginfo_t *si, void *ctxt) +{ + int rc = -1; + + /* + * Perform normal exception logging + */ + CFE_PSP_ExceptionSigHandler(signo, si, ctxt); + + printf("CFE_PSP: Exception handler exiting thread: %d\n",pthread_self()); + + /* + * Call pthread_exit to stop this thread + */ + pthread_exit(&rc); +} + +/* + * Helper function to call sigaction() to attach a signal handler + */ +void CFE_PSP_AttachSigHandler(int signo) +{ + struct sigaction sa; + + memset(&sa, 0, sizeof(sa)); + sa.sa_mask = CFE_PSP_AsyncMask; + + if (!sigismember(&CFE_PSP_AsyncMask, signo)) + { + /* + * In the event that the handler is being installed for one of the + * synchronous events, use the CFE_PSP_ExceptionSigHandlerKill variant. + * + * This exits the calling thread. + * + * For debugging, this could be changed to CFE_PSP_ExceptionSigHandlerSuspend + * which will suspend the calling thread so it can be examined. + */ + sa.sa_sigaction = CFE_PSP_ExceptionSigHandlerKill; + + /* + * add it back to the mask set. + * This is supposed to be default unless SA_NODEFER flag is set, + * but also setting it here to be sure. + */ + sigaddset(&sa.sa_mask, signo); + } + else + { + /* + * Use default handler which will return to the application + * after logging the event + */ + sa.sa_sigaction = CFE_PSP_ExceptionSigHandler; + } + sa.sa_flags = SA_SIGINFO; + + sigaction(signo, &sa, NULL); +} + +/* +** +** This is called from the CFE Main task, before any other threads +** are started. Use this opportunity to install the handler for +** CTRL+C events, which will now be treated as an exception. +** +** Not only does this clean up the code by NOT requiring a specific +** handler for CTRL+C, it also provides a way to exercise and test +** the exception handling in general, which tends to be infrequently +** invoked because otherwise it only happens with off nominal behavior. +** +** This has yet another benefit that SIGINT events will make their +** way into the exception and reset log, so it is visible why the +** CFE shut down. +*/ + +void CFE_PSP_AttachExceptions(void) +{ +#if 0 + /* + ** VxWorks RTP todo: VxWorks does not support backtrace + */ + void *Addr[1]; + + /* + * preemptively call "backtrace" - + * The manpage notes that backtrace is implemented in libgcc + * which may be dynamically linked with lazy binding. So + * by calling it once we ensure that it is loaded and therefore + * it is safe to use in a signal handler. + */ + backtrace(Addr, 1); +#endif + + OS_printf("CFE_PSP: %s called\n", __func__); + + /* + * Block most other signals during handler execution. + * Exceptions are for synchronous errors SIGFPE/SIGSEGV/SIGILL/SIGBUS + */ + sigfillset(&CFE_PSP_AsyncMask); + sigdelset(&CFE_PSP_AsyncMask, SIGILL); + sigdelset(&CFE_PSP_AsyncMask, SIGFPE); + sigdelset(&CFE_PSP_AsyncMask, SIGBUS); + sigdelset(&CFE_PSP_AsyncMask, SIGSEGV); + + /* + * Install sigint_handler as the signal handler for SIGINT. + * + * In the event that the user presses CTRL+C at the console + * this will be recorded as an exception and use the general + * purpose exception processing logic to shut down CFE. + * + * Also include SIGTERM so it will invoke a graceful shutdown + */ + CFE_PSP_AttachSigHandler(SIGINT); + CFE_PSP_AttachSigHandler(SIGTERM); + CFE_PSP_AttachSigHandler(SIGILL); + CFE_PSP_AttachSigHandler(SIGBUS); + CFE_PSP_AttachSigHandler(SIGSEGV); + + /* + * Clear any pending exceptions. + * + * This is just in case this is a PROCESSOR reset and there + * was something still in the queue from the last lifetime. + * + * It should have been logged already, but if not, then + * don't action on it now. + */ + CFE_PSP_Exception_Reset(); +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_SetDefaultExceptionEnvironment(void) +{ + /* + * This additionally sets a handler for SIGFPE which will catch arithmetic errors + * such as divide by zero. Other possibilities are SIGILL/SIGBUS/SIGSEGV. + * + * This is primarily used as a proof-of-concept on this platform to demonstrate + * how the exception handling feature works. + * + * As the PC-Linux platform is often used for debugging, it is better to + * maintain the default signal handler for the SIGILL/SIGBUS/SIGSEGV which will + * abort the program and generate a core file. + */ + CFE_PSP_AttachSigHandler(SIGFPE); +} + +int32 CFE_PSP_ExceptionGetSummary_Impl(const CFE_PSP_Exception_LogData_t *Buffer, char *ReasonBuf, uint32 ReasonSize) +{ + const char *ComputedReason = "unknown"; + + /* check the "code" within the siginfo structure, which reveals more info about the FP exception */ + if (Buffer->context_info.si.si_signo == SIGFPE) + { + switch (Buffer->context_info.si.si_code) + { + case FPE_INTDIV: + ComputedReason = "Integer divide by zero"; + break; + case FPE_INTOVF: + ComputedReason = "Integer overflow"; + break; + case FPE_FLTDIV: + ComputedReason = "Floating-point divide by zero"; + break; + case FPE_FLTOVF: + ComputedReason = "Floating-point overflow"; + break; + case FPE_FLTUND: + ComputedReason = "Floating-point underflow"; + break; + case FPE_FLTRES: + ComputedReason = "Floating-point inexact result"; + break; + case FPE_FLTINV: + ComputedReason = "Invalid floating-point operation"; + break; + case FPE_FLTSUB: + ComputedReason = "Subscript out of range"; + break; + default: + ComputedReason = "Unknown SIGFPE"; + } + (void)snprintf(ReasonBuf, ReasonSize, "%s at ip 0x%lx", ComputedReason, + (unsigned long)Buffer->context_info.si.si_addr); + } + else if (Buffer->context_info.si.si_signo == SIGINT) + { + /* interrupt e.g. CTRL+C */ + (void)snprintf(ReasonBuf, ReasonSize, "Caught SIGINT"); + } + else + { + /* + * other signal.... + * POSIX 2008 does provide a strsignal() function to get the name, but this + * is a newer spec than what is targeted by CFE, so just print the number. + */ + (void)snprintf(ReasonBuf, ReasonSize, "Caught Signal %d", Buffer->context_info.si.si_signo); + } + + return CFE_PSP_SUCCESS; +} diff --git a/fsw/generic-vxworks-rtp/src/cfe_psp_memory.c b/fsw/generic-vxworks-rtp/src/cfe_psp_memory.c new file mode 100644 index 00000000..723856a3 --- /dev/null +++ b/fsw/generic-vxworks-rtp/src/cfe_psp_memory.c @@ -0,0 +1,796 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_memory.c +** +** VxWorks 7 RTP / POSIX implementation +** +** Purpose: +** cFE PSP Memory related functions. This is the implementation of the cFE +** memory areas that have to be preserved, and the API that is designed to allow +** access to them. It also contains memory related routines to return the +** address of the kernel code used in the cFE checksum. +** +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include + +#include +#include +#include +#include +#include + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +/* +** Types and prototypes for this module +*/ +#include "cfe_psp.h" + +/* +** PSP Specific defines +*/ +#include "cfe_psp_config.h" +#include "cfe_psp_memory.h" + +#include "target_config.h" + +/* +** On VxWorks, POSIX shared memory segments are being used for the +** reserved memory. This memory is preserved when the process quits +** but not when the OS is restarted. +** In VxWorks, the shared memory segments must be created through +** files in the "shmFs" which is mounted at /shm. +** shmFS is a flat file system, so shared memory segments for different +** cFS instances must be uniquely named. +** +** The shared memory segments are named by using a new command line +** parameter: cfsid +** This parameter specifies a prefix for the following shared memory segment file names. +** The default value for cfsid is "cfs1", so the default shared memory segment names are: +** /shm/cfs1.cdsfile +** /shm/cfs1.resetfile +** /shm/cfs1.reservedfile +** +** This allows more than one copy of the cFS to run on VxWorks (in RTPs) by using +** a different cfs id such as "cfs2" +*/ +#define CFE_PSP_SHM_DIR "/shm/" +#define CFE_PSP_CDS_SHM_FILE ".cdsfile" +#define CFE_PSP_RST_SHM_FILE ".resetfile" +#define CFE_PSP_USR_SHM_FILE ".reservedfile" + +/* + * Define the PSP-supported capacities to be the maximum allowed, + * (since the PC-linux PSP has the advantage of abundant disk space to hold this) + */ +#define CFE_PSP_CDS_SIZE (GLOBAL_CONFIGDATA.CfeConfig->CdsSize) +#define CFE_PSP_RESET_AREA_SIZE (GLOBAL_CONFIGDATA.CfeConfig->ResetAreaSize) +#define CFE_PSP_USER_RESERVED_SIZE (GLOBAL_CONFIGDATA.CfeConfig->UserReservedSize) + +#define CFE_PSP_RAM_DISK_SECTOR_SIZE (GLOBAL_CONFIGDATA.CfeConfig->RamDiskSectorSize) +#define CFE_PSP_RAM_DISK_NUM_SECTORS (GLOBAL_CONFIGDATA.CfeConfig->RamDiskTotalSectors) + +typedef struct +{ + CFE_PSP_ReservedMemoryBootRecord_t BootRecord; + CFE_PSP_ExceptionStorage_t ExceptionStorage; +} CFE_PSP_VxWorksReservedAreaFixedLayout_t; + +/* +** Internal prototypes for this module +*/ +void CFE_PSP_InitCDS(void); +void CFE_PSP_InitResetArea(void); +void CFE_PSP_InitVolatileDiskMem(void); +void CFE_PSP_InitUserReservedArea(void); + +/* +** External Declarations +** These symbols mark the start and end of the RTPs code segment. +** Note that this is not the kernel text segment that runs the RTP. +*/ +extern unsigned int _init; +extern unsigned int _fini; + +/* +** Need to access the command line paramter data for cfsid +*/ +extern CFE_PSP_CommandData_t CommandData; + +/* +** Global variables +*/ + +/* +** Pointer to the vxWorks USER_RESERVED_MEMORY area +** The sizes of each memory area is defined in os_processor.h for this architecture. +*/ +CFE_PSP_ReservedMemoryMap_t CFE_PSP_ReservedMemoryMap = {0}; + +/* +********************************************************************************* +** CDS related functions +********************************************************************************* +*/ + +/****************************************************************************** +** +** Purpose: This function is used by the ES startup code to initialize the +** Critical Data store area +** +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ + +void CFE_PSP_InitCDS(void) +{ + int shm_fd; + char shm_name[CFE_PSP_SHM_NAME_LENGTH]; + + memset(shm_name, 0, CFE_PSP_SHM_NAME_LENGTH); + strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH -1); + strncat(shm_name, CommandData.CfsId, strlen(CommandData.CfsId)); + strncat(shm_name, CFE_PSP_CDS_SHM_FILE, strlen(CFE_PSP_CDS_SHM_FILE)); + + /* + ** Try to open an existing shared memory segment. + ** If it fails, create a new one + */ + shm_fd = shm_open(shm_name, O_RDWR, 0666); + if (shm_fd != -1) + { + OS_printf("CFE_PSP: Opened existing CDS shared memory segment\n"); + } + else + { + OS_printf("CFE_PSP: Creating new CDS shared memory segment\n"); + + shm_fd = shm_open(shm_name, O_CREAT | O_RDWR, 0666); + if (shm_fd == -1) + { + perror("CFE_PSP - cannot create new shared memory segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); + } + + ftruncate(shm_fd, CFE_PSP_CDS_SIZE); + } + + /* + ** Map the shared memory object + */ + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr = mmap(0, CFE_PSP_CDS_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); + if ( CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr == MAP_FAILED) + { + perror("CFE_PSP - Cannot map CDS Shared memory Segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); + } + else + { + OS_printf("CFE_PSP: mmap CDS shared memory segment, size = %d\n", CFE_PSP_CDS_SIZE); + } + + CFE_PSP_ReservedMemoryMap.CDSMemory.BlockSize = CFE_PSP_CDS_SIZE; + close(shm_fd); +} + +/****************************************************************************** +** +** Purpose: +** This is an internal function to delete the CDS Shared memory segment. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_DeleteCDS(void) +{ + char shm_name[CFE_PSP_SHM_NAME_LENGTH]; + + memset(shm_name, 0, CFE_PSP_SHM_NAME_LENGTH); + strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH -1); + strncat(shm_name, CommandData.CfsId, strlen(CommandData.CfsId)); + strncat(shm_name, CFE_PSP_CDS_SHM_FILE, strlen(CFE_PSP_CDS_SHM_FILE)); + + shm_unlink(shm_name); + OS_printf("CFE_PSP: CDS Shared memory segment removed\n"); +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS) +{ + int32 return_code; + + if (SizeOfCDS == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *SizeOfCDS = CFE_PSP_CDS_SIZE; + return_code = CFE_PSP_SUCCESS; + } + + return return_code; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_WriteToCDS(const void *PtrToDataToWrite, uint32 CDSOffset, uint32 NumBytes) +{ + uint8 *CopyPtr; + int32 return_code; + + if (PtrToDataToWrite == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE)) + { + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr += CDSOffset; + memcpy(CopyPtr, (char *)PtrToDataToWrite, NumBytes); + + return_code = CFE_PSP_SUCCESS; + } + else + { + return_code = CFE_PSP_ERROR; + } + + } /* end if PtrToDataToWrite == NULL */ + + return return_code; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumBytes) +{ + uint8 *CopyPtr; + int32 return_code; + + if (PtrToDataToRead == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + if ((CDSOffset < CFE_PSP_CDS_SIZE) && ((CDSOffset + NumBytes) <= CFE_PSP_CDS_SIZE)) + { + CopyPtr = CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr; + CopyPtr += CDSOffset; + memcpy((char *)PtrToDataToRead, CopyPtr, NumBytes); + + return_code = CFE_PSP_SUCCESS; + } + else + { + return_code = CFE_PSP_ERROR; + } + + } /* end if PtrToDataToWrite == NULL */ + + return return_code; +} + +/* +********************************************************************************* +** ES Reset Area related functions +********************************************************************************* +*/ + +/****************************************************************************** +** +** Purpose: +** This function is used by the ES startup code to initialize the +** ES Reset Area. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_InitResetArea(void) +{ + + size_t total_size; + size_t reset_offset; + size_t align_mask; + cpuaddr block_addr; + CFE_PSP_VxWorksReservedAreaFixedLayout_t *FixedBlocksPtr; + char shm_name[CFE_PSP_SHM_NAME_LENGTH]; + int shm_fd; + + memset(shm_name, 0, CFE_PSP_SHM_NAME_LENGTH); + strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH -1); + strncat(shm_name, CommandData.CfsId, strlen(CommandData.CfsId)); + strncat(shm_name, CFE_PSP_RST_SHM_FILE, strlen(CFE_PSP_RST_SHM_FILE)); + + /* + * NOTE: Historically the CFE ES reset area also contains the Exception log. + * This is now allocated as a separate structure in the PSP, but it can + * reside in this shared memory segment so it will be preserved on a processor + * reset. + */ + align_mask = 4096 - 1; /* align blocks to whole memory pages */ + total_size = sizeof(CFE_PSP_VxWorksReservedAreaFixedLayout_t); + total_size = (total_size + align_mask) & ~align_mask; + reset_offset = total_size; + total_size += CFE_PSP_RESET_AREA_SIZE; + total_size = (total_size + align_mask) & ~align_mask; + + /* + ** Try to open an existing shared memory segment. + ** If it fails, create a new one + */ + shm_fd = shm_open(shm_name, O_RDWR, 0666); + if (shm_fd != -1) + { + OS_printf("CFE_PSP: Opened existing RST shared memory segment\n"); + } + else + { + OS_printf("CFE_PSP: Creating new CDS shared memory segment\n"); + + shm_fd = shm_open(shm_name, O_CREAT | O_RDWR, 0666); + if (shm_fd == -1) + { + perror("CFE_PSP - cannot create new shared memory segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); + } + + ftruncate(shm_fd, total_size); + } + + /* + ** Map the shared memory object + */ + block_addr = (cpuaddr)mmap(0, total_size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); + if ( block_addr == (cpuaddr)MAP_FAILED) + { + perror("CFE_PSP - Cannot map RST Shared memory Segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); + } + else + { + OS_printf("CFE_PSP: mmap RST shared memory segment, size = %zu\n", total_size); + } + + FixedBlocksPtr = (CFE_PSP_VxWorksReservedAreaFixedLayout_t *)block_addr; + block_addr += reset_offset; + + CFE_PSP_ReservedMemoryMap.BootPtr = &FixedBlocksPtr->BootRecord; + CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr = &FixedBlocksPtr->ExceptionStorage; + + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr = (void *)block_addr; + CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize = CFE_PSP_RESET_AREA_SIZE; + close(shm_fd); +} + +/****************************************************************************** +** +** Purpose: +** This is an internal function to delete the Reset Area Shared memory segment. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_DeleteResetArea(void) +{ + char shm_name[CFE_PSP_SHM_NAME_LENGTH]; + + memset(shm_name, 0, CFE_PSP_SHM_NAME_LENGTH); + strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH -1); + strncat(shm_name, CommandData.CfsId, strlen(CommandData.CfsId)); + strncat(shm_name, CFE_PSP_RST_SHM_FILE, strlen(CFE_PSP_RST_SHM_FILE)); + + shm_unlink(shm_name); + OS_printf("CFE_PSP: RST Shared memory segment removed\n"); +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetResetArea(cpuaddr *PtrToResetArea, uint32 *SizeOfResetArea) +{ + int32 return_code; + + if (SizeOfResetArea == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToResetArea = (cpuaddr)CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr; + *SizeOfResetArea = CFE_PSP_ReservedMemoryMap.ResetMemory.BlockSize; + return_code = CFE_PSP_SUCCESS; + } + + return return_code; +} + +/* +********************************************************************************* +** ES User Reserved Area related functions +********************************************************************************* +*/ + +/****************************************************************************** +** +** Purpose: +** This function is used by the ES startup code to initialize the +** ES user reserved area. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_InitUserReservedArea(void) +{ + int shm_fd; + char shm_name[CFE_PSP_SHM_NAME_LENGTH]; + + memset(shm_name, 0, CFE_PSP_SHM_NAME_LENGTH); + strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH -1); + strncat(shm_name, CommandData.CfsId, strlen(CommandData.CfsId)); + strncat(shm_name, CFE_PSP_USR_SHM_FILE, strlen(CFE_PSP_USR_SHM_FILE)); + + /* + ** Try to open an existing shared memory segment. + ** If it fails, create a new one + */ + shm_fd = shm_open(shm_name, O_RDWR, 0666); + if (shm_fd != -1) + { + OS_printf("CFE_PSP: Opened existing USR shared memory segment\n"); + } + else + { + OS_printf("CFE_PSP: Creating new USR shared memory segment\n"); + shm_fd = shm_open(shm_name, O_CREAT | O_RDWR, 0666); + if (shm_fd == -1) + { + perror("CFE_PSP - cannot create new shared memory segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); + } + + ftruncate(shm_fd, CFE_PSP_USER_RESERVED_SIZE); + } + + /* + ** Map the shared memory object + */ + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr = mmap(0, CFE_PSP_USER_RESERVED_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0); + if ( CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr == MAP_FAILED) + { + perror("CFE_PSP - Cannot map USR Shared memory Segment"); + CFE_PSP_Panic(CFE_PSP_ERROR); + printf("PSP: error calling mmap! (USR)\n"); + } + else + { + OS_printf("CFE_PSP: mmap USR shared memory segment, size = %d\n", CFE_PSP_USER_RESERVED_SIZE); + } + CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize = CFE_PSP_USER_RESERVED_SIZE; + close(shm_fd); + +} + +/****************************************************************************** +** +** Purpose: +** This is an internal function to delete the User Reserved Shared memory segment. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_DeleteUserReservedArea(void) +{ + char shm_name[CFE_PSP_SHM_NAME_LENGTH]; + + memset(shm_name, 0, CFE_PSP_SHM_NAME_LENGTH); + strncpy(shm_name, CFE_PSP_SHM_DIR, CFE_PSP_SHM_NAME_LENGTH -1); + strncat(shm_name, CommandData.CfsId, strlen(CommandData.CfsId)); + strncat(shm_name, CFE_PSP_USR_SHM_FILE, strlen(CFE_PSP_USR_SHM_FILE)); + + shm_unlink(shm_name); + OS_printf("CFE_PSP: USR Reserved Shared memory segment removed\n"); +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetUserReservedArea(cpuaddr *PtrToUserArea, uint32 *SizeOfUserArea) +{ + int32 return_code; + + if (SizeOfUserArea == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToUserArea = (cpuaddr)CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr; + *SizeOfUserArea = CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockSize; + return_code = CFE_PSP_SUCCESS; + } + + return return_code; +} + +/* +********************************************************************************* +** ES Volatile disk memory related functions +********************************************************************************* +*/ + +/****************************************************************************** +** +** Purpose: +** This function is used by the ES startup code to initialize the memory +** used by the volatile disk. On a desktop/posix platform this is currently +** a no-op, because the volatile disk is being mapped to the desktop. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_InitVolatileDiskMem(void) +{ + /* + ** Here, we want to clear out the volatile ram disk contents + ** on a power on reset + */ +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetVolatileDiskMem(cpuaddr *PtrToVolDisk, uint32 *SizeOfVolDisk) +{ + int32 return_code; + + if (SizeOfVolDisk == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToVolDisk = (cpuaddr)CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockPtr; + *SizeOfVolDisk = CFE_PSP_ReservedMemoryMap.VolatileDiskMemory.BlockSize; + return_code = CFE_PSP_SUCCESS; + } + + return return_code; +} + +/* +********************************************************************************* +** ES BSP Top Level Reserved memory initialization +********************************************************************************* +*/ + +/****************************************************************************** +** +** Purpose: +** This function performs the top level reserved memory initialization. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_SetupReservedMemoryMap(void) +{ + /* + * The setup of each section is done as a separate init. + * + * Any failures within these routines call exit(), so there + * is no need to check status - failure means no return. + */ + + CFE_PSP_InitCDS(); + CFE_PSP_InitResetArea(); + CFE_PSP_InitVolatileDiskMem(); + CFE_PSP_InitUserReservedArea(); + + /* + * Set up the "RAM" entry in the memory table. + * On Linux this is just encompasses the entire memory space, but an entry needs + * to exist so that CFE_PSP_ValidateMemRange() works as intended. + */ + CFE_PSP_MemRangeSet(0, CFE_PSP_MEM_RAM, 0, SIZE_MAX, CFE_PSP_MEM_SIZE_DWORD, CFE_PSP_MEM_ATTR_READWRITE); +} + +int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) +{ + /* + * Clear the segments only on a POWER ON reset + * + * Newly-created segments should already be zeroed out, + * but this ensures it. + */ + if (RestartType == CFE_PSP_RST_TYPE_POWERON) + { + OS_printf("CFE_PSP: Clearing out CFE CDS Shared memory segment.\n"); + memset(CFE_PSP_ReservedMemoryMap.CDSMemory.BlockPtr, 0, CFE_PSP_CDS_SIZE); + OS_printf("CFE_PSP: Clearing out CFE Reset Shared memory segment.\n"); + memset(CFE_PSP_ReservedMemoryMap.ResetMemory.BlockPtr, 0, CFE_PSP_RESET_AREA_SIZE); + OS_printf("CFE_PSP: Clearing out CFE User Reserved Shared memory segment.\n"); + memset(CFE_PSP_ReservedMemoryMap.UserReservedMemory.BlockPtr, 0, CFE_PSP_USER_RESERVED_SIZE); + + memset(CFE_PSP_ReservedMemoryMap.BootPtr, 0, sizeof(*CFE_PSP_ReservedMemoryMap.BootPtr)); + memset(CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr, 0, + sizeof(*CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr)); + + /* + * If an unclean shutdown occurs, try to do a PROCESSOR reset next. + * This will attempt to preserve the exception and reset log content. + */ + CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType = CFE_PSP_RST_TYPE_PROCESSOR; + } + else + { + /* + * If an unclean shutdown occurs after a PROCESSOR reset, then next time should + * be a POWERON reset. + */ + CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType = CFE_PSP_RST_TYPE_POWERON; + } + + /* + * Reset the boot record validity flag (always). + * + * If an unclean shutdown occurs, such as a software crash or abort, this + * will remain in the shm structure and it can be detected at startup. + * + * This can be used to differentiate between an intentional and unintentional + * processor reset. + * + * If a directed shutdown occurs (via CFE_PSP_Restart) then this + * is overwritten with the valid value. + */ + CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag = CFE_PSP_BOOTRECORD_INVALID; + + return CFE_PSP_SUCCESS; +} + +/****************************************************************************** +** +** Purpose: +** This function cleans up all of the shared memory segments in the +** Linux/OSX ports. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_DeleteProcessorReservedMemory(void) +{ + CFE_PSP_DeleteCDS(); + CFE_PSP_DeleteResetArea(); + CFE_PSP_DeleteUserReservedArea(); +} + +/* +********************************************************************************* +** ES BSP kernel memory segment functions +********************************************************************************* +*/ + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetKernelTextSegmentInfo(cpuaddr *PtrToKernelSegment, uint32 *SizeOfKernelSegment) +{ + /* Check pointers */ + if (PtrToKernelSegment == NULL || SizeOfKernelSegment == NULL) + { + return CFE_PSP_ERROR; + } + + /* Set to known values */ + *PtrToKernelSegment = (cpuaddr)0x0; + *SizeOfKernelSegment = 0; + + return CFE_PSP_ERROR_NOT_IMPLEMENTED; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFESegment) +{ + int32 return_code; + + if (SizeOfCFESegment == NULL) + { + return_code = CFE_PSP_ERROR; + } + else + { + *PtrToCFESegment = (cpuaddr)(&_init); + *SizeOfCFESegment = (uint32)(((cpuaddr)&_fini) - ((cpuaddr)&_init)); + + return_code = CFE_PSP_SUCCESS; + } + + return return_code; +} diff --git a/fsw/generic-vxworks-rtp/src/cfe_psp_ssr.c b/fsw/generic-vxworks-rtp/src/cfe_psp_ssr.c new file mode 100644 index 00000000..40283654 --- /dev/null +++ b/fsw/generic-vxworks-rtp/src/cfe_psp_ssr.c @@ -0,0 +1,63 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_ssr.c +** +** Purpose: +** This file contains glue routines between the cFE and the OS Board Support Package ( BSP ). +** The functions here allow the cFE to interface functions that are board and OS specific +** and usually don't fit well in the OS abstraction layer. +** +** History: +** 2005/06/05 Alan Cudmore | Initial version, +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include +#include "vxWorks.h" + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +/* +** Types and prototypes for this module +*/ +#include "cfe_psp.h" +#include "cfe_psp_memory.h" + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName) +{ + int32 ReturnCode = CFE_PSP_SUCCESS; + + return ReturnCode; +} diff --git a/fsw/generic-vxworks-rtp/src/cfe_psp_start.c b/fsw/generic-vxworks-rtp/src/cfe_psp_start.c new file mode 100644 index 00000000..cbbee545 --- /dev/null +++ b/fsw/generic-vxworks-rtp/src/cfe_psp_start.c @@ -0,0 +1,600 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_start.c +** +** Purpose: +** cFE PSP main entry point. +** +** History: +** 2004/09/23 J.P. Swinski | Initial version, +** 2004/10/01 P.Kutt | Replaced OS API task delay with VxWorks functions +** since OS API is initialized later. +** 2016/04/07 M.Grubb | Updated for PSP version 1.3 +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include +#include +#include +#include +#include +#include "vxWorks.h" + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +#include "cfe_psp.h" +#include "cfe_psp_memory.h" +#include "cfe_psp_module.h" + +#include "parg.h" + +/* +** External Declarations +*/ + +/* + * The preferred way to obtain the CFE tunable values at runtime is via + * the dynamically generated configuration object. This allows a single build + * of the PSP to be completely CFE-independent. + */ +#include "target_config.h" + +#define CFE_PSP_MAIN_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->SystemMain) +#define CFE_PSP_1HZ_FUNCTION (*GLOBAL_CONFIGDATA.CfeConfig->System1HzISR) +#define CFE_PSP_NONVOL_STARTUP_FILE (GLOBAL_CONFIGDATA.CfeConfig->NonvolStartupFile) +#define CFE_PSP_CPU_ID (GLOBAL_CONFIGDATA.Default_CpuId) +#define CFE_PSP_CPU_NAME (GLOBAL_CONFIGDATA.Default_CpuName) +#define CFE_PSP_SPACECRAFT_ID (GLOBAL_CONFIGDATA.Default_SpacecraftId) + +#define CFE_PSP_KERNEL_NAME_LENGTH_MAX 16 + +/* +** Typedefs for this module +*/ + +/* +** Prototypes for this module +*/ +void CFE_PSP_DisplayUsage(char *Name); +void CFE_PSP_ProcessArgumentDefaults(CFE_PSP_CommandData_t *CommandDataDefault); + +/* +** Global data for this module +*/ +CFE_PSP_CommandData_t CommandData; +int32 CFE_PSP_SpacecraftId; +uint32 CFE_PSP_CpuId; +char CFE_PSP_CpuName[CFE_PSP_CPU_NAME_LENGTH]; +CFE_PSP_IdleTaskState_t CFE_PSP_IdleTaskState; + +/* +** getopts parameter passing options string +*/ +static const char *optString = "R:S:C:I:N:F:h"; + +/* +** getopts_long long form argument table +*/ +static const struct parg_option longOpts[] = {{"reset", PARG_REQARG, NULL, 'R'}, + {"subtype", PARG_REQARG, NULL, 'S'}, + {"cpuid", PARG_REQARG, NULL, 'C'}, + {"scid", PARG_REQARG, NULL, 'I'}, + {"cpuname", PARG_REQARG, NULL, 'N'}, + {"cfsid", PARG_REQARG, NULL, 'F'}, + {"help", PARG_NOARG, NULL, 'h'}, + {NULL, PARG_NOARG, NULL, 0}}; +/* +** OS_Application_Run is called by the OSAL BSP after initialization +*/ +void OS_Application_Run(void) +{ + int sig; + int ret; + sigset_t sigset; + + /* + * Now that all main tasks are created, + * this original thread will exist just to service signals + * that aren't directed to a specific task. + * + * OSAL sets a very conservative signal mask that + * blocks most signals. Start by unblocking the + * ones that should be handled. + * + * Unblock SIGQUIT so the user can force exit the CFE + * by pressing CTRL+\ (default handler). Also allow + * SIGTERM for which a handler was installed in CFE_PSP_AttachExceptions() + * Unblock SIGCNCL to allow pthread_cancel to work on this thread. + */ + sigemptyset(&sigset); + sigaddset(&sigset, SIGQUIT); + sigaddset(&sigset, SIGTERM); + sigaddset(&sigset, SIGCNCL); + pthread_sigmask(SIG_UNBLOCK, &sigset, NULL); + + /* + * Reset to the signal for background events (SIGUSR1) + */ + sigemptyset(&sigset); + sigaddset(&sigset, CFE_PSP_EXCEPTION_EVENT_SIGNAL); + + /* + ** just wait for events to occur and notify CFE + ** + ** "shutdownreq" will become true if CFE calls CFE_PSP_Restart(), + ** indicating a request to gracefully exit and restart CFE. + */ + while (!CFE_PSP_IdleTaskState.ShutdownReq) + { + /* go idle and wait for an event */ + ret = sigwait(&sigset, &sig); + + if (ret == 0 && !CFE_PSP_IdleTaskState.ShutdownReq && sig == CFE_PSP_EXCEPTION_EVENT_SIGNAL && + GLOBAL_CFE_CONFIGDATA.SystemNotify != NULL) + { + /* notify the CFE of the event */ + GLOBAL_CFE_CONFIGDATA.SystemNotify(); + } + } + + /* + * This happens if an unhandled exception occurs, or if the user presses CTRL+C + */ + OS_printf("\nCFE_PSP: Shutdown initiated - Exiting cFE\n"); + OS_TaskDelay(100); + + OS_DeleteAllObjects(); +} + +/* +** CFE_PSP_OS_EventHandler +** +** This function is called by the OSAL to handle specific events +** such as task creation and deletion. +** +** Note that some of the items here are a work in progress: +** - setting the processor affinity of tasks +** - assigning a name to each task using the non-posix pthread_setname_np +** - this is commented out because it is not supported in vxWorks SR0650 +*/ +int32 CFE_PSP_OS_EventHandler(OS_Event_t event, osal_id_t object_id, void *data) +{ + char taskname[OS_MAX_API_NAME]; + sigset_t sigset; + + /* + ** VxWorks RTP work todo: enable processor affinity + ** cpu_set_t cpuset; + */ + + memset(taskname, 0, sizeof(taskname)); + + switch (event) + { + case OS_EVENT_RESOURCE_ALLOCATED: + /* resource/id is newly allocated but not yet created. Invoked within locked region. */ + break; + case OS_EVENT_RESOURCE_CREATED: + /* resource/id has been fully created/finalized. Invoked outside locked region. */ + break; + case OS_EVENT_RESOURCE_DELETED: + /* resource/id has been deleted. Invoked outside locked region. */ + break; + case OS_EVENT_TASK_STARTUP: + { + /* New task is starting. Invoked from within the task context. */ + /* Get the name from OSAL and propagate to the pthread/system layer */ + if (OS_GetResourceName(object_id, taskname, sizeof(taskname)) == OS_SUCCESS) + { + /* + * Example mechanism for setting thread affinity + * + * Could assign based on task name, pattern within name (CFE_* on 0, + * *_CN where N is desired core), round robin or whatever the requrements are. + * + * Just assigning all "CFE_*" tasks to core zero and let the rest float. + */ + /* + ** VxWorks RTP work todo: enable processor affinity + ** if (strncmp(taskname, "CFE_", 4) == 0) + ** { + ** CPU_ZERO(&cpuset); + ** CPU_SET(0, &cpuset); + ** pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset); + ** } + */ + /* + * glibc/kernel has an internal limit for this name. + * If the OSAL name is longer, just truncate it. + * Otherwise the name isn't set at all - this assumes the first + * chars of the name is better for debug than none of it. + */ + if (strlen(taskname) >= CFE_PSP_KERNEL_NAME_LENGTH_MAX) + { + taskname[CFE_PSP_KERNEL_NAME_LENGTH_MAX - 1] = 0; + } + /* pthread_setname_np is not in the VxWorks SR650 SDK */ + /* SR0650 supports pthread_attr_setname, but that would require an OSAL modification */ + /* pthread_setname_np(pthread_self(), taskname); */ + + /* + ** Unblock the SIGCNCL signal used by VxWorks pthread_cancel implementation + */ + sigemptyset(&sigset); + sigaddset(&sigset, SIGCNCL); + pthread_sigmask(SIG_UNBLOCK, &sigset, NULL); + } + break; + } + + default: + break; + } + + return OS_SUCCESS; +} + +/****************************************************************************** +** +** Purpose: +** Application startup entry point from OSAL BSP. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void OS_Application_Startup(void) +{ + uint32 reset_type; + uint32 reset_subtype; + osal_id_t fs_id; + int opt = 0; + int longIndex = 0; + int32 Status; + char *const *argv; + int argc; + struct parg_state ps; + + /* + ** Initialize the CommandData struct + */ + memset(&(CommandData), 0, sizeof(CFE_PSP_CommandData_t)); + + /* + ** Process the arguments with getopt_long(), then + ** start the cFE + */ + argc = OS_BSP_GetArgC(); + argv = OS_BSP_GetArgV(); + + parg_init(&ps); + opt = parg_getopt_long(&ps, argc, argv, optString, longOpts, &longIndex); + + while (opt != -1) + { + switch (opt) + { + case 'R': + strncpy(CommandData.ResetType, ps.optarg, CFE_PSP_RESET_NAME_LENGTH - 1); + CommandData.ResetType[CFE_PSP_RESET_NAME_LENGTH - 1] = 0; + + if ((strncmp(CommandData.ResetType, "PO", CFE_PSP_RESET_NAME_LENGTH) != 0) && + (strncmp(CommandData.ResetType, "PR", CFE_PSP_RESET_NAME_LENGTH) != 0)) + { + printf("\nERROR: Invalid Reset Type: %s\n\n", CommandData.ResetType); + CommandData.GotResetType = 0; + CFE_PSP_DisplayUsage(argv[0]); + break; + } + printf("CFE_PSP: Reset Type: %s\n", (char *)ps.optarg); + CommandData.GotResetType = 1; + break; + case 'S': + CommandData.SubType = strtol(ps.optarg, NULL, 0); + if (CommandData.SubType < 1 || CommandData.SubType > 5) + { + printf("\nERROR: Invalid Reset SubType: %s\n\n", ps.optarg); + CommandData.SubType = 0; + CommandData.GotSubType = 0; + CFE_PSP_DisplayUsage(argv[0]); + break; + } + printf("CFE_PSP: Reset SubType: %d\n", (int)CommandData.SubType); + CommandData.GotSubType = 1; + break; + + case 'N': + strncpy(CommandData.CpuName, ps.optarg, CFE_PSP_CPU_NAME_LENGTH - 1); + CommandData.CpuName[CFE_PSP_CPU_NAME_LENGTH - 1] = 0; + printf("CFE_PSP: CPU Name: %s\n", CommandData.CpuName); + CommandData.GotCpuName = 1; + break; + + case 'C': + CommandData.CpuId = strtol(ps.optarg, NULL, 0); + printf("CFE_PSP: CPU ID: %d\n", (int)CommandData.CpuId); + CommandData.GotCpuId = 1; + break; + + case 'I': + CommandData.SpacecraftId = strtol(ps.optarg, NULL, 0); + printf("CFE_PSP: Spacecraft ID: %d\n", (int)CommandData.SpacecraftId); + CommandData.GotSpacecraftId = 1; + break; + + case 'F': + strncpy(CommandData.CfsId, ps.optarg, CFE_PSP_CFS_ID_LENGTH - 1); + CommandData.CfsId[CFE_PSP_CFS_ID_LENGTH - 1] = 0; + printf("CFE_PSP: cFS ID: %s\n", CommandData.CfsId); + CommandData.GotCfsId = 1; + break; + + case 'h': + CFE_PSP_DisplayUsage(argv[0]); + break; + + default: + CFE_PSP_DisplayUsage(argv[0]); + break; + } + opt = parg_getopt_long(&ps, argc, argv, optString, longOpts, &longIndex); + } /* end while */ + + /* + ** Set the defaults for values that were not given for the + ** optional arguments, and check for arguments that are required. + */ + CFE_PSP_ProcessArgumentDefaults(&CommandData); + + /* + ** Assign the Spacecraft ID, CPU ID, and CPU Name + */ + CFE_PSP_SpacecraftId = CommandData.SpacecraftId; + CFE_PSP_CpuId = CommandData.CpuId; + strncpy(CFE_PSP_CpuName, CommandData.CpuName, sizeof(CFE_PSP_CpuName) - 1); + CFE_PSP_CpuName[sizeof(CFE_PSP_CpuName) - 1] = 0; + + /* + ** Set the reset subtype + */ + reset_subtype = CommandData.SubType; + + /* + ** Initialize the OS API + */ + Status = OS_API_Init(); + if (Status != OS_SUCCESS) + { + /* irrecoverable error if OS_API_Init() fails. */ + /* note: use printf here, as OS_printf may not work */ + printf("CFE_PSP: OS_API_Init() failure\n"); + CFE_PSP_Panic(Status); + + /* + * normally CFE_PSP_Panic() does not return, except + * during unit testing. This return avoids executing + * the rest of this function in that case. + */ + return; + } + + /* + ** Set up the virtual FS mapping for the "/cf" directory + ** On this platform it will use the CF:0 physical device. + ** + ** VxWorks RTP TODO: Possibly pass the CF path with a command line option + ** to make this more portable. + */ +#ifdef VXSDK_RPI4 + Status = OS_FileSysAddFixedMap(&fs_id, "/sd0a/cpu1/cf", "/cf"); +#else + Status = OS_FileSysAddFixedMap(&fs_id, "/host.host/cpu1/cf", "/cf"); +#endif + if (Status != OS_SUCCESS) + { + /* Print for informational purposes -- + * startup can continue, but loads may fail later, depending on config. */ + OS_printf("CFE_PSP: OS_FileSysAddFixedMap() failure: %d\n", (int)Status); + } + + /* + ** Register the event handler + */ + OS_RegisterEventHandler(CFE_PSP_OS_EventHandler); + + /* + ** Setup the pointer to the reserved area in vxWorks. + ** This must be done before any of the reset variables are used. + */ + CFE_PSP_SetupReservedMemoryMap(); + + /* + ** Initialize the statically linked modules (if any) + */ + CFE_PSP_ModuleInit(); + + /* + * Prepare for exception handling in the idle task + */ + memset(&CFE_PSP_IdleTaskState, 0, sizeof(CFE_PSP_IdleTaskState)); + CFE_PSP_IdleTaskState.ThreadID = pthread_self(); + + /* + * determine reset type... + * If not specified at the command line, then check the "boot record" + */ + reset_type = 0; + if (!CommandData.GotResetType) + { + reset_type = CFE_PSP_RST_TYPE_POWERON; + if (CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_VALID || + CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag == CFE_PSP_BOOTRECORD_INVALID) + { + reset_type = CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType; + } + } + else if (strncmp("PR", CommandData.ResetType, 2) == 0) + { + reset_type = CFE_PSP_RST_TYPE_PROCESSOR; + } + + if (reset_type == CFE_PSP_RST_TYPE_PROCESSOR) + { + OS_printf("CFE_PSP: Starting the cFE with a PROCESSOR reset.\n"); + } + else + { + /* catch-all for anything else */ + reset_type = CFE_PSP_RST_TYPE_POWERON; + OS_printf("CFE_PSP: Starting the cFE with a POWER ON reset.\n"); + } + + /* + * If CFE fails to boot with a processor reset, + * then make sure next time it uses a power on reset. + */ + if (reset_type == CFE_PSP_RST_TYPE_PROCESSOR) + { + CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_POWERON; + } + + /* + ** Initialize the reserved memory + */ + CFE_PSP_InitProcessorReservedMemory(reset_type); + + /* + ** Call cFE entry point. This will return when cFE startup + ** is complete. + */ + CFE_PSP_MAIN_FUNCTION(reset_type, reset_subtype, 1, CFE_PSP_NONVOL_STARTUP_FILE); +} + +/****************************************************************************** +** +** Purpose: +** Display program usage, and exit. +** +** Arguments: +** Name -- the name of the binary. +** +** Return: +** (none) +*/ +void CFE_PSP_DisplayUsage(char *Name) +{ + printf("usage : %s [-R ] [-S ] [-C GotSubType == 0) + { + CommandDataDefault->SubType = 1; + printf("CFE_PSP: Default Reset SubType = 1\n"); + CommandDataDefault->GotSubType = 1; + } + + if (CommandDataDefault->GotCpuId == 0) + { + CommandDataDefault->CpuId = CFE_PSP_CPU_ID; + printf("CFE_PSP: Default CPU ID = %d\n", CFE_PSP_CPU_ID); + CommandDataDefault->GotCpuId = 1; + } + + if (CommandDataDefault->GotSpacecraftId == 0) + { + CommandDataDefault->SpacecraftId = CFE_PSP_SPACECRAFT_ID; + printf("CFE_PSP: Default Spacecraft ID = %d\n", CFE_PSP_SPACECRAFT_ID); + CommandDataDefault->GotSpacecraftId = 1; + } + + if (CommandDataDefault->GotCpuName == 0) + { + strncpy(CommandDataDefault->CpuName, CFE_PSP_CPU_NAME, CFE_PSP_CPU_NAME_LENGTH - 1); + CommandDataDefault->CpuName[CFE_PSP_CPU_NAME_LENGTH - 1] = 0; + printf("CFE_PSP: Default CPU Name: %s\n", CFE_PSP_CPU_NAME); + CommandDataDefault->GotCpuName = 1; + } + + if (CommandDataDefault->GotCfsId == 0) + { + strncpy(CommandDataDefault->CfsId, CFE_PSP_CFS_ID, CFE_PSP_CFS_ID_LENGTH - 1); + CommandDataDefault->CfsId[CFE_PSP_CFS_ID_LENGTH - 1] = 0; + printf("CFE_PSP: Default cFS ID: %s\n", CFE_PSP_CFS_ID); + CommandDataDefault->GotCfsId = 1; + } +} + diff --git a/fsw/generic-vxworks-rtp/src/cfe_psp_support.c b/fsw/generic-vxworks-rtp/src/cfe_psp_support.c new file mode 100644 index 00000000..bf428502 --- /dev/null +++ b/fsw/generic-vxworks-rtp/src/cfe_psp_support.c @@ -0,0 +1,165 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_support.c +** +** Purpose: +** This file contains glue routines between the cFE and the OS Board Support Package ( BSP ). +** The functions here allow the cFE to interface functions that are board and OS specific +** and usually don't fit well in the OS abstraction layer. +** +******************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include +#include + +#include "common_types.h" +#include "osapi.h" + +/* +** Types and prototypes for this module +*/ +#include "cfe_psp.h" +#include "cfe_psp_config.h" +#include "cfe_psp_memory.h" + +/* +** External Variables +*/ +extern uint32 CFE_PSP_SpacecraftId; +extern uint32 CFE_PSP_CpuId; +extern char CFE_PSP_CpuName[]; + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_Restart(uint32 resetType) +{ + if (resetType == CFE_PSP_RST_TYPE_POWERON) + { + OS_printf("CFE_PSP: Exiting cFE with POWERON Reset status.\n"); + + /* Also delete the SHM segments, so they will be recreated on next boot */ + /* Deleting these memories will unlink them, but active references should still work */ + CFE_PSP_DeleteProcessorReservedMemory(); + } + else + { + OS_printf("CFE_PSP: Exiting cFE with PROCESSOR Reset status.\n"); + } + + /* + * Record the reset type for the next boot. + */ + CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType = resetType; + CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag = CFE_PSP_BOOTRECORD_VALID; + + /* + * Begin process of orderly shutdown. + * + * This should cause the original thread (main task) to wake up + * and start the shutdown procedure. + */ + CFE_PSP_IdleTaskState.ShutdownReq = true; + pthread_kill(CFE_PSP_IdleTaskState.ThreadID, CFE_PSP_EXCEPTION_EVENT_SIGNAL); + + /* + * Give time for the orderly shutdown to occur. + * + * Normally during shutdown this task will be deleted, and therefore + * this does not return. + * + * However, if problems occur (e.g. deadlock) eventually this timeout + * will expire and return. + */ + OS_TaskDelay(CFE_PSP_RESTART_DELAY); + + /* + * Timeout expired without this task being deleted, so abort(). + * + * This should generate a core file to reveal what went wrong + * with normal shutdown. + */ + abort(); +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_Panic(int32 ErrorCode) +{ + OS_printf("%s called with error code = 0x%08X. Exiting.\n", __func__, (unsigned int)ErrorCode); + OS_printf("The cFE could not start.\n"); + abort(); /* abort() is preferable to exit(EXIT_FAILURE), as it may create a core file for debug */ +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size) +{ + printf("%s called -- Currently no Linux/OSX/Cygwin implementation\n", __func__); +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +uint32 CFE_PSP_GetProcessorId(void) +{ + return CFE_PSP_CpuId; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +uint32 CFE_PSP_GetSpacecraftId(void) +{ + return CFE_PSP_SpacecraftId; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +const char *CFE_PSP_GetProcessorName(void) +{ + return CFE_PSP_CpuName; +} diff --git a/fsw/generic-vxworks-rtp/src/cfe_psp_watchdog.c b/fsw/generic-vxworks-rtp/src/cfe_psp_watchdog.c new file mode 100644 index 00000000..4a24dc1d --- /dev/null +++ b/fsw/generic-vxworks-rtp/src/cfe_psp_watchdog.c @@ -0,0 +1,134 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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_psp_watchdog.c +** +** Purpose: +** This file contains glue routines between the cFE and the OS Board Support Package ( BSP ). +** The functions here allow the cFE to interface functions that are board and OS specific +** and usually don't fit well in the OS abstraction layer. +** +** History: +** 2009/07/20 A. Cudmore | Initial version, +** +*************************************************************************************************/ + +/* +** Include Files +*/ + +/* +** cFE includes +*/ +#include "common_types.h" +#include "osapi.h" + +/* +** System Include Files +*/ +#include +#include +#include +#include "vxWorks.h" + +/* +** Types and prototypes for this module +*/ +#include "cfe_psp.h" +#include "cfe_psp_config.h" + +/* +** Global data +*/ + +/* +** The watchdog time in milliseconds +*/ +uint32 CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogInit(void) +{ + /* + ** Just set it to a value right now + ** The pc-linux desktop platform does not actually implement a watchdog + ** timeout ( but could with a signal ) + */ + CFE_PSP_WatchdogValue = CFE_PSP_WATCHDOG_MAX; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogEnable(void) +{ + return; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogDisable(void) +{ + return; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogService(void) +{ + return; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +uint32 CFE_PSP_WatchdogGet(void) +{ + return CFE_PSP_WatchdogValue; +} + +/*---------------------------------------------------------------- + * + * Implemented per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_WatchdogSet(uint32 WatchdogValue) +{ + CFE_PSP_WatchdogValue = WatchdogValue; +} diff --git a/fsw/inc/cfe_psp.h b/fsw/inc/cfe_psp.h index 789d2c53..a1951245 100644 --- a/fsw/inc/cfe_psp.h +++ b/fsw/inc/cfe_psp.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -38,6 +38,7 @@ #include "common_types.h" #include "osapi.h" +#include "pspconfig.h" /* * All PSP API sub-components @@ -61,6 +62,22 @@ #include "cfe_psp_version_api.h" #include "cfe_psp_watchdog_api.h" +/* + * The "PSP_DEBUG" is a no-op unless PSP_CONFIG_DEBUG_PRINTF is enabled. + * When enabled, it is a macro that includes function/line number info. + */ +#if defined(PSP_CONFIG_DEBUG_PRINTF) +extern void PSP_DebugPrintf(uint32 Level, const char *Func, uint32 Line, const char *Format, ...); +/* Debug printfs are compiled in, but also can be disabled by a run-time flag. + * Note that the ##__VA_ARGS__ syntax works on GCC but might need tweaks for other compilers... */ +#define PSP_DEBUG_LEV(l, ...) PSP_DebugPrintf(l, __func__, __LINE__, __VA_ARGS__); +#define PSP_DEBUG(...) PSP_DEBUG_LEV(1, __VA_ARGS__) +#else +/* Debug printfs are not compiled in at all */ +#define PSP_DEBUG_LEV(l, ...) +#define PSP_DEBUG(...) +#endif + /****************************************************************************** FUNCTION PROTOTYPES ******************************************************************************/ diff --git a/fsw/inc/cfe_psp_cache_api.h b/fsw/inc/cfe_psp_cache_api.h index 43a97b12..d460f33c 100644 --- a/fsw/inc/cfe_psp_cache_api.h +++ b/fsw/inc/cfe_psp_cache_api.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/inc/cfe_psp_cds_api.h b/fsw/inc/cfe_psp_cds_api.h index 995c7bce..423361aa 100644 --- a/fsw/inc/cfe_psp_cds_api.h +++ b/fsw/inc/cfe_psp_cds_api.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/inc/cfe_psp_eepromaccess_api.h b/fsw/inc/cfe_psp_eepromaccess_api.h index 492f4333..e5db7049 100644 --- a/fsw/inc/cfe_psp_eepromaccess_api.h +++ b/fsw/inc/cfe_psp_eepromaccess_api.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/inc/cfe_psp_endian.h b/fsw/inc/cfe_psp_endian.h new file mode 100644 index 00000000..5492105c --- /dev/null +++ b/fsw/inc/cfe_psp_endian.h @@ -0,0 +1,53 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * + * Map the PSP endian conversion routines to the system-provided endian.h file + * This is done using static inline functions, such that the result should be + * optimized as much as possible. + */ + +#ifndef CFE_PSP_ENDIAN_H +#define CFE_PSP_ENDIAN_H + +/* +** Include Files +*/ +#include "common_types.h" + +uint16 CFE_PSP_HtoBE16(uint16 host_16bits); +uint16 CFE_PSP_HtoLE16(uint16 host_16bits); +uint16 CFE_PSP_BE16toH(uint16 big_endian_16bits); +uint16 CFE_PSP_LE16toH(uint16 little_endian_16bits); + +uint32 CFE_PSP_HtoBE32(uint32 host_32bits); +uint32 CFE_PSP_HtoLE32(uint32 host_32bits); +uint32 CFE_PSP_BE32toH(uint32 big_endian_32bits); +uint32 CFE_PSP_LE32toH(uint32 little_endian_32bits); + +uint64 CFE_PSP_HtoBE64(uint64 host_64bits); +uint64 CFE_PSP_HtoLE64(uint64 host_64bits); +uint64 CFE_PSP_BE64toH(uint64 big_endian_64bits); +uint64 CFE_PSP_LE64toH(uint64 little_endian_64bits); + +bool CFE_PSP_IsBigEndian(void); +bool CFE_PSP_IsLittleEndian(void); + +#endif /* CFE_PSP_ENDIAN_H */ diff --git a/fsw/inc/cfe_psp_error.h b/fsw/inc/cfe_psp_error.h index 8fd31596..90ea38b1 100644 --- a/fsw/inc/cfe_psp_error.h +++ b/fsw/inc/cfe_psp_error.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/inc/cfe_psp_exception_api.h b/fsw/inc/cfe_psp_exception_api.h index 9bff3dcd..f4c65ca4 100644 --- a/fsw/inc/cfe_psp_exception_api.h +++ b/fsw/inc/cfe_psp_exception_api.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/inc/cfe_psp_id_api.h b/fsw/inc/cfe_psp_id_api.h index 4c2a9cdf..f9c087cc 100644 --- a/fsw/inc/cfe_psp_id_api.h +++ b/fsw/inc/cfe_psp_id_api.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/inc/cfe_psp_memaccess_api.h b/fsw/inc/cfe_psp_memaccess_api.h index 0dc0ceaa..7255ab86 100644 --- a/fsw/inc/cfe_psp_memaccess_api.h +++ b/fsw/inc/cfe_psp_memaccess_api.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/inc/cfe_psp_memrange_api.h b/fsw/inc/cfe_psp_memrange_api.h index 82482750..de9c3507 100644 --- a/fsw/inc/cfe_psp_memrange_api.h +++ b/fsw/inc/cfe_psp_memrange_api.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/inc/cfe_psp_port_api.h b/fsw/inc/cfe_psp_port_api.h index cee6ab39..f94b7c55 100644 --- a/fsw/inc/cfe_psp_port_api.h +++ b/fsw/inc/cfe_psp_port_api.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/inc/cfe_psp_ssr_api.h b/fsw/inc/cfe_psp_ssr_api.h index 116f9430..11682451 100644 --- a/fsw/inc/cfe_psp_ssr_api.h +++ b/fsw/inc/cfe_psp_ssr_api.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/inc/cfe_psp_timertick_api.h b/fsw/inc/cfe_psp_timertick_api.h index efeb1149..08706e5a 100644 --- a/fsw/inc/cfe_psp_timertick_api.h +++ b/fsw/inc/cfe_psp_timertick_api.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/inc/cfe_psp_version_api.h b/fsw/inc/cfe_psp_version_api.h index e49ee8bb..7a517802 100644 --- a/fsw/inc/cfe_psp_version_api.h +++ b/fsw/inc/cfe_psp_version_api.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/inc/cfe_psp_watchdog_api.h b/fsw/inc/cfe_psp_watchdog_api.h index 34f0e01d..2513955d 100644 --- a/fsw/inc/cfe_psp_watchdog_api.h +++ b/fsw/inc/cfe_psp_watchdog_api.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/mcp750-vxworks/inc/cfe_psp_config.h b/fsw/mcp750-vxworks/inc/cfe_psp_config.h index dcf76695..1fdc09d0 100644 --- a/fsw/mcp750-vxworks/inc/cfe_psp_config.h +++ b/fsw/mcp750-vxworks/inc/cfe_psp_config.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/mcp750-vxworks/inc/psp_version.h b/fsw/mcp750-vxworks/inc/psp_version.h index cf45f59e..024f6092 100644 --- a/fsw/mcp750-vxworks/inc/psp_version.h +++ b/fsw/mcp750-vxworks/inc/psp_version.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -27,22 +27,22 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 73 -#define CFE_PSP_IMPL_BUILD_BASELINE "equuleus-rc1" -#define CFE_PSP_BUILD_DEV_CYCLE "equuleus-rc2" /**< @brief Development: Release name for current development cycle */ -#define CFE_PSP_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */ +#define CFE_PSP_IMPL_BUILD_NUMBER 0 +#define CFE_PSP_IMPL_BUILD_BASELINE "v7.0.0" +#define CFE_PSP_BUILD_DEV_CYCLE "v7.0.0" /**< @brief Development: Release name for current development cycle */ +#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ /* * Version Macros, see \ref cfsversions for definitions. */ -#define CFE_PSP_IMPL_MAJOR_VERSION 1 /*!< @brief Major version number */ -#define CFE_PSP_IMPL_MINOR_VERSION 4 /*!< @brief Minor version number */ +#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ +#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ #define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ /** * @brief Last official release. */ -#define CFE_PSP_LAST_OFFICIAL "v1.4.0" +#define CFE_PSP_LAST_OFFICIAL "v7.0.0" /*! * @brief Mission revision. @@ -51,7 +51,7 @@ * Values 1-254 are reserved for mission use to denote patches/customizations as needed. NOTE: Reserving 0 and 0xFF for * cFS open-source development use (pending resolution of nasa/cFS#440) */ -#define CFE_PSP_IMPL_MISSION_REV 0xFF +#define CFE_PSP_IMPL_MISSION_REV 0x0 /* * Tools to construct version string diff --git a/fsw/mcp750-vxworks/psp_module_list.cmake b/fsw/mcp750-vxworks/psp_module_list.cmake index 64281acf..47666596 100644 --- a/fsw/mcp750-vxworks/psp_module_list.cmake +++ b/fsw/mcp750-vxworks/psp_module_list.cmake @@ -8,3 +8,4 @@ ram_direct port_direct iodriver vxworks_sysmon +endian_api diff --git a/fsw/mcp750-vxworks/src/bsp-integration/cfeSupport.c b/fsw/mcp750-vxworks/src/bsp-integration/cfeSupport.c index f9ad825d..5e2ce93a 100644 --- a/fsw/mcp750-vxworks/src/bsp-integration/cfeSupport.c +++ b/fsw/mcp750-vxworks/src/bsp-integration/cfeSupport.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/mcp750-vxworks/src/cfe_psp_exception.c b/fsw/mcp750-vxworks/src/cfe_psp_exception.c index d23b632a..aafb17df 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_exception.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_exception.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/mcp750-vxworks/src/cfe_psp_memory.c b/fsw/mcp750-vxworks/src/cfe_psp_memory.c index 9bb4cd44..23418c4f 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_memory.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_memory.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/mcp750-vxworks/src/cfe_psp_ssr.c b/fsw/mcp750-vxworks/src/cfe_psp_ssr.c index 30e2f263..f1342554 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_ssr.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_ssr.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/mcp750-vxworks/src/cfe_psp_start.c b/fsw/mcp750-vxworks/src/cfe_psp_start.c index 472f432e..1319e7ed 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_start.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_start.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/mcp750-vxworks/src/cfe_psp_support.c b/fsw/mcp750-vxworks/src/cfe_psp_support.c index 70c2e2cc..78cfccb3 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_support.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_support.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/mcp750-vxworks/src/cfe_psp_watchdog.c b/fsw/mcp750-vxworks/src/cfe_psp_watchdog.c index 6cee24a1..800ce3e5 100644 --- a/fsw/mcp750-vxworks/src/cfe_psp_watchdog.c +++ b/fsw/mcp750-vxworks/src/cfe_psp_watchdog.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/modules/backtrace_libunwind/CMakeLists.txt b/fsw/modules/backtrace_libunwind/CMakeLists.txt new file mode 100644 index 00000000..a348ab79 --- /dev/null +++ b/fsw/modules/backtrace_libunwind/CMakeLists.txt @@ -0,0 +1,9 @@ + +# Backtrace interface module for libunwind +add_psp_module(backtrace_libunwind src/cfe_psp_backtrace.c) + +target_include_directories(backtrace_libunwind PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc) + +if (ENABLE_UNIT_TESTS) + add_subdirectory(ut-stubs) +endif (ENABLE_UNIT_TESTS) diff --git a/fsw/modules/backtrace_libunwind/inc/cfe_psp_backtrace.h b/fsw/modules/backtrace_libunwind/inc/cfe_psp_backtrace.h new file mode 100644 index 00000000..2feb8933 --- /dev/null +++ b/fsw/modules/backtrace_libunwind/inc/cfe_psp_backtrace.h @@ -0,0 +1,57 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +#ifndef CFE_PSP_BACKTRACE_H +#define CFE_PSP_BACKTRACE_H + +#include + +#include "common_types.h" + +/* +** Global variables +*/ +#define CFE_PSP_BACKTRACE_SYM_NAME_LEN 64 + +typedef struct +{ + unw_word_t RegIp; + unw_word_t RegSp; + unw_word_t SymOffset; + char SymName[CFE_PSP_BACKTRACE_SYM_NAME_LEN]; +} CFE_PSP_BacktraceEntry_t; + +/* ------------------------------------------------------------- */ +/** + * @brief Initialize Backtrace interface + */ +void CFE_PSP_Backtrace_Init(void); + +/* ------------------------------------------------------------- */ +/** + * @brief Collect backtrace information + * + * @param[out] Entry Pointer to store backtrace entries + * @param[inout] ContextPtr Abstract context data + * @param[in] MaxEntries Maximum number of backtrace entries to collect + * + * @retval int32 Number of backtrace entries collected + */ +int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, int32 MaxEntries); + +#endif diff --git a/fsw/modules/backtrace_libunwind/src/cfe_psp_backtrace.c b/fsw/modules/backtrace_libunwind/src/cfe_psp_backtrace.c new file mode 100644 index 00000000..f859621f --- /dev/null +++ b/fsw/modules/backtrace_libunwind/src/cfe_psp_backtrace.c @@ -0,0 +1,114 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include + +/* +** cFE includes +*/ +#include "cfe_psp.h" +#include "cfe_psp_config.h" +#include "cfe_psp_module.h" +#include "cfe_psp_backtrace.h" + +#include +#include // For ucontext_t in signal handler +#include +#include + +/* Global unwind variables */ +unw_cursor_t Cursor; +unw_context_t Context; +unw_proc_info_t Info; + + +CFE_PSP_MODULE_DECLARE_SIMPLE(backtrace_libunwind); + +/* + * ------------------------------------------ + * Init Routine + * ------------------------------------------ + */ +void backtrace_libunwind_Init(uint32 PspModuleId) +{ + /* Inform the user that this module is in use */ + printf("CFE_PSP: LIBUNWIND Backtrace Module Initialized...\n"); +} + +/* + * ------------------------------------------ + * Init Routine + * ------------------------------------------ + */ +void CFE_PSP_Backtrace_Init(void) +{ +} + +/* + * ------------------------------------------ + * Backtrace Routine + * ------------------------------------------ + */ +int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, int32 MaxEntries) +{ + int32 NumAddrs = 0; + + if (Entry != NULL) + { + /* Init the unwind context */ + Context = *(unw_context_t *)ContextPtr; + + /* Init unwind cursor for local execution context */ + unw_init_local(&Cursor, &Context); + + /* loop through stack frame */ + while ((MaxEntries > 0) && (unw_step(&Cursor) > 0)) + { + /* Get instruction pointer (IP) and stack pointer (SP) registers */ + Entry->RegIp = Entry->RegSp = 0xDEADBEEF; + unw_get_reg(&Cursor, UNW_REG_IP, &Entry->RegIp); + unw_get_reg(&Cursor, UNW_REG_SP, &Entry->RegSp); + + /* Get symbol name and offset */ + if (unw_get_proc_name(&Cursor, Entry->SymName, CFE_PSP_BACKTRACE_SYM_NAME_LEN, &Entry->SymOffset) != 0) + { + strncpy(Entry->SymName, "", CFE_PSP_BACKTRACE_SYM_NAME_LEN); + Entry->SymOffset = 0; + } + else + { + Entry->SymName[CFE_PSP_BACKTRACE_SYM_NAME_LEN - 1] = '\0'; + } + + /* Display bracktrace info */ + PSP_DEBUG("CFE_PSP_Backtrace: [%02u] SP: 0x%lx PC: 0x%lx (%s+0x%lx)\n", NumAddrs, Entry->RegSp, Entry->RegIp, Entry->SymName, Entry->SymOffset); + + /* update entry pointer and counters */ + NumAddrs++; + Entry++; + MaxEntries--; + } + } + + return NumAddrs; +} diff --git a/fsw/modules/backtrace_libunwind/ut-stubs/.gitkeep b/fsw/modules/backtrace_libunwind/ut-stubs/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/fsw/modules/backtrace_libunwind/ut-stubs/CMakeLists.txt b/fsw/modules/backtrace_libunwind/ut-stubs/CMakeLists.txt new file mode 100644 index 00000000..77ced413 --- /dev/null +++ b/fsw/modules/backtrace_libunwind/ut-stubs/CMakeLists.txt @@ -0,0 +1,3 @@ +add_cfe_coverage_stubs(backtrace_libunwind + cfe_psp_backtrace_stubs.c +) diff --git a/fsw/modules/backtrace_libunwind/ut-stubs/cfe_psp_backtrace_stubs.c b/fsw/modules/backtrace_libunwind/ut-stubs/cfe_psp_backtrace_stubs.c new file mode 100644 index 00000000..2fe40381 --- /dev/null +++ b/fsw/modules/backtrace_libunwind/ut-stubs/cfe_psp_backtrace_stubs.c @@ -0,0 +1,55 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * + * Auto-Generated stub implementations for functions defined in + * cfe_psp_backtrace header + */ + +#include "cfe_psp_backtrace.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_Backtrace() + * ---------------------------------------------------- + */ +int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, + int32 MaxEntries) { + UT_GenStub_SetupReturnBuffer(CFE_PSP_Backtrace, int32); + + UT_GenStub_AddParam(CFE_PSP_Backtrace, CFE_PSP_BacktraceEntry_t *, Entry); + UT_GenStub_AddParam(CFE_PSP_Backtrace, void *, ContextPtr); + UT_GenStub_AddParam(CFE_PSP_Backtrace, int32, MaxEntries); + + UT_GenStub_Execute(CFE_PSP_Backtrace, Basic, NULL); + + return UT_GenStub_GetReturnValue(CFE_PSP_Backtrace, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_Backtrace_Init() + * ---------------------------------------------------- + */ +void CFE_PSP_Backtrace_Init(void) { + + UT_GenStub_Execute(CFE_PSP_Backtrace_Init, Basic, NULL); +} diff --git a/fsw/modules/backtrace_qnx/CMakeLists.txt b/fsw/modules/backtrace_qnx/CMakeLists.txt new file mode 100644 index 00000000..81956006 --- /dev/null +++ b/fsw/modules/backtrace_qnx/CMakeLists.txt @@ -0,0 +1,9 @@ + +# Backtrace interface module for QNX +add_psp_module(backtrace_qnx src/cfe_psp_backtrace.c) + +target_include_directories(backtrace_qnx PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc) + +if (ENABLE_UNIT_TESTS) + add_subdirectory(ut-stubs) +endif (ENABLE_UNIT_TESTS) diff --git a/fsw/modules/backtrace_qnx/inc/cfe_psp_backtrace.h b/fsw/modules/backtrace_qnx/inc/cfe_psp_backtrace.h new file mode 100644 index 00000000..592e4fc3 --- /dev/null +++ b/fsw/modules/backtrace_qnx/inc/cfe_psp_backtrace.h @@ -0,0 +1,50 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +#ifndef CFE_PSP_BACKTRACE_H +#define CFE_PSP_BACKTRACE_H + +#include "common_types.h" + +#include + +/* +** Global variables +*/ + +typedef bt_addr_t CFE_PSP_BacktraceEntry_t; + +/* ------------------------------------------------------------- */ +/** + * @brief Initialize Backtrace interface + */ +void CFE_PSP_Backtrace_Init(void); + +/* ------------------------------------------------------------- */ +/** + * @brief Collect backtrace information + * + * @param[out] Entry Pointer to store backtrace entries + * @param[inout] ContextPtr Abstract context data + * @param[in] MaxEntries Maximum number of backtrace entries to collect + * + * @retval int32 Number of backtrace entries collected + */ +int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, int32 MaxEntries); + +#endif diff --git a/fsw/modules/backtrace_qnx/src/cfe_psp_backtrace.c b/fsw/modules/backtrace_qnx/src/cfe_psp_backtrace.c new file mode 100644 index 00000000..fb6afaa6 --- /dev/null +++ b/fsw/modules/backtrace_qnx/src/cfe_psp_backtrace.c @@ -0,0 +1,85 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +/* +** Include Files +*/ +#include +#include +#include + +/* +** cFE includes +*/ +#include "cfe_psp.h" +#include "cfe_psp_config.h" +#include "cfe_psp_module.h" +#include "cfe_psp_backtrace.h" + +#include +#include +#include + +/* Declare backtrace accessor */ +bt_accessor_t CFE_PSP_BacktraceAcc; + +CFE_PSP_MODULE_DECLARE_SIMPLE(backtrace_qnx); + +/* + * ------------------------------------------ + * Init Routine + * ------------------------------------------ + */ +void backtrace_qnx_Init(uint32 PspModuleId) +{ + /* Inform the user that this module is in use */ + printf("CFE_PSP: QNX Backtrace Module Initialized...\n"); +} + +/* + * ------------------------------------------ + * Init Routine + * ------------------------------------------ + */ +void CFE_PSP_Backtrace_Init(void) +{ + /* Initialize backtrace accessor */ + if (bt_init_accessor(&CFE_PSP_BacktraceAcc, BT_SELF) == -1) + { + OS_printf("CFE_PSP: %s:%i could not initialize backtrace: %s (%i)%s\n", __func__, __LINE__, + "bt_init_accessor", errno, strerror(errno)); + abort(); /* abort() is preferable to exit(EXIT_FAILURE), as it may create a core file for debug */ + } +} + +/* + * ------------------------------------------ + * Backtrace Routine + * ------------------------------------------ + */ +int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, int32 MaxEntries) +{ + int32 NumAddrs; + + NumAddrs = bt_get_backtrace(&CFE_PSP_BacktraceAcc, Entry, MaxEntries); + + PSP_DEBUG("CFE_PSP: %s:%i collecting backtrace [ NumAddrs: %i Info: %s (%i) %s ]\n", __func__, __LINE__, + NumAddrs, "bt_init_accessor/bt_get_backtrace", errno, strerror(errno)); + + return NumAddrs; +} diff --git a/fsw/modules/backtrace_qnx/ut-stubs/.gitkeep b/fsw/modules/backtrace_qnx/ut-stubs/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/fsw/modules/backtrace_qnx/ut-stubs/CMakeLists.txt b/fsw/modules/backtrace_qnx/ut-stubs/CMakeLists.txt new file mode 100644 index 00000000..8948d87d --- /dev/null +++ b/fsw/modules/backtrace_qnx/ut-stubs/CMakeLists.txt @@ -0,0 +1,3 @@ +add_cfe_coverage_stubs(backtrace_qnx + cfe_psp_backtrace_stubs.c +) diff --git a/fsw/modules/backtrace_qnx/ut-stubs/cfe_psp_backtrace_stubs.c b/fsw/modules/backtrace_qnx/ut-stubs/cfe_psp_backtrace_stubs.c new file mode 100644 index 00000000..2fe40381 --- /dev/null +++ b/fsw/modules/backtrace_qnx/ut-stubs/cfe_psp_backtrace_stubs.c @@ -0,0 +1,55 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * + * Auto-Generated stub implementations for functions defined in + * cfe_psp_backtrace header + */ + +#include "cfe_psp_backtrace.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_Backtrace() + * ---------------------------------------------------- + */ +int32 CFE_PSP_Backtrace(CFE_PSP_BacktraceEntry_t *Entry, void *ContextPtr, + int32 MaxEntries) { + UT_GenStub_SetupReturnBuffer(CFE_PSP_Backtrace, int32); + + UT_GenStub_AddParam(CFE_PSP_Backtrace, CFE_PSP_BacktraceEntry_t *, Entry); + UT_GenStub_AddParam(CFE_PSP_Backtrace, void *, ContextPtr); + UT_GenStub_AddParam(CFE_PSP_Backtrace, int32, MaxEntries); + + UT_GenStub_Execute(CFE_PSP_Backtrace, Basic, NULL); + + return UT_GenStub_GetReturnValue(CFE_PSP_Backtrace, int32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_Backtrace_Init() + * ---------------------------------------------------- + */ +void CFE_PSP_Backtrace_Init(void) { + + UT_GenStub_Execute(CFE_PSP_Backtrace_Init, Basic, NULL); +} diff --git a/fsw/modules/eeprom_direct/cfe_psp_eeprom_direct.c b/fsw/modules/eeprom_direct/cfe_psp_eeprom_direct.c index a44768b8..3e4faae5 100644 --- a/fsw/modules/eeprom_direct/cfe_psp_eeprom_direct.c +++ b/fsw/modules/eeprom_direct/cfe_psp_eeprom_direct.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c b/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c index 39880c6d..9a2a9077 100644 --- a/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c +++ b/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/modules/eeprom_notimpl/cfe_psp_eeprom_notimpl.c b/fsw/modules/eeprom_notimpl/cfe_psp_eeprom_notimpl.c index b7eddabc..be0c3b42 100644 --- a/fsw/modules/eeprom_notimpl/cfe_psp_eeprom_notimpl.c +++ b/fsw/modules/eeprom_notimpl/cfe_psp_eeprom_notimpl.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/modules/endian_api/CMakeLists.txt b/fsw/modules/endian_api/CMakeLists.txt new file mode 100644 index 00000000..bc21c205 --- /dev/null +++ b/fsw/modules/endian_api/CMakeLists.txt @@ -0,0 +1,37 @@ + +# Check if the target system provides the "endian.h" header file. +# This needs to use the same compile definitions as OSAL when testing, BUT +# in typical CMake fashion things are not consistent. The interface +# compile definitions is a simple list whereas the COMPILE_DEFINITIONS passed +# to try_compile needs to have a -D in front of every option like add_definitions() +get_property(OSAL_COMPILE_DEFS TARGET osal_public_api PROPERTY INTERFACE_COMPILE_DEFINITIONS) + +# When using glibc it may also be hidden behind one of these feature flags +set(PSP_ENDIAN_TRY_COMPILE_DEFS -D_DEFAULT_SOURCE -D_BSD_SOURCE) +foreach(DEF ${OSAL_COMPILE_DEFS}) + list(APPEND PSP_ENDIAN_TRY_COMPILE_DEFS "-D${DEF}") +endforeach() + +add_definitions(${PSP_ENDIAN_TRY_COMPILE_DEFS}) + +# Check if the system provides an endian.h and if it is usable +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +try_compile(PSP_HAVE_ENDIAN_H + ${CMAKE_CURRENT_BINARY_DIR}/configtest_endian_h + ${CMAKE_CURRENT_SOURCE_DIR}/configtest_endian_h.c + COMPILE_DEFINITIONS ${PSP_ENDIAN_TRY_COMPILE_DEFS} # use defs from OSAL +) + +if ($ENV{VERBOSE}) + message(STATUS "HAVE_ENDIAN_H=${PSP_HAVE_ENDIAN_H}") +endif() + +if (PSP_HAVE_ENDIAN_H) + # Use the endian.h variant, this is likely to be better optimized + set(PSP_ENDIAN_SOURCE cfe_psp_endian_wrappers.c) +else() + # Use the generic variant, this is not optimized but works anywhere + set(PSP_ENDIAN_SOURCE cfe_psp_endian_generic.c) +endif() + +add_psp_module(endian_api cfe_psp_endian_common.c ${PSP_ENDIAN_SOURCE}) diff --git a/fsw/modules/endian_api/cfe_psp_endian_common.c b/fsw/modules/endian_api/cfe_psp_endian_common.c new file mode 100644 index 00000000..28cb5bd7 --- /dev/null +++ b/fsw/modules/endian_api/cfe_psp_endian_common.c @@ -0,0 +1,81 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * + * Map the PSP endian conversion routines to the system-provided endian.h file + * This is done using static inline functions, such that the result should be + * optimized as much as possible. + */ + +/* +** Include Files +*/ +#include "cfe_psp_module.h" +#include "cfe_psp_endian.h" + +CFE_PSP_MODULE_DECLARE_SIMPLE(endian_api); + +/* Note these are not supposed to be exposed publicly but UT needs to access them */ +uint8_t CFE_PSP_ENDIAN_INDICATOR; + +/* these just need to be different. Making them substantially different */ +#define CFE_PSP_BIG_INDICATOR 0x25 +#define CFE_PSP_LITTLE_INDICATOR 0x9a + +bool CFE_PSP_IsBigEndian(void) +{ + return (CFE_PSP_ENDIAN_INDICATOR == CFE_PSP_BIG_INDICATOR); +} + +bool CFE_PSP_IsLittleEndian(void) +{ + return (CFE_PSP_ENDIAN_INDICATOR == CFE_PSP_LITTLE_INDICATOR); +} + +void CFE_PSP_ReportEndian(uint8 CheckValue) +{ + const char *CpuType; + + /* Keep it in the global for future reference */ + CFE_PSP_ENDIAN_INDICATOR = CheckValue; + + if (CFE_PSP_IsBigEndian()) + { + CpuType = "BIG"; + } + else if (CFE_PSP_IsLittleEndian()) + { + CpuType = "LITTLE"; + } + else + { + CpuType = "UNDEFINED"; + } + + printf("CFE_PSP: Host CPU Endian=%s\n", CpuType); +} + +void endian_api_Init(uint32 PspModuleId) +{ + const uint16 Check = (CFE_PSP_BIG_INDICATOR << 8) | CFE_PSP_LITTLE_INDICATOR; + + /* Inform the user that this module is in use and what endianness we think this CPU has */ + CFE_PSP_ReportEndian(*((const char *)&Check)); +} diff --git a/fsw/modules/endian_api/cfe_psp_endian_generic.c b/fsw/modules/endian_api/cfe_psp_endian_generic.c new file mode 100644 index 00000000..faf26ae9 --- /dev/null +++ b/fsw/modules/endian_api/cfe_psp_endian_generic.c @@ -0,0 +1,302 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * + * Map the PSP endian conversion routines to the system-provided endian.h file + * This is done using static inline functions, such that the result should be + * optimized as much as possible. + */ + +/* +** Include Files +*/ +#include "cfe_psp_endian_impl.h" + +/* When compiled with _UNIT_TEST_, this changes the names of the functions + * to allow multiple different implementations to be tested together */ +#ifdef _UNIT_TEST_ +#define PSP_ENDIAN_CONVERSION(f) ENDIAN_CONVERSION_COMBINE_NAME(UT_GENERIC, f) +#else +#define PSP_ENDIAN_CONVERSION(f) ENDIAN_CONVERSION_COMBINE_NAME(CFE_PSP, f) +#endif + +union CFE_PSP_EndianWrap16 +{ + uint16 Word; + uint8 Octets[2]; +}; + +union CFE_PSP_EndianWrap32 +{ + uint32 Word; + uint8 Octets[4]; +}; + +union CFE_PSP_EndianWrap64 +{ + uint64 Word; + uint8 Octets[8]; +}; + +/* + * NOTE: the 16 bit conversions still use a 32 bit shift register. + * This is intentional, on some architectures it adds an additional + * (non-coverable) branch when shifting a short int + */ + +uint16 PSP_ENDIAN_CONVERSION(HtoBE16)(uint16 host_16bits) +{ + union CFE_PSP_EndianWrap16 Out; + uint32 ShiftReg; + size_t i; + + ShiftReg = host_16bits; + Out.Word = 0; + + i = sizeof(Out); + while (i > 0) + { + --i; + Out.Octets[i] = ShiftReg & 0xFF; + ShiftReg >>= 8; + } + + return Out.Word; +} + +uint16 PSP_ENDIAN_CONVERSION(HtoLE16)(uint16 host_16bits) +{ + union CFE_PSP_EndianWrap16 Out; + uint32 ShiftReg; + size_t i; + + ShiftReg = host_16bits; + Out.Word = 0; + + i = 0; + while (i < sizeof(Out)) + { + Out.Octets[i] = ShiftReg & 0xFF; + ShiftReg >>= 8; + ++i; + } + + return Out.Word; +} + +uint16 PSP_ENDIAN_CONVERSION(BE16toH)(uint16 big_endian_16bits) +{ + union CFE_PSP_EndianWrap16 In; + uint32 ShiftReg; + size_t i; + + In.Word = big_endian_16bits; + ShiftReg = 0; + + i = 0; + while (i < sizeof(In)) + { + ShiftReg <<= 8; + ShiftReg |= In.Octets[i]; + ++i; + } + + return ShiftReg; +} + +uint16 PSP_ENDIAN_CONVERSION(LE16toH)(uint16 little_endian_16bits) +{ + union CFE_PSP_EndianWrap16 In; + uint32 ShiftReg; + size_t i; + + In.Word = little_endian_16bits; + ShiftReg = 0; + + i = sizeof(In); + while (i > 0) + { + --i; + ShiftReg <<= 8; + ShiftReg |= In.Octets[i]; + } + + return ShiftReg; +} + +uint32 PSP_ENDIAN_CONVERSION(HtoBE32)(uint32 host_32bits) +{ + union CFE_PSP_EndianWrap32 Out; + uint32 ShiftReg; + size_t i; + + ShiftReg = host_32bits; + Out.Word = 0; + + i = sizeof(Out); + while (i > 0) + { + --i; + Out.Octets[i] = ShiftReg & 0xFF; + ShiftReg >>= 8; + } + + return Out.Word; +} + +uint32 PSP_ENDIAN_CONVERSION(HtoLE32)(uint32 host_32bits) +{ + union CFE_PSP_EndianWrap32 Out; + uint32 ShiftReg; + size_t i; + + ShiftReg = host_32bits; + Out.Word = 0; + + i = 0; + while (i < sizeof(Out)) + { + Out.Octets[i] = ShiftReg & 0xFF; + ShiftReg >>= 8; + ++i; + } + + return Out.Word; +} + +uint32 PSP_ENDIAN_CONVERSION(BE32toH)(uint32 big_endian_32bits) +{ + union CFE_PSP_EndianWrap32 In; + uint32 ShiftReg; + size_t i; + + In.Word = big_endian_32bits; + ShiftReg = 0; + + i = 0; + while (i < sizeof(In)) + { + ShiftReg <<= 8; + ShiftReg |= In.Octets[i]; + ++i; + } + + return ShiftReg; +} + +uint32 PSP_ENDIAN_CONVERSION(LE32toH)(uint32 little_endian_32bits) +{ + union CFE_PSP_EndianWrap32 In; + uint32 ShiftReg; + size_t i; + + In.Word = little_endian_32bits; + ShiftReg = 0; + + i = sizeof(In); + while (i > 0) + { + --i; + ShiftReg <<= 8; + ShiftReg |= In.Octets[i]; + } + + return ShiftReg; +} + +uint64 PSP_ENDIAN_CONVERSION(HtoBE64)(uint64 host_64bits) +{ + union CFE_PSP_EndianWrap64 Out; + uint64 ShiftReg; + size_t i; + + ShiftReg = host_64bits; + Out.Word = 0; + + i = sizeof(Out); + while (i > 0) + { + --i; + Out.Octets[i] = ShiftReg & 0xFF; + ShiftReg >>= 8; + } + + return Out.Word; +} + +uint64 PSP_ENDIAN_CONVERSION(HtoLE64)(uint64 host_64bits) +{ + union CFE_PSP_EndianWrap64 Out; + uint64 ShiftReg; + size_t i; + + ShiftReg = host_64bits; + Out.Word = 0; + + i = 0; + while (i < sizeof(Out)) + { + Out.Octets[i] = ShiftReg & 0xFF; + ShiftReg >>= 8; + ++i; + } + + return Out.Word; +} + +uint64 PSP_ENDIAN_CONVERSION(BE64toH)(uint64 big_endian_64bits) +{ + union CFE_PSP_EndianWrap64 In; + uint64 ShiftReg; + size_t i; + + In.Word = big_endian_64bits; + ShiftReg = 0; + + i = 0; + while (i < sizeof(In)) + { + ShiftReg <<= 8; + ShiftReg |= In.Octets[i]; + ++i; + } + + return ShiftReg; +} + +uint64 PSP_ENDIAN_CONVERSION(LE64toH)(uint64 little_endian_64bits) +{ + union CFE_PSP_EndianWrap64 In; + uint64 ShiftReg; + size_t i; + + In.Word = little_endian_64bits; + ShiftReg = 0; + + i = sizeof(In); + while (i > 0) + { + --i; + ShiftReg <<= 8; + ShiftReg |= In.Octets[i]; + } + + return ShiftReg; +} diff --git a/fsw/modules/endian_api/cfe_psp_endian_impl.h b/fsw/modules/endian_api/cfe_psp_endian_impl.h new file mode 100644 index 00000000..b2241f54 --- /dev/null +++ b/fsw/modules/endian_api/cfe_psp_endian_impl.h @@ -0,0 +1,37 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * + * Map the PSP endian conversion routines to the system-provided endian.h file + * This is done using static inline functions, such that the result should be + * optimized as much as possible. + */ + +#ifndef CFE_PSP_ENDIAN_IMPL_H +#define CFE_PSP_ENDIAN_IMPL_H + +/* +** Include Files +*/ +#include "cfe_psp_endian.h" + +#define ENDIAN_CONVERSION_COMBINE_NAME(ns, f) ns##_##f + +#endif diff --git a/fsw/modules/endian_api/cfe_psp_endian_wrappers.c b/fsw/modules/endian_api/cfe_psp_endian_wrappers.c new file mode 100644 index 00000000..4e0caa90 --- /dev/null +++ b/fsw/modules/endian_api/cfe_psp_endian_wrappers.c @@ -0,0 +1,99 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * + * Map the PSP endian conversion routines to the system-provided endian.h file + * When compiled with optimization enabled, these should generally get reduced + * to just a couple instructions (e.g. bswap) + */ + +/* +** Include Files +*/ +#include +#include "cfe_psp_endian_impl.h" + +/* When compiled with _UNIT_TEST_, this changes the names of the functions + * to allow multiple different implementations to be tested together */ +#ifdef _UNIT_TEST_ +#define PSP_ENDIAN_CONVERSION(f) ENDIAN_CONVERSION_COMBINE_NAME(UT_WRAPPED, f) +#else +#define PSP_ENDIAN_CONVERSION(f) ENDIAN_CONVERSION_COMBINE_NAME(CFE_PSP, f) +#endif + +uint16 PSP_ENDIAN_CONVERSION(HtoBE16)(uint16 host_16bits) +{ + return htobe16(host_16bits); +} + +uint16 PSP_ENDIAN_CONVERSION(HtoLE16)(uint16 host_16bits) +{ + return htole16(host_16bits); +} + +uint16 PSP_ENDIAN_CONVERSION(BE16toH)(uint16 big_endian_16bits) +{ + return be16toh(big_endian_16bits); +} + +uint16 PSP_ENDIAN_CONVERSION(LE16toH)(uint16 little_endian_16bits) +{ + return le16toh(little_endian_16bits); +} + +uint32 PSP_ENDIAN_CONVERSION(HtoBE32)(uint32 host_32bits) +{ + return htobe32(host_32bits); +} + +uint32 PSP_ENDIAN_CONVERSION(HtoLE32)(uint32 host_32bits) +{ + return htole32(host_32bits); +} + +uint32 PSP_ENDIAN_CONVERSION(BE32toH)(uint32 big_endian_32bits) +{ + return be32toh(big_endian_32bits); +} + +uint32 PSP_ENDIAN_CONVERSION(LE32toH)(uint32 little_endian_32bits) +{ + return le32toh(little_endian_32bits); +} + +uint64 PSP_ENDIAN_CONVERSION(HtoBE64)(uint64 host_64bits) +{ + return htobe64(host_64bits); +} + +uint64 PSP_ENDIAN_CONVERSION(HtoLE64)(uint64 host_64bits) +{ + return htole64(host_64bits); +} + +uint64 PSP_ENDIAN_CONVERSION(BE64toH)(uint64 big_endian_64bits) +{ + return be64toh(big_endian_64bits); +} + +uint64 PSP_ENDIAN_CONVERSION(LE64toH)(uint64 little_endian_64bits) +{ + return le64toh(little_endian_64bits); +} diff --git a/fsw/modules/endian_api/configtest_endian_h.c b/fsw/modules/endian_api/configtest_endian_h.c new file mode 100644 index 00000000..a50bb7da --- /dev/null +++ b/fsw/modules/endian_api/configtest_endian_h.c @@ -0,0 +1,17 @@ +/* + * Checks if this C library provides endian.h. + * If it does, then this is the preferred method to + * perform byte ordering conversions, as the implentation + * is more reliably correct and probably also optimized for + * the platform, as opposed to checking non-standard compiler + * defines and making assumptions about it. + */ + +#include +#include + +/* make a non-empty unit, invoke one of the functions */ +uint16_t test_noop(void) +{ + return htobe16(0x1234); +} diff --git a/fsw/modules/endian_compiledef/cfe_psp_endian.h b/fsw/modules/endian_compiledef/cfe_psp_endian.h new file mode 100644 index 00000000..fb976ee0 --- /dev/null +++ b/fsw/modules/endian_compiledef/cfe_psp_endian.h @@ -0,0 +1,96 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * + * Purpose: + * Define macros to enforce big-endian/network byte order for 16 and 32 bit integers + * + */ + +#ifndef CFE_PSP_ENDIAN_H +#define CFE_PSP_ENDIAN_H + +/* +** Include Files +*/ +#include +#include "common_types.h" + +static inline uint16 CFE_PSP_htobe16(uint16 host_16bits) +{ + return htobe16(host_16bits); +} + +static inline uint16 CFE_PSP_htole16(uint16 host_16bits) +{ + return htole16(host_16bits); +} + +static inline uint16 CFE_PSP_be16toh(uint16 big_endian_16bits) +{ + return be16toh(big_endian_16bits); +} + +static inline uint16 CFE_PSP_le16toh(uint16 little_endian_16bits) +{ + return le16toh(little_endian_16bits); +} + +static inline uint32 CFE_PSP_htobe32(uint32 host_32bits) +{ + return htobe32(host_32bits); +} + +static inline uint32 CFE_PSP_htole32(uint32 host_32bits) +{ + return htole32(host_32bits); +} + +static inline uint32 CFE_PSP_be32toh(uint32 big_endian_32bits) +{ + return be32toh(big_endian_32bits); +} + +static inline uint32 CFE_PSP_le32toh(uint32 little_endian_32bits) +{ + return le32toh(little_endian_32bits); +} + +static inline uint64 CFE_PSP_htobe64(uint64 host_64bits) +{ + return htobe64(host_64bits); +} + +static inline uint64 CFE_PSP_htole64(uint64 host_64bits) +{ + return htole64(host_64bits); +} + +static inline uint64 CFE_PSP_be64toh(uint64 big_endian_64bits) +{ + return be64toh(big_endian_64bits); +} + +static inline uint64 CFE_PSP_le64toh(uint64 little_endian_64bits) +{ + return le64toh(little_endian_64bits); +} + +#endif /* CFE_PSP_ENDIAN_H */ diff --git a/fsw/modules/network_pc686_rtems/CMakeLists.txt b/fsw/modules/network_pc686_rtems/CMakeLists.txt new file mode 100644 index 00000000..3faac2c0 --- /dev/null +++ b/fsw/modules/network_pc686_rtems/CMakeLists.txt @@ -0,0 +1,8 @@ +###################################################################### +# +# CMAKE build recipe for modular PSP component +# +###################################################################### + +# Create the module +add_psp_module(network_pc686_rtems cfe_psp_network_pc686_rtems.c) diff --git a/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.c b/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.c new file mode 100644 index 00000000..49e178e8 --- /dev/null +++ b/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.c @@ -0,0 +1,72 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * + * A PSP module for network initialization for pc686 RTEMS + * + */ +#include +#include +#include +#include +#include + +#include "cfe_psp.h" +#include "cfe_psp_module.h" +#include "cfe_psp_network_pc686_rtems.h" + +extern int rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching); + +static struct rtems_bsdnet_ifconfig netdriver_config = { + .name = net_name_str, + .attach = rtems_fxp_attach, + .next = NULL, + .ip_address = ip_addr_str, + .ip_netmask = ip_netmask_str, + .hardware_address = ethernet_address + /* more options can follow */ +}; + +struct rtems_bsdnet_config rtems_bsdnet_config = { + .ifconfig = &netdriver_config, .bootp = rtems_bsdnet_do_dhcp_failsafe, /* fill if DHCP is used*/ +}; + + +CFE_PSP_MODULE_DECLARE_SIMPLE(network_pc686_rtems); + +/* Module initialization function */ +void network_pc686_rtems_Init(uint32 PspModuleId) +{ + rtems_status_code status; + + /* Inform the user that this module is in use */ + printf("CFE_PSP: Using pc686 RTEMS network implementation\n"); + + /* + * Initialize the network. This is also optional and only + * works if an appropriate network device is present. + */ + status = rtems_bsdnet_initialize_network(); + if (status != RTEMS_SUCCESSFUL) + { + printf("Network init not successful: %s / %s (continuing)\n", rtems_status_text(status), strerror(errno)); + } + +} \ No newline at end of file diff --git a/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.h b/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.h new file mode 100644 index 00000000..e33a3426 --- /dev/null +++ b/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.h @@ -0,0 +1,35 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * + * A PSP module for network initialization for pc686 RTEMS + * + */ + + #ifndef CFE_PSP_NETWORK_PC686_RTEMS_H + #define CFE_PSP_NETWORK_PC686_RTEMS_H + +/* Parameters needed for network initialization */ +static unsigned char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x61}; +static char net_name_str[] = "fxp1"; +static char ip_addr_str[] = "10.0.2.15"; +static char ip_netmask_str[] = "255.255.255.0"; + +#endif /* CFE_PSP_NETWORK_PC686_RTEMS_H */ \ No newline at end of file diff --git a/fsw/modules/port_direct/cfe_psp_port_direct.c b/fsw/modules/port_direct/cfe_psp_port_direct.c index c4a67f8b..3d934c93 100644 --- a/fsw/modules/port_direct/cfe_psp_port_direct.c +++ b/fsw/modules/port_direct/cfe_psp_port_direct.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/modules/port_notimpl/cfe_psp_port_notimpl.c b/fsw/modules/port_notimpl/cfe_psp_port_notimpl.c index 3f0e13c5..375468f8 100644 --- a/fsw/modules/port_notimpl/cfe_psp_port_notimpl.c +++ b/fsw/modules/port_notimpl/cfe_psp_port_notimpl.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/modules/ram_direct/cfe_psp_ram_direct.c b/fsw/modules/ram_direct/cfe_psp_ram_direct.c index 271ad6ba..843c978b 100644 --- a/fsw/modules/ram_direct/cfe_psp_ram_direct.c +++ b/fsw/modules/ram_direct/cfe_psp_ram_direct.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/modules/ram_notimpl/cfe_psp_ram_notimpl.c b/fsw/modules/ram_notimpl/cfe_psp_ram_notimpl.c index f0af66a3..69be968e 100644 --- a/fsw/modules/ram_notimpl/cfe_psp_ram_notimpl.c +++ b/fsw/modules/ram_notimpl/cfe_psp_ram_notimpl.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/modules/rtems_sysmon/rtems_sysmon.c b/fsw/modules/rtems_sysmon/rtems_sysmon.c index 8bfaa680..7005b189 100644 --- a/fsw/modules/rtems_sysmon/rtems_sysmon.c +++ b/fsw/modules/rtems_sysmon/rtems_sysmon.c @@ -1,6 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: - * Draco + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. diff --git a/fsw/modules/rtems_sysmon/rtems_sysmon.h b/fsw/modules/rtems_sysmon/rtems_sysmon.h index adb7236c..f6140988 100644 --- a/fsw/modules/rtems_sysmon/rtems_sysmon.h +++ b/fsw/modules/rtems_sysmon/rtems_sysmon.h @@ -1,5 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. diff --git a/fsw/modules/soft_timebase/cfe_psp_soft_timebase.c b/fsw/modules/soft_timebase/cfe_psp_soft_timebase.c index f8355892..efceed38 100644 --- a/fsw/modules/soft_timebase/cfe_psp_soft_timebase.c +++ b/fsw/modules/soft_timebase/cfe_psp_soft_timebase.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/modules/timebase_posix_clock/cfe_psp_timebase_posix_clock.c b/fsw/modules/timebase_posix_clock/cfe_psp_timebase_posix_clock.c index b17f100a..047f77b9 100644 --- a/fsw/modules/timebase_posix_clock/cfe_psp_timebase_posix_clock.c +++ b/fsw/modules/timebase_posix_clock/cfe_psp_timebase_posix_clock.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c b/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c index bd7a9ba6..243cca99 100644 --- a/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c +++ b/fsw/modules/timebase_vxworks/cfe_psp_timebase_vxworks.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/modules/vxworks_sysmon/vxworks_sysmon.c b/fsw/modules/vxworks_sysmon/vxworks_sysmon.c index 735dd3c7..6dc38911 100644 --- a/fsw/modules/vxworks_sysmon/vxworks_sysmon.c +++ b/fsw/modules/vxworks_sysmon/vxworks_sysmon.c @@ -1,6 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: - * Draco + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. diff --git a/fsw/modules/vxworks_sysmon/vxworks_sysmon.h b/fsw/modules/vxworks_sysmon/vxworks_sysmon.h index 9cae2a09..7b79f935 100644 --- a/fsw/modules/vxworks_sysmon/vxworks_sysmon.h +++ b/fsw/modules/vxworks_sysmon/vxworks_sysmon.h @@ -1,5 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. diff --git a/fsw/pc-linux/inc/cfe_psp_config.h b/fsw/pc-linux/inc/cfe_psp_config.h index 5db48c55..738c5611 100644 --- a/fsw/pc-linux/inc/cfe_psp_config.h +++ b/fsw/pc-linux/inc/cfe_psp_config.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/pc-linux/inc/psp_version.h b/fsw/pc-linux/inc/psp_version.h index cf45f59e..024f6092 100644 --- a/fsw/pc-linux/inc/psp_version.h +++ b/fsw/pc-linux/inc/psp_version.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -27,22 +27,22 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 73 -#define CFE_PSP_IMPL_BUILD_BASELINE "equuleus-rc1" -#define CFE_PSP_BUILD_DEV_CYCLE "equuleus-rc2" /**< @brief Development: Release name for current development cycle */ -#define CFE_PSP_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */ +#define CFE_PSP_IMPL_BUILD_NUMBER 0 +#define CFE_PSP_IMPL_BUILD_BASELINE "v7.0.0" +#define CFE_PSP_BUILD_DEV_CYCLE "v7.0.0" /**< @brief Development: Release name for current development cycle */ +#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ /* * Version Macros, see \ref cfsversions for definitions. */ -#define CFE_PSP_IMPL_MAJOR_VERSION 1 /*!< @brief Major version number */ -#define CFE_PSP_IMPL_MINOR_VERSION 4 /*!< @brief Minor version number */ +#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ +#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ #define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ /** * @brief Last official release. */ -#define CFE_PSP_LAST_OFFICIAL "v1.4.0" +#define CFE_PSP_LAST_OFFICIAL "v7.0.0" /*! * @brief Mission revision. @@ -51,7 +51,7 @@ * Values 1-254 are reserved for mission use to denote patches/customizations as needed. NOTE: Reserving 0 and 0xFF for * cFS open-source development use (pending resolution of nasa/cFS#440) */ -#define CFE_PSP_IMPL_MISSION_REV 0xFF +#define CFE_PSP_IMPL_MISSION_REV 0x0 /* * Tools to construct version string diff --git a/fsw/pc-linux/psp_module_list.cmake b/fsw/pc-linux/psp_module_list.cmake index 557e2886..6da40c2a 100644 --- a/fsw/pc-linux/psp_module_list.cmake +++ b/fsw/pc-linux/psp_module_list.cmake @@ -8,3 +8,4 @@ ram_notimpl port_notimpl iodriver linux_sysmon +endian_api diff --git a/fsw/pc-linux/src/cfe_psp_exception.c b/fsw/pc-linux/src/cfe_psp_exception.c index 61276229..bbf7acb0 100644 --- a/fsw/pc-linux/src/cfe_psp_exception.c +++ b/fsw/pc-linux/src/cfe_psp_exception.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/pc-linux/src/cfe_psp_memory.c b/fsw/pc-linux/src/cfe_psp_memory.c index 5fcbdc7a..649f1f2e 100644 --- a/fsw/pc-linux/src/cfe_psp_memory.c +++ b/fsw/pc-linux/src/cfe_psp_memory.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -93,8 +93,17 @@ void CFE_PSP_InitUserReservedArea(void); /* ** External Declarations */ +#ifdef __riscv +extern unsigned int _start; +extern unsigned int __DATA_BEGIN__; +#define CODE_START_ADDR ((cpuaddr)&_start) +#define CODE_END_ADDR ((cpuaddr)&__DATA_BEGIN__) +#else extern unsigned int _init; extern unsigned int _fini; +#define CODE_START_ADDR ((cpuaddr)&_init) +#define CODE_END_ADDR ((cpuaddr)&_fini) +#endif /* ** Global variables @@ -741,8 +750,8 @@ int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFES } else { - *PtrToCFESegment = (cpuaddr)(&_init); - *SizeOfCFESegment = (uint32)(((cpuaddr)&_fini) - ((cpuaddr)&_init)); + *PtrToCFESegment = CODE_START_ADDR; + *SizeOfCFESegment = (uint32)(CODE_END_ADDR - CODE_START_ADDR); return_code = CFE_PSP_SUCCESS; } diff --git a/fsw/pc-linux/src/cfe_psp_ssr.c b/fsw/pc-linux/src/cfe_psp_ssr.c index ae4bec3d..280b2dff 100644 --- a/fsw/pc-linux/src/cfe_psp_ssr.c +++ b/fsw/pc-linux/src/cfe_psp_ssr.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/pc-linux/src/cfe_psp_start.c b/fsw/pc-linux/src/cfe_psp_start.c index b281a4cf..e8bfb584 100644 --- a/fsw/pc-linux/src/cfe_psp_start.c +++ b/fsw/pc-linux/src/cfe_psp_start.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/pc-linux/src/cfe_psp_support.c b/fsw/pc-linux/src/cfe_psp_support.c index a0952e23..bf428502 100644 --- a/fsw/pc-linux/src/cfe_psp_support.c +++ b/fsw/pc-linux/src/cfe_psp_support.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/pc-linux/src/cfe_psp_watchdog.c b/fsw/pc-linux/src/cfe_psp_watchdog.c index d7872b1f..09df80e2 100644 --- a/fsw/pc-linux/src/cfe_psp_watchdog.c +++ b/fsw/pc-linux/src/cfe_psp_watchdog.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/pc-rtems/inc/cfe_psp_config.h b/fsw/pc-rtems/inc/cfe_psp_config.h index ae6d4662..9f730f74 100644 --- a/fsw/pc-rtems/inc/cfe_psp_config.h +++ b/fsw/pc-rtems/inc/cfe_psp_config.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -49,13 +49,21 @@ */ #define CFE_PSP_SOFT_TIMEBASE_PERIOD 10000 +/* + * A random 32-bit value that is used as the "validity flag" + * of the PC-Rtems boot record structure. This is simply + * a value that is unlikely to occur unless specifically set. + */ +#define CFE_PSP_BOOTRECORD_VALID ((uint32)0x2aebe984) +#define CFE_PSP_BOOTRECORD_INVALID (~CFE_PSP_BOOTRECORD_VALID) + /* ** Typedef for the layout of the header in the reserved memory block */ typedef struct { - /* not currently used in PC-RTEMS */ - uint32 reserved; + uint32 ValidityFlag; + uint32 NextResetType; } CFE_PSP_ReservedMemoryBootRecord_t; /** diff --git a/fsw/pc-rtems/inc/psp_version.h b/fsw/pc-rtems/inc/psp_version.h index cf45f59e..024f6092 100644 --- a/fsw/pc-rtems/inc/psp_version.h +++ b/fsw/pc-rtems/inc/psp_version.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -27,22 +27,22 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 73 -#define CFE_PSP_IMPL_BUILD_BASELINE "equuleus-rc1" -#define CFE_PSP_BUILD_DEV_CYCLE "equuleus-rc2" /**< @brief Development: Release name for current development cycle */ -#define CFE_PSP_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */ +#define CFE_PSP_IMPL_BUILD_NUMBER 0 +#define CFE_PSP_IMPL_BUILD_BASELINE "v7.0.0" +#define CFE_PSP_BUILD_DEV_CYCLE "v7.0.0" /**< @brief Development: Release name for current development cycle */ +#define CFE_PSP_BUILD_CODENAME "Draco" /**< @brief: Development: Code name for the current build */ /* * Version Macros, see \ref cfsversions for definitions. */ -#define CFE_PSP_IMPL_MAJOR_VERSION 1 /*!< @brief Major version number */ -#define CFE_PSP_IMPL_MINOR_VERSION 4 /*!< @brief Minor version number */ +#define CFE_PSP_IMPL_MAJOR_VERSION 7 /*!< @brief Major version number */ +#define CFE_PSP_IMPL_MINOR_VERSION 0 /*!< @brief Minor version number */ #define CFE_PSP_IMPL_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ /** * @brief Last official release. */ -#define CFE_PSP_LAST_OFFICIAL "v1.4.0" +#define CFE_PSP_LAST_OFFICIAL "v7.0.0" /*! * @brief Mission revision. @@ -51,7 +51,7 @@ * Values 1-254 are reserved for mission use to denote patches/customizations as needed. NOTE: Reserving 0 and 0xFF for * cFS open-source development use (pending resolution of nasa/cFS#440) */ -#define CFE_PSP_IMPL_MISSION_REV 0xFF +#define CFE_PSP_IMPL_MISSION_REV 0x0 /* * Tools to construct version string diff --git a/fsw/pc-rtems/psp_conditional_modules.cmake b/fsw/pc-rtems/psp_conditional_modules.cmake index b559d224..fd7e637e 100644 --- a/fsw/pc-rtems/psp_conditional_modules.cmake +++ b/fsw/pc-rtems/psp_conditional_modules.cmake @@ -5,4 +5,10 @@ if(CMAKE_SYSTEM_VERSION VERSION_GREATER 4.99) list(APPEND PSP_TARGET_MODULE_LIST rtems_sysmon) +endif() + +# Selecting the network module based on platform being used +# For Qemu RTEMS versions 4.11,5,6 +if(RTEMS_BSP MATCHES "pc686") + list(APPEND PSP_TARGET_MODULE_LIST network_pc686_rtems) endif() \ No newline at end of file diff --git a/fsw/pc-rtems/psp_module_list.cmake b/fsw/pc-rtems/psp_module_list.cmake index f93fe1e6..c6a233a9 100644 --- a/fsw/pc-rtems/psp_module_list.cmake +++ b/fsw/pc-rtems/psp_module_list.cmake @@ -11,3 +11,4 @@ eeprom_notimpl ram_direct port_notimpl iodriver +endian_api diff --git a/fsw/pc-rtems/src/cfe_psp_exception.c b/fsw/pc-rtems/src/cfe_psp_exception.c index 49228e20..60e43d06 100644 --- a/fsw/pc-rtems/src/cfe_psp_exception.c +++ b/fsw/pc-rtems/src/cfe_psp_exception.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/pc-rtems/src/cfe_psp_memory.c b/fsw/pc-rtems/src/cfe_psp_memory.c index af87f2b9..f6d4565e 100644 --- a/fsw/pc-rtems/src/cfe_psp_memory.c +++ b/fsw/pc-rtems/src/cfe_psp_memory.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -400,6 +400,22 @@ int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType) return CFE_PSP_SUCCESS; } +/****************************************************************************** +** +** Purpose: +** This function frees the top level reserved memory. +** +** Arguments: +** (none) +** +** Return: +** (none) +*/ +void CFE_PSP_DeleteProcessorReservedMemory(void) +{ + free(PcRtems_ReservedMemBlock.BlockPtr); +} + /* ********************************************************************************* ** ES BSP kernel memory segment functions diff --git a/fsw/pc-rtems/src/cfe_psp_ssr.c b/fsw/pc-rtems/src/cfe_psp_ssr.c index d0ac00b3..faf8f2a6 100644 --- a/fsw/pc-rtems/src/cfe_psp_ssr.c +++ b/fsw/pc-rtems/src/cfe_psp_ssr.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/pc-rtems/src/cfe_psp_start.c b/fsw/pc-rtems/src/cfe_psp_start.c index 5d03d17f..2de8a78a 100644 --- a/fsw/pc-rtems/src/cfe_psp_start.c +++ b/fsw/pc-rtems/src/cfe_psp_start.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -32,11 +32,7 @@ #include #include #include -#include -#include -#include -extern int rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching); /* ** cFE includes @@ -63,24 +59,6 @@ extern int rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) rtems_id RtemsTimerId; -static unsigned char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x61}; -static char net_name_str[] = "fxp1"; -static char ip_addr_str[] = "10.0.2.17"; -static char ip_netmask_str[] = "255.255.255.0"; - -static struct rtems_bsdnet_ifconfig netdriver_config = { - .name = net_name_str, - .attach = rtems_fxp_attach, - .next = NULL, - .ip_address = ip_addr_str, - .ip_netmask = ip_netmask_str, - .hardware_address = ethernet_address - /* more options can follow */ -}; - -struct rtems_bsdnet_config rtems_bsdnet_config = { - .ifconfig = &netdriver_config, .bootp = rtems_bsdnet_do_dhcp_failsafe, /* fill if DHCP is used*/ -}; /* ** 1 HZ Timer "ISR" @@ -112,18 +90,6 @@ int timer_count = 0; */ int CFE_PSP_Setup(void) { - rtems_status_code status; - - /* - * Initialize the network. This is also optional and only - * works if an appropriate network device is present. - */ - status = rtems_bsdnet_initialize_network(); - if (status != RTEMS_SUCCESSFUL) - { - printf("Network init not successful: %s / %s (continuing)\n", rtems_status_text(status), strerror(errno)); - } - return RTEMS_SUCCESSFUL; } diff --git a/fsw/pc-rtems/src/cfe_psp_support.c b/fsw/pc-rtems/src/cfe_psp_support.c index 8cb843d6..11e02199 100644 --- a/fsw/pc-rtems/src/cfe_psp_support.c +++ b/fsw/pc-rtems/src/cfe_psp_support.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -73,8 +73,16 @@ extern CFE_PSP_MemoryBlock_t PcRtems_ReservedMemBlock; *-----------------------------------------------------------------*/ void CFE_PSP_Restart(uint32 resetType) { + + CFE_PSP_DeleteProcessorReservedMemory(); + + /* + * Record the reset type for the next boot. + */ + CFE_PSP_ReservedMemoryMap.BootPtr->NextResetType = resetType; + CFE_PSP_ReservedMemoryMap.BootPtr->ValidityFlag = CFE_PSP_BOOTRECORD_VALID; + CFE_PSP_FlushCaches(1, PcRtems_ReservedMemBlock.BlockPtr, PcRtems_ReservedMemBlock.BlockSize); - OS_printf("%s is not implemented on this platform ( yet ! )\n", __func__); exit(EXIT_FAILURE); } diff --git a/fsw/pc-rtems/src/cfe_psp_watchdog.c b/fsw/pc-rtems/src/cfe_psp_watchdog.c index 4afac615..f8e3f0fb 100644 --- a/fsw/pc-rtems/src/cfe_psp_watchdog.c +++ b/fsw/pc-rtems/src/cfe_psp_watchdog.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/shared/CMakeLists.txt b/fsw/shared/CMakeLists.txt index 77173a70..58ced02e 100644 --- a/fsw/shared/CMakeLists.txt +++ b/fsw/shared/CMakeLists.txt @@ -11,8 +11,8 @@ # target implementation. This makes it implementation-specific even though # the same source code is used with multiple targets. -# Build the shared implementation as a library -add_library(psp-${CFE_PSP_TARGETNAME}-shared OBJECT +# Build file list for library +set(PSP_SHARED_SRCLIST src/cfe_psp_error.c src/cfe_psp_exceptionstorage.c src/cfe_psp_memrange.c @@ -21,6 +21,17 @@ add_library(psp-${CFE_PSP_TARGETNAME}-shared OBJECT src/cfe_psp_version.c ) +if (PSP_CONFIG_DEBUG_PRINTF) + list(APPEND PSP_SHARED_SRCLIST + src/cfe_psp_debug.c + ) +endif (PSP_CONFIG_DEBUG_PRINTF) + +# Build the shared implementation as a library +add_library(psp-${CFE_PSP_TARGETNAME}-shared OBJECT + ${PSP_SHARED_SRCLIST} +) + target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-shared PRIVATE $ ) diff --git a/fsw/shared/inc/cfe_psp_exceptionstorage_api.h b/fsw/shared/inc/cfe_psp_exceptionstorage_api.h index f46f1656..0e67bc1a 100644 --- a/fsw/shared/inc/cfe_psp_exceptionstorage_api.h +++ b/fsw/shared/inc/cfe_psp_exceptionstorage_api.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/shared/inc/cfe_psp_exceptionstorage_types.h b/fsw/shared/inc/cfe_psp_exceptionstorage_types.h index 7c38d922..dee9a552 100644 --- a/fsw/shared/inc/cfe_psp_exceptionstorage_types.h +++ b/fsw/shared/inc/cfe_psp_exceptionstorage_types.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/shared/inc/cfe_psp_memory.h b/fsw/shared/inc/cfe_psp_memory.h index cfa06477..bedd7493 100644 --- a/fsw/shared/inc/cfe_psp_memory.h +++ b/fsw/shared/inc/cfe_psp_memory.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/shared/inc/cfe_psp_module.h b/fsw/shared/inc/cfe_psp_module.h index 03cf938f..a594df75 100644 --- a/fsw/shared/inc/cfe_psp_module.h +++ b/fsw/shared/inc/cfe_psp_module.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/shared/src/cfe_psp_debug.c b/fsw/shared/src/cfe_psp_debug.c new file mode 100644 index 00000000..913a5b11 --- /dev/null +++ b/fsw/shared/src/cfe_psp_debug.c @@ -0,0 +1,92 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * \ingroup shared + * \author dwaine.s.molock@nasa.gov + * + * Contains the implementation for PSP_DEBUG(). + * + * This is only compiled when PSP_CONFIG_DEBUG_PRINTF is enabled. + */ + +/**************************************************************************************** + INCLUDE FILES + ***************************************************************************************/ +#include +#include +#include +#include + +/* + * User defined include files + */ +#include "cfe_psp.h" +#include "osapi.h" + +#define PSP_DEBUG_MAX_LINE_LEN 132 + +uint8 CFE_PSP_DebugLevel = CFE_PSP_DEBUG_LEVEL; + +/*---------------------------------------------------------------- + * + * Purpose: Outputs a single debug statement to the console + * + *-----------------------------------------------------------------*/ +void PSP_DebugPrintf(uint32 Level, const char *Func, uint32 Line, const char *Format, ...) +{ + char prefix[PSP_DEBUG_MAX_LINE_LEN]; + char buffer[PSP_DEBUG_MAX_LINE_LEN]; + int actualsz; + va_list va; + + if (CFE_PSP_DebugLevel >= Level) + { + /* build prefix string */ + actualsz = snprintf(prefix, sizeof(prefix), "PSP_DEBUG: %s():%lu ", Func, (unsigned long)Line); + if (actualsz < 0) + { + actualsz = 0; + } + else if (actualsz >= PSP_DEBUG_MAX_LINE_LEN) + { + actualsz = PSP_DEBUG_MAX_LINE_LEN - 1; + } + prefix[actualsz] = 0; + + /* build message str */ + va_start(va, Format); + actualsz = vsnprintf(buffer, sizeof(buffer), Format, va); + va_end(va); + + if (actualsz < 0) + { + actualsz = 0; + } + else if (actualsz >= PSP_DEBUG_MAX_LINE_LEN) + { + actualsz = PSP_DEBUG_MAX_LINE_LEN - 1; + } + buffer[actualsz] = 0; + + /* output message strings */ + OS_printf("%s%s", prefix, buffer); + } +} + diff --git a/fsw/shared/src/cfe_psp_error.c b/fsw/shared/src/cfe_psp_error.c index 97b9bf56..a74b8f9e 100644 --- a/fsw/shared/src/cfe_psp_error.c +++ b/fsw/shared/src/cfe_psp_error.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/shared/src/cfe_psp_exceptionstorage.c b/fsw/shared/src/cfe_psp_exceptionstorage.c index c23e6317..17470da2 100644 --- a/fsw/shared/src/cfe_psp_exceptionstorage.c +++ b/fsw/shared/src/cfe_psp_exceptionstorage.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -54,6 +54,7 @@ void CFE_PSP_Exception_Reset(void) { /* just reset the counter */ + PSP_DEBUG("Resetting Execption Log [Discarded Entries: %2lu]...\n", CFE_PSP_Exception_GetCount()); CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumRead = CFE_PSP_ReservedMemoryMap.ExceptionStoragePtr->NumWritten; } diff --git a/fsw/shared/src/cfe_psp_memrange.c b/fsw/shared/src/cfe_psp_memrange.c index f845bee1..739e5fcc 100644 --- a/fsw/shared/src/cfe_psp_memrange.c +++ b/fsw/shared/src/cfe_psp_memrange.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/shared/src/cfe_psp_memutils.c b/fsw/shared/src/cfe_psp_memutils.c index 4fa24ca8..debaef34 100644 --- a/fsw/shared/src/cfe_psp_memutils.c +++ b/fsw/shared/src/cfe_psp_memutils.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/shared/src/cfe_psp_module.c b/fsw/shared/src/cfe_psp_module.c index 3f5754cf..09421d4e 100644 --- a/fsw/shared/src/cfe_psp_module.c +++ b/fsw/shared/src/cfe_psp_module.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/fsw/shared/src/cfe_psp_version.c b/fsw/shared/src/cfe_psp_version.c index bb6f0583..fd8b4f2f 100644 --- a/fsw/shared/src/cfe_psp_version.c +++ b/fsw/shared/src/cfe_psp_version.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/pspconfig.h.in b/pspconfig.h.in new file mode 100644 index 00000000..5d481779 --- /dev/null +++ b/pspconfig.h.in @@ -0,0 +1,79 @@ +/** + * \brief Configuration file Platform Support Package Layer + * + * The specific definitions in this file may only be modified + * by setting the respective PSP configuration options in the CMake + * build. + * + * Any direct modifications to the generated copy will + * be overwritten each time CMake executes. + * + * \note This file was automatically generated by CMake from + * @CMAKE_CURRENT_SOURCE_DIR@/default_config.cmake + */ + +#ifndef PSPCONFIG_H +#define PSPCONFIG_H + +/* + * PSP feature selection options from build config + */ +#cmakedefine PSP_CONFIG_DEBUG_PRINTF + +/* + * PSP resource limits from build config + * + * (These are prefixed with CFE_PSP for compatibility + * with existing code referencing these symbols) + */ + + /** + * \brief The default debug level for PSP_DEBUG statements + * + * Based on the PSP_CONFIG_DEBUG_LEVEL configuration option + */ +#define CFE_PSP_DEBUG_LEVEL @PSP_CONFIG_DEBUG_LEVEL@ + + + /** + * \brief The default virtual FS mapping for the /cf directory, typically used for Linux and QNX + * + * Based on the PSP_CONFIG_CF_VIRTUAL_MAPPING configuration option + * + * \note This value must include a terminating NUL character + */ +#define CFE_PSP_CF_VIRTUAL_MAPPING "@PSP_CONFIG_CF_VIRTUAL_MAPPING@" + + + /** + * \brief The default virtual FS mapping for the EEPROM /cf directory, typically used for RTEMS + * + * Based on the PSP_CONFIG_CF_EEPROM_VIRTUAL_MAPPING configuration option + * + * \note This value must include a terminating NUL character + */ +#define CFE_PSP_CF_EEPROM_VIRTUAL_MAPPING "@PSP_CONFIG_CF_EEPROM_VIRTUAL_MAPPING@" + + + /** + * \brief The default virtual FS mapping for the ROMFS /cf directory, typically used for VxWorks 7.x + * + * Based on the PSP_CONFIG_CF_ROMFS_VIRTUAL_MAPPING configuration option + * + * \note This value must include a terminating NUL character + */ +#define CFE_PSP_CF_ROMFS_VIRTUAL_MAPPING "@PSP_CONFIG_CF_ROMFS_VIRTUAL_MAPPING@" + + + /** + * \brief The default virtual FS mapping for the physical device /cf directory, typically used for VxWorks 6.9 (MCP750) + * + * Based on the PSP_CONFIG_CF_PHY_DEV_VIRTUAL_MAPPING configuration option + * + * \note This value must include a terminating NUL character + */ +#define CFE_PSP_CF_PHY_DEV_VIRTUAL_MAPPING "@PSP_CONFIG_CF_PHY_DEV_VIRTUAL_MAPPING@" + + +#endif /* PSPCONFIG_H */ + diff --git a/unit-test-coverage/mcp750-vxworks/CMakeLists.txt b/unit-test-coverage/mcp750-vxworks/CMakeLists.txt index a0b5ddfa..f5e38f08 100644 --- a/unit-test-coverage/mcp750-vxworks/CMakeLists.txt +++ b/unit-test-coverage/mcp750-vxworks/CMakeLists.txt @@ -64,5 +64,5 @@ target_link_libraries(coverage-${CFE_PSP_TARGETNAME}-testrunner add_test(coverage-${CFE_PSP_TARGETNAME} coverage-${CFE_PSP_TARGETNAME}-testrunner) foreach(TGT ${INSTALL_TARGET_LIST}) - install(TARGETS coverage-${CFE_PSP_TARGETNAME}-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) + install(TARGETS coverage-${CFE_PSP_TARGETNAME}-testrunner DESTINATION ${TGT}) endforeach() diff --git a/unit-test-coverage/mcp750-vxworks/adaptors/inc/ut-adaptor-bootrec.h b/unit-test-coverage/mcp750-vxworks/adaptors/inc/ut-adaptor-bootrec.h index 965b56f1..2887b7d1 100644 --- a/unit-test-coverage/mcp750-vxworks/adaptors/inc/ut-adaptor-bootrec.h +++ b/unit-test-coverage/mcp750-vxworks/adaptors/inc/ut-adaptor-bootrec.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c b/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c index 835ac59e..5798d488 100644 --- a/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c +++ b/unit-test-coverage/mcp750-vxworks/adaptors/src/ut-adaptor-bootrec.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c index 46d3d7ce..65781c73 100644 --- a/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-start.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-support.c b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-support.c index ca804de6..53064933 100644 --- a/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-support.c +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-cfe-psp-support.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c index 61b44a99..a9829c00 100644 --- a/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.h b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.h index 01fa92f7..c7316024 100644 --- a/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.h +++ b/unit-test-coverage/mcp750-vxworks/src/coveragetest-psp-mcp750-vxworks.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/CMakeLists.txt b/unit-test-coverage/modules/CMakeLists.txt index 447f4f6c..686209a1 100644 --- a/unit-test-coverage/modules/CMakeLists.txt +++ b/unit-test-coverage/modules/CMakeLists.txt @@ -38,7 +38,8 @@ function(add_psp_covtest MODULE_NAME TESTCASE_SRC UT_SRCS) ${CFEPSP_SOURCE_DIR}/fsw/shared/inc # all PSP shared headers ${CFE_SOURCE_DIR}/cmake/target/inc # for sysconfig headers $ # use headers from OSAL - ) + $ + ) # Compile a test runner application, which contains the # actual coverage test code (test cases) and the unit under test @@ -71,7 +72,6 @@ endfunction() # a list of modules for which there is a coverage test implemented add_subdirectory(timebase_vxworks) add_subdirectory(vxworks_sysmon) -add_subdirectory(rtems_sysmon) add_subdirectory(ram_notimpl) add_subdirectory(ram_direct) add_subdirectory(port_notimpl) @@ -81,4 +81,5 @@ add_subdirectory(eeprom_mmap_file) add_subdirectory(eeprom_direct) add_subdirectory(iodriver) add_subdirectory(soft_timebase) - +add_subdirectory(network_pc686_rtems) +add_subdirectory(endian_api) diff --git a/unit-test-coverage/modules/eeprom_direct/coveragetest-eeprom_direct.c b/unit-test-coverage/modules/eeprom_direct/coveragetest-eeprom_direct.c index 44de0dfd..6b7b3c33 100644 --- a/unit-test-coverage/modules/eeprom_direct/coveragetest-eeprom_direct.c +++ b/unit-test-coverage/modules/eeprom_direct/coveragetest-eeprom_direct.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/eeprom_mmap_file/coveragetest-eeprom_mmap_file.c b/unit-test-coverage/modules/eeprom_mmap_file/coveragetest-eeprom_mmap_file.c index 5aef5ac8..1131d42f 100644 --- a/unit-test-coverage/modules/eeprom_mmap_file/coveragetest-eeprom_mmap_file.c +++ b/unit-test-coverage/modules/eeprom_mmap_file/coveragetest-eeprom_mmap_file.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/eeprom_notimpl/coveragetest-eeprom_notimpl.c b/unit-test-coverage/modules/eeprom_notimpl/coveragetest-eeprom_notimpl.c index 0e67f53c..5c5f5f8f 100644 --- a/unit-test-coverage/modules/eeprom_notimpl/coveragetest-eeprom_notimpl.c +++ b/unit-test-coverage/modules/eeprom_notimpl/coveragetest-eeprom_notimpl.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/endian_api/CMakeLists.txt b/unit-test-coverage/modules/endian_api/CMakeLists.txt new file mode 100644 index 00000000..89d83e56 --- /dev/null +++ b/unit-test-coverage/modules/endian_api/CMakeLists.txt @@ -0,0 +1,16 @@ +###################################################################### +# +# CMAKE build recipe for tests of Endianness conversions +# This contains a functional test not just a coverage test +# +add_definitions(-D_CFE_PSP_MODULE_) +add_definitions(-D_UNIT_TEST_) + +# Also link this with the real (non-stub) endian API +set (UT_COVERAGE_LINK_FLAGS endian_api ${UT_COVERAGE_LINK_FLAGS}) + +add_psp_covtest(endian_api coveragetest-endian_api.c + ${CFEPSP_SOURCE_DIR}/fsw/modules/endian_api/cfe_psp_endian_common.c + ${CFEPSP_SOURCE_DIR}/fsw/modules/endian_api/cfe_psp_endian_wrappers.c + ${CFEPSP_SOURCE_DIR}/fsw/modules/endian_api/cfe_psp_endian_generic.c +) diff --git a/unit-test-coverage/modules/endian_api/coveragetest-endian_api.c b/unit-test-coverage/modules/endian_api/coveragetest-endian_api.c new file mode 100644 index 00000000..9045a387 --- /dev/null +++ b/unit-test-coverage/modules/endian_api/coveragetest-endian_api.c @@ -0,0 +1,646 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +/* + * + * Copyright (c) 2020, United States government as represented by the + * administrator of the National Aeronautics Space Administration. + * All rights reserved. This software was created at NASA Goddard + * Space Flight Center pursuant to government contracts. + * + * This is governed by the NASA Open Source Agreement and may be used, + * distributed and modified only according to the terms of that agreement. + * + */ + +/** + * \file + * \ingroup modules + * + * HOW THIS WORKS: + * + * For each of the test cases, the test vector will be passed to the + * actual implementation used in FSW, and this becomes the reference value for + * a direct call to the two impls which are compiled with coverage testing flags. + * + * This obtains an element of correctness testing by comparing the generic + * conversion impl result to the FSW result, assuming that the latter was + * compiled with the endian.h version, thereby confirming both impls give + * the same result. + * + * However, on platforms that do not have endian.h and thus use the generic + * version only, it ends up comparing to itself. This is not really a + * correctness test because there is no way to check if the + * result is correct, but it still gets coverage, and at least verifies + * the result is consistent with itself, even if its not able to confirm + * that the result is correct. + * + * In both cases it can also be compiled with the "ubsan" to gain confidence + * that neither routine induces undefined behavior. + */ + +#include "utassert.h" +#include "utstubs.h" +#include "uttest.h" +#include "utgenstub.h" + +#include "cfe_psp_endian.h" +#include "PCS_endian.h" + +/* This compiles in both the generic and platform-specific implementations + * with different name prefixes, as well as the real (non-stub) implementation */ + +extern uint16 UT_WRAPPED_HtoBE16(uint16 host_16bits); +extern uint16 UT_WRAPPED_HtoLE16(uint16 host_16bits); +extern uint16 UT_WRAPPED_BE16toH(uint16 big_endian_16bits); +extern uint16 UT_WRAPPED_LE16toH(uint16 little_endian_16bits); + +extern uint32 UT_WRAPPED_HtoBE32(uint32 host_32bits); +extern uint32 UT_WRAPPED_HtoLE32(uint32 host_32bits); +extern uint32 UT_WRAPPED_BE32toH(uint32 big_endian_32bits); +extern uint32 UT_WRAPPED_LE32toH(uint32 little_endian_32bits); + +extern uint64 UT_WRAPPED_HtoBE64(uint64 host_64bits); +extern uint64 UT_WRAPPED_HtoLE64(uint64 host_64bits); +extern uint64 UT_WRAPPED_BE64toH(uint64 big_endian_64bits); +extern uint64 UT_WRAPPED_LE64toH(uint64 little_endian_64bits); + +extern uint16 UT_GENERIC_HtoBE16(uint16 host_16bits); +extern uint16 UT_GENERIC_HtoLE16(uint16 host_16bits); +extern uint16 UT_GENERIC_BE16toH(uint16 big_endian_16bits); +extern uint16 UT_GENERIC_LE16toH(uint16 little_endian_16bits); + +extern uint32 UT_GENERIC_HtoBE32(uint32 host_32bits); +extern uint32 UT_GENERIC_HtoLE32(uint32 host_32bits); +extern uint32 UT_GENERIC_BE32toH(uint32 big_endian_32bits); +extern uint32 UT_GENERIC_LE32toH(uint32 little_endian_32bits); + +extern uint64 UT_GENERIC_HtoBE64(uint64 host_64bits); +extern uint64 UT_GENERIC_HtoLE64(uint64 host_64bits); +extern uint64 UT_GENERIC_BE64toH(uint64 big_endian_64bits); +extern uint64 UT_GENERIC_LE64toH(uint64 little_endian_64bits); + +/* Internal values from the impl that need to be accessed here */ +extern uint8_t CFE_PSP_ENDIAN_INDICATOR; + +#define CFE_PSP_BIG_INDICATOR 0x25 +#define CFE_PSP_LITTLE_INDICATOR 0x9a + +extern void endian_api_Init(uint32 PspModuleId); +extern void CFE_PSP_ReportEndian(uint8 CheckValue); + +/* Define a handler for all the conversions that invokes the generic version */ +/* This means that the two implementations can be correlated */ + +/* + * ---------------------------------------------------- + * Handler for PCS_be16toh() + * ---------------------------------------------------- + */ +void UT_Handler_PCS_be16toh(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint16_t PCS_be16toh(uint16_t big_endian_16bits) */ + uint16_t val = UT_Hook_GetArgValueByName(Context, "big_endian_16bits", uint16_t); + val = UT_GENERIC_BE16toH(val); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for PCS_be32toh() + * ---------------------------------------------------- + */ +void UT_Handler_PCS_be32toh(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint32_t PCS_be32toh(uint32_t big_endian_32bits) */ + uint32_t val = UT_Hook_GetArgValueByName(Context, "big_endian_32bits", uint32_t); + val = UT_GENERIC_BE32toH(val); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for PCS_be64toh() + * ---------------------------------------------------- + */ +void UT_Handler_PCS_be64toh(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint64_t PCS_be64toh(uint64_t big_endian_64bits) */ + uint64_t val = UT_Hook_GetArgValueByName(Context, "big_endian_64bits", uint64_t); + val = UT_GENERIC_BE64toH(val); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for PCS_htobe16() + * ---------------------------------------------------- + */ +void UT_Handler_PCS_htobe16(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint16_t PCS_htobe16(uint16_t host_16bits) */ + uint16_t val = UT_Hook_GetArgValueByName(Context, "host_16bits", uint16_t); + val = UT_GENERIC_HtoBE16(val); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for PCS_htobe32() + * ---------------------------------------------------- + */ +void UT_Handler_PCS_htobe32(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint32_t PCS_htobe32(uint32_t host_32bits) */ + uint32_t val = UT_Hook_GetArgValueByName(Context, "host_32bits", uint32_t); + val = UT_GENERIC_HtoBE32(val); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for PCS_htobe64() + * ---------------------------------------------------- + */ +void UT_Handler_PCS_htobe64(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint64_t PCS_htobe64(uint64_t host_64bits) */ + uint64_t val = UT_Hook_GetArgValueByName(Context, "host_64bits", uint64_t); + val = UT_GENERIC_HtoBE64(val); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for PCS_htole16() + * ---------------------------------------------------- + */ +void UT_Handler_PCS_htole16(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint16_t PCS_htole16(uint16_t host_16bits) */ + uint16_t val = UT_Hook_GetArgValueByName(Context, "host_16bits", uint16_t); + val = UT_GENERIC_HtoLE16(val); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for PCS_htole32() + * ---------------------------------------------------- + */ +void UT_Handler_PCS_htole32(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint32_t PCS_htole32(uint32_t host_32bits) */ + uint32_t val = UT_Hook_GetArgValueByName(Context, "host_32bits", uint32_t); + val = UT_GENERIC_HtoLE32(val); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for PCS_htole64() + * ---------------------------------------------------- + */ +void UT_Handler_PCS_htole64(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint64_t PCS_htole64(uint64_t host_64bits) */ + uint64_t val = UT_Hook_GetArgValueByName(Context, "host_64bits", uint64_t); + val = UT_GENERIC_HtoLE64(val); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for PCS_le16toh() + * ---------------------------------------------------- + */ +void UT_Handler_PCS_le16toh(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint16_t PCS_le16toh(uint16_t little_endian_16bits) */ + uint16_t val = UT_Hook_GetArgValueByName(Context, "little_endian_16bits", uint16_t); + val = UT_GENERIC_LE16toH(val); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for PCS_le32toh() + * ---------------------------------------------------- + */ +void UT_Handler_PCS_le32toh(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint32_t PCS_le32toh(uint32_t little_endian_32bits) */ + uint32_t val = UT_Hook_GetArgValueByName(Context, "little_endian_32bits", uint32_t); + val = UT_GENERIC_LE32toH(val); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for PCS_le64toh() + * ---------------------------------------------------- + */ +void UT_Handler_PCS_le64toh(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint64_t PCS_le64toh(uint64_t little_endian_64bits) */ + uint64_t val = UT_Hook_GetArgValueByName(Context, "little_endian_64bits", uint64_t); + val = UT_GENERIC_LE64toH(val); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/********** TEST FUNCTIONS BEGIN HERE *************/ + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_HtoBE16: + * uint16 CFE_PSP_HtoBE16(uint16 host_16bits); + * ---------------------------------------------------- + */ +void Test_CFE_PSP_HtoBE16(void) +{ + uint16 host_16bits; + uint16 result; + const uint16 test_values[] = {0x1234, 0x5678, 0x9ABC, 0xDEF0}; + uint16 i; + + UT_SetHandlerFunction(UT_KEY(PCS_htobe16), UT_Handler_PCS_htobe16, NULL); + + for (i = 0; i < sizeof(test_values) / sizeof(test_values[0]); ++i) + { + host_16bits = test_values[i]; + result = CFE_PSP_HtoBE16(host_16bits); + UtAssert_EQ(uint16, UT_GENERIC_HtoBE16(host_16bits), result); + UtAssert_EQ(uint16, UT_WRAPPED_HtoBE16(host_16bits), result); + } +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_HtoLE16: + * uint16 CFE_PSP_HtoLE16(uint16 host_16bits); + * ---------------------------------------------------- + */ +void Test_CFE_PSP_HtoLE16(void) +{ + uint16 host_16bits; + const uint16 test_values[] = {0x1234, 0x5678, 0x9ABC, 0xDEF0}; + uint16 result; + uint16 i; + + UT_SetHandlerFunction(UT_KEY(PCS_htole16), UT_Handler_PCS_htole16, NULL); + + for (i = 0; i < sizeof(test_values) / sizeof(test_values[0]); ++i) + { + host_16bits = test_values[i]; + result = CFE_PSP_HtoLE16(host_16bits); + UtAssert_EQ(uint16, UT_GENERIC_HtoLE16(host_16bits), result); + UtAssert_EQ(uint16, UT_WRAPPED_HtoLE16(host_16bits), result); + } +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_BE16toH: + * uint16 CFE_PSP_BE16toH(uint16 big_endian_16bits) + * ---------------------------------------------------- + */ +void Test_CFE_PSP_BE16toH(void) +{ + uint16 big_endian_16bits; + const uint16 test_values[] = {0x1234, 0x5678, 0x9ABC, 0xDEF0}; + uint16 result; + uint16 i; + + UT_SetHandlerFunction(UT_KEY(PCS_be16toh), UT_Handler_PCS_be16toh, NULL); + + for (i = 0; i < sizeof(test_values) / sizeof(test_values[0]); ++i) + { + big_endian_16bits = test_values[i]; + result = CFE_PSP_BE16toH(big_endian_16bits); + UtAssert_EQ(uint16, UT_GENERIC_BE16toH(big_endian_16bits), result); + UtAssert_EQ(uint16, UT_WRAPPED_BE16toH(big_endian_16bits), result); + } +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_LE16toH: + * uint16 CFE_PSP_LE16toH(uint16 little_endian_16bi + * ---------------------------------------------------- + */ +void Test_CFE_PSP_LE16toH(void) +{ + uint16 little_endian_16bits; + const uint16 test_values[] = {0x1234, 0x5678, 0x9ABC, 0xDEF0}; + uint16 result; + uint16 i; + + UT_SetHandlerFunction(UT_KEY(PCS_le16toh), UT_Handler_PCS_le16toh, NULL); + + for (i = 0; i < sizeof(test_values) / sizeof(test_values[0]); ++i) + { + little_endian_16bits = test_values[i]; + result = CFE_PSP_LE16toH(little_endian_16bits); + UtAssert_EQ(uint16, UT_GENERIC_LE16toH(little_endian_16bits), result); + UtAssert_EQ(uint16, UT_WRAPPED_LE16toH(little_endian_16bits), result); + } +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_HtoBE32: + * uint32 CFE_PSP_HtoBE32(uint32 host_32bits); + * ---------------------------------------------------- + */ +void Test_CFE_PSP_HtoBE32(void) +{ + uint32 host_32bits; + const uint32 test_values[] = {0x12345678, 0x9ABCDEF0, 0x3456789A, 0xBCDEF012}; + uint32 result; + uint16 i; + + UT_SetHandlerFunction(UT_KEY(PCS_htobe32), UT_Handler_PCS_htobe32, NULL); + + for (i = 0; i < sizeof(test_values) / sizeof(test_values[0]); ++i) + { + host_32bits = test_values[i]; + result = CFE_PSP_HtoBE32(host_32bits); + UtAssert_EQ(uint32, UT_GENERIC_HtoBE32(host_32bits), result); + UtAssert_EQ(uint32, UT_WRAPPED_HtoBE32(host_32bits), result); + } +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_HtoLE32: + * uint32 CFE_PSP_HtoLE32(uint32 host_32bits); + * ---------------------------------------------------- + */ +void Test_CFE_PSP_HtoLE32(void) +{ + uint32 host_32bits; + const uint32 test_values[] = {0x12345678, 0x9ABCDEF0, 0x3456789A, 0xBCDEF012}; + uint32 result; + uint16 i; + + UT_SetHandlerFunction(UT_KEY(PCS_htole32), UT_Handler_PCS_htole32, NULL); + + for (i = 0; i < sizeof(test_values) / sizeof(test_values[0]); ++i) + { + host_32bits = test_values[i]; + result = CFE_PSP_HtoLE32(host_32bits); + UtAssert_EQ(uint32, UT_GENERIC_HtoLE32(host_32bits), result); + UtAssert_EQ(uint32, UT_WRAPPED_HtoLE32(host_32bits), result); + } +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_BE32toH: + * uint32 CFE_PSP_BE32toH(uint32 big_endian_32bits) + * ---------------------------------------------------- + */ +void Test_CFE_PSP_BE32toH(void) +{ + uint32 big_endian_32bits; + const uint32 test_values[] = {0x12345678, 0x9ABCDEF0, 0x3456789A, 0xBCDEF012}; + uint32 result; + uint16 i; + + UT_SetHandlerFunction(UT_KEY(PCS_be32toh), UT_Handler_PCS_be32toh, NULL); + + for (i = 0; i < sizeof(test_values) / sizeof(test_values[0]); ++i) + { + big_endian_32bits = test_values[i]; + result = CFE_PSP_BE32toH(big_endian_32bits); + UtAssert_EQ(uint32, UT_GENERIC_BE32toH(big_endian_32bits), result); + UtAssert_EQ(uint32, UT_WRAPPED_BE32toH(big_endian_32bits), result); + } +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_LE32toH: + * uint32 CFE_PSP_LE32toH(uint32 little_endian_32bi + * ---------------------------------------------------- + */ +void Test_CFE_PSP_LE32toH(void) +{ + uint32 little_endian_32bits; + const uint32 test_values[] = {0x12345678, 0x9ABCDEF0, 0x3456789A, 0xBCDEF012}; + uint32 result; + uint16 i; + + UT_SetHandlerFunction(UT_KEY(PCS_le32toh), UT_Handler_PCS_le32toh, NULL); + + for (i = 0; i < sizeof(test_values) / sizeof(test_values[0]); ++i) + { + little_endian_32bits = test_values[i]; + result = CFE_PSP_LE32toH(little_endian_32bits); + UtAssert_EQ(uint32, UT_GENERIC_LE32toH(little_endian_32bits), result); + UtAssert_EQ(uint32, UT_WRAPPED_LE32toH(little_endian_32bits), result); + } +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_HtoBE64: + * uint64 CFE_PSP_HtoBE64(uint64 host_64bits); + * ---------------------------------------------------- + */ +void Test_CFE_PSP_HtoBE64(void) +{ + uint64 host_64bits; + const uint64 test_values[] = {0x123456789ABCDEF0, 0x56789ABCDEF01234, 0x9ABCDEF012345678, 0xDEF0123456789ABC}; + uint64 result; + uint16 i; + + UT_SetHandlerFunction(UT_KEY(PCS_htobe64), UT_Handler_PCS_htobe64, NULL); + + for (i = 0; i < sizeof(test_values) / sizeof(test_values[0]); ++i) + { + host_64bits = test_values[i]; + result = CFE_PSP_HtoBE64(host_64bits); + UtAssert_EQ(uint64, UT_GENERIC_HtoBE64(host_64bits), result); + UtAssert_EQ(uint64, UT_WRAPPED_HtoBE64(host_64bits), result); + } +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_HtoLE64: + * uint64 CFE_PSP_HtoLE64(uint64 host_64bits); + * ---------------------------------------------------- + */ +void Test_CFE_PSP_HtoLE64(void) +{ + uint64 host_64bits; + const uint64 test_values[] = {0x123456789ABCDEF0, 0x56789ABCDEF01234, 0x9ABCDEF012345678, 0xDEF0123456789ABC}; + uint64 result; + uint16 i; + + UT_SetHandlerFunction(UT_KEY(PCS_htole64), UT_Handler_PCS_htole64, NULL); + + for (i = 0; i < sizeof(test_values) / sizeof(test_values[0]); ++i) + { + host_64bits = test_values[i]; + result = CFE_PSP_HtoLE64(host_64bits); + UtAssert_EQ(uint64, UT_GENERIC_HtoLE64(host_64bits), result); + UtAssert_EQ(uint64, UT_WRAPPED_HtoLE64(host_64bits), result); + } +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_BE64toH: + * uint64 CFE_PSP_BE64toH(uint64 big_endian_64bits) + * ---------------------------------------------------- + */ +void Test_CFE_PSP_BE64toH(void) +{ + uint64 big_endian_64bits; + const uint64 test_values[] = {0x123456789ABCDEF0, 0x56789ABCDEF01234, 0x9ABCDEF012345678, 0xDEF0123456789ABC}; + uint64 result; + uint16 i; + + UT_SetHandlerFunction(UT_KEY(PCS_be64toh), UT_Handler_PCS_be64toh, NULL); + + for (i = 0; i < sizeof(test_values) / sizeof(test_values[0]); ++i) + { + big_endian_64bits = test_values[i]; + result = CFE_PSP_BE64toH(big_endian_64bits); + UtAssert_EQ(uint64, UT_GENERIC_BE64toH(big_endian_64bits), result); + UtAssert_EQ(uint64, UT_WRAPPED_BE64toH(big_endian_64bits), result); + } +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_LE64toH: + * uint64 CFE_PSP_LE64toH(uint64 little_endian_64bi + * ---------------------------------------------------- + */ +void Test_CFE_PSP_LE64toH(void) +{ + uint64 little_endian_64bits; + const uint64 test_values[] = {0x123456789ABCDEF0, 0x56789ABCDEF01234, 0x9ABCDEF012345678, 0xDEF0123456789ABC}; + uint64 result; + uint16 i; + + UT_SetHandlerFunction(UT_KEY(PCS_le64toh), UT_Handler_PCS_le64toh, NULL); + + for (i = 0; i < sizeof(test_values) / sizeof(test_values[0]); ++i) + { + little_endian_64bits = test_values[i]; + result = CFE_PSP_LE64toH(little_endian_64bits); + UtAssert_EQ(uint64, UT_GENERIC_LE64toH(little_endian_64bits), result); + UtAssert_EQ(uint64, UT_WRAPPED_LE64toH(little_endian_64bits), result); + } +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_IsBigEndian + * bool CFE_PSP_IsBigEndian(void) + * ---------------------------------------------------- + */ +void Test_CFE_PSP_IsBigEndian(void) +{ + CFE_PSP_ENDIAN_INDICATOR = 0; + UtAssert_BOOL_FALSE(CFE_PSP_IsBigEndian()); + CFE_PSP_ENDIAN_INDICATOR = CFE_PSP_LITTLE_INDICATOR; + UtAssert_BOOL_FALSE(CFE_PSP_IsBigEndian()); + CFE_PSP_ENDIAN_INDICATOR = CFE_PSP_BIG_INDICATOR; + UtAssert_BOOL_TRUE(CFE_PSP_IsBigEndian()); +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_IsLittleEndian + * bool CFE_PSP_IsLittleEndian(void) + * ---------------------------------------------------- + */ +void Test_CFE_PSP_IsLittleEndian(void) +{ + CFE_PSP_ENDIAN_INDICATOR = 0; + UtAssert_BOOL_FALSE(CFE_PSP_IsLittleEndian()); + CFE_PSP_ENDIAN_INDICATOR = CFE_PSP_LITTLE_INDICATOR; + UtAssert_BOOL_TRUE(CFE_PSP_IsLittleEndian()); + CFE_PSP_ENDIAN_INDICATOR = CFE_PSP_BIG_INDICATOR; + UtAssert_BOOL_FALSE(CFE_PSP_IsLittleEndian()); +} + +/* + * ---------------------------------------------------- + * Test Case For: CFE_PSP_ReportEndian + * void CFE_PSP_ReportEndian(uint8 CheckValue) + * ---------------------------------------------------- + */ +void Test_CFE_PSP_ReportEndian(void) +{ + /* this has no outputs but prints a different message depending on the check value */ + UtAssert_VOIDCALL(CFE_PSP_ReportEndian(0)); + UtAssert_VOIDCALL(CFE_PSP_ReportEndian(CFE_PSP_LITTLE_INDICATOR)); + UtAssert_VOIDCALL(CFE_PSP_ReportEndian(CFE_PSP_BIG_INDICATOR)); +} + +/* + * ---------------------------------------------------- + * Test Case For: endian_api_Init + * void endian_api_Init(uint32 PspModuleId) + * ---------------------------------------------------- + */ +void Test_endian_api_Init(void) +{ + /* no branches here and nothing to check; called for coverage */ + UtAssert_VOIDCALL(endian_api_Init(1)); +} + +/* + * Macro to add a test case to the list of tests to execute + */ +#define ADD_TEST(test) UtTest_Add(test, ResetTest, NULL, #test) + +void ResetTest(void) +{ + UT_ResetState(0); +} + +/* + * Register the test cases to execute with the unit test tool + */ +void UtTest_Setup(void) +{ + ADD_TEST(Test_endian_api_Init); + ADD_TEST(Test_CFE_PSP_ReportEndian); + ADD_TEST(Test_CFE_PSP_IsBigEndian); + ADD_TEST(Test_CFE_PSP_IsLittleEndian); + + ADD_TEST(Test_CFE_PSP_HtoBE16); + ADD_TEST(Test_CFE_PSP_HtoLE16); + ADD_TEST(Test_CFE_PSP_BE16toH); + ADD_TEST(Test_CFE_PSP_LE16toH); + ADD_TEST(Test_CFE_PSP_HtoBE32); + ADD_TEST(Test_CFE_PSP_HtoLE32); + ADD_TEST(Test_CFE_PSP_BE32toH); + ADD_TEST(Test_CFE_PSP_LE32toH); + ADD_TEST(Test_CFE_PSP_HtoBE64); + ADD_TEST(Test_CFE_PSP_HtoLE64); + ADD_TEST(Test_CFE_PSP_BE64toH); + ADD_TEST(Test_CFE_PSP_LE64toH); +} diff --git a/unit-test-coverage/modules/iodriver/coveragetest-iodriver.c b/unit-test-coverage/modules/iodriver/coveragetest-iodriver.c index a8a272ea..171c1435 100644 --- a/unit-test-coverage/modules/iodriver/coveragetest-iodriver.c +++ b/unit-test-coverage/modules/iodriver/coveragetest-iodriver.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/linux_sysmon/coveragetest-linux_sysmon.c b/unit-test-coverage/modules/linux_sysmon/coveragetest-linux_sysmon.c index d80141c9..25c6fc6c 100644 --- a/unit-test-coverage/modules/linux_sysmon/coveragetest-linux_sysmon.c +++ b/unit-test-coverage/modules/linux_sysmon/coveragetest-linux_sysmon.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/network_pc686_rtems/CMakeLists.txt b/unit-test-coverage/modules/network_pc686_rtems/CMakeLists.txt new file mode 100644 index 00000000..293a54de --- /dev/null +++ b/unit-test-coverage/modules/network_pc686_rtems/CMakeLists.txt @@ -0,0 +1,10 @@ +###################################################################### +# +# CMAKE build recipe for white-box coverage tests of VxWorks timebase module +# +add_definitions(-D_CFE_PSP_MODULE_) +include_directories("${CMAKE_CURRENT_SOURCE_DIR}/inc") + +add_psp_covtest(network_pc686_rtems coveragetest-network_pc686_rtems.c + ${CFEPSP_SOURCE_DIR}/fsw/modules/network_pc686_rtems/cfe_psp_network_pc686_rtems.c +) diff --git a/unit-test-coverage/modules/network_pc686_rtems/coveragetest-network_pc686_rtems.c b/unit-test-coverage/modules/network_pc686_rtems/coveragetest-network_pc686_rtems.c new file mode 100644 index 00000000..f5f93c7e --- /dev/null +++ b/unit-test-coverage/modules/network_pc686_rtems/coveragetest-network_pc686_rtems.c @@ -0,0 +1,61 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +#include "utassert.h" +#include "utstubs.h" +#include "uttest.h" + +#include "cfe_psp.h" +#include "cfe_psp_config.h" +#include "cfe_psp_module.h" + +#include "PCS_rtems.h" +#include "PCS_bsdnet.h" +#include "PCS_stdlib.h" +#include "PCS_stdio.h" + +/* This does not have a prototype */ +extern void network_pc686_rtems_Init(uint32 PspModuleId); + +void Test_network_pc686_rtems_Init(void) +{ + /* + Test case for: + void network_pc686_rtems_Init(uint32 PspModuleId) + */ + UtAssert_VOIDCALL(network_pc686_rtems_Init(1)); + UtAssert_STUB_COUNT(PCS_printf, 1); + + /* Test for printf due to error from rtems_bsdnet_initialize_network */ + UT_SetDefaultReturnValue(UT_KEY(PCS_rtems_bsdnet_initialize_network), -1); + UtAssert_VOIDCALL(network_pc686_rtems_Init(1)); + UtAssert_STUB_COUNT(PCS_printf, 3); +} + +/* + * Macro to add a test case to the list of tests to execute + */ +#define ADD_TEST(test) UtTest_Add(test, NULL, NULL, #test) + +/* + * Register the test cases to execute with the unit test tool + */ +void UtTest_Setup(void) +{ + ADD_TEST(Test_network_pc686_rtems_Init); +} \ No newline at end of file diff --git a/unit-test-coverage/modules/port_direct/coveragetest-port_direct.c b/unit-test-coverage/modules/port_direct/coveragetest-port_direct.c index d2593549..faf1453a 100644 --- a/unit-test-coverage/modules/port_direct/coveragetest-port_direct.c +++ b/unit-test-coverage/modules/port_direct/coveragetest-port_direct.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/port_notimpl/coveragetest-port_notimpl.c b/unit-test-coverage/modules/port_notimpl/coveragetest-port_notimpl.c index 976972a9..e31be8f9 100644 --- a/unit-test-coverage/modules/port_notimpl/coveragetest-port_notimpl.c +++ b/unit-test-coverage/modules/port_notimpl/coveragetest-port_notimpl.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/ram_direct/coveragetest-ram_direct.c b/unit-test-coverage/modules/ram_direct/coveragetest-ram_direct.c index 2cda9b3e..c79a7f45 100644 --- a/unit-test-coverage/modules/ram_direct/coveragetest-ram_direct.c +++ b/unit-test-coverage/modules/ram_direct/coveragetest-ram_direct.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/ram_notimpl/coveragetest-ram_notimpl.c b/unit-test-coverage/modules/ram_notimpl/coveragetest-ram_notimpl.c index e0f15699..d518c5ef 100644 --- a/unit-test-coverage/modules/ram_notimpl/coveragetest-ram_notimpl.c +++ b/unit-test-coverage/modules/ram_notimpl/coveragetest-ram_notimpl.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon.h b/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon.h index 06696121..7f1d28da 100644 --- a/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon.h +++ b/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon.h @@ -1,6 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: - * Draco + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. @@ -15,7 +14,7 @@ * 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. - **********************************************************************/ + ************************************************************************/ /* * diff --git a/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon_utils.h b/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon_utils.h index e14aa797..56f15a2d 100644 --- a/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon_utils.h +++ b/unit-test-coverage/modules/rtems_sysmon/inc/coveragetest-rtems_sysmon_utils.h @@ -1,6 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: - * Draco + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. @@ -15,7 +14,7 @@ * 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. - **********************************************************************/ + ************************************************************************/ /* * diff --git a/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon.c b/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon.c index 05ddc369..d2f51da2 100644 --- a/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon.c +++ b/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon_utils.c b/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon_utils.c index b35ce20b..8d37d596 100644 --- a/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon_utils.c +++ b/unit-test-coverage/modules/rtems_sysmon/src/coveragetest-rtems_sysmon_utils.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/soft_timebase/coveragetest-soft_timebase.c b/unit-test-coverage/modules/soft_timebase/coveragetest-soft_timebase.c index e7c6a8d9..d01e1bf1 100644 --- a/unit-test-coverage/modules/soft_timebase/coveragetest-soft_timebase.c +++ b/unit-test-coverage/modules/soft_timebase/coveragetest-soft_timebase.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/soft_timebase/inc/cfe_psp_config.h b/unit-test-coverage/modules/soft_timebase/inc/cfe_psp_config.h index 9ff3fe70..e08558e7 100644 --- a/unit-test-coverage/modules/soft_timebase/inc/cfe_psp_config.h +++ b/unit-test-coverage/modules/soft_timebase/inc/cfe_psp_config.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/timebase_posix_clock/coveragetest-timebase_posix_clock.c b/unit-test-coverage/modules/timebase_posix_clock/coveragetest-timebase_posix_clock.c index 3486c4ce..6f2396f1 100644 --- a/unit-test-coverage/modules/timebase_posix_clock/coveragetest-timebase_posix_clock.c +++ b/unit-test-coverage/modules/timebase_posix_clock/coveragetest-timebase_posix_clock.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/timebase_vxworks/inc/cfe_psp_config.h b/unit-test-coverage/modules/timebase_vxworks/inc/cfe_psp_config.h index 78d379e3..7a59d2ea 100644 --- a/unit-test-coverage/modules/timebase_vxworks/inc/cfe_psp_config.h +++ b/unit-test-coverage/modules/timebase_vxworks/inc/cfe_psp_config.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/timebase_vxworks/inc/coveragetest-timebase_vxworks.h b/unit-test-coverage/modules/timebase_vxworks/inc/coveragetest-timebase_vxworks.h index 283ca8d8..2c604923 100644 --- a/unit-test-coverage/modules/timebase_vxworks/inc/coveragetest-timebase_vxworks.h +++ b/unit-test-coverage/modules/timebase_vxworks/inc/coveragetest-timebase_vxworks.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/timebase_vxworks/src/coveragetest-timebase_vxworks.c b/unit-test-coverage/modules/timebase_vxworks/src/coveragetest-timebase_vxworks.c index cc6f5fcb..97521216 100644 --- a/unit-test-coverage/modules/timebase_vxworks/src/coveragetest-timebase_vxworks.c +++ b/unit-test-coverage/modules/timebase_vxworks/src/coveragetest-timebase_vxworks.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/modules/vxworks_sysmon/inc/coveragetest-vxworks_sysmon.h b/unit-test-coverage/modules/vxworks_sysmon/inc/coveragetest-vxworks_sysmon.h index 21db0bb2..71de1a2b 100644 --- a/unit-test-coverage/modules/vxworks_sysmon/inc/coveragetest-vxworks_sysmon.h +++ b/unit-test-coverage/modules/vxworks_sysmon/inc/coveragetest-vxworks_sysmon.h @@ -1,6 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: - * Draco + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. @@ -15,7 +14,7 @@ * 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. - **********************************************************************/ + ************************************************************************/ /* * diff --git a/unit-test-coverage/modules/vxworks_sysmon/src/coveragetest-vxworks_sysmon.c b/unit-test-coverage/modules/vxworks_sysmon/src/coveragetest-vxworks_sysmon.c index 5803793c..63350fe4 100644 --- a/unit-test-coverage/modules/vxworks_sysmon/src/coveragetest-vxworks_sysmon.c +++ b/unit-test-coverage/modules/vxworks_sysmon/src/coveragetest-vxworks_sysmon.c @@ -1,6 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: - * Draco + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. @@ -15,7 +14,7 @@ * 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. - **********************************************************************/ + ************************************************************************/ /* * diff --git a/unit-test-coverage/pc-rtems/CMakeLists.txt b/unit-test-coverage/pc-rtems/CMakeLists.txt index 4029bd0f..c12ae852 100644 --- a/unit-test-coverage/pc-rtems/CMakeLists.txt +++ b/unit-test-coverage/pc-rtems/CMakeLists.txt @@ -46,5 +46,5 @@ target_link_libraries(coverage-${CFE_PSP_TARGETNAME}-testrunner PUBLIC add_test(coverage-${CFE_PSP_TARGETNAME} coverage-${CFE_PSP_TARGETNAME}-testrunner) foreach(TGT ${INSTALL_TARGET_LIST}) - install(TARGETS coverage-${CFE_PSP_TARGETNAME}-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) + install(TARGETS coverage-${CFE_PSP_TARGETNAME}-testrunner DESTINATION ${TGT}) endforeach() diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-exception.c b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-exception.c index edd82b3b..f28186a9 100644 --- a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-exception.c +++ b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-exception.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-memory.c b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-memory.c index 75db7adf..f62bd0a5 100644 --- a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-memory.c +++ b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-memory.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-ssr.c b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-ssr.c index c670c087..11bdd8fa 100644 --- a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-ssr.c +++ b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-ssr.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-start.c b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-start.c index ffa95577..b7582489 100644 --- a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-start.c +++ b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-start.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -39,11 +39,6 @@ void Test_CFE_PSP_Setup(void) { /* Nominal/Success path */ UtAssert_INT32_EQ(CFE_PSP_Setup(), PCS_RTEMS_SUCCESSFUL); - - /* Test for printf due to error from rtems_bsdnet_initialize_network (function still returns RTEMS_SUCCESSFUL) */ - UT_SetDefaultReturnValue(UT_KEY(PCS_rtems_bsdnet_initialize_network), -1); - UtAssert_INT32_EQ(CFE_PSP_Setup(), PCS_RTEMS_SUCCESSFUL); - UtAssert_STUB_COUNT(PCS_printf, 1); } void Test_OS_Application_Startup(void) diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-support.c b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-support.c index f42e070b..6f3d9336 100644 --- a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-support.c +++ b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-support.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-watchdog.c b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-watchdog.c index 273019b8..48b4360b 100644 --- a/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-watchdog.c +++ b/unit-test-coverage/pc-rtems/src/coveragetest-cfe-psp-watchdog.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.c b/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.c index e1be439a..3e5a8612 100644 --- a/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.c +++ b/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.h b/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.h index f095eae1..b0205334 100644 --- a/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.h +++ b/unit-test-coverage/pc-rtems/src/coveragetest-psp-pc-rtems.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-bootrec.h b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-bootrec.h index 44ea72e6..32954507 100644 --- a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-bootrec.h +++ b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-bootrec.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-cdsmem.h b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-cdsmem.h index 9d6fd28a..65066ace 100644 --- a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-cdsmem.h +++ b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-cdsmem.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-exceptions.h b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-exceptions.h index a7e2e28f..0168bf32 100644 --- a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-exceptions.h +++ b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-exceptions.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-memrange.h b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-memrange.h index 307ab9c1..4a940aef 100644 --- a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-memrange.h +++ b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-memrange.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-resetmem.h b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-resetmem.h index 90749434..3588e220 100644 --- a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-resetmem.h +++ b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-resetmem.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-usermem.h b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-usermem.h index 2e3f3fa8..c347cf73 100644 --- a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-usermem.h +++ b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-usermem.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-voldisk.h b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-voldisk.h index 01dd00b0..2128937d 100644 --- a/unit-test-coverage/shared/adaptors/inc/ut-adaptor-voldisk.h +++ b/unit-test-coverage/shared/adaptors/inc/ut-adaptor-voldisk.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/src/ut-adaptor-bootrec.c b/unit-test-coverage/shared/adaptors/src/ut-adaptor-bootrec.c index b711d7ca..b98d88ee 100644 --- a/unit-test-coverage/shared/adaptors/src/ut-adaptor-bootrec.c +++ b/unit-test-coverage/shared/adaptors/src/ut-adaptor-bootrec.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/src/ut-adaptor-cdsmem.c b/unit-test-coverage/shared/adaptors/src/ut-adaptor-cdsmem.c index 58368f8d..9cd19c2e 100644 --- a/unit-test-coverage/shared/adaptors/src/ut-adaptor-cdsmem.c +++ b/unit-test-coverage/shared/adaptors/src/ut-adaptor-cdsmem.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/src/ut-adaptor-exceptions.c b/unit-test-coverage/shared/adaptors/src/ut-adaptor-exceptions.c index edd440e6..95240173 100644 --- a/unit-test-coverage/shared/adaptors/src/ut-adaptor-exceptions.c +++ b/unit-test-coverage/shared/adaptors/src/ut-adaptor-exceptions.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/src/ut-adaptor-memrange.c b/unit-test-coverage/shared/adaptors/src/ut-adaptor-memrange.c index c39b6180..2cd3c045 100644 --- a/unit-test-coverage/shared/adaptors/src/ut-adaptor-memrange.c +++ b/unit-test-coverage/shared/adaptors/src/ut-adaptor-memrange.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/src/ut-adaptor-resetmem.c b/unit-test-coverage/shared/adaptors/src/ut-adaptor-resetmem.c index 8767a94a..a6570a23 100644 --- a/unit-test-coverage/shared/adaptors/src/ut-adaptor-resetmem.c +++ b/unit-test-coverage/shared/adaptors/src/ut-adaptor-resetmem.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/src/ut-adaptor-usermem.c b/unit-test-coverage/shared/adaptors/src/ut-adaptor-usermem.c index db7eee6b..87ba3942 100644 --- a/unit-test-coverage/shared/adaptors/src/ut-adaptor-usermem.c +++ b/unit-test-coverage/shared/adaptors/src/ut-adaptor-usermem.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/adaptors/src/ut-adaptor-voldisk.c b/unit-test-coverage/shared/adaptors/src/ut-adaptor-voldisk.c index a6e86dcc..dd1e1783 100644 --- a/unit-test-coverage/shared/adaptors/src/ut-adaptor-voldisk.c +++ b/unit-test-coverage/shared/adaptors/src/ut-adaptor-voldisk.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/inc/coveragetest-psp-shared.h b/unit-test-coverage/shared/inc/coveragetest-psp-shared.h index 14af5213..c1146727 100644 --- a/unit-test-coverage/shared/inc/coveragetest-psp-shared.h +++ b/unit-test-coverage/shared/inc/coveragetest-psp-shared.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/src/coveragetest-cfe-psp-error.c b/unit-test-coverage/shared/src/coveragetest-cfe-psp-error.c index 28f49b87..bd129725 100644 --- a/unit-test-coverage/shared/src/coveragetest-cfe-psp-error.c +++ b/unit-test-coverage/shared/src/coveragetest-cfe-psp-error.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c b/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c index e9a6725f..fe861359 100644 --- a/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c +++ b/unit-test-coverage/shared/src/coveragetest-cfe-psp-exceptionstorage.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/src/coveragetest-cfe-psp-memrange.c b/unit-test-coverage/shared/src/coveragetest-cfe-psp-memrange.c index 899c4307..86a0ddc1 100644 --- a/unit-test-coverage/shared/src/coveragetest-cfe-psp-memrange.c +++ b/unit-test-coverage/shared/src/coveragetest-cfe-psp-memrange.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/src/coveragetest-cfe-psp-memutils.c b/unit-test-coverage/shared/src/coveragetest-cfe-psp-memutils.c index e74964d4..2aecb252 100644 --- a/unit-test-coverage/shared/src/coveragetest-cfe-psp-memutils.c +++ b/unit-test-coverage/shared/src/coveragetest-cfe-psp-memutils.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/src/coveragetest-cfe-psp-module.c b/unit-test-coverage/shared/src/coveragetest-cfe-psp-module.c index 7ca9c80c..6773476b 100644 --- a/unit-test-coverage/shared/src/coveragetest-cfe-psp-module.c +++ b/unit-test-coverage/shared/src/coveragetest-cfe-psp-module.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/shared/src/coveragetest-cfe-psp-version.c b/unit-test-coverage/shared/src/coveragetest-cfe-psp-version.c index 530fd97d..5c01bdef 100644 --- a/unit-test-coverage/shared/src/coveragetest-cfe-psp-version.c +++ b/unit-test-coverage/shared/src/coveragetest-cfe-psp-version.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -75,5 +75,5 @@ void Test_CFE_PSP_GetBuildNumber(void) * uint32 CFE_PSP_GetBuildNumber(void) */ - UtAssert_NONZERO(CFE_PSP_GetBuildNumber()); + UtAssert_VOIDCALL(CFE_PSP_GetBuildNumber()); } diff --git a/unit-test-coverage/ut-stubs/CMakeLists.txt b/unit-test-coverage/ut-stubs/CMakeLists.txt index 9ddb8309..40c9ebdb 100644 --- a/unit-test-coverage/ut-stubs/CMakeLists.txt +++ b/unit-test-coverage/ut-stubs/CMakeLists.txt @@ -48,6 +48,7 @@ add_library(ut_psp_libc_stubs STATIC EXCLUDE_FROM_ALL src/PCS_drv_hdisk_ataDrv_stubs.c src/PCS_drv_pci_pciConfigLib_handlers.c src/PCS_drv_pci_pciConfigLib_stubs.c + src/PCS_endian_stubs.c src/PCS_errno_globals.c src/PCS_errnoLib_stubs.c src/PCS_excLib_stubs.c diff --git a/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_esfPpc.h b/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_esfPpc.h index 6c7c8c14..de31eddf 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_esfPpc.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_esfPpc.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h b/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h index 43a49ece..a1bfee40 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_arch_ppc_vxPpcLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_arpa_inet.h b/unit-test-coverage/ut-stubs/inc/PCS_arpa_inet.h index a0de82bb..f8f7d949 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_arpa_inet.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_arpa_inet.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_basetypes.h b/unit-test-coverage/ut-stubs/inc/PCS_basetypes.h index f1136345..13d699b6 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_basetypes.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_basetypes.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_blkIo.h b/unit-test-coverage/ut-stubs/inc/PCS_blkIo.h index 1d2a023e..16f978bb 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_blkIo.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_blkIo.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_bsdnet.h b/unit-test-coverage/ut-stubs/inc/PCS_bsdnet.h index 6857fa1f..096ad5a1 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_bsdnet.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_bsdnet.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_cacheLib.h b/unit-test-coverage/ut-stubs/inc/PCS_cacheLib.h index db749be9..8b252005 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_cacheLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_cacheLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_cfe_configdata.h b/unit-test-coverage/ut-stubs/inc/PCS_cfe_configdata.h index eb555bb3..59fcc3fd 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_cfe_configdata.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_cfe_configdata.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_cpuuse.h b/unit-test-coverage/ut-stubs/inc/PCS_cpuuse.h index 024cdd66..baa4dd48 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_cpuuse.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_cpuuse.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_dosFsLib.h b/unit-test-coverage/ut-stubs/inc/PCS_dosFsLib.h index ab4403c0..1074908d 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_dosFsLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_dosFsLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_drv_hdisk_ataDrv.h b/unit-test-coverage/ut-stubs/inc/PCS_drv_hdisk_ataDrv.h index 513be366..9d275ae7 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_drv_hdisk_ataDrv.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_drv_hdisk_ataDrv.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_drv_pci_pciConfigLib.h b/unit-test-coverage/ut-stubs/inc/PCS_drv_pci_pciConfigLib.h index 343b24a8..6987fb04 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_drv_pci_pciConfigLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_drv_pci_pciConfigLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_endian.h b/unit-test-coverage/ut-stubs/inc/PCS_endian.h new file mode 100644 index 00000000..53fd25e0 --- /dev/null +++ b/unit-test-coverage/ut-stubs/inc/PCS_endian.h @@ -0,0 +1,72 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +/************************************************************************ + * Note that this file has been cloned-n-owned from its open-source github + * repository for Gateway as of September 2023. Therefore, it is subject to + * NASA Export Control restrictions, as stated below. + ************************************************************************/ + +/************************************************************************/ +/** \export_control EAR ECCN 9E515.a and/or 9E515.f (HALO) + * + * Export Administration Regulations (EAR) Notice + * + * This document contains information which falls under the purview of the + * Export Administration Regulations (EAR), 15 CFR §730-774 and is export + * controlled. It may be used only to fulfill responsibilities of the Parties + * of, or a Cooperating Agency of a NASA Gateway Program Partner (CSA, ESA, + * JAXA, MBRSC) and their contractors in furtherance of the Gateway MOUs + * with ESA, CSA, and Japan and IA with MBRSC. Any use, re-transfer, or + * disclosure to any party for any purpose other than the designated use of + * fulfilling the responsibilities of the Gateway MOUs and IA requires prior + * U.S. Government authorization. + *************************************************************************/ + +/** + * \file + * \ingroup ut-stubs + * + * PSP coverage stub replacement for endian.h + */ + +#ifndef PCS_ENDIAN_H +#define PCS_ENDIAN_H + +#include "PCS_basetypes.h" + +/* ----------------------------------------- */ +/* prototypes normally declared in endian.h */ +/* ----------------------------------------- */ + +uint16_t PCS_htobe16(uint16_t host_16bits); +uint16_t PCS_htole16(uint16_t host_16bits); +uint16_t PCS_be16toh(uint16_t big_endian_16bits); +uint16_t PCS_le16toh(uint16_t little_endian_16bits); + +uint32_t PCS_htobe32(uint32_t host_32bits); +uint32_t PCS_htole32(uint32_t host_32bits); +uint32_t PCS_be32toh(uint32_t big_endian_32bits); +uint32_t PCS_le32toh(uint32_t little_endian_32bits); + +uint64_t PCS_htobe64(uint64_t host_64bits); +uint64_t PCS_htole64(uint64_t host_64bits); +uint64_t PCS_be64toh(uint64_t big_endian_64bits); +uint64_t PCS_le64toh(uint64_t little_endian_64bits); + +#endif /* PCS_FCNTL_H */ diff --git a/unit-test-coverage/ut-stubs/inc/PCS_errno.h b/unit-test-coverage/ut-stubs/inc/PCS_errno.h index 1f62d424..08e9e3af 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_errno.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_errno.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_errnoLib.h b/unit-test-coverage/ut-stubs/inc/PCS_errnoLib.h index 6fbf6530..a2fad4f8 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_errnoLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_errnoLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_excLib.h b/unit-test-coverage/ut-stubs/inc/PCS_excLib.h index b4c3c79f..1db72ae9 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_excLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_excLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_fcntl.h b/unit-test-coverage/ut-stubs/inc/PCS_fcntl.h index 67b64091..af38672d 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_fcntl.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_fcntl.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_fppLib.h b/unit-test-coverage/ut-stubs/inc/PCS_fppLib.h index b7fb4ae7..9f47cb28 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_fppLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_fppLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_intLib.h b/unit-test-coverage/ut-stubs/inc/PCS_intLib.h index 0d427edd..54b77d39 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_intLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_intLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_ioLib.h b/unit-test-coverage/ut-stubs/inc/PCS_ioLib.h index f1b2c218..7c8f4195 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_ioLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_ioLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h b/unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h index e8a19cc7..d5d03823 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_mcpx750.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_moduleLib.h b/unit-test-coverage/ut-stubs/inc/PCS_moduleLib.h index 93d8149e..9c9587df 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_moduleLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_moduleLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_net_if.h b/unit-test-coverage/ut-stubs/inc/PCS_net_if.h index 5f505cff..e52feefe 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_net_if.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_net_if.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_netinet_in.h b/unit-test-coverage/ut-stubs/inc/PCS_netinet_in.h index dbf26559..7a4cda3e 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_netinet_in.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_netinet_in.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_object.h b/unit-test-coverage/ut-stubs/inc/PCS_object.h index d7c8e6f0..719677a2 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_object.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_object.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h b/unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h index 5e72fab9..5218d3d0 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_ramDrv.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_rebootLib.h b/unit-test-coverage/ut-stubs/inc/PCS_rebootLib.h index 26c05955..4ab7e594 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_rebootLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_rebootLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_rtems.h b/unit-test-coverage/ut-stubs/inc/PCS_rtems.h index 3a874de2..c1ef7096 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_rtems.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_rtems.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_speLib.h b/unit-test-coverage/ut-stubs/inc/PCS_speLib.h index cfa4aeb1..7b15f38c 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_speLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_speLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_spyLib.h b/unit-test-coverage/ut-stubs/inc/PCS_spyLib.h index 088ec671..c2ef80c2 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_spyLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_spyLib.h @@ -1,5 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. diff --git a/unit-test-coverage/ut-stubs/inc/PCS_spyLibP.h b/unit-test-coverage/ut-stubs/inc/PCS_spyLibP.h index f7d5c71e..10ef01d8 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_spyLibP.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_spyLibP.h @@ -1,5 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. diff --git a/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h b/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h index 69524342..3d23da3a 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_stdarg.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_stdio.h b/unit-test-coverage/ut-stubs/inc/PCS_stdio.h index dd00db45..a13490ad 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_stdio.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_stdio.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h b/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h index 99744e2d..7142305b 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_stdlib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_string.h b/unit-test-coverage/ut-stubs/inc/PCS_string.h index 2737ab8c..f88f944f 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_string.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_string.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sys950Lib.h b/unit-test-coverage/ut-stubs/inc/PCS_sys950Lib.h index 06604a00..efc63f14 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_sys950Lib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_sys950Lib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sysApi.h b/unit-test-coverage/ut-stubs/inc/PCS_sysApi.h index e5621956..02bc651f 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_sysApi.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_sysApi.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sysLib.h b/unit-test-coverage/ut-stubs/inc/PCS_sysLib.h index dbf07bdd..3429c75d 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_sysLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_sysLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sys_mman.h b/unit-test-coverage/ut-stubs/inc/PCS_sys_mman.h index 9fa15b85..c4711e43 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_sys_mman.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_sys_mman.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sys_select.h b/unit-test-coverage/ut-stubs/inc/PCS_sys_select.h index 3781cdb7..3ab888bd 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_sys_select.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_sys_select.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sys_socket.h b/unit-test-coverage/ut-stubs/inc/PCS_sys_socket.h index bf5f1c4f..61390a80 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_sys_socket.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_sys_socket.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sys_stat.h b/unit-test-coverage/ut-stubs/inc/PCS_sys_stat.h index af965701..6904663e 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_sys_stat.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_sys_stat.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sys_time.h b/unit-test-coverage/ut-stubs/inc/PCS_sys_time.h index 67e01093..296ddc48 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_sys_time.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_sys_time.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_sys_types.h b/unit-test-coverage/ut-stubs/inc/PCS_sys_types.h index 87e23fda..378a65f6 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_sys_types.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_sys_types.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h b/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h index 5c158ba3..1baf7b13 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_taskLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_taskLibCommon.h b/unit-test-coverage/ut-stubs/inc/PCS_taskLibCommon.h index f7408e59..ad4442d8 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_taskLibCommon.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_taskLibCommon.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_tasks.h b/unit-test-coverage/ut-stubs/inc/PCS_tasks.h index f6788c42..ff9f4ab3 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_tasks.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_tasks.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_threadimpl.h b/unit-test-coverage/ut-stubs/inc/PCS_threadimpl.h index 4599f69b..0e253fef 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_threadimpl.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_threadimpl.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_tickLib.h b/unit-test-coverage/ut-stubs/inc/PCS_tickLib.h index 1d7b6cb0..5d1a53c2 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_tickLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_tickLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_time.h b/unit-test-coverage/ut-stubs/inc/PCS_time.h index e44be5ae..dfa6d920 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_time.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_time.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_timers.h b/unit-test-coverage/ut-stubs/inc/PCS_timers.h index b38b24dd..b23ae716 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_timers.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_timers.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_timestampimpl.h b/unit-test-coverage/ut-stubs/inc/PCS_timestampimpl.h index 7931834b..f95c2b71 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_timestampimpl.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_timestampimpl.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_todimpl.h b/unit-test-coverage/ut-stubs/inc/PCS_todimpl.h index fd7a49f3..f52121ad 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_todimpl.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_todimpl.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_unistd.h b/unit-test-coverage/ut-stubs/inc/PCS_unistd.h index d953b2bf..82c46ac0 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_unistd.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_unistd.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_usrLib.h b/unit-test-coverage/ut-stubs/inc/PCS_usrLib.h index bd1cd714..4c065963 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_usrLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_usrLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_vxLib.h b/unit-test-coverage/ut-stubs/inc/PCS_vxLib.h index 3c4c58d5..d4dfb75b 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_vxLib.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_vxLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h b/unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h index 723f4042..13ad4624 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_vxWorks.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_xbdBlkDev.h b/unit-test-coverage/ut-stubs/inc/PCS_xbdBlkDev.h index ad061b04..5180910e 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_xbdBlkDev.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_xbdBlkDev.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/inc/PCS_xbdRamDisk.h b/unit-test-coverage/ut-stubs/inc/PCS_xbdRamDisk.h index 93bc479a..dc728260 100644 --- a/unit-test-coverage/ut-stubs/inc/PCS_xbdRamDisk.h +++ b/unit-test-coverage/ut-stubs/inc/PCS_xbdRamDisk.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/arch/ppc/esfPpc.h b/unit-test-coverage/ut-stubs/override_inc/arch/ppc/esfPpc.h index 7ac7a989..768a6f8f 100644 --- a/unit-test-coverage/ut-stubs/override_inc/arch/ppc/esfPpc.h +++ b/unit-test-coverage/ut-stubs/override_inc/arch/ppc/esfPpc.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/arch/ppc/vxPpcLib.h b/unit-test-coverage/ut-stubs/override_inc/arch/ppc/vxPpcLib.h index 95bdd8f4..d16f05a4 100644 --- a/unit-test-coverage/ut-stubs/override_inc/arch/ppc/vxPpcLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/arch/ppc/vxPpcLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/arpa/inet.h b/unit-test-coverage/ut-stubs/override_inc/arpa/inet.h index cbf77b6c..61b42d62 100644 --- a/unit-test-coverage/ut-stubs/override_inc/arpa/inet.h +++ b/unit-test-coverage/ut-stubs/override_inc/arpa/inet.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/blkIo.h b/unit-test-coverage/ut-stubs/override_inc/blkIo.h index dd9d1874..13f9aba5 100644 --- a/unit-test-coverage/ut-stubs/override_inc/blkIo.h +++ b/unit-test-coverage/ut-stubs/override_inc/blkIo.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/bsp.h b/unit-test-coverage/ut-stubs/override_inc/bsp.h index b799de29..543e9eda 100644 --- a/unit-test-coverage/ut-stubs/override_inc/bsp.h +++ b/unit-test-coverage/ut-stubs/override_inc/bsp.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/cacheLib.h b/unit-test-coverage/ut-stubs/override_inc/cacheLib.h index cfc0a94b..69da4375 100644 --- a/unit-test-coverage/ut-stubs/override_inc/cacheLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/cacheLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h b/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h index e3604a01..34bad47d 100644 --- a/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/dosFsLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h b/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h index 2cb6ed5f..571ee2ef 100644 --- a/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h +++ b/unit-test-coverage/ut-stubs/override_inc/drv/hdisk/ataDrv.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/drv/pci/pciConfigLib.h b/unit-test-coverage/ut-stubs/override_inc/drv/pci/pciConfigLib.h index 62b6d908..99b42c8e 100644 --- a/unit-test-coverage/ut-stubs/override_inc/drv/pci/pciConfigLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/drv/pci/pciConfigLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/endian.h b/unit-test-coverage/ut-stubs/override_inc/endian.h new file mode 100644 index 00000000..0cc6d276 --- /dev/null +++ b/unit-test-coverage/ut-stubs/override_inc/endian.h @@ -0,0 +1,40 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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. + ************************************************************************/ + +/* PSP coverage stub replacement for endian.h */ +#ifndef OVERRIDE_ENDIAN_H +#define OVERRIDE_ENDIAN_H + +#include "PCS_endian.h" + +#define htobe16 PCS_htobe16 +#define htole16 PCS_htole16 +#define be16toh PCS_be16toh +#define le16toh PCS_le16toh + +#define htobe32 PCS_htobe32 +#define htole32 PCS_htole32 +#define be32toh PCS_be32toh +#define le32toh PCS_le32toh + +#define htobe64 PCS_htobe64 +#define htole64 PCS_htole64 +#define be64toh PCS_be64toh +#define le64toh PCS_le64toh + +#endif /* OVERRIDE_ENDIAN_H */ diff --git a/unit-test-coverage/ut-stubs/override_inc/errno.h b/unit-test-coverage/ut-stubs/override_inc/errno.h index 70493cb9..6eb21ff9 100644 --- a/unit-test-coverage/ut-stubs/override_inc/errno.h +++ b/unit-test-coverage/ut-stubs/override_inc/errno.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/errnoLib.h b/unit-test-coverage/ut-stubs/override_inc/errnoLib.h index 67adb6d2..752b137d 100644 --- a/unit-test-coverage/ut-stubs/override_inc/errnoLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/errnoLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/excLib.h b/unit-test-coverage/ut-stubs/override_inc/excLib.h index 234169e1..90fa18d2 100644 --- a/unit-test-coverage/ut-stubs/override_inc/excLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/excLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/fcntl.h b/unit-test-coverage/ut-stubs/override_inc/fcntl.h index f9282e88..8738f804 100644 --- a/unit-test-coverage/ut-stubs/override_inc/fcntl.h +++ b/unit-test-coverage/ut-stubs/override_inc/fcntl.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/fppLib.h b/unit-test-coverage/ut-stubs/override_inc/fppLib.h index 3205fd54..393bdf21 100644 --- a/unit-test-coverage/ut-stubs/override_inc/fppLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/fppLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/intLib.h b/unit-test-coverage/ut-stubs/override_inc/intLib.h index 2c48ccb2..c51a8d19 100644 --- a/unit-test-coverage/ut-stubs/override_inc/intLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/intLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/ioLib.h b/unit-test-coverage/ut-stubs/override_inc/ioLib.h index de7d25f6..1fdac1f3 100644 --- a/unit-test-coverage/ut-stubs/override_inc/ioLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/ioLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/mcpx750.h b/unit-test-coverage/ut-stubs/override_inc/mcpx750.h index cf5ff0a2..f6d1bd71 100644 --- a/unit-test-coverage/ut-stubs/override_inc/mcpx750.h +++ b/unit-test-coverage/ut-stubs/override_inc/mcpx750.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/moduleLib.h b/unit-test-coverage/ut-stubs/override_inc/moduleLib.h index 5a34289c..ae207b60 100644 --- a/unit-test-coverage/ut-stubs/override_inc/moduleLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/moduleLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/net/if.h b/unit-test-coverage/ut-stubs/override_inc/net/if.h index fdd02250..1ae0a6bf 100644 --- a/unit-test-coverage/ut-stubs/override_inc/net/if.h +++ b/unit-test-coverage/ut-stubs/override_inc/net/if.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/netinet/in.h b/unit-test-coverage/ut-stubs/override_inc/netinet/in.h index 13a07c80..b8c02435 100644 --- a/unit-test-coverage/ut-stubs/override_inc/netinet/in.h +++ b/unit-test-coverage/ut-stubs/override_inc/netinet/in.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/netinet/ip.h b/unit-test-coverage/ut-stubs/override_inc/netinet/ip.h index adcb28ec..0f1c2de6 100644 --- a/unit-test-coverage/ut-stubs/override_inc/netinet/ip.h +++ b/unit-test-coverage/ut-stubs/override_inc/netinet/ip.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/private/spyLibP.h b/unit-test-coverage/ut-stubs/override_inc/private/spyLibP.h index a900d71a..63dcdee0 100644 --- a/unit-test-coverage/ut-stubs/override_inc/private/spyLibP.h +++ b/unit-test-coverage/ut-stubs/override_inc/private/spyLibP.h @@ -1,5 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. diff --git a/unit-test-coverage/ut-stubs/override_inc/ramDrv.h b/unit-test-coverage/ut-stubs/override_inc/ramDrv.h index 95ab53bd..35bcba09 100644 --- a/unit-test-coverage/ut-stubs/override_inc/ramDrv.h +++ b/unit-test-coverage/ut-stubs/override_inc/ramDrv.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/rebootLib.h b/unit-test-coverage/ut-stubs/override_inc/rebootLib.h index 1c500a20..addfec9a 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rebootLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/rebootLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems.h b/unit-test-coverage/ut-stubs/override_inc/rtems.h index 154800c1..82d98800 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rtems.h +++ b/unit-test-coverage/ut-stubs/override_inc/rtems.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems/cpuuse.h b/unit-test-coverage/ut-stubs/override_inc/rtems/cpuuse.h index 997c8cd5..edf2c0f1 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rtems/cpuuse.h +++ b/unit-test-coverage/ut-stubs/override_inc/rtems/cpuuse.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems/rtems/object.h b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems/object.h index b79a370a..1d56e45b 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rtems/rtems/object.h +++ b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems/object.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems/rtems/tasks.h b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems/tasks.h index 058f9a41..b8f331d7 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rtems/rtems/tasks.h +++ b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems/tasks.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_bsdnet.h b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_bsdnet.h index c0dda61b..82653ca5 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_bsdnet.h +++ b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_bsdnet.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_dhcp_failsafe.h b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_dhcp_failsafe.h index 736c4a28..5fb6317f 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_dhcp_failsafe.h +++ b/unit-test-coverage/ut-stubs/override_inc/rtems/rtems_dhcp_failsafe.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems/score/threadimpl.h b/unit-test-coverage/ut-stubs/override_inc/rtems/score/threadimpl.h index 1e7f736c..75242a93 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rtems/score/threadimpl.h +++ b/unit-test-coverage/ut-stubs/override_inc/rtems/score/threadimpl.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems/score/timestampimpl.h b/unit-test-coverage/ut-stubs/override_inc/rtems/score/timestampimpl.h index 6b28d44d..01603b24 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rtems/score/timestampimpl.h +++ b/unit-test-coverage/ut-stubs/override_inc/rtems/score/timestampimpl.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/rtems/score/todimpl.h b/unit-test-coverage/ut-stubs/override_inc/rtems/score/todimpl.h index d835db28..408b28c6 100644 --- a/unit-test-coverage/ut-stubs/override_inc/rtems/score/todimpl.h +++ b/unit-test-coverage/ut-stubs/override_inc/rtems/score/todimpl.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/speLib.h b/unit-test-coverage/ut-stubs/override_inc/speLib.h index b6a51e58..40fb5164 100644 --- a/unit-test-coverage/ut-stubs/override_inc/speLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/speLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/spyLib.h b/unit-test-coverage/ut-stubs/override_inc/spyLib.h index 87dbf623..b2775fbd 100644 --- a/unit-test-coverage/ut-stubs/override_inc/spyLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/spyLib.h @@ -1,5 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. diff --git a/unit-test-coverage/ut-stubs/override_inc/stdio.h b/unit-test-coverage/ut-stubs/override_inc/stdio.h index a55da486..32893790 100644 --- a/unit-test-coverage/ut-stubs/override_inc/stdio.h +++ b/unit-test-coverage/ut-stubs/override_inc/stdio.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/stdlib.h b/unit-test-coverage/ut-stubs/override_inc/stdlib.h index 500c77ab..ea680a75 100644 --- a/unit-test-coverage/ut-stubs/override_inc/stdlib.h +++ b/unit-test-coverage/ut-stubs/override_inc/stdlib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/string.h b/unit-test-coverage/ut-stubs/override_inc/string.h index 39a37cfb..7e1a6b8d 100644 --- a/unit-test-coverage/ut-stubs/override_inc/string.h +++ b/unit-test-coverage/ut-stubs/override_inc/string.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/sys/mman.h b/unit-test-coverage/ut-stubs/override_inc/sys/mman.h index 2502aabd..cdc416ae 100644 --- a/unit-test-coverage/ut-stubs/override_inc/sys/mman.h +++ b/unit-test-coverage/ut-stubs/override_inc/sys/mman.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/sys/select.h b/unit-test-coverage/ut-stubs/override_inc/sys/select.h index ccfd6388..70b655c0 100644 --- a/unit-test-coverage/ut-stubs/override_inc/sys/select.h +++ b/unit-test-coverage/ut-stubs/override_inc/sys/select.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/sys/socket.h b/unit-test-coverage/ut-stubs/override_inc/sys/socket.h index b55f1ac7..b1cc0c92 100644 --- a/unit-test-coverage/ut-stubs/override_inc/sys/socket.h +++ b/unit-test-coverage/ut-stubs/override_inc/sys/socket.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/sys/stat.h b/unit-test-coverage/ut-stubs/override_inc/sys/stat.h index e48af287..8a1f2882 100644 --- a/unit-test-coverage/ut-stubs/override_inc/sys/stat.h +++ b/unit-test-coverage/ut-stubs/override_inc/sys/stat.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/sys/time.h b/unit-test-coverage/ut-stubs/override_inc/sys/time.h index 96e5881d..c0e6f893 100644 --- a/unit-test-coverage/ut-stubs/override_inc/sys/time.h +++ b/unit-test-coverage/ut-stubs/override_inc/sys/time.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/sys/types.h b/unit-test-coverage/ut-stubs/override_inc/sys/types.h index 247f90fc..5638ec24 100644 --- a/unit-test-coverage/ut-stubs/override_inc/sys/types.h +++ b/unit-test-coverage/ut-stubs/override_inc/sys/types.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/sys950Lib.h b/unit-test-coverage/ut-stubs/override_inc/sys950Lib.h index e4b87469..82ccc6a3 100644 --- a/unit-test-coverage/ut-stubs/override_inc/sys950Lib.h +++ b/unit-test-coverage/ut-stubs/override_inc/sys950Lib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/sysApi.h b/unit-test-coverage/ut-stubs/override_inc/sysApi.h index 23f4bd0c..1c5d86b7 100644 --- a/unit-test-coverage/ut-stubs/override_inc/sysApi.h +++ b/unit-test-coverage/ut-stubs/override_inc/sysApi.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/sysLib.h b/unit-test-coverage/ut-stubs/override_inc/sysLib.h index 927c28e6..3d13b877 100644 --- a/unit-test-coverage/ut-stubs/override_inc/sysLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/sysLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/taskLib.h b/unit-test-coverage/ut-stubs/override_inc/taskLib.h index 22c0fc7d..9e454326 100644 --- a/unit-test-coverage/ut-stubs/override_inc/taskLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/taskLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/taskLibCommon.h b/unit-test-coverage/ut-stubs/override_inc/taskLibCommon.h index f355ac7d..afcb5aae 100644 --- a/unit-test-coverage/ut-stubs/override_inc/taskLibCommon.h +++ b/unit-test-coverage/ut-stubs/override_inc/taskLibCommon.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/tickLib.h b/unit-test-coverage/ut-stubs/override_inc/tickLib.h index 157523d8..4025f017 100644 --- a/unit-test-coverage/ut-stubs/override_inc/tickLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/tickLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/time.h b/unit-test-coverage/ut-stubs/override_inc/time.h index 1eb74d21..ffc9e2f0 100644 --- a/unit-test-coverage/ut-stubs/override_inc/time.h +++ b/unit-test-coverage/ut-stubs/override_inc/time.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/unistd.h b/unit-test-coverage/ut-stubs/override_inc/unistd.h index bc9b1ff9..2ca7cd52 100644 --- a/unit-test-coverage/ut-stubs/override_inc/unistd.h +++ b/unit-test-coverage/ut-stubs/override_inc/unistd.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/usrLib.h b/unit-test-coverage/ut-stubs/override_inc/usrLib.h index 0d90df57..40df88ca 100644 --- a/unit-test-coverage/ut-stubs/override_inc/usrLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/usrLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/vxLib.h b/unit-test-coverage/ut-stubs/override_inc/vxLib.h index e1363f7f..c8b8e60b 100644 --- a/unit-test-coverage/ut-stubs/override_inc/vxLib.h +++ b/unit-test-coverage/ut-stubs/override_inc/vxLib.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/vxWorks.h b/unit-test-coverage/ut-stubs/override_inc/vxWorks.h index ecbd6ad4..c9f6b66e 100644 --- a/unit-test-coverage/ut-stubs/override_inc/vxWorks.h +++ b/unit-test-coverage/ut-stubs/override_inc/vxWorks.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h b/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h index 5e294764..1d586170 100644 --- a/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h +++ b/unit-test-coverage/ut-stubs/override_inc/xbdBlkDev.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h b/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h index d100748e..3f4df84c 100644 --- a/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h +++ b/unit-test-coverage/ut-stubs/override_inc/xbdRamDisk.h @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_arch_ppc_vxPpcLib_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_arch_ppc_vxPpcLib_handlers.c index 2cee627b..dc7e754e 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_arch_ppc_vxPpcLib_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_arch_ppc_vxPpcLib_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_arch_ppc_vxPpcLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_arch_ppc_vxPpcLib_stubs.c index ba3a3769..8f29f1fb 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_arch_ppc_vxPpcLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_arch_ppc_vxPpcLib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_arpa_inet_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_arpa_inet_handlers.c index c8ff61b7..2299259c 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_arpa_inet_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_arpa_inet_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_arpa_inet_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_arpa_inet_stubs.c index 42fa3685..4e615d1e 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_arpa_inet_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_arpa_inet_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_bsdnet_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_bsdnet_handlers.c index 98ca6fff..e17db460 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_bsdnet_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_bsdnet_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_bsdnet_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_bsdnet_stubs.c index 81f259d0..12eb9ee6 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_bsdnet_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_bsdnet_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_cacheLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_cacheLib_stubs.c index 2023f390..52bcd7c9 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_cacheLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_cacheLib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_cfe_configdata_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_cfe_configdata_stubs.c index e6417d48..dc4aa234 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_cfe_configdata_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_cfe_configdata_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_cpuuse_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_cpuuse_stubs.c index 028c493c..29ecac24 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_cpuuse_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_cpuuse_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -26,8 +26,6 @@ #include "PCS_cpuuse.h" #include "utgenstub.h" - - /* * ---------------------------------------------------- * Generated stub function for PCS_rtems_cpu_usage_reset() diff --git a/unit-test-coverage/ut-stubs/src/PCS_dosFsLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_dosFsLib_stubs.c index 6e720e4c..37f11904 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_dosFsLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_dosFsLib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_drv_hdisk_ataDrv_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_drv_hdisk_ataDrv_stubs.c index 10e55bee..dad34039 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_drv_hdisk_ataDrv_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_drv_hdisk_ataDrv_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_drv_pci_pciConfigLib_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_drv_pci_pciConfigLib_handlers.c index bab46493..be682125 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_drv_pci_pciConfigLib_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_drv_pci_pciConfigLib_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_drv_pci_pciConfigLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_drv_pci_pciConfigLib_stubs.c index ea253b2a..d4aab722 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_drv_pci_pciConfigLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_drv_pci_pciConfigLib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_endian_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_endian_stubs.c new file mode 100644 index 00000000..65c36394 --- /dev/null +++ b/unit-test-coverage/ut-stubs/src/PCS_endian_stubs.c @@ -0,0 +1,218 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * + * Auto-Generated stub implementations for functions defined in PCS_endian header + */ + +#include "PCS_endian.h" +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Generated stub function for PCS_be16toh() + * ---------------------------------------------------- + */ +uint16_t PCS_be16toh(uint16_t big_endian_16bits) +{ + UT_GenStub_SetupReturnBuffer(PCS_be16toh, uint16_t); + + UT_GenStub_AddParam(PCS_be16toh, uint16_t, big_endian_16bits); + + UT_GenStub_Execute(PCS_be16toh, Basic, NULL); + + return UT_GenStub_GetReturnValue(PCS_be16toh, uint16_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for PCS_be32toh() + * ---------------------------------------------------- + */ +uint32_t PCS_be32toh(uint32_t big_endian_32bits) +{ + UT_GenStub_SetupReturnBuffer(PCS_be32toh, uint32_t); + + UT_GenStub_AddParam(PCS_be32toh, uint32_t, big_endian_32bits); + + UT_GenStub_Execute(PCS_be32toh, Basic, NULL); + + return UT_GenStub_GetReturnValue(PCS_be32toh, uint32_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for PCS_be64toh() + * ---------------------------------------------------- + */ +uint64_t PCS_be64toh(uint64_t big_endian_64bits) +{ + UT_GenStub_SetupReturnBuffer(PCS_be64toh, uint64_t); + + UT_GenStub_AddParam(PCS_be64toh, uint64_t, big_endian_64bits); + + UT_GenStub_Execute(PCS_be64toh, Basic, NULL); + + return UT_GenStub_GetReturnValue(PCS_be64toh, uint64_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for PCS_htobe16() + * ---------------------------------------------------- + */ +uint16_t PCS_htobe16(uint16_t host_16bits) +{ + UT_GenStub_SetupReturnBuffer(PCS_htobe16, uint16_t); + + UT_GenStub_AddParam(PCS_htobe16, uint16_t, host_16bits); + + UT_GenStub_Execute(PCS_htobe16, Basic, NULL); + + return UT_GenStub_GetReturnValue(PCS_htobe16, uint16_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for PCS_htobe32() + * ---------------------------------------------------- + */ +uint32_t PCS_htobe32(uint32_t host_32bits) +{ + UT_GenStub_SetupReturnBuffer(PCS_htobe32, uint32_t); + + UT_GenStub_AddParam(PCS_htobe32, uint32_t, host_32bits); + + UT_GenStub_Execute(PCS_htobe32, Basic, NULL); + + return UT_GenStub_GetReturnValue(PCS_htobe32, uint32_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for PCS_htobe64() + * ---------------------------------------------------- + */ +uint64_t PCS_htobe64(uint64_t host_64bits) +{ + UT_GenStub_SetupReturnBuffer(PCS_htobe64, uint64_t); + + UT_GenStub_AddParam(PCS_htobe64, uint64_t, host_64bits); + + UT_GenStub_Execute(PCS_htobe64, Basic, NULL); + + return UT_GenStub_GetReturnValue(PCS_htobe64, uint64_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for PCS_htole16() + * ---------------------------------------------------- + */ +uint16_t PCS_htole16(uint16_t host_16bits) +{ + UT_GenStub_SetupReturnBuffer(PCS_htole16, uint16_t); + + UT_GenStub_AddParam(PCS_htole16, uint16_t, host_16bits); + + UT_GenStub_Execute(PCS_htole16, Basic, NULL); + + return UT_GenStub_GetReturnValue(PCS_htole16, uint16_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for PCS_htole32() + * ---------------------------------------------------- + */ +uint32_t PCS_htole32(uint32_t host_32bits) +{ + UT_GenStub_SetupReturnBuffer(PCS_htole32, uint32_t); + + UT_GenStub_AddParam(PCS_htole32, uint32_t, host_32bits); + + UT_GenStub_Execute(PCS_htole32, Basic, NULL); + + return UT_GenStub_GetReturnValue(PCS_htole32, uint32_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for PCS_htole64() + * ---------------------------------------------------- + */ +uint64_t PCS_htole64(uint64_t host_64bits) +{ + UT_GenStub_SetupReturnBuffer(PCS_htole64, uint64_t); + + UT_GenStub_AddParam(PCS_htole64, uint64_t, host_64bits); + + UT_GenStub_Execute(PCS_htole64, Basic, NULL); + + return UT_GenStub_GetReturnValue(PCS_htole64, uint64_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for PCS_le16toh() + * ---------------------------------------------------- + */ +uint16_t PCS_le16toh(uint16_t little_endian_16bits) +{ + UT_GenStub_SetupReturnBuffer(PCS_le16toh, uint16_t); + + UT_GenStub_AddParam(PCS_le16toh, uint16_t, little_endian_16bits); + + UT_GenStub_Execute(PCS_le16toh, Basic, NULL); + + return UT_GenStub_GetReturnValue(PCS_le16toh, uint16_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for PCS_le32toh() + * ---------------------------------------------------- + */ +uint32_t PCS_le32toh(uint32_t little_endian_32bits) +{ + UT_GenStub_SetupReturnBuffer(PCS_le32toh, uint32_t); + + UT_GenStub_AddParam(PCS_le32toh, uint32_t, little_endian_32bits); + + UT_GenStub_Execute(PCS_le32toh, Basic, NULL); + + return UT_GenStub_GetReturnValue(PCS_le32toh, uint32_t); +} + +/* + * ---------------------------------------------------- + * Generated stub function for PCS_le64toh() + * ---------------------------------------------------- + */ +uint64_t PCS_le64toh(uint64_t little_endian_64bits) +{ + UT_GenStub_SetupReturnBuffer(PCS_le64toh, uint64_t); + + UT_GenStub_AddParam(PCS_le64toh, uint64_t, little_endian_64bits); + + UT_GenStub_Execute(PCS_le64toh, Basic, NULL); + + return UT_GenStub_GetReturnValue(PCS_le64toh, uint64_t); +} diff --git a/unit-test-coverage/ut-stubs/src/PCS_errnoLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_errnoLib_stubs.c index ae9091ec..c8f699a7 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_errnoLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_errnoLib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_errno_globals.c b/unit-test-coverage/ut-stubs/src/PCS_errno_globals.c index 1119bd04..de310cad 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_errno_globals.c +++ b/unit-test-coverage/ut-stubs/src/PCS_errno_globals.c @@ -1,8 +1,8 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_excLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_excLib_stubs.c index f5e90100..30ff5fcf 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_excLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_excLib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_fcntl_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_fcntl_stubs.c index d75025cb..0d9243eb 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_fcntl_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_fcntl_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_fppLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_fppLib_stubs.c index 9e67c81c..1959ac83 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_fppLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_fppLib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_intLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_intLib_stubs.c index 412fff39..6b900b47 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_intLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_intLib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_moduleLib_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_moduleLib_handlers.c index 78135c49..984f9f87 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_moduleLib_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_moduleLib_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_moduleLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_moduleLib_stubs.c index 0df0bbb9..5b344097 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_moduleLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_moduleLib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_netinet_in_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_netinet_in_stubs.c index 0e984b73..21493569 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_netinet_in_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_netinet_in_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_object_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_object_stubs.c index 4e0caacf..8c9418d6 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_object_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_object_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_ramDrv_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_ramDrv_stubs.c index d6701bc0..4668d80a 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_ramDrv_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_ramDrv_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_rebootLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_rebootLib_stubs.c index f96a64d5..40d2ab65 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_rebootLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_rebootLib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_speLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_speLib_stubs.c index a67feed1..4ee2c714 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_speLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_speLib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_spyLibP_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_spyLibP_stubs.c index bd911111..85e703f0 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_spyLibP_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_spyLibP_stubs.c @@ -1,5 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. diff --git a/unit-test-coverage/ut-stubs/src/PCS_spyLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_spyLib_stubs.c index 9fa7fa0b..021401a1 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_spyLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_spyLib_stubs.c @@ -1,5 +1,5 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. diff --git a/unit-test-coverage/ut-stubs/src/PCS_stdio_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_stdio_handlers.c index 3781d970..70d46dfd 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_stdio_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_stdio_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_stdio_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_stdio_stubs.c index 0d5e8af1..b6fda09f 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_stdio_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_stdio_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_stdlib_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_stdlib_handlers.c index 7e612bf1..2beef5ed 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_stdlib_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_stdlib_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_stdlib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_stdlib_stubs.c index 5b9f1df5..4658f402 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_stdlib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_stdlib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_string_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_string_handlers.c index 34a9dfb9..7b57087d 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_string_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_string_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_string_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_string_stubs.c index ce72771c..49731e8f 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_string_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_string_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_sys950Lib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_sys950Lib_stubs.c index ef26eddf..045e703a 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_sys950Lib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_sys950Lib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_sysApi_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_sysApi_stubs.c index de842e31..5dca11a1 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_sysApi_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_sysApi_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_sysLib_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_sysLib_handlers.c index 2addda5c..e7052f06 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_sysLib_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_sysLib_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_sysLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_sysLib_stubs.c index 71361dc3..3f96dbcf 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_sysLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_sysLib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_sys_mman_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_sys_mman_stubs.c index 4f79a4f0..0cea5c94 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_sys_mman_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_sys_mman_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_sys_select_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_sys_select_stubs.c index b6537206..f661c6dd 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_sys_select_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_sys_select_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_sys_socket_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_sys_socket_handlers.c index d4e10a52..251e0b80 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_sys_socket_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_sys_socket_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_sys_socket_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_sys_socket_stubs.c index 729aa66b..d727f9fd 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_sys_socket_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_sys_socket_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_sys_stat_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_sys_stat_handlers.c index 2fa80670..3e5790de 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_sys_stat_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_sys_stat_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_sys_stat_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_sys_stat_stubs.c index 89b3b076..54535d7a 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_sys_stat_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_sys_stat_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_taskLib_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_taskLib_handlers.c index 79bfcf30..e1d58c4a 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_taskLib_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_taskLib_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_taskLib_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_taskLib_stubs.c index 550ecc25..fefba218 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_taskLib_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_taskLib_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_tasks_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_tasks_stubs.c index 5960b34d..45ecc199 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_tasks_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_tasks_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_threadimpl_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_threadimpl_stubs.c index a03b608d..53be1ca3 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_threadimpl_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_threadimpl_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_time_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_time_handlers.c index 6d5ab351..695fdc31 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_time_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_time_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_time_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_time_stubs.c index 52a3544e..04fc92ba 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_time_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_time_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_timestampimpl_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_timestampimpl_stubs.c index 80fee3f3..dc3855d0 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_timestampimpl_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_timestampimpl_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_todimpl_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_todimpl_stubs.c index ea14c463..b026e83e 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_todimpl_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_todimpl_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_unistd_handlers.c b/unit-test-coverage/ut-stubs/src/PCS_unistd_handlers.c index a0871aac..b2b09120 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_unistd_handlers.c +++ b/unit-test-coverage/ut-stubs/src/PCS_unistd_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_unistd_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_unistd_stubs.c index a53dfa32..abdb3d80 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_unistd_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_unistd_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/PCS_xbdBlkDev_stubs.c b/unit-test-coverage/ut-stubs/src/PCS_xbdBlkDev_stubs.c index 75dc467a..289c248e 100644 --- a/unit-test-coverage/ut-stubs/src/PCS_xbdBlkDev_stubs.c +++ b/unit-test-coverage/ut-stubs/src/PCS_xbdBlkDev_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c b/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c index 18a4ff36..9d0b020d 100644 --- a/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c +++ b/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c b/unit-test-coverage/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c index 56c92a58..6db738c1 100644 --- a/unit-test-coverage/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c +++ b/unit-test-coverage/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/cfe_psp_memory_stubs.c b/unit-test-coverage/ut-stubs/src/cfe_psp_memory_stubs.c index 61021c14..5aa3f0ed 100644 --- a/unit-test-coverage/ut-stubs/src/cfe_psp_memory_stubs.c +++ b/unit-test-coverage/ut-stubs/src/cfe_psp_memory_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/cfe_psp_module_stubs.c b/unit-test-coverage/ut-stubs/src/cfe_psp_module_stubs.c index 714d53e4..8d6f1a70 100644 --- a/unit-test-coverage/ut-stubs/src/cfe_psp_module_stubs.c +++ b/unit-test-coverage/ut-stubs/src/cfe_psp_module_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/unit-test-coverage/ut-stubs/src/vxworks-mcpx750-stubs.c b/unit-test-coverage/ut-stubs/src/vxworks-mcpx750-stubs.c index b649b281..64401f42 100644 --- a/unit-test-coverage/ut-stubs/src/vxworks-mcpx750-stubs.c +++ b/unit-test-coverage/ut-stubs/src/vxworks-mcpx750-stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/CMakeLists.txt b/ut-stubs/CMakeLists.txt index 0157c9a5..e6996b96 100644 --- a/ut-stubs/CMakeLists.txt +++ b/ut-stubs/CMakeLists.txt @@ -7,6 +7,8 @@ add_library(ut_psp_api_stubs src/cfe_psp_cds_api_handlers.c src/cfe_psp_cds_api_stubs.c src/cfe_psp_eepromaccess_api_stubs.c + src/cfe_psp_endian_handlers.c + src/cfe_psp_endian_stubs.c src/cfe_psp_error_stubs.c src/cfe_psp_exception_api_handlers.c src/cfe_psp_exception_api_stubs.c diff --git a/ut-stubs/src/cfe_psp_cache_api_stubs.c b/ut-stubs/src/cfe_psp_cache_api_stubs.c index d06537de..2a08b9bb 100644 --- a/ut-stubs/src/cfe_psp_cache_api_stubs.c +++ b/ut-stubs/src/cfe_psp_cache_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_cds_api_handlers.c b/ut-stubs/src/cfe_psp_cds_api_handlers.c index eaf66b0f..c061428a 100644 --- a/ut-stubs/src/cfe_psp_cds_api_handlers.c +++ b/ut-stubs/src/cfe_psp_cds_api_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_cds_api_stubs.c b/ut-stubs/src/cfe_psp_cds_api_stubs.c index 55e33b62..06f3058e 100644 --- a/ut-stubs/src/cfe_psp_cds_api_stubs.c +++ b/ut-stubs/src/cfe_psp_cds_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_eepromaccess_api_stubs.c b/ut-stubs/src/cfe_psp_eepromaccess_api_stubs.c index c329ea66..caa39911 100644 --- a/ut-stubs/src/cfe_psp_eepromaccess_api_stubs.c +++ b/ut-stubs/src/cfe_psp_eepromaccess_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_endian_handlers.c b/ut-stubs/src/cfe_psp_endian_handlers.c new file mode 100644 index 00000000..c9435f8a --- /dev/null +++ b/ut-stubs/src/cfe_psp_endian_handlers.c @@ -0,0 +1,171 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * + * The default implementation of the stubs just passes through the original value + * This is exactly what would happen in the real impl on a big endian processor, + * so it should satisfy the existing test cases. + */ + +#include "utgenstub.h" + +/* + * ---------------------------------------------------- + * Handler for CFE_PSP_BE16toH() + * ---------------------------------------------------- + */ +void UT_DefaultHandler_CFE_PSP_BE16toH(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint16_t CFE_PSP_BE16toH(uint16_t big_endian_16bits) */ + uint16_t val = UT_Hook_GetArgValueByName(Context, "big_endian_16bits", uint16_t); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for CFE_PSP_BE32toH() + * ---------------------------------------------------- + */ +void UT_DefaultHandler_CFE_PSP_BE32toH(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint32_t CFE_PSP_BE32toH(uint32_t big_endian_32bits) */ + uint32_t val = UT_Hook_GetArgValueByName(Context, "big_endian_32bits", uint32_t); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for CFE_PSP_BE64toH() + * ---------------------------------------------------- + */ +void UT_DefaultHandler_CFE_PSP_BE64toH(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint64_t CFE_PSP_BE64toH(uint64_t big_endian_64bits) */ + uint64_t val = UT_Hook_GetArgValueByName(Context, "big_endian_64bits", uint64_t); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for CFE_PSP_HtoBE16() + * ---------------------------------------------------- + */ +void UT_DefaultHandler_CFE_PSP_HtoBE16(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint16_t CFE_PSP_HtoBE16(uint16_t host_16bits) */ + uint16_t val = UT_Hook_GetArgValueByName(Context, "host_16bits", uint16_t); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for CFE_PSP_HtoBE32() + * ---------------------------------------------------- + */ +void UT_DefaultHandler_CFE_PSP_HtoBE32(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint32_t CFE_PSP_HtoBE32(uint32_t host_32bits) */ + uint32_t val = UT_Hook_GetArgValueByName(Context, "host_32bits", uint32_t); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for CFE_PSP_HtoBE64() + * ---------------------------------------------------- + */ +void UT_DefaultHandler_CFE_PSP_HtoBE64(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint64_t CFE_PSP_HtoBE64(uint64_t host_64bits) */ + uint64_t val = UT_Hook_GetArgValueByName(Context, "host_64bits", uint64_t); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for CFE_PSP_HtoLE16() + * ---------------------------------------------------- + */ +void UT_DefaultHandler_CFE_PSP_HtoLE16(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint16_t CFE_PSP_HtoLE16(uint16_t host_16bits) */ + uint16_t val = UT_Hook_GetArgValueByName(Context, "host_16bits", uint16_t); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for CFE_PSP_HtoLE32() + * ---------------------------------------------------- + */ +void UT_DefaultHandler_CFE_PSP_HtoLE32(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint32_t CFE_PSP_HtoLE32(uint32_t host_32bits) */ + uint32_t val = UT_Hook_GetArgValueByName(Context, "host_32bits", uint32_t); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for CFE_PSP_HtoLE64() + * ---------------------------------------------------- + */ +void UT_DefaultHandler_CFE_PSP_HtoLE64(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint64_t CFE_PSP_HtoLE64(uint64_t host_64bits) */ + uint64_t val = UT_Hook_GetArgValueByName(Context, "host_64bits", uint64_t); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for CFE_PSP_LE16toH() + * ---------------------------------------------------- + */ +void UT_DefaultHandler_CFE_PSP_LE16toH(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint16_t CFE_PSP_LE16toH(uint16_t little_endian_16bits) */ + uint16_t val = UT_Hook_GetArgValueByName(Context, "little_endian_16bits", uint16_t); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for CFE_PSP_LE32toH() + * ---------------------------------------------------- + */ +void UT_DefaultHandler_CFE_PSP_LE32toH(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint32_t CFE_PSP_LE32toH(uint32_t little_endian_32bits) */ + uint32_t val = UT_Hook_GetArgValueByName(Context, "little_endian_32bits", uint32_t); + UT_Stub_SetReturnValue(FuncKey, val); +} + +/* + * ---------------------------------------------------- + * Handler for CFE_PSP_LE64toH() + * ---------------------------------------------------- + */ +void UT_DefaultHandler_CFE_PSP_LE64toH(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) +{ + /* uint64_t CFE_PSP_LE64toH(uint64_t little_endian_64bits) */ + uint64_t val = UT_Hook_GetArgValueByName(Context, "little_endian_64bits", uint64_t); + UT_Stub_SetReturnValue(FuncKey, val); +} diff --git a/ut-stubs/src/cfe_psp_endian_stubs.c b/ut-stubs/src/cfe_psp_endian_stubs.c new file mode 100644 index 00000000..edc543c6 --- /dev/null +++ b/ut-stubs/src/cfe_psp_endian_stubs.c @@ -0,0 +1,231 @@ +/************************************************************************ + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" + * + * Copyright (c) 2023 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 + * + * Auto-Generated stub implementations for functions defined in cfe_psp_endian header + */ + +#include "cfe_psp_endian.h" +#include "utgenstub.h" + +void UT_DefaultHandler_CFE_PSP_BE16toH(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_PSP_BE32toH(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_PSP_BE64toH(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_PSP_HtoBE16(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_PSP_HtoBE32(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_PSP_HtoBE64(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_PSP_HtoLE16(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_PSP_HtoLE32(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_PSP_HtoLE64(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_PSP_LE16toH(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_PSP_LE32toH(void *, UT_EntryKey_t, const UT_StubContext_t *); +void UT_DefaultHandler_CFE_PSP_LE64toH(void *, UT_EntryKey_t, const UT_StubContext_t *); + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_BE16toH() + * ---------------------------------------------------- + */ +uint16 CFE_PSP_BE16toH(uint16 big_endian_16bits) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_BE16toH, uint16); + + UT_GenStub_AddParam(CFE_PSP_BE16toH, uint16, big_endian_16bits); + + UT_GenStub_Execute(CFE_PSP_BE16toH, Basic, UT_DefaultHandler_CFE_PSP_BE16toH); + + return UT_GenStub_GetReturnValue(CFE_PSP_BE16toH, uint16); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_BE32toH() + * ---------------------------------------------------- + */ +uint32 CFE_PSP_BE32toH(uint32 big_endian_32bits) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_BE32toH, uint32); + + UT_GenStub_AddParam(CFE_PSP_BE32toH, uint32, big_endian_32bits); + + UT_GenStub_Execute(CFE_PSP_BE32toH, Basic, UT_DefaultHandler_CFE_PSP_BE32toH); + + return UT_GenStub_GetReturnValue(CFE_PSP_BE32toH, uint32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_BE64toH() + * ---------------------------------------------------- + */ +uint64 CFE_PSP_BE64toH(uint64 big_endian_64bits) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_BE64toH, uint64); + + UT_GenStub_AddParam(CFE_PSP_BE64toH, uint64, big_endian_64bits); + + UT_GenStub_Execute(CFE_PSP_BE64toH, Basic, UT_DefaultHandler_CFE_PSP_BE64toH); + + return UT_GenStub_GetReturnValue(CFE_PSP_BE64toH, uint64); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_HtoBE16() + * ---------------------------------------------------- + */ +uint16 CFE_PSP_HtoBE16(uint16 host_16bits) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_HtoBE16, uint16); + + UT_GenStub_AddParam(CFE_PSP_HtoBE16, uint16, host_16bits); + + UT_GenStub_Execute(CFE_PSP_HtoBE16, Basic, UT_DefaultHandler_CFE_PSP_HtoBE16); + + return UT_GenStub_GetReturnValue(CFE_PSP_HtoBE16, uint16); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_HtoBE32() + * ---------------------------------------------------- + */ +uint32 CFE_PSP_HtoBE32(uint32 host_32bits) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_HtoBE32, uint32); + + UT_GenStub_AddParam(CFE_PSP_HtoBE32, uint32, host_32bits); + + UT_GenStub_Execute(CFE_PSP_HtoBE32, Basic, UT_DefaultHandler_CFE_PSP_HtoBE32); + + return UT_GenStub_GetReturnValue(CFE_PSP_HtoBE32, uint32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_HtoBE64() + * ---------------------------------------------------- + */ +uint64 CFE_PSP_HtoBE64(uint64 host_64bits) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_HtoBE64, uint64); + + UT_GenStub_AddParam(CFE_PSP_HtoBE64, uint64, host_64bits); + + UT_GenStub_Execute(CFE_PSP_HtoBE64, Basic, UT_DefaultHandler_CFE_PSP_HtoBE64); + + return UT_GenStub_GetReturnValue(CFE_PSP_HtoBE64, uint64); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_HtoLE16() + * ---------------------------------------------------- + */ +uint16 CFE_PSP_HtoLE16(uint16 host_16bits) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_HtoLE16, uint16); + + UT_GenStub_AddParam(CFE_PSP_HtoLE16, uint16, host_16bits); + + UT_GenStub_Execute(CFE_PSP_HtoLE16, Basic, UT_DefaultHandler_CFE_PSP_HtoLE16); + + return UT_GenStub_GetReturnValue(CFE_PSP_HtoLE16, uint16); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_HtoLE32() + * ---------------------------------------------------- + */ +uint32 CFE_PSP_HtoLE32(uint32 host_32bits) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_HtoLE32, uint32); + + UT_GenStub_AddParam(CFE_PSP_HtoLE32, uint32, host_32bits); + + UT_GenStub_Execute(CFE_PSP_HtoLE32, Basic, UT_DefaultHandler_CFE_PSP_HtoLE32); + + return UT_GenStub_GetReturnValue(CFE_PSP_HtoLE32, uint32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_HtoLE64() + * ---------------------------------------------------- + */ +uint64 CFE_PSP_HtoLE64(uint64 host_64bits) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_HtoLE64, uint64); + + UT_GenStub_AddParam(CFE_PSP_HtoLE64, uint64, host_64bits); + + UT_GenStub_Execute(CFE_PSP_HtoLE64, Basic, UT_DefaultHandler_CFE_PSP_HtoLE64); + + return UT_GenStub_GetReturnValue(CFE_PSP_HtoLE64, uint64); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_LE16toH() + * ---------------------------------------------------- + */ +uint16 CFE_PSP_LE16toH(uint16 little_endian_16bits) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_LE16toH, uint16); + + UT_GenStub_AddParam(CFE_PSP_LE16toH, uint16, little_endian_16bits); + + UT_GenStub_Execute(CFE_PSP_LE16toH, Basic, UT_DefaultHandler_CFE_PSP_LE16toH); + + return UT_GenStub_GetReturnValue(CFE_PSP_LE16toH, uint16); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_LE32toH() + * ---------------------------------------------------- + */ +uint32 CFE_PSP_LE32toH(uint32 little_endian_32bits) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_LE32toH, uint32); + + UT_GenStub_AddParam(CFE_PSP_LE32toH, uint32, little_endian_32bits); + + UT_GenStub_Execute(CFE_PSP_LE32toH, Basic, UT_DefaultHandler_CFE_PSP_LE32toH); + + return UT_GenStub_GetReturnValue(CFE_PSP_LE32toH, uint32); +} + +/* + * ---------------------------------------------------- + * Generated stub function for CFE_PSP_LE64toH() + * ---------------------------------------------------- + */ +uint64 CFE_PSP_LE64toH(uint64 little_endian_64bits) +{ + UT_GenStub_SetupReturnBuffer(CFE_PSP_LE64toH, uint64); + + UT_GenStub_AddParam(CFE_PSP_LE64toH, uint64, little_endian_64bits); + + UT_GenStub_Execute(CFE_PSP_LE64toH, Basic, UT_DefaultHandler_CFE_PSP_LE64toH); + + return UT_GenStub_GetReturnValue(CFE_PSP_LE64toH, uint64); +} diff --git a/ut-stubs/src/cfe_psp_error_stubs.c b/ut-stubs/src/cfe_psp_error_stubs.c index f8422057..86a0fa14 100644 --- a/ut-stubs/src/cfe_psp_error_stubs.c +++ b/ut-stubs/src/cfe_psp_error_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_exception_api_handlers.c b/ut-stubs/src/cfe_psp_exception_api_handlers.c index 8b87de2f..3efdafec 100644 --- a/ut-stubs/src/cfe_psp_exception_api_handlers.c +++ b/ut-stubs/src/cfe_psp_exception_api_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_exception_api_stubs.c b/ut-stubs/src/cfe_psp_exception_api_stubs.c index e52a2a85..fd89d032 100644 --- a/ut-stubs/src/cfe_psp_exception_api_stubs.c +++ b/ut-stubs/src/cfe_psp_exception_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c b/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c index 56c92a58..6db738c1 100644 --- a/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c +++ b/ut-stubs/src/cfe_psp_exceptionstorage_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_globaldata_stubs.c b/ut-stubs/src/cfe_psp_globaldata_stubs.c index 93f4681a..85aafd1b 100644 --- a/ut-stubs/src/cfe_psp_globaldata_stubs.c +++ b/ut-stubs/src/cfe_psp_globaldata_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_id_api_handlers.c b/ut-stubs/src/cfe_psp_id_api_handlers.c index 441bfc72..b81c00fb 100644 --- a/ut-stubs/src/cfe_psp_id_api_handlers.c +++ b/ut-stubs/src/cfe_psp_id_api_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_id_api_stubs.c b/ut-stubs/src/cfe_psp_id_api_stubs.c index d698e1d8..a91043ca 100644 --- a/ut-stubs/src/cfe_psp_id_api_stubs.c +++ b/ut-stubs/src/cfe_psp_id_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_memaccess_api_handlers.c b/ut-stubs/src/cfe_psp_memaccess_api_handlers.c index cc914215..9616b18c 100644 --- a/ut-stubs/src/cfe_psp_memaccess_api_handlers.c +++ b/ut-stubs/src/cfe_psp_memaccess_api_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -42,7 +42,7 @@ */ void UT_DefaultHandler_CFE_PSP_MemCpy(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { - /* CFE_PSP_MemCpy(void *dest, const void *src, uint32 size) */ + /* CFE_PSP_MemCpy(void *dest, const void *src, uint32 n) */ void * dest = UT_Hook_GetArgValueByName(Context, "dest", void *); const void *src = UT_Hook_GetArgValueByName(Context, "src", const void *); uint32 n = UT_Hook_GetArgValueByName(Context, "n", uint32); @@ -62,7 +62,7 @@ void UT_DefaultHandler_CFE_PSP_MemCpy(void *UserObj, UT_EntryKey_t FuncKey, cons */ void UT_DefaultHandler_CFE_PSP_MemSet(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { - /* int32 CFE_PSP_MemSet(void *dest, uint8 value, uint32 size) */ + /* int32 CFE_PSP_MemSet(void *dest, uint8 value, uint32 n) */ void * dest = UT_Hook_GetArgValueByName(Context, "dest", void *); uint8 value = UT_Hook_GetArgValueByName(Context, "value", uint8); uint32 n = UT_Hook_GetArgValueByName(Context, "n", uint32); diff --git a/ut-stubs/src/cfe_psp_memaccess_api_stubs.c b/ut-stubs/src/cfe_psp_memaccess_api_stubs.c index b4cf20c6..254b2f26 100644 --- a/ut-stubs/src/cfe_psp_memaccess_api_stubs.c +++ b/ut-stubs/src/cfe_psp_memaccess_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_memory_stubs.c b/ut-stubs/src/cfe_psp_memory_stubs.c index 61021c14..5aa3f0ed 100644 --- a/ut-stubs/src/cfe_psp_memory_stubs.c +++ b/ut-stubs/src/cfe_psp_memory_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_memrange_api_handlers.c b/ut-stubs/src/cfe_psp_memrange_api_handlers.c index 93feae7b..1437df25 100644 --- a/ut-stubs/src/cfe_psp_memrange_api_handlers.c +++ b/ut-stubs/src/cfe_psp_memrange_api_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_memrange_api_stubs.c b/ut-stubs/src/cfe_psp_memrange_api_stubs.c index 8f823ad9..be54bc72 100644 --- a/ut-stubs/src/cfe_psp_memrange_api_stubs.c +++ b/ut-stubs/src/cfe_psp_memrange_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_module_stubs.c b/ut-stubs/src/cfe_psp_module_stubs.c index dce406d0..12838163 100644 --- a/ut-stubs/src/cfe_psp_module_stubs.c +++ b/ut-stubs/src/cfe_psp_module_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_port_api_stubs.c b/ut-stubs/src/cfe_psp_port_api_stubs.c index b1ea32c9..e68c05c8 100644 --- a/ut-stubs/src/cfe_psp_port_api_stubs.c +++ b/ut-stubs/src/cfe_psp_port_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_ssr_api_stubs.c b/ut-stubs/src/cfe_psp_ssr_api_stubs.c index b898b61f..bdce1e5f 100644 --- a/ut-stubs/src/cfe_psp_ssr_api_stubs.c +++ b/ut-stubs/src/cfe_psp_ssr_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_stubs.c b/ut-stubs/src/cfe_psp_stubs.c index 510edc00..d88a4e1f 100644 --- a/ut-stubs/src/cfe_psp_stubs.c +++ b/ut-stubs/src/cfe_psp_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -22,6 +22,8 @@ * Auto-Generated stub implementations for functions defined in cfe_psp header */ +#include + #include "cfe_psp.h" #include "utgenstub.h" @@ -35,3 +37,22 @@ void CFE_PSP_Main(void) UT_GenStub_Execute(CFE_PSP_Main, Basic, NULL); } + +/* + * ---------------------------------------------------- + * Generated stub function for PSP_DebugPrintf() + * ---------------------------------------------------- + */ +void PSP_DebugPrintf(uint32 Level, const char *Func, uint32 Line, const char *Format, ...) +{ + va_list UtStub_ArgList; + + UT_GenStub_AddParam(PSP_DebugPrintf, uint32, Level); + UT_GenStub_AddParam(PSP_DebugPrintf, const char *, Func); + UT_GenStub_AddParam(PSP_DebugPrintf, uint32, Line); + UT_GenStub_AddParam(PSP_DebugPrintf, const char *, Format); + + va_start(UtStub_ArgList, Format); + UT_GenStub_Execute(PSP_DebugPrintf, Va, NULL, UtStub_ArgList); + va_end(UtStub_ArgList); +} diff --git a/ut-stubs/src/cfe_psp_timertick_api_handlers.c b/ut-stubs/src/cfe_psp_timertick_api_handlers.c index 06d84a2c..60e143f2 100644 --- a/ut-stubs/src/cfe_psp_timertick_api_handlers.c +++ b/ut-stubs/src/cfe_psp_timertick_api_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_timertick_api_stubs.c b/ut-stubs/src/cfe_psp_timertick_api_stubs.c index 96c3716f..5a4b97c4 100644 --- a/ut-stubs/src/cfe_psp_timertick_api_stubs.c +++ b/ut-stubs/src/cfe_psp_timertick_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_version_api_handlers.c b/ut-stubs/src/cfe_psp_version_api_handlers.c index 4685457d..7f47c55d 100644 --- a/ut-stubs/src/cfe_psp_version_api_handlers.c +++ b/ut-stubs/src/cfe_psp_version_api_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_version_api_stubs.c b/ut-stubs/src/cfe_psp_version_api_stubs.c index 89fc5b6f..a65d32b2 100644 --- a/ut-stubs/src/cfe_psp_version_api_stubs.c +++ b/ut-stubs/src/cfe_psp_version_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_watchdog_api_handlers.c b/ut-stubs/src/cfe_psp_watchdog_api_handlers.c index 65cdf2b9..603697eb 100644 --- a/ut-stubs/src/cfe_psp_watchdog_api_handlers.c +++ b/ut-stubs/src/cfe_psp_watchdog_api_handlers.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * diff --git a/ut-stubs/src/cfe_psp_watchdog_api_stubs.c b/ut-stubs/src/cfe_psp_watchdog_api_stubs.c index 20774273..9e05477c 100644 --- a/ut-stubs/src/cfe_psp_watchdog_api_stubs.c +++ b/ut-stubs/src/cfe_psp_watchdog_api_stubs.c @@ -1,7 +1,7 @@ /************************************************************************ - * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * NASA Docket No. GSC-19,200-1, and identified as "cFS Draco" * - * Copyright (c) 2020 United States Government as represented by the + * Copyright (c) 2023 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. *