Improved structure #17

Merged
meierj merged 16 commits from mueller/master into develop 2021-02-14 16:28:52 +01:00
46 changed files with 358 additions and 339 deletions

View File

@ -44,8 +44,10 @@ set(FSFW_PATH fsfw)
set(MISSION_PATH mission)
set(CSPLIB_PATH libcsp)
set(TEST_PATH test/testtasks)
set(LINUX_PATH linux)
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
set(ADD_LINUX_FILES FALSE)
# Analyse different OS and architecture/target options, determine BSP_PATH,
# display information about compiler etc.
@ -53,17 +55,15 @@ include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake)
pre_source_hw_os_config()
if(TGT_BSP)
if(${TGT_BSP} MATCHES "arm/q7s" OR ${TGT_BSP} MATCHES "arm/raspberrypi")
set(ROOT_CONFIG_FOLDER TRUE)
set(FSFW_CONFIG_PATH "fsfwconfig")
endif()
if(${TGT_BSP} MATCHES "arm/q7s")
set(ADD_CSP_LIB TRUE)
endif()
if(${TGT_BSP} MATCHES "arm/q7s" OR ${TGT_BSP} MATCHES "arm/raspberrypi")
set(ROOT_CONFIG_FOLDER TRUE)
set(FSFW_CONFIG_PATH "fsfwconfig")
set(ADD_LINUX_FILES TRUE)
set(ADD_CSP_LIB TRUE)
endif()
else()
# Required by FSFW library
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
# Required by FSFW library
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
endif()
################################################################################
@ -75,11 +75,15 @@ add_executable(${TARGET_NAME})
# Add subdirectories
if(ROOT_CONFIG_FOLDER)
add_subdirectory(${FSFW_CONFIG_PATH})
add_subdirectory(${FSFW_CONFIG_PATH})
endif()
if(ADD_CSP_LIB)
add_subdirectory(${CSPLIB_PATH})
add_subdirectory(${CSPLIB_PATH})
endif()
if(ADD_LINUX_FILES)
add_subdirectory(${LINUX_PATH})
endif()
add_subdirectory(${BSP_PATH})

View File

@ -24,10 +24,7 @@ Target systems:
The steps in the primary README are related to the main OBC target Q7S.
The CMake build system can be used to generate build systems as well (see helper scripts in `cmake/scripts`:
- Linux (Raspberry Pi): Using the `bsp_rpi` BSP folder, and a very similar cross-compiler.
For running the software on a Raspberry Pi, it is recommended to follow the steps specified in
[the fsfw example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/mueller/master/doc/README-rpi.md#top) and
using the TCF agent to have a similar set-up process also required for the Q7S.
- Linux (Raspberry Pi): See special section below.
- Linux Host: Uses the `bsp_hosted` BSP folder and the CMake Unix Makefiles generator.
- Windows Host: Uses the `bsp_hosted` BSP folder, the CMake MinGW Makefiles generator and MSYS2.
@ -89,6 +86,13 @@ C++ applications. Alternatively you can download the toolchain
sudo apt-get install cmake
````
## Getting the Q7S system root
It is necessary to copy the Q7S system root to your local development machine for libraries
like `libgpio`. You can find the system root [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S/Toolchain&fileid=422486). Download it and unzip it somewhere in the Xilinx installation folder.
Then, create a new environmental variables `Q7S_SYSROOT` and set it to the local system root path.
## Building the software with CMake
When using Windows, run theses steps in MSYS2.
@ -149,9 +153,9 @@ The [TCF agent](https://wiki.eclipse.org/TCF) can be used to perform remote debu
After that, comfortable remote debugging should be possible with the Debug button.
A build configuration and a shell helper script has been provided to set up the path variables and build the Q7S binary
on Windows, but a launch configuration needs to be newly created because the IP address and path settings differ
from machine to machine.
A build configuration and a shell helper script has been provided to set up the path variables and
build the Q7S binary on Windows, but a launch configuration needs to be newly created because the
IP address and path settings differ from machine to machine.
## Building in Xilinx SDK 2018.2
@ -501,6 +505,7 @@ GET out_en[0] = 1
* Remote File Path: /tmp/eive_obsw.elf
## Libgpiod
Detect all gpio device files:
````
gpiodetect
@ -527,3 +532,26 @@ gpioget <gpiogroup> <offset>
````
Example to get state:
gpioget gpiochip7 14
## Running the EIVE OBSW on a Raspberry Pi
Special section for running the EIVE OBSW on the Raspberry Pi.
The Raspberry Pi build uses the `bsp_rpi` BSP folder, and a very similar cross-compiler.
For running the software on a Raspberry Pi, it is recommended to follow the steps specified in
[the fsfw example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/mueller/master/doc/README-rpi.md#top)
and using the TCF agent to have a similar set-up process also required for the Q7S.
You should run the following command first on your Raspberry Pi
```sh
sudo apt-get install gpiod libgpiod-dev
```
to install the required GPIO libraries before cloning the system root folder.
## Special notes on Eclipse
When using Eclipse, there are two special build variables in the project properties
&rarr; C/C++ Build &rarr; Build Variables called `Q7S_SYSROOT` or `RPI_SYSROOT`. You can set
the sysroot path in those variables to get any additional includes like `gpiod.h` in the
Eclipse indexer.

View File

@ -8,9 +8,9 @@
#define OBSW_ADD_TEST_CODE 0
// These defines should be disabled for mission code but are useful for
// debugging.
#define OBSW_ENHANCED_PRINTOUT 1
/* These defines should be disabled for mission code but are useful for
debugging. */
#define OBSW_VEBOSE_LEVEL 1
#ifdef __cplusplus

View File

@ -6,7 +6,7 @@ target_sources(${TARGET_NAME} PUBLIC
add_subdirectory(boardconfig)
add_subdirectory(comIF)
add_subdirectory(gpio)
add_subdirectory(boardtest)

View File

@ -26,147 +26,151 @@
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include <mission/utility/TmFunnel.h>
#include <bsp_q7s/comIF/cookies/CspCookie.h>
#include <bsp_q7s/comIF/cookies/I2cCookie.h>
#include <bsp_q7s/comIF/CspComIF.h>
#include <bsp_q7s/comIF/I2cComIF.h>
#include <bsp_q7s/gpio/LinuxLibgpioIF.h>
#include <bsp_q7s/gpio/cookies/GpioCookie.h>
#include <linux/csp/CspCookie.h>
#include <linux/csp/CspComIF.h>
#include <linux/i2c/I2cCookie.h>
#include <linux/i2c/I2cComIF.h>
#include <linux/gpio/LinuxLibgpioIF.h>
#include <linux/gpio/GpioCookie.h>
# if TEST_LIBGPIOD == 1
#if TEST_LIBGPIOD == 1
#include "LibgpiodTest.h"
#endif
void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
PusServiceBase::packetDestination = objects::TM_FUNNEL;
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
PusServiceBase::packetDestination = objects::TM_FUNNEL;
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
TmFunnel::downlinkDestination = objects::UDP_BRIDGE;
// No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT;
TmFunnel::downlinkDestination = objects::UDP_BRIDGE;
// No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT;
LocalDataPoolManager::defaultHkDestination = objects::NO_OBJECT;
LocalDataPoolManager::defaultHkDestination = objects::NO_OBJECT;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
TmPacketStored::timeStamperId = objects::TIME_STAMPER;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
TmPacketStored::timeStamperId = objects::TIME_STAMPER;
}
void ObjectFactory::produce(){
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();
#if TE0720 == 1
I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
#else
I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1,
I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-1"));
I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-1"));
#endif
/* Communication interfaces */
new CspComIF(objects::CSP_COM_IF);
new I2cComIF(objects::I2C_COM_IF);
new CspComIF(objects::CSP_COM_IF);
new I2cComIF(objects::I2C_COM_IF);
#if TE0720 == 0
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH,
addresses::P60DOCK);
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH,
addresses::P60DOCK);
CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH,
addresses::PDU1);
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH,
addresses::PDU2);
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH,
addresses::ACU);
addresses::ACU);
/* Device Handler */
P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie);
PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie);
PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie);
ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie);
new PCDUHandler(objects::PCDU_HANDLER, 50);
P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER,
objects::CSP_COM_IF, p60DockCspCookie);
PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER,
objects::CSP_COM_IF, pdu1CspCookie);
PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER,
objects::CSP_COM_IF, pdu2CspCookie);
ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER,
objects::CSP_COM_IF, acuCspCookie);
new PCDUHandler(objects::PCDU_HANDLER, 50);
/**
* Setting PCDU devices to mode normal immediately after start up because PCDU is always
* running.
*/
p60dockhandler->setModeNormal();
pdu1handler->setModeNormal();
pdu2handler->setModeNormal();
acuhandler->setModeNormal();
/**
* Setting PCDU devices to mode normal immediately after start up because PCDU is always
* running.
*/
p60dockhandler->setModeNormal();
pdu1handler->setModeNormal();
pdu2handler->setModeNormal();
acuhandler->setModeNormal();
#endif
/* Temperature sensors */
Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler(
objects::TMP1075_HANDLER_1, objects::I2C_COM_IF,
i2cCookieTmp1075tcs1);
tmp1075Handler_1->setStartUpImmediately();
Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler(
objects::TMP1075_HANDLER_2, objects::I2C_COM_IF,
i2cCookieTmp1075tcs2);
tmp1075Handler_2->setStartUpImmediately();
/* Temperature sensors */
Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler(
objects::TMP1075_HANDLER_1, objects::I2C_COM_IF,
i2cCookieTmp1075tcs1);
tmp1075Handler_1->setStartUpImmediately();
Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler(
objects::TMP1075_HANDLER_2, objects::I2C_COM_IF,
i2cCookieTmp1075tcs2);
tmp1075Handler_2->setStartUpImmediately();
GpioCookie* gpioCookie = new GpioCookie;
new LinuxLibgpioIF(objects::GPIO_IF);
GpioCookie* gpioCookie = new GpioCookie;
new LinuxLibgpioIF(objects::GPIO_IF);
#if TE0720 == 0
/* Pin H2-11 on stack connector */
GpioConfig_t gpioConfigHeater0(std::string("gpiochip7"), 18,
std::string("Heater0"), Gpio::OUT, 0);
/* Pin H2-11 on stack connector */
GpioConfig_t gpioConfigHeater0(std::string("gpiochip7"), 18,
std::string("Heater0"), gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0);
/* Pin H2-12 on stack connector */
GpioConfig_t gpioConfigHeater1(std::string("gpiochip7"), 14,
std::string("Heater1"), Gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1);
std::string("Heater1"), gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1);
/* Pin H2-13 on stack connector */
/* Pin H2-13 on stack connector */
GpioConfig_t gpioConfigHeater2(std::string("gpiochip7"), 20,
std::string("Heater2"), Gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2);
std::string("Heater2"), gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2);
GpioConfig_t gpioConfigHeater3(std::string("gpiochip7"), 16,
std::string("Heater3"), Gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3);
std::string("Heater3"), gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3);
GpioConfig_t gpioConfigHeater4(std::string("gpiochip7"), 24,
std::string("Heater4"), Gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4);
std::string("Heater4"), gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4);
GpioConfig_t gpioConfigHeater5(std::string("gpiochip7"), 26,
std::string("Heater5"), Gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5);
std::string("Heater5"), gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5);
GpioConfig_t gpioConfigHeater6(std::string("gpiochip7"), 22,
std::string("Heater6"), Gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6);
std::string("Heater6"), gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6);
GpioConfig_t gpioConfigHeater7(std::string("gpiochip7"), 28,
std::string("Heater7"), Gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7);
std::string("Heater7"), gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER,
pcduSwitches::TCS_BOARD_8V_HEATER_IN);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER,
pcduSwitches::TCS_BOARD_8V_HEATER_IN);
#endif
new TmTcUnixUdpBridge(objects::UDP_BRIDGE,
objects::CCSDS_PACKET_DISTRIBUTOR,
objects::TM_STORE, objects::TC_STORE);
new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
new TmTcUnixUdpBridge(objects::UDP_BRIDGE,
objects::CCSDS_PACKET_DISTRIBUTOR,
objects::TM_STORE, objects::TC_STORE);
new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
#if TE0720 == 1 && TEST_LIBGPIOD == 1
/* Configure MIO0 as input */
/* Configure MIO0 as input */
GpioConfig_t gpioConfigMio0(std::string("gpiochip0"), 0,
std::string("MIO0"), Gpio::IN, 0);
std::string("MIO0"), gpio::IN, 0);
gpioCookie->addGpio(gpioIds::Test_ID, gpioConfigMio0);
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie);
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie);
#elif TE0720 == 1
// Configuration for MIO0 on TE0720-03-1CFA
/* Configuration for MIO0 on TE0720-03-1CFA */
GpioConfig_t gpioConfigForDummyHeater(std::string("gpiochip0"), 0,
std::string("Heater0"), Gpio::OUT, 0);
std::string("Heater0"), gpio::OUT, 0);
gpioCookie->addGpio(gpioIds::HEATER_0, gpioConfigForDummyHeater);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER,
pcduSwitches::TCS_BOARD_8V_HEATER_IN);

View File

@ -1,10 +1,9 @@
#ifndef BSP_Q7S_OBJECTFACTORY_H_
#define BSP_Q7S_OBJECTFACTORY_H_
namespace ObjectFactory {
void setStatics();
void produce();
void setStatics();
void produce();
};
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */

View File

@ -0,0 +1,7 @@
target_sources(${TARGET_NAME} PRIVATE
LibgpiodTest.cpp
)

View File

@ -1,10 +1,11 @@
#include "LibgpiodTest.h"
#include "devices/gpioIds.h"
#include <fsfwconfig/devices/gpioIds.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie) :
LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId,
GpioCookie* gpioCookie):
TestTask(objectId) {
gpioInterface = objectManager->get<GpioIF>(gpioIfobjectId);

View File

@ -2,8 +2,8 @@
#define TEST_TESTTASKS_LIBGPIODTEST_H_
#include "TestTask.h"
#include "GpioIF.h"
#include "GpioCookie.h"
#include <linux/gpio/GpioIF.h>
#include <linux/gpio/GpioCookie.h>
#include <fsfw/objectmanager/SystemObject.h>
/**

View File

@ -1,8 +1,4 @@
target_sources(${TARGET_NAME} PRIVATE
cookies/CspCookie.cpp
cookies/I2cCookie.cpp
CspComIF.cpp
I2cComIF.cpp
)

View File

@ -1,11 +0,0 @@
target_sources(${TARGET_NAME} PUBLIC
cookies/GpioCookie.cpp
LinuxLibgpioIF.cpp
)
target_include_directories(${TARGET_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/cookies
)

2
fsfw

@ -1 +1 @@
Subproject commit 7d0916a44e18c87b00998448333023186b3d85b1
Subproject commit c28398257b68facbabb19d7228b045f1388305df

View File

@ -6,18 +6,17 @@
#ifndef FSFWCONFIG_OBSWCONFIG_H_
#define FSFWCONFIG_OBSWCONFIG_H_
#define TEST_LIBGPIOD 0
#define ADD_TEST_TAST 0
#define TEST_LIBGPIOD 0
// These defines should be disabled for mission code but are useful for
// debugging.
#define OBSW_ENHANCED_PRINTOUT 1
/* These defines should be disabled for mission code but are useful for
debugging. */
#define OBSW_VERBOSE_LEVEL 1
#define TE0720 0
#define TE0720 0
#define P60DOCK_DEBUG 0
#define PDU1_DEBUG 0
#define PDU2_DEBUG 0
#define P60DOCK_DEBUG 0
#define PDU1_DEBUG 0
#define PDU2_DEBUG 0
#include "OBSWVersion.h"

View File

@ -1,7 +1,7 @@
#ifndef FSFWCONFIG_DEVICES_GPIOIDS_H_
#define FSFWCONFIG_DEVICES_GPIOIDS_H_
#include <bsp_q7s/gpio/GpioIF.h>
#include <linux/gpio/GpioIF.h>
namespace gpioIds {
enum gpioId_t {

5
linux/CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
add_subdirectory(gpio)
add_subdirectory(i2c)
add_subdirectory(csp)
add_subdirectory(spi)

8
linux/csp/CMakeLists.txt Normal file
View File

@ -0,0 +1,8 @@
target_sources(${TARGET_NAME} PUBLIC
CspComIF.cpp
CspCookie.cpp
)

View File

@ -1,5 +1,5 @@
#include "CspComIF.h"
#include "cookies/CspCookie.h"
#include "CspCookie.h"
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <csp/drivers/can_socketcan.h>
@ -7,7 +7,6 @@
CspComIF::CspComIF(object_id_t objectId) :
SystemObject(objectId) {
}
CspComIF::~CspComIF() {

View File

@ -0,0 +1,8 @@
target_sources(${TARGET_NAME} PUBLIC
GpioCookie.cpp
LinuxLibgpioIF.cpp
)

View File

@ -1,4 +1,4 @@
#include <bsp_q7s/gpio/cookies/GpioCookie.h>
#include "GpioCookie.h"
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
GpioCookie::GpioCookie() {

View File

@ -1,17 +1,17 @@
#ifndef SAM9G20_COMIF_COOKIES_GPIO_COOKIE_H_
#define SAM9G20_COMIF_COOKIES_GPIO_COOKIE_H_
#include "GpioIF.h"
#include <fsfw/devicehandlers/CookieIF.h>
#include <bsp_q7s/gpio/GpioIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <string>
#include <unordered_map>
namespace Gpio {
enum Direction {
IN = 0,
OUT = 1
};
namespace gpio {
enum Direction {
IN = 0,
OUT = 1
};
}
/**
@ -29,17 +29,17 @@ namespace Gpio {
* pointer.
*/
typedef struct GpioConfig {
GpioConfig(std::string chipname_, int lineNum_, std::string consumer_,
Gpio::Direction direction_, int initValue_) :
chipname(chipname_), lineNum(lineNum_), consumer(consumer_), direction(
direction_), initValue(initValue_) {
}
std::string chipname;
int lineNum;
std::string consumer;
Gpio::Direction direction;
int initValue;
struct gpiod_line* lineHandle;
GpioConfig(std::string chipname_, int lineNum_, std::string consumer_,
gpio::Direction direction_, int initValue_) :
chipname(chipname_), lineNum(lineNum_), consumer(consumer_), direction(direction_),
initValue(initValue_) {
}
std::string chipname;
int lineNum;
std::string consumer;
gpio::Direction direction;
int initValue;
struct gpiod_line* lineHandle = nullptr;
} GpioConfig_t;
using GpioMap = std::unordered_map<gpioId_t, GpioConfig_t>;
using GpioMapIter = GpioMap::iterator;
@ -57,20 +57,20 @@ using GpioMapIter = GpioMap::iterator;
class GpioCookie: public CookieIF {
public:
GpioCookie();
GpioCookie();
virtual ~GpioCookie();
virtual ~GpioCookie();
void addGpio(gpioId_t gpioId, GpioConfig_t gpioConfig);
/**
* @brief Get map with registered GPIOs.
*/
GpioMap getGpioMap() const;
void addGpio(gpioId_t gpioId, GpioConfig_t gpioConfig);
/**
* @brief Get map with registered GPIOs.
*/
GpioMap getGpioMap() const;
private:
GpioMap gpioMap;
GpioMapIter gpioMapIter;
GpioMap gpioMap;
GpioMapIter gpioMapIter;
};
#endif

View File

@ -1,5 +1,5 @@
#include <bsp_q7s/gpio/LinuxLibgpioIF.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include "LinuxLibgpioIF.h"
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <utility>
#include <unistd.h>
@ -12,36 +12,36 @@ LinuxLibgpioIF::~LinuxLibgpioIF() {
}
ReturnValue_t LinuxLibgpioIF::initialize(CookieIF * cookie){
ReturnValue_t result;
GpioMap mapToAdd;
ReturnValue_t result;
GpioMap mapToAdd;
if(cookie == nullptr) {
sif::error << "LinuxLibgpioIF::initialize: Invalid cookie" << std::endl;
return RETURN_FAILED;
}
GpioCookie* gpioCookie = dynamic_cast<GpioCookie*>(cookie);
if(gpioCookie == nullptr) {
sif::error << "LinuxLibgpioIF: Invalid Gpio Cookie!"
<< std::endl;
return RETURN_FAILED;
}
if(cookie == nullptr) {
sif::error << "LinuxLibgpioIF::initialize: Invalid cookie" << std::endl;
return RETURN_FAILED;
}
GpioCookie* gpioCookie = dynamic_cast<GpioCookie*>(cookie);
if(gpioCookie == nullptr) {
sif::error << "LinuxLibgpioIF: Invalid Gpio Cookie!"
<< std::endl;
return RETURN_FAILED;
}
mapToAdd = gpioCookie->getGpioMap();
mapToAdd = gpioCookie->getGpioMap();
result = checkForConflicts(mapToAdd);
if (result != RETURN_OK){
return result;
}
result = checkForConflicts(mapToAdd);
if (result != RETURN_OK){
return result;
}
result = configureGpios(&mapToAdd);
if (result != RETURN_OK) {
return RETURN_FAILED;
}
result = configureGpios(&mapToAdd);
if (result != RETURN_OK) {
return RETURN_FAILED;
}
/* Register new GPIOs in gpioMap*/
gpioMap.insert(mapToAdd.begin(), mapToAdd.end());
/* Register new GPIOs in gpioMap*/
gpioMap.insert(mapToAdd.begin(), mapToAdd.end());
return RETURN_OK;
return RETURN_OK;
}
ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) {
@ -49,7 +49,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) {
std::string chipname;
unsigned int lineNum;
struct gpiod_chip *chip;
Gpio::Direction direction;
gpio::Direction direction;
std::string consumer;
struct gpiod_line *lineHandle;
int result;
@ -77,7 +77,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) {
consumer = mapToAddIter->second.consumer;
/* Configure direction and add a description to the GPIO */
switch (direction) {
case Gpio::OUT:
case gpio::OUT:
result = gpiod_line_request_output(lineHandle, consumer.c_str(),
mapToAddIter->second.initValue);
if (result < 0) {
@ -88,7 +88,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) {
return RETURN_FAILED;
}
break;
case Gpio::IN:
case gpio::IN:
result = gpiod_line_request_input(lineHandle, consumer.c_str());
if (result < 0) {
sif::error << "LinuxLibgpioIF::configureGpios: Failed to request line "
@ -100,7 +100,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) {
break;
default:
sif::error << "LinuxLibgpioIF::configureGpios: Invalid direction specified"
<< std::endl;
<< std::endl;
return RETURN_FAILED;
}
/**
@ -113,33 +113,33 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) {
}
ReturnValue_t LinuxLibgpioIF::pullHigh(gpioId_t gpioId){
return driveGpio(gpioId, 1);
return driveGpio(gpioId, 1);
}
ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId){
return driveGpio(gpioId, 0);
return driveGpio(gpioId, 0);
}
ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId,
unsigned int logiclevel) {
unsigned int logiclevel) {
int result;
struct gpiod_line *lineHandle;
struct gpiod_line *lineHandle;
gpioMapIter = gpioMap.find(gpioId);
gpioMapIter = gpioMap.find(gpioId);
if (gpioMapIter == gpioMap.end()){
sif::debug << "LinuxLibgpioIF::driveGpio: Unknown gpio id " << gpioId << std::endl;
return RETURN_FAILED;
}
lineHandle = gpioMapIter->second.lineHandle;
result = gpiod_line_set_value(lineHandle, logiclevel);
if (result < 0) {
sif::error << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID "
<< gpioId << " to logic level " << logiclevel << std::endl;
return DRIVE_GPIO_FAILURE;
}
result = gpiod_line_set_value(lineHandle, logiclevel);
if (result < 0) {
sif::error << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID "
<< gpioId << " to logic level " << logiclevel << std::endl;
return DRIVE_GPIO_FAILURE;
}
return RETURN_OK;
return RETURN_OK;
}
ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) {
@ -158,23 +158,23 @@ ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) {
}
ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap mapToAdd){
gpioId_t gpioId;
GpioMapIter mapToAddIter = mapToAdd.begin();
for(; mapToAddIter != mapToAdd.end(); mapToAddIter++){
gpioId = mapToAddIter->first;
gpioMapIter = gpioMap.find(gpioId);
if(gpioMapIter != mapToAdd.end()){
/* An entry for this GPIO already exists. Check if configuration
* of direction is equivalent */
if (mapToAddIter->second.direction != gpioMapIter->second.direction){
sif::error << "LinuxLibgpioIF::checkForConflicts: Detected conflict "
<< "for GPIO " << mapToAddIter->first << std::endl;
return RETURN_OK;
}
/* Remove element from map to add because a entry for this GPIO
* already exists */
mapToAdd.erase(mapToAddIter);
}
}
return RETURN_OK;
gpioId_t gpioId;
GpioMapIter mapToAddIter = mapToAdd.begin();
for(; mapToAddIter != mapToAdd.end(); mapToAddIter++){
gpioId = mapToAddIter->first;
gpioMapIter = gpioMap.find(gpioId);
if(gpioMapIter != mapToAdd.end()){
/* An entry for this GPIO already exists. Check if configuration
* of direction is equivalent */
if (mapToAddIter->second.direction != gpioMapIter->second.direction){
sif::error << "LinuxLibgpioIF::checkForConflicts: Detected conflict "
<< "for GPIO " << mapToAddIter->first << std::endl;
return RETURN_OK;
}
/* Remove element from map to add because a entry for this GPIO
* already exists */
mapToAdd.erase(mapToAddIter);
}
}
return RETURN_OK;
}

View File

@ -1,9 +1,9 @@
#ifndef BSP_Q7S_GPIO_LINUXLIBGPIOIF_H_
#define BSP_Q7S_GPIO_LINUXLIBGPIOIF_H_
#include <bsp_q7s/gpio/GpioIF.h>
#include <linux/gpio/GpioIF.h>
#include <linux/gpio/GpioCookie.h>
#include <fsfwconfig/returnvalues/classIds.h>
#include <bsp_q7s/gpio/cookies/GpioCookie.h>
#include <fsfw/objectmanager/SystemObject.h>
/**

8
linux/i2c/CMakeLists.txt Normal file
View File

@ -0,0 +1,8 @@
target_sources(${TARGET_NAME} PUBLIC
I2cComIF.cpp
I2cCookie.cpp
)

View File

@ -1,5 +1,6 @@
#include <bsp_q7s/comIF/I2cComIF.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include "I2cComIF.h"
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>

View File

@ -1,9 +1,9 @@
#ifndef BSP_Q7S_COMIF_I2COMIF_H_
#define BSP_Q7S_COMIF_I2COMIF_H_
#include "I2cCookie.h"
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <bsp_q7s/comIF/cookies/I2cCookie.h>
#include <unordered_map>
#include <vector>

View File

@ -1,4 +1,4 @@
#include <bsp_q7s/comIF/cookies/I2cCookie.h>
#include "I2cCookie.h"
I2cCookie::I2cCookie(address_t i2cAddress_, size_t maxReplyLen_,
std::string deviceFile_) :

6
linux/spi/CMakeLists.txt Normal file
View File

@ -0,0 +1,6 @@
target_sources(${TARGET_NAME} PUBLIC
)

View File

@ -219,6 +219,9 @@
</cconfiguration>
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851" moduleId="org.eclipse.cdt.core.settings" name="eive-rpi-debug-win">
<macros>
<stringMacro name="RPI_SYSROOT" type="VALUE_TEXT" value="C:\Users\Robin\raspberrypi\rootfs"/>
</macros>
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
@ -315,6 +318,7 @@
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.2065184927" name="GNU Arm Cross C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.1596179531" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive_obsw}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${RPI_SYSROOT}/usr/include&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.864441147" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/>
@ -324,6 +328,7 @@
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1595165802" name="GNU Arm Cross C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths.1606583601" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive_obsw}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${RPI_SYSROOT}/usr/include&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.1683468766" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/>
@ -355,7 +360,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
@ -363,6 +368,9 @@
</cconfiguration>
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171" moduleId="org.eclipse.cdt.core.settings" name="eive-rpi-release-win">
<macros>
<stringMacro name="RPI_SYSROOT" type="VALUE_TEXT" value="C:\Users\Robin\raspberrypi\rootfs"/>
</macros>
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
@ -459,6 +467,7 @@
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.193772074" name="GNU Arm Cross C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.606914861" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive_obsw}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${RPI_SYSROOT}/usr/include&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.1796598598" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/>
@ -468,6 +477,7 @@
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.2044466190" name="GNU Arm Cross C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths.77129276" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive_obsw}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${RPI_SYSROOT}/usr/include&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.1881223360" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/>
@ -499,7 +509,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
@ -507,6 +517,9 @@
</cconfiguration>
<cconfiguration id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689" moduleId="org.eclipse.cdt.core.settings" name="eive-q7s-debug-win">
<macros>
<stringMacro name="Q7S_SYSROOT" type="VALUE_TEXT" value="C:\Xilinx\cortexa9hf-neon-xiphos-linux-gnueabi"/>
</macros>
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
@ -612,6 +625,7 @@
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1535302916" name="GNU Arm Cross C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths.1607430527" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive_obsw}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${Q7S_SYSROOT}/usr/include&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.1199844227" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/>
@ -643,7 +657,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
@ -787,7 +801,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
@ -795,19 +809,26 @@
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="eive_obsw.null.1062489770" name="eive_obsw"/>
<project id="eive_obsw.null.1569861610" name="eive_obsw"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="eive-linux-host-debug">
<configuration configurationName="eive-linux-host-debug"/>
<configuration configurationName="eive-q7s-release-win">
<resource resourceType="PROJECT" workspacePath="/eive_obsw"/>
</configuration>
<configuration configurationName="eive-mingw-release"/>
<configuration configurationName="eive-rpi-release-win"/>
<configuration configurationName="eive-linux-host-release"/>
<configuration configurationName="eive-mingw-debug">
<resource resourceType="PROJECT" workspacePath="/eive_obsw"/>
</configuration>
<configuration configurationName="Default">
<resource resourceType="PROJECT" workspacePath="/eive_obsw"/>
</configuration>
<configuration configurationName="eive-rpi-debug-win"/>
<configuration configurationName="eive-q7s-debug-win"/>
<configuration configurationName="eive-rpi-debug"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings">
<doc-comment-owner id="org.eclipse.cdt.ui.doxygen">
@ -816,17 +837,9 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j16</buildArguments>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="hardclean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j16</buildArguments>
<buildArguments>-f Makefile-Hosted -j16</buildArguments>
<buildTarget>hardclean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
@ -836,10 +849,28 @@
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.base.2047596104;cdt.managedbuild.toolchain.gnu.base.2047596104.1629235648;cdt.managedbuild.tool.gnu.c.compiler.base.1751527394;cdt.managedbuild.tool.gnu.c.compiler.input.72239787">
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.2065184927;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.920837857">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.base.2047596104;cdt.managedbuild.toolchain.gnu.base.2047596104.1629235648;cdt.managedbuild.tool.gnu.cpp.compiler.base.1852610587;cdt.managedbuild.tool.gnu.cpp.compiler.input.1985567520">
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.628631287;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.216437361">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.1707795689.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1535302916;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.96000231">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1031020513;cdt.managedbuild.toolchain.gnu.mingw.base.1031020513.519944638;cdt.managedbuild.tool.gnu.c.compiler.mingw.base.438317679;cdt.managedbuild.tool.gnu.c.compiler.input.336445831">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1595165802;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1925043110">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.2044466190;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1551006500">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1031020513;cdt.managedbuild.toolchain.gnu.mingw.base.1031020513.519944638;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.base.205410786;cdt.managedbuild.tool.gnu.cpp.compiler.input.1560428812">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171;cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.2117915473.688890851.190921171.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.193772074;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.2081570054">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>

View File

@ -11,8 +11,8 @@
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/devicehandlers/CookieIF.h>
#include <fsfw/timemanager/Countdown.h>
#include <linux/gpio/GpioIF.h>
#include <unordered_map>
#include <bsp_q7s/gpio/GpioIF.h>
/**
* @brief This class intends the control of heaters.

View File

@ -5,7 +5,7 @@ MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId,
object_id_t deviceCommunication, CookieIF* comCookie):
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
dataset(this) {
#if OBSW_ENHANCED_PRINTOUT == 1
#if OBSW_VERBOSE_LEVEL >= 1
debugDivider = new PeriodicOperationDivider(10);
#endif
// Set to default values right away.
@ -247,7 +247,7 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id,
float mgmZ = static_cast<float>(mgmMeasurementRawZ) * sensitivityFactor
* MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR;
#if OBSW_ENHANCED_PRINTOUT == 1
#if OBSW_VERBOSE_LEVEL >= 1
if(debugDivider->checkAndIncrement()) {
sif::info << "MGMHandlerLIS3: Magnetic field strength in"
" microtesla:" << std::endl;
@ -271,7 +271,7 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id,
case MGMLIS3MDL::READ_TEMPERATURE: {
int16_t tempValueRaw = packet[2] << 8 | packet[1];
float tempValue = 25.0 + ((static_cast<float>(tempValueRaw)) / 8.0);
#if OBSW_ENHANCED_PRINTOUT == 1
#if OBSW_VERBOSE_LEVEL >= 1
if(debugDivider->check()) {
// Set terminal to utf-8 if there is an issue with micro printout.
sif::info << "MGMHandlerLIS3: Temperature: " << tempValue<< " °C"

View File

@ -157,7 +157,7 @@ private:
CommunicationStep communicationStep = CommunicationStep::DATA;
bool commandExecuted = false;
#if OBSW_ENHANCED_PRINTOUT == 1
#if OBSW_VERBOSE_LEVEL >= 1
PeriodicOperationDivider* debugDivider;
#endif

View File

@ -9,7 +9,7 @@ MGMHandlerRM3100::MGMHandlerRM3100(object_id_t objectId,
object_id_t deviceCommunication, CookieIF* comCookie):
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
primaryDataset(this) {
#if OBSW_ENHANCED_PRINTOUT == 1
#if OBSW_VERBOSE_LEVEL >= 1
debugDivider = new PeriodicOperationDivider(10);
#endif
}
@ -328,7 +328,7 @@ ReturnValue_t MGMHandlerRM3100::handleDataReadout(const uint8_t *packet) {
int32_t fieldStrengthZ = (packet[7] << 16 | packet[8] << 8 | packet[9])
* scaleFactorZ;
#if OBSW_ENHANCED_PRINTOUT == 1
#if OBSW_VERBOSE_LEVEL >= 1
if(debugDivider->checkAndIncrement()) {
sif::info << "MGMHandlerLIS3: Magnetic field strength in"
" microtesla:" << std::endl;

View File

@ -6,7 +6,7 @@
#include <OBSWConfig.h>
#if OBSW_ENHANCED_PRINTOUT == 1
#if OBSW_VERBOSE_LEVEL >= 1
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
#endif
@ -97,7 +97,7 @@ private:
const uint8_t *commandData,size_t commandDataLen);
ReturnValue_t handleDataReadout(const uint8_t* packet);
#if OBSW_ENHANCED_PRINTOUT == 1
#if OBSW_VERBOSE_LEVEL >= 1
PeriodicOperationDivider* debugDivider;
#endif
};

View File

@ -25,7 +25,7 @@ void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *
*/
handleDeviceTM(&p60dockHkTableDataset, id, true);
#if OBSW_ENHANCED_PRINTOUT == 1 && P60DOCK_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && P60DOCK_DEBUG == 1
p60dockHkTableDataset.read();
float temperatureC = p60dockHkTableDataset.temperature1.value * 0.1;

View File

@ -23,7 +23,7 @@ void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac
parseHkTableReply(packet);
// handleDeviceTM(&pdu1HkTableDataset, id, true);
#if OBSW_ENHANCED_PRINTOUT == 1 && PDU1_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && PDU1_DEBUG == 1
pdu1HkTableDataset.read();
sif::info << "PDU1 VCC: " << pdu1HkTableDataset.vcc << " mV" << std::endl;
float vbat = pdu1HkTableDataset.vbat.value * 0.1;

View File

@ -26,7 +26,7 @@ void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac
*/
handleDeviceTM(&pdu2HkTableDataset, id, true);
#if OBSW_ENHANCED_PRINTOUT == 1 && PDU2_DEBUG == 1
#if OBSW_VERBOSE_LEVEL >= 1 && PDU2_DEBUG == 1
pdu2HkTableDataset.read();
sif::info << "PDU2 Q7S current voltage: " << pdu2HkTableDataset.voltageOutQ7S << " mV" << std::endl;
sif::info << "PDU2 VCC: " << pdu2HkTableDataset.vcc << " mV" << std::endl;

View File

@ -98,7 +98,7 @@ ReturnValue_t Tmp1075Handler::interpretDeviceReply(DeviceCommandId_t id,
int16_t tempValueRaw = 0;
tempValueRaw = packet[0] << 4 | packet[1] >> 4;
float tempValue = ((static_cast<float>(tempValueRaw)) * 0.0625);
#if OBSW_ENHANCED_PRINTOUT == 1
#if OBSW_VERBOSE_LEVEL >= 1
sif::info << "Tmp1075 with object id: 0x" << std::hex << getObjectId()
<< ": Temperature: " << tempValue<< " °C"
<< std::endl;

View File

@ -1,5 +1,4 @@
target_sources(${TARGET_NAME} PUBLIC
LibgpiodTest.cpp
TestTask.cpp
)

View File

@ -1,41 +0,0 @@
/*
* MutextestTask.cpp
*
* Created on: 19.07.2018
* Author: mohr
*/
#include <test/testtasks/MutextestTask.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
MutexIF * MutextestTask::mutex = nullptr;
MutextestTask::MutextestTask(const char *name, object_id_t setObjectId) :
SystemObject(setObjectId), name(name), locked(false) {
if (mutex == NULL) {
mutex = MutexFactory::instance()->createMutex();
}
}
ReturnValue_t MutextestTask::performOperation(uint8_t operationCode) {
if (!locked){
sif::info << name << ": locking..." << std::endl;
ReturnValue_t result = mutex->lockMutex(MutexIF::BLOCKING);
sif::info << name << ": locked with " << (int) result << std::endl;
if (result == HasReturnvaluesIF::RETURN_OK){
locked = true;
}
} else {
sif::info << name << ": releasing" << std::endl;
mutex->unlockMutex();
locked = false;
}
return HasReturnvaluesIF::RETURN_OK;
}
MutextestTask::~MutextestTask() {
// TODO Auto-generated destructor stub
}

View File

@ -1,32 +0,0 @@
/*
* MutextestTask.h
*
* Created on: 19.07.2018
* Author: mohr
*/
#ifndef MISSION_MUTEXTESTTASK_H_
#define MISSION_MUTEXTESTTASK_H_
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/tasks/ExecutableObjectIF.h>
#include <fsfw/ipc/MutexFactory.h>
/**
* Start two of them with a little time difference and different periods to see mutex in action
*/
class MutextestTask: public SystemObject, public ExecutableObjectIF {
public:
virtual ReturnValue_t performOperation(uint8_t operationCode = 0);
MutextestTask(const char *name, object_id_t setObjectId);
virtual ~MutextestTask();
private:
static MutexIF *mutex;
const char * name;
bool locked;
};
#endif /* MISSION_MUTEXTESTTASK_H_ */

2
tmtc

@ -1 +1 @@
Subproject commit 110ec9644a520af9c6f4cb7f2b5d47f3d34ba256
Subproject commit 2b85ece07195ee905c35b35494bc7a86b94335f5