From 9ddea586ead7c498cc8faf1e5826f9c60c70b73f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Oct 2021 18:15:39 +0200 Subject: [PATCH 01/37] updated build scripts --- Justfile | 9 +++++++++ cmake/scripts/Host/make-debug-cfg.sh | 2 +- cmake/scripts/Host/make-release-cfg.sh | 2 +- cmake/scripts/Host/ninja-debug-cfg.sh | 2 +- cmake/scripts/Linux/make-debug-cfg.sh | 2 +- cmake/scripts/Linux/ninja-debug-cfg.sh | 2 +- cmake/scripts/Q7S/make-debug-cfg.sh | 4 +--- cmake/scripts/Q7S/make-release-cfg.sh | 4 +--- cmake/scripts/Q7S/ninja-debug-cfg.sh | 2 +- cmake/scripts/Q7S/ninja-release-cfg.sh | 2 +- cmake/scripts/RPi/make-debug-cfg.sh | 4 +--- cmake/scripts/RPi/ninja-debug-cfg.sh | 2 +- cmake/scripts/cmake-build-cfg.py | 14 ++++++++++++-- common/config/commonConfig.cpp | 2 +- fsfw | 2 +- mission/core/GenericFactory.cpp | 2 +- tmtc | 2 +- 17 files changed, 36 insertions(+), 23 deletions(-) create mode 100644 Justfile diff --git a/Justfile b/Justfile new file mode 100644 index 00000000..f9d9504b --- /dev/null +++ b/Justfile @@ -0,0 +1,9 @@ +python_script := './cmake/scripts/cmake-build-cfg.py' + +default: q7s-debug-make + +q7s-debug-make: + {{python_script}} -o linux -g make -b debug -t "arm/q7s" -l build-Debug-Q7S + +q7s-debug-ninja: + {{python_script}} -o linux -g ninja -b debug -t "arm/q7s" -l build-Debug-Q7S diff --git a/cmake/scripts/Host/make-debug-cfg.sh b/cmake/scripts/Host/make-debug-cfg.sh index 3bda2da2..de0487ea 100755 --- a/cmake/scripts/Host/make-debug-cfg.sh +++ b/cmake/scripts/Host/make-debug-cfg.sh @@ -15,7 +15,7 @@ if [ "${counter}" -ge 5 ];then exit 1 fi -build_generator="Unix Makefiles" +build_generator="make" os_fsfw="host" builddir="build-Debug-Host" if [ "${OS}" = "Windows_NT" ]; then diff --git a/cmake/scripts/Host/make-release-cfg.sh b/cmake/scripts/Host/make-release-cfg.sh index eb0a9f57..5114f490 100755 --- a/cmake/scripts/Host/make-release-cfg.sh +++ b/cmake/scripts/Host/make-release-cfg.sh @@ -15,7 +15,7 @@ if [ "${counter}" -ge 5 ];then exit 1 fi -build_generator="Unix Makefiles" +build_generator="make" os_fsfw="host" builddir="build-Release-Host" if [ "${OS}" = "Windows_NT" ]; then diff --git a/cmake/scripts/Host/ninja-debug-cfg.sh b/cmake/scripts/Host/ninja-debug-cfg.sh index d1627174..80a5687f 100755 --- a/cmake/scripts/Host/ninja-debug-cfg.sh +++ b/cmake/scripts/Host/ninja-debug-cfg.sh @@ -15,7 +15,7 @@ if [ "${counter}" -ge 5 ];then exit 1 fi -build_generator="Ninja" +build_generator="ninja" os_fsfw="host" builddir="build-Debug-Host" if [ "${OS}" = "Windows_NT" ]; then diff --git a/cmake/scripts/Linux/make-debug-cfg.sh b/cmake/scripts/Linux/make-debug-cfg.sh index e2130416..2207a2e8 100755 --- a/cmake/scripts/Linux/make-debug-cfg.sh +++ b/cmake/scripts/Linux/make-debug-cfg.sh @@ -15,7 +15,7 @@ if [ "${counter}" -ge 5 ];then exit 1 fi -build_generator="Unix Makefiles" +build_generator="make" os_fsfw="linux" builddir="build-Debug-Host" if [ "${OS}" = "Windows_NT" ]; then diff --git a/cmake/scripts/Linux/ninja-debug-cfg.sh b/cmake/scripts/Linux/ninja-debug-cfg.sh index 905612e0..23ebc25d 100755 --- a/cmake/scripts/Linux/ninja-debug-cfg.sh +++ b/cmake/scripts/Linux/ninja-debug-cfg.sh @@ -15,7 +15,7 @@ if [ "${counter}" -ge 5 ];then exit 1 fi -build_generator="Ninja" +build_generator="ninja" os_fsfw="linux" builddir="build-Debug-Host" if [ "${OS}" = "Windows_NT" ]; then diff --git a/cmake/scripts/Q7S/make-debug-cfg.sh b/cmake/scripts/Q7S/make-debug-cfg.sh index c0807320..f3cfd81c 100755 --- a/cmake/scripts/Q7S/make-debug-cfg.sh +++ b/cmake/scripts/Q7S/make-debug-cfg.sh @@ -18,13 +18,11 @@ fi os_fsfw="linux" tgt_bsp="arm/q7s" build_dir="build-Debug-Q7S" -build_generator="" +build_generator="make" if [ "${OS}" = "Windows_NT" ]; then - build_generator="MinGW Makefiles" python="py" # Could be other OS but this works for now. else - build_generator="Unix Makefiles" python="python3" fi diff --git a/cmake/scripts/Q7S/make-release-cfg.sh b/cmake/scripts/Q7S/make-release-cfg.sh index c421f336..d71dcc83 100755 --- a/cmake/scripts/Q7S/make-release-cfg.sh +++ b/cmake/scripts/Q7S/make-release-cfg.sh @@ -18,13 +18,11 @@ fi os_fsfw="linux" tgt_bsp="arm/q7s" build_dir="build-Debug-Q7S" -build_generator="" +build_generator="make" if [ "${OS}" = "Windows_NT" ]; then - build_generator="MinGW Makefiles" python="py" # Could be other OS but this works for now. else - build_generator="Unix Makefiles" python="python3" fi diff --git a/cmake/scripts/Q7S/ninja-debug-cfg.sh b/cmake/scripts/Q7S/ninja-debug-cfg.sh index 9a6b35c8..bd9ebb4e 100755 --- a/cmake/scripts/Q7S/ninja-debug-cfg.sh +++ b/cmake/scripts/Q7S/ninja-debug-cfg.sh @@ -18,7 +18,7 @@ fi os_fsfw="linux" tgt_bsp="arm/q7s" build_dir="build-Debug-Q7S" -build_generator="Ninja" +build_generator="ninja" if [ "${OS}" = "Windows_NT" ]; then python="py" # Could be other OS but this works for now. diff --git a/cmake/scripts/Q7S/ninja-release-cfg.sh b/cmake/scripts/Q7S/ninja-release-cfg.sh index a9c82d54..c9972c89 100755 --- a/cmake/scripts/Q7S/ninja-release-cfg.sh +++ b/cmake/scripts/Q7S/ninja-release-cfg.sh @@ -18,7 +18,7 @@ fi os_fsfw="linux" tgt_bsp="arm/q7s" build_dir="build-Release-Q7S" -build_generator="Ninja" +build_generator="ninja" if [ "${OS}" = "Windows_NT" ]; then python="py" # Could be other OS but this works for now. diff --git a/cmake/scripts/RPi/make-debug-cfg.sh b/cmake/scripts/RPi/make-debug-cfg.sh index 3b95ceee..f4d006c3 100755 --- a/cmake/scripts/RPi/make-debug-cfg.sh +++ b/cmake/scripts/RPi/make-debug-cfg.sh @@ -18,14 +18,12 @@ fi os_fsfw="linux" tgt_bsp="arm/raspberrypi" -build_generator="" +build_generator="make" build_dir="build-Debug-RPi" if [ "${OS}" = "Windows_NT" ]; then - build_generator="MinGW Makefiles" python="py" # Could be other OS but this works for now. else - build_generator="Unix Makefiles" python="python3" fi diff --git a/cmake/scripts/RPi/ninja-debug-cfg.sh b/cmake/scripts/RPi/ninja-debug-cfg.sh index 4cfb9854..13096fd6 100755 --- a/cmake/scripts/RPi/ninja-debug-cfg.sh +++ b/cmake/scripts/RPi/ninja-debug-cfg.sh @@ -17,7 +17,7 @@ fi os_fsfw="linux" tgt_bsp="arm/raspberrypi" -build_generator="Ninja" +build_generator="ninja" build_dir="build-Debug-RPi" if [ "${OS}" = "Windows_NT" ]; then python="py" diff --git a/cmake/scripts/cmake-build-cfg.py b/cmake/scripts/cmake-build-cfg.py index e3259fd4..5d1b1048 100755 --- a/cmake/scripts/cmake-build-cfg.py +++ b/cmake/scripts/cmake-build-cfg.py @@ -29,7 +29,9 @@ def main(): "Information)", default="debug" ) parser.add_argument("-l", "--builddir", type=str, help="Specify build directory.") - parser.add_argument("-g", "--generator", type=str, help="CMake Generator") + parser.add_argument( + "-g", "--generator", type=str, help="CMake Generator", choices=['make', 'ninja'] + ) parser.add_argument( "-d", "--defines", help="Additional custom defines passed to CMake (supply without -D prefix!)", @@ -56,7 +58,15 @@ def main(): if args.generator is None: generator_cmake_arg = "" else: - generator_cmake_arg = f"-G \"{args.generator}\"" + if args.generator == 'make': + if os.name == 'nt': + generator_cmake_arg = '-G "MinGW Makefiles"' + else: + generator_cmake_arg = '-G "Unix Makefiles"' + elif args.generator == 'ninja': + generator_cmake_arg = '-G Ninja' + else: + generator_cmake_arg = args.generator if args.buildtype == "debug": cmake_build_type = "Debug" diff --git a/common/config/commonConfig.cpp b/common/config/commonConfig.cpp index 1c9ece8b..97690e09 100644 --- a/common/config/commonConfig.cpp +++ b/common/config/commonConfig.cpp @@ -2,4 +2,4 @@ #include "tmtc/apid.h" #include "fsfw/tmtcpacket/SpacePacket.h" -const uint16_t common::TC_PACKET_ID = spacepacket::getTcSpacePacketIdFromApid(apid::EIVE_OBSW); +constexpr uint16_t common::PUS_PACKET_ID = spacepacket::getTcSpacePacketIdFromApid(apid::EIVE_OBSW); diff --git a/fsfw b/fsfw index eba2f87b..e29606a2 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit eba2f87b36429fc814f9d4768c68fd2827f4c410 +Subproject commit e29606a2d07ff2fcad77e99493ec3765816e646b diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index a0939f1c..58485b71 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -110,7 +110,7 @@ void ObjectFactory::produceGenericObjects() { tmtcBridge->setMaxNumberOfPacketsStored(50); auto tcpServer = new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); // TCP is stream based. Use packet ID as start marker when parsing for space packets - tcpServer->setSpacePacketParsingOptions({common::TC_PACKET_ID}); + tcpServer->setSpacePacketParsingOptions({common::PUS_PACKET_ID}); sif::info << "Created TCP server for TMTC commanding with listener port " << tcpServer->getTcpPort() << std::endl; #endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */ diff --git a/tmtc b/tmtc index b2cc2354..edcaf2e9 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b2cc2354d410b0bc0d80c481bfd37afc580e63cf +Subproject commit edcaf2e9c323cbda2ef331e93cc04985f44c6855 From 46dcc18ddbc67e1b2dfc84988066f16a500cd4ed Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Oct 2021 18:23:26 +0200 Subject: [PATCH 02/37] updated constants --- common/config/commonConfig.cpp | 2 +- common/config/commonConfig.h.in | 2 +- fsfw | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/config/commonConfig.cpp b/common/config/commonConfig.cpp index 97690e09..31674512 100644 --- a/common/config/commonConfig.cpp +++ b/common/config/commonConfig.cpp @@ -2,4 +2,4 @@ #include "tmtc/apid.h" #include "fsfw/tmtcpacket/SpacePacket.h" -constexpr uint16_t common::PUS_PACKET_ID = spacepacket::getTcSpacePacketIdFromApid(apid::EIVE_OBSW); +const uint16_t common::PUS_PACKET_ID = spacepacket::getTcSpacePacketIdFromApid(apid::EIVE_OBSW); diff --git a/common/config/commonConfig.h.in b/common/config/commonConfig.h.in index 6dad37d5..c18d4bff 100644 --- a/common/config/commonConfig.h.in +++ b/common/config/commonConfig.h.in @@ -15,7 +15,7 @@ #define OBSW_USE_TCP_BRIDGE 1 namespace common { -extern const uint16_t TC_PACKET_ID; +extern const uint16_t PUS_PACKET_ID; static constexpr uint32_t CCSDS_HANDLER_QUEUE_SIZE = 50; static constexpr uint8_t NUMBER_OF_VIRTUAL_CHANNELS = 4; diff --git a/fsfw b/fsfw index e29606a2..15687f6f 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e29606a2d07ff2fcad77e99493ec3765816e646b +Subproject commit 15687f6f6e0ca284dbe502f082ef3ab2f0b27b71 From 017e02e5138f84f092e32b7c48accd1928411599 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 29 Oct 2021 19:11:46 +0200 Subject: [PATCH 03/37] changes applied during flatsat debugging --- bsp_q7s/callbacks/rwSpiCallback.cpp | 22 ++++++------ .../pollingSequenceFactory.cpp | 34 +++++++++---------- mission/devices/Max31865PT1000Handler.cpp | 27 +++++++++------ mission/devices/Max31865PT1000Handler.h | 2 +- 4 files changed, 46 insertions(+), 39 deletions(-) diff --git a/bsp_q7s/callbacks/rwSpiCallback.cpp b/bsp_q7s/callbacks/rwSpiCallback.cpp index 73516fb4..620f63f7 100644 --- a/bsp_q7s/callbacks/rwSpiCallback.cpp +++ b/bsp_q7s/callbacks/rwSpiCallback.cpp @@ -23,6 +23,16 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen uint8_t writeBuffer[2]; uint8_t writeSize = 0; + gpioId_t gpioId = cookie->getChipSelectPin(); + GpioIF* gpioIF = comIf->getGpioInterface(); + MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; + uint32_t timeoutMs = 0; + MutexIF* mutex = comIf->getMutex(&timeoutType, &timeoutMs); + if(mutex == nullptr or gpioIF == nullptr) { + sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + int fileDescriptor = 0; std::string device = cookie->getSpiDevice(); UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "rwSpiCallback::spiCallback"); @@ -35,16 +45,6 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen cookie->getSpiParameters(spiMode, spiSpeed, nullptr); comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); - gpioId_t gpioId = cookie->getChipSelectPin(); - GpioIF* gpioIF = comIf->getGpioInterface(); - MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; - uint32_t timeoutMs = 0; - MutexIF* mutex = comIf->getMutex(&timeoutType, &timeoutMs); - if(mutex == nullptr or gpioIF == nullptr) { - sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - result = mutex->lockMutex(timeoutType, timeoutMs); if (result != HasReturnvaluesIF::RETURN_OK) { sif::debug << "rwSpiCallback::spiCallback: Failed to lock mutex" << std::endl; @@ -119,7 +119,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen size_t replyBufferSize = cookie->getMaxBufferSize(); - /** There must be a delay of 20 ms after sending the command */ + /** There must be a delay of at least 20 ms after sending the command */ usleep(RwDefinitions::SPI_REPLY_DELAY); /** diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 225fffd8..73a27116 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -36,9 +36,6 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { DeviceHandlerIF::PERFORM_OPERATION); #endif #if OBSW_ADD_RTD_DEVICES == 1 - thisSequence->addSlot(objects::RTD_IC_0, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::RTD_IC_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::RTD_IC_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC_3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC_4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC_5, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -52,6 +49,9 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC_13, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC_14, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC_15, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::RTD_IC_16, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::RTD_IC_17, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::RTD_IC_18, length * 0, DeviceHandlerIF::PERFORM_OPERATION); #endif /* OBSW_ADD_RTD_DEVICES */ #if OBSW_ADD_TMP_DEVICES == 1 @@ -59,9 +59,6 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::SEND_WRITE); #endif #if OBSW_ADD_RTD_DEVICES == 1 - thisSequence->addSlot(objects::RTD_IC_0, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::RTD_IC_1, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::RTD_IC_2, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC_3, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC_4, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC_5, length * 0.2, DeviceHandlerIF::SEND_WRITE); @@ -75,6 +72,9 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC_13, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC_14, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC_15, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::RTD_IC_16, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::RTD_IC_17, length * 0.2, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::RTD_IC_18, length * 0.2, DeviceHandlerIF::SEND_WRITE); #endif /* OBSW_ADD_RTD_DEVICES */ #if OBSW_ADD_TMP_DEVICES == 1 @@ -82,9 +82,6 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.4, DeviceHandlerIF::GET_WRITE); #endif #if OBSW_ADD_RTD_DEVICES == 1 - thisSequence->addSlot(objects::RTD_IC_0, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::RTD_IC_1, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::RTD_IC_2, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC_3, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC_4, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC_5, length * 0.4, DeviceHandlerIF::GET_WRITE); @@ -98,6 +95,9 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC_13, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC_14, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC_15, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RTD_IC_16, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RTD_IC_17, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RTD_IC_18, length * 0.4, DeviceHandlerIF::GET_WRITE); #endif /* OBSW_ADD_RTD_DEVICES */ #if OBSW_ADD_TMP_DEVICES == 1 @@ -105,9 +105,6 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ); #endif #if OBSW_ADD_RTD_DEVICES == 1 - thisSequence->addSlot(objects::RTD_IC_0, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::RTD_IC_1, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::RTD_IC_2, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC_3, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC_4, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC_5, length * 0.6, DeviceHandlerIF::SEND_READ); @@ -121,6 +118,9 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC_13, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC_14, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC_15, length * 0.6, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RTD_IC_16, length * 0.6, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RTD_IC_17, length * 0.6, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RTD_IC_18, length * 0.6, DeviceHandlerIF::SEND_READ); #endif /* OBSW_ADD_RTD_DEVICES */ #if OBSW_ADD_TMP_DEVICES == 1 @@ -128,9 +128,6 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.8, DeviceHandlerIF::GET_READ); #endif #if OBSW_ADD_RTD_DEVICES == 1 - thisSequence->addSlot(objects::RTD_IC_0, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::RTD_IC_1, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::RTD_IC_2, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC_3, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC_4, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC_5, length * 0.8, DeviceHandlerIF::GET_READ); @@ -144,6 +141,9 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC_13, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC_14, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC_15, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RTD_IC_16, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RTD_IC_17, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RTD_IC_18, length * 0.8, DeviceHandlerIF::GET_READ); #endif /* OBSW_ADD_RTD_DEVICES */ #if OBSW_ADD_RAD_SENSORS == 1 @@ -439,8 +439,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { #endif #if OBSW_ADD_ACS_BOARD == 1 - bool enableAside = true; - bool enableBside = false; + bool enableAside = false; + bool enableBside = true; if(enableAside) { // A side thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, diff --git a/mission/devices/Max31865PT1000Handler.cpp b/mission/devices/Max31865PT1000Handler.cpp index 450d34f3..ba9c8e08 100644 --- a/mission/devices/Max31865PT1000Handler.cpp +++ b/mission/devices/Max31865PT1000Handler.cpp @@ -306,7 +306,8 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply( if(packet[1] != DEFAULT_CONFIG) { #if FSFW_CPP_OSTREAM_ENABLED == 1 // it propably would be better if we at least try one restart.. - sif::error << "Max31865PT1000Handler: Invalid configuration reply!" << std::endl; + sif::error << "Max31865PT1000Handler: Object ID: " << std::hex << this->getObjectId() + << ": Invalid configuration reply!" << std::endl; #else sif::printError("Max31865PT1000Handler: Invalid configuration reply!\n"); #endif @@ -327,7 +328,8 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply( if(readLowThreshold != LOW_THRESHOLD) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Missmatch between " << + sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " << + std::hex << this->getObjectId() << ": Missmatch between " << "written and readback value of low threshold register" << std::endl; #else sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Missmatch between " @@ -343,7 +345,8 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply( if(readHighThreshold != HIGH_THRESHOLD) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Missmatch between " << + sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " + << std::hex << this->getObjectId() << ": Missmatch between " << "written and readback value of high threshold register" << std::endl; #else sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Missmatch between " @@ -375,7 +378,8 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply( #if OBSW_VERBOSE_LEVEL >= 1 if(debugDivider->checkAndIncrement()) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "Max31865: Measured resistance is " << rtdValue << " Ohms." << std::endl; + sif::info << "Max31865: Object ID: " << std::hex << this->getObjectId() + << ": Measured resistance is " << rtdValue << " Ohms." << std::endl; sif::info << "Approximated temperature is " << approxTemp << " C" << std::endl; #else sif::printInfo("Max31685: Measured resistance is %f Ohms\n", rtdValue); @@ -388,11 +392,12 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply( if(pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) { // Configuration error #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Error reading dataset!" + sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " + << std::hex << this->getObjectId() << ": Error reading dataset!" << std::endl; #else sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: " - "Error reading dataset!\n"); + "Error reading dataset!\n"); #endif return pg.getReadResult(); } @@ -411,7 +416,8 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply( faultByte = packet[1]; #if OBSW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Fault byte" + sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " + << std::hex << this->getObjectId() << ": Fault byte" " is: 0b" << std::bitset<8>(faultByte) << std::endl; #else sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Fault byte" @@ -422,7 +428,8 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply( if(result != HasReturnvaluesIF::RETURN_OK) { // Configuration error #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "Max31865PT1000Handler::interpretDeviceReply: " + sif::debug << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " << std::hex + << this->getObjectId() << ":" "Error reading dataset!" << std::endl; #else sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: " @@ -440,8 +447,8 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply( if(result != HasReturnvaluesIF::RETURN_OK) { // Configuration error #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "Max31865PT1000Handler::interpretDeviceReply: " - "Error commiting dataset!" << std::endl; + sif::debug << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " << std::hex + << this->getObjectId() << ": Error commiting dataset!" << std::endl; #else sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: " "Error commiting dataset!\n"); diff --git a/mission/devices/Max31865PT1000Handler.h b/mission/devices/Max31865PT1000Handler.h index ad412ef1..b33ddbe0 100644 --- a/mission/devices/Max31865PT1000Handler.h +++ b/mission/devices/Max31865PT1000Handler.h @@ -37,7 +37,7 @@ public: // 1. 1 for V_BIAS enabled, 0 for disabled // 2. 1 for Auto-conversion, 0 for off // 3. 1 for 1-shot enabled, 0 for disabled (self-clearing bit) - // 4. 1 for 3-wire disabled, 0 for disabled + // 4. 1 for 3-wire enabled, 0 for disabled (two and four wired RTD) // 5./6. Fault detection: 00 for no action, 01 for automatic delay, 1 // 0 for run fault detection with manual delay, // 11 for finish fault detection with manual delay From ca8e3f685a312c85c3538cf70a4eae12e58e6cac Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 29 Oct 2021 19:13:48 +0200 Subject: [PATCH 04/37] improved chip select decoding --- bsp_q7s/gpio/gpioCallbacks.cpp | 258 +++++++++++++++++++++++++++------ bsp_q7s/gpio/gpioCallbacks.h | 6 + 2 files changed, 221 insertions(+), 43 deletions(-) diff --git a/bsp_q7s/gpio/gpioCallbacks.cpp b/bsp_q7s/gpio/gpioCallbacks.cpp index b1eefac7..38c5b46e 100644 --- a/bsp_q7s/gpio/gpioCallbacks.cpp +++ b/bsp_q7s/gpio/gpioCallbacks.cpp @@ -27,14 +27,25 @@ void initSpiCsDecoder(GpioIF* gpioComIF) { GpiodRegularByLineName* spiMuxBit = nullptr; /** Setting mux bit 1 to low will disable IC21 on the interface board */ spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 1", - gpio::OUT, gpio::LOW); + gpio::OUT, gpio::HIGH); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit); /** Setting mux bit 2 to low disables IC1 on the TCS board */ - spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 2", gpio::OUT, gpio::LOW); + spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 2", gpio::OUT, gpio::HIGH); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit); /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */ spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 3", gpio::OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit); + +// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 1", +// gpio::OUT, gpio::LOW); +// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit); +// /** Setting mux bit 2 to low disables IC1 on the TCS board */ +// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 2", gpio::OUT, gpio::HIGH); +// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit); +// /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */ +// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 3", gpio::OUT, gpio::LOW); +// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit); + /** The following gpios can take arbitrary initial values */ spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 4", gpio::OUT, gpio::LOW); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit); @@ -68,173 +79,308 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Lev } if (value == gpio::HIGH) { - disableAllDecoder(); + switch (gpioId) { + case(gpioIds::RTD_IC_3): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_4): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_5): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_6): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_7): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_8): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_9): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_10): { + disableDecoderTcsIc1(); + break; + } + case(gpioIds::RTD_IC_11): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_12): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_13): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_14): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_15): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_16): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_17): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::RTD_IC_18): { + disableDecoderTcsIc2(); + break; + } + case(gpioIds::CS_SUS_1): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_SUS_2): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_SUS_3): { + disableDecoderInterfaceBoardIc2(); + break; + } + case(gpioIds::CS_SUS_4): { + disableDecoderInterfaceBoardIc2(); + break; + } + case(gpioIds::CS_SUS_5): { + disableDecoderInterfaceBoardIc2(); + break; + } + case(gpioIds::CS_SUS_6): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_SUS_7): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_SUS_8): { + disableDecoderInterfaceBoardIc2(); + break; + } + case(gpioIds::CS_SUS_9): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_SUS_10): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_SUS_11): { + disableDecoderInterfaceBoardIc2(); + break; + } + case(gpioIds::CS_SUS_12): { + disableDecoderInterfaceBoardIc2(); + break; + } + case(gpioIds::CS_SUS_13): { + disableDecoderInterfaceBoardIc1(); + break; + } + case(gpioIds::CS_RW1): { + disableRwDecoder(); + break; + } + case(gpioIds::CS_RW2): { + disableRwDecoder(); + break; + } + case(gpioIds::CS_RW3): { + disableRwDecoder(); + break; + } + case(gpioIds::CS_RW4): { + disableRwDecoder(); + break; + } + default: + sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl; + } } else if (value == gpio::LOW) { switch (gpioId) { case(gpioIds::RTD_IC_3): { + selectY7(); enableDecoderTcsIc1(); - selectY7(); break; } case(gpioIds::RTD_IC_4): { + selectY6(); enableDecoderTcsIc1(); - selectY6(); break; } case(gpioIds::RTD_IC_5): { + selectY5(); enableDecoderTcsIc1(); - selectY5(); break; } case(gpioIds::RTD_IC_6): { + selectY4(); enableDecoderTcsIc1(); - selectY4(); break; } case(gpioIds::RTD_IC_7): { + selectY3(); enableDecoderTcsIc1(); - selectY3(); break; } case(gpioIds::RTD_IC_8): { + selectY2(); enableDecoderTcsIc1(); - selectY2(); break; } case(gpioIds::RTD_IC_9): { + selectY1(); enableDecoderTcsIc1(); - selectY1(); break; } case(gpioIds::RTD_IC_10): { + selectY0(); enableDecoderTcsIc1(); - selectY0(); break; } case(gpioIds::RTD_IC_11): { + selectY7(); enableDecoderTcsIc2(); - selectY7(); break; } case(gpioIds::RTD_IC_12): { + selectY6(); enableDecoderTcsIc2(); - selectY6(); break; } case(gpioIds::RTD_IC_13): { + selectY5(); enableDecoderTcsIc2(); - selectY5(); break; } case(gpioIds::RTD_IC_14): { + selectY4(); enableDecoderTcsIc2(); - selectY4(); break; } case(gpioIds::RTD_IC_15): { + selectY3(); enableDecoderTcsIc2(); - selectY3(); break; } case(gpioIds::RTD_IC_16): { + selectY2(); enableDecoderTcsIc2(); - selectY2(); break; } case(gpioIds::RTD_IC_17): { + selectY1(); enableDecoderTcsIc2(); - selectY1(); break; } case(gpioIds::RTD_IC_18): { + selectY0(); enableDecoderTcsIc2(); - selectY0(); break; } case(gpioIds::CS_SUS_1): { + selectY0(); enableDecoderInterfaceBoardIc1(); - selectY0(); break; } case(gpioIds::CS_SUS_2): { + selectY1(); enableDecoderInterfaceBoardIc1(); - selectY1(); break; } case(gpioIds::CS_SUS_3): { + selectY0(); enableDecoderInterfaceBoardIc2(); - selectY0(); break; } case(gpioIds::CS_SUS_4): { + selectY1(); enableDecoderInterfaceBoardIc2(); - selectY1(); break; } case(gpioIds::CS_SUS_5): { + selectY2(); enableDecoderInterfaceBoardIc2(); - selectY2(); break; } case(gpioIds::CS_SUS_6): { + selectY2(); enableDecoderInterfaceBoardIc1(); - selectY2(); break; } case(gpioIds::CS_SUS_7): { + selectY3(); enableDecoderInterfaceBoardIc1(); - selectY3(); break; } case(gpioIds::CS_SUS_8): { + selectY3(); enableDecoderInterfaceBoardIc2(); - selectY3(); break; } case(gpioIds::CS_SUS_9): { + selectY4(); enableDecoderInterfaceBoardIc1(); - selectY4(); break; } case(gpioIds::CS_SUS_10): { + selectY5(); enableDecoderInterfaceBoardIc1(); - selectY5(); break; } case(gpioIds::CS_SUS_11): { + selectY4(); enableDecoderInterfaceBoardIc2(); - selectY4(); break; } case(gpioIds::CS_SUS_12): { + selectY5(); enableDecoderInterfaceBoardIc2(); - selectY5(); break; } case(gpioIds::CS_SUS_13): { + selectY6(); enableDecoderInterfaceBoardIc1(); - selectY6(); break; } case(gpioIds::CS_RW1): { + selectY0(); enableRwDecoder(); - selectY0(); break; } case(gpioIds::CS_RW2): { + selectY1(); enableRwDecoder(); - selectY1(); break; } case(gpioIds::CS_RW3): { + selectY2(); enableRwDecoder(); - selectY2(); break; } case(gpioIds::CS_RW4): { + selectY3(); enableRwDecoder(); - selectY3(); break; } default: @@ -253,9 +399,9 @@ void enableDecoderTcsIc1() { } void enableDecoderTcsIc2() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); - gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); } void enableDecoderInterfaceBoardIc1() { @@ -266,15 +412,41 @@ void enableDecoderInterfaceBoardIc1() { void enableDecoderInterfaceBoardIc2() { gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); +} + +void disableDecoderTcsIc1() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); +} + +void disableDecoderTcsIc2() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); +} + +void disableDecoderInterfaceBoardIc1() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); +} + +void disableDecoderInterfaceBoardIc2() { + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1); + gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2); + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); } void enableRwDecoder() { - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); - gpioComInterface->pullHigh(gpioIds::EN_RW_CS); + gpioComInterface->pullHigh(gpioIds::EN_RW_CS); +} + +void disableRwDecoder() { + gpioComInterface->pullLow(gpioIds::EN_RW_CS); } void selectY0() { @@ -326,9 +498,9 @@ void selectY7() { } void disableAllDecoder() { + gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1); gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2); - gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3); gpioComInterface->pullLow(gpioIds::EN_RW_CS); } diff --git a/bsp_q7s/gpio/gpioCallbacks.h b/bsp_q7s/gpio/gpioCallbacks.h index 13a51df2..18adb52b 100644 --- a/bsp_q7s/gpio/gpioCallbacks.h +++ b/bsp_q7s/gpio/gpioCallbacks.h @@ -44,10 +44,16 @@ namespace gpioCallbacks { */ void enableDecoderInterfaceBoardIc2(); + void disableDecoderTcsIc1(); + void disableDecoderTcsIc2(); + void disableDecoderInterfaceBoardIc1(); + void disableDecoderInterfaceBoardIc2(); + /** * @brief Enables the reaction wheel chip select decoder (IC3). */ void enableRwDecoder(); + void disableRwDecoder(); /** * @brief This function disables all decoder. From b71ac25a77ca7fc2d6547a00d4ec84f5e44f8840 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 29 Oct 2021 19:15:14 +0200 Subject: [PATCH 05/37] changed spi of of RTDs --- common/config/devConf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/common/config/devConf.h b/common/config/devConf.h index fbd9763b..3fbded81 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -33,6 +33,7 @@ static constexpr uint32_t RW_SPEED = 300'000; static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0; static constexpr uint32_t RTD_SPEED = 2'000'000; +static constexpr spi::SpiModes RTD_MODE = spi::SpiModes::MODE_3; } From 556a3986c12ffdac61dfd0fa9afc32cb758f0942 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 1 Nov 2021 12:41:20 +0100 Subject: [PATCH 06/37] pdec handler --- bsp_q7s/boardconfig/busConf.h | 1 + bsp_q7s/core/InitMission.cpp | 13 +- bsp_q7s/core/ObjectFactory.cpp | 20 +- common/config/commonClassIds.h | 1 + common/config/commonObjects.h | 1 + common/config/commonSubsystemIds.h | 1 + generators/bsp_q7s_events.csv | 212 +++++------ generators/events/translateEvents.cpp | 2 +- linux/fsfwconfig/OBSWConfig.h.in | 1 + linux/fsfwconfig/devices/gpioIds.h | 2 + linux/fsfwconfig/events/translateEvents.cpp | 2 +- linux/obc/CMakeLists.txt | 1 + linux/obc/PdecConfig.h | 31 ++ linux/obc/PdecHandler.cpp | 379 ++++++++++++++++++++ linux/obc/PdecHandler.h | 298 +++++++++++++++ linux/obc/PtmeConfig.h | 10 +- mission/tmtc/CCSDSHandler.cpp | 24 +- mission/tmtc/CCSDSHandler.h | 13 +- 18 files changed, 895 insertions(+), 117 deletions(-) create mode 100644 linux/obc/PdecConfig.h create mode 100644 linux/obc/PdecHandler.cpp create mode 100644 linux/obc/PdecHandler.h diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index 8905a125..75d67b1a 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -62,6 +62,7 @@ namespace gpioNames { static constexpr char PAPB_EMPTY_SIGNAL_VC3[] = "papb_empty_signal_vc3"; static constexpr char RS485_EN_TX_CLOCK[] = "tx_clock_enable_ltc2872"; static constexpr char RS485_EN_TX_DATA[] = "tx_data_enable_ltc2872"; + static constexpr char PDEC_RESET[] = "pdec_reset"; } } diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 1715cada..2c1179d9 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -100,11 +100,21 @@ void initmission::initTasks() { #if OBSW_USE_CCSDS_IP_CORE == 1 PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask( - "UDP_POLLING", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + "CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER); if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER); } + + // Minimal distance between two received TCs amounts to 0.6 seconds + // If a command has not been read before the next one arrives, the old command will be + // overwritten by the PDEC. + PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask( + "PDEC_HANDLER", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); + result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER); + } #endif /* OBSW_USE_CCSDS_IP_CORE == 1 */ # if BOARD_TE0720 == 0 @@ -158,6 +168,7 @@ void initmission::initTasks() { #if OBSW_USE_CCSDS_IP_CORE == 1 ccsdsHandlerTask->startTask(); + pdecHandlerTask->startTask(); #endif /* OBSW_USE_CCSDS_IP_CORE == 1 */ #if BOARD_TE0720 == 0 diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 66357373..d297bb05 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -76,6 +76,7 @@ #endif #include +#include #include #include @@ -171,7 +172,7 @@ void ObjectFactory::produce(void* args) { new StarTrackerHandler(objects::START_TRACKER, objects::UART_COM_IF, starTrackerCookie); #endif /* OBSW_ADD_STAR_TRACKER == 1 */ -#endif /* TE7020 != 0 */ +#endif /* TE7020 == 0 */ #if OBSW_USE_CCSDS_IP_CORE == 1 createCcsdsComponents(gpioComIF); @@ -936,7 +937,8 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) { ptme->addVcInterface(ccsds::VC2, vc2); ptme->addVcInterface(ccsds::VC3, vc3); - CCSDSHandler* ccsdsHandler = new CCSDSHandler(objects::CCSDS_HANDLER, objects::PTME); + CCSDSHandler* ccsdsHandler = new CCSDSHandler(objects::CCSDS_HANDLER, objects::PTME, + objects::CCSDS_PACKET_DISTRIBUTOR); VirtualChannel* vc = nullptr; vc = new VirtualChannel(ccsds::VC0, common::VC0_QUEUE_SIZE); @@ -948,6 +950,19 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) { vc = new VirtualChannel(ccsds::VC3, common::VC3_QUEUE_SIZE); ccsdsHandler->addVirtualChannel(ccsds::VC3, vc); + GpioCookie* gpioCookiePdec = new GpioCookie; + consumer.str(""); + consumer << "0x" << std::hex << objects::PDEC_HANDLER; + // GPIO also low after linux boot (specified by device-tree) + gpio = new GpiodRegularByLineName(q7s::gpioNames::PDEC_RESET, consumer.str(), gpio::OUT, + gpio::LOW); + gpioCookiePdec->addGpio(gpioIds::PDEC_RESET, gpio); + + gpioComIF->addGpios(gpioCookiePdec); + + new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET); + +#if BOARD_TE0720 == 0 GpioCookie* gpioRS485Chip = new GpioCookie; gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_CLOCK, "RS485 Transceiver", gpio::Direction::OUT, gpio::HIGH); @@ -957,6 +972,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) { gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_DATA, gpio); gpioComIF->addGpios(gpioRS485Chip); +#endif /* BOARD_TE0720 == 0 */ } void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { diff --git a/common/config/commonClassIds.h b/common/config/commonClassIds.h index bddea49a..605ace3b 100644 --- a/common/config/commonClassIds.h +++ b/common/config/commonClassIds.h @@ -21,6 +21,7 @@ enum commonClassIds: uint8_t { PLOC_UPDATER, //PLUD GOM_SPACE_HANDLER, //GOMS PLOC_MEMORY_DUMPER, //PLMEMDUMP + PDEC_HANDLER, //PDEC COMMON_CLASS_ID_END // [EXPORT] : [END] }; diff --git a/common/config/commonObjects.h b/common/config/commonObjects.h index dc18995e..8cf45e9a 100644 --- a/common/config/commonObjects.h +++ b/common/config/commonObjects.h @@ -16,6 +16,7 @@ enum commonObjects: uint32_t { PAPB_VC1 = 0x50000701, PAPB_VC2 = 0x50000702, PAPB_VC3 = 0x50000703, + PDEC_HANDLER = 0x50000704, CCSDS_HANDLER = 0x50000800, /* 0x43 ('C') for Controllers */ diff --git a/common/config/commonSubsystemIds.h b/common/config/commonSubsystemIds.h index 4cef8774..05fda61c 100644 --- a/common/config/commonSubsystemIds.h +++ b/common/config/commonSubsystemIds.h @@ -17,6 +17,7 @@ enum: uint8_t { FILE_SYSTEM = 116, PLOC_UPDATER = 117, PLOC_MEMORY_DUMPER = 118, + PDEC_HANDLER = 119, COMMON_SUBSYSTEM_ID_END }; } diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index a5bbcde4..165ad708 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -1,106 +1,106 @@ -2200;STORE_SEND_WRITE_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2201;STORE_WRITE_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2202;STORE_SEND_READ_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2203;STORE_READ_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2204;UNEXPECTED_MSG;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2205;STORING_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2206;TM_DUMP_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2207;STORE_INIT_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2208;STORE_INIT_EMPTY;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2209;STORE_CONTENT_CORRUPTED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2210;STORE_INITIALIZE;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2211;INIT_DONE;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2212;DUMP_FINISHED;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2213;DELETION_FINISHED;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2214;DELETION_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2215;AUTO_CATALOGS_SENDING_FAILED;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2600;GET_DATA_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h -2601;STORE_DATA_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h -2800;DEVICE_BUILDING_COMMAND_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2801;DEVICE_SENDING_COMMAND_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2802;DEVICE_REQUESTING_REPLY_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2803;DEVICE_READING_REPLY_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2804;DEVICE_INTERPRETING_REPLY_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2805;DEVICE_MISSED_REPLY;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2806;DEVICE_UNKNOWN_REPLY;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2807;DEVICE_UNREQUESTED_REPLY;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2808;INVALID_DEVICE_COMMAND;LOW;Indicates a SW bug in child class.;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2809;MONITORING_LIMIT_EXCEEDED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2810;MONITORING_AMBIGUOUS;HIGH;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -4201;FUSE_CURRENT_HIGH;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h -4202;FUSE_WENT_OFF;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h -4204;POWER_ABOVE_HIGH_LIMIT;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h -4205;POWER_BELOW_LOW_LIMIT;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h -4300;SWITCH_WENT_OFF;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/PowerSwitchIF.h -5000;HEATER_ON;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h -5001;HEATER_OFF;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h -5002;HEATER_TIMEOUT;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h -5003;HEATER_STAYED_ON;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h -5004;HEATER_STAYED_OFF;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h -5200;TEMP_SENSOR_HIGH;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h -5201;TEMP_SENSOR_LOW;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h -5202;TEMP_SENSOR_GRADIENT;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h -5901;COMPONENT_TEMP_LOW;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h -5902;COMPONENT_TEMP_HIGH;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h -5903;COMPONENT_TEMP_OOL_LOW;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h -5904;COMPONENT_TEMP_OOL_HIGH;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h -5905;TEMP_NOT_IN_OP_RANGE;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h -7101;FDIR_CHANGED_STATE;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h -7102;FDIR_STARTS_RECOVERY;MEDIUM;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h -7103;FDIR_TURNS_OFF_DEVICE;MEDIUM;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h -7201;MONITOR_CHANGED_STATE;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h -7202;VALUE_BELOW_LOW_LIMIT;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h -7203;VALUE_ABOVE_HIGH_LIMIT;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h -7204;VALUE_OUT_OF_RANGE;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h -7301;SWITCHING_TM_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datapool/HkSwitchHelper.h -7400;CHANGING_MODE;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7401;MODE_INFO;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7402;FALLBACK_FAILED;HIGH;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7403;MODE_TRANSITION_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7404;CANT_KEEP_MODE;HIGH;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7405;OBJECT_IN_INVALID_MODE;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7406;FORCING_MODE;MEDIUM;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7407;MODE_CMD_REJECTED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7506;HEALTH_INFO;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7507;CHILD_CHANGED_HEALTH;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7508;CHILD_PROBLEMS;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7509;OVERWRITING_HEALTH;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7510;TRYING_RECOVERY;MEDIUM;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7511;RECOVERY_STEP;MEDIUM;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7512;RECOVERY_DONE;MEDIUM;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7900;RF_AVAILABLE;INFO;A RF available signal was detected. P1: raw RFA state, P2: 0;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h -7901;RF_LOST;INFO;A previously found RF available signal was lost. P1: raw RFA state, P2: 0;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h -7902;BIT_LOCK;INFO;A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h -7903;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h -7905;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h -8900;CLOCK_SET;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h -8901;CLOCK_SET_FAILURE;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h -9700;TEST;INFO;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/pus/Service17Test.h -10600;CHANGE_OF_SETUP_PARAMETER;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/MGMHandlerLIS3MDL.h -11101;MEMORY_READ_RPT_CRC_FAILURE;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h -11102;ACK_FAILURE;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h -11103;EXE_FAILURE;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h -11104;CRC_FAILURE_EVENT;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h -11201;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11202;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11203;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11204;SELF_TEST_PWM_FAILURE;LOW;Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11205;SELF_TEST_TC_FAILURE;LOW;Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11206;SELF_TEST_MTM_RANGE_FAILURE;LOW;Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11207;SELF_TEST_COIL_CURRENT_FAILURE;LOW;Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11208;INVALID_ERROR_BYTE;LOW;Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11301;ERROR_STATE;HIGH;Reaction wheel signals an error state;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/RwHandler.h -11501;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h -11502;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h -11503;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h -11504;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h -11600;SANITIZATION_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/memory/SdCardManager.h -11700;UPDATE_FILE_NOT_EXISTS;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h -11701;ACTION_COMMANDING_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h -11702;UPDATE_AVAILABLE_FAILED;LOW;Supervisor handler replied action message indicating a command execution failure of the update available command;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h -11703;UPDATE_TRANSFER_FAILED;LOW;Supervisor handler failed to transfer an update space packet. P1: Parameter holds the number of update packets already sent (inclusive the failed packet);C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h -11704;UPDATE_VERIFY_FAILED;LOW;Supervisor failed to execute the update verify command.;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h -11705;UPDATE_FINISHED;INFO;MPSoC update successful completed;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h -11800;SEND_MRAM_DUMP_FAILED;LOW;;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h -11801;MRAM_DUMP_FAILED;LOW;Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h -11802;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;C:\Users\jakob\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h +2200;STORE_SEND_WRITE_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2201;STORE_WRITE_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2202;STORE_SEND_READ_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2203;STORE_READ_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2204;UNEXPECTED_MSG;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2205;STORING_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2206;TM_DUMP_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2207;STORE_INIT_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2208;STORE_INIT_EMPTY;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2209;STORE_CONTENT_CORRUPTED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2210;STORE_INITIALIZE;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2211;INIT_DONE;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2212;DUMP_FINISHED;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2213;DELETION_FINISHED;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2214;DELETION_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2215;AUTO_CATALOGS_SENDING_FAILED;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2600;GET_DATA_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h +2601;STORE_DATA_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h +2800;DEVICE_BUILDING_COMMAND_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2801;DEVICE_SENDING_COMMAND_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2802;DEVICE_REQUESTING_REPLY_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2803;DEVICE_READING_REPLY_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2804;DEVICE_INTERPRETING_REPLY_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2805;DEVICE_MISSED_REPLY;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2806;DEVICE_UNKNOWN_REPLY;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2807;DEVICE_UNREQUESTED_REPLY;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2808;INVALID_DEVICE_COMMAND;LOW;Indicates a SW bug in child class.;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2809;MONITORING_LIMIT_EXCEEDED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2810;MONITORING_AMBIGUOUS;HIGH;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +4201;FUSE_CURRENT_HIGH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h +4202;FUSE_WENT_OFF;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h +4204;POWER_ABOVE_HIGH_LIMIT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h +4205;POWER_BELOW_LOW_LIMIT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h +4300;SWITCH_WENT_OFF;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/PowerSwitchIF.h +5000;HEATER_ON;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h +5001;HEATER_OFF;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h +5002;HEATER_TIMEOUT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h +5003;HEATER_STAYED_ON;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h +5004;HEATER_STAYED_OFF;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h +5200;TEMP_SENSOR_HIGH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h +5201;TEMP_SENSOR_LOW;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h +5202;TEMP_SENSOR_GRADIENT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h +5901;COMPONENT_TEMP_LOW;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h +5902;COMPONENT_TEMP_HIGH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h +5903;COMPONENT_TEMP_OOL_LOW;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h +5904;COMPONENT_TEMP_OOL_HIGH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h +5905;TEMP_NOT_IN_OP_RANGE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h +7101;FDIR_CHANGED_STATE;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h +7102;FDIR_STARTS_RECOVERY;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h +7103;FDIR_TURNS_OFF_DEVICE;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h +7201;MONITOR_CHANGED_STATE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h +7202;VALUE_BELOW_LOW_LIMIT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h +7203;VALUE_ABOVE_HIGH_LIMIT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h +7204;VALUE_OUT_OF_RANGE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h +7301;SWITCHING_TM_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datapool/HkSwitchHelper.h +7400;CHANGING_MODE;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h +7401;MODE_INFO;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h +7402;FALLBACK_FAILED;HIGH;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h +7403;MODE_TRANSITION_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h +7404;CANT_KEEP_MODE;HIGH;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h +7405;OBJECT_IN_INVALID_MODE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h +7406;FORCING_MODE;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h +7407;MODE_CMD_REJECTED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h +7506;HEALTH_INFO;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h +7507;CHILD_CHANGED_HEALTH;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h +7508;CHILD_PROBLEMS;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h +7509;OVERWRITING_HEALTH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h +7510;TRYING_RECOVERY;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h +7511;RECOVERY_STEP;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h +7512;RECOVERY_DONE;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h +7900;RF_AVAILABLE;INFO;A RF available signal was detected. P1: raw RFA state, P2: 0;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h +7901;RF_LOST;INFO;A previously found RF available signal was lost. P1: raw RFA state, P2: 0;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h +7902;BIT_LOCK;INFO;A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h +7903;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h +7905;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h +8900;CLOCK_SET;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h +8901;CLOCK_SET_FAILURE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h +9700;TEST;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/pus/Service17Test.h +10600;CHANGE_OF_SETUP_PARAMETER;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h +11101;MEMORY_READ_RPT_CRC_FAILURE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h +11102;ACK_FAILURE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h +11103;EXE_FAILURE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h +11104;CRC_FAILURE_EVENT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h +11201;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h +11202;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h +11203;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h +11204;SELF_TEST_PWM_FAILURE;LOW;Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h +11205;SELF_TEST_TC_FAILURE;LOW;Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h +11206;SELF_TEST_MTM_RANGE_FAILURE;LOW;Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h +11207;SELF_TEST_COIL_CURRENT_FAILURE;LOW;Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h +11208;INVALID_ERROR_BYTE;LOW;Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h +11301;ERROR_STATE;HIGH;Reaction wheel signals an error state;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/RwHandler.h +11501;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h +11502;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h +11503;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h +11504;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h +11600;SANITIZATION_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/memory/SdCardManager.h +11700;UPDATE_FILE_NOT_EXISTS;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h +11701;ACTION_COMMANDING_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h +11702;UPDATE_AVAILABLE_FAILED;LOW;Supervisor handler replied action message indicating a command execution failure of the update available command;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h +11703;UPDATE_TRANSFER_FAILED;LOW;Supervisor handler failed to transfer an update space packet. P1: Parameter holds the number of update packets already sent (inclusive the failed packet);C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h +11704;UPDATE_VERIFY_FAILED;LOW;Supervisor failed to execute the update verify command.;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h +11705;UPDATE_FINISHED;INFO;MPSoC update successful completed;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h +11800;SEND_MRAM_DUMP_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h +11801;MRAM_DUMP_FAILED;LOW;Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h +11802;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 9d817651..18f6ba50 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 106 translations. * @details - * Generated on: 2021-08-31 10:50:10 + * Generated on: 2021-10-31 17:56:40 */ #include "translateEvents.h" diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 6ccd6b6d..9dbc5428 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -109,6 +109,7 @@ debugging. */ #define OBSW_DEBUG_STARTRACKER 0 #define OBSW_DEBUG_PLOC_MPSOC 0 #define OBSW_DEBUG_PLOC_SUPERVISOR 0 +#define OBSW_DEBUG_PDEC_HANDLER 0 /*******************************************************************/ /** Hardcoded */ diff --git a/linux/fsfwconfig/devices/gpioIds.h b/linux/fsfwconfig/devices/gpioIds.h index ebe8a3eb..2fe715ea 100644 --- a/linux/fsfwconfig/devices/gpioIds.h +++ b/linux/fsfwconfig/devices/gpioIds.h @@ -100,6 +100,8 @@ enum gpioId_t { VC3_PAPB_EMPTY, VC3_PAPB_BUSY, + PDEC_RESET, + RS485_EN_TX_DATA, RS485_EN_TX_CLOCK diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 9d817651..18f6ba50 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 106 translations. * @details - * Generated on: 2021-08-31 10:50:10 + * Generated on: 2021-10-31 17:56:40 */ #include "translateEvents.h" diff --git a/linux/obc/CMakeLists.txt b/linux/obc/CMakeLists.txt index 315a0d33..220bd375 100644 --- a/linux/obc/CMakeLists.txt +++ b/linux/obc/CMakeLists.txt @@ -1,6 +1,7 @@ target_sources(${TARGET_NAME} PUBLIC PapbVcInterface.cpp Ptme.cpp + PdecHandler.cpp ) diff --git a/linux/obc/PdecConfig.h b/linux/obc/PdecConfig.h new file mode 100644 index 00000000..a661d5b4 --- /dev/null +++ b/linux/obc/PdecConfig.h @@ -0,0 +1,31 @@ +#ifndef LINUX_OBC_PDECCONFIG_H_ +#define LINUX_OBC_PDECCONFIG_H_ + +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include + +/** + * @brief PDEC specific configuration parameters. + * + * @author J. Meier + */ +namespace PdecConfig { + + // Access to register space of PDEC via the AXI to AHB bridge + static const char UIO_PDEC_REGISTERS[] = "/dev/uio0"; + // Direct access to memory area in DDR assigned to PDEC + static const char UIO_PDEC_MEMORY[] = "/dev/uio2"; + + // TC transfer frame configuration parameters + static const uint8_t VERSION_ID = 0; + static const uint8_t BYPASS_FLAG = 1; + static const uint8_t CONTROL_COMMAND_FLAG = 1; + static const uint8_t VIRTUAL_CHANNEL = 0; + static const uint8_t RESERVED_FIELD_A = 0; + static const uint16_t SPACECRAFT_ID = 0x274; + // Parameters to control the FARM for AD frames + static const uint8_t POSITIVE_WINDOW = 10; + static const uint8_t NEGATIVE_WINDOW = 151; +}; + +#endif /* LINUX_OBC_PDECCONFIG_H_ */ diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp new file mode 100644 index 00000000..7e7278fa --- /dev/null +++ b/linux/obc/PdecHandler.cpp @@ -0,0 +1,379 @@ +#include + +#include +#include + +#include "PdecHandler.h" +#include "OBSWConfig.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/TmTcMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" + +PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId, LinuxLibgpioIF* gpioComIF, + gpioId_t pdecReset) : + SystemObject(objectId), tcDestinationId(tcDestinationId), gpioComIF(gpioComIF), pdecReset( + pdecReset) { + +} + +PdecHandler::~PdecHandler() { +} + +ReturnValue_t PdecHandler::initialize() { + + tcStore = ObjectManager::instance()->get(objects::TC_STORE); + if (tcStore == nullptr) { + sif::error << "PdecHandler::initialize: Invalid TC store" << std::endl; + return ObjectManagerIF::CHILD_INIT_FAILED; + } + + tcDestination = ObjectManager::instance()->get( + tcDestinationId); + + if (tcDestination == nullptr) { + sif::error << "PdecHandler::initialize: Invalid tc destination specified" << std::endl; + return ObjectManagerIF::CHILD_INIT_FAILED; + } + + ReturnValue_t result = RETURN_OK; + + result = getRegisterAddress(); + if (result != RETURN_OK) { + return ObjectManagerIF::CHILD_INIT_FAILED; + } + + result = getMemoryBaseAddress(); + if (result != RETURN_OK) { + return ObjectManagerIF::CHILD_INIT_FAILED; + } + + writePdecConfig(); + + result = releasePdec(); + if (result != RETURN_OK) { + return ObjectManagerIF::CHILD_INIT_FAILED; + } + + return RETURN_OK; +} + +ReturnValue_t PdecHandler::getRegisterAddress() { + int fd = open(PdecConfig::UIO_PDEC_REGISTERS, O_RDWR); + if (fd < 1) { + sif::warning << "PdecHandler::getRegisterAddress: Invalid UIO device file" << std::endl; + return RETURN_FAILED; + } + + registerBaseAddress = static_cast(mmap(NULL, REGISTER_MAP_SIZE, + PROT_WRITE | PROT_READ, MAP_SHARED, fd, 0)); + + if (registerBaseAddress == MAP_FAILED) { + sif::error << "PdecHandler::getRegisterAddress: Failed to map uio address" << std::endl; + return RETURN_FAILED; + } + + return RETURN_OK; +} + +ReturnValue_t PdecHandler::getMemoryBaseAddress() { + int fd = open(PdecConfig::UIO_PDEC_MEMORY, O_RDWR); + if (fd < 1) { + sif::warning << "PdecHandler::getMemoryBaseAddress: Invalid UIO device file" << std::endl; + return RETURN_FAILED; + } + + memoryBaseAddress = static_cast(mmap(NULL, MEMORY_MAP_SIZE, PROT_WRITE | PROT_READ, + MAP_SHARED, fd, 0)); + + if (memoryBaseAddress == MAP_FAILED) { + sif::error << "PdecHandler::getMemoryBaseAddress: Failed to map uio address" << std::endl; + return RETURN_FAILED; + } + + return RETURN_OK; +} + +void PdecHandler::writePdecConfig() { + PdecParams_t pdecParams; + pdecParams.versionId = 0; + pdecParams.bypassFlag = PdecConfig::BYPASS_FLAG; + pdecParams.controlCommandFlag = PdecConfig::CONTROL_COMMAND_FLAG; + pdecParams.reservedFieldA = 0; + pdecParams.spacecraftId = PdecConfig::SPACECRAFT_ID; + pdecParams.virtualChannelId = PdecConfig::VIRTUAL_CHANNEL; + pdecParams.dummy = 0; + pdecParams.positiveWindow = PdecConfig::POSITIVE_WINDOW; + pdecParams.negativeWindow = PdecConfig::NEGATIVE_WINDOW; + std::memcpy(memoryBaseAddress, &pdecParams, sizeof(pdecParams)); + + // Configure all MAP IDs as invalid + for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) { + *(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx / 4) = NO_DESTINATION << 24 + | NO_DESTINATION << 16 | NO_DESTINATION << 8 | NO_DESTINATION; + + } + + // All TCs with MAP ID 7 will be routed to the PM module (can then be read from memory) + uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER); + *(memoryBaseAddress + 1) = NO_DESTINATION << 24 | NO_DESTINATION << 16 | NO_DESTINATION << 8 + | routeToPm; +} + +ReturnValue_t PdecHandler::resetFarStatFlag() { + uint32_t pdecFar = *(registerBaseAddress + PDEC_FAR_OFFSET); + if (pdecFar != FAR_RESET) { + sif::warning << "PdecHandler::resetFarStatFlag: FAR register did not match expected value." + << " Read value:" << static_cast(pdecFar) << std::endl; + return RETURN_FAILED; + } +#if OBSW_DEBUG_PDEC_HANDLER == 1 + sif::debug << "PdecHandler::resetFarStatFlag: read FAR with value: 0x" << std::hex << pdecFar + << std::endl; +#endif /* OBSW_DEBUG_PDEC_HANDLER == 1 */ + return RETURN_OK; +} + +ReturnValue_t PdecHandler::releasePdec() { + ReturnValue_t result = RETURN_OK; + result = gpioComIF->pullHigh(pdecReset); + if (result != RETURN_OK) { + sif::error << "PdecHandler::releasePdec: Failed to release PDEC reset signal" << std::endl; + } + return result; +} + +ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) { + + ReturnValue_t result = RETURN_OK; + + switch(state) { + case State::INIT: + resetFarStatFlag(); + if (result != RETURN_OK) { + // Requires reconfiguration and reinitialization of PDEC + triggerEvent(INVALID_FAR); + state = State::WAIT_FOR_RECOVERY; + return result; + } + state = State::RUNNING; + break; + case State::RUNNING: + if (newTcReceived()) { + handleNewTc(); + } + break; + case State::WAIT_FOR_RECOVERY: + break; + default: + sif::debug << "PdecHandler::performOperation: Invalid state" << std::endl; + break; + } + + return RETURN_OK; +} + +bool PdecHandler::newTcReceived() { + uint32_t pdecFar = *(registerBaseAddress + PDEC_FAR_OFFSET); + if (pdecFar >> STAT_POSITION != NEW_FAR_RECEIVED) { + return false; + } + if (!checkFrameAna(pdecFar)) { + return false; + } + return true; +} + +bool PdecHandler::checkFrameAna(uint32_t pdecFar) { + bool frameValid = false; + FrameAna_t frameAna = static_cast((pdecFar & FRAME_ANA_MASK) >> FRAME_ANA_POSITION); + switch(frameAna) { + case(FrameAna_t::ABANDONED_CLTU): { + triggerEvent(INVALID_TC_FRAME, ABANDONED_CLTU); + sif::debug << "PdecHandler::checkFrameAna: Abondoned CLTU" << std::endl; + break; + } + case(FrameAna_t::FRAME_DIRTY): { + triggerEvent(INVALID_TC_FRAME, FRAME_DIRTY); + sif::debug << "PdecHandler::checkFrameAna: Frame dirty" << std::endl; + break; + } + case(FrameAna_t::FRAME_ILLEGAL): { + sif::debug << "PdecHandler::checkFrameAna: Frame illegal for one reason" << std::endl; + handleIReason(pdecFar, FRAME_ILLEGAL_ONE_REASON); + break; + } + case(FrameAna_t::FRAME_ILLEGAL_MULTI_REASON): { + sif::debug << "PdecHandler::checkFrameAna: Frame illegal for multiple reasons" + << std::endl; + handleIReason(pdecFar, FRAME_ILLEGAL_MULTIPLE_REASONS); + break; + } + case(FrameAna_t::AD_DISCARDED_LOCKOUT): { + triggerEvent(INVALID_TC_FRAME, AD_DISCARDED_LOCKOUT); + sif::debug << "PdecHandler::checkFrameAna: AD frame discarded because of lockout" + << std::endl; + break; + } + case(FrameAna_t::AD_DISCARDED_WAIT): { + triggerEvent(INVALID_TC_FRAME, AD_DISCARDED_LOCKOUT); + sif::debug << "PdecHandler::checkFrameAna: AD frame discarded because of wait" + << std::endl; + break; + } + case(FrameAna_t::AD_DISCARDED_NS_VR): { + triggerEvent(INVALID_TC_FRAME, AD_DISCARDED_NS_VS); + sif::debug << "PdecHandler::checkFrameAna: AD frame discarded because N(S) or V(R)" + << std::endl; + break; + } + case(FrameAna_t::FRAME_ACCEPTED): { + sif::debug << "PdecHandler::checkFrameAna: Accepted TC frame" << std::endl; + frameValid = true; + break; + } + default: { + sif::debug << "PdecHandler::checkFrameAna: Invaid frame analysis report" << std::endl; + break; + } + } + return frameValid; +} + +void PdecHandler::handleIReason(uint32_t pdecFar, ReturnValue_t parameter1) { + IReason_t ireason = static_cast((pdecFar & IREASON_MASK) >> IREASON_POSITION); + switch(ireason) { + case(IReason_t::NO_REPORT): { + triggerEvent(INVALID_TC_FRAME, parameter1, NO_REPORT); + sif::debug << "PdecHandler::handleIReason: No illegal report" << std::endl; + break; + } + case(IReason_t::ERROR_VERSION_NUMBER): { + triggerEvent(INVALID_TC_FRAME, parameter1, ERROR_VERSION_NUMBER); + sif::debug << "PdecHandler::handleIReason: Error in version number and reserved A and B " + << "fields" << std::endl; + break; + } + case(IReason_t::ILLEGAL_COMBINATION): { + triggerEvent(INVALID_TC_FRAME, parameter1, ILLEGAL_COMBINATION); + sif::debug << "PdecHandler::handleIReason: Illegal combination (AC) of bypass and control " + << "command flags" << std::endl; + break; + } + case(IReason_t::INVALID_SC_ID): { + triggerEvent(INVALID_TC_FRAME, parameter1, INVALID_SC_ID); + sif::debug << "PdecHandler::handleIReason: Invalid spacecraft identifier " << std::endl; + break; + } + case(IReason_t::INVALID_VC_ID_MSB): { + triggerEvent(INVALID_TC_FRAME, parameter1, INVALID_VC_ID_MSB); + sif::debug << "PdecHandler::handleIReason: VC identifier bit 0 to 4 did not match " + << std::endl; + break; + } + case(IReason_t::INVALID_VC_ID_LSB): { + triggerEvent(INVALID_TC_FRAME, parameter1, INVALID_VC_ID_LSB); + sif::debug << "PdecHandler::handleIReason: VC identifier bit 5 did not match " << std::endl; + break; + } + case(IReason_t::NS_NOT_ZERO): { + triggerEvent(INVALID_TC_FRAME, parameter1, NS_NOT_ZERO); + sif::debug << "PdecHandler::handleIReason: N(S) of BC or BD frame not set to all zeros" + << std::endl; + break; + } + case(IReason_t::INCORRECT_BC_CC): { + triggerEvent(INVALID_TC_FRAME, parameter1, INVALID_BC_CC); + sif::debug << "PdecHandler::handleIReason: Invalid BC control command format" << std::endl; + break; + } + default: { + sif::debug << "PdecHandler::handleIReason: Invaid reason id" << std::endl; + break; + } + } +} + +void PdecHandler::handleNewTc() { + ReturnValue_t result = RETURN_OK; + + uint32_t tcLength = 0; + result = readTc(tcLength); + if (result != RETURN_OK) { + return; + } +#if OBSW_DEBUG_PDEC == 1 + unsigned int mapId = tcSegment[0] & MAP_ID_MASK; + sif::debug << "PdecHandler::handleNewTc: Received TC segment with map ID" << mapId + << std::endl; +#endif /* OBSW_DEBUG_PDEC */ + + store_address_t storeId; + result = tcStore->addData(&storeId, tcSegment + 1, tcLength - 1); + if (result != RETURN_OK) { + sif::warning << "PdecHandler::handleNewTc: Failed to add received space packet to store" + << std::endl; + return; + } + + TmTcMessage message(storeId); + + result = MessageQueueSenderIF::sendMessage(tcDestination->getRequestQueue(), &message); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "PdecHandler::handleNewTc: Failed to send message to TC destination" + << std::endl; + tcStore->deleteData(storeId); + return; + } + + return; +} + +ReturnValue_t PdecHandler::readTc(uint32_t& tcLength) { + uint32_t tcOffset = *(registerBaseAddress + PDEC_BPTR_OFFSET) - PHYSICAL_BASE_ADDRESS; + +#if OBSW_DEBUG_PDEC == 1 + sif::debug << "PdecHandler::readTc: TC offset: " << std::hex << tcOffset << std::endl; +#endif /* OBSW_DEBUG_PDEC */ + + uint32_t* tcPtr = reinterpret_cast(*(registerBaseAddress + tcOffset) / 4); + tcLength = *(registerBaseAddress + PDEC_SLEN_OFFSET); + +#if OBSW_DEBUG_PDEC == 1 + sif::debug << "PdecHandler::readTc: TC length: " << tcLength << std::endl; +#endif /* OBSW_DEBUG_PDEC */ + + if (tcLength > MAX_TC_SEGMENT_SIZE) { + sif::warning << "PdecHandler::handleNewTc: Read invalid TC length from PDEC register" + << std::endl; + return RETURN_FAILED; + } + + uint32_t idx = 0; + uint32_t tcData = 0; + for (idx = 0; idx < tcLength; idx = idx + 4) { + tcData = *(tcPtr + idx); + std::memcpy(tcSegment + idx, &tcData, sizeof(tcData)); + } + + // Backend buffer is handled back to PDEC3 + *(registerBaseAddress + PDEC_BFREE_OFFSET) = 0; + + return RETURN_OK; +} + +uint8_t PdecHandler::calcMapAddrEntry(uint8_t moduleId) { + uint8_t lutEntry = 0; + uint8_t parity = getOddParity(moduleId | (1 << VALID_POSITION)); + lutEntry = (parity << PARITY_POSITION) | (1 << VALID_POSITION) | moduleId; + return lutEntry; +} + +uint8_t PdecHandler::getOddParity(uint8_t number) { + uint8_t parityBit = 0; + uint8_t countBits = 0; + for (unsigned int idx = 0; idx < sizeof(number) * 8; idx++) { + countBits += (number >> idx) & 0x1; + } + parityBit = ~(countBits & 0x1) & 0x1; + return parityBit; +} diff --git a/linux/obc/PdecHandler.h b/linux/obc/PdecHandler.h new file mode 100644 index 00000000..033977e4 --- /dev/null +++ b/linux/obc/PdecHandler.h @@ -0,0 +1,298 @@ +#ifndef LINUX_OBC_PDECHANDLER_H_ +#define LINUX_OBC_PDECHANDLER_H_ + +#include "PdecConfig.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw_hal/common/gpio/gpioDefinitions.h" +#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" +#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/tasks/ExecutableObjectIF.h" + +/** + * @brief This class controls the PDEC IP Core implemented in the programmable logic of the + * Zynq-7020. All registers and memories of the PDEC IP Core are accessed via UIO + * drivers. + * + * @details The PDEC IP Core is responsible for processing data received in form of CLTUs from the + * S-Band transceiver. This comprises the BCH decoding of the CLTUs and reconstruction of + * telecommand transfer frames. Finally the PDEC stores the TC segment transported with + * the TC transfer frame in a register. As soon as a new TC has been received a new + * frame acceptance report (FAR) will be generated. If the FAR confirms the validity of + * a received TC segment, the data can be read out from the associated register. + * Currently, the ground software only supports transmissions of CLTUs containing one + * space packet. + * Link to datasheet of PDEC IP Core: https://eive-cloud.irs.uni-stuttgart.de/index.php/ + * apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/CCSDS_IP_Cores&fileid=1108967 + * + * @author J. Meier + */ +class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF { + +public: + /** + * @brief Constructor + * @param objectId Object ID of PDEC handler system object + * @param tcDestinationId Object ID of object responsible for processing TCs. + * @param gpioComIF Pointer to GPIO interace responsible for driving GPIOs. + * @param pdecReset GPIO ID of GPIO connected to the reset signal of the PDEC. + */ + PdecHandler(object_id_t objectId, object_id_t tcDestinationId, LinuxLibgpioIF* gpioComIF, + gpioId_t pdecReset); + + virtual ~PdecHandler(); + + ReturnValue_t performOperation(uint8_t operationCode = 0); + + ReturnValue_t initialize() override; + +private: + + static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER; + + static const ReturnValue_t ABANDONED_CLTU = MAKE_RETURN_CODE(0xA0); + static const ReturnValue_t FRAME_DIRTY = MAKE_RETURN_CODE(0xA1); + static const ReturnValue_t FRAME_ILLEGAL_ONE_REASON = MAKE_RETURN_CODE(0xA2); + static const ReturnValue_t FRAME_ILLEGAL_MULTIPLE_REASONS = MAKE_RETURN_CODE(0xA2); + static const ReturnValue_t AD_DISCARDED_LOCKOUT = MAKE_RETURN_CODE(0xA3); + static const ReturnValue_t AD_DISCARDED_WAIT = MAKE_RETURN_CODE(0xA4); + static const ReturnValue_t AD_DISCARDED_NS_VS = MAKE_RETURN_CODE(0xA5); + + static const ReturnValue_t NO_REPORT = MAKE_RETURN_CODE(0xA6); + //! Error in version number and reserved A and B fields + static const ReturnValue_t ERROR_VERSION_NUMBER = MAKE_RETURN_CODE(0xA7); + //! Illegal combination of bypass and control command flag + static const ReturnValue_t ILLEGAL_COMBINATION = MAKE_RETURN_CODE(0xA8); + //! Spacecraft identifier did not match + static const ReturnValue_t INVALID_SC_ID = MAKE_RETURN_CODE(0xA9); + //! VC identifier bits 0 to 4 did not match + static const ReturnValue_t INVALID_VC_ID_MSB = MAKE_RETURN_CODE(0xAA); + //! VC identifier bit 5 did not match + static const ReturnValue_t INVALID_VC_ID_LSB = MAKE_RETURN_CODE(0xAB); + //! N(S) of BC or BD frame not set to all zeros + static const ReturnValue_t NS_NOT_ZERO = MAKE_RETURN_CODE(0xAC); + //! Invalid BC control command + static const ReturnValue_t INVALID_BC_CC = MAKE_RETURN_CODE(0xAE); + + static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PDEC_HANDLER; + + //! [EXPORT] : [COMMENT] Frame acceptance report signals an invalid frame + //! P1: The frame analysis information (FrameAna field of PDEC_FAR register) + //! P2: When frame declared illegal this parameter this parameter gives information about the reason (IReason field of the PDEC_FAR register) + static const Event INVALID_TC_FRAME = MAKE_EVENT(1, severity::HIGH); + //! [EXPORT] : [COMMENT] Read invalid FAR from PDEC after startup + static const Event INVALID_FAR = MAKE_EVENT(2, severity::HIGH); + + static const uint8_t STAT_POSITION = 31; + static const uint8_t FRAME_ANA_POSITION = 28; + static const uint8_t IREASON_POSITION = 25; + + static const uint8_t NEW_FAR_RECEIVED = 0; + + static const uint32_t FRAME_ANA_MASK = 0x70000000; + static const uint32_t IREASON_MASK = 0x0E000000; + + /** + * UIO is 4 byte aligned. Thus offset is calculated with "true offset" / 4 + * Example: PDEC_FAR = 0x2840 => Offset in virtual address space is 0xA10 + */ + static const uint32_t PDEC_FAR_OFFSET = 0xA10; + static const uint32_t PDEC_BFREE_OFFSET = 0xA24; + static const uint32_t PDEC_BPTR_OFFSET = 0xA25; + static const uint32_t PDEC_SLEN_OFFSET = 0xA26; + + static const int MEMORY_MAP_SIZE = 0xF42400; + static const int REGISTER_MAP_SIZE = 0x10000; + + static const size_t MAX_TC_SEGMENT_SIZE = 1017; + static const uint8_t MAP_ID_MASK = 0x3F; + + static const uint32_t PHYSICAL_BASE_ADDRESS = 0x30000000; + static const uint32_t MAP_ADDR_LUT_OFFSET = 0xA0; + + static const uint8_t MAX_MAP_ADDR = 63; + // Writing this to the map address in the look up table will invalidate a MAP ID. + static const uint8_t NO_DESTINATION = 0; + static const uint8_t VALID_POSITION = 6; + static const uint8_t PARITY_POSITION = 7; + + // Expected value stored in FAR register after reset + static const uint32_t FAR_RESET = 0x7FE0; + + /** + * TCs with map addresses (also know as Map IDs) assigned to this channel will be stored in + * the PDEC memory. + */ + static const uint32_t PM_BUFFER = 7; + + enum class FrameAna_t: uint8_t { + ABANDONED_CLTU, + FRAME_DIRTY, + FRAME_ILLEGAL, + FRAME_ILLEGAL_MULTI_REASON, + AD_DISCARDED_LOCKOUT, + AD_DISCARDED_WAIT, + AD_DISCARDED_NS_VR, + FRAME_ACCEPTED + }; + + enum class IReason_t: uint8_t { + NO_REPORT, + ERROR_VERSION_NUMBER, + ILLEGAL_COMBINATION, + INVALID_SC_ID, + INVALID_VC_ID_LSB, + INVALID_VC_ID_MSB, + NS_NOT_ZERO, + INCORRECT_BC_CC + }; + + typedef struct PdecParams { + uint8_t versionId : 2 ; + uint8_t bypassFlag : 1; + uint8_t controlCommandFlag : 1; + uint8_t reservedFieldA : 2; + uint16_t spacecraftId : 10; + uint8_t virtualChannelId : 6; + uint8_t dummy : 2; + uint8_t positiveWindow; + uint8_t negativeWindow; + //Authentication unit not used for EIVE + uint8_t auMapIdPointer = 0; + // De-randomizing enabled + uint8_t derandomiserConfig = 1; + // Only used when AU is enabled. Enables the use of an external recovery lac counter. + // The AU requires a lac counter to generate the signature. + uint8_t recoveryLacConfig = 0; + } PdecParams_t; + + enum class State: uint8_t { + INIT, + RUNNING, + WAIT_FOR_RECOVERY + }; + + /** + * @brief Opens UIO device assigned to AXI to AHB converter giving access to the PDEC + * registers. The register base address will be mapped into the virtual address space. + */ + ReturnValue_t getRegisterAddress(); + + /** + * @brief Opens UIO device assigned to the base address of the PDEC memory space and maps the + * physical address into the virtual address space. + */ + ReturnValue_t getMemoryBaseAddress(); + + /** + * @brief This functions writes the configuration parameters to the configuration + * section of the PDEC. + */ + void writePdecConfig(); + + /** + * @brief Reading the FAR resets the set stat flag which signals a new TC. Without clearing + * this flag no new TC will be excepted. After start up the flag is set and needs + * to be reset. + * Stat flag 0 - new TC received + * Stat flag 1 - old TC (ready to receive next TC) + */ + ReturnValue_t resetFarStatFlag(); + + /** + * @brief Releases the PDEC from reset state. PDEC will start with loading the written + * configuration parameters. + */ + ReturnValue_t releasePdec(); + + /** + * @brief Reads the FAR register and checks if a new TC has been received. + */ + bool newTcReceived(); + + /** + * @brief Analyzes the FramAna field (frame analysis data) of a FAR report. + * + * @return True if frame valid, otherwise false. + */ + bool checkFrameAna(uint32_t pdecFar); + + /** + * @brief This function handles the IReason field of the frame analysis report. + * + * @details In case frame as been declared illegal for multiple reasons, the reason with the + * lowest value will be shown. + */ + void handleIReason(uint32_t pdecFar, ReturnValue_t parameter1); + + /** + * @brief Handles the reception of new TCs. Reads the pointer to the storage location of the + * new TC segment, extracts the PUS packet and forwards the data to the object + * responsible for processing the TC. + */ + void handleNewTc(); + + /** + * @brief Function reads the last received TC segment from the PDEC memory and copies + * the data to the tcSegement array. + * + * @param tcLength The length of the received TC. + * + */ + ReturnValue_t readTc(uint32_t& tcLength); + + /** + * @brief This function calculates the entry for the configuration of the MAP ID routing. + * + * @param mapAddr The MAP ID to configure + * @param moduleId The destination module where all TCs with the map id mapAddr will be routed + * to. + * + * @details The PDEC has different modules where the TCs can be routed to. A lookup table is + * used which links the MAP ID field to the destination module. The entry for this + * lookup table is created by this function and must be stored in the configuration + * memory region of the PDEC. The entry has a specific format + */ + uint8_t calcMapAddrEntry(uint8_t moduleId); + + /** + * @brief This functions calculates the odd parity of the bits in number. + * + * @param number The number from which to calculate the odd parity. + */ + uint8_t getOddParity(uint8_t number); + + object_id_t tcDestinationId; + + AcceptsTelecommandsIF* tcDestination = nullptr; + + LinuxLibgpioIF* gpioComIF = nullptr; + + StorageManagerIF* tcStore = nullptr; + + State state = State::INIT; + + /** + * Reset signal is required to hold PDEC in reset state until the configuration has been + * written to the appropriate memory space. + * Can also be used to reboot PDEC in case of erros. + */ + gpioId_t pdecReset = gpio::NO_GPIO; + + /** + * Pointer pointing to base address of the PDEC memory space. + * This address is equivalent with the base address of the section named configuration area in + * the PDEC datasheet. + */ + uint32_t* memoryBaseAddress = nullptr; + + // Pointer pointing to base address of register space + uint32_t* registerBaseAddress = nullptr; + + uint32_t pdecFar = 0; + + uint8_t tcSegment[1017]; +}; + +#endif /* LINUX_OBC_PDECHANDLER_H_ */ diff --git a/linux/obc/PtmeConfig.h b/linux/obc/PtmeConfig.h index f4468570..a3b17551 100644 --- a/linux/obc/PtmeConfig.h +++ b/linux/obc/PtmeConfig.h @@ -3,10 +3,10 @@ #include "fsfw/returnvalues/HasReturnvaluesIF.h" #include - +#include "OBSWConfig.h" /** - * @brief Configuration parameters derived from FPGA design and device tree. + * @brief PTME specific configuration parameters derived from FPGA design and device tree. * * @author J. Meier */ @@ -19,8 +19,12 @@ namespace PtmeConfig { static const uint32_t VC1_OFFSETT = 0x4000; static const uint32_t VC2_OFFSETT = 0x8000; static const uint32_t VC3_OFFSETT = 0xC000; - +#if BOARD_TE0720 == 0 static const char UIO_DEVICE_FILE[] = "/dev/uio0"; +#else + static const char UIO_DEVICE_FILE[] = "/dev/uio1"; +#endif + }; #endif /* LINUX_OBC_PTMECONFIG_H_ */ diff --git a/mission/tmtc/CCSDSHandler.cpp b/mission/tmtc/CCSDSHandler.cpp index 9b2912c1..ad630044 100644 --- a/mission/tmtc/CCSDSHandler.cpp +++ b/mission/tmtc/CCSDSHandler.cpp @@ -5,8 +5,8 @@ #include "CCSDSHandler.h" -CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId) : - SystemObject(objectId), ptmeId(ptmeId), parameterHelper(this) { +CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination) : + SystemObject(objectId), ptmeId(ptmeId), tcDestination(tcDestination), parameterHelper(this) { commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE); } @@ -39,6 +39,17 @@ ReturnValue_t CCSDSHandler::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } + AcceptsTelecommandsIF* tcDistributor = + ObjectManager::instance()->get(tcDestination); + if (tcDistributor == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "CCSDSHandler::initialize: Invalid TC Distributor object" << std::endl; +#endif + return ObjectManagerIF::CHILD_INIT_FAILED; + } + + tcDistributorQueueId = tcDistributor->getRequestQueue(); + result = parameterHelper.initialize(); if (result != HasReturnvaluesIF::RETURN_OK) { return result; @@ -120,3 +131,12 @@ ReturnValue_t CCSDSHandler::getParameter(uint8_t domainId, uint8_t uniqueIdentif uint16_t startAtIndex) { return RETURN_OK; } + +uint16_t CCSDSHandler::getIdentifier() { + return 0; +} + +MessageQueueId_t CCSDSHandler::getRequestQueue() { + // Forward packets directly to TC distributor + return tcDistributorQueueId; +} diff --git a/mission/tmtc/CCSDSHandler.h b/mission/tmtc/CCSDSHandler.h index b53cb8cd..b1c3dd60 100644 --- a/mission/tmtc/CCSDSHandler.h +++ b/mission/tmtc/CCSDSHandler.h @@ -5,6 +5,8 @@ #include "fsfw/objectmanager/SystemObject.h" #include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tmtcservices/AcceptsTelemetryIF.h" +#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h" #include "fsfw/parameters/ParameterHelper.h" #include "VirtualChannel.h" #include @@ -18,6 +20,7 @@ class CCSDSHandler: public SystemObject, public ExecutableObjectIF, public AcceptsTelemetryIF, + public AcceptsTelecommandsIF, public HasReturnvaluesIF, public ReceivesParameterMessagesIF { public: @@ -29,8 +32,9 @@ public: * * @param objectId Object ID of the CCSDS handler * @param ptmeId Object ID of the PTME object providing access to the PTME IP Core. + * @param tcDestination Object ID of object handling received TC space packets */ - CCSDSHandler(object_id_t objectId, object_id_t ptmeId); + CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination); ~CCSDSHandler(); @@ -51,6 +55,9 @@ public: ParameterWrapper *parameterWrapper, const ParameterWrapper *newValues, uint16_t startAtIndex); + uint16_t getIdentifier() override; + MessageQueueId_t getRequestQueue() override; + private: static const uint32_t QUEUE_SIZE = common::CCSDS_HANDLER_QUEUE_SIZE; @@ -63,10 +70,14 @@ private: // Object ID of PTME object object_id_t ptmeId; + object_id_t tcDestination; + MessageQueueIF* commandQueue = nullptr; ParameterHelper parameterHelper; + MessageQueueId_t tcDistributorQueueId; + void readCommandQueue(void); void handleTelemetry(); void handleTelecommands(); From 9191d1ec33eb9c478744b08bdc4b49ee1951b11c Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 1 Nov 2021 18:11:29 +0100 Subject: [PATCH 07/37] save before changing configuration writing --- linux/obc/PdecConfig.h | 6 ++++-- linux/obc/PdecHandler.cpp | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/linux/obc/PdecConfig.h b/linux/obc/PdecConfig.h index a661d5b4..4c2306c8 100644 --- a/linux/obc/PdecConfig.h +++ b/linux/obc/PdecConfig.h @@ -18,8 +18,10 @@ namespace PdecConfig { // TC transfer frame configuration parameters static const uint8_t VERSION_ID = 0; - static const uint8_t BYPASS_FLAG = 1; - static const uint8_t CONTROL_COMMAND_FLAG = 1; +// static const uint8_t BYPASS_FLAG = 1; +// static const uint8_t CONTROL_COMMAND_FLAG = 1; + static const uint8_t BYPASS_FLAG = 0; + static const uint8_t CONTROL_COMMAND_FLAG = 0; static const uint8_t VIRTUAL_CHANNEL = 0; static const uint8_t RESERVED_FIELD_A = 0; static const uint16_t SPACECRAFT_ID = 0x274; diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index 7e7278fa..fb40c623 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -106,10 +106,13 @@ void PdecHandler::writePdecConfig() { pdecParams.negativeWindow = PdecConfig::NEGATIVE_WINDOW; std::memcpy(memoryBaseAddress, &pdecParams, sizeof(pdecParams)); +// uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER); // Configure all MAP IDs as invalid for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) { *(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx / 4) = NO_DESTINATION << 24 | NO_DESTINATION << 16 | NO_DESTINATION << 8 | NO_DESTINATION; +// *(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx / 4) = routeToPm << 24 +// | routeToPm << 16 | routeToPm << 8 | routeToPm; } @@ -123,7 +126,7 @@ ReturnValue_t PdecHandler::resetFarStatFlag() { uint32_t pdecFar = *(registerBaseAddress + PDEC_FAR_OFFSET); if (pdecFar != FAR_RESET) { sif::warning << "PdecHandler::resetFarStatFlag: FAR register did not match expected value." - << " Read value:" << static_cast(pdecFar) << std::endl; + << " Read value: 0x" << std::hex << static_cast(pdecFar) << std::endl; return RETURN_FAILED; } #if OBSW_DEBUG_PDEC_HANDLER == 1 @@ -174,6 +177,10 @@ ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) { bool PdecHandler::newTcReceived() { uint32_t pdecFar = *(registerBaseAddress + PDEC_FAR_OFFSET); + + sif::debug << "PdecHandler::newTcReceived: pdecFar 0x" << std::hex + << static_cast(pdecFar) << std::endl; + if (pdecFar >> STAT_POSITION != NEW_FAR_RECEIVED) { return false; } From 3e2f4e7a109856e0df5c151d19fac66a2f8c7111 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Tue, 2 Nov 2021 11:11:38 +0100 Subject: [PATCH 08/37] class to generate pdec config words --- bsp_q7s/boardconfig/busConf.h | 3 +++ bsp_q7s/core/ObjectFactory.cpp | 3 ++- linux/obc/CMakeLists.txt | 1 + linux/obc/PdecConfig.cpp | 33 ++++++++++++++++++++++++++++++ linux/obc/PdecConfig.h | 35 +++++++++++++++++++++++--------- linux/obc/PdecHandler.cpp | 27 ++++++++++--------------- linux/obc/PdecHandler.h | 37 ++++++++++++---------------------- 7 files changed, 89 insertions(+), 50 deletions(-) create mode 100644 linux/obc/PdecConfig.cpp diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index 75d67b1a..75618e7a 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -16,6 +16,9 @@ static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8"; static constexpr char UART_GNSS_0_DEV[] = "/dev/ttyUL0"; static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2"; +static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0"; +static constexpr char UIO_PDEC_MEMORY[] = "/dev/uio2"; + namespace gpioNames { static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select"; static constexpr char GYRO_1_L3G_CS[] = "gyro_1_l3g_chip_select"; diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index d297bb05..b86b29f8 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -960,7 +960,8 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) { gpioComIF->addGpios(gpioCookiePdec); - new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET); + new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET, + std::string(q7s::UIO_PDEC_MEMORY), std::string(q7s::UIO_PDEC_REGISTERS)); #if BOARD_TE0720 == 0 GpioCookie* gpioRS485Chip = new GpioCookie; diff --git a/linux/obc/CMakeLists.txt b/linux/obc/CMakeLists.txt index 220bd375..371ea7cd 100644 --- a/linux/obc/CMakeLists.txt +++ b/linux/obc/CMakeLists.txt @@ -2,6 +2,7 @@ target_sources(${TARGET_NAME} PUBLIC PapbVcInterface.cpp Ptme.cpp PdecHandler.cpp + PdecConfig.cpp ) diff --git a/linux/obc/PdecConfig.cpp b/linux/obc/PdecConfig.cpp new file mode 100644 index 00000000..6e5e3a91 --- /dev/null +++ b/linux/obc/PdecConfig.cpp @@ -0,0 +1,33 @@ +#include "PdecConfig.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + +PdecConfig::PdecConfig() { + initialize(); +} + +PdecConfig::~PdecConfig() { + +} + +void PdecConfig::initialize() { + uint32_t word = 0; + word |= (VERSION_ID << 30); + word |= (BYPASS_FLAG << 29); + word |= (CONTROL_COMMAND_FLAG << 28); + word |= (RESERVED_FIELD_A << 26); + word |= (SPACECRAFT_ID << 16); + word |= (VIRTUAL_CHANNEL << 10); + word |= (DUMMY_BITS << 8); + word |= POSITIVE_WINDOW; + configWords[0] = word; + word = 0; + word |= (NEGATIVE_WINDOW << 24); +} + +uint32_t PdecConfig::getConfigWord(uint8_t wordNo) { + if (wordNo >= CONFIG_WORDS_NUM) { + sif::error << "PdecConfig::getConfigWord: Invalid word number" << std::endl; + return 0; + } + return configWords[wordNo]; +} diff --git a/linux/obc/PdecConfig.h b/linux/obc/PdecConfig.h index 4c2306c8..d1159bf2 100644 --- a/linux/obc/PdecConfig.h +++ b/linux/obc/PdecConfig.h @@ -5,29 +5,46 @@ #include /** - * @brief PDEC specific configuration parameters. + * @brief This class generates the configuration words for the configuration memory of the PDEC + * IP Cores. + * + * @details Fields are initialized according to pecification in PDEC datasheet section 6.11.3.1 + * PROM usage. * * @author J. Meier */ -namespace PdecConfig { +class PdecConfig { - // Access to register space of PDEC via the AXI to AHB bridge - static const char UIO_PDEC_REGISTERS[] = "/dev/uio0"; - // Direct access to memory area in DDR assigned to PDEC - static const char UIO_PDEC_MEMORY[] = "/dev/uio2"; +public: + PdecConfig(); + virtual ~PdecConfig(); + /** + * @brief Returns the configuration word by specifying the position. + */ + uint32_t getConfigWord(uint8_t wordNo); + +private: // TC transfer frame configuration parameters static const uint8_t VERSION_ID = 0; -// static const uint8_t BYPASS_FLAG = 1; -// static const uint8_t CONTROL_COMMAND_FLAG = 1; - static const uint8_t BYPASS_FLAG = 0; + // BD Frames + static const uint8_t BYPASS_FLAG = 1; static const uint8_t CONTROL_COMMAND_FLAG = 0; + static const uint8_t VIRTUAL_CHANNEL = 0; static const uint8_t RESERVED_FIELD_A = 0; static const uint16_t SPACECRAFT_ID = 0x274; + static const uint16_t DUMMY_BITS = 0; // Parameters to control the FARM for AD frames + // Set here for future use static const uint8_t POSITIVE_WINDOW = 10; static const uint8_t NEGATIVE_WINDOW = 151; + + static const uint8_t CONFIG_WORDS_NUM = 2; + + uint32_t configWords[CONFIG_WORDS_NUM]; + + void initialize(); }; #endif /* LINUX_OBC_PDECCONFIG_H_ */ diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index fb40c623..df6e967f 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -9,10 +9,11 @@ #include "fsfw/tmtcservices/TmTcMessage.h" #include "fsfw/objectmanager/ObjectManager.h" -PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId, LinuxLibgpioIF* gpioComIF, - gpioId_t pdecReset) : +PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId, + LinuxLibgpioIF* gpioComIF, gpioId_t pdecReset, std::string uioMemory, + std::string uioRegisters) : SystemObject(objectId), tcDestinationId(tcDestinationId), gpioComIF(gpioComIF), pdecReset( - pdecReset) { + pdecReset), uioMemory(uioMemory), uioRegisters(uioRegisters) { } @@ -58,7 +59,7 @@ ReturnValue_t PdecHandler::initialize() { } ReturnValue_t PdecHandler::getRegisterAddress() { - int fd = open(PdecConfig::UIO_PDEC_REGISTERS, O_RDWR); + int fd = open(uioRegisters.c_str(), O_RDWR); if (fd < 1) { sif::warning << "PdecHandler::getRegisterAddress: Invalid UIO device file" << std::endl; return RETURN_FAILED; @@ -76,7 +77,7 @@ ReturnValue_t PdecHandler::getRegisterAddress() { } ReturnValue_t PdecHandler::getMemoryBaseAddress() { - int fd = open(PdecConfig::UIO_PDEC_MEMORY, O_RDWR); + int fd = open(uioMemory.c_str(), O_RDWR); if (fd < 1) { sif::warning << "PdecHandler::getMemoryBaseAddress: Invalid UIO device file" << std::endl; return RETURN_FAILED; @@ -94,17 +95,11 @@ ReturnValue_t PdecHandler::getMemoryBaseAddress() { } void PdecHandler::writePdecConfig() { - PdecParams_t pdecParams; - pdecParams.versionId = 0; - pdecParams.bypassFlag = PdecConfig::BYPASS_FLAG; - pdecParams.controlCommandFlag = PdecConfig::CONTROL_COMMAND_FLAG; - pdecParams.reservedFieldA = 0; - pdecParams.spacecraftId = PdecConfig::SPACECRAFT_ID; - pdecParams.virtualChannelId = PdecConfig::VIRTUAL_CHANNEL; - pdecParams.dummy = 0; - pdecParams.positiveWindow = PdecConfig::POSITIVE_WINDOW; - pdecParams.negativeWindow = PdecConfig::NEGATIVE_WINDOW; - std::memcpy(memoryBaseAddress, &pdecParams, sizeof(pdecParams)); + + PdecConfig pdecConfig; + + *memoryBaseAddress = pdecConfig.getConfigWord(0); + *(memoryBaseAddress + 1) = pdecConfig.getConfigWord(1); // uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER); // Configure all MAP IDs as invalid diff --git a/linux/obc/PdecHandler.h b/linux/obc/PdecHandler.h index 033977e4..7f7d1420 100644 --- a/linux/obc/PdecHandler.h +++ b/linux/obc/PdecHandler.h @@ -37,9 +37,11 @@ public: * @param tcDestinationId Object ID of object responsible for processing TCs. * @param gpioComIF Pointer to GPIO interace responsible for driving GPIOs. * @param pdecReset GPIO ID of GPIO connected to the reset signal of the PDEC. + * @param uioMemory String of uio device file same mapped to the PDEC memory space + * @param uioregsiters String of uio device file same mapped to the PDEC register space */ PdecHandler(object_id_t objectId, object_id_t tcDestinationId, LinuxLibgpioIF* gpioComIF, - gpioId_t pdecReset); + gpioId_t pdecReset, std::string uioMemory, std::string uioRegisters); virtual ~PdecHandler(); @@ -148,25 +150,6 @@ private: INCORRECT_BC_CC }; - typedef struct PdecParams { - uint8_t versionId : 2 ; - uint8_t bypassFlag : 1; - uint8_t controlCommandFlag : 1; - uint8_t reservedFieldA : 2; - uint16_t spacecraftId : 10; - uint8_t virtualChannelId : 6; - uint8_t dummy : 2; - uint8_t positiveWindow; - uint8_t negativeWindow; - //Authentication unit not used for EIVE - uint8_t auMapIdPointer = 0; - // De-randomizing enabled - uint8_t derandomiserConfig = 1; - // Only used when AU is enabled. Enables the use of an external recovery lac counter. - // The AU requires a lac counter to generate the signature. - uint8_t recoveryLacConfig = 0; - } PdecParams_t; - enum class State: uint8_t { INIT, RUNNING, @@ -269,10 +252,6 @@ private: LinuxLibgpioIF* gpioComIF = nullptr; - StorageManagerIF* tcStore = nullptr; - - State state = State::INIT; - /** * Reset signal is required to hold PDEC in reset state until the configuration has been * written to the appropriate memory space. @@ -280,6 +259,16 @@ private: */ gpioId_t pdecReset = gpio::NO_GPIO; + // UIO device file giving access to the PDEC memory space + std::string uioMemory; + + // UIO device file giving access to the PDEC register space + std::string uioRegisters; + + StorageManagerIF* tcStore = nullptr; + + State state = State::INIT; + /** * Pointer pointing to base address of the PDEC memory space. * This address is equivalent with the base address of the section named configuration area in From 709661ff6730b4d4228acd4a145d5946b8bea03f Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 3 Nov 2021 18:19:36 +0100 Subject: [PATCH 09/37] pdec handler print tc --- bsp_q7s/boardconfig/busConf.h | 3 +- bsp_q7s/core/ObjectFactory.cpp | 3 +- linux/obc/PdecConfig.cpp | 3 + linux/obc/PdecConfig.h | 2 + linux/obc/PdecHandler.cpp | 117 ++++++++++++++++++++++++--------- linux/obc/PdecHandler.h | 47 ++++++++++--- 6 files changed, 132 insertions(+), 43 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index 75618e7a..e68a1f19 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -17,7 +17,8 @@ static constexpr char UART_GNSS_0_DEV[] = "/dev/ttyUL0"; static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2"; static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0"; -static constexpr char UIO_PDEC_MEMORY[] = "/dev/uio2"; +static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2"; +static constexpr char UIO_PDEC_RAM[] = "/dev/uio3"; namespace gpioNames { static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select"; diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index b86b29f8..a64a1493 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -961,7 +961,8 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) { gpioComIF->addGpios(gpioCookiePdec); new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET, - std::string(q7s::UIO_PDEC_MEMORY), std::string(q7s::UIO_PDEC_REGISTERS)); + std::string(q7s::UIO_PDEC_CONFIG_MEMORY), std::string(q7s::UIO_PDEC_RAM), + std::string(q7s::UIO_PDEC_REGISTERS)); #if BOARD_TE0720 == 0 GpioCookie* gpioRS485Chip = new GpioCookie; diff --git a/linux/obc/PdecConfig.cpp b/linux/obc/PdecConfig.cpp index 6e5e3a91..bb2ffb13 100644 --- a/linux/obc/PdecConfig.cpp +++ b/linux/obc/PdecConfig.cpp @@ -22,6 +22,9 @@ void PdecConfig::initialize() { configWords[0] = word; word = 0; word |= (NEGATIVE_WINDOW << 24); + word |= (HIGH_AU_MAP_ID << 16); + word |= (ENABLE_DERANDOMIZER << 8); + configWords[1] = word; } uint32_t PdecConfig::getConfigWord(uint8_t wordNo) { diff --git a/linux/obc/PdecConfig.h b/linux/obc/PdecConfig.h index d1159bf2..46cd5097 100644 --- a/linux/obc/PdecConfig.h +++ b/linux/obc/PdecConfig.h @@ -39,6 +39,8 @@ private: // Set here for future use static const uint8_t POSITIVE_WINDOW = 10; static const uint8_t NEGATIVE_WINDOW = 151; + static const uint8_t HIGH_AU_MAP_ID = 0xF; + static const uint8_t ENABLE_DERANDOMIZER = 1; static const uint8_t CONFIG_WORDS_NUM = 2; diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index df6e967f..0a49f94a 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -10,10 +11,11 @@ #include "fsfw/objectmanager/ObjectManager.h" PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId, - LinuxLibgpioIF* gpioComIF, gpioId_t pdecReset, std::string uioMemory, - std::string uioRegisters) : + LinuxLibgpioIF* gpioComIF, gpioId_t pdecReset, std::string uioConfigMemory, + std::string uioRamMemory, std::string uioRegisters) : SystemObject(objectId), tcDestinationId(tcDestinationId), gpioComIF(gpioComIF), pdecReset( - pdecReset), uioMemory(uioMemory), uioRegisters(uioRegisters) { + pdecReset), uioConfigMemory(uioConfigMemory), uioRamMemory(uioRamMemory), uioRegisters( + uioRegisters) { } @@ -43,7 +45,12 @@ ReturnValue_t PdecHandler::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } - result = getMemoryBaseAddress(); + result = getConfigMemoryBaseAddress(); + if (result != RETURN_OK) { + return ObjectManagerIF::CHILD_INIT_FAILED; + } + + result = getRamBaseAddress(); if (result != RETURN_OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } @@ -76,45 +83,62 @@ ReturnValue_t PdecHandler::getRegisterAddress() { return RETURN_OK; } -ReturnValue_t PdecHandler::getMemoryBaseAddress() { - int fd = open(uioMemory.c_str(), O_RDWR); +ReturnValue_t PdecHandler::getConfigMemoryBaseAddress() { + int fd = open(uioConfigMemory.c_str(), O_RDWR); if (fd < 1) { - sif::warning << "PdecHandler::getMemoryBaseAddress: Invalid UIO device file" << std::endl; + sif::warning << "PdecHandler::getConfigMemoryBaseAddress: Invalid UIO device file" << std::endl; return RETURN_FAILED; } - memoryBaseAddress = static_cast(mmap(NULL, MEMORY_MAP_SIZE, PROT_WRITE | PROT_READ, + memoryBaseAddress = static_cast(mmap(NULL, CONFIG_MEMORY_MAP_SIZE, PROT_WRITE | PROT_READ, MAP_SHARED, fd, 0)); if (memoryBaseAddress == MAP_FAILED) { - sif::error << "PdecHandler::getMemoryBaseAddress: Failed to map uio address" << std::endl; + sif::error << "PdecHandler::getConfigMemoryBaseAddress: Failed to map uio address" << std::endl; return RETURN_FAILED; } return RETURN_OK; } +ReturnValue_t PdecHandler::getRamBaseAddress() { + int fd = open(uioRamMemory.c_str(), O_RDWR); + + ramBaseAddress = static_cast(mmap(NULL, RAM_MAP_SIZE, PROT_WRITE | PROT_READ, + MAP_SHARED, fd, 0)); + + if (ramBaseAddress == MAP_FAILED) { + sif::error << "PdecHandler::getRamBaseAddress: Failed to map RAM base address" << std::endl; + return RETURN_FAILED; + } + return RETURN_OK; +} + void PdecHandler::writePdecConfig() { PdecConfig pdecConfig; - *memoryBaseAddress = pdecConfig.getConfigWord(0); - *(memoryBaseAddress + 1) = pdecConfig.getConfigWord(1); + *(memoryBaseAddress + FRAME_HEADER_OFFSET)= pdecConfig.getConfigWord(0); + *(memoryBaseAddress + FRAME_HEADER_OFFSET + 1) = pdecConfig.getConfigWord(1); -// uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER); // Configure all MAP IDs as invalid for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) { - *(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx / 4) = NO_DESTINATION << 24 + *(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx + 1 / 4) = NO_DESTINATION << 24 | NO_DESTINATION << 16 | NO_DESTINATION << 8 | NO_DESTINATION; -// *(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx / 4) = routeToPm << 24 -// | routeToPm << 16 | routeToPm << 8 | routeToPm; } // All TCs with MAP ID 7 will be routed to the PM module (can then be read from memory) uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER); - *(memoryBaseAddress + 1) = NO_DESTINATION << 24 | NO_DESTINATION << 16 | NO_DESTINATION << 8 + *(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + 1) = (NO_DESTINATION << 24) | (NO_DESTINATION << 16) | (NO_DESTINATION << 8) | routeToPm; + + // Write map id clock frequencies + for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) { + *(memoryBaseAddress + MAP_CLK_FREQ_OFFSET + idx / 4) = MAP_CLK_FREQ << 24 + | MAP_CLK_FREQ << 16 | MAP_CLK_FREQ << 8 | MAP_CLK_FREQ; + + } } ReturnValue_t PdecHandler::resetFarStatFlag() { @@ -173,9 +197,6 @@ ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) { bool PdecHandler::newTcReceived() { uint32_t pdecFar = *(registerBaseAddress + PDEC_FAR_OFFSET); - sif::debug << "PdecHandler::newTcReceived: pdecFar 0x" << std::hex - << static_cast(pdecFar) << std::endl; - if (pdecFar >> STAT_POSITION != NEW_FAR_RECEIVED) { return false; } @@ -303,11 +324,12 @@ void PdecHandler::handleNewTc() { if (result != RETURN_OK) { return; } -#if OBSW_DEBUG_PDEC == 1 +#if OBSW_DEBUG_PDEC_HANDLER == 1 unsigned int mapId = tcSegment[0] & MAP_ID_MASK; sif::debug << "PdecHandler::handleNewTc: Received TC segment with map ID" << mapId << std::endl; -#endif /* OBSW_DEBUG_PDEC */ + printTC(tcLength); +#endif /* OBSW_DEBUG_PDEC_HANDLER */ store_address_t storeId; result = tcStore->addData(&storeId, tcSegment + 1, tcLength - 1); @@ -331,18 +353,17 @@ void PdecHandler::handleNewTc() { } ReturnValue_t PdecHandler::readTc(uint32_t& tcLength) { - uint32_t tcOffset = *(registerBaseAddress + PDEC_BPTR_OFFSET) - PHYSICAL_BASE_ADDRESS; + uint32_t tcOffset = (*(registerBaseAddress + PDEC_BPTR_OFFSET) - PHYSICAL_RAM_BASE_ADDRESS) / 4; -#if OBSW_DEBUG_PDEC == 1 - sif::debug << "PdecHandler::readTc: TC offset: " << std::hex << tcOffset << std::endl; -#endif /* OBSW_DEBUG_PDEC */ +#if OBSW_DEBUG_PDEC_HANDLER == 1 + sif::debug << "PdecHandler::readTc: TC offset: 0x" << std::hex << tcOffset << std::endl; +#endif /* OBSW_DEBUG_PDEC_HANDLER */ - uint32_t* tcPtr = reinterpret_cast(*(registerBaseAddress + tcOffset) / 4); tcLength = *(registerBaseAddress + PDEC_SLEN_OFFSET); -#if OBSW_DEBUG_PDEC == 1 - sif::debug << "PdecHandler::readTc: TC length: " << tcLength << std::endl; -#endif /* OBSW_DEBUG_PDEC */ +#if OBSW_DEBUG_PDEC_HANDLER == 1 + sif::debug << "PdecHandler::readTc: TC segment length: " << std::dec << tcLength << std::endl; +#endif /* OBSW_DEBUG_PDEC_HANDLER */ if (tcLength > MAX_TC_SEGMENT_SIZE) { sif::warning << "PdecHandler::handleNewTc: Read invalid TC length from PDEC register" @@ -352,9 +373,31 @@ ReturnValue_t PdecHandler::readTc(uint32_t& tcLength) { uint32_t idx = 0; uint32_t tcData = 0; - for (idx = 0; idx < tcLength; idx = idx + 4) { - tcData = *(tcPtr + idx); - std::memcpy(tcSegment + idx, &tcData, sizeof(tcData)); + for (idx = 0; idx <= tcLength; idx = idx + 4) { + tcData = *(ramBaseAddress + tcOffset + idx / 4); + if (idx == 0) { + tcSegment[idx] = static_cast((tcData >> 16) & 0xFF); + tcSegment[idx + 1] = static_cast((tcData >> 8) & 0xFF); + tcSegment[idx + 2] = static_cast(tcData & 0xFF); + } + else if (tcLength - idx + 1 == 3) { + tcSegment[idx - 1] = static_cast((tcData >> 16) & 0xFF); + tcSegment[idx] = static_cast((tcData >> 8) & 0xFF); + tcSegment[idx + 1] = static_cast(tcData & 0xFF); + } + else if (tcLength - idx + 1 == 2) { + tcSegment[idx - 1] = static_cast((tcData >> 8) & 0xFF); + tcSegment[idx + 1] = static_cast(tcData & 0xFF); + } + else if (tcLength - idx + 1 == 1) { + tcSegment[idx - 1] = static_cast(tcData & 0xFF); + } + else { + tcSegment[idx - 1] = static_cast((tcData >> 24) & 0xFF); + tcSegment[idx] = static_cast((tcData >> 16) & 0xFF); + tcSegment[idx + 1] = static_cast((tcData >> 8) & 0xFF); + tcSegment[idx + 2] = static_cast(tcData & 0xFF); + } } // Backend buffer is handled back to PDEC3 @@ -363,6 +406,16 @@ ReturnValue_t PdecHandler::readTc(uint32_t& tcLength) { return RETURN_OK; } +void PdecHandler::printTC(uint32_t tcLength) { + std::stringstream tcSegmentStream; + tcSegmentStream << "TC segment data: 0x"; + for (uint32_t idx = 0; idx < tcLength; idx++) { + tcSegmentStream << std::setfill('0') << std::setw(2) << std::hex + << static_cast(tcSegment[idx]); + } + sif::debug << tcSegmentStream.str() << std::endl; +} + uint8_t PdecHandler::calcMapAddrEntry(uint8_t moduleId) { uint8_t lutEntry = 0; uint8_t parity = getOddParity(moduleId | (1 << VALID_POSITION)); diff --git a/linux/obc/PdecHandler.h b/linux/obc/PdecHandler.h index 7f7d1420..10e57afc 100644 --- a/linux/obc/PdecHandler.h +++ b/linux/obc/PdecHandler.h @@ -37,11 +37,12 @@ public: * @param tcDestinationId Object ID of object responsible for processing TCs. * @param gpioComIF Pointer to GPIO interace responsible for driving GPIOs. * @param pdecReset GPIO ID of GPIO connected to the reset signal of the PDEC. - * @param uioMemory String of uio device file same mapped to the PDEC memory space + * @param uioConfigMemory String of uio device file same mapped to the PDEC memory space * @param uioregsiters String of uio device file same mapped to the PDEC register space */ PdecHandler(object_id_t objectId, object_id_t tcDestinationId, LinuxLibgpioIF* gpioComIF, - gpioId_t pdecReset, std::string uioMemory, std::string uioRegisters); + gpioId_t pdecReset, std::string uioConfigMemory, std::string uioRamMemory, + std::string uioRegisters); virtual ~PdecHandler(); @@ -104,14 +105,19 @@ private: static const uint32_t PDEC_BPTR_OFFSET = 0xA25; static const uint32_t PDEC_SLEN_OFFSET = 0xA26; - static const int MEMORY_MAP_SIZE = 0xF42400; + static const int CONFIG_MEMORY_MAP_SIZE = 0x400; + static const int RAM_MAP_SIZE = 0x4000; static const int REGISTER_MAP_SIZE = 0x10000; + // 0x200 / 4 = 0x80 + static const uint32_t FRAME_HEADER_OFFSET = 0x80; + static const size_t MAX_TC_SEGMENT_SIZE = 1017; static const uint8_t MAP_ID_MASK = 0x3F; - static const uint32_t PHYSICAL_BASE_ADDRESS = 0x30000000; + static const uint32_t PHYSICAL_RAM_BASE_ADDRESS = 0x32000000; static const uint32_t MAP_ADDR_LUT_OFFSET = 0xA0; + static const uint32_t MAP_CLK_FREQ_OFFSET = 0x90; static const uint8_t MAX_MAP_ADDR = 63; // Writing this to the map address in the look up table will invalidate a MAP ID. @@ -122,11 +128,17 @@ private: // Expected value stored in FAR register after reset static const uint32_t FAR_RESET = 0x7FE0; + static const uint32_t TC_SEGMENT_LEN = 1017; + /** * TCs with map addresses (also know as Map IDs) assigned to this channel will be stored in * the PDEC memory. */ - static const uint32_t PM_BUFFER = 7; + static const uint8_t PM_BUFFER = 7; + + // MAP clock frequency. Must be a value between 1 and 13 otherwise the TC segment will be + // discarded + static const uint8_t MAP_CLK_FREQ = 2; enum class FrameAna_t: uint8_t { ABANDONED_CLTU, @@ -166,7 +178,14 @@ private: * @brief Opens UIO device assigned to the base address of the PDEC memory space and maps the * physical address into the virtual address space. */ - ReturnValue_t getMemoryBaseAddress(); + ReturnValue_t getConfigMemoryBaseAddress(); + + /** + * @brief Opens UIO device assigned to the RAM section of the PDEC IP core memory map. + * + * @details A received TC segment will be written to this memory area. + */ + ReturnValue_t getRamBaseAddress(); /** * @brief This functions writes the configuration parameters to the configuration @@ -225,6 +244,11 @@ private: */ ReturnValue_t readTc(uint32_t& tcLength); + /** + * @brief Prints the tc segment data + */ + void printTC(uint32_t tcLength); + /** * @brief This function calculates the entry for the configuration of the MAP ID routing. * @@ -259,8 +283,11 @@ private: */ gpioId_t pdecReset = gpio::NO_GPIO; - // UIO device file giving access to the PDEC memory space - std::string uioMemory; + // UIO device file giving access to the PDEC configuration memory section + std::string uioConfigMemory; + + // UIO device file giving access to the PDEC RAM section + std::string uioRamMemory; // UIO device file giving access to the PDEC register space std::string uioRegisters; @@ -276,12 +303,14 @@ private: */ uint32_t* memoryBaseAddress = nullptr; + uint32_t* ramBaseAddress = nullptr; + // Pointer pointing to base address of register space uint32_t* registerBaseAddress = nullptr; uint32_t pdecFar = 0; - uint8_t tcSegment[1017]; + uint8_t tcSegment[TC_SEGMENT_LEN]; }; #endif /* LINUX_OBC_PDECHANDLER_H_ */ From 6f85968f3cec3813e86333899042942fab38ecee Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 3 Nov 2021 19:49:41 +0100 Subject: [PATCH 10/37] clcw readout --- linux/obc/PdecHandler.cpp | 57 ++++++++++++++++++++++++++++++++++++++- linux/obc/PdecHandler.h | 6 +++++ 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index 0a49f94a..e20cdb95 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -183,6 +183,7 @@ ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) { if (newTcReceived()) { handleNewTc(); } + getClcw(); break; case State::WAIT_FOR_RECOVERY: break; @@ -326,7 +327,7 @@ void PdecHandler::handleNewTc() { } #if OBSW_DEBUG_PDEC_HANDLER == 1 unsigned int mapId = tcSegment[0] & MAP_ID_MASK; - sif::debug << "PdecHandler::handleNewTc: Received TC segment with map ID" << mapId + sif::debug << "PdecHandler::handleNewTc: Received TC segment with map ID " << mapId << std::endl; printTC(tcLength); #endif /* OBSW_DEBUG_PDEC_HANDLER */ @@ -432,3 +433,57 @@ uint8_t PdecHandler::getOddParity(uint8_t number) { parityBit = ~(countBits & 0x1) & 0x1; return parityBit; } + +void PdecHandler::getClcw() { + uint32_t clcw = *(registerBaseAddress + PDEC_CLCW_OFFSET); + +#if OBSW_DEBUG_PDEC_HANDLER == 1 + if (debugDivider == 5) { + printClcw(clcw); + debugDivider = 0; + return; + } + debugDivider++; +#endif /* OBSW_DEBUG_PDEC_HANDLER == 1 */ + +} + +void PdecHandler::printClcw(uint32_t clcw) { + uint8_t type = static_cast((clcw >> 31) & 0x1); + uint8_t versionNo = static_cast((clcw >> 29) & 0x3); + uint8_t status = static_cast((clcw >> 26) & 0x7); + uint8_t cop = static_cast((clcw >> 24) & 0x3); + uint8_t vcId = static_cast((clcw >> 18) & 0x3F); + uint8_t noRf = static_cast((clcw >> 15) & 0x1); + uint8_t noBitLock = static_cast((clcw >> 14) & 0x1); + uint8_t lockoutFlag = static_cast((clcw >> 13) & 0x1); + uint8_t waitFlag = static_cast((clcw >> 12) & 0x1); + uint8_t retransmitFlag = static_cast((clcw >> 11) & 0x1); + uint8_t farmBcnt = static_cast((clcw >> 9) & 0x3); + // Expected frame sequence number in te next AD frame + uint8_t repValue = static_cast(clcw & 0xFF); + sif::info << std::setw(30) << std::left << "CLCW type: " << std::hex + << "0x" << static_cast(type) << std::endl; + sif::info << std::setw(30) << std::left << "CLCW version no: " << std::hex + << "0x" << static_cast(versionNo) << std::endl; + sif::info << std::setw(30) << std::left << "CLCW status: " << std::hex + << "0x" << static_cast(status) << std::endl; + sif::info << std::setw(30) << std::left << "CLCW COP: " << std::hex + << "0x" << static_cast(cop) << std::endl; + sif::info << std::setw(30) << std::left << "CLCW virtual channel ID: " << std::hex + << "0x" << static_cast(vcId) << std::endl; + sif::info << std::setw(30) << std::left << "CLCW no RF: " << std::hex + << "0x" << static_cast(noRf) << std::endl; + sif::info << std::setw(30) << std::left << "CLCW no bit lock: " << std::hex + << "0x" << static_cast(noBitLock) << std::endl; + sif::info << std::setw(30) << std::left << "CLCW lockout flag: " << std::hex + << "0x" << static_cast(lockoutFlag) << std::endl; + sif::info << std::setw(30) << std::left << "CLCW wait flag: " << std::hex + << "0x" << static_cast(waitFlag) << std::endl; + sif::info << std::setw(30) << std::left << "CLCW retransmit flag: " << std::hex + << "0x" << static_cast(retransmitFlag) << std::endl; + sif::info << std::setw(30) << std::left << "CLCW FARM B count: " << std::hex + << "0x" << static_cast(farmBcnt) << std::endl; + sif::info << std::setw(30) << std::left << "CLCW rep value: " << std::hex + << "0x" << static_cast(repValue) << std::endl; +} diff --git a/linux/obc/PdecHandler.h b/linux/obc/PdecHandler.h index 10e57afc..4e07ea43 100644 --- a/linux/obc/PdecHandler.h +++ b/linux/obc/PdecHandler.h @@ -101,6 +101,7 @@ private: * Example: PDEC_FAR = 0x2840 => Offset in virtual address space is 0xA10 */ static const uint32_t PDEC_FAR_OFFSET = 0xA10; + static const uint32_t PDEC_CLCW_OFFSET = 0xA12; static const uint32_t PDEC_BFREE_OFFSET = 0xA24; static const uint32_t PDEC_BPTR_OFFSET = 0xA25; static const uint32_t PDEC_SLEN_OFFSET = 0xA26; @@ -270,6 +271,9 @@ private: */ uint8_t getOddParity(uint8_t number); + void getClcw(); + void printClcw(uint32_t clcw); + object_id_t tcDestinationId; AcceptsTelecommandsIF* tcDestination = nullptr; @@ -311,6 +315,8 @@ private: uint32_t pdecFar = 0; uint8_t tcSegment[TC_SEGMENT_LEN]; + + uint8_t debugDivider = 0; }; #endif /* LINUX_OBC_PDECHANDLER_H_ */ From 08b369f667c8c233dd8d5cf5c1bf932a4ad64fa0 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sat, 6 Nov 2021 20:28:33 +0100 Subject: [PATCH 11/37] fix in pdec tc reading --- linux/obc/PdecHandler.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index e20cdb95..86493ce8 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -256,7 +256,7 @@ bool PdecHandler::checkFrameAna(uint32_t pdecFar) { break; } default: { - sif::debug << "PdecHandler::checkFrameAna: Invaid frame analysis report" << std::endl; + sif::debug << "PdecHandler::checkFrameAna: Invalid frame analysis report" << std::endl; break; } } @@ -311,7 +311,7 @@ void PdecHandler::handleIReason(uint32_t pdecFar, ReturnValue_t parameter1) { break; } default: { - sif::debug << "PdecHandler::handleIReason: Invaid reason id" << std::endl; + sif::debug << "PdecHandler::handleIReason: Invalid reason id" << std::endl; break; } } @@ -382,16 +382,16 @@ ReturnValue_t PdecHandler::readTc(uint32_t& tcLength) { tcSegment[idx + 2] = static_cast(tcData & 0xFF); } else if (tcLength - idx + 1 == 3) { - tcSegment[idx - 1] = static_cast((tcData >> 16) & 0xFF); - tcSegment[idx] = static_cast((tcData >> 8) & 0xFF); - tcSegment[idx + 1] = static_cast(tcData & 0xFF); + tcSegment[idx - 1] = static_cast((tcData >> 24) & 0xFF); + tcSegment[idx] = static_cast((tcData >> 16) & 0xFF); + tcSegment[idx + 1] = static_cast((tcData >> 8) & 0xFF); } else if (tcLength - idx + 1 == 2) { - tcSegment[idx - 1] = static_cast((tcData >> 8) & 0xFF); - tcSegment[idx + 1] = static_cast(tcData & 0xFF); + tcSegment[idx - 1] = static_cast((tcData >> 24) & 0xFF); + tcSegment[idx] = static_cast((tcData >> 16) & 0xFF); } else if (tcLength - idx + 1 == 1) { - tcSegment[idx - 1] = static_cast(tcData & 0xFF); + tcSegment[idx - 1] = static_cast((tcData >> 24) & 0xFF); } else { tcSegment[idx - 1] = static_cast((tcData >> 24) & 0xFF); From f75e7b20025737723f10aad3a77c59d167e466fa Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 8 Nov 2021 12:25:12 +0100 Subject: [PATCH 12/37] adaptions to q7s design --- linux/obc/PdecHandler.cpp | 2 +- linux/obc/PdecHandler.h | 7 +++++++ linux/obc/PtmeConfig.h | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index 86493ce8..9f95860b 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -435,9 +435,9 @@ uint8_t PdecHandler::getOddParity(uint8_t number) { } void PdecHandler::getClcw() { - uint32_t clcw = *(registerBaseAddress + PDEC_CLCW_OFFSET); #if OBSW_DEBUG_PDEC_HANDLER == 1 + uint32_t clcw = *(registerBaseAddress + PDEC_CLCW_OFFSET); if (debugDivider == 5) { printClcw(clcw); debugDivider = 0; diff --git a/linux/obc/PdecHandler.h b/linux/obc/PdecHandler.h index 4e07ea43..d6b44c13 100644 --- a/linux/obc/PdecHandler.h +++ b/linux/obc/PdecHandler.h @@ -1,6 +1,7 @@ #ifndef LINUX_OBC_PDECHANDLER_H_ #define LINUX_OBC_PDECHANDLER_H_ +#include "OBSWConfig.h" #include "PdecConfig.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h" #include "fsfw_hal/common/gpio/gpioDefinitions.h" @@ -106,9 +107,15 @@ private: static const uint32_t PDEC_BPTR_OFFSET = 0xA25; static const uint32_t PDEC_SLEN_OFFSET = 0xA26; +#if BOARD_TE0720 == 1 static const int CONFIG_MEMORY_MAP_SIZE = 0x400; static const int RAM_MAP_SIZE = 0x4000; static const int REGISTER_MAP_SIZE = 0x10000; +#else + static const int CONFIG_MEMORY_MAP_SIZE = 0x400; + static const int RAM_MAP_SIZE = 0x4000; + static const int REGISTER_MAP_SIZE = 0x4000; +#endif /* BOARD_TE0720 == 1 */ // 0x200 / 4 = 0x80 static const uint32_t FRAME_HEADER_OFFSET = 0x80; diff --git a/linux/obc/PtmeConfig.h b/linux/obc/PtmeConfig.h index a3b17551..9ec9cfde 100644 --- a/linux/obc/PtmeConfig.h +++ b/linux/obc/PtmeConfig.h @@ -20,9 +20,9 @@ namespace PtmeConfig { static const uint32_t VC2_OFFSETT = 0x8000; static const uint32_t VC3_OFFSETT = 0xC000; #if BOARD_TE0720 == 0 - static const char UIO_DEVICE_FILE[] = "/dev/uio0"; -#else static const char UIO_DEVICE_FILE[] = "/dev/uio1"; +#else + static const char UIO_DEVICE_FILE[] = "/dev/uio0"; #endif }; From 9e9a19ebb086a80e8fc86ba5c82017cbd6a9e0eb Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 17 Nov 2021 11:27:29 +0100 Subject: [PATCH 13/37] changed ptme uio on te0720 --- linux/obc/PdecHandler.cpp | 2 +- linux/obc/PdecHandler.h | 1 + linux/obc/PtmeConfig.h | 2 +- mission/devices/StarTrackerHandler.cpp | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index 9f95860b..3d80af8a 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -438,7 +438,7 @@ void PdecHandler::getClcw() { #if OBSW_DEBUG_PDEC_HANDLER == 1 uint32_t clcw = *(registerBaseAddress + PDEC_CLCW_OFFSET); - if (debugDivider == 5) { + if (debugDivider == 10) { printClcw(clcw); debugDivider = 0; return; diff --git a/linux/obc/PdecHandler.h b/linux/obc/PdecHandler.h index d6b44c13..7696a7a0 100644 --- a/linux/obc/PdecHandler.h +++ b/linux/obc/PdecHandler.h @@ -106,6 +106,7 @@ private: static const uint32_t PDEC_BFREE_OFFSET = 0xA24; static const uint32_t PDEC_BPTR_OFFSET = 0xA25; static const uint32_t PDEC_SLEN_OFFSET = 0xA26; + static const uint32_t PDEC_MON = 0xA27; #if BOARD_TE0720 == 1 static const int CONFIG_MEMORY_MAP_SIZE = 0x400; diff --git a/linux/obc/PtmeConfig.h b/linux/obc/PtmeConfig.h index 9ec9cfde..814dfeda 100644 --- a/linux/obc/PtmeConfig.h +++ b/linux/obc/PtmeConfig.h @@ -22,7 +22,7 @@ namespace PtmeConfig { #if BOARD_TE0720 == 0 static const char UIO_DEVICE_FILE[] = "/dev/uio1"; #else - static const char UIO_DEVICE_FILE[] = "/dev/uio0"; + static const char UIO_DEVICE_FILE[] = "/dev/uio1"; #endif }; diff --git a/mission/devices/StarTrackerHandler.cpp b/mission/devices/StarTrackerHandler.cpp index a695403f..c5718f02 100644 --- a/mission/devices/StarTrackerHandler.cpp +++ b/mission/devices/StarTrackerHandler.cpp @@ -86,7 +86,7 @@ ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t *start, size_t rema continue; } case ARC_DEC_ASYNC: { - sif::debug << "StarTrackerHandler::scanForReply: Received asychronous tm" << std::endl; + sif::debug << "StarTrackerHandler::scanForReply: Received asynchronous tm" << std::endl; /** No asynchronous replies are expected as of now */ return RETURN_FAILED; } From a2d5f872ad6b95b3da61ccbfbb2b6ec1e0b399bd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 18 Nov 2021 18:54:00 +0100 Subject: [PATCH 14/37] fsfw and tmtc update --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index 15687f6f..190848d0 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 15687f6f6e0ca284dbe502f082ef3ab2f0b27b71 +Subproject commit 190848d00e32274eb844e0f930669b65ffe7eb4e diff --git a/tmtc b/tmtc index edcaf2e9..28082dca 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit edcaf2e9c323cbda2ef331e93cc04985f44c6855 +Subproject commit 28082dca885e35641fda85be765ff10c16c3ebe8 From c1be4a1e834ed302feeab57236a63c45c4795dcf Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 19 Nov 2021 13:22:20 +0100 Subject: [PATCH 15/37] changes for updated fsfw --- bsp_q7s/boardtest/Q7STestTask.cpp | 12 ++++---- bsp_q7s/memory/FileSystemHandler.cpp | 28 +++++++++++++------ bsp_q7s/memory/FileSystemHandler.h | 18 ++++++------ fsfw | 2 +- .../Host/eive-linux-host-unittest.launch | 4 +-- test/testtasks/TestTask.cpp | 17 ++++++----- test/testtasks/TestTask.h | 15 ++++------ tmtc | 2 +- 8 files changed, 52 insertions(+), 46 deletions(-) diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp index 18baf124..7681ef09 100644 --- a/bsp_q7s/boardtest/Q7STestTask.cpp +++ b/bsp_q7s/boardtest/Q7STestTask.cpp @@ -227,7 +227,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { // Lambda for common code auto createNonEmptyTmpDir = [&]() { if(not std::filesystem::exists("/tmp/test")) { - result = fsHandler->createDirectory("/tmp/test", &cfg); + result = fsHandler->createDirectory("/tmp", "test", false, &cfg); if(result != HasReturnvaluesIF::RETURN_OK) { return result; } @@ -278,7 +278,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { cfg.useMountPrefix = false; sif::info << "Creating empty file in /tmp folder" << std::endl; // Do not delete file, user can check existence in shell - ReturnValue_t result = fsHandler->createDirectory("/tmp/test", &cfg); + ReturnValue_t result = fsHandler->createDirectory("/tmp", "test", false, &cfg); if(result == HasReturnvaluesIF::RETURN_OK) { sif::info << "Directory created successfully" << std::endl; } @@ -291,13 +291,13 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { // No mount prefix, cause file is created in tmp cfg.useMountPrefix = false; if(not std::filesystem::exists("/tmp/test")) { - result = fsHandler->createDirectory("/tmp/test", &cfg); + result = fsHandler->createDirectory("/tmp", "test", false, &cfg); } else { // Delete any leftover files to regular dir removal works std::remove("/tmp/test/*"); } - result = fsHandler->removeDirectory("/tmp/test", false, &cfg); + result = fsHandler->removeDirectory("/tmp", "test", false, &cfg); if(result == HasReturnvaluesIF::RETURN_OK) { sif::info << "Directory removed successfully" << std::endl; } @@ -311,7 +311,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { if(result != HasReturnvaluesIF::RETURN_OK) { return; } - result = fsHandler->removeDirectory("/tmp/test", true, &cfg); + result = fsHandler->removeDirectory("/tmp", "test", true, &cfg); if(result == HasReturnvaluesIF::RETURN_OK) { sif::info << "Directory removed recursively successfully" << std::endl; } @@ -325,7 +325,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { if(result != HasReturnvaluesIF::RETURN_OK) { return; } - result = fsHandler->removeDirectory("/tmp/test", false, &cfg); + result = fsHandler->removeDirectory("/tmp", "test", false, &cfg); if(result != HasReturnvaluesIF::RETURN_OK) { sif::info << "Directory removal attempt failed as expected" << std::endl; } diff --git a/bsp_q7s/memory/FileSystemHandler.cpp b/bsp_q7s/memory/FileSystemHandler.cpp index ad8ec137..2943875a 100644 --- a/bsp_q7s/memory/FileSystemHandler.cpp +++ b/bsp_q7s/memory/FileSystemHandler.cpp @@ -133,8 +133,9 @@ ReturnValue_t FileSystemHandler::initialize() { return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t FileSystemHandler::appendToFile(const char *repositoryPath, const char *filename, - const uint8_t *data, size_t size, uint16_t packetNumber, void *args) { +ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath, + const char* filename, const uint8_t* data, size_t size, + uint16_t packetNumber, FileSystemArgsIF* args) { // A double slash between repo and filename should not be an issue, so add it in any case std::string fullPath = currentMountPrefix + std::string(repositoryPath) + "/" + std::string(filename); @@ -149,8 +150,8 @@ ReturnValue_t FileSystemHandler::appendToFile(const char *repositoryPath, const return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t FileSystemHandler::createFile(const char *repositoryPath, const char *filename, - const uint8_t *data, size_t size, void *args) { +ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath, + const char* filename, const uint8_t* data, size_t size, FileSystemArgsIF* args) { std::string fullPath; bool useMountPrefix = true; parseCfg(reinterpret_cast(args), useMountPrefix); @@ -171,8 +172,8 @@ ReturnValue_t FileSystemHandler::createFile(const char *repositoryPath, const ch return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t FileSystemHandler::removeFile(const char *repositoryPath, const char *filename, - void *args) { +ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath, + const char* filename, FileSystemArgsIF* args) { std::string fullPath; bool useMountPrefix = true; parseCfg(reinterpret_cast(args), useMountPrefix); @@ -193,7 +194,8 @@ ReturnValue_t FileSystemHandler::removeFile(const char *repositoryPath, const ch return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t FileSystemHandler::createDirectory(const char *repositoryPath, void *args) { +ReturnValue_t FileSystemHandler:: createDirectory(const char* repositoryPath, const char* dirname, + bool createParentDirs, FileSystemArgsIF* args) { std::string fullPath; bool useMountPrefix = true; parseCfg(reinterpret_cast(args), useMountPrefix); @@ -202,6 +204,7 @@ ReturnValue_t FileSystemHandler::createDirectory(const char *repositoryPath, voi } fullPath += std::string(repositoryPath); + fullPath += "/" + std::string(dirname); if(std::filesystem::exists(fullPath)) { return DIRECTORY_ALREADY_EXISTS; } @@ -212,8 +215,8 @@ ReturnValue_t FileSystemHandler::createDirectory(const char *repositoryPath, voi return GENERIC_FILE_ERROR; } -ReturnValue_t FileSystemHandler::removeDirectory(const char *repositoryPath, - bool deleteRecurively, void *args) { +ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, const char* dirname, + bool deleteRecurively, FileSystemArgsIF* args) { std::string fullPath; bool useMountPrefix = true; parseCfg(reinterpret_cast(args), useMountPrefix); @@ -222,6 +225,7 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char *repositoryPath, } fullPath += std::string(repositoryPath); + fullPath += "/" + std::string(dirname); if(not std::filesystem::exists(fullPath)) { return DIRECTORY_DOES_NOT_EXIST; } @@ -268,3 +272,9 @@ void FileSystemHandler::parseCfg(FsCommandCfg *cfg, bool& useMountPrefix) { useMountPrefix = cfg->useMountPrefix; } } + +ReturnValue_t FileSystemHandler::renameFile(const char *repositoryPath, const char *oldFilename, + const char *newFilename, FileSystemArgsIF *args) { + // TODO: Implement + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/bsp_q7s/memory/FileSystemHandler.h b/bsp_q7s/memory/FileSystemHandler.h index 1ff5d7c9..8fdebd05 100644 --- a/bsp_q7s/memory/FileSystemHandler.h +++ b/bsp_q7s/memory/FileSystemHandler.h @@ -17,7 +17,7 @@ class FileSystemHandler: public SystemObject, public ExecutableObjectIF, public HasFileSystemIF { public: - struct FsCommandCfg { + struct FsCommandCfg: public FileSystemArgsIF { // Can be used to automatically use mount prefix of active SD card. // Otherwise, the operator has to specify the full path to the mounted SD card as well. bool useMountPrefix = false; @@ -35,18 +35,20 @@ public: * @return MessageQueueId_t of the object */ MessageQueueId_t getCommandQueue() const override; - ReturnValue_t appendToFile(const char* repositoryPath, const char* filename, const uint8_t* data, size_t size, - uint16_t packetNumber, void* args = nullptr) override; + uint16_t packetNumber, FileSystemArgsIF* args = nullptr) override; ReturnValue_t createFile(const char* repositoryPath, const char* filename, const uint8_t* data = nullptr, - size_t size = 0, void* args = nullptr) override; + size_t size = 0, FileSystemArgsIF* args = nullptr) override; ReturnValue_t removeFile(const char* repositoryPath, - const char* filename, void* args = nullptr) override; - ReturnValue_t createDirectory(const char* repositoryPath, void* args = nullptr) override; - ReturnValue_t removeDirectory(const char* repositoryPath, bool deleteRecurively = false, - void* args = nullptr) override; + const char* filename, FileSystemArgsIF* args = nullptr) override; + ReturnValue_t createDirectory(const char* repositoryPath, const char* dirname, + bool createParentDirs, FileSystemArgsIF* args = nullptr) override; + ReturnValue_t removeDirectory(const char* repositoryPath, const char* dirname, + bool deleteRecurively = false, FileSystemArgsIF* args = nullptr) override; + ReturnValue_t renameFile(const char* repositoryPath, const char* oldFilename, + const char* newFilename, FileSystemArgsIF* args = nullptr) override; private: CoreController* coreCtrl = nullptr; diff --git a/fsfw b/fsfw index 190848d0..5d719d0a 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 190848d00e32274eb844e0f930669b65ffe7eb4e +Subproject commit 5d719d0aeb2d4e2089f5106a03c0bbf9caee4381 diff --git a/misc/eclipse/Host/eive-linux-host-unittest.launch b/misc/eclipse/Host/eive-linux-host-unittest.launch index 85d54281..68c1747f 100644 --- a/misc/eclipse/Host/eive-linux-host-unittest.launch +++ b/misc/eclipse/Host/eive-linux-host-unittest.launch @@ -18,10 +18,10 @@ - + - + diff --git a/test/testtasks/TestTask.cpp b/test/testtasks/TestTask.cpp index cb185b4a..6a90cc08 100644 --- a/test/testtasks/TestTask.cpp +++ b/test/testtasks/TestTask.cpp @@ -11,15 +11,14 @@ #include -TestTask::TestTask(object_id_t objectId_): -SystemObject(objectId_), testMode(testModes::A) { +EiveTestTask::EiveTestTask(object_id_t objectId_): TestTask(objectId_), testMode(testModes::A) { IPCStore = ObjectManager::instance()->get(objects::IPC_STORE); } -TestTask::~TestTask() { +EiveTestTask::~EiveTestTask() { } -ReturnValue_t TestTask::performOperation(uint8_t operationCode) { +ReturnValue_t EiveTestTask::performOperation(uint8_t operationCode) { ReturnValue_t result = RETURN_OK; if(oneShotAction) { @@ -74,7 +73,7 @@ const char hyperion_gps_data[] = "" "$GNVTG,040.7,T,,M,000.0,N,000.0,K,A*10\r\n" "$GNZDA,173225.998892,27,02,2021,00,00*75\r\n"; -ReturnValue_t TestTask::performOneShotAction() { +ReturnValue_t EiveTestTask::performOneShotAction() { #if OBSW_ADD_TEST_CODE == 1 //performLwgpsTest(); #endif @@ -82,24 +81,24 @@ ReturnValue_t TestTask::performOneShotAction() { } -ReturnValue_t TestTask::performPeriodicAction() { +ReturnValue_t EiveTestTask::performPeriodicAction() { ReturnValue_t result = RETURN_OK; return result; } -ReturnValue_t TestTask::performActionA() { +ReturnValue_t EiveTestTask::performActionA() { ReturnValue_t result = RETURN_OK; /* Add periodically executed code here */ return result; } -ReturnValue_t TestTask::performActionB() { +ReturnValue_t EiveTestTask::performActionB() { ReturnValue_t result = RETURN_OK; /* Add periodically executed code here */ return result; } -void TestTask::performLwgpsTest() { +void EiveTestTask::performLwgpsTest() { /* Everything here will only be performed once. */ sif::info << "Processing sample GPS output.." << std::endl; diff --git a/test/testtasks/TestTask.h b/test/testtasks/TestTask.h index e2e8db48..c2b8c8ed 100644 --- a/test/testtasks/TestTask.h +++ b/test/testtasks/TestTask.h @@ -1,13 +1,10 @@ #ifndef TEST_TESTTASK_H_ #define TEST_TESTTASK_H_ -#include -#include -#include #include #include #include -#include +#include "fsfw_tests/integration/task/TestTask.h" #include @@ -18,13 +15,11 @@ * Should not be used for board specific * tests. Instead, a derived board test class should be used. */ -class TestTask : public SystemObject, - public ExecutableObjectIF, - public HasReturnvaluesIF { +class EiveTestTask : public TestTask { public: - TestTask(object_id_t objectId); - virtual ~TestTask(); - virtual ReturnValue_t performOperation(uint8_t operationCode = 0); + EiveTestTask(object_id_t objectId); + virtual ~EiveTestTask(); + virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override; protected: virtual ReturnValue_t performOneShotAction(); diff --git a/tmtc b/tmtc index 28082dca..9068ebbf 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 28082dca885e35641fda85be765ff10c16c3ebe8 +Subproject commit 9068ebbfc07fe2d58d8c41eed133e758729ca9b6 From 4a01ff3537b5ae5ede5c036e5ccb969f984c4dc5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 19 Nov 2021 16:55:17 +0100 Subject: [PATCH 16/37] fsfw and tmtc update --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index 5d719d0a..d8823f12 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 5d719d0aeb2d4e2089f5106a03c0bbf9caee4381 +Subproject commit d8823f12f1ff5ff7ffdf20f03199ace3807851b2 diff --git a/tmtc b/tmtc index 9068ebbf..46d7a15e 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 9068ebbfc07fe2d58d8c41eed133e758729ca9b6 +Subproject commit 46d7a15edf42b7f7e709c49ef9a162a18c45f56a From 67ac4060d72235d79d06026b6db870a494df63ae Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sun, 21 Nov 2021 13:58:05 +0100 Subject: [PATCH 17/37] physical ram base adress for q7s --- linux/obc/PdecHandler.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux/obc/PdecHandler.h b/linux/obc/PdecHandler.h index 7696a7a0..6a8a6562 100644 --- a/linux/obc/PdecHandler.h +++ b/linux/obc/PdecHandler.h @@ -124,7 +124,12 @@ private: static const size_t MAX_TC_SEGMENT_SIZE = 1017; static const uint8_t MAP_ID_MASK = 0x3F; +#if BOARD_TE0720 == 1 static const uint32_t PHYSICAL_RAM_BASE_ADDRESS = 0x32000000; +#else + static const uint32_t PHYSICAL_RAM_BASE_ADDRESS = 0x26000000; +#endif + static const uint32_t MAP_ADDR_LUT_OFFSET = 0xA0; static const uint32_t MAP_CLK_FREQ_OFFSET = 0x90; From 63965e2f6836cb54bbe14baa3f74671fb5100f59 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sun, 21 Nov 2021 13:59:18 +0100 Subject: [PATCH 18/37] enabled rx lines of syrlinks rs485 transceiver chips --- bsp_q7s/boardconfig/busConf.h | 3 +++ bsp_q7s/core/ObjectFactory.cpp | 23 ++++++++++++++++++++++- linux/fsfwconfig/devices/gpioIds.h | 6 +++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index e68a1f19..af89d346 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -66,7 +66,10 @@ namespace gpioNames { static constexpr char PAPB_EMPTY_SIGNAL_VC3[] = "papb_empty_signal_vc3"; static constexpr char RS485_EN_TX_CLOCK[] = "tx_clock_enable_ltc2872"; static constexpr char RS485_EN_TX_DATA[] = "tx_data_enable_ltc2872"; + static constexpr char RS485_EN_RX_CLOCK[] = "rx_clock_enable_ltc2872"; + static constexpr char RS485_EN_RX_DATA[] = "rx_data_enable_ltc2872"; static constexpr char PDEC_RESET[] = "pdec_reset"; + static constexpr char BIT_RATE_SEL[] = "bit_rate_sel"; } } diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index a64a1493..c7738679 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -79,6 +79,8 @@ #include #include #include +#include +#include ResetArgs resetArgsGnss0; ResetArgs resetArgsGnss1; @@ -937,8 +939,19 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) { ptme->addVcInterface(ccsds::VC2, vc2); ptme->addVcInterface(ccsds::VC3, vc3); + GpioCookie* gpioCookieRateSetter = new GpioCookie; + consumer.str(""); + consumer << "ptme rate setter"; + // Init to low -> default bit rate is low bit rate (200 kbps in downlink with syrlinks) + gpio = new GpiodRegularByLineName(q7s::gpioNames::BIT_RATE_SEL, consumer.str(), gpio::OUT, + gpio::LOW); + gpioCookieRateSetter->addGpio(gpioIds::BIT_RATE_SEL, gpio); + gpioComIF->addGpios(gpioCookieRateSetter); + + TxRateSetterIF* txRateSetterIF = new PtmeRateSetter(gpioIds::BIT_RATE_SEL, gpioComIF); + CCSDSHandler* ccsdsHandler = new CCSDSHandler(objects::CCSDS_HANDLER, objects::PTME, - objects::CCSDS_PACKET_DISTRIBUTOR); + objects::CCSDS_PACKET_DISTRIBUTOR, txRateSetterIF); VirtualChannel* vc = nullptr; vc = new VirtualChannel(ccsds::VC0, common::VC0_QUEUE_SIZE); @@ -973,6 +986,14 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) { gpio::Direction::OUT, gpio::HIGH); gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_DATA, gpio); + // Default configuration enables RX channels (RXEN = LOW) + gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_CLOCK, "RS485 Transceiver", + gpio::Direction::OUT, gpio::LOW); + gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_CLOCK, gpio); + gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_DATA, "RS485 Transceiver", + gpio::Direction::OUT, gpio::LOW); + gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_DATA, gpio); + gpioComIF->addGpios(gpioRS485Chip); #endif /* BOARD_TE0720 == 0 */ } diff --git a/linux/fsfwconfig/devices/gpioIds.h b/linux/fsfwconfig/devices/gpioIds.h index 2fe715ea..8d3f94ca 100644 --- a/linux/fsfwconfig/devices/gpioIds.h +++ b/linux/fsfwconfig/devices/gpioIds.h @@ -104,7 +104,11 @@ enum gpioId_t { RS485_EN_TX_DATA, - RS485_EN_TX_CLOCK + RS485_EN_TX_CLOCK, + RS485_EN_RX_DATA, + RS485_EN_RX_CLOCK, + + BIT_RATE_SEL }; } From dc0f435dbd420242953805b9e783b7a0119cc58f Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sun, 21 Nov 2021 18:07:05 +0100 Subject: [PATCH 19/37] bit rate setter --- bsp_q7s/core/InitMission.cpp | 2 +- linux/obc/CMakeLists.txt | 1 + linux/obc/PtmeRateSetter.cpp | 27 +++++++++++++++++++++++ linux/obc/PtmeRateSetter.h | 40 +++++++++++++++++++++++++++++++++++ linux/obc/TxRateSetterIF.h | 25 ++++++++++++++++++++++ mission/tmtc/CCSDSHandler.cpp | 31 +++++++++++++++++++++++++-- mission/tmtc/CCSDSHandler.h | 26 +++++++++++++++++++++-- 7 files changed, 147 insertions(+), 5 deletions(-) create mode 100644 linux/obc/PtmeRateSetter.cpp create mode 100644 linux/obc/PtmeRateSetter.h create mode 100644 linux/obc/TxRateSetterIF.h diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 2c1179d9..eab396c6 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -110,7 +110,7 @@ void initmission::initTasks() { // If a command has not been read before the next one arrives, the old command will be // overwritten by the PDEC. PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask( - "PDEC_HANDLER", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); + "PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.6, missedDeadlineFunc); result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER); if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER); diff --git a/linux/obc/CMakeLists.txt b/linux/obc/CMakeLists.txt index 371ea7cd..4119624c 100644 --- a/linux/obc/CMakeLists.txt +++ b/linux/obc/CMakeLists.txt @@ -3,6 +3,7 @@ target_sources(${TARGET_NAME} PUBLIC Ptme.cpp PdecHandler.cpp PdecConfig.cpp + PtmeRateSetter.cpp ) diff --git a/linux/obc/PtmeRateSetter.cpp b/linux/obc/PtmeRateSetter.cpp new file mode 100644 index 00000000..92886623 --- /dev/null +++ b/linux/obc/PtmeRateSetter.cpp @@ -0,0 +1,27 @@ +#include "PtmeRateSetter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + +PtmeRateSetter::PtmeRateSetter(gpioId_t bitrateSel, GpioIF* gpioif) : + bitrateSel(bitrateSel), gpioif(gpioif) { +} + +PtmeRateSetter::~PtmeRateSetter() { +} + +ReturnValue_t PtmeRateSetter::setRate(BitRates rate) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + switch(rate) { + case RATE_2000KHZ: + result = gpioif->pullHigh(bitrateSel); + break; + case RATE_400KHZ: + result = gpioif->pullLow(bitrateSel); + break; + default: + sif::debug << "PtmeRateSetter::setRate: Invalid rate" << std::endl; + result = HasReturnvaluesIF::RETURN_FAILED; + break; + } + return result; +} + diff --git a/linux/obc/PtmeRateSetter.h b/linux/obc/PtmeRateSetter.h new file mode 100644 index 00000000..ece78e91 --- /dev/null +++ b/linux/obc/PtmeRateSetter.h @@ -0,0 +1,40 @@ +#ifndef LINUX_OBC_PTMERATESETTER_H_ +#define LINUX_OBC_PTMERATESETTER_H_ + +#include "TxRateSetterIF.h" +#include "fsfw_hal/common/gpio/gpioDefinitions.h" +#include "fsfw_hal/common/gpio/GpioIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" + +/** + * @brief Class to set the downlink bit rate by using the cadu_rate_switcher implemented in + * the programmable logic. + * + * @details The cadu_rate_switcher module sets the input rate to the syrlinks transceiver either + * to 2000 kHz (bitrateSel = 1) or 400 kHz (bitrate = 0). + * + * @author J. Meier + */ +class PtmeRateSetter: public TxRateSetterIF { +public: + + /** + * @brief Constructor + * + * @param bitrateSel GPIO ID of the GPIO connected to the bitrate_sel input of the + * cadu_rate_switcher. + * @param gpioif GPIO interface to drive the bitrateSel GPIO + */ + PtmeRateSetter(gpioId_t bitrateSel, GpioIF* gpioif); + virtual ~PtmeRateSetter(); + + virtual ReturnValue_t setRate(BitRates rate); + +private: + + gpioId_t bitrateSel = gpio::NO_GPIO; + + GpioIF* gpioif = nullptr; +}; + +#endif /* LINUX_OBC_PTMERATESETTER_H_ */ diff --git a/linux/obc/TxRateSetterIF.h b/linux/obc/TxRateSetterIF.h new file mode 100644 index 00000000..c07106e4 --- /dev/null +++ b/linux/obc/TxRateSetterIF.h @@ -0,0 +1,25 @@ +#ifndef LINUX_OBC_TXRATESETTERIF_H_ +#define LINUX_OBC_TXRATESETTERIF_H_ + +#include "fsfw/returnvalues/HasReturnvaluesIF.h" + +enum BitRates : uint32_t { + RATE_2000KHZ, + RATE_400KHZ +}; + +/** + * @brief Abstract class for objects implementing the functionality to switch the + * downlink bit rate. + * + * @author J. Meier + */ +class TxRateSetterIF { +public: + TxRateSetterIF() {}; + virtual ~TxRateSetterIF() {}; + + virtual ReturnValue_t setRate(BitRates bitRate) = 0; +}; + +#endif /* LINUX_OBC_TXRATESETTERIF_H_ */ diff --git a/mission/tmtc/CCSDSHandler.cpp b/mission/tmtc/CCSDSHandler.cpp index ad630044..caf99515 100644 --- a/mission/tmtc/CCSDSHandler.cpp +++ b/mission/tmtc/CCSDSHandler.cpp @@ -5,8 +5,10 @@ #include "CCSDSHandler.h" -CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination) : - SystemObject(objectId), ptmeId(ptmeId), tcDestination(tcDestination), parameterHelper(this) { +CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination, + TxRateSetterIF* txRateSetterIF) : + SystemObject(objectId), ptmeId(ptmeId), tcDestination(tcDestination), parameterHelper(this), actionHelper( + this, nullptr), txRateSetterIF(txRateSetterIF) { commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE); } @@ -55,6 +57,11 @@ ReturnValue_t CCSDSHandler::initialize() { return result; } + result = actionHelper.initialize(commandQueue); + if (result != RETURN_OK) { + return result; + } + VirtualChannelMapIter iter; for (iter = virtualChannelMap.begin(); iter != virtualChannelMap.end(); iter++) { result = iter->second->initialize(); @@ -77,10 +84,15 @@ void CCSDSHandler::readCommandQueue(void) { if (result == RETURN_OK) { return; } + result = actionHelper.handleActionMessage(&commandMessage); + if (result == RETURN_OK) { + return; + } CommandMessage reply; reply.setReplyRejected(CommandMessage::UNKNOWN_COMMAND, commandMessage.getCommand()); commandQueue->reply(&reply); + return; } } @@ -140,3 +152,18 @@ MessageQueueId_t CCSDSHandler::getRequestQueue() { // Forward packets directly to TC distributor return tcDistributorQueueId; } + +ReturnValue_t CCSDSHandler::executeAction(ActionId_t actionId, + MessageQueueId_t commandedBy, const uint8_t* data, size_t size) { + + switch(actionId) { + case SET_LOW_RATE: + txRateSetterIF->setRate(BitRates::RATE_400KHZ); + return EXECUTION_FINISHED; + case SET_HIGH_RATE: + txRateSetterIF->setRate(BitRates::RATE_2000KHZ); + return EXECUTION_FINISHED; + default: + return COMMAND_NOT_IMPLEMENTED; + } +} diff --git a/mission/tmtc/CCSDSHandler.h b/mission/tmtc/CCSDSHandler.h index b1c3dd60..6ed5abbe 100644 --- a/mission/tmtc/CCSDSHandler.h +++ b/mission/tmtc/CCSDSHandler.h @@ -8,6 +8,9 @@ #include "fsfw/tmtcservices/AcceptsTelemetryIF.h" #include "fsfw/tmtcservices/AcceptsTelecommandsIF.h" #include "fsfw/parameters/ParameterHelper.h" +#include "fsfw/action/ActionHelper.h" +#include "fsfw/action/HasActionsIF.h" +#include "linux/obc/TxRateSetterIF.h" #include "VirtualChannel.h" #include @@ -22,7 +25,8 @@ class CCSDSHandler: public SystemObject, public AcceptsTelemetryIF, public AcceptsTelecommandsIF, public HasReturnvaluesIF, - public ReceivesParameterMessagesIF { + public ReceivesParameterMessagesIF, + public HasActionsIF { public: using VcId_t = uint8_t; @@ -33,8 +37,11 @@ public: * @param objectId Object ID of the CCSDS handler * @param ptmeId Object ID of the PTME object providing access to the PTME IP Core. * @param tcDestination Object ID of object handling received TC space packets + * @param txRateSetter Object providing the functionality to switch the input bitrate of + * the S-Band transceiver. */ - CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination); + CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination, + TxRateSetterIF* txRateSetterIF); ~CCSDSHandler(); @@ -58,10 +65,21 @@ public: uint16_t getIdentifier() override; MessageQueueId_t getRequestQueue() override; + virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, + const uint8_t* data, size_t size); + private: + static const uint8_t INTERFACE_ID = CLASS_ID::CCSDS_HANDLER; + static const uint32_t QUEUE_SIZE = common::CCSDS_HANDLER_QUEUE_SIZE; + static const ActionId_t SET_LOW_RATE = 0; + static const ActionId_t SET_HIGH_RATE = 1; + + //! [EXPORT] : [COMMENT] Received action message with unknown action id + static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xA0); + using VirtualChannelMap = std::unordered_map; using VirtualChannelMapIter = VirtualChannelMap::iterator; @@ -76,8 +94,12 @@ private: ParameterHelper parameterHelper; + ActionHelper actionHelper; + MessageQueueId_t tcDistributorQueueId; + TxRateSetterIF* txRateSetterIF = nullptr; + void readCommandQueue(void); void handleTelemetry(); void handleTelecommands(); From 283921cba189e2c988404b3a08792edead17cea2 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 22 Nov 2021 10:38:32 +0100 Subject: [PATCH 20/37] print clcw command --- linux/obc/PdecHandler.cpp | 65 +++++++++++++++++++++++++++++---------- linux/obc/PdecHandler.h | 44 ++++++++++++++++++++++---- 2 files changed, 87 insertions(+), 22 deletions(-) diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index 3d80af8a..d68f79a4 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -9,14 +9,16 @@ #include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/tmtcservices/TmTcMessage.h" #include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/ipc/QueueFactory.h" + PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId, LinuxLibgpioIF* gpioComIF, gpioId_t pdecReset, std::string uioConfigMemory, std::string uioRamMemory, std::string uioRegisters) : SystemObject(objectId), tcDestinationId(tcDestinationId), gpioComIF(gpioComIF), pdecReset( pdecReset), uioConfigMemory(uioConfigMemory), uioRamMemory(uioRamMemory), uioRegisters( - uioRegisters) { - + uioRegisters), actionHelper(this, nullptr) { + commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE); } PdecHandler::~PdecHandler() { @@ -62,9 +64,18 @@ ReturnValue_t PdecHandler::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } + result = actionHelper.initialize(commandQueue); + if (result != RETURN_OK) { + return result; + } + return RETURN_OK; } +MessageQueueId_t PdecHandler::getCommandQueue() const { + return commandQueue->getId(); +} + ReturnValue_t PdecHandler::getRegisterAddress() { int fd = open(uioRegisters.c_str(), O_RDWR); if (fd < 1) { @@ -168,6 +179,8 @@ ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) { ReturnValue_t result = RETURN_OK; + readCommandQueue(); + switch(state) { case State::INIT: resetFarStatFlag(); @@ -183,7 +196,6 @@ ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) { if (newTcReceived()) { handleNewTc(); } - getClcw(); break; case State::WAIT_FOR_RECOVERY: break; @@ -195,6 +207,24 @@ ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) { return RETURN_OK; } +void PdecHandler::readCommandQueue(void) { + CommandMessage commandMessage; + ReturnValue_t result = RETURN_FAILED; + + result = commandQueue->receiveMessage(&commandMessage); + if (result == RETURN_OK) { + result = actionHelper.handleActionMessage(&commandMessage); + if (result == RETURN_OK) { + return; + } + CommandMessage reply; + reply.setReplyRejected(CommandMessage::UNKNOWN_COMMAND, + commandMessage.getCommand()); + commandQueue->reply(&reply); + return; + } +} + bool PdecHandler::newTcReceived() { uint32_t pdecFar = *(registerBaseAddress + PDEC_FAR_OFFSET); @@ -434,21 +464,12 @@ uint8_t PdecHandler::getOddParity(uint8_t number) { return parityBit; } -void PdecHandler::getClcw() { - -#if OBSW_DEBUG_PDEC_HANDLER == 1 - uint32_t clcw = *(registerBaseAddress + PDEC_CLCW_OFFSET); - if (debugDivider == 10) { - printClcw(clcw); - debugDivider = 0; - return; - } - debugDivider++; -#endif /* OBSW_DEBUG_PDEC_HANDLER == 1 */ - +uint32_t PdecHandler::getClcw() { + return *(registerBaseAddress + PDEC_CLCW_OFFSET); } -void PdecHandler::printClcw(uint32_t clcw) { +void PdecHandler::printClcw() { + uint32_t clcw = getClcw(); uint8_t type = static_cast((clcw >> 31) & 0x1); uint8_t versionNo = static_cast((clcw >> 29) & 0x3); uint8_t status = static_cast((clcw >> 26) & 0x7); @@ -487,3 +508,15 @@ void PdecHandler::printClcw(uint32_t clcw) { sif::info << std::setw(30) << std::left << "CLCW rep value: " << std::hex << "0x" << static_cast(repValue) << std::endl; } + + +ReturnValue_t PdecHandler::executeAction(ActionId_t actionId, + MessageQueueId_t commandedBy, const uint8_t* data, size_t size) { + switch(actionId) { + case PRINT_CLCW: + printClcw(); + return EXECUTION_FINISHED; + default: + return COMMAND_NOT_IMPLEMENTED; + } +} diff --git a/linux/obc/PdecHandler.h b/linux/obc/PdecHandler.h index 6a8a6562..d7c7d236 100644 --- a/linux/obc/PdecHandler.h +++ b/linux/obc/PdecHandler.h @@ -10,6 +10,8 @@ #include "fsfw/storagemanager/StorageManagerIF.h" #include "fsfw/objectmanager/SystemObject.h" #include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/action/ActionHelper.h" +#include "fsfw/action/HasActionsIF.h" /** * @brief This class controls the PDEC IP Core implemented in the programmable logic of the @@ -29,7 +31,10 @@ * * @author J. Meier */ -class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF { +class PdecHandler : public SystemObject, + public ExecutableObjectIF, + public HasReturnvaluesIF, + public HasActionsIF { public: /** @@ -51,6 +56,21 @@ public: ReturnValue_t initialize() override; + MessageQueueId_t getCommandQueue() const; + + ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, + const uint8_t* data, size_t size) override; + + /** + * brief Returns the 32-bit wide communication link control word (CLCW) + */ + uint32_t getClcw(); + + /** + * @rief Reads and prints the CLCW. Can be useful for debugging. + */ + void printClcw(); + private: static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER; @@ -63,6 +83,9 @@ private: static const ReturnValue_t AD_DISCARDED_WAIT = MAKE_RETURN_CODE(0xA4); static const ReturnValue_t AD_DISCARDED_NS_VS = MAKE_RETURN_CODE(0xA5); + //! [EXPORT] : [COMMENT] Received action message with unknown action id + static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xB0); + static const ReturnValue_t NO_REPORT = MAKE_RETURN_CODE(0xA6); //! Error in version number and reserved A and B fields static const ReturnValue_t ERROR_VERSION_NUMBER = MAKE_RETURN_CODE(0xA7); @@ -88,6 +111,11 @@ private: //! [EXPORT] : [COMMENT] Read invalid FAR from PDEC after startup static const Event INVALID_FAR = MAKE_EVENT(2, severity::HIGH); + static const uint32_t QUEUE_SIZE = common::CCSDS_HANDLER_QUEUE_SIZE; + + // Action IDs + static const ActionId_t PRINT_CLCW = 0; + static const uint8_t STAT_POSITION = 31; static const uint8_t FRAME_ANA_POSITION = 28; static const uint8_t IREASON_POSITION = 25; @@ -182,6 +210,11 @@ private: WAIT_FOR_RECOVERY }; + /** + * @brief Reads and handles messages stored in the commandQueue + */ + void readCommandQueue(void); + /** * @brief Opens UIO device assigned to AXI to AHB converter giving access to the PDEC * registers. The register base address will be mapped into the virtual address space. @@ -284,9 +317,6 @@ private: */ uint8_t getOddParity(uint8_t number); - void getClcw(); - void printClcw(uint32_t clcw); - object_id_t tcDestinationId; AcceptsTelecommandsIF* tcDestination = nullptr; @@ -309,8 +339,12 @@ private: // UIO device file giving access to the PDEC register space std::string uioRegisters; + ActionHelper actionHelper; + StorageManagerIF* tcStore = nullptr; + MessageQueueIF* commandQueue = nullptr; + State state = State::INIT; /** @@ -328,8 +362,6 @@ private: uint32_t pdecFar = 0; uint8_t tcSegment[TC_SEGMENT_LEN]; - - uint8_t debugDivider = 0; }; #endif /* LINUX_OBC_PDECHANDLER_H_ */ From 15b2f9a13e0ebe83b6efef48fd8434f16958125a Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 22 Nov 2021 17:55:40 +0100 Subject: [PATCH 21/37] run event parser --- generators/events/translateEvents.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 18f6ba50..b0a9ee6a 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 106 translations. * @details - * Generated on: 2021-10-31 17:56:40 + * Generated on: 2021-11-22 17:04:42 */ #include "translateEvents.h" From cb6db97fc1797137d7b00dd4c155f7032024f17e Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 22 Nov 2021 17:56:46 +0100 Subject: [PATCH 22/37] run object parser --- generators/objects/translateObjects.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index 15f82c2c..48eb29e7 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 111 translations. - * Generated on: 2021-10-13 15:54:21 + * Contains 112 translations. + * Generated on: 2021-11-22 17:04:51 */ #include "translateObjects.h" @@ -86,6 +86,7 @@ const char *PAPB_VC0_STRING = "PAPB_VC0"; const char *PAPB_VC1_STRING = "PAPB_VC1"; const char *PAPB_VC2_STRING = "PAPB_VC2"; const char *PAPB_VC3_STRING = "PAPB_VC3"; +const char *PDEC_HANDLER_STRING = "PDEC_HANDLER"; const char *CCSDS_HANDLER_STRING = "CCSDS_HANDLER"; const char *PUS_SERVICE_6_STRING = "PUS_SERVICE_6"; const char *FSFW_OBJECTS_START_STRING = "FSFW_OBJECTS_START"; @@ -280,6 +281,8 @@ const char* translateObject(object_id_t object) { return PAPB_VC2_STRING; case 0x50000703: return PAPB_VC3_STRING; + case 0x50000704: + return PDEC_HANDLER_STRING; case 0x50000800: return CCSDS_HANDLER_STRING; case 0x51000500: From c2dbebe56be196f309118cebf2441c29f5f1c9e4 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 22 Nov 2021 17:57:33 +0100 Subject: [PATCH 23/37] gen events --- linux/fsfwconfig/events/translateEvents.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 18f6ba50..b0a9ee6a 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 106 translations. * @details - * Generated on: 2021-10-31 17:56:40 + * Generated on: 2021-11-22 17:04:42 */ #include "translateEvents.h" From ec7568337cbf082a240234eb657d0a40b8b2e9c4 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 22 Nov 2021 17:58:24 +0100 Subject: [PATCH 24/37] object parser --- linux/fsfwconfig/objects/translateObjects.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index 15f82c2c..48eb29e7 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 111 translations. - * Generated on: 2021-10-13 15:54:21 + * Contains 112 translations. + * Generated on: 2021-11-22 17:04:51 */ #include "translateObjects.h" @@ -86,6 +86,7 @@ const char *PAPB_VC0_STRING = "PAPB_VC0"; const char *PAPB_VC1_STRING = "PAPB_VC1"; const char *PAPB_VC2_STRING = "PAPB_VC2"; const char *PAPB_VC3_STRING = "PAPB_VC3"; +const char *PDEC_HANDLER_STRING = "PDEC_HANDLER"; const char *CCSDS_HANDLER_STRING = "CCSDS_HANDLER"; const char *PUS_SERVICE_6_STRING = "PUS_SERVICE_6"; const char *FSFW_OBJECTS_START_STRING = "FSFW_OBJECTS_START"; @@ -280,6 +281,8 @@ const char* translateObject(object_id_t object) { return PAPB_VC2_STRING; case 0x50000703: return PAPB_VC3_STRING; + case 0x50000704: + return PDEC_HANDLER_STRING; case 0x50000800: return CCSDS_HANDLER_STRING; case 0x51000500: From 345ccf5392385a7f64f14cc89669cbe29bfd5a28 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 22 Nov 2021 18:01:16 +0100 Subject: [PATCH 25/37] transmit enable and timeout --- bsp_q7s/core/InitMission.cpp | 2 +- bsp_q7s/core/ObjectFactory.cpp | 3 +- generators/bsp_q7s_objects.csv | 1 + linux/fsfwconfig/OBSWConfig.h.in | 2 +- linux/obc/PdecHandler.cpp | 14 ++++ linux/obc/PdecHandler.h | 34 ++++++-- mission/tmtc/CCSDSHandler.cpp | 137 ++++++++++++++++++++++++++++++- mission/tmtc/CCSDSHandler.h | 58 ++++++++++++- 8 files changed, 234 insertions(+), 17 deletions(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index eab396c6..bd70c1c0 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -110,7 +110,7 @@ void initmission::initTasks() { // If a command has not been read before the next one arrives, the old command will be // overwritten by the PDEC. PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask( - "PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.6, missedDeadlineFunc); + "PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc); result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER); if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index c7738679..ec0c085f 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -951,7 +951,8 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) { TxRateSetterIF* txRateSetterIF = new PtmeRateSetter(gpioIds::BIT_RATE_SEL, gpioComIF); CCSDSHandler* ccsdsHandler = new CCSDSHandler(objects::CCSDS_HANDLER, objects::PTME, - objects::CCSDS_PACKET_DISTRIBUTOR, txRateSetterIF); + objects::CCSDS_PACKET_DISTRIBUTOR, txRateSetterIF, gpioComIF, + gpioIds::RS485_EN_TX_CLOCK, gpioIds::RS485_EN_TX_DATA); VirtualChannel* vc = nullptr; vc = new VirtualChannel(ccsds::VC0, common::VC0_QUEUE_SIZE); diff --git a/generators/bsp_q7s_objects.csv b/generators/bsp_q7s_objects.csv index 3d8a4d40..fded183b 100644 --- a/generators/bsp_q7s_objects.csv +++ b/generators/bsp_q7s_objects.csv @@ -78,6 +78,7 @@ 0x50000701;PAPB_VC1 0x50000702;PAPB_VC2 0x50000703;PAPB_VC3 +0x50000704;PDEC_HANDLER 0x50000800;CCSDS_HANDLER 0x51000500;PUS_SERVICE_6 0x53000000;FSFW_OBJECTS_START diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 9dbc5428..3e3bf5c3 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -37,7 +37,7 @@ debugging. */ // Set to 1 if all telemetry should be sent to the PTME IP Core #define OBSW_TM_TO_PTME 1 // Set to 1 if telecommands are received via the PDEC IP Core -#define OBSW_TC_FROM_PDEC 0 +#define OBSW_TC_FROM_PDEC 1 #define OBSW_ENABLE_TIMERS 1 #define OBSW_ADD_STAR_TRACKER 0 diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index d68f79a4..f99a1a30 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -196,6 +196,7 @@ ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) { if (newTcReceived()) { handleNewTc(); } + checkLocks(); break; case State::WAIT_FOR_RECOVERY: break; @@ -237,6 +238,19 @@ bool PdecHandler::newTcReceived() { return true; } +void PdecHandler::checkLocks() { + uint32_t clcw = getClcw(); + if (!(clcw & NO_RF_MASK) && (lastClcw & NO_RF_MASK)) { + // Rf available changed from 0 to 1 + triggerEvent(CARRIER_LOCK); + } + if (!(clcw & NO_BITLOCK_MASK) && (lastClcw & NO_BITLOCK_MASK)) { + // Bit lock changed from 0 to 1 + triggerEvent(BIT_LOCK); + } + lastClcw = clcw; +} + bool PdecHandler::checkFrameAna(uint32_t pdecFar) { bool frameValid = false; FrameAna_t frameAna = static_cast((pdecFar & FRAME_ANA_MASK) >> FRAME_ANA_POSITION); diff --git a/linux/obc/PdecHandler.h b/linux/obc/PdecHandler.h index d7c7d236..83e4a253 100644 --- a/linux/obc/PdecHandler.h +++ b/linux/obc/PdecHandler.h @@ -71,6 +71,19 @@ public: */ void printClcw(); + static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PDEC_HANDLER; + + //! [EXPORT] : [COMMENT] Frame acceptance report signals an invalid frame + //! P1: The frame analysis information (FrameAna field of PDEC_FAR register) + //! P2: When frame declared illegal this parameter this parameter gives information about the reason (IReason field of the PDEC_FAR register) + static const Event INVALID_TC_FRAME = MAKE_EVENT(1, severity::HIGH); + //! [EXPORT] : [COMMENT] Read invalid FAR from PDEC after startup + static const Event INVALID_FAR = MAKE_EVENT(2, severity::HIGH); + //! [EXPORT] : [COMMENT] Carrier lock detected + static const Event CARRIER_LOCK = MAKE_EVENT(3, severity::INFO); + //! [EXPORT] : [COMMENT] Bit lock detected (data valid) + static const Event BIT_LOCK = MAKE_EVENT(4, severity::INFO); + private: static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER; @@ -102,15 +115,6 @@ private: //! Invalid BC control command static const ReturnValue_t INVALID_BC_CC = MAKE_RETURN_CODE(0xAE); - static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PDEC_HANDLER; - - //! [EXPORT] : [COMMENT] Frame acceptance report signals an invalid frame - //! P1: The frame analysis information (FrameAna field of PDEC_FAR register) - //! P2: When frame declared illegal this parameter this parameter gives information about the reason (IReason field of the PDEC_FAR register) - static const Event INVALID_TC_FRAME = MAKE_EVENT(1, severity::HIGH); - //! [EXPORT] : [COMMENT] Read invalid FAR from PDEC after startup - static const Event INVALID_FAR = MAKE_EVENT(2, severity::HIGH); - static const uint32_t QUEUE_SIZE = common::CCSDS_HANDLER_QUEUE_SIZE; // Action IDs @@ -172,6 +176,9 @@ private: static const uint32_t TC_SEGMENT_LEN = 1017; + static const uint32_t NO_RF_MASK = 0x8000; + static const uint32_t NO_BITLOCK_MASK = 0x4000; + /** * TCs with map addresses (also know as Map IDs) assigned to this channel will be stored in * the PDEC memory. @@ -260,6 +267,12 @@ private: */ bool newTcReceived(); + /** + * @brief Checks if carrier lock or bit lock has been detected and triggers appropriate + * event. + */ + void checkLocks(); + /** * @brief Analyzes the FramAna field (frame analysis data) of a FAR report. * @@ -362,6 +375,9 @@ private: uint32_t pdecFar = 0; uint8_t tcSegment[TC_SEGMENT_LEN]; + + // Used to check carrier and bit lock changes (default set to no rf and no bitlock) + uint32_t lastClcw = 0xC000; }; #endif /* LINUX_OBC_PDECHANDLER_H_ */ diff --git a/mission/tmtc/CCSDSHandler.cpp b/mission/tmtc/CCSDSHandler.cpp index caf99515..a9c6df27 100644 --- a/mission/tmtc/CCSDSHandler.cpp +++ b/mission/tmtc/CCSDSHandler.cpp @@ -1,24 +1,32 @@ +#include "OBSWConfig.h" #include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/serviceInterfaceDefintions.h" #include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/ipc/QueueFactory.h" +#include "fsfw/events/EventManagerIF.h" + +#include #include "CCSDSHandler.h" CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination, - TxRateSetterIF* txRateSetterIF) : + TxRateSetterIF* txRateSetterIF, GpioIF* gpioIF, gpioId_t enTxClock, gpioId_t enTxData) : SystemObject(objectId), ptmeId(ptmeId), tcDestination(tcDestination), parameterHelper(this), actionHelper( - this, nullptr), txRateSetterIF(txRateSetterIF) { + this, nullptr), txRateSetterIF(txRateSetterIF), gpioIF(gpioIF), enTxClock( + enTxClock), enTxData(enTxData) { commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE); + eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 2); } CCSDSHandler::~CCSDSHandler() { } ReturnValue_t CCSDSHandler::performOperation(uint8_t operationCode) { + checkEvents(); readCommandQueue(); handleTelemetry(); handleTelecommands(); + checkTxTimer(); return RETURN_OK; } @@ -71,6 +79,27 @@ ReturnValue_t CCSDSHandler::initialize() { iter->second->setPtmeObject(ptme); } + EventManagerIF* manager = ObjectManager::instance()->get( + objects::EVENT_MANAGER); + if (manager == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "CCSDSHandler::initialize: Invalid event manager" << std::endl; +#endif + return RETURN_FAILED; + } + result = manager->registerListener(eventQueue->getId()); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + result = manager->subscribeToEventRange(eventQueue->getId(), + event::getEventId(PdecHandler::CARRIER_LOCK), event::getEventId(PdecHandler::BIT_LOCK)); + if (result != HasReturnvaluesIF::RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "CCSDSHandler::initialize: Failed to subscribe to events from PDEC " + "handler" << std::endl; +#endif + return result; + } return result; } @@ -157,13 +186,113 @@ ReturnValue_t CCSDSHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t size) { switch(actionId) { - case SET_LOW_RATE: + case SET_LOW_RATE: { txRateSetterIF->setRate(BitRates::RATE_400KHZ); return EXECUTION_FINISHED; - case SET_HIGH_RATE: + } + case SET_HIGH_RATE: { txRateSetterIF->setRate(BitRates::RATE_2000KHZ); return EXECUTION_FINISHED; + } + case EN_TRANSMITTER: { + enableTransmit(); + return EXECUTION_FINISHED; + } + case DIS_TRANSMITTER: { + disableTransmit(); + return EXECUTION_FINISHED; + } default: return COMMAND_NOT_IMPLEMENTED; } } + +void CCSDSHandler::checkEvents() { + EventMessage event; + for (ReturnValue_t result = eventQueue->receiveMessage(&event); + result == RETURN_OK; result = eventQueue->receiveMessage(&event)) { + switch (event.getMessageId()) { + case EventMessage::EVENT_MESSAGE: + handleEvent(&event); + break; + default: + sif::debug << "CCSDSHandler::checkEvents: Did not subscribe to this event message" + << std::endl; + break; + } + } +} + + +void CCSDSHandler::handleEvent(EventMessage* eventMessage) { + Event event = eventMessage->getEvent(); + switch(event){ + case PdecHandler::BIT_LOCK: { + handleBitLockEvent(); + break; + } + case PdecHandler::CARRIER_LOCK: { + handleCarrierLockEvent(); + break; + } + default: + sif::debug << "CCSDSHandler::handleEvent: Did not subscribe to this event" + << std::endl; + break; + } +} + +void CCSDSHandler::handleBitLockEvent() { + if(transmitterCountdown.isBusy()) { + // Transmitter already enabled + return; + } + enableTransmit(); +} + +void CCSDSHandler::handleCarrierLockEvent() { + if (!enableTxWhenCarrierLock) { + return; + } + enableTransmit(); +} + +void CCSDSHandler::forwardLinkstate() { + VirtualChannelMapIter iter; + for(iter = virtualChannelMap.begin(); iter != virtualChannelMap.end(); iter++) { + iter->second->setLinkState(linkState); + } +} + +void CCSDSHandler::enableTransmit() { + if(transmitterCountdown.isBusy()) { + // Transmitter already enabled + return; + } + transmitterCountdown.setTimeout(TRANSMITTER_TIMEOUT); +#if BOARD_TE0720 == 0 + gpioIF->pullLow(enTxClock); + gpioIF->pullLow(enTxData); +#endif /* BOARD_TE0720 == 0 */ + linkState = UP; + // Set link state of all virtual channels to link up + forwardLinkstate(); +} + +void CCSDSHandler::checkTxTimer() { + if(linkState == DOWN) { + return; + } + if (transmitterCountdown.hasTimedOut()) { + disableTransmit(); + } +} + +void CCSDSHandler::disableTransmit() { +#if BOARD_TE0720 == 0 + gpioIF->pullHigh(enTxClock); + gpioIF->pullHigh(enTxData); +#endif /* BOARD_TE0720 == 0 */ + linkState = DOWN; + forwardLinkstate(); +} diff --git a/mission/tmtc/CCSDSHandler.h b/mission/tmtc/CCSDSHandler.h index 6ed5abbe..cdab72e0 100644 --- a/mission/tmtc/CCSDSHandler.h +++ b/mission/tmtc/CCSDSHandler.h @@ -10,7 +10,11 @@ #include "fsfw/parameters/ParameterHelper.h" #include "fsfw/action/ActionHelper.h" #include "fsfw/action/HasActionsIF.h" +#include "fsfw/timemanager/Countdown.h" +#include "fsfw/events/EventMessage.h" #include "linux/obc/TxRateSetterIF.h" +#include "fsfw_hal/common/gpio/gpioDefinitions.h" +#include "fsfw_hal/common/gpio/GpioIF.h" #include "VirtualChannel.h" #include @@ -39,9 +43,12 @@ public: * @param tcDestination Object ID of object handling received TC space packets * @param txRateSetter Object providing the functionality to switch the input bitrate of * the S-Band transceiver. + * @param gpioIF Required to enable TX data and TX clock RS485 transceiver chips. + * @param enTxClock GPIO ID of RS485 tx clock enable + * @param enTxData GPIO ID of RS485 tx data enable */ CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination, - TxRateSetterIF* txRateSetterIF); + TxRateSetterIF* txRateSetterIF, GpioIF* gpioIF, gpioId_t enTxClock, gpioId_t enTxData); ~CCSDSHandler(); @@ -76,10 +83,19 @@ private: static const ActionId_t SET_LOW_RATE = 0; static const ActionId_t SET_HIGH_RATE = 1; + static const ActionId_t EN_TRANSMITTER = 2; + static const ActionId_t DIS_TRANSMITTER = 3; //! [EXPORT] : [COMMENT] Received action message with unknown action id static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xA0); + // syrlinks must not be transmitting more than 15 minutes (according to datasheet) +// static const uint32_t TRANSMITTER_TIMEOUT = 900000; //900000 ms = 15 min + static const uint32_t TRANSMITTER_TIMEOUT = 10000; //900000 ms = 15 min + + static const bool UP = true; + static const bool DOWN = false; + using VirtualChannelMap = std::unordered_map; using VirtualChannelMapIter = VirtualChannelMap::iterator; @@ -91,6 +107,7 @@ private: object_id_t tcDestination; MessageQueueIF* commandQueue = nullptr; + MessageQueueIF* eventQueue = nullptr; ParameterHelper parameterHelper; @@ -100,9 +117,48 @@ private: TxRateSetterIF* txRateSetterIF = nullptr; + GpioIF* gpioIF = nullptr; + gpioId_t enTxClock = gpio::NO_GPIO; + gpioId_t enTxData = gpio::NO_GPIO; + + // Countdown to disable transmitter after 15 minutes + Countdown transmitterCountdown; + + // When true transmitting is started as soon as carrier lock has been detected + bool enableTxWhenCarrierLock = false; + + bool linkState = DOWN; + void readCommandQueue(void); void handleTelemetry(); void handleTelecommands(); + void checkEvents(); + void handleEvent(EventMessage* eventMessage); + + void handleBitLockEvent(); + void handleCarrierLockEvent(); + + /** + * @brief Forward link state to virtual channels. + */ + void forwardLinkstate(); + + /** + * @brief Starts transmit timer and enables transmitter. + */ + void enableTransmit(); + + /** + * @brief Checks Tx timer for timeout and disables RS485 tx clock and tx data in case + * timer has expired. + */ + void checkTxTimer(); + + /** + * @brief Disables the transmitter by pulling the enable tx clock and tx data pin of the + * RS485 transceiver chips to high. + */ + void disableTransmit(); }; #endif /* CCSDSHANDLER_H_ */ From 542aa994b712c7c2cfaea36f8c14194a4a773f50 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 24 Nov 2021 15:55:25 +0100 Subject: [PATCH 26/37] link state now detected by bit and carrier lock flags --- bsp_q7s/core/InitMission.cpp | 2 +- bsp_q7s/core/ObjectFactory.cpp | 4 ++-- linux/fsfwconfig/OBSWConfig.h.in | 5 +++-- mission/tmtc/CCSDSHandler.cpp | 10 +++++----- mission/tmtc/CCSDSHandler.h | 8 ++++++-- mission/tmtc/VirtualChannel.cpp | 4 ++-- mission/tmtc/VirtualChannel.h | 6 +----- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index bd70c1c0..7923a2cd 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -110,7 +110,7 @@ void initmission::initTasks() { // If a command has not been read before the next one arrives, the old command will be // overwritten by the PDEC. PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask( - "PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc); + "PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER); if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index ec0c085f..bf8a2fba 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -981,10 +981,10 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) { #if BOARD_TE0720 == 0 GpioCookie* gpioRS485Chip = new GpioCookie; gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_CLOCK, "RS485 Transceiver", - gpio::Direction::OUT, gpio::HIGH); + gpio::Direction::OUT, gpio::LOW); gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_CLOCK, gpio); gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_DATA, "RS485 Transceiver", - gpio::Direction::OUT, gpio::HIGH); + gpio::Direction::OUT, gpio::LOW); gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_DATA, gpio); // Default configuration enables RX channels (RXEN = LOW) diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 3e3bf5c3..0ca7bae2 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -39,6 +39,8 @@ debugging. */ // Set to 1 if telecommands are received via the PDEC IP Core #define OBSW_TC_FROM_PDEC 1 +#define TMTC_TEST_SETUP 1 + #define OBSW_ENABLE_TIMERS 1 #define OBSW_ADD_STAR_TRACKER 0 #define OBSW_ADD_PLOC_SUPERVISOR 0 @@ -92,7 +94,6 @@ debugging. */ #define OBSW_TEST_TE7020_HEATER 0 #define OBSW_TEST_GPIO_OPEN_BY_LABEL 0 #define OBSW_TEST_GPIO_OPEN_BY_LINE_NAME 0 -#define OBSW_LINK_IS_UP 1 #define OBSW_DEBUG_P60DOCK 0 #define OBSW_DEBUG_PDU1 0 @@ -109,7 +110,7 @@ debugging. */ #define OBSW_DEBUG_STARTRACKER 0 #define OBSW_DEBUG_PLOC_MPSOC 0 #define OBSW_DEBUG_PLOC_SUPERVISOR 0 -#define OBSW_DEBUG_PDEC_HANDLER 0 +#define OBSW_DEBUG_PDEC_HANDLER 1 /*******************************************************************/ /** Hardcoded */ diff --git a/mission/tmtc/CCSDSHandler.cpp b/mission/tmtc/CCSDSHandler.cpp index a9c6df27..71307bd9 100644 --- a/mission/tmtc/CCSDSHandler.cpp +++ b/mission/tmtc/CCSDSHandler.cpp @@ -1,4 +1,3 @@ -#include "OBSWConfig.h" #include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/serviceInterfaceDefintions.h" #include "fsfw/objectmanager/ObjectManager.h" @@ -271,8 +270,8 @@ void CCSDSHandler::enableTransmit() { } transmitterCountdown.setTimeout(TRANSMITTER_TIMEOUT); #if BOARD_TE0720 == 0 - gpioIF->pullLow(enTxClock); - gpioIF->pullLow(enTxData); + gpioIF->pullHigh(enTxClock); + gpioIF->pullHigh(enTxData); #endif /* BOARD_TE0720 == 0 */ linkState = UP; // Set link state of all virtual channels to link up @@ -290,9 +289,10 @@ void CCSDSHandler::checkTxTimer() { void CCSDSHandler::disableTransmit() { #if BOARD_TE0720 == 0 - gpioIF->pullHigh(enTxClock); - gpioIF->pullHigh(enTxData); + gpioIF->pullLow(enTxClock); + gpioIF->pullLow(enTxData); #endif /* BOARD_TE0720 == 0 */ linkState = DOWN; forwardLinkstate(); + transmitterCountdown.setTimeout(0); } diff --git a/mission/tmtc/CCSDSHandler.h b/mission/tmtc/CCSDSHandler.h index cdab72e0..6fb6168b 100644 --- a/mission/tmtc/CCSDSHandler.h +++ b/mission/tmtc/CCSDSHandler.h @@ -89,9 +89,13 @@ private: //! [EXPORT] : [COMMENT] Received action message with unknown action id static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xA0); +#if TMTC_TEST_SETUP == 0 // syrlinks must not be transmitting more than 15 minutes (according to datasheet) -// static const uint32_t TRANSMITTER_TIMEOUT = 900000; //900000 ms = 15 min - static const uint32_t TRANSMITTER_TIMEOUT = 10000; //900000 ms = 15 min + static const uint32_t TRANSMITTER_TIMEOUT = 900000; //900000 ms = 15 min +#else + // Set to high value when not sending via syrlinks + static const uint32_t TRANSMITTER_TIMEOUT = 86400000; // 1 day +#endif /* TMTC_TEST_SETUP == 0 */ static const bool UP = true; static const bool DOWN = false; diff --git a/mission/tmtc/VirtualChannel.cpp b/mission/tmtc/VirtualChannel.cpp index 3423692b..0273f5ce 100644 --- a/mission/tmtc/VirtualChannel.cpp +++ b/mission/tmtc/VirtualChannel.cpp @@ -64,6 +64,6 @@ void VirtualChannel::setPtmeObject(PtmeIF* ptme_) { ptme = ptme_; } -void VirtualChannel::setLinkState(bool linkIsUp) { - linkIsUp = linkIsUp; +void VirtualChannel::setLinkState(bool linkIsUp_) { + linkIsUp = linkIsUp_; } diff --git a/mission/tmtc/VirtualChannel.h b/mission/tmtc/VirtualChannel.h index d7d95cb7..c6e2eb6d 100644 --- a/mission/tmtc/VirtualChannel.h +++ b/mission/tmtc/VirtualChannel.h @@ -38,7 +38,7 @@ class VirtualChannel: public AcceptsTelemetryIF, public HasReturnvaluesIF { * @brief Can be used by the owner to set the link state. Packets will be discarded if link * to ground station is down. */ - void setLinkState(bool linkIsUp); + void setLinkState(bool linkIsUp_); private: @@ -46,11 +46,7 @@ private: MessageQueueIF* tmQueue = nullptr; uint8_t vcId; -#if OBSW_LINK_IS_UP == 1 - bool linkIsUp = true; -#else bool linkIsUp = false; -#endif /* OBSW_LINK_IS_UP == 1 */ StorageManagerIF* tmStore = nullptr; }; From 34897aceae14dc5dac2d71f4c40faa3e025d1154 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 24 Nov 2021 18:29:14 +0100 Subject: [PATCH 27/37] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index b2cc2354..aabbb129 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b2cc2354d410b0bc0d80c481bfd37afc580e63cf +Subproject commit aabbb129a6df1d33cf10770a5ecb6336c698f0e6 From b4479d6a7da9cf3ad87fa12d137a6c6a58935f87 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 24 Nov 2021 18:29:34 +0100 Subject: [PATCH 28/37] ccsds handler class id --- common/config/commonClassIds.h | 1 + 1 file changed, 1 insertion(+) diff --git a/common/config/commonClassIds.h b/common/config/commonClassIds.h index 605ace3b..00b5ca25 100644 --- a/common/config/commonClassIds.h +++ b/common/config/commonClassIds.h @@ -22,6 +22,7 @@ enum commonClassIds: uint8_t { GOM_SPACE_HANDLER, //GOMS PLOC_MEMORY_DUMPER, //PLMEMDUMP PDEC_HANDLER, //PDEC + CCSDS_HANDLER, //PDEC COMMON_CLASS_ID_END // [EXPORT] : [END] }; From 1be7208f47cd87967295bba8fd568beedec0e186 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 24 Nov 2021 18:58:34 +0100 Subject: [PATCH 29/37] tmtc and fsfw update --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index d8823f12..d8580074 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit d8823f12f1ff5ff7ffdf20f03199ace3807851b2 +Subproject commit d8580074c2730d861353ab47e659afeb707afe71 diff --git a/tmtc b/tmtc index 46d7a15e..1d374230 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 46d7a15edf42b7f7e709c49ef9a162a18c45f56a +Subproject commit 1d374230b34606d8b6aa4df1335befec316a1e35 From be75332be7608bfc7380d28775ed933f0da61470 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 25 Nov 2021 14:03:21 +0100 Subject: [PATCH 30/37] update event list --- generators/bsp_q7s_events.csv | 212 ++++++++++---------- generators/events/translateEvents.cpp | 2 +- linux/fsfwconfig/OBSWConfig.h.in | 2 +- linux/fsfwconfig/events/translateEvents.cpp | 2 +- 4 files changed, 109 insertions(+), 109 deletions(-) diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index 165ad708..48e9705c 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -1,106 +1,106 @@ -2200;STORE_SEND_WRITE_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2201;STORE_WRITE_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2202;STORE_SEND_READ_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2203;STORE_READ_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2204;UNEXPECTED_MSG;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2205;STORING_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2206;TM_DUMP_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2207;STORE_INIT_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2208;STORE_INIT_EMPTY;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2209;STORE_CONTENT_CORRUPTED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2210;STORE_INITIALIZE;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2211;INIT_DONE;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2212;DUMP_FINISHED;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2213;DELETION_FINISHED;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2214;DELETION_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2215;AUTO_CATALOGS_SENDING_FAILED;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h -2600;GET_DATA_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h -2601;STORE_DATA_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h -2800;DEVICE_BUILDING_COMMAND_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2801;DEVICE_SENDING_COMMAND_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2802;DEVICE_REQUESTING_REPLY_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2803;DEVICE_READING_REPLY_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2804;DEVICE_INTERPRETING_REPLY_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2805;DEVICE_MISSED_REPLY;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2806;DEVICE_UNKNOWN_REPLY;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2807;DEVICE_UNREQUESTED_REPLY;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2808;INVALID_DEVICE_COMMAND;LOW;Indicates a SW bug in child class.;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2809;MONITORING_LIMIT_EXCEEDED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -2810;MONITORING_AMBIGUOUS;HIGH;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h -4201;FUSE_CURRENT_HIGH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h -4202;FUSE_WENT_OFF;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h -4204;POWER_ABOVE_HIGH_LIMIT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h -4205;POWER_BELOW_LOW_LIMIT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/Fuse.h -4300;SWITCH_WENT_OFF;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/power/PowerSwitchIF.h -5000;HEATER_ON;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h -5001;HEATER_OFF;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h -5002;HEATER_TIMEOUT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h -5003;HEATER_STAYED_ON;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h -5004;HEATER_STAYED_OFF;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h -5200;TEMP_SENSOR_HIGH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h -5201;TEMP_SENSOR_LOW;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h -5202;TEMP_SENSOR_GRADIENT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h -5901;COMPONENT_TEMP_LOW;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h -5902;COMPONENT_TEMP_HIGH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h -5903;COMPONENT_TEMP_OOL_LOW;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h -5904;COMPONENT_TEMP_OOL_HIGH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h -5905;TEMP_NOT_IN_OP_RANGE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h -7101;FDIR_CHANGED_STATE;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h -7102;FDIR_STARTS_RECOVERY;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h -7103;FDIR_TURNS_OFF_DEVICE;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h -7201;MONITOR_CHANGED_STATE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h -7202;VALUE_BELOW_LOW_LIMIT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h -7203;VALUE_ABOVE_HIGH_LIMIT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h -7204;VALUE_OUT_OF_RANGE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h -7301;SWITCHING_TM_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datapool/HkSwitchHelper.h -7400;CHANGING_MODE;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7401;MODE_INFO;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7402;FALLBACK_FAILED;HIGH;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7403;MODE_TRANSITION_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7404;CANT_KEEP_MODE;HIGH;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7405;OBJECT_IN_INVALID_MODE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7406;FORCING_MODE;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7407;MODE_CMD_REJECTED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h -7506;HEALTH_INFO;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7507;CHILD_CHANGED_HEALTH;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7508;CHILD_PROBLEMS;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7509;OVERWRITING_HEALTH;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7510;TRYING_RECOVERY;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7511;RECOVERY_STEP;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7512;RECOVERY_DONE;MEDIUM;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h -7900;RF_AVAILABLE;INFO;A RF available signal was detected. P1: raw RFA state, P2: 0;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h -7901;RF_LOST;INFO;A previously found RF available signal was lost. P1: raw RFA state, P2: 0;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h -7902;BIT_LOCK;INFO;A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h -7903;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h -7905;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h -8900;CLOCK_SET;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h -8901;CLOCK_SET_FAILURE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h -9700;TEST;INFO;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/src/fsfw/pus/Service17Test.h -10600;CHANGE_OF_SETUP_PARAMETER;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/fsfw/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h -11101;MEMORY_READ_RPT_CRC_FAILURE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h -11102;ACK_FAILURE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h -11103;EXE_FAILURE;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h -11104;CRC_FAILURE_EVENT;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/PlocMPSoCHandler.h -11201;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11202;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11203;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11204;SELF_TEST_PWM_FAILURE;LOW;Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11205;SELF_TEST_TC_FAILURE;LOW;Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11206;SELF_TEST_MTM_RANGE_FAILURE;LOW;Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11207;SELF_TEST_COIL_CURRENT_FAILURE;LOW;Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11208;INVALID_ERROR_BYTE;LOW;Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/IMTQHandler.h -11301;ERROR_STATE;HIGH;Reaction wheel signals an error state;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/mission/devices/RwHandler.h -11501;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h -11502;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h -11503;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h -11504;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h -11600;SANITIZATION_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/memory/SdCardManager.h -11700;UPDATE_FILE_NOT_EXISTS;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h -11701;ACTION_COMMANDING_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h -11702;UPDATE_AVAILABLE_FAILED;LOW;Supervisor handler replied action message indicating a command execution failure of the update available command;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h -11703;UPDATE_TRANSFER_FAILED;LOW;Supervisor handler failed to transfer an update space packet. P1: Parameter holds the number of update packets already sent (inclusive the failed packet);C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h -11704;UPDATE_VERIFY_FAILED;LOW;Supervisor failed to execute the update verify command.;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h -11705;UPDATE_FINISHED;INFO;MPSoC update successful completed;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocUpdater.h -11800;SEND_MRAM_DUMP_FAILED;LOW;;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h -11801;MRAM_DUMP_FAILED;LOW;Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h -11802;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;C:\Users\jakob\OneDrive\Work\EIVE\Q7S\Software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h +2200;STORE_SEND_WRITE_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2201;STORE_WRITE_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2202;STORE_SEND_READ_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2203;STORE_READ_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2204;UNEXPECTED_MSG;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2205;STORING_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2206;TM_DUMP_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2207;STORE_INIT_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2208;STORE_INIT_EMPTY;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2209;STORE_CONTENT_CORRUPTED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2210;STORE_INITIALIZE;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2211;INIT_DONE;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2212;DUMP_FINISHED;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2213;DELETION_FINISHED;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2214;DELETION_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2215;AUTO_CATALOGS_SENDING_FAILED;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h +2600;GET_DATA_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h +2601;STORE_DATA_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h +2800;DEVICE_BUILDING_COMMAND_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2801;DEVICE_SENDING_COMMAND_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2802;DEVICE_REQUESTING_REPLY_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2803;DEVICE_READING_REPLY_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2804;DEVICE_INTERPRETING_REPLY_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2805;DEVICE_MISSED_REPLY;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2806;DEVICE_UNKNOWN_REPLY;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2807;DEVICE_UNREQUESTED_REPLY;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2808;INVALID_DEVICE_COMMAND;LOW;Indicates a SW bug in child class.;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2809;MONITORING_LIMIT_EXCEEDED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +2810;MONITORING_AMBIGUOUS;HIGH;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h +4201;FUSE_CURRENT_HIGH;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/power/Fuse.h +4202;FUSE_WENT_OFF;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/power/Fuse.h +4204;POWER_ABOVE_HIGH_LIMIT;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/power/Fuse.h +4205;POWER_BELOW_LOW_LIMIT;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/power/Fuse.h +4300;SWITCH_WENT_OFF;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/power/PowerSwitchIF.h +5000;HEATER_ON;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/Heater.h +5001;HEATER_OFF;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/Heater.h +5002;HEATER_TIMEOUT;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/Heater.h +5003;HEATER_STAYED_ON;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/Heater.h +5004;HEATER_STAYED_OFF;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/Heater.h +5200;TEMP_SENSOR_HIGH;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h +5201;TEMP_SENSOR_LOW;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h +5202;TEMP_SENSOR_GRADIENT;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h +5901;COMPONENT_TEMP_LOW;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h +5902;COMPONENT_TEMP_HIGH;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h +5903;COMPONENT_TEMP_OOL_LOW;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h +5904;COMPONENT_TEMP_OOL_HIGH;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h +5905;TEMP_NOT_IN_OP_RANGE;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h +7101;FDIR_CHANGED_STATE;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h +7102;FDIR_STARTS_RECOVERY;MEDIUM;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h +7103;FDIR_TURNS_OFF_DEVICE;MEDIUM;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h +7201;MONITOR_CHANGED_STATE;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h +7202;VALUE_BELOW_LOW_LIMIT;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h +7203;VALUE_ABOVE_HIGH_LIMIT;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h +7204;VALUE_OUT_OF_RANGE;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h +7301;SWITCHING_TM_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/datapool/HkSwitchHelper.h +7400;CHANGING_MODE;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h +7401;MODE_INFO;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h +7402;FALLBACK_FAILED;HIGH;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h +7403;MODE_TRANSITION_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h +7404;CANT_KEEP_MODE;HIGH;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h +7405;OBJECT_IN_INVALID_MODE;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h +7406;FORCING_MODE;MEDIUM;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h +7407;MODE_CMD_REJECTED;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/modes/HasModesIF.h +7506;HEALTH_INFO;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h +7507;CHILD_CHANGED_HEALTH;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h +7508;CHILD_PROBLEMS;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h +7509;OVERWRITING_HEALTH;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h +7510;TRYING_RECOVERY;MEDIUM;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h +7511;RECOVERY_STEP;MEDIUM;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h +7512;RECOVERY_DONE;MEDIUM;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/health/HasHealthIF.h +7900;RF_AVAILABLE;INFO;A RF available signal was detected. P1: raw RFA state, P2: 0;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h +7901;RF_LOST;INFO;A previously found RF available signal was lost. P1: raw RFA state, P2: 0;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h +7902;BIT_LOCK;INFO;A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h +7903;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h +7905;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h +8900;CLOCK_SET;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h +8901;CLOCK_SET_FAILURE;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h +9700;TEST;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/pus/Service17Test.h +10600;CHANGE_OF_SETUP_PARAMETER;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h +11101;MEMORY_READ_RPT_CRC_FAILURE;LOW;;/home/eive/EIVE/Robin/eive-obsw/mission/devices/PlocMPSoCHandler.h +11102;ACK_FAILURE;LOW;;/home/eive/EIVE/Robin/eive-obsw/mission/devices/PlocMPSoCHandler.h +11103;EXE_FAILURE;LOW;;/home/eive/EIVE/Robin/eive-obsw/mission/devices/PlocMPSoCHandler.h +11104;CRC_FAILURE_EVENT;LOW;;/home/eive/EIVE/Robin/eive-obsw/mission/devices/PlocMPSoCHandler.h +11201;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h +11202;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h +11203;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h +11204;SELF_TEST_PWM_FAILURE;LOW;Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h +11205;SELF_TEST_TC_FAILURE;LOW;Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h +11206;SELF_TEST_MTM_RANGE_FAILURE;LOW;Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h +11207;SELF_TEST_COIL_CURRENT_FAILURE;LOW;Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h +11208;INVALID_ERROR_BYTE;LOW;Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.;/home/eive/EIVE/Robin/eive-obsw/mission/devices/IMTQHandler.h +11301;ERROR_STATE;HIGH;Reaction wheel signals an error state;/home/eive/EIVE/Robin/eive-obsw/mission/devices/RwHandler.h +11501;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h +11502;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h +11503;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h +11504;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h +11600;SANITIZATION_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/memory/SdCardManager.h +11700;UPDATE_FILE_NOT_EXISTS;LOW;;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocUpdater.h +11701;ACTION_COMMANDING_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocUpdater.h +11702;UPDATE_AVAILABLE_FAILED;LOW;Supervisor handler replied action message indicating a command execution failure of the update available command;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocUpdater.h +11703;UPDATE_TRANSFER_FAILED;LOW;Supervisor handler failed to transfer an update space packet. P1: Parameter holds the number of update packets already sent (inclusive the failed packet);/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocUpdater.h +11704;UPDATE_VERIFY_FAILED;LOW;Supervisor failed to execute the update verify command.;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocUpdater.h +11705;UPDATE_FINISHED;INFO;MPSoC update successful completed;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocUpdater.h +11800;SEND_MRAM_DUMP_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocMemoryDumper.h +11801;MRAM_DUMP_FAILED;LOW;Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocMemoryDumper.h +11802;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocMemoryDumper.h diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index b0a9ee6a..ffb6f6b3 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 106 translations. * @details - * Generated on: 2021-11-22 17:04:42 + * Generated on: 2021-11-25 13:58:03 */ #include "translateEvents.h" diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 0ca7bae2..663ef00b 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -110,7 +110,7 @@ debugging. */ #define OBSW_DEBUG_STARTRACKER 0 #define OBSW_DEBUG_PLOC_MPSOC 0 #define OBSW_DEBUG_PLOC_SUPERVISOR 0 -#define OBSW_DEBUG_PDEC_HANDLER 1 +#define OBSW_DEBUG_PDEC_HANDLER 0 /*******************************************************************/ /** Hardcoded */ diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index b0a9ee6a..ffb6f6b3 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 106 translations. * @details - * Generated on: 2021-11-22 17:04:42 + * Generated on: 2021-11-25 13:58:03 */ #include "translateEvents.h" From fa89da4438e35001cae88c374ebe6ae8507d93a9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 25 Nov 2021 14:07:05 +0100 Subject: [PATCH 31/37] update event list --- generators/bsp_q7s_events.csv | 14 +++++++ generators/events/event_parser.py | 2 +- generators/events/translateEvents.cpp | 46 ++++++++++++++++++++- linux/fsfwconfig/events/translateEvents.cpp | 46 ++++++++++++++++++++- 4 files changed, 103 insertions(+), 5 deletions(-) diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index 48e9705c..7de6a92c 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -77,6 +77,16 @@ 8901;CLOCK_SET_FAILURE;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h 9700;TEST;INFO;;/home/eive/EIVE/Robin/eive-obsw/fsfw/src/fsfw/pus/Service17Test.h 10600;CHANGE_OF_SETUP_PARAMETER;LOW;;/home/eive/EIVE/Robin/eive-obsw/fsfw/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h +10900;GPIO_PULL_HIGH_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/HeaterHandler.h +10901;GPIO_PULL_LOW_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/HeaterHandler.h +10902;SWITCH_ALREADY_ON;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/HeaterHandler.h +10903;SWITCH_ALREADY_OFF;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/HeaterHandler.h +10904;MAIN_SWITCH_TIMEOUT;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/HeaterHandler.h +11000;MAIN_SWITCH_ON_TIMEOUT;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h +11001;MAIN_SWITCH_OFF_TIMEOUT;LOW;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h +11002;DEPLOYMENT_FAILED;HIGH;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h +11003;DEPL_SA1_GPIO_SWTICH_ON_FAILED;HIGH;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h +11004;DEPL_SA2_GPIO_SWTICH_ON_FAILED;HIGH;;/home/eive/EIVE/Robin/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h 11101;MEMORY_READ_RPT_CRC_FAILURE;LOW;;/home/eive/EIVE/Robin/eive-obsw/mission/devices/PlocMPSoCHandler.h 11102;ACK_FAILURE;LOW;;/home/eive/EIVE/Robin/eive-obsw/mission/devices/PlocMPSoCHandler.h 11103;EXE_FAILURE;LOW;;/home/eive/EIVE/Robin/eive-obsw/mission/devices/PlocMPSoCHandler.h @@ -104,3 +114,7 @@ 11800;SEND_MRAM_DUMP_FAILED;LOW;;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocMemoryDumper.h 11801;MRAM_DUMP_FAILED;LOW;Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocMemoryDumper.h 11802;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;/home/eive/EIVE/Robin/eive-obsw/bsp_q7s/devices/PlocMemoryDumper.h +11901;INVALID_TC_FRAME;HIGH;;/home/eive/EIVE/Robin/eive-obsw/linux/obc/PdecHandler.h +11902;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;/home/eive/EIVE/Robin/eive-obsw/linux/obc/PdecHandler.h +11903;CARRIER_LOCK;INFO;Carrier lock detected;/home/eive/EIVE/Robin/eive-obsw/linux/obc/PdecHandler.h +11904;BIT_LOCK;INFO;Bit lock detected (data valid);/home/eive/EIVE/Robin/eive-obsw/linux/obc/PdecHandler.h diff --git a/generators/events/event_parser.py b/generators/events/event_parser.py index 62b26af4..2275aa04 100644 --- a/generators/events/event_parser.py +++ b/generators/events/event_parser.py @@ -51,7 +51,7 @@ SUBSYSTEM_DEFINITION_DESTINATIONS = [ ] HEADER_DEFINITION_DESTINATIONS = [ f"{OBSW_ROOT_DIR}/mission/", f"{OBSW_ROOT_DIR}/fsfw/", f"{FSFW_CONFIG_ROOT}", - f"{OBSW_ROOT_DIR}/test/", f"{OBSW_ROOT_DIR}/bsp_q7s" + f"{OBSW_ROOT_DIR}/test/", f"{OBSW_ROOT_DIR}/bsp_q7s", f"{OBSW_ROOT_DIR}/linux/" ] diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index ffb6f6b3..4b8a407b 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 106 translations. + * @brief Auto-generated event translation file. Contains 120 translations. * @details - * Generated on: 2021-11-25 13:58:03 + * Generated on: 2021-11-25 14:06:54 */ #include "translateEvents.h" @@ -84,6 +84,16 @@ const char *CLOCK_SET_STRING = "CLOCK_SET"; const char *CLOCK_SET_FAILURE_STRING = "CLOCK_SET_FAILURE"; const char *TEST_STRING = "TEST"; const char *CHANGE_OF_SETUP_PARAMETER_STRING = "CHANGE_OF_SETUP_PARAMETER"; +const char *GPIO_PULL_HIGH_FAILED_STRING = "GPIO_PULL_HIGH_FAILED"; +const char *GPIO_PULL_LOW_FAILED_STRING = "GPIO_PULL_LOW_FAILED"; +const char *SWITCH_ALREADY_ON_STRING = "SWITCH_ALREADY_ON"; +const char *SWITCH_ALREADY_OFF_STRING = "SWITCH_ALREADY_OFF"; +const char *MAIN_SWITCH_TIMEOUT_STRING = "MAIN_SWITCH_TIMEOUT"; +const char *MAIN_SWITCH_ON_TIMEOUT_STRING = "MAIN_SWITCH_ON_TIMEOUT"; +const char *MAIN_SWITCH_OFF_TIMEOUT_STRING = "MAIN_SWITCH_OFF_TIMEOUT"; +const char *DEPLOYMENT_FAILED_STRING = "DEPLOYMENT_FAILED"; +const char *DEPL_SA1_GPIO_SWTICH_ON_FAILED_STRING = "DEPL_SA1_GPIO_SWTICH_ON_FAILED"; +const char *DEPL_SA2_GPIO_SWTICH_ON_FAILED_STRING = "DEPL_SA2_GPIO_SWTICH_ON_FAILED"; const char *MEMORY_READ_RPT_CRC_FAILURE_STRING = "MEMORY_READ_RPT_CRC_FAILURE"; const char *ACK_FAILURE_STRING = "ACK_FAILURE"; const char *EXE_FAILURE_STRING = "EXE_FAILURE"; @@ -111,6 +121,10 @@ const char *UPDATE_FINISHED_STRING = "UPDATE_FINISHED"; const char *SEND_MRAM_DUMP_FAILED_STRING = "SEND_MRAM_DUMP_FAILED"; const char *MRAM_DUMP_FAILED_STRING = "MRAM_DUMP_FAILED"; const char *MRAM_DUMP_FINISHED_STRING = "MRAM_DUMP_FINISHED"; +const char *INVALID_TC_FRAME_STRING = "INVALID_TC_FRAME"; +const char *INVALID_FAR_STRING = "INVALID_FAR"; +const char *CARRIER_LOCK_STRING = "CARRIER_LOCK"; +const char *BIT_LOCK_STRING = "BIT_LOCK"; const char * translateEvents(Event event) { switch( (event & 0xffff) ) { @@ -272,6 +286,26 @@ const char * translateEvents(Event event) { return TEST_STRING; case(10600): return CHANGE_OF_SETUP_PARAMETER_STRING; + case(10900): + return GPIO_PULL_HIGH_FAILED_STRING; + case(10901): + return GPIO_PULL_LOW_FAILED_STRING; + case(10902): + return SWITCH_ALREADY_ON_STRING; + case(10903): + return SWITCH_ALREADY_OFF_STRING; + case(10904): + return MAIN_SWITCH_TIMEOUT_STRING; + case(11000): + return MAIN_SWITCH_ON_TIMEOUT_STRING; + case(11001): + return MAIN_SWITCH_OFF_TIMEOUT_STRING; + case(11002): + return DEPLOYMENT_FAILED_STRING; + case(11003): + return DEPL_SA1_GPIO_SWTICH_ON_FAILED_STRING; + case(11004): + return DEPL_SA2_GPIO_SWTICH_ON_FAILED_STRING; case(11101): return MEMORY_READ_RPT_CRC_FAILURE_STRING; case(11102): @@ -326,6 +360,14 @@ const char * translateEvents(Event event) { return MRAM_DUMP_FAILED_STRING; case(11802): return MRAM_DUMP_FINISHED_STRING; + case(11901): + return INVALID_TC_FRAME_STRING; + case(11902): + return INVALID_FAR_STRING; + case(11903): + return CARRIER_LOCK_STRING; + case(11904): + return BIT_LOCK_STRING; default: return "UNKNOWN_EVENT"; } diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index ffb6f6b3..4b8a407b 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 106 translations. + * @brief Auto-generated event translation file. Contains 120 translations. * @details - * Generated on: 2021-11-25 13:58:03 + * Generated on: 2021-11-25 14:06:54 */ #include "translateEvents.h" @@ -84,6 +84,16 @@ const char *CLOCK_SET_STRING = "CLOCK_SET"; const char *CLOCK_SET_FAILURE_STRING = "CLOCK_SET_FAILURE"; const char *TEST_STRING = "TEST"; const char *CHANGE_OF_SETUP_PARAMETER_STRING = "CHANGE_OF_SETUP_PARAMETER"; +const char *GPIO_PULL_HIGH_FAILED_STRING = "GPIO_PULL_HIGH_FAILED"; +const char *GPIO_PULL_LOW_FAILED_STRING = "GPIO_PULL_LOW_FAILED"; +const char *SWITCH_ALREADY_ON_STRING = "SWITCH_ALREADY_ON"; +const char *SWITCH_ALREADY_OFF_STRING = "SWITCH_ALREADY_OFF"; +const char *MAIN_SWITCH_TIMEOUT_STRING = "MAIN_SWITCH_TIMEOUT"; +const char *MAIN_SWITCH_ON_TIMEOUT_STRING = "MAIN_SWITCH_ON_TIMEOUT"; +const char *MAIN_SWITCH_OFF_TIMEOUT_STRING = "MAIN_SWITCH_OFF_TIMEOUT"; +const char *DEPLOYMENT_FAILED_STRING = "DEPLOYMENT_FAILED"; +const char *DEPL_SA1_GPIO_SWTICH_ON_FAILED_STRING = "DEPL_SA1_GPIO_SWTICH_ON_FAILED"; +const char *DEPL_SA2_GPIO_SWTICH_ON_FAILED_STRING = "DEPL_SA2_GPIO_SWTICH_ON_FAILED"; const char *MEMORY_READ_RPT_CRC_FAILURE_STRING = "MEMORY_READ_RPT_CRC_FAILURE"; const char *ACK_FAILURE_STRING = "ACK_FAILURE"; const char *EXE_FAILURE_STRING = "EXE_FAILURE"; @@ -111,6 +121,10 @@ const char *UPDATE_FINISHED_STRING = "UPDATE_FINISHED"; const char *SEND_MRAM_DUMP_FAILED_STRING = "SEND_MRAM_DUMP_FAILED"; const char *MRAM_DUMP_FAILED_STRING = "MRAM_DUMP_FAILED"; const char *MRAM_DUMP_FINISHED_STRING = "MRAM_DUMP_FINISHED"; +const char *INVALID_TC_FRAME_STRING = "INVALID_TC_FRAME"; +const char *INVALID_FAR_STRING = "INVALID_FAR"; +const char *CARRIER_LOCK_STRING = "CARRIER_LOCK"; +const char *BIT_LOCK_STRING = "BIT_LOCK"; const char * translateEvents(Event event) { switch( (event & 0xffff) ) { @@ -272,6 +286,26 @@ const char * translateEvents(Event event) { return TEST_STRING; case(10600): return CHANGE_OF_SETUP_PARAMETER_STRING; + case(10900): + return GPIO_PULL_HIGH_FAILED_STRING; + case(10901): + return GPIO_PULL_LOW_FAILED_STRING; + case(10902): + return SWITCH_ALREADY_ON_STRING; + case(10903): + return SWITCH_ALREADY_OFF_STRING; + case(10904): + return MAIN_SWITCH_TIMEOUT_STRING; + case(11000): + return MAIN_SWITCH_ON_TIMEOUT_STRING; + case(11001): + return MAIN_SWITCH_OFF_TIMEOUT_STRING; + case(11002): + return DEPLOYMENT_FAILED_STRING; + case(11003): + return DEPL_SA1_GPIO_SWTICH_ON_FAILED_STRING; + case(11004): + return DEPL_SA2_GPIO_SWTICH_ON_FAILED_STRING; case(11101): return MEMORY_READ_RPT_CRC_FAILURE_STRING; case(11102): @@ -326,6 +360,14 @@ const char * translateEvents(Event event) { return MRAM_DUMP_FAILED_STRING; case(11802): return MRAM_DUMP_FINISHED_STRING; + case(11901): + return INVALID_TC_FRAME_STRING; + case(11902): + return INVALID_FAR_STRING; + case(11903): + return CARRIER_LOCK_STRING; + case(11904): + return BIT_LOCK_STRING; default: return "UNKNOWN_EVENT"; } From 14ba11738b42a125dcc2aa2c995029409c5c07bb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 25 Nov 2021 14:09:06 +0100 Subject: [PATCH 32/37] adapted event name --- generators/bsp_q7s_events.csv | 2 +- generators/events/translateEvents.cpp | 6 +++--- linux/fsfwconfig/events/translateEvents.cpp | 6 +++--- linux/obc/PdecHandler.cpp | 2 +- linux/obc/PdecHandler.h | 2 +- mission/tmtc/CCSDSHandler.cpp | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index 7de6a92c..8dfa9e78 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -117,4 +117,4 @@ 11901;INVALID_TC_FRAME;HIGH;;/home/eive/EIVE/Robin/eive-obsw/linux/obc/PdecHandler.h 11902;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;/home/eive/EIVE/Robin/eive-obsw/linux/obc/PdecHandler.h 11903;CARRIER_LOCK;INFO;Carrier lock detected;/home/eive/EIVE/Robin/eive-obsw/linux/obc/PdecHandler.h -11904;BIT_LOCK;INFO;Bit lock detected (data valid);/home/eive/EIVE/Robin/eive-obsw/linux/obc/PdecHandler.h +11904;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);/home/eive/EIVE/Robin/eive-obsw/linux/obc/PdecHandler.h diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 4b8a407b..943468c5 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 120 translations. * @details - * Generated on: 2021-11-25 14:06:54 + * Generated on: 2021-11-25 14:09:00 */ #include "translateEvents.h" @@ -124,7 +124,7 @@ const char *MRAM_DUMP_FINISHED_STRING = "MRAM_DUMP_FINISHED"; const char *INVALID_TC_FRAME_STRING = "INVALID_TC_FRAME"; const char *INVALID_FAR_STRING = "INVALID_FAR"; const char *CARRIER_LOCK_STRING = "CARRIER_LOCK"; -const char *BIT_LOCK_STRING = "BIT_LOCK"; +const char *BIT_LOCK_PDEC_STRING = "BIT_LOCK_PDEC"; const char * translateEvents(Event event) { switch( (event & 0xffff) ) { @@ -367,7 +367,7 @@ const char * translateEvents(Event event) { case(11903): return CARRIER_LOCK_STRING; case(11904): - return BIT_LOCK_STRING; + return BIT_LOCK_PDEC_STRING; default: return "UNKNOWN_EVENT"; } diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 4b8a407b..943468c5 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 120 translations. * @details - * Generated on: 2021-11-25 14:06:54 + * Generated on: 2021-11-25 14:09:00 */ #include "translateEvents.h" @@ -124,7 +124,7 @@ const char *MRAM_DUMP_FINISHED_STRING = "MRAM_DUMP_FINISHED"; const char *INVALID_TC_FRAME_STRING = "INVALID_TC_FRAME"; const char *INVALID_FAR_STRING = "INVALID_FAR"; const char *CARRIER_LOCK_STRING = "CARRIER_LOCK"; -const char *BIT_LOCK_STRING = "BIT_LOCK"; +const char *BIT_LOCK_PDEC_STRING = "BIT_LOCK_PDEC"; const char * translateEvents(Event event) { switch( (event & 0xffff) ) { @@ -367,7 +367,7 @@ const char * translateEvents(Event event) { case(11903): return CARRIER_LOCK_STRING; case(11904): - return BIT_LOCK_STRING; + return BIT_LOCK_PDEC_STRING; default: return "UNKNOWN_EVENT"; } diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index f99a1a30..027cac80 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -246,7 +246,7 @@ void PdecHandler::checkLocks() { } if (!(clcw & NO_BITLOCK_MASK) && (lastClcw & NO_BITLOCK_MASK)) { // Bit lock changed from 0 to 1 - triggerEvent(BIT_LOCK); + triggerEvent(BIT_LOCK_PDEC); } lastClcw = clcw; } diff --git a/linux/obc/PdecHandler.h b/linux/obc/PdecHandler.h index 83e4a253..8819df22 100644 --- a/linux/obc/PdecHandler.h +++ b/linux/obc/PdecHandler.h @@ -82,7 +82,7 @@ public: //! [EXPORT] : [COMMENT] Carrier lock detected static const Event CARRIER_LOCK = MAKE_EVENT(3, severity::INFO); //! [EXPORT] : [COMMENT] Bit lock detected (data valid) - static const Event BIT_LOCK = MAKE_EVENT(4, severity::INFO); + static const Event BIT_LOCK_PDEC = MAKE_EVENT(4, severity::INFO); private: diff --git a/mission/tmtc/CCSDSHandler.cpp b/mission/tmtc/CCSDSHandler.cpp index 71307bd9..01894cbc 100644 --- a/mission/tmtc/CCSDSHandler.cpp +++ b/mission/tmtc/CCSDSHandler.cpp @@ -226,7 +226,7 @@ void CCSDSHandler::checkEvents() { void CCSDSHandler::handleEvent(EventMessage* eventMessage) { Event event = eventMessage->getEvent(); switch(event){ - case PdecHandler::BIT_LOCK: { + case PdecHandler::BIT_LOCK_PDEC: { handleBitLockEvent(); break; } From 0f89282dae29700d9f9ce3d33be3e90ef1cbd36c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 25 Nov 2021 14:20:53 +0100 Subject: [PATCH 33/37] event name correction --- mission/tmtc/CCSDSHandler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mission/tmtc/CCSDSHandler.cpp b/mission/tmtc/CCSDSHandler.cpp index 01894cbc..e0239d9a 100644 --- a/mission/tmtc/CCSDSHandler.cpp +++ b/mission/tmtc/CCSDSHandler.cpp @@ -91,7 +91,8 @@ ReturnValue_t CCSDSHandler::initialize() { return result; } result = manager->subscribeToEventRange(eventQueue->getId(), - event::getEventId(PdecHandler::CARRIER_LOCK), event::getEventId(PdecHandler::BIT_LOCK)); + event::getEventId(PdecHandler::CARRIER_LOCK), + event::getEventId(PdecHandler::BIT_LOCK_PDEC)); if (result != HasReturnvaluesIF::RETURN_OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "CCSDSHandler::initialize: Failed to subscribe to events from PDEC " From 5b412bf07269c847be6269c2c71c2deb3df5db3d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 25 Nov 2021 21:38:13 +0100 Subject: [PATCH 34/37] implemented rename function --- bsp_q7s/boardtest/Q7STestTask.cpp | 45 +++++++++++--- bsp_q7s/boardtest/Q7STestTask.h | 2 + bsp_q7s/memory/FileSystemHandler.cpp | 87 ++++++++++------------------ bsp_q7s/memory/FileSystemHandler.h | 2 + 4 files changed, 73 insertions(+), 63 deletions(-) diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp index 7681ef09..965a6d63 100644 --- a/bsp_q7s/boardtest/Q7STestTask.cpp +++ b/bsp_q7s/boardtest/Q7STestTask.cpp @@ -26,8 +26,8 @@ ReturnValue_t Q7STestTask::performOneShotAction() { //testJsonLibDirect(); //testDummyParams(); //testProtHandler(); - //FsOpCodes opCode = FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY; - //testFileSystemHandlerDirect(opCode); + FsOpCodes opCode = FsOpCodes::APPEND_TO_FILE; + testFileSystemHandlerDirect(opCode); return TestTask::performOneShotAction(); } @@ -252,7 +252,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { cfg.useMountPrefix = false; sif::info << "Creating empty file in /tmp folder" << std::endl; // Do not delete file, user can check existence in shell - fsHandler->createFile("/tmp", "test.txt", nullptr, 0, &cfg); + fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg); break; } case(FsOpCodes::REMOVE_TMP_FILE): { @@ -262,7 +262,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { if(not std::filesystem::exists("/tmp/test.txt")) { // Creating sample file sif::info << "Creating sample file /tmp/test.txt to delete" << std::endl; - fsHandler->createFile("/tmp", "test.txt", nullptr, 0, &cfg); + fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg); } result = fsHandler->removeFile("/tmp", "test.txt", &cfg); if(result == HasReturnvaluesIF::RETURN_OK) { @@ -278,7 +278,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { cfg.useMountPrefix = false; sif::info << "Creating empty file in /tmp folder" << std::endl; // Do not delete file, user can check existence in shell - ReturnValue_t result = fsHandler->createDirectory("/tmp", "test", false, &cfg); + ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg); if(result == HasReturnvaluesIF::RETURN_OK) { sif::info << "Directory created successfully" << std::endl; } @@ -297,7 +297,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { // Delete any leftover files to regular dir removal works std::remove("/tmp/test/*"); } - result = fsHandler->removeDirectory("/tmp", "test", false, &cfg); + result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg); if(result == HasReturnvaluesIF::RETURN_OK) { sif::info << "Directory removed successfully" << std::endl; } @@ -311,7 +311,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { if(result != HasReturnvaluesIF::RETURN_OK) { return; } - result = fsHandler->removeDirectory("/tmp", "test", true, &cfg); + result = fsHandler->removeDirectory("/tmp/", "test", true, &cfg); if(result == HasReturnvaluesIF::RETURN_OK) { sif::info << "Directory removed recursively successfully" << std::endl; } @@ -325,13 +325,42 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { if(result != HasReturnvaluesIF::RETURN_OK) { return; } - result = fsHandler->removeDirectory("/tmp", "test", false, &cfg); + result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg); if(result != HasReturnvaluesIF::RETURN_OK) { sif::info << "Directory removal attempt failed as expected" << std::endl; } else { sif::warning << "Directory removal worked when it should not have!" << std::endl; } + break; + } + case(FsOpCodes::RENAME_FILE): { + // No mount prefix, cause file is created in tmp + cfg.useMountPrefix = false; + if(std::filesystem::exists("/tmp/test.txt")) { + fsHandler->removeDirectory("/tmp/", "test", false, &cfg); + } + sif::info << "Creating empty file /tmp/test.txt and rename to /tmp/test2.txt" << std::endl; + // Do not delete file, user can check existence in shell + fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg); + fsHandler->renameFile("/tmp/", "test.txt", "test2.txt", &cfg); + break; + } + case(FsOpCodes::APPEND_TO_FILE): { + // No mount prefix, cause file is created in tmp + cfg.useMountPrefix = false; + if(std::filesystem::exists("/tmp/test.txt")) { + fsHandler->removeDirectory("/tmp/", "test", false, &cfg); + } + if(std::filesystem::exists("/tmp/test.txt")) { + fsHandler->removeDirectory("/tmp/", "test", false, &cfg); + } + sif::info << "Creating empty file /tmp/test.txt and adding content" << std::endl; + std::string content = "Hello World\n"; + // Do not delete file, user can check existence in shell + fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg); + fsHandler->appendToFile("/tmp/", "test.txt", reinterpret_cast( + content.data()), content.size(), 0, &cfg); } } } diff --git a/bsp_q7s/boardtest/Q7STestTask.h b/bsp_q7s/boardtest/Q7STestTask.h index b0153ce9..5e11b374 100644 --- a/bsp_q7s/boardtest/Q7STestTask.h +++ b/bsp_q7s/boardtest/Q7STestTask.h @@ -27,6 +27,8 @@ private: REMOVE_EMPTY_DIR_IN_TMP, ATTEMPT_DIR_REMOVAL_NON_EMPTY, REMOVE_FILLED_DIR_IN_TMP, + RENAME_FILE, + APPEND_TO_FILE, }; void testFileSystemHandlerDirect(FsOpCodes opCode); }; diff --git a/bsp_q7s/memory/FileSystemHandler.cpp b/bsp_q7s/memory/FileSystemHandler.cpp index 2943875a..caad94a6 100644 --- a/bsp_q7s/memory/FileSystemHandler.cpp +++ b/bsp_q7s/memory/FileSystemHandler.cpp @@ -136,13 +136,11 @@ ReturnValue_t FileSystemHandler::initialize() { ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath, const char* filename, const uint8_t* data, size_t size, uint16_t packetNumber, FileSystemArgsIF* args) { - // A double slash between repo and filename should not be an issue, so add it in any case - std::string fullPath = currentMountPrefix + std::string(repositoryPath) + "/" + - std::string(filename); - if(not std::filesystem::exists(fullPath)) { + auto path = getInitPath(args) / repositoryPath / filename; + if(not std::filesystem::exists(path)) { return FILE_DOES_NOT_EXIST; } - std::ofstream file(fullPath, std::ios_base::app|std::ios_base::out); + std::ofstream file(path, std::ios_base::app|std::ios_base::out); file.write(reinterpret_cast(data), size); if(not file.good()) { return GENERIC_FILE_ERROR; @@ -152,19 +150,11 @@ ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath, ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath, const char* filename, const uint8_t* data, size_t size, FileSystemArgsIF* args) { - std::string fullPath; - bool useMountPrefix = true; - parseCfg(reinterpret_cast(args), useMountPrefix); - if(useMountPrefix) { - fullPath += currentMountPrefix; - } - - // A double slash between repo and filename should not be an issue, so add it in any case - fullPath += std::string(repositoryPath) + "/" + std::string(filename); - if(std::filesystem::exists(fullPath)) { + auto path = getInitPath(args) / filename; + if(std::filesystem::exists(path)) { return FILE_ALREADY_EXISTS; } - std::ofstream file(fullPath); + std::ofstream file(path); file.write(reinterpret_cast(data), size); if(not file.good()) { return GENERIC_FILE_ERROR; @@ -174,19 +164,11 @@ ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath, ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath, const char* filename, FileSystemArgsIF* args) { - std::string fullPath; - bool useMountPrefix = true; - parseCfg(reinterpret_cast(args), useMountPrefix); - if(useMountPrefix) { - fullPath += currentMountPrefix; - } - - // A double slash between repo and filename should not be an issue, so add it in any case - fullPath += std::string(repositoryPath) + "/" + std::string(filename); - if(not std::filesystem::exists(fullPath)) { + auto path = getInitPath(args) / repositoryPath / filename; + if(not std::filesystem::exists(path)) { return FILE_DOES_NOT_EXIST; } - int result = std::remove(fullPath.c_str()); + int result = std::remove(path.c_str()); if(result != 0) { sif::warning << "FileSystemHandler::deleteFile: Failed with code " << result << std::endl; return GENERIC_FILE_ERROR; @@ -196,42 +178,26 @@ ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath, ReturnValue_t FileSystemHandler:: createDirectory(const char* repositoryPath, const char* dirname, bool createParentDirs, FileSystemArgsIF* args) { - std::string fullPath; - bool useMountPrefix = true; - parseCfg(reinterpret_cast(args), useMountPrefix); - if(useMountPrefix) { - fullPath += currentMountPrefix; - } - - fullPath += std::string(repositoryPath); - fullPath += "/" + std::string(dirname); - if(std::filesystem::exists(fullPath)) { + auto path = getInitPath(args) / repositoryPath / dirname; + if(std::filesystem::exists(path)) { return DIRECTORY_ALREADY_EXISTS; } - if(std::filesystem::create_directory(fullPath)) { + if(std::filesystem::create_directory(path)) { return HasReturnvaluesIF::RETURN_OK; } - sif::warning << "Creating directory " << fullPath << " failed" << std::endl; + sif::warning << "Creating directory " << path << " failed" << std::endl; return GENERIC_FILE_ERROR; } ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, const char* dirname, bool deleteRecurively, FileSystemArgsIF* args) { - std::string fullPath; - bool useMountPrefix = true; - parseCfg(reinterpret_cast(args), useMountPrefix); - if(useMountPrefix) { - fullPath += currentMountPrefix; - } - - fullPath += std::string(repositoryPath); - fullPath += "/" + std::string(dirname); - if(not std::filesystem::exists(fullPath)) { + auto path = getInitPath(args) / repositoryPath / dirname; + if(not std::filesystem::exists(path)) { return DIRECTORY_DOES_NOT_EXIST; } std::error_code err; if(not deleteRecurively) { - if(std::filesystem::remove(fullPath, err)) { + if(std::filesystem::remove(path, err)) { return HasReturnvaluesIF::RETURN_OK; } else { @@ -248,7 +214,7 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, con } } else { - if(std::filesystem::remove_all(fullPath, err)) { + if(std::filesystem::remove_all(path, err)) { return HasReturnvaluesIF::RETURN_OK; } else { @@ -267,14 +233,25 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, con return HasReturnvaluesIF::RETURN_OK; } +ReturnValue_t FileSystemHandler::renameFile(const char *repositoryPath, const char *oldFilename, + const char *newFilename, FileSystemArgsIF *args) { + auto basepath = getInitPath(args) / repositoryPath; + std::filesystem::rename(basepath / oldFilename, basepath / newFilename); + return HasReturnvaluesIF::RETURN_OK; +} + void FileSystemHandler::parseCfg(FsCommandCfg *cfg, bool& useMountPrefix) { if(cfg != nullptr) { useMountPrefix = cfg->useMountPrefix; } } -ReturnValue_t FileSystemHandler::renameFile(const char *repositoryPath, const char *oldFilename, - const char *newFilename, FileSystemArgsIF *args) { - // TODO: Implement - return HasReturnvaluesIF::RETURN_OK; +std::filesystem::path FileSystemHandler::getInitPath(FileSystemArgsIF* args) { + bool useMountPrefix = true; + parseCfg(reinterpret_cast(args), useMountPrefix); + std::string path; + if(useMountPrefix) { + path = currentMountPrefix; + } + return std::filesystem::path(path); } diff --git a/bsp_q7s/memory/FileSystemHandler.h b/bsp_q7s/memory/FileSystemHandler.h index 8fdebd05..35a0f533 100644 --- a/bsp_q7s/memory/FileSystemHandler.h +++ b/bsp_q7s/memory/FileSystemHandler.h @@ -10,6 +10,7 @@ #include "fsfw/memory/HasFileSystemIF.h" #include +#include class CoreController; @@ -61,6 +62,7 @@ private: void fileSystemHandlerLoop(); void fileSystemCheckup(); + std::filesystem::path getInitPath(FileSystemArgsIF* args); void parseCfg(FsCommandCfg* cfg, bool& useMountPrefix); }; From 667bbc918f5ab62430fb841b77678f8318ac3fa7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 Nov 2021 14:40:35 +0100 Subject: [PATCH 35/37] make some debug output optional --- linux/obc/PdecHandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index 027cac80..0c2d207a 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -295,7 +295,9 @@ bool PdecHandler::checkFrameAna(uint32_t pdecFar) { break; } case(FrameAna_t::FRAME_ACCEPTED): { - sif::debug << "PdecHandler::checkFrameAna: Accepted TC frame" << std::endl; +#if OBSW_DEBUG_PDEC_HANDLER == 1 + sif::info << "PdecHandler::checkFrameAna: Accepted TC frame" << std::endl; +#endif frameValid = true; break; } From 8d284b3d2acc1875a1a1c24fce594b878c5c0211 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 Nov 2021 14:41:42 +0100 Subject: [PATCH 36/37] using warning insted of debug --- linux/obc/PdecHandler.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index 0c2d207a..1ac83d44 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -257,7 +257,7 @@ bool PdecHandler::checkFrameAna(uint32_t pdecFar) { switch(frameAna) { case(FrameAna_t::ABANDONED_CLTU): { triggerEvent(INVALID_TC_FRAME, ABANDONED_CLTU); - sif::debug << "PdecHandler::checkFrameAna: Abondoned CLTU" << std::endl; + sif::warning << "PdecHandler::checkFrameAna: Abondoned CLTU" << std::endl; break; } case(FrameAna_t::FRAME_DIRTY): { @@ -266,31 +266,31 @@ bool PdecHandler::checkFrameAna(uint32_t pdecFar) { break; } case(FrameAna_t::FRAME_ILLEGAL): { - sif::debug << "PdecHandler::checkFrameAna: Frame illegal for one reason" << std::endl; + sif::warning << "PdecHandler::checkFrameAna: Frame illegal for one reason" << std::endl; handleIReason(pdecFar, FRAME_ILLEGAL_ONE_REASON); break; } case(FrameAna_t::FRAME_ILLEGAL_MULTI_REASON): { - sif::debug << "PdecHandler::checkFrameAna: Frame illegal for multiple reasons" + sif::warning << "PdecHandler::checkFrameAna: Frame illegal for multiple reasons" << std::endl; handleIReason(pdecFar, FRAME_ILLEGAL_MULTIPLE_REASONS); break; } case(FrameAna_t::AD_DISCARDED_LOCKOUT): { triggerEvent(INVALID_TC_FRAME, AD_DISCARDED_LOCKOUT); - sif::debug << "PdecHandler::checkFrameAna: AD frame discarded because of lockout" + sif::warning << "PdecHandler::checkFrameAna: AD frame discarded because of lockout" << std::endl; break; } case(FrameAna_t::AD_DISCARDED_WAIT): { triggerEvent(INVALID_TC_FRAME, AD_DISCARDED_LOCKOUT); - sif::debug << "PdecHandler::checkFrameAna: AD frame discarded because of wait" + sif::warning << "PdecHandler::checkFrameAna: AD frame discarded because of wait" << std::endl; break; } case(FrameAna_t::AD_DISCARDED_NS_VR): { triggerEvent(INVALID_TC_FRAME, AD_DISCARDED_NS_VS); - sif::debug << "PdecHandler::checkFrameAna: AD frame discarded because N(S) or V(R)" + sif::warning << "PdecHandler::checkFrameAna: AD frame discarded because N(S) or V(R)" << std::endl; break; } From d287aa80c11b517fe6c3719266944edc863acf76 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 Nov 2021 14:54:10 +0100 Subject: [PATCH 37/37] increase max number of stored packets in tmtcbridge --- fsfw | 2 +- mission/core/GenericFactory.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fsfw b/fsfw index d8580074..ceb87b5a 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit d8580074c2730d861353ab47e659afeb707afe71 +Subproject commit ceb87b5abb2992a18266328e0ea34d9af15db7af diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 58485b71..14c8791a 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -101,18 +101,18 @@ void ObjectFactory::produceGenericObjects() { #if OBSW_ADD_TCPIP_BRIDGE == 1 #if OBSW_USE_TCP_BRIDGE == 0 auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); - tmtcBridge->setMaxNumberOfPacketsStored(50); new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); sif::info << "Created UDP server for TMTC commanding with listener port " << udpBridge->getUdpPort() << std::endl; #else auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); - tmtcBridge->setMaxNumberOfPacketsStored(50); auto tcpServer = new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); // TCP is stream based. Use packet ID as start marker when parsing for space packets tcpServer->setSpacePacketParsingOptions({common::PUS_PACKET_ID}); sif::info << "Created TCP server for TMTC commanding with listener port " << tcpServer->getTcpPort() << std::endl; #endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */ + tmtcBridge->setMaxNumberOfPacketsStored(70); #endif /* OBSW_ADD_TCPIP_BRIDGE == 1 */ + }