diff --git a/CHANGELOG b/CHANGELOG index 09b8db6a..8f86c147 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,17 +1,81 @@ -## Changes from ASTP 1.0.0 to 1.1.0 +# Changed from ASTP 1.1.0 to 1.2.0 + +## API Changes + +### FSFW Architecture + +- New src folder which contains all source files except the HAL, contributed code and test code +- External and internal API mostly stayed the same +- Folder names are now all smaller case: internalError was renamed to internalerror and + FreeRTOS was renamed to freertos +- Warning if optional headers are used but the modules was not added to the source files to compile + +### HAL + +- HAL added back into FSFW. It is tightly bound to the FSFW, and compiling it as a static library + made using it more complicated than necessary + +## Bugfixes + +### FreeRTOS QueueMapManager + +- Fixed a bug which causes the first generated Queue ID to be invalid + +## Enhancements + +### FSFW Architecture + +- See API changes chapter. This change will keep the internal API consistent in the future + +# Changes from ASTP 1.0.0 to 1.1.0 + +## API Changes ### PUS - Added PUS C support +- SUBSYSTEM_IDs added for PUS Services +- Added new Parameter which must be defined in config: fsfwconfig::FSFW_MAX_TM_PACKET_SIZE + +### ObjectManager + + - ObjectManager is now a singelton + ### Configuration - Additional configuration option fsfwconfig::FSFW_MAX_TM_PACKET_SIZE which need to be specified in FSFWConfig.h +### CMake + +- Changed Cmake FSFW_ADDITIONAL_INC_PATH to FSFW_ADDITIONAL_INC_PATHS + +## Bugfixes + +- timemanager/TimeStamperIF.h: Timestamp config was not used correctly, leading to different timestamp sizes than configured in fsfwconfig::FSFW_MISSION_TIMESTAMP_SIZE +- TCP server fixes + +## Enhancements + +### FreeRTOS Queue Handles + +- Fixed an internal issue how FreeRTOS MessageQueues were handled + +### Linux OSAL + +- Better printf error messages + +### CMake + +- Check for C++11 as mininimum required Version + +### Debug Output + +- Changed Warning color to magenta, which is well readable on both dark and light mode IDEs -## Changes from ASTP 0.0.1 to 1.0.0 +# Changes from ASTP 0.0.1 to 1.0.0 ### Host OSAL diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ba73a3f..c75d711f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,20 +3,31 @@ cmake_minimum_required(VERSION 3.13) option(FSFW_GENERATE_SECTIONS "Generate function and data sections. Required to remove unused code" ON ) - if(FSFW_GENERATE_SECTIONS) option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON) endif() option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) # Options to exclude parts of the FSFW from compilation. -option(FSFW_USE_RMAP "Compile with RMAP" ON) -option(FSFW_USE_DATALINKLAYER "Compile with Data Link Layer" ON) +option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON) + +# Optional sources +option(FSFW_ADD_PUS "Compile with PUS sources" ON) +option(FSFW_ADD_MONITORING "Compile with monitoring components" ON) + +option(FSFW_ADD_RMAP "Compile with RMAP" OFF) +option(FSFW_ADD_DATALINKLAYER "Compile with Data Link Layer" OFF) +option(FSFW_ADD_COORDINATES "Compile with coordinate components" OFF) +option(FSFW_ADD_TMSTORAGE "Compile with tm storage components" OFF) + +# Contrib sources +option(FSFW_ADD_SPG4_PROPAGATOR "Add SPG4 propagator code" OFF) set(LIB_FSFW_NAME fsfw) add_library(${LIB_FSFW_NAME}) +set(FSFW_CORE_INC_PATH "inc") -set_property(CACHE OS_FSFW PROPERTY STRINGS host linux rtems freertos) +set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux rtems freertos) if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) @@ -25,38 +36,44 @@ elseif(${CMAKE_CXX_STANDARD} LESS 11) message(FATAL_ERROR "Compiling the FSFW requires a minimum of C++11 support") endif() -if(NOT OS_FSFW) - message(STATUS "No OS for FSFW via OS_FSFW set. Assuming host OS") +# Backwards comptability +if(OS_FSFW) + message(WARNING "Please pass the FSFW OSAL as FSFW_OSAL instead of OS_FSFW") + set(FSFW_OSAL OS_FSFW) +endif() + +if(NOT FSFW_OSAL) + message(STATUS "No OS for FSFW via FSFW_OSAL set. Assuming host OS") # Assume host OS and autodetermine from OS_FSFW if(UNIX) - set(OS_FSFW "linux" + set(FSFW_OSAL "linux" CACHE STRING "OS abstraction layer used in the FSFW" ) elseif(WIN32) - set(OS_FSFW "host" + set(FSFW_OSAL "host" CACHE STRING "OS abstraction layer used in the FSFW" ) endif() endif() -set(FSFW_OSAL_DEFINITION FSFW_HOST) +set(FSFW_OSAL_DEFINITION FSFW_OSAL_HOST) -if(${OS_FSFW} STREQUAL host) +if(FSFW_OSAL MATCHES host) set(OS_FSFW_NAME "Host") -elseif(${OS_FSFW} STREQUAL linux) +elseif(FSFW_OSAL MATCHES linux) set(OS_FSFW_NAME "Linux") - set(FSFW_OSAL_DEFINITION FSFW_LINUX) -elseif(${OS_FSFW} STREQUAL freertos) + set(FSFW_OSAL_DEFINITION FSFW_OSAL_LINUX) +elseif(FSFW_OSAL MATCHES freertos) set(OS_FSFW_NAME "FreeRTOS") - set(FSFW_OSAL_DEFINITION FSFW_FREERTOS) + set(FSFW_OSAL_DEFINITION FSFW_OSAL_FREERTOS) target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${LIB_OS_NAME} ) -elseif(${OS_FSFW} STREQUAL rtems) +elseif(FSFW_OSAL STREQUAL rtems) set(OS_FSFW_NAME "RTEMS") - set(FSFW_OSAL_DEFINITION FSFW_RTEMS) + set(FSFW_OSAL_DEFINITION FSFW_OSAL_RTEMS) else() message(WARNING "Invalid operating system for FSFW specified! Setting to host.." @@ -75,50 +92,10 @@ target_compile_definitions(${LIB_FSFW_NAME} INTERFACE message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.") -add_subdirectory(action) -add_subdirectory(container) -add_subdirectory(controller) -add_subdirectory(coordinates) - -if(FSFW_USE_DATALINKLAYER) - add_subdirectory(datalinklayer) -endif() - -add_subdirectory(datapool) -add_subdirectory(datapoollocal) -add_subdirectory(housekeeping) -add_subdirectory(devicehandlers) -add_subdirectory(events) -add_subdirectory(fdir) -add_subdirectory(globalfunctions) -add_subdirectory(health) -add_subdirectory(internalError) -add_subdirectory(ipc) -add_subdirectory(memory) -add_subdirectory(modes) -add_subdirectory(monitoring) -add_subdirectory(objectmanager) -add_subdirectory(osal) -add_subdirectory(parameters) -add_subdirectory(power) -add_subdirectory(pus) - -if(FSFW_USE_RMAP) - add_subdirectory(rmap) -endif() - -add_subdirectory(serialize) -add_subdirectory(serviceinterface) -add_subdirectory(storagemanager) -add_subdirectory(subsystem) -add_subdirectory(tasks) -add_subdirectory(tcdistribution) -add_subdirectory(thermal) -add_subdirectory(timemanager) -add_subdirectory(tmstorage) -add_subdirectory(tmtcpacket) -add_subdirectory(tmtcservices) -add_subdirectory(unittest) +add_subdirectory(src) +add_subdirectory(tests) +add_subdirectory(hal) +add_subdirectory(contrib) # The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. # If this is not given, we include the default configuration and emit a warning. @@ -191,6 +168,7 @@ endif() target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_SOURCE_DIR} ${FSFW_CONFIG_PATH_ABSOLUTE} + ${FSFW_CORE_INC_PATH} ${FSFW_ADD_INC_PATHS_ABS} ) @@ -200,6 +178,7 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE target_include_directories(${LIB_FSFW_NAME} PRIVATE ${CMAKE_SOURCE_DIR} ${FSFW_CONFIG_PATH_ABSOLUTE} + ${FSFW_CORE_INC_PATH} ${FSFW_ADD_INC_PATHS_ABS} ) diff --git a/FSFW.h b/FSFW.h deleted file mode 100644 index df06ff3d..00000000 --- a/FSFW.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef FSFW_FSFW_H_ -#define FSFW_FSFW_H_ - -#include "FSFWConfig.h" - - -#endif /* FSFW_FSFW_H_ */ diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt new file mode 100644 index 00000000..3a987228 --- /dev/null +++ b/contrib/CMakeLists.txt @@ -0,0 +1,11 @@ +if(FSFW_ADD_SPG4_PROPAGATOR) + target_sources(${LIB_FSFW_NAME} PRIVATE + sgp4/sgp4unit.cpp + ) + target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/sgp4 + ) + target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}/sgp4 + ) +endif() diff --git a/datapoollocal/datapoollocal.h b/datapoollocal/datapoollocal.h deleted file mode 100644 index c5c47078..00000000 --- a/datapoollocal/datapoollocal.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ -#define FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ - -/* Collected related headers */ -#include "LocalPoolVariable.h" -#include "LocalPoolVector.h" -#include "StaticLocalDataSet.h" -#include "LocalDataSet.h" -#include "SharedLocalDataSet.h" - - -#endif /* FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ */ diff --git a/defaultcfg/fsfwconfig/fsfwconfig.mk b/defaultcfg/fsfwconfig/fsfwconfig.mk deleted file mode 100644 index 51543eba..00000000 --- a/defaultcfg/fsfwconfig/fsfwconfig.mk +++ /dev/null @@ -1,15 +0,0 @@ -CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/tmtc/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/devices/*.cpp) - -INCLUDES += $(CURRENTPATH) -INCLUDES += $(CURRENTPATH)/objects -INCLUDES += $(CURRENTPATH)/returnvalues -INCLUDES += $(CURRENTPATH)/tmtc -INCLUDES += $(CURRENTPATH)/events -INCLUDES += $(CURRENTPATH)/devices -INCLUDES += $(CURRENTPATH)/pollingsequence -INCLUDES += $(CURRENTPATH)/ipc diff --git a/events/CMakeLists.txt b/events/CMakeLists.txt deleted file mode 100644 index 4e935167..00000000 --- a/events/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -target_sources(${LIB_FSFW_NAME} - PRIVATE - EventManager.cpp - EventMessage.cpp -) - -add_subdirectory(eventmatching) \ No newline at end of file diff --git a/fsfw.mk b/fsfw.mk deleted file mode 100644 index 0d72fae1..00000000 --- a/fsfw.mk +++ /dev/null @@ -1,75 +0,0 @@ -# This submake file needs to be included by the primary Makefile. -# This file needs FRAMEWORK_PATH and OS_FSFW set correctly by another Makefile. -# Valid API settings: rtems, linux, freeRTOS, host - -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/action/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/container/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/contrib/sgp4/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/controller/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/coordinates/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datalinklayer/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datapool/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datapoollocal/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datapoollocal/internal/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/housekeeping/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/devicehandlers/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/events/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/events/eventmatching/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/fdir/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/globalfunctions/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/globalfunctions/matching/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/globalfunctions/math/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/health/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/internalError/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/ipc/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/memory/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/modes/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/monitoring/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/objectmanager/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/*.cpp) - -# select the OS -ifeq ($(OS_FSFW),rtems) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/rtems/*.cpp) - -else ifeq ($(OS_FSFW),linux) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/linux/*.cpp) - -else ifeq ($(OS_FSFW),freeRTOS) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/FreeRTOS/*.cpp) - -else ifeq ($(OS_FSFW),host) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/host/*.cpp) -ifeq ($(OS),Windows_NT) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/windows/*.cpp) -else -# For now, the linux UDP bridge sources needs to be included manually by upper makefile -# for host OS because we can't be sure the OS is linux. -# Following lines can be used to do this: -# CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TcUnixUdpPollingTask.cpp -# CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TmTcUnixUdpBridge.cpp -endif - -else -$(error invalid OS_FSFW specified, valid OS_FSFW are rtems, linux, freeRTOS, host) -endif - -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/parameters/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/power/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/returnvalues/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/rmap/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/serialize/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/serviceinterface/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/storagemanager/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/subsystem/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/subsystem/modes/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tasks/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tcdistribution/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/thermal/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/timemanager/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmstorage/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcpacket/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcpacket/packetmatcher/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcpacket/pus/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcservices/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/pus/*.cpp) diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt new file mode 100644 index 00000000..7a9a0ffa --- /dev/null +++ b/hal/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 3.13) + +# Can also be changed by upper CMakeLists.txt file +find_library(LIB_FSFW_NAME fsfw REQUIRED) + +option(FSFW_HAL_ADD_LINUX "Add the Linux HAL to the sources. Required gpiod library" OFF) +option(FSFW_HAL_ADD_RASPBERRY_PI "Add Raspberry Pi specific code to the sources" OFF) +option(FSFW_HAL_ADD_STM32H7 "Add the STM32H7 HAL to the sources" OFF) +option(FSFW_HAL_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) + +set(LINUX_HAL_PATH_NAME linux) +set(STM32H7_PATH_NAME stm32h7) + +add_subdirectory(src) + +foreach(INCLUDE_PATH ${FSFW_HAL_ADDITIONAL_INC_PATHS}) + if(IS_ABSOLUTE ${INCLUDE_PATH}) + set(CURR_ABS_INC_PATH "${INCLUDE_PATH}") + else() + get_filename_component(CURR_ABS_INC_PATH + ${INCLUDE_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR}) + endif() + + if(CMAKE_VERBOSE) + message(STATUS "FSFW include path: ${CURR_ABS_INC_PATH}") + endif() + + list(APPEND FSFW_HAL_ADD_INC_PATHS_ABS ${CURR_ABS_INC_PATH}) +endforeach() + +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${FSFW_HAL_ADD_INC_PATHS_ABS} +) + +target_compile_definitions(${LIB_FSFW_NAME} PRIVATE + ${FSFW_HAL_DEFINES} +) + +target_link_libraries(${LIB_FSFW_NAME} PRIVATE + ${FSFW_HAL_LINK_LIBS} +) diff --git a/hal/src/CMakeLists.txt b/hal/src/CMakeLists.txt new file mode 100644 index 00000000..ed2f2522 --- /dev/null +++ b/hal/src/CMakeLists.txt @@ -0,0 +1,9 @@ +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_subdirectory(fsfw) diff --git a/hal/src/fsfw/CMakeLists.txt b/hal/src/fsfw/CMakeLists.txt new file mode 100644 index 00000000..c034e0b7 --- /dev/null +++ b/hal/src/fsfw/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(hal) diff --git a/hal/src/fsfw/hal/CMakeLists.txt b/hal/src/fsfw/hal/CMakeLists.txt new file mode 100644 index 00000000..f5901e91 --- /dev/null +++ b/hal/src/fsfw/hal/CMakeLists.txt @@ -0,0 +1,10 @@ +add_subdirectory(devicehandlers) +add_subdirectory(common) + +if(FSFW_HAL_ADD_LINUX) + add_subdirectory(linux) +endif() + +if(FSFW_HAL_ADD_STM32H7) + add_subdirectory(stm32h7) +endif() diff --git a/hal/src/fsfw/hal/common/CMakeLists.txt b/hal/src/fsfw/hal/common/CMakeLists.txt new file mode 100644 index 00000000..f1cfec52 --- /dev/null +++ b/hal/src/fsfw/hal/common/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(gpio) diff --git a/hal/src/fsfw/hal/common/gpio/CMakeLists.txt b/hal/src/fsfw/hal/common/gpio/CMakeLists.txt new file mode 100644 index 00000000..098c05fa --- /dev/null +++ b/hal/src/fsfw/hal/common/gpio/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + GpioCookie.cpp +) \ No newline at end of file diff --git a/hal/src/fsfw/hal/common/gpio/GpioCookie.cpp b/hal/src/fsfw/hal/common/gpio/GpioCookie.cpp new file mode 100644 index 00000000..31832070 --- /dev/null +++ b/hal/src/fsfw/hal/common/gpio/GpioCookie.cpp @@ -0,0 +1,50 @@ +#include "fsfw/hal/common/gpio/GpioCookie.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + +GpioCookie::GpioCookie() { +} + +ReturnValue_t GpioCookie::addGpio(gpioId_t gpioId, GpioBase* gpioConfig) { + if (gpioConfig == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "GpioCookie::addGpio: gpioConfig is nullpointer" << std::endl; +#else + sif::printWarning("GpioCookie::addGpio: gpioConfig is nullpointer\n"); +#endif + return HasReturnvaluesIF::RETURN_FAILED; + } + auto gpioMapIter = gpioMap.find(gpioId); + if(gpioMapIter == gpioMap.end()) { + auto statusPair = gpioMap.emplace(gpioId, gpioConfig); + if (statusPair.second == false) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "GpioCookie::addGpio: Failed to add GPIO " << gpioId << + " to GPIO map" << std::endl; +#else + sif::printWarning("GpioCookie::addGpio: Failed to add GPIO %d to GPIO map\n", gpioId); +#endif +#endif + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; + } +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "GpioCookie::addGpio: GPIO already exists in GPIO map " << std::endl; +#else + sif::printWarning("GpioCookie::addGpio: GPIO already exists in GPIO map\n"); +#endif +#endif + return HasReturnvaluesIF::RETURN_FAILED; +} + +GpioMap GpioCookie::getGpioMap() const { + return gpioMap; +} + +GpioCookie::~GpioCookie() { + for(auto& config: gpioMap) { + delete(config.second); + } +} diff --git a/hal/src/fsfw/hal/common/gpio/GpioCookie.h b/hal/src/fsfw/hal/common/gpio/GpioCookie.h new file mode 100644 index 00000000..0473fe0f --- /dev/null +++ b/hal/src/fsfw/hal/common/gpio/GpioCookie.h @@ -0,0 +1,41 @@ +#ifndef COMMON_GPIO_GPIOCOOKIE_H_ +#define COMMON_GPIO_GPIOCOOKIE_H_ + +#include "GpioIF.h" +#include "gpioDefinitions.h" + +#include +#include + +/** + * @brief Cookie for the GpioIF. Allows the GpioIF to determine which + * GPIOs to initialize and whether they should be configured as in- or + * output. + * @details One GpioCookie can hold multiple GPIO configurations. To add a new + * GPIO configuration to a GpioCookie use the GpioCookie::addGpio + * function. + * + * @author J. Meier + */ +class GpioCookie: public CookieIF { +public: + + GpioCookie(); + + virtual ~GpioCookie(); + + ReturnValue_t addGpio(gpioId_t gpioId, GpioBase* gpioConfig); + + /** + * @brief Get map with registered GPIOs. + */ + GpioMap getGpioMap() const; + +private: + /** + * Returns a copy of the internal GPIO map. + */ + GpioMap gpioMap; +}; + +#endif /* COMMON_GPIO_GPIOCOOKIE_H_ */ diff --git a/hal/src/fsfw/hal/common/gpio/GpioIF.h b/hal/src/fsfw/hal/common/gpio/GpioIF.h new file mode 100644 index 00000000..af73f94c --- /dev/null +++ b/hal/src/fsfw/hal/common/gpio/GpioIF.h @@ -0,0 +1,54 @@ +#ifndef COMMON_GPIO_GPIOIF_H_ +#define COMMON_GPIO_GPIOIF_H_ + +#include "gpioDefinitions.h" +#include +#include + +class GpioCookie; + +/** + * @brief This class defines the interface for objects requiring the control + * over GPIOs. + * @author J. Meier + */ +class GpioIF : public HasReturnvaluesIF { +public: + + virtual ~GpioIF() {}; + + /** + * @brief Called by the GPIO using object. + * @param cookie Cookie specifying informations of the GPIOs required + * by a object. + */ + virtual ReturnValue_t addGpios(GpioCookie* cookie) = 0; + + /** + * @brief By implementing this function a child must provide the + * functionality to pull a certain GPIO to high logic level. + * + * @param gpioId A unique number which specifies the GPIO to drive. + * @return Returns RETURN_OK for success. This should never return RETURN_FAILED. + */ + virtual ReturnValue_t pullHigh(gpioId_t gpioId) = 0; + + /** + * @brief By implementing this function a child must provide the + * functionality to pull a certain GPIO to low logic level. + * + * @param gpioId A unique number which specifies the GPIO to drive. + */ + virtual ReturnValue_t pullLow(gpioId_t gpioId) = 0; + + /** + * @brief This function requires a child to implement the functionality to read the state of + * an ouput or input gpio. + * + * @param gpioId A unique number which specifies the GPIO to read. + * @param gpioState State of GPIO will be written to this pointer. + */ + virtual ReturnValue_t readGpio(gpioId_t gpioId, int* gpioState) = 0; +}; + +#endif /* COMMON_GPIO_GPIOIF_H_ */ diff --git a/hal/src/fsfw/hal/common/gpio/gpioDefinitions.h b/hal/src/fsfw/hal/common/gpio/gpioDefinitions.h new file mode 100644 index 00000000..710b2e2c --- /dev/null +++ b/hal/src/fsfw/hal/common/gpio/gpioDefinitions.h @@ -0,0 +1,110 @@ +#ifndef COMMON_GPIO_GPIODEFINITIONS_H_ +#define COMMON_GPIO_GPIODEFINITIONS_H_ + +#include +#include +#include + +using gpioId_t = uint16_t; + +namespace gpio { + +enum Levels { + LOW = 0, + HIGH = 1 +}; + +enum Direction { + IN = 0, + OUT = 1 +}; + +enum GpioOperation { + READ, + WRITE +}; + +enum GpioTypes { + NONE, + GPIO_REGULAR, + CALLBACK +}; + +static constexpr gpioId_t NO_GPIO = -1; + +using gpio_cb_t = void (*) (gpioId_t gpioId, gpio::GpioOperation gpioOp, int value, void* args); + +} + +/** + * @brief Struct containing information about the GPIO to use. This is + * required by the libgpiod to access and drive a GPIO. + * @param chipname String of the chipname specifying the group which contains the GPIO to + * access. E.g. gpiochip0. To detect names of GPIO groups run gpiodetect on + * the linux command line. + * @param lineNum The offset of the GPIO within the GPIO group. + * @param consumer Name of the consumer. Simply a description of the GPIO configuration. + * @param direction Specifies whether the GPIO should be used as in- or output. + * @param initValue Defines the initial state of the GPIO when configured as output. + * Only required for output GPIOs. + * @param lineHandle The handle returned by gpiod_chip_get_line will be later written to this + * pointer. + */ +class GpioBase { +public: + + GpioBase() = default; + + GpioBase(gpio::GpioTypes gpioType, std::string consumer, gpio::Direction direction, + int initValue): + gpioType(gpioType), consumer(consumer),direction(direction), initValue(initValue) {} + + virtual~ GpioBase() {}; + + // Can be used to cast GpioBase to a concrete child implementation + gpio::GpioTypes gpioType = gpio::GpioTypes::NONE; + std::string consumer; + gpio::Direction direction = gpio::Direction::IN; + int initValue = 0; +}; + +class GpiodRegular: public GpioBase { +public: + GpiodRegular() : + GpioBase(gpio::GpioTypes::GPIO_REGULAR, std::string(), gpio::Direction::IN, 0) { + } + ; + + GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_, + gpio::Direction direction_, int initValue_) : + GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, direction_, initValue_), + chipname(chipname_), lineNum(lineNum_) { + } + + GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_) : + GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, gpio::Direction::IN, 0), + chipname(chipname_), lineNum(lineNum_) { + } + std::string chipname; + int lineNum = 0; + struct gpiod_line* lineHandle = nullptr; +}; + +class GpioCallback: public GpioBase { +public: + GpioCallback(std::string consumer, gpio::Direction direction_, int initValue_, + gpio::gpio_cb_t callback, void* callbackArgs): + GpioBase(gpio::GpioTypes::CALLBACK, consumer, direction_, initValue_), + callback(callback), callbackArgs(callbackArgs) {} + + gpio::gpio_cb_t callback = nullptr; + void* callbackArgs = nullptr; +}; + + +using GpioMap = std::map; +using GpioUnorderedMap = std::unordered_map; +using GpioMapIter = GpioMap::iterator; +using GpioUnorderedMapIter = GpioUnorderedMap::iterator; + +#endif /* LINUX_GPIO_GPIODEFINITIONS_H_ */ diff --git a/hal/src/fsfw/hal/common/spi/spiCommon.h b/hal/src/fsfw/hal/common/spi/spiCommon.h new file mode 100644 index 00000000..9b3aef6a --- /dev/null +++ b/hal/src/fsfw/hal/common/spi/spiCommon.h @@ -0,0 +1,17 @@ +#ifndef FSFW_HAL_COMMON_SPI_SPICOMMON_H_ +#define FSFW_HAL_COMMON_SPI_SPICOMMON_H_ + +#include + +namespace spi { + +enum SpiModes: uint8_t { + MODE_0, + MODE_1, + MODE_2, + MODE_3 +}; + +} + +#endif /* FSFW_HAL_COMMON_SPI_SPICOMMON_H_ */ diff --git a/hal/src/fsfw/hal/devicehandlers/CMakeLists.txt b/hal/src/fsfw/hal/devicehandlers/CMakeLists.txt new file mode 100644 index 00000000..cf542d8d --- /dev/null +++ b/hal/src/fsfw/hal/devicehandlers/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + GyroL3GD20Handler.cpp +) diff --git a/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.cpp b/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.cpp new file mode 100644 index 00000000..11f7e92d --- /dev/null +++ b/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.cpp @@ -0,0 +1,262 @@ +#include "fsfw/hal/devicehandlers/GyroL3GD20Handler.h" + +#include "fsfw/datapool/PoolReadGuard.h" + +GyroHandlerL3GD20H::GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceCommunication, + CookieIF *comCookie): + DeviceHandlerBase(objectId, deviceCommunication, comCookie), + dataset(this) { +#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 + debugDivider = new PeriodicOperationDivider(5); +#endif +} + +GyroHandlerL3GD20H::~GyroHandlerL3GD20H() {} + +void GyroHandlerL3GD20H::doStartUp() { + if(internalState == InternalState::NONE) { + internalState = InternalState::CONFIGURE; + } + + if(internalState == InternalState::CONFIGURE) { + if(commandExecuted) { + internalState = InternalState::CHECK_REGS; + commandExecuted = false; + } + } + + if(internalState == InternalState::CHECK_REGS) { + if(commandExecuted) { + internalState = InternalState::NORMAL; + if(goNormalModeImmediately) { + setMode(MODE_NORMAL); + } + else { + setMode(_MODE_TO_ON); + } + commandExecuted = false; + } + } +} + +void GyroHandlerL3GD20H::doShutDown() { + setMode(_MODE_POWER_DOWN); +} + +ReturnValue_t GyroHandlerL3GD20H::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + switch(internalState) { + case(InternalState::NONE): + case(InternalState::NORMAL): { + return HasReturnvaluesIF::RETURN_OK; + } + case(InternalState::CONFIGURE): { + *id = L3GD20H::CONFIGURE_CTRL_REGS; + uint8_t command [5]; + command[0] = L3GD20H::CTRL_REG_1_VAL; + command[1] = L3GD20H::CTRL_REG_2_VAL; + command[2] = L3GD20H::CTRL_REG_3_VAL; + command[3] = L3GD20H::CTRL_REG_4_VAL; + command[4] = L3GD20H::CTRL_REG_5_VAL; + return buildCommandFromCommand(*id, command, 5); + } + case(InternalState::CHECK_REGS): { + *id = L3GD20H::READ_REGS; + return buildCommandFromCommand(*id, nullptr, 0); + } + default: +#if FSFW_CPP_OSTREAM_ENABLED == 1 + /* Might be a configuration error. */ + sif::debug << "GyroHandler::buildTransitionDeviceCommand: Unknown internal state!" << + std::endl; +#else + sif::printDebug("GyroHandler::buildTransitionDeviceCommand: Unknown internal state!\n"); +#endif + return HasReturnvaluesIF::RETURN_OK; + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroHandlerL3GD20H::buildNormalDeviceCommand(DeviceCommandId_t *id) { + *id = L3GD20H::READ_REGS; + return buildCommandFromCommand(*id, nullptr, 0); +} + +ReturnValue_t GyroHandlerL3GD20H::buildCommandFromCommand( + DeviceCommandId_t deviceCommand, const uint8_t *commandData, + size_t commandDataLen) { + switch(deviceCommand) { + case(L3GD20H::READ_REGS): { + commandBuffer[0] = L3GD20H::READ_START | L3GD20H::AUTO_INCREMENT_MASK | L3GD20H::READ_MASK; + std::memset(commandBuffer + 1, 0, L3GD20H::READ_LEN); + rawPacket = commandBuffer; + rawPacketLen = L3GD20H::READ_LEN + 1; + break; + } + case(L3GD20H::CONFIGURE_CTRL_REGS): { + commandBuffer[0] = L3GD20H::CTRL_REG_1 | L3GD20H::AUTO_INCREMENT_MASK; + if(commandData == nullptr or commandDataLen != 5) { + return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; + } + + ctrlReg1Value = commandData[0]; + ctrlReg2Value = commandData[1]; + ctrlReg3Value = commandData[2]; + ctrlReg4Value = commandData[3]; + ctrlReg5Value = commandData[4]; + + bool fsH = ctrlReg4Value & L3GD20H::SET_FS_1; + bool fsL = ctrlReg4Value & L3GD20H::SET_FS_0; + + if(not fsH and not fsL) { + sensitivity = L3GD20H::SENSITIVITY_00; + } + else if(not fsH and fsL) { + sensitivity = L3GD20H::SENSITIVITY_01; + } + else { + sensitivity = L3GD20H::SENSITIVITY_11; + } + + commandBuffer[1] = ctrlReg1Value; + commandBuffer[2] = ctrlReg2Value; + commandBuffer[3] = ctrlReg3Value; + commandBuffer[4] = ctrlReg4Value; + commandBuffer[5] = ctrlReg5Value; + + rawPacket = commandBuffer; + rawPacketLen = 6; + break; + } + case(L3GD20H::READ_CTRL_REGS): { + commandBuffer[0] = L3GD20H::READ_START | L3GD20H::AUTO_INCREMENT_MASK | + L3GD20H::READ_MASK; + + std::memset(commandBuffer + 1, 0, 5); + rawPacket = commandBuffer; + rawPacketLen = 6; + break; + } + default: + return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroHandlerL3GD20H::scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) { + /* For SPI, the ID will always be the one of the last sent command. */ + *foundId = this->getPendingCommand(); + *foundLen = this->rawPacketLen; + + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroHandlerL3GD20H::interpretDeviceReply(DeviceCommandId_t id, + const uint8_t *packet) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + switch(id) { + case(L3GD20H::CONFIGURE_CTRL_REGS): { + commandExecuted = true; + break; + } + case(L3GD20H::READ_CTRL_REGS): { + if(packet[1] == ctrlReg1Value and packet[2] == ctrlReg2Value and + packet[3] == ctrlReg3Value and packet[4] == ctrlReg4Value and + packet[5] == ctrlReg5Value) { + commandExecuted = true; + } + else { + /* Attempt reconfiguration. */ + internalState = InternalState::CONFIGURE; + return DeviceHandlerIF::DEVICE_REPLY_INVALID; + } + break; + } + case(L3GD20H::READ_REGS): { + if(packet[1] != ctrlReg1Value and packet[2] != ctrlReg2Value and + packet[3] != ctrlReg3Value and packet[4] != ctrlReg4Value and + packet[5] != ctrlReg5Value) { + return DeviceHandlerIF::DEVICE_REPLY_INVALID; + } + else { + if(internalState == InternalState::CHECK_REGS) { + commandExecuted = true; + } + } + + statusReg = packet[L3GD20H::STATUS_IDX]; + + int16_t angVelocXRaw = packet[L3GD20H::OUT_X_H] << 8 | packet[L3GD20H::OUT_X_L]; + int16_t angVelocYRaw = packet[L3GD20H::OUT_Y_H] << 8 | packet[L3GD20H::OUT_Y_L]; + int16_t angVelocZRaw = packet[L3GD20H::OUT_Z_H] << 8 | packet[L3GD20H::OUT_Z_L]; + float angVelocX = angVelocXRaw * sensitivity; + float angVelocY = angVelocYRaw * sensitivity; + float angVelocZ = angVelocZRaw * sensitivity; + + int8_t temperaturOffset = (-1) * packet[L3GD20H::TEMPERATURE_IDX]; + float temperature = 25.0 + temperaturOffset; +#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 + if(debugDivider->checkAndIncrement()) { + /* Set terminal to utf-8 if there is an issue with micro printout. */ +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "GyroHandlerL3GD20H: Angular velocities in degrees per second:" << + std::endl; + sif::info << "X: " << angVelocX << " \xC2\xB0" << std::endl; + sif::info << "Y: " << angVelocY << " \xC2\xB0" << std::endl; + sif::info << "Z: " << angVelocZ << " \xC2\xB0" << std::endl; +#else + sif::printInfo("GyroHandlerL3GD20H: Angular velocities in degrees per second:\n"); + sif::printInfo("X: %f\n", angVelocX); + sif::printInfo("Y: %f\n", angVelocY); + sif::printInfo("Z: %f\n", angVelocZ); +#endif + } +#endif + + PoolReadGuard readSet(&dataset); + if(readSet.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + dataset.angVelocX = angVelocX; + dataset.angVelocY = angVelocY; + dataset.angVelocZ = angVelocZ; + dataset.temperature = temperature; + dataset.setValidity(true, true); + } + break; + } + default: + return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; + } + return result; +} + + +uint32_t GyroHandlerL3GD20H::getTransitionDelayMs(Mode_t from, Mode_t to) { + return 10000; +} + +void GyroHandlerL3GD20H::setGoNormalModeAtStartup() { + this->goNormalModeImmediately = true; +} + +ReturnValue_t GyroHandlerL3GD20H::initializeLocalDataPool( + localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { + localDataPoolMap.emplace(L3GD20H::ANG_VELOC_X, + new PoolEntry({0.0})); + localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Y, + new PoolEntry({0.0})); + localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Z, + new PoolEntry({0.0})); + localDataPoolMap.emplace(L3GD20H::TEMPERATURE, + new PoolEntry({0.0})); + return HasReturnvaluesIF::RETURN_OK; +} + +void GyroHandlerL3GD20H::fillCommandAndReplyMap() { + insertInCommandAndReplyMap(L3GD20H::READ_REGS, 1, &dataset); + insertInCommandAndReplyMap(L3GD20H::CONFIGURE_CTRL_REGS, 1); + insertInCommandAndReplyMap(L3GD20H::READ_CTRL_REGS, 1); +} + +void GyroHandlerL3GD20H::modeChanged() { + internalState = InternalState::NONE; +} diff --git a/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.h b/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.h new file mode 100644 index 00000000..f82ba935 --- /dev/null +++ b/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.h @@ -0,0 +1,86 @@ +#ifndef MISSION_DEVICES_GYROL3GD20HANDLER_H_ +#define MISSION_DEVICES_GYROL3GD20HANDLER_H_ + +#include "OBSWConfig.h" +#include "devicedefinitions/GyroL3GD20Definitions.h" + +#include +#include + +#ifndef FSFW_HAL_L3GD20_GYRO_DEBUG +#define FSFW_HAL_L3GD20_GYRO_DEBUG 1 +#endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */ + +/** + * @brief Device Handler for the L3GD20H gyroscope sensor + * (https://www.st.com/en/mems-and-sensors/l3gd20h.html) + * @details + * Advanced documentation: + * https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/L3GD20H_Gyro + * + * Data is read big endian with the smallest possible range of 245 degrees per second. + */ +class GyroHandlerL3GD20H: public DeviceHandlerBase { +public: + GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceCommunication, + CookieIF* comCookie); + virtual ~GyroHandlerL3GD20H(); + + void setGoNormalModeAtStartup(); +protected: + + /* DeviceHandlerBase overrides */ + ReturnValue_t buildTransitionDeviceCommand( + DeviceCommandId_t *id) override; + void doStartUp() override; + void doShutDown() override; + ReturnValue_t buildNormalDeviceCommand( + DeviceCommandId_t *id) override; + ReturnValue_t buildCommandFromCommand( + DeviceCommandId_t deviceCommand, const uint8_t *commandData, + size_t commandDataLen) override; + ReturnValue_t scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) override; + ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, + const uint8_t *packet) override; + + void fillCommandAndReplyMap() override; + void modeChanged() override; + uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; + ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) override; + +private: + GyroPrimaryDataset dataset; + + enum class InternalState { + NONE, + CONFIGURE, + CHECK_REGS, + NORMAL + }; + InternalState internalState = InternalState::NONE; + bool commandExecuted = false; + + uint8_t statusReg = 0; + bool goNormalModeImmediately = false; + + uint8_t ctrlReg1Value = L3GD20H::CTRL_REG_1_VAL; + uint8_t ctrlReg2Value = L3GD20H::CTRL_REG_2_VAL; + uint8_t ctrlReg3Value = L3GD20H::CTRL_REG_3_VAL; + uint8_t ctrlReg4Value = L3GD20H::CTRL_REG_4_VAL; + uint8_t ctrlReg5Value = L3GD20H::CTRL_REG_5_VAL; + + uint8_t commandBuffer[L3GD20H::READ_LEN + 1]; + + // Set default value + float sensitivity = L3GD20H::SENSITIVITY_00; + +#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 + PeriodicOperationDivider* debugDivider = nullptr; +#endif +}; + + + +#endif /* MISSION_DEVICES_GYROL3GD20HANDLER_H_ */ diff --git a/hal/src/fsfw/hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h b/hal/src/fsfw/hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h new file mode 100644 index 00000000..56a2468d --- /dev/null +++ b/hal/src/fsfw/hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h @@ -0,0 +1,143 @@ +#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_ +#define MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_ + +#include +#include +#include + +namespace L3GD20H { + +/* Actual size is 15 but we round up a bit */ +static constexpr size_t MAX_BUFFER_SIZE = 16; + +static constexpr uint8_t READ_MASK = 0b10000000; + +static constexpr uint8_t AUTO_INCREMENT_MASK = 0b01000000; + +static constexpr uint8_t WHO_AM_I_REG = 0b00001111; +static constexpr uint8_t WHO_AM_I_VAL = 0b11010111; + +/*------------------------------------------------------------------------*/ +/* Control registers */ +/*------------------------------------------------------------------------*/ +static constexpr uint8_t CTRL_REG_1 = 0b00100000; +static constexpr uint8_t CTRL_REG_2 = 0b00100001; +static constexpr uint8_t CTRL_REG_3 = 0b00100010; +static constexpr uint8_t CTRL_REG_4 = 0b00100011; +static constexpr uint8_t CTRL_REG_5 = 0b00100100; + +/* Register 1 */ +static constexpr uint8_t SET_DR_1 = 1 << 7; +static constexpr uint8_t SET_DR_0 = 1 << 6; +static constexpr uint8_t SET_BW_1 = 1 << 5; +static constexpr uint8_t SET_BW_0 = 1 << 4; +static constexpr uint8_t SET_POWER_NORMAL_MODE = 1 << 3; +static constexpr uint8_t SET_Z_ENABLE = 1 << 2; +static constexpr uint8_t SET_X_ENABLE = 1 << 1; +static constexpr uint8_t SET_Y_ENABLE = 1; + +static constexpr uint8_t CTRL_REG_1_VAL = SET_POWER_NORMAL_MODE | SET_Z_ENABLE | + SET_Y_ENABLE | SET_X_ENABLE; + +/* Register 2 */ +static constexpr uint8_t EXTERNAL_EDGE_ENB = 1 << 7; +static constexpr uint8_t LEVEL_SENSITIVE_TRIGGER = 1 << 6; +static constexpr uint8_t SET_HPM_1 = 1 << 5; +static constexpr uint8_t SET_HPM_0 = 1 << 4; +static constexpr uint8_t SET_HPCF_3 = 1 << 3; +static constexpr uint8_t SET_HPCF_2 = 1 << 2; +static constexpr uint8_t SET_HPCF_1 = 1 << 1; +static constexpr uint8_t SET_HPCF_0 = 1; + +static constexpr uint8_t CTRL_REG_2_VAL = 0b00000000; + +/* Register 3 */ +static constexpr uint8_t CTRL_REG_3_VAL = 0b00000000; + +/* Register 4 */ +static constexpr uint8_t SET_BNU = 1 << 7; +static constexpr uint8_t SET_BLE = 1 << 6; +static constexpr uint8_t SET_FS_1 = 1 << 5; +static constexpr uint8_t SET_FS_0 = 1 << 4; +static constexpr uint8_t SET_IMP_ENB = 1 << 3; +static constexpr uint8_t SET_SELF_TEST_ENB_1 = 1 << 2; +static constexpr uint8_t SET_SELF_TEST_ENB_0 = 1 << 1; +static constexpr uint8_t SET_SPI_IF_SELECT = 1; + +/* Enable big endian data format */ +static constexpr uint8_t CTRL_REG_4_VAL = SET_BLE; + +/* Register 5 */ +static constexpr uint8_t SET_REBOOT_MEM = 1 << 7; +static constexpr uint8_t SET_FIFO_ENB = 1 << 6; + +static constexpr uint8_t CTRL_REG_5_VAL = 0b00000000; + +/* Possible range values in degrees per second (DPS). */ +static constexpr uint16_t RANGE_DPS_00 = 245; +static constexpr float SENSITIVITY_00 = 8.75 * 0.001; +static constexpr uint16_t RANGE_DPS_01 = 500; +static constexpr float SENSITIVITY_01 = 17.5 * 0.001; +static constexpr uint16_t RANGE_DPS_11 = 2000; +static constexpr float SENSITIVITY_11 = 70.0 * 0.001; + +static constexpr uint8_t READ_START = CTRL_REG_1; +static constexpr size_t READ_LEN = 14; + +/* Indexing */ +static constexpr uint8_t REFERENCE_IDX = 6; +static constexpr uint8_t TEMPERATURE_IDX = 7; +static constexpr uint8_t STATUS_IDX = 8; +static constexpr uint8_t OUT_X_H = 9; +static constexpr uint8_t OUT_X_L = 10; +static constexpr uint8_t OUT_Y_H = 11; +static constexpr uint8_t OUT_Y_L = 12; +static constexpr uint8_t OUT_Z_H = 13; +static constexpr uint8_t OUT_Z_L = 14; + +/*------------------------------------------------------------------------*/ +/* Device Handler specific */ +/*------------------------------------------------------------------------*/ +static constexpr DeviceCommandId_t READ_REGS = 0; +static constexpr DeviceCommandId_t CONFIGURE_CTRL_REGS = 1; +static constexpr DeviceCommandId_t READ_CTRL_REGS = 2; + +static constexpr uint32_t GYRO_DATASET_ID = READ_REGS; + +enum GyroPoolIds: lp_id_t { + ANG_VELOC_X, + ANG_VELOC_Y, + ANG_VELOC_Z, + TEMPERATURE +}; + +} + +class GyroPrimaryDataset: public StaticLocalDataSet<5> { +public: + + /** Constructor for data users like controllers */ + GyroPrimaryDataset(object_id_t mgmId): + StaticLocalDataSet(sid_t(mgmId, L3GD20H::GYRO_DATASET_ID)) { + setAllVariablesReadOnly(); + } + + /* Angular velocities in degrees per second (DPS) */ + lp_var_t angVelocX = lp_var_t(sid.objectId, + L3GD20H::ANG_VELOC_X, this); + lp_var_t angVelocY = lp_var_t(sid.objectId, + L3GD20H::ANG_VELOC_Y, this); + lp_var_t angVelocZ = lp_var_t(sid.objectId, + L3GD20H::ANG_VELOC_Z, this); + lp_var_t temperature = lp_var_t(sid.objectId, + L3GD20H::TEMPERATURE, this); +private: + + friend class GyroHandlerL3GD20H; + /** Constructor for the data creator */ + GyroPrimaryDataset(HasLocalDataPoolIF* hkOwner): + StaticLocalDataSet(hkOwner, L3GD20H::GYRO_DATASET_ID) {} +}; + + +#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_ */ diff --git a/hal/src/fsfw/hal/host/CMakeLists.txt b/hal/src/fsfw/hal/host/CMakeLists.txt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/hal/src/fsfw/hal/host/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/hal/src/fsfw/hal/linux/CMakeLists.txt b/hal/src/fsfw/hal/linux/CMakeLists.txt new file mode 100644 index 00000000..5944b0e5 --- /dev/null +++ b/hal/src/fsfw/hal/linux/CMakeLists.txt @@ -0,0 +1,13 @@ +if(FSFW_HAL_ADD_RASPBERRY_PI) + add_subdirectory(rpi) +endif() + +target_sources(${LIB_FSFW_NAME} PRIVATE + UnixFileGuard.cpp + utility.cpp +) + +add_subdirectory(gpio) +add_subdirectory(spi) +add_subdirectory(i2c) +add_subdirectory(uart) \ No newline at end of file diff --git a/hal/src/fsfw/hal/linux/UnixFileGuard.cpp b/hal/src/fsfw/hal/linux/UnixFileGuard.cpp new file mode 100644 index 00000000..c47e35b1 --- /dev/null +++ b/hal/src/fsfw/hal/linux/UnixFileGuard.cpp @@ -0,0 +1,33 @@ +#include "fsfw/hal/linux/UnixFileGuard.h" + +UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags, + std::string diagnosticPrefix): + fileDescriptor(fileDescriptor) { + if(fileDescriptor == nullptr) { + return; + } + *fileDescriptor = open(device.c_str(), flags); + if (*fileDescriptor < 0) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << diagnosticPrefix <<"Opening device failed with error code " << errno << + "." << std::endl; + sif::warning << "Error description: " << strerror(errno) << std::endl; +#else + sif::printError("%sOpening device failed with error code %d.\n", diagnosticPrefix); + sif::printWarning("Error description: %s\n", strerror(errno)); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + openStatus = OPEN_FILE_FAILED; + } +} + +UnixFileGuard::~UnixFileGuard() { + if(fileDescriptor != nullptr) { + close(*fileDescriptor); + } +} + +ReturnValue_t UnixFileGuard::getOpenResult() const { + return openStatus; +} diff --git a/hal/src/fsfw/hal/linux/UnixFileGuard.h b/hal/src/fsfw/hal/linux/UnixFileGuard.h new file mode 100644 index 00000000..fb595704 --- /dev/null +++ b/hal/src/fsfw/hal/linux/UnixFileGuard.h @@ -0,0 +1,33 @@ +#ifndef LINUX_UTILITY_UNIXFILEGUARD_H_ +#define LINUX_UTILITY_UNIXFILEGUARD_H_ + +#include + +#include + +#include +#include + + +class UnixFileGuard { +public: + static constexpr int READ_WRITE_FLAG = O_RDWR; + static constexpr int READ_ONLY_FLAG = O_RDONLY; + static constexpr int NON_BLOCKING_IO_FLAG = O_NONBLOCK; + + static constexpr ReturnValue_t OPEN_FILE_FAILED = 1; + + UnixFileGuard(std::string device, int* fileDescriptor, int flags, + std::string diagnosticPrefix = ""); + + virtual~ UnixFileGuard(); + + ReturnValue_t getOpenResult() const; +private: + int* fileDescriptor = nullptr; + ReturnValue_t openStatus = HasReturnvaluesIF::RETURN_OK; +}; + + + +#endif /* LINUX_UTILITY_UNIXFILEGUARD_H_ */ diff --git a/hal/src/fsfw/hal/linux/gpio/CMakeLists.txt b/hal/src/fsfw/hal/linux/gpio/CMakeLists.txt new file mode 100644 index 00000000..7083f70d --- /dev/null +++ b/hal/src/fsfw/hal/linux/gpio/CMakeLists.txt @@ -0,0 +1,12 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + LinuxLibgpioIF.cpp +) + +# This abstraction layer requires the gpiod library. You can install this library +# with "sudo apt-get install -y libgpiod-dev". If you are cross-compiling, you need +# to install the package before syncing the sysroot to your host computer. +find_library(LIB_GPIO gpiod REQUIRED) + +target_link_libraries(${LIB_FSFW_NAME} PRIVATE + ${LIB_GPIO} +) \ No newline at end of file diff --git a/hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.cpp b/hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.cpp new file mode 100644 index 00000000..98e02796 --- /dev/null +++ b/hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.cpp @@ -0,0 +1,305 @@ +#include "fsfw/hal/linux/gpio/LinuxLibgpioIF.h" +#include "fsfw/hal/common/gpio/gpioDefinitions.h" +#include "fsfw/hal/common/gpio/GpioCookie.h" + +#include + +#include +#include +#include + +LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) { +} + +LinuxLibgpioIF::~LinuxLibgpioIF() { + for(auto& config: gpioMap) { + delete(config.second); + } +} + +ReturnValue_t LinuxLibgpioIF::addGpios(GpioCookie* gpioCookie) { + ReturnValue_t result; + if(gpioCookie == nullptr) { + sif::error << "LinuxLibgpioIF::initialize: Invalid cookie" << std::endl; + return RETURN_FAILED; + } + + GpioMap mapToAdd = gpioCookie->getGpioMap(); + + /* Check whether this ID already exists in the map and remove duplicates */ + result = checkForConflicts(mapToAdd); + if (result != RETURN_OK){ + return result; + } + + result = configureGpios(mapToAdd); + if (result != RETURN_OK) { + return RETURN_FAILED; + } + + /* Register new GPIOs in gpioMap */ + gpioMap.insert(mapToAdd.begin(), mapToAdd.end()); + + return RETURN_OK; +} + +ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap& mapToAdd) { + for(auto& gpioConfig: mapToAdd) { + switch(gpioConfig.second->gpioType) { + case(gpio::GpioTypes::NONE): { + return GPIO_INVALID_INSTANCE; + } + case(gpio::GpioTypes::GPIO_REGULAR): { + GpiodRegular* regularGpio = dynamic_cast(gpioConfig.second); + if(regularGpio == nullptr) { + return GPIO_INVALID_INSTANCE; + } + configureRegularGpio(gpioConfig.first, regularGpio); + break; + } + case(gpio::GpioTypes::CALLBACK): { + auto gpioCallback = dynamic_cast(gpioConfig.second); + if(gpioCallback->callback == nullptr) { + return GPIO_INVALID_INSTANCE; + } + gpioCallback->callback(gpioConfig.first, gpio::GpioOperation::WRITE, + gpioCallback->initValue, gpioCallback->callbackArgs); + } + } + } + return RETURN_OK; +} + +ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, GpiodRegular *regularGpio) { + std::string chipname; + unsigned int lineNum; + struct gpiod_chip *chip; + gpio::Direction direction; + std::string consumer; + struct gpiod_line *lineHandle; + int result = 0; + + chipname = regularGpio->chipname; + chip = gpiod_chip_open_by_name(chipname.c_str()); + if (!chip) { + sif::warning << "LinuxLibgpioIF::configureRegularGpio: Failed to open chip " + << chipname << ". Gpio ID: " << gpioId << std::endl; + return RETURN_FAILED; + } + + lineNum = regularGpio->lineNum; + lineHandle = gpiod_chip_get_line(chip, lineNum); + if (!lineHandle) { + sif::debug << "LinuxLibgpioIF::configureRegularGpio: Failed to open line " << std::endl; + sif::debug << "GPIO ID: " << gpioId << ", line number: " << lineNum << + ", chipname: " << chipname << std::endl; + sif::debug << "Check if linux GPIO configuration has changed. " << std::endl; + gpiod_chip_close(chip); + return RETURN_FAILED; + } + + direction = regularGpio->direction; + consumer = regularGpio->consumer; + /* Configure direction and add a description to the GPIO */ + switch (direction) { + case(gpio::OUT): { + result = gpiod_line_request_output(lineHandle, consumer.c_str(), + regularGpio->initValue); + if (result < 0) { + sif::error << "LinuxLibgpioIF::configureRegularGpio: Failed to request line " << lineNum << + " from GPIO instance with ID: " << gpioId << std::endl; + gpiod_line_release(lineHandle); + return RETURN_FAILED; + } + break; + } + case(gpio::IN): { + result = gpiod_line_request_input(lineHandle, consumer.c_str()); + if (result < 0) { + sif::error << "LinuxLibgpioIF::configureGpios: Failed to request line " + << lineNum << " from GPIO instance with ID: " << gpioId << std::endl; + gpiod_line_release(lineHandle); + return RETURN_FAILED; + } + break; + } + default: { + sif::error << "LinuxLibgpioIF::configureGpios: Invalid direction specified" + << std::endl; + return GPIO_INVALID_INSTANCE; + } + + } + /** + * Write line handle to GPIO configuration instance so it can later be used to set or + * read states of GPIOs. + */ + regularGpio->lineHandle = lineHandle; + return RETURN_OK; +} + +ReturnValue_t LinuxLibgpioIF::pullHigh(gpioId_t gpioId) { + gpioMapIter = gpioMap.find(gpioId); + if (gpioMapIter == gpioMap.end()) { + sif::warning << "LinuxLibgpioIF::pullHigh: Unknown GPIO ID " << gpioId << std::endl; + return UNKNOWN_GPIO_ID; + } + + if(gpioMapIter->second->gpioType == gpio::GpioTypes::GPIO_REGULAR) { + return driveGpio(gpioId, dynamic_cast(gpioMapIter->second), 1); + } + else { + auto gpioCallback = dynamic_cast(gpioMapIter->second); + if(gpioCallback->callback == nullptr) { + return GPIO_INVALID_INSTANCE; + } + gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE, + 1, gpioCallback->callbackArgs); + return RETURN_OK; + } + return GPIO_TYPE_FAILURE; +} + +ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId) { + gpioMapIter = gpioMap.find(gpioId); + if (gpioMapIter == gpioMap.end()) { + sif::warning << "LinuxLibgpioIF::pullLow: Unknown GPIO ID " << gpioId << std::endl; + return UNKNOWN_GPIO_ID; + } + + if(gpioMapIter->second->gpioType == gpio::GpioTypes::GPIO_REGULAR) { + return driveGpio(gpioId, dynamic_cast(gpioMapIter->second), 0); + } + else { + auto gpioCallback = dynamic_cast(gpioMapIter->second); + if(gpioCallback->callback == nullptr) { + return GPIO_INVALID_INSTANCE; + } + gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE, + 0, gpioCallback->callbackArgs); + return RETURN_OK; + } + return GPIO_TYPE_FAILURE; +} + +ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId, + GpiodRegular* regularGpio, unsigned int logicLevel) { + if(regularGpio == nullptr) { + return GPIO_TYPE_FAILURE; + } + + int result = gpiod_line_set_value(regularGpio->lineHandle, logicLevel); + if (result < 0) { + sif::warning << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID " << gpioId << + " to logic level " << logicLevel << std::endl; + return DRIVE_GPIO_FAILURE; + } + + return RETURN_OK; +} + +ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) { + gpioMapIter = gpioMap.find(gpioId); + if (gpioMapIter == gpioMap.end()){ + sif::warning << "LinuxLibgpioIF::readGpio: Unknown GPIOD ID " << gpioId << std::endl; + return UNKNOWN_GPIO_ID; + } + + if(gpioMapIter->second->gpioType == gpio::GpioTypes::GPIO_REGULAR) { + GpiodRegular* regularGpio = dynamic_cast(gpioMapIter->second); + if(regularGpio == nullptr) { + return GPIO_TYPE_FAILURE; + } + *gpioState = gpiod_line_get_value(regularGpio->lineHandle); + } + else { + + } + + + return RETURN_OK; +} + +ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap& mapToAdd){ + ReturnValue_t status = HasReturnvaluesIF::RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + for(auto& gpioConfig: mapToAdd) { + switch(gpioConfig.second->gpioType) { + case(gpio::GpioTypes::GPIO_REGULAR): { + auto regularGpio = dynamic_cast(gpioConfig.second); + if(regularGpio == nullptr) { + return GPIO_TYPE_FAILURE; + } + /* Check for conflicts and remove duplicates if necessary */ + result = checkForConflictsRegularGpio(gpioConfig.first, regularGpio, mapToAdd); + if(result != HasReturnvaluesIF::RETURN_OK) { + status = result; + } + break; + } + case(gpio::GpioTypes::CALLBACK): { + auto callbackGpio = dynamic_cast(gpioConfig.second); + if(callbackGpio == nullptr) { + return GPIO_TYPE_FAILURE; + } + /* Check for conflicts and remove duplicates if necessary */ + result = checkForConflictsCallbackGpio(gpioConfig.first, callbackGpio, mapToAdd); + if(result != HasReturnvaluesIF::RETURN_OK) { + status = result; + } + break; + } + default: { + + } + } + } + return status; +} + + +ReturnValue_t LinuxLibgpioIF::checkForConflictsRegularGpio(gpioId_t gpioIdToCheck, + GpiodRegular* gpioToCheck, GpioMap& mapToAdd) { + /* Cross check with private map */ + gpioMapIter = gpioMap.find(gpioIdToCheck); + if(gpioMapIter != gpioMap.end()) { + if(gpioMapIter->second->gpioType != gpio::GpioTypes::GPIO_REGULAR) { + sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for different " + "GPIO type" << gpioIdToCheck << ". Removing duplicate." << std::endl; + mapToAdd.erase(gpioIdToCheck); + return HasReturnvaluesIF::RETURN_OK; + } + auto ownRegularGpio = dynamic_cast(gpioMapIter->second); + if(ownRegularGpio == nullptr) { + return GPIO_TYPE_FAILURE; + } + + /* Remove element from map to add because a entry for this GPIO + already exists */ + sif::warning << "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO definition" + << " detected. Duplicate will be removed from map to add." << std::endl; + mapToAdd.erase(gpioIdToCheck); + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t LinuxLibgpioIF::checkForConflictsCallbackGpio(gpioId_t gpioIdToCheck, + GpioCallback *callbackGpio, GpioMap& mapToAdd) { + /* Cross check with private map */ + gpioMapIter = gpioMap.find(gpioIdToCheck); + if(gpioMapIter != gpioMap.end()) { + if(gpioMapIter->second->gpioType != gpio::GpioTypes::CALLBACK) { + sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for different " + "GPIO type" << gpioIdToCheck << ". Removing duplicate." << std::endl; + mapToAdd.erase(gpioIdToCheck); + return HasReturnvaluesIF::RETURN_OK; + } + + /* Remove element from map to add because a entry for this GPIO + already exists */ + sif::warning << "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO definition" + << " detected. Duplicate will be removed from map to add." << std::endl; + mapToAdd.erase(gpioIdToCheck); + } + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.h b/hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.h new file mode 100644 index 00000000..00e1bdfe --- /dev/null +++ b/hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.h @@ -0,0 +1,77 @@ +#ifndef LINUX_GPIO_LINUXLIBGPIOIF_H_ +#define LINUX_GPIO_LINUXLIBGPIOIF_H_ + +#include "../../common/gpio/GpioIF.h" +#include +#include + +class GpioCookie; + +/** + * @brief This class implements the GpioIF for a linux based system. The + * implementation is based on the libgpiod lib which requires linux 4.8 + * or higher. + * @note The Petalinux SDK from Xilinx supports libgpiod since Petalinux + * 2019.1. + */ +class LinuxLibgpioIF : public GpioIF, public SystemObject { +public: + + static const uint8_t gpioRetvalId = CLASS_ID::HAL_GPIO; + + static constexpr ReturnValue_t UNKNOWN_GPIO_ID = + HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 1); + static constexpr ReturnValue_t DRIVE_GPIO_FAILURE = + HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 2); + static constexpr ReturnValue_t GPIO_TYPE_FAILURE = + HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 3); + static constexpr ReturnValue_t GPIO_INVALID_INSTANCE = + HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 4); + + LinuxLibgpioIF(object_id_t objectId); + virtual ~LinuxLibgpioIF(); + + ReturnValue_t addGpios(GpioCookie* gpioCookie) override; + ReturnValue_t pullHigh(gpioId_t gpioId) override; + ReturnValue_t pullLow(gpioId_t gpioId) override; + ReturnValue_t readGpio(gpioId_t gpioId, int* gpioState) override; + +private: + /* Holds the information and configuration of all used GPIOs */ + GpioUnorderedMap gpioMap; + GpioUnorderedMapIter gpioMapIter; + + /** + * @brief This functions drives line of a GPIO specified by the GPIO ID. + * + * @param gpioId The GPIO ID of the GPIO to drive. + * @param logiclevel The logic level to set. O or 1. + */ + ReturnValue_t driveGpio(gpioId_t gpioId, GpiodRegular* regularGpio, unsigned int logiclevel); + + ReturnValue_t configureRegularGpio(gpioId_t gpioId, GpiodRegular* regularGpio); + + /** + * @brief This function checks if GPIOs are already registered and whether + * there exists a conflict in the GPIO configuration. E.g. the + * direction. + * + * @param mapToAdd The GPIOs which shall be added to the gpioMap. + * + * @return RETURN_OK if successful, otherwise RETURN_FAILED + */ + ReturnValue_t checkForConflicts(GpioMap& mapToAdd); + + ReturnValue_t checkForConflictsRegularGpio(gpioId_t gpiodId, GpiodRegular* regularGpio, + GpioMap& mapToAdd); + ReturnValue_t checkForConflictsCallbackGpio(gpioId_t gpiodId, GpioCallback* regularGpio, + GpioMap& mapToAdd); + + /** + * @brief Performs the initial configuration of all GPIOs specified in the GpioMap mapToAdd. + */ + ReturnValue_t configureGpios(GpioMap& mapToAdd); + +}; + +#endif /* LINUX_GPIO_LINUXLIBGPIOIF_H_ */ diff --git a/hal/src/fsfw/hal/linux/i2c/CMakeLists.txt b/hal/src/fsfw/hal/linux/i2c/CMakeLists.txt new file mode 100644 index 00000000..3eb0882c --- /dev/null +++ b/hal/src/fsfw/hal/linux/i2c/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${LIB_FSFW_NAME} PUBLIC + I2cComIF.cpp + I2cCookie.cpp +) + + + + diff --git a/hal/src/fsfw/hal/linux/i2c/I2cComIF.cpp b/hal/src/fsfw/hal/linux/i2c/I2cComIF.cpp new file mode 100644 index 00000000..d756e75e --- /dev/null +++ b/hal/src/fsfw/hal/linux/i2c/I2cComIF.cpp @@ -0,0 +1,205 @@ +#include "fsfw/hal/linux/i2c/I2cComIF.h" +#include "fsfw/hal/linux/utility.h" +#include "fsfw/hal/linux/UnixFileGuard.h" + +#include "fsfw/serviceinterface/ServiceInterface.h" + +#include +#include +#include +#include +#include + +#include + + +I2cComIF::I2cComIF(object_id_t objectId): SystemObject(objectId){ +} + +I2cComIF::~I2cComIF() {} + +ReturnValue_t I2cComIF::initializeInterface(CookieIF* cookie) { + + address_t i2cAddress; + std::string deviceFile; + + if(cookie == nullptr) { + sif::error << "I2cComIF::initializeInterface: Invalid cookie!" << std::endl; + return NULLPOINTER; + } + I2cCookie* i2cCookie = dynamic_cast(cookie); + if(i2cCookie == nullptr) { + sif::error << "I2cComIF::initializeInterface: Invalid I2C cookie!" << std::endl; + return NULLPOINTER; + } + + i2cAddress = i2cCookie->getAddress(); + + i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); + if(i2cDeviceMapIter == i2cDeviceMap.end()) { + size_t maxReplyLen = i2cCookie->getMaxReplyLen(); + I2cInstance i2cInstance = {std::vector(maxReplyLen), 0}; + auto statusPair = i2cDeviceMap.emplace(i2cAddress, i2cInstance); + if (not statusPair.second) { + sif::error << "I2cComIF::initializeInterface: Failed to insert device with address " << + i2cAddress << "to I2C device " << "map" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; + } + + sif::error << "I2cComIF::initializeInterface: Device with address " << i2cAddress << + "already in use" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; +} + +ReturnValue_t I2cComIF::sendMessage(CookieIF *cookie, + const uint8_t *sendData, size_t sendLen) { + + ReturnValue_t result; + int fd; + std::string deviceFile; + + if(sendData == nullptr) { + sif::error << "I2cComIF::sendMessage: Send Data is nullptr" + << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + + if(sendLen == 0) { + return HasReturnvaluesIF::RETURN_OK; + } + + I2cCookie* i2cCookie = dynamic_cast(cookie); + if(i2cCookie == nullptr) { + sif::error << "I2cComIF::sendMessage: Invalid I2C Cookie!" << std::endl; + return NULLPOINTER; + } + + address_t i2cAddress = i2cCookie->getAddress(); + i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); + if (i2cDeviceMapIter == i2cDeviceMap.end()) { + sif::error << "I2cComIF::sendMessage: i2cAddress of Cookie not " + << "registered in i2cDeviceMap" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + + deviceFile = i2cCookie->getDeviceFile(); + UnixFileGuard fileHelper(deviceFile, &fd, O_RDWR, "I2cComIF::sendMessage"); + if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { + return fileHelper.getOpenResult(); + } + result = openDevice(deviceFile, i2cAddress, &fd); + if (result != HasReturnvaluesIF::RETURN_OK){ + return result; + } + + if (write(fd, sendData, sendLen) != (int)sendLen) { + sif::error << "I2cComIF::sendMessage: Failed to send data to I2C " + "device with error code " << errno << ". Error description: " + << strerror(errno) << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t I2cComIF::getSendSuccess(CookieIF *cookie) { + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF *cookie, + size_t requestLen) { + ReturnValue_t result; + int fd; + std::string deviceFile; + + if (requestLen == 0) { + return HasReturnvaluesIF::RETURN_OK; + } + + I2cCookie* i2cCookie = dynamic_cast(cookie); + if(i2cCookie == nullptr) { + sif::error << "I2cComIF::requestReceiveMessage: Invalid I2C Cookie!" << std::endl; + i2cDeviceMapIter->second.replyLen = 0; + return NULLPOINTER; + } + + address_t i2cAddress = i2cCookie->getAddress(); + i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); + if (i2cDeviceMapIter == i2cDeviceMap.end()) { + sif::error << "I2cComIF::requestReceiveMessage: i2cAddress of Cookie not " + << "registered in i2cDeviceMap" << std::endl; + i2cDeviceMapIter->second.replyLen = 0; + return HasReturnvaluesIF::RETURN_FAILED; + } + + deviceFile = i2cCookie->getDeviceFile(); + UnixFileGuard fileHelper(deviceFile, &fd, O_RDWR, "I2cComIF::requestReceiveMessage"); + if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { + return fileHelper.getOpenResult(); + } + result = openDevice(deviceFile, i2cAddress, &fd); + if (result != HasReturnvaluesIF::RETURN_OK){ + i2cDeviceMapIter->second.replyLen = 0; + return result; + } + + uint8_t* replyBuffer = i2cDeviceMapIter->second.replyBuffer.data(); + + int readLen = read(fd, replyBuffer, requestLen); + if (readLen != static_cast(requestLen)) { +#if FSFW_VERBOSE_LEVEL >= 1 and FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "I2cComIF::requestReceiveMessage: Reading from I2C " + << "device failed with error code " << errno <<". Description" + << " of error: " << strerror(errno) << std::endl; + sif::error << "I2cComIF::requestReceiveMessage: Read only " << readLen << " from " + << requestLen << " bytes" << std::endl; +#endif + i2cDeviceMapIter->second.replyLen = 0; + sif::debug << "I2cComIF::requestReceiveMessage: Read " << readLen << " of " << requestLen << " bytes" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + + i2cDeviceMapIter->second.replyLen = requestLen; + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t I2cComIF::readReceivedMessage(CookieIF *cookie, + uint8_t **buffer, size_t* size) { + I2cCookie* i2cCookie = dynamic_cast(cookie); + if(i2cCookie == nullptr) { + sif::error << "I2cComIF::readReceivedMessage: Invalid I2C Cookie!" << std::endl; + return NULLPOINTER; + } + + address_t i2cAddress = i2cCookie->getAddress(); + i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); + if (i2cDeviceMapIter == i2cDeviceMap.end()) { + sif::error << "I2cComIF::readReceivedMessage: i2cAddress of Cookie not " + << "found in i2cDeviceMap" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + *buffer = i2cDeviceMapIter->second.replyBuffer.data(); + *size = i2cDeviceMapIter->second.replyLen; + + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t I2cComIF::openDevice(std::string deviceFile, + address_t i2cAddress, int* fileDescriptor) { + + if (ioctl(*fileDescriptor, I2C_SLAVE, i2cAddress) < 0) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "I2cComIF: Specifying target device failed with error code " << errno << "." + << std::endl; + sif::warning << "Error description " << strerror(errno) << std::endl; +#else + sif::printWarning("I2cComIF: Specifying target device failed with error code %d.\n"); + sif::printWarning("Error description: %s\n", strerror(errno)); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/hal/src/fsfw/hal/linux/i2c/I2cComIF.h b/hal/src/fsfw/hal/linux/i2c/I2cComIF.h new file mode 100644 index 00000000..0856c9bd --- /dev/null +++ b/hal/src/fsfw/hal/linux/i2c/I2cComIF.h @@ -0,0 +1,61 @@ +#ifndef LINUX_I2C_I2COMIF_H_ +#define LINUX_I2C_I2COMIF_H_ + +#include "I2cCookie.h" +#include +#include + +#include +#include + +/** + * @brief This is the communication interface for I2C devices connected + * to a system running a Linux OS. + * + * @note The Xilinx Linux kernel might not support to read more than 255 bytes at once. + * + * @author J. Meier + */ +class I2cComIF: public DeviceCommunicationIF, public SystemObject { +public: + I2cComIF(object_id_t objectId); + + virtual ~I2cComIF(); + + ReturnValue_t initializeInterface(CookieIF * cookie) override; + ReturnValue_t sendMessage(CookieIF *cookie,const uint8_t *sendData, + size_t sendLen) override; + ReturnValue_t getSendSuccess(CookieIF *cookie) override; + ReturnValue_t requestReceiveMessage(CookieIF *cookie, + size_t requestLen) override; + ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, + size_t *size) override; + +private: + + struct I2cInstance { + std::vector replyBuffer; + size_t replyLen; + }; + + using I2cDeviceMap = std::unordered_map; + using I2cDeviceMapIter = I2cDeviceMap::iterator; + + /* In this map all i2c devices will be registered with their address and + * the appropriate file descriptor will be stored */ + I2cDeviceMap i2cDeviceMap; + I2cDeviceMapIter i2cDeviceMapIter; + + /** + * @brief This function opens an I2C device and binds the opened file + * to a specific I2C address. + * @param deviceFile The name of the device file. E.g. i2c-0 + * @param i2cAddress The address of the i2c slave device. + * @param fileDescriptor Pointer to device descriptor. + * @return RETURN_OK if successful, otherwise RETURN_FAILED. + */ + ReturnValue_t openDevice(std::string deviceFile, + address_t i2cAddress, int* fileDescriptor); +}; + +#endif /* LINUX_I2C_I2COMIF_H_ */ diff --git a/hal/src/fsfw/hal/linux/i2c/I2cCookie.cpp b/hal/src/fsfw/hal/linux/i2c/I2cCookie.cpp new file mode 100644 index 00000000..fd0f654d --- /dev/null +++ b/hal/src/fsfw/hal/linux/i2c/I2cCookie.cpp @@ -0,0 +1,20 @@ +#include "fsfw/hal/linux/i2c/I2cCookie.h" + +I2cCookie::I2cCookie(address_t i2cAddress_, size_t maxReplyLen_, + std::string deviceFile_) : + i2cAddress(i2cAddress_), maxReplyLen(maxReplyLen_), deviceFile(deviceFile_) { +} + +address_t I2cCookie::getAddress() const { + return i2cAddress; +} + +size_t I2cCookie::getMaxReplyLen() const { + return maxReplyLen; +} + +std::string I2cCookie::getDeviceFile() const { + return deviceFile; +} + +I2cCookie::~I2cCookie() {} diff --git a/hal/src/fsfw/hal/linux/i2c/I2cCookie.h b/hal/src/fsfw/hal/linux/i2c/I2cCookie.h new file mode 100644 index 00000000..888a2b12 --- /dev/null +++ b/hal/src/fsfw/hal/linux/i2c/I2cCookie.h @@ -0,0 +1,38 @@ +#ifndef LINUX_I2C_I2CCOOKIE_H_ +#define LINUX_I2C_I2CCOOKIE_H_ + +#include +#include + +/** + * @brief Cookie for the i2cDeviceComIF. + * + * @author J. Meier + */ +class I2cCookie: public CookieIF { +public: + + /** + * @brief Constructor for the I2C cookie. + * @param i2cAddress_ The i2c address of the target device. + * @param maxReplyLen_ The maximum expected length of a reply from the + * target device. + * @param devicFile_ The device file specifying the i2c interface to use. E.g. "/dev/i2c-0". + */ + I2cCookie(address_t i2cAddress_, size_t maxReplyLen_, + std::string deviceFile_); + + virtual ~I2cCookie(); + + address_t getAddress() const; + size_t getMaxReplyLen() const; + std::string getDeviceFile() const; + +private: + + address_t i2cAddress = 0; + size_t maxReplyLen = 0; + std::string deviceFile; +}; + +#endif /* LINUX_I2C_I2CCOOKIE_H_ */ diff --git a/hal/src/fsfw/hal/linux/rpi/CMakeLists.txt b/hal/src/fsfw/hal/linux/rpi/CMakeLists.txt new file mode 100644 index 00000000..47be218c --- /dev/null +++ b/hal/src/fsfw/hal/linux/rpi/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + GpioRPi.cpp +) \ No newline at end of file diff --git a/hal/src/fsfw/hal/linux/rpi/GpioRPi.cpp b/hal/src/fsfw/hal/linux/rpi/GpioRPi.cpp new file mode 100644 index 00000000..277a9fb2 --- /dev/null +++ b/hal/src/fsfw/hal/linux/rpi/GpioRPi.cpp @@ -0,0 +1,38 @@ +#include "fsfw/FSFW.h" + +#include "fsfw/hal/linux/rpi/GpioRPi.h" +#include "fsfw/hal/common/gpio/GpioCookie.h" + +#include + + +ReturnValue_t gpio::createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin, + std::string consumer, gpio::Direction direction, int initValue) { + if(cookie == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + + GpiodRegular* config = new GpiodRegular(); + /* Default chipname for Raspberry Pi. There is still gpiochip1 for expansion, but most users + will not need this */ + config->chipname = "gpiochip0"; + + config->consumer = consumer; + config->direction = direction; + config->initValue = initValue; + + /* Sanity check for the BCM pins before assigning it */ + if(bcmPin > 27) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "createRpiGpioConfig: BCM pin " << bcmPin << " invalid!" << std::endl; +#else + sif::printError("createRpiGpioConfig: BCM pin %d invalid!\n", bcmPin); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return HasReturnvaluesIF::RETURN_FAILED; + } + config->lineNum = bcmPin; + cookie->addGpio(gpioId, config); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/hal/src/fsfw/hal/linux/rpi/GpioRPi.h b/hal/src/fsfw/hal/linux/rpi/GpioRPi.h new file mode 100644 index 00000000..54917e6d --- /dev/null +++ b/hal/src/fsfw/hal/linux/rpi/GpioRPi.h @@ -0,0 +1,26 @@ +#ifndef BSP_RPI_GPIO_GPIORPI_H_ +#define BSP_RPI_GPIO_GPIORPI_H_ + +#include +#include "../../common/gpio/gpioDefinitions.h" + +class GpioCookie; + +namespace gpio { + +/** + * Create a GpioConfig_t. This function does a sanity check on the BCM pin number and fails if the + * BCM pin is invalid. + * @param cookie Adds the configuration to this cookie directly + * @param gpioId ID which identifies the GPIO configuration + * @param bcmPin Raspberry Pi BCM pin + * @param consumer Information string + * @param direction GPIO direction + * @param initValue Intial value for output pins, 0 for low, 1 for high + * @return + */ +ReturnValue_t createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin, + std::string consumer, gpio::Direction direction, int initValue); +} + +#endif /* BSP_RPI_GPIO_GPIORPI_H_ */ diff --git a/hal/src/fsfw/hal/linux/spi/CMakeLists.txt b/hal/src/fsfw/hal/linux/spi/CMakeLists.txt new file mode 100644 index 00000000..404e1f47 --- /dev/null +++ b/hal/src/fsfw/hal/linux/spi/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${LIB_FSFW_NAME} PUBLIC + SpiComIF.cpp + SpiCookie.cpp +) + + + + diff --git a/hal/src/fsfw/hal/linux/spi/SpiComIF.cpp b/hal/src/fsfw/hal/linux/spi/SpiComIF.cpp new file mode 100644 index 00000000..f3d8ab09 --- /dev/null +++ b/hal/src/fsfw/hal/linux/spi/SpiComIF.cpp @@ -0,0 +1,398 @@ +#include "fsfw/FSFW.h" +#include "fsfw/hal/linux/spi/SpiComIF.h" +#include "fsfw/hal/linux/spi/SpiCookie.h" +#include "fsfw/hal/linux/utility.h" +#include "fsfw/hal/linux/UnixFileGuard.h" + +#include +#include + +#include +#include +#include +#include + +#include +#include + +/* Can be used for low-level debugging of the SPI bus */ +#ifndef FSFW_HAL_LINUX_SPI_WIRETAPPING +#define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 +#endif + +SpiComIF::SpiComIF(object_id_t objectId, GpioIF* gpioComIF): + SystemObject(objectId), gpioComIF(gpioComIF) { + if(gpioComIF == nullptr) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::SpiComIF: GPIO communication interface invalid!" << std::endl; +#else + sif::printError("SpiComIF::SpiComIF: GPIO communication interface invalid!\n"); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + } + + spiMutex = MutexFactory::instance()->createMutex(); +} + +ReturnValue_t SpiComIF::initializeInterface(CookieIF *cookie) { + int retval = 0; + SpiCookie* spiCookie = dynamic_cast(cookie); + if(spiCookie == nullptr) { + return NULLPOINTER; + } + + address_t spiAddress = spiCookie->getSpiAddress(); + + auto iter = spiDeviceMap.find(spiAddress); + if(iter == spiDeviceMap.end()) { + size_t bufferSize = spiCookie->getMaxBufferSize(); + SpiInstance spiInstance(bufferSize); + auto statusPair = spiDeviceMap.emplace(spiAddress, spiInstance); + if (not statusPair.second) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::initializeInterface: Failed to insert device with address " << + spiAddress << "to SPI device map" << std::endl; +#else + sif::printError("SpiComIF::initializeInterface: Failed to insert device with address " + "%lu to SPI device map\n", static_cast(spiAddress)); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return HasReturnvaluesIF::RETURN_FAILED; + } + /* Now we emplaced the read buffer in the map, we still need to assign that location + to the SPI driver transfer struct */ + spiCookie->assignReadBuffer(statusPair.first->second.replyBuffer.data()); + } + else { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::initializeInterface: SPI address already exists!" << std::endl; +#else + sif::printError("SpiComIF::initializeInterface: SPI address already exists!\n"); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return HasReturnvaluesIF::RETURN_FAILED; + } + + /* Pull CS high in any case to be sure that device is inactive */ + gpioId_t gpioId = spiCookie->getChipSelectPin(); + if(gpioId != gpio::NO_GPIO) { + gpioComIF->pullHigh(gpioId); + } + + size_t spiSpeed = 0; + spi::SpiModes spiMode = spi::SpiModes::MODE_0; + + SpiCookie::UncommonParameters params; + spiCookie->getSpiParameters(spiMode, spiSpeed, ¶ms); + + int fileDescriptor = 0; + UnixFileGuard fileHelper(spiCookie->getSpiDevice(), &fileDescriptor, O_RDWR, + "SpiComIF::initializeInterface: "); + if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { + return fileHelper.getOpenResult(); + } + + /* These flags are rather uncommon */ + if(params.threeWireSpi or params.noCs or params.csHigh) { + uint32_t currentMode = 0; + retval = ioctl(fileDescriptor, SPI_IOC_RD_MODE32, ¤tMode); + if(retval != 0) { + utility::handleIoctlError("SpiComIF::initialiezInterface: Could not read full mode!"); + } + + if(params.threeWireSpi) { + currentMode |= SPI_3WIRE; + } + if(params.noCs) { + /* Some drivers like the Raspberry Pi ignore this flag in any case */ + currentMode |= SPI_NO_CS; + } + if(params.csHigh) { + currentMode |= SPI_CS_HIGH; + } + /* Write adapted mode */ + retval = ioctl(fileDescriptor, SPI_IOC_WR_MODE32, ¤tMode); + if(retval != 0) { + utility::handleIoctlError("SpiComIF::initialiezInterface: Could not write full mode!"); + } + } + if(params.lsbFirst) { + retval = ioctl(fileDescriptor, SPI_IOC_WR_LSB_FIRST, ¶ms.lsbFirst); + if(retval != 0) { + utility::handleIoctlError("SpiComIF::initializeInterface: Setting LSB first failed"); + } + } + if(params.bitsPerWord != 8) { + retval = ioctl(fileDescriptor, SPI_IOC_WR_BITS_PER_WORD, ¶ms.bitsPerWord); + if(retval != 0) { + utility::handleIoctlError("SpiComIF::initializeInterface: " + "Could not write bits per word!"); + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) { + SpiCookie* spiCookie = dynamic_cast(cookie); + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + + if(spiCookie == nullptr) { + return NULLPOINTER; + } + + if(sendLen > spiCookie->getMaxBufferSize()) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::sendMessage: Too much data sent, send length" << sendLen << + "larger than maximum buffer length" << spiCookie->getMaxBufferSize() << std::endl; +#else + sif::printWarning("SpiComIF::sendMessage: Too much data sent, send length %lu larger " + "than maximum buffer length %lu!\n", static_cast(sendLen), + static_cast(spiCookie->getMaxBufferSize())); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return DeviceCommunicationIF::TOO_MUCH_DATA; + } + + if(spiCookie->getComIfMode() == spi::SpiComIfModes::REGULAR) { + result = performRegularSendOperation(spiCookie, sendData, sendLen); + } + else if(spiCookie->getComIfMode() == spi::SpiComIfModes::CALLBACK) { + spi::send_callback_function_t sendFunc = nullptr; + void* funcArgs = nullptr; + spiCookie->getCallback(&sendFunc, &funcArgs); + if(sendFunc != nullptr) { + result = sendFunc(this, spiCookie, sendData, sendLen, funcArgs); + } + } + return result; +} + +ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie *spiCookie, const uint8_t *sendData, + size_t sendLen) { + address_t spiAddress = spiCookie->getSpiAddress(); + auto iter = spiDeviceMap.find(spiAddress); + if(iter != spiDeviceMap.end()) { + spiCookie->assignReadBuffer(iter->second.replyBuffer.data()); + } + + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + int retval = 0; + /* Prepare transfer */ + int fileDescriptor = 0; + std::string device = spiCookie->getSpiDevice(); + UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "SpiComIF::sendMessage: "); + if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { + return OPENING_FILE_FAILED; + } + spi::SpiModes spiMode = spi::SpiModes::MODE_0; + uint32_t spiSpeed = 0; + spiCookie->getSpiParameters(spiMode, spiSpeed, nullptr); + setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); + spiCookie->assignWriteBuffer(sendData); + spiCookie->assignTransferSize(sendLen); + + bool fullDuplex = spiCookie->isFullDuplex(); + gpioId_t gpioId = spiCookie->getChipSelectPin(); + + /* Pull SPI CS low. For now, no support for active high given */ + if(gpioId != gpio::NO_GPIO) { + result = spiMutex->lockMutex(timeoutType, timeoutMs); + if (result != RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::sendMessage: Failed to lock mutex" << std::endl; +#endif + return result; + } + gpioComIF->pullLow(gpioId); + } + + /* Execute transfer */ + if(fullDuplex) { + /* Initiate a full duplex SPI transfer. */ + retval = ioctl(fileDescriptor, SPI_IOC_MESSAGE(1), spiCookie->getTransferStructHandle()); + if(retval < 0) { + utility::handleIoctlError("SpiComIF::sendMessage: ioctl error."); + result = FULL_DUPLEX_TRANSFER_FAILED; + } +#if FSFW_HAL_LINUX_SPI_WIRETAPPING == 1 + performSpiWiretapping(spiCookie); +#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */ + } + else { + /* We write with a blocking half-duplex transfer here */ + if (write(fileDescriptor, sendData, sendLen) != static_cast(sendLen)) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::sendMessage: Half-Duplex write operation failed!" << + std::endl; +#else + sif::printWarning("SpiComIF::sendMessage: Half-Duplex write operation failed!\n"); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + result = HALF_DUPLEX_TRANSFER_FAILED; + } + } + + if(gpioId != gpio::NO_GPIO) { + gpioComIF->pullHigh(gpioId); + result = spiMutex->unlockMutex(); + if (result != RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::sendMessage: Failed to unlock mutex" << std::endl; +#endif + return result; + } + } + return result; +} + +ReturnValue_t SpiComIF::getSendSuccess(CookieIF *cookie) { + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { + SpiCookie* spiCookie = dynamic_cast(cookie); + if(spiCookie == nullptr) { + return NULLPOINTER; + } + + if(spiCookie->isFullDuplex()) { + return HasReturnvaluesIF::RETURN_OK; + } + + return performHalfDuplexReception(spiCookie); +} + + +ReturnValue_t SpiComIF::performHalfDuplexReception(SpiCookie* spiCookie) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + std::string device = spiCookie->getSpiDevice(); + int fileDescriptor = 0; + UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, + "SpiComIF::requestReceiveMessage: "); + if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { + return OPENING_FILE_FAILED; + } + + uint8_t* rxBuf = nullptr; + size_t readSize = spiCookie->getCurrentTransferSize(); + result = getReadBuffer(spiCookie->getSpiAddress(), &rxBuf); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + + gpioId_t gpioId = spiCookie->getChipSelectPin(); + if(gpioId != gpio::NO_GPIO) { + result = spiMutex->lockMutex(timeoutType, timeoutMs); + if (result != RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::getSendSuccess: Failed to lock mutex" << std::endl; +#endif + return result; + } + gpioComIF->pullLow(gpioId); + } + + if(read(fileDescriptor, rxBuf, readSize) != static_cast(readSize)) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::sendMessage: Half-Duplex read operation failed!" << std::endl; +#else + sif::printWarning("SpiComIF::sendMessage: Half-Duplex read operation failed!\n"); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + result = HALF_DUPLEX_TRANSFER_FAILED; + } + + if(gpioId != gpio::NO_GPIO) { + gpioComIF->pullHigh(gpioId); + result = spiMutex->unlockMutex(); + if (result != RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::getSendSuccess: Failed to unlock mutex" << std::endl; +#endif + return result; + } + } + + return result; +} + +ReturnValue_t SpiComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { + SpiCookie* spiCookie = dynamic_cast(cookie); + if(spiCookie == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + uint8_t* rxBuf = nullptr; + ReturnValue_t result = getReadBuffer(spiCookie->getSpiAddress(), &rxBuf); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + + *buffer = rxBuf; + *size = spiCookie->getCurrentTransferSize(); + return HasReturnvaluesIF::RETURN_OK; +} + +MutexIF* SpiComIF::getMutex(MutexIF::TimeoutType* timeoutType, uint32_t* timeoutMs) { + if(timeoutType != nullptr) { + *timeoutType = this->timeoutType; + } + if(timeoutMs != nullptr) { + *timeoutMs = this->timeoutMs; + } + return spiMutex; +} + +void SpiComIF::performSpiWiretapping(SpiCookie* spiCookie) { + if(spiCookie == nullptr) { + return; + } + size_t dataLen = spiCookie->getTransferStructHandle()->len; + uint8_t* dataPtr = reinterpret_cast(spiCookie->getTransferStructHandle()->tx_buf); +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "Sent SPI data: " << std::endl; + arrayprinter::print(dataPtr, dataLen, OutputType::HEX, false); + sif::info << "Received SPI data: " << std::endl; +#else + sif::printInfo("Sent SPI data: \n"); + arrayprinter::print(dataPtr, dataLen, OutputType::HEX, false); + sif::printInfo("Received SPI data: \n"); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ + dataPtr = reinterpret_cast(spiCookie->getTransferStructHandle()->rx_buf); + arrayprinter::print(dataPtr, dataLen, OutputType::HEX, false); +} + +ReturnValue_t SpiComIF::getReadBuffer(address_t spiAddress, uint8_t** buffer) { + if(buffer == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + + auto iter = spiDeviceMap.find(spiAddress); + if(iter == spiDeviceMap.end()) { + return HasReturnvaluesIF::RETURN_FAILED; + } + + *buffer = iter->second.replyBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; +} + +GpioIF* SpiComIF::getGpioInterface() { + return gpioComIF; +} + +void SpiComIF::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed) { + int retval = ioctl(spiFd, SPI_IOC_WR_MODE, reinterpret_cast(&mode)); + if(retval != 0) { + utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!"); + } + + retval = ioctl(spiFd, SPI_IOC_WR_MAX_SPEED_HZ, &speed); + if(retval != 0) { + utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI speed failed!"); + } +} diff --git a/hal/src/fsfw/hal/linux/spi/SpiComIF.h b/hal/src/fsfw/hal/linux/spi/SpiComIF.h new file mode 100644 index 00000000..7f66b8e5 --- /dev/null +++ b/hal/src/fsfw/hal/linux/spi/SpiComIF.h @@ -0,0 +1,90 @@ +#ifndef LINUX_SPI_SPICOMIF_H_ +#define LINUX_SPI_SPICOMIF_H_ + +#include "spiDefinitions.h" +#include "returnvalues/classIds.h" +#include "fsfw/hal/common/gpio/GpioIF.h" + +#include "fsfw/devicehandlers/DeviceCommunicationIF.h" +#include "fsfw/objectmanager/SystemObject.h" + +#include +#include + +class SpiCookie; + +/** + * @brief Encapsulates access to linux SPI driver for FSFW objects + * @details + * Right now, only full-duplex SPI is supported. Most device specific transfer properties + * are contained in the SPI cookie. + * @author R. Mueller + */ +class SpiComIF: public DeviceCommunicationIF, public SystemObject { +public: + static constexpr uint8_t spiRetvalId = CLASS_ID::HAL_SPI; + static constexpr ReturnValue_t OPENING_FILE_FAILED = + HasReturnvaluesIF::makeReturnCode(spiRetvalId, 0); + /* Full duplex (ioctl) transfer failure */ + static constexpr ReturnValue_t FULL_DUPLEX_TRANSFER_FAILED = + HasReturnvaluesIF::makeReturnCode(spiRetvalId, 1); + /* Half duplex (read/write) transfer failure */ + static constexpr ReturnValue_t HALF_DUPLEX_TRANSFER_FAILED = + HasReturnvaluesIF::makeReturnCode(spiRetvalId, 2); + + SpiComIF(object_id_t objectId, GpioIF* gpioComIF); + + ReturnValue_t initializeInterface(CookieIF * cookie) override; + ReturnValue_t sendMessage(CookieIF *cookie,const uint8_t *sendData, + size_t sendLen) override; + ReturnValue_t getSendSuccess(CookieIF *cookie) override; + ReturnValue_t requestReceiveMessage(CookieIF *cookie, + size_t requestLen) override; + ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, + size_t *size) override; + + /** + * @brief This function returns the mutex which can be used to protect the spi bus when + * the chip select must be driven from outside of the com if. + */ + MutexIF* getMutex(MutexIF::TimeoutType* timeoutType = nullptr, uint32_t* timeoutMs = nullptr); + + /** + * Perform a regular send operation using Linux iotcl. This is public so it can be used + * in functions like a user callback if special handling is only necessary for certain commands. + * @param spiCookie + * @param sendData + * @param sendLen + * @return + */ + ReturnValue_t performRegularSendOperation(SpiCookie* spiCookie, const uint8_t *sendData, + size_t sendLen); + + GpioIF* getGpioInterface(); + void setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed); + void performSpiWiretapping(SpiCookie* spiCookie); + + ReturnValue_t getReadBuffer(address_t spiAddress, uint8_t** buffer); + +private: + + struct SpiInstance { + SpiInstance(size_t maxRecvSize): replyBuffer(std::vector(maxRecvSize)) {} + std::vector replyBuffer; + }; + + GpioIF* gpioComIF = nullptr; + + MutexIF* spiMutex = nullptr; + MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; + uint32_t timeoutMs = 20; + + using SpiDeviceMap = std::unordered_map; + using SpiDeviceMapIter = SpiDeviceMap::iterator; + + SpiDeviceMap spiDeviceMap; + + ReturnValue_t performHalfDuplexReception(SpiCookie* spiCookie); +}; + +#endif /* LINUX_SPI_SPICOMIF_H_ */ diff --git a/hal/src/fsfw/hal/linux/spi/SpiCookie.cpp b/hal/src/fsfw/hal/linux/spi/SpiCookie.cpp new file mode 100644 index 00000000..a74bc419 --- /dev/null +++ b/hal/src/fsfw/hal/linux/spi/SpiCookie.cpp @@ -0,0 +1,144 @@ +#include "fsfw/hal/linux/spi/SpiCookie.h" + +SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, + const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed): + SpiCookie(spi::SpiComIfModes::REGULAR, spiAddress, chipSelect, spiDev, maxSize, spiMode, + spiSpeed, nullptr, nullptr) { + +} + +SpiCookie::SpiCookie(address_t spiAddress, std::string spiDev, const size_t maxSize, + spi::SpiModes spiMode, uint32_t spiSpeed): + SpiCookie(spiAddress, gpio::NO_GPIO, spiDev, maxSize, spiMode, spiSpeed) { +} + +SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, + const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed, + spi::send_callback_function_t callback, void *args): + SpiCookie(spi::SpiComIfModes::CALLBACK, spiAddress, chipSelect, spiDev, maxSize, + spiMode, spiSpeed, callback, args) { +} + +SpiCookie::SpiCookie(spi::SpiComIfModes comIfMode, address_t spiAddress, gpioId_t chipSelect, + std::string spiDev, const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed, + spi::send_callback_function_t callback, void* args): + spiAddress(spiAddress), chipSelectPin(chipSelect), spiDevice(spiDev), + comIfMode(comIfMode), maxSize(maxSize), spiMode(spiMode), spiSpeed(spiSpeed), + sendCallback(callback), callbackArgs(args) { +} + +spi::SpiComIfModes SpiCookie::getComIfMode() const { + return this->comIfMode; +} + +void SpiCookie::getSpiParameters(spi::SpiModes& spiMode, uint32_t& spiSpeed, + UncommonParameters* parameters) const { + spiMode = this->spiMode; + spiSpeed = this->spiSpeed; + + if(parameters != nullptr) { + parameters->threeWireSpi = uncommonParameters.threeWireSpi; + parameters->lsbFirst = uncommonParameters.lsbFirst; + parameters->noCs = uncommonParameters.noCs; + parameters->bitsPerWord = uncommonParameters.bitsPerWord; + parameters->csHigh = uncommonParameters.csHigh; + } +} + +gpioId_t SpiCookie::getChipSelectPin() const { + return chipSelectPin; +} + +size_t SpiCookie::getMaxBufferSize() const { + return maxSize; +} + +address_t SpiCookie::getSpiAddress() const { + return spiAddress; +} + +std::string SpiCookie::getSpiDevice() const { + return spiDevice; +} + +void SpiCookie::setThreeWireSpi(bool enable) { + uncommonParameters.threeWireSpi = enable; +} + +void SpiCookie::setLsbFirst(bool enable) { + uncommonParameters.lsbFirst = enable; +} + +void SpiCookie::setNoCs(bool enable) { + uncommonParameters.noCs = enable; +} + +void SpiCookie::setBitsPerWord(uint8_t bitsPerWord) { + uncommonParameters.bitsPerWord = bitsPerWord; +} + +void SpiCookie::setCsHigh(bool enable) { + uncommonParameters.csHigh = enable; +} + +void SpiCookie::activateCsDeselect(bool deselectCs, uint16_t delayUsecs) { + spiTransferStruct.cs_change = deselectCs; + spiTransferStruct.delay_usecs = delayUsecs; +} + +void SpiCookie::assignReadBuffer(uint8_t* rx) { + if(rx != nullptr) { + spiTransferStruct.rx_buf = reinterpret_cast<__u64>(rx); + } +} + +void SpiCookie::assignWriteBuffer(const uint8_t* tx) { + if(tx != nullptr) { + spiTransferStruct.tx_buf = reinterpret_cast<__u64>(tx); + } +} + +void SpiCookie::setCallbackMode(spi::send_callback_function_t callback, + void *args) { + this->comIfMode = spi::SpiComIfModes::CALLBACK; + this->sendCallback = callback; + this->callbackArgs = args; +} + +void SpiCookie::setCallbackArgs(void *args) { + this->callbackArgs = args; +} + +spi_ioc_transfer* SpiCookie::getTransferStructHandle() { + return &spiTransferStruct; +} + +void SpiCookie::setFullOrHalfDuplex(bool halfDuplex) { + this->halfDuplex = halfDuplex; +} + +bool SpiCookie::isFullDuplex() const { + return not this->halfDuplex; +} + +void SpiCookie::assignTransferSize(size_t transferSize) { + spiTransferStruct.len = transferSize; +} + +size_t SpiCookie::getCurrentTransferSize() const { + return spiTransferStruct.len; +} + +void SpiCookie::setSpiSpeed(uint32_t newSpeed) { + this->spiSpeed = newSpeed; +} + +void SpiCookie::setSpiMode(spi::SpiModes newMode) { + this->spiMode = newMode; +} + +void SpiCookie::getCallback(spi::send_callback_function_t *callback, + void **args) { + *callback = this->sendCallback; + *args = this->callbackArgs; +} diff --git a/hal/src/fsfw/hal/linux/spi/SpiCookie.h b/hal/src/fsfw/hal/linux/spi/SpiCookie.h new file mode 100644 index 00000000..acf7c77c --- /dev/null +++ b/hal/src/fsfw/hal/linux/spi/SpiCookie.h @@ -0,0 +1,185 @@ +#ifndef LINUX_SPI_SPICOOKIE_H_ +#define LINUX_SPI_SPICOOKIE_H_ + +#include "spiDefinitions.h" +#include "../../common/gpio/gpioDefinitions.h" + +#include + +#include + +/** + * @brief This cookie class is passed to the SPI communication interface + * @details + * This cookie contains device specific properties like speed and SPI mode or the SPI transfer + * struct required by the Linux SPI driver. It also contains a handle to a GPIO interface + * to perform slave select switching when necessary. + * + * The user can specify gpio::NO_GPIO as the GPIO ID or use a custom send callback to meet + * special requirements like expander slave select switching (e.g. GPIO or I2C expander) + * or special timing related requirements. + */ +class SpiCookie: public CookieIF { +public: + /** + * Each SPI device will have a corresponding cookie. The cookie is used by the communication + * interface and contains device specific information like the largest expected size to be + * sent and received and the GPIO pin used to toggle the SPI slave select pin. + * @param spiAddress + * @param chipSelect Chip select. gpio::NO_GPIO can be used for hardware slave selects. + * @param spiDev + * @param maxSize + */ + SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, + const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed); + + /** + * Like constructor above, but without a dedicated GPIO CS. Can be used for hardware + * slave select or if CS logic is performed with decoders. + */ + SpiCookie(address_t spiAddress, std::string spiDev, const size_t maxReplySize, + spi::SpiModes spiMode, uint32_t spiSpeed); + + /** + * Use the callback mode of the SPI communication interface. The user can pass the callback + * function here or by using the setter function #setCallbackMode + */ + SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, const size_t maxSize, + spi::SpiModes spiMode, uint32_t spiSpeed, spi::send_callback_function_t callback, + void *args); + + /** + * Get the callback function + * @param callback + * @param args + */ + void getCallback(spi::send_callback_function_t* callback, void** args); + + address_t getSpiAddress() const; + std::string getSpiDevice() const; + gpioId_t getChipSelectPin() const; + size_t getMaxBufferSize() const; + + spi::SpiComIfModes getComIfMode() const; + + /** Enables changing SPI speed at run-time */ + void setSpiSpeed(uint32_t newSpeed); + /** Enables changing the SPI mode at run-time */ + void setSpiMode(spi::SpiModes newMode); + + /** + * Set the SPI to callback mode and assigns the user supplied callback and an argument + * passed to the callback. + * @param callback + * @param args + */ + void setCallbackMode(spi::send_callback_function_t callback, void* args); + + /** + * Can be used to set the callback arguments and a later point than initialization. + * @param args + */ + void setCallbackArgs(void* args); + + /** + * True if SPI transfers should be performed in full duplex mode + * @return + */ + bool isFullDuplex() const; + + /** + * Set transfer type to full duplex or half duplex. Full duplex is the default setting, + * ressembling common SPI hardware implementation with shift registers, where read and writes + * happen simultaneosly. + * @param fullDuplex + */ + void setFullOrHalfDuplex(bool halfDuplex); + + /** + * This needs to be called to specify where the SPI driver writes to or reads from. + * @param readLocation + * @param writeLocation + */ + void assignReadBuffer(uint8_t* rx); + void assignWriteBuffer(const uint8_t* tx); + /** + * Assign size for the next transfer. + * @param transferSize + */ + void assignTransferSize(size_t transferSize); + size_t getCurrentTransferSize() const; + + struct UncommonParameters { + uint8_t bitsPerWord = 8; + bool noCs = false; + bool csHigh = false; + bool threeWireSpi = false; + /* MSB first is more common */ + bool lsbFirst = false; + }; + + /** + * Can be used to explicitely disable hardware chip select. + * Some drivers like the Raspberry Pi Linux driver will not use hardware chip select by default + * (see https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md) + * @param enable + */ + void setNoCs(bool enable); + void setThreeWireSpi(bool enable); + void setLsbFirst(bool enable); + void setCsHigh(bool enable); + void setBitsPerWord(uint8_t bitsPerWord); + + void getSpiParameters(spi::SpiModes& spiMode, uint32_t& spiSpeed, + UncommonParameters* parameters = nullptr) const; + + /** + * See spidev.h cs_change and delay_usecs + * @param deselectCs + * @param delayUsecs + */ + void activateCsDeselect(bool deselectCs, uint16_t delayUsecs); + + spi_ioc_transfer* getTransferStructHandle(); +private: + + /** + * Internal constructor which initializes every field + * @param spiAddress + * @param chipSelect + * @param spiDev + * @param maxSize + * @param spiMode + * @param spiSpeed + * @param callback + * @param args + */ + SpiCookie(spi::SpiComIfModes comIfMode, address_t spiAddress, gpioId_t chipSelect, + std::string spiDev, const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed, + spi::send_callback_function_t callback, void* args); + + size_t currentTransferSize = 0; + + address_t spiAddress; + gpioId_t chipSelectPin; + std::string spiDevice; + + spi::SpiComIfModes comIfMode; + + // Required for regular mode + const size_t maxSize; + spi::SpiModes spiMode; + uint32_t spiSpeed; + bool halfDuplex = false; + + // Required for callback mode + spi::send_callback_function_t sendCallback = nullptr; + void* callbackArgs = nullptr; + + struct spi_ioc_transfer spiTransferStruct = {}; + UncommonParameters uncommonParameters; +}; + + + +#endif /* LINUX_SPI_SPICOOKIE_H_ */ diff --git a/hal/src/fsfw/hal/linux/spi/spiDefinitions.h b/hal/src/fsfw/hal/linux/spi/spiDefinitions.h new file mode 100644 index 00000000..14af4fd5 --- /dev/null +++ b/hal/src/fsfw/hal/linux/spi/spiDefinitions.h @@ -0,0 +1,28 @@ +#ifndef LINUX_SPI_SPIDEFINITONS_H_ +#define LINUX_SPI_SPIDEFINITONS_H_ + +#include "../../common/gpio/gpioDefinitions.h" +#include "../../common/spi/spiCommon.h" + +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include + +#include + +class SpiCookie; +class SpiComIF; + +namespace spi { + +enum SpiComIfModes { + REGULAR, + CALLBACK +}; + + +using send_callback_function_t = ReturnValue_t (*) (SpiComIF* comIf, SpiCookie *cookie, + const uint8_t *sendData, size_t sendLen, void* args); + +} + +#endif /* LINUX_SPI_SPIDEFINITONS_H_ */ diff --git a/hal/src/fsfw/hal/linux/uart/CMakeLists.txt b/hal/src/fsfw/hal/linux/uart/CMakeLists.txt new file mode 100644 index 00000000..21ed0278 --- /dev/null +++ b/hal/src/fsfw/hal/linux/uart/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(${LIB_FSFW_NAME} PUBLIC + UartComIF.cpp + UartCookie.cpp +) diff --git a/hal/src/fsfw/hal/linux/uart/UartComIF.cpp b/hal/src/fsfw/hal/linux/uart/UartComIF.cpp new file mode 100644 index 00000000..e543f60e --- /dev/null +++ b/hal/src/fsfw/hal/linux/uart/UartComIF.cpp @@ -0,0 +1,500 @@ +#include "fsfw/hal/linux/uart/UartComIF.h" +#include "OBSWConfig.h" + +#include "fsfw/serviceinterface/ServiceInterface.h" + +#include +#include +#include +#include +#include + +UartComIF::UartComIF(object_id_t objectId): SystemObject(objectId){ +} + +UartComIF::~UartComIF() {} + +ReturnValue_t UartComIF::initializeInterface(CookieIF* cookie) { + + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + + if(cookie == nullptr) { + return NULLPOINTER; + } + + UartCookie* uartCookie = dynamic_cast(cookie); + if (uartCookie == nullptr) { + sif::error << "UartComIF::initializeInterface: Invalid UART Cookie!" << std::endl; + return NULLPOINTER; + } + + deviceFile = uartCookie->getDeviceFile(); + + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + if(uartDeviceMapIter == uartDeviceMap.end()) { + int fileDescriptor = configureUartPort(uartCookie); + if (fileDescriptor < 0) { + return RETURN_FAILED; + } + size_t maxReplyLen = uartCookie->getMaxReplyLen(); + UartElements uartElements = {fileDescriptor, std::vector(maxReplyLen), 0}; + auto status = uartDeviceMap.emplace(deviceFile, uartElements); + if (status.second == false) { + sif::warning << "UartComIF::initializeInterface: Failed to insert device " << + deviceFile << "to UART device map" << std::endl; + return RETURN_FAILED; + } + } + else { + sif::warning << "UartComIF::initializeInterface: UART device " << deviceFile << + " already in use" << std::endl; + return RETURN_FAILED; + } + + return RETURN_OK; +} + +int UartComIF::configureUartPort(UartCookie* uartCookie) { + + struct termios options = {}; + + std::string deviceFile = uartCookie->getDeviceFile(); + int fd = open(deviceFile.c_str(), O_RDWR); + + if (fd < 0) { + sif::warning << "UartComIF::configureUartPort: Failed to open uart " << deviceFile << + "with error code " << errno << strerror(errno) << std::endl; + return fd; + } + + /* Read in existing settings */ + if(tcgetattr(fd, &options) != 0) { + sif::warning << "UartComIF::configureUartPort: Error " << errno << "from tcgetattr: " + << strerror(errno) << std::endl; + return fd; + } + + setParityOptions(&options, uartCookie); + setStopBitOptions(&options, uartCookie); + setDatasizeOptions(&options, uartCookie); + setFixedOptions(&options); + setUartMode(&options, *uartCookie); + if(uartCookie->getInputShouldBeFlushed()) { + tcflush(fd, TCIFLUSH); + } + + /* Sets uart to non-blocking mode. Read returns immediately when there are no data available */ + options.c_cc[VTIME] = 0; + options.c_cc[VMIN] = 0; + + configureBaudrate(&options, uartCookie); + + /* Save option settings */ + if (tcsetattr(fd, TCSANOW, &options) != 0) { + sif::warning << "UartComIF::configureUartPort: Failed to set options with error " << + errno << ": " << strerror(errno); + return fd; + } + return fd; +} + +void UartComIF::setParityOptions(struct termios* options, UartCookie* uartCookie) { + /* Clear parity bit */ + options->c_cflag &= ~PARENB; + switch (uartCookie->getParity()) { + case Parity::EVEN: + options->c_cflag |= PARENB; + options->c_cflag &= ~PARODD; + break; + case Parity::ODD: + options->c_cflag |= PARENB; + options->c_cflag |= PARODD; + break; + default: + break; + } +} + +void UartComIF::setStopBitOptions(struct termios* options, UartCookie* uartCookie) { + /* Clear stop field. Sets stop bit to one bit */ + options->c_cflag &= ~CSTOPB; + switch (uartCookie->getStopBits()) { + case StopBits::TWO_STOP_BITS: + options->c_cflag |= CSTOPB; + break; + default: + break; + } +} + +void UartComIF::setDatasizeOptions(struct termios* options, UartCookie* uartCookie) { + /* Clear size bits */ + options->c_cflag &= ~CSIZE; + switch (uartCookie->getBitsPerWord()) { + case 5: + options->c_cflag |= CS5; + break; + case 6: + options->c_cflag |= CS6; + break; + case 7: + options->c_cflag |= CS7; + break; + case 8: + options->c_cflag |= CS8; + break; + default: + sif::warning << "UartComIF::setDatasizeOptions: Invalid size specified" << std::endl; + break; + } +} + +void UartComIF::setFixedOptions(struct termios* options) { + /* Disable RTS/CTS hardware flow control */ + options->c_cflag &= ~CRTSCTS; + /* Turn on READ & ignore ctrl lines (CLOCAL = 1) */ + options->c_cflag |= CREAD | CLOCAL; + /* Disable echo */ + options->c_lflag &= ~ECHO; + /* Disable erasure */ + options->c_lflag &= ~ECHOE; + /* Disable new-line echo */ + options->c_lflag &= ~ECHONL; + /* Disable interpretation of INTR, QUIT and SUSP */ + options->c_lflag &= ~ISIG; + /* Turn off s/w flow ctrl */ + options->c_iflag &= ~(IXON | IXOFF | IXANY); + /* Disable any special handling of received bytes */ + options->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL); + /* Prevent special interpretation of output bytes (e.g. newline chars) */ + options->c_oflag &= ~OPOST; + /* Prevent conversion of newline to carriage return/line feed */ + options->c_oflag &= ~ONLCR; +} + +void UartComIF::configureBaudrate(struct termios* options, UartCookie* uartCookie) { + switch (uartCookie->getBaudrate()) { + case 50: + cfsetispeed(options, B50); + cfsetospeed(options, B50); + break; + case 75: + cfsetispeed(options, B75); + cfsetospeed(options, B75); + break; + case 110: + cfsetispeed(options, B110); + cfsetospeed(options, B110); + break; + case 134: + cfsetispeed(options, B134); + cfsetospeed(options, B134); + break; + case 150: + cfsetispeed(options, B150); + cfsetospeed(options, B150); + break; + case 200: + cfsetispeed(options, B200); + cfsetospeed(options, B200); + break; + case 300: + cfsetispeed(options, B300); + cfsetospeed(options, B300); + break; + case 600: + cfsetispeed(options, B600); + cfsetospeed(options, B600); + break; + case 1200: + cfsetispeed(options, B1200); + cfsetospeed(options, B1200); + break; + case 1800: + cfsetispeed(options, B1800); + cfsetospeed(options, B1800); + break; + case 2400: + cfsetispeed(options, B2400); + cfsetospeed(options, B2400); + break; + case 4800: + cfsetispeed(options, B4800); + cfsetospeed(options, B4800); + break; + case 9600: + cfsetispeed(options, B9600); + cfsetospeed(options, B9600); + break; + case 19200: + cfsetispeed(options, B19200); + cfsetospeed(options, B19200); + break; + case 38400: + cfsetispeed(options, B38400); + cfsetospeed(options, B38400); + break; + case 57600: + cfsetispeed(options, B57600); + cfsetospeed(options, B57600); + break; + case 115200: + cfsetispeed(options, B115200); + cfsetospeed(options, B115200); + break; + case 230400: + cfsetispeed(options, B230400); + cfsetospeed(options, B230400); + break; + case 460800: + cfsetispeed(options, B460800); + cfsetospeed(options, B460800); + break; + default: + sif::warning << "UartComIF::configureBaudrate: Baudrate not supported" << std::endl; + break; + } +} + +ReturnValue_t UartComIF::sendMessage(CookieIF *cookie, + const uint8_t *sendData, size_t sendLen) { + + int fd = 0; + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + + if(sendData == nullptr) { + sif::debug << "UartComIF::sendMessage: Send Data is nullptr" << std::endl; + return RETURN_FAILED; + } + + if(sendLen == 0) { + return RETURN_OK; + } + + UartCookie* uartCookie = dynamic_cast(cookie); + if(uartCookie == nullptr) { + sif::debug << "UartComIF::sendMessasge: Invalid UART Cookie!" << std::endl; + return NULLPOINTER; + } + + deviceFile = uartCookie->getDeviceFile(); + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + if (uartDeviceMapIter == uartDeviceMap.end()) { + sif::debug << "UartComIF::sendMessage: Device file " << deviceFile << + "not in UART map" << std::endl; + return RETURN_FAILED; + } + + fd = uartDeviceMapIter->second.fileDescriptor; + + if (write(fd, sendData, sendLen) != (int)sendLen) { + sif::error << "UartComIF::sendMessage: Failed to send data with error code " << + errno << ": Error description: " << strerror(errno) << std::endl; + return RETURN_FAILED; + } + + return RETURN_OK; +} + +ReturnValue_t UartComIF::getSendSuccess(CookieIF *cookie) { + return RETURN_OK; +} + +ReturnValue_t UartComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + + UartCookie* uartCookie = dynamic_cast(cookie); + if(uartCookie == nullptr) { + sif::debug << "UartComIF::requestReceiveMessage: Invalid Uart Cookie!" << std::endl; + return NULLPOINTER; + } + + UartModes uartMode = uartCookie->getUartMode(); + deviceFile = uartCookie->getDeviceFile(); + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + + if(uartMode == UartModes::NON_CANONICAL and requestLen == 0) { + return RETURN_OK; + } + + if (uartDeviceMapIter == uartDeviceMap.end()) { + sif::debug << "UartComIF::requestReceiveMessage: Device file " << deviceFile + << " not in uart map" << std::endl; + return RETURN_FAILED; + } + + if (uartMode == UartModes::CANONICAL) { + return handleCanonicalRead(*uartCookie, uartDeviceMapIter, requestLen); + } + else if (uartMode == UartModes::NON_CANONICAL) { + return handleNoncanonicalRead(*uartCookie, uartDeviceMapIter, requestLen); + } + else { + return HasReturnvaluesIF::RETURN_FAILED; + } +} + +ReturnValue_t UartComIF::handleCanonicalRead(UartCookie& uartCookie, UartDeviceMapIter& iter, + size_t requestLen) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + uint8_t maxReadCycles = uartCookie.getReadCycles(); + uint8_t currentReadCycles = 0; + int bytesRead = 0; + size_t currentBytesRead = 0; + size_t maxReplySize = uartCookie.getMaxReplyLen(); + int fd = iter->second.fileDescriptor; + auto bufferPtr = iter->second.replyBuffer.data(); + do { + size_t allowedReadSize = 0; + if(currentBytesRead >= maxReplySize) { + // Overflow risk. Emit warning, trigger event and break. If this happens, + // the reception buffer is not large enough or data is not polled often enough. +#if OBSW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "UartComIF::requestReceiveMessage: Next read would cause overflow!" + << std::endl; +#else + sif::printWarning("UartComIF::requestReceiveMessage: " + "Next read would cause overflow!"); +#endif +#endif + result = UART_RX_BUFFER_TOO_SMALL; + break; + } + else { + allowedReadSize = maxReplySize - currentBytesRead; + } + + bytesRead = read(fd, bufferPtr, allowedReadSize); + if (bytesRead < 0) { + return RETURN_FAILED; + } + else if(bytesRead > 0) { + iter->second.replyLen += bytesRead; + bufferPtr += bytesRead; + currentBytesRead += bytesRead; + } + currentReadCycles++; + } while(bytesRead > 0 and currentReadCycles < maxReadCycles); + return result; +} + +ReturnValue_t UartComIF::handleNoncanonicalRead(UartCookie &uartCookie, UartDeviceMapIter &iter, + size_t requestLen) { + int fd = iter->second.fileDescriptor; + auto bufferPtr = iter->second.replyBuffer.data(); + // Size check to prevent buffer overflow + if(requestLen > uartCookie.getMaxReplyLen()) { +#if OBSW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "UartComIF::requestReceiveMessage: Next read would cause overflow!" + << std::endl; +#else + sif::printWarning("UartComIF::requestReceiveMessage: " + "Next read would cause overflow!"); +#endif +#endif + return UART_RX_BUFFER_TOO_SMALL; + } + int bytesRead = read(fd, bufferPtr, requestLen); + if (bytesRead < 0) { + return RETURN_FAILED; + } + else if (bytesRead != static_cast(requestLen)) { + if(uartCookie.isReplySizeFixed()) { + sif::warning << "UartComIF::requestReceiveMessage: Only read " << bytesRead << + " of " << requestLen << " bytes" << std::endl; + return RETURN_FAILED; + } + } + iter->second.replyLen = bytesRead; + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t UartComIF::readReceivedMessage(CookieIF *cookie, + uint8_t **buffer, size_t* size) { + + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + + UartCookie* uartCookie = dynamic_cast(cookie); + if(uartCookie == nullptr) { + sif::debug << "UartComIF::readReceivedMessage: Invalid uart cookie!" << std::endl; + return NULLPOINTER; + } + + deviceFile = uartCookie->getDeviceFile(); + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + if (uartDeviceMapIter == uartDeviceMap.end()) { + sif::debug << "UartComIF::readReceivedMessage: Device file " << deviceFile << + " not in uart map" << std::endl; + return RETURN_FAILED; + } + + *buffer = uartDeviceMapIter->second.replyBuffer.data(); + *size = uartDeviceMapIter->second.replyLen; + + /* Length is reset to 0 to prevent reading the same data twice */ + uartDeviceMapIter->second.replyLen = 0; + + return RETURN_OK; +} + +ReturnValue_t UartComIF::flushUartRxBuffer(CookieIF *cookie) { + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + UartCookie* uartCookie = dynamic_cast(cookie); + if(uartCookie == nullptr) { + sif::warning << "UartComIF::flushUartRxBuffer: Invalid uart cookie!" << std::endl; + return NULLPOINTER; + } + deviceFile = uartCookie->getDeviceFile(); + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + int fd = uartDeviceMapIter->second.fileDescriptor; + tcflush(fd, TCIFLUSH); + return RETURN_OK; +} + +ReturnValue_t UartComIF::flushUartTxBuffer(CookieIF *cookie) { + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + UartCookie* uartCookie = dynamic_cast(cookie); + if(uartCookie == nullptr) { + sif::warning << "UartComIF::flushUartTxBuffer: Invalid uart cookie!" << std::endl; + return NULLPOINTER; + } + deviceFile = uartCookie->getDeviceFile(); + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + int fd = uartDeviceMapIter->second.fileDescriptor; + tcflush(fd, TCOFLUSH); + return RETURN_OK; +} + +ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF *cookie) { + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + UartCookie* uartCookie = dynamic_cast(cookie); + if(uartCookie == nullptr) { + sif::warning << "UartComIF::flushUartTxAndRxBuf: Invalid uart cookie!" << std::endl; + return NULLPOINTER; + } + deviceFile = uartCookie->getDeviceFile(); + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + int fd = uartDeviceMapIter->second.fileDescriptor; + tcflush(fd, TCIOFLUSH); + return RETURN_OK; +} + +void UartComIF::setUartMode(struct termios *options, UartCookie &uartCookie) { + UartModes uartMode = uartCookie.getUartMode(); + if(uartMode == UartModes::NON_CANONICAL) { + /* Disable canonical mode */ + options->c_lflag &= ~ICANON; + } + else if(uartMode == UartModes::CANONICAL) { + options->c_lflag |= ICANON; + } +} diff --git a/hal/src/fsfw/hal/linux/uart/UartComIF.h b/hal/src/fsfw/hal/linux/uart/UartComIF.h new file mode 100644 index 00000000..68d2b9f5 --- /dev/null +++ b/hal/src/fsfw/hal/linux/uart/UartComIF.h @@ -0,0 +1,125 @@ +#ifndef BSP_Q7S_COMIF_UARTCOMIF_H_ +#define BSP_Q7S_COMIF_UARTCOMIF_H_ + +#include "UartCookie.h" +#include +#include + +#include +#include + +/** + * @brief This is the communication interface to access serial ports on linux based operating + * systems. + * + * @details The implementation follows the instructions from https://blog.mbedded.ninja/programming/ + * operating-systems/linux/linux-serial-ports-using-c-cpp/#disabling-canonical-mode + * + * @author J. Meier + */ +class UartComIF: public DeviceCommunicationIF, public SystemObject { +public: + static constexpr uint8_t uartRetvalId = CLASS_ID::HAL_UART; + + static constexpr ReturnValue_t UART_READ_FAILURE = + HasReturnvaluesIF::makeReturnCode(uartRetvalId, 1); + static constexpr ReturnValue_t UART_READ_SIZE_MISSMATCH = + HasReturnvaluesIF::makeReturnCode(uartRetvalId, 2); + static constexpr ReturnValue_t UART_RX_BUFFER_TOO_SMALL = + HasReturnvaluesIF::makeReturnCode(uartRetvalId, 3); + + UartComIF(object_id_t objectId); + + virtual ~UartComIF(); + + ReturnValue_t initializeInterface(CookieIF * cookie) override; + ReturnValue_t sendMessage(CookieIF *cookie,const uint8_t *sendData, + size_t sendLen) override; + ReturnValue_t getSendSuccess(CookieIF *cookie) override; + ReturnValue_t requestReceiveMessage(CookieIF *cookie, + size_t requestLen) override; + ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, + size_t *size) override; + + /** + * @brief This function discards all data received but not read in the UART buffer. + */ + ReturnValue_t flushUartRxBuffer(CookieIF *cookie); + + /** + * @brief This function discards all data in the transmit buffer of the UART driver. + */ + ReturnValue_t flushUartTxBuffer(CookieIF *cookie); + + /** + * @brief This function discards both data in the transmit and receive buffer of the UART. + */ + ReturnValue_t flushUartTxAndRxBuf(CookieIF *cookie); + +private: + + using UartDeviceFile_t = std::string; + + struct UartElements { + int fileDescriptor; + std::vector replyBuffer; + /** Number of bytes read will be written to this variable */ + size_t replyLen; + }; + + using UartDeviceMap = std::unordered_map; + using UartDeviceMapIter = UartDeviceMap::iterator; + + /** + * The uart devie map stores informations of initialized uart ports. + */ + UartDeviceMap uartDeviceMap; + + /** + * @brief This function opens and configures a uart device by using the information stored + * in the uart cookie. + * @param uartCookie Pointer to uart cookie with information about the uart. Contains the + * uart device file, baudrate, parity, stopbits etc. + * @return The file descriptor of the configured uart. + */ + int configureUartPort(UartCookie* uartCookie); + + /** + * @brief This function adds the parity settings to the termios options struct. + * + * @param options Pointer to termios options struct which will be modified to enable or disable + * parity checking. + * @param uartCookie Pointer to uart cookie containing the information about the desired + * parity settings. + * + */ + void setParityOptions(struct termios* options, UartCookie* uartCookie); + + void setStopBitOptions(struct termios* options, UartCookie* uartCookie); + + /** + * @brief This function sets options which are not configurable by the uartCookie. + */ + void setFixedOptions(struct termios* options); + + /** + * @brief With this function the datasize settings are added to the termios options struct. + */ + void setDatasizeOptions(struct termios* options, UartCookie* uartCookie); + + /** + * @brief This functions adds the baudrate specified in the uartCookie to the termios options + * struct. + */ + void configureBaudrate(struct termios* options, UartCookie* uartCookie); + + void setUartMode(struct termios* options, UartCookie& uartCookie); + + ReturnValue_t handleCanonicalRead(UartCookie& uartCookie, UartDeviceMapIter& iter, + size_t requestLen); + ReturnValue_t handleNoncanonicalRead(UartCookie& uartCookie, UartDeviceMapIter& iter, + size_t requestLen); + +}; + +#endif /* BSP_Q7S_COMIF_UARTCOMIF_H_ */ diff --git a/hal/src/fsfw/hal/linux/uart/UartCookie.cpp b/hal/src/fsfw/hal/linux/uart/UartCookie.cpp new file mode 100644 index 00000000..bfd091a8 --- /dev/null +++ b/hal/src/fsfw/hal/linux/uart/UartCookie.cpp @@ -0,0 +1,97 @@ +#include "fsfw/hal/linux/uart/UartCookie.h" + +#include + +UartCookie::UartCookie(object_id_t handlerId, std::string deviceFile, UartModes uartMode, + uint32_t baudrate, size_t maxReplyLen): + handlerId(handlerId), deviceFile(deviceFile), uartMode(uartMode), baudrate(baudrate), + maxReplyLen(maxReplyLen) { +} + +UartCookie::~UartCookie() {} + +uint32_t UartCookie::getBaudrate() const { + return baudrate; +} + +size_t UartCookie::getMaxReplyLen() const { + return maxReplyLen; +} + +std::string UartCookie::getDeviceFile() const { + return deviceFile; +} + +void UartCookie::setParityOdd() { + parity = Parity::ODD; +} + +void UartCookie::setParityEven() { + parity = Parity::EVEN; +} + +Parity UartCookie::getParity() const { + return parity; +} + +void UartCookie::setBitsPerWord(uint8_t bitsPerWord_) { + switch(bitsPerWord_) { + case 5: + case 6: + case 7: + case 8: + break; + default: + sif::debug << "UartCookie::setBitsPerWord: Invalid bits per word specified" << std::endl; + return; + } + bitsPerWord = bitsPerWord_; +} + +uint8_t UartCookie::getBitsPerWord() const { + return bitsPerWord; +} + +StopBits UartCookie::getStopBits() const { + return stopBits; +} + +void UartCookie::setTwoStopBits() { + stopBits = StopBits::TWO_STOP_BITS; +} + +void UartCookie::setOneStopBit() { + stopBits = StopBits::ONE_STOP_BIT; +} + +UartModes UartCookie::getUartMode() const { + return uartMode; +} + +void UartCookie::setReadCycles(uint8_t readCycles) { + this->readCycles = readCycles; +} + +void UartCookie::setToFlushInput(bool enable) { + this->flushInput = enable; +} + +uint8_t UartCookie::getReadCycles() const { + return readCycles; +} + +bool UartCookie::getInputShouldBeFlushed() { + return this->flushInput; +} + +object_id_t UartCookie::getHandlerId() const { + return this->handlerId; +} + +void UartCookie::setNoFixedSizeReply() { + replySizeFixed = false; +} + +bool UartCookie::isReplySizeFixed() { + return replySizeFixed; +} diff --git a/hal/src/fsfw/hal/linux/uart/UartCookie.h b/hal/src/fsfw/hal/linux/uart/UartCookie.h new file mode 100644 index 00000000..faf95d50 --- /dev/null +++ b/hal/src/fsfw/hal/linux/uart/UartCookie.h @@ -0,0 +1,121 @@ +#ifndef SAM9G20_COMIF_COOKIES_UART_COOKIE_H_ +#define SAM9G20_COMIF_COOKIES_UART_COOKIE_H_ + +#include +#include + +#include + +enum class Parity { + NONE, + EVEN, + ODD +}; + +enum class StopBits { + ONE_STOP_BIT, + TWO_STOP_BITS +}; + +enum class UartModes { + CANONICAL, + NON_CANONICAL +}; + +/** + * @brief Cookie for the UartComIF. There are many options available to configure the UART driver. + * The constructor only requests for common options like the baudrate. Other options can + * be set by member functions. + * + * @author J. Meier + */ +class UartCookie: public CookieIF { +public: + + /** + * @brief Constructor for the uart cookie. + * @param deviceFile The device file specifying the uart to use, e.g. "/dev/ttyPS1" + * @param uartMode Specify the UART mode. The canonical mode should be used if the + * messages are separated by a delimited character like '\n'. See the + * termios documentation for more information + * @param baudrate The baudrate to use for input and output. Possible Baudrates are: 50, + * 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, B19200, + * 38400, 57600, 115200, 230400, 460800 + * @param maxReplyLen The maximum size an object using this cookie expects + * @details + * Default configuration: No parity + * 8 databits (number of bits transfered with one uart frame) + * One stop bit + */ + UartCookie(object_id_t handlerId, std::string deviceFile, UartModes uartMode, + uint32_t baudrate, size_t maxReplyLen); + + virtual ~UartCookie(); + + uint32_t getBaudrate() const; + size_t getMaxReplyLen() const; + std::string getDeviceFile() const; + Parity getParity() const; + uint8_t getBitsPerWord() const; + StopBits getStopBits() const; + UartModes getUartMode() const; + object_id_t getHandlerId() const; + + /** + * The UART ComIF will only perform a specified number of read cycles for the canonical mode. + * The user can specify how many of those read cycles are performed for one device handler + * communication cycle. An example use-case would be to read all available GPS NMEA strings + * at once. + * @param readCycles + */ + void setReadCycles(uint8_t readCycles); + uint8_t getReadCycles() const; + + /** + * Allows to flush the data which was received but has not been read yet. This is useful + * to discard obsolete data at software startup. + */ + void setToFlushInput(bool enable); + bool getInputShouldBeFlushed(); + + /** + * Functions two enable parity checking. + */ + void setParityOdd(); + void setParityEven(); + + /** + * Function two set number of bits per UART frame. + */ + void setBitsPerWord(uint8_t bitsPerWord_); + + /** + * Function to specify the number of stopbits. + */ + void setTwoStopBits(); + void setOneStopBit(); + + /** + * Calling this function prevents the UartComIF to return failed if not all requested bytes + * could be read. This is required by a device handler when the size of a reply is not known. + */ + void setNoFixedSizeReply(); + + bool isReplySizeFixed(); + +private: + + const object_id_t handlerId; + std::string deviceFile; + const UartModes uartMode; + bool flushInput = false; + uint32_t baudrate; + size_t maxReplyLen = 0; + Parity parity = Parity::NONE; + uint8_t bitsPerWord = 8; + uint8_t readCycles = 1; + StopBits stopBits = StopBits::ONE_STOP_BIT; + bool replySizeFixed = true; +}; + +#endif diff --git a/hal/src/fsfw/hal/linux/utility.cpp b/hal/src/fsfw/hal/linux/utility.cpp new file mode 100644 index 00000000..04fded6c --- /dev/null +++ b/hal/src/fsfw/hal/linux/utility.cpp @@ -0,0 +1,26 @@ +#include "fsfw/FSFW.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/hal/linux/utility.h" + +#include +#include + +void utility::handleIoctlError(const char* const customPrintout) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + if(customPrintout != nullptr) { + sif::warning << customPrintout << std::endl; + } + sif::warning << "handleIoctlError: Error code " << errno << ", "<< strerror(errno) << + std::endl; +#else + if(customPrintout != nullptr) { + sif::printWarning("%s\n", customPrintout); + } + sif::printWarning("handleIoctlError: Error code %d, %s\n", errno, strerror(errno)); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + +} + + diff --git a/hal/src/fsfw/hal/linux/utility.h b/hal/src/fsfw/hal/linux/utility.h new file mode 100644 index 00000000..0353b1d0 --- /dev/null +++ b/hal/src/fsfw/hal/linux/utility.h @@ -0,0 +1,10 @@ +#ifndef LINUX_UTILITY_UTILITY_H_ +#define LINUX_UTILITY_UTILITY_H_ + +namespace utility { + +void handleIoctlError(const char* const customPrintout); + +} + +#endif /* LINUX_UTILITY_UTILITY_H_ */ diff --git a/hal/src/fsfw/hal/stm32h7/CMakeLists.txt b/hal/src/fsfw/hal/stm32h7/CMakeLists.txt new file mode 100644 index 00000000..bae3b1ac --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/CMakeLists.txt @@ -0,0 +1,7 @@ +add_subdirectory(spi) +add_subdirectory(gpio) +add_subdirectory(devicetest) + +target_sources(${LIB_FSFW_NAME} PRIVATE + dma.cpp +) diff --git a/hal/src/fsfw/hal/stm32h7/devicetest/CMakeLists.txt b/hal/src/fsfw/hal/stm32h7/devicetest/CMakeLists.txt new file mode 100644 index 00000000..7bd4c3a9 --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/devicetest/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + GyroL3GD20H.cpp +) \ No newline at end of file diff --git a/hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.cpp b/hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.cpp new file mode 100644 index 00000000..04b1de3b --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.cpp @@ -0,0 +1,558 @@ +#include "fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h" + +#include "fsfw/hal/stm32h7/spi/mspInit.h" +#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" +#include "fsfw/hal/stm32h7/spi/spiCore.h" +#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw/hal/stm32h7/spi/stm32h743ziSpi.h" + +#include "fsfw/tasks/TaskFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + +#include "stm32h7xx_hal_spi.h" +#include "stm32h7xx_hal_rcc.h" + +#include + +alignas(32) std::array GyroL3GD20H::rxBuffer; +alignas(32) std::array +GyroL3GD20H::txBuffer __attribute__((section(".dma_buffer"))); + +TransferStates transferState = TransferStates::IDLE; +spi::TransferModes GyroL3GD20H::transferMode = spi::TransferModes::POLLING; + + +GyroL3GD20H::GyroL3GD20H(SPI_HandleTypeDef *spiHandle, spi::TransferModes transferMode_): + spiHandle(spiHandle) { + txDmaHandle = new DMA_HandleTypeDef(); + rxDmaHandle = new DMA_HandleTypeDef(); + spi::setSpiHandle(spiHandle); + spi::assignSpiUserArgs(spi::SpiBus::SPI_1, spiHandle); + transferMode = transferMode_; + if(transferMode == spi::TransferModes::DMA) { + mspCfg = new spi::MspDmaConfigStruct(); + auto typedCfg = dynamic_cast(mspCfg); + spi::setDmaHandles(txDmaHandle, rxDmaHandle); + spi::h743zi::standardDmaCfg(*typedCfg, IrqPriorities::HIGHEST_FREERTOS, + IrqPriorities::HIGHEST_FREERTOS, IrqPriorities::HIGHEST_FREERTOS); + spi::setSpiDmaMspFunctions(typedCfg); + } + else if(transferMode == spi::TransferModes::INTERRUPT) { + mspCfg = new spi::MspIrqConfigStruct(); + auto typedCfg = dynamic_cast(mspCfg); + spi::h743zi::standardInterruptCfg(*typedCfg, IrqPriorities::HIGHEST_FREERTOS); + spi::setSpiIrqMspFunctions(typedCfg); + } + else if(transferMode == spi::TransferModes::POLLING) { + mspCfg = new spi::MspPollingConfigStruct(); + auto typedCfg = dynamic_cast(mspCfg); + spi::h743zi::standardPollingCfg(*typedCfg); + spi::setSpiPollingMspFunctions(typedCfg); + } + + spi::assignTransferRxTxCompleteCallback(&spiTransferCompleteCallback, nullptr); + spi::assignTransferErrorCallback(&spiTransferErrorCallback, nullptr); + + GPIO_InitTypeDef chipSelect = {}; + __HAL_RCC_GPIOD_CLK_ENABLE(); + chipSelect.Pin = GPIO_PIN_14; + chipSelect.Mode = GPIO_MODE_OUTPUT_PP; + HAL_GPIO_Init(GPIOD, &chipSelect); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); +} + +GyroL3GD20H::~GyroL3GD20H() { + delete txDmaHandle; + delete rxDmaHandle; + if(mspCfg != nullptr) { + delete mspCfg; + } +} + +ReturnValue_t GyroL3GD20H::initialize() { + // Configure the SPI peripheral + spiHandle->Instance = SPI1; + spiHandle->Init.BaudRatePrescaler = spi::getPrescaler(HAL_RCC_GetHCLKFreq(), 3900000); + spiHandle->Init.Direction = SPI_DIRECTION_2LINES; + spi::assignSpiMode(spi::SpiModes::MODE_3, *spiHandle); + spiHandle->Init.DataSize = SPI_DATASIZE_8BIT; + spiHandle->Init.FirstBit = SPI_FIRSTBIT_MSB; + spiHandle->Init.TIMode = SPI_TIMODE_DISABLE; + spiHandle->Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; + spiHandle->Init.CRCPolynomial = 7; + spiHandle->Init.CRCLength = SPI_CRC_LENGTH_8BIT; + spiHandle->Init.NSS = SPI_NSS_SOFT; + spiHandle->Init.NSSPMode = SPI_NSS_PULSE_DISABLE; + // Recommended setting to avoid glitches + spiHandle->Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_ENABLE; + spiHandle->Init.Mode = SPI_MODE_MASTER; + if(HAL_SPI_Init(spiHandle) != HAL_OK) { + sif::printWarning("Error initializing SPI\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + + delete mspCfg; + transferState = TransferStates::WAIT; + + sif::printInfo("GyroL3GD20H::performOperation: Reading WHO AM I register\n"); + + txBuffer[0] = WHO_AM_I_REG | STM_READ_MASK; + txBuffer[1] = 0; + + switch(transferMode) { + case(spi::TransferModes::DMA): { + return handleDmaTransferInit(); + } + case(spi::TransferModes::INTERRUPT): { + return handleInterruptTransferInit(); + } + case(spi::TransferModes::POLLING): { + return handlePollingTransferInit(); + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroL3GD20H::performOperation() { + switch(transferMode) { + case(spi::TransferModes::DMA): { + return handleDmaSensorRead(); + } + case(spi::TransferModes::POLLING): { + return handlePollingSensorRead(); + } + case(spi::TransferModes::INTERRUPT): { + return handleInterruptSensorRead(); + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroL3GD20H::handleDmaTransferInit() { + /* Clean D-cache */ + /* Make sure the address is 32-byte aligned and add 32-bytes to length, + in case it overlaps cacheline */ + // See https://community.st.com/s/article/FAQ-DMA-is-not-working-on-STM32H7-devices + HAL_StatusTypeDef result = performDmaTransfer(2); + if(result != HAL_OK) { + // Transfer error in transmission process + sif::printWarning("GyroL3GD20H::initialize: Error transmitting SPI with DMA\n"); + } + + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + + switch(transferState) { + case(TransferStates::SUCCESS): { + uint8_t whoAmIVal = rxBuffer[1]; + if(whoAmIVal != EXPECTED_WHO_AM_I_VAL) { + sif::printDebug("GyroL3GD20H::initialize: " + "Read WHO AM I value %d not equal to expected value!\n", whoAmIVal); + } + transferState = TransferStates::IDLE; + break; + } + case(TransferStates::FAILURE): { + sif::printWarning("Transfer failure\n"); + transferState = TransferStates::FAILURE; + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + sif::printInfo("GyroL3GD20H::initialize: Configuring device\n"); + // Configure the 5 configuration registers + uint8_t configRegs[5]; + prepareConfigRegs(configRegs); + + result = performDmaTransfer(6); + if(result != HAL_OK) { + // Transfer error in transmission process + sif::printWarning("Error transmitting SPI with DMA\n"); + } + + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + + switch(transferState) { + case(TransferStates::SUCCESS): { + sif::printInfo("GyroL3GD20H::initialize: Configuration transfer success\n"); + transferState = TransferStates::IDLE; + break; + } + case(TransferStates::FAILURE): { + sif::printWarning("GyroL3GD20H::initialize: Configuration transfer failure\n"); + transferState = TransferStates::FAILURE; + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK | STM_READ_MASK; + std::memset(txBuffer.data() + 1, 0 , 5); + result = performDmaTransfer(6); + if(result != HAL_OK) { + // Transfer error in transmission process + sif::printWarning("Error transmitting SPI with DMA\n"); + } + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + + switch(transferState) { + case(TransferStates::SUCCESS): { + if(rxBuffer[1] != configRegs[0] or rxBuffer[2] != configRegs[1] or + rxBuffer[3] != configRegs[2] or rxBuffer[4] != configRegs[3] or + rxBuffer[5] != configRegs[4]) { + sif::printWarning("GyroL3GD20H::initialize: Configuration failure\n"); + } + else { + sif::printInfo("GyroL3GD20H::initialize: Configuration success\n"); + } + transferState = TransferStates::IDLE; + break; + } + case(TransferStates::FAILURE): { + sif::printWarning("GyroL3GD20H::initialize: Configuration transfer failure\n"); + transferState = TransferStates::FAILURE; + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroL3GD20H::handleDmaSensorRead() { + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK | STM_READ_MASK; + std::memset(txBuffer.data() + 1, 0 , 14); + + HAL_StatusTypeDef result = performDmaTransfer(15); + if(result != HAL_OK) { + // Transfer error in transmission process + sif::printDebug("GyroL3GD20H::handleDmaSensorRead: Error transmitting SPI with DMA\n"); + } + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + + switch(transferState) { + case(TransferStates::SUCCESS): { + handleSensorReadout(); + break; + } + case(TransferStates::FAILURE): { + sif::printWarning("GyroL3GD20H::handleDmaSensorRead: Sensor read failure\n"); + transferState = TransferStates::FAILURE; + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +HAL_StatusTypeDef GyroL3GD20H::performDmaTransfer(size_t sendSize) { + transferState = TransferStates::WAIT; +#if STM_USE_PERIPHERAL_TX_BUFFER_MPU_PROTECTION == 0 + SCB_CleanDCache_by_Addr((uint32_t*)(((uint32_t)txBuffer.data()) & ~(uint32_t)0x1F), + txBuffer.size()+32); +#endif + + // Start SPI transfer via DMA + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + return HAL_SPI_TransmitReceive_DMA(spiHandle, txBuffer.data(), rxBuffer.data(), sendSize); +} + +ReturnValue_t GyroL3GD20H::handlePollingTransferInit() { + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + auto result = HAL_SPI_TransmitReceive(spiHandle, txBuffer.data(), rxBuffer.data(), 2, 1000); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); + switch(result) { + case(HAL_OK): { + sif::printInfo("GyroL3GD20H::initialize: Polling transfer success\n"); + uint8_t whoAmIVal = rxBuffer[1]; + if(whoAmIVal != EXPECTED_WHO_AM_I_VAL) { + sif::printDebug("GyroL3GD20H::performOperation: " + "Read WHO AM I value %d not equal to expected value!\n", whoAmIVal); + } + break; + } + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer timeout\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + case(HAL_ERROR): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer failure\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + sif::printInfo("GyroL3GD20H::initialize: Configuring device\n"); + // Configure the 5 configuration registers + uint8_t configRegs[5]; + prepareConfigRegs(configRegs); + + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + result = HAL_SPI_TransmitReceive(spiHandle, txBuffer.data(), rxBuffer.data(), 6, 1000); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); + switch(result) { + case(HAL_OK): { + break; + } + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer timeout\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + case(HAL_ERROR): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer failure\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK | STM_READ_MASK; + std::memset(txBuffer.data() + 1, 0 , 5); + + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + result = HAL_SPI_TransmitReceive(spiHandle, txBuffer.data(), rxBuffer.data(), 6, 1000); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); + switch(result) { + case(HAL_OK): { + if(rxBuffer[1] != configRegs[0] or rxBuffer[2] != configRegs[1] or + rxBuffer[3] != configRegs[2] or rxBuffer[4] != configRegs[3] or + rxBuffer[5] != configRegs[4]) { + sif::printWarning("GyroL3GD20H::initialize: Configuration failure\n"); + } + else { + sif::printInfo("GyroL3GD20H::initialize: Configuration success\n"); + } + break; + } + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer timeout\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + case(HAL_ERROR): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer failure\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroL3GD20H::handlePollingSensorRead() { + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK | STM_READ_MASK; + std::memset(txBuffer.data() + 1, 0 , 14); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + auto result = HAL_SPI_TransmitReceive(spiHandle, txBuffer.data(), rxBuffer.data(), 15, 1000); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); + + switch(result) { + case(HAL_OK): { + handleSensorReadout(); + break; + } + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer timeout\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + case(HAL_ERROR): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer failure\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroL3GD20H::handleInterruptTransferInit() { + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + switch(HAL_SPI_TransmitReceive_IT(spiHandle, txBuffer.data(), rxBuffer.data(), 2)) { + case(HAL_OK): { + sif::printInfo("GyroL3GD20H::initialize: Interrupt transfer success\n"); + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + + uint8_t whoAmIVal = rxBuffer[1]; + if(whoAmIVal != EXPECTED_WHO_AM_I_VAL) { + sif::printDebug("GyroL3GD20H::initialize: " + "Read WHO AM I value %d not equal to expected value!\n", whoAmIVal); + } + break; + } + case(HAL_BUSY): + case(HAL_ERROR): + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Initialization failure using interrupts\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + sif::printInfo("GyroL3GD20H::initialize: Configuring device\n"); + transferState = TransferStates::WAIT; + // Configure the 5 configuration registers + uint8_t configRegs[5]; + prepareConfigRegs(configRegs); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + switch(HAL_SPI_TransmitReceive_IT(spiHandle, txBuffer.data(), rxBuffer.data(), 6)) { + case(HAL_OK): { + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + break; + } + case(HAL_BUSY): + case(HAL_ERROR): + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Initialization failure using interrupts\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK | STM_READ_MASK; + std::memset(txBuffer.data() + 1, 0 , 5); + transferState = TransferStates::WAIT; + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + switch(HAL_SPI_TransmitReceive_IT(spiHandle, txBuffer.data(), rxBuffer.data(), 6)) { + case(HAL_OK): { + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + if(rxBuffer[1] != configRegs[0] or rxBuffer[2] != configRegs[1] or + rxBuffer[3] != configRegs[2] or rxBuffer[4] != configRegs[3] or + rxBuffer[5] != configRegs[4]) { + sif::printWarning("GyroL3GD20H::initialize: Configuration failure\n"); + } + else { + sif::printInfo("GyroL3GD20H::initialize: Configuration success\n"); + } + break; + } + case(HAL_BUSY): + case(HAL_ERROR): + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Initialization failure using interrupts\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroL3GD20H::handleInterruptSensorRead() { + transferState = TransferStates::WAIT; + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK | STM_READ_MASK; + std::memset(txBuffer.data() + 1, 0 , 14); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + switch(HAL_SPI_TransmitReceive_IT(spiHandle, txBuffer.data(), rxBuffer.data(), 15)) { + case(HAL_OK): { + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + handleSensorReadout(); + break; + } + case(HAL_BUSY): + case(HAL_ERROR): + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Sensor read failure using interrupts\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +void GyroL3GD20H::prepareConfigRegs(uint8_t* configRegs) { + // Enable sensor + configRegs[0] = 0b00001111; + configRegs[1] = 0b00000000; + configRegs[2] = 0b00000000; + // Big endian select + configRegs[3] = 0b01000000; + configRegs[4] = 0b00000000; + + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK; + std::memcpy(txBuffer.data() + 1, configRegs, 5); +} + +uint8_t GyroL3GD20H::readRegPolling(uint8_t reg) { + uint8_t rxBuf[2] = {}; + uint8_t txBuf[2] = {}; + txBuf[0] = reg | STM_READ_MASK; + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + auto result = HAL_SPI_TransmitReceive(spiHandle, txBuf, rxBuf, 2, 1000); + if(result) {}; + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); + return rxBuf[1]; +} + +void GyroL3GD20H::handleSensorReadout() { + uint8_t statusReg = rxBuffer[8]; + int16_t gyroXRaw = rxBuffer[9] << 8 | rxBuffer[10]; + float gyroX = static_cast(gyroXRaw) * 0.00875; + int16_t gyroYRaw = rxBuffer[11] << 8 | rxBuffer[12]; + float gyroY = static_cast(gyroYRaw) * 0.00875; + int16_t gyroZRaw = rxBuffer[13] << 8 | rxBuffer[14]; + float gyroZ = static_cast(gyroZRaw) * 0.00875; + sif::printInfo("Status register: 0b" BYTE_TO_BINARY_PATTERN "\n", BYTE_TO_BINARY(statusReg)); + sif::printInfo("Gyro X: %f\n", gyroX); + sif::printInfo("Gyro Y: %f\n", gyroY); + sif::printInfo("Gyro Z: %f\n", gyroZ); +} + + +void GyroL3GD20H::spiTransferCompleteCallback(SPI_HandleTypeDef *hspi, void* args) { + transferState = TransferStates::SUCCESS; + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); + if(GyroL3GD20H::transferMode == spi::TransferModes::DMA) { + // Invalidate cache prior to access by CPU + SCB_InvalidateDCache_by_Addr ((uint32_t *)GyroL3GD20H::rxBuffer.data(), + GyroL3GD20H::recvBufferSize); + } +} + +/** + * @brief SPI error callbacks. + * @param hspi: SPI handle + * @note This example shows a simple way to report transfer error, and you can + * add your own implementation. + * @retval None + */ +void GyroL3GD20H::spiTransferErrorCallback(SPI_HandleTypeDef *hspi, void* args) { + transferState = TransferStates::FAILURE; +} diff --git a/hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h b/hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h new file mode 100644 index 00000000..b65654de --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h @@ -0,0 +1,70 @@ +#ifndef FSFW_HAL_STM32H7_DEVICETEST_GYRO_L3GD20H_H_ +#define FSFW_HAL_STM32H7_DEVICETEST_GYRO_L3GD20H_H_ + +#include "stm32h7xx_hal.h" +#include "stm32h7xx_hal_spi.h" +#include "../spi/mspInit.h" +#include "../spi/spiDefinitions.h" + +#include "fsfw/returnvalues/HasReturnvaluesIF.h" + +#include +#include + +enum class TransferStates { + IDLE, + WAIT, + SUCCESS, + FAILURE +}; + +class GyroL3GD20H { +public: + GyroL3GD20H(SPI_HandleTypeDef* spiHandle, spi::TransferModes transferMode); + ~GyroL3GD20H(); + + ReturnValue_t initialize(); + ReturnValue_t performOperation(); + +private: + + const uint8_t WHO_AM_I_REG = 0b00001111; + const uint8_t STM_READ_MASK = 0b10000000; + const uint8_t STM_AUTO_INCREMENT_MASK = 0b01000000; + const uint8_t EXPECTED_WHO_AM_I_VAL = 0b11010111; + const uint8_t CTRL_REG_1 = 0b00100000; + const uint32_t L3G_RANGE = 245; + + SPI_HandleTypeDef* spiHandle; + + static spi::TransferModes transferMode; + static constexpr size_t recvBufferSize = 32 * 10; + static std::array rxBuffer; + static constexpr size_t txBufferSize = 32; + static std::array txBuffer; + + ReturnValue_t handleDmaTransferInit(); + ReturnValue_t handlePollingTransferInit(); + ReturnValue_t handleInterruptTransferInit(); + + ReturnValue_t handleDmaSensorRead(); + HAL_StatusTypeDef performDmaTransfer(size_t sendSize); + ReturnValue_t handlePollingSensorRead(); + ReturnValue_t handleInterruptSensorRead(); + + uint8_t readRegPolling(uint8_t reg); + + static void spiTransferCompleteCallback(SPI_HandleTypeDef *hspi, void* args); + static void spiTransferErrorCallback(SPI_HandleTypeDef *hspi, void* args); + + + void prepareConfigRegs(uint8_t* configRegs); + void handleSensorReadout(); + + + DMA_HandleTypeDef* txDmaHandle = {}; + DMA_HandleTypeDef* rxDmaHandle = {}; + spi::MspCfgBase* mspCfg = {}; +}; + +#endif /* FSFW_HAL_STM32H7_DEVICETEST_GYRO_L3GD20H_H_ */ diff --git a/hal/src/fsfw/hal/stm32h7/dma.cpp b/hal/src/fsfw/hal/stm32h7/dma.cpp new file mode 100644 index 00000000..288e4294 --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/dma.cpp @@ -0,0 +1,84 @@ +#include + +#include +#include + +user_handler_t DMA_1_USER_HANDLERS[8]; +user_args_t DMA_1_USER_ARGS[8]; + +user_handler_t DMA_2_USER_HANDLERS[8]; +user_args_t DMA_2_USER_ARGS[8]; + +void dma::assignDmaUserHandler(DMAIndexes dma_idx, DMAStreams stream_idx, + user_handler_t user_handler, user_args_t user_args) { + if(dma_idx == DMA_1) { + DMA_1_USER_HANDLERS[stream_idx] = user_handler; + DMA_1_USER_ARGS[stream_idx] = user_args; + } + else if(dma_idx == DMA_2) { + DMA_2_USER_HANDLERS[stream_idx] = user_handler; + DMA_2_USER_ARGS[stream_idx] = user_args; + } +} + +// The interrupt handlers in the format required for the IRQ vector table + +/* Do not change these function names! They need to be exactly equal to the name of the functions +defined in the startup_stm32h743xx.s files! */ + +#define GENERIC_DMA_IRQ_HANDLER(DMA_IDX, STREAM_IDX) \ + if(DMA_##DMA_IDX##_USER_HANDLERS[STREAM_IDX] != NULL) { \ + DMA_##DMA_IDX##_USER_HANDLERS[STREAM_IDX](DMA_##DMA_IDX##_USER_ARGS[STREAM_IDX]); \ + return; \ + } \ + Default_Handler() \ + +extern"C" void DMA1_Stream0_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 0); +} +extern"C" void DMA1_Stream1_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 1); +} +extern"C" void DMA1_Stream2_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 2); +} +extern"C" void DMA1_Stream3_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 3); +} +extern"C" void DMA1_Stream4_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 4); +} +extern"C" void DMA1_Stream5_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 5); +} +extern"C" void DMA1_Stream6_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 6); +} +extern"C" void DMA1_Stream7_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 7); +} + +extern"C" void DMA2_Stream0_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 0); +} +extern"C" void DMA2_Stream1_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 1); +} +extern"C" void DMA2_Stream2_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 2); +} +extern"C" void DMA2_Stream3_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 3); +} +extern"C" void DMA2_Stream4_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 4); +} +extern"C" void DMA2_Stream5_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 5); +} +extern"C" void DMA2_Stream6_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 6); +} +extern"C" void DMA2_Stream7_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 7); +} diff --git a/hal/src/fsfw/hal/stm32h7/dma.h b/hal/src/fsfw/hal/stm32h7/dma.h new file mode 100644 index 00000000..779a64cb --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/dma.h @@ -0,0 +1,49 @@ +#ifndef FSFW_HAL_STM32H7_DMA_H_ +#define FSFW_HAL_STM32H7_DMA_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "interrupts.h" +#include + +namespace dma { + +enum DMAType { + TX = 0, + RX = 1 +}; + +enum DMAIndexes: uint8_t { + DMA_1 = 1, + DMA_2 = 2 +}; + +enum DMAStreams { + STREAM_0 = 0, + STREAM_1 = 1, + STREAM_2 = 2, + STREAM_3 = 3, + STREAM_4 = 4, + STREAM_5 = 5, + STREAM_6 = 6, + STREAM_7 = 7, +} ; + +/** + * Assign user interrupt handlers for DMA streams, allowing to pass an + * arbitrary argument as well. Generally, this argument will be the related DMA handle. + * @param user_handler + * @param user_args + */ +void assignDmaUserHandler(DMAIndexes dma_idx, DMAStreams stream_idx, + user_handler_t user_handler, user_args_t user_args); + +} + +#ifdef __cplusplus +} +#endif + +#endif /* FSFW_HAL_STM32H7_DMA_H_ */ diff --git a/hal/src/fsfw/hal/stm32h7/gpio/CMakeLists.txt b/hal/src/fsfw/hal/stm32h7/gpio/CMakeLists.txt new file mode 100644 index 00000000..35245b25 --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/gpio/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + gpio.cpp +) diff --git a/hal/src/fsfw/hal/stm32h7/gpio/gpio.cpp b/hal/src/fsfw/hal/stm32h7/gpio/gpio.cpp new file mode 100644 index 00000000..927588a3 --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/gpio/gpio.cpp @@ -0,0 +1,71 @@ +#include "fsfw/hal/stm32h7/gpio/gpio.h" + +#include "stm32h7xx_hal_rcc.h" + +void gpio::initializeGpioClock(GPIO_TypeDef* gpioPort) { +#ifdef GPIOA + if(gpioPort == GPIOA) { + __HAL_RCC_GPIOA_CLK_ENABLE(); + } +#endif + +#ifdef GPIOB + if(gpioPort == GPIOB) { + __HAL_RCC_GPIOB_CLK_ENABLE(); + } +#endif + +#ifdef GPIOC + if(gpioPort == GPIOC) { + __HAL_RCC_GPIOC_CLK_ENABLE(); + } +#endif + +#ifdef GPIOD + if(gpioPort == GPIOD) { + __HAL_RCC_GPIOD_CLK_ENABLE(); + } +#endif + +#ifdef GPIOE + if(gpioPort == GPIOE) { + __HAL_RCC_GPIOE_CLK_ENABLE(); + } +#endif + +#ifdef GPIOF + if(gpioPort == GPIOF) { + __HAL_RCC_GPIOF_CLK_ENABLE(); + } +#endif + +#ifdef GPIOG + if(gpioPort == GPIOG) { + __HAL_RCC_GPIOG_CLK_ENABLE(); + } +#endif + +#ifdef GPIOH + if(gpioPort == GPIOH) { + __HAL_RCC_GPIOH_CLK_ENABLE(); + } +#endif + +#ifdef GPIOI + if(gpioPort == GPIOI) { + __HAL_RCC_GPIOI_CLK_ENABLE(); + } +#endif + +#ifdef GPIOJ + if(gpioPort == GPIOJ) { + __HAL_RCC_GPIOJ_CLK_ENABLE(); + } +#endif + +#ifdef GPIOK + if(gpioPort == GPIOK) { + __HAL_RCC_GPIOK_CLK_ENABLE(); + } +#endif +} diff --git a/hal/src/fsfw/hal/stm32h7/gpio/gpio.h b/hal/src/fsfw/hal/stm32h7/gpio/gpio.h new file mode 100644 index 00000000..38fcd708 --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/gpio/gpio.h @@ -0,0 +1,12 @@ +#ifndef FSFW_HAL_STM32H7_GPIO_GPIO_H_ +#define FSFW_HAL_STM32H7_GPIO_GPIO_H_ + +#include "stm32h7xx.h" + +namespace gpio { + +void initializeGpioClock(GPIO_TypeDef* gpioPort); + +} + +#endif /* FSFW_HAL_STM32H7_GPIO_GPIO_H_ */ diff --git a/hal/src/fsfw/hal/stm32h7/i2c/CMakeLists.txt b/hal/src/fsfw/hal/stm32h7/i2c/CMakeLists.txt new file mode 100644 index 00000000..5ecb0990 --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/i2c/CMakeLists.txt @@ -0,0 +1,2 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE +) diff --git a/hal/src/fsfw/hal/stm32h7/interrupts.h b/hal/src/fsfw/hal/stm32h7/interrupts.h new file mode 100644 index 00000000..aef60bf7 --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/interrupts.h @@ -0,0 +1,28 @@ +#ifndef FSFW_HAL_STM32H7_INTERRUPTS_H_ +#define FSFW_HAL_STM32H7_INTERRUPTS_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Default handler which is defined in startup file as assembly code. + */ +extern void Default_Handler(); + +typedef void (*user_handler_t) (void*); +typedef void* user_args_t; + +enum IrqPriorities: uint8_t { + HIGHEST = 0, + HIGHEST_FREERTOS = 6, + LOWEST = 15 +}; + +#ifdef __cplusplus +} +#endif + +#endif /* FSFW_HAL_STM32H7_INTERRUPTS_H_ */ diff --git a/hal/src/fsfw/hal/stm32h7/spi/CMakeLists.txt b/hal/src/fsfw/hal/stm32h7/spi/CMakeLists.txt new file mode 100644 index 00000000..e28c35aa --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + spiCore.cpp + spiDefinitions.cpp + spiInterrupts.cpp + mspInit.cpp + SpiCookie.cpp + SpiComIF.cpp + stm32h743ziSpi.cpp +) diff --git a/hal/src/fsfw/hal/stm32h7/spi/SpiComIF.cpp b/hal/src/fsfw/hal/stm32h7/spi/SpiComIF.cpp new file mode 100644 index 00000000..da34c4c0 --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/SpiComIF.cpp @@ -0,0 +1,468 @@ +#include "fsfw/hal/stm32h7/spi/SpiComIF.h" +#include "fsfw/hal/stm32h7/spi/SpiCookie.h" + +#include "fsfw/tasks/SemaphoreFactory.h" +#include "fsfw/hal/stm32h7/spi/spiCore.h" +#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw/hal/stm32h7/spi/mspInit.h" +#include "fsfw/hal/stm32h7/gpio/gpio.h" + +// FreeRTOS required special Semaphore handling from an ISR. Therefore, we use the concrete +// instance here, because RTEMS and FreeRTOS are the only relevant OSALs currently +// and it is not trivial to add a releaseFromISR to the SemaphoreIF +#if defined FSFW_OSAL_RTEMS +#include "fsfw/osal/rtems/BinarySemaphore.h" +#elif defined FSFW_OSAL_FREERTOS +#include "fsfw/osal/freertos/TaskManagement.h" +#include "fsfw/osal/freertos/BinarySemaphore.h" +#endif + +#include "stm32h7xx_hal_gpio.h" + +SpiComIF::SpiComIF(object_id_t objectId): SystemObject(objectId) { + void* irqArgsVoided = reinterpret_cast(&irqArgs); + spi::assignTransferRxTxCompleteCallback(&spiTransferCompleteCallback, irqArgsVoided); + spi::assignTransferRxCompleteCallback(&spiTransferRxCompleteCallback, irqArgsVoided); + spi::assignTransferTxCompleteCallback(&spiTransferTxCompleteCallback, irqArgsVoided); + spi::assignTransferErrorCallback(&spiTransferErrorCallback, irqArgsVoided); +} + +void SpiComIF::configureCacheMaintenanceOnTxBuffer(bool enable) { + this->cacheMaintenanceOnTxBuffer = enable; +} + +void SpiComIF::addDmaHandles(DMA_HandleTypeDef *txHandle, DMA_HandleTypeDef *rxHandle) { + spi::setDmaHandles(txHandle, rxHandle); +} + +ReturnValue_t SpiComIF::initialize() { + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::initializeInterface(CookieIF *cookie) { + SpiCookie* spiCookie = dynamic_cast(cookie); + if(spiCookie == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error < "SpiComIF::initializeInterface: Invalid cookie" << std::endl; +#else + sif::printError("SpiComIF::initializeInterface: Invalid cookie\n"); +#endif + return NULLPOINTER; + } + auto transferMode = spiCookie->getTransferMode(); + + if(transferMode == spi::TransferModes::DMA) { + DMA_HandleTypeDef *txHandle = nullptr; + DMA_HandleTypeDef *rxHandle = nullptr; + spi::getDmaHandles(&txHandle, &rxHandle); + if(txHandle == nullptr or rxHandle == nullptr) { + sif::printError("SpiComIF::initialize: DMA handles not set!\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + } + // This semaphore ensures thread-safety for a given bus + spiSemaphore = dynamic_cast( + SemaphoreFactory::instance()->createBinarySemaphore()); + address_t spiAddress = spiCookie->getDeviceAddress(); + + auto iter = spiDeviceMap.find(spiAddress); + if(iter == spiDeviceMap.end()) { + size_t bufferSize = spiCookie->getMaxRecvSize(); + auto statusPair = spiDeviceMap.emplace(spiAddress, SpiInstance(bufferSize)); + if (not statusPair.second) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::initializeInterface: Failed to insert device with address " << + spiAddress << "to SPI device map" << std::endl; +#else + sif::printError("SpiComIF::initializeInterface: Failed to insert device with address " + "%lu to SPI device map\n", static_cast(spiAddress)); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return HasReturnvaluesIF::RETURN_FAILED; + } + } + auto gpioPin = spiCookie->getChipSelectGpioPin(); + auto gpioPort = spiCookie->getChipSelectGpioPort(); + + SPI_HandleTypeDef& spiHandle = spiCookie->getSpiHandle(); + + auto spiIdx = spiCookie->getSpiIdx(); + if(spiIdx == spi::SpiBus::SPI_1) { +#ifdef SPI1 + spiHandle.Instance = SPI1; +#endif + } + else if(spiIdx == spi::SpiBus::SPI_2) { +#ifdef SPI2 + spiHandle.Instance = SPI2; +#endif + } + else { + printCfgError("SPI Bus Index"); + return HasReturnvaluesIF::RETURN_FAILED; + } + + auto mspCfg = spiCookie->getMspCfg(); + + if(transferMode == spi::TransferModes::POLLING) { + auto typedCfg = dynamic_cast(mspCfg); + if(typedCfg == nullptr) { + printCfgError("Polling MSP"); + return HasReturnvaluesIF::RETURN_FAILED; + } + spi::setSpiPollingMspFunctions(typedCfg); + } + else if(transferMode == spi::TransferModes::INTERRUPT) { + auto typedCfg = dynamic_cast(mspCfg); + if(typedCfg == nullptr) { + printCfgError("IRQ MSP"); + return HasReturnvaluesIF::RETURN_FAILED; + } + spi::setSpiIrqMspFunctions(typedCfg); + } + else if(transferMode == spi::TransferModes::DMA) { + auto typedCfg = dynamic_cast(mspCfg); + if(typedCfg == nullptr) { + printCfgError("DMA MSP"); + return HasReturnvaluesIF::RETURN_FAILED; + } + // Check DMA handles + DMA_HandleTypeDef* txHandle = nullptr; + DMA_HandleTypeDef* rxHandle = nullptr; + spi::getDmaHandles(&txHandle, &rxHandle); + if(txHandle == nullptr or rxHandle == nullptr) { + printCfgError("DMA Handle"); + return HasReturnvaluesIF::RETURN_FAILED; + } + spi::setSpiDmaMspFunctions(typedCfg); + } + + gpio::initializeGpioClock(gpioPort); + GPIO_InitTypeDef chipSelect = {}; + chipSelect.Pin = gpioPin; + chipSelect.Mode = GPIO_MODE_OUTPUT_PP; + HAL_GPIO_Init(gpioPort, &chipSelect); + HAL_GPIO_WritePin(gpioPort, gpioPin, GPIO_PIN_SET); + + if(HAL_SPI_Init(&spiHandle) != HAL_OK) { + sif::printWarning("SpiComIF::initialize: Error initializing SPI\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + // The MSP configuration struct is not required anymore + spiCookie->deleteMspCfg(); + + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) { + SpiCookie* spiCookie = dynamic_cast(cookie); + if(spiCookie == nullptr) { + return NULLPOINTER; + } + + SPI_HandleTypeDef& spiHandle = spiCookie->getSpiHandle(); + + auto iter = spiDeviceMap.find(spiCookie->getDeviceAddress()); + if(iter == spiDeviceMap.end()) { + return HasReturnvaluesIF::RETURN_FAILED; + } + iter->second.currentTransferLen = sendLen; + + auto transferMode = spiCookie->getTransferMode(); + switch(spiCookie->getTransferState()) { + case(spi::TransferStates::IDLE): { + break; + } + case(spi::TransferStates::WAIT): + case(spi::TransferStates::FAILURE): + case(spi::TransferStates::SUCCESS): + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + switch(transferMode) { + case(spi::TransferModes::POLLING): { + return handlePollingSendOperation(iter->second.replyBuffer.data(), spiHandle, *spiCookie, + sendData, sendLen); + } + case(spi::TransferModes::INTERRUPT): { + return handleInterruptSendOperation(iter->second.replyBuffer.data(), spiHandle, *spiCookie, + sendData, sendLen); + } + case(spi::TransferModes::DMA): { + return handleDmaSendOperation(iter->second.replyBuffer.data(), spiHandle, *spiCookie, + sendData, sendLen); + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::getSendSuccess(CookieIF *cookie) { + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { + SpiCookie* spiCookie = dynamic_cast(cookie); + if(spiCookie == nullptr) { + return NULLPOINTER; + } + switch(spiCookie->getTransferState()) { + case(spi::TransferStates::SUCCESS): { + auto iter = spiDeviceMap.find(spiCookie->getDeviceAddress()); + if(iter == spiDeviceMap.end()) { + return HasReturnvaluesIF::RETURN_FAILED; + } + *buffer = iter->second.replyBuffer.data(); + *size = iter->second.currentTransferLen; + spiCookie->setTransferState(spi::TransferStates::IDLE); + break; + } + case(spi::TransferStates::FAILURE): { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::readReceivedMessage: Transfer failure" << std::endl; +#else + sif::printWarning("SpiComIF::readReceivedMessage: Transfer failure\n"); +#endif +#endif + spiCookie->setTransferState(spi::TransferStates::IDLE); + return HasReturnvaluesIF::RETURN_FAILED; + } + case(spi::TransferStates::WAIT): + case(spi::TransferStates::IDLE): { + break; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + return HasReturnvaluesIF::RETURN_OK; +} + +void SpiComIF::setDefaultPollingTimeout(dur_millis_t timeout) { + this->defaultPollingTimeout = timeout; +} + +ReturnValue_t SpiComIF::handlePollingSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t *sendData, size_t sendLen) { + auto gpioPort = spiCookie.getChipSelectGpioPort(); + auto gpioPin = spiCookie.getChipSelectGpioPin(); + auto returnval = spiSemaphore->acquire(timeoutType, timeoutMs); + if(returnval != HasReturnvaluesIF::RETURN_OK) { + return returnval; + } + spiCookie.setTransferState(spi::TransferStates::WAIT); + HAL_GPIO_WritePin(gpioPort, gpioPin, GPIO_PIN_RESET); + auto result = HAL_SPI_TransmitReceive(&spiHandle, const_cast(sendData), + recvPtr, sendLen, defaultPollingTimeout); + HAL_GPIO_WritePin(gpioPort, gpioPin, GPIO_PIN_SET); + spiSemaphore->release(); + switch(result) { + case(HAL_OK): { + spiCookie.setTransferState(spi::TransferStates::SUCCESS); + break; + } + case(HAL_TIMEOUT): { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::sendMessage: Polling Mode | Timeout for SPI device" << + spiCookie->getDeviceAddress() << std::endl; +#else + sif::printWarning("SpiComIF::sendMessage: Polling Mode | Timeout for SPI device %d\n", + spiCookie.getDeviceAddress()); +#endif +#endif + spiCookie.setTransferState(spi::TransferStates::FAILURE); + return spi::HAL_TIMEOUT_RETVAL; + } + case(HAL_ERROR): + default: { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::sendMessage: Polling Mode | HAL error for SPI device" << + spiCookie->getDeviceAddress() << std::endl; +#else + sif::printWarning("SpiComIF::sendMessage: Polling Mode | HAL error for SPI device %d\n", + spiCookie.getDeviceAddress()); +#endif +#endif + spiCookie.setTransferState(spi::TransferStates::FAILURE); + return spi::HAL_ERROR_RETVAL; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::handleInterruptSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen) { + return handleIrqSendOperation(recvPtr, spiHandle, spiCookie, sendData, sendLen); +} + +ReturnValue_t SpiComIF::handleDmaSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen) { + return handleIrqSendOperation(recvPtr, spiHandle, spiCookie, sendData, sendLen); +} + +ReturnValue_t SpiComIF::handleIrqSendOperation(uint8_t *recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t *sendData, size_t sendLen) { + ReturnValue_t result = genericIrqSendSetup(recvPtr, spiHandle, spiCookie, sendData, sendLen); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + // yet another HAL driver which is not const-correct.. + HAL_StatusTypeDef status = HAL_OK; + auto transferMode = spiCookie.getTransferMode(); + if(transferMode == spi::TransferModes::DMA) { + if(cacheMaintenanceOnTxBuffer) { + /* Clean D-cache. Make sure the address is 32-byte aligned and add 32-bytes to length, + in case it overlaps cacheline */ + SCB_CleanDCache_by_Addr((uint32_t*)(((uint32_t) sendData ) & ~(uint32_t)0x1F), + sendLen + 32); + } + status = HAL_SPI_TransmitReceive_DMA(&spiHandle, const_cast(sendData), + currentRecvPtr, sendLen); + } + else { + status = HAL_SPI_TransmitReceive_IT(&spiHandle, const_cast(sendData), + currentRecvPtr, sendLen); + } + switch(status) { + case(HAL_OK): { + break; + } + default: { + return halErrorHandler(status, transferMode); + } + } + return result; +} + +ReturnValue_t SpiComIF::halErrorHandler(HAL_StatusTypeDef status, spi::TransferModes transferMode) { + char modeString[10]; + if(transferMode == spi::TransferModes::DMA) { + std::snprintf(modeString, sizeof(modeString), "Dma"); + } + else { + std::snprintf(modeString, sizeof(modeString), "Interrupt"); + } + sif::printWarning("SpiComIF::handle%sSendOperation: HAL error %d occured\n", modeString, + status); + switch(status) { + case(HAL_BUSY): { + return spi::HAL_BUSY_RETVAL; + } + case(HAL_ERROR): { + return spi::HAL_ERROR_RETVAL; + } + case(HAL_TIMEOUT): { + return spi::HAL_TIMEOUT_RETVAL; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } +} + + +ReturnValue_t SpiComIF::genericIrqSendSetup(uint8_t *recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t *sendData, size_t sendLen) { + currentRecvPtr = recvPtr; + currentRecvBuffSize = sendLen; + + // Take the semaphore which will be released by a callback when the transfer is complete + ReturnValue_t result = spiSemaphore->acquire(SemaphoreIF::TimeoutType::WAITING, timeoutMs); + if(result != HasReturnvaluesIF::RETURN_OK) { + // Configuration error + sif::printWarning("SpiComIF::handleInterruptSendOperation: Semaphore " + "could not be acquired after %d ms\n", timeoutMs); + return result; + } + // Cache the current SPI handle in any case + spi::setSpiHandle(&spiHandle); + // Assign the IRQ arguments for the user callbacks + irqArgs.comIF = this; + irqArgs.spiCookie = &spiCookie; + // The SPI handle is passed to the default SPI callback as a void argument. This callback + // is different from the user callbacks specified above! + spi::assignSpiUserArgs(spiCookie.getSpiIdx(), reinterpret_cast(&spiHandle)); + HAL_GPIO_WritePin(spiCookie.getChipSelectGpioPort(), spiCookie.getChipSelectGpioPin(), + GPIO_PIN_RESET); + return HasReturnvaluesIF::RETURN_OK; +} + +void SpiComIF::spiTransferTxCompleteCallback(SPI_HandleTypeDef *hspi, void *args) { + genericIrqHandler(args, spi::TransferStates::SUCCESS); +} + +void SpiComIF::spiTransferRxCompleteCallback(SPI_HandleTypeDef *hspi, void *args) { + genericIrqHandler(args, spi::TransferStates::SUCCESS); +} + +void SpiComIF::spiTransferCompleteCallback(SPI_HandleTypeDef *hspi, void *args) { + genericIrqHandler(args, spi::TransferStates::SUCCESS); +} + +void SpiComIF::spiTransferErrorCallback(SPI_HandleTypeDef *hspi, void *args) { + genericIrqHandler(args, spi::TransferStates::FAILURE); +} + +void SpiComIF::genericIrqHandler(void *irqArgsVoid, spi::TransferStates targetState) { + IrqArgs* irqArgs = reinterpret_cast(irqArgsVoid); + if(irqArgs == nullptr) { + return; + } + SpiCookie* spiCookie = irqArgs->spiCookie; + SpiComIF* comIF = irqArgs->comIF; + if(spiCookie == nullptr or comIF == nullptr) { + return; + } + + spiCookie->setTransferState(targetState); + + // Pull CS pin high again + HAL_GPIO_WritePin(spiCookie->getChipSelectGpioPort(), spiCookie->getChipSelectGpioPin(), + GPIO_PIN_SET); + +#if defined FSFW_OSAL_FREERTOS + // Release the task semaphore + BaseType_t taskWoken = pdFALSE; + ReturnValue_t result = BinarySemaphore::releaseFromISR(comIF->spiSemaphore->getSemaphore(), + &taskWoken); +#elif defined FSFW_OSAL_RTEMS + ReturnValue_t result = comIF->spiSemaphore->release(); +#endif + if(result != HasReturnvaluesIF::RETURN_OK) { + // Configuration error + printf("SpiComIF::genericIrqHandler: Failure releasing Semaphore!\n"); + } + + // Perform cache maintenance operation for DMA transfers + if(spiCookie->getTransferMode() == spi::TransferModes::DMA) { + // Invalidate cache prior to access by CPU + SCB_InvalidateDCache_by_Addr ((uint32_t *) comIF->currentRecvPtr, + comIF->currentRecvBuffSize); + } +#if defined FSFW_OSAL_FREERTOS + /* Request a context switch if the SPI ComIF task was woken up and has a higher priority + than the currently running task */ + if(taskWoken == pdTRUE) { + TaskManagement::requestContextSwitch(CallContext::ISR); + } +#endif +} + +void SpiComIF::printCfgError(const char *const type) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::initializeInterface: Invalid " << type << " configuration" + << std::endl; +#else + sif::printWarning("SpiComIF::initializeInterface: Invalid %s configuration\n", type); +#endif +} diff --git a/hal/src/fsfw/hal/stm32h7/spi/SpiComIF.h b/hal/src/fsfw/hal/stm32h7/spi/SpiComIF.h new file mode 100644 index 00000000..00625b34 --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/SpiComIF.h @@ -0,0 +1,130 @@ +#ifndef FSFW_HAL_STM32H7_SPI_SPICOMIF_H_ +#define FSFW_HAL_STM32H7_SPI_SPICOMIF_H_ + +#include "fsfw/tasks/SemaphoreIF.h" +#include "fsfw/devicehandlers/DeviceCommunicationIF.h" +#include "fsfw/objectmanager/SystemObject.h" + +#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" +#include "stm32h7xx_hal_spi.h" +#include "stm32h743xx.h" + +#include +#include + +class SpiCookie; +class BinarySemaphore; + +/** + * @brief This communication interface allows using generic device handlers with using + * the STM32H7 SPI peripherals + * @details + * This communication interface supports all three major communcation modes: + * - Polling: Simple, but not recommended to real use-cases, blocks the CPU + * - Interrupt: Good for small data only arriving occasionally + * - DMA: Good for large data which also occur regularly. Please note that the number + * of DMA channels in limited + * The device specific information is usually kept in the SpiCookie class. The current + * implementation limits the transfer mode for a given SPI bus. + * @author R. Mueller + */ +class SpiComIF: + public SystemObject, + public DeviceCommunicationIF { +public: + /** + * Create a SPI communication interface for the given SPI peripheral (spiInstance) + * @param objectId + * @param spiInstance + * @param spiHandle + * @param transferMode + */ + SpiComIF(object_id_t objectId); + + /** + * Allows the user to disable cache maintenance on the TX buffer. This can be done if the + * TX buffers are places and MPU protected properly like specified in this link: + * https://community.st.com/s/article/FAQ-DMA-is-not-working-on-STM32H7-devices + * The cache maintenace is enabled by default. + * @param enable + */ + void configureCacheMaintenanceOnTxBuffer(bool enable); + + void setDefaultPollingTimeout(dur_millis_t timeout); + + /** + * Add the DMA handles. These need to be set in the DMA transfer mode is used. + * @param txHandle + * @param rxHandle + */ + void addDmaHandles(DMA_HandleTypeDef* txHandle, DMA_HandleTypeDef* rxHandle); + + ReturnValue_t initialize() override; +protected: + + // DeviceCommunicationIF overrides + virtual ReturnValue_t initializeInterface(CookieIF * cookie) override; + virtual ReturnValue_t sendMessage(CookieIF *cookie, + const uint8_t * sendData, size_t sendLen) override; + virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override; + virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, + size_t requestLen) override; + virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, + uint8_t **buffer, size_t *size) override; + +private: + + struct SpiInstance { + SpiInstance(size_t maxRecvSize): replyBuffer(std::vector(maxRecvSize)) {} + std::vector replyBuffer; + size_t currentTransferLen = 0; + }; + + struct IrqArgs { + SpiComIF* comIF = nullptr; + SpiCookie* spiCookie = nullptr; + }; + + IrqArgs irqArgs; + + uint32_t defaultPollingTimeout = 50; + + SemaphoreIF::TimeoutType timeoutType = SemaphoreIF::TimeoutType::WAITING; + dur_millis_t timeoutMs = 20; + + BinarySemaphore* spiSemaphore = nullptr; + bool cacheMaintenanceOnTxBuffer = true; + + using SpiDeviceMap = std::map; + using SpiDeviceMapIter = SpiDeviceMap::iterator; + + uint8_t* currentRecvPtr = nullptr; + size_t currentRecvBuffSize = 0; + + SpiDeviceMap spiDeviceMap; + + ReturnValue_t handlePollingSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen); + ReturnValue_t handleInterruptSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen); + ReturnValue_t handleDmaSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen); + ReturnValue_t handleIrqSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen); + ReturnValue_t genericIrqSendSetup(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen); + ReturnValue_t halErrorHandler(HAL_StatusTypeDef status, spi::TransferModes transferMode); + + static void spiTransferTxCompleteCallback(SPI_HandleTypeDef *hspi, void* args); + static void spiTransferRxCompleteCallback(SPI_HandleTypeDef *hspi, void* args); + static void spiTransferCompleteCallback(SPI_HandleTypeDef *hspi, void* args); + static void spiTransferErrorCallback(SPI_HandleTypeDef *hspi, void* args); + + static void genericIrqHandler(void* irqArgs, spi::TransferStates targetState); + + void printCfgError(const char* const type); +}; + + + +#endif /* FSFW_HAL_STM32H7_SPI_SPICOMIF_H_ */ diff --git a/hal/src/fsfw/hal/stm32h7/spi/SpiCookie.cpp b/hal/src/fsfw/hal/stm32h7/spi/SpiCookie.cpp new file mode 100644 index 00000000..82d705c2 --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/SpiCookie.cpp @@ -0,0 +1,78 @@ +#include "fsfw/hal/stm32h7/spi/SpiCookie.h" + + +SpiCookie::SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode, + spi::MspCfgBase* mspCfg, uint32_t spiSpeed, spi::SpiModes spiMode, + uint16_t chipSelectGpioPin, GPIO_TypeDef* chipSelectGpioPort, size_t maxRecvSize): + deviceAddress(deviceAddress), spiIdx(spiIdx), spiSpeed(spiSpeed), spiMode(spiMode), + transferMode(transferMode), chipSelectGpioPin(chipSelectGpioPin), + chipSelectGpioPort(chipSelectGpioPort), mspCfg(mspCfg), maxRecvSize(maxRecvSize) { + spiHandle.Init.DataSize = SPI_DATASIZE_8BIT; + spiHandle.Init.FirstBit = SPI_FIRSTBIT_MSB; + spiHandle.Init.TIMode = SPI_TIMODE_DISABLE; + spiHandle.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; + spiHandle.Init.CRCPolynomial = 7; + spiHandle.Init.CRCLength = SPI_CRC_LENGTH_8BIT; + spiHandle.Init.NSS = SPI_NSS_SOFT; + spiHandle.Init.NSSPMode = SPI_NSS_PULSE_DISABLE; + spiHandle.Init.Direction = SPI_DIRECTION_2LINES; + // Recommended setting to avoid glitches + spiHandle.Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_ENABLE; + spiHandle.Init.Mode = SPI_MODE_MASTER; + spi::assignSpiMode(spiMode, spiHandle); + spiHandle.Init.BaudRatePrescaler = spi::getPrescaler(HAL_RCC_GetHCLKFreq(), spiSpeed); +} + +uint16_t SpiCookie::getChipSelectGpioPin() const { + return chipSelectGpioPin; +} + +GPIO_TypeDef* SpiCookie::getChipSelectGpioPort() { + return chipSelectGpioPort; +} + +address_t SpiCookie::getDeviceAddress() const { + return deviceAddress; +} + +spi::SpiBus SpiCookie::getSpiIdx() const { + return spiIdx; +} + +spi::SpiModes SpiCookie::getSpiMode() const { + return spiMode; +} + +uint32_t SpiCookie::getSpiSpeed() const { + return spiSpeed; +} + +size_t SpiCookie::getMaxRecvSize() const { + return maxRecvSize; +} + +SPI_HandleTypeDef& SpiCookie::getSpiHandle() { + return spiHandle; +} + +spi::MspCfgBase* SpiCookie::getMspCfg() { + return mspCfg; +} + +void SpiCookie::deleteMspCfg() { + if(mspCfg != nullptr) { + delete mspCfg; + } +} + +spi::TransferModes SpiCookie::getTransferMode() const { + return transferMode; +} + +void SpiCookie::setTransferState(spi::TransferStates transferState) { + this->transferState = transferState; +} + +spi::TransferStates SpiCookie::getTransferState() const { + return this->transferState; +} diff --git a/hal/src/fsfw/hal/stm32h7/spi/SpiCookie.h b/hal/src/fsfw/hal/stm32h7/spi/SpiCookie.h new file mode 100644 index 00000000..45226b4a --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/SpiCookie.h @@ -0,0 +1,75 @@ +#ifndef FSFW_HAL_STM32H7_SPI_SPICOOKIE_H_ +#define FSFW_HAL_STM32H7_SPI_SPICOOKIE_H_ + +#include "spiDefinitions.h" +#include "mspInit.h" + +#include "fsfw/devicehandlers/CookieIF.h" + +#include "stm32h743xx.h" + +/** + * @brief SPI cookie implementation for the STM32H7 device family + * @details + * This cookie contains and caches device specific information to be used by the + * SPI communication interface + * @author R. Mueller + */ +class SpiCookie: public CookieIF { + friend class SpiComIF; +public: + /** + * Allows construction of a SPI cookie for a connected SPI device + * @param deviceAddress + * @param spiIdx SPI bus, e.g. SPI1 or SPI2 + * @param transferMode + * @param mspCfg This is the MSP configuration. The user is expected to supply + * a valid MSP configuration. See mspInit.h for functions + * to create one. + * @param spiSpeed + * @param spiMode + * @param chipSelectGpioPin GPIO port. Don't use a number here, use the 16 bit type + * definitions supplied in the MCU header file! (e.g. GPIO_PIN_X) + * @param chipSelectGpioPort GPIO port (e.g. GPIOA) + * @param maxRecvSize Maximum expected receive size. Chose as small as possible. + */ + SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode, + spi::MspCfgBase* mspCfg, uint32_t spiSpeed, spi::SpiModes spiMode, + uint16_t chipSelectGpioPin, GPIO_TypeDef* chipSelectGpioPort, size_t maxRecvSize); + + uint16_t getChipSelectGpioPin() const; + GPIO_TypeDef* getChipSelectGpioPort(); + address_t getDeviceAddress() const; + spi::SpiBus getSpiIdx() const; + spi::SpiModes getSpiMode() const; + spi::TransferModes getTransferMode() const; + uint32_t getSpiSpeed() const; + size_t getMaxRecvSize() const; + SPI_HandleTypeDef& getSpiHandle(); + +private: + address_t deviceAddress; + SPI_HandleTypeDef spiHandle = {}; + spi::SpiBus spiIdx; + uint32_t spiSpeed; + spi::SpiModes spiMode; + spi::TransferModes transferMode; + volatile spi::TransferStates transferState = spi::TransferStates::IDLE; + uint16_t chipSelectGpioPin; + GPIO_TypeDef* chipSelectGpioPort; + // The MSP configuration is cached here. Be careful when using this, it is automatically + // deleted by the SPI communication interface if it is not required anymore! + spi::MspCfgBase* mspCfg = nullptr; + const size_t maxRecvSize; + + // Only the SpiComIF is allowed to use this to prevent dangling pointers issues + spi::MspCfgBase* getMspCfg(); + void deleteMspCfg(); + + void setTransferState(spi::TransferStates transferState); + spi::TransferStates getTransferState() const; +}; + + + +#endif /* FSFW_HAL_STM32H7_SPI_SPICOOKIE_H_ */ diff --git a/hal/src/fsfw/hal/stm32h7/spi/mspInit.cpp b/hal/src/fsfw/hal/stm32h7/spi/mspInit.cpp new file mode 100644 index 00000000..424a8bfb --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/mspInit.cpp @@ -0,0 +1,253 @@ +#include "fsfw/hal/stm32h7/dma.h" +#include "fsfw/hal/stm32h7/spi/mspInit.h" +#include "fsfw/hal/stm32h7/spi/spiCore.h" +#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" + +#include "stm32h743xx.h" +#include "stm32h7xx_hal_spi.h" +#include "stm32h7xx_hal_dma.h" +#include "stm32h7xx_hal_def.h" + +#include + +spi::msp_func_t mspInitFunc = nullptr; +spi::MspCfgBase* mspInitArgs = nullptr; + +spi::msp_func_t mspDeinitFunc = nullptr; +spi::MspCfgBase* mspDeinitArgs = nullptr; + +/** + * @brief SPI MSP Initialization + * This function configures the hardware resources used in this example: + * - Peripheral's clock enable + * - Peripheral's GPIO Configuration + * - DMA configuration for transmission request by peripheral + * - NVIC configuration for DMA interrupt request enable + * @param hspi: SPI handle pointer + * @retval None + */ +void spi::halMspInitDma(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { + auto cfg = dynamic_cast(cfgBase); + if(hspi == nullptr or cfg == nullptr) { + return; + } + setSpiHandle(hspi); + + DMA_HandleTypeDef* hdma_tx = nullptr; + DMA_HandleTypeDef* hdma_rx = nullptr; + spi::getDmaHandles(&hdma_tx, &hdma_rx); + if(hdma_tx == nullptr or hdma_rx == nullptr) { + printf("HAL_SPI_MspInit: Invalid DMA handles. Make sure to call setDmaHandles!\n"); + return; + } + + spi::halMspInitInterrupt(hspi, cfg); + + // DMA setup + if(cfg->dmaClkEnableWrapper == nullptr) { + mspErrorHandler("spi::halMspInitDma", "DMA Clock init invalid"); + } + cfg->dmaClkEnableWrapper(); + + // Configure the DMA + /* Configure the DMA handler for Transmission process */ + if(hdma_tx->Instance == nullptr) { + // Assume it was not configured properly + mspErrorHandler("spi::halMspInitDma", "DMA TX handle invalid"); + } + + HAL_DMA_Init(hdma_tx); + /* Associate the initialized DMA handle to the the SPI handle */ + __HAL_LINKDMA(hspi, hdmatx, *hdma_tx); + + HAL_DMA_Init(hdma_rx); + /* Associate the initialized DMA handle to the the SPI handle */ + __HAL_LINKDMA(hspi, hdmarx, *hdma_rx); + + /*##-4- Configure the NVIC for DMA #########################################*/ + /* NVIC configuration for DMA transfer complete interrupt (SPI1_RX) */ + // Assign the interrupt handler + dma::assignDmaUserHandler(cfg->rxDmaIndex, cfg->rxDmaStream, &spi::dmaRxIrqHandler, hdma_rx); + HAL_NVIC_SetPriority(cfg->rxDmaIrqNumber, cfg->rxPreEmptPriority, cfg->rxSubpriority); + HAL_NVIC_EnableIRQ(cfg->rxDmaIrqNumber); + + /* NVIC configuration for DMA transfer complete interrupt (SPI1_TX) */ + // Assign the interrupt handler + dma::assignDmaUserHandler(cfg->txDmaIndex, cfg->txDmaStream, + &spi::dmaTxIrqHandler, hdma_tx); + HAL_NVIC_SetPriority(cfg->txDmaIrqNumber, cfg->txPreEmptPriority, cfg->txSubpriority); + HAL_NVIC_EnableIRQ(cfg->txDmaIrqNumber); +} + +/** + * @brief SPI MSP De-Initialization + * This function frees the hardware resources used in this example: + * - Disable the Peripheral's clock + * - Revert GPIO, DMA and NVIC configuration to their default state + * @param hspi: SPI handle pointer + * @retval None + */ +void spi::halMspDeinitDma(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { + auto cfg = dynamic_cast(cfgBase); + if(hspi == nullptr or cfg == nullptr) { + return; + } + spi::halMspDeinitInterrupt(hspi, cfgBase); + DMA_HandleTypeDef* hdma_tx = NULL; + DMA_HandleTypeDef* hdma_rx = NULL; + spi::getDmaHandles(&hdma_tx, &hdma_rx); + if(hdma_tx == NULL || hdma_rx == NULL) { + printf("HAL_SPI_MspInit: Invalid DMA handles. Make sure to call setDmaHandles!\n"); + } + else { + // Disable the DMA + /* De-Initialize the DMA associated to transmission process */ + HAL_DMA_DeInit(hdma_tx); + /* De-Initialize the DMA associated to reception process */ + HAL_DMA_DeInit(hdma_rx); + } + + // Disable the NVIC for DMA + HAL_NVIC_DisableIRQ(cfg->txDmaIrqNumber); + HAL_NVIC_DisableIRQ(cfg->rxDmaIrqNumber); + +} + +void spi::halMspInitPolling(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { + auto cfg = dynamic_cast(cfgBase); + GPIO_InitTypeDef GPIO_InitStruct = {}; + /*##-1- Enable peripherals and GPIO Clocks #################################*/ + /* Enable GPIO TX/RX clock */ + cfg->setupMacroWrapper(); + + /*##-2- Configure peripheral GPIO ##########################################*/ + /* SPI SCK GPIO pin configuration */ + GPIO_InitStruct.Pin = cfg->sckPin; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_PULLDOWN; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.Alternate = cfg->sckAlternateFunction; + HAL_GPIO_Init(cfg->sckPort, &GPIO_InitStruct); + + /* SPI MISO GPIO pin configuration */ + GPIO_InitStruct.Pin = cfg->misoPin; + GPIO_InitStruct.Alternate = cfg->misoAlternateFunction; + HAL_GPIO_Init(cfg->misoPort, &GPIO_InitStruct); + + /* SPI MOSI GPIO pin configuration */ + GPIO_InitStruct.Pin = cfg->mosiPin; + GPIO_InitStruct.Alternate = cfg->mosiAlternateFunction; + HAL_GPIO_Init(cfg->mosiPort, &GPIO_InitStruct); +} + +void spi::halMspDeinitPolling(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { + auto cfg = reinterpret_cast(cfgBase); + // Reset peripherals + cfg->cleanUpMacroWrapper(); + + // Disable peripherals and GPIO Clocks + /* Configure SPI SCK as alternate function */ + HAL_GPIO_DeInit(cfg->sckPort, cfg->sckPin); + /* Configure SPI MISO as alternate function */ + HAL_GPIO_DeInit(cfg->misoPort, cfg->misoPin); + /* Configure SPI MOSI as alternate function */ + HAL_GPIO_DeInit(cfg->mosiPort, cfg->mosiPin); +} + +void spi::halMspInitInterrupt(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { + auto cfg = dynamic_cast(cfgBase); + if(cfg == nullptr or hspi == nullptr) { + return; + } + + spi::halMspInitPolling(hspi, cfg); + // Configure the NVIC for SPI + spi::assignSpiUserHandler(cfg->spiBus, cfg->spiIrqHandler, cfg->spiUserArgs); + HAL_NVIC_SetPriority(cfg->spiIrqNumber, cfg->preEmptPriority, cfg->subpriority); + HAL_NVIC_EnableIRQ(cfg->spiIrqNumber); +} + +void spi::halMspDeinitInterrupt(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { + auto cfg = dynamic_cast(cfgBase); + spi::halMspDeinitPolling(hspi, cfg); + // Disable the NVIC for SPI + HAL_NVIC_DisableIRQ(cfg->spiIrqNumber); +} + +void spi::getMspInitFunction(msp_func_t* init_func, MspCfgBase** args) { + if(init_func != NULL && args != NULL) { + *init_func = mspInitFunc; + *args = mspInitArgs; + } +} + +void spi::getMspDeinitFunction(msp_func_t* deinit_func, MspCfgBase** args) { + if(deinit_func != NULL && args != NULL) { + *deinit_func = mspDeinitFunc; + *args = mspDeinitArgs; + } +} + +void spi::setSpiDmaMspFunctions(MspDmaConfigStruct* cfg, + msp_func_t initFunc, msp_func_t deinitFunc) { + mspInitFunc = initFunc; + mspDeinitFunc = deinitFunc; + mspInitArgs = cfg; + mspDeinitArgs = cfg; +} + +void spi::setSpiIrqMspFunctions(MspIrqConfigStruct *cfg, msp_func_t initFunc, + msp_func_t deinitFunc) { + mspInitFunc = initFunc; + mspDeinitFunc = deinitFunc; + mspInitArgs = cfg; + mspDeinitArgs = cfg; +} + +void spi::setSpiPollingMspFunctions(MspPollingConfigStruct *cfg, msp_func_t initFunc, + msp_func_t deinitFunc) { + mspInitFunc = initFunc; + mspDeinitFunc = deinitFunc; + mspInitArgs = cfg; + mspDeinitArgs = cfg; +} + +/** + * @brief SPI MSP Initialization + * This function configures the hardware resources used in this example: + * - Peripheral's clock enable + * - Peripheral's GPIO Configuration + * - DMA configuration for transmission request by peripheral + * - NVIC configuration for DMA interrupt request enable + * @param hspi: SPI handle pointer + * @retval None + */ +extern "C" void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi) { + if(mspInitFunc != NULL) { + mspInitFunc(hspi, mspInitArgs); + } + else { + printf("HAL_SPI_MspInit: Please call set_msp_functions to assign SPI MSP functions\n"); + } +} + +/** + * @brief SPI MSP De-Initialization + * This function frees the hardware resources used in this example: + * - Disable the Peripheral's clock + * - Revert GPIO, DMA and NVIC configuration to their default state + * @param hspi: SPI handle pointer + * @retval None + */ +extern "C" void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) { + if(mspDeinitFunc != NULL) { + mspDeinitFunc(hspi, mspDeinitArgs); + } + else { + printf("HAL_SPI_MspDeInit: Please call set_msp_functions to assign SPI MSP functions\n"); + } +} + +void spi::mspErrorHandler(const char* const function, const char *const message) { + printf("%s failure: %s\n", function, message); +} diff --git a/hal/src/fsfw/hal/stm32h7/spi/mspInit.h b/hal/src/fsfw/hal/stm32h7/spi/mspInit.h new file mode 100644 index 00000000..e6de2f8e --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/mspInit.h @@ -0,0 +1,114 @@ +#ifndef FSFW_HAL_STM32H7_SPI_MSPINIT_H_ +#define FSFW_HAL_STM32H7_SPI_MSPINIT_H_ + +#include "spiDefinitions.h" +#include "../dma.h" + +#include "stm32h7xx_hal_spi.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief This file provides MSP implementation for DMA, IRQ and Polling mode for the + * SPI peripheral. This configuration is required for the SPI communication to work. + */ +namespace spi { + +struct MspCfgBase { + virtual ~MspCfgBase() = default; + + void (* cleanUpMacroWrapper) (void) = nullptr; + void (* setupMacroWrapper) (void) = nullptr; + + GPIO_TypeDef* sckPort = nullptr; + uint32_t sckPin = 0; + uint8_t sckAlternateFunction = 0; + GPIO_TypeDef* mosiPort = nullptr; + uint32_t mosiPin = 0; + uint8_t mosiAlternateFunction = 0; + GPIO_TypeDef* misoPort = nullptr; + uint32_t misoPin = 0; + uint8_t misoAlternateFunction = 0; +}; + +struct MspPollingConfigStruct: public MspCfgBase {}; + +/* A valid instance of this struct must be passed to the MSP initialization function as a void* +argument */ +struct MspIrqConfigStruct: public MspPollingConfigStruct { + SpiBus spiBus = SpiBus::SPI_1; + user_handler_t spiIrqHandler = nullptr; + user_args_t spiUserArgs = nullptr; + IRQn_Type spiIrqNumber = SPI1_IRQn; + // Priorities for NVIC + // Pre-Empt priority ranging from 0 to 15. If FreeRTOS calls are used, only 5-15 are allowed + IrqPriorities preEmptPriority = IrqPriorities::LOWEST; + IrqPriorities subpriority = IrqPriorities::LOWEST; +}; + +/* A valid instance of this struct must be passed to the MSP initialization function as a void* +argument */ +struct MspDmaConfigStruct: public MspIrqConfigStruct { + void (* dmaClkEnableWrapper) (void) = nullptr; + dma::DMAIndexes txDmaIndex; + dma::DMAIndexes rxDmaIndex; + dma::DMAStreams txDmaStream; + dma::DMAStreams rxDmaStream; + IRQn_Type txDmaIrqNumber = DMA1_Stream0_IRQn; + IRQn_Type rxDmaIrqNumber = DMA1_Stream1_IRQn; + // Priorities for NVIC + IrqPriorities txPreEmptPriority = IrqPriorities::LOWEST; + IrqPriorities rxPreEmptPriority = IrqPriorities::LOWEST; + IrqPriorities txSubpriority = IrqPriorities::LOWEST; + IrqPriorities rxSubpriority = IrqPriorities::LOWEST; +}; + +using msp_func_t = void (*) (SPI_HandleTypeDef* hspi, MspCfgBase* cfg); + + +void getMspInitFunction(msp_func_t* init_func, MspCfgBase **args); +void getMspDeinitFunction(msp_func_t* deinit_func, MspCfgBase **args); + +void halMspInitDma(SPI_HandleTypeDef* hspi, MspCfgBase* cfg); +void halMspDeinitDma(SPI_HandleTypeDef* hspi, MspCfgBase* cfg); + +void halMspInitInterrupt(SPI_HandleTypeDef* hspi, MspCfgBase* cfg); +void halMspDeinitInterrupt(SPI_HandleTypeDef* hspi, MspCfgBase* cfg); + +void halMspInitPolling(SPI_HandleTypeDef* hspi, MspCfgBase* cfg); +void halMspDeinitPolling(SPI_HandleTypeDef* hspi, MspCfgBase* cfg); + +/** + * Assign MSP init functions. Important for SPI configuration + * @param init_func + * @param init_args + * @param deinit_func + * @param deinit_args + */ +void setSpiDmaMspFunctions(MspDmaConfigStruct* cfg, + msp_func_t initFunc = &spi::halMspInitDma, + msp_func_t deinitFunc= &spi::halMspDeinitDma +); +void setSpiIrqMspFunctions(MspIrqConfigStruct* cfg, + msp_func_t initFunc = &spi::halMspInitInterrupt, + msp_func_t deinitFunc= &spi::halMspDeinitInterrupt +); +void setSpiPollingMspFunctions(MspPollingConfigStruct* cfg, + msp_func_t initFunc = &spi::halMspInitPolling, + msp_func_t deinitFunc= &spi::halMspDeinitPolling +); + +void mspErrorHandler(const char* const function, const char *const message); + +} + + +#ifdef __cplusplus +} +#endif + +#endif /* FSFW_HAL_STM32H7_SPI_MSPINIT_H_ */ diff --git a/hal/src/fsfw/hal/stm32h7/spi/spiCore.cpp b/hal/src/fsfw/hal/stm32h7/spi/spiCore.cpp new file mode 100644 index 00000000..a72bf12b --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/spiCore.cpp @@ -0,0 +1,341 @@ +#include "fsfw/hal/stm32h7/spi/spiCore.h" +#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" + +#include + +SPI_HandleTypeDef* spiHandle = nullptr; +DMA_HandleTypeDef* hdmaTx = nullptr; +DMA_HandleTypeDef* hdmaRx = nullptr; + +spi_transfer_cb_t rxTxCb = nullptr; +void* rxTxArgs = nullptr; +spi_transfer_cb_t txCb = nullptr; +void* txArgs = nullptr; +spi_transfer_cb_t rxCb = nullptr; +void* rxArgs = nullptr; +spi_transfer_cb_t errorCb = nullptr; +void* errorArgs = nullptr; + +void mapIndexAndStream(DMA_HandleTypeDef* handle, dma::DMAType dmaType, dma::DMAIndexes dmaIdx, + dma::DMAStreams dmaStream, IRQn_Type* dmaIrqNumber); +void mapSpiBus(DMA_HandleTypeDef *handle, dma::DMAType dmaType, spi::SpiBus spiBus); + +void spi::configureDmaHandle(DMA_HandleTypeDef *handle, spi::SpiBus spiBus, dma::DMAType dmaType, + dma::DMAIndexes dmaIdx, dma::DMAStreams dmaStream, IRQn_Type* dmaIrqNumber, + uint32_t dmaMode, uint32_t dmaPriority) { + using namespace dma; + mapIndexAndStream(handle, dmaType, dmaIdx, dmaStream, dmaIrqNumber); + mapSpiBus(handle, dmaType, spiBus); + + if(dmaType == DMAType::TX) { + handle->Init.Direction = DMA_MEMORY_TO_PERIPH; + } + else { + handle->Init.Direction = DMA_PERIPH_TO_MEMORY; + } + + handle->Init.Priority = dmaPriority; + handle->Init.Mode = dmaMode; + + // Standard settings for the rest for now + handle->Init.FIFOMode = DMA_FIFOMODE_DISABLE; + handle->Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL; + handle->Init.MemBurst = DMA_MBURST_INC4; + handle->Init.PeriphBurst = DMA_PBURST_INC4; + handle->Init.PeriphInc = DMA_PINC_DISABLE; + handle->Init.MemInc = DMA_MINC_ENABLE; + handle->Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE; + handle->Init.MemDataAlignment = DMA_MDATAALIGN_BYTE; +} + +void spi::setDmaHandles(DMA_HandleTypeDef* txHandle, DMA_HandleTypeDef* rxHandle) { + hdmaTx = txHandle; + hdmaRx = rxHandle; +} + +void spi::getDmaHandles(DMA_HandleTypeDef** txHandle, DMA_HandleTypeDef** rxHandle) { + *txHandle = hdmaTx; + *rxHandle = hdmaRx; +} + +void spi::setSpiHandle(SPI_HandleTypeDef *spiHandle_) { + if(spiHandle_ == NULL) { + return; + } + spiHandle = spiHandle_; +} + +void spi::assignTransferRxTxCompleteCallback(spi_transfer_cb_t callback, void *userArgs) { + rxTxCb = callback; + rxTxArgs = userArgs; +} + +void spi::assignTransferRxCompleteCallback(spi_transfer_cb_t callback, void *userArgs) { + rxCb = callback; + rxArgs = userArgs; +} + +void spi::assignTransferTxCompleteCallback(spi_transfer_cb_t callback, void *userArgs) { + txCb = callback; + txArgs = userArgs; +} + +void spi::assignTransferErrorCallback(spi_transfer_cb_t callback, void *userArgs) { + errorCb = callback; + errorArgs = userArgs; +} + +SPI_HandleTypeDef* spi::getSpiHandle() { + return spiHandle; +} + + + +/** + * @brief TxRx Transfer completed callback. + * @param hspi: SPI handle + */ +extern "C" void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi) { + if(rxTxCb != NULL) { + rxTxCb(hspi, rxTxArgs); + } + else { + printf("HAL_SPI_TxRxCpltCallback: No user callback specified\n"); + } +} + +/** + * @brief TxRx Transfer completed callback. + * @param hspi: SPI handle + */ +extern "C" void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) { + if(txCb != NULL) { + txCb(hspi, txArgs); + } + else { + printf("HAL_SPI_TxCpltCallback: No user callback specified\n"); + } +} + +/** + * @brief TxRx Transfer completed callback. + * @param hspi: SPI handle + */ +extern "C" void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi) { + if(rxCb != nullptr) { + rxCb(hspi, rxArgs); + } + else { + printf("HAL_SPI_RxCpltCallback: No user callback specified\n"); + } +} + +/** + * @brief SPI error callbacks. + * @param hspi: SPI handle + * @note This example shows a simple way to report transfer error, and you can + * add your own implementation. + * @retval None + */ +extern "C" void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi) { + if(errorCb != nullptr) { + errorCb(hspi, rxArgs); + } + else { + printf("HAL_SPI_ErrorCallback: No user callback specified\n"); + } +} + +void mapIndexAndStream(DMA_HandleTypeDef* handle, dma::DMAType dmaType, dma::DMAIndexes dmaIdx, + dma::DMAStreams dmaStream, IRQn_Type* dmaIrqNumber) { + using namespace dma; + if(dmaIdx == DMAIndexes::DMA_1) { +#ifdef DMA1 + switch(dmaStream) { + case(DMAStreams::STREAM_0): { +#ifdef DMA1_Stream0 + handle->Instance = DMA1_Stream0; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream0_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_1): { +#ifdef DMA1_Stream1 + handle->Instance = DMA1_Stream1; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream1_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_2): { +#ifdef DMA1_Stream2 + handle->Instance = DMA1_Stream2; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream2_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_3): { +#ifdef DMA1_Stream3 + handle->Instance = DMA1_Stream3; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream3_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_4): { +#ifdef DMA1_Stream4 + handle->Instance = DMA1_Stream4; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream4_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_5): { +#ifdef DMA1_Stream5 + handle->Instance = DMA1_Stream5; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream5_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_6): { +#ifdef DMA1_Stream6 + handle->Instance = DMA1_Stream6; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream6_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_7): { +#ifdef DMA1_Stream7 + handle->Instance = DMA1_Stream7; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream7_IRQn; + } +#endif + break; + } + } + if(dmaType == DMAType::TX) { + handle->Init.Request = DMA_REQUEST_SPI1_TX; + } + else { + handle->Init.Request = DMA_REQUEST_SPI1_RX; + } +#endif /* DMA1 */ + } + if(dmaIdx == DMAIndexes::DMA_2) { +#ifdef DMA2 + switch(dmaStream) { + case(DMAStreams::STREAM_0): { +#ifdef DMA2_Stream0 + handle->Instance = DMA2_Stream0; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream0_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_1): { +#ifdef DMA2_Stream1 + handle->Instance = DMA2_Stream1; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream1_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_2): { +#ifdef DMA2_Stream2 + handle->Instance = DMA2_Stream2; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream2_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_3): { +#ifdef DMA2_Stream3 + handle->Instance = DMA2_Stream3; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream3_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_4): { +#ifdef DMA2_Stream4 + handle->Instance = DMA2_Stream4; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream4_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_5): { +#ifdef DMA2_Stream5 + handle->Instance = DMA2_Stream5; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream5_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_6): { +#ifdef DMA2_Stream6 + handle->Instance = DMA2_Stream6; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream6_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_7): { +#ifdef DMA2_Stream7 + handle->Instance = DMA2_Stream7; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream7_IRQn; + } +#endif + break; + } + } +#endif /* DMA2 */ + } +} + +void mapSpiBus(DMA_HandleTypeDef *handle, dma::DMAType dmaType, spi::SpiBus spiBus) { + if(dmaType == dma::DMAType::TX) { + if(spiBus == spi::SpiBus::SPI_1) { +#ifdef DMA_REQUEST_SPI1_TX + handle->Init.Request = DMA_REQUEST_SPI1_TX; +#endif + } + else if(spiBus == spi::SpiBus::SPI_2) { +#ifdef DMA_REQUEST_SPI2_TX + handle->Init.Request = DMA_REQUEST_SPI2_TX; +#endif + } + } + else { + if(spiBus == spi::SpiBus::SPI_1) { +#ifdef DMA_REQUEST_SPI1_RX + handle->Init.Request = DMA_REQUEST_SPI1_RX; +#endif + } + else if(spiBus == spi::SpiBus::SPI_2) { +#ifdef DMA_REQUEST_SPI2_RX + handle->Init.Request = DMA_REQUEST_SPI2_RX; +#endif + } + } +} diff --git a/hal/src/fsfw/hal/stm32h7/spi/spiCore.h b/hal/src/fsfw/hal/stm32h7/spi/spiCore.h new file mode 100644 index 00000000..bff90a5b --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/spiCore.h @@ -0,0 +1,54 @@ +#ifndef FSFW_HAL_STM32H7_SPI_SPICORE_H_ +#define FSFW_HAL_STM32H7_SPI_SPICORE_H_ + +#include "fsfw/hal/stm32h7/dma.h" +#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" + +#include "stm32h7xx_hal.h" +#include "stm32h7xx_hal_dma.h" + +#ifdef __cplusplus +extern "C" { +#endif + +using spi_transfer_cb_t = void (*) (SPI_HandleTypeDef *hspi, void* userArgs); + +namespace spi { + +void configureDmaHandle(DMA_HandleTypeDef* handle, spi::SpiBus spiBus, + dma::DMAType dmaType, dma::DMAIndexes dmaIdx, + dma::DMAStreams dmaStream, IRQn_Type* dmaIrqNumber, uint32_t dmaMode = DMA_NORMAL, + uint32_t dmaPriority = DMA_PRIORITY_LOW); + +/** + * Assign DMA handles. Required to use DMA for SPI transfers. + * @param txHandle + * @param rxHandle + */ +void setDmaHandles(DMA_HandleTypeDef* txHandle, DMA_HandleTypeDef* rxHandle); +void getDmaHandles(DMA_HandleTypeDef** txHandle, DMA_HandleTypeDef** rxHandle); + +/** + * Assign SPI handle. Needs to be done before using the SPI + * @param spiHandle + */ +void setSpiHandle(SPI_HandleTypeDef *spiHandle); + +void assignTransferRxTxCompleteCallback(spi_transfer_cb_t callback, void* userArgs); +void assignTransferRxCompleteCallback(spi_transfer_cb_t callback, void* userArgs); +void assignTransferTxCompleteCallback(spi_transfer_cb_t callback, void* userArgs); +void assignTransferErrorCallback(spi_transfer_cb_t callback, void* userArgs); + +/** + * Get the assigned SPI handle. + * @return + */ +SPI_HandleTypeDef* getSpiHandle(); + +} + +#ifdef __cplusplus +} +#endif + +#endif /* FSFW_HAL_STM32H7_SPI_SPICORE_H_ */ diff --git a/hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.cpp b/hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.cpp new file mode 100644 index 00000000..6a83ae42 --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.cpp @@ -0,0 +1,52 @@ +#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" + +void spi::assignSpiMode(SpiModes spiMode, SPI_HandleTypeDef& spiHandle) { + switch(spiMode) { + case(SpiModes::MODE_0): { + spiHandle.Init.CLKPolarity = SPI_POLARITY_LOW; + spiHandle.Init.CLKPhase = SPI_PHASE_1EDGE; + break; + } + case(SpiModes::MODE_1): { + spiHandle.Init.CLKPolarity = SPI_POLARITY_LOW; + spiHandle.Init.CLKPhase = SPI_PHASE_2EDGE; + break; + } + case(SpiModes::MODE_2): { + spiHandle.Init.CLKPolarity = SPI_POLARITY_HIGH; + spiHandle.Init.CLKPhase = SPI_PHASE_1EDGE; + break; + } + case(SpiModes::MODE_3): { + spiHandle.Init.CLKPolarity = SPI_POLARITY_HIGH; + spiHandle.Init.CLKPhase = SPI_PHASE_2EDGE; + break; + } + } +} + +uint32_t spi::getPrescaler(uint32_t clock_src_freq, uint32_t baudrate_mbps) { + uint32_t divisor = 0; + uint32_t spi_clk = clock_src_freq; + uint32_t presc = 0; + static const uint32_t baudrate[] = { + SPI_BAUDRATEPRESCALER_2, + SPI_BAUDRATEPRESCALER_4, + SPI_BAUDRATEPRESCALER_8, + SPI_BAUDRATEPRESCALER_16, + SPI_BAUDRATEPRESCALER_32, + SPI_BAUDRATEPRESCALER_64, + SPI_BAUDRATEPRESCALER_128, + SPI_BAUDRATEPRESCALER_256, + }; + + while( spi_clk > baudrate_mbps) { + presc = baudrate[divisor]; + if (++divisor > 7) + break; + + spi_clk = ( spi_clk >> 1); + } + + return presc; +} diff --git a/hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.h b/hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.h new file mode 100644 index 00000000..772bf32d --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.h @@ -0,0 +1,50 @@ +#ifndef FSFW_HAL_STM32H7_SPI_SPIDEFINITIONS_H_ +#define FSFW_HAL_STM32H7_SPI_SPIDEFINITIONS_H_ + +#include "../../common/spi/spiCommon.h" + +#include "fsfw/returnvalues/FwClassIds.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" + +#include "stm32h7xx_hal.h" +#include "stm32h7xx_hal_spi.h" + +namespace spi { + +static constexpr uint8_t HAL_SPI_ID = CLASS_ID::HAL_SPI; +static constexpr ReturnValue_t HAL_TIMEOUT_RETVAL = HasReturnvaluesIF::makeReturnCode(HAL_SPI_ID, 0); +static constexpr ReturnValue_t HAL_BUSY_RETVAL = HasReturnvaluesIF::makeReturnCode(HAL_SPI_ID, 1); +static constexpr ReturnValue_t HAL_ERROR_RETVAL = HasReturnvaluesIF::makeReturnCode(HAL_SPI_ID, 2); + +enum class TransferStates { + IDLE, + WAIT, + SUCCESS, + FAILURE +}; + +enum SpiBus { + SPI_1, + SPI_2 +}; + +enum TransferModes { + POLLING, + INTERRUPT, + DMA +}; + +void assignSpiMode(SpiModes spiMode, SPI_HandleTypeDef& spiHandle); + +/** + * @brief Set SPI frequency to calculate correspondent baud-rate prescaler. + * @param clock_src_freq Frequency of clock source + * @param baudrate_mbps Baudrate to set to set + * @retval Baudrate prescaler + */ +uint32_t getPrescaler(uint32_t clock_src_freq, uint32_t baudrate_mbps); + +} + + +#endif /* FSFW_HAL_STM32H7_SPI_SPIDEFINITIONS_H_ */ diff --git a/hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.cpp b/hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.cpp new file mode 100644 index 00000000..90cfe706 --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.cpp @@ -0,0 +1,106 @@ +#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw/hal/stm32h7/spi/spiCore.h" + +#include "stm32h7xx_hal.h" +#include "stm32h7xx_hal_dma.h" +#include "stm32h7xx_hal_spi.h" + +#include + +user_handler_t spi1UserHandler = &spi::spiIrqHandler; +user_args_t spi1UserArgs = nullptr; + +user_handler_t spi2UserHandler = &spi::spiIrqHandler; +user_args_t spi2UserArgs = nullptr; + +/** + * @brief This function handles DMA Rx interrupt request. + * @param None + * @retval None + */ +void spi::dmaRxIrqHandler(void* dmaHandle) { + if(dmaHandle == nullptr) { + return; + } + HAL_DMA_IRQHandler((DMA_HandleTypeDef *) dmaHandle); +} + +/** + * @brief This function handles DMA Rx interrupt request. + * @param None + * @retval None + */ +void spi::dmaTxIrqHandler(void* dmaHandle) { + if(dmaHandle == nullptr) { + return; + } + HAL_DMA_IRQHandler((DMA_HandleTypeDef *) dmaHandle); +} + +/** + * @brief This function handles SPIx interrupt request. + * @param None + * @retval None + */ +void spi::spiIrqHandler(void* spiHandle) { + if(spiHandle == nullptr) { + return; + } + //auto currentSpiHandle = spi::getSpiHandle(); + HAL_SPI_IRQHandler((SPI_HandleTypeDef *) spiHandle); +} + +void spi::assignSpiUserHandler(spi::SpiBus spiIdx, user_handler_t userHandler, + user_args_t userArgs) { + if(spiIdx == spi::SpiBus::SPI_1) { + spi1UserHandler = userHandler; + spi1UserArgs = userArgs; + } + else { + spi2UserHandler = userHandler; + spi2UserArgs = userArgs; + } +} + +void spi::getSpiUserHandler(spi::SpiBus spiBus, user_handler_t *userHandler, + user_args_t *userArgs) { + if(userHandler == nullptr or userArgs == nullptr) { + return; + } + if(spiBus == spi::SpiBus::SPI_1) { + *userArgs = spi1UserArgs; + *userHandler = spi1UserHandler; + } + else { + *userArgs = spi2UserArgs; + *userHandler = spi2UserHandler; + } +} + +void spi::assignSpiUserArgs(spi::SpiBus spiBus, user_args_t userArgs) { + if(spiBus == spi::SpiBus::SPI_1) { + spi1UserArgs = userArgs; + } + else { + spi2UserArgs = userArgs; + } +} + +/* Do not change these function names! They need to be exactly equal to the name of the functions +defined in the startup_stm32h743xx.s files! */ + +extern "C" void SPI1_IRQHandler() { + if(spi1UserHandler != NULL) { + spi1UserHandler(spi1UserArgs); + return; + } + Default_Handler(); +} + +extern "C" void SPI2_IRQHandler() { + if(spi2UserHandler != nullptr) { + spi2UserHandler(spi2UserArgs); + return; + } + Default_Handler(); +} diff --git a/hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.h b/hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.h new file mode 100644 index 00000000..0b53f48b --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.h @@ -0,0 +1,41 @@ +#ifndef FSFW_HAL_STM32H7_SPI_INTERRUPTS_H_ +#define FSFW_HAL_STM32H7_SPI_INTERRUPTS_H_ + +#include "../interrupts.h" +#include "spiDefinitions.h" + +#ifdef __cplusplus +extern "C" { +#endif + +namespace spi { + +void assignSpiUserArgs(spi::SpiBus spiBus, user_args_t userArgs); + +/** + * Assign a user interrupt handler for SPI bus 1, allowing to pass an arbitrary argument as well. + * Generally, this argument will be the related SPI handle. + * @param user_handler + * @param user_args + */ +void assignSpiUserHandler(spi::SpiBus spiBus, user_handler_t user_handler, + user_args_t user_args); +void getSpiUserHandler(spi::SpiBus spiBus, user_handler_t* user_handler, + user_args_t* user_args); + +/** + * Generic interrupt handlers supplied for convenience. Do not call these directly! Set them + * instead with assign_dma_user_handler and assign_spi_user_handler functions. + * @param dma_handle + */ +void dmaRxIrqHandler(void* dma_handle); +void dmaTxIrqHandler(void* dma_handle); +void spiIrqHandler(void* spi_handle); + +} + +#ifdef __cplusplus +} +#endif + +#endif /* FSFW_HAL_STM32H7_SPI_INTERRUPTS_H_ */ diff --git a/hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.cpp b/hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.cpp new file mode 100644 index 00000000..f1f2815e --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.cpp @@ -0,0 +1,82 @@ +#include "fsfw/hal/stm32h7/spi/stm32h743ziSpi.h" +#include "fsfw/hal/stm32h7/spi/spiCore.h" +#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" + +#include "stm32h7xx_hal.h" +#include "stm32h7xx_hal_rcc.h" + +#include + +void spiSetupWrapper() { + __HAL_RCC_GPIOA_CLK_ENABLE(); + __HAL_RCC_GPIOB_CLK_ENABLE(); + __HAL_RCC_SPI1_CLK_ENABLE(); +} + +void spiCleanUpWrapper() { + __HAL_RCC_SPI1_FORCE_RESET(); + __HAL_RCC_SPI1_RELEASE_RESET(); +} + +void spiDmaClockEnableWrapper() { + __HAL_RCC_DMA2_CLK_ENABLE(); +} + +void spi::h743zi::standardPollingCfg(MspPollingConfigStruct& cfg) { + cfg.setupMacroWrapper = &spiSetupWrapper; + cfg.cleanUpMacroWrapper = &spiCleanUpWrapper; + cfg.sckPort = GPIOA; + cfg.sckPin = GPIO_PIN_5; + cfg.misoPort = GPIOA; + cfg.misoPin = GPIO_PIN_6; + cfg.mosiPort = GPIOA; + cfg.mosiPin = GPIO_PIN_7; + cfg.sckAlternateFunction = GPIO_AF5_SPI1; + cfg.mosiAlternateFunction = GPIO_AF5_SPI1; + cfg.misoAlternateFunction = GPIO_AF5_SPI1; +} + +void spi::h743zi::standardInterruptCfg(MspIrqConfigStruct& cfg, IrqPriorities spiIrqPrio, + IrqPriorities spiSubprio) { + // High, but works on FreeRTOS as well (priorities range from 0 to 15) + cfg.preEmptPriority = spiIrqPrio; + cfg.subpriority = spiSubprio; + cfg.spiIrqNumber = SPI1_IRQn; + cfg.spiBus = SpiBus::SPI_1; + user_handler_t spiUserHandler = nullptr; + user_args_t spiUserArgs = nullptr; + getSpiUserHandler(spi::SpiBus::SPI_1, &spiUserHandler, &spiUserArgs); + if(spiUserHandler == nullptr) { + printf("spi::h743zi::standardInterruptCfg: Invalid SPI user handlers\n"); + return; + } + cfg.spiUserArgs = spiUserArgs; + cfg.spiIrqHandler = spiUserHandler; + standardPollingCfg(cfg); +} + +void spi::h743zi::standardDmaCfg(MspDmaConfigStruct& cfg, IrqPriorities spiIrqPrio, + IrqPriorities txIrqPrio, IrqPriorities rxIrqPrio, IrqPriorities spiSubprio, + IrqPriorities txSubprio, IrqPriorities rxSubprio) { + cfg.dmaClkEnableWrapper = &spiDmaClockEnableWrapper; + cfg.rxDmaIndex = dma::DMAIndexes::DMA_2; + cfg.txDmaIndex = dma::DMAIndexes::DMA_2; + cfg.txDmaStream = dma::DMAStreams::STREAM_3; + cfg.rxDmaStream = dma::DMAStreams::STREAM_2; + DMA_HandleTypeDef* txHandle; + DMA_HandleTypeDef* rxHandle; + spi::getDmaHandles(&txHandle, &rxHandle); + if(txHandle == nullptr or rxHandle == nullptr) { + printf("spi::h743zi::standardDmaCfg: Invalid DMA handles\n"); + return; + } + spi::configureDmaHandle(txHandle, spi::SpiBus::SPI_1, dma::DMAType::TX, cfg.txDmaIndex, + cfg.txDmaStream, &cfg.txDmaIrqNumber); + spi::configureDmaHandle(rxHandle, spi::SpiBus::SPI_1, dma::DMAType::RX, cfg.rxDmaIndex, + cfg.rxDmaStream, &cfg.rxDmaIrqNumber, DMA_NORMAL, DMA_PRIORITY_HIGH); + cfg.txPreEmptPriority = txIrqPrio; + cfg.rxPreEmptPriority = txSubprio; + cfg.txSubpriority = rxIrqPrio; + cfg.rxSubpriority = rxSubprio; + standardInterruptCfg(cfg, spiIrqPrio, spiSubprio); +} diff --git a/hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.h b/hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.h new file mode 100644 index 00000000..87689add --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.h @@ -0,0 +1,23 @@ +#ifndef FSFW_HAL_STM32H7_SPI_STM32H743ZISPI_H_ +#define FSFW_HAL_STM32H7_SPI_STM32H743ZISPI_H_ + +#include "mspInit.h" + +namespace spi { + +namespace h743zi { + +void standardPollingCfg(MspPollingConfigStruct& cfg); +void standardInterruptCfg(MspIrqConfigStruct& cfg, IrqPriorities spiIrqPrio, + IrqPriorities spiSubprio = HIGHEST); +void standardDmaCfg(MspDmaConfigStruct& cfg, IrqPriorities spiIrqPrio, + IrqPriorities txIrqPrio, IrqPriorities rxIrqPrio, + IrqPriorities spiSubprio = HIGHEST, IrqPriorities txSubPrio = HIGHEST, + IrqPriorities rxSubprio = HIGHEST); + +} +} + + + +#endif /* FSFW_HAL_STM32H7_SPI_STM32H743ZISPI_H_ */ diff --git a/hal/src/fsfw/hal/stm32h7/uart/CMakeLists.txt b/hal/src/fsfw/hal/stm32h7/uart/CMakeLists.txt new file mode 100644 index 00000000..5ecb0990 --- /dev/null +++ b/hal/src/fsfw/hal/stm32h7/uart/CMakeLists.txt @@ -0,0 +1,2 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE +) diff --git a/defaultcfg/README.md b/misc/defaultcfg/README.md similarity index 100% rename from defaultcfg/README.md rename to misc/defaultcfg/README.md diff --git a/defaultcfg/fsfwconfig/CMakeLists.txt b/misc/defaultcfg/fsfwconfig/CMakeLists.txt similarity index 100% rename from defaultcfg/fsfwconfig/CMakeLists.txt rename to misc/defaultcfg/fsfwconfig/CMakeLists.txt diff --git a/defaultcfg/fsfwconfig/FSFWConfig.h b/misc/defaultcfg/fsfwconfig/FSFWConfig.h similarity index 100% rename from defaultcfg/fsfwconfig/FSFWConfig.h rename to misc/defaultcfg/fsfwconfig/FSFWConfig.h diff --git a/defaultcfg/fsfwconfig/OBSWConfig.h b/misc/defaultcfg/fsfwconfig/OBSWConfig.h similarity index 100% rename from defaultcfg/fsfwconfig/OBSWConfig.h rename to misc/defaultcfg/fsfwconfig/OBSWConfig.h diff --git a/defaultcfg/fsfwconfig/OBSWVersion.h b/misc/defaultcfg/fsfwconfig/OBSWVersion.h similarity index 100% rename from defaultcfg/fsfwconfig/OBSWVersion.h rename to misc/defaultcfg/fsfwconfig/OBSWVersion.h diff --git a/defaultcfg/fsfwconfig/devices/logicalAddresses.h b/misc/defaultcfg/fsfwconfig/devices/logicalAddresses.h similarity index 100% rename from defaultcfg/fsfwconfig/devices/logicalAddresses.h rename to misc/defaultcfg/fsfwconfig/devices/logicalAddresses.h diff --git a/defaultcfg/fsfwconfig/devices/powerSwitcherList.h b/misc/defaultcfg/fsfwconfig/devices/powerSwitcherList.h similarity index 100% rename from defaultcfg/fsfwconfig/devices/powerSwitcherList.h rename to misc/defaultcfg/fsfwconfig/devices/powerSwitcherList.h diff --git a/defaultcfg/fsfwconfig/events/subsystemIdRanges.h b/misc/defaultcfg/fsfwconfig/events/subsystemIdRanges.h similarity index 100% rename from defaultcfg/fsfwconfig/events/subsystemIdRanges.h rename to misc/defaultcfg/fsfwconfig/events/subsystemIdRanges.h diff --git a/defaultcfg/fsfwconfig/ipc/missionMessageTypes.cpp b/misc/defaultcfg/fsfwconfig/ipc/missionMessageTypes.cpp similarity index 100% rename from defaultcfg/fsfwconfig/ipc/missionMessageTypes.cpp rename to misc/defaultcfg/fsfwconfig/ipc/missionMessageTypes.cpp diff --git a/defaultcfg/fsfwconfig/ipc/missionMessageTypes.h b/misc/defaultcfg/fsfwconfig/ipc/missionMessageTypes.h similarity index 100% rename from defaultcfg/fsfwconfig/ipc/missionMessageTypes.h rename to misc/defaultcfg/fsfwconfig/ipc/missionMessageTypes.h diff --git a/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp b/misc/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp similarity index 100% rename from defaultcfg/fsfwconfig/objects/FsfwFactory.cpp rename to misc/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp diff --git a/defaultcfg/fsfwconfig/objects/FsfwFactory.h b/misc/defaultcfg/fsfwconfig/objects/FsfwFactory.h similarity index 100% rename from defaultcfg/fsfwconfig/objects/FsfwFactory.h rename to misc/defaultcfg/fsfwconfig/objects/FsfwFactory.h diff --git a/defaultcfg/fsfwconfig/objects/systemObjectList.h b/misc/defaultcfg/fsfwconfig/objects/systemObjectList.h similarity index 100% rename from defaultcfg/fsfwconfig/objects/systemObjectList.h rename to misc/defaultcfg/fsfwconfig/objects/systemObjectList.h diff --git a/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp b/misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp similarity index 100% rename from defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp rename to misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp diff --git a/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.h b/misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.h similarity index 100% rename from defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.h rename to misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.h diff --git a/defaultcfg/fsfwconfig/returnvalues/classIds.h b/misc/defaultcfg/fsfwconfig/returnvalues/classIds.h similarity index 100% rename from defaultcfg/fsfwconfig/returnvalues/classIds.h rename to misc/defaultcfg/fsfwconfig/returnvalues/classIds.h diff --git a/defaultcfg/fsfwconfig/tmtc/apid.h b/misc/defaultcfg/fsfwconfig/tmtc/apid.h similarity index 100% rename from defaultcfg/fsfwconfig/tmtc/apid.h rename to misc/defaultcfg/fsfwconfig/tmtc/apid.h diff --git a/defaultcfg/fsfwconfig/tmtc/pusIds.h b/misc/defaultcfg/fsfwconfig/tmtc/pusIds.h similarity index 100% rename from defaultcfg/fsfwconfig/tmtc/pusIds.h rename to misc/defaultcfg/fsfwconfig/tmtc/pusIds.h diff --git a/logo/FSFW_Logo_V3.png b/misc/logo/FSFW_Logo_V3.png similarity index 100% rename from logo/FSFW_Logo_V3.png rename to misc/logo/FSFW_Logo_V3.png diff --git a/logo/FSFW_Logo_V3.svg b/misc/logo/FSFW_Logo_V3.svg similarity index 100% rename from logo/FSFW_Logo_V3.svg rename to misc/logo/FSFW_Logo_V3.svg diff --git a/logo/FSFW_Logo_V3_bw.png b/misc/logo/FSFW_Logo_V3_bw.png similarity index 100% rename from logo/FSFW_Logo_V3_bw.png rename to misc/logo/FSFW_Logo_V3_bw.png diff --git a/osal/InternalErrorCodes.h b/osal/InternalErrorCodes.h deleted file mode 100644 index 1da116fa..00000000 --- a/osal/InternalErrorCodes.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef INTERNALERRORCODES_H_ -#define INTERNALERRORCODES_H_ - -#include "../returnvalues/HasReturnvaluesIF.h" - -class InternalErrorCodes { -public: - static const uint8_t INTERFACE_ID = CLASS_ID::INTERNAL_ERROR_CODES; - -static const ReturnValue_t NO_CONFIGURATION_TABLE = MAKE_RETURN_CODE(0x01 ); -static const ReturnValue_t NO_CPU_TABLE = MAKE_RETURN_CODE(0x02 ); -static const ReturnValue_t INVALID_WORKSPACE_ADDRESS = MAKE_RETURN_CODE(0x03 ); -static const ReturnValue_t TOO_LITTLE_WORKSPACE = MAKE_RETURN_CODE(0x04 ); -static const ReturnValue_t WORKSPACE_ALLOCATION = MAKE_RETURN_CODE(0x05 ); -static const ReturnValue_t INTERRUPT_STACK_TOO_SMALL = MAKE_RETURN_CODE(0x06 ); -static const ReturnValue_t THREAD_EXITTED = MAKE_RETURN_CODE(0x07 ); -static const ReturnValue_t INCONSISTENT_MP_INFORMATION = MAKE_RETURN_CODE(0x08 ); -static const ReturnValue_t INVALID_NODE = MAKE_RETURN_CODE(0x09 ); -static const ReturnValue_t NO_MPCI = MAKE_RETURN_CODE(0x0a ); -static const ReturnValue_t BAD_PACKET = MAKE_RETURN_CODE(0x0b ); -static const ReturnValue_t OUT_OF_PACKETS = MAKE_RETURN_CODE(0x0c ); -static const ReturnValue_t OUT_OF_GLOBAL_OBJECTS = MAKE_RETURN_CODE(0x0d ); -static const ReturnValue_t OUT_OF_PROXIES = MAKE_RETURN_CODE(0x0e ); -static const ReturnValue_t INVALID_GLOBAL_ID = MAKE_RETURN_CODE(0x0f ); -static const ReturnValue_t BAD_STACK_HOOK = MAKE_RETURN_CODE(0x10 ); -static const ReturnValue_t BAD_ATTRIBUTES = MAKE_RETURN_CODE(0x11 ); -static const ReturnValue_t IMPLEMENTATION_KEY_CREATE_INCONSISTENCY = MAKE_RETURN_CODE(0x12 ); -static const ReturnValue_t IMPLEMENTATION_BLOCKING_OPERATION_CANCEL = MAKE_RETURN_CODE(0x13 ); -static const ReturnValue_t MUTEX_OBTAIN_FROM_BAD_STATE = MAKE_RETURN_CODE(0x14 ); -static const ReturnValue_t UNLIMITED_AND_MAXIMUM_IS_0 = MAKE_RETURN_CODE(0x15 ); - - virtual ~InternalErrorCodes(); - - static ReturnValue_t translate(uint8_t code); -private: - InternalErrorCodes(); -}; - -#endif /* INTERNALERRORCODES_H_ */ diff --git a/osal/rtems/RtemsBasic.cpp b/osal/rtems/RtemsBasic.cpp deleted file mode 100644 index 8ab0ddcd..00000000 --- a/osal/rtems/RtemsBasic.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "RtemsBasic.h" - -// TODO: Can this be removed? - -//ReturnValue_t RtemsBasic::convertReturnCode(rtems_status_code inValue) { -// if (inValue == RTEMS_SUCCESSFUL) { -// return HasReturnvaluesIF::RETURN_OK; -// } else { -// switch(inValue){ -// case RTEMS_SUCCESSFUL: -// return OperatingSystemIF::SUCCESSFUL; -// case RTEMS_TASK_EXITTED: -// return OperatingSystemIF::TASK_EXITTED; -// case RTEMS_MP_NOT_CONFIGURED: -// return OperatingSystemIF::MP_NOT_CONFIGURED; -// case RTEMS_INVALID_NAME: -// return OperatingSystemIF::INVALID_NAME; -// case RTEMS_INVALID_ID: -// return OperatingSystemIF::INVALID_ID; -// case RTEMS_TOO_MANY: -// return OperatingSystemIF::TOO_MANY; -// case RTEMS_TIMEOUT: -// return OperatingSystemIF::TIMEOUT; -// case RTEMS_OBJECT_WAS_DELETED: -// return OperatingSystemIF::OBJECT_WAS_DELETED; -// case RTEMS_INVALID_SIZE: -// return OperatingSystemIF::INVALID_SIZE; -// case RTEMS_INVALID_ADDRESS: -// return OperatingSystemIF::INVALID_ADDRESS; -// case RTEMS_INVALID_NUMBER: -// return OperatingSystemIF::INVALID_NUMBER; -// case RTEMS_NOT_DEFINED: -// return OperatingSystemIF::NOT_DEFINED; -// case RTEMS_RESOURCE_IN_USE: -// return OperatingSystemIF::RESOURCE_IN_USE; -// //TODO RTEMS_UNSATISFIED is double mapped for FLP so it will only return Queue_empty and not unsatisfied -// case RTEMS_UNSATISFIED: -// return OperatingSystemIF::QUEUE_EMPTY; -// case RTEMS_INCORRECT_STATE: -// return OperatingSystemIF::INCORRECT_STATE; -// case RTEMS_ALREADY_SUSPENDED: -// return OperatingSystemIF::ALREADY_SUSPENDED; -// case RTEMS_ILLEGAL_ON_SELF: -// return OperatingSystemIF::ILLEGAL_ON_SELF; -// case RTEMS_ILLEGAL_ON_REMOTE_OBJECT: -// return OperatingSystemIF::ILLEGAL_ON_REMOTE_OBJECT; -// case RTEMS_CALLED_FROM_ISR: -// return OperatingSystemIF::CALLED_FROM_ISR; -// case RTEMS_INVALID_PRIORITY: -// return OperatingSystemIF::INVALID_PRIORITY; -// case RTEMS_INVALID_CLOCK: -// return OperatingSystemIF::INVALID_CLOCK; -// case RTEMS_INVALID_NODE: -// return OperatingSystemIF::INVALID_NODE; -// case RTEMS_NOT_CONFIGURED: -// return OperatingSystemIF::NOT_CONFIGURED; -// case RTEMS_NOT_OWNER_OF_RESOURCE: -// return OperatingSystemIF::NOT_OWNER_OF_RESOURCE; -// case RTEMS_NOT_IMPLEMENTED: -// return OperatingSystemIF::NOT_IMPLEMENTED; -// case RTEMS_INTERNAL_ERROR: -// return OperatingSystemIF::INTERNAL_ERROR; -// case RTEMS_NO_MEMORY: -// return OperatingSystemIF::NO_MEMORY; -// case RTEMS_IO_ERROR: -// return OperatingSystemIF::IO_ERROR; -// default: -// return HasReturnvaluesIF::RETURN_FAILED; -// } -// } -//} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..5a8f139b --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,20 @@ +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_subdirectory(fsfw) + +# Configure File + +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} +) +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_BINARY_DIR} +) + +configure_file(fsfw/FSFW.h.in fsfw/FSFW.h) diff --git a/src/fsfw/CMakeLists.txt b/src/fsfw/CMakeLists.txt new file mode 100644 index 00000000..7c665e28 --- /dev/null +++ b/src/fsfw/CMakeLists.txt @@ -0,0 +1,55 @@ +# Core + +add_subdirectory(action) +add_subdirectory(container) +add_subdirectory(controller) +add_subdirectory(datapool) +add_subdirectory(datapoollocal) +add_subdirectory(devicehandlers) +add_subdirectory(events) +add_subdirectory(fdir) +add_subdirectory(globalfunctions) +add_subdirectory(health) +add_subdirectory(housekeeping) +add_subdirectory(internalerror) +add_subdirectory(ipc) +add_subdirectory(memory) +add_subdirectory(modes) +add_subdirectory(objectmanager) +add_subdirectory(parameters) +add_subdirectory(power) +add_subdirectory(serialize) +add_subdirectory(serviceinterface) +add_subdirectory(storagemanager) +add_subdirectory(subsystem) +add_subdirectory(tasks) +add_subdirectory(tcdistribution) +add_subdirectory(thermal) +add_subdirectory(timemanager) +add_subdirectory(tmtcpacket) +add_subdirectory(tmtcservices) + +# Optional + +if(FSFW_ADD_MONITORING) +add_subdirectory(monitoring) +endif() +if(FSFW_ADD_PUS) + add_subdirectory(pus) +endif() +if(FSFW_ADD_TMSTORAGE) + add_subdirectory(tmstorage) +endif() +if(FSFW_ADD_COORDINATES) + add_subdirectory(coordinates) +endif() +if(FSFW_ADD_RMAP) + add_subdirectory(rmap) +endif() +if(FSFW_ADD_DATALINKLAYER) + add_subdirectory(datalinklayer) +endif() + +# OSAL + +add_subdirectory(osal) diff --git a/src/fsfw/FSFW.h.in b/src/fsfw/FSFW.h.in new file mode 100644 index 00000000..9b74d04c --- /dev/null +++ b/src/fsfw/FSFW.h.in @@ -0,0 +1,13 @@ +#ifndef FSFW_FSFW_H_ +#define FSFW_FSFW_H_ + +#include "FSFWConfig.h" + +#cmakedefine FSFW_ADD_RMAP +#cmakedefine FSFW_ADD_DATALINKLAYER +#cmakedefine FSFW_ADD_TMSTORAGE +#cmakedefine FSFW_ADD_COORDINATES +#cmakedefine FSFW_ADD_PUS +#cmakedefine FSFW_ADD_MONITORING + +#endif /* FSFW_FSFW_H_ */ diff --git a/FSFWVersion.h b/src/fsfw/FSFWVersion.h similarity index 100% rename from FSFWVersion.h rename to src/fsfw/FSFWVersion.h diff --git a/src/fsfw/action.h b/src/fsfw/action.h new file mode 100644 index 00000000..1300cf17 --- /dev/null +++ b/src/fsfw/action.h @@ -0,0 +1,11 @@ +#ifndef FSFW_INC_FSFW_ACTION_H_ +#define FSFW_INC_FSFW_ACTION_H_ + +#include "fsfw/action/ActionHelper.h" +#include "fsfw/action/ActionMessage.h" +#include "fsfw/action/CommandActionHelper.h" +#include "fsfw/action/HasActionsIF.h" +#include "fsfw/action/CommandsActionsIF.h" +#include "fsfw/action/SimpleActionHelper.h" + +#endif /* FSFW_INC_FSFW_ACTION_H_ */ diff --git a/action/ActionHelper.cpp b/src/fsfw/action/ActionHelper.cpp similarity index 96% rename from action/ActionHelper.cpp rename to src/fsfw/action/ActionHelper.cpp index 73007ea3..3dfe8b50 100644 --- a/action/ActionHelper.cpp +++ b/src/fsfw/action/ActionHelper.cpp @@ -1,9 +1,8 @@ -#include "ActionHelper.h" -#include "HasActionsIF.h" +#include "fsfw/action.h" -#include "../ipc/MessageQueueSenderIF.h" -#include "../objectmanager/ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) : diff --git a/action/ActionHelper.h b/src/fsfw/action/ActionHelper.h similarity index 100% rename from action/ActionHelper.h rename to src/fsfw/action/ActionHelper.h diff --git a/action/ActionMessage.cpp b/src/fsfw/action/ActionMessage.cpp similarity index 93% rename from action/ActionMessage.cpp rename to src/fsfw/action/ActionMessage.cpp index f25858af..7d66c57f 100644 --- a/action/ActionMessage.cpp +++ b/src/fsfw/action/ActionMessage.cpp @@ -1,8 +1,7 @@ -#include "ActionMessage.h" -#include "HasActionsIF.h" +#include "fsfw/action.h" -#include "../objectmanager/ObjectManager.h" -#include "../storagemanager/StorageManagerIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/storagemanager/StorageManagerIF.h" ActionMessage::ActionMessage() { } diff --git a/action/ActionMessage.h b/src/fsfw/action/ActionMessage.h similarity index 92% rename from action/ActionMessage.h rename to src/fsfw/action/ActionMessage.h index 0c64588c..c7570c9d 100644 --- a/action/ActionMessage.h +++ b/src/fsfw/action/ActionMessage.h @@ -1,9 +1,9 @@ #ifndef FSFW_ACTION_ACTIONMESSAGE_H_ #define FSFW_ACTION_ACTIONMESSAGE_H_ -#include "../ipc/CommandMessage.h" -#include "../objectmanager/ObjectManagerIF.h" -#include "../storagemanager/StorageManagerIF.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" using ActionId_t = uint32_t; diff --git a/action/CMakeLists.txt b/src/fsfw/action/CMakeLists.txt similarity index 100% rename from action/CMakeLists.txt rename to src/fsfw/action/CMakeLists.txt diff --git a/action/CommandActionHelper.cpp b/src/fsfw/action/CommandActionHelper.cpp similarity index 96% rename from action/CommandActionHelper.cpp rename to src/fsfw/action/CommandActionHelper.cpp index 31650cae..b46dcceb 100644 --- a/action/CommandActionHelper.cpp +++ b/src/fsfw/action/CommandActionHelper.cpp @@ -1,9 +1,6 @@ -#include "ActionMessage.h" -#include "CommandActionHelper.h" -#include "CommandsActionsIF.h" -#include "HasActionsIF.h" +#include "fsfw/action.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/ObjectManager.h" CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner) : owner(setOwner), queueToUse(NULL), ipcStore( diff --git a/action/CommandActionHelper.h b/src/fsfw/action/CommandActionHelper.h similarity index 82% rename from action/CommandActionHelper.h rename to src/fsfw/action/CommandActionHelper.h index 96ef1763..ce297e66 100644 --- a/action/CommandActionHelper.h +++ b/src/fsfw/action/CommandActionHelper.h @@ -2,11 +2,11 @@ #define COMMANDACTIONHELPER_H_ #include "ActionMessage.h" -#include "../objectmanager/ObjectManagerIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../serialize/SerializeIF.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/serialize/SerializeIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/ipc/MessageQueueIF.h" class CommandsActionsIF; diff --git a/action/CommandsActionsIF.h b/src/fsfw/action/CommandsActionsIF.h similarity index 100% rename from action/CommandsActionsIF.h rename to src/fsfw/action/CommandsActionsIF.h diff --git a/action/HasActionsIF.h b/src/fsfw/action/HasActionsIF.h similarity index 100% rename from action/HasActionsIF.h rename to src/fsfw/action/HasActionsIF.h diff --git a/action/SimpleActionHelper.cpp b/src/fsfw/action/SimpleActionHelper.cpp similarity index 97% rename from action/SimpleActionHelper.cpp rename to src/fsfw/action/SimpleActionHelper.cpp index 8d34f40f..7135ea62 100644 --- a/action/SimpleActionHelper.cpp +++ b/src/fsfw/action/SimpleActionHelper.cpp @@ -1,5 +1,4 @@ -#include "HasActionsIF.h" -#include "SimpleActionHelper.h" +#include "fsfw/action.h" SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) : diff --git a/action/SimpleActionHelper.h b/src/fsfw/action/SimpleActionHelper.h similarity index 100% rename from action/SimpleActionHelper.h rename to src/fsfw/action/SimpleActionHelper.h diff --git a/container/ArrayList.h b/src/fsfw/container/ArrayList.h similarity index 100% rename from container/ArrayList.h rename to src/fsfw/container/ArrayList.h diff --git a/container/BinaryTree.h b/src/fsfw/container/BinaryTree.h similarity index 100% rename from container/BinaryTree.h rename to src/fsfw/container/BinaryTree.h diff --git a/container/CMakeLists.txt b/src/fsfw/container/CMakeLists.txt similarity index 100% rename from container/CMakeLists.txt rename to src/fsfw/container/CMakeLists.txt diff --git a/container/DynamicFIFO.h b/src/fsfw/container/DynamicFIFO.h similarity index 100% rename from container/DynamicFIFO.h rename to src/fsfw/container/DynamicFIFO.h diff --git a/container/FIFO.h b/src/fsfw/container/FIFO.h similarity index 100% rename from container/FIFO.h rename to src/fsfw/container/FIFO.h diff --git a/container/FIFOBase.h b/src/fsfw/container/FIFOBase.h similarity index 100% rename from container/FIFOBase.h rename to src/fsfw/container/FIFOBase.h diff --git a/container/FIFOBase.tpp b/src/fsfw/container/FIFOBase.tpp similarity index 100% rename from container/FIFOBase.tpp rename to src/fsfw/container/FIFOBase.tpp diff --git a/container/FixedArrayList.h b/src/fsfw/container/FixedArrayList.h similarity index 100% rename from container/FixedArrayList.h rename to src/fsfw/container/FixedArrayList.h diff --git a/container/FixedMap.h b/src/fsfw/container/FixedMap.h similarity index 100% rename from container/FixedMap.h rename to src/fsfw/container/FixedMap.h diff --git a/container/FixedOrderedMultimap.h b/src/fsfw/container/FixedOrderedMultimap.h similarity index 100% rename from container/FixedOrderedMultimap.h rename to src/fsfw/container/FixedOrderedMultimap.h diff --git a/container/FixedOrderedMultimap.tpp b/src/fsfw/container/FixedOrderedMultimap.tpp similarity index 100% rename from container/FixedOrderedMultimap.tpp rename to src/fsfw/container/FixedOrderedMultimap.tpp diff --git a/container/HybridIterator.h b/src/fsfw/container/HybridIterator.h similarity index 100% rename from container/HybridIterator.h rename to src/fsfw/container/HybridIterator.h diff --git a/container/IndexedRingMemoryArray.h b/src/fsfw/container/IndexedRingMemoryArray.h similarity index 100% rename from container/IndexedRingMemoryArray.h rename to src/fsfw/container/IndexedRingMemoryArray.h diff --git a/container/PlacementFactory.h b/src/fsfw/container/PlacementFactory.h similarity index 100% rename from container/PlacementFactory.h rename to src/fsfw/container/PlacementFactory.h diff --git a/container/RingBufferBase.h b/src/fsfw/container/RingBufferBase.h similarity index 100% rename from container/RingBufferBase.h rename to src/fsfw/container/RingBufferBase.h diff --git a/container/SharedRingBuffer.cpp b/src/fsfw/container/SharedRingBuffer.cpp similarity index 93% rename from container/SharedRingBuffer.cpp rename to src/fsfw/container/SharedRingBuffer.cpp index fe36341d..f7c97802 100644 --- a/container/SharedRingBuffer.cpp +++ b/src/fsfw/container/SharedRingBuffer.cpp @@ -1,6 +1,6 @@ -#include "SharedRingBuffer.h" -#include "../ipc/MutexFactory.h" -#include "../ipc/MutexGuard.h" +#include "fsfw/container/SharedRingBuffer.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/ipc/MutexGuard.h" SharedRingBuffer::SharedRingBuffer(object_id_t objectId, const size_t size, bool overwriteOld, size_t maxExcessBytes): diff --git a/container/SharedRingBuffer.h b/src/fsfw/container/SharedRingBuffer.h similarity index 96% rename from container/SharedRingBuffer.h rename to src/fsfw/container/SharedRingBuffer.h index 9d6ea56c..26aa45c1 100644 --- a/container/SharedRingBuffer.h +++ b/src/fsfw/container/SharedRingBuffer.h @@ -3,9 +3,10 @@ #include "SimpleRingBuffer.h" #include "DynamicFIFO.h" -#include "../ipc/MutexIF.h" -#include "../objectmanager/SystemObject.h" -#include "../timemanager/Clock.h" + +#include "fsfw/ipc/MutexIF.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/timemanager/Clock.h" /** * @brief Ring buffer which can be shared among multiple objects diff --git a/container/SimpleRingBuffer.cpp b/src/fsfw/container/SimpleRingBuffer.cpp similarity index 98% rename from container/SimpleRingBuffer.cpp rename to src/fsfw/container/SimpleRingBuffer.cpp index 8544acbf..8de9cf08 100644 --- a/container/SimpleRingBuffer.cpp +++ b/src/fsfw/container/SimpleRingBuffer.cpp @@ -1,4 +1,5 @@ -#include "SimpleRingBuffer.h" +#include "fsfw/container/SimpleRingBuffer.h" + #include SimpleRingBuffer::SimpleRingBuffer(const size_t size, bool overwriteOld, diff --git a/container/SimpleRingBuffer.h b/src/fsfw/container/SimpleRingBuffer.h similarity index 100% rename from container/SimpleRingBuffer.h rename to src/fsfw/container/SimpleRingBuffer.h diff --git a/container/SinglyLinkedList.h b/src/fsfw/container/SinglyLinkedList.h similarity index 100% rename from container/SinglyLinkedList.h rename to src/fsfw/container/SinglyLinkedList.h diff --git a/container/group.h b/src/fsfw/container/group.h similarity index 100% rename from container/group.h rename to src/fsfw/container/group.h diff --git a/controller/CMakeLists.txt b/src/fsfw/controller/CMakeLists.txt similarity index 100% rename from controller/CMakeLists.txt rename to src/fsfw/controller/CMakeLists.txt diff --git a/controller/ControllerBase.cpp b/src/fsfw/controller/ControllerBase.cpp similarity index 94% rename from controller/ControllerBase.cpp rename to src/fsfw/controller/ControllerBase.cpp index 5a94c082..86838068 100644 --- a/controller/ControllerBase.cpp +++ b/src/fsfw/controller/ControllerBase.cpp @@ -1,9 +1,9 @@ -#include "ControllerBase.h" +#include "fsfw/controller/ControllerBase.h" -#include "../subsystem/SubsystemBase.h" -#include "../ipc/QueueFactory.h" -#include "../action/HasActionsIF.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/subsystem/SubsystemBase.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/action/HasActionsIF.h" +#include "fsfw/objectmanager/ObjectManager.h" ControllerBase::ControllerBase(object_id_t setObjectId, object_id_t parentId, size_t commandQueueDepth) : diff --git a/controller/ControllerBase.h b/src/fsfw/controller/ControllerBase.h similarity index 89% rename from controller/ControllerBase.h rename to src/fsfw/controller/ControllerBase.h index f583342f..1efe0cc1 100644 --- a/controller/ControllerBase.h +++ b/src/fsfw/controller/ControllerBase.h @@ -1,14 +1,14 @@ #ifndef FSFW_CONTROLLER_CONTROLLERBASE_H_ #define FSFW_CONTROLLER_CONTROLLERBASE_H_ -#include "../health/HasHealthIF.h" -#include "../health/HealthHelper.h" -#include "../modes/HasModesIF.h" -#include "../modes/ModeHelper.h" -#include "../objectmanager/SystemObject.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../tasks/PeriodicTaskIF.h" -#include "../datapool/HkSwitchHelper.h" +#include "fsfw/health/HasHealthIF.h" +#include "fsfw/health/HealthHelper.h" +#include "fsfw/modes/HasModesIF.h" +#include "fsfw/modes/ModeHelper.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/tasks/PeriodicTaskIF.h" +#include "fsfw/datapool/HkSwitchHelper.h" /** * @brief Generic base class for controller classes diff --git a/controller/ExtendedControllerBase.cpp b/src/fsfw/controller/ExtendedControllerBase.cpp similarity index 98% rename from controller/ExtendedControllerBase.cpp rename to src/fsfw/controller/ExtendedControllerBase.cpp index b5b8c660..f59c50a9 100644 --- a/controller/ExtendedControllerBase.cpp +++ b/src/fsfw/controller/ExtendedControllerBase.cpp @@ -1,5 +1,4 @@ -#include "ExtendedControllerBase.h" - +#include "fsfw/controller/ExtendedControllerBase.h" ExtendedControllerBase::ExtendedControllerBase(object_id_t objectId, object_id_t parentId, size_t commandQueueDepth): diff --git a/controller/ExtendedControllerBase.h b/src/fsfw/controller/ExtendedControllerBase.h similarity index 93% rename from controller/ExtendedControllerBase.h rename to src/fsfw/controller/ExtendedControllerBase.h index 63c350e2..4172e03e 100644 --- a/controller/ExtendedControllerBase.h +++ b/src/fsfw/controller/ExtendedControllerBase.h @@ -3,10 +3,9 @@ #include "ControllerBase.h" -#include "../action/HasActionsIF.h" -#include "../datapoollocal/HasLocalDataPoolIF.h" -#include "../action/ActionHelper.h" -#include "../datapoollocal/LocalDataPoolManager.h" +#include "fsfw/action.h" +#include "fsfw/datapoollocal/HasLocalDataPoolIF.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" /** * @brief Extendes the basic ControllerBase with the common components diff --git a/coordinates/CMakeLists.txt b/src/fsfw/coordinates/CMakeLists.txt similarity index 100% rename from coordinates/CMakeLists.txt rename to src/fsfw/coordinates/CMakeLists.txt diff --git a/coordinates/CoordinateTransformations.cpp b/src/fsfw/coordinates/CoordinateTransformations.cpp similarity index 94% rename from coordinates/CoordinateTransformations.cpp rename to src/fsfw/coordinates/CoordinateTransformations.cpp index 4e2debbe..fe879dd1 100644 --- a/coordinates/CoordinateTransformations.cpp +++ b/src/fsfw/coordinates/CoordinateTransformations.cpp @@ -1,8 +1,9 @@ -#include "CoordinateTransformations.h" -#include "../globalfunctions/constants.h" -#include "../globalfunctions/math/MatrixOperations.h" -#include "../globalfunctions/math/VectorOperations.h" -#include +#include "fsfw/coordinates/CoordinateTransformations.h" +#include "fsfw/globalfunctions/constants.h" +#include "fsfw/globalfunctions/math/MatrixOperations.h" +#include "fsfw/globalfunctions/math/VectorOperations.h" + +#include #include @@ -17,11 +18,13 @@ void CoordinateTransformations::velocityEcfToEci(const double* ecfVelocity, ecfToEci(ecfVelocity, eciVelocity, ecfPosition, timeUTC); } -void CoordinateTransformations::positionEciToEcf(const double* eciCoordinates, double* ecfCoordinates,timeval *timeUTC){ +void CoordinateTransformations::positionEciToEcf(const double* eciCoordinates, + double* ecfCoordinates,timeval *timeUTC){ eciToEcf(eciCoordinates,ecfCoordinates,NULL,timeUTC); }; -void CoordinateTransformations::velocityEciToEcf(const double* eciVelocity,const double* eciPosition, double* ecfVelocity,timeval* timeUTC){ +void CoordinateTransformations::velocityEciToEcf(const double* eciVelocity, + const double* eciPosition, double* ecfVelocity,timeval* timeUTC){ eciToEcf(eciVelocity,ecfVelocity,eciPosition,timeUTC); } diff --git a/coordinates/CoordinateTransformations.h b/src/fsfw/coordinates/CoordinateTransformations.h similarity index 95% rename from coordinates/CoordinateTransformations.h rename to src/fsfw/coordinates/CoordinateTransformations.h index 09ea2c48..ddc715d1 100644 --- a/coordinates/CoordinateTransformations.h +++ b/src/fsfw/coordinates/CoordinateTransformations.h @@ -1,7 +1,8 @@ #ifndef COORDINATETRANSFORMATIONS_H_ #define COORDINATETRANSFORMATIONS_H_ -#include "../timemanager/Clock.h" +#include "coordinatesConf.h" +#include "fsfw/timemanager/Clock.h" #include class CoordinateTransformations { diff --git a/coordinates/Jgm3Model.h b/src/fsfw/coordinates/Jgm3Model.h similarity index 96% rename from coordinates/Jgm3Model.h rename to src/fsfw/coordinates/Jgm3Model.h index 884ed141..0eeaf08f 100644 --- a/coordinates/Jgm3Model.h +++ b/src/fsfw/coordinates/Jgm3Model.h @@ -1,13 +1,14 @@ #ifndef FRAMEWORK_COORDINATES_JGM3MODEL_H_ #define FRAMEWORK_COORDINATES_JGM3MODEL_H_ -#include +#include "coordinatesConf.h" #include "CoordinateTransformations.h" -#include "../globalfunctions/math/VectorOperations.h" -#include "../globalfunctions/timevalOperations.h" -#include "../globalfunctions/constants.h" -#include +#include "fsfw/globalfunctions/math/VectorOperations.h" +#include "fsfw/globalfunctions/timevalOperations.h" +#include "fsfw/globalfunctions/constants.h" +#include +#include template class Jgm3Model { diff --git a/coordinates/Sgp4Propagator.cpp b/src/fsfw/coordinates/Sgp4Propagator.cpp similarity index 95% rename from coordinates/Sgp4Propagator.cpp rename to src/fsfw/coordinates/Sgp4Propagator.cpp index 5cb1497c..a0e66ebd 100644 --- a/coordinates/Sgp4Propagator.cpp +++ b/src/fsfw/coordinates/Sgp4Propagator.cpp @@ -1,10 +1,13 @@ -#include "CoordinateTransformations.h" -#include "Sgp4Propagator.h" -#include "../globalfunctions/constants.h" -#include "../globalfunctions/math/MatrixOperations.h" -#include "../globalfunctions/math/VectorOperations.h" -#include "../globalfunctions/timevalOperations.h" +#include "fsfw/coordinates/CoordinateTransformations.h" +#include "fsfw/coordinates/Sgp4Propagator.h" + +#include "fsfw/globalfunctions/constants.h" +#include "fsfw/globalfunctions/math/MatrixOperations.h" +#include "fsfw/globalfunctions/math/VectorOperations.h" +#include "fsfw/globalfunctions/timevalOperations.h" + #include + Sgp4Propagator::Sgp4Propagator() : initialized(false), epoch({0, 0}), whichconst(wgs84) { diff --git a/coordinates/Sgp4Propagator.h b/src/fsfw/coordinates/Sgp4Propagator.h similarity index 88% rename from coordinates/Sgp4Propagator.h rename to src/fsfw/coordinates/Sgp4Propagator.h index f813c6f4..4f29509f 100644 --- a/coordinates/Sgp4Propagator.h +++ b/src/fsfw/coordinates/Sgp4Propagator.h @@ -1,11 +1,14 @@ #ifndef SGP4PROPAGATOR_H_ #define SGP4PROPAGATOR_H_ -#ifndef WIN32 +#include "coordinatesConf.h" +#include "fsfw/platform.h" + +#ifndef PLATFORM_WIN #include #endif -#include "../contrib/sgp4/sgp4unit.h" -#include "../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/contrib/sgp4/sgp4unit.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" class Sgp4Propagator { public: diff --git a/src/fsfw/coordinates/coordinatesConf.h b/src/fsfw/coordinates/coordinatesConf.h new file mode 100644 index 00000000..ce798e6f --- /dev/null +++ b/src/fsfw/coordinates/coordinatesConf.h @@ -0,0 +1,11 @@ +#ifndef FSFW_SRC_FSFW_COORDINATES_COORDINATESCONF_H_ +#define FSFW_SRC_FSFW_COORDINATES_COORDINATESCONF_H_ + +#include "fsfw/FSFW.h" + +#ifndef FSFW_ADD_COORDINATES +#warning Coordinates files were included but compilation was \ + not enabled with FSFW_ADD_COORDINATES +#endif + +#endif /* FSFW_SRC_FSFW_COORDINATES_COORDINATESCONF_H_ */ diff --git a/datalinklayer/BCFrame.h b/src/fsfw/datalinklayer/BCFrame.h similarity index 98% rename from datalinklayer/BCFrame.h rename to src/fsfw/datalinklayer/BCFrame.h index b7795556..9cedd41b 100644 --- a/datalinklayer/BCFrame.h +++ b/src/fsfw/datalinklayer/BCFrame.h @@ -8,6 +8,7 @@ #ifndef BCFRAME_H_ #define BCFRAME_H_ +#include "dllConf.h" #include "CCSDSReturnValuesIF.h" /** diff --git a/datalinklayer/CCSDSReturnValuesIF.h b/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h similarity index 98% rename from datalinklayer/CCSDSReturnValuesIF.h rename to src/fsfw/datalinklayer/CCSDSReturnValuesIF.h index 805b6969..a31f9ced 100644 --- a/datalinklayer/CCSDSReturnValuesIF.h +++ b/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h @@ -8,7 +8,8 @@ #ifndef CCSDSRETURNVALUESIF_H_ #define CCSDSRETURNVALUESIF_H_ -#include "../returnvalues/HasReturnvaluesIF.h" +#include "dllConf.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" /** * This is a helper class to collect special return values that come up during CCSDS Handling. * @ingroup ccsds_handling diff --git a/datalinklayer/CMakeLists.txt b/src/fsfw/datalinklayer/CMakeLists.txt similarity index 100% rename from datalinklayer/CMakeLists.txt rename to src/fsfw/datalinklayer/CMakeLists.txt diff --git a/datalinklayer/Clcw.cpp b/src/fsfw/datalinklayer/Clcw.cpp similarity index 88% rename from datalinklayer/Clcw.cpp rename to src/fsfw/datalinklayer/Clcw.cpp index 13971929..9f2fe7d3 100644 --- a/datalinklayer/Clcw.cpp +++ b/src/fsfw/datalinklayer/Clcw.cpp @@ -1,14 +1,5 @@ -/** - * @file Clcw.cpp - * @brief This file defines the Clcw class. - * @date 17.04.2013 - * @author baetz - */ - - - -#include "Clcw.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/datalinklayer/Clcw.h" +#include "fsfw/serviceinterface/ServiceInterface.h" Clcw::Clcw() { content.raw = 0; diff --git a/datalinklayer/Clcw.h b/src/fsfw/datalinklayer/Clcw.h similarity index 95% rename from datalinklayer/Clcw.h rename to src/fsfw/datalinklayer/Clcw.h index 8116d63b..aa1ee35b 100644 --- a/datalinklayer/Clcw.h +++ b/src/fsfw/datalinklayer/Clcw.h @@ -1,14 +1,9 @@ -/** - * @file Clcw.h - * @brief This file defines the Clcw class. - * @date 17.04.2013 - * @author baetz - */ - #ifndef CLCW_H_ #define CLCW_H_ +#include "dllConf.h" #include "ClcwIF.h" + /** * Small helper method to handle the Clcw values. * It has a content struct that manages the register and can be set externally. diff --git a/datalinklayer/ClcwIF.h b/src/fsfw/datalinklayer/ClcwIF.h similarity index 100% rename from datalinklayer/ClcwIF.h rename to src/fsfw/datalinklayer/ClcwIF.h diff --git a/datalinklayer/DataLinkLayer.cpp b/src/fsfw/datalinklayer/DataLinkLayer.cpp similarity index 97% rename from datalinklayer/DataLinkLayer.cpp rename to src/fsfw/datalinklayer/DataLinkLayer.cpp index 1bdaa4f5..94199bc4 100644 --- a/datalinklayer/DataLinkLayer.cpp +++ b/src/fsfw/datalinklayer/DataLinkLayer.cpp @@ -1,6 +1,6 @@ -#include "DataLinkLayer.h" -#include "../globalfunctions/CRC.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/datalinklayer/DataLinkLayer.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/serviceinterface/ServiceInterface.h" DataLinkLayer::DataLinkLayer(uint8_t* set_frame_buffer, ClcwIF* setClcw, uint8_t set_start_sequence_length, uint16_t set_scid) : diff --git a/datalinklayer/DataLinkLayer.h b/src/fsfw/datalinklayer/DataLinkLayer.h similarity index 99% rename from datalinklayer/DataLinkLayer.h rename to src/fsfw/datalinklayer/DataLinkLayer.h index aa203785..9c2a2952 100644 --- a/datalinklayer/DataLinkLayer.h +++ b/src/fsfw/datalinklayer/DataLinkLayer.h @@ -1,11 +1,13 @@ #ifndef DATALINKLAYER_H_ #define DATALINKLAYER_H_ +#include "dllConf.h" #include "CCSDSReturnValuesIF.h" #include "ClcwIF.h" #include "TcTransferFrame.h" #include "VirtualChannelReceptionIF.h" -#include "../events/Event.h" +#include "fsfw/events/Event.h" + #include diff --git a/datalinklayer/Farm1StateIF.h b/src/fsfw/datalinklayer/Farm1StateIF.h similarity index 98% rename from datalinklayer/Farm1StateIF.h rename to src/fsfw/datalinklayer/Farm1StateIF.h index 71794d75..7e1ba2ec 100644 --- a/datalinklayer/Farm1StateIF.h +++ b/src/fsfw/datalinklayer/Farm1StateIF.h @@ -8,7 +8,9 @@ #ifndef FARM1STATEIF_H_ #define FARM1STATEIF_H_ +#include "dllConf.h" #include "CCSDSReturnValuesIF.h" + class VirtualChannelReception; class TcTransferFrame; class ClcwIF; diff --git a/datalinklayer/Farm1StateLockout.cpp b/src/fsfw/datalinklayer/Farm1StateLockout.cpp similarity index 70% rename from datalinklayer/Farm1StateLockout.cpp rename to src/fsfw/datalinklayer/Farm1StateLockout.cpp index 1b339a85..b74d0a5f 100644 --- a/datalinklayer/Farm1StateLockout.cpp +++ b/src/fsfw/datalinklayer/Farm1StateLockout.cpp @@ -1,16 +1,8 @@ -/** - * @file Farm1StateLockout.cpp - * @brief This file defines the Farm1StateLockout class. - * @date 24.04.2013 - * @author baetz - */ +#include "fsfw/datalinklayer/ClcwIF.h" +#include "fsfw/datalinklayer/Farm1StateLockout.h" +#include "fsfw/datalinklayer/TcTransferFrame.h" +#include "fsfw/datalinklayer/VirtualChannelReception.h" - - -#include "ClcwIF.h" -#include "Farm1StateLockout.h" -#include "TcTransferFrame.h" -#include "VirtualChannelReception.h" Farm1StateLockout::Farm1StateLockout(VirtualChannelReception* setMyVC) : myVC(setMyVC) { } diff --git a/datalinklayer/Farm1StateLockout.h b/src/fsfw/datalinklayer/Farm1StateLockout.h similarity index 93% rename from datalinklayer/Farm1StateLockout.h rename to src/fsfw/datalinklayer/Farm1StateLockout.h index 63cdc4d2..a039c89b 100644 --- a/datalinklayer/Farm1StateLockout.h +++ b/src/fsfw/datalinklayer/Farm1StateLockout.h @@ -1,13 +1,7 @@ -/** - * @file Farm1StateLockout.h - * @brief This file defines the Farm1StateLockout class. - * @date 24.04.2013 - * @author baetz - */ - #ifndef FARM1STATELOCKOUT_H_ #define FARM1STATELOCKOUT_H_ +#include "dllConf.h" #include "Farm1StateIF.h" /** diff --git a/datalinklayer/Farm1StateOpen.cpp b/src/fsfw/datalinklayer/Farm1StateOpen.cpp similarity index 79% rename from datalinklayer/Farm1StateOpen.cpp rename to src/fsfw/datalinklayer/Farm1StateOpen.cpp index 61c0997f..6f91df47 100644 --- a/datalinklayer/Farm1StateOpen.cpp +++ b/src/fsfw/datalinklayer/Farm1StateOpen.cpp @@ -1,17 +1,7 @@ -/** - * @file Farm1StateOpen.cpp - * @brief This file defines the Farm1StateOpen class. - * @date 24.04.2013 - * @author baetz - */ - - - - -#include "ClcwIF.h" -#include "Farm1StateOpen.h" -#include "TcTransferFrame.h" -#include "VirtualChannelReception.h" +#include "fsfw/datalinklayer/ClcwIF.h" +#include "fsfw/datalinklayer/Farm1StateOpen.h" +#include "fsfw/datalinklayer/TcTransferFrame.h" +#include "fsfw/datalinklayer/VirtualChannelReception.h" Farm1StateOpen::Farm1StateOpen(VirtualChannelReception* setMyVC) : myVC(setMyVC) { } diff --git a/datalinklayer/Farm1StateOpen.h b/src/fsfw/datalinklayer/Farm1StateOpen.h similarity index 99% rename from datalinklayer/Farm1StateOpen.h rename to src/fsfw/datalinklayer/Farm1StateOpen.h index 3b3a2604..c5506e7a 100644 --- a/datalinklayer/Farm1StateOpen.h +++ b/src/fsfw/datalinklayer/Farm1StateOpen.h @@ -8,6 +8,7 @@ #ifndef FARM1STATEOPEN_H_ #define FARM1STATEOPEN_H_ +#include "dllConf.h" #include "Farm1StateIF.h" /** diff --git a/datalinklayer/Farm1StateWait.cpp b/src/fsfw/datalinklayer/Farm1StateWait.cpp similarity index 78% rename from datalinklayer/Farm1StateWait.cpp rename to src/fsfw/datalinklayer/Farm1StateWait.cpp index 9001e1f5..8d3f97fc 100644 --- a/datalinklayer/Farm1StateWait.cpp +++ b/src/fsfw/datalinklayer/Farm1StateWait.cpp @@ -1,15 +1,7 @@ -/** - * @file Farm1StateWait.cpp - * @brief This file defines the Farm1StateWait class. - * @date 24.04.2013 - * @author baetz - */ - - -#include "ClcwIF.h" -#include "Farm1StateWait.h" -#include "TcTransferFrame.h" -#include "VirtualChannelReception.h" +#include "fsfw/datalinklayer/ClcwIF.h" +#include "fsfw/datalinklayer/Farm1StateWait.h" +#include "fsfw/datalinklayer/TcTransferFrame.h" +#include "fsfw/datalinklayer/VirtualChannelReception.h" Farm1StateWait::Farm1StateWait(VirtualChannelReception* setMyVC) : myVC(setMyVC) { } diff --git a/datalinklayer/Farm1StateWait.h b/src/fsfw/datalinklayer/Farm1StateWait.h similarity index 98% rename from datalinklayer/Farm1StateWait.h rename to src/fsfw/datalinklayer/Farm1StateWait.h index 877c36c2..76704fdb 100644 --- a/datalinklayer/Farm1StateWait.h +++ b/src/fsfw/datalinklayer/Farm1StateWait.h @@ -8,6 +8,7 @@ #ifndef FARM1STATEWAIT_H_ #define FARM1STATEWAIT_H_ +#include "dllConf.h" #include "Farm1StateIF.h" /** diff --git a/datalinklayer/MapPacketExtraction.cpp b/src/fsfw/datalinklayer/MapPacketExtraction.cpp similarity index 92% rename from datalinklayer/MapPacketExtraction.cpp rename to src/fsfw/datalinklayer/MapPacketExtraction.cpp index d377ca34..7d06695a 100644 --- a/datalinklayer/MapPacketExtraction.cpp +++ b/src/fsfw/datalinklayer/MapPacketExtraction.cpp @@ -1,12 +1,12 @@ -#include "MapPacketExtraction.h" +#include "fsfw/datalinklayer/MapPacketExtraction.h" -#include "../ipc/QueueFactory.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../tmtcpacket/SpacePacketBase.h" -#include "../tmtcservices/AcceptsTelecommandsIF.h" -#include "../tmtcservices/TmTcMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" +#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h" +#include "fsfw/tmtcservices/TmTcMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" #include diff --git a/datalinklayer/MapPacketExtraction.h b/src/fsfw/datalinklayer/MapPacketExtraction.h similarity index 94% rename from datalinklayer/MapPacketExtraction.h rename to src/fsfw/datalinklayer/MapPacketExtraction.h index ddb867fb..30552a8e 100644 --- a/datalinklayer/MapPacketExtraction.h +++ b/src/fsfw/datalinklayer/MapPacketExtraction.h @@ -1,10 +1,11 @@ #ifndef FSFW_DATALINKLAYER_MAPPACKETEXTRACTION_H_ #define FSFW_DATALINKLAYER_MAPPACKETEXTRACTION_H_ +#include "dllConf.h" #include "MapPacketExtractionIF.h" -#include "../objectmanager/ObjectManagerIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../ipc/MessageQueueSenderIF.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" class StorageManagerIF; diff --git a/datalinklayer/MapPacketExtractionIF.h b/src/fsfw/datalinklayer/MapPacketExtractionIF.h similarity index 98% rename from datalinklayer/MapPacketExtractionIF.h rename to src/fsfw/datalinklayer/MapPacketExtractionIF.h index e29ac666..7f8a60af 100644 --- a/datalinklayer/MapPacketExtractionIF.h +++ b/src/fsfw/datalinklayer/MapPacketExtractionIF.h @@ -8,6 +8,7 @@ #ifndef MAPPACKETEXTRACTIONIF_H_ #define MAPPACKETEXTRACTIONIF_H_ +#include "dllConf.h" #include "CCSDSReturnValuesIF.h" #include "TcTransferFrame.h" diff --git a/datalinklayer/TcTransferFrame.cpp b/src/fsfw/datalinklayer/TcTransferFrame.cpp similarity index 92% rename from datalinklayer/TcTransferFrame.cpp rename to src/fsfw/datalinklayer/TcTransferFrame.cpp index ee094dc3..42ccf7ca 100644 --- a/datalinklayer/TcTransferFrame.cpp +++ b/src/fsfw/datalinklayer/TcTransferFrame.cpp @@ -1,17 +1,8 @@ -/** - * @file TcTransferFrame.cpp - * @brief This file defines the TcTransferFrame class. - * @date 27.04.2013 - * @author baetz - */ - - - -#include "TcTransferFrame.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/datalinklayer/TcTransferFrame.h" +#include "fsfw/serviceinterface/ServiceInterface.h" TcTransferFrame::TcTransferFrame() { - frame = NULL; + frame = nullptr; } TcTransferFrame::TcTransferFrame(uint8_t* setData) { diff --git a/datalinklayer/TcTransferFrame.h b/src/fsfw/datalinklayer/TcTransferFrame.h similarity index 98% rename from datalinklayer/TcTransferFrame.h rename to src/fsfw/datalinklayer/TcTransferFrame.h index b58441fc..9d4f6349 100644 --- a/datalinklayer/TcTransferFrame.h +++ b/src/fsfw/datalinklayer/TcTransferFrame.h @@ -1,8 +1,10 @@ #ifndef TCTRANSFERFRAME_H_ #define TCTRANSFERFRAME_H_ -#include -#include +#include "dllConf.h" + +#include +#include /** * The TcTransferFrame class simplifies handling of such Frames. diff --git a/datalinklayer/TcTransferFrameLocal.cpp b/src/fsfw/datalinklayer/TcTransferFrameLocal.cpp similarity index 83% rename from datalinklayer/TcTransferFrameLocal.cpp rename to src/fsfw/datalinklayer/TcTransferFrameLocal.cpp index de8f568f..f88f79e2 100644 --- a/datalinklayer/TcTransferFrameLocal.cpp +++ b/src/fsfw/datalinklayer/TcTransferFrameLocal.cpp @@ -1,14 +1,8 @@ -/** - * @file TcTransferFrameLocal.cpp - * @brief This file defines the TcTransferFrameLocal class. - * @date 27.04.2013 - * @author baetz - */ +#include "fsfw/datalinklayer/TcTransferFrameLocal.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/serviceinterface/ServiceInterface.h" -#include "TcTransferFrameLocal.h" -#include "../globalfunctions/CRC.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include +#include TcTransferFrameLocal::TcTransferFrameLocal(bool bypass, bool controlCommand, uint16_t scid, uint8_t vcId, uint8_t sequenceNumber, uint8_t setSegmentHeader, uint8_t* data, uint16_t dataSize, uint16_t forceCrc) { @@ -38,7 +32,7 @@ TcTransferFrameLocal::TcTransferFrameLocal(bool bypass, bool controlCommand, uin this->getFullFrame()[getFullSize()-1] = (crc & 0x00FF); } else { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "TcTransferFrameLocal: dataSize too large: " << dataSize << std::endl; + sif::warning << "TcTransferFrameLocal: dataSize too large: " << dataSize << std::endl; #endif } } else { diff --git a/datalinklayer/TcTransferFrameLocal.h b/src/fsfw/datalinklayer/TcTransferFrameLocal.h similarity index 98% rename from datalinklayer/TcTransferFrameLocal.h rename to src/fsfw/datalinklayer/TcTransferFrameLocal.h index 487d8940..f2bf3275 100644 --- a/datalinklayer/TcTransferFrameLocal.h +++ b/src/fsfw/datalinklayer/TcTransferFrameLocal.h @@ -8,6 +8,7 @@ #ifndef TCTRANSFERFRAMELOCAL_H_ #define TCTRANSFERFRAMELOCAL_H_ +#include "dllConf.h" #include "TcTransferFrame.h" /** diff --git a/datalinklayer/VirtualChannelReception.cpp b/src/fsfw/datalinklayer/VirtualChannelReception.cpp similarity index 96% rename from datalinklayer/VirtualChannelReception.cpp rename to src/fsfw/datalinklayer/VirtualChannelReception.cpp index 3a56fe1e..e0a88e8e 100644 --- a/datalinklayer/VirtualChannelReception.cpp +++ b/src/fsfw/datalinklayer/VirtualChannelReception.cpp @@ -5,9 +5,9 @@ * @author baetz */ -#include "BCFrame.h" -#include "VirtualChannelReception.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/datalinklayer/BCFrame.h" +#include "fsfw/datalinklayer/VirtualChannelReception.h" +#include "fsfw/serviceinterface/ServiceInterface.h" VirtualChannelReception::VirtualChannelReception(uint8_t setChannelId, uint8_t setSlidingWindowWidth) : diff --git a/datalinklayer/VirtualChannelReception.h b/src/fsfw/datalinklayer/VirtualChannelReception.h similarity index 99% rename from datalinklayer/VirtualChannelReception.h rename to src/fsfw/datalinklayer/VirtualChannelReception.h index 9b4e2987..314e18ec 100644 --- a/datalinklayer/VirtualChannelReception.h +++ b/src/fsfw/datalinklayer/VirtualChannelReception.h @@ -8,6 +8,7 @@ #ifndef VIRTUALCHANNELRECEPTION_H_ #define VIRTUALCHANNELRECEPTION_H_ +#include "dllConf.h" #include "CCSDSReturnValuesIF.h" #include "Clcw.h" #include "Farm1StateIF.h" @@ -16,6 +17,7 @@ #include "Farm1StateWait.h" #include "MapPacketExtractionIF.h" #include "VirtualChannelReceptionIF.h" + #include /** * Implementation of a TC Virtual Channel. diff --git a/datalinklayer/VirtualChannelReceptionIF.h b/src/fsfw/datalinklayer/VirtualChannelReceptionIF.h similarity index 95% rename from datalinklayer/VirtualChannelReceptionIF.h rename to src/fsfw/datalinklayer/VirtualChannelReceptionIF.h index 36f60e8c..e7a21b3c 100644 --- a/datalinklayer/VirtualChannelReceptionIF.h +++ b/src/fsfw/datalinklayer/VirtualChannelReceptionIF.h @@ -8,9 +8,10 @@ #ifndef VIRTUALCHANNELRECEPTIONIF_H_ #define VIRTUALCHANNELRECEPTIONIF_H_ +#include "dllConf.h" #include "ClcwIF.h" #include "TcTransferFrame.h" -#include "../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" /** * This is the interface for Virtual Channel reception classes. diff --git a/src/fsfw/datalinklayer/dllConf.h b/src/fsfw/datalinklayer/dllConf.h new file mode 100644 index 00000000..dce63ff0 --- /dev/null +++ b/src/fsfw/datalinklayer/dllConf.h @@ -0,0 +1,11 @@ +#ifndef FSFW_SRC_FSFW_DATALINKLAYER_DLLCONF_H_ +#define FSFW_SRC_FSFW_DATALINKLAYER_DLLCONF_H_ + +#include "fsfw/FSFW.h" + +#ifndef FSFW_ADD_DATALINKLAYER +#warning Datalinklayer files were included but compilation was \ + not enabled with FSFW_ADD_DATALINKLAYER +#endif + +#endif /* FSFW_SRC_FSFW_DATALINKLAYER_DLLCONF_H_ */ diff --git a/datapool/CMakeLists.txt b/src/fsfw/datapool/CMakeLists.txt similarity index 100% rename from datapool/CMakeLists.txt rename to src/fsfw/datapool/CMakeLists.txt diff --git a/datapool/DataSetIF.h b/src/fsfw/datapool/DataSetIF.h similarity index 100% rename from datapool/DataSetIF.h rename to src/fsfw/datapool/DataSetIF.h diff --git a/datapool/HkSwitchHelper.cpp b/src/fsfw/datapool/HkSwitchHelper.cpp similarity index 96% rename from datapool/HkSwitchHelper.cpp rename to src/fsfw/datapool/HkSwitchHelper.cpp index 21e37f59..bcf237ba 100644 --- a/datapool/HkSwitchHelper.cpp +++ b/src/fsfw/datapool/HkSwitchHelper.cpp @@ -1,5 +1,5 @@ -#include "../datapool/HkSwitchHelper.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/datapool/HkSwitchHelper.h" +#include "fsfw/ipc/QueueFactory.h" HkSwitchHelper::HkSwitchHelper(EventReportingProxyIF* eventProxy) : commandActionHelper(this), eventProxy(eventProxy) { diff --git a/datapool/HkSwitchHelper.h b/src/fsfw/datapool/HkSwitchHelper.h similarity index 91% rename from datapool/HkSwitchHelper.h rename to src/fsfw/datapool/HkSwitchHelper.h index bb9e7dc6..611c5d86 100644 --- a/datapool/HkSwitchHelper.h +++ b/src/fsfw/datapool/HkSwitchHelper.h @@ -1,9 +1,9 @@ #ifndef FRAMEWORK_DATAPOOL_HKSWITCHHELPER_H_ #define FRAMEWORK_DATAPOOL_HKSWITCHHELPER_H_ -#include "../tasks/ExecutableObjectIF.h" -#include "../action/CommandsActionsIF.h" -#include "../events/EventReportingProxyIF.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/action/CommandsActionsIF.h" +#include "fsfw/events/EventReportingProxyIF.h" //TODO this class violations separation between mission and framework //but it is only a transitional solution until the Datapool is diff --git a/datapool/PoolDataSetBase.cpp b/src/fsfw/datapool/PoolDataSetBase.cpp similarity index 98% rename from datapool/PoolDataSetBase.cpp rename to src/fsfw/datapool/PoolDataSetBase.cpp index 1bd58698..7856dc9a 100644 --- a/datapool/PoolDataSetBase.cpp +++ b/src/fsfw/datapool/PoolDataSetBase.cpp @@ -1,7 +1,7 @@ -#include "PoolDataSetBase.h" -#include "ReadCommitIFAttorney.h" +#include "fsfw/datapool/PoolDataSetBase.h" +#include "fsfw/datapool/ReadCommitIFAttorney.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/datapool/PoolDataSetBase.h b/src/fsfw/datapool/PoolDataSetBase.h similarity index 99% rename from datapool/PoolDataSetBase.h rename to src/fsfw/datapool/PoolDataSetBase.h index 043c860a..36cf2a30 100644 --- a/datapool/PoolDataSetBase.h +++ b/src/fsfw/datapool/PoolDataSetBase.h @@ -3,8 +3,9 @@ #include "PoolDataSetIF.h" #include "PoolVariableIF.h" -#include "../serialize/SerializeIF.h" -#include "../ipc/MutexIF.h" + +#include "fsfw/serialize/SerializeIF.h" +#include "fsfw/ipc/MutexIF.h" /** * @brief The DataSetBase class manages a set of locally checked out variables. diff --git a/datapool/PoolDataSetIF.h b/src/fsfw/datapool/PoolDataSetIF.h similarity index 100% rename from datapool/PoolDataSetIF.h rename to src/fsfw/datapool/PoolDataSetIF.h diff --git a/datapool/PoolEntry.cpp b/src/fsfw/datapool/PoolEntry.cpp similarity index 94% rename from datapool/PoolEntry.cpp rename to src/fsfw/datapool/PoolEntry.cpp index 6504e20c..0443aa11 100644 --- a/datapool/PoolEntry.cpp +++ b/src/fsfw/datapool/PoolEntry.cpp @@ -1,7 +1,8 @@ -#include "PoolEntry.h" +#include "fsfw/datapool/PoolEntry.h" + +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/globalfunctions/arrayprinter.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../globalfunctions/arrayprinter.h" #include #include diff --git a/datapool/PoolEntry.h b/src/fsfw/datapool/PoolEntry.h similarity index 100% rename from datapool/PoolEntry.h rename to src/fsfw/datapool/PoolEntry.h diff --git a/datapool/PoolEntryIF.h b/src/fsfw/datapool/PoolEntryIF.h similarity index 100% rename from datapool/PoolEntryIF.h rename to src/fsfw/datapool/PoolEntryIF.h diff --git a/datapool/PoolReadGuard.h b/src/fsfw/datapool/PoolReadGuard.h similarity index 100% rename from datapool/PoolReadGuard.h rename to src/fsfw/datapool/PoolReadGuard.h diff --git a/datapool/PoolVarList.h b/src/fsfw/datapool/PoolVarList.h similarity index 100% rename from datapool/PoolVarList.h rename to src/fsfw/datapool/PoolVarList.h diff --git a/datapool/PoolVariableIF.h b/src/fsfw/datapool/PoolVariableIF.h similarity index 100% rename from datapool/PoolVariableIF.h rename to src/fsfw/datapool/PoolVariableIF.h diff --git a/datapool/ReadCommitIF.h b/src/fsfw/datapool/ReadCommitIF.h similarity index 100% rename from datapool/ReadCommitIF.h rename to src/fsfw/datapool/ReadCommitIF.h diff --git a/datapool/ReadCommitIFAttorney.h b/src/fsfw/datapool/ReadCommitIFAttorney.h similarity index 100% rename from datapool/ReadCommitIFAttorney.h rename to src/fsfw/datapool/ReadCommitIFAttorney.h diff --git a/datapool/SharedDataSetIF.h b/src/fsfw/datapool/SharedDataSetIF.h similarity index 100% rename from datapool/SharedDataSetIF.h rename to src/fsfw/datapool/SharedDataSetIF.h diff --git a/src/fsfw/datapoollocal.h b/src/fsfw/datapoollocal.h new file mode 100644 index 00000000..7a3c4c20 --- /dev/null +++ b/src/fsfw/datapoollocal.h @@ -0,0 +1,11 @@ +#ifndef FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ +#define FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ + +/* Collected related headers */ +#include "fsfw/datapoollocal/LocalPoolVariable.h" +#include "fsfw/datapoollocal/LocalPoolVector.h" +#include "fsfw/datapoollocal/StaticLocalDataSet.h" +#include "fsfw/datapoollocal/LocalDataSet.h" +#include "fsfw/datapoollocal/SharedLocalDataSet.h" + +#endif /* FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ */ diff --git a/datapoollocal/AccessLocalPoolF.h b/src/fsfw/datapoollocal/AccessLocalPoolF.h similarity index 100% rename from datapoollocal/AccessLocalPoolF.h rename to src/fsfw/datapoollocal/AccessLocalPoolF.h diff --git a/datapoollocal/CMakeLists.txt b/src/fsfw/datapoollocal/CMakeLists.txt similarity index 100% rename from datapoollocal/CMakeLists.txt rename to src/fsfw/datapoollocal/CMakeLists.txt diff --git a/datapoollocal/HasLocalDataPoolIF.h b/src/fsfw/datapoollocal/HasLocalDataPoolIF.h similarity index 100% rename from datapoollocal/HasLocalDataPoolIF.h rename to src/fsfw/datapoollocal/HasLocalDataPoolIF.h diff --git a/datapoollocal/LocalDataPoolManager.cpp b/src/fsfw/datapoollocal/LocalDataPoolManager.cpp similarity index 98% rename from datapoollocal/LocalDataPoolManager.cpp rename to src/fsfw/datapoollocal/LocalDataPoolManager.cpp index 71997b9b..4a706657 100644 --- a/datapoollocal/LocalDataPoolManager.cpp +++ b/src/fsfw/datapoollocal/LocalDataPoolManager.cpp @@ -1,18 +1,16 @@ -#include "HasLocalDataPoolIF.h" -#include "LocalDataPoolManager.h" -#include "LocalPoolObjectBase.h" -#include "LocalPoolDataSetBase.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" +#include "fsfw/datapoollocal.h" #include "internal/LocalPoolDataSetAttorney.h" #include "internal/HasLocalDpIFManagerAttorney.h" -#include "../housekeeping/HousekeepingSetPacket.h" -#include "../objectmanager/ObjectManager.h" -#include "../housekeeping/HousekeepingSnapshot.h" -#include "../housekeeping/AcceptsHkPacketsIF.h" -#include "../timemanager/CCSDSTime.h" -#include "../ipc/MutexFactory.h" -#include "../ipc/MutexGuard.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/housekeeping/HousekeepingSetPacket.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/housekeeping/HousekeepingSnapshot.h" +#include "fsfw/housekeeping/AcceptsHkPacketsIF.h" +#include "fsfw/timemanager/CCSDSTime.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/ipc/MutexGuard.h" +#include "fsfw/ipc/QueueFactory.h" #include #include diff --git a/datapoollocal/LocalDataPoolManager.h b/src/fsfw/datapoollocal/LocalDataPoolManager.h similarity index 97% rename from datapoollocal/LocalDataPoolManager.h rename to src/fsfw/datapoollocal/LocalDataPoolManager.h index 2ec81f1c..9f91613b 100644 --- a/datapoollocal/LocalDataPoolManager.h +++ b/src/fsfw/datapoollocal/LocalDataPoolManager.h @@ -4,17 +4,17 @@ #include "ProvidesDataPoolSubscriptionIF.h" #include "AccessLocalPoolF.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../housekeeping/HousekeepingPacketDownlink.h" -#include "../housekeeping/HousekeepingMessage.h" -#include "../housekeeping/PeriodicHousekeepingHelper.h" -#include "../datapool/DataSetIF.h" -#include "../datapool/PoolEntry.h" -#include "../objectmanager/SystemObjectIF.h" -#include "../ipc/MutexIF.h" -#include "../ipc/CommandMessage.h" -#include "../ipc/MessageQueueIF.h" -#include "../ipc/MutexGuard.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/housekeeping/HousekeepingPacketDownlink.h" +#include "fsfw/housekeeping/HousekeepingMessage.h" +#include "fsfw/housekeeping/PeriodicHousekeepingHelper.h" +#include "fsfw/datapool/DataSetIF.h" +#include "fsfw/datapool/PoolEntry.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/ipc/MutexIF.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/ipc/MutexGuard.h" #include #include diff --git a/datapoollocal/LocalDataSet.cpp b/src/fsfw/datapoollocal/LocalDataSet.cpp similarity index 80% rename from datapoollocal/LocalDataSet.cpp rename to src/fsfw/datapoollocal/LocalDataSet.cpp index aeb5c6b3..260f8500 100644 --- a/datapoollocal/LocalDataSet.cpp +++ b/src/fsfw/datapoollocal/LocalDataSet.cpp @@ -1,6 +1,7 @@ -#include "LocalDataSet.h" -#include "../datapoollocal/LocalDataPoolManager.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/datapoollocal/LocalDataSet.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" + +#include "fsfw/serialize/SerializeAdapter.h" #include #include diff --git a/datapoollocal/LocalDataSet.h b/src/fsfw/datapoollocal/LocalDataSet.h similarity index 100% rename from datapoollocal/LocalDataSet.h rename to src/fsfw/datapoollocal/LocalDataSet.h diff --git a/datapoollocal/LocalPoolDataSetBase.cpp b/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp similarity index 96% rename from datapoollocal/LocalPoolDataSetBase.cpp rename to src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp index a7a7e6c8..5422c68a 100644 --- a/datapoollocal/LocalPoolDataSetBase.cpp +++ b/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp @@ -1,13 +1,12 @@ -#include "LocalPoolDataSetBase.h" -#include "HasLocalDataPoolIF.h" +#include "fsfw/datapoollocal.h" #include "internal/HasLocalDpIFUserAttorney.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/ObjectManager.h" -#include "../globalfunctions/bitutility.h" -#include "../datapoollocal/LocalDataPoolManager.h" -#include "../housekeeping/PeriodicHousekeepingHelper.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/globalfunctions/bitutility.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" +#include "fsfw/housekeeping/PeriodicHousekeepingHelper.h" +#include "fsfw/serialize/SerializeAdapter.h" #include #include diff --git a/datapoollocal/LocalPoolDataSetBase.h b/src/fsfw/datapoollocal/LocalPoolDataSetBase.h similarity index 99% rename from datapoollocal/LocalPoolDataSetBase.h rename to src/fsfw/datapoollocal/LocalPoolDataSetBase.h index ab67dc3f..822e2cb8 100644 --- a/datapoollocal/LocalPoolDataSetBase.h +++ b/src/fsfw/datapoollocal/LocalPoolDataSetBase.h @@ -4,8 +4,8 @@ #include "MarkChangedIF.h" #include "localPoolDefinitions.h" -#include "../datapool/DataSetIF.h" -#include "../datapool/PoolDataSetBase.h" +#include "fsfw/datapool/DataSetIF.h" +#include "fsfw/datapool/PoolDataSetBase.h" #include diff --git a/datapoollocal/LocalPoolObjectBase.cpp b/src/fsfw/datapoollocal/LocalPoolObjectBase.cpp similarity index 94% rename from datapoollocal/LocalPoolObjectBase.cpp rename to src/fsfw/datapoollocal/LocalPoolObjectBase.cpp index 6920749b..96b849c6 100644 --- a/datapoollocal/LocalPoolObjectBase.cpp +++ b/src/fsfw/datapoollocal/LocalPoolObjectBase.cpp @@ -1,10 +1,10 @@ -#include "LocalPoolObjectBase.h" -#include "LocalDataPoolManager.h" -#include "AccessLocalPoolF.h" -#include "HasLocalDataPoolIF.h" +#include "fsfw/datapoollocal/LocalPoolObjectBase.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" +#include "fsfw/datapoollocal/AccessLocalPoolF.h" +#include "fsfw/datapoollocal/HasLocalDataPoolIF.h" #include "internal/HasLocalDpIFUserAttorney.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/ObjectManager.h" LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkOwner, diff --git a/datapoollocal/LocalPoolObjectBase.h b/src/fsfw/datapoollocal/LocalPoolObjectBase.h similarity index 93% rename from datapoollocal/LocalPoolObjectBase.h rename to src/fsfw/datapoollocal/LocalPoolObjectBase.h index 3f7fb6dd..72275646 100644 --- a/datapoollocal/LocalPoolObjectBase.h +++ b/src/fsfw/datapoollocal/LocalPoolObjectBase.h @@ -4,9 +4,9 @@ #include "MarkChangedIF.h" #include "localPoolDefinitions.h" -#include "../objectmanager/SystemObjectIF.h" -#include "../datapool/PoolVariableIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/datapool/PoolVariableIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" class LocalDataPoolManager; class DataSetIF; diff --git a/datapoollocal/LocalPoolVariable.h b/src/fsfw/datapoollocal/LocalPoolVariable.h similarity index 100% rename from datapoollocal/LocalPoolVariable.h rename to src/fsfw/datapoollocal/LocalPoolVariable.h diff --git a/datapoollocal/LocalPoolVariable.tpp b/src/fsfw/datapoollocal/LocalPoolVariable.tpp similarity index 100% rename from datapoollocal/LocalPoolVariable.tpp rename to src/fsfw/datapoollocal/LocalPoolVariable.tpp diff --git a/datapoollocal/LocalPoolVector.h b/src/fsfw/datapoollocal/LocalPoolVector.h similarity index 100% rename from datapoollocal/LocalPoolVector.h rename to src/fsfw/datapoollocal/LocalPoolVector.h diff --git a/datapoollocal/LocalPoolVector.tpp b/src/fsfw/datapoollocal/LocalPoolVector.tpp similarity index 100% rename from datapoollocal/LocalPoolVector.tpp rename to src/fsfw/datapoollocal/LocalPoolVector.tpp diff --git a/datapoollocal/MarkChangedIF.h b/src/fsfw/datapoollocal/MarkChangedIF.h similarity index 100% rename from datapoollocal/MarkChangedIF.h rename to src/fsfw/datapoollocal/MarkChangedIF.h diff --git a/datapoollocal/ProvidesDataPoolSubscriptionIF.h b/src/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h similarity index 100% rename from datapoollocal/ProvidesDataPoolSubscriptionIF.h rename to src/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h diff --git a/datapoollocal/SharedLocalDataSet.cpp b/src/fsfw/datapoollocal/SharedLocalDataSet.cpp similarity index 96% rename from datapoollocal/SharedLocalDataSet.cpp rename to src/fsfw/datapoollocal/SharedLocalDataSet.cpp index 84c2d1c3..2ee00aca 100644 --- a/datapoollocal/SharedLocalDataSet.cpp +++ b/src/fsfw/datapoollocal/SharedLocalDataSet.cpp @@ -1,4 +1,4 @@ -#include "SharedLocalDataSet.h" +#include "fsfw/datapoollocal/SharedLocalDataSet.h" SharedLocalDataSet::SharedLocalDataSet(object_id_t objectId, sid_t sid, diff --git a/datapoollocal/SharedLocalDataSet.h b/src/fsfw/datapoollocal/SharedLocalDataSet.h similarity index 100% rename from datapoollocal/SharedLocalDataSet.h rename to src/fsfw/datapoollocal/SharedLocalDataSet.h diff --git a/datapoollocal/StaticLocalDataSet.h b/src/fsfw/datapoollocal/StaticLocalDataSet.h similarity index 100% rename from datapoollocal/StaticLocalDataSet.h rename to src/fsfw/datapoollocal/StaticLocalDataSet.h diff --git a/datapoollocal/internal/CMakeLists.txt b/src/fsfw/datapoollocal/internal/CMakeLists.txt similarity index 100% rename from datapoollocal/internal/CMakeLists.txt rename to src/fsfw/datapoollocal/internal/CMakeLists.txt diff --git a/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp b/src/fsfw/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp similarity index 76% rename from datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp rename to src/fsfw/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp index 65feda75..a275626b 100644 --- a/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp +++ b/src/fsfw/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp @@ -1,7 +1,7 @@ #include "HasLocalDpIFManagerAttorney.h" -#include "../LocalPoolObjectBase.h" -#include "../LocalPoolDataSetBase.h" -#include "../HasLocalDataPoolIF.h" +#include "fsfw/datapoollocal/LocalPoolObjectBase.h" +#include "fsfw/datapoollocal/LocalPoolDataSetBase.h" +#include "fsfw/datapoollocal/HasLocalDataPoolIF.h" LocalPoolDataSetBase* HasLocalDpIFManagerAttorney::getDataSetHandle(HasLocalDataPoolIF* clientIF, sid_t sid) { diff --git a/datapoollocal/internal/HasLocalDpIFManagerAttorney.h b/src/fsfw/datapoollocal/internal/HasLocalDpIFManagerAttorney.h similarity index 92% rename from datapoollocal/internal/HasLocalDpIFManagerAttorney.h rename to src/fsfw/datapoollocal/internal/HasLocalDpIFManagerAttorney.h index dfe333a6..a82ee489 100644 --- a/datapoollocal/internal/HasLocalDpIFManagerAttorney.h +++ b/src/fsfw/datapoollocal/internal/HasLocalDpIFManagerAttorney.h @@ -1,7 +1,7 @@ #ifndef FSFW_DATAPOOLLOCAL_HASLOCALDPIFMANAGERATTORNEY_H_ #define FSFW_DATAPOOLLOCAL_HASLOCALDPIFMANAGERATTORNEY_H_ -#include "../localPoolDefinitions.h" +#include "fsfw/datapoollocal/localPoolDefinitions.h" class HasLocalDataPoolIF; class LocalPoolDataSetBase; diff --git a/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp b/src/fsfw/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp similarity index 63% rename from datapoollocal/internal/HasLocalDpIFUserAttorney.cpp rename to src/fsfw/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp index 838204a7..8c52fbfb 100644 --- a/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp +++ b/src/fsfw/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp @@ -1,6 +1,6 @@ #include "HasLocalDpIFUserAttorney.h" -#include "../AccessLocalPoolF.h" -#include "../HasLocalDataPoolIF.h" +#include "fsfw/datapoollocal/AccessLocalPoolF.h" +#include "fsfw/datapoollocal/HasLocalDataPoolIF.h" AccessPoolManagerIF* HasLocalDpIFUserAttorney::getAccessorHandle(HasLocalDataPoolIF *clientIF) { return clientIF->getAccessorHandle(); diff --git a/datapoollocal/internal/HasLocalDpIFUserAttorney.h b/src/fsfw/datapoollocal/internal/HasLocalDpIFUserAttorney.h similarity index 100% rename from datapoollocal/internal/HasLocalDpIFUserAttorney.h rename to src/fsfw/datapoollocal/internal/HasLocalDpIFUserAttorney.h diff --git a/datapoollocal/internal/LocalDpManagerAttorney.h b/src/fsfw/datapoollocal/internal/LocalDpManagerAttorney.h similarity index 100% rename from datapoollocal/internal/LocalDpManagerAttorney.h rename to src/fsfw/datapoollocal/internal/LocalDpManagerAttorney.h diff --git a/datapoollocal/internal/LocalPoolDataSetAttorney.h b/src/fsfw/datapoollocal/internal/LocalPoolDataSetAttorney.h similarity index 95% rename from datapoollocal/internal/LocalPoolDataSetAttorney.h rename to src/fsfw/datapoollocal/internal/LocalPoolDataSetAttorney.h index f81428cd..9e46cffd 100644 --- a/datapoollocal/internal/LocalPoolDataSetAttorney.h +++ b/src/fsfw/datapoollocal/internal/LocalPoolDataSetAttorney.h @@ -1,7 +1,7 @@ #ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_ #define FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_ -#include "../LocalPoolDataSetBase.h" +#include "fsfw/datapoollocal/LocalPoolDataSetBase.h" class LocalPoolDataSetAttorney { private: diff --git a/datapoollocal/localPoolDefinitions.h b/src/fsfw/datapoollocal/localPoolDefinitions.h similarity index 100% rename from datapoollocal/localPoolDefinitions.h rename to src/fsfw/datapoollocal/localPoolDefinitions.h diff --git a/devicehandlers/AcceptsDeviceResponsesIF.h b/src/fsfw/devicehandlers/AcceptsDeviceResponsesIF.h similarity index 100% rename from devicehandlers/AcceptsDeviceResponsesIF.h rename to src/fsfw/devicehandlers/AcceptsDeviceResponsesIF.h diff --git a/devicehandlers/AssemblyBase.cpp b/src/fsfw/devicehandlers/AssemblyBase.cpp similarity index 99% rename from devicehandlers/AssemblyBase.cpp rename to src/fsfw/devicehandlers/AssemblyBase.cpp index 46b2211a..146adfcb 100644 --- a/devicehandlers/AssemblyBase.cpp +++ b/src/fsfw/devicehandlers/AssemblyBase.cpp @@ -1,4 +1,4 @@ -#include "AssemblyBase.h" +#include "fsfw/devicehandlers/AssemblyBase.h" AssemblyBase::AssemblyBase(object_id_t objectId, object_id_t parentId, uint16_t commandQueueDepth) : diff --git a/devicehandlers/AssemblyBase.h b/src/fsfw/devicehandlers/AssemblyBase.h similarity index 100% rename from devicehandlers/AssemblyBase.h rename to src/fsfw/devicehandlers/AssemblyBase.h diff --git a/devicehandlers/CMakeLists.txt b/src/fsfw/devicehandlers/CMakeLists.txt similarity index 100% rename from devicehandlers/CMakeLists.txt rename to src/fsfw/devicehandlers/CMakeLists.txt diff --git a/devicehandlers/ChildHandlerBase.cpp b/src/fsfw/devicehandlers/ChildHandlerBase.cpp similarity index 93% rename from devicehandlers/ChildHandlerBase.cpp rename to src/fsfw/devicehandlers/ChildHandlerBase.cpp index 628ea3e0..e6508727 100644 --- a/devicehandlers/ChildHandlerBase.cpp +++ b/src/fsfw/devicehandlers/ChildHandlerBase.cpp @@ -1,5 +1,5 @@ -#include "ChildHandlerBase.h" -#include "../subsystem/SubsystemBase.h" +#include "fsfw/devicehandlers/ChildHandlerBase.h" +#include "fsfw/subsystem/SubsystemBase.h" ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, CookieIF * cookie, diff --git a/devicehandlers/ChildHandlerBase.h b/src/fsfw/devicehandlers/ChildHandlerBase.h similarity index 100% rename from devicehandlers/ChildHandlerBase.h rename to src/fsfw/devicehandlers/ChildHandlerBase.h diff --git a/devicehandlers/ChildHandlerFDIR.cpp b/src/fsfw/devicehandlers/ChildHandlerFDIR.cpp similarity index 84% rename from devicehandlers/ChildHandlerFDIR.cpp rename to src/fsfw/devicehandlers/ChildHandlerFDIR.cpp index cb4c75ea..e1d1321d 100644 --- a/devicehandlers/ChildHandlerFDIR.cpp +++ b/src/fsfw/devicehandlers/ChildHandlerFDIR.cpp @@ -1,4 +1,4 @@ -#include "ChildHandlerFDIR.h" +#include "fsfw/devicehandlers/ChildHandlerFDIR.h" ChildHandlerFDIR::ChildHandlerFDIR(object_id_t owner, object_id_t faultTreeParent, uint32_t recoveryCount) : diff --git a/devicehandlers/ChildHandlerFDIR.h b/src/fsfw/devicehandlers/ChildHandlerFDIR.h similarity index 100% rename from devicehandlers/ChildHandlerFDIR.h rename to src/fsfw/devicehandlers/ChildHandlerFDIR.h diff --git a/devicehandlers/CookieIF.h b/src/fsfw/devicehandlers/CookieIF.h similarity index 100% rename from devicehandlers/CookieIF.h rename to src/fsfw/devicehandlers/CookieIF.h diff --git a/devicehandlers/DeviceCommunicationIF.h b/src/fsfw/devicehandlers/DeviceCommunicationIF.h similarity index 100% rename from devicehandlers/DeviceCommunicationIF.h rename to src/fsfw/devicehandlers/DeviceCommunicationIF.h diff --git a/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp similarity index 98% rename from devicehandlers/DeviceHandlerBase.cpp rename to src/fsfw/devicehandlers/DeviceHandlerBase.cpp index 5665b101..96fe031a 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -1,17 +1,17 @@ -#include "DeviceHandlerBase.h" -#include "AcceptsDeviceResponsesIF.h" -#include "DeviceTmReportingWrapper.h" +#include "fsfw/devicehandlers/DeviceHandlerBase.h" +#include "fsfw/devicehandlers/AcceptsDeviceResponsesIF.h" +#include "fsfw/devicehandlers/DeviceTmReportingWrapper.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/ObjectManager.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../thermal/ThermalComponentIF.h" -#include "../globalfunctions/CRC.h" -#include "../housekeeping/HousekeepingMessage.h" -#include "../ipc/MessageQueueMessage.h" -#include "../ipc/QueueFactory.h" -#include "../subsystem/SubsystemBase.h" -#include "../datapoollocal/LocalPoolVariable.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/thermal/ThermalComponentIF.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/housekeeping/HousekeepingMessage.h" +#include "fsfw/ipc/MessageQueueMessage.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/subsystem/SubsystemBase.h" +#include "fsfw/datapoollocal/LocalPoolVariable.h" object_id_t DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT; object_id_t DeviceHandlerBase::rawDataReceiverId = objects::NO_OBJECT; diff --git a/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h similarity index 100% rename from devicehandlers/DeviceHandlerBase.h rename to src/fsfw/devicehandlers/DeviceHandlerBase.h diff --git a/devicehandlers/DeviceHandlerFailureIsolation.cpp b/src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.cpp similarity index 95% rename from devicehandlers/DeviceHandlerFailureIsolation.cpp rename to src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.cpp index b0708a59..8b1c1489 100644 --- a/devicehandlers/DeviceHandlerFailureIsolation.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.cpp @@ -1,12 +1,12 @@ -#include "DeviceHandlerFailureIsolation.h" +#include "fsfw/devicehandlers/DeviceHandlerFailureIsolation.h" -#include "../devicehandlers/DeviceHandlerIF.h" -#include "../objectmanager/ObjectManager.h" -#include "../modes/HasModesIF.h" -#include "../health/HealthTableIF.h" -#include "../power/Fuse.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../thermal/ThermalComponentIF.h" +#include "fsfw/devicehandlers/DeviceHandlerIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/modes/HasModesIF.h" +#include "fsfw/health/HealthTableIF.h" +#include "fsfw/power/Fuse.h" +#include "fsfw/serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/thermal/ThermalComponentIF.h" object_id_t DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT; diff --git a/devicehandlers/DeviceHandlerFailureIsolation.h b/src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.h similarity index 100% rename from devicehandlers/DeviceHandlerFailureIsolation.h rename to src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.h diff --git a/devicehandlers/DeviceHandlerIF.h b/src/fsfw/devicehandlers/DeviceHandlerIF.h similarity index 100% rename from devicehandlers/DeviceHandlerIF.h rename to src/fsfw/devicehandlers/DeviceHandlerIF.h diff --git a/devicehandlers/DeviceHandlerMessage.cpp b/src/fsfw/devicehandlers/DeviceHandlerMessage.cpp similarity index 96% rename from devicehandlers/DeviceHandlerMessage.cpp rename to src/fsfw/devicehandlers/DeviceHandlerMessage.cpp index 69c9deb9..48277c9a 100644 --- a/devicehandlers/DeviceHandlerMessage.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerMessage.cpp @@ -1,5 +1,5 @@ -#include "DeviceHandlerMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/devicehandlers/DeviceHandlerMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" store_address_t DeviceHandlerMessage::getStoreAddress( const CommandMessage* message) { diff --git a/devicehandlers/DeviceHandlerMessage.h b/src/fsfw/devicehandlers/DeviceHandlerMessage.h similarity index 100% rename from devicehandlers/DeviceHandlerMessage.h rename to src/fsfw/devicehandlers/DeviceHandlerMessage.h diff --git a/devicehandlers/DeviceHandlerThermalSet.h b/src/fsfw/devicehandlers/DeviceHandlerThermalSet.h similarity index 100% rename from devicehandlers/DeviceHandlerThermalSet.h rename to src/fsfw/devicehandlers/DeviceHandlerThermalSet.h diff --git a/devicehandlers/DeviceTmReportingWrapper.cpp b/src/fsfw/devicehandlers/DeviceTmReportingWrapper.cpp similarity index 93% rename from devicehandlers/DeviceTmReportingWrapper.cpp rename to src/fsfw/devicehandlers/DeviceTmReportingWrapper.cpp index c70f57d6..0300a24a 100644 --- a/devicehandlers/DeviceTmReportingWrapper.cpp +++ b/src/fsfw/devicehandlers/DeviceTmReportingWrapper.cpp @@ -1,5 +1,5 @@ -#include "DeviceTmReportingWrapper.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/devicehandlers/DeviceTmReportingWrapper.h" +#include "fsfw/serialize/SerializeAdapter.h" DeviceTmReportingWrapper::DeviceTmReportingWrapper(object_id_t objectId, ActionId_t actionId, SerializeIF* data) : diff --git a/devicehandlers/DeviceTmReportingWrapper.h b/src/fsfw/devicehandlers/DeviceTmReportingWrapper.h similarity index 100% rename from devicehandlers/DeviceTmReportingWrapper.h rename to src/fsfw/devicehandlers/DeviceTmReportingWrapper.h diff --git a/devicehandlers/HealthDevice.cpp b/src/fsfw/devicehandlers/HealthDevice.cpp similarity index 95% rename from devicehandlers/HealthDevice.cpp rename to src/fsfw/devicehandlers/HealthDevice.cpp index e23dd5b6..2f6e1dfb 100644 --- a/devicehandlers/HealthDevice.cpp +++ b/src/fsfw/devicehandlers/HealthDevice.cpp @@ -1,5 +1,5 @@ -#include "HealthDevice.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/devicehandlers/HealthDevice.h" +#include "fsfw/ipc/QueueFactory.h" HealthDevice::HealthDevice(object_id_t setObjectId, MessageQueueId_t parentQueue) : diff --git a/devicehandlers/HealthDevice.h b/src/fsfw/devicehandlers/HealthDevice.h similarity index 79% rename from devicehandlers/HealthDevice.h rename to src/fsfw/devicehandlers/HealthDevice.h index 738f0c7e..bf9cdb82 100644 --- a/devicehandlers/HealthDevice.h +++ b/src/fsfw/devicehandlers/HealthDevice.h @@ -1,11 +1,11 @@ #ifndef FSFW_DEVICEHANDLERS_HEALTHDEVICE_H_ #define FSFW_DEVICEHANDLERS_HEALTHDEVICE_H_ -#include "../health/HasHealthIF.h" -#include "../health/HealthHelper.h" -#include "../objectmanager/SystemObject.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/health/HasHealthIF.h" +#include "fsfw/health/HealthHelper.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/ipc/MessageQueueIF.h" class HealthDevice: public SystemObject, public ExecutableObjectIF, diff --git a/src/fsfw/events/CMakeLists.txt b/src/fsfw/events/CMakeLists.txt new file mode 100644 index 00000000..28eec772 --- /dev/null +++ b/src/fsfw/events/CMakeLists.txt @@ -0,0 +1,6 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + EventManager.cpp + EventMessage.cpp +) + +add_subdirectory(eventmatching) diff --git a/events/Event.h b/src/fsfw/events/Event.h similarity index 100% rename from events/Event.h rename to src/fsfw/events/Event.h diff --git a/events/EventManager.cpp b/src/fsfw/events/EventManager.cpp similarity index 98% rename from events/EventManager.cpp rename to src/fsfw/events/EventManager.cpp index 8e2a2a82..5aa82434 100644 --- a/events/EventManager.cpp +++ b/src/fsfw/events/EventManager.cpp @@ -1,8 +1,8 @@ -#include "EventManager.h" -#include "EventMessage.h" +#include "fsfw/events/EventManager.h" +#include "fsfw/events/EventMessage.h" -#include "../ipc/QueueFactory.h" -#include "../ipc/MutexFactory.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/ipc/MutexFactory.h" MessageQueueId_t EventManagerIF::eventmanagerQueue = MessageQueueIF::NO_QUEUE; diff --git a/events/EventManager.h b/src/fsfw/events/EventManager.h similarity index 100% rename from events/EventManager.h rename to src/fsfw/events/EventManager.h diff --git a/events/EventManagerIF.h b/src/fsfw/events/EventManagerIF.h similarity index 100% rename from events/EventManagerIF.h rename to src/fsfw/events/EventManagerIF.h diff --git a/events/EventMessage.cpp b/src/fsfw/events/EventMessage.cpp similarity index 98% rename from events/EventMessage.cpp rename to src/fsfw/events/EventMessage.cpp index 548b4f0f..74f42b06 100644 --- a/events/EventMessage.cpp +++ b/src/fsfw/events/EventMessage.cpp @@ -1,4 +1,4 @@ -#include "EventMessage.h" +#include "fsfw/events/EventMessage.h" #include EventMessage::EventMessage() { diff --git a/events/EventMessage.h b/src/fsfw/events/EventMessage.h similarity index 88% rename from events/EventMessage.h rename to src/fsfw/events/EventMessage.h index f2f5ffb5..36e261bd 100644 --- a/events/EventMessage.h +++ b/src/fsfw/events/EventMessage.h @@ -1,9 +1,9 @@ -#ifndef EVENTMESSAGE_H_ -#define EVENTMESSAGE_H_ +#ifndef FSFW_EVENTS_EVENTMESSAGE_H_ +#define FSFW_EVENTS_EVENTMESSAGE_H_ #include "Event.h" -#include "../ipc/MessageQueueMessage.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" /** * Passing on events through IPC. @@ -49,4 +49,4 @@ protected: }; -#endif /* EVENTMESSAGE_H_ */ +#endif /* FSFW_EVENTS_EVENTMESSAGE_H_ */ diff --git a/events/EventReportingProxyIF.h b/src/fsfw/events/EventReportingProxyIF.h similarity index 100% rename from events/EventReportingProxyIF.h rename to src/fsfw/events/EventReportingProxyIF.h diff --git a/events/eventmatching/CMakeLists.txt b/src/fsfw/events/eventmatching/CMakeLists.txt similarity index 100% rename from events/eventmatching/CMakeLists.txt rename to src/fsfw/events/eventmatching/CMakeLists.txt diff --git a/events/eventmatching/EventIdRangeMatcher.cpp b/src/fsfw/events/eventmatching/EventIdRangeMatcher.cpp similarity index 84% rename from events/eventmatching/EventIdRangeMatcher.cpp rename to src/fsfw/events/eventmatching/EventIdRangeMatcher.cpp index 974567d4..92089f7c 100644 --- a/events/eventmatching/EventIdRangeMatcher.cpp +++ b/src/fsfw/events/eventmatching/EventIdRangeMatcher.cpp @@ -1,4 +1,4 @@ -#include "EventIdRangeMatcher.h" +#include "fsfw/events/eventmatching/EventIdRangeMatcher.h" EventIdRangeMatcher::EventIdRangeMatcher(EventId_t lower, EventId_t upper, bool inverted) : EventRangeMatcherBase(lower, upper, inverted) { diff --git a/events/eventmatching/EventIdRangeMatcher.h b/src/fsfw/events/eventmatching/EventIdRangeMatcher.h similarity index 100% rename from events/eventmatching/EventIdRangeMatcher.h rename to src/fsfw/events/eventmatching/EventIdRangeMatcher.h diff --git a/events/eventmatching/EventMatchTree.cpp b/src/fsfw/events/eventmatching/EventMatchTree.cpp similarity index 94% rename from events/eventmatching/EventMatchTree.cpp rename to src/fsfw/events/eventmatching/EventMatchTree.cpp index 55e4083f..66e9e91a 100644 --- a/events/eventmatching/EventMatchTree.cpp +++ b/src/fsfw/events/eventmatching/EventMatchTree.cpp @@ -1,7 +1,7 @@ -#include "EventIdRangeMatcher.h" -#include "EventMatchTree.h" -#include "ReporterRangeMatcher.h" -#include "SeverityRangeMatcher.h" +#include "fsfw/events/eventmatching/EventIdRangeMatcher.h" +#include "fsfw/events/eventmatching/EventMatchTree.h" +#include "fsfw/events/eventmatching/ReporterRangeMatcher.h" +#include "fsfw/events/eventmatching/SeverityRangeMatcher.h" EventMatchTree::EventMatchTree(StorageManagerIF* storageBackend, bool invertedMatch) : diff --git a/events/eventmatching/EventMatchTree.h b/src/fsfw/events/eventmatching/EventMatchTree.h similarity index 100% rename from events/eventmatching/EventMatchTree.h rename to src/fsfw/events/eventmatching/EventMatchTree.h diff --git a/events/eventmatching/EventRangeMatcherBase.h b/src/fsfw/events/eventmatching/EventRangeMatcherBase.h similarity index 100% rename from events/eventmatching/EventRangeMatcherBase.h rename to src/fsfw/events/eventmatching/EventRangeMatcherBase.h diff --git a/events/eventmatching/ReporterRangeMatcher.cpp b/src/fsfw/events/eventmatching/ReporterRangeMatcher.cpp similarity index 84% rename from events/eventmatching/ReporterRangeMatcher.cpp rename to src/fsfw/events/eventmatching/ReporterRangeMatcher.cpp index 61179726..fc3a2f9f 100644 --- a/events/eventmatching/ReporterRangeMatcher.cpp +++ b/src/fsfw/events/eventmatching/ReporterRangeMatcher.cpp @@ -1,4 +1,4 @@ -#include "ReporterRangeMatcher.h" +#include "fsfw/events/eventmatching/ReporterRangeMatcher.h" ReporterRangeMatcher::ReporterRangeMatcher(object_id_t lower, object_id_t upper, bool inverted) : EventRangeMatcherBase(lower, upper, inverted) { diff --git a/events/eventmatching/ReporterRangeMatcher.h b/src/fsfw/events/eventmatching/ReporterRangeMatcher.h similarity index 100% rename from events/eventmatching/ReporterRangeMatcher.h rename to src/fsfw/events/eventmatching/ReporterRangeMatcher.h diff --git a/events/eventmatching/SeverityRangeMatcher.cpp b/src/fsfw/events/eventmatching/SeverityRangeMatcher.cpp similarity index 70% rename from events/eventmatching/SeverityRangeMatcher.cpp rename to src/fsfw/events/eventmatching/SeverityRangeMatcher.cpp index 6fd38271..230e4e77 100644 --- a/events/eventmatching/SeverityRangeMatcher.cpp +++ b/src/fsfw/events/eventmatching/SeverityRangeMatcher.cpp @@ -1,6 +1,6 @@ -#include "SeverityRangeMatcher.h" -#include "../../events/EventMessage.h" -#include "../../serialize/SerializeAdapter.h" +#include "fsfw/events/eventmatching/SeverityRangeMatcher.h" +#include "fsfw/events/EventMessage.h" +#include "fsfw/serialize/SerializeAdapter.h" SeverityRangeMatcher::SeverityRangeMatcher(EventSeverity_t from, EventSeverity_t till, bool inverted) : EventRangeMatcherBase(from, till, inverted) { diff --git a/events/eventmatching/SeverityRangeMatcher.h b/src/fsfw/events/eventmatching/SeverityRangeMatcher.h similarity index 100% rename from events/eventmatching/SeverityRangeMatcher.h rename to src/fsfw/events/eventmatching/SeverityRangeMatcher.h diff --git a/events/eventmatching/eventmatching.h b/src/fsfw/events/eventmatching/eventmatching.h similarity index 100% rename from events/eventmatching/eventmatching.h rename to src/fsfw/events/eventmatching/eventmatching.h diff --git a/events/fwSubsystemIdRanges.h b/src/fsfw/events/fwSubsystemIdRanges.h similarity index 100% rename from events/fwSubsystemIdRanges.h rename to src/fsfw/events/fwSubsystemIdRanges.h diff --git a/fdir/CMakeLists.txt b/src/fsfw/fdir/CMakeLists.txt similarity index 100% rename from fdir/CMakeLists.txt rename to src/fsfw/fdir/CMakeLists.txt diff --git a/fdir/ConfirmsFailuresIF.h b/src/fsfw/fdir/ConfirmsFailuresIF.h similarity index 100% rename from fdir/ConfirmsFailuresIF.h rename to src/fsfw/fdir/ConfirmsFailuresIF.h diff --git a/fdir/EventCorrelation.cpp b/src/fsfw/fdir/EventCorrelation.cpp similarity index 95% rename from fdir/EventCorrelation.cpp rename to src/fsfw/fdir/EventCorrelation.cpp index d60fc6ca..5b023334 100644 --- a/fdir/EventCorrelation.cpp +++ b/src/fsfw/fdir/EventCorrelation.cpp @@ -1,4 +1,4 @@ -#include "EventCorrelation.h" +#include "fsfw/fdir/EventCorrelation.h" EventCorrelation::EventCorrelation(uint32_t timeout) : eventPending(false) { diff --git a/fdir/EventCorrelation.h b/src/fsfw/fdir/EventCorrelation.h similarity index 100% rename from fdir/EventCorrelation.h rename to src/fsfw/fdir/EventCorrelation.h diff --git a/fdir/FailureIsolationBase.cpp b/src/fsfw/fdir/FailureIsolationBase.cpp similarity index 95% rename from fdir/FailureIsolationBase.cpp rename to src/fsfw/fdir/FailureIsolationBase.cpp index 764fc918..717e5072 100644 --- a/fdir/FailureIsolationBase.cpp +++ b/src/fsfw/fdir/FailureIsolationBase.cpp @@ -1,9 +1,9 @@ -#include "../events/EventManagerIF.h" -#include "FailureIsolationBase.h" -#include "../health/HasHealthIF.h" -#include "../health/HealthMessage.h" -#include "../ipc/QueueFactory.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/events/EventManagerIF.h" +#include "fsfw/fdir/FailureIsolationBase.h" +#include "fsfw/health/HasHealthIF.h" +#include "fsfw/health/HealthMessage.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/objectmanager/ObjectManager.h" FailureIsolationBase::FailureIsolationBase(object_id_t owner, object_id_t parent, uint8_t messageDepth, uint8_t parameterDomainBase) : diff --git a/fdir/FailureIsolationBase.h b/src/fsfw/fdir/FailureIsolationBase.h similarity index 100% rename from fdir/FailureIsolationBase.h rename to src/fsfw/fdir/FailureIsolationBase.h diff --git a/fdir/FaultCounter.cpp b/src/fsfw/fdir/FaultCounter.cpp similarity index 98% rename from fdir/FaultCounter.cpp rename to src/fsfw/fdir/FaultCounter.cpp index 53c1dd7d..0b30a67d 100644 --- a/fdir/FaultCounter.cpp +++ b/src/fsfw/fdir/FaultCounter.cpp @@ -1,4 +1,4 @@ -#include "FaultCounter.h" +#include "fsfw/fdir/FaultCounter.h" FaultCounter::FaultCounter(uint32_t failureThreshold, uint32_t decrementAfterMs, uint8_t setParameterDomain) : diff --git a/fdir/FaultCounter.h b/src/fsfw/fdir/FaultCounter.h similarity index 79% rename from fdir/FaultCounter.h rename to src/fsfw/fdir/FaultCounter.h index e0670c4b..a85e8cf7 100644 --- a/fdir/FaultCounter.h +++ b/src/fsfw/fdir/FaultCounter.h @@ -1,8 +1,8 @@ -#ifndef FRAMEWORK_FDIR_FAULTCOUNTER_H_ -#define FRAMEWORK_FDIR_FAULTCOUNTER_H_ +#ifndef FSFW_FDIR_FAULTCOUNTER_H_ +#define FSFW_FDIR_FAULTCOUNTER_H_ -#include "../parameters/HasParametersIF.h" -#include "../timemanager/Countdown.h" +#include "fsfw/parameters/HasParametersIF.h" +#include "fsfw/timemanager/Countdown.h" class FaultCounter: public HasParametersIF { public: @@ -35,4 +35,4 @@ private: uint32_t failureThreshold; }; -#endif /* FRAMEWORK_FDIR_FAULTCOUNTER_H_ */ +#endif /* FSFW_FDIR_FAULTCOUNTER_H_ */ diff --git a/globalfunctions/AsciiConverter.cpp b/src/fsfw/globalfunctions/AsciiConverter.cpp similarity index 99% rename from globalfunctions/AsciiConverter.cpp rename to src/fsfw/globalfunctions/AsciiConverter.cpp index 9eb3698f..09908815 100644 --- a/globalfunctions/AsciiConverter.cpp +++ b/src/fsfw/globalfunctions/AsciiConverter.cpp @@ -1,4 +1,5 @@ -#include "AsciiConverter.h" +#include "fsfw/globalfunctions/AsciiConverter.h" + #include #include diff --git a/globalfunctions/AsciiConverter.h b/src/fsfw/globalfunctions/AsciiConverter.h similarity index 100% rename from globalfunctions/AsciiConverter.h rename to src/fsfw/globalfunctions/AsciiConverter.h diff --git a/globalfunctions/CMakeLists.txt b/src/fsfw/globalfunctions/CMakeLists.txt similarity index 100% rename from globalfunctions/CMakeLists.txt rename to src/fsfw/globalfunctions/CMakeLists.txt diff --git a/globalfunctions/CRC.cpp b/src/fsfw/globalfunctions/CRC.cpp similarity index 99% rename from globalfunctions/CRC.cpp rename to src/fsfw/globalfunctions/CRC.cpp index 7bb56806..3df6018c 100644 --- a/globalfunctions/CRC.cpp +++ b/src/fsfw/globalfunctions/CRC.cpp @@ -1,4 +1,4 @@ -#include "CRC.h" +#include "fsfw/globalfunctions/CRC.h" #include const uint16_t CRC::crc16ccitt_table[256] = { diff --git a/globalfunctions/CRC.h b/src/fsfw/globalfunctions/CRC.h similarity index 100% rename from globalfunctions/CRC.h rename to src/fsfw/globalfunctions/CRC.h diff --git a/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp similarity index 98% rename from globalfunctions/DleEncoder.cpp rename to src/fsfw/globalfunctions/DleEncoder.cpp index 8520389d..11df8ad7 100644 --- a/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -1,4 +1,4 @@ -#include "../globalfunctions/DleEncoder.h" +#include "fsfw/globalfunctions/DleEncoder.h" DleEncoder::DleEncoder() {} diff --git a/globalfunctions/DleEncoder.h b/src/fsfw/globalfunctions/DleEncoder.h similarity index 100% rename from globalfunctions/DleEncoder.h rename to src/fsfw/globalfunctions/DleEncoder.h diff --git a/globalfunctions/PeriodicOperationDivider.cpp b/src/fsfw/globalfunctions/PeriodicOperationDivider.cpp similarity index 93% rename from globalfunctions/PeriodicOperationDivider.cpp rename to src/fsfw/globalfunctions/PeriodicOperationDivider.cpp index 28e98feb..62cc6f4c 100644 --- a/globalfunctions/PeriodicOperationDivider.cpp +++ b/src/fsfw/globalfunctions/PeriodicOperationDivider.cpp @@ -1,4 +1,4 @@ -#include "PeriodicOperationDivider.h" +#include "fsfw/globalfunctions/PeriodicOperationDivider.h" PeriodicOperationDivider::PeriodicOperationDivider(uint32_t divider, diff --git a/globalfunctions/PeriodicOperationDivider.h b/src/fsfw/globalfunctions/PeriodicOperationDivider.h similarity index 100% rename from globalfunctions/PeriodicOperationDivider.h rename to src/fsfw/globalfunctions/PeriodicOperationDivider.h diff --git a/globalfunctions/Type.cpp b/src/fsfw/globalfunctions/Type.cpp similarity index 97% rename from globalfunctions/Type.cpp rename to src/fsfw/globalfunctions/Type.cpp index fa6d2f28..5f1e05d1 100644 --- a/globalfunctions/Type.cpp +++ b/src/fsfw/globalfunctions/Type.cpp @@ -1,5 +1,5 @@ -#include "Type.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/globalfunctions/Type.h" +#include "fsfw/serialize/SerializeAdapter.h" Type::Type() : actualType(UNKNOWN_TYPE) { diff --git a/globalfunctions/Type.h b/src/fsfw/globalfunctions/Type.h similarity index 96% rename from globalfunctions/Type.h rename to src/fsfw/globalfunctions/Type.h index fa894e3e..cfbb3cfa 100644 --- a/globalfunctions/Type.h +++ b/src/fsfw/globalfunctions/Type.h @@ -1,8 +1,9 @@ #ifndef FSFW_GLOBALFUNCTIONS_TYPE_H_ #define FSFW_GLOBALFUNCTIONS_TYPE_H_ -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../serialize/SerializeIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/serialize/SerializeIF.h" + #include /** diff --git a/globalfunctions/arrayprinter.cpp b/src/fsfw/globalfunctions/arrayprinter.cpp similarity index 97% rename from globalfunctions/arrayprinter.cpp rename to src/fsfw/globalfunctions/arrayprinter.cpp index 3c729c6b..45a1cb38 100644 --- a/globalfunctions/arrayprinter.cpp +++ b/src/fsfw/globalfunctions/arrayprinter.cpp @@ -1,5 +1,6 @@ -#include "arrayprinter.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/globalfunctions/arrayprinter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + #include diff --git a/globalfunctions/arrayprinter.h b/src/fsfw/globalfunctions/arrayprinter.h similarity index 100% rename from globalfunctions/arrayprinter.h rename to src/fsfw/globalfunctions/arrayprinter.h diff --git a/globalfunctions/bitutility.cpp b/src/fsfw/globalfunctions/bitutility.cpp similarity index 94% rename from globalfunctions/bitutility.cpp rename to src/fsfw/globalfunctions/bitutility.cpp index 5cc92dac..628e30c2 100644 --- a/globalfunctions/bitutility.cpp +++ b/src/fsfw/globalfunctions/bitutility.cpp @@ -1,4 +1,4 @@ -#include "bitutility.h" +#include "fsfw/globalfunctions/bitutility.h" void bitutil::bitSet(uint8_t *byte, uint8_t position) { if(position > 7) { diff --git a/globalfunctions/bitutility.h b/src/fsfw/globalfunctions/bitutility.h similarity index 100% rename from globalfunctions/bitutility.h rename to src/fsfw/globalfunctions/bitutility.h diff --git a/globalfunctions/constants.h b/src/fsfw/globalfunctions/constants.h similarity index 100% rename from globalfunctions/constants.h rename to src/fsfw/globalfunctions/constants.h diff --git a/globalfunctions/matching/BinaryMatcher.h b/src/fsfw/globalfunctions/matching/BinaryMatcher.h similarity index 100% rename from globalfunctions/matching/BinaryMatcher.h rename to src/fsfw/globalfunctions/matching/BinaryMatcher.h diff --git a/globalfunctions/matching/DecimalMatcher.h b/src/fsfw/globalfunctions/matching/DecimalMatcher.h similarity index 100% rename from globalfunctions/matching/DecimalMatcher.h rename to src/fsfw/globalfunctions/matching/DecimalMatcher.h diff --git a/globalfunctions/matching/MatchTree.h b/src/fsfw/globalfunctions/matching/MatchTree.h similarity index 100% rename from globalfunctions/matching/MatchTree.h rename to src/fsfw/globalfunctions/matching/MatchTree.h diff --git a/globalfunctions/matching/MatcherIF.h b/src/fsfw/globalfunctions/matching/MatcherIF.h similarity index 100% rename from globalfunctions/matching/MatcherIF.h rename to src/fsfw/globalfunctions/matching/MatcherIF.h diff --git a/globalfunctions/matching/RangeMatcher.h b/src/fsfw/globalfunctions/matching/RangeMatcher.h similarity index 100% rename from globalfunctions/matching/RangeMatcher.h rename to src/fsfw/globalfunctions/matching/RangeMatcher.h diff --git a/globalfunctions/matching/SerializeableMatcherIF.h b/src/fsfw/globalfunctions/matching/SerializeableMatcherIF.h similarity index 100% rename from globalfunctions/matching/SerializeableMatcherIF.h rename to src/fsfw/globalfunctions/matching/SerializeableMatcherIF.h diff --git a/globalfunctions/math/CMakeLists.txt b/src/fsfw/globalfunctions/math/CMakeLists.txt similarity index 100% rename from globalfunctions/math/CMakeLists.txt rename to src/fsfw/globalfunctions/math/CMakeLists.txt diff --git a/globalfunctions/math/MatrixOperations.h b/src/fsfw/globalfunctions/math/MatrixOperations.h similarity index 100% rename from globalfunctions/math/MatrixOperations.h rename to src/fsfw/globalfunctions/math/MatrixOperations.h diff --git a/globalfunctions/math/QuaternionOperations.cpp b/src/fsfw/globalfunctions/math/QuaternionOperations.cpp similarity index 97% rename from globalfunctions/math/QuaternionOperations.cpp rename to src/fsfw/globalfunctions/math/QuaternionOperations.cpp index c09426da..31ba2044 100644 --- a/globalfunctions/math/QuaternionOperations.cpp +++ b/src/fsfw/globalfunctions/math/QuaternionOperations.cpp @@ -1,5 +1,5 @@ -#include "QuaternionOperations.h" -#include "VectorOperations.h" +#include "fsfw/globalfunctions/math/QuaternionOperations.h" +#include "fsfw/globalfunctions/math/VectorOperations.h" #include #include diff --git a/globalfunctions/math/QuaternionOperations.h b/src/fsfw/globalfunctions/math/QuaternionOperations.h similarity index 100% rename from globalfunctions/math/QuaternionOperations.h rename to src/fsfw/globalfunctions/math/QuaternionOperations.h diff --git a/globalfunctions/math/VectorOperations.h b/src/fsfw/globalfunctions/math/VectorOperations.h similarity index 100% rename from globalfunctions/math/VectorOperations.h rename to src/fsfw/globalfunctions/math/VectorOperations.h diff --git a/globalfunctions/sign.h b/src/fsfw/globalfunctions/sign.h similarity index 100% rename from globalfunctions/sign.h rename to src/fsfw/globalfunctions/sign.h diff --git a/globalfunctions/timevalOperations.cpp b/src/fsfw/globalfunctions/timevalOperations.cpp similarity index 98% rename from globalfunctions/timevalOperations.cpp rename to src/fsfw/globalfunctions/timevalOperations.cpp index 1228da04..e91e7f57 100644 --- a/globalfunctions/timevalOperations.cpp +++ b/src/fsfw/globalfunctions/timevalOperations.cpp @@ -1,4 +1,4 @@ -#include "timevalOperations.h" +#include "fsfw/globalfunctions/timevalOperations.h" timeval& operator+=(timeval& lhs, const timeval& rhs) { int64_t sum = lhs.tv_sec * 1000000. + lhs.tv_usec; diff --git a/globalfunctions/timevalOperations.h b/src/fsfw/globalfunctions/timevalOperations.h similarity index 100% rename from globalfunctions/timevalOperations.h rename to src/fsfw/globalfunctions/timevalOperations.h diff --git a/src/fsfw/health.h b/src/fsfw/health.h new file mode 100644 index 00000000..0b7c8793 --- /dev/null +++ b/src/fsfw/health.h @@ -0,0 +1,9 @@ +#ifndef FSFW_INC_FSFW_HEALTH_H_ +#define FSFW_INC_FSFW_HEALTH_H_ + +#include "src/core/health/HasHealthIF.h" +#include "src/core/health/HealthHelper.h" +#include "src/core/health/HealthMessage.h" +#include "src/core/health/HealthTable.h" + +#endif /* FSFW_INC_FSFW_HEALTH_H_ */ diff --git a/health/CMakeLists.txt b/src/fsfw/health/CMakeLists.txt similarity index 100% rename from health/CMakeLists.txt rename to src/fsfw/health/CMakeLists.txt diff --git a/health/HasHealthIF.h b/src/fsfw/health/HasHealthIF.h similarity index 100% rename from health/HasHealthIF.h rename to src/fsfw/health/HasHealthIF.h diff --git a/health/HealthHelper.cpp b/src/fsfw/health/HealthHelper.cpp similarity index 97% rename from health/HealthHelper.cpp rename to src/fsfw/health/HealthHelper.cpp index 28419108..6bbbe25b 100644 --- a/health/HealthHelper.cpp +++ b/src/fsfw/health/HealthHelper.cpp @@ -1,5 +1,6 @@ -#include "HealthHelper.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/health/HealthHelper.h" + +#include "fsfw/serviceinterface/ServiceInterface.h" HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId) : objectId(objectId), owner(owner) { diff --git a/health/HealthHelper.h b/src/fsfw/health/HealthHelper.h similarity index 100% rename from health/HealthHelper.h rename to src/fsfw/health/HealthHelper.h diff --git a/health/HealthMessage.cpp b/src/fsfw/health/HealthMessage.cpp similarity index 95% rename from health/HealthMessage.cpp rename to src/fsfw/health/HealthMessage.cpp index 52479c26..31b6273b 100644 --- a/health/HealthMessage.cpp +++ b/src/fsfw/health/HealthMessage.cpp @@ -1,4 +1,4 @@ -#include "HealthMessage.h" +#include "fsfw/health/HealthMessage.h" void HealthMessage::setHealthMessage(CommandMessage* message, Command_t command, HasHealthIF::HealthState health, HasHealthIF::HealthState oldHealth) { diff --git a/health/HealthMessage.h b/src/fsfw/health/HealthMessage.h similarity index 96% rename from health/HealthMessage.h rename to src/fsfw/health/HealthMessage.h index fb979c66..3dc58977 100644 --- a/health/HealthMessage.h +++ b/src/fsfw/health/HealthMessage.h @@ -2,7 +2,7 @@ #define FSFW_HEALTH_HEALTHMESSAGE_H_ #include "HasHealthIF.h" -#include "../ipc/CommandMessage.h" +#include "fsfw/ipc/CommandMessage.h" class HealthMessage { public: diff --git a/health/HealthTable.cpp b/src/fsfw/health/HealthTable.cpp similarity index 95% rename from health/HealthTable.cpp rename to src/fsfw/health/HealthTable.cpp index 3fed1deb..a3300462 100644 --- a/health/HealthTable.cpp +++ b/src/fsfw/health/HealthTable.cpp @@ -1,7 +1,8 @@ -#include "HealthTable.h" -#include "../ipc/MutexGuard.h" -#include "../ipc/MutexFactory.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/health/HealthTable.h" + +#include "fsfw/ipc/MutexGuard.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/serialize/SerializeAdapter.h" HealthTable::HealthTable(object_id_t objectid) : SystemObject(objectid) { diff --git a/health/HealthTable.h b/src/fsfw/health/HealthTable.h similarity index 100% rename from health/HealthTable.h rename to src/fsfw/health/HealthTable.h diff --git a/health/HealthTableIF.h b/src/fsfw/health/HealthTableIF.h similarity index 100% rename from health/HealthTableIF.h rename to src/fsfw/health/HealthTableIF.h diff --git a/health/ManagesHealthIF.h b/src/fsfw/health/ManagesHealthIF.h similarity index 100% rename from health/ManagesHealthIF.h rename to src/fsfw/health/ManagesHealthIF.h diff --git a/src/fsfw/housekeeping.h b/src/fsfw/housekeeping.h new file mode 100644 index 00000000..0627d523 --- /dev/null +++ b/src/fsfw/housekeeping.h @@ -0,0 +1,9 @@ +#ifndef FSFW_INC_FSFW_HOUSEKEEPING_H_ +#define FSFW_INC_FSFW_HOUSEKEEPING_H_ + +#include "src/core/housekeeping/HousekeepingMessage.h" +#include "src/core/housekeeping/HousekeepingPacketDownlink.h" +#include "src/core/housekeeping/HousekeepingSetPacket.h" +#include "src/core/housekeeping/HousekeepingSnapshot.h" + +#endif /* FSFW_INC_FSFW_HOUSEKEEPING_H_ */ diff --git a/housekeeping/AcceptsHkPacketsIF.h b/src/fsfw/housekeeping/AcceptsHkPacketsIF.h similarity index 100% rename from housekeeping/AcceptsHkPacketsIF.h rename to src/fsfw/housekeeping/AcceptsHkPacketsIF.h diff --git a/housekeeping/CMakeLists.txt b/src/fsfw/housekeeping/CMakeLists.txt similarity index 100% rename from housekeeping/CMakeLists.txt rename to src/fsfw/housekeeping/CMakeLists.txt diff --git a/housekeeping/HousekeepingMessage.cpp b/src/fsfw/housekeeping/HousekeepingMessage.cpp similarity index 98% rename from housekeeping/HousekeepingMessage.cpp rename to src/fsfw/housekeeping/HousekeepingMessage.cpp index 71f7ff17..432a8620 100644 --- a/housekeeping/HousekeepingMessage.cpp +++ b/src/fsfw/housekeeping/HousekeepingMessage.cpp @@ -1,6 +1,7 @@ -#include "HousekeepingMessage.h" +#include "fsfw/housekeeping/HousekeepingMessage.h" + +#include "fsfw/objectmanager/ObjectManager.h" -#include "../objectmanager/ObjectManager.h" #include HousekeepingMessage::~HousekeepingMessage() {} diff --git a/housekeeping/HousekeepingMessage.h b/src/fsfw/housekeeping/HousekeepingMessage.h similarity index 95% rename from housekeeping/HousekeepingMessage.h rename to src/fsfw/housekeeping/HousekeepingMessage.h index a38ff73f..509a68c9 100644 --- a/housekeeping/HousekeepingMessage.h +++ b/src/fsfw/housekeeping/HousekeepingMessage.h @@ -1,11 +1,11 @@ #ifndef FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_ #define FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_ -#include "../datapoollocal/localPoolDefinitions.h" -#include "../ipc/CommandMessage.h" -#include "../ipc/FwMessageTypes.h" -#include "../objectmanager/frameworkObjects.h" -#include "../storagemanager/StorageManagerIF.h" +#include "fsfw/datapoollocal/localPoolDefinitions.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/ipc/FwMessageTypes.h" +#include "fsfw/objectmanager/frameworkObjects.h" +#include "fsfw/storagemanager/StorageManagerIF.h" /** diff --git a/housekeeping/HousekeepingPacketDownlink.h b/src/fsfw/housekeeping/HousekeepingPacketDownlink.h similarity index 100% rename from housekeeping/HousekeepingPacketDownlink.h rename to src/fsfw/housekeeping/HousekeepingPacketDownlink.h diff --git a/housekeeping/HousekeepingSetPacket.h b/src/fsfw/housekeeping/HousekeepingSetPacket.h similarity index 100% rename from housekeeping/HousekeepingSetPacket.h rename to src/fsfw/housekeeping/HousekeepingSetPacket.h diff --git a/housekeeping/HousekeepingSnapshot.h b/src/fsfw/housekeeping/HousekeepingSnapshot.h similarity index 100% rename from housekeeping/HousekeepingSnapshot.h rename to src/fsfw/housekeeping/HousekeepingSnapshot.h diff --git a/housekeeping/PeriodicHousekeepingHelper.cpp b/src/fsfw/housekeeping/PeriodicHousekeepingHelper.cpp similarity index 96% rename from housekeeping/PeriodicHousekeepingHelper.cpp rename to src/fsfw/housekeeping/PeriodicHousekeepingHelper.cpp index 892eb354..68740d33 100644 --- a/housekeeping/PeriodicHousekeepingHelper.cpp +++ b/src/fsfw/housekeeping/PeriodicHousekeepingHelper.cpp @@ -1,6 +1,6 @@ -#include "PeriodicHousekeepingHelper.h" +#include "fsfw/housekeeping/PeriodicHousekeepingHelper.h" -#include "../datapoollocal/LocalPoolDataSetBase.h" +#include "fsfw/datapoollocal/LocalPoolDataSetBase.h" #include PeriodicHousekeepingHelper::PeriodicHousekeepingHelper( diff --git a/housekeeping/PeriodicHousekeepingHelper.h b/src/fsfw/housekeeping/PeriodicHousekeepingHelper.h similarity index 96% rename from housekeeping/PeriodicHousekeepingHelper.h rename to src/fsfw/housekeeping/PeriodicHousekeepingHelper.h index 3256fbff..4e93308b 100644 --- a/housekeeping/PeriodicHousekeepingHelper.h +++ b/src/fsfw/housekeeping/PeriodicHousekeepingHelper.h @@ -1,7 +1,7 @@ #ifndef FSFW_HOUSEKEEPING_PERIODICHOUSEKEEPINGHELPER_H_ #define FSFW_HOUSEKEEPING_PERIODICHOUSEKEEPINGHELPER_H_ -#include "../timemanager/Clock.h" +#include "fsfw/timemanager/Clock.h" #include class LocalPoolDataSetBase; diff --git a/internalError/CMakeLists.txt b/src/fsfw/internalerror/CMakeLists.txt similarity index 100% rename from internalError/CMakeLists.txt rename to src/fsfw/internalerror/CMakeLists.txt diff --git a/internalError/InternalErrorDataset.h b/src/fsfw/internalerror/InternalErrorDataset.h similarity index 100% rename from internalError/InternalErrorDataset.h rename to src/fsfw/internalerror/InternalErrorDataset.h diff --git a/internalError/InternalErrorReporter.cpp b/src/fsfw/internalerror/InternalErrorReporter.cpp similarity index 96% rename from internalError/InternalErrorReporter.cpp rename to src/fsfw/internalerror/InternalErrorReporter.cpp index 78618448..8689ab3e 100644 --- a/internalError/InternalErrorReporter.cpp +++ b/src/fsfw/internalerror/InternalErrorReporter.cpp @@ -1,9 +1,9 @@ -#include "InternalErrorReporter.h" +#include "fsfw/internalerror/InternalErrorReporter.h" -#include "../ipc/QueueFactory.h" -#include "../ipc/MutexFactory.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../datapool/PoolReadGuard.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/datapool/PoolReadGuard.h" InternalErrorReporter::InternalErrorReporter(object_id_t setObjectId, uint32_t messageQueueDepth): SystemObject(setObjectId), diff --git a/internalError/InternalErrorReporter.h b/src/fsfw/internalerror/InternalErrorReporter.h similarity index 91% rename from internalError/InternalErrorReporter.h rename to src/fsfw/internalerror/InternalErrorReporter.h index 580cb8f6..57a6a135 100644 --- a/internalError/InternalErrorReporter.h +++ b/src/fsfw/internalerror/InternalErrorReporter.h @@ -3,12 +3,12 @@ #include "InternalErrorReporterIF.h" -#include "../tasks/PeriodicTaskIF.h" -#include "../internalError/InternalErrorDataset.h" -#include "../datapoollocal/LocalDataPoolManager.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../objectmanager/SystemObject.h" -#include "../ipc/MutexIF.h" +#include "fsfw/tasks/PeriodicTaskIF.h" +#include "fsfw/internalerror/InternalErrorDataset.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/ipc/MutexIF.h" /** * @brief This class is used to track internal errors like lost telemetry, diff --git a/internalError/InternalErrorReporterIF.h b/src/fsfw/internalerror/InternalErrorReporterIF.h similarity index 100% rename from internalError/InternalErrorReporterIF.h rename to src/fsfw/internalerror/InternalErrorReporterIF.h diff --git a/ipc/CMakeLists.txt b/src/fsfw/ipc/CMakeLists.txt similarity index 100% rename from ipc/CMakeLists.txt rename to src/fsfw/ipc/CMakeLists.txt diff --git a/ipc/CommandMessage.cpp b/src/fsfw/ipc/CommandMessage.cpp similarity index 97% rename from ipc/CommandMessage.cpp rename to src/fsfw/ipc/CommandMessage.cpp index 513debd3..9448d152 100644 --- a/ipc/CommandMessage.cpp +++ b/src/fsfw/ipc/CommandMessage.cpp @@ -1,5 +1,6 @@ -#include "CommandMessage.h" -#include "CommandMessageCleaner.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/ipc/CommandMessageCleaner.h" + #include CommandMessage::CommandMessage() { diff --git a/ipc/CommandMessage.h b/src/fsfw/ipc/CommandMessage.h similarity index 100% rename from ipc/CommandMessage.h rename to src/fsfw/ipc/CommandMessage.h diff --git a/ipc/CommandMessageCleaner.cpp b/src/fsfw/ipc/CommandMessageCleaner.cpp similarity index 64% rename from ipc/CommandMessageCleaner.cpp rename to src/fsfw/ipc/CommandMessageCleaner.cpp index 29998124..0918d739 100644 --- a/ipc/CommandMessageCleaner.cpp +++ b/src/fsfw/ipc/CommandMessageCleaner.cpp @@ -1,15 +1,18 @@ -#include "CommandMessageCleaner.h" +#include "fsfw/FSFW.h" +#include "fsfw/ipc/CommandMessageCleaner.h" -#include "../memory/GenericFileSystemMessage.h" -#include "../devicehandlers/DeviceHandlerMessage.h" -#include "../health/HealthMessage.h" -#include "../memory/MemoryMessage.h" -#include "../modes/ModeMessage.h" -#include "../monitoring/MonitoringMessage.h" -#include "../subsystem/modes/ModeSequenceMessage.h" -#include "../tmstorage/TmStoreMessage.h" -#include "../housekeeping/HousekeepingMessage.h" -#include "../parameters/ParameterMessage.h" +#include "fsfw/memory/GenericFileSystemMessage.h" +#include "fsfw/devicehandlers/DeviceHandlerMessage.h" +#include "fsfw/health/HealthMessage.h" +#include "fsfw/memory/MemoryMessage.h" +#include "fsfw/modes/ModeMessage.h" +#include "fsfw/monitoring/MonitoringMessage.h" +#include "fsfw/subsystem/modes/ModeSequenceMessage.h" +#include "fsfw/housekeeping/HousekeepingMessage.h" +#include "fsfw/parameters/ParameterMessage.h" +#ifdef FSFW_ADD_TMSTORAGE +#include "fsfw/tmstorage/TmStoreMessage.h" +#endif void CommandMessageCleaner::clearCommandMessage(CommandMessage* message) { switch(message->getMessageType()){ @@ -34,9 +37,11 @@ void CommandMessageCleaner::clearCommandMessage(CommandMessage* message) { case messagetypes::MONITORING: MonitoringMessage::clear(message); break; +#ifdef FSFW_ADD_TMSTORAGE case messagetypes::TM_STORE: TmStoreMessage::clear(message); break; +#endif case messagetypes::PARAMETER: ParameterMessage::clear(message); break; diff --git a/ipc/CommandMessageCleaner.h b/src/fsfw/ipc/CommandMessageCleaner.h similarity index 100% rename from ipc/CommandMessageCleaner.h rename to src/fsfw/ipc/CommandMessageCleaner.h diff --git a/ipc/CommandMessageIF.h b/src/fsfw/ipc/CommandMessageIF.h similarity index 100% rename from ipc/CommandMessageIF.h rename to src/fsfw/ipc/CommandMessageIF.h diff --git a/ipc/FwMessageTypes.h b/src/fsfw/ipc/FwMessageTypes.h similarity index 100% rename from ipc/FwMessageTypes.h rename to src/fsfw/ipc/FwMessageTypes.h diff --git a/ipc/MessageQueueIF.h b/src/fsfw/ipc/MessageQueueIF.h similarity index 100% rename from ipc/MessageQueueIF.h rename to src/fsfw/ipc/MessageQueueIF.h diff --git a/ipc/MessageQueueMessage.cpp b/src/fsfw/ipc/MessageQueueMessage.cpp similarity index 94% rename from ipc/MessageQueueMessage.cpp rename to src/fsfw/ipc/MessageQueueMessage.cpp index 1958af54..62b826e9 100644 --- a/ipc/MessageQueueMessage.cpp +++ b/src/fsfw/ipc/MessageQueueMessage.cpp @@ -1,6 +1,7 @@ -#include "MessageQueueMessage.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../globalfunctions/arrayprinter.h" +#include "fsfw/ipc/MessageQueueMessage.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/globalfunctions/arrayprinter.h" + #include MessageQueueMessage::MessageQueueMessage() : diff --git a/ipc/MessageQueueMessage.h b/src/fsfw/ipc/MessageQueueMessage.h similarity index 99% rename from ipc/MessageQueueMessage.h rename to src/fsfw/ipc/MessageQueueMessage.h index 111056ca..e9ef6756 100644 --- a/ipc/MessageQueueMessage.h +++ b/src/fsfw/ipc/MessageQueueMessage.h @@ -1,7 +1,7 @@ #ifndef FSFW_IPC_MESSAGEQUEUEMESSAGE_H_ #define FSFW_IPC_MESSAGEQUEUEMESSAGE_H_ -#include "../ipc/MessageQueueMessageIF.h" +#include "fsfw/ipc/MessageQueueMessageIF.h" #include /** diff --git a/ipc/MessageQueueMessageIF.h b/src/fsfw/ipc/MessageQueueMessageIF.h similarity index 100% rename from ipc/MessageQueueMessageIF.h rename to src/fsfw/ipc/MessageQueueMessageIF.h diff --git a/ipc/MessageQueueSenderIF.h b/src/fsfw/ipc/MessageQueueSenderIF.h similarity index 100% rename from ipc/MessageQueueSenderIF.h rename to src/fsfw/ipc/MessageQueueSenderIF.h diff --git a/ipc/MutexFactory.h b/src/fsfw/ipc/MutexFactory.h similarity index 100% rename from ipc/MutexFactory.h rename to src/fsfw/ipc/MutexFactory.h diff --git a/ipc/MutexGuard.h b/src/fsfw/ipc/MutexGuard.h similarity index 100% rename from ipc/MutexGuard.h rename to src/fsfw/ipc/MutexGuard.h diff --git a/ipc/MutexIF.h b/src/fsfw/ipc/MutexIF.h similarity index 100% rename from ipc/MutexIF.h rename to src/fsfw/ipc/MutexIF.h diff --git a/ipc/QueueFactory.h b/src/fsfw/ipc/QueueFactory.h similarity index 100% rename from ipc/QueueFactory.h rename to src/fsfw/ipc/QueueFactory.h diff --git a/ipc/messageQueueDefinitions.h b/src/fsfw/ipc/messageQueueDefinitions.h similarity index 100% rename from ipc/messageQueueDefinitions.h rename to src/fsfw/ipc/messageQueueDefinitions.h diff --git a/memory/AcceptsMemoryMessagesIF.h b/src/fsfw/memory/AcceptsMemoryMessagesIF.h similarity index 100% rename from memory/AcceptsMemoryMessagesIF.h rename to src/fsfw/memory/AcceptsMemoryMessagesIF.h diff --git a/memory/CMakeLists.txt b/src/fsfw/memory/CMakeLists.txt similarity index 100% rename from memory/CMakeLists.txt rename to src/fsfw/memory/CMakeLists.txt diff --git a/memory/GenericFileSystemMessage.cpp b/src/fsfw/memory/GenericFileSystemMessage.cpp similarity index 97% rename from memory/GenericFileSystemMessage.cpp rename to src/fsfw/memory/GenericFileSystemMessage.cpp index c35ead3c..bd36d87b 100644 --- a/memory/GenericFileSystemMessage.cpp +++ b/src/fsfw/memory/GenericFileSystemMessage.cpp @@ -1,7 +1,7 @@ -#include "GenericFileSystemMessage.h" +#include "fsfw/memory/GenericFileSystemMessage.h" -#include "../objectmanager/ObjectManager.h" -#include "../storagemanager/StorageManagerIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/storagemanager/StorageManagerIF.h" void GenericFileSystemMessage::setCreateFileCommand(CommandMessage* message, store_address_t storeId) { diff --git a/memory/GenericFileSystemMessage.h b/src/fsfw/memory/GenericFileSystemMessage.h similarity index 100% rename from memory/GenericFileSystemMessage.h rename to src/fsfw/memory/GenericFileSystemMessage.h diff --git a/memory/HasFileSystemIF.h b/src/fsfw/memory/HasFileSystemIF.h similarity index 98% rename from memory/HasFileSystemIF.h rename to src/fsfw/memory/HasFileSystemIF.h index ec941f59..c897f0db 100644 --- a/memory/HasFileSystemIF.h +++ b/src/fsfw/memory/HasFileSystemIF.h @@ -81,7 +81,7 @@ public: * @param args Any other arguments which an implementation might require * @return */ - virtual ReturnValue_t deleteFile(const char* repositoryPath, + virtual ReturnValue_t removeFile(const char* repositoryPath, const char* filename, void* args = nullptr) = 0; /** diff --git a/memory/HasMemoryIF.h b/src/fsfw/memory/HasMemoryIF.h similarity index 100% rename from memory/HasMemoryIF.h rename to src/fsfw/memory/HasMemoryIF.h diff --git a/memory/MemoryHelper.cpp b/src/fsfw/memory/MemoryHelper.cpp similarity index 95% rename from memory/MemoryHelper.cpp rename to src/fsfw/memory/MemoryHelper.cpp index d83a9fab..2039a488 100644 --- a/memory/MemoryHelper.cpp +++ b/src/fsfw/memory/MemoryHelper.cpp @@ -1,10 +1,10 @@ -#include "MemoryHelper.h" -#include "MemoryMessage.h" +#include "fsfw/memory/MemoryHelper.h" +#include "fsfw/memory/MemoryMessage.h" -#include "../globalfunctions/CRC.h" -#include "../objectmanager/ObjectManager.h" -#include "../serialize/EndianConverter.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serialize/EndianConverter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" MemoryHelper::MemoryHelper(HasMemoryIF* workOnThis, MessageQueueIF* useThisQueue): diff --git a/memory/MemoryHelper.h b/src/fsfw/memory/MemoryHelper.h similarity index 100% rename from memory/MemoryHelper.h rename to src/fsfw/memory/MemoryHelper.h diff --git a/memory/MemoryMessage.cpp b/src/fsfw/memory/MemoryMessage.cpp similarity index 97% rename from memory/MemoryMessage.cpp rename to src/fsfw/memory/MemoryMessage.cpp index 1f050ef8..9df52609 100644 --- a/memory/MemoryMessage.cpp +++ b/src/fsfw/memory/MemoryMessage.cpp @@ -1,6 +1,6 @@ -#include "MemoryMessage.h" +#include "fsfw/memory/MemoryMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/ObjectManager.h" uint32_t MemoryMessage::getAddress(const CommandMessage* message) { return message->getParameter(); diff --git a/memory/MemoryMessage.h b/src/fsfw/memory/MemoryMessage.h similarity index 100% rename from memory/MemoryMessage.h rename to src/fsfw/memory/MemoryMessage.h diff --git a/modes/CMakeLists.txt b/src/fsfw/modes/CMakeLists.txt similarity index 100% rename from modes/CMakeLists.txt rename to src/fsfw/modes/CMakeLists.txt diff --git a/modes/HasModesIF.h b/src/fsfw/modes/HasModesIF.h similarity index 100% rename from modes/HasModesIF.h rename to src/fsfw/modes/HasModesIF.h diff --git a/modes/ModeHelper.cpp b/src/fsfw/modes/ModeHelper.cpp similarity index 95% rename from modes/ModeHelper.cpp rename to src/fsfw/modes/ModeHelper.cpp index 6be4f776..d2c5067d 100644 --- a/modes/ModeHelper.cpp +++ b/src/fsfw/modes/ModeHelper.cpp @@ -1,8 +1,8 @@ -#include "HasModesIF.h" -#include "ModeHelper.h" +#include "fsfw/modes/HasModesIF.h" +#include "fsfw/modes/ModeHelper.h" -#include "../ipc/MessageQueueSenderIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" ModeHelper::ModeHelper(HasModesIF *owner) : commandedMode(HasModesIF::MODE_OFF), diff --git a/modes/ModeHelper.h b/src/fsfw/modes/ModeHelper.h similarity index 89% rename from modes/ModeHelper.h rename to src/fsfw/modes/ModeHelper.h index c2f089ec..27928a29 100644 --- a/modes/ModeHelper.h +++ b/src/fsfw/modes/ModeHelper.h @@ -2,9 +2,9 @@ #define FSFW_MODES_MODEHELPER_H_ #include "ModeMessage.h" -#include "../ipc/MessageQueueIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../timemanager/Countdown.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/timemanager/Countdown.h" class HasModesIF; diff --git a/modes/ModeMessage.cpp b/src/fsfw/modes/ModeMessage.cpp similarity index 95% rename from modes/ModeMessage.cpp rename to src/fsfw/modes/ModeMessage.cpp index b33bba60..a228304d 100644 --- a/modes/ModeMessage.cpp +++ b/src/fsfw/modes/ModeMessage.cpp @@ -1,4 +1,4 @@ -#include "ModeMessage.h" +#include "fsfw/modes/ModeMessage.h" Mode_t ModeMessage::getMode(const CommandMessage* message) { return message->getParameter(); diff --git a/modes/ModeMessage.h b/src/fsfw/modes/ModeMessage.h similarity index 100% rename from modes/ModeMessage.h rename to src/fsfw/modes/ModeMessage.h diff --git a/monitoring/AbsLimitMonitor.h b/src/fsfw/monitoring/AbsLimitMonitor.h similarity index 98% rename from monitoring/AbsLimitMonitor.h rename to src/fsfw/monitoring/AbsLimitMonitor.h index 5feb369c..f3bbf04c 100644 --- a/monitoring/AbsLimitMonitor.h +++ b/src/fsfw/monitoring/AbsLimitMonitor.h @@ -1,6 +1,7 @@ #ifndef FSFW_MONITORING_ABSLIMITMONITOR_H_ #define FSFW_MONITORING_ABSLIMITMONITOR_H_ +#include "monitoringConf.h" #include "MonitorBase.h" #include diff --git a/monitoring/CMakeLists.txt b/src/fsfw/monitoring/CMakeLists.txt similarity index 100% rename from monitoring/CMakeLists.txt rename to src/fsfw/monitoring/CMakeLists.txt diff --git a/monitoring/HasMonitorsIF.h b/src/fsfw/monitoring/HasMonitorsIF.h similarity index 96% rename from monitoring/HasMonitorsIF.h rename to src/fsfw/monitoring/HasMonitorsIF.h index 04f63437..20520952 100644 --- a/monitoring/HasMonitorsIF.h +++ b/src/fsfw/monitoring/HasMonitorsIF.h @@ -1,6 +1,7 @@ #ifndef FSFW_MONITORING_HASMONITORSIF_H_ #define FSFW_MONITORING_HASMONITORSIF_H_ +#include "monitoringConf.h" #include "../events/EventReportingProxyIF.h" #include "../objectmanager/ObjectManagerIF.h" #include "../ipc/MessageQueueSenderIF.h" diff --git a/monitoring/LimitMonitor.h b/src/fsfw/monitoring/LimitMonitor.h similarity index 99% rename from monitoring/LimitMonitor.h rename to src/fsfw/monitoring/LimitMonitor.h index cd8b8d13..2565ebaa 100644 --- a/monitoring/LimitMonitor.h +++ b/src/fsfw/monitoring/LimitMonitor.h @@ -1,6 +1,7 @@ #ifndef FRAMEWORK_MONITORING_LIMITMONITOR_H_ #define FRAMEWORK_MONITORING_LIMITMONITOR_H_ +#include "monitoringConf.h" #include "MonitorBase.h" /** diff --git a/monitoring/LimitViolationReporter.cpp b/src/fsfw/monitoring/LimitViolationReporter.cpp similarity index 87% rename from monitoring/LimitViolationReporter.cpp rename to src/fsfw/monitoring/LimitViolationReporter.cpp index 2de1e008..a0b8a4cb 100644 --- a/monitoring/LimitViolationReporter.cpp +++ b/src/fsfw/monitoring/LimitViolationReporter.cpp @@ -1,9 +1,9 @@ -#include "LimitViolationReporter.h" -#include "MonitoringIF.h" -#include "ReceivesMonitoringReportsIF.h" +#include "fsfw/monitoring/LimitViolationReporter.h" +#include "fsfw/monitoring/MonitoringIF.h" +#include "fsfw/monitoring/ReceivesMonitoringReportsIF.h" -#include "../objectmanager/ObjectManager.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serialize/SerializeAdapter.h" ReturnValue_t LimitViolationReporter::sendLimitViolationReport(const SerializeIF* data) { ReturnValue_t result = checkClassLoaded(); diff --git a/monitoring/LimitViolationReporter.h b/src/fsfw/monitoring/LimitViolationReporter.h similarity index 96% rename from monitoring/LimitViolationReporter.h rename to src/fsfw/monitoring/LimitViolationReporter.h index a71b972f..b254e312 100644 --- a/monitoring/LimitViolationReporter.h +++ b/src/fsfw/monitoring/LimitViolationReporter.h @@ -7,6 +7,7 @@ #ifndef LIMITVIOLATIONREPORTER_H_ #define LIMITVIOLATIONREPORTER_H_ +#include "monitoringConf.h" #include "../returnvalues/HasReturnvaluesIF.h" #include "../serialize/SerializeIF.h" #include "../storagemanager/StorageManagerIF.h" diff --git a/monitoring/MonitorBase.h b/src/fsfw/monitoring/MonitorBase.h similarity index 98% rename from monitoring/MonitorBase.h rename to src/fsfw/monitoring/MonitorBase.h index 967f0f62..261b3eac 100644 --- a/monitoring/MonitorBase.h +++ b/src/fsfw/monitoring/MonitorBase.h @@ -1,6 +1,7 @@ #ifndef FSFW_MONITORING_MONITORBASE_H_ #define FSFW_MONITORING_MONITORBASE_H_ +#include "monitoringConf.h" #include "LimitViolationReporter.h" #include "MonitoringIF.h" #include "MonitoringMessageContent.h" diff --git a/monitoring/MonitorReporter.h b/src/fsfw/monitoring/MonitorReporter.h similarity index 99% rename from monitoring/MonitorReporter.h rename to src/fsfw/monitoring/MonitorReporter.h index d155594d..e27d0101 100644 --- a/monitoring/MonitorReporter.h +++ b/src/fsfw/monitoring/MonitorReporter.h @@ -1,6 +1,7 @@ #ifndef FSFW_MONITORING_MONITORREPORTER_H_ #define FSFW_MONITORING_MONITORREPORTER_H_ +#include "monitoringConf.h" #include "LimitViolationReporter.h" #include "MonitoringIF.h" #include "MonitoringMessageContent.h" diff --git a/monitoring/MonitoringIF.h b/src/fsfw/monitoring/MonitoringIF.h similarity index 98% rename from monitoring/MonitoringIF.h rename to src/fsfw/monitoring/MonitoringIF.h index 32c62530..9c35b419 100644 --- a/monitoring/MonitoringIF.h +++ b/src/fsfw/monitoring/MonitoringIF.h @@ -1,8 +1,8 @@ #ifndef FSFW_MONITORING_MONITORINGIF_H_ #define FSFW_MONITORING_MONITORINGIF_H_ +#include "monitoringConf.h" #include "MonitoringMessage.h" -#include "../memory/HasMemoryIF.h" #include "../serialize/SerializeIF.h" class MonitoringIF : public SerializeIF { @@ -62,6 +62,4 @@ public: } }; - - #endif /* FSFW_MONITORING_MONITORINGIF_H_ */ diff --git a/monitoring/MonitoringMessage.cpp b/src/fsfw/monitoring/MonitoringMessage.cpp similarity index 91% rename from monitoring/MonitoringMessage.cpp rename to src/fsfw/monitoring/MonitoringMessage.cpp index 6e5f49cc..8bbb7765 100644 --- a/monitoring/MonitoringMessage.cpp +++ b/src/fsfw/monitoring/MonitoringMessage.cpp @@ -1,5 +1,5 @@ -#include "MonitoringMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/monitoring/MonitoringMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" MonitoringMessage::~MonitoringMessage() { } diff --git a/monitoring/MonitoringMessage.h b/src/fsfw/monitoring/MonitoringMessage.h similarity index 86% rename from monitoring/MonitoringMessage.h rename to src/fsfw/monitoring/MonitoringMessage.h index 84b02750..a625e388 100644 --- a/monitoring/MonitoringMessage.h +++ b/src/fsfw/monitoring/MonitoringMessage.h @@ -1,8 +1,9 @@ #ifndef MONITORINGMESSAGE_H_ #define MONITORINGMESSAGE_H_ -#include "../ipc/CommandMessage.h" -#include "../storagemanager/StorageManagerIF.h" +#include "monitoringConf.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/storagemanager/StorageManagerIF.h" class MonitoringMessage: public CommandMessage { public: diff --git a/monitoring/MonitoringMessageContent.h b/src/fsfw/monitoring/MonitoringMessageContent.h similarity index 99% rename from monitoring/MonitoringMessageContent.h rename to src/fsfw/monitoring/MonitoringMessageContent.h index 1d5f9c92..cf8c8752 100644 --- a/monitoring/MonitoringMessageContent.h +++ b/src/fsfw/monitoring/MonitoringMessageContent.h @@ -1,6 +1,7 @@ #ifndef FSFW_MONITORING_MONITORINGMESSAGECONTENT_H_ #define FSFW_MONITORING_MONITORINGMESSAGECONTENT_H_ +#include "monitoringConf.h" #include "HasMonitorsIF.h" #include "MonitoringIF.h" diff --git a/monitoring/ReceivesMonitoringReportsIF.h b/src/fsfw/monitoring/ReceivesMonitoringReportsIF.h similarity index 78% rename from monitoring/ReceivesMonitoringReportsIF.h rename to src/fsfw/monitoring/ReceivesMonitoringReportsIF.h index fb37c16c..6c126c84 100644 --- a/monitoring/ReceivesMonitoringReportsIF.h +++ b/src/fsfw/monitoring/ReceivesMonitoringReportsIF.h @@ -1,7 +1,8 @@ #ifndef RECEIVESMONITORINGREPORTSIF_H_ #define RECEIVESMONITORINGREPORTSIF_H_ -#include "../ipc/MessageQueueSenderIF.h" +#include "monitoringConf.h" +#include "fsfw/ipc/messageQueueDefinitions.h" class ReceivesMonitoringReportsIF { public: diff --git a/monitoring/TriplexMonitor.h b/src/fsfw/monitoring/TriplexMonitor.h similarity index 99% rename from monitoring/TriplexMonitor.h rename to src/fsfw/monitoring/TriplexMonitor.h index 295a6174..ff995b5d 100644 --- a/monitoring/TriplexMonitor.h +++ b/src/fsfw/monitoring/TriplexMonitor.h @@ -1,6 +1,7 @@ #ifndef FRAMEWORK_MONITORING_TRIPLEXMONITOR_H_ #define FRAMEWORK_MONITORING_TRIPLEXMONITOR_H_ +#include "monitoringConf.h" #include "../datapool/DataSet.h" #include "../datapool/PIDReaderList.h" #include "../health/HealthTableIF.h" diff --git a/monitoring/TwoValueLimitMonitor.h b/src/fsfw/monitoring/TwoValueLimitMonitor.h similarity index 98% rename from monitoring/TwoValueLimitMonitor.h rename to src/fsfw/monitoring/TwoValueLimitMonitor.h index e690cdae..cd34391c 100644 --- a/monitoring/TwoValueLimitMonitor.h +++ b/src/fsfw/monitoring/TwoValueLimitMonitor.h @@ -1,6 +1,7 @@ #ifndef FRAMEWORK_MONITORING_TWOVALUELIMITMONITOR_H_ #define FRAMEWORK_MONITORING_TWOVALUELIMITMONITOR_H_ +#include "monitoringConf.h" #include "LimitMonitor.h" template diff --git a/src/fsfw/monitoring/monitoringConf.h b/src/fsfw/monitoring/monitoringConf.h new file mode 100644 index 00000000..25cac8db --- /dev/null +++ b/src/fsfw/monitoring/monitoringConf.h @@ -0,0 +1,11 @@ +#ifndef FSFW_MONITORING_MONITORINGCONF_H_ +#define FSFW_MONITORING_MONITORINGCONF_H_ + +#include "fsfw/FSFW.h" + +#ifndef FSFW_ADD_MONITORING +#warning Monitoring files were included but compilation was \ + not enabled with FSFW_ADD_MONITORING +#endif + +#endif /* FSFW_MONITORING_MONITORINGCONF_H_ */ diff --git a/src/fsfw/objectmanager.h b/src/fsfw/objectmanager.h new file mode 100644 index 00000000..50a90c9f --- /dev/null +++ b/src/fsfw/objectmanager.h @@ -0,0 +1,8 @@ +#ifndef FSFW_SRC_FSFW_OBJECTMANAGER_H_ +#define FSFW_SRC_FSFW_OBJECTMANAGER_H_ + +#include "objectmanager/ObjectManager.h" +#include "objectmanager/SystemObject.h" +#include "objectmanager/frameworkObjects.h" + +#endif /* FSFW_SRC_FSFW_OBJECTMANAGER_H_ */ diff --git a/objectmanager/CMakeLists.txt b/src/fsfw/objectmanager/CMakeLists.txt similarity index 100% rename from objectmanager/CMakeLists.txt rename to src/fsfw/objectmanager/CMakeLists.txt diff --git a/objectmanager/ObjectManager.cpp b/src/fsfw/objectmanager/ObjectManager.cpp similarity index 97% rename from objectmanager/ObjectManager.cpp rename to src/fsfw/objectmanager/ObjectManager.cpp index 3e6820a7..639688ab 100644 --- a/objectmanager/ObjectManager.cpp +++ b/src/fsfw/objectmanager/ObjectManager.cpp @@ -1,5 +1,5 @@ -#include "ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #if FSFW_CPP_OSTREAM_ENABLED == 1 #include diff --git a/objectmanager/ObjectManager.h b/src/fsfw/objectmanager/ObjectManager.h similarity index 100% rename from objectmanager/ObjectManager.h rename to src/fsfw/objectmanager/ObjectManager.h diff --git a/objectmanager/ObjectManagerIF.h b/src/fsfw/objectmanager/ObjectManagerIF.h similarity index 100% rename from objectmanager/ObjectManagerIF.h rename to src/fsfw/objectmanager/ObjectManagerIF.h diff --git a/objectmanager/SystemObject.cpp b/src/fsfw/objectmanager/SystemObject.cpp similarity index 87% rename from objectmanager/SystemObject.cpp rename to src/fsfw/objectmanager/SystemObject.cpp index 123bbe65..bad38975 100644 --- a/objectmanager/SystemObject.cpp +++ b/src/fsfw/objectmanager/SystemObject.cpp @@ -1,6 +1,6 @@ -#include "ObjectManager.h" -#include "SystemObject.h" -#include "../events/EventManagerIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/events/EventManagerIF.h" SystemObject::SystemObject(object_id_t setObjectId, bool doRegister) : objectId(setObjectId), registered(doRegister) { diff --git a/objectmanager/SystemObject.h b/src/fsfw/objectmanager/SystemObject.h similarity index 93% rename from objectmanager/SystemObject.h rename to src/fsfw/objectmanager/SystemObject.h index d9c4236d..e7d2ae2b 100644 --- a/objectmanager/SystemObject.h +++ b/src/fsfw/objectmanager/SystemObject.h @@ -2,9 +2,9 @@ #define FSFW_OBJECTMANAGER_SYSTEMOBJECT_H_ #include "SystemObjectIF.h" -#include "../events/Event.h" -#include "../events/EventReportingProxyIF.h" -#include "../timemanager/Clock.h" +#include "fsfw/events/Event.h" +#include "fsfw/events/EventReportingProxyIF.h" +#include "fsfw/timemanager/Clock.h" /** * @brief This class automates insertion into the ObjectManager and diff --git a/objectmanager/SystemObjectIF.h b/src/fsfw/objectmanager/SystemObjectIF.h similarity index 100% rename from objectmanager/SystemObjectIF.h rename to src/fsfw/objectmanager/SystemObjectIF.h diff --git a/objectmanager/frameworkObjects.h b/src/fsfw/objectmanager/frameworkObjects.h similarity index 100% rename from objectmanager/frameworkObjects.h rename to src/fsfw/objectmanager/frameworkObjects.h diff --git a/osal/CMakeLists.txt b/src/fsfw/osal/CMakeLists.txt similarity index 80% rename from osal/CMakeLists.txt rename to src/fsfw/osal/CMakeLists.txt index 76b939b1..f3c5cfad 100644 --- a/osal/CMakeLists.txt +++ b/src/fsfw/osal/CMakeLists.txt @@ -1,11 +1,11 @@ # Check the OS_FSFW variable -if(${OS_FSFW} STREQUAL "freertos") - add_subdirectory(FreeRTOS) -elseif(${OS_FSFW} STREQUAL "rtems") +if(FSFW_OSAL MATCHES "freertos") + add_subdirectory(freertos) +elseif(FSFW_OSAL MATCHES "rtems") add_subdirectory(rtems) -elseif(${OS_FSFW} STREQUAL "linux") +elseif(FSFW_OSAL MATCHES "linux") add_subdirectory(linux) -elseif(${OS_FSFW} STREQUAL "host") +elseif(FSFW_OSAL MATCHES "host") add_subdirectory(host) if (WIN32) add_subdirectory(windows) diff --git a/osal/Endiness.h b/src/fsfw/osal/Endiness.h similarity index 100% rename from osal/Endiness.h rename to src/fsfw/osal/Endiness.h diff --git a/src/fsfw/osal/InternalErrorCodes.h b/src/fsfw/osal/InternalErrorCodes.h new file mode 100644 index 00000000..e7522875 --- /dev/null +++ b/src/fsfw/osal/InternalErrorCodes.h @@ -0,0 +1,39 @@ +#ifndef INTERNALERRORCODES_H_ +#define INTERNALERRORCODES_H_ + +#include "fsfw/returnvalues/HasReturnvaluesIF.h" + +class InternalErrorCodes { +public: + static const uint8_t INTERFACE_ID = CLASS_ID::INTERNAL_ERROR_CODES; + + static const ReturnValue_t NO_CONFIGURATION_TABLE = MAKE_RETURN_CODE(0x01 ); + static const ReturnValue_t NO_CPU_TABLE = MAKE_RETURN_CODE(0x02 ); + static const ReturnValue_t INVALID_WORKSPACE_ADDRESS = MAKE_RETURN_CODE(0x03 ); + static const ReturnValue_t TOO_LITTLE_WORKSPACE = MAKE_RETURN_CODE(0x04 ); + static const ReturnValue_t WORKSPACE_ALLOCATION = MAKE_RETURN_CODE(0x05 ); + static const ReturnValue_t INTERRUPT_STACK_TOO_SMALL = MAKE_RETURN_CODE(0x06 ); + static const ReturnValue_t THREAD_EXITTED = MAKE_RETURN_CODE(0x07 ); + static const ReturnValue_t INCONSISTENT_MP_INFORMATION = MAKE_RETURN_CODE(0x08 ); + static const ReturnValue_t INVALID_NODE = MAKE_RETURN_CODE(0x09 ); + static const ReturnValue_t NO_MPCI = MAKE_RETURN_CODE(0x0a ); + static const ReturnValue_t BAD_PACKET = MAKE_RETURN_CODE(0x0b ); + static const ReturnValue_t OUT_OF_PACKETS = MAKE_RETURN_CODE(0x0c ); + static const ReturnValue_t OUT_OF_GLOBAL_OBJECTS = MAKE_RETURN_CODE(0x0d ); + static const ReturnValue_t OUT_OF_PROXIES = MAKE_RETURN_CODE(0x0e ); + static const ReturnValue_t INVALID_GLOBAL_ID = MAKE_RETURN_CODE(0x0f ); + static const ReturnValue_t BAD_STACK_HOOK = MAKE_RETURN_CODE(0x10 ); + static const ReturnValue_t BAD_ATTRIBUTES = MAKE_RETURN_CODE(0x11 ); + static const ReturnValue_t IMPLEMENTATION_KEY_CREATE_INCONSISTENCY = MAKE_RETURN_CODE(0x12 ); + static const ReturnValue_t IMPLEMENTATION_BLOCKING_OPERATION_CANCEL = MAKE_RETURN_CODE(0x13 ); + static const ReturnValue_t MUTEX_OBTAIN_FROM_BAD_STATE = MAKE_RETURN_CODE(0x14 ); + static const ReturnValue_t UNLIMITED_AND_MAXIMUM_IS_0 = MAKE_RETURN_CODE(0x15 ); + + virtual ~InternalErrorCodes(); + + static ReturnValue_t translate(uint8_t code); +private: + InternalErrorCodes(); +}; + +#endif /* INTERNALERRORCODES_H_ */ diff --git a/osal/common/CMakeLists.txt b/src/fsfw/osal/common/CMakeLists.txt similarity index 100% rename from osal/common/CMakeLists.txt rename to src/fsfw/osal/common/CMakeLists.txt diff --git a/osal/common/TcpIpBase.cpp b/src/fsfw/osal/common/TcpIpBase.cpp similarity index 94% rename from osal/common/TcpIpBase.cpp rename to src/fsfw/osal/common/TcpIpBase.cpp index 0b37e38c..b6b64e13 100644 --- a/osal/common/TcpIpBase.cpp +++ b/src/fsfw/osal/common/TcpIpBase.cpp @@ -1,5 +1,5 @@ -#include "TcpIpBase.h" -#include "../../platform.h" +#include "fsfw/osal/common/TcpIpBase.h" +#include "fsfw/platform.h" #ifdef PLATFORM_UNIX #include diff --git a/osal/common/TcpIpBase.h b/src/fsfw/osal/common/TcpIpBase.h similarity index 100% rename from osal/common/TcpIpBase.h rename to src/fsfw/osal/common/TcpIpBase.h diff --git a/osal/common/TcpTmTcBridge.cpp b/src/fsfw/osal/common/TcpTmTcBridge.cpp similarity index 88% rename from osal/common/TcpTmTcBridge.cpp rename to src/fsfw/osal/common/TcpTmTcBridge.cpp index 24fab9a9..24f1a281 100644 --- a/osal/common/TcpTmTcBridge.cpp +++ b/src/fsfw/osal/common/TcpTmTcBridge.cpp @@ -1,15 +1,16 @@ -#include "TcpTmTcBridge.h" -#include "tcpipHelpers.h" +#include "fsfw/platform.h" +#include "fsfw/osal/common/TcpTmTcBridge.h" +#include "fsfw/osal/common/tcpipHelpers.h" -#include -#include -#include +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/ipc/MutexGuard.h" +#include "fsfw/osal/common/TcpTmTcBridge.h" -#ifdef _WIN32 +#ifdef PLATFORM_WIN #include -#elif defined(__unix__) +#elif defined PLATFORM_UNIX #include #include diff --git a/osal/common/TcpTmTcBridge.h b/src/fsfw/osal/common/TcpTmTcBridge.h similarity index 100% rename from osal/common/TcpTmTcBridge.h rename to src/fsfw/osal/common/TcpTmTcBridge.h diff --git a/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp similarity index 94% rename from osal/common/TcpTmTcServer.cpp rename to src/fsfw/osal/common/TcpTmTcServer.cpp index 38f72647..f94449bb 100644 --- a/osal/common/TcpTmTcServer.cpp +++ b/src/fsfw/osal/common/TcpTmTcServer.cpp @@ -1,15 +1,15 @@ -#include "TcpTmTcServer.h" -#include "TcpTmTcBridge.h" -#include "tcpipHelpers.h" +#include "fsfw/osal/common/TcpTmTcServer.h" +#include "fsfw/osal/common/TcpTmTcBridge.h" +#include "fsfw/osal/common/tcpipHelpers.h" -#include "../../platform.h" -#include "../../container/SharedRingBuffer.h" -#include "../../ipc/MessageQueueSenderIF.h" -#include "../../ipc/MutexGuard.h" -#include "../../objectmanager/ObjectManager.h" +#include "fsfw/platform.h" +#include "fsfw/container/SharedRingBuffer.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" +#include "fsfw/ipc/MutexGuard.h" +#include "fsfw/objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tmtcservices/TmTcMessage.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/TmTcMessage.h" #ifdef PLATFORM_WIN #include diff --git a/osal/common/TcpTmTcServer.h b/src/fsfw/osal/common/TcpTmTcServer.h similarity index 100% rename from osal/common/TcpTmTcServer.h rename to src/fsfw/osal/common/TcpTmTcServer.h diff --git a/osal/common/UdpTcPollingTask.cpp b/src/fsfw/osal/common/UdpTcPollingTask.cpp similarity index 95% rename from osal/common/UdpTcPollingTask.cpp rename to src/fsfw/osal/common/UdpTcPollingTask.cpp index 4453e1bc..35e086ee 100644 --- a/osal/common/UdpTcPollingTask.cpp +++ b/src/fsfw/osal/common/UdpTcPollingTask.cpp @@ -1,9 +1,10 @@ -#include "UdpTcPollingTask.h" -#include "tcpipHelpers.h" -#include "../../platform.h" -#include "../../globalfunctions/arrayprinter.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../objectmanager/ObjectManager.h" +#include "fsfw/osal/common/UdpTcPollingTask.h" +#include "fsfw/osal/common/tcpipHelpers.h" + +#include "fsfw/platform.h" +#include "fsfw/globalfunctions/arrayprinter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" #ifdef PLATFORM_WIN #include diff --git a/osal/common/UdpTcPollingTask.h b/src/fsfw/osal/common/UdpTcPollingTask.h similarity index 100% rename from osal/common/UdpTcPollingTask.h rename to src/fsfw/osal/common/UdpTcPollingTask.h diff --git a/osal/common/UdpTmTcBridge.cpp b/src/fsfw/osal/common/UdpTmTcBridge.cpp similarity index 96% rename from osal/common/UdpTmTcBridge.cpp rename to src/fsfw/osal/common/UdpTmTcBridge.cpp index 4c83385b..7015cf4a 100644 --- a/osal/common/UdpTmTcBridge.cpp +++ b/src/fsfw/osal/common/UdpTmTcBridge.cpp @@ -1,9 +1,9 @@ -#include "UdpTmTcBridge.h" -#include "tcpipHelpers.h" +#include "fsfw/osal/common/UdpTmTcBridge.h" +#include "fsfw/osal/common/tcpipHelpers.h" -#include "../../platform.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../ipc/MutexGuard.h" +#include "fsfw/platform.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/ipc/MutexGuard.h" #ifdef PLATFORM_WIN #include diff --git a/osal/common/UdpTmTcBridge.h b/src/fsfw/osal/common/UdpTmTcBridge.h similarity index 100% rename from osal/common/UdpTmTcBridge.h rename to src/fsfw/osal/common/UdpTmTcBridge.h diff --git a/osal/common/tcpipCommon.cpp b/src/fsfw/osal/common/tcpipCommon.cpp similarity index 94% rename from osal/common/tcpipCommon.cpp rename to src/fsfw/osal/common/tcpipCommon.cpp index ca4dbf18..0fdbf867 100644 --- a/osal/common/tcpipCommon.cpp +++ b/src/fsfw/osal/common/tcpipCommon.cpp @@ -1,7 +1,8 @@ -#include "tcpipCommon.h" -#include +#include "fsfw/platform.h" +#include "fsfw/osal/common/tcpipCommon.h" +#include "fsfw/serviceinterface/ServiceInterface.h" -#ifdef _WIN32 +#ifdef PLATFORM_WIN #include #endif diff --git a/osal/common/tcpipCommon.h b/src/fsfw/osal/common/tcpipCommon.h similarity index 100% rename from osal/common/tcpipCommon.h rename to src/fsfw/osal/common/tcpipCommon.h diff --git a/osal/common/tcpipHelpers.h b/src/fsfw/osal/common/tcpipHelpers.h similarity index 85% rename from osal/common/tcpipHelpers.h rename to src/fsfw/osal/common/tcpipHelpers.h index 9764a93f..bf9a7b5a 100644 --- a/osal/common/tcpipHelpers.h +++ b/src/fsfw/osal/common/tcpipHelpers.h @@ -1,7 +1,7 @@ #ifndef FSFW_OSAL_WINDOWS_TCPIPHELPERS_H_ #define FSFW_OSAL_WINDOWS_TCPIPHELPERS_H_ -#include "../../timemanager/clockDefinitions.h" +#include "fsfw/timemanager/clockDefinitions.h" #include "tcpipCommon.h" namespace tcpip { diff --git a/osal/FreeRTOS/BinSemaphUsingTask.cpp b/src/fsfw/osal/freertos/BinSemaphUsingTask.cpp similarity index 95% rename from osal/FreeRTOS/BinSemaphUsingTask.cpp rename to src/fsfw/osal/freertos/BinSemaphUsingTask.cpp index 7d609aee..637c1925 100644 --- a/osal/FreeRTOS/BinSemaphUsingTask.cpp +++ b/src/fsfw/osal/freertos/BinSemaphUsingTask.cpp @@ -1,6 +1,6 @@ -#include "BinSemaphUsingTask.h" -#include "TaskManagement.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/osal/freertos/BinSemaphUsingTask.h" +#include "fsfw/osal/freertos/TaskManagement.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \ tskKERNEL_VERSION_MAJOR > 8 diff --git a/osal/FreeRTOS/BinSemaphUsingTask.h b/src/fsfw/osal/freertos/BinSemaphUsingTask.h similarity index 95% rename from osal/FreeRTOS/BinSemaphUsingTask.h rename to src/fsfw/osal/freertos/BinSemaphUsingTask.h index ec434853..0645b1fa 100644 --- a/osal/FreeRTOS/BinSemaphUsingTask.h +++ b/src/fsfw/osal/freertos/BinSemaphUsingTask.h @@ -1,11 +1,11 @@ #ifndef FSFW_OSAL_FREERTOS_BINSEMAPHUSINGTASK_H_ #define FSFW_OSAL_FREERTOS_BINSEMAPHUSINGTASK_H_ -#include "../../returnvalues/HasReturnvaluesIF.h" -#include "../../tasks/SemaphoreIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/SemaphoreIF.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \ tskKERNEL_VERSION_MAJOR > 8 diff --git a/osal/FreeRTOS/BinarySemaphore.cpp b/src/fsfw/osal/freertos/BinarySemaphore.cpp similarity index 94% rename from osal/FreeRTOS/BinarySemaphore.cpp rename to src/fsfw/osal/freertos/BinarySemaphore.cpp index c0349b7c..4ec5d30f 100644 --- a/osal/FreeRTOS/BinarySemaphore.cpp +++ b/src/fsfw/osal/freertos/BinarySemaphore.cpp @@ -1,6 +1,6 @@ -#include "BinarySemaphore.h" -#include "TaskManagement.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/osal/freertos/BinarySemaphore.h" +#include "fsfw/osal/freertos/TaskManagement.h" +#include "fsfw/serviceinterface/ServiceInterface.h" BinarySemaphore::BinarySemaphore() { handle = xSemaphoreCreateBinary(); diff --git a/osal/FreeRTOS/BinarySemaphore.h b/src/fsfw/osal/freertos/BinarySemaphore.h similarity index 95% rename from osal/FreeRTOS/BinarySemaphore.h rename to src/fsfw/osal/freertos/BinarySemaphore.h index 8969d503..1ae56ff6 100644 --- a/osal/FreeRTOS/BinarySemaphore.h +++ b/src/fsfw/osal/freertos/BinarySemaphore.h @@ -1,11 +1,11 @@ #ifndef FSFW_OSAL_FREERTOS_BINARYSEMPAHORE_H_ #define FSFW_OSAL_FREERTOS_BINARYSEMPAHORE_H_ -#include "../../returnvalues/HasReturnvaluesIF.h" -#include "../../tasks/SemaphoreIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/SemaphoreIF.h" -#include -#include +#include "FreeRTOS.h" +#include "semphr.h" /** * @brief OS Tool to achieve synchronization of between tasks or between diff --git a/osal/FreeRTOS/CMakeLists.txt b/src/fsfw/osal/freertos/CMakeLists.txt similarity index 75% rename from osal/FreeRTOS/CMakeLists.txt rename to src/fsfw/osal/freertos/CMakeLists.txt index 4da24a71..40bdcd0f 100644 --- a/osal/FreeRTOS/CMakeLists.txt +++ b/src/fsfw/osal/freertos/CMakeLists.txt @@ -22,10 +22,11 @@ target_sources(${LIB_FSFW_NAME} # FreeRTOS as a static library and set LIB_OS_NAME to the target name of the # library. if(NOT LIB_OS_NAME) - message(FATAL_ERROR - "FreeRTOS needs to be linked as a target and " - "LIB_OS_NAME needs to be set to the target" + message(STATUS + "LIB_OS_NAME is empty. Make sure to include the FreeRTOS header path properly." ) +else() + target_link_libraries(${LIB_FSFW_NAME} PRIVATE + ${LIB_OS_NAME} + ) endif() - -target_link_libraries(${LIB_FSWFW_NAME} ${LIB_OS_NAME}) \ No newline at end of file diff --git a/osal/FreeRTOS/Clock.cpp b/src/fsfw/osal/freertos/Clock.cpp similarity index 93% rename from osal/FreeRTOS/Clock.cpp rename to src/fsfw/osal/freertos/Clock.cpp index 66207d75..eddf2fec 100644 --- a/osal/FreeRTOS/Clock.cpp +++ b/src/fsfw/osal/freertos/Clock.cpp @@ -1,13 +1,13 @@ -#include "Timekeeper.h" +#include "fsfw/osal/freertos/Timekeeper.h" -#include "../../timemanager/Clock.h" -#include "../../globalfunctions/timevalOperations.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/globalfunctions/timevalOperations.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" -#include -#include +#include +#include //TODO sanitize input? //TODO much of this code can be reused for tick-only systems diff --git a/osal/FreeRTOS/CountingSemaphUsingTask.cpp b/src/fsfw/osal/freertos/CountingSemaphUsingTask.cpp similarity index 95% rename from osal/FreeRTOS/CountingSemaphUsingTask.cpp rename to src/fsfw/osal/freertos/CountingSemaphUsingTask.cpp index 750ea9d6..a34a6508 100644 --- a/osal/FreeRTOS/CountingSemaphUsingTask.cpp +++ b/src/fsfw/osal/freertos/CountingSemaphUsingTask.cpp @@ -1,7 +1,7 @@ -#include "CountingSemaphUsingTask.h" -#include "TaskManagement.h" +#include "fsfw/osal/freertos/CountingSemaphUsingTask.h" +#include "fsfw/osal/freertos/TaskManagement.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \ tskKERNEL_VERSION_MAJOR > 8 diff --git a/osal/FreeRTOS/CountingSemaphUsingTask.h b/src/fsfw/osal/freertos/CountingSemaphUsingTask.h similarity index 97% rename from osal/FreeRTOS/CountingSemaphUsingTask.h rename to src/fsfw/osal/freertos/CountingSemaphUsingTask.h index 45915b6b..eb2fc67b 100644 --- a/osal/FreeRTOS/CountingSemaphUsingTask.h +++ b/src/fsfw/osal/freertos/CountingSemaphUsingTask.h @@ -2,10 +2,10 @@ #define FSFW_OSAL_FREERTOS_COUNTINGSEMAPHUSINGTASK_H_ #include "CountingSemaphUsingTask.h" -#include "../../tasks/SemaphoreIF.h" +#include "fsfw/tasks/SemaphoreIF.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \ tskKERNEL_VERSION_MAJOR > 8 diff --git a/osal/FreeRTOS/CountingSemaphore.cpp b/src/fsfw/osal/freertos/CountingSemaphore.cpp similarity index 87% rename from osal/FreeRTOS/CountingSemaphore.cpp rename to src/fsfw/osal/freertos/CountingSemaphore.cpp index 40884d27..90dc771f 100644 --- a/osal/FreeRTOS/CountingSemaphore.cpp +++ b/src/fsfw/osal/freertos/CountingSemaphore.cpp @@ -1,9 +1,10 @@ -#include "CountingSemaphore.h" -#include "TaskManagement.h" +#include "fsfw/osal/freertos/CountingSemaphore.h" +#include "fsfw/osal/freertos/TaskManagement.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/serviceinterface/ServiceInterface.h" -#include +#include "FreeRTOS.h" +#include "semphr.h" // Make sure #define configUSE_COUNTING_SEMAPHORES 1 is set in // free FreeRTOSConfig.h file. diff --git a/osal/FreeRTOS/CountingSemaphore.h b/src/fsfw/osal/freertos/CountingSemaphore.h similarity index 100% rename from osal/FreeRTOS/CountingSemaphore.h rename to src/fsfw/osal/freertos/CountingSemaphore.h diff --git a/osal/FreeRTOS/FixedTimeslotTask.cpp b/src/fsfw/osal/freertos/FixedTimeslotTask.cpp similarity index 97% rename from osal/FreeRTOS/FixedTimeslotTask.cpp rename to src/fsfw/osal/freertos/FixedTimeslotTask.cpp index a722c958..9690991d 100644 --- a/osal/FreeRTOS/FixedTimeslotTask.cpp +++ b/src/fsfw/osal/freertos/FixedTimeslotTask.cpp @@ -1,7 +1,7 @@ -#include "FixedTimeslotTask.h" +#include "fsfw/osal/freertos/FixedTimeslotTask.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" uint32_t FixedTimeslotTask::deadlineMissedCount = 0; const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = configMINIMAL_STACK_SIZE; diff --git a/osal/FreeRTOS/FixedTimeslotTask.h b/src/fsfw/osal/freertos/FixedTimeslotTask.h similarity index 94% rename from osal/FreeRTOS/FixedTimeslotTask.h rename to src/fsfw/osal/freertos/FixedTimeslotTask.h index f2245ba4..ebd902cc 100644 --- a/osal/FreeRTOS/FixedTimeslotTask.h +++ b/src/fsfw/osal/freertos/FixedTimeslotTask.h @@ -2,12 +2,12 @@ #define FSFW_OSAL_FREERTOS_FIXEDTIMESLOTTASK_H_ #include "FreeRTOSTaskIF.h" -#include "../../tasks/FixedSlotSequence.h" -#include "../../tasks/FixedTimeslotTaskIF.h" -#include "../../tasks/Typedef.h" +#include "fsfw/tasks/FixedSlotSequence.h" +#include "fsfw/tasks/FixedTimeslotTaskIF.h" +#include "fsfw/tasks/Typedef.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" class FixedTimeslotTask: public FixedTimeslotTaskIF, public FreeRTOSTaskIF { public: diff --git a/osal/FreeRTOS/FreeRTOSTaskIF.h b/src/fsfw/osal/freertos/FreeRTOSTaskIF.h similarity index 95% rename from osal/FreeRTOS/FreeRTOSTaskIF.h rename to src/fsfw/osal/freertos/FreeRTOSTaskIF.h index 2a2d9494..08f0df25 100644 --- a/osal/FreeRTOS/FreeRTOSTaskIF.h +++ b/src/fsfw/osal/freertos/FreeRTOSTaskIF.h @@ -1,8 +1,8 @@ #ifndef FSFW_OSAL_FREERTOS_FREERTOSTASKIF_H_ #define FSFW_OSAL_FREERTOS_FREERTOSTASKIF_H_ -#include -#include +#include "FreeRTOS.h" +#include "task.h" class FreeRTOSTaskIF { public: diff --git a/osal/FreeRTOS/MessageQueue.cpp b/src/fsfw/osal/freertos/MessageQueue.cpp similarity index 96% rename from osal/FreeRTOS/MessageQueue.cpp rename to src/fsfw/osal/freertos/MessageQueue.cpp index cc8bd6a7..487fa864 100644 --- a/osal/FreeRTOS/MessageQueue.cpp +++ b/src/fsfw/osal/freertos/MessageQueue.cpp @@ -1,7 +1,8 @@ -#include "MessageQueue.h" -#include "QueueMapManager.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/osal/freertos/MessageQueue.h" +#include "fsfw/osal/freertos/QueueMapManager.h" + +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize): maxMessageSize(maxMessageSize) { diff --git a/osal/FreeRTOS/MessageQueue.h b/src/fsfw/osal/freertos/MessageQueue.h similarity index 96% rename from osal/FreeRTOS/MessageQueue.h rename to src/fsfw/osal/freertos/MessageQueue.h index be74d4fe..ba835211 100644 --- a/osal/FreeRTOS/MessageQueue.h +++ b/src/fsfw/osal/freertos/MessageQueue.h @@ -3,13 +3,14 @@ #include "TaskManagement.h" -#include "../../internalError/InternalErrorReporterIF.h" -#include "../../ipc/MessageQueueIF.h" -#include "../../ipc/MessageQueueMessageIF.h" +#include "fsfw/internalerror/InternalErrorReporterIF.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/ipc/MessageQueueMessageIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" + +#include "FreeRTOS.h" +#include "queue.h" -#include -#include -#include /** * @brief This class manages sending and receiving of diff --git a/osal/FreeRTOS/Mutex.cpp b/src/fsfw/osal/freertos/Mutex.cpp similarity index 92% rename from osal/FreeRTOS/Mutex.cpp rename to src/fsfw/osal/freertos/Mutex.cpp index 0b85ca13..8d1313e6 100644 --- a/osal/FreeRTOS/Mutex.cpp +++ b/src/fsfw/osal/freertos/Mutex.cpp @@ -1,6 +1,6 @@ -#include "Mutex.h" +#include "fsfw/osal/freertos/Mutex.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/serviceinterface/ServiceInterface.h" Mutex::Mutex() { handle = xSemaphoreCreateMutex(); diff --git a/osal/FreeRTOS/Mutex.h b/src/fsfw/osal/freertos/Mutex.h similarity index 86% rename from osal/FreeRTOS/Mutex.h rename to src/fsfw/osal/freertos/Mutex.h index 156d431c..082679c7 100644 --- a/osal/FreeRTOS/Mutex.h +++ b/src/fsfw/osal/freertos/Mutex.h @@ -1,10 +1,10 @@ #ifndef FRAMEWORK_FREERTOS_MUTEX_H_ #define FRAMEWORK_FREERTOS_MUTEX_H_ -#include "../../ipc/MutexIF.h" +#include "fsfw/ipc/MutexIF.h" -#include -#include +#include "FreeRTOS.h" +#include "semphr.h" /** * @brief OS component to implement MUTual EXclusion diff --git a/osal/FreeRTOS/MutexFactory.cpp b/src/fsfw/osal/freertos/MutexFactory.cpp similarity index 89% rename from osal/FreeRTOS/MutexFactory.cpp rename to src/fsfw/osal/freertos/MutexFactory.cpp index d9569e35..f8b48c7d 100644 --- a/osal/FreeRTOS/MutexFactory.cpp +++ b/src/fsfw/osal/freertos/MutexFactory.cpp @@ -1,6 +1,6 @@ -#include "Mutex.h" +#include "fsfw/osal/freertos/Mutex.h" -#include "../../ipc/MutexFactory.h" +#include "fsfw/ipc/MutexFactory.h" //TODO: Different variant than the lazy loading in QueueFactory. diff --git a/osal/FreeRTOS/PeriodicTask.cpp b/src/fsfw/osal/freertos/PeriodicTask.cpp similarity index 95% rename from osal/FreeRTOS/PeriodicTask.cpp rename to src/fsfw/osal/freertos/PeriodicTask.cpp index 42d6681d..7ef1c837 100644 --- a/osal/FreeRTOS/PeriodicTask.cpp +++ b/src/fsfw/osal/freertos/PeriodicTask.cpp @@ -1,8 +1,8 @@ -#include "PeriodicTask.h" +#include "fsfw/osal/freertos/PeriodicTask.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tasks/ExecutableObjectIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/ExecutableObjectIF.h" PeriodicTask::PeriodicTask(const char *name, TaskPriority setPriority, TaskStackSize setStack, TaskPeriod setPeriod, diff --git a/osal/FreeRTOS/PeriodicTask.h b/src/fsfw/osal/freertos/PeriodicTask.h similarity index 95% rename from osal/FreeRTOS/PeriodicTask.h rename to src/fsfw/osal/freertos/PeriodicTask.h index 36ef568f..e910a0c6 100644 --- a/osal/FreeRTOS/PeriodicTask.h +++ b/src/fsfw/osal/freertos/PeriodicTask.h @@ -2,12 +2,12 @@ #define FSFW_OSAL_FREERTOS_PERIODICTASK_H_ #include "FreeRTOSTaskIF.h" -#include "../../objectmanager/ObjectManagerIF.h" -#include "../../tasks/PeriodicTaskIF.h" -#include "../../tasks/Typedef.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/tasks/PeriodicTaskIF.h" +#include "fsfw/tasks/Typedef.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #include diff --git a/osal/FreeRTOS/QueueFactory.cpp b/src/fsfw/osal/freertos/QueueFactory.cpp similarity index 86% rename from osal/FreeRTOS/QueueFactory.cpp rename to src/fsfw/osal/freertos/QueueFactory.cpp index ed29e10c..536c16c0 100644 --- a/osal/FreeRTOS/QueueFactory.cpp +++ b/src/fsfw/osal/freertos/QueueFactory.cpp @@ -1,7 +1,7 @@ -#include "MessageQueue.h" +#include "fsfw/osal/freertos/MessageQueue.h" -#include "../../ipc/MessageQueueSenderIF.h" -#include "../../ipc/QueueFactory.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" +#include "fsfw/ipc/QueueFactory.h" QueueFactory* QueueFactory::factoryInstance = nullptr; diff --git a/osal/FreeRTOS/QueueMapManager.cpp b/src/fsfw/osal/freertos/QueueMapManager.cpp similarity index 83% rename from osal/FreeRTOS/QueueMapManager.cpp rename to src/fsfw/osal/freertos/QueueMapManager.cpp index 51cfe11d..7d6b2f12 100644 --- a/osal/FreeRTOS/QueueMapManager.cpp +++ b/src/fsfw/osal/freertos/QueueMapManager.cpp @@ -1,6 +1,6 @@ -#include "QueueMapManager.h" -#include "../../ipc/MutexFactory.h" -#include "../../ipc/MutexGuard.h" +#include "fsfw/osal/freertos/QueueMapManager.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/ipc/MutexGuard.h" QueueMapManager* QueueMapManager::mqManagerInstance = nullptr; @@ -17,7 +17,13 @@ QueueMapManager* QueueMapManager::instance() { ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id) { MutexGuard lock(mapLock); - uint32_t currentId = queueCounter++; + uint32_t currentId = queueCounter; + queueCounter++; + if(currentId == MessageQueueIF::NO_QUEUE) { + // Skip the NO_QUEUE value + currentId = queueCounter; + queueCounter++; + } auto returnPair = queueMap.emplace(currentId, queue); if(not returnPair.second) { #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/osal/FreeRTOS/QueueMapManager.h b/src/fsfw/osal/freertos/QueueMapManager.h similarity index 84% rename from osal/FreeRTOS/QueueMapManager.h rename to src/fsfw/osal/freertos/QueueMapManager.h index 91a839f0..dbe0526b 100644 --- a/osal/FreeRTOS/QueueMapManager.h +++ b/src/fsfw/osal/freertos/QueueMapManager.h @@ -1,12 +1,12 @@ #ifndef FSFW_OSAL_FREERTOS_QUEUEMAPMANAGER_H_ #define FSFW_OSAL_FREERTOS_QUEUEMAPMANAGER_H_ -#include "../../ipc/MutexIF.h" -#include "../../ipc/messageQueueDefinitions.h" -#include "../../ipc/MessageQueueIF.h" +#include "fsfw/ipc/MutexIF.h" +#include "fsfw/ipc/messageQueueDefinitions.h" +#include "fsfw/ipc/MessageQueueIF.h" -#include "freertos/FreeRTOS.h" -#include "freertos/queue.h" +#include "FreeRTOS.h" +#include "queue.h" #include @@ -39,7 +39,7 @@ private: QueueMapManager(); ~QueueMapManager(); - uint32_t queueCounter = 0; + uint32_t queueCounter = MessageQueueIF::NO_QUEUE + 1; MutexIF* mapLock; QueueMap queueMap; static QueueMapManager* mqManagerInstance; diff --git a/osal/FreeRTOS/README.md b/src/fsfw/osal/freertos/README.md similarity index 100% rename from osal/FreeRTOS/README.md rename to src/fsfw/osal/freertos/README.md diff --git a/osal/FreeRTOS/SemaphoreFactory.cpp b/src/fsfw/osal/freertos/SemaphoreFactory.cpp similarity index 83% rename from osal/FreeRTOS/SemaphoreFactory.cpp rename to src/fsfw/osal/freertos/SemaphoreFactory.cpp index df005f6a..b6e8f86e 100644 --- a/osal/FreeRTOS/SemaphoreFactory.cpp +++ b/src/fsfw/osal/freertos/SemaphoreFactory.cpp @@ -1,9 +1,10 @@ -#include "../../osal/FreeRTOS/BinarySemaphore.h" -#include "../../osal/FreeRTOS/BinSemaphUsingTask.h" -#include "../../osal/FreeRTOS/CountingSemaphore.h" -#include "../../osal/FreeRTOS/CountingSemaphUsingTask.h" -#include "../../tasks/SemaphoreFactory.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/osal/freertos/BinarySemaphore.h" +#include "fsfw/osal/freertos/BinSemaphUsingTask.h" +#include "fsfw/osal/freertos/CountingSemaphore.h" +#include "fsfw/osal/freertos/CountingSemaphUsingTask.h" + +#include "fsfw/tasks/SemaphoreFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr; diff --git a/osal/FreeRTOS/TaskFactory.cpp b/src/fsfw/osal/freertos/TaskFactory.cpp similarity index 88% rename from osal/FreeRTOS/TaskFactory.cpp rename to src/fsfw/osal/freertos/TaskFactory.cpp index 5b64811a..21ca80cb 100644 --- a/osal/FreeRTOS/TaskFactory.cpp +++ b/src/fsfw/osal/freertos/TaskFactory.cpp @@ -1,9 +1,8 @@ -#include "../../tasks/TaskFactory.h" -#include "../../returnvalues/HasReturnvaluesIF.h" - -#include "PeriodicTask.h" -#include "FixedTimeslotTask.h" +#include "fsfw/tasks/TaskFactory.h" +#include "fsfw/osal/freertos/PeriodicTask.h" +#include "fsfw/osal/freertos/FixedTimeslotTask.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" TaskFactory* TaskFactory::factoryInstance = new TaskFactory(); diff --git a/osal/FreeRTOS/TaskManagement.cpp b/src/fsfw/osal/freertos/TaskManagement.cpp similarity index 92% rename from osal/FreeRTOS/TaskManagement.cpp rename to src/fsfw/osal/freertos/TaskManagement.cpp index c0d0067e..f19aa4fd 100644 --- a/osal/FreeRTOS/TaskManagement.cpp +++ b/src/fsfw/osal/freertos/TaskManagement.cpp @@ -1,4 +1,4 @@ -#include "TaskManagement.h" +#include "fsfw/osal/freertos/TaskManagement.h" void TaskManagement::vRequestContextSwitchFromTask() { vTaskDelay(0); diff --git a/osal/FreeRTOS/TaskManagement.h b/src/fsfw/osal/freertos/TaskManagement.h similarity index 91% rename from osal/FreeRTOS/TaskManagement.h rename to src/fsfw/osal/freertos/TaskManagement.h index b9aece48..9aa10797 100644 --- a/osal/FreeRTOS/TaskManagement.h +++ b/src/fsfw/osal/freertos/TaskManagement.h @@ -1,10 +1,10 @@ -#ifndef FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_ -#define FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_ +#ifndef FSFW_OSAL_FREERTOS_TASKMANAGEMENT_H_ +#define FSFW_OSAL_FREERTOS_TASKMANAGEMENT_H_ #include "../../returnvalues/HasReturnvaluesIF.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #include diff --git a/osal/FreeRTOS/Timekeeper.cpp b/src/fsfw/osal/freertos/Timekeeper.cpp similarity index 91% rename from osal/FreeRTOS/Timekeeper.cpp rename to src/fsfw/osal/freertos/Timekeeper.cpp index d986d832..1b7dc741 100644 --- a/osal/FreeRTOS/Timekeeper.cpp +++ b/src/fsfw/osal/freertos/Timekeeper.cpp @@ -1,6 +1,6 @@ -#include "Timekeeper.h" +#include "fsfw/osal/freertos/Timekeeper.h" -#include +#include "FreeRTOSConfig.h" Timekeeper * Timekeeper::myinstance = nullptr; diff --git a/osal/FreeRTOS/Timekeeper.h b/src/fsfw/osal/freertos/Timekeeper.h similarity index 93% rename from osal/FreeRTOS/Timekeeper.h rename to src/fsfw/osal/freertos/Timekeeper.h index 7d583f7d..d4d0bc07 100644 --- a/osal/FreeRTOS/Timekeeper.h +++ b/src/fsfw/osal/freertos/Timekeeper.h @@ -3,8 +3,8 @@ #include "../../timemanager/Clock.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" /** diff --git a/osal/host/CMakeLists.txt b/src/fsfw/osal/host/CMakeLists.txt similarity index 100% rename from osal/host/CMakeLists.txt rename to src/fsfw/osal/host/CMakeLists.txt diff --git a/osal/host/Clock.cpp b/src/fsfw/osal/host/Clock.cpp similarity index 97% rename from osal/host/Clock.cpp rename to src/fsfw/osal/host/Clock.cpp index 1018de57..0bdcd8f5 100644 --- a/osal/host/Clock.cpp +++ b/src/fsfw/osal/host/Clock.cpp @@ -1,6 +1,6 @@ -#include "../../serviceinterface/ServiceInterface.h" -#include "../../timemanager/Clock.h" -#include "../../platform.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/platform.h" #include diff --git a/osal/host/FixedTimeslotTask.cpp b/src/fsfw/osal/host/FixedTimeslotTask.cpp similarity index 93% rename from osal/host/FixedTimeslotTask.cpp rename to src/fsfw/osal/host/FixedTimeslotTask.cpp index 3ad191e5..f9a0588c 100644 --- a/osal/host/FixedTimeslotTask.cpp +++ b/src/fsfw/osal/host/FixedTimeslotTask.cpp @@ -1,20 +1,20 @@ -#include "taskHelpers.h" +#include "fsfw/osal/host/taskHelpers.h" +#include "fsfw/osal/host/FixedTimeslotTask.h" +#include "fsfw/osal/host/FixedTimeslotTask.h" -#include "../../platform.h" -#include "../../osal/host/FixedTimeslotTask.h" -#include "../../ipc/MutexFactory.h" -#include "../../osal/host/Mutex.h" -#include "../../osal/host/FixedTimeslotTask.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tasks/ExecutableObjectIF.h" +#include "fsfw/platform.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/osal/host/Mutex.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/ExecutableObjectIF.h" #include #include #if defined(PLATFORM_WIN) #include -#include "../windows/winTaskHelpers.h" +#include "fsfw/osal/windows/winTaskHelpers.h" #elif defined(PLATFORM_UNIX) #include #endif diff --git a/osal/host/FixedTimeslotTask.h b/src/fsfw/osal/host/FixedTimeslotTask.h similarity index 100% rename from osal/host/FixedTimeslotTask.h rename to src/fsfw/osal/host/FixedTimeslotTask.h diff --git a/osal/host/MessageQueue.cpp b/src/fsfw/osal/host/MessageQueue.cpp similarity index 95% rename from osal/host/MessageQueue.cpp rename to src/fsfw/osal/host/MessageQueue.cpp index a2137e27..c7bcb042 100644 --- a/osal/host/MessageQueue.cpp +++ b/src/fsfw/osal/host/MessageQueue.cpp @@ -1,10 +1,10 @@ -#include "MessageQueue.h" -#include "QueueMapManager.h" +#include "fsfw/osal/host/MessageQueue.h" +#include "fsfw/osal/host/QueueMapManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../ipc/MutexFactory.h" -#include "../../ipc/MutexGuard.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/ipc/MutexGuard.h" #include diff --git a/osal/host/MessageQueue.h b/src/fsfw/osal/host/MessageQueue.h similarity index 97% rename from osal/host/MessageQueue.h rename to src/fsfw/osal/host/MessageQueue.h index 1c9b5e33..0bdfd8fc 100644 --- a/osal/host/MessageQueue.h +++ b/src/fsfw/osal/host/MessageQueue.h @@ -1,11 +1,11 @@ #ifndef FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_ #define FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_ -#include "../../internalError/InternalErrorReporterIF.h" -#include "../../ipc/MessageQueueIF.h" -#include "../../ipc/MessageQueueMessage.h" -#include "../../ipc/MutexIF.h" -#include "../../timemanager/Clock.h" +#include "fsfw/internalerror/InternalErrorReporterIF.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" +#include "fsfw/ipc/MutexIF.h" +#include "fsfw/timemanager/Clock.h" #include #include diff --git a/osal/host/Mutex.cpp b/src/fsfw/osal/host/Mutex.cpp similarity index 89% rename from osal/host/Mutex.cpp rename to src/fsfw/osal/host/Mutex.cpp index 892028b2..e423ea93 100644 --- a/osal/host/Mutex.cpp +++ b/src/fsfw/osal/host/Mutex.cpp @@ -1,5 +1,5 @@ -#include "Mutex.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/osal/host/Mutex.h" +#include "fsfw/serviceinterface/ServiceInterface.h" Mutex::Mutex() {} diff --git a/osal/host/Mutex.h b/src/fsfw/osal/host/Mutex.h similarity index 95% rename from osal/host/Mutex.h rename to src/fsfw/osal/host/Mutex.h index 0bd93c8a..e90ce932 100644 --- a/osal/host/Mutex.h +++ b/src/fsfw/osal/host/Mutex.h @@ -1,7 +1,7 @@ #ifndef FSFW_OSAL_HOSTED_MUTEX_H_ #define FSFW_OSAL_HOSTED_MUTEX_H_ -#include "../../ipc/MutexIF.h" +#include "fsfw/ipc/MutexIF.h" #include diff --git a/osal/host/MutexFactory.cpp b/src/fsfw/osal/host/MutexFactory.cpp similarity index 90% rename from osal/host/MutexFactory.cpp rename to src/fsfw/osal/host/MutexFactory.cpp index f3b98fd1..87287906 100644 --- a/osal/host/MutexFactory.cpp +++ b/src/fsfw/osal/host/MutexFactory.cpp @@ -1,5 +1,5 @@ -#include "../../ipc/MutexFactory.h" -#include "../../osal/host/Mutex.h" +#include "fsfw/osal/host/Mutex.h" +#include "fsfw/ipc/MutexFactory.h" //TODO: Different variant than the lazy loading in QueueFactory. //What's better and why? -> one is on heap the other on bss/data diff --git a/osal/host/PeriodicTask.cpp b/src/fsfw/osal/host/PeriodicTask.cpp similarity index 93% rename from osal/host/PeriodicTask.cpp rename to src/fsfw/osal/host/PeriodicTask.cpp index 180272d0..def3a6cb 100644 --- a/osal/host/PeriodicTask.cpp +++ b/src/fsfw/osal/host/PeriodicTask.cpp @@ -1,19 +1,19 @@ -#include "Mutex.h" -#include "PeriodicTask.h" -#include "taskHelpers.h" +#include "fsfw/osal/host/Mutex.h" +#include "fsfw/osal/host/PeriodicTask.h" +#include "fsfw/osal/host/taskHelpers.h" -#include "../../platform.h" -#include "../../ipc/MutexFactory.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tasks/ExecutableObjectIF.h" +#include "fsfw/platform.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/ExecutableObjectIF.h" #include #include #if defined(PLATFORM_WIN) #include -#include +#include "fsfw/osal/windows/winTaskHelpers.h" #elif defined(PLATFORM_UNIX) #include #endif diff --git a/osal/host/PeriodicTask.h b/src/fsfw/osal/host/PeriodicTask.h similarity index 100% rename from osal/host/PeriodicTask.h rename to src/fsfw/osal/host/PeriodicTask.h diff --git a/osal/host/QueueFactory.cpp b/src/fsfw/osal/host/QueueFactory.cpp similarity index 83% rename from osal/host/QueueFactory.cpp rename to src/fsfw/osal/host/QueueFactory.cpp index 1a679c96..466bb33b 100644 --- a/osal/host/QueueFactory.cpp +++ b/src/fsfw/osal/host/QueueFactory.cpp @@ -1,10 +1,9 @@ +#include "fsfw/osal/host/MessageQueue.h" -#include "MessageQueue.h" - -#include "../../ipc/MessageQueueSenderIF.h" -#include "../../ipc/MessageQueueMessageIF.h" -#include "../../ipc/QueueFactory.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" +#include "fsfw/ipc/MessageQueueMessageIF.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/osal/host/QueueMapManager.cpp b/src/fsfw/osal/host/QueueMapManager.cpp similarity index 82% rename from osal/host/QueueMapManager.cpp rename to src/fsfw/osal/host/QueueMapManager.cpp index 879bc36d..58575cf6 100644 --- a/osal/host/QueueMapManager.cpp +++ b/src/fsfw/osal/host/QueueMapManager.cpp @@ -1,8 +1,8 @@ -#include "QueueMapManager.h" +#include "fsfw/osal/host/QueueMapManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../ipc/MutexFactory.h" -#include "../../ipc/MutexGuard.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/ipc/MutexGuard.h" QueueMapManager* QueueMapManager::mqManagerInstance = nullptr; @@ -24,7 +24,13 @@ QueueMapManager* QueueMapManager::instance() { ReturnValue_t QueueMapManager::addMessageQueue( MessageQueueIF* queueToInsert, MessageQueueId_t* id) { MutexGuard lock(mapLock); - uint32_t currentId = queueCounter++; + uint32_t currentId = queueCounter; + queueCounter++; + if(currentId == MessageQueueIF::NO_QUEUE) { + // Skip the NO_QUEUE value + currentId = queueCounter; + queueCounter++; + } auto returnPair = queueMap.emplace(currentId, queueToInsert); if(not returnPair.second) { /* This should never happen for the atomic variable. */ diff --git a/osal/host/QueueMapManager.h b/src/fsfw/osal/host/QueueMapManager.h similarity index 96% rename from osal/host/QueueMapManager.h rename to src/fsfw/osal/host/QueueMapManager.h index e274bed2..2dd2a01d 100644 --- a/osal/host/QueueMapManager.h +++ b/src/fsfw/osal/host/QueueMapManager.h @@ -41,7 +41,7 @@ private: QueueMapManager(); ~QueueMapManager(); - uint32_t queueCounter = 0; + uint32_t queueCounter = MessageQueueIF::NO_QUEUE + 1; MutexIF* mapLock; QueueMap queueMap; static QueueMapManager* mqManagerInstance; diff --git a/osal/host/SemaphoreFactory.cpp b/src/fsfw/osal/host/SemaphoreFactory.cpp similarity index 91% rename from osal/host/SemaphoreFactory.cpp rename to src/fsfw/osal/host/SemaphoreFactory.cpp index 530b3e45..3ea12877 100644 --- a/osal/host/SemaphoreFactory.cpp +++ b/src/fsfw/osal/host/SemaphoreFactory.cpp @@ -1,5 +1,5 @@ -#include "../../tasks/SemaphoreFactory.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/SemaphoreFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr; diff --git a/osal/host/TaskFactory.cpp b/src/fsfw/osal/host/TaskFactory.cpp similarity index 84% rename from osal/host/TaskFactory.cpp rename to src/fsfw/osal/host/TaskFactory.cpp index 71d0bf8b..ad59bd1a 100644 --- a/osal/host/TaskFactory.cpp +++ b/src/fsfw/osal/host/TaskFactory.cpp @@ -1,10 +1,11 @@ -#include "taskHelpers.h" -#include "../../tasks/TaskFactory.h" -#include "../../osal/host/FixedTimeslotTask.h" -#include "../../osal/host/PeriodicTask.h" -#include "../../returnvalues/HasReturnvaluesIF.h" -#include "../../tasks/PeriodicTaskIF.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/osal/host/FixedTimeslotTask.h" +#include "fsfw/osal/host/PeriodicTask.h" +#include "fsfw/osal/host/taskHelpers.h" + +#include "fsfw/tasks/TaskFactory.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/PeriodicTaskIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/osal/host/taskHelpers.cpp b/src/fsfw/osal/host/taskHelpers.cpp similarity index 94% rename from osal/host/taskHelpers.cpp rename to src/fsfw/osal/host/taskHelpers.cpp index be4c29ad..a7de76d9 100644 --- a/osal/host/taskHelpers.cpp +++ b/src/fsfw/osal/host/taskHelpers.cpp @@ -1,4 +1,4 @@ -#include "taskHelpers.h" +#include "fsfw/osal/host/taskHelpers.h" #include #include diff --git a/osal/host/taskHelpers.h b/src/fsfw/osal/host/taskHelpers.h similarity index 100% rename from osal/host/taskHelpers.h rename to src/fsfw/osal/host/taskHelpers.h diff --git a/osal/linux/BinarySemaphore.cpp b/src/fsfw/osal/linux/BinarySemaphore.cpp similarity index 95% rename from osal/linux/BinarySemaphore.cpp rename to src/fsfw/osal/linux/BinarySemaphore.cpp index 110b0a90..3ef04cf0 100644 --- a/osal/linux/BinarySemaphore.cpp +++ b/src/fsfw/osal/linux/BinarySemaphore.cpp @@ -1,11 +1,11 @@ -#include "BinarySemaphore.h" -#include "unixUtility.h" -#include "../../serviceinterface/ServiceInterfacePrinter.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/osal/linux/BinarySemaphore.h" +#include "fsfw/osal/linux/unixUtility.h" +#include "fsfw/serviceinterface/ServiceInterfacePrinter.h" +#include "fsfw/serviceinterface/ServiceInterfaceStream.h" #include #include -#include +#include BinarySemaphore::BinarySemaphore() { diff --git a/osal/linux/BinarySemaphore.h b/src/fsfw/osal/linux/BinarySemaphore.h similarity index 100% rename from osal/linux/BinarySemaphore.h rename to src/fsfw/osal/linux/BinarySemaphore.h diff --git a/osal/linux/CMakeLists.txt b/src/fsfw/osal/linux/CMakeLists.txt similarity index 100% rename from osal/linux/CMakeLists.txt rename to src/fsfw/osal/linux/CMakeLists.txt diff --git a/osal/linux/Clock.cpp b/src/fsfw/osal/linux/Clock.cpp similarity index 97% rename from osal/linux/Clock.cpp rename to src/fsfw/osal/linux/Clock.cpp index 960d9c0d..d79c72be 100644 --- a/osal/linux/Clock.cpp +++ b/src/fsfw/osal/linux/Clock.cpp @@ -1,5 +1,5 @@ -#include "../../serviceinterface/ServiceInterfaceStream.h" -#include "../../timemanager/Clock.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/Clock.h" #include #include diff --git a/osal/linux/CountingSemaphore.cpp b/src/fsfw/osal/linux/CountingSemaphore.cpp similarity index 93% rename from osal/linux/CountingSemaphore.cpp rename to src/fsfw/osal/linux/CountingSemaphore.cpp index 752e150b..cc2117f3 100644 --- a/osal/linux/CountingSemaphore.cpp +++ b/src/fsfw/osal/linux/CountingSemaphore.cpp @@ -1,7 +1,7 @@ -#include "CountingSemaphore.h" -#include "unixUtility.h" +#include "fsfw/osal/linux/CountingSemaphore.h" +#include "fsfw/osal/linux/unixUtility.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/osal/linux/CountingSemaphore.h b/src/fsfw/osal/linux/CountingSemaphore.h similarity index 100% rename from osal/linux/CountingSemaphore.h rename to src/fsfw/osal/linux/CountingSemaphore.h diff --git a/osal/linux/FixedTimeslotTask.cpp b/src/fsfw/osal/linux/FixedTimeslotTask.cpp similarity index 95% rename from osal/linux/FixedTimeslotTask.cpp rename to src/fsfw/osal/linux/FixedTimeslotTask.cpp index c60c287a..f6648299 100644 --- a/osal/linux/FixedTimeslotTask.cpp +++ b/src/fsfw/osal/linux/FixedTimeslotTask.cpp @@ -1,7 +1,7 @@ -#include "FixedTimeslotTask.h" +#include "fsfw/osal/linux/FixedTimeslotTask.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/osal/linux/FixedTimeslotTask.h b/src/fsfw/osal/linux/FixedTimeslotTask.h similarity index 100% rename from osal/linux/FixedTimeslotTask.h rename to src/fsfw/osal/linux/FixedTimeslotTask.h diff --git a/osal/linux/InternalErrorCodes.cpp b/src/fsfw/osal/linux/InternalErrorCodes.cpp similarity index 84% rename from osal/linux/InternalErrorCodes.cpp rename to src/fsfw/osal/linux/InternalErrorCodes.cpp index a01cc72a..14274535 100644 --- a/osal/linux/InternalErrorCodes.cpp +++ b/src/fsfw/osal/linux/InternalErrorCodes.cpp @@ -1,4 +1,4 @@ -#include "../../osal/InternalErrorCodes.h" +#include "fsfw/osal/InternalErrorCodes.h" ReturnValue_t InternalErrorCodes::translate(uint8_t code) { //TODO This class can be removed diff --git a/osal/linux/MessageQueue.cpp b/src/fsfw/osal/linux/MessageQueue.cpp similarity index 98% rename from osal/linux/MessageQueue.cpp rename to src/fsfw/osal/linux/MessageQueue.cpp index 3c151143..b068c04f 100644 --- a/osal/linux/MessageQueue.cpp +++ b/src/fsfw/osal/linux/MessageQueue.cpp @@ -1,8 +1,8 @@ -#include "MessageQueue.h" -#include "unixUtility.h" +#include "fsfw/osal/linux/MessageQueue.h" +#include "fsfw/osal/linux/unixUtility.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" #include diff --git a/osal/linux/MessageQueue.h b/src/fsfw/osal/linux/MessageQueue.h similarity index 98% rename from osal/linux/MessageQueue.h rename to src/fsfw/osal/linux/MessageQueue.h index 935ee948..cf0ac10c 100644 --- a/osal/linux/MessageQueue.h +++ b/src/fsfw/osal/linux/MessageQueue.h @@ -1,9 +1,9 @@ #ifndef FSFW_OSAL_LINUX_MESSAGEQUEUE_H_ #define FSFW_OSAL_LINUX_MESSAGEQUEUE_H_ -#include "../../internalError/InternalErrorReporterIF.h" -#include "../../ipc/MessageQueueIF.h" -#include "../../ipc/MessageQueueMessage.h" +#include "fsfw/internalerror/InternalErrorReporterIF.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" #include /** diff --git a/osal/linux/Mutex.cpp b/src/fsfw/osal/linux/Mutex.cpp similarity index 95% rename from osal/linux/Mutex.cpp rename to src/fsfw/osal/linux/Mutex.cpp index 33e84aac..7391c6b5 100644 --- a/osal/linux/Mutex.cpp +++ b/src/fsfw/osal/linux/Mutex.cpp @@ -1,8 +1,8 @@ -#include "Mutex.h" -#include "unixUtility.h" +#include "fsfw/osal/linux/Mutex.h" +#include "fsfw/osal/linux/unixUtility.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../timemanager/Clock.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/Clock.h" #include #include diff --git a/osal/linux/Mutex.h b/src/fsfw/osal/linux/Mutex.h similarity index 100% rename from osal/linux/Mutex.h rename to src/fsfw/osal/linux/Mutex.h diff --git a/osal/linux/MutexFactory.cpp b/src/fsfw/osal/linux/MutexFactory.cpp similarity index 86% rename from osal/linux/MutexFactory.cpp rename to src/fsfw/osal/linux/MutexFactory.cpp index 80211f8b..373ff7da 100644 --- a/osal/linux/MutexFactory.cpp +++ b/src/fsfw/osal/linux/MutexFactory.cpp @@ -1,6 +1,6 @@ -#include "Mutex.h" +#include "fsfw/osal/linux/Mutex.h" -#include "../../ipc/MutexFactory.h" +#include "fsfw/ipc/MutexFactory.h" //TODO: Different variant than the lazy loading in QueueFactory. What's better and why? MutexFactory* MutexFactory::factoryInstance = new MutexFactory(); diff --git a/osal/linux/PeriodicPosixTask.cpp b/src/fsfw/osal/linux/PeriodicPosixTask.cpp similarity index 91% rename from osal/linux/PeriodicPosixTask.cpp rename to src/fsfw/osal/linux/PeriodicPosixTask.cpp index c0152bec..0603cf6a 100644 --- a/osal/linux/PeriodicPosixTask.cpp +++ b/src/fsfw/osal/linux/PeriodicPosixTask.cpp @@ -1,8 +1,8 @@ -#include "PeriodicPosixTask.h" +#include "fsfw/osal/linux/PeriodicPosixTask.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../tasks/ExecutableObjectIF.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/osal/linux/PeriodicPosixTask.h b/src/fsfw/osal/linux/PeriodicPosixTask.h similarity index 100% rename from osal/linux/PeriodicPosixTask.h rename to src/fsfw/osal/linux/PeriodicPosixTask.h diff --git a/osal/linux/PosixThread.cpp b/src/fsfw/osal/linux/PosixThread.cpp similarity index 98% rename from osal/linux/PosixThread.cpp rename to src/fsfw/osal/linux/PosixThread.cpp index 36501282..5ca41d73 100644 --- a/osal/linux/PosixThread.cpp +++ b/src/fsfw/osal/linux/PosixThread.cpp @@ -1,7 +1,7 @@ -#include "PosixThread.h" -#include "unixUtility.h" +#include "fsfw/osal/linux/PosixThread.h" +#include "fsfw/osal/linux/unixUtility.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include #include diff --git a/osal/linux/PosixThread.h b/src/fsfw/osal/linux/PosixThread.h similarity index 100% rename from osal/linux/PosixThread.h rename to src/fsfw/osal/linux/PosixThread.h diff --git a/osal/linux/QueueFactory.cpp b/src/fsfw/osal/linux/QueueFactory.cpp similarity index 79% rename from osal/linux/QueueFactory.cpp rename to src/fsfw/osal/linux/QueueFactory.cpp index 44def48a..1df26ca9 100644 --- a/osal/linux/QueueFactory.cpp +++ b/src/fsfw/osal/linux/QueueFactory.cpp @@ -1,14 +1,12 @@ -#include "../../ipc/QueueFactory.h" -#include "MessageQueue.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/osal/linux/MessageQueue.h" -#include "../../ipc/messageQueueDefinitions.h" -#include "../../ipc/MessageQueueSenderIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/ipc/messageQueueDefinitions.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" #include #include - #include QueueFactory* QueueFactory::factoryInstance = nullptr; diff --git a/osal/linux/SemaphoreFactory.cpp b/src/fsfw/osal/linux/SemaphoreFactory.cpp similarity index 81% rename from osal/linux/SemaphoreFactory.cpp rename to src/fsfw/osal/linux/SemaphoreFactory.cpp index cfb5f12d..0a0974be 100644 --- a/osal/linux/SemaphoreFactory.cpp +++ b/src/fsfw/osal/linux/SemaphoreFactory.cpp @@ -1,8 +1,7 @@ -#include "BinarySemaphore.h" -#include "CountingSemaphore.h" +#include "fsfw/osal/linux/BinarySemaphore.h" +#include "fsfw/osal/linux/CountingSemaphore.h" -#include "../../tasks/SemaphoreFactory.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/tasks/SemaphoreFactory.h" SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr; diff --git a/osal/linux/TaskFactory.cpp b/src/fsfw/osal/linux/TaskFactory.cpp similarity index 88% rename from osal/linux/TaskFactory.cpp rename to src/fsfw/osal/linux/TaskFactory.cpp index 80bf47b7..53aea0ac 100644 --- a/osal/linux/TaskFactory.cpp +++ b/src/fsfw/osal/linux/TaskFactory.cpp @@ -1,9 +1,9 @@ -#include "FixedTimeslotTask.h" -#include "PeriodicPosixTask.h" +#include "fsfw/osal/linux/FixedTimeslotTask.h" +#include "fsfw/osal/linux/PeriodicPosixTask.h" -#include "../../tasks/TaskFactory.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/TaskFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" //TODO: Different variant than the lazy loading in QueueFactory. What's better and why? TaskFactory* TaskFactory::factoryInstance = new TaskFactory(); diff --git a/osal/linux/Timer.cpp b/src/fsfw/osal/linux/Timer.cpp similarity index 91% rename from osal/linux/Timer.cpp rename to src/fsfw/osal/linux/Timer.cpp index fe0fbebb..dca3112d 100644 --- a/osal/linux/Timer.cpp +++ b/src/fsfw/osal/linux/Timer.cpp @@ -1,5 +1,5 @@ -#include "Timer.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/osal/linux/Timer.h" +#include "fsfw/serviceinterface/ServiceInterfaceStream.h" #include diff --git a/osal/linux/Timer.h b/src/fsfw/osal/linux/Timer.h similarity index 100% rename from osal/linux/Timer.h rename to src/fsfw/osal/linux/Timer.h diff --git a/osal/linux/tcpipHelpers.cpp b/src/fsfw/osal/linux/tcpipHelpers.cpp similarity index 94% rename from osal/linux/tcpipHelpers.cpp rename to src/fsfw/osal/linux/tcpipHelpers.cpp index d7c644ec..800c6fb7 100644 --- a/osal/linux/tcpipHelpers.cpp +++ b/src/fsfw/osal/linux/tcpipHelpers.cpp @@ -1,7 +1,7 @@ -#include "../common/tcpipHelpers.h" +#include "fsfw/osal/common/tcpipHelpers.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tasks/TaskFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/TaskFactory.h" #include #include diff --git a/osal/linux/unixUtility.cpp b/src/fsfw/osal/linux/unixUtility.cpp similarity index 89% rename from osal/linux/unixUtility.cpp rename to src/fsfw/osal/linux/unixUtility.cpp index d7aab4ba..40d8c212 100644 --- a/osal/linux/unixUtility.cpp +++ b/src/fsfw/osal/linux/unixUtility.cpp @@ -1,6 +1,6 @@ -#include "FSFWConfig.h" -#include "unixUtility.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/FSFW.h" +#include "fsfw/osal/linux/unixUtility.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include #include diff --git a/osal/linux/unixUtility.h b/src/fsfw/osal/linux/unixUtility.h similarity index 100% rename from osal/linux/unixUtility.h rename to src/fsfw/osal/linux/unixUtility.h diff --git a/src/fsfw/osal/rtems/BinarySemaphore.cpp b/src/fsfw/osal/rtems/BinarySemaphore.cpp new file mode 100644 index 00000000..6d145d98 --- /dev/null +++ b/src/fsfw/osal/rtems/BinarySemaphore.cpp @@ -0,0 +1,23 @@ +#include "BinarySemaphore.h" + +#include + +BinarySemaphore::BinarySemaphore() { +} + +BinarySemaphore::~BinarySemaphore() { + +} + +ReturnValue_t BinarySemaphore::acquire(TimeoutType timeoutType, uint32_t timeoutMs) { + return HasReturnvaluesIF::RETURN_OK; +} + + +ReturnValue_t BinarySemaphore::release() { + return HasReturnvaluesIF::RETURN_OK; +} + +uint8_t BinarySemaphore::getSemaphoreCounter() const { + return 0; +} diff --git a/src/fsfw/osal/rtems/BinarySemaphore.h b/src/fsfw/osal/rtems/BinarySemaphore.h new file mode 100644 index 00000000..a2796af1 --- /dev/null +++ b/src/fsfw/osal/rtems/BinarySemaphore.h @@ -0,0 +1,23 @@ +#ifndef FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_ +#define FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_ + +#include "fsfw/tasks/SemaphoreIF.h" + +class BinarySemaphore: public SemaphoreIF { +public: + BinarySemaphore(); + virtual ~BinarySemaphore(); + + // Semaphore IF implementations + ReturnValue_t acquire(TimeoutType timeoutType = + TimeoutType::BLOCKING, uint32_t timeoutMs = 0) override; + ReturnValue_t release() override; + uint8_t getSemaphoreCounter() const override; + +private: + +}; + + + +#endif /* FSFW_SRC_FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_ */ diff --git a/osal/rtems/CMakeLists.txt b/src/fsfw/osal/rtems/CMakeLists.txt similarity index 86% rename from osal/rtems/CMakeLists.txt rename to src/fsfw/osal/rtems/CMakeLists.txt index cd266125..734566a3 100644 --- a/osal/rtems/CMakeLists.txt +++ b/src/fsfw/osal/rtems/CMakeLists.txt @@ -13,6 +13,8 @@ target_sources(${LIB_FSFW_NAME} RtemsBasic.cpp RTEMSTaskBase.cpp TaskFactory.cpp + BinarySemaphore.cpp + SemaphoreFactory.cpp ) diff --git a/osal/rtems/Clock.cpp b/src/fsfw/osal/rtems/Clock.cpp similarity index 97% rename from osal/rtems/Clock.cpp rename to src/fsfw/osal/rtems/Clock.cpp index ae720c36..42f30dcc 100644 --- a/osal/rtems/Clock.cpp +++ b/src/fsfw/osal/rtems/Clock.cpp @@ -1,7 +1,7 @@ -#include "RtemsBasic.h" +#include "fsfw/osal/rtems/RtemsBasic.h" -#include "../../timemanager/Clock.h" -#include "../../ipc/MutexGuard.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/ipc/MutexGuard.h" #include #include diff --git a/osal/rtems/CpuUsage.cpp b/src/fsfw/osal/rtems/CpuUsage.cpp similarity index 97% rename from osal/rtems/CpuUsage.cpp rename to src/fsfw/osal/rtems/CpuUsage.cpp index 89c01336..771b52dc 100644 --- a/osal/rtems/CpuUsage.cpp +++ b/src/fsfw/osal/rtems/CpuUsage.cpp @@ -1,6 +1,6 @@ -#include "CpuUsage.h" -#include "../../serialize/SerialArrayListAdapter.h" -#include "../../serialize/SerializeAdapter.h" +#include "fsfw/osal/rtems/CpuUsage.h" +#include "fsfw/serialize/SerialArrayListAdapter.h" +#include "fsfw/serialize/SerializeAdapter.h" #include extern "C" { diff --git a/osal/rtems/CpuUsage.h b/src/fsfw/osal/rtems/CpuUsage.h similarity index 93% rename from osal/rtems/CpuUsage.h rename to src/fsfw/osal/rtems/CpuUsage.h index f487e191..6b6b9910 100644 --- a/osal/rtems/CpuUsage.h +++ b/src/fsfw/osal/rtems/CpuUsage.h @@ -1,8 +1,8 @@ #ifndef CPUUSAGE_H_ #define CPUUSAGE_H_ -#include "../../container/FixedArrayList.h" -#include "../../serialize/SerializeIF.h" +#include "fsfw/container/FixedArrayList.h" +#include "fsfw/serialize/SerializeIF.h" #include class CpuUsage : public SerializeIF { diff --git a/osal/rtems/FixedTimeslotTask.cpp b/src/fsfw/osal/rtems/FixedTimeslotTask.cpp similarity index 93% rename from osal/rtems/FixedTimeslotTask.cpp rename to src/fsfw/osal/rtems/FixedTimeslotTask.cpp index 19960a4c..8b313df6 100644 --- a/osal/rtems/FixedTimeslotTask.cpp +++ b/src/fsfw/osal/rtems/FixedTimeslotTask.cpp @@ -1,11 +1,11 @@ -#include "FixedTimeslotTask.h" -#include "RtemsBasic.h" +#include "fsfw/osal/rtems/FixedTimeslotTask.h" +#include "fsfw/osal/rtems/RtemsBasic.h" -#include "../../tasks/FixedSequenceSlot.h" -#include "../../objectmanager/SystemObjectIF.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../returnvalues/HasReturnvaluesIF.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/FixedSequenceSlot.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include #include diff --git a/osal/rtems/FixedTimeslotTask.h b/src/fsfw/osal/rtems/FixedTimeslotTask.h similarity index 100% rename from osal/rtems/FixedTimeslotTask.h rename to src/fsfw/osal/rtems/FixedTimeslotTask.h diff --git a/osal/rtems/InitTask.cpp b/src/fsfw/osal/rtems/InitTask.cpp similarity index 52% rename from osal/rtems/InitTask.cpp rename to src/fsfw/osal/rtems/InitTask.cpp index 80afed3d..8a9bb9f6 100644 --- a/osal/rtems/InitTask.cpp +++ b/src/fsfw/osal/rtems/InitTask.cpp @@ -1,5 +1,5 @@ -#include "InitTask.h" -#include "RtemsBasic.h" +#include "fsfw/osal/rtems/InitTask.h" +#include "fsfw/osal/rtems/RtemsBasic.h" diff --git a/osal/rtems/InitTask.h b/src/fsfw/osal/rtems/InitTask.h similarity index 100% rename from osal/rtems/InitTask.h rename to src/fsfw/osal/rtems/InitTask.h diff --git a/osal/rtems/InternalErrorCodes.cpp b/src/fsfw/osal/rtems/InternalErrorCodes.cpp similarity index 97% rename from osal/rtems/InternalErrorCodes.cpp rename to src/fsfw/osal/rtems/InternalErrorCodes.cpp index f4079814..049286d7 100644 --- a/osal/rtems/InternalErrorCodes.cpp +++ b/src/fsfw/osal/rtems/InternalErrorCodes.cpp @@ -1,4 +1,4 @@ -#include "../../osal/InternalErrorCodes.h" +#include "fsfw/osal/InternalErrorCodes.h" #include ReturnValue_t InternalErrorCodes::translate(uint8_t code) { diff --git a/osal/rtems/MessageQueue.cpp b/src/fsfw/osal/rtems/MessageQueue.cpp similarity index 96% rename from osal/rtems/MessageQueue.cpp rename to src/fsfw/osal/rtems/MessageQueue.cpp index e8128e90..65fe0946 100644 --- a/osal/rtems/MessageQueue.cpp +++ b/src/fsfw/osal/rtems/MessageQueue.cpp @@ -1,8 +1,8 @@ -#include "MessageQueue.h" -#include "RtemsBasic.h" +#include "fsfw/osal/rtems/MessageQueue.h" +#include "fsfw/osal/rtems/RtemsBasic.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" #include diff --git a/osal/rtems/MessageQueue.h b/src/fsfw/osal/rtems/MessageQueue.h similarity index 98% rename from osal/rtems/MessageQueue.h rename to src/fsfw/osal/rtems/MessageQueue.h index 342f1e30..fa143ebe 100644 --- a/osal/rtems/MessageQueue.h +++ b/src/fsfw/osal/rtems/MessageQueue.h @@ -1,9 +1,9 @@ #ifndef FSFW_OSAL_RTEMS_MESSAGEQUEUE_H_ #define FSFW_OSAL_RTEMS_MESSAGEQUEUE_H_ -#include "../../internalError/InternalErrorReporterIF.h" -#include "../../ipc/MessageQueueIF.h" -#include "../../ipc/MessageQueueMessage.h" +#include "fsfw/internalerror/InternalErrorReporterIF.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" #include "RtemsBasic.h" /** diff --git a/osal/rtems/Mutex.cpp b/src/fsfw/osal/rtems/Mutex.cpp similarity index 96% rename from osal/rtems/Mutex.cpp rename to src/fsfw/osal/rtems/Mutex.cpp index f65c1f55..2dfa39fa 100644 --- a/osal/rtems/Mutex.cpp +++ b/src/fsfw/osal/rtems/Mutex.cpp @@ -1,5 +1,5 @@ -#include "Mutex.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/osal/rtems/Mutex.h" +#include "fsfw/serviceinterface/ServiceInterface.h" uint8_t Mutex::count = 0; diff --git a/osal/rtems/Mutex.h b/src/fsfw/osal/rtems/Mutex.h similarity index 100% rename from osal/rtems/Mutex.h rename to src/fsfw/osal/rtems/Mutex.h diff --git a/osal/rtems/MutexFactory.cpp b/src/fsfw/osal/rtems/MutexFactory.cpp similarity index 83% rename from osal/rtems/MutexFactory.cpp rename to src/fsfw/osal/rtems/MutexFactory.cpp index adc599e9..bf7ce666 100644 --- a/osal/rtems/MutexFactory.cpp +++ b/src/fsfw/osal/rtems/MutexFactory.cpp @@ -1,6 +1,6 @@ -#include "Mutex.h" +#include "fsfw/osal/rtems/Mutex.h" -#include "../../ipc/MutexFactory.h" +#include "fsfw/ipc/MutexFactory.h" MutexFactory* MutexFactory::factoryInstance = new MutexFactory(); diff --git a/osal/rtems/PeriodicTask.cpp b/src/fsfw/osal/rtems/PeriodicTask.cpp similarity index 93% rename from osal/rtems/PeriodicTask.cpp rename to src/fsfw/osal/rtems/PeriodicTask.cpp index 58717344..db98153c 100644 --- a/osal/rtems/PeriodicTask.cpp +++ b/src/fsfw/osal/rtems/PeriodicTask.cpp @@ -1,8 +1,8 @@ -#include "PeriodicTask.h" +#include "fsfw/osal/rtems/PeriodicTask.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../tasks/ExecutableObjectIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/tasks/ExecutableObjectIF.h" PeriodicTask::PeriodicTask(const char *name, rtems_task_priority setPriority, size_t setStack, rtems_interval setPeriod, void (*setDeadlineMissedFunc)()) : diff --git a/osal/rtems/PeriodicTask.h b/src/fsfw/osal/rtems/PeriodicTask.h similarity index 100% rename from osal/rtems/PeriodicTask.h rename to src/fsfw/osal/rtems/PeriodicTask.h diff --git a/osal/rtems/QueueFactory.cpp b/src/fsfw/osal/rtems/QueueFactory.cpp similarity index 90% rename from osal/rtems/QueueFactory.cpp rename to src/fsfw/osal/rtems/QueueFactory.cpp index ff561304..ddcc3959 100644 --- a/osal/rtems/QueueFactory.cpp +++ b/src/fsfw/osal/rtems/QueueFactory.cpp @@ -1,7 +1,8 @@ -#include "../../ipc/QueueFactory.h" -#include "../../ipc/MessageQueueSenderIF.h" -#include "MessageQueue.h" -#include "RtemsBasic.h" +#include "fsfw/osal/rtems/MessageQueue.h" +#include "fsfw/osal/rtems/RtemsBasic.h" + +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" QueueFactory* QueueFactory::factoryInstance = nullptr; diff --git a/osal/rtems/RTEMSTaskBase.cpp b/src/fsfw/osal/rtems/RTEMSTaskBase.cpp similarity index 96% rename from osal/rtems/RTEMSTaskBase.cpp rename to src/fsfw/osal/rtems/RTEMSTaskBase.cpp index d0cdc876..fc8bbed5 100644 --- a/osal/rtems/RTEMSTaskBase.cpp +++ b/src/fsfw/osal/rtems/RTEMSTaskBase.cpp @@ -1,5 +1,5 @@ -#include "RTEMSTaskBase.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/osal/rtems/RTEMSTaskBase.h" +#include "fsfw/serviceinterface/ServiceInterface.h" const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = RTEMS_MINIMUM_STACK_SIZE; diff --git a/osal/rtems/RTEMSTaskBase.h b/src/fsfw/osal/rtems/RTEMSTaskBase.h similarity index 100% rename from osal/rtems/RTEMSTaskBase.h rename to src/fsfw/osal/rtems/RTEMSTaskBase.h diff --git a/src/fsfw/osal/rtems/RtemsBasic.cpp b/src/fsfw/osal/rtems/RtemsBasic.cpp new file mode 100644 index 00000000..463824ad --- /dev/null +++ b/src/fsfw/osal/rtems/RtemsBasic.cpp @@ -0,0 +1 @@ +#include "fsfw/osal/rtems/RtemsBasic.h" diff --git a/osal/rtems/RtemsBasic.h b/src/fsfw/osal/rtems/RtemsBasic.h similarity index 92% rename from osal/rtems/RtemsBasic.h rename to src/fsfw/osal/rtems/RtemsBasic.h index 73f23186..382697a3 100644 --- a/osal/rtems/RtemsBasic.h +++ b/src/fsfw/osal/rtems/RtemsBasic.h @@ -1,7 +1,7 @@ #ifndef FSFW_OSAL_RTEMS_RTEMSBASIC_H_ #define FSFW_OSAL_RTEMS_RTEMSBASIC_H_ -#include "../../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include #include diff --git a/src/fsfw/osal/rtems/SemaphoreFactory.cpp b/src/fsfw/osal/rtems/SemaphoreFactory.cpp new file mode 100644 index 00000000..cec4b833 --- /dev/null +++ b/src/fsfw/osal/rtems/SemaphoreFactory.cpp @@ -0,0 +1,34 @@ +#include "fsfw/osal/rtems/BinarySemaphore.h" +//#include "fsfw/osal/rtems/CountingSemaphore.h" + +#include "fsfw/tasks/SemaphoreFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + +SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr; + +SemaphoreFactory::SemaphoreFactory() { +} + +SemaphoreFactory::~SemaphoreFactory() { + delete factoryInstance; +} + +SemaphoreFactory* SemaphoreFactory::instance() { + if (factoryInstance == nullptr){ + factoryInstance = new SemaphoreFactory(); + } + return SemaphoreFactory::factoryInstance; +} + +SemaphoreIF* SemaphoreFactory::createBinarySemaphore(uint32_t argument) { + return new BinarySemaphore(); +} + +SemaphoreIF* SemaphoreFactory::createCountingSemaphore(uint8_t maxCount, + uint8_t initCount, uint32_t argument) { + return nullptr; +} + +void SemaphoreFactory::deleteSemaphore(SemaphoreIF* semaphore) { + delete semaphore; +} diff --git a/osal/rtems/TaskFactory.cpp b/src/fsfw/osal/rtems/TaskFactory.cpp similarity index 86% rename from osal/rtems/TaskFactory.cpp rename to src/fsfw/osal/rtems/TaskFactory.cpp index 095e9a26..dd3e92fc 100644 --- a/osal/rtems/TaskFactory.cpp +++ b/src/fsfw/osal/rtems/TaskFactory.cpp @@ -1,10 +1,10 @@ -#include "FixedTimeslotTask.h" -#include "PeriodicTask.h" -#include "InitTask.h" -#include "RtemsBasic.h" +#include "fsfw/osal/rtems/FixedTimeslotTask.h" +#include "fsfw/osal/rtems/PeriodicTask.h" +#include "fsfw/osal/rtems/InitTask.h" +#include "fsfw/osal/rtems/RtemsBasic.h" -#include "../../tasks/TaskFactory.h" -#include "../../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/TaskFactory.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" //TODO: Different variant than the lazy loading in QueueFactory. What's better and why? TaskFactory* TaskFactory::factoryInstance = new TaskFactory(); diff --git a/osal/windows/CMakeLists.txt b/src/fsfw/osal/windows/CMakeLists.txt similarity index 100% rename from osal/windows/CMakeLists.txt rename to src/fsfw/osal/windows/CMakeLists.txt diff --git a/osal/windows/tcpipHelpers.cpp b/src/fsfw/osal/windows/tcpipHelpers.cpp similarity index 90% rename from osal/windows/tcpipHelpers.cpp rename to src/fsfw/osal/windows/tcpipHelpers.cpp index 3dab9406..37d6fb2f 100644 --- a/osal/windows/tcpipHelpers.cpp +++ b/src/fsfw/osal/windows/tcpipHelpers.cpp @@ -1,8 +1,8 @@ -#include "../common/tcpipHelpers.h" -#include +#include "fsfw/FSFW.h" +#include "fsfw/osal/common/tcpipHelpers.h" -#include "../../tasks/TaskFactory.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/TaskFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/osal/windows/winTaskHelpers.cpp b/src/fsfw/osal/windows/winTaskHelpers.cpp similarity index 98% rename from osal/windows/winTaskHelpers.cpp rename to src/fsfw/osal/windows/winTaskHelpers.cpp index 6765b952..20d4d98d 100644 --- a/osal/windows/winTaskHelpers.cpp +++ b/src/fsfw/osal/windows/winTaskHelpers.cpp @@ -1,4 +1,5 @@ -#include +#include "fsfw/osal/windows/winTaskHelpers.h" + #include TaskPriority tasks::makeWinPriority(PriorityClass prioClass, PriorityNumber prioNumber) { diff --git a/osal/windows/winTaskHelpers.h b/src/fsfw/osal/windows/winTaskHelpers.h similarity index 100% rename from osal/windows/winTaskHelpers.h rename to src/fsfw/osal/windows/winTaskHelpers.h diff --git a/parameters/CMakeLists.txt b/src/fsfw/parameters/CMakeLists.txt similarity index 100% rename from parameters/CMakeLists.txt rename to src/fsfw/parameters/CMakeLists.txt diff --git a/parameters/HasParametersIF.h b/src/fsfw/parameters/HasParametersIF.h similarity index 100% rename from parameters/HasParametersIF.h rename to src/fsfw/parameters/HasParametersIF.h diff --git a/parameters/ParameterHelper.cpp b/src/fsfw/parameters/ParameterHelper.cpp similarity index 97% rename from parameters/ParameterHelper.cpp rename to src/fsfw/parameters/ParameterHelper.cpp index 694ec5a4..9250a1d4 100644 --- a/parameters/ParameterHelper.cpp +++ b/src/fsfw/parameters/ParameterHelper.cpp @@ -1,7 +1,7 @@ -#include "ParameterHelper.h" -#include "ParameterMessage.h" +#include "fsfw/parameters/ParameterHelper.h" +#include "fsfw/parameters/ParameterMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/ObjectManager.h" ParameterHelper::ParameterHelper(ReceivesParameterMessagesIF* owner): owner(owner) {} diff --git a/parameters/ParameterHelper.h b/src/fsfw/parameters/ParameterHelper.h similarity index 100% rename from parameters/ParameterHelper.h rename to src/fsfw/parameters/ParameterHelper.h diff --git a/parameters/ParameterMessage.cpp b/src/fsfw/parameters/ParameterMessage.cpp similarity index 95% rename from parameters/ParameterMessage.cpp rename to src/fsfw/parameters/ParameterMessage.cpp index 8a5835ff..ee58339c 100644 --- a/parameters/ParameterMessage.cpp +++ b/src/fsfw/parameters/ParameterMessage.cpp @@ -1,6 +1,6 @@ -#include "ParameterMessage.h" +#include "fsfw/parameters/ParameterMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/ObjectManager.h" ParameterId_t ParameterMessage::getParameterId(const CommandMessage* message) { return message->getParameter(); diff --git a/parameters/ParameterMessage.h b/src/fsfw/parameters/ParameterMessage.h similarity index 100% rename from parameters/ParameterMessage.h rename to src/fsfw/parameters/ParameterMessage.h diff --git a/parameters/ParameterWrapper.cpp b/src/fsfw/parameters/ParameterWrapper.cpp similarity index 98% rename from parameters/ParameterWrapper.cpp rename to src/fsfw/parameters/ParameterWrapper.cpp index 660d7db7..8c09a822 100644 --- a/parameters/ParameterWrapper.cpp +++ b/src/fsfw/parameters/ParameterWrapper.cpp @@ -1,6 +1,6 @@ -#include "ParameterWrapper.h" -#include -#include +#include "fsfw/FSFW.h" +#include "fsfw/parameters/ParameterWrapper.h" +#include "fsfw/serviceinterface/ServiceInterface.h" ParameterWrapper::ParameterWrapper() : pointsToStream(false), type(Type::UNKNOWN_TYPE) { diff --git a/parameters/ParameterWrapper.h b/src/fsfw/parameters/ParameterWrapper.h similarity index 100% rename from parameters/ParameterWrapper.h rename to src/fsfw/parameters/ParameterWrapper.h diff --git a/parameters/ReceivesParameterMessagesIF.h b/src/fsfw/parameters/ReceivesParameterMessagesIF.h similarity index 100% rename from parameters/ReceivesParameterMessagesIF.h rename to src/fsfw/parameters/ReceivesParameterMessagesIF.h diff --git a/platform.h b/src/fsfw/platform.h similarity index 100% rename from platform.h rename to src/fsfw/platform.h diff --git a/power/CMakeLists.txt b/src/fsfw/power/CMakeLists.txt similarity index 100% rename from power/CMakeLists.txt rename to src/fsfw/power/CMakeLists.txt diff --git a/power/Fuse.cpp b/src/fsfw/power/Fuse.cpp similarity index 96% rename from power/Fuse.cpp rename to src/fsfw/power/Fuse.cpp index 0cb1385b..821bdbc5 100644 --- a/power/Fuse.cpp +++ b/src/fsfw/power/Fuse.cpp @@ -1,10 +1,10 @@ -#include "Fuse.h" +#include "fsfw/power/Fuse.h" -#include "../monitoring/LimitViolationReporter.h" -#include "../monitoring/MonitoringMessageContent.h" -#include "../objectmanager/ObjectManager.h" -#include "../serialize/SerialFixedArrayListAdapter.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/monitoring/LimitViolationReporter.h" +#include "fsfw/monitoring/MonitoringMessageContent.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serialize/SerialFixedArrayListAdapter.h" +#include "fsfw/ipc/QueueFactory.h" object_id_t Fuse::powerSwitchId = 0; diff --git a/power/Fuse.h b/src/fsfw/power/Fuse.h similarity index 100% rename from power/Fuse.h rename to src/fsfw/power/Fuse.h diff --git a/power/PowerComponent.cpp b/src/fsfw/power/PowerComponent.cpp similarity index 96% rename from power/PowerComponent.cpp rename to src/fsfw/power/PowerComponent.cpp index 9ea84dad..fb66748a 100644 --- a/power/PowerComponent.cpp +++ b/src/fsfw/power/PowerComponent.cpp @@ -1,5 +1,5 @@ -#include "PowerComponent.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/power/PowerComponent.h" +#include "fsfw/serialize/SerializeAdapter.h" PowerComponent::PowerComponent(): switchId1(0xFF), switchId2(0xFF), diff --git a/power/PowerComponent.h b/src/fsfw/power/PowerComponent.h similarity index 92% rename from power/PowerComponent.h rename to src/fsfw/power/PowerComponent.h index 6b9778a5..3889a2ae 100644 --- a/power/PowerComponent.h +++ b/src/fsfw/power/PowerComponent.h @@ -3,8 +3,8 @@ #include "PowerComponentIF.h" -#include "../objectmanager/frameworkObjects.h" -#include "../objectmanager/SystemObjectIF.h" +#include "fsfw/objectmanager/frameworkObjects.h" +#include "fsfw/objectmanager/SystemObjectIF.h" class PowerComponent: public PowerComponentIF { diff --git a/power/PowerComponentIF.h b/src/fsfw/power/PowerComponentIF.h similarity index 100% rename from power/PowerComponentIF.h rename to src/fsfw/power/PowerComponentIF.h diff --git a/power/PowerSensor.cpp b/src/fsfw/power/PowerSensor.cpp similarity index 98% rename from power/PowerSensor.cpp rename to src/fsfw/power/PowerSensor.cpp index 40d7afc6..e1e31353 100644 --- a/power/PowerSensor.cpp +++ b/src/fsfw/power/PowerSensor.cpp @@ -1,6 +1,6 @@ -#include "PowerSensor.h" +#include "fsfw/power/PowerSensor.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/ipc/QueueFactory.h" PowerSensor::PowerSensor(object_id_t objectId, sid_t setId, VariableIds ids, DefaultLimits limits, SensorEvents events, uint16_t confirmationCount) : diff --git a/power/PowerSensor.h b/src/fsfw/power/PowerSensor.h similarity index 87% rename from power/PowerSensor.h rename to src/fsfw/power/PowerSensor.h index 5a21ab10..d00c5420 100644 --- a/power/PowerSensor.h +++ b/src/fsfw/power/PowerSensor.h @@ -1,12 +1,12 @@ #ifndef FSFW_POWER_POWERSENSOR_H_ #define FSFW_POWER_POWERSENSOR_H_ -#include "../datapoollocal/StaticLocalDataSet.h" -#include "../devicehandlers/HealthDevice.h" -#include "../monitoring/LimitMonitor.h" -#include "../parameters/ParameterHelper.h" -#include "../objectmanager/SystemObject.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/datapoollocal/StaticLocalDataSet.h" +#include "fsfw/devicehandlers/HealthDevice.h" +#include "fsfw/monitoring/LimitMonitor.h" +#include "fsfw/parameters/ParameterHelper.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/ipc/MessageQueueIF.h" class PowerController; diff --git a/power/PowerSwitchIF.h b/src/fsfw/power/PowerSwitchIF.h similarity index 100% rename from power/PowerSwitchIF.h rename to src/fsfw/power/PowerSwitchIF.h diff --git a/power/PowerSwitcher.cpp b/src/fsfw/power/PowerSwitcher.cpp similarity index 95% rename from power/PowerSwitcher.cpp rename to src/fsfw/power/PowerSwitcher.cpp index 642a2697..f849a7fb 100644 --- a/power/PowerSwitcher.cpp +++ b/src/fsfw/power/PowerSwitcher.cpp @@ -1,7 +1,7 @@ -#include "PowerSwitcher.h" +#include "fsfw/power/PowerSwitcher.h" -#include "../objectmanager/ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" PowerSwitcher::PowerSwitcher(uint8_t setSwitch1, uint8_t setSwitch2, PowerSwitcher::State_t setStartState): diff --git a/power/PowerSwitcher.h b/src/fsfw/power/PowerSwitcher.h similarity index 100% rename from power/PowerSwitcher.h rename to src/fsfw/power/PowerSwitcher.h diff --git a/pus/CMakeLists.txt b/src/fsfw/pus/CMakeLists.txt similarity index 100% rename from pus/CMakeLists.txt rename to src/fsfw/pus/CMakeLists.txt diff --git a/pus/CService200ModeCommanding.cpp b/src/fsfw/pus/CService200ModeCommanding.cpp similarity index 92% rename from pus/CService200ModeCommanding.cpp rename to src/fsfw/pus/CService200ModeCommanding.cpp index d178b3a9..66c61dbe 100644 --- a/pus/CService200ModeCommanding.cpp +++ b/src/fsfw/pus/CService200ModeCommanding.cpp @@ -1,11 +1,11 @@ -#include "CService200ModeCommanding.h" -#include "servicepackets/Service200Packets.h" +#include "fsfw/pus/CService200ModeCommanding.h" +#include "fsfw/pus/servicepackets/Service200Packets.h" -#include "../modes/HasModesIF.h" -#include "../objectmanager/ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../serialize/SerialLinkedListAdapter.h" -#include "../modes/ModeMessage.h" +#include "fsfw/modes/HasModesIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/serialize/SerialLinkedListAdapter.h" +#include "fsfw/modes/ModeMessage.h" CService200ModeCommanding::CService200ModeCommanding(object_id_t objectId, uint16_t apid, uint8_t serviceId, uint8_t numParallelCommands, diff --git a/pus/CService200ModeCommanding.h b/src/fsfw/pus/CService200ModeCommanding.h similarity index 98% rename from pus/CService200ModeCommanding.h rename to src/fsfw/pus/CService200ModeCommanding.h index 84040212..d523d6c3 100644 --- a/pus/CService200ModeCommanding.h +++ b/src/fsfw/pus/CService200ModeCommanding.h @@ -1,7 +1,7 @@ #ifndef FSFW_PUS_CSERVICE200MODECOMMANDING_H_ #define FSFW_PUS_CSERVICE200MODECOMMANDING_H_ -#include "../tmtcservices/CommandingServiceBase.h" +#include "fsfw/tmtcservices/CommandingServiceBase.h" /** * @brief Custom PUS service to set mode of all objects implementing HasModesIF diff --git a/pus/CService201HealthCommanding.cpp b/src/fsfw/pus/CService201HealthCommanding.cpp similarity index 92% rename from pus/CService201HealthCommanding.cpp rename to src/fsfw/pus/CService201HealthCommanding.cpp index 52a8a603..1e414c82 100644 --- a/pus/CService201HealthCommanding.cpp +++ b/src/fsfw/pus/CService201HealthCommanding.cpp @@ -1,10 +1,10 @@ -#include "CService201HealthCommanding.h" -#include "servicepackets/Service201Packets.h" +#include "fsfw/pus/CService201HealthCommanding.h" +#include "fsfw/pus/servicepackets/Service201Packets.h" -#include "../health/HasHealthIF.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/ObjectManager.h" -#include "../health/HealthMessage.h" +#include "fsfw/health/HasHealthIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/health/HealthMessage.h" CService201HealthCommanding::CService201HealthCommanding(object_id_t objectId, diff --git a/pus/CService201HealthCommanding.h b/src/fsfw/pus/CService201HealthCommanding.h similarity index 100% rename from pus/CService201HealthCommanding.h rename to src/fsfw/pus/CService201HealthCommanding.h diff --git a/pus/Service17Test.cpp b/src/fsfw/pus/Service17Test.cpp similarity index 87% rename from pus/Service17Test.cpp rename to src/fsfw/pus/Service17Test.cpp index 37258cc1..20227172 100644 --- a/pus/Service17Test.cpp +++ b/src/fsfw/pus/Service17Test.cpp @@ -1,9 +1,9 @@ -#include "Service17Test.h" -#include +#include "fsfw/FSFW.h" +#include "fsfw/pus/Service17Test.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/SystemObject.h" -#include "../tmtcpacket/pus/tm/TmPacketStored.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h" Service17Test::Service17Test(object_id_t objectId, diff --git a/pus/Service17Test.h b/src/fsfw/pus/Service17Test.h similarity index 93% rename from pus/Service17Test.h rename to src/fsfw/pus/Service17Test.h index 83d436ea..d1e1ecce 100644 --- a/pus/Service17Test.h +++ b/src/fsfw/pus/Service17Test.h @@ -1,8 +1,8 @@ #ifndef FSFW_PUS_SERVICE17TEST_H_ #define FSFW_PUS_SERVICE17TEST_H_ -#include "../tmtcservices/PusServiceBase.h" -#include "../objectmanager/SystemObject.h" +#include "fsfw/tmtcservices/PusServiceBase.h" +#include "fsfw/objectmanager/SystemObject.h" /** * @brief Test Service diff --git a/pus/Service1TelecommandVerification.cpp b/src/fsfw/pus/Service1TelecommandVerification.cpp similarity index 90% rename from pus/Service1TelecommandVerification.cpp rename to src/fsfw/pus/Service1TelecommandVerification.cpp index 8aec6902..c6b024f9 100644 --- a/pus/Service1TelecommandVerification.cpp +++ b/src/fsfw/pus/Service1TelecommandVerification.cpp @@ -1,12 +1,12 @@ -#include "Service1TelecommandVerification.h" -#include "servicepackets/Service1Packets.h" +#include "fsfw/pus/Service1TelecommandVerification.h" +#include "fsfw/pus/servicepackets/Service1Packets.h" -#include "../ipc/QueueFactory.h" -#include "../objectmanager/ObjectManager.h" -#include "../tmtcservices/PusVerificationReport.h" -#include "../tmtcpacket/pus/tm/TmPacketStored.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../tmtcservices/AcceptsTelemetryIF.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/AcceptsTelemetryIF.h" Service1TelecommandVerification::Service1TelecommandVerification( object_id_t objectId, uint16_t apid, uint8_t serviceId, diff --git a/pus/Service1TelecommandVerification.h b/src/fsfw/pus/Service1TelecommandVerification.h similarity index 91% rename from pus/Service1TelecommandVerification.h rename to src/fsfw/pus/Service1TelecommandVerification.h index 3d68a4e0..26284493 100644 --- a/pus/Service1TelecommandVerification.h +++ b/src/fsfw/pus/Service1TelecommandVerification.h @@ -1,12 +1,12 @@ #ifndef FSFW_PUS_SERVICE1TELECOMMANDVERIFICATION_H_ #define FSFW_PUS_SERVICE1TELECOMMANDVERIFICATION_H_ -#include "../objectmanager/SystemObject.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../tmtcservices/AcceptsVerifyMessageIF.h" -#include "../tmtcservices/PusVerificationReport.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/tmtcservices/AcceptsVerifyMessageIF.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" +#include "fsfw/ipc/MessageQueueIF.h" /** * @brief Verify TC acceptance, start, progress and execution. diff --git a/pus/Service20ParameterManagement.cpp b/src/fsfw/pus/Service20ParameterManagement.cpp similarity index 95% rename from pus/Service20ParameterManagement.cpp rename to src/fsfw/pus/Service20ParameterManagement.cpp index c4e4b5eb..e28e7804 100644 --- a/pus/Service20ParameterManagement.cpp +++ b/src/fsfw/pus/Service20ParameterManagement.cpp @@ -1,11 +1,11 @@ -#include "Service20ParameterManagement.h" -#include "servicepackets/Service20Packets.h" +#include "fsfw/pus/Service20ParameterManagement.h" +#include "fsfw/pus/servicepackets/Service20Packets.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../parameters/HasParametersIF.h" -#include "../parameters/ParameterMessage.h" -#include "../objectmanager/ObjectManager.h" -#include "../parameters/ReceivesParameterMessagesIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/parameters/HasParametersIF.h" +#include "fsfw/parameters/ParameterMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/parameters/ReceivesParameterMessagesIF.h" Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId, uint16_t apid, diff --git a/pus/Service20ParameterManagement.h b/src/fsfw/pus/Service20ParameterManagement.h similarity index 97% rename from pus/Service20ParameterManagement.h rename to src/fsfw/pus/Service20ParameterManagement.h index 5370bfcb..63ec199c 100644 --- a/pus/Service20ParameterManagement.h +++ b/src/fsfw/pus/Service20ParameterManagement.h @@ -1,7 +1,7 @@ #ifndef FSFW_PUS_SERVICE20PARAMETERMANAGEMENT_H_ #define FSFW_PUS_SERVICE20PARAMETERMANAGEMENT_H_ -#include "../tmtcservices/CommandingServiceBase.h" +#include "fsfw/tmtcservices/CommandingServiceBase.h" /** * @brief PUS Service 20 Parameter Service implementation diff --git a/pus/Service2DeviceAccess.cpp b/src/fsfw/pus/Service2DeviceAccess.cpp similarity index 91% rename from pus/Service2DeviceAccess.cpp rename to src/fsfw/pus/Service2DeviceAccess.cpp index 4cf75d32..0e5edfd3 100644 --- a/pus/Service2DeviceAccess.cpp +++ b/src/fsfw/pus/Service2DeviceAccess.cpp @@ -1,15 +1,15 @@ -#include "Service2DeviceAccess.h" -#include "servicepackets/Service2Packets.h" +#include "fsfw/pus/Service2DeviceAccess.h" +#include "fsfw/pus/servicepackets/Service2Packets.h" -#include "../objectmanager/ObjectManager.h" -#include "../devicehandlers/DeviceHandlerIF.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../devicehandlers/DeviceHandlerMessage.h" -#include "../serialize/EndianConverter.h" -#include "../action/ActionMessage.h" -#include "../serialize/SerializeAdapter.h" -#include "../serialize/SerialLinkedListAdapter.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/devicehandlers/DeviceHandlerIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/devicehandlers/DeviceHandlerMessage.h" +#include "fsfw/serialize/EndianConverter.h" +#include "fsfw/action/ActionMessage.h" +#include "fsfw/serialize/SerializeAdapter.h" +#include "fsfw/serialize/SerialLinkedListAdapter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" Service2DeviceAccess::Service2DeviceAccess(object_id_t objectId, uint16_t apid, uint8_t serviceId, uint8_t numberOfParallelCommands, diff --git a/pus/Service2DeviceAccess.h b/src/fsfw/pus/Service2DeviceAccess.h similarity index 95% rename from pus/Service2DeviceAccess.h rename to src/fsfw/pus/Service2DeviceAccess.h index b62e6854..e518863c 100644 --- a/pus/Service2DeviceAccess.h +++ b/src/fsfw/pus/Service2DeviceAccess.h @@ -1,9 +1,9 @@ #ifndef FSFW_PUS_SERVICE2DEVICEACCESS_H_ #define FSFW_PUS_SERVICE2DEVICEACCESS_H_ -#include "../objectmanager/SystemObjectIF.h" -#include "../devicehandlers/AcceptsDeviceResponsesIF.h" -#include "../tmtcservices/CommandingServiceBase.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/devicehandlers/AcceptsDeviceResponsesIF.h" +#include "fsfw/tmtcservices/CommandingServiceBase.h" /** * @brief Raw Commanding and Wiretapping of devices. diff --git a/pus/Service3Housekeeping.cpp b/src/fsfw/pus/Service3Housekeeping.cpp similarity index 98% rename from pus/Service3Housekeeping.cpp rename to src/fsfw/pus/Service3Housekeeping.cpp index 6b1275b3..2b91f366 100644 --- a/pus/Service3Housekeeping.cpp +++ b/src/fsfw/pus/Service3Housekeeping.cpp @@ -1,8 +1,8 @@ -#include "Service3Housekeeping.h" -#include "servicepackets/Service3Packets.h" +#include "fsfw/pus/Service3Housekeeping.h" +#include "fsfw/pus/servicepackets/Service3Packets.h" -#include "../objectmanager/ObjectManager.h" -#include "../datapoollocal/HasLocalDataPoolIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/datapoollocal/HasLocalDataPoolIF.h" Service3Housekeeping::Service3Housekeeping(object_id_t objectId, uint16_t apid, uint8_t serviceId): diff --git a/pus/Service3Housekeeping.h b/src/fsfw/pus/Service3Housekeeping.h similarity index 96% rename from pus/Service3Housekeeping.h rename to src/fsfw/pus/Service3Housekeeping.h index 269710ef..d2dc6066 100644 --- a/pus/Service3Housekeeping.h +++ b/src/fsfw/pus/Service3Housekeeping.h @@ -1,9 +1,9 @@ #ifndef FSFW_PUS_SERVICE3HOUSEKEEPINGSERVICE_H_ #define FSFW_PUS_SERVICE3HOUSEKEEPINGSERVICE_H_ -#include "../housekeeping/AcceptsHkPacketsIF.h" -#include "../housekeeping/HousekeepingMessage.h" -#include "../tmtcservices/CommandingServiceBase.h" +#include "fsfw/housekeeping/AcceptsHkPacketsIF.h" +#include "fsfw/housekeeping/HousekeepingMessage.h" +#include "fsfw/tmtcservices/CommandingServiceBase.h" /** * @brief Manges spacecraft housekeeping reports and diff --git a/pus/Service5EventReporting.cpp b/src/fsfw/pus/Service5EventReporting.cpp similarity index 90% rename from pus/Service5EventReporting.cpp rename to src/fsfw/pus/Service5EventReporting.cpp index 0c139f3a..36aa7e70 100644 --- a/pus/Service5EventReporting.cpp +++ b/src/fsfw/pus/Service5EventReporting.cpp @@ -1,11 +1,11 @@ -#include "Service5EventReporting.h" -#include "servicepackets/Service5Packets.h" +#include "fsfw/pus/Service5EventReporting.h" +#include "fsfw/pus/servicepackets/Service5Packets.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/ObjectManager.h" -#include "../events/EventManagerIF.h" -#include "../ipc/QueueFactory.h" -#include "../tmtcpacket/pus/tm/TmPacketStored.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/events/EventManagerIF.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h" Service5EventReporting::Service5EventReporting(object_id_t objectId, diff --git a/pus/Service5EventReporting.h b/src/fsfw/pus/Service5EventReporting.h similarity index 97% rename from pus/Service5EventReporting.h rename to src/fsfw/pus/Service5EventReporting.h index 69242801..35ff34b6 100644 --- a/pus/Service5EventReporting.h +++ b/src/fsfw/pus/Service5EventReporting.h @@ -1,8 +1,8 @@ #ifndef FSFW_PUS_SERVICE5EVENTREPORTING_H_ #define FSFW_PUS_SERVICE5EVENTREPORTING_H_ -#include "../tmtcservices/PusServiceBase.h" -#include "../events/EventMessage.h" +#include "fsfw/tmtcservices/PusServiceBase.h" +#include "fsfw/events/EventMessage.h" /** * @brief Report on-board events like information or errors diff --git a/pus/Service8FunctionManagement.cpp b/src/fsfw/pus/Service8FunctionManagement.cpp similarity index 93% rename from pus/Service8FunctionManagement.cpp rename to src/fsfw/pus/Service8FunctionManagement.cpp index 77b7dc80..39e872a0 100644 --- a/pus/Service8FunctionManagement.cpp +++ b/src/fsfw/pus/Service8FunctionManagement.cpp @@ -1,12 +1,12 @@ -#include "Service8FunctionManagement.h" -#include "servicepackets/Service8Packets.h" +#include "fsfw/pus/Service8FunctionManagement.h" +#include "fsfw/pus/servicepackets/Service8Packets.h" -#include "../objectmanager/ObjectManager.h" -#include "../objectmanager/SystemObjectIF.h" -#include "../action/HasActionsIF.h" -#include "../devicehandlers/DeviceHandlerIF.h" -#include "../serialize/SerializeAdapter.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/action/HasActionsIF.h" +#include "fsfw/devicehandlers/DeviceHandlerIF.h" +#include "fsfw/serialize/SerializeAdapter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId, uint16_t apid, uint8_t serviceId, uint8_t numParallelCommands, diff --git a/pus/Service8FunctionManagement.h b/src/fsfw/pus/Service8FunctionManagement.h similarity index 96% rename from pus/Service8FunctionManagement.h rename to src/fsfw/pus/Service8FunctionManagement.h index 00153cfb..debdf636 100644 --- a/pus/Service8FunctionManagement.h +++ b/src/fsfw/pus/Service8FunctionManagement.h @@ -1,8 +1,8 @@ #ifndef FSFW_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ #define FSFW_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ -#include "../action/ActionMessage.h" -#include "../tmtcservices/CommandingServiceBase.h" +#include "fsfw/action/ActionMessage.h" +#include "fsfw/tmtcservices/CommandingServiceBase.h" /** * @brief Functional commanding. diff --git a/pus/Service9TimeManagement.cpp b/src/fsfw/pus/Service9TimeManagement.cpp similarity index 84% rename from pus/Service9TimeManagement.cpp rename to src/fsfw/pus/Service9TimeManagement.cpp index 5625bdd8..619b2405 100644 --- a/pus/Service9TimeManagement.cpp +++ b/src/fsfw/pus/Service9TimeManagement.cpp @@ -1,9 +1,9 @@ -#include "Service9TimeManagement.h" -#include "servicepackets/Service9Packets.h" +#include "fsfw/pus/Service9TimeManagement.h" +#include "fsfw/pus/servicepackets/Service9Packets.h" -#include "../timemanager/CCSDSTime.h" -#include "../events/EventManagerIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/timemanager/CCSDSTime.h" +#include "fsfw/events/EventManagerIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" Service9TimeManagement::Service9TimeManagement(object_id_t objectId, diff --git a/pus/Service9TimeManagement.h b/src/fsfw/pus/Service9TimeManagement.h similarity index 96% rename from pus/Service9TimeManagement.h rename to src/fsfw/pus/Service9TimeManagement.h index 70b86966..d8e183a4 100644 --- a/pus/Service9TimeManagement.h +++ b/src/fsfw/pus/Service9TimeManagement.h @@ -1,7 +1,7 @@ #ifndef FSFW_PUS_SERVICE9TIMEMANAGEMENT_H_ #define FSFW_PUS_SERVICE9TIMEMANAGEMENT_H_ -#include "../tmtcservices/PusServiceBase.h" +#include "fsfw/tmtcservices/PusServiceBase.h" class Service9TimeManagement: public PusServiceBase { public: diff --git a/pus/servicepackets/Service1Packets.h b/src/fsfw/pus/servicepackets/Service1Packets.h similarity index 100% rename from pus/servicepackets/Service1Packets.h rename to src/fsfw/pus/servicepackets/Service1Packets.h diff --git a/pus/servicepackets/Service200Packets.h b/src/fsfw/pus/servicepackets/Service200Packets.h similarity index 100% rename from pus/servicepackets/Service200Packets.h rename to src/fsfw/pus/servicepackets/Service200Packets.h diff --git a/pus/servicepackets/Service201Packets.h b/src/fsfw/pus/servicepackets/Service201Packets.h similarity index 100% rename from pus/servicepackets/Service201Packets.h rename to src/fsfw/pus/servicepackets/Service201Packets.h diff --git a/pus/servicepackets/Service20Packets.h b/src/fsfw/pus/servicepackets/Service20Packets.h similarity index 100% rename from pus/servicepackets/Service20Packets.h rename to src/fsfw/pus/servicepackets/Service20Packets.h diff --git a/pus/servicepackets/Service2Packets.h b/src/fsfw/pus/servicepackets/Service2Packets.h similarity index 100% rename from pus/servicepackets/Service2Packets.h rename to src/fsfw/pus/servicepackets/Service2Packets.h diff --git a/pus/servicepackets/Service3Packets.h b/src/fsfw/pus/servicepackets/Service3Packets.h similarity index 100% rename from pus/servicepackets/Service3Packets.h rename to src/fsfw/pus/servicepackets/Service3Packets.h diff --git a/pus/servicepackets/Service5Packets.h b/src/fsfw/pus/servicepackets/Service5Packets.h similarity index 100% rename from pus/servicepackets/Service5Packets.h rename to src/fsfw/pus/servicepackets/Service5Packets.h diff --git a/pus/servicepackets/Service8Packets.h b/src/fsfw/pus/servicepackets/Service8Packets.h similarity index 100% rename from pus/servicepackets/Service8Packets.h rename to src/fsfw/pus/servicepackets/Service8Packets.h diff --git a/pus/servicepackets/Service9Packets.h b/src/fsfw/pus/servicepackets/Service9Packets.h similarity index 100% rename from pus/servicepackets/Service9Packets.h rename to src/fsfw/pus/servicepackets/Service9Packets.h diff --git a/returnvalues/FwClassIds.h b/src/fsfw/returnvalues/FwClassIds.h similarity index 100% rename from returnvalues/FwClassIds.h rename to src/fsfw/returnvalues/FwClassIds.h diff --git a/returnvalues/HasReturnvaluesIF.h b/src/fsfw/returnvalues/HasReturnvaluesIF.h similarity index 100% rename from returnvalues/HasReturnvaluesIF.h rename to src/fsfw/returnvalues/HasReturnvaluesIF.h diff --git a/rmap/CMakeLists.txt b/src/fsfw/rmap/CMakeLists.txt similarity index 100% rename from rmap/CMakeLists.txt rename to src/fsfw/rmap/CMakeLists.txt diff --git a/rmap/RMAP.cpp b/src/fsfw/rmap/RMAP.cpp similarity index 93% rename from rmap/RMAP.cpp rename to src/fsfw/rmap/RMAP.cpp index 7ea6e532..6ac4904d 100644 --- a/rmap/RMAP.cpp +++ b/src/fsfw/rmap/RMAP.cpp @@ -1,8 +1,8 @@ -#include "RMAP.h" -#include "rmapStructs.h" -#include "RMAPChannelIF.h" +#include "fsfw/rmap/RMAP.h" +#include "fsfw/rmap/rmapStructs.h" +#include "fsfw/rmap/RMAPChannelIF.h" -#include "../devicehandlers/DeviceCommunicationIF.h" +#include "fsfw/devicehandlers/DeviceCommunicationIF.h" #include diff --git a/rmap/RMAP.h b/src/fsfw/rmap/RMAP.h similarity index 99% rename from rmap/RMAP.h rename to src/fsfw/rmap/RMAP.h index 83e29fed..ff310db0 100644 --- a/rmap/RMAP.h +++ b/src/fsfw/rmap/RMAP.h @@ -1,8 +1,9 @@ #ifndef FSFW_RMAP_RMAP_H_ #define FSFW_RMAP_RMAP_H_ -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../rmap/RMAPCookie.h" +#include "rmapConf.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/rmap/RMAPCookie.h" //SHOULDTODO: clean up includes for RMAP, should be enough to include RMAP.h but right now it's quite chaotic... diff --git a/rmap/RMAPChannelIF.h b/src/fsfw/rmap/RMAPChannelIF.h similarity index 98% rename from rmap/RMAPChannelIF.h rename to src/fsfw/rmap/RMAPChannelIF.h index 0aa809c5..7fbda348 100644 --- a/rmap/RMAPChannelIF.h +++ b/src/fsfw/rmap/RMAPChannelIF.h @@ -1,8 +1,9 @@ #ifndef FSFW_RMAP_RMAPCHANNELIF_H_ #define FSFW_RMAP_RMAPCHANNELIF_H_ +#include "rmapConf.h" #include "RMAPCookie.h" -#include "../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include class RMAPChannelIF { diff --git a/rmap/RMAPCookie.cpp b/src/fsfw/rmap/RMAPCookie.cpp similarity index 97% rename from rmap/RMAPCookie.cpp rename to src/fsfw/rmap/RMAPCookie.cpp index f8fe2d3e..393a5ce0 100644 --- a/rmap/RMAPCookie.cpp +++ b/src/fsfw/rmap/RMAPCookie.cpp @@ -1,5 +1,6 @@ -#include "RMAPChannelIF.h" -#include "RMAPCookie.h" +#include "fsfw/rmap/RMAPChannelIF.h" +#include "fsfw/rmap/RMAPCookie.h" + #include diff --git a/rmap/RMAPCookie.h b/src/fsfw/rmap/RMAPCookie.h similarity index 95% rename from rmap/RMAPCookie.h rename to src/fsfw/rmap/RMAPCookie.h index 38542646..032e5a46 100644 --- a/rmap/RMAPCookie.h +++ b/src/fsfw/rmap/RMAPCookie.h @@ -1,8 +1,9 @@ #ifndef FSFW_RMAP_RMAPCOOKIE_H_ #define FSFW_RMAP_RMAPCOOKIE_H_ +#include "rmapConf.h" #include "rmapStructs.h" -#include "../devicehandlers/CookieIF.h" +#include "fsfw/devicehandlers/CookieIF.h" #include class RMAPChannelIF; diff --git a/rmap/RmapDeviceCommunicationIF.cpp b/src/fsfw/rmap/RmapDeviceCommunicationIF.cpp similarity index 94% rename from rmap/RmapDeviceCommunicationIF.cpp rename to src/fsfw/rmap/RmapDeviceCommunicationIF.cpp index d81baabd..2fab613e 100644 --- a/rmap/RmapDeviceCommunicationIF.cpp +++ b/src/fsfw/rmap/RmapDeviceCommunicationIF.cpp @@ -1,5 +1,5 @@ -#include "RmapDeviceCommunicationIF.h" -#include "RMAP.h" +#include "fsfw/rmap/RmapDeviceCommunicationIF.h" +#include "fsfw/rmap/RMAP.h" //TODO Cast here are all potential bugs RmapDeviceCommunicationIF::~RmapDeviceCommunicationIF() { diff --git a/rmap/RmapDeviceCommunicationIF.h b/src/fsfw/rmap/RmapDeviceCommunicationIF.h similarity index 97% rename from rmap/RmapDeviceCommunicationIF.h rename to src/fsfw/rmap/RmapDeviceCommunicationIF.h index 1333966a..36baf87b 100644 --- a/rmap/RmapDeviceCommunicationIF.h +++ b/src/fsfw/rmap/RmapDeviceCommunicationIF.h @@ -1,7 +1,8 @@ #ifndef FSFW_RMAP_RMAPDEVICECOMMUNICATIONINTERFACE_H_ #define FSFW_RMAP_RMAPDEVICECOMMUNICATIONINTERFACE_H_ -#include "../devicehandlers/DeviceCommunicationIF.h" +#include "rmapConf.h" +#include "fsfw/devicehandlers/DeviceCommunicationIF.h" /** * @brief This class is a implementation of a DeviceCommunicationIF for RMAP calls. diff --git a/src/fsfw/rmap/rmapConf.h b/src/fsfw/rmap/rmapConf.h new file mode 100644 index 00000000..c4fa1e54 --- /dev/null +++ b/src/fsfw/rmap/rmapConf.h @@ -0,0 +1,10 @@ +#ifndef FSFW_SRC_FSFW_RMAP_RAMCONF_H_ +#define FSFW_SRC_FSFW_RMAP_RAMCONF_H_ + +#include "fsfw/FSFW.h" + +#ifndef FSFW_ADD_RMAP +#warning RMAP was included but compilation was not enabled with FSFW_ADD_RMAP +#endif + +#endif /* FSFW_SRC_FSFW_RMAP_RAMCONF_H_ */ diff --git a/rmap/rmapStructs.h b/src/fsfw/rmap/rmapStructs.h similarity index 99% rename from rmap/rmapStructs.h rename to src/fsfw/rmap/rmapStructs.h index 11d8bb85..de8b3a59 100644 --- a/rmap/rmapStructs.h +++ b/src/fsfw/rmap/rmapStructs.h @@ -1,6 +1,8 @@ #ifndef FSFW_RMAP_RMAPSTRUCTS_H_ #define FSFW_RMAP_RMAPSTRUCTS_H_ +#include "rmapConf.h" + #include //SHOULDDO: having the defines within a namespace would be nice. Problem are the defines referencing the previous define, eg RMAP_COMMAND_WRITE diff --git a/src/fsfw/serialize.h b/src/fsfw/serialize.h new file mode 100644 index 00000000..7cd735bb --- /dev/null +++ b/src/fsfw/serialize.h @@ -0,0 +1,10 @@ +#ifndef FSFW_INC_FSFW_SERIALIZE_H_ +#define FSFW_INC_FSFW_SERIALIZE_H_ + +#include "src/core/serialize/EndianConverter.h" +#include "src/core/serialize/SerialArrayListAdapter.h" +#include "src/core/serialize/SerialBufferAdapter.h" +#include "src/core/serialize/SerializeElement.h" +#include "src/core/serialize/SerialLinkedListAdapter.h" + +#endif /* FSFW_INC_FSFW_SERIALIZE_H_ */ diff --git a/serialize/CMakeLists.txt b/src/fsfw/serialize/CMakeLists.txt similarity index 100% rename from serialize/CMakeLists.txt rename to src/fsfw/serialize/CMakeLists.txt diff --git a/serialize/EndianConverter.h b/src/fsfw/serialize/EndianConverter.h similarity index 100% rename from serialize/EndianConverter.h rename to src/fsfw/serialize/EndianConverter.h diff --git a/serialize/SerialArrayListAdapter.h b/src/fsfw/serialize/SerialArrayListAdapter.h similarity index 100% rename from serialize/SerialArrayListAdapter.h rename to src/fsfw/serialize/SerialArrayListAdapter.h diff --git a/serialize/SerialBufferAdapter.cpp b/src/fsfw/serialize/SerialBufferAdapter.cpp similarity index 97% rename from serialize/SerialBufferAdapter.cpp rename to src/fsfw/serialize/SerialBufferAdapter.cpp index 53b8c3d5..4f03658a 100644 --- a/serialize/SerialBufferAdapter.cpp +++ b/src/fsfw/serialize/SerialBufferAdapter.cpp @@ -1,5 +1,5 @@ -#include "../serialize/SerialBufferAdapter.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/serialize/SerialBufferAdapter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include template diff --git a/serialize/SerialBufferAdapter.h b/src/fsfw/serialize/SerialBufferAdapter.h similarity index 96% rename from serialize/SerialBufferAdapter.h rename to src/fsfw/serialize/SerialBufferAdapter.h index 9a89e18b..6c79cd03 100644 --- a/serialize/SerialBufferAdapter.h +++ b/src/fsfw/serialize/SerialBufferAdapter.h @@ -1,8 +1,8 @@ #ifndef SERIALBUFFERADAPTER_H_ #define SERIALBUFFERADAPTER_H_ -#include "../serialize/SerializeIF.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/serialize/SerializeIF.h" +#include "fsfw/serialize/SerializeAdapter.h" /** * This adapter provides an interface for SerializeIF to serialize or deserialize diff --git a/serialize/SerialFixedArrayListAdapter.h b/src/fsfw/serialize/SerialFixedArrayListAdapter.h similarity index 100% rename from serialize/SerialFixedArrayListAdapter.h rename to src/fsfw/serialize/SerialFixedArrayListAdapter.h diff --git a/serialize/SerialLinkedListAdapter.h b/src/fsfw/serialize/SerialLinkedListAdapter.h similarity index 100% rename from serialize/SerialLinkedListAdapter.h rename to src/fsfw/serialize/SerialLinkedListAdapter.h diff --git a/serialize/SerializeAdapter.h b/src/fsfw/serialize/SerializeAdapter.h similarity index 100% rename from serialize/SerializeAdapter.h rename to src/fsfw/serialize/SerializeAdapter.h diff --git a/serialize/SerializeElement.h b/src/fsfw/serialize/SerializeElement.h similarity index 100% rename from serialize/SerializeElement.h rename to src/fsfw/serialize/SerializeElement.h diff --git a/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h similarity index 100% rename from serialize/SerializeIF.h rename to src/fsfw/serialize/SerializeIF.h diff --git a/src/fsfw/serviceinterface.h b/src/fsfw/serviceinterface.h new file mode 100644 index 00000000..2e9a0b7e --- /dev/null +++ b/src/fsfw/serviceinterface.h @@ -0,0 +1,6 @@ +#ifndef FSFW_SRC_FSFW_SERVICEINTERFACE_H_ +#define FSFW_SRC_FSFW_SERVICEINTERFACE_H_ + +#include "serviceinterface/ServiceInterface.h" + +#endif /* FSFW_SRC_FSFW_SERVICEINTERFACE_H_ */ diff --git a/serviceinterface/CMakeLists.txt b/src/fsfw/serviceinterface/CMakeLists.txt similarity index 100% rename from serviceinterface/CMakeLists.txt rename to src/fsfw/serviceinterface/CMakeLists.txt diff --git a/serviceinterface/ServiceInterface.h b/src/fsfw/serviceinterface/ServiceInterface.h similarity index 100% rename from serviceinterface/ServiceInterface.h rename to src/fsfw/serviceinterface/ServiceInterface.h diff --git a/serviceinterface/ServiceInterfaceBuffer.cpp b/src/fsfw/serviceinterface/ServiceInterfaceBuffer.cpp similarity index 97% rename from serviceinterface/ServiceInterfaceBuffer.cpp rename to src/fsfw/serviceinterface/ServiceInterfaceBuffer.cpp index b85a43a4..7cba2145 100644 --- a/serviceinterface/ServiceInterfaceBuffer.cpp +++ b/src/fsfw/serviceinterface/ServiceInterfaceBuffer.cpp @@ -1,10 +1,10 @@ -#include "ServiceInterfaceBuffer.h" +#include "fsfw/serviceinterface/ServiceInterfaceBuffer.h" #if FSFW_CPP_OSTREAM_ENABLED == 1 -#include "../timemanager/Clock.h" +#include "fsfw/timemanager/Clock.h" -#include "serviceInterfaceDefintions.h" +#include "fsfw/serviceinterface/serviceInterfaceDefintions.h" #include #include diff --git a/serviceinterface/ServiceInterfaceBuffer.h b/src/fsfw/serviceinterface/ServiceInterfaceBuffer.h similarity index 100% rename from serviceinterface/ServiceInterfaceBuffer.h rename to src/fsfw/serviceinterface/ServiceInterfaceBuffer.h diff --git a/serviceinterface/ServiceInterfacePrinter.cpp b/src/fsfw/serviceinterface/ServiceInterfacePrinter.cpp similarity index 95% rename from serviceinterface/ServiceInterfacePrinter.cpp rename to src/fsfw/serviceinterface/ServiceInterfacePrinter.cpp index ce797f1c..9b62e91d 100644 --- a/serviceinterface/ServiceInterfacePrinter.cpp +++ b/src/fsfw/serviceinterface/ServiceInterfacePrinter.cpp @@ -1,7 +1,7 @@ -#include -#include "ServiceInterfacePrinter.h" -#include "serviceInterfaceDefintions.h" -#include "../timemanager/Clock.h" +#include "fsfw/FSFW.h" +#include "fsfw/serviceinterface/ServiceInterfacePrinter.h" +#include "fsfw/serviceinterface/serviceInterfaceDefintions.h" +#include "fsfw/timemanager/Clock.h" #include #include diff --git a/serviceinterface/ServiceInterfacePrinter.h b/src/fsfw/serviceinterface/ServiceInterfacePrinter.h similarity index 100% rename from serviceinterface/ServiceInterfacePrinter.h rename to src/fsfw/serviceinterface/ServiceInterfacePrinter.h diff --git a/serviceinterface/ServiceInterfaceStream.cpp b/src/fsfw/serviceinterface/ServiceInterfaceStream.cpp similarity index 92% rename from serviceinterface/ServiceInterfaceStream.cpp rename to src/fsfw/serviceinterface/ServiceInterfaceStream.cpp index 80942b88..fe45442d 100644 --- a/serviceinterface/ServiceInterfaceStream.cpp +++ b/src/fsfw/serviceinterface/ServiceInterfaceStream.cpp @@ -1,4 +1,4 @@ -#include "ServiceInterfaceStream.h" +#include "fsfw/serviceinterface/ServiceInterfaceStream.h" #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/serviceinterface/ServiceInterfaceStream.h b/src/fsfw/serviceinterface/ServiceInterfaceStream.h similarity index 100% rename from serviceinterface/ServiceInterfaceStream.h rename to src/fsfw/serviceinterface/ServiceInterfaceStream.h diff --git a/serviceinterface/serviceInterfaceDefintions.h b/src/fsfw/serviceinterface/serviceInterfaceDefintions.h similarity index 100% rename from serviceinterface/serviceInterfaceDefintions.h rename to src/fsfw/serviceinterface/serviceInterfaceDefintions.h diff --git a/storagemanager/CMakeLists.txt b/src/fsfw/storagemanager/CMakeLists.txt similarity index 100% rename from storagemanager/CMakeLists.txt rename to src/fsfw/storagemanager/CMakeLists.txt diff --git a/storagemanager/ConstStorageAccessor.cpp b/src/fsfw/storagemanager/ConstStorageAccessor.cpp similarity index 92% rename from storagemanager/ConstStorageAccessor.cpp rename to src/fsfw/storagemanager/ConstStorageAccessor.cpp index aab84862..67736d51 100644 --- a/storagemanager/ConstStorageAccessor.cpp +++ b/src/fsfw/storagemanager/ConstStorageAccessor.cpp @@ -1,8 +1,8 @@ -#include "ConstStorageAccessor.h" -#include "StorageManagerIF.h" +#include "fsfw/storagemanager/ConstStorageAccessor.h" +#include "fsfw/storagemanager/StorageManagerIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../globalfunctions/arrayprinter.h" +#include "fsfw/serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/globalfunctions/arrayprinter.h" #include diff --git a/storagemanager/ConstStorageAccessor.h b/src/fsfw/storagemanager/ConstStorageAccessor.h similarity index 100% rename from storagemanager/ConstStorageAccessor.h rename to src/fsfw/storagemanager/ConstStorageAccessor.h diff --git a/storagemanager/LocalPool.cpp b/src/fsfw/storagemanager/LocalPool.cpp similarity index 99% rename from storagemanager/LocalPool.cpp rename to src/fsfw/storagemanager/LocalPool.cpp index 41c9250a..c5e74e08 100644 --- a/storagemanager/LocalPool.cpp +++ b/src/fsfw/storagemanager/LocalPool.cpp @@ -1,7 +1,7 @@ -#include "LocalPool.h" -#include "FSFWConfig.h" +#include "fsfw/FSFW.h" +#include "fsfw/storagemanager/LocalPool.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/ObjectManager.h" #include diff --git a/storagemanager/LocalPool.h b/src/fsfw/storagemanager/LocalPool.h similarity index 96% rename from storagemanager/LocalPool.h rename to src/fsfw/storagemanager/LocalPool.h index 6a666485..383d8a94 100644 --- a/storagemanager/LocalPool.h +++ b/src/fsfw/storagemanager/LocalPool.h @@ -1,12 +1,13 @@ #ifndef FSFW_STORAGEMANAGER_LOCALPOOL_H_ #define FSFW_STORAGEMANAGER_LOCALPOOL_H_ -#include "StorageManagerIF.h" -#include "../objectmanager/SystemObject.h" -#include "../objectmanager/ObjectManagerIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../internalError/InternalErrorReporterIF.h" -#include "../storagemanager/StorageAccessor.h" +#include "fsfw/storagemanager/StorageManagerIF.h" + +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/internalerror/InternalErrorReporterIF.h" +#include "fsfw/storagemanager/StorageAccessor.h" #include #include diff --git a/storagemanager/PoolManager.cpp b/src/fsfw/storagemanager/PoolManager.cpp similarity index 96% rename from storagemanager/PoolManager.cpp rename to src/fsfw/storagemanager/PoolManager.cpp index eec84907..073371ad 100644 --- a/storagemanager/PoolManager.cpp +++ b/src/fsfw/storagemanager/PoolManager.cpp @@ -1,5 +1,6 @@ -#include "PoolManager.h" -#include +#include "fsfw/FSFW.h" +#include "fsfw/storagemanager/PoolManager.h" + PoolManager::PoolManager(object_id_t setObjectId, const LocalPoolConfig& localPoolConfig): diff --git a/storagemanager/PoolManager.h b/src/fsfw/storagemanager/PoolManager.h similarity index 100% rename from storagemanager/PoolManager.h rename to src/fsfw/storagemanager/PoolManager.h diff --git a/storagemanager/StorageAccessor.cpp b/src/fsfw/storagemanager/StorageAccessor.cpp similarity index 93% rename from storagemanager/StorageAccessor.cpp rename to src/fsfw/storagemanager/StorageAccessor.cpp index a7b4fae4..95f61a75 100644 --- a/storagemanager/StorageAccessor.cpp +++ b/src/fsfw/storagemanager/StorageAccessor.cpp @@ -1,6 +1,7 @@ -#include "StorageAccessor.h" -#include "StorageManagerIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/storagemanager/StorageAccessor.h" +#include "fsfw/storagemanager/StorageManagerIF.h" + +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/storagemanager/StorageAccessor.h b/src/fsfw/storagemanager/StorageAccessor.h similarity index 100% rename from storagemanager/StorageAccessor.h rename to src/fsfw/storagemanager/StorageAccessor.h diff --git a/storagemanager/StorageManagerIF.h b/src/fsfw/storagemanager/StorageManagerIF.h similarity index 100% rename from storagemanager/StorageManagerIF.h rename to src/fsfw/storagemanager/StorageManagerIF.h diff --git a/storagemanager/storeAddress.h b/src/fsfw/storagemanager/storeAddress.h similarity index 100% rename from storagemanager/storeAddress.h rename to src/fsfw/storagemanager/storeAddress.h diff --git a/subsystem/CMakeLists.txt b/src/fsfw/subsystem/CMakeLists.txt similarity index 100% rename from subsystem/CMakeLists.txt rename to src/fsfw/subsystem/CMakeLists.txt diff --git a/subsystem/Subsystem.cpp b/src/fsfw/subsystem/Subsystem.cpp similarity index 98% rename from subsystem/Subsystem.cpp rename to src/fsfw/subsystem/Subsystem.cpp index dffad034..0c8e3f35 100644 --- a/subsystem/Subsystem.cpp +++ b/src/fsfw/subsystem/Subsystem.cpp @@ -1,11 +1,11 @@ -#include "Subsystem.h" +#include "fsfw/subsystem/Subsystem.h" -#include "../health/HealthMessage.h" -#include "../objectmanager/ObjectManager.h" -#include "../serialize/SerialArrayListAdapter.h" -#include "../serialize/SerialFixedArrayListAdapter.h" -#include "../serialize/SerializeElement.h" -#include "../serialize/SerialLinkedListAdapter.h" +#include "fsfw/health/HealthMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serialize/SerialArrayListAdapter.h" +#include "fsfw/serialize/SerialFixedArrayListAdapter.h" +#include "fsfw/serialize/SerializeElement.h" +#include "fsfw/serialize/SerialLinkedListAdapter.h" #include diff --git a/subsystem/Subsystem.h b/src/fsfw/subsystem/Subsystem.h similarity index 100% rename from subsystem/Subsystem.h rename to src/fsfw/subsystem/Subsystem.h diff --git a/subsystem/SubsystemBase.cpp b/src/fsfw/subsystem/SubsystemBase.cpp similarity index 98% rename from subsystem/SubsystemBase.cpp rename to src/fsfw/subsystem/SubsystemBase.cpp index 0d459324..afcd43ad 100644 --- a/subsystem/SubsystemBase.cpp +++ b/src/fsfw/subsystem/SubsystemBase.cpp @@ -1,8 +1,8 @@ -#include "SubsystemBase.h" +#include "fsfw/subsystem/SubsystemBase.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/ObjectManager.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/ipc/QueueFactory.h" SubsystemBase::SubsystemBase(object_id_t setObjectId, object_id_t parent, Mode_t initialMode, uint16_t commandQueueDepth) : diff --git a/subsystem/SubsystemBase.h b/src/fsfw/subsystem/SubsystemBase.h similarity index 100% rename from subsystem/SubsystemBase.h rename to src/fsfw/subsystem/SubsystemBase.h diff --git a/subsystem/modes/CMakeLists.txt b/src/fsfw/subsystem/modes/CMakeLists.txt similarity index 100% rename from subsystem/modes/CMakeLists.txt rename to src/fsfw/subsystem/modes/CMakeLists.txt diff --git a/subsystem/modes/HasModeSequenceIF.h b/src/fsfw/subsystem/modes/HasModeSequenceIF.h similarity index 100% rename from subsystem/modes/HasModeSequenceIF.h rename to src/fsfw/subsystem/modes/HasModeSequenceIF.h diff --git a/subsystem/modes/ModeDefinitions.h b/src/fsfw/subsystem/modes/ModeDefinitions.h similarity index 100% rename from subsystem/modes/ModeDefinitions.h rename to src/fsfw/subsystem/modes/ModeDefinitions.h diff --git a/subsystem/modes/ModeSequenceMessage.cpp b/src/fsfw/subsystem/modes/ModeSequenceMessage.cpp similarity index 92% rename from subsystem/modes/ModeSequenceMessage.cpp rename to src/fsfw/subsystem/modes/ModeSequenceMessage.cpp index 749a90bf..d7570276 100644 --- a/subsystem/modes/ModeSequenceMessage.cpp +++ b/src/fsfw/subsystem/modes/ModeSequenceMessage.cpp @@ -1,7 +1,7 @@ -#include "ModeSequenceMessage.h" +#include "fsfw/subsystem/modes/ModeSequenceMessage.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../storagemanager/StorageManagerIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/storagemanager/StorageManagerIF.h" void ModeSequenceMessage::setModeSequenceMessage(CommandMessage* message, Command_t command, Mode_t sequence, store_address_t storeAddress) { diff --git a/subsystem/modes/ModeSequenceMessage.h b/src/fsfw/subsystem/modes/ModeSequenceMessage.h similarity index 95% rename from subsystem/modes/ModeSequenceMessage.h rename to src/fsfw/subsystem/modes/ModeSequenceMessage.h index 7852c984..0dbe7ffb 100644 --- a/subsystem/modes/ModeSequenceMessage.h +++ b/src/fsfw/subsystem/modes/ModeSequenceMessage.h @@ -3,8 +3,8 @@ #include "ModeDefinitions.h" -#include "../../ipc/CommandMessage.h" -#include "../../storagemanager/StorageManagerIF.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/storagemanager/StorageManagerIF.h" class ModeSequenceMessage { diff --git a/subsystem/modes/ModeStore.cpp b/src/fsfw/subsystem/modes/ModeStore.cpp similarity index 98% rename from subsystem/modes/ModeStore.cpp rename to src/fsfw/subsystem/modes/ModeStore.cpp index e216a167..e28bbc4f 100644 --- a/subsystem/modes/ModeStore.cpp +++ b/src/fsfw/subsystem/modes/ModeStore.cpp @@ -1,4 +1,4 @@ -#include "ModeStore.h" +#include "fsfw/subsystem/modes/ModeStore.h" // todo: I think some parts are deprecated. If this is used, the define // USE_MODESTORE could be part of the new FSFWConfig.h file. diff --git a/subsystem/modes/ModeStore.h b/src/fsfw/subsystem/modes/ModeStore.h similarity index 100% rename from subsystem/modes/ModeStore.h rename to src/fsfw/subsystem/modes/ModeStore.h diff --git a/subsystem/modes/ModeStoreIF.h b/src/fsfw/subsystem/modes/ModeStoreIF.h similarity index 100% rename from subsystem/modes/ModeStoreIF.h rename to src/fsfw/subsystem/modes/ModeStoreIF.h diff --git a/tasks/CMakeLists.txt b/src/fsfw/tasks/CMakeLists.txt similarity index 100% rename from tasks/CMakeLists.txt rename to src/fsfw/tasks/CMakeLists.txt diff --git a/tasks/ExecutableObjectIF.h b/src/fsfw/tasks/ExecutableObjectIF.h similarity index 100% rename from tasks/ExecutableObjectIF.h rename to src/fsfw/tasks/ExecutableObjectIF.h diff --git a/tasks/FixedSequenceSlot.cpp b/src/fsfw/tasks/FixedSequenceSlot.cpp similarity index 85% rename from tasks/FixedSequenceSlot.cpp rename to src/fsfw/tasks/FixedSequenceSlot.cpp index f5d82178..9f617b58 100644 --- a/tasks/FixedSequenceSlot.cpp +++ b/src/fsfw/tasks/FixedSequenceSlot.cpp @@ -1,5 +1,6 @@ -#include "FixedSequenceSlot.h" -#include "PeriodicTaskIF.h" +#include "fsfw/tasks/FixedSequenceSlot.h" +#include "fsfw/tasks/PeriodicTaskIF.h" + #include FixedSequenceSlot::FixedSequenceSlot(object_id_t handlerId, uint32_t setTime, diff --git a/tasks/FixedSequenceSlot.h b/src/fsfw/tasks/FixedSequenceSlot.h similarity index 97% rename from tasks/FixedSequenceSlot.h rename to src/fsfw/tasks/FixedSequenceSlot.h index 1744ec19..aea77dfe 100644 --- a/tasks/FixedSequenceSlot.h +++ b/src/fsfw/tasks/FixedSequenceSlot.h @@ -2,7 +2,7 @@ #define FSFW_TASKS_FIXEDSEQUENCESLOT_H_ #include "ExecutableObjectIF.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" class PeriodicTaskIF; diff --git a/tasks/FixedSlotSequence.cpp b/src/fsfw/tasks/FixedSlotSequence.cpp similarity index 98% rename from tasks/FixedSlotSequence.cpp rename to src/fsfw/tasks/FixedSlotSequence.cpp index 54b6ae6d..2e5384b7 100644 --- a/tasks/FixedSlotSequence.cpp +++ b/src/fsfw/tasks/FixedSlotSequence.cpp @@ -1,5 +1,5 @@ -#include "FixedSlotSequence.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/tasks/FixedSlotSequence.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include FixedSlotSequence::FixedSlotSequence(uint32_t setLengthMs) : diff --git a/tasks/FixedSlotSequence.h b/src/fsfw/tasks/FixedSlotSequence.h similarity index 100% rename from tasks/FixedSlotSequence.h rename to src/fsfw/tasks/FixedSlotSequence.h diff --git a/tasks/FixedTimeslotTaskIF.h b/src/fsfw/tasks/FixedTimeslotTaskIF.h similarity index 100% rename from tasks/FixedTimeslotTaskIF.h rename to src/fsfw/tasks/FixedTimeslotTaskIF.h diff --git a/tasks/PeriodicTaskIF.h b/src/fsfw/tasks/PeriodicTaskIF.h similarity index 100% rename from tasks/PeriodicTaskIF.h rename to src/fsfw/tasks/PeriodicTaskIF.h diff --git a/tasks/SemaphoreFactory.h b/src/fsfw/tasks/SemaphoreFactory.h similarity index 97% rename from tasks/SemaphoreFactory.h rename to src/fsfw/tasks/SemaphoreFactory.h index 01c09d1b..2df7d53f 100644 --- a/tasks/SemaphoreFactory.h +++ b/src/fsfw/tasks/SemaphoreFactory.h @@ -1,7 +1,7 @@ #ifndef FSFW_TASKS_SEMAPHOREFACTORY_H_ #define FSFW_TASKS_SEMAPHOREFACTORY_H_ -#include "../tasks/SemaphoreIF.h" +#include "fsfw/tasks/SemaphoreIF.h" /** * Creates Semaphore. diff --git a/tasks/SemaphoreIF.h b/src/fsfw/tasks/SemaphoreIF.h similarity index 100% rename from tasks/SemaphoreIF.h rename to src/fsfw/tasks/SemaphoreIF.h diff --git a/tasks/TaskFactory.h b/src/fsfw/tasks/TaskFactory.h similarity index 100% rename from tasks/TaskFactory.h rename to src/fsfw/tasks/TaskFactory.h diff --git a/tasks/Typedef.h b/src/fsfw/tasks/Typedef.h similarity index 55% rename from tasks/Typedef.h rename to src/fsfw/tasks/Typedef.h index 55f6bda2..f2f9fe65 100644 --- a/tasks/Typedef.h +++ b/src/fsfw/tasks/Typedef.h @@ -1,5 +1,8 @@ -#ifndef FRAMEWORK_TASKS_TYPEDEF_H_ -#define FRAMEWORK_TASKS_TYPEDEF_H_ +#ifndef FSFW_TASKS_TYPEDEF_H_ +#define FSFW_TASKS_TYPEDEF_H_ + +#include +#include typedef const char* TaskName; typedef uint32_t TaskPriority; @@ -7,4 +10,4 @@ typedef size_t TaskStackSize; typedef double TaskPeriod; typedef void (*TaskDeadlineMissedFunction)(); -#endif /* FRAMEWORK_TASKS_TYPEDEF_H_ */ +#endif /* FSFW_TASKS_TYPEDEF_H_ */ diff --git a/tcdistribution/CCSDSDistributor.cpp b/src/fsfw/tcdistribution/CCSDSDistributor.cpp similarity index 94% rename from tcdistribution/CCSDSDistributor.cpp rename to src/fsfw/tcdistribution/CCSDSDistributor.cpp index 7380866a..ffceaecc 100644 --- a/tcdistribution/CCSDSDistributor.cpp +++ b/src/fsfw/tcdistribution/CCSDSDistributor.cpp @@ -1,8 +1,8 @@ -#include "CCSDSDistributor.h" +#include "fsfw/tcdistribution/CCSDSDistributor.h" -#include "../objectmanager/ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../tmtcpacket/SpacePacketBase.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" #define CCSDS_DISTRIBUTOR_DEBUGGING 0 diff --git a/tcdistribution/CCSDSDistributor.h b/src/fsfw/tcdistribution/CCSDSDistributor.h similarity index 100% rename from tcdistribution/CCSDSDistributor.h rename to src/fsfw/tcdistribution/CCSDSDistributor.h diff --git a/tcdistribution/CCSDSDistributorIF.h b/src/fsfw/tcdistribution/CCSDSDistributorIF.h similarity index 100% rename from tcdistribution/CCSDSDistributorIF.h rename to src/fsfw/tcdistribution/CCSDSDistributorIF.h diff --git a/tcdistribution/CMakeLists.txt b/src/fsfw/tcdistribution/CMakeLists.txt similarity index 100% rename from tcdistribution/CMakeLists.txt rename to src/fsfw/tcdistribution/CMakeLists.txt diff --git a/tcdistribution/PUSDistributor.cpp b/src/fsfw/tcdistribution/PUSDistributor.cpp similarity index 94% rename from tcdistribution/PUSDistributor.cpp rename to src/fsfw/tcdistribution/PUSDistributor.cpp index 955a8093..eec02429 100644 --- a/tcdistribution/PUSDistributor.cpp +++ b/src/fsfw/tcdistribution/PUSDistributor.cpp @@ -1,9 +1,9 @@ -#include "CCSDSDistributorIF.h" -#include "PUSDistributor.h" +#include "fsfw/tcdistribution/CCSDSDistributorIF.h" +#include "fsfw/tcdistribution/PUSDistributor.h" -#include "../objectmanager/ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../tmtcservices/PusVerificationReport.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" #define PUS_DISTRIBUTOR_DEBUGGING 0 diff --git a/tcdistribution/PUSDistributor.h b/src/fsfw/tcdistribution/PUSDistributor.h similarity index 92% rename from tcdistribution/PUSDistributor.h rename to src/fsfw/tcdistribution/PUSDistributor.h index c6f863f0..53a996ca 100644 --- a/tcdistribution/PUSDistributor.h +++ b/src/fsfw/tcdistribution/PUSDistributor.h @@ -5,10 +5,10 @@ #include "TcDistributor.h" #include "TcPacketCheck.h" -#include "../tmtcpacket/pus/tc.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../tmtcservices/AcceptsTelecommandsIF.h" -#include "../tmtcservices/VerificationReporter.h" +#include "fsfw/tmtcpacket/pus/tc.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h" +#include "fsfw/tmtcservices/VerificationReporter.h" /** * This class accepts PUS Telecommands and forwards them to Application diff --git a/tcdistribution/PUSDistributorIF.h b/src/fsfw/tcdistribution/PUSDistributorIF.h similarity index 100% rename from tcdistribution/PUSDistributorIF.h rename to src/fsfw/tcdistribution/PUSDistributorIF.h diff --git a/tcdistribution/TcDistributor.cpp b/src/fsfw/tcdistribution/TcDistributor.cpp similarity index 89% rename from tcdistribution/TcDistributor.cpp rename to src/fsfw/tcdistribution/TcDistributor.cpp index df069556..8384e6ee 100644 --- a/tcdistribution/TcDistributor.cpp +++ b/src/fsfw/tcdistribution/TcDistributor.cpp @@ -1,8 +1,8 @@ -#include "TcDistributor.h" +#include "fsfw/tcdistribution/TcDistributor.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../tmtcservices/TmTcMessage.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/TmTcMessage.h" +#include "fsfw/ipc/QueueFactory.h" TcDistributor::TcDistributor(object_id_t objectId) : SystemObject(objectId) { diff --git a/tcdistribution/TcDistributor.h b/src/fsfw/tcdistribution/TcDistributor.h similarity index 93% rename from tcdistribution/TcDistributor.h rename to src/fsfw/tcdistribution/TcDistributor.h index 5d0ca45d..14b532bd 100644 --- a/tcdistribution/TcDistributor.h +++ b/src/fsfw/tcdistribution/TcDistributor.h @@ -1,13 +1,13 @@ #ifndef FSFW_TMTCSERVICES_TCDISTRIBUTOR_H_ #define FSFW_TMTCSERVICES_TCDISTRIBUTOR_H_ -#include "../objectmanager/ObjectManagerIF.h" -#include "../objectmanager/SystemObject.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../tmtcservices/TmTcMessage.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/tmtcservices/TmTcMessage.h" +#include "fsfw/ipc/MessageQueueIF.h" #include /** diff --git a/tcdistribution/TcPacketCheck.cpp b/src/fsfw/tcdistribution/TcPacketCheck.cpp similarity index 78% rename from tcdistribution/TcPacketCheck.cpp rename to src/fsfw/tcdistribution/TcPacketCheck.cpp index b3a025a4..44501c58 100644 --- a/tcdistribution/TcPacketCheck.cpp +++ b/src/fsfw/tcdistribution/TcPacketCheck.cpp @@ -1,11 +1,11 @@ -#include "TcPacketCheck.h" +#include "fsfw/tcdistribution/TcPacketCheck.h" -#include "../globalfunctions/CRC.h" -#include "../tmtcpacket/pus/tc/TcPacketBase.h" -#include "../tmtcpacket/pus/tc/TcPacketStoredBase.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../tmtcservices/VerificationCodes.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketBase.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/tmtcservices/VerificationCodes.h" TcPacketCheck::TcPacketCheck(uint16_t setApid): apid(setApid) { } diff --git a/tcdistribution/TcPacketCheck.h b/src/fsfw/tcdistribution/TcPacketCheck.h similarity index 94% rename from tcdistribution/TcPacketCheck.h rename to src/fsfw/tcdistribution/TcPacketCheck.h index 7106b7e4..519943c7 100644 --- a/tcdistribution/TcPacketCheck.h +++ b/src/fsfw/tcdistribution/TcPacketCheck.h @@ -1,9 +1,9 @@ #ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_ #define FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_ -#include "../FSFW.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../tmtcservices/PusVerificationReport.h" +#include "fsfw/FSFW.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" class TcPacketStoredBase; diff --git a/thermal/AbstractTemperatureSensor.cpp b/src/fsfw/thermal/AbstractTemperatureSensor.cpp similarity index 95% rename from thermal/AbstractTemperatureSensor.cpp rename to src/fsfw/thermal/AbstractTemperatureSensor.cpp index 40b305af..68e8d1c0 100644 --- a/thermal/AbstractTemperatureSensor.cpp +++ b/src/fsfw/thermal/AbstractTemperatureSensor.cpp @@ -1,5 +1,5 @@ -#include "AbstractTemperatureSensor.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/thermal/AbstractTemperatureSensor.h" +#include "fsfw/ipc/QueueFactory.h" AbstractTemperatureSensor::AbstractTemperatureSensor(object_id_t setObjectid, ThermalModuleIF *thermalModule) : diff --git a/thermal/AbstractTemperatureSensor.h b/src/fsfw/thermal/AbstractTemperatureSensor.h similarity index 86% rename from thermal/AbstractTemperatureSensor.h rename to src/fsfw/thermal/AbstractTemperatureSensor.h index a1153314..719d84fe 100644 --- a/thermal/AbstractTemperatureSensor.h +++ b/src/fsfw/thermal/AbstractTemperatureSensor.h @@ -1,12 +1,12 @@ #ifndef ABSTRACTSENSOR_H_ #define ABSTRACTSENSOR_H_ -#include "../health/HasHealthIF.h" -#include "../health/HealthHelper.h" -#include "../objectmanager/SystemObject.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../parameters/ParameterHelper.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/health/HasHealthIF.h" +#include "fsfw/health/HealthHelper.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/parameters/ParameterHelper.h" +#include "fsfw/ipc/MessageQueueIF.h" #include "ThermalModuleIF.h" #include "tcsDefinitions.h" diff --git a/thermal/AcceptsThermalMessagesIF.h b/src/fsfw/thermal/AcceptsThermalMessagesIF.h similarity index 100% rename from thermal/AcceptsThermalMessagesIF.h rename to src/fsfw/thermal/AcceptsThermalMessagesIF.h diff --git a/thermal/CMakeLists.txt b/src/fsfw/thermal/CMakeLists.txt similarity index 100% rename from thermal/CMakeLists.txt rename to src/fsfw/thermal/CMakeLists.txt diff --git a/thermal/Heater.cpp b/src/fsfw/thermal/Heater.cpp similarity index 98% rename from thermal/Heater.cpp rename to src/fsfw/thermal/Heater.cpp index f97cb543..e6acba13 100644 --- a/thermal/Heater.cpp +++ b/src/fsfw/thermal/Heater.cpp @@ -1,9 +1,9 @@ -#include "Heater.h" +#include "fsfw/thermal/Heater.h" -#include "../objectmanager/ObjectManager.h" -#include "../devicehandlers/DeviceHandlerFailureIsolation.h" -#include "../power/Fuse.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/devicehandlers/DeviceHandlerFailureIsolation.h" +#include "fsfw/power/Fuse.h" +#include "fsfw/ipc/QueueFactory.h" Heater::Heater(uint32_t objectId, uint8_t switch0, uint8_t switch1) : HealthDevice(objectId, 0), internalState(STATE_OFF), switch0(switch0), switch1(switch1), diff --git a/thermal/Heater.h b/src/fsfw/thermal/Heater.h similarity index 92% rename from thermal/Heater.h rename to src/fsfw/thermal/Heater.h index 2caddd85..2a40cac6 100644 --- a/thermal/Heater.h +++ b/src/fsfw/thermal/Heater.h @@ -1,11 +1,12 @@ #ifndef FSFW_THERMAL_HEATER_H_ #define FSFW_THERMAL_HEATER_H_ -#include "../devicehandlers/HealthDevice.h" -#include "../parameters/ParameterHelper.h" -#include "../power/PowerSwitchIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../timemanager/Countdown.h" +#include "fsfw/devicehandlers/HealthDevice.h" +#include "fsfw/parameters/ParameterHelper.h" +#include "fsfw/power/PowerSwitchIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/timemanager/Countdown.h" + #include diff --git a/thermal/RedundantHeater.cpp b/src/fsfw/thermal/RedundantHeater.cpp similarity index 95% rename from thermal/RedundantHeater.cpp rename to src/fsfw/thermal/RedundantHeater.cpp index 6463fcc8..e7b774cb 100644 --- a/thermal/RedundantHeater.cpp +++ b/src/fsfw/thermal/RedundantHeater.cpp @@ -1,4 +1,4 @@ -#include "RedundantHeater.h" +#include "fsfw/thermal/RedundantHeater.h" RedundantHeater::~RedundantHeater() { } diff --git a/thermal/RedundantHeater.h b/src/fsfw/thermal/RedundantHeater.h similarity index 100% rename from thermal/RedundantHeater.h rename to src/fsfw/thermal/RedundantHeater.h diff --git a/thermal/TemperatureSensor.h b/src/fsfw/thermal/TemperatureSensor.h similarity index 100% rename from thermal/TemperatureSensor.h rename to src/fsfw/thermal/TemperatureSensor.h diff --git a/thermal/ThermalComponent.cpp b/src/fsfw/thermal/ThermalComponent.cpp similarity index 99% rename from thermal/ThermalComponent.cpp rename to src/fsfw/thermal/ThermalComponent.cpp index d42c34b3..8d4b7bbd 100644 --- a/thermal/ThermalComponent.cpp +++ b/src/fsfw/thermal/ThermalComponent.cpp @@ -1,4 +1,4 @@ -#include "ThermalComponent.h" +#include "fsfw/thermal/ThermalComponent.h" ThermalComponent::ThermalComponent(object_id_t reportingObjectId, uint8_t domainId, gp_id_t temperaturePoolId, diff --git a/thermal/ThermalComponent.h b/src/fsfw/thermal/ThermalComponent.h similarity index 100% rename from thermal/ThermalComponent.h rename to src/fsfw/thermal/ThermalComponent.h diff --git a/thermal/ThermalComponentCore.cpp b/src/fsfw/thermal/ThermalComponentCore.cpp similarity index 98% rename from thermal/ThermalComponentCore.cpp rename to src/fsfw/thermal/ThermalComponentCore.cpp index 7df04b04..7718ac36 100644 --- a/thermal/ThermalComponentCore.cpp +++ b/src/fsfw/thermal/ThermalComponentCore.cpp @@ -1,5 +1,5 @@ -#include "ThermalComponentCore.h" -#include "tcsDefinitions.h" +#include "fsfw/thermal/ThermalComponentCore.h" +#include "fsfw/thermal/tcsDefinitions.h" ThermalComponentCore::ThermalComponentCore(object_id_t reportingObjectId, uint8_t domainId, gp_id_t temperaturePoolId, diff --git a/thermal/ThermalComponentCore.h b/src/fsfw/thermal/ThermalComponentCore.h similarity index 98% rename from thermal/ThermalComponentCore.h rename to src/fsfw/thermal/ThermalComponentCore.h index a1fa594a..19430015 100644 --- a/thermal/ThermalComponentCore.h +++ b/src/fsfw/thermal/ThermalComponentCore.h @@ -6,7 +6,7 @@ #include "AbstractTemperatureSensor.h" #include "ThermalModule.h" -#include "../datapoollocal/LocalPoolVariable.h" +#include "fsfw/datapoollocal/LocalPoolVariable.h" /** * @brief diff --git a/thermal/ThermalComponentIF.h b/src/fsfw/thermal/ThermalComponentIF.h similarity index 100% rename from thermal/ThermalComponentIF.h rename to src/fsfw/thermal/ThermalComponentIF.h diff --git a/thermal/ThermalModule.cpp b/src/fsfw/thermal/ThermalModule.cpp similarity index 97% rename from thermal/ThermalModule.cpp rename to src/fsfw/thermal/ThermalModule.cpp index de347542..d8108ab3 100644 --- a/thermal/ThermalModule.cpp +++ b/src/fsfw/thermal/ThermalModule.cpp @@ -1,8 +1,8 @@ -#include "ThermalModule.h" -#include "AbstractTemperatureSensor.h" +#include "fsfw/thermal/ThermalModule.h" +#include "fsfw/thermal/AbstractTemperatureSensor.h" -#include "../monitoring/LimitViolationReporter.h" -#include "../monitoring/MonitoringMessageContent.h" +#include "fsfw/monitoring/LimitViolationReporter.h" +#include "fsfw/monitoring/MonitoringMessageContent.h" ThermalModule::ThermalModule(gp_id_t moduleTemperaturePoolId, diff --git a/thermal/ThermalModule.h b/src/fsfw/thermal/ThermalModule.h similarity index 100% rename from thermal/ThermalModule.h rename to src/fsfw/thermal/ThermalModule.h diff --git a/thermal/ThermalModuleIF.h b/src/fsfw/thermal/ThermalModuleIF.h similarity index 100% rename from thermal/ThermalModuleIF.h rename to src/fsfw/thermal/ThermalModuleIF.h diff --git a/thermal/ThermalMonitorReporter.cpp b/src/fsfw/thermal/ThermalMonitorReporter.cpp similarity index 94% rename from thermal/ThermalMonitorReporter.cpp rename to src/fsfw/thermal/ThermalMonitorReporter.cpp index cefc6110..31503203 100644 --- a/thermal/ThermalMonitorReporter.cpp +++ b/src/fsfw/thermal/ThermalMonitorReporter.cpp @@ -1,7 +1,7 @@ -#include "ThermalMonitorReporter.h" -#include "ThermalComponentIF.h" +#include "fsfw/thermal/ThermalMonitorReporter.h" +#include "fsfw/thermal/ThermalComponentIF.h" -#include "../monitoring/MonitoringIF.h" +#include "fsfw/monitoring/MonitoringIF.h" ThermalMonitorReporter::~ThermalMonitorReporter() { } diff --git a/thermal/ThermalMonitorReporter.h b/src/fsfw/thermal/ThermalMonitorReporter.h similarity index 100% rename from thermal/ThermalMonitorReporter.h rename to src/fsfw/thermal/ThermalMonitorReporter.h diff --git a/thermal/tcsDefinitions.h b/src/fsfw/thermal/tcsDefinitions.h similarity index 100% rename from thermal/tcsDefinitions.h rename to src/fsfw/thermal/tcsDefinitions.h diff --git a/timemanager/CCSDSTime.cpp b/src/fsfw/timemanager/CCSDSTime.cpp similarity index 99% rename from timemanager/CCSDSTime.cpp rename to src/fsfw/timemanager/CCSDSTime.cpp index 192c1f57..2475a5eb 100644 --- a/timemanager/CCSDSTime.cpp +++ b/src/fsfw/timemanager/CCSDSTime.cpp @@ -1,5 +1,6 @@ -#include "CCSDSTime.h" -#include +#include "fsfw/FSFW.h" +#include "fsfw/timemanager/CCSDSTime.h" + #include #include #include diff --git a/timemanager/CCSDSTime.h b/src/fsfw/timemanager/CCSDSTime.h similarity index 100% rename from timemanager/CCSDSTime.h rename to src/fsfw/timemanager/CCSDSTime.h diff --git a/timemanager/CMakeLists.txt b/src/fsfw/timemanager/CMakeLists.txt similarity index 100% rename from timemanager/CMakeLists.txt rename to src/fsfw/timemanager/CMakeLists.txt diff --git a/timemanager/Clock.h b/src/fsfw/timemanager/Clock.h similarity index 97% rename from timemanager/Clock.h rename to src/fsfw/timemanager/Clock.h index 6a76c86d..b1d6bfaf 100644 --- a/timemanager/Clock.h +++ b/src/fsfw/timemanager/Clock.h @@ -2,9 +2,9 @@ #define FSFW_TIMEMANAGER_CLOCK_H_ #include "clockDefinitions.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../ipc/MutexFactory.h" -#include "../globalfunctions/timevalOperations.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/globalfunctions/timevalOperations.h" #include diff --git a/timemanager/ClockCommon.cpp b/src/fsfw/timemanager/ClockCommon.cpp similarity index 95% rename from timemanager/ClockCommon.cpp rename to src/fsfw/timemanager/ClockCommon.cpp index e56d4953..82c65b96 100644 --- a/timemanager/ClockCommon.cpp +++ b/src/fsfw/timemanager/ClockCommon.cpp @@ -1,5 +1,5 @@ -#include "Clock.h" -#include "../ipc/MutexGuard.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/ipc/MutexGuard.h" ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval *tt) { uint16_t leapSeconds; diff --git a/timemanager/Countdown.cpp b/src/fsfw/timemanager/Countdown.cpp similarity index 94% rename from timemanager/Countdown.cpp rename to src/fsfw/timemanager/Countdown.cpp index 20b56189..c3499685 100644 --- a/timemanager/Countdown.cpp +++ b/src/fsfw/timemanager/Countdown.cpp @@ -1,4 +1,4 @@ -#include "Countdown.h" +#include "fsfw/timemanager/Countdown.h" Countdown::Countdown(uint32_t initialTimeout): timeout(initialTimeout) { } diff --git a/timemanager/Countdown.h b/src/fsfw/timemanager/Countdown.h similarity index 100% rename from timemanager/Countdown.h rename to src/fsfw/timemanager/Countdown.h diff --git a/timemanager/ReceivesTimeInfoIF.h b/src/fsfw/timemanager/ReceivesTimeInfoIF.h similarity index 100% rename from timemanager/ReceivesTimeInfoIF.h rename to src/fsfw/timemanager/ReceivesTimeInfoIF.h diff --git a/timemanager/Stopwatch.cpp b/src/fsfw/timemanager/Stopwatch.cpp similarity index 95% rename from timemanager/Stopwatch.cpp rename to src/fsfw/timemanager/Stopwatch.cpp index 04ccab72..a8f87029 100644 --- a/timemanager/Stopwatch.cpp +++ b/src/fsfw/timemanager/Stopwatch.cpp @@ -1,5 +1,5 @@ -#include "Stopwatch.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/Stopwatch.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #if FSFW_CPP_OSTREAM_ENABLED == 1 #include diff --git a/timemanager/Stopwatch.h b/src/fsfw/timemanager/Stopwatch.h similarity index 100% rename from timemanager/Stopwatch.h rename to src/fsfw/timemanager/Stopwatch.h diff --git a/timemanager/TimeMessage.cpp b/src/fsfw/timemanager/TimeMessage.cpp similarity index 94% rename from timemanager/TimeMessage.cpp rename to src/fsfw/timemanager/TimeMessage.cpp index 66aea0f4..320f3000 100644 --- a/timemanager/TimeMessage.cpp +++ b/src/fsfw/timemanager/TimeMessage.cpp @@ -1,4 +1,4 @@ -#include "TimeMessage.h" +#include "fsfw/timemanager/TimeMessage.h" TimeMessage::TimeMessage() { this->messageSize += sizeof(timeval) + sizeof(uint32_t); diff --git a/timemanager/TimeMessage.h b/src/fsfw/timemanager/TimeMessage.h similarity index 100% rename from timemanager/TimeMessage.h rename to src/fsfw/timemanager/TimeMessage.h diff --git a/timemanager/TimeStamper.cpp b/src/fsfw/timemanager/TimeStamper.cpp similarity index 87% rename from timemanager/TimeStamper.cpp rename to src/fsfw/timemanager/TimeStamper.cpp index d9f0f2f3..4926c2d5 100644 --- a/timemanager/TimeStamper.cpp +++ b/src/fsfw/timemanager/TimeStamper.cpp @@ -1,5 +1,6 @@ -#include "TimeStamper.h" -#include "Clock.h" +#include "fsfw/timemanager/TimeStamper.h" +#include "fsfw/timemanager/Clock.h" + #include TimeStamper::TimeStamper(object_id_t objectId): SystemObject(objectId) {} diff --git a/timemanager/TimeStamper.h b/src/fsfw/timemanager/TimeStamper.h similarity index 100% rename from timemanager/TimeStamper.h rename to src/fsfw/timemanager/TimeStamper.h diff --git a/timemanager/TimeStamperIF.h b/src/fsfw/timemanager/TimeStamperIF.h similarity index 100% rename from timemanager/TimeStamperIF.h rename to src/fsfw/timemanager/TimeStamperIF.h diff --git a/timemanager/clockDefinitions.h b/src/fsfw/timemanager/clockDefinitions.h similarity index 100% rename from timemanager/clockDefinitions.h rename to src/fsfw/timemanager/clockDefinitions.h diff --git a/tmstorage/CMakeLists.txt b/src/fsfw/tmstorage/CMakeLists.txt similarity index 100% rename from tmstorage/CMakeLists.txt rename to src/fsfw/tmstorage/CMakeLists.txt diff --git a/tmstorage/TmStoreBackendIF.h b/src/fsfw/tmstorage/TmStoreBackendIF.h similarity index 95% rename from tmstorage/TmStoreBackendIF.h rename to src/fsfw/tmstorage/TmStoreBackendIF.h index 4ae77609..4183334b 100644 --- a/tmstorage/TmStoreBackendIF.h +++ b/src/fsfw/tmstorage/TmStoreBackendIF.h @@ -1,11 +1,13 @@ #ifndef FSFW_TMTCSERVICES_TMSTOREBACKENDIF_H_ #define FSFW_TMTCSERVICES_TMSTOREBACKENDIF_H_ -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../objectmanager/SystemObjectIF.h" -#include "../parameters/HasParametersIF.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../timemanager/Clock.h" +#include "tmStorageConf.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/parameters/HasParametersIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/timemanager/Clock.h" + class TmPacketInformation; class TmPacketMinimal; class SpacePacketBase; diff --git a/tmstorage/TmStoreFrontendIF.h b/src/fsfw/tmstorage/TmStoreFrontendIF.h similarity index 95% rename from tmstorage/TmStoreFrontendIF.h rename to src/fsfw/tmstorage/TmStoreFrontendIF.h index beee7ede..11b2a686 100644 --- a/tmstorage/TmStoreFrontendIF.h +++ b/src/fsfw/tmstorage/TmStoreFrontendIF.h @@ -1,9 +1,10 @@ #ifndef FSFW_TMTCSERVICES_TMSTOREFRONTENDIF_H_ #define FSFW_TMTCSERVICES_TMSTOREFRONTENDIF_H_ +#include "tmStorageConf.h" #include "TmStorePackets.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../ipc/MessageQueueSenderIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" class TmPacketMinimal; class SpacePacketBase; diff --git a/tmstorage/TmStoreMessage.cpp b/src/fsfw/tmstorage/TmStoreMessage.cpp similarity index 99% rename from tmstorage/TmStoreMessage.cpp rename to src/fsfw/tmstorage/TmStoreMessage.cpp index 11af6121..fa5fb541 100644 --- a/tmstorage/TmStoreMessage.cpp +++ b/src/fsfw/tmstorage/TmStoreMessage.cpp @@ -1,5 +1,5 @@ #include "TmStoreMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/ObjectManager.h" TmStoreMessage::~TmStoreMessage() { diff --git a/tmstorage/TmStoreMessage.h b/src/fsfw/tmstorage/TmStoreMessage.h similarity index 95% rename from tmstorage/TmStoreMessage.h rename to src/fsfw/tmstorage/TmStoreMessage.h index d0178920..51f86b3a 100644 --- a/tmstorage/TmStoreMessage.h +++ b/src/fsfw/tmstorage/TmStoreMessage.h @@ -1,10 +1,11 @@ #ifndef FSFW_TMSTORAGE_TMSTOREMESSAGE_H_ #define FSFW_TMSTORAGE_TMSTOREMESSAGE_H_ +#include "tmStorageConf.h" #include "TmStorePackets.h" -#include "../ipc/CommandMessage.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../objectmanager/SystemObjectIF.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/objectmanager/SystemObjectIF.h" class TmStoreMessage { public: diff --git a/tmstorage/TmStorePackets.h b/src/fsfw/tmstorage/TmStorePackets.h similarity index 95% rename from tmstorage/TmStorePackets.h rename to src/fsfw/tmstorage/TmStorePackets.h index 53a5d8d6..738f7ac2 100644 --- a/tmstorage/TmStorePackets.h +++ b/src/fsfw/tmstorage/TmStorePackets.h @@ -1,14 +1,15 @@ #ifndef FSFW_TMSTORAGE_TMSTOREPACKETS_H_ #define FSFW_TMSTORAGE_TMSTOREPACKETS_H_ -#include "../serialize/SerialFixedArrayListAdapter.h" -#include "../serialize/SerializeElement.h" -#include "../serialize/SerialLinkedListAdapter.h" -#include "../serialize/SerialBufferAdapter.h" -#include "../tmtcpacket/pus/tm/TmPacketMinimal.h" -#include "../timemanager/TimeStamperIF.h" -#include "../timemanager/CCSDSTime.h" -#include "../globalfunctions/timevalOperations.h" +#include "tmStorageConf.h" +#include "fsfw/serialize/SerialFixedArrayListAdapter.h" +#include "fsfw/serialize/SerializeElement.h" +#include "fsfw/serialize/SerialLinkedListAdapter.h" +#include "fsfw/serialize/SerialBufferAdapter.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h" +#include "fsfw/timemanager/TimeStamperIF.h" +#include "fsfw/timemanager/CCSDSTime.h" +#include "fsfw/globalfunctions/timevalOperations.h" class ServiceSubservice: public SerialLinkedListAdapter { public: diff --git a/src/fsfw/tmstorage/tmStorageConf.h b/src/fsfw/tmstorage/tmStorageConf.h new file mode 100644 index 00000000..e5c3d0d5 --- /dev/null +++ b/src/fsfw/tmstorage/tmStorageConf.h @@ -0,0 +1,11 @@ +#ifndef FSFW_TMSTORAGE_TMSTORAGECONF_H_ +#define FSFW_TMSTORAGE_TMSTORAGECONF_H_ + +#include "fsfw/FSFW.h" + +#ifndef FSFW_ADD_TMSTORAGE +#warning TM storage files were includes but compilation was \ + not enabled with FSFW_ADD_TMSTORAGE +#endif + +#endif /* FSFW_TMSTORAGE_TMSTORAGECONF_H_ */ diff --git a/tmtcpacket/CMakeLists.txt b/src/fsfw/tmtcpacket/CMakeLists.txt similarity index 100% rename from tmtcpacket/CMakeLists.txt rename to src/fsfw/tmtcpacket/CMakeLists.txt diff --git a/tmtcpacket/SpacePacket.cpp b/src/fsfw/tmtcpacket/SpacePacket.cpp similarity index 66% rename from tmtcpacket/SpacePacket.cpp rename to src/fsfw/tmtcpacket/SpacePacket.cpp index b8ba27e9..cbf82e0d 100644 --- a/tmtcpacket/SpacePacket.cpp +++ b/src/fsfw/tmtcpacket/SpacePacket.cpp @@ -1,10 +1,10 @@ -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "ccsds_header.h" -#include "SpacePacket.h" -#include +#include "fsfw/tmtcpacket/ccsds_header.h" +#include "fsfw/tmtcpacket/SpacePacket.h" +#include -SpacePacket::SpacePacket( uint16_t packetDataLength, bool isTelecommand, uint16_t apid, uint16_t sequenceCount ): -SpacePacketBase( (uint8_t*)&this->localData ) { +SpacePacket::SpacePacket(uint16_t packetDataLength, bool isTelecommand, uint16_t apid, + uint16_t sequenceCount): + SpacePacketBase( (uint8_t*)&this->localData ) { initSpacePacketHeader(isTelecommand, false, apid, sequenceCount); this->setPacketSequenceCount(sequenceCount); if ( packetDataLength <= sizeof(this->localData.fields.buffer) ) { diff --git a/tmtcpacket/SpacePacket.h b/src/fsfw/tmtcpacket/SpacePacket.h similarity index 100% rename from tmtcpacket/SpacePacket.h rename to src/fsfw/tmtcpacket/SpacePacket.h diff --git a/tmtcpacket/SpacePacketBase.cpp b/src/fsfw/tmtcpacket/SpacePacketBase.cpp similarity index 97% rename from tmtcpacket/SpacePacketBase.cpp rename to src/fsfw/tmtcpacket/SpacePacketBase.cpp index 14198027..e9a0b836 100644 --- a/tmtcpacket/SpacePacketBase.cpp +++ b/src/fsfw/tmtcpacket/SpacePacketBase.cpp @@ -1,5 +1,6 @@ -#include "SpacePacketBase.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + #include SpacePacketBase::SpacePacketBase( const uint8_t* set_address ) { diff --git a/tmtcpacket/SpacePacketBase.h b/src/fsfw/tmtcpacket/SpacePacketBase.h similarity index 100% rename from tmtcpacket/SpacePacketBase.h rename to src/fsfw/tmtcpacket/SpacePacketBase.h diff --git a/tmtcpacket/ccsds_header.h b/src/fsfw/tmtcpacket/ccsds_header.h similarity index 100% rename from tmtcpacket/ccsds_header.h rename to src/fsfw/tmtcpacket/ccsds_header.h diff --git a/tmtcpacket/packetmatcher/ApidMatcher.h b/src/fsfw/tmtcpacket/packetmatcher/ApidMatcher.h similarity index 100% rename from tmtcpacket/packetmatcher/ApidMatcher.h rename to src/fsfw/tmtcpacket/packetmatcher/ApidMatcher.h diff --git a/tmtcpacket/packetmatcher/CMakeLists.txt b/src/fsfw/tmtcpacket/packetmatcher/CMakeLists.txt similarity index 100% rename from tmtcpacket/packetmatcher/CMakeLists.txt rename to src/fsfw/tmtcpacket/packetmatcher/CMakeLists.txt diff --git a/tmtcpacket/packetmatcher/PacketMatchTree.cpp b/src/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.cpp similarity index 96% rename from tmtcpacket/packetmatcher/PacketMatchTree.cpp rename to src/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.cpp index 05e176ef..7f8aae9a 100644 --- a/tmtcpacket/packetmatcher/PacketMatchTree.cpp +++ b/src/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.cpp @@ -1,7 +1,7 @@ -#include "ApidMatcher.h" -#include "PacketMatchTree.h" -#include "ServiceMatcher.h" -#include "SubserviceMatcher.h" +#include "fsfw/tmtcpacket/packetmatcher/ApidMatcher.h" +#include "fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h" +#include "fsfw/tmtcpacket/packetmatcher/ServiceMatcher.h" +#include "fsfw/tmtcpacket/packetmatcher/SubserviceMatcher.h" // This should be configurable.. const LocalPool::LocalPoolConfig PacketMatchTree::poolConfig = { diff --git a/tmtcpacket/packetmatcher/PacketMatchTree.h b/src/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h similarity index 86% rename from tmtcpacket/packetmatcher/PacketMatchTree.h rename to src/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h index a40b5099..e2439c74 100644 --- a/tmtcpacket/packetmatcher/PacketMatchTree.h +++ b/src/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h @@ -1,10 +1,10 @@ #ifndef FSFW_TMTCPACKET_PACKETMATCHER_PACKETMATCHTREE_H_ #define FSFW_TMTCPACKET_PACKETMATCHER_PACKETMATCHTREE_H_ -#include "../../container/PlacementFactory.h" -#include "../../globalfunctions/matching/MatchTree.h" -#include "../../storagemanager/LocalPool.h" -#include "../../tmtcpacket/pus/tm/TmPacketMinimal.h" +#include "fsfw/container/PlacementFactory.h" +#include "fsfw/globalfunctions/matching/MatchTree.h" +#include "fsfw/storagemanager/LocalPool.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h" class PacketMatchTree: public MatchTree, public HasReturnvaluesIF { public: diff --git a/tmtcpacket/packetmatcher/ServiceMatcher.h b/src/fsfw/tmtcpacket/packetmatcher/ServiceMatcher.h similarity index 100% rename from tmtcpacket/packetmatcher/ServiceMatcher.h rename to src/fsfw/tmtcpacket/packetmatcher/ServiceMatcher.h diff --git a/tmtcpacket/packetmatcher/SubserviceMatcher.h b/src/fsfw/tmtcpacket/packetmatcher/SubserviceMatcher.h similarity index 100% rename from tmtcpacket/packetmatcher/SubserviceMatcher.h rename to src/fsfw/tmtcpacket/packetmatcher/SubserviceMatcher.h diff --git a/tmtcpacket/pus/CMakeLists.txt b/src/fsfw/tmtcpacket/pus/CMakeLists.txt similarity index 100% rename from tmtcpacket/pus/CMakeLists.txt rename to src/fsfw/tmtcpacket/pus/CMakeLists.txt diff --git a/src/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h b/src/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h new file mode 100644 index 00000000..b839223a --- /dev/null +++ b/src/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h @@ -0,0 +1,19 @@ +#ifndef FSFW_TMTCPACKET_PUS_PACKETTIMESTAMPINTERPRETERIF_H_ +#define FSFW_TMTCPACKET_PUS_PACKETTIMESTAMPINTERPRETERIF_H_ + +#include "fsfw/returnvalues/HasReturnvaluesIF.h" + +class TmPacketMinimal; + +class PacketTimestampInterpreterIF { +public: + virtual ~PacketTimestampInterpreterIF() {} + virtual ReturnValue_t getPacketTime(TmPacketMinimal* packet, + timeval* timestamp) const = 0; + virtual ReturnValue_t getPacketTimeRaw(TmPacketMinimal* packet, const uint8_t** timePtr, + uint32_t* size) const = 0; +}; + + + +#endif /* FSFW_TMTCPACKET_PUS_PACKETTIMESTAMPINTERPRETERIF_H_ */ diff --git a/tmtcpacket/pus/tc.h b/src/fsfw/tmtcpacket/pus/tc.h similarity index 100% rename from tmtcpacket/pus/tc.h rename to src/fsfw/tmtcpacket/pus/tc.h diff --git a/tmtcpacket/pus/tc/CMakeLists.txt b/src/fsfw/tmtcpacket/pus/tc/CMakeLists.txt similarity index 100% rename from tmtcpacket/pus/tc/CMakeLists.txt rename to src/fsfw/tmtcpacket/pus/tc/CMakeLists.txt diff --git a/tmtcpacket/pus/tc/TcPacketBase.cpp b/src/fsfw/tmtcpacket/pus/tc/TcPacketBase.cpp similarity index 66% rename from tmtcpacket/pus/tc/TcPacketBase.cpp rename to src/fsfw/tmtcpacket/pus/tc/TcPacketBase.cpp index dd576fec..0c7a4183 100644 --- a/tmtcpacket/pus/tc/TcPacketBase.cpp +++ b/src/fsfw/tmtcpacket/pus/tc/TcPacketBase.cpp @@ -1,8 +1,8 @@ -#include "TcPacketBase.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketBase.h" -#include "../../../globalfunctions/CRC.h" -#include "../../../globalfunctions/arrayprinter.h" -#include "../../../serviceinterface/ServiceInterface.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/globalfunctions/arrayprinter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/tmtcpacket/pus/tc/TcPacketBase.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketBase.h similarity index 99% rename from tmtcpacket/pus/tc/TcPacketBase.h rename to src/fsfw/tmtcpacket/pus/tc/TcPacketBase.h index e2872246..14356c8c 100644 --- a/tmtcpacket/pus/tc/TcPacketBase.h +++ b/src/fsfw/tmtcpacket/pus/tc/TcPacketBase.h @@ -1,7 +1,7 @@ #ifndef TMTCPACKET_PUS_TCPACKETBASE_H_ #define TMTCPACKET_PUS_TCPACKETBASE_H_ -#include "../../../tmtcpacket/SpacePacketBase.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" #include /** diff --git a/tmtcpacket/pus/tc/TcPacketPus.cpp b/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.cpp similarity index 97% rename from tmtcpacket/pus/tc/TcPacketPus.cpp rename to src/fsfw/tmtcpacket/pus/tc/TcPacketPus.cpp index d2b19206..28533754 100644 --- a/tmtcpacket/pus/tc/TcPacketPus.cpp +++ b/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.cpp @@ -1,5 +1,5 @@ -#include "TcPacketPus.h" -#include "../../../globalfunctions/CRC.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketPus.h" +#include "fsfw/globalfunctions/CRC.h" #include diff --git a/tmtcpacket/pus/tc/TcPacketPus.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h similarity index 97% rename from tmtcpacket/pus/tc/TcPacketPus.h rename to src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h index 7a28a957..082541ba 100644 --- a/tmtcpacket/pus/tc/TcPacketPus.h +++ b/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h @@ -1,8 +1,8 @@ #ifndef FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ #define FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ -#include "../../../FSFW.h" -#include "../../ccsds_header.h" +#include "fsfw/FSFW.h" +#include "fsfw/tmtcpacket/ccsds_header.h" #include "TcPacketBase.h" #include diff --git a/tmtcpacket/pus/tc/TcPacketStoredBase.cpp b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.cpp similarity index 90% rename from tmtcpacket/pus/tc/TcPacketStoredBase.cpp rename to src/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.cpp index cf980e68..98ce1725 100644 --- a/tmtcpacket/pus/tc/TcPacketStoredBase.cpp +++ b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.cpp @@ -1,8 +1,8 @@ -#include "TcPacketStoredBase.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h" -#include "../../../objectmanager/ObjectManager.h" -#include "../../../serviceinterface/ServiceInterface.h" -#include "../../../objectmanager/frameworkObjects.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/frameworkObjects.h" #include diff --git a/tmtcpacket/pus/tc/TcPacketStoredBase.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h similarity index 100% rename from tmtcpacket/pus/tc/TcPacketStoredBase.h rename to src/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h diff --git a/tmtcpacket/pus/tc/TcPacketStoredIF.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredIF.h similarity index 100% rename from tmtcpacket/pus/tc/TcPacketStoredIF.h rename to src/fsfw/tmtcpacket/pus/tc/TcPacketStoredIF.h diff --git a/tmtcpacket/pus/tc/TcPacketStoredPus.cpp b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.cpp similarity index 95% rename from tmtcpacket/pus/tc/TcPacketStoredPus.cpp rename to src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.cpp index 426aafdb..5ea9f5b1 100644 --- a/tmtcpacket/pus/tc/TcPacketStoredPus.cpp +++ b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.cpp @@ -1,6 +1,6 @@ -#include "TcPacketStoredPus.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.h" -#include "../../../serviceinterface/ServiceInterface.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/tmtcpacket/pus/tc/TcPacketStoredPus.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.h similarity index 100% rename from tmtcpacket/pus/tc/TcPacketStoredPus.h rename to src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.h diff --git a/tmtcpacket/pus/tm.h b/src/fsfw/tmtcpacket/pus/tm.h similarity index 92% rename from tmtcpacket/pus/tm.h rename to src/fsfw/tmtcpacket/pus/tm.h index 591ada7c..afbe8251 100644 --- a/tmtcpacket/pus/tm.h +++ b/src/fsfw/tmtcpacket/pus/tm.h @@ -1,7 +1,7 @@ #ifndef FSFW_TMTCPACKET_PUS_TM_H_ #define FSFW_TMTCPACKET_PUS_TM_H_ -#include "../../FSFW.h" +#include "fsfw/FSFW.h" #if FSFW_USE_PUS_C_TELEMETRY == 1 #include "tm/TmPacketPusC.h" diff --git a/tmtcpacket/pus/tm/CMakeLists.txt b/src/fsfw/tmtcpacket/pus/tm/CMakeLists.txt similarity index 100% rename from tmtcpacket/pus/tm/CMakeLists.txt rename to src/fsfw/tmtcpacket/pus/tm/CMakeLists.txt diff --git a/tmtcpacket/pus/tm/TmPacketBase.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketBase.cpp similarity index 87% rename from tmtcpacket/pus/tm/TmPacketBase.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketBase.cpp index 3dd1749f..d448fe5e 100644 --- a/tmtcpacket/pus/tm/TmPacketBase.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketBase.cpp @@ -1,10 +1,10 @@ -#include "TmPacketBase.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketBase.h" -#include "../../../globalfunctions/CRC.h" -#include "../../../globalfunctions/arrayprinter.h" -#include "../../../objectmanager/ObjectManager.h" -#include "../../../serviceinterface/ServiceInterface.h" -#include "../../../timemanager/CCSDSTime.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/globalfunctions/arrayprinter.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/CCSDSTime.h" #include diff --git a/tmtcpacket/pus/tm/TmPacketBase.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketBase.h similarity index 95% rename from tmtcpacket/pus/tm/TmPacketBase.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketBase.h index 9f534f29..0379b977 100644 --- a/tmtcpacket/pus/tm/TmPacketBase.h +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketBase.h @@ -1,13 +1,15 @@ #ifndef TMTCPACKET_PUS_TMPACKETBASE_H_ #define TMTCPACKET_PUS_TMPACKETBASE_H_ -#include "../../SpacePacketBase.h" -#include "../../../timemanager/TimeStamperIF.h" -#include "../../../timemanager/Clock.h" -#include "../../../objectmanager/SystemObjectIF.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" +#include "fsfw/timemanager/TimeStamperIF.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/objectmanager/SystemObjectIF.h" + +namespace Factory { -namespace Factory{ void setStaticFrameworkObjectIds(); + } diff --git a/tmtcpacket/pus/tm/TmPacketMinimal.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.cpp similarity index 91% rename from tmtcpacket/pus/tm/TmPacketMinimal.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.cpp index 3f785cde..25e159da 100644 --- a/tmtcpacket/pus/tm/TmPacketMinimal.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.cpp @@ -1,5 +1,5 @@ -#include "TmPacketMinimal.h" -#include "../PacketTimestampInterpreterIF.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h" +#include "fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h" #include #include diff --git a/tmtcpacket/pus/tm/TmPacketMinimal.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h similarity index 100% rename from tmtcpacket/pus/tm/TmPacketMinimal.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h diff --git a/tmtcpacket/pus/tm/TmPacketPusA.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp similarity index 87% rename from tmtcpacket/pus/tm/TmPacketPusA.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp index bdc0a815..c6540af5 100644 --- a/tmtcpacket/pus/tm/TmPacketPusA.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp @@ -1,11 +1,11 @@ -#include "TmPacketPusA.h" -#include "TmPacketBase.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketPusA.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketBase.h" -#include "../../../globalfunctions/CRC.h" -#include "../../../globalfunctions/arrayprinter.h" -#include "../../../objectmanager/ObjectManagerIF.h" -#include "../../../serviceinterface/ServiceInterfaceStream.h" -#include "../../../timemanager/CCSDSTime.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/globalfunctions/arrayprinter.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/CCSDSTime.h" #include diff --git a/tmtcpacket/pus/tm/TmPacketPusA.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h similarity index 95% rename from tmtcpacket/pus/tm/TmPacketPusA.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h index 49f26b34..3856c779 100644 --- a/tmtcpacket/pus/tm/TmPacketPusA.h +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h @@ -2,10 +2,10 @@ #define FSFW_TMTCPACKET_PUS_TMPACKETPUSA_H_ #include "TmPacketBase.h" -#include "../../SpacePacketBase.h" -#include "../../../timemanager/TimeStamperIF.h" -#include "../../../timemanager/Clock.h" -#include "../../../objectmanager/SystemObjectIF.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" +#include "fsfw/timemanager/TimeStamperIF.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/objectmanager/SystemObjectIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/tmtcpacket/pus/tm/TmPacketPusC.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp similarity index 87% rename from tmtcpacket/pus/tm/TmPacketPusC.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp index 5090aaeb..ea25f5d2 100644 --- a/tmtcpacket/pus/tm/TmPacketPusC.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp @@ -1,11 +1,11 @@ -#include "TmPacketPusC.h" -#include "TmPacketBase.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketPusC.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketBase.h" -#include "../../../globalfunctions/CRC.h" -#include "../../../globalfunctions/arrayprinter.h" -#include "../../../objectmanager/ObjectManagerIF.h" -#include "../../../serviceinterface/ServiceInterfaceStream.h" -#include "../../../timemanager/CCSDSTime.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/globalfunctions/arrayprinter.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/CCSDSTime.h" #include diff --git a/tmtcpacket/pus/tm/TmPacketPusC.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h similarity index 95% rename from tmtcpacket/pus/tm/TmPacketPusC.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h index 2a6d3bf6..fe373c6f 100644 --- a/tmtcpacket/pus/tm/TmPacketPusC.h +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h @@ -2,10 +2,10 @@ #define FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_ #include "TmPacketBase.h" -#include "../../SpacePacketBase.h" -#include "../../../timemanager/TimeStamperIF.h" -#include "../../../timemanager/Clock.h" -#include "../../../objectmanager/SystemObjectIF.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" +#include "fsfw/timemanager/TimeStamperIF.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/objectmanager/SystemObjectIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/tmtcpacket/pus/tm/TmPacketStored.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketStored.h similarity index 100% rename from tmtcpacket/pus/tm/TmPacketStored.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStored.h diff --git a/tmtcpacket/pus/tm/TmPacketStoredBase.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp similarity index 93% rename from tmtcpacket/pus/tm/TmPacketStoredBase.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp index ba8b15d1..466e4cd2 100644 --- a/tmtcpacket/pus/tm/TmPacketStoredBase.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp @@ -1,8 +1,8 @@ -#include "TmPacketStoredBase.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h" -#include "../../../objectmanager/ObjectManager.h" -#include "../../../serviceinterface/ServiceInterface.h" -#include "../../../tmtcservices/TmTcMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/TmTcMessage.h" #include diff --git a/tmtcpacket/pus/tm/TmPacketStoredBase.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h similarity index 92% rename from tmtcpacket/pus/tm/TmPacketStoredBase.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h index 1bc092dd..8e8b9c70 100644 --- a/tmtcpacket/pus/tm/TmPacketStoredBase.h +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h @@ -1,15 +1,15 @@ #ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_ #define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_ -#include "../../../FSFW.h" +#include "fsfw/FSFW.h" #include "TmPacketBase.h" #include "TmPacketStoredBase.h" #include "TmPacketPusA.h" -#include "../../../serialize/SerializeIF.h" -#include "../../../storagemanager/StorageManagerIF.h" -#include "../../../internalError/InternalErrorReporterIF.h" -#include "../../../ipc/MessageQueueSenderIF.h" +#include "fsfw/serialize/SerializeIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/internalerror/InternalErrorReporterIF.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" /** * This class generates a ECSS PUS Telemetry packet within a given diff --git a/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp similarity index 94% rename from tmtcpacket/pus/tm/TmPacketStoredPusA.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp index 02fb77ef..538dc95e 100644 --- a/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp @@ -1,7 +1,7 @@ -#include "TmPacketStoredPusA.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h" -#include "../../../serviceinterface/ServiceInterface.h" -#include "../../../tmtcservices/TmTcMessage.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/TmTcMessage.h" #include diff --git a/tmtcpacket/pus/tm/TmPacketStoredPusA.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h similarity index 100% rename from tmtcpacket/pus/tm/TmPacketStoredPusA.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h diff --git a/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp similarity index 94% rename from tmtcpacket/pus/tm/TmPacketStoredPusC.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp index 6f8f7fa2..add4f4b9 100644 --- a/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp @@ -1,7 +1,7 @@ -#include "TmPacketStoredPusC.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.h" -#include "../../../serviceinterface/ServiceInterface.h" -#include "../../../tmtcservices/TmTcMessage.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/TmTcMessage.h" #include diff --git a/tmtcpacket/pus/tm/TmPacketStoredPusC.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.h similarity index 100% rename from tmtcpacket/pus/tm/TmPacketStoredPusC.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.h diff --git a/tmtcservices/AcceptsTelecommandsIF.h b/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h similarity index 100% rename from tmtcservices/AcceptsTelecommandsIF.h rename to src/fsfw/tmtcservices/AcceptsTelecommandsIF.h diff --git a/tmtcservices/AcceptsTelemetryIF.h b/src/fsfw/tmtcservices/AcceptsTelemetryIF.h similarity index 100% rename from tmtcservices/AcceptsTelemetryIF.h rename to src/fsfw/tmtcservices/AcceptsTelemetryIF.h diff --git a/tmtcservices/AcceptsVerifyMessageIF.h b/src/fsfw/tmtcservices/AcceptsVerifyMessageIF.h similarity index 100% rename from tmtcservices/AcceptsVerifyMessageIF.h rename to src/fsfw/tmtcservices/AcceptsVerifyMessageIF.h diff --git a/tmtcservices/CMakeLists.txt b/src/fsfw/tmtcservices/CMakeLists.txt similarity index 100% rename from tmtcservices/CMakeLists.txt rename to src/fsfw/tmtcservices/CMakeLists.txt diff --git a/tmtcservices/CommandingServiceBase.cpp b/src/fsfw/tmtcservices/CommandingServiceBase.cpp similarity index 97% rename from tmtcservices/CommandingServiceBase.cpp rename to src/fsfw/tmtcservices/CommandingServiceBase.cpp index 307a2a98..10805b47 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/src/fsfw/tmtcservices/CommandingServiceBase.cpp @@ -1,14 +1,13 @@ -#include "AcceptsTelemetryIF.h" -#include "CommandingServiceBase.h" -#include "TmTcMessage.h" -#include +#include "fsfw/tmtcservices/CommandingServiceBase.h" +#include "fsfw/tmtcservices/AcceptsTelemetryIF.h" +#include "fsfw/tmtcservices/TmTcMessage.h" -#include "../tcdistribution/PUSDistributorIF.h" -#include "../objectmanager/ObjectManager.h" -#include "../ipc/QueueFactory.h" -#include "../tmtcpacket/pus/tc.h" -#include "../tmtcpacket/pus/tm.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/tcdistribution/PUSDistributorIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/tmtcpacket/pus/tc.h" +#include "fsfw/tmtcpacket/pus/tm.h" +#include "fsfw/serviceinterface/ServiceInterface.h" object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT; object_id_t CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT; diff --git a/tmtcservices/CommandingServiceBase.h b/src/fsfw/tmtcservices/CommandingServiceBase.h similarity index 97% rename from tmtcservices/CommandingServiceBase.h rename to src/fsfw/tmtcservices/CommandingServiceBase.h index 4ee4a21a..b6709693 100644 --- a/tmtcservices/CommandingServiceBase.h +++ b/src/fsfw/tmtcservices/CommandingServiceBase.h @@ -3,17 +3,16 @@ #include "AcceptsTelecommandsIF.h" #include "VerificationReporter.h" +#include "fsfw/FSFW.h" -#include "../objectmanager/SystemObject.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../ipc/MessageQueueIF.h" -#include "../ipc/CommandMessage.h" -#include "../container/FixedMap.h" -#include "../container/FIFO.h" -#include "../serialize/SerializeIF.h" - -#include +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/container/FixedMap.h" +#include "fsfw/container/FIFO.h" +#include "fsfw/serialize/SerializeIF.h" class TcPacketStored; class TcPacketStoredBase; diff --git a/tmtcservices/PusServiceBase.cpp b/src/fsfw/tmtcservices/PusServiceBase.cpp similarity index 91% rename from tmtcservices/PusServiceBase.cpp rename to src/fsfw/tmtcservices/PusServiceBase.cpp index 811c9bcb..866e0844 100644 --- a/tmtcservices/PusServiceBase.cpp +++ b/src/fsfw/tmtcservices/PusServiceBase.cpp @@ -1,12 +1,12 @@ -#include "PusServiceBase.h" -#include "AcceptsTelemetryIF.h" -#include "PusVerificationReport.h" -#include "TmTcMessage.h" +#include "fsfw/tmtcservices/PusServiceBase.h" +#include "fsfw/tmtcservices/AcceptsTelemetryIF.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" +#include "fsfw/tmtcservices/TmTcMessage.h" -#include "../objectmanager/ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../tcdistribution/PUSDistributorIF.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tcdistribution/PUSDistributorIF.h" +#include "fsfw/ipc/QueueFactory.h" object_id_t PusServiceBase::packetSource = 0; object_id_t PusServiceBase::packetDestination = 0; diff --git a/tmtcservices/PusServiceBase.h b/src/fsfw/tmtcservices/PusServiceBase.h similarity index 95% rename from tmtcservices/PusServiceBase.h rename to src/fsfw/tmtcservices/PusServiceBase.h index 6cde6fb4..ea4147fe 100644 --- a/tmtcservices/PusServiceBase.h +++ b/src/fsfw/tmtcservices/PusServiceBase.h @@ -5,12 +5,12 @@ #include "VerificationCodes.h" #include "VerificationReporter.h" -#include "../objectmanager/ObjectManagerIF.h" -#include "../objectmanager/SystemObject.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../tmtcpacket/pus/tc.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/tmtcpacket/pus/tc.h" +#include "fsfw/ipc/MessageQueueIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/tmtcservices/PusVerificationReport.cpp b/src/fsfw/tmtcservices/PusVerificationReport.cpp similarity index 97% rename from tmtcservices/PusVerificationReport.cpp rename to src/fsfw/tmtcservices/PusVerificationReport.cpp index c64e5feb..827486ce 100644 --- a/tmtcservices/PusVerificationReport.cpp +++ b/src/fsfw/tmtcservices/PusVerificationReport.cpp @@ -1,5 +1,5 @@ -#include "../serialize/SerializeAdapter.h" -#include "../tmtcservices/PusVerificationReport.h" +#include "fsfw/serialize/SerializeAdapter.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" PusVerificationMessage::PusVerificationMessage() { } diff --git a/tmtcservices/PusVerificationReport.h b/src/fsfw/tmtcservices/PusVerificationReport.h similarity index 93% rename from tmtcservices/PusVerificationReport.h rename to src/fsfw/tmtcservices/PusVerificationReport.h index 0e1732ef..c22ba535 100644 --- a/tmtcservices/PusVerificationReport.h +++ b/src/fsfw/tmtcservices/PusVerificationReport.h @@ -3,9 +3,9 @@ #include "VerificationCodes.h" -#include "../ipc/MessageQueueMessage.h" -#include "../tmtcpacket/pus/tc/TcPacketBase.h" -#include "../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketBase.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" class PusVerificationMessage: public MessageQueueMessage { private: diff --git a/tmtcservices/SourceSequenceCounter.h b/src/fsfw/tmtcservices/SourceSequenceCounter.h similarity index 100% rename from tmtcservices/SourceSequenceCounter.h rename to src/fsfw/tmtcservices/SourceSequenceCounter.h diff --git a/tmtcservices/TmTcBridge.cpp b/src/fsfw/tmtcservices/TmTcBridge.cpp similarity index 97% rename from tmtcservices/TmTcBridge.cpp rename to src/fsfw/tmtcservices/TmTcBridge.cpp index 7198bc76..7346cfe2 100644 --- a/tmtcservices/TmTcBridge.cpp +++ b/src/fsfw/tmtcservices/TmTcBridge.cpp @@ -1,9 +1,9 @@ -#include "TmTcBridge.h" +#include "fsfw/tmtcservices/TmTcBridge.h" -#include "../objectmanager/ObjectManager.h" -#include "../ipc/QueueFactory.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../globalfunctions/arrayprinter.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/globalfunctions/arrayprinter.h" #define TMTCBRIDGE_WIRETAPPING 0 diff --git a/tmtcservices/TmTcBridge.h b/src/fsfw/tmtcservices/TmTcBridge.h similarity index 94% rename from tmtcservices/TmTcBridge.h rename to src/fsfw/tmtcservices/TmTcBridge.h index d3e1c547..d3689d19 100644 --- a/tmtcservices/TmTcBridge.h +++ b/src/fsfw/tmtcservices/TmTcBridge.h @@ -4,12 +4,12 @@ #include "AcceptsTelemetryIF.h" #include "AcceptsTelecommandsIF.h" -#include "../objectmanager/SystemObject.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../ipc/MessageQueueIF.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../container/DynamicFIFO.h" -#include "../tmtcservices/TmTcMessage.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/container/DynamicFIFO.h" +#include "fsfw/tmtcservices/TmTcMessage.h" class TmTcBridge : public AcceptsTelemetryIF, public AcceptsTelecommandsIF, diff --git a/tmtcservices/TmTcMessage.cpp b/src/fsfw/tmtcservices/TmTcMessage.cpp similarity index 93% rename from tmtcservices/TmTcMessage.cpp rename to src/fsfw/tmtcservices/TmTcMessage.cpp index c0f32aaa..9dbd8fd8 100644 --- a/tmtcservices/TmTcMessage.cpp +++ b/src/fsfw/tmtcservices/TmTcMessage.cpp @@ -1,4 +1,4 @@ -#include "TmTcMessage.h" +#include "fsfw/tmtcservices/TmTcMessage.h" #include diff --git a/tmtcservices/TmTcMessage.h b/src/fsfw/tmtcservices/TmTcMessage.h similarity index 94% rename from tmtcservices/TmTcMessage.h rename to src/fsfw/tmtcservices/TmTcMessage.h index 7d2a7bdb..5e6647fe 100644 --- a/tmtcservices/TmTcMessage.h +++ b/src/fsfw/tmtcservices/TmTcMessage.h @@ -1,8 +1,8 @@ #ifndef FSFW_TMTCSERVICES_TMTCMESSAGE_H_ #define FSFW_TMTCSERVICES_TMTCMESSAGE_H_ -#include "../ipc/MessageQueueMessage.h" -#include "../storagemanager/StorageManagerIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" +#include "fsfw/storagemanager/StorageManagerIF.h" /** * @brief This message class is used to pass Telecommand and Telemetry * packets between tasks. diff --git a/tmtcservices/VerificationCodes.h b/src/fsfw/tmtcservices/VerificationCodes.h similarity index 100% rename from tmtcservices/VerificationCodes.h rename to src/fsfw/tmtcservices/VerificationCodes.h diff --git a/tmtcservices/VerificationReporter.cpp b/src/fsfw/tmtcservices/VerificationReporter.cpp similarity index 92% rename from tmtcservices/VerificationReporter.cpp rename to src/fsfw/tmtcservices/VerificationReporter.cpp index 74e0719c..2b371d1e 100644 --- a/tmtcservices/VerificationReporter.cpp +++ b/src/fsfw/tmtcservices/VerificationReporter.cpp @@ -1,11 +1,11 @@ -#include "VerificationReporter.h" -#include "AcceptsVerifyMessageIF.h" -#include "PusVerificationReport.h" +#include "fsfw/tmtcservices/VerificationReporter.h" +#include "fsfw/tmtcservices/AcceptsVerifyMessageIF.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" -#include "../objectmanager/ObjectManager.h" -#include "../ipc/MessageQueueIF.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/frameworkObjects.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/frameworkObjects.h" object_id_t VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; diff --git a/tmtcservices/VerificationReporter.h b/src/fsfw/tmtcservices/VerificationReporter.h similarity index 97% rename from tmtcservices/VerificationReporter.h rename to src/fsfw/tmtcservices/VerificationReporter.h index f26fa54f..4a64d3df 100644 --- a/tmtcservices/VerificationReporter.h +++ b/src/fsfw/tmtcservices/VerificationReporter.h @@ -2,7 +2,7 @@ #define FSFW_TMTCSERVICES_VERIFICATIONREPORTER_H_ #include "PusVerificationReport.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..febd4f0a --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(src) diff --git a/tests/src/CMakeLists.txt b/tests/src/CMakeLists.txt new file mode 100644 index 00000000..ed2f2522 --- /dev/null +++ b/tests/src/CMakeLists.txt @@ -0,0 +1,9 @@ +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_subdirectory(fsfw) diff --git a/tests/src/fsfw/CMakeLists.txt b/tests/src/fsfw/CMakeLists.txt new file mode 100644 index 00000000..571a126e --- /dev/null +++ b/tests/src/fsfw/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(tests) \ No newline at end of file diff --git a/tests/src/fsfw/tests/CMakeLists.txt b/tests/src/fsfw/tests/CMakeLists.txt new file mode 100644 index 00000000..e4a6be80 --- /dev/null +++ b/tests/src/fsfw/tests/CMakeLists.txt @@ -0,0 +1,8 @@ + +if(FSFW_ADD_INTERNAL_TESTS) + add_subdirectory(internal) +endif() + +if(FSFW_ADD_UNITTESTS) + add_subdirectory(unit) +endif() diff --git a/unittest/internal/CMakeLists.txt b/tests/src/fsfw/tests/internal/CMakeLists.txt similarity index 57% rename from unittest/internal/CMakeLists.txt rename to tests/src/fsfw/tests/internal/CMakeLists.txt index 11fd2b2f..2a144a9b 100644 --- a/unittest/internal/CMakeLists.txt +++ b/tests/src/fsfw/tests/internal/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE InternalUnitTester.cpp UnittDefinitions.cpp ) diff --git a/unittest/internal/InternalUnitTester.cpp b/tests/src/fsfw/tests/internal/InternalUnitTester.cpp similarity index 57% rename from unittest/internal/InternalUnitTester.cpp rename to tests/src/fsfw/tests/internal/InternalUnitTester.cpp index a9394ad3..8631ce0d 100644 --- a/unittest/internal/InternalUnitTester.cpp +++ b/tests/src/fsfw/tests/internal/InternalUnitTester.cpp @@ -1,11 +1,11 @@ -#include "InternalUnitTester.h" -#include "UnittDefinitions.h" +#include "fsfw/tests/internal/InternalUnitTester.h" +#include "fsfw/tests/internal/UnittDefinitions.h" -#include "osal/IntTestMq.h" -#include "osal/IntTestSemaphore.h" -#include "osal/IntTestMutex.h" -#include "serialize/IntTestSerialization.h" -#include "globalfunctions/TestArrayPrinter.h" +#include "fsfw/tests/internal/osal/IntTestMq.h" +#include "fsfw/tests/internal/osal/IntTestSemaphore.h" +#include "fsfw/tests/internal/osal/IntTestMutex.h" +#include "fsfw/tests/internal/serialize/IntTestSerialization.h" +#include "fsfw/tests/internal/globalfunctions/TestArrayPrinter.h" #include @@ -13,7 +13,8 @@ InternalUnitTester::InternalUnitTester() {} InternalUnitTester::~InternalUnitTester() {} -ReturnValue_t InternalUnitTester::performTests(struct InternalUnitTester::TestConfig& testConfig) { +ReturnValue_t InternalUnitTester::performTests( + const struct InternalUnitTester::TestConfig& testConfig) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::info << "Running internal unit tests.." << std::endl; #else diff --git a/unittest/internal/InternalUnitTester.h b/tests/src/fsfw/tests/internal/InternalUnitTester.h similarity index 80% rename from unittest/internal/InternalUnitTester.h rename to tests/src/fsfw/tests/internal/InternalUnitTester.h index ae954c6a..50c89d77 100644 --- a/unittest/internal/InternalUnitTester.h +++ b/tests/src/fsfw/tests/internal/InternalUnitTester.h @@ -2,7 +2,7 @@ #define FRAMEWORK_TEST_UNITTESTCLASS_H_ #include "UnittDefinitions.h" -#include "../../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" /** @@ -17,7 +17,7 @@ class InternalUnitTester: public HasReturnvaluesIF { public: struct TestConfig { - bool testArrayPrinter; + bool testArrayPrinter = false; }; InternalUnitTester(); @@ -27,7 +27,7 @@ public: * Some function which calls all other tests * @return */ - virtual ReturnValue_t performTests(struct InternalUnitTester::TestConfig& testConfig); + virtual ReturnValue_t performTests(const struct InternalUnitTester::TestConfig& testConfig); }; diff --git a/unittest/internal/UnittDefinitions.cpp b/tests/src/fsfw/tests/internal/UnittDefinitions.cpp similarity index 87% rename from unittest/internal/UnittDefinitions.cpp rename to tests/src/fsfw/tests/internal/UnittDefinitions.cpp index ed4b59c1..74fd53be 100644 --- a/unittest/internal/UnittDefinitions.cpp +++ b/tests/src/fsfw/tests/internal/UnittDefinitions.cpp @@ -1,4 +1,4 @@ -#include "UnittDefinitions.h" +#include "fsfw/tests/internal/UnittDefinitions.h" ReturnValue_t unitt::put_error(std::string errorId) { #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/unittest/internal/UnittDefinitions.h b/tests/src/fsfw/tests/internal/UnittDefinitions.h similarity index 88% rename from unittest/internal/UnittDefinitions.h rename to tests/src/fsfw/tests/internal/UnittDefinitions.h index 3e14fec5..7e7e06a6 100644 --- a/unittest/internal/UnittDefinitions.h +++ b/tests/src/fsfw/tests/internal/UnittDefinitions.h @@ -1,8 +1,9 @@ #ifndef UNITTEST_INTERNAL_UNITTDEFINITIONS_H_ #define UNITTEST_INTERNAL_UNITTDEFINITIONS_H_ -#include "../../returnvalues/HasReturnvaluesIF.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + #include #include #include diff --git a/tests/src/fsfw/tests/internal/globalfunctions/CMakeLists.txt b/tests/src/fsfw/tests/internal/globalfunctions/CMakeLists.txt new file mode 100644 index 00000000..cde97734 --- /dev/null +++ b/tests/src/fsfw/tests/internal/globalfunctions/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + TestArrayPrinter.cpp +) diff --git a/unittest/internal/globalfunctions/TestArrayPrinter.cpp b/tests/src/fsfw/tests/internal/globalfunctions/TestArrayPrinter.cpp similarity index 94% rename from unittest/internal/globalfunctions/TestArrayPrinter.cpp rename to tests/src/fsfw/tests/internal/globalfunctions/TestArrayPrinter.cpp index de016d19..90578095 100644 --- a/unittest/internal/globalfunctions/TestArrayPrinter.cpp +++ b/tests/src/fsfw/tests/internal/globalfunctions/TestArrayPrinter.cpp @@ -1,4 +1,4 @@ -#include "TestArrayPrinter.h" +#include "fsfw/tests/internal/globalfunctions/TestArrayPrinter.h" void arrayprinter::testArrayPrinter() { { diff --git a/unittest/internal/globalfunctions/TestArrayPrinter.h b/tests/src/fsfw/tests/internal/globalfunctions/TestArrayPrinter.h similarity index 100% rename from unittest/internal/globalfunctions/TestArrayPrinter.h rename to tests/src/fsfw/tests/internal/globalfunctions/TestArrayPrinter.h diff --git a/unittest/internal/osal/CMakeLists.txt b/tests/src/fsfw/tests/internal/osal/CMakeLists.txt similarity index 58% rename from unittest/internal/osal/CMakeLists.txt rename to tests/src/fsfw/tests/internal/osal/CMakeLists.txt index c6f1eb95..84316089 100644 --- a/unittest/internal/osal/CMakeLists.txt +++ b/tests/src/fsfw/tests/internal/osal/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE IntTestMq.cpp IntTestMutex.cpp IntTestSemaphore.cpp diff --git a/unittest/internal/osal/IntTestMq.cpp b/tests/src/fsfw/tests/internal/osal/IntTestMq.cpp similarity index 93% rename from unittest/internal/osal/IntTestMq.cpp rename to tests/src/fsfw/tests/internal/osal/IntTestMq.cpp index fc8e963e..91bc2c6d 100644 --- a/unittest/internal/osal/IntTestMq.cpp +++ b/tests/src/fsfw/tests/internal/osal/IntTestMq.cpp @@ -1,5 +1,5 @@ -#include "IntTestMq.h" -#include +#include "fsfw/tests/internal/osal/IntTestMq.h" +#include "fsfw/tests/internal/UnittDefinitions.h" #include #include @@ -49,5 +49,4 @@ void testmq::testMq() { if(senderId != testSenderMqId) { unitt::put_error(id); } - } diff --git a/unittest/internal/osal/IntTestMq.h b/tests/src/fsfw/tests/internal/osal/IntTestMq.h similarity index 100% rename from unittest/internal/osal/IntTestMq.h rename to tests/src/fsfw/tests/internal/osal/IntTestMq.h diff --git a/unittest/internal/osal/IntTestMutex.cpp b/tests/src/fsfw/tests/internal/osal/IntTestMutex.cpp similarity index 92% rename from unittest/internal/osal/IntTestMutex.cpp rename to tests/src/fsfw/tests/internal/osal/IntTestMutex.cpp index 13d87a8b..9e7c1481 100644 --- a/unittest/internal/osal/IntTestMutex.cpp +++ b/tests/src/fsfw/tests/internal/osal/IntTestMutex.cpp @@ -1,7 +1,7 @@ -#include "IntTestMutex.h" +#include "fsfw/tests/internal/osal/IntTestMutex.h" +#include "fsfw/tests/internal/UnittDefinitions.h" #include -#include #if defined(WIN32) || defined(UNIX) #include diff --git a/unittest/internal/osal/IntTestMutex.h b/tests/src/fsfw/tests/internal/osal/IntTestMutex.h similarity index 100% rename from unittest/internal/osal/IntTestMutex.h rename to tests/src/fsfw/tests/internal/osal/IntTestMutex.h diff --git a/unittest/internal/osal/IntTestSemaphore.cpp b/tests/src/fsfw/tests/internal/osal/IntTestSemaphore.cpp similarity index 96% rename from unittest/internal/osal/IntTestSemaphore.cpp rename to tests/src/fsfw/tests/internal/osal/IntTestSemaphore.cpp index 43990c2c..e278e3c1 100644 --- a/unittest/internal/osal/IntTestSemaphore.cpp +++ b/tests/src/fsfw/tests/internal/osal/IntTestSemaphore.cpp @@ -1,8 +1,8 @@ -#include "IntTestSemaphore.h" -#include +#include "fsfw/tests/internal/osal/IntTestSemaphore.h" +#include "fsfw/tests/internal/UnittDefinitions.h" #include -#include +#include #include #include diff --git a/unittest/internal/osal/IntTestSemaphore.h b/tests/src/fsfw/tests/internal/osal/IntTestSemaphore.h similarity index 100% rename from unittest/internal/osal/IntTestSemaphore.h rename to tests/src/fsfw/tests/internal/osal/IntTestSemaphore.h diff --git a/tests/src/fsfw/tests/internal/serialize/CMakeLists.txt b/tests/src/fsfw/tests/internal/serialize/CMakeLists.txt new file mode 100644 index 00000000..47e8b538 --- /dev/null +++ b/tests/src/fsfw/tests/internal/serialize/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + IntTestSerialization.cpp +) diff --git a/unittest/internal/serialize/IntTestSerialization.cpp b/tests/src/fsfw/tests/internal/serialize/IntTestSerialization.cpp similarity index 98% rename from unittest/internal/serialize/IntTestSerialization.cpp rename to tests/src/fsfw/tests/internal/serialize/IntTestSerialization.cpp index 69d82942..3489c759 100644 --- a/unittest/internal/serialize/IntTestSerialization.cpp +++ b/tests/src/fsfw/tests/internal/serialize/IntTestSerialization.cpp @@ -1,5 +1,5 @@ -#include "IntTestSerialization.h" -#include +#include "fsfw/tests/internal/serialize/IntTestSerialization.h" +#include "fsfw/tests/internal/UnittDefinitions.h" #include #include diff --git a/unittest/internal/serialize/IntTestSerialization.h b/tests/src/fsfw/tests/internal/serialize/IntTestSerialization.h similarity index 88% rename from unittest/internal/serialize/IntTestSerialization.h rename to tests/src/fsfw/tests/internal/serialize/IntTestSerialization.h index 8706e057..0767fb44 100644 --- a/unittest/internal/serialize/IntTestSerialization.h +++ b/tests/src/fsfw/tests/internal/serialize/IntTestSerialization.h @@ -1,7 +1,7 @@ #ifndef FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_ #define FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_ -#include "../../../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include namespace testserialize { diff --git a/unittest/tests/CMakeLists.txt b/tests/src/fsfw/tests/unit/CMakeLists.txt similarity index 72% rename from unittest/tests/CMakeLists.txt rename to tests/src/fsfw/tests/unit/CMakeLists.txt index 180e1a51..255063f3 100644 --- a/unittest/tests/CMakeLists.txt +++ b/tests/src/fsfw/tests/unit/CMakeLists.txt @@ -4,4 +4,5 @@ add_subdirectory(osal) add_subdirectory(serialize) add_subdirectory(datapoollocal) add_subdirectory(storagemanager) - +add_subdirectory(globalfunctions) +add_subdirectory(tmtcpacket) diff --git a/unittest/tests/action/CMakeLists.txt b/tests/src/fsfw/tests/unit/action/CMakeLists.txt similarity index 100% rename from unittest/tests/action/CMakeLists.txt rename to tests/src/fsfw/tests/unit/action/CMakeLists.txt diff --git a/unittest/tests/action/TestActionHelper.cpp b/tests/src/fsfw/tests/unit/action/TestActionHelper.cpp similarity index 100% rename from unittest/tests/action/TestActionHelper.cpp rename to tests/src/fsfw/tests/unit/action/TestActionHelper.cpp diff --git a/unittest/tests/action/TestActionHelper.h b/tests/src/fsfw/tests/unit/action/TestActionHelper.h similarity index 100% rename from unittest/tests/action/TestActionHelper.h rename to tests/src/fsfw/tests/unit/action/TestActionHelper.h diff --git a/unittest/tests/container/CMakeLists.txt b/tests/src/fsfw/tests/unit/container/CMakeLists.txt similarity index 100% rename from unittest/tests/container/CMakeLists.txt rename to tests/src/fsfw/tests/unit/container/CMakeLists.txt diff --git a/unittest/tests/container/RingBufferTest.cpp b/tests/src/fsfw/tests/unit/container/RingBufferTest.cpp similarity index 100% rename from unittest/tests/container/RingBufferTest.cpp rename to tests/src/fsfw/tests/unit/container/RingBufferTest.cpp diff --git a/unittest/tests/container/TestArrayList.cpp b/tests/src/fsfw/tests/unit/container/TestArrayList.cpp similarity index 100% rename from unittest/tests/container/TestArrayList.cpp rename to tests/src/fsfw/tests/unit/container/TestArrayList.cpp diff --git a/unittest/tests/container/TestDynamicFifo.cpp b/tests/src/fsfw/tests/unit/container/TestDynamicFifo.cpp similarity index 100% rename from unittest/tests/container/TestDynamicFifo.cpp rename to tests/src/fsfw/tests/unit/container/TestDynamicFifo.cpp diff --git a/unittest/tests/container/TestFifo.cpp b/tests/src/fsfw/tests/unit/container/TestFifo.cpp similarity index 100% rename from unittest/tests/container/TestFifo.cpp rename to tests/src/fsfw/tests/unit/container/TestFifo.cpp diff --git a/unittest/tests/container/TestFixedArrayList.cpp b/tests/src/fsfw/tests/unit/container/TestFixedArrayList.cpp similarity index 100% rename from unittest/tests/container/TestFixedArrayList.cpp rename to tests/src/fsfw/tests/unit/container/TestFixedArrayList.cpp diff --git a/unittest/tests/container/TestFixedMap.cpp b/tests/src/fsfw/tests/unit/container/TestFixedMap.cpp similarity index 100% rename from unittest/tests/container/TestFixedMap.cpp rename to tests/src/fsfw/tests/unit/container/TestFixedMap.cpp diff --git a/unittest/tests/container/TestFixedOrderedMultimap.cpp b/tests/src/fsfw/tests/unit/container/TestFixedOrderedMultimap.cpp similarity index 100% rename from unittest/tests/container/TestFixedOrderedMultimap.cpp rename to tests/src/fsfw/tests/unit/container/TestFixedOrderedMultimap.cpp diff --git a/unittest/tests/container/TestPlacementFactory.cpp b/tests/src/fsfw/tests/unit/container/TestPlacementFactory.cpp similarity index 100% rename from unittest/tests/container/TestPlacementFactory.cpp rename to tests/src/fsfw/tests/unit/container/TestPlacementFactory.cpp diff --git a/unittest/tests/datapoollocal/CMakeLists.txt b/tests/src/fsfw/tests/unit/datapoollocal/CMakeLists.txt similarity index 100% rename from unittest/tests/datapoollocal/CMakeLists.txt rename to tests/src/fsfw/tests/unit/datapoollocal/CMakeLists.txt diff --git a/unittest/tests/datapoollocal/DataSetTest.cpp b/tests/src/fsfw/tests/unit/datapoollocal/DataSetTest.cpp similarity index 100% rename from unittest/tests/datapoollocal/DataSetTest.cpp rename to tests/src/fsfw/tests/unit/datapoollocal/DataSetTest.cpp diff --git a/unittest/tests/datapoollocal/LocalPoolManagerTest.cpp b/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolManagerTest.cpp similarity index 100% rename from unittest/tests/datapoollocal/LocalPoolManagerTest.cpp rename to tests/src/fsfw/tests/unit/datapoollocal/LocalPoolManagerTest.cpp diff --git a/unittest/tests/datapoollocal/LocalPoolOwnerBase.cpp b/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.cpp similarity index 100% rename from unittest/tests/datapoollocal/LocalPoolOwnerBase.cpp rename to tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.cpp diff --git a/unittest/tests/datapoollocal/LocalPoolOwnerBase.h b/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.h similarity index 100% rename from unittest/tests/datapoollocal/LocalPoolOwnerBase.h rename to tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.h diff --git a/unittest/tests/datapoollocal/LocalPoolVariableTest.cpp b/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolVariableTest.cpp similarity index 100% rename from unittest/tests/datapoollocal/LocalPoolVariableTest.cpp rename to tests/src/fsfw/tests/unit/datapoollocal/LocalPoolVariableTest.cpp diff --git a/unittest/tests/datapoollocal/LocalPoolVectorTest.cpp b/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolVectorTest.cpp similarity index 100% rename from unittest/tests/datapoollocal/LocalPoolVectorTest.cpp rename to tests/src/fsfw/tests/unit/datapoollocal/LocalPoolVectorTest.cpp diff --git a/unittest/internal/globalfunctions/CMakeLists.txt b/tests/src/fsfw/tests/unit/globalfunctions/CMakeLists.txt similarity index 100% rename from unittest/internal/globalfunctions/CMakeLists.txt rename to tests/src/fsfw/tests/unit/globalfunctions/CMakeLists.txt diff --git a/unittest/tests/mocks/HkReceiverMock.h b/tests/src/fsfw/tests/unit/mocks/HkReceiverMock.h similarity index 100% rename from unittest/tests/mocks/HkReceiverMock.h rename to tests/src/fsfw/tests/unit/mocks/HkReceiverMock.h diff --git a/unittest/tests/mocks/MessageQueueMockBase.h b/tests/src/fsfw/tests/unit/mocks/MessageQueueMockBase.h similarity index 100% rename from unittest/tests/mocks/MessageQueueMockBase.h rename to tests/src/fsfw/tests/unit/mocks/MessageQueueMockBase.h diff --git a/unittest/tests/osal/CMakeLists.txt b/tests/src/fsfw/tests/unit/osal/CMakeLists.txt similarity index 100% rename from unittest/tests/osal/CMakeLists.txt rename to tests/src/fsfw/tests/unit/osal/CMakeLists.txt diff --git a/unittest/tests/osal/TestMessageQueue.cpp b/tests/src/fsfw/tests/unit/osal/TestMessageQueue.cpp similarity index 100% rename from unittest/tests/osal/TestMessageQueue.cpp rename to tests/src/fsfw/tests/unit/osal/TestMessageQueue.cpp diff --git a/unittest/tests/osal/TestSemaphore.cpp b/tests/src/fsfw/tests/unit/osal/TestSemaphore.cpp similarity index 100% rename from unittest/tests/osal/TestSemaphore.cpp rename to tests/src/fsfw/tests/unit/osal/TestSemaphore.cpp diff --git a/unittest/tests/serialize/CMakeLists.txt b/tests/src/fsfw/tests/unit/serialize/CMakeLists.txt similarity index 100% rename from unittest/tests/serialize/CMakeLists.txt rename to tests/src/fsfw/tests/unit/serialize/CMakeLists.txt diff --git a/unittest/tests/serialize/TestSerialBufferAdapter.cpp b/tests/src/fsfw/tests/unit/serialize/TestSerialBufferAdapter.cpp similarity index 100% rename from unittest/tests/serialize/TestSerialBufferAdapter.cpp rename to tests/src/fsfw/tests/unit/serialize/TestSerialBufferAdapter.cpp diff --git a/unittest/tests/serialize/TestSerialLinkedPacket.cpp b/tests/src/fsfw/tests/unit/serialize/TestSerialLinkedPacket.cpp similarity index 100% rename from unittest/tests/serialize/TestSerialLinkedPacket.cpp rename to tests/src/fsfw/tests/unit/serialize/TestSerialLinkedPacket.cpp diff --git a/unittest/tests/serialize/TestSerialLinkedPacket.h b/tests/src/fsfw/tests/unit/serialize/TestSerialLinkedPacket.h similarity index 100% rename from unittest/tests/serialize/TestSerialLinkedPacket.h rename to tests/src/fsfw/tests/unit/serialize/TestSerialLinkedPacket.h diff --git a/unittest/tests/serialize/TestSerialization.cpp b/tests/src/fsfw/tests/unit/serialize/TestSerialization.cpp similarity index 100% rename from unittest/tests/serialize/TestSerialization.cpp rename to tests/src/fsfw/tests/unit/serialize/TestSerialization.cpp diff --git a/unittest/tests/storagemanager/CMakeLists.txt b/tests/src/fsfw/tests/unit/storagemanager/CMakeLists.txt similarity index 100% rename from unittest/tests/storagemanager/CMakeLists.txt rename to tests/src/fsfw/tests/unit/storagemanager/CMakeLists.txt diff --git a/unittest/tests/storagemanager/TestNewAccessor.cpp b/tests/src/fsfw/tests/unit/storagemanager/TestNewAccessor.cpp similarity index 100% rename from unittest/tests/storagemanager/TestNewAccessor.cpp rename to tests/src/fsfw/tests/unit/storagemanager/TestNewAccessor.cpp diff --git a/unittest/tests/storagemanager/TestPool.cpp b/tests/src/fsfw/tests/unit/storagemanager/TestPool.cpp similarity index 100% rename from unittest/tests/storagemanager/TestPool.cpp rename to tests/src/fsfw/tests/unit/storagemanager/TestPool.cpp diff --git a/unittest/tests/tmtcpacket/CMakeLists.txt b/tests/src/fsfw/tests/unit/tmtcpacket/CMakeLists.txt similarity index 100% rename from unittest/tests/tmtcpacket/CMakeLists.txt rename to tests/src/fsfw/tests/unit/tmtcpacket/CMakeLists.txt diff --git a/unittest/tests/tmtcpacket/PusTmTest.cpp b/tests/src/fsfw/tests/unit/tmtcpacket/PusTmTest.cpp similarity index 100% rename from unittest/tests/tmtcpacket/PusTmTest.cpp rename to tests/src/fsfw/tests/unit/tmtcpacket/PusTmTest.cpp diff --git a/unittest/user/CMakeLists.txt b/tests/user/CMakeLists.txt similarity index 100% rename from unittest/user/CMakeLists.txt rename to tests/user/CMakeLists.txt diff --git a/unittest/README.md b/tests/user/README.md similarity index 100% rename from unittest/README.md rename to tests/user/README.md diff --git a/unittest/lcov.sh b/tests/user/lcov.sh similarity index 100% rename from unittest/lcov.sh rename to tests/user/lcov.sh diff --git a/unittest/user/testcfg/CMakeLists.txt b/tests/user/testcfg/CMakeLists.txt similarity index 100% rename from unittest/user/testcfg/CMakeLists.txt rename to tests/user/testcfg/CMakeLists.txt diff --git a/unittest/user/testcfg/FSFWConfig.h b/tests/user/testcfg/FSFWConfig.h similarity index 100% rename from unittest/user/testcfg/FSFWConfig.h rename to tests/user/testcfg/FSFWConfig.h diff --git a/unittest/user/testcfg/Makefile-FSFW-Tests b/tests/user/testcfg/Makefile-FSFW-Tests similarity index 100% rename from unittest/user/testcfg/Makefile-FSFW-Tests rename to tests/user/testcfg/Makefile-FSFW-Tests diff --git a/unittest/user/testcfg/TestsConfig.h b/tests/user/testcfg/TestsConfig.h similarity index 100% rename from unittest/user/testcfg/TestsConfig.h rename to tests/user/testcfg/TestsConfig.h diff --git a/unittest/user/testcfg/cdatapool/dataPoolInit.cpp b/tests/user/testcfg/cdatapool/dataPoolInit.cpp similarity index 100% rename from unittest/user/testcfg/cdatapool/dataPoolInit.cpp rename to tests/user/testcfg/cdatapool/dataPoolInit.cpp diff --git a/unittest/user/testcfg/cdatapool/dataPoolInit.h b/tests/user/testcfg/cdatapool/dataPoolInit.h similarity index 100% rename from unittest/user/testcfg/cdatapool/dataPoolInit.h rename to tests/user/testcfg/cdatapool/dataPoolInit.h diff --git a/unittest/user/testcfg/devices/logicalAddresses.cpp b/tests/user/testcfg/devices/logicalAddresses.cpp similarity index 100% rename from unittest/user/testcfg/devices/logicalAddresses.cpp rename to tests/user/testcfg/devices/logicalAddresses.cpp diff --git a/unittest/user/testcfg/devices/logicalAddresses.h b/tests/user/testcfg/devices/logicalAddresses.h similarity index 100% rename from unittest/user/testcfg/devices/logicalAddresses.h rename to tests/user/testcfg/devices/logicalAddresses.h diff --git a/unittest/user/testcfg/devices/powerSwitcherList.cpp b/tests/user/testcfg/devices/powerSwitcherList.cpp similarity index 100% rename from unittest/user/testcfg/devices/powerSwitcherList.cpp rename to tests/user/testcfg/devices/powerSwitcherList.cpp diff --git a/unittest/user/testcfg/devices/powerSwitcherList.h b/tests/user/testcfg/devices/powerSwitcherList.h similarity index 100% rename from unittest/user/testcfg/devices/powerSwitcherList.h rename to tests/user/testcfg/devices/powerSwitcherList.h diff --git a/unittest/user/testcfg/events/subsystemIdRanges.h b/tests/user/testcfg/events/subsystemIdRanges.h similarity index 100% rename from unittest/user/testcfg/events/subsystemIdRanges.h rename to tests/user/testcfg/events/subsystemIdRanges.h diff --git a/unittest/user/testcfg/ipc/MissionMessageTypes.cpp b/tests/user/testcfg/ipc/MissionMessageTypes.cpp similarity index 100% rename from unittest/user/testcfg/ipc/MissionMessageTypes.cpp rename to tests/user/testcfg/ipc/MissionMessageTypes.cpp diff --git a/unittest/user/testcfg/ipc/MissionMessageTypes.h b/tests/user/testcfg/ipc/MissionMessageTypes.h similarity index 100% rename from unittest/user/testcfg/ipc/MissionMessageTypes.h rename to tests/user/testcfg/ipc/MissionMessageTypes.h diff --git a/unittest/user/testcfg/objects/systemObjectList.h b/tests/user/testcfg/objects/systemObjectList.h similarity index 100% rename from unittest/user/testcfg/objects/systemObjectList.h rename to tests/user/testcfg/objects/systemObjectList.h diff --git a/unittest/user/testcfg/pollingsequence/PollingSequenceFactory.cpp b/tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp similarity index 100% rename from unittest/user/testcfg/pollingsequence/PollingSequenceFactory.cpp rename to tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp diff --git a/unittest/user/testcfg/pollingsequence/PollingSequenceFactory.h b/tests/user/testcfg/pollingsequence/PollingSequenceFactory.h similarity index 100% rename from unittest/user/testcfg/pollingsequence/PollingSequenceFactory.h rename to tests/user/testcfg/pollingsequence/PollingSequenceFactory.h diff --git a/unittest/user/testcfg/returnvalues/classIds.h b/tests/user/testcfg/returnvalues/classIds.h similarity index 100% rename from unittest/user/testcfg/returnvalues/classIds.h rename to tests/user/testcfg/returnvalues/classIds.h diff --git a/unittest/user/testcfg/testcfg.mk b/tests/user/testcfg/testcfg.mk similarity index 100% rename from unittest/user/testcfg/testcfg.mk rename to tests/user/testcfg/testcfg.mk diff --git a/unittest/user/testcfg/tmtc/apid.h b/tests/user/testcfg/tmtc/apid.h similarity index 100% rename from unittest/user/testcfg/tmtc/apid.h rename to tests/user/testcfg/tmtc/apid.h diff --git a/unittest/user/testcfg/tmtc/pusIds.h b/tests/user/testcfg/tmtc/pusIds.h similarity index 100% rename from unittest/user/testcfg/tmtc/pusIds.h rename to tests/user/testcfg/tmtc/pusIds.h diff --git a/unittest/user/testtemplate/TestTemplate.cpp b/tests/user/testtemplate/TestTemplate.cpp similarity index 100% rename from unittest/user/testtemplate/TestTemplate.cpp rename to tests/user/testtemplate/TestTemplate.cpp diff --git a/unittest/user/unittest/CMakeLists.txt b/tests/user/unittest/CMakeLists.txt similarity index 100% rename from unittest/user/unittest/CMakeLists.txt rename to tests/user/unittest/CMakeLists.txt diff --git a/unittest/user/unittest/core/CMakeLists.txt b/tests/user/unittest/core/CMakeLists.txt similarity index 100% rename from unittest/user/unittest/core/CMakeLists.txt rename to tests/user/unittest/core/CMakeLists.txt diff --git a/unittest/user/unittest/core/CatchDefinitions.cpp b/tests/user/unittest/core/CatchDefinitions.cpp similarity index 100% rename from unittest/user/unittest/core/CatchDefinitions.cpp rename to tests/user/unittest/core/CatchDefinitions.cpp diff --git a/unittest/user/unittest/core/CatchDefinitions.h b/tests/user/unittest/core/CatchDefinitions.h similarity index 100% rename from unittest/user/unittest/core/CatchDefinitions.h rename to tests/user/unittest/core/CatchDefinitions.h diff --git a/unittest/user/unittest/core/CatchFactory.cpp b/tests/user/unittest/core/CatchFactory.cpp similarity index 100% rename from unittest/user/unittest/core/CatchFactory.cpp rename to tests/user/unittest/core/CatchFactory.cpp diff --git a/unittest/user/unittest/core/CatchFactory.h b/tests/user/unittest/core/CatchFactory.h similarity index 100% rename from unittest/user/unittest/core/CatchFactory.h rename to tests/user/unittest/core/CatchFactory.h diff --git a/unittest/user/unittest/core/CatchRunner.cpp b/tests/user/unittest/core/CatchRunner.cpp similarity index 100% rename from unittest/user/unittest/core/CatchRunner.cpp rename to tests/user/unittest/core/CatchRunner.cpp diff --git a/unittest/user/unittest/core/CatchSetup.cpp b/tests/user/unittest/core/CatchSetup.cpp similarity index 100% rename from unittest/user/unittest/core/CatchSetup.cpp rename to tests/user/unittest/core/CatchSetup.cpp diff --git a/unittest/user/unittest/core/core.mk b/tests/user/unittest/core/core.mk similarity index 100% rename from unittest/user/unittest/core/core.mk rename to tests/user/unittest/core/core.mk diff --git a/unittest/user/unittest/core/printChar.cpp b/tests/user/unittest/core/printChar.cpp similarity index 100% rename from unittest/user/unittest/core/printChar.cpp rename to tests/user/unittest/core/printChar.cpp diff --git a/unittest/user/unittest/core/printChar.h b/tests/user/unittest/core/printChar.h similarity index 100% rename from unittest/user/unittest/core/printChar.h rename to tests/user/unittest/core/printChar.h diff --git a/tmtcpacket/pus/PacketTimestampInterpreterIF.h b/tmtcpacket/pus/PacketTimestampInterpreterIF.h deleted file mode 100644 index 40e7a2ea..00000000 --- a/tmtcpacket/pus/PacketTimestampInterpreterIF.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef FRAMEWORK_TMTCPACKET_PUS_PACKETTIMESTAMPINTERPRETERIF_H_ -#define FRAMEWORK_TMTCPACKET_PUS_PACKETTIMESTAMPINTERPRETERIF_H_ - -#include "../../returnvalues/HasReturnvaluesIF.h" -class TmPacketMinimal; - -class PacketTimestampInterpreterIF { -public: - virtual ~PacketTimestampInterpreterIF() {} - virtual ReturnValue_t getPacketTime(TmPacketMinimal* packet, - timeval* timestamp) const = 0; - virtual ReturnValue_t getPacketTimeRaw(TmPacketMinimal* packet, const uint8_t** timePtr, uint32_t* size) const = 0; -}; - - - -#endif /* FRAMEWORK_TMTCPACKET_PUS_PACKETTIMESTAMPINTERPRETERIF_H_ */ diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt deleted file mode 100644 index 24f8ef6f..00000000 --- a/unittest/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_subdirectory(internal) - -if(LINK_CATCH2) - add_subdirectory(tests) -endif() \ No newline at end of file diff --git a/unittest/internal/internal.mk b/unittest/internal/internal.mk deleted file mode 100644 index 1d4c9c99..00000000 --- a/unittest/internal/internal.mk +++ /dev/null @@ -1,4 +0,0 @@ -CXXSRC += $(wildcard $(CURRENTPATH)/osal/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/serialize/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/globalfunctions/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/*.cpp) \ No newline at end of file diff --git a/unittest/internal/serialize/CMakeLists.txt b/unittest/internal/serialize/CMakeLists.txt deleted file mode 100644 index e8dc5717..00000000 --- a/unittest/internal/serialize/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -target_sources(${TARGET_NAME} PRIVATE - IntTestSerialization.cpp -) diff --git a/unittest/tests/globalfunctions/CMakeLists.txt b/unittest/tests/globalfunctions/CMakeLists.txt deleted file mode 100644 index 4ea49bf7..00000000 --- a/unittest/tests/globalfunctions/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -target_sources(${TARGET_NAME} PRIVATE - TestArrayPrinter.cpp -) diff --git a/unittest/tests/tests.mk b/unittest/tests/tests.mk deleted file mode 100644 index 47e634a2..00000000 --- a/unittest/tests/tests.mk +++ /dev/null @@ -1,8 +0,0 @@ -CXXSRC += $(wildcard $(CURRENTPATH)/container/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/action/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/serialize/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/storagemanager/*.cpp) - -# OSAL not included for now. - -INCLUDES += $(CURRENTPATH) \ No newline at end of file diff --git a/unittest/user/unlockRealtime.sh b/unittest/user/unlockRealtime.sh deleted file mode 100644 index b28d5490..00000000 --- a/unittest/user/unlockRealtime.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Run this script to unlock all permissions to run the linux binaries -# and create threads - -binaries=$(find $directory -type f -name "*.elf") - -echo Unlocking real time permissions for binaries and bash console... - -# Set up the soft realtime limit to maximum (99) -# Please note that the hard limit needs to be set to 99 too -# for this to work (check with ulimit -Hr). -# If that has not been done yet, add -# hard rtprio 99 -# to /etc/security/limits.conf -# It is also necessary and recommended to add -# soft rtprio 99 -# as well. This can also be done in the command line -# but would need to be done for each session. -ulimit -Sr 99 - -for binary in ${binaries}; do - sudo setcap 'cap_sys_nice=eip' ${binary} - result=$? - if [ ${result} = 0 ];then - echo ${binary} was unlocked - fi -done - -# sudo setcap 'cap_sys_nice=eip' /bin/bash -# result=$? -# if [ ${result} = 0 ];then -# echo /bin/bash was unlocked -# fi -