adding uart isolator switches wip

This commit is contained in:
Jakob Meier 2022-03-27 14:42:20 +02:00
parent 6d04c278c3
commit e2c9bece05
5 changed files with 40 additions and 17 deletions

View File

@ -185,8 +185,9 @@ void ObjectFactory::produce(void* args) {
new UartCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV,
UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler(
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, plocMpsocCookie, plocMpsocHelper);
PlocMPSoCHandler* plocMPSoCHandler =
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, plocMpsocCookie,
plocMpsocHelper, gpioComIF);
plocMPSoCHandler->setStartUpImmediately();
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */

View File

@ -5,10 +5,17 @@
#include "fsfw/globalfunctions/CRC.h"
PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid,
CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper)
: DeviceHandlerBase(objectId, uartComIFid, comCookie), plocMPSoCHelper(plocMPSoCHelper) {
if (comCookie == NULL) {
sif::error << "PlocMPSoCHandler: Invalid com cookie" << std::endl;
CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper,
LinuxLibgpioIF* gpioComIF, gpioId_t 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);
}
@ -118,9 +125,13 @@ void PlocMPSoCHandler::doStartUp() {
#else
setMode(_MODE_TO_ON);
#endif
gpioComIF->pullHigh(uartIsolatorSwitch);
}
void PlocMPSoCHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
void PlocMPSoCHandler::doShutDown() {
gpioComIF->pullLow(uartIsolatorSwitch);
setMode(_MODE_POWER_DOWN);
}
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
return NOTHING_TO_SEND;

View File

@ -8,27 +8,29 @@
#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 "linux/devices/devicedefinitions/MPSoCReturnValuesIF.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
/**
* @brief This is the device handler for the MPSoC of the payload computer.
*
* @details The PLOC uses the space packet protocol for communication. On each command the PLOC
* answers with at least one acknowledgment and one execution report.
* @details The PLOC uses the space packet protocol for communication. Each command will be
* answered with at least one acknowledgment and one execution report.
* Flight manual:
* https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/PLOC_MPSoC ICD:
* https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_TAS-ILH-IRS/ICD-PLOC/ILH&fileid=1030263
*
* @note The sequence count in the space packets must be incremented with each received and sent
* packet.
* packet otherwise the MPSoC will reply with an acknowledgment failure report.
*
* @author J. Meier
*/
class PlocMPSoCHandler : public DeviceHandlerBase {
public:
PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
PlocMPSoCHelper* plocMPSoCHelper);
PlocMPSoCHelper* plocMPSoCHelper, LinuxLibgpioIF* gpioComIF,
gpioId_t uartIsolatorSwitch);
virtual ~PlocMPSoCHandler();
virtual ReturnValue_t initialize() override;
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
@ -97,6 +99,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
UartComIF* uartComIf = nullptr;
PlocMPSoCHelper* plocMPSoCHelper = nullptr;
LinuxLibgpioIF* gpioComIF = nullptr;
gpioId_t uartIsolatorSwitch = gpio::NO_GPIO;
// Used to block incoming commands when MPSoC helper class is currently executing a command
bool plocMPSoCHelperExecuting = false;

View File

@ -12,8 +12,11 @@
#include "OBSWConfig.h"
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid,
CookieIF* comCookie)
CookieIF* comCookie, LinuxLibgpioIF* gpioComIF,
gpioId_t uartIsolatorSwitch)
: DeviceHandlerBase(objectId, uartComIFid, comCookie),
gpioComIF(gpioComIF),
uartIsolatorSwitch(uartIsolatorSwitch),
hkset(this),
bootStatusReport(this),
latchupStatusReport(this) {

View File

@ -1,10 +1,11 @@
#ifndef MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
#define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
#include <bsp_q7s/memory/SdCardManager.h>
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <fsfw_hal/linux/uart/UartComIF.h>
#include <linux/devices/devicedefinitions/PlocSupervisorDefinitions.h>
#include "bsp_q7s/memory/SdCardManager.h"
#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 "OBSWConfig.h"
@ -22,7 +23,8 @@
*/
class PlocSupervisorHandler : public DeviceHandlerBase {
public:
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie);
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
LinuxLibgpioIF* gpioComIF, gpioId_t uartIsolatorSwitch);
virtual ~PlocSupervisorHandler();
virtual ReturnValue_t initialize() override;
@ -112,6 +114,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
DeviceCommandId_t nextReplyId = PLOC_SPV::NONE;
UartComIF* uartComIf = nullptr;
LinuxLibgpioIF* gpioComIF = nullptr;
gpioId_t uartIsolatorSwitch = gpio::NO_GPIO;
PLOC_SPV::HkSet hkset;
PLOC_SPV::BootStatusReport bootStatusReport;