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, new UartCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV,
UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE); UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER); PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler( PlocMPSoCHandler* plocMPSoCHandler =
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, plocMpsocCookie, plocMpsocHelper); new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, plocMpsocCookie,
plocMpsocHelper, gpioComIF);
plocMPSoCHandler->setStartUpImmediately(); plocMPSoCHandler->setStartUpImmediately();
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */ #endif /* OBSW_ADD_PLOC_MPSOC == 1 */

View File

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

View File

@ -8,27 +8,29 @@
#include "fsfw/ipc/QueueFactory.h" #include "fsfw/ipc/QueueFactory.h"
#include "fsfw/tmtcservices/SourceSequenceCounter.h" #include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "fsfw_hal/linux/uart/UartComIF.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/MPSoCReturnValuesIF.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h" #include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
/** /**
* @brief This is the device handler for the MPSoC of the payload computer. * @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 * @details The PLOC uses the space packet protocol for communication. Each command will be
* answers with at least one acknowledgment and one execution report. * answered with at least one acknowledgment and one execution report.
* Flight manual: * Flight manual:
* https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/PLOC_MPSoC ICD: * 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 * 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 * @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 * @author J. Meier
*/ */
class PlocMPSoCHandler : public DeviceHandlerBase { class PlocMPSoCHandler : public DeviceHandlerBase {
public: public:
PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie, PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
PlocMPSoCHelper* plocMPSoCHelper); PlocMPSoCHelper* plocMPSoCHelper, LinuxLibgpioIF* gpioComIF,
gpioId_t uartIsolatorSwitch);
virtual ~PlocMPSoCHandler(); virtual ~PlocMPSoCHandler();
virtual ReturnValue_t initialize() override; virtual ReturnValue_t initialize() override;
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
@ -97,6 +99,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
UartComIF* uartComIf = nullptr; UartComIF* uartComIf = nullptr;
PlocMPSoCHelper* plocMPSoCHelper = 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 // Used to block incoming commands when MPSoC helper class is currently executing a command
bool plocMPSoCHelperExecuting = false; bool plocMPSoCHelperExecuting = false;

View File

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

View File

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