From 8331b76ea8c708f8b6c4e26b720754a12f9faa70 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 23 Mar 2021 13:44:45 +0100 Subject: [PATCH 01/36] updated tmtc submodule --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 5f1803b6..74c61842 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 5f1803b66393210ded8c5d88fbc28cd8130cef91 +Subproject commit 74c61842c87e6a25751904116fdc82dd61a14333 From 8d30c83d42d8f01bfa59cfa94a84610ca5e568d2 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 23 Mar 2021 16:06:23 +0100 Subject: [PATCH 02/36] added fsfw hal --- .gitmodules | 3 +++ fsfw_hal | 1 + 2 files changed, 4 insertions(+) create mode 160000 fsfw_hal diff --git a/.gitmodules b/.gitmodules index 7af82082..4a973500 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "thirdparty/lwgps"] path = thirdparty/lwgps url = https://github.com/rmspacefish/lwgps.git +[submodule "fsfw_hal"] + path = fsfw_hal + url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw_hal.git diff --git a/fsfw_hal b/fsfw_hal new file mode 160000 index 00000000..45eb9cbe --- /dev/null +++ b/fsfw_hal @@ -0,0 +1 @@ +Subproject commit 45eb9cbe2bc7e7e11aca7a6262098251f358ec8d From f6fb7f4c4bb698443e2aa4e4370d9c2eb3888d9f Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 23 Mar 2021 16:15:31 +0100 Subject: [PATCH 03/36] integrating fsfw_hal --- CMakeLists.txt | 6 ++++++ bsp_rpi/gpio/CMakeLists.txt | 1 - fsfw_hal | 2 +- linux/CMakeLists.txt | 2 +- linux/{ => archive}/gpio/CMakeLists.txt | 0 linux/{ => archive}/gpio/GpioCookie.cpp | 0 linux/{ => archive}/gpio/GpioCookie.h | 0 linux/{ => archive}/gpio/GpioIF.h | 0 linux/{ => archive}/gpio/LinuxLibgpioIF.cpp | 0 linux/{ => archive}/gpio/LinuxLibgpioIF.h | 0 linux/{ => archive}/gpio/gpioDefinitions.h | 0 {bsp_rpi/gpio => misc/archive}/GPIORPi.cpp | 0 {bsp_rpi/gpio => misc/archive}/GPIORPi.h | 0 13 files changed, 8 insertions(+), 3 deletions(-) rename linux/{ => archive}/gpio/CMakeLists.txt (100%) rename linux/{ => archive}/gpio/GpioCookie.cpp (100%) rename linux/{ => archive}/gpio/GpioCookie.h (100%) rename linux/{ => archive}/gpio/GpioIF.h (100%) rename linux/{ => archive}/gpio/LinuxLibgpioIF.cpp (100%) rename linux/{ => archive}/gpio/LinuxLibgpioIF.h (100%) rename linux/{ => archive}/gpio/gpioDefinitions.h (100%) rename {bsp_rpi/gpio => misc/archive}/GPIORPi.cpp (100%) rename {bsp_rpi/gpio => misc/archive}/GPIORPi.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 53689123..61b99287 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ set(TARGET_NAME ${CMAKE_PROJECT_NAME}) set(LIB_FSFW_NAME fsfw) set(LIB_ETL_NAME etl) set(LIB_CSP_NAME libcsp) +set(LIB_FSFW_HAL_NAME fsfw_hal) set(LIB_LWGPS_NAME lwgps) set(THIRD_PARTY_FOLDER thirdparty) @@ -50,6 +51,7 @@ set(TEST_PATH test/testtasks) set(LINUX_PATH linux) set(COMMON_PATH common) +set(FSFW_HAL_LIB_PATH fsfw_hal) set(CSP_LIB_PATH ${THIRD_PARTY_FOLDER}/libcsp) set(ETL_LIB_PATH ${THIRD_PARTY_FOLDER}/etl) set(LWGPS_LIB_PATH ${THIRD_PARTY_FOLDER}/lwgps) @@ -68,10 +70,12 @@ if(TGT_BSP) set(FSFW_CONFIG_PATH "fsfwconfig") set(ADD_LINUX_FILES TRUE) set(ADD_CSP_LIB TRUE) + set(FSFW_HAL_ADD_LINUX ON) endif() if(${TGT_BSP} MATCHES "arm/raspberrypi") add_definitions(-DRASPBERRY_PI) + set(FSFW_HAL_ADD_RASPBERRY_PI ON) endif() if(${TGT_BSP} MATCHES "arm/q7s") @@ -113,6 +117,7 @@ add_subdirectory(${BSP_PATH}) add_subdirectory(${FSFW_PATH}) add_subdirectory(${MISSION_PATH}) add_subdirectory(${TEST_PATH}) +add_subdirectory(${FSFW_HAL_LIB_PATH}) add_subdirectory(${COMMON_PATH}) ################################################################################ @@ -126,6 +131,7 @@ target_link_libraries(${TARGET_NAME} PRIVATE ${LIB_FSFW_NAME} ${LIB_OS_NAME} ${LIB_LWGPS_NAME} + ${LIB_FSFW_HAL_NAME} ) if(ADD_ETL_LIB) diff --git a/bsp_rpi/gpio/CMakeLists.txt b/bsp_rpi/gpio/CMakeLists.txt index 85bd6aa6..b816684d 100644 --- a/bsp_rpi/gpio/CMakeLists.txt +++ b/bsp_rpi/gpio/CMakeLists.txt @@ -1,5 +1,4 @@ target_sources(${TARGET_NAME} PUBLIC - GPIORPi.cpp ) diff --git a/fsfw_hal b/fsfw_hal index 45eb9cbe..547c788c 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit 45eb9cbe2bc7e7e11aca7a6262098251f358ec8d +Subproject commit 547c788c818069abb9eaea12a0c997376641f9aa diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 77bea0ef..13748f41 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -1,4 +1,4 @@ -add_subdirectory(gpio) +# add_subdirectory(gpio) add_subdirectory(i2c) add_subdirectory(csp) add_subdirectory(spi) diff --git a/linux/gpio/CMakeLists.txt b/linux/archive/gpio/CMakeLists.txt similarity index 100% rename from linux/gpio/CMakeLists.txt rename to linux/archive/gpio/CMakeLists.txt diff --git a/linux/gpio/GpioCookie.cpp b/linux/archive/gpio/GpioCookie.cpp similarity index 100% rename from linux/gpio/GpioCookie.cpp rename to linux/archive/gpio/GpioCookie.cpp diff --git a/linux/gpio/GpioCookie.h b/linux/archive/gpio/GpioCookie.h similarity index 100% rename from linux/gpio/GpioCookie.h rename to linux/archive/gpio/GpioCookie.h diff --git a/linux/gpio/GpioIF.h b/linux/archive/gpio/GpioIF.h similarity index 100% rename from linux/gpio/GpioIF.h rename to linux/archive/gpio/GpioIF.h diff --git a/linux/gpio/LinuxLibgpioIF.cpp b/linux/archive/gpio/LinuxLibgpioIF.cpp similarity index 100% rename from linux/gpio/LinuxLibgpioIF.cpp rename to linux/archive/gpio/LinuxLibgpioIF.cpp diff --git a/linux/gpio/LinuxLibgpioIF.h b/linux/archive/gpio/LinuxLibgpioIF.h similarity index 100% rename from linux/gpio/LinuxLibgpioIF.h rename to linux/archive/gpio/LinuxLibgpioIF.h diff --git a/linux/gpio/gpioDefinitions.h b/linux/archive/gpio/gpioDefinitions.h similarity index 100% rename from linux/gpio/gpioDefinitions.h rename to linux/archive/gpio/gpioDefinitions.h diff --git a/bsp_rpi/gpio/GPIORPi.cpp b/misc/archive/GPIORPi.cpp similarity index 100% rename from bsp_rpi/gpio/GPIORPi.cpp rename to misc/archive/GPIORPi.cpp diff --git a/bsp_rpi/gpio/GPIORPi.h b/misc/archive/GPIORPi.h similarity index 100% rename from bsp_rpi/gpio/GPIORPi.h rename to misc/archive/GPIORPi.h From 4bf1206fbd3b8d387b6aeb9e3937fa429638db88 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 23 Mar 2021 16:45:07 +0100 Subject: [PATCH 04/36] using new fsfw_hal now --- bsp_rpi/ObjectFactory.cpp | 9 +- fsfw_hal | 2 +- fsfwconfig/devices/gpioIds.h | 2 +- linux/boardtest/LibgpiodTest.h | 4 +- linux/boardtest/SpiTestClass.cpp | 4 +- linux/boardtest/SpiTestClass.h | 2 +- linux/spi/SpiComIF.h | 2 +- linux/spi/SpiCookie.h | 2 +- misc/eclipse/.cproject | 434 ++++++++++--------------------- 9 files changed, 148 insertions(+), 313 deletions(-) diff --git a/bsp_rpi/ObjectFactory.cpp b/bsp_rpi/ObjectFactory.cpp index 13cadfb3..a5c81961 100644 --- a/bsp_rpi/ObjectFactory.cpp +++ b/bsp_rpi/ObjectFactory.cpp @@ -1,5 +1,5 @@ #include "ObjectFactory.h" -#include +#include #include #include @@ -11,11 +11,10 @@ #include #include -#include -#include #include #include +#include #include #include #include @@ -28,7 +27,9 @@ #include #include #include -#include + +#include +#include void Factory::setStaticFrameworkObjectIds() { diff --git a/fsfw_hal b/fsfw_hal index 547c788c..f094e992 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit 547c788c818069abb9eaea12a0c997376641f9aa +Subproject commit f094e9921db807344ed5488f662295034eb89731 diff --git a/fsfwconfig/devices/gpioIds.h b/fsfwconfig/devices/gpioIds.h index 8963bd20..10c0a553 100644 --- a/fsfwconfig/devices/gpioIds.h +++ b/fsfwconfig/devices/gpioIds.h @@ -1,7 +1,7 @@ #ifndef FSFWCONFIG_DEVICES_GPIOIDS_H_ #define FSFWCONFIG_DEVICES_GPIOIDS_H_ -#include +#include namespace gpioIds { enum gpioId_t { diff --git a/linux/boardtest/LibgpiodTest.h b/linux/boardtest/LibgpiodTest.h index e9c6c030..a18c618e 100644 --- a/linux/boardtest/LibgpiodTest.h +++ b/linux/boardtest/LibgpiodTest.h @@ -2,8 +2,8 @@ #define TEST_TESTTASKS_LIBGPIODTEST_H_ #include "TestTask.h" -#include -#include +#include +#include #include /** diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 3090c115..374cb644 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -7,9 +7,9 @@ #include #include -#include -#include #include +#include +#include #include #include diff --git a/linux/boardtest/SpiTestClass.h b/linux/boardtest/SpiTestClass.h index c567bc45..2e3d8b8c 100644 --- a/linux/boardtest/SpiTestClass.h +++ b/linux/boardtest/SpiTestClass.h @@ -1,7 +1,7 @@ #ifndef LINUX_BOARDTEST_SPITESTCLASS_H_ #define LINUX_BOARDTEST_SPITESTCLASS_H_ -#include +#include #include #include diff --git a/linux/spi/SpiComIF.h b/linux/spi/SpiComIF.h index 0e27a595..c5076ba6 100644 --- a/linux/spi/SpiComIF.h +++ b/linux/spi/SpiComIF.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/linux/spi/SpiCookie.h b/linux/spi/SpiCookie.h index 59d0e206..aff4d770 100644 --- a/linux/spi/SpiCookie.h +++ b/linux/spi/SpiCookie.h @@ -3,7 +3,7 @@ #include "spiDefinitions.h" #include -#include +#include #include class SpiCookie: public CookieIF { diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index 6caf4a08..e06537d3 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -15,11 +15,11 @@ - + - + @@ -70,7 +70,7 @@ - + @@ -219,9 +219,6 @@ - - - @@ -233,7 +230,7 @@ - + - + @@ -370,9 +363,6 @@ - - - @@ -461,7 +451,7 @@ - + - - + + - + @@ -535,277 +521,134 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -813,14 +656,11 @@ - + - - - @@ -831,50 +671,44 @@ - + - - - - make - -f Makefile-Hosted -j16 - hardclean - true - true - true - - - - + - + - + - + - + - + - + - + + + + + + + From ced80ce4d0bad3be4adeb6cd183063d4bbc61ec5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 23 Mar 2021 16:47:35 +0100 Subject: [PATCH 05/36] updated project files again --- misc/eclipse/.cproject | 434 ++++++++++++++++++++++++++++------------- misc/eclipse/.project | 2 +- 2 files changed, 301 insertions(+), 135 deletions(-) diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index e06537d3..6caf4a08 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -15,11 +15,11 @@ - + - + @@ -70,7 +70,7 @@ - + @@ -219,6 +219,9 @@ + + + @@ -230,7 +233,7 @@ - + - + @@ -363,6 +370,9 @@ + + + @@ -451,7 +461,7 @@ - - + + - + @@ -521,134 +535,277 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -656,11 +813,14 @@ - + + + + @@ -671,44 +831,50 @@ + - + + + + make + -f Makefile-Hosted -j16 + hardclean + true + true + true + + + - + - + - + - + - + - + - + - - - - - - - + diff --git a/misc/eclipse/.project b/misc/eclipse/.project index 906c567f..059a5c19 100644 --- a/misc/eclipse/.project +++ b/misc/eclipse/.project @@ -7,7 +7,7 @@ org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, + full,incremental, From 1ad03cef9ed5e7c39a7556db705c446eda41a7f3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 23 Mar 2021 16:52:19 +0100 Subject: [PATCH 06/36] fixed q7s --- bsp_q7s/ObjectFactory.cpp | 4 ++-- bsp_q7s/devices/HeaterHandler.cpp | 2 +- bsp_q7s/devices/HeaterHandler.h | 2 +- bsp_q7s/devices/SolarArrayDeploymentHandler.cpp | 2 +- bsp_q7s/devices/SolarArrayDeploymentHandler.h | 4 +--- fsfw_hal | 2 +- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index f81fc173..70e2db20 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -24,8 +24,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/bsp_q7s/devices/HeaterHandler.cpp b/bsp_q7s/devices/HeaterHandler.cpp index 9a44c57b..21a4a3f4 100644 --- a/bsp_q7s/devices/HeaterHandler.cpp +++ b/bsp_q7s/devices/HeaterHandler.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include HeaterHandler::HeaterHandler(object_id_t setObjectId_, object_id_t gpioDriverId_, CookieIF * gpioCookie_, object_id_t mainLineSwitcherObjectId_, uint8_t mainLineSwitch_) : diff --git a/bsp_q7s/devices/HeaterHandler.h b/bsp_q7s/devices/HeaterHandler.h index 01319ce9..8969ebd9 100644 --- a/bsp_q7s/devices/HeaterHandler.h +++ b/bsp_q7s/devices/HeaterHandler.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include /** diff --git a/bsp_q7s/devices/SolarArrayDeploymentHandler.cpp b/bsp_q7s/devices/SolarArrayDeploymentHandler.cpp index d307ef15..25be3927 100644 --- a/bsp_q7s/devices/SolarArrayDeploymentHandler.cpp +++ b/bsp_q7s/devices/SolarArrayDeploymentHandler.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include diff --git a/bsp_q7s/devices/SolarArrayDeploymentHandler.h b/bsp_q7s/devices/SolarArrayDeploymentHandler.h index b7e94f23..5e573128 100644 --- a/bsp_q7s/devices/SolarArrayDeploymentHandler.h +++ b/bsp_q7s/devices/SolarArrayDeploymentHandler.h @@ -1,8 +1,6 @@ #ifndef MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_ #define MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_ -#include - #include #include #include @@ -11,7 +9,7 @@ #include #include #include - +#include #include /** diff --git a/fsfw_hal b/fsfw_hal index f094e992..20b4b5d5 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit f094e9921db807344ed5488f662295034eb89731 +Subproject commit 20b4b5d5d3c5f1af807634e75f859ded2dc74012 From ebfda75e34b386bda94dd27acb446dbb9337b128 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 29 Mar 2021 14:31:55 +0200 Subject: [PATCH 07/36] added way to supply definesto cmake --- cmake/scripts/cmake_build_config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/scripts/cmake_build_config.py b/cmake/scripts/cmake_build_config.py index 0e4b6f25..32b560f6 100644 --- a/cmake/scripts/cmake_build_config.py +++ b/cmake/scripts/cmake_build_config.py @@ -26,6 +26,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("-d", "--defines", + help="Additional custom defines passed to CMake (supply without -D prefix!)", + nargs="*", type=str) parser.add_argument("-t", "--target-bsp", type=str, help="Target BSP, combination of architecture and machine") args = parser.parse_args() From 25b5734186f2b00ad863fe385fde69e884a5fdd5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 29 Mar 2021 14:37:08 +0200 Subject: [PATCH 08/36] fsfw updated --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 83d0db82..f2da3123 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 83d0db824289b28dbad81cce0c80276c4fc839c8 +Subproject commit f2da31239c43422f7254b8f4a26e663cffd8e3f3 From 103c12052c27475aa91991d58dba36c0d53e55e4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 29 Mar 2021 14:42:33 +0200 Subject: [PATCH 09/36] corrections ofr updated common udp code --- bsp_q7s/ObjectFactory.cpp | 10 ++++++---- bsp_rpi/ObjectFactory.cpp | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index 70e2db20..3e52402a 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -30,9 +30,11 @@ #include #include #include -#include #include -#include + +/* UDP server includes */ +#include +#include #if TEST_LIBGPIOD == 1 #include @@ -170,10 +172,10 @@ void ObjectFactory::produce(){ gpioIds::DEPLSA1, gpioIds::DEPLSA2, 1000); #endif - new TmTcUnixUdpBridge(objects::UDP_BRIDGE, + new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE); - new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); + new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); #if TE0720 == 1 && TEST_LIBGPIOD == 1 /* Configure MIO0 as input */ diff --git a/bsp_rpi/ObjectFactory.cpp b/bsp_rpi/ObjectFactory.cpp index a5c81961..0c75cf81 100644 --- a/bsp_rpi/ObjectFactory.cpp +++ b/bsp_rpi/ObjectFactory.cpp @@ -23,11 +23,13 @@ #include #include #include -#include #include -#include #include +/* UDP server includes */ +#include +#include + #include #include @@ -55,10 +57,10 @@ void ObjectFactory::produce(){ Factory::setStaticFrameworkObjectIds(); ObjectFactory::produceGenericObjects(); - new TmTcUnixUdpBridge(objects::UDP_BRIDGE, + new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE); - new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); + new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF); From 93daabab73d24e53fd3566f1faf44c06870e4339 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Thu, 1 Apr 2021 10:09:37 +0200 Subject: [PATCH 10/36] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 83d0db82..f2da3123 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 83d0db824289b28dbad81cce0c80276c4fc839c8 +Subproject commit f2da31239c43422f7254b8f4a26e663cffd8e3f3 From f13b86379fe9ac861449a185323263bd8495044f Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Thu, 1 Apr 2021 10:12:57 +0200 Subject: [PATCH 11/36] updated to new fsfw --- bsp_q7s/ObjectFactory.cpp | 8 ++++---- bsp_rpi/ObjectFactory.cpp | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index 70e2db20..abec2e19 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -30,9 +30,9 @@ #include #include #include -#include #include -#include +#include +#include #if TEST_LIBGPIOD == 1 #include @@ -170,10 +170,10 @@ void ObjectFactory::produce(){ gpioIds::DEPLSA1, gpioIds::DEPLSA2, 1000); #endif - new TmTcUnixUdpBridge(objects::UDP_BRIDGE, + new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE); - new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); + new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); #if TE0720 == 1 && TEST_LIBGPIOD == 1 /* Configure MIO0 as input */ diff --git a/bsp_rpi/ObjectFactory.cpp b/bsp_rpi/ObjectFactory.cpp index a5c81961..b2e6f23d 100644 --- a/bsp_rpi/ObjectFactory.cpp +++ b/bsp_rpi/ObjectFactory.cpp @@ -23,9 +23,9 @@ #include #include #include -#include #include -#include +#include +#include #include #include @@ -55,10 +55,9 @@ void ObjectFactory::produce(){ Factory::setStaticFrameworkObjectIds(); ObjectFactory::produceGenericObjects(); - new TmTcUnixUdpBridge(objects::UDP_BRIDGE, - objects::CCSDS_PACKET_DISTRIBUTOR, + new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE); - new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); + new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF); From 5f6479d193b68d281159884f614e7d7d40296479 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Thu, 1 Apr 2021 10:24:21 +0200 Subject: [PATCH 12/36] added unix path helper --- cmake/scripts/Q7S/unix_path_helper.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 cmake/scripts/Q7S/unix_path_helper.sh diff --git a/cmake/scripts/Q7S/unix_path_helper.sh b/cmake/scripts/Q7S/unix_path_helper.sh new file mode 100644 index 00000000..296bfdd8 --- /dev/null +++ b/cmake/scripts/Q7S/unix_path_helper.sh @@ -0,0 +1,6 @@ +#!/bin/sh +export PATH=$PATH:"/opt/Xilinx/SDK/2018.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin" +export CROSS_COMPILE="arm-linux-gnueabihf" + +export Q7S_SYSROOT="$HOME/Xilinx/cortexa9hf-neon-xiphos-linux-gnueabi" + From 4e2d8bdc5ce1510403a7d023a5395a81e809ade3 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Thu, 1 Apr 2021 10:37:34 +0200 Subject: [PATCH 13/36] updated host osal --- bsp_hosted/ObjectFactory.cpp | 21 ++++----------------- test/testtasks/TestTask.cpp | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index 798fa7ec..f3d7591d 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -11,13 +11,8 @@ #include #include -#ifdef LINUX -#include -#include -#elif WIN32 -#include -#include -#endif +#include +#include #include @@ -45,17 +40,9 @@ void ObjectFactory::produce(){ Factory::setStaticFrameworkObjectIds(); ObjectFactory::produceGenericObjects(); -#ifdef LINUX - new TmTcUnixUdpBridge(objects::UDP_BRIDGE, + new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE); - new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); -#elif WIN32 - new TmTcWinUdpBridge(objects::UDP_BRIDGE, - objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE, - objects::TC_STORE); - new TcWinUdpPollingTask(objects::UDP_POLLING_TASK, - objects::UDP_BRIDGE); -#endif + new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); } diff --git a/test/testtasks/TestTask.cpp b/test/testtasks/TestTask.cpp index 86f4af38..88a5d13e 100644 --- a/test/testtasks/TestTask.cpp +++ b/test/testtasks/TestTask.cpp @@ -66,6 +66,14 @@ gps_rx_data[] = "" "$GPRMC,183731,A,3907.482,N,12102.436,W,000.0,360.0,080301,015.5,E*67\r\n" "$GPRMB,A,,,,,,,,,,,,V*71\r\n"; +const char hyperion_gps_data[] = "" + "$GNGGA,173225.998892,4908.5596,N,00906.2765,E,1,05,2.1,215.0,M,48.2,M,,0000*74\r\n" + "$GNGLL,4908.5596,N,00906.2765,E,173225.998892,A,A*7F\r\n" + "$GPGSA,A,3,18,16,26,31,20,,,,,,,,3.2,2.1,2.4*3C\r\n" + "$GNRMC,173225.998892,A,4908.5596,N,00906.2765,E,000.0,040.7,270221,,,A*4F\r\n" + "$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() { #if OBSW_ADD_TEST_CODE == 1 //performLwgpsTest(); @@ -93,18 +101,18 @@ ReturnValue_t TestTask::performActionB() { void TestTask::performLwgpsTest() { /* Everything here will only be performed once. */ - etl::vector testVec; + sif::info << "Processing sample GPS output.." << std::endl; lwgps_t gpsStruct; sif::info << "Size of GPS struct: " << sizeof(gpsStruct) << std::endl; lwgps_init(&gpsStruct); /* Process all input data */ - lwgps_process(&gpsStruct, gps_rx_data, strlen(gps_rx_data)); + lwgps_process(&gpsStruct, hyperion_gps_data, strlen(hyperion_gps_data)); /* Print messages */ - printf("Valid status: %d\r\n", gpsStruct.is_valid); - printf("Latitude: %f degrees\r\n", gpsStruct.latitude); - printf("Longitude: %f degrees\r\n", gpsStruct.longitude); - printf("Altitude: %f meters\r\n", gpsStruct.altitude); + printf("Valid status: %d\n", gpsStruct.is_valid); + printf("Latitude: %f degrees\n", gpsStruct.latitude); + printf("Longitude: %f degrees\n", gpsStruct.longitude); + printf("Altitude: %f meters\n", gpsStruct.altitude); } From 2b3d531e5d83a2b8013af963219911f3f101b947 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Thu, 1 Apr 2021 10:59:36 +0200 Subject: [PATCH 14/36] moved spi code to fsfw_hal --- bsp_rpi/ObjectFactory.cpp | 7 +- fsfw_hal | 2 +- fsfwconfig/devices/spi.h | 2 +- linux/boardtest/SpiTestClass.cpp | 9 +- linux/boardtest/SpiTestClass.h | 2 +- linux/i2c/I2cComIF.cpp | 9 +- linux/spi/CMakeLists.txt | 8 - linux/spi/SpiComIF.cpp | 321 ------------------------------- linux/spi/SpiComIF.h | 63 ------ linux/spi/SpiCookie.cpp | 107 ----------- linux/spi/SpiCookie.h | 119 ------------ linux/spi/spiDefinitions.h | 17 -- linux/utility/CMakeLists.txt | 1 - linux/utility/Utility.cpp | 52 ----- linux/utility/Utility.h | 36 ---- 15 files changed, 17 insertions(+), 738 deletions(-) delete mode 100644 linux/spi/SpiComIF.cpp delete mode 100644 linux/spi/SpiComIF.h delete mode 100644 linux/spi/SpiCookie.cpp delete mode 100644 linux/spi/SpiCookie.h delete mode 100644 linux/spi/spiDefinitions.h delete mode 100644 linux/utility/Utility.cpp delete mode 100644 linux/utility/Utility.h diff --git a/bsp_rpi/ObjectFactory.cpp b/bsp_rpi/ObjectFactory.cpp index 0c75cf81..960abfe6 100644 --- a/bsp_rpi/ObjectFactory.cpp +++ b/bsp_rpi/ObjectFactory.cpp @@ -1,5 +1,4 @@ #include "ObjectFactory.h" -#include #include #include @@ -11,8 +10,6 @@ #include #include -#include -#include #include #include @@ -31,8 +28,10 @@ #include #include +#include #include - +#include +#include void Factory::setStaticFrameworkObjectIds() { PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; diff --git a/fsfw_hal b/fsfw_hal index 20b4b5d5..8f3b0ecc 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit 20b4b5d5d3c5f1af807634e75f859ded2dc74012 +Subproject commit 8f3b0eccdb1cf9ac5863d3d6411e6ef6528b8005 diff --git a/fsfwconfig/devices/spi.h b/fsfwconfig/devices/spi.h index 7085aa4d..55271a40 100644 --- a/fsfwconfig/devices/spi.h +++ b/fsfwconfig/devices/spi.h @@ -2,7 +2,7 @@ #define FSFWCONFIG_DEVICES_SPI_H_ #include -#include +#include /** * SPI configuration will be contained here to let the device handlers remain independent diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 374cb644..4f2e0e7e 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -7,7 +7,8 @@ #include #include -#include +#include +#include #include #include @@ -81,7 +82,7 @@ void SpiTestClass::performRm3100Test(uint8_t mgmId) { int fileDescriptor = 0; - utility::UnixFileHelper fileHelper(deviceName, &fileDescriptor, O_RDWR, + UnixFileGuard fileHelper(deviceName, &fileDescriptor, O_RDWR, "SpiComIF::initializeInterface: "); if(fileHelper.getOpenResult()) { sif::error << "SpiTestClass::performRm3100Test: File descriptor could not be opened!" @@ -179,7 +180,7 @@ void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) { #endif int fileDescriptor = 0; - utility::UnixFileHelper fileHelper(deviceName, &fileDescriptor, O_RDWR, + UnixFileGuard fileHelper(deviceName, &fileDescriptor, O_RDWR, "SpiComIF::initializeInterface: "); if(fileHelper.getOpenResult()) { sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!" @@ -225,7 +226,7 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { #endif int fileDescriptor = 0; - utility::UnixFileHelper fileHelper(deviceName, &fileDescriptor, O_RDWR, + UnixFileGuard fileHelper(deviceName, &fileDescriptor, O_RDWR, "SpiComIF::initializeInterface: "); if(fileHelper.getOpenResult()) { sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!" diff --git a/linux/boardtest/SpiTestClass.h b/linux/boardtest/SpiTestClass.h index 2e3d8b8c..f92799b5 100644 --- a/linux/boardtest/SpiTestClass.h +++ b/linux/boardtest/SpiTestClass.h @@ -2,7 +2,7 @@ #define LINUX_BOARDTEST_SPITESTCLASS_H_ #include -#include +#include #include #include diff --git a/linux/i2c/I2cComIF.cpp b/linux/i2c/I2cComIF.cpp index ed50293d..753d33a9 100644 --- a/linux/i2c/I2cComIF.cpp +++ b/linux/i2c/I2cComIF.cpp @@ -1,11 +1,14 @@ #include "I2cComIF.h" #include + +#include +#include + #include #include #include #include #include -#include #include @@ -82,7 +85,7 @@ ReturnValue_t I2cComIF::sendMessage(CookieIF *cookie, } deviceFile = i2cCookie->getDeviceFile(); - utility::UnixFileHelper fileHelper(deviceFile, &fd, O_RDWR, "I2cComIF::sendMessage"); + UnixFileGuard fileHelper(deviceFile, &fd, O_RDWR, "I2cComIF::sendMessage"); if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { return fileHelper.getOpenResult(); } @@ -131,7 +134,7 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF *cookie, } deviceFile = i2cCookie->getDeviceFile(); - utility::UnixFileHelper fileHelper(deviceFile, &fd, O_RDWR, "I2cComIF::requestReceiveMessage"); + UnixFileGuard fileHelper(deviceFile, &fd, O_RDWR, "I2cComIF::requestReceiveMessage"); if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { return fileHelper.getOpenResult(); } diff --git a/linux/spi/CMakeLists.txt b/linux/spi/CMakeLists.txt index cb1c9277..e69de29b 100644 --- a/linux/spi/CMakeLists.txt +++ b/linux/spi/CMakeLists.txt @@ -1,8 +0,0 @@ -target_sources(${TARGET_NAME} PUBLIC - SpiComIF.cpp - SpiCookie.cpp -) - - - - diff --git a/linux/spi/SpiComIF.cpp b/linux/spi/SpiComIF.cpp deleted file mode 100644 index b94e1249..00000000 --- a/linux/spi/SpiComIF.cpp +++ /dev/null @@ -1,321 +0,0 @@ -#include "SpiComIF.h" -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -SpiComIF::SpiComIF(object_id_t objectId, GpioIF* gpioComIF): SystemObject(objectId), - gpioComIF(gpioComIF) { - if(gpioComIF == nullptr) { -#if FSFW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "SpiComIF::SpiComIF: GPIO communication interface invalid!" << std::endl; -#else - sif::printError("SpiComIF::SpiComIF: GPIO communication interface invalid!\n"); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif /* FSFW_VERBOSE_LEVEL >= 1 */ - } - - spiMutex = MutexFactory::instance()->createMutex(); -} - -ReturnValue_t SpiComIF::initializeInterface(CookieIF *cookie) { - int retval = 0; - SpiCookie* spiCookie = dynamic_cast(cookie); - if(spiCookie == nullptr) { - return NULLPOINTER; - } - - address_t spiAddress = spiCookie->getSpiAddress(); - - auto iter = spiDeviceMap.find(spiAddress); - if(iter == spiDeviceMap.end()) { - size_t bufferSize = spiCookie->getMaxBufferSize(); - SpiInstance spiInstance = {std::vector(bufferSize)}; - auto statusPair = spiDeviceMap.emplace(spiAddress, spiInstance); - if (not statusPair.second) { -#if FSFW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "SpiComIF::initializeInterface: Failed to insert device with address " << - spiAddress << "to SPI device map" << std::endl; -#else - sif::printError("SpiComIF::initializeInterface: Failed to insert device with address " - "%lu to SPI device map\n", static_cast(spiAddress)); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif /* FSFW_VERBOSE_LEVEL >= 1 */ - return HasReturnvaluesIF::RETURN_FAILED; - } - /* Now we emplaced the read buffer in the map, we still need to assign that location - to the SPI driver transfer struct */ - spiCookie->assignReadBuffer(statusPair.first->second.replyBuffer.data()); - } - else { -#if FSFW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "SpiComIF::initializeInterface: SPI address already exists!" << std::endl; -#else - sif::printError("SpiComIF::initializeInterface: SPI address already exists!\n"); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif /* FSFW_VERBOSE_LEVEL >= 1 */ - return HasReturnvaluesIF::RETURN_FAILED; - } - - /* Pull CS high in any case to be sure that device is inactive */ - gpioId_t gpioId = spiCookie->getChipSelectPin(); - if(gpioId != gpio::NO_GPIO) { - gpioComIF->pullHigh(gpioId); - } - - size_t spiSpeed = 0; - spi::SpiModes spiMode = spi::SpiModes::MODE_0; - - SpiCookie::UncommonParameters params; - spiCookie->getSpiParameters(spiMode, spiSpeed, ¶ms); - - int fileDescriptor = 0; - utility::UnixFileHelper fileHelper(spiCookie->getSpiDevice(), &fileDescriptor, O_RDWR, - "SpiComIF::initializeInterface: "); - if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { - return fileHelper.getOpenResult(); - } - - /* These flags are rather uncommon */ - if(params.threeWireSpi or params.noCs or params.csHigh) { - uint32_t currentMode = 0; - retval = ioctl(fileDescriptor, SPI_IOC_RD_MODE32, ¤tMode); - if(retval != 0) { - utility::handleIoctlError("SpiComIF::initialiezInterface: Could not read full mode!"); - } - - if(params.threeWireSpi) { - currentMode |= SPI_3WIRE; - } - if(params.noCs) { - /* Some drivers like the Raspberry Pi ignore this flag in any case */ - currentMode |= SPI_NO_CS; - } - if(params.csHigh) { - currentMode |= SPI_CS_HIGH; - } - /* Write adapted mode */ - retval = ioctl(fileDescriptor, SPI_IOC_WR_MODE32, ¤tMode); - if(retval != 0) { - utility::handleIoctlError("SpiComIF::initialiezInterface: Could not write full mode!"); - } - } - if(params.lsbFirst) { - retval = ioctl(fileDescriptor, SPI_IOC_WR_LSB_FIRST, ¶ms.lsbFirst); - if(retval != 0) { - utility::handleIoctlError("SpiComIF::initializeInterface: Setting LSB first failed"); - } - } - if(params.bitsPerWord != 8) { - retval = ioctl(fileDescriptor, SPI_IOC_WR_BITS_PER_WORD, ¶ms.bitsPerWord); - if(retval != 0) { - utility::handleIoctlError("SpiComIF::initializeInterface: " - "Could not write bits per word!"); - } - } - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t SpiComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) { - SpiCookie* spiCookie = dynamic_cast(cookie); - ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; - int retval = 0; - - if(spiCookie == nullptr) { - return NULLPOINTER; - } - - if(sendLen > spiCookie->getMaxBufferSize()) { -#if FSFW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "SpiComIF::sendMessage: Too much data sent, send length" << sendLen << - "larger than maximum buffer length" << spiCookie->getMaxBufferSize() << std::endl; -#else - sif::printWarning("SpiComIF::sendMessage: Too much data sent, send length %lu larger " - "than maximum buffer length %lu!\n", static_cast(sendLen), - static_cast(spiCookie->getMaxBufferSize())); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif /* FSFW_VERBOSE_LEVEL >= 1 */ - return DeviceCommunicationIF::TOO_MUCH_DATA; - } - - - /* Prepare transfer */ - int fileDescriptor = 0; - std::string device = spiCookie->getSpiDevice(); - utility::UnixFileHelper fileHelper(device, &fileDescriptor, O_RDWR, - "SpiComIF::sendMessage: "); - if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { - return OPENING_FILE_FAILED; - } - spi::SpiModes spiMode = spi::SpiModes::MODE_0; - uint32_t spiSpeed = 0; - spiCookie->getSpiParameters(spiMode, spiSpeed, nullptr); - setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); - spiCookie->assignWriteBuffer(sendData); - spiCookie->assignTransferSize(sendLen); - - bool fullDuplex = spiCookie->isFullDuplex(); - gpioId_t gpioId = spiCookie->getChipSelectPin(); - - /* GPIO access is mutex protected */ - MutexGuard(spiMutex, timeoutType, timeoutMs); - - /* Pull SPI CS low. For now, no support for active high given */ - if(gpioId != gpio::NO_GPIO) { - gpioComIF->pullLow(gpioId); - } - - /* Execute transfer */ - if(fullDuplex) { - /* Initiate a full duplex SPI transfer. */ - retval = ioctl(fileDescriptor, SPI_IOC_MESSAGE(1), spiCookie->getTransferStructHandle()); - if(retval < 0) { - utility::handleIoctlError("SpiComIF::sendMessage: ioctl error."); - result = FULL_DUPLEX_TRANSFER_FAILED; - } -#if FSFW_LINUX_SPI_WIRETAPPING == 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "Sent SPI data: " << std::endl; - size_t dataLen = spiCookie->getTransferStructHandle()->len; - uint8_t* dataPtr = reinterpret_cast(spiCookie->getTransferStructHandle()->tx_buf); - arrayprinter::print(dataPtr, dataLen, OutputType::HEX, false); - sif::info << "Received SPI data: " << std::endl; - dataPtr = reinterpret_cast(spiCookie->getTransferStructHandle()->rx_buf); - arrayprinter::print(dataPtr, dataLen, OutputType::HEX, false); -#else -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */ - } - else { - /* We write with a blocking half-duplex transfer here */ - if (write(fileDescriptor, sendData, sendLen) != static_cast(sendLen)) { -#if FSFW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "SpiComIF::sendMessage: Half-Duplex write operation failed!" << - std::endl; -#else - sif::printWarning("SpiComIF::sendMessage: Half-Duplex write operation failed!\n"); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif /* FSFW_VERBOSE_LEVEL >= 1 */ - result = HALF_DUPLEX_TRANSFER_FAILED; - } - } - - if(gpioId != gpio::NO_GPIO) { - gpioComIF->pullHigh(gpioId); - } - return result; -} - -ReturnValue_t SpiComIF::getSendSuccess(CookieIF *cookie) { - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t SpiComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { - ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; - SpiCookie* spiCookie = dynamic_cast(cookie); - if(spiCookie == nullptr) { - return NULLPOINTER; - } - - bool fullDuplex = spiCookie->isFullDuplex(); - if(fullDuplex) { - return HasReturnvaluesIF::RETURN_OK; - } - - std::string device = spiCookie->getSpiDevice(); - int fileDescriptor = 0; - utility::UnixFileHelper fileHelper(device, &fileDescriptor, O_RDWR, - "SpiComIF::requestReceiveMessage: "); - if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { - return OPENING_FILE_FAILED; - } - - uint8_t* rxBuf = nullptr; - size_t readSize = spiCookie->getCurrentTransferSize(); - result = getReadBuffer(spiCookie->getSpiAddress(), &rxBuf); - if(result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - - gpioId_t gpioId = spiCookie->getChipSelectPin(); - MutexGuard(spiMutex, timeoutType, timeoutMs); - if(gpioId != gpio::NO_GPIO) { - gpioComIF->pullLow(gpioId); - } - - if(read(fileDescriptor, rxBuf, readSize) != static_cast(readSize)) { -#if FSFW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "SpiComIF::sendMessage: Half-Duplex read operation failed!" << std::endl; -#else - sif::printWarning("SpiComIF::sendMessage: Half-Duplex read operation failed!\n"); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif /* FSFW_VERBOSE_LEVEL >= 1 */ - result = HALF_DUPLEX_TRANSFER_FAILED; - } - - if(gpioId != gpio::NO_GPIO) { - gpioComIF->pullHigh(gpioId); - } - - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t SpiComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { - SpiCookie* spiCookie = dynamic_cast(cookie); - if(spiCookie == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - uint8_t* rxBuf = nullptr; - ReturnValue_t result = getReadBuffer(spiCookie->getSpiAddress(), &rxBuf); - if(result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - - *buffer = rxBuf; - *size = spiCookie->getCurrentTransferSize(); - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t SpiComIF::getReadBuffer(address_t spiAddress, uint8_t** buffer) { - if(buffer == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - - auto iter = spiDeviceMap.find(spiAddress); - if(iter == spiDeviceMap.end()) { - return HasReturnvaluesIF::RETURN_FAILED; - } - - *buffer = iter->second.replyBuffer.data(); - return HasReturnvaluesIF::RETURN_OK; -} - -void SpiComIF::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed) { - int retval = ioctl(spiFd, SPI_IOC_WR_MODE, reinterpret_cast(&mode)); - if(retval != 0) { - utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!"); - } - - retval = ioctl(spiFd, SPI_IOC_WR_MAX_SPEED_HZ, &speed); - if(retval != 0) { - utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI speed failed!"); - } -} diff --git a/linux/spi/SpiComIF.h b/linux/spi/SpiComIF.h deleted file mode 100644 index c5076ba6..00000000 --- a/linux/spi/SpiComIF.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef LINUX_SPI_SPICOMIF_H_ -#define LINUX_SPI_SPICOMIF_H_ - -#include -#include -#include -#include -#include - -#include -#include - -/** - * @brief Encapsulates access to linux SPI driver for FSFW objects - * @details - * Right now, only full-duplex SPI is supported. - * @author R. Mueller - */ -class SpiComIF: public DeviceCommunicationIF, public SystemObject { -public: - static constexpr uint8_t spiRetvalId = CLASS_ID::LINUX_SPI_COM_IF; - static constexpr ReturnValue_t OPENING_FILE_FAILED = - HasReturnvaluesIF::makeReturnCode(spiRetvalId, 0); - /* Full duplex (ioctl) transfer failure */ - static constexpr ReturnValue_t FULL_DUPLEX_TRANSFER_FAILED = - HasReturnvaluesIF::makeReturnCode(spiRetvalId, 1); - /* Half duplex (read/write) transfer failure */ - static constexpr ReturnValue_t HALF_DUPLEX_TRANSFER_FAILED = - HasReturnvaluesIF::makeReturnCode(spiRetvalId, 2); - - SpiComIF(object_id_t objectId, GpioIF* gpioComIF); - - ReturnValue_t initializeInterface(CookieIF * cookie) override; - ReturnValue_t sendMessage(CookieIF *cookie,const uint8_t *sendData, - size_t sendLen) override; - ReturnValue_t getSendSuccess(CookieIF *cookie) override; - ReturnValue_t requestReceiveMessage(CookieIF *cookie, - size_t requestLen) override; - ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, - size_t *size) override; -private: - - struct SpiInstance { - std::vector replyBuffer; - }; - - GpioIF* gpioComIF = nullptr; - - MutexIF* spiMutex = nullptr; - MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; - uint32_t timeoutMs = 20; - - using SpiDeviceMap = std::unordered_map; - using SpiDeviceMapIter = SpiDeviceMap::iterator; - - SpiDeviceMap spiDeviceMap; - - - ReturnValue_t getReadBuffer(address_t spiAddress, uint8_t** buffer); - void setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed); -}; - -#endif /* LINUX_SPI_SPICOMIF_H_ */ diff --git a/linux/spi/SpiCookie.cpp b/linux/spi/SpiCookie.cpp deleted file mode 100644 index 91117682..00000000 --- a/linux/spi/SpiCookie.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include "SpiCookie.h" - -SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, - const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed): spiAddress(spiAddress), - chipSelectPin(chipSelect), spiDevice(spiDev), maxSize(maxSize), spiMode(spiMode), - spiSpeed(spiSpeed) { -} - -SpiCookie::SpiCookie(address_t spiAddress, std::string spiDev, const size_t maxSize, - spi::SpiModes spiMode, uint32_t spiSpeed): - SpiCookie(spiAddress, gpio::NO_GPIO, spiDev, maxSize, spiMode, spiSpeed) { -} - -void SpiCookie::getSpiParameters(spi::SpiModes& spiMode, uint32_t& spiSpeed, - UncommonParameters* parameters) const { - spiMode = this->spiMode; - spiSpeed = this->spiSpeed; - - if(parameters != nullptr) { - parameters->threeWireSpi = uncommonParameters.threeWireSpi; - parameters->lsbFirst = uncommonParameters.lsbFirst; - parameters->noCs = uncommonParameters.noCs; - parameters->bitsPerWord = uncommonParameters.bitsPerWord; - parameters->csHigh = uncommonParameters.csHigh; - } -} - -gpioId_t SpiCookie::getChipSelectPin() const { - return chipSelectPin; -} - -size_t SpiCookie::getMaxBufferSize() const { - return maxSize; -} - -address_t SpiCookie::getSpiAddress() const { - return spiAddress; -} - -std::string SpiCookie::getSpiDevice() const { - return spiDevice; -} - -void SpiCookie::setThreeWireSpi(bool enable) { - uncommonParameters.threeWireSpi = enable; -} - -void SpiCookie::setLsbFirst(bool enable) { - uncommonParameters.lsbFirst = enable; -} - -void SpiCookie::setNoCs(bool enable) { - uncommonParameters.noCs = enable; -} - -void SpiCookie::setBitsPerWord(uint8_t bitsPerWord) { - uncommonParameters.bitsPerWord = bitsPerWord; -} - -void SpiCookie::setCsHigh(bool enable) { - uncommonParameters.csHigh = enable; -} - -void SpiCookie::activateCsDeselect(bool deselectCs, uint16_t delayUsecs) { - spiTransferStruct.cs_change = deselectCs; - spiTransferStruct.delay_usecs = delayUsecs; -} - -void SpiCookie::assignReadBuffer(uint8_t* rx) { - if(rx != nullptr) { - spiTransferStruct.rx_buf = reinterpret_cast<__u64>(rx); - } -} - -void SpiCookie::assignWriteBuffer(const uint8_t* tx) { - if(tx != nullptr) { - spiTransferStruct.tx_buf = reinterpret_cast<__u64>(tx); - } -} - -spi_ioc_transfer* SpiCookie::getTransferStructHandle() { - return &spiTransferStruct; -} - -void SpiCookie::setFullOrHalfDuplex(bool halfDuplex) { - this->halfDuplex = halfDuplex; -} - -bool SpiCookie::isFullDuplex() const { - return not this->halfDuplex; -} - -void SpiCookie::assignTransferSize(size_t transferSize) { - spiTransferStruct.len = transferSize; -} - -size_t SpiCookie::getCurrentTransferSize() const { - return spiTransferStruct.len; -} - -void SpiCookie::setSpiSpeed(uint32_t newSpeed) { - this->spiSpeed = newSpeed; -} - -void SpiCookie::setSpiMode(spi::SpiModes newMode) { - this->spiMode = newMode; -} diff --git a/linux/spi/SpiCookie.h b/linux/spi/SpiCookie.h deleted file mode 100644 index aff4d770..00000000 --- a/linux/spi/SpiCookie.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef LINUX_SPI_SPICOOKIE_H_ -#define LINUX_SPI_SPICOOKIE_H_ - -#include "spiDefinitions.h" -#include -#include -#include - -class SpiCookie: public CookieIF { -public: - - /** - * Each SPI device will have a corresponding cookie. The cookie is used by the communication - * interface and contains device specific information like the largest expected size to be - * sent and received and the GPIO pin used to toggle the SPI slave select pin. - * @param spiAddress - * @param chipSelect Chip select. gpio::NO_GPIO can be used for hardware slave selects. - * @param spiDev - * @param maxSize - */ - SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, - const size_t maxReplySize, spi::SpiModes spiMode, uint32_t spiSpeed); - - /** - * Like constructor above, but without a dedicated GPIO CS. Can be used for hardware - * slave select or if CS logic is performed with decoders. - */ - SpiCookie(address_t spiAddress, std::string spiDev, const size_t maxReplySize, - spi::SpiModes spiMode, uint32_t spiSpeed); - - address_t getSpiAddress() const; - std::string getSpiDevice() const; - gpioId_t getChipSelectPin() const; - size_t getMaxBufferSize() const; - - /** Enables changing SPI speed at run-time */ - void setSpiSpeed(uint32_t newSpeed); - /** Enables changing the SPI mode at run-time */ - void setSpiMode(spi::SpiModes newMode); - - /** - * True if SPI transfers should be performed in full duplex mode - * @return - */ - bool isFullDuplex() const; - - /** - * Set transfer type to full duplex or half duplex. Full duplex is the default setting, - * ressembling common SPI hardware implementation with shift registers, where read and writes - * happen simultaneosly. - * @param fullDuplex - */ - void setFullOrHalfDuplex(bool halfDuplex); - - /** - * This needs to be called to specify where the SPI driver writes to or reads from. - * @param readLocation - * @param writeLocation - */ - void assignReadBuffer(uint8_t* rx); - void assignWriteBuffer(const uint8_t* tx); - /** - * Assign size for the next transfer. - * @param transferSize - */ - void assignTransferSize(size_t transferSize); - size_t getCurrentTransferSize() const; - - struct UncommonParameters { - uint8_t bitsPerWord = 8; - bool noCs = false; - bool csHigh = false; - bool threeWireSpi = false; - /* MSB first is more common */ - bool lsbFirst = false; - }; - - /** - * Can be used to explicitely disable hardware chip select. - * Some drivers like the Raspberry Pi Linux driver will not use hardware chip select by default - * (see https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md) - * @param enable - */ - void setNoCs(bool enable); - void setThreeWireSpi(bool enable); - void setLsbFirst(bool enable); - void setCsHigh(bool enable); - void setBitsPerWord(uint8_t bitsPerWord); - - void getSpiParameters(spi::SpiModes& spiMode, uint32_t& spiSpeed, - UncommonParameters* parameters = nullptr) const; - - /** - * See spidev.h cs_change and delay_usecs - * @param deselectCs - * @param delayUsecs - */ - void activateCsDeselect(bool deselectCs, uint16_t delayUsecs); - - spi_ioc_transfer* getTransferStructHandle(); -private: - size_t currentTransferSize = 0; - - address_t spiAddress; - gpioId_t chipSelectPin; - std::string spiDevice; - - const size_t maxSize; - spi::SpiModes spiMode; - uint32_t spiSpeed; - bool halfDuplex = false; - - struct spi_ioc_transfer spiTransferStruct = {}; - UncommonParameters uncommonParameters; -}; - - - -#endif /* LINUX_SPI_SPICOOKIE_H_ */ diff --git a/linux/spi/spiDefinitions.h b/linux/spi/spiDefinitions.h deleted file mode 100644 index e8c48147..00000000 --- a/linux/spi/spiDefinitions.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef LINUX_SPI_SPIDEFINITONS_H_ -#define LINUX_SPI_SPIDEFINITONS_H_ - -#include - -namespace spi { - -enum SpiModes: uint8_t { - MODE_0, - MODE_1, - MODE_2, - MODE_3 -}; - -} - -#endif /* LINUX_SPI_SPIDEFINITONS_H_ */ diff --git a/linux/utility/CMakeLists.txt b/linux/utility/CMakeLists.txt index 71151b6c..45a7edcc 100644 --- a/linux/utility/CMakeLists.txt +++ b/linux/utility/CMakeLists.txt @@ -1,5 +1,4 @@ target_sources(${TARGET_NAME} PUBLIC - Utility.cpp ) diff --git a/linux/utility/Utility.cpp b/linux/utility/Utility.cpp deleted file mode 100644 index 45c347db..00000000 --- a/linux/utility/Utility.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "Utility.h" - -void utility::handleIoctlError(const char* const customPrintout) { -#if FSFW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - if(customPrintout != nullptr) { - sif::warning << customPrintout << std::endl; - } - sif::warning << "handleIoctlError: Error code " << errno << ", "<< strerror(errno) << - std::endl; -#else - if(customPrintout != nullptr) { - sif::printWarning("%s\n", customPrintout); - } - sif::printWarning("handleIoctlError: Error code %d, %s\n", errno, strerror(errno)); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif /* FSFW_VERBOSE_LEVEL >= 1 */ - -} - -utility::UnixFileHelper::UnixFileHelper(std::string device, int* fileDescriptor, int flags, - std::string diagnosticPrefix): - fileDescriptor(fileDescriptor) { - if(fileDescriptor == nullptr) { - return; - } - *fileDescriptor = open(device.c_str(), flags); - if (*fileDescriptor < 0) { -#if FSFW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << diagnosticPrefix <<"Opening device failed with error code " << errno << - "." << std::endl; - sif::warning << "Error description: " << strerror(errno) << std::endl; -#else - sif::printError("%sOpening device failed with error code %d.\n", diagnosticPrefix); - sif::printWarning("Error description: %s\n", strerror(errno)); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif /* FSFW_VERBOSE_LEVEL >= 1 */ - openStatus = OPEN_FILE_FAILED; - } -} - -utility::UnixFileHelper::~UnixFileHelper() { - if(fileDescriptor != nullptr) { - close(*fileDescriptor); - } -} - -ReturnValue_t utility::UnixFileHelper::getOpenResult() const { - return openStatus; -} - diff --git a/linux/utility/Utility.h b/linux/utility/Utility.h deleted file mode 100644 index a93b4936..00000000 --- a/linux/utility/Utility.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef LINUX_UTILITY_UTILITY_H_ -#define LINUX_UTILITY_UTILITY_H_ - -#include -#include -#include - -#include -#include - -namespace utility { - -void handleIoctlError(const char* const customPrintout); - -class UnixFileHelper { -public: - static constexpr int READ_WRITE_FLAG = O_RDWR; - static constexpr int READ_ONLY_FLAG = O_RDONLY; - static constexpr int NON_BLOCKING_IO_FLAG = O_NONBLOCK; - - static constexpr ReturnValue_t OPEN_FILE_FAILED = 1; - - UnixFileHelper(std::string device, int* fileDescriptor, int flags, - std::string diagnosticPrefix = ""); - - virtual~ UnixFileHelper(); - - ReturnValue_t getOpenResult() const; -private: - int* fileDescriptor = nullptr; - ReturnValue_t openStatus = HasReturnvaluesIF::RETURN_OK; -}; - -} - -#endif /* LINUX_UTILITY_UTILITY_H_ */ From fb7abbc82b2bd3bd6997ac7aa187a81d72c8eaed Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Thu, 1 Apr 2021 11:06:26 +0200 Subject: [PATCH 15/36] moved i2c to fsfw_hal as well --- bsp_q7s/ObjectFactory.cpp | 4 +- fsfw_hal | 2 +- linux/i2c/CMakeLists.txt | 2 - linux/i2c/I2cComIF.cpp | 199 -------------------------------------- linux/i2c/I2cComIF.h | 59 ----------- linux/i2c/I2cCookie.cpp | 20 ---- linux/i2c/I2cCookie.h | 37 ------- 7 files changed, 3 insertions(+), 320 deletions(-) delete mode 100644 linux/i2c/I2cComIF.cpp delete mode 100644 linux/i2c/I2cComIF.h delete mode 100644 linux/i2c/I2cCookie.cpp delete mode 100644 linux/i2c/I2cCookie.h diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index 3e52402a..6b4e94e1 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -22,8 +22,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/fsfw_hal b/fsfw_hal index 8f3b0ecc..7a3190e5 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit 8f3b0eccdb1cf9ac5863d3d6411e6ef6528b8005 +Subproject commit 7a3190e5b6980ad2addc5e8a76d21994b542f0e0 diff --git a/linux/i2c/CMakeLists.txt b/linux/i2c/CMakeLists.txt index 179abd06..45a7edcc 100644 --- a/linux/i2c/CMakeLists.txt +++ b/linux/i2c/CMakeLists.txt @@ -1,6 +1,4 @@ target_sources(${TARGET_NAME} PUBLIC - I2cComIF.cpp - I2cCookie.cpp ) diff --git a/linux/i2c/I2cComIF.cpp b/linux/i2c/I2cComIF.cpp deleted file mode 100644 index 753d33a9..00000000 --- a/linux/i2c/I2cComIF.cpp +++ /dev/null @@ -1,199 +0,0 @@ -#include "I2cComIF.h" -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include - - -I2cComIF::I2cComIF(object_id_t objectId): SystemObject(objectId){ -} - -I2cComIF::~I2cComIF() {} - -ReturnValue_t I2cComIF::initializeInterface(CookieIF* cookie) { - - address_t i2cAddress; - std::string deviceFile; - - if(cookie == nullptr) { - sif::error << "I2cComIF::initializeInterface: Invalid cookie!" << std::endl; - return NULLPOINTER; - } - I2cCookie* i2cCookie = dynamic_cast(cookie); - if(i2cCookie == nullptr) { - sif::error << "I2cComIF::initializeInterface: Invalid I2C cookie!" << std::endl; - return NULLPOINTER; - } - - i2cAddress = i2cCookie->getAddress(); - - i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); - if(i2cDeviceMapIter == i2cDeviceMap.end()) { - size_t maxReplyLen = i2cCookie->getMaxReplyLen(); - I2cInstance_t i2cInstance = {std::vector(maxReplyLen), 0}; - auto statusPair = i2cDeviceMap.emplace(i2cAddress, i2cInstance); - if (not statusPair.second) { - sif::error << "I2cComIF::initializeInterface: Failed to insert device with address " << - i2cAddress << "to I2C device " << "map" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - return HasReturnvaluesIF::RETURN_OK; - } - - sif::error << "I2cComIF::initializeInterface: Device with address " << i2cAddress << - "already in use" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; -} - -ReturnValue_t I2cComIF::sendMessage(CookieIF *cookie, - const uint8_t *sendData, size_t sendLen) { - - ReturnValue_t result; - int fd; - std::string deviceFile; - - if(sendData == nullptr) { - sif::error << "I2cComIF::sendMessage: Send Data is nullptr" - << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - - if(sendLen == 0) { - return HasReturnvaluesIF::RETURN_OK; - } - - I2cCookie* i2cCookie = dynamic_cast(cookie); - if(i2cCookie == nullptr) { - sif::error << "I2cComIF::sendMessage: Invalid I2C Cookie!" << std::endl; - return NULLPOINTER; - } - - address_t i2cAddress = i2cCookie->getAddress(); - i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); - if (i2cDeviceMapIter == i2cDeviceMap.end()) { - sif::error << "I2cComIF::sendMessage: i2cAddress of Cookie not " - << "registered in i2cDeviceMap" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - - deviceFile = i2cCookie->getDeviceFile(); - UnixFileGuard fileHelper(deviceFile, &fd, O_RDWR, "I2cComIF::sendMessage"); - if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { - return fileHelper.getOpenResult(); - } - result = openDevice(deviceFile, i2cAddress, &fd); - if (result != HasReturnvaluesIF::RETURN_OK){ - return result; - } - - if (write(fd, sendData, sendLen) != (int)sendLen) { - sif::error << "I2cComIF::sendMessage: Failed to send data to I2C " - "device with error code " << errno << ". Error description: " - << strerror(errno) << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t I2cComIF::getSendSuccess(CookieIF *cookie) { - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF *cookie, - size_t requestLen) { - ReturnValue_t result; - int fd; - std::string deviceFile; - - if (requestLen == 0) { - return HasReturnvaluesIF::RETURN_OK; - } - - I2cCookie* i2cCookie = dynamic_cast(cookie); - if(i2cCookie == nullptr) { - sif::error << "I2cComIF::requestReceiveMessage: Invalid I2C Cookie!" << std::endl; - i2cDeviceMapIter->second.replyLen = 0; - return NULLPOINTER; - } - - address_t i2cAddress = i2cCookie->getAddress(); - i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); - if (i2cDeviceMapIter == i2cDeviceMap.end()) { - sif::error << "I2cComIF::requestReceiveMessage: i2cAddress of Cookie not " - << "registered in i2cDeviceMap" << std::endl; - i2cDeviceMapIter->second.replyLen = 0; - return HasReturnvaluesIF::RETURN_FAILED; - } - - deviceFile = i2cCookie->getDeviceFile(); - UnixFileGuard fileHelper(deviceFile, &fd, O_RDWR, "I2cComIF::requestReceiveMessage"); - if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { - return fileHelper.getOpenResult(); - } - result = openDevice(deviceFile, i2cAddress, &fd); - if (result != HasReturnvaluesIF::RETURN_OK){ - i2cDeviceMapIter->second.replyLen = 0; - return result; - } - - uint8_t* replyBuffer = i2cDeviceMapIter->second.replyBuffer.data(); - - if (read(fd, replyBuffer, requestLen) != static_cast(requestLen)) { - sif::error << "I2cComIF::requestReceiveMessage: Reading from I2C " - << "device failed with error code " << errno <<". Description" - << " of error: " << strerror(errno) << std::endl; - i2cDeviceMapIter->second.replyLen = 0; - return HasReturnvaluesIF::RETURN_FAILED; - } - - i2cDeviceMapIter->second.replyLen = requestLen; - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t I2cComIF::readReceivedMessage(CookieIF *cookie, - uint8_t **buffer, size_t* size) { - I2cCookie* i2cCookie = dynamic_cast(cookie); - if(i2cCookie == nullptr) { - sif::error << "I2cComIF::readReceivedMessage: Invalid I2C Cookie!" << std::endl; - return NULLPOINTER; - } - - address_t i2cAddress = i2cCookie->getAddress(); - i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); - if (i2cDeviceMapIter == i2cDeviceMap.end()) { - sif::error << "I2cComIF::readReceivedMessage: i2cAddress of Cookie not " - << "found in i2cDeviceMap" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - *buffer = i2cDeviceMapIter->second.replyBuffer.data(); - *size = i2cDeviceMapIter->second.replyLen; - - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t I2cComIF::openDevice(std::string deviceFile, - address_t i2cAddress, int* fileDescriptor) { - - if (ioctl(*fileDescriptor, I2C_SLAVE, i2cAddress) < 0) { -#if FSFW_VERBOSE_LEVEL >= 1 -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "I2cComIF: Specifying target device failed with error code " << errno << "." - << std::endl; - sif::warning << "Error description " << strerror(errno) << std::endl; -#else - sif::printWarning("I2cComIF: Specifying target device failed with error code %d.\n"); - sif::printWarning("Error description: %s\n", strerror(errno)); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif /* FSFW_VERBOSE_LEVEL >= 1 */ - return HasReturnvaluesIF::RETURN_FAILED; - } - return HasReturnvaluesIF::RETURN_OK; -} diff --git a/linux/i2c/I2cComIF.h b/linux/i2c/I2cComIF.h deleted file mode 100644 index 3529bde7..00000000 --- a/linux/i2c/I2cComIF.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef LINUX_I2C_I2COMIF_H_ -#define LINUX_I2C_I2COMIF_H_ - -#include "I2cCookie.h" -#include -#include - -#include -#include - -/** - * @brief This is the communication interface for i2c devices connected - * to a system running a linux OS. - * - * @author J. Meier - */ -class I2cComIF: public DeviceCommunicationIF, public SystemObject { -public: - I2cComIF(object_id_t objectId); - - virtual ~I2cComIF(); - - ReturnValue_t initializeInterface(CookieIF * cookie) override; - ReturnValue_t sendMessage(CookieIF *cookie,const uint8_t *sendData, - size_t sendLen) override; - ReturnValue_t getSendSuccess(CookieIF *cookie) override; - ReturnValue_t requestReceiveMessage(CookieIF *cookie, - size_t requestLen) override; - ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, - size_t *size) override; - -private: - - typedef struct I2cInstance { - std::vector replyBuffer; - size_t replyLen; - } I2cInstance_t; - - using I2cDeviceMap = std::unordered_map; - using I2cDeviceMapIter = I2cDeviceMap::iterator; - - /* In this map all i2c devices will be registered with their address and - * the appropriate file descriptor will be stored */ - I2cDeviceMap i2cDeviceMap; - I2cDeviceMapIter i2cDeviceMapIter; - - /** - * @brief This function opens an I2C device and binds the opened file - * to a specific I2C address. - * @param deviceFile The name of the device file. E.g. i2c-0 - * @param i2cAddress The address of the i2c slave device. - * @param fileDescriptor Pointer to device descriptor. - * @return RETURN_OK if successful, otherwise RETURN_FAILED. - */ - ReturnValue_t openDevice(std::string deviceFile, - address_t i2cAddress, int* fileDescriptor); -}; - -#endif /* LINUX_I2C_I2COMIF_H_ */ diff --git a/linux/i2c/I2cCookie.cpp b/linux/i2c/I2cCookie.cpp deleted file mode 100644 index fe0f3f92..00000000 --- a/linux/i2c/I2cCookie.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "I2cCookie.h" - -I2cCookie::I2cCookie(address_t i2cAddress_, size_t maxReplyLen_, - std::string deviceFile_) : - i2cAddress(i2cAddress_), maxReplyLen(maxReplyLen_), deviceFile(deviceFile_) { -} - -address_t I2cCookie::getAddress() const { - return i2cAddress; -} - -size_t I2cCookie::getMaxReplyLen() const { - return maxReplyLen; -} - -std::string I2cCookie::getDeviceFile() const { - return deviceFile; -} - -I2cCookie::~I2cCookie() {} diff --git a/linux/i2c/I2cCookie.h b/linux/i2c/I2cCookie.h deleted file mode 100644 index c924eb4e..00000000 --- a/linux/i2c/I2cCookie.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef LINUX_I2C_I2CCOOKIE_H_ -#define LINUX_I2C_I2CCOOKIE_H_ - -#include -#include - -/** - * @brief Cookie for the i2cDeviceComIF. - * - * @author J. Meier - */ -class I2cCookie: public CookieIF { -public: - - /** - * @brief Constructor for the I2C cookie. - * @param i2cAddress_ The i2c address of the target device. - * @param maxReplyLen The maximum expected length of a reply from the - * target device. - */ - I2cCookie(address_t i2cAddress_, size_t maxReplyLen_, - std::string deviceFile_); - - virtual ~I2cCookie(); - - address_t getAddress() const; - size_t getMaxReplyLen() const; - std::string getDeviceFile() const; - -private: - - address_t i2cAddress = 0; - size_t maxReplyLen = 0; - std::string deviceFile; -}; - -#endif /* LINUX_I2C_I2CCOOKIE_H_ */ From 1a4830aea9360eaf59aecabad0c1d04bfc4050b7 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Thu, 1 Apr 2021 11:07:56 +0200 Subject: [PATCH 16/36] deleted folder which was moved --- linux/i2c/CMakeLists.txt | 6 ------ linux/spi/CMakeLists.txt | 0 2 files changed, 6 deletions(-) delete mode 100644 linux/i2c/CMakeLists.txt delete mode 100644 linux/spi/CMakeLists.txt diff --git a/linux/i2c/CMakeLists.txt b/linux/i2c/CMakeLists.txt deleted file mode 100644 index 45a7edcc..00000000 --- a/linux/i2c/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -target_sources(${TARGET_NAME} PUBLIC -) - - - - diff --git a/linux/spi/CMakeLists.txt b/linux/spi/CMakeLists.txt deleted file mode 100644 index e69de29b..00000000 From e86106615af720c683184090a0d9f28ac488257e Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Thu, 1 Apr 2021 13:31:10 +0200 Subject: [PATCH 17/36] updated default Q7S sysroot --- cmake/scripts/Q7S/win_path_helper_xilinx_tools.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/scripts/Q7S/win_path_helper_xilinx_tools.sh b/cmake/scripts/Q7S/win_path_helper_xilinx_tools.sh index c9bcc54a..a8352331 100644 --- a/cmake/scripts/Q7S/win_path_helper_xilinx_tools.sh +++ b/cmake/scripts/Q7S/win_path_helper_xilinx_tools.sh @@ -2,4 +2,4 @@ export PATH=$PATH:"/c/Xilinx/SDK/2018.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/bin" export CROSS_COMPILE="arm-linux-gnueabihf" -export Q7S_SYSROOT="/c/Xilinx/SDK/2018.2/gnu/aarch32/nt/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc" +export Q7S_SYSROOT="/c/Users/${USER}/Documents/EIVE/cortexa9hf-neon-xiphos-linux-gnueabi" From 12be9bf7e408e6ef7014df17d152707f66d13838 Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Thu, 1 Apr 2021 14:06:56 +0200 Subject: [PATCH 18/36] added rpi acs board code to q7s --- bsp_q7s/ObjectFactory.cpp | 40 +++++++++++++++++++++++++++++++++++++++ linux/CMakeLists.txt | 2 -- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index 6b4e94e1..31ed8058 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -106,6 +106,46 @@ void ObjectFactory::produce(){ //pdu1handler->setModeNormal(); //pdu2handler->setModeNormal(); //acuhandler->setModeNormal(); + (void) p60dockhandler; + (void) pdu1handler; + (void) pdu2handler; + (void) acuhandler; + + GpioCookie* gpioCookieAcsBoard = new GpioCookie(); + gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, + "MGM_0_LIS3", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN, + "MGM_1_RM3100", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, + "MGM_2_LIS3", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN, + "MGM_3_RM3100", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN, + "GYRO_0_ADIS", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, + "GYRO_1_L3G", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::GYRO_2_L3G_CS, gpio::GYRO_2_BCM_PIN, + "GYRO_2_L3G", gpio::Direction::OUT, 1); + gpioIF->addGpios(gpioCookieAcsBoard); + + std::string spiDev = "/dev/spidev0.0"; + SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, + MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); + auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, + objects::SPI_COM_IF, spiCookie); + mgmLis3Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, + RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); + auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER, + objects::SPI_COM_IF, spiCookie); + mgmRm3100Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, + spiCookie); + gyroL3gHandler->setStartUpImmediately(); #endif /* Temperature sensors */ Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler( diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 13748f41..dfc3b086 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -1,7 +1,5 @@ # add_subdirectory(gpio) -add_subdirectory(i2c) add_subdirectory(csp) -add_subdirectory(spi) add_subdirectory(utility) add_subdirectory(boardtest) From 0027a433154f6ef524f7db5bd916fff67e6d056f Mon Sep 17 00:00:00 2001 From: Martin Zietz Date: Thu, 1 Apr 2021 15:32:43 +0200 Subject: [PATCH 19/36] polling sequence table entries for acs devices --- bsp_q7s/ObjectFactory.cpp | 2 +- .../pollingSequenceFactory.cpp | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index 31ed8058..aa376dff 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -128,7 +128,7 @@ void ObjectFactory::produce(){ "GYRO_2_L3G", gpio::Direction::OUT, 1); gpioIF->addGpios(gpioCookieAcsBoard); - std::string spiDev = "/dev/spidev0.0"; + std::string spiDev = "/dev/spidev2.0"; SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, diff --git a/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 04b1367b..00471f25 100644 --- a/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -91,6 +91,39 @@ ReturnValue_t pst::gomspacePstInit(FixedTimeslotTaskIF *thisSequence){ thisSequence->addSlot(objects::ACU_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { sif::error << "Initialization of GomSpace PST failed" << std::endl; return HasReturnvaluesIF::RETURN_FAILED; From af48c6528d19cdb6983aba61cd27cceef3ebb207 Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Thu, 1 Apr 2021 15:14:50 +0200 Subject: [PATCH 20/36] compiling --- bsp_q7s/ObjectFactory.cpp | 46 +++++++++++++++++++--------- fsfw_hal | 2 +- linux/archive/gpio/gpioDefinitions.h | 6 ++++ 3 files changed, 38 insertions(+), 16 deletions(-) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index aa376dff..9c61b6ee 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -16,6 +17,10 @@ #include #include #include +#include +#include +#include + #include #include #include @@ -24,6 +29,7 @@ #include #include #include +#include #include #include @@ -78,6 +84,7 @@ void ObjectFactory::produce(){ new CspComIF(objects::CSP_COM_IF); new I2cComIF(objects::I2C_COM_IF); + auto gpioIF = new LinuxLibgpioIF(objects::GPIO_IF); #if TE0720 == 0 CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, addresses::P60DOCK); @@ -112,20 +119,29 @@ void ObjectFactory::produce(){ (void) acuhandler; GpioCookie* gpioCookieAcsBoard = new GpioCookie(); - gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, - "MGM_0_LIS3", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN, - "MGM_1_RM3100", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, - "MGM_2_LIS3", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN, - "MGM_3_RM3100", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN, - "GYRO_0_ADIS", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, - "GYRO_1_L3G", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::GYRO_2_L3G_CS, gpio::GYRO_2_BCM_PIN, - "GYRO_2_L3G", gpio::Direction::OUT, 1); + GpiodRegular gpioGyro1(std::string("gpiochip5"), 21, std::string("CS_GYRO_1_ADIS"), + gpio::OUT, gpio::HIGH); + gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpioGyro1); + GpiodRegular gpioGyro2(std::string("gpiochip5"), 7, std::string("CS_GYRO_2_L3G"), + gpio::OUT, gpio::HIGH); + gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpioGyro2); + GpiodRegular gpioGyro3(std::string("gpiochip5"), 3, std::string("CS_GYRO_3_L3G"), + gpio::OUT, gpio::HIGH); + gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_L3G_CS, gpioGyro3); + + GpiodRegular gpioMgm0(std::string("gpiochip5"), 5, std::string("CS_MGM_0_LIS3_A"), + gpio::OUT, gpio::HIGH); + gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpioMgm0); + GpiodRegular gpioMgm1(std::string("gpiochip5"), 17, std::string("CS_MGM_1_RM3100_A"), + gpio::OUT, gpio::HIGH); + gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpioMgm1); + GpiodRegular gpioMgm2(std::string("gpiochip6"), 0, std::string("CS_MGM_2_LIS3_B"), + gpio::OUT, gpio::HIGH); + gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpioMgm2); + GpiodRegular gpioMgm3(std::string("gpiochip5"), 23, std::string("CS_MGM_3_RM3100_B"), + gpio::OUT, gpio::HIGH); + gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpioMgm3); + gpioIF->addGpios(gpioCookieAcsBoard); std::string spiDev = "/dev/spidev2.0"; @@ -158,7 +174,7 @@ void ObjectFactory::produce(){ tmp1075Handler_2->setStartUpImmediately(); GpioCookie* heaterGpiosCookie = new GpioCookie; - new LinuxLibgpioIF(objects::GPIO_IF); + #if TE0720 == 0 /* Pin H2-11 on stack connector */ GpiodRegular gpioConfigHeater0(std::string("gpiochip7"), 18, diff --git a/fsfw_hal b/fsfw_hal index 7a3190e5..feee39a6 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit 7a3190e5b6980ad2addc5e8a76d21994b542f0e0 +Subproject commit feee39a6c759f699a07dcde4a97d4b5f779ec50b diff --git a/linux/archive/gpio/gpioDefinitions.h b/linux/archive/gpio/gpioDefinitions.h index 3b0f70fd..66c0b005 100644 --- a/linux/archive/gpio/gpioDefinitions.h +++ b/linux/archive/gpio/gpioDefinitions.h @@ -7,6 +7,12 @@ using gpioId_t = uint16_t; namespace gpio { + +enum Levels { + LOW = 0, + HIGH = 1 +}; + enum Direction { IN = 0, OUT = 1 From 29d8c8c0c82ccdc0aeeb5549f7237da35ebd9b29 Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Thu, 1 Apr 2021 15:22:16 +0200 Subject: [PATCH 21/36] one missing zeros --- fsfw | 2 +- fsfwconfig/objects/systemObjectList.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index f2da3123..dea22059 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit f2da31239c43422f7254b8f4a26e663cffd8e3f3 +Subproject commit dea2205908f29cbb700ad85c2614da71b6efccfc diff --git a/fsfwconfig/objects/systemObjectList.h b/fsfwconfig/objects/systemObjectList.h index 459cbd77..43909e45 100644 --- a/fsfwconfig/objects/systemObjectList.h +++ b/fsfwconfig/objects/systemObjectList.h @@ -42,7 +42,7 @@ namespace objects { ACU_HANDLER = 0x44000004, TMP1075_HANDLER_1 = 0x44000005, TMP1075_HANDLER_2 = 0x44000006, - MGM_0_LIS3_HANDLER = 0x4400007, + MGM_0_LIS3_HANDLER = 0x44000007, MGM_1_RM3100_HANDLER = 0x44000008, MGM_2_LIS3_HANDLER = 0x44000009, MGM_3_RM3100_HANDLER = 0x44000010, From e1454db4b93e3fefec2b1f74e3b01836d428d13e Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Thu, 1 Apr 2021 15:42:51 +0200 Subject: [PATCH 22/36] some adaptions --- bsp_q7s/gpio/gpioCallbacks.cpp | 6 +++--- bsp_q7s/gpio/gpioCallbacks.h | 4 ++-- linux/boardtest/SpiTestClass.cpp | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bsp_q7s/gpio/gpioCallbacks.cpp b/bsp_q7s/gpio/gpioCallbacks.cpp index b85de9ab..b9af9b02 100644 --- a/bsp_q7s/gpio/gpioCallbacks.cpp +++ b/bsp_q7s/gpio/gpioCallbacks.cpp @@ -1,7 +1,7 @@ #include #include -#include -#include +#include +#include #include @@ -25,7 +25,7 @@ void initTcsBoardDecoder(GpioIF* gpioComIF) { * Initial values of the spi mux gpios can all be set to an arbitrary value expect for spi mux * bit 1. Setting spi mux bit 1 to high will pull all decoder outputs to high voltage level. */ - GpiodRegular* spiMuxBit1 = new GpiodRegular(std::string("gpiochip7"), 13, + GpiodRegular spiMuxBit1 = new GpiodRegular(std::string("gpiochip7"), 13, std::string("SPI Mux Bit 1"), gpio::OUT, 1); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit1); GpiodRegular* spiMuxBit2 = new GpiodRegular(std::string("gpiochip7"), 14, diff --git a/bsp_q7s/gpio/gpioCallbacks.h b/bsp_q7s/gpio/gpioCallbacks.h index 7654e548..845127fb 100644 --- a/bsp_q7s/gpio/gpioCallbacks.h +++ b/bsp_q7s/gpio/gpioCallbacks.h @@ -1,8 +1,8 @@ #ifndef LINUX_GPIO_GPIOCALLBACKS_H_ #define LINUX_GPIO_GPIOCALLBACKS_H_ -#include -#include +#include +#include namespace gpioCallbacks { diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index b9d1df55..cb5b996c 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -297,27 +297,27 @@ void SpiTestClass::acsInit() { { GpiodRegular gpio(rpiGpioName, mgm0Lis3ChipSelect, "MGM_0_LIS3", gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, &gpio); + gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); } { GpiodRegular gpio(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100", gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, &gpio); + gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); } { GpiodRegular gpio(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS", gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, &gpio); + gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); } { GpiodRegular gpio(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G", gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, &gpio); + gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); } { GpiodRegular gpio(rpiGpioName, gyro2L3gd20ChipSelect, "GYRO_2_L3G", gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::GYRO_2_L3G_CS, &gpio); + gpioCookie->addGpio(gpioIds::GYRO_2_L3G_CS, gpio); } { GpiodRegular gpio(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", From aa606b031ac7aec535893d5bf350fe46ec02cc7c Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Thu, 1 Apr 2021 16:21:24 +0200 Subject: [PATCH 23/36] fixes --- bsp_q7s/ObjectFactory.cpp | 39 +++++++++-------- bsp_q7s/gpio/gpioCallbacks.cpp | 9 ++-- bsp_q7s/gpio/gpioCallbacks.h | 4 +- fsfw_hal | 2 +- .../pollingSequenceFactory.cpp | 42 +++++++++---------- linux/CMakeLists.txt | 2 +- 6 files changed, 51 insertions(+), 47 deletions(-) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index b7222465..ac0c6353 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -33,9 +33,13 @@ #include #include +#include +#include + #include #include #include +#include #include #include @@ -94,8 +98,6 @@ void ObjectFactory::produce(){ new UartComIF(objects::UART_COM_IF); new SpiComIF(objects::SPI_COM_IF, gpioComIF); - auto gpioIF = new LinuxLibgpioIF(objects::GPIO_IF); - /* Temperature sensors */ Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler( objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, @@ -143,30 +145,31 @@ void ObjectFactory::produce(){ (void) acuhandler; GpioCookie* gpioCookieAcsBoard = new GpioCookie(); - GpiodRegular gpioGyro1(std::string("gpiochip5"), 21, std::string("CS_GYRO_1_ADIS"), + GpiodRegular* gpio = nullptr; + gpio = new GpiodRegular(std::string("gpiochip5"), 21, std::string("CS_GYRO_1_ADIS"), gpio::OUT, gpio::HIGH); - gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpioGyro1); - GpiodRegular gpioGyro2(std::string("gpiochip5"), 7, std::string("CS_GYRO_2_L3G"), + gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); + gpio = new GpiodRegular(std::string("gpiochip5"), 7, std::string("CS_GYRO_2_L3G"), gpio::OUT, gpio::HIGH); - gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpioGyro2); - GpiodRegular gpioGyro3(std::string("gpiochip5"), 3, std::string("CS_GYRO_3_L3G"), + gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); + gpio = new GpiodRegular(std::string("gpiochip5"), 3, std::string("CS_GYRO_3_L3G"), gpio::OUT, gpio::HIGH); - gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_L3G_CS, gpioGyro3); + gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_L3G_CS, gpio); - GpiodRegular gpioMgm0(std::string("gpiochip5"), 5, std::string("CS_MGM_0_LIS3_A"), + gpio = new GpiodRegular(std::string("gpiochip5"), 5, std::string("CS_MGM_0_LIS3_A"), gpio::OUT, gpio::HIGH); - gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpioMgm0); - GpiodRegular gpioMgm1(std::string("gpiochip5"), 17, std::string("CS_MGM_1_RM3100_A"), + gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); + gpio = new GpiodRegular(std::string("gpiochip5"), 17, std::string("CS_MGM_1_RM3100_A"), gpio::OUT, gpio::HIGH); - gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpioMgm1); - GpiodRegular gpioMgm2(std::string("gpiochip6"), 0, std::string("CS_MGM_2_LIS3_B"), + gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); + gpio = new GpiodRegular(std::string("gpiochip6"), 0, std::string("CS_MGM_2_LIS3_B"), gpio::OUT, gpio::HIGH); - gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpioMgm2); - GpiodRegular gpioMgm3(std::string("gpiochip5"), 23, std::string("CS_MGM_3_RM3100_B"), + gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); + gpio = new GpiodRegular(std::string("gpiochip5"), 23, std::string("CS_MGM_3_RM3100_B"), gpio::OUT, gpio::HIGH); - gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpioMgm3); + gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); - gpioIF->addGpios(gpioCookieAcsBoard); + gpioComIF->addGpios(gpioCookieAcsBoard); std::string spiDev = "/dev/spidev2.0"; SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, @@ -366,7 +369,7 @@ void ObjectFactory::produce(){ Max31865PT1000Handler* rtdIc16 = new Max31865PT1000Handler(objects::RTD_IC16, objects::SPI_COM_IF, spiRtdIc16, 0); Max31865PT1000Handler* rtdIc17 = new Max31865PT1000Handler(objects::RTD_IC17, objects::SPI_COM_IF, spiRtdIc17, 0); Max31865PT1000Handler* rtdIc18 = new Max31865PT1000Handler(objects::RTD_IC18, objects::SPI_COM_IF, spiRtdIc18, 0); - rtdIc10->setStartUpImmediately(); +// rtdIc10->setStartUpImmediately(); // rtdIc4->setStartUpImmediately(); #endif diff --git a/bsp_q7s/gpio/gpioCallbacks.cpp b/bsp_q7s/gpio/gpioCallbacks.cpp index b85de9ab..086e6469 100644 --- a/bsp_q7s/gpio/gpioCallbacks.cpp +++ b/bsp_q7s/gpio/gpioCallbacks.cpp @@ -1,7 +1,8 @@ -#include -#include -#include -#include +#include "gpioCallbacks.h" +#include + +#include +#include #include diff --git a/bsp_q7s/gpio/gpioCallbacks.h b/bsp_q7s/gpio/gpioCallbacks.h index 7654e548..845127fb 100644 --- a/bsp_q7s/gpio/gpioCallbacks.h +++ b/bsp_q7s/gpio/gpioCallbacks.h @@ -1,8 +1,8 @@ #ifndef LINUX_GPIO_GPIOCALLBACKS_H_ #define LINUX_GPIO_GPIOCALLBACKS_H_ -#include -#include +#include +#include namespace gpioCallbacks { diff --git a/fsfw_hal b/fsfw_hal index 7ffae254..c62cdbeb 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit 7ffae254b1c2658c2b87566a7bb6856236c6e7e8 +Subproject commit c62cdbebcb521975043f1782692667faaf5a8aca diff --git a/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 5f1c8359..ce0b7490 100644 --- a/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -182,27 +182,27 @@ ReturnValue_t pst::gomspacePstInit(FixedTimeslotTaskIF *thisSequence){ thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); +// +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { sif::error << "Initialization of GomSpace PST failed" << std::endl; diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index d6824b0e..7e6d1f35 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -1,4 +1,4 @@ add_subdirectory(csp) +add_subdirectory(uart) add_subdirectory(utility) add_subdirectory(boardtest) - From e79a8e092660d5ccb57b96921d5140bf65ce9e60 Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Thu, 1 Apr 2021 16:33:30 +0200 Subject: [PATCH 24/36] now its compiling --- bsp_q7s/gpio/gpioCallbacks.cpp | 2 +- fsfw_hal | 2 +- fsfwconfig/OBSWConfig.h | 2 -- linux/boardtest/SpiTestClass.cpp | 19 ++++++++++--------- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/bsp_q7s/gpio/gpioCallbacks.cpp b/bsp_q7s/gpio/gpioCallbacks.cpp index 5d7a639e..086e6469 100644 --- a/bsp_q7s/gpio/gpioCallbacks.cpp +++ b/bsp_q7s/gpio/gpioCallbacks.cpp @@ -26,7 +26,7 @@ void initTcsBoardDecoder(GpioIF* gpioComIF) { * Initial values of the spi mux gpios can all be set to an arbitrary value expect for spi mux * bit 1. Setting spi mux bit 1 to high will pull all decoder outputs to high voltage level. */ - GpiodRegular spiMuxBit1 = new GpiodRegular(std::string("gpiochip7"), 13, + GpiodRegular* spiMuxBit1 = new GpiodRegular(std::string("gpiochip7"), 13, std::string("SPI Mux Bit 1"), gpio::OUT, 1); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit1); GpiodRegular* spiMuxBit2 = new GpiodRegular(std::string("gpiochip7"), 14, diff --git a/fsfw_hal b/fsfw_hal index c62cdbeb..2fb50360 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit c62cdbebcb521975043f1782692667faaf5a8aca +Subproject commit 2fb50360ef8910ed785d31cc4da098a77c26fd81 diff --git a/fsfwconfig/OBSWConfig.h b/fsfwconfig/OBSWConfig.h index 05ad0fe9..81e61653 100644 --- a/fsfwconfig/OBSWConfig.h +++ b/fsfwconfig/OBSWConfig.h @@ -31,8 +31,6 @@ debugging. */ /* Can be used to switch device to NORMAL mode immediately */ #define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1 -/* Can be used for low-level debugging of the SPI bus */ -#define FSFW_LINUX_SPI_WIRETAPPING 0 #ifdef __cplusplus diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index cb5b996c..ec6cc65c 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -294,40 +294,41 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { void SpiTestClass::acsInit() { GpioCookie* gpioCookie = new GpioCookie(); std::string rpiGpioName = "gpiochip0"; + GpiodRegular* gpio = nullptr; { - GpiodRegular gpio(rpiGpioName, mgm0Lis3ChipSelect, "MGM_0_LIS3", + gpio = new GpiodRegular(rpiGpioName, mgm0Lis3ChipSelect, "MGM_0_LIS3", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); } { - GpiodRegular gpio(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100", + gpio = new GpiodRegular(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); } { - GpiodRegular gpio(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS", + gpio = new GpiodRegular(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); } { - GpiodRegular gpio(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G", + gpio = new GpiodRegular(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); } { - GpiodRegular gpio(rpiGpioName, gyro2L3gd20ChipSelect, "GYRO_2_L3G", + gpio = new GpiodRegular(rpiGpioName, gyro2L3gd20ChipSelect, "GYRO_2_L3G", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::GYRO_2_L3G_CS, gpio); } { - GpiodRegular gpio(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", + gpio = new GpiodRegular(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, &gpio); + gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); } { - GpiodRegular gpio(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", + gpio = new GpiodRegular(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, &gpio); + gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); } if(gpioIF != nullptr) { gpioIF->addGpios(gpioCookie); From 62834bebccc6bf1984d050e3c7949cdd478b652c Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Thu, 1 Apr 2021 17:06:35 +0200 Subject: [PATCH 25/36] small form improvements --- bsp_q7s/ObjectFactory.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index ac0c6353..bbaa5e7c 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -159,12 +159,15 @@ void ObjectFactory::produce(){ gpio = new GpiodRegular(std::string("gpiochip5"), 5, std::string("CS_MGM_0_LIS3_A"), gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); + gpio = new GpiodRegular(std::string("gpiochip5"), 17, std::string("CS_MGM_1_RM3100_A"), gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); + gpio = new GpiodRegular(std::string("gpiochip6"), 0, std::string("CS_MGM_2_LIS3_B"), gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); + gpio = new GpiodRegular(std::string("gpiochip5"), 23, std::string("CS_MGM_3_RM3100_B"), gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); @@ -371,7 +374,7 @@ void ObjectFactory::produce(){ Max31865PT1000Handler* rtdIc18 = new Max31865PT1000Handler(objects::RTD_IC18, objects::SPI_COM_IF, spiRtdIc18, 0); // rtdIc10->setStartUpImmediately(); // rtdIc4->setStartUpImmediately(); -#endif +#endif /* TE0720 == 0 */ new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR, From ffa11ce2532ad7a021eb42a19dd5c3b1582fc0f8 Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Thu, 1 Apr 2021 17:19:12 +0200 Subject: [PATCH 26/36] pushed stuff --- bsp_q7s/ObjectFactory.cpp | 2 + fsfwconfig/OBSWConfig.h | 13 +++-- .../pollingSequenceFactory.cpp | 57 ++++++++++++------- 3 files changed, 45 insertions(+), 27 deletions(-) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index bbaa5e7c..ab32ec9a 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -144,6 +144,7 @@ void ObjectFactory::produce(){ (void) pdu2handler; (void) acuhandler; +#if OBSW_ADD_ACS_BOARD == 1 GpioCookie* gpioCookieAcsBoard = new GpioCookie(); GpiodRegular* gpio = nullptr; gpio = new GpiodRegular(std::string("gpiochip5"), 21, std::string("CS_GYRO_1_ADIS"), @@ -192,6 +193,7 @@ void ObjectFactory::produce(){ auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, spiCookie); gyroL3gHandler->setStartUpImmediately(); +#endif /* Pin H2-11 on stack connector */ GpiodRegular* gpioConfigHeater0 = new GpiodRegular(std::string("gpiochip7"), 6, diff --git a/fsfwconfig/OBSWConfig.h b/fsfwconfig/OBSWConfig.h index 81e61653..a41757e1 100644 --- a/fsfwconfig/OBSWConfig.h +++ b/fsfwconfig/OBSWConfig.h @@ -20,12 +20,15 @@ debugging. */ #define TEST_LIBGPIOD 0 #define TE0720 0 +/* Add code for ACS board */ +#define OBSW_ADD_ACS_BOARD 1 + +#define P60DOCK_DEBUG 0 +#define PDU1_DEBUG 0 +#define PDU2_DEBUG 0 +#define ACU_DEBUG 0 +#define SYRLINKS_DEBUG 0 -#define P60DOCK_DEBUG 0 -#define PDU1_DEBUG 0 -#define PDU2_DEBUG 0 -#define ACU_DEBUG 0 -#define SYRLINKS_DEBUG 0 #include "OBSWVersion.h" diff --git a/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index ce0b7490..ef11f41e 100644 --- a/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -1,5 +1,5 @@ #include "pollingSequenceFactory.h" - +#include #include #include #include @@ -171,6 +171,7 @@ ReturnValue_t pst::gomspacePstInit(FixedTimeslotTaskIF *thisSequence){ thisSequence->addSlot(objects::ACU_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); +#if OBSW_ADD_ACS_BOARD == 1 thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, @@ -182,27 +183,39 @@ ReturnValue_t pst::gomspacePstInit(FixedTimeslotTaskIF *thisSequence){ thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); -// -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); + + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); +#endif if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { sif::error << "Initialization of GomSpace PST failed" << std::endl; From 2dbe893197e9aeb0be0d40e290b86c4f29527cf7 Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Fri, 2 Apr 2021 13:25:37 +0200 Subject: [PATCH 27/36] added device handler --- bsp_q7s/ObjectFactory.cpp | 6 ++ .../pollingSequenceFactory.cpp | 62 +++++++++---------- 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index ab32ec9a..47cc1934 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -182,6 +182,12 @@ void ObjectFactory::produce(){ objects::SPI_COM_IF, spiCookie); mgmLis3Handler->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, + MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); + auto mgmLis3Handler2 = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, + objects::SPI_COM_IF, spiCookie); + mgmLis3Handler2->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER, diff --git a/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index ef11f41e..63a21081 100644 --- a/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -172,27 +172,27 @@ ReturnValue_t pst::gomspacePstInit(FixedTimeslotTaskIF *thisSequence){ length * 0.8, DeviceHandlerIF::GET_READ); #if OBSW_ADD_ACS_BOARD == 1 - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); +// +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -205,16 +205,16 @@ ReturnValue_t pst::gomspacePstInit(FixedTimeslotTaskIF *thisSequence){ thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); #endif if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { From 437f4573b58f5135acbe85a4f9867e91195fcb92 Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Fri, 2 Apr 2021 15:14:08 +0200 Subject: [PATCH 28/36] added more spi test code, preprocessor defines and various bugfixes --- bsp_q7s/InitMission.cpp | 18 +++- bsp_q7s/ObjectFactory.cpp | 12 ++- bsp_q7s/boardconfig/q7s_config.h | 11 +++ fsfw_hal | 2 +- fsfwconfig/OBSWConfig.h | 4 +- fsfwconfig/objects/systemObjectList.h | 2 +- linux/boardtest/SpiTestClass.cpp | 129 ++++++++++++++++---------- linux/boardtest/SpiTestClass.h | 11 +++ mission/devices/MGMHandlerLIS3MDL.cpp | 4 +- 9 files changed, 136 insertions(+), 57 deletions(-) create mode 100644 bsp_q7s/boardconfig/q7s_config.h diff --git a/bsp_q7s/InitMission.cpp b/bsp_q7s/InitMission.cpp index c776ead0..3fe0ba0c 100644 --- a/bsp_q7s/InitMission.cpp +++ b/bsp_q7s/InitMission.cpp @@ -137,6 +137,7 @@ void initmission::initTasks() { //TODO: Add handling of missed deadlines /* Polling Sequence Table Default */ +#if Q7S_ADD_SPI_TEST == 0 FixedTimeslotTaskIF * pollingSequenceTableTaskDefault = factory->createFixedTimeslotTask( "PST_TASK_DEFAULT", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc); @@ -144,6 +145,7 @@ void initmission::initTasks() { if (result != HasReturnvaluesIF::RETURN_OK) { sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; } +#endif #if TE0720 == 0 FixedTimeslotTaskIF* gomSpacePstTask = factory-> @@ -155,13 +157,20 @@ void initmission::initTasks() { } #endif - PeriodicTaskIF* testTask = factory->createPeriodicTask( - "GPIOD_TEST", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc); #if OBSW_ADD_TEST_CODE == 1 + PeriodicTaskIF* testTask = factory->createPeriodicTask( + "TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc); result = testTask->addComponent(objects::TEST_TASK); if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK); } + +#if Q7S_ADD_SPI_TEST == 1 + result = testTask->addComponent(objects::SPI_TEST); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST); + } +#endif #endif /* OBSW_ADD_TEST_CODE == 1 */ #if TE0720 == 1 && TEST_LIBGPIOD == 1 result = testTask->addComponent(objects::LIBGPIOD_TEST); @@ -178,7 +187,10 @@ void initmission::initTasks() { #if TE0720 == 0 gomSpacePstTask->startTask(); #endif + +#if Q7S_ADD_SPI_TEST == 0 pollingSequenceTableTaskDefault->startTask(); +#endif pusVerification->startTask(); pusEvents->startTask(); @@ -186,6 +198,8 @@ void initmission::initTasks() { pusMedPrio->startTask(); pusLowPrio->startTask(); +#if OBSW_ADD_TEST_CODE == 1 testTask->startTask(); +#endif sif::info << "Tasks started.." << std::endl; } diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index 47cc1934..fed5734c 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -51,6 +51,7 @@ /* UDP server includes */ #include #include +#include #if TEST_LIBGPIOD == 1 #include @@ -96,7 +97,9 @@ void ObjectFactory::produce(){ new CspComIF(objects::CSP_COM_IF); new I2cComIF(objects::I2C_COM_IF); new UartComIF(objects::UART_COM_IF); +#if Q7S_ADD_SPI_TEST == 0 new SpiComIF(objects::SPI_COM_IF, gpioComIF); +#endif /* Temperature sensors */ Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler( @@ -184,7 +187,7 @@ void ObjectFactory::produce(){ spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); - auto mgmLis3Handler2 = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, + auto mgmLis3Handler2 = new MGMHandlerLIS3MDL(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie); mgmLis3Handler2->setStartUpImmediately(); @@ -261,6 +264,7 @@ void ObjectFactory::produce(){ objects::UART_COM_IF, syrlinksUartCookie); syrlinksHkHandler->setModeNormal(); +#if Q7S_ADD_SPI_TEST == 0 GpioCookie* rtdGpioCookie = new GpioCookie; gpioCallbacks::initTcsBoardDecoder(gpioComIF); @@ -382,6 +386,8 @@ void ObjectFactory::produce(){ Max31865PT1000Handler* rtdIc18 = new Max31865PT1000Handler(objects::RTD_IC18, objects::SPI_COM_IF, spiRtdIc18, 0); // rtdIc10->setStartUpImmediately(); // rtdIc4->setStartUpImmediately(); +#endif /* Q7S_ADD_SPI_TEST == 0 */ + #endif /* TE0720 == 0 */ new UdpTmTcBridge(objects::UDP_BRIDGE, @@ -404,4 +410,8 @@ void ObjectFactory::produce(){ new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie, objects::PCDU_HANDLER, pcduSwitches::TCS_BOARD_8V_HEATER_IN); #endif + +#if Q7S_ADD_SPI_TEST == 1 + new SpiTestClass(objects::SPI_TEST, gpioComIF); +#endif } diff --git a/bsp_q7s/boardconfig/q7s_config.h b/bsp_q7s/boardconfig/q7s_config.h new file mode 100644 index 00000000..d4b821c1 --- /dev/null +++ b/bsp_q7s/boardconfig/q7s_config.h @@ -0,0 +1,11 @@ +#ifndef BSP_Q7S_BOARDCONFIG_Q7S_CONFIG_H_ +#define BSP_Q7S_BOARDCONFIG_Q7S_CONFIG_H_ + +/* Only one of those 2 should be enabled! */ +/* Add code for ACS board */ +#define OBSW_ADD_ACS_BOARD 0 +#define Q7S_ADD_SPI_TEST 1 + + + +#endif /* BSP_Q7S_BOARDCONFIG_Q7S_CONFIG_H_ */ diff --git a/fsfw_hal b/fsfw_hal index 2fb50360..94fcbd58 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit 2fb50360ef8910ed785d31cc4da098a77c26fd81 +Subproject commit 94fcbd587ea9eac76fbe6cbd85e1559c42235ce9 diff --git a/fsfwconfig/OBSWConfig.h b/fsfwconfig/OBSWConfig.h index a41757e1..b650597a 100644 --- a/fsfwconfig/OBSWConfig.h +++ b/fsfwconfig/OBSWConfig.h @@ -8,6 +8,8 @@ #ifdef RASPBERRY_PI #include +#elif defined(XIPHOS_Q7S) +#include #endif #include "commonConfig.h" #include "OBSWVersion.h" @@ -20,8 +22,6 @@ debugging. */ #define TEST_LIBGPIOD 0 #define TE0720 0 -/* Add code for ACS board */ -#define OBSW_ADD_ACS_BOARD 1 #define P60DOCK_DEBUG 0 #define PDU1_DEBUG 0 diff --git a/fsfwconfig/objects/systemObjectList.h b/fsfwconfig/objects/systemObjectList.h index 2d1fd82a..44d58a79 100644 --- a/fsfwconfig/objects/systemObjectList.h +++ b/fsfwconfig/objects/systemObjectList.h @@ -54,7 +54,7 @@ namespace objects { /* Custom device handler */ PCDU_HANDLER = 0x44001000, SOLAR_ARRAY_DEPL_HANDLER = 0x44001001, - SYRLINKS_HK_HANDLER = 0x44000009, + SYRLINKS_HK_HANDLER = 0x44001002, /* 0x54 ('T') for thermal objects */ HEATER_HANDLER = 0x54000003, diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index ec6cc65c..b46cef4b 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -21,11 +21,11 @@ SpiTestClass::SpiTestClass(object_id_t objectId, GpioIF* gpioIF): TestTask(objectId), - gpioIF(gpioIF) { +gpioIF(gpioIF) { if(gpioIF == nullptr) { sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl; } - testMode = TestModes::GYRO_L3GD20H; + testMode = TestModes::MGM_LIS3MDL; spiTransferStruct.rx_buf = reinterpret_cast<__u64>(recvBuffer.data()); spiTransferStruct.tx_buf = reinterpret_cast<__u64>(sendBuffer.data()); } @@ -36,11 +36,11 @@ ReturnValue_t SpiTestClass::performOneShotAction() { break; } case(TestModes::MGM_LIS3MDL): { - performLis3MdlTest(mgm0Lis3ChipSelect); + performLis3MdlTest(mgm2Lis3mdlChipSelect); break; } case(TestModes::MGM_RM3100): { - performRm3100Test(mgm1Rm3100ChipSelect); + performRm3100Test(mgm3Rm3100ChipSelect); break; } case(TestModes::GYRO_L3GD20H): { @@ -78,7 +78,7 @@ void SpiTestClass::performRm3100Test(uint8_t mgmId) { #ifdef RASPBERRY_PI std::string deviceName = "/dev/spidev0.0"; #else - std::string deviceName = "placeholder"; + std::string deviceName = "/dev/spidev2.0"; #endif int fileDescriptor = 0; @@ -160,13 +160,14 @@ void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) { acsInit(); /* Adapt accordingly */ - if(lis3Id != mgm0Lis3ChipSelect and lis3Id != mgm2Lis3mdlChipSelect) { + if(lis3Id != mgm0Lis3mdlChipSelect and lis3Id != mgm2Lis3mdlChipSelect) { sif::warning << "SpiTestClass::performLis3MdlTest: Invalid MGM ID!" << std::endl; } gpioId_t currentGpioId = 0; uint8_t chipSelectPin = lis3Id; uint8_t whoAmIReg = 0b0000'1111; - if(chipSelectPin == mgm0Lis3ChipSelect) { + uint8_t whoAmIRegExpectedVal = 0b0011'1101; + if(chipSelectPin == mgm0Lis3mdlChipSelect) { currentGpioId = gpioIds::MGM_0_LIS3_CS; } else { @@ -177,7 +178,7 @@ void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) { #ifdef RASPBERRY_PI std::string deviceName = "/dev/spidev0.0"; #else - std::string deviceName = "placeholder"; + std::string deviceName = "/dev/spidev2.0"; #endif int fileDescriptor = 0; @@ -189,10 +190,15 @@ void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) { return; } setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); + spiTransferStruct.delay_usecs = 0; uint8_t whoAmIRegVal = readStmRegister(fileDescriptor, currentGpioId, whoAmIReg, false); sif::info << "SpiTestClass::performLis3MdlTest: WHO AM I register 0b" << std::bitset<8>(whoAmIRegVal) << std::endl; + if(whoAmIRegVal != whoAmIRegExpectedVal) { + sif::warning << "SpiTestClass::performLis3MdlTest: WHO AM I register invalid!" + << std::endl; + } } @@ -223,7 +229,7 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { #ifdef RASPBERRY_PI std::string deviceName = "/dev/spidev0.0"; #else - std::string deviceName = "placeholder"; + std::string deviceName = "/dev/spidev2.0"; #endif int fileDescriptor = 0; @@ -293,46 +299,73 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { void SpiTestClass::acsInit() { GpioCookie* gpioCookie = new GpioCookie(); - std::string rpiGpioName = "gpiochip0"; GpiodRegular* gpio = nullptr; - { - gpio = new GpiodRegular(rpiGpioName, mgm0Lis3ChipSelect, "MGM_0_LIS3", - gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - } - { - gpio = new GpiodRegular(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100", - gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - } - { - gpio = new GpiodRegular(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS", - gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - } - { - gpio = new GpiodRegular(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G", - gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - } - { - gpio = new GpiodRegular(rpiGpioName, gyro2L3gd20ChipSelect, "GYRO_2_L3G", - gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::GYRO_2_L3G_CS, gpio); - } - { - gpio = new GpiodRegular(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", - gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - } - { - gpio = new GpiodRegular(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", - gpio::Direction::OUT, 1); - gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); - } - if(gpioIF != nullptr) { - gpioIF->addGpios(gpioCookie); - } +#ifdef RASPBERRY_PI + std::string rpiGpioName = "gpiochip0"; + gpio = new GpiodRegular(rpiGpioName, mgm0Lis3mdlChipSelect, "MGM_0_LIS3", + gpio::Direction::OUT, 1); + gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); + + gpio = new GpiodRegular(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100", + gpio::Direction::OUT, 1); + gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); + + gpio = new GpiodRegular(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS", + gpio::Direction::OUT, 1); + gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); + + gpio = new GpiodRegular(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G", + gpio::Direction::OUT, 1); + gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); + + gpio = new GpiodRegular(rpiGpioName, gyro2L3gd20ChipSelect, "GYRO_2_L3G", + gpio::Direction::OUT, 1); + gpioCookie->addGpio(gpioIds::GYRO_2_L3G_CS, gpio); + + gpio = new GpiodRegular(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", + gpio::Direction::OUT, 1); + gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); + + gpio = new GpiodRegular(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", + gpio::Direction::OUT, 1); + gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); +} +#elif defined(XIPHOS_Q7S) + std::string q7sGpioName5 = "gpiochip5"; + std::string q7sGpioName6 = "gpiochip6"; + + gpio = new GpiodRegular(q7sGpioName5, mgm0Lis3mdlChipSelect, "MGM_0_LIS3", + gpio::Direction::OUT, gpio::HIGH); + gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); + + gpio = new GpiodRegular(q7sGpioName5, mgm1Rm3100ChipSelect, "MGM_1_RM3100", + gpio::Direction::OUT, gpio::HIGH); + gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); + + gpio = new GpiodRegular(q7sGpioName5, gyro0AdisChipSelect, "GYRO_0_ADIS", + gpio::Direction::OUT, gpio::HIGH); + gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); + + gpio = new GpiodRegular(q7sGpioName5, gyro1L3gd20ChipSelect, "GYRO_1_L3G", + gpio::Direction::OUT, gpio::HIGH); + gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); + + gpio = new GpiodRegular(q7sGpioName5, gyro2L3gd20ChipSelect, "GYRO_2_L3G", + gpio::Direction::OUT, gpio::HIGH); + gpioCookie->addGpio(gpioIds::GYRO_2_L3G_CS, gpio); + + gpio = new GpiodRegular(q7sGpioName6, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", + gpio::Direction::OUT, gpio::HIGH); + gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); + + gpio = new GpiodRegular(q7sGpioName5, mgm3Rm3100ChipSelect, "MGM_3_RM3100", + gpio::Direction::OUT, gpio::HIGH); + gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); +#endif +if(gpioIF != nullptr) { + gpioIF->addGpios(gpioCookie); +} + } void SpiTestClass::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed) { diff --git a/linux/boardtest/SpiTestClass.h b/linux/boardtest/SpiTestClass.h index f92799b5..c24a5156 100644 --- a/linux/boardtest/SpiTestClass.h +++ b/linux/boardtest/SpiTestClass.h @@ -38,6 +38,7 @@ private: void acsInit(); /* ACS board specific variables */ +#ifdef RASPBERRY_PI uint8_t mgm0Lis3ChipSelect = 0; uint8_t mgm1Rm3100ChipSelect = 1; uint8_t gyro0AdisChipSelect = 5; @@ -45,6 +46,16 @@ private: uint8_t gyro2L3gd20ChipSelect = 4; uint8_t mgm2Lis3mdlChipSelect = 17; uint8_t mgm3Rm3100ChipSelect = 27; +#elif defined(XIPHOS_Q7S) + uint8_t mgm0Lis3mdlChipSelect = 5; + uint8_t mgm1Rm3100ChipSelect = 17; + uint8_t gyro0AdisResetLin = 20; + uint8_t gyro0AdisChipSelect = 21; + uint8_t gyro1L3gd20ChipSelect = 7; + uint8_t gyro2L3gd20ChipSelect = 3; + uint8_t mgm2Lis3mdlChipSelect = 0; + uint8_t mgm3Rm3100ChipSelect = 23; +#endif static constexpr uint8_t STM_READ_MASK = 0b1000'0000; static constexpr uint8_t RM3100_READ_MASK = STM_READ_MASK; diff --git a/mission/devices/MGMHandlerLIS3MDL.cpp b/mission/devices/MGMHandlerLIS3MDL.cpp index 17854de7..15f6e325 100644 --- a/mission/devices/MGMHandlerLIS3MDL.cpp +++ b/mission/devices/MGMHandlerLIS3MDL.cpp @@ -33,8 +33,8 @@ void MGMHandlerLIS3MDL::doStartUp() { /* Will be set by checking device ID (WHO AM I register) */ if(commandExecuted) { commandExecuted = false; + internalState = InternalState::STATE_SETUP; } - internalState = InternalState::STATE_SETUP; break; } case(InternalState::STATE_SETUP): { @@ -463,7 +463,7 @@ void MGMHandlerLIS3MDL::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { } uint32_t MGMHandlerLIS3MDL::getTransitionDelayMs(Mode_t from, Mode_t to) { - return 10000; + return 20000; } void MGMHandlerLIS3MDL::modeChanged(void) { From 1647b8a98efe3a8580fced0910fdbb0e3a59bf25 Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Fri, 2 Apr 2021 15:16:41 +0200 Subject: [PATCH 29/36] hal update --- fsfw_hal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw_hal b/fsfw_hal index 94fcbd58..c47d3996 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit 94fcbd587ea9eac76fbe6cbd85e1559c42235ce9 +Subproject commit c47d39964fcdc08f6ab93a5e6b6e3b63d4a21abb From 14b69ed7e9984ae33d15e559fe87a3f9cba57121 Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Fri, 2 Apr 2021 15:26:57 +0200 Subject: [PATCH 30/36] minor formatting stuff --- linux/boardtest/SpiTestClass.cpp | 4 ++-- linux/boardtest/SpiTestClass.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index b46cef4b..8ad03b7d 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -25,7 +25,7 @@ gpioIF(gpioIF) { if(gpioIF == nullptr) { sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl; } - testMode = TestModes::MGM_LIS3MDL; + testMode = TestModes::GYRO_L3GD20H; spiTransferStruct.rx_buf = reinterpret_cast<__u64>(recvBuffer.data()); spiTransferStruct.tx_buf = reinterpret_cast<__u64>(sendBuffer.data()); } @@ -266,7 +266,7 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { for(uint8_t idx = 0; idx < sizeof(readRegs); idx++) { if(readRegs[idx] != commandRegs[0]) { sif::warning << "SpiTestClass::performL3gTest: Read control register" << - static_cast(idx + 1) << "not equal to configured value" << std::endl; + static_cast(idx + 1) << " not equal to configured value" << std::endl; } } } diff --git a/linux/boardtest/SpiTestClass.h b/linux/boardtest/SpiTestClass.h index c24a5156..9c6305f6 100644 --- a/linux/boardtest/SpiTestClass.h +++ b/linux/boardtest/SpiTestClass.h @@ -49,9 +49,9 @@ private: #elif defined(XIPHOS_Q7S) uint8_t mgm0Lis3mdlChipSelect = 5; uint8_t mgm1Rm3100ChipSelect = 17; - uint8_t gyro0AdisResetLin = 20; + uint8_t gyro0AdisResetLine = 20; uint8_t gyro0AdisChipSelect = 21; - uint8_t gyro1L3gd20ChipSelect = 7; + uint8_t gyro1L3gd20ChipSelect = 10; uint8_t gyro2L3gd20ChipSelect = 3; uint8_t mgm2Lis3mdlChipSelect = 0; uint8_t mgm3Rm3100ChipSelect = 23; From 5fbaca9b9f64802f80f8770e87456d612cab090f Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Fri, 2 Apr 2021 16:44:25 +0200 Subject: [PATCH 31/36] non block almostr eworking --- linux/boardtest/SpiTestClass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 8ad03b7d..dc7ca931 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -265,7 +265,7 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { sizeof(readRegs)); for(uint8_t idx = 0; idx < sizeof(readRegs); idx++) { if(readRegs[idx] != commandRegs[0]) { - sif::warning << "SpiTestClass::performL3gTest: Read control register" << + sif::warning << "SpiTestClass::performL3gTest: Read control register " << static_cast(idx + 1) << " not equal to configured value" << std::endl; } } From c4a6a680c8f6690d665d674498d87b325ca8f12e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 10 Apr 2021 21:59:19 +0200 Subject: [PATCH 32/36] fsfw and fsfw_hal update --- fsfw | 2 +- fsfw_hal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index dea22059..720ce596 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit dea2205908f29cbb700ad85c2614da71b6efccfc +Subproject commit 720ce596807e0e60629725bc2730ab0fcf3dca01 diff --git a/fsfw_hal b/fsfw_hal index c47d3996..a12f0363 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit c47d39964fcdc08f6ab93a5e6b6e3b63d4a21abb +Subproject commit a12f036339ab2f6716fae4ba95e3205f0b827271 From 3046b62ddbcd4852d0dc867e48672a0c40cd6b3e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 10 Apr 2021 22:22:39 +0200 Subject: [PATCH 33/36] resolved merge conflicts --- bsp_rpi/InitMission.cpp | 58 +------------------------------- fsfw_hal | 2 +- linux/boardtest/SpiTestClass.cpp | 8 ++--- linux/boardtest/SpiTestClass.h | 2 +- 4 files changed, 6 insertions(+), 64 deletions(-) diff --git a/bsp_rpi/InitMission.cpp b/bsp_rpi/InitMission.cpp index 091f6bbd..40c38e6c 100644 --- a/bsp_rpi/InitMission.cpp +++ b/bsp_rpi/InitMission.cpp @@ -3,13 +3,9 @@ #include #include -<<<<<<< HEAD -#include +#include -======= ->>>>>>> develop #include - #include #include #include @@ -17,10 +13,6 @@ #include #include #include -<<<<<<< HEAD -======= -#include ->>>>>>> develop #include @@ -124,8 +116,6 @@ void initmission::initTasks() { result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS); if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS); -<<<<<<< HEAD -======= } PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask( @@ -135,24 +125,6 @@ void initmission::initTasks() { initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST); } -#if RPI_TEST_ACS_BOARD == 1 - FixedTimeslotTaskIF* acsTask = factory->createFixedTimeslotTask( - "ACS_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 1.0, missedDeadlineFunc); - result = pst::pollingSequenceAcsTest(acsTask); - if(result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "initmission::initTasks: ACS PST initialization failed!" << std::endl; ->>>>>>> develop - } -#endif /* RPI_TEST_ACS_BOARD == 1 */ - -<<<<<<< HEAD - PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask( - "PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc); - result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST); - } - #if RPI_TEST_ACS_BOARD == 1 FixedTimeslotTaskIF* acsTask = factory->createFixedTimeslotTask( "ACS_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); @@ -188,34 +160,6 @@ void initmission::initTasks() { udpBridgeTask->startTask(); udpPollingTask->startTask(); -======= - PeriodicTaskIF* testTask = factory->createPeriodicTask( - "TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); -#if OBSW_ADD_TEST_CODE == 1 - result = testTask->addComponent(objects::TEST_TASK); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK); - } -#endif /* OBSW_ADD_TEST_CODE == 1 */ -#if RPI_ADD_SPI_TEST == 1 - result = testTask->addComponent(objects::SPI_TEST); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST); - } -#endif /* RPI_ADD_SPI_TEST == 1 */ -#if RPI_ADD_GPIO_TEST == 1 - result = testTask->addComponent(objects::LIBGPIOD_TEST); - if(result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST); - } -#endif /* RPI_ADD_GPIO_TEST == 1 */ - - sif::info << "Starting tasks.." << std::endl; - tmTcDistributor->startTask(); - udpBridgeTask->startTask(); - udpPollingTask->startTask(); - ->>>>>>> develop pusVerification->startTask(); pusEvents->startTask(); pusHighPrio->startTask(); diff --git a/fsfw_hal b/fsfw_hal index a12f0363..14fe3257 160000 --- a/fsfw_hal +++ b/fsfw_hal @@ -1 +1 @@ -Subproject commit a12f036339ab2f6716fae4ba95e3205f0b827271 +Subproject commit 14fe32572d62db9d19707dc1f9bb6fecb1993b73 diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index dc7ca931..387c7eb5 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -329,7 +329,6 @@ void SpiTestClass::acsInit() { gpio = new GpiodRegular(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); -} #elif defined(XIPHOS_Q7S) std::string q7sGpioName5 = "gpiochip5"; std::string q7sGpioName6 = "gpiochip6"; @@ -362,10 +361,9 @@ void SpiTestClass::acsInit() { gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); #endif -if(gpioIF != nullptr) { - gpioIF->addGpios(gpioCookie); -} - + if(gpioIF != nullptr) { + gpioIF->addGpios(gpioCookie); + } } void SpiTestClass::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed) { diff --git a/linux/boardtest/SpiTestClass.h b/linux/boardtest/SpiTestClass.h index 9c6305f6..f93eb9c2 100644 --- a/linux/boardtest/SpiTestClass.h +++ b/linux/boardtest/SpiTestClass.h @@ -39,7 +39,7 @@ private: /* ACS board specific variables */ #ifdef RASPBERRY_PI - uint8_t mgm0Lis3ChipSelect = 0; + uint8_t mgm0Lis3mdlChipSelect = 0; uint8_t mgm1Rm3100ChipSelect = 1; uint8_t gyro0AdisChipSelect = 5; uint8_t gyro1L3gd20ChipSelect = 6; From 0b9ae5e4ec06b88dfefba1aeaecd9df3b1ae9c23 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 11 Apr 2021 12:25:23 +0200 Subject: [PATCH 34/36] common versioning file --- common/config/OBSWVersion.h | 10 ++++++++++ fsfwconfig/OBSWVersion.h | 13 ------------- tmtc | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) create mode 100644 common/config/OBSWVersion.h delete mode 100644 fsfwconfig/OBSWVersion.h diff --git a/common/config/OBSWVersion.h b/common/config/OBSWVersion.h new file mode 100644 index 00000000..548363f2 --- /dev/null +++ b/common/config/OBSWVersion.h @@ -0,0 +1,10 @@ +#ifndef COMMON_CONFIG_OBSWVERSION_H_ +#define COMMON_CONFIG_OBSWVERSION_H_ + +const char* const SW_NAME = "eive"; + +#define SW_VERSION 1 +#define SW_SUBVERSION 1 +#define SW_SUBSUBVERSION 0 + +#endif /* COMMON_CONFIG_OBSWVERSION_H_ */ diff --git a/fsfwconfig/OBSWVersion.h b/fsfwconfig/OBSWVersion.h deleted file mode 100644 index fd76332e..00000000 --- a/fsfwconfig/OBSWVersion.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef FSFWCONFIG_OBSWVERSION_H_ -#define FSFWCONFIG_OBSWVERSION_H_ - -//! TODO: Think of a cool name for the software releases. -const char* const SW_NAME = "eive"; - -#define SW_VERSION 1 -#define SW_SUBVERSION 0 -#define SW_SUBSUBVERSION 0 - - - -#endif /* FSFWCONFIG_OBSWVERSION_H_ */ diff --git a/tmtc b/tmtc index 74c61842..2e84c822 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 74c61842c87e6a25751904116fdc82dd61a14333 +Subproject commit 2e84c822c8ce5c589793b7ec784c9860f527a2f4 From 97e5eb73197f6c76b0c21e486586d53a1b3849ba Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Sun, 11 Apr 2021 15:18:55 +0200 Subject: [PATCH 35/36] spi chipselects changes --- bsp_q7s/ObjectFactory.cpp | 4 ++-- fsfw | 2 +- tmtc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index fed5734c..6df0cf30 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -150,7 +150,7 @@ void ObjectFactory::produce(){ #if OBSW_ADD_ACS_BOARD == 1 GpioCookie* gpioCookieAcsBoard = new GpioCookie(); GpiodRegular* gpio = nullptr; - gpio = new GpiodRegular(std::string("gpiochip5"), 21, std::string("CS_GYRO_1_ADIS"), + gpio = new GpiodRegular(std::string("gpiochip5"), 19, std::string("CS_GYRO_1_ADIS"), gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); gpio = new GpiodRegular(std::string("gpiochip5"), 7, std::string("CS_GYRO_2_L3G"), @@ -172,7 +172,7 @@ void ObjectFactory::produce(){ gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - gpio = new GpiodRegular(std::string("gpiochip5"), 23, std::string("CS_MGM_3_RM3100_B"), + gpio = new GpiodRegular(std::string("gpiochip5"), 10, std::string("CS_MGM_3_RM3100_B"), gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); diff --git a/fsfw b/fsfw index dea22059..42720e6f 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit dea2205908f29cbb700ad85c2614da71b6efccfc +Subproject commit 42720e6f7d64bdd9a1ac0cea5846c9a8cedea0ff diff --git a/tmtc b/tmtc index 74c61842..73105138 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 74c61842c87e6a25751904116fdc82dd61a14333 +Subproject commit 73105138050b5661a6cff76e1d64af40981f9c7f From 0c892982aecbca6afc6eebe8b337e6735a10ad25 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Mon, 12 Apr 2021 10:22:13 +0200 Subject: [PATCH 36/36] cs gyro 1 change --- bsp_q7s/ObjectFactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index 6df0cf30..85e94fa6 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -150,7 +150,7 @@ void ObjectFactory::produce(){ #if OBSW_ADD_ACS_BOARD == 1 GpioCookie* gpioCookieAcsBoard = new GpioCookie(); GpiodRegular* gpio = nullptr; - gpio = new GpiodRegular(std::string("gpiochip5"), 19, std::string("CS_GYRO_1_ADIS"), + gpio = new GpiodRegular(std::string("gpiochip5"), 1, std::string("CS_GYRO_1_ADIS"), gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); gpio = new GpiodRegular(std::string("gpiochip5"), 7, std::string("CS_GYRO_2_L3G"),