uart isolator switch handling

This commit is contained in:
Jakob Meier
2022-03-28 09:08:11 +02:00
parent e2c9bece05
commit 758c4e6f4f
11 changed files with 75 additions and 45 deletions

View File

@ -6,17 +6,13 @@
PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid,
CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper,
LinuxLibgpioIF* gpioComIF, gpioId_t uartIsolatorSwitch)
Gpio uartIsolatorSwitch)
: DeviceHandlerBase(objectId, uartComIFid, comCookie),
plocMPSoCHelper(plocMPSoCHelper),
gpioComIF(gpioComIF),
uartIsolatorSwitch(uartIsolatorSwitch) {
if (comCookie == nullptr) {
sif::error << "PlocMPSoCHandler: Invalid communication cookie" << std::endl;
}
if (gpioComIF == nullptr) {
sif::error << "PlocMPSoCHandler: Invalid gpio communication interface" << std::endl;
}
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
}
@ -125,11 +121,11 @@ void PlocMPSoCHandler::doStartUp() {
#else
setMode(_MODE_TO_ON);
#endif
gpioComIF->pullHigh(uartIsolatorSwitch);
uartIsolatorSwitch.pullHigh();
}
void PlocMPSoCHandler::doShutDown() {
gpioComIF->pullLow(uartIsolatorSwitch);
uartIsolatorSwitch.pullLow();
setMode(_MODE_POWER_DOWN);
}

View File

@ -8,7 +8,7 @@
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
#include "fsfw_hal/linux/gpio/Gpio.h"
#include "linux/devices/devicedefinitions/MPSoCReturnValuesIF.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
@ -29,8 +29,7 @@
class PlocMPSoCHandler : public DeviceHandlerBase {
public:
PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
PlocMPSoCHelper* plocMPSoCHelper, LinuxLibgpioIF* gpioComIF,
gpioId_t uartIsolatorSwitch);
PlocMPSoCHelper* plocMPSoCHelper, Gpio uartIsolatorSwitch);
virtual ~PlocMPSoCHandler();
virtual ReturnValue_t initialize() override;
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
@ -99,8 +98,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
UartComIF* uartComIf = nullptr;
PlocMPSoCHelper* plocMPSoCHelper = nullptr;
LinuxLibgpioIF* gpioComIF = nullptr;
gpioId_t uartIsolatorSwitch = gpio::NO_GPIO;
Gpio uartIsolatorSwitch;
// Used to block incoming commands when MPSoC helper class is currently executing a command
bool plocMPSoCHelperExecuting = false;

View File

@ -12,10 +12,9 @@
#include "OBSWConfig.h"
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid,
CookieIF* comCookie, LinuxLibgpioIF* gpioComIF,
gpioId_t uartIsolatorSwitch)
CookieIF* comCookie,
Gpio uartIsolatorSwitch)
: DeviceHandlerBase(objectId, uartComIFid, comCookie),
gpioComIF(gpioComIF),
uartIsolatorSwitch(uartIsolatorSwitch),
hkset(this),
bootStatusReport(this),
@ -50,9 +49,13 @@ void PlocSupervisorHandler::doStartUp() {
#else
setMode(_MODE_TO_ON);
#endif
uartIsolatorSwitch.pullHigh();
}
void PlocSupervisorHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
void PlocSupervisorHandler::doShutDown() {
setMode(_MODE_POWER_DOWN);
uartIsolatorSwitch.pullLow();
}
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
return NOTHING_TO_SEND;

View File

@ -5,7 +5,8 @@
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
#include "inux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
#include "fsfw_hal/linux/gpio/Gpio.h"
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
#include "OBSWConfig.h"
@ -24,7 +25,7 @@
class PlocSupervisorHandler : public DeviceHandlerBase {
public:
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
LinuxLibgpioIF* gpioComIF, gpioId_t uartIsolatorSwitch);
Gpio uartIsolatorSwitch);
virtual ~PlocSupervisorHandler();
virtual ReturnValue_t initialize() override;
@ -115,7 +116,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
UartComIF* uartComIf = nullptr;
LinuxLibgpioIF* gpioComIF = nullptr;
gpioId_t uartIsolatorSwitch = gpio::NO_GPIO;
Gpio uartIsolatorSwitch;
PLOC_SPV::HkSet hkset;
PLOC_SPV::BootStatusReport bootStatusReport;