mpsoc startup command
This commit is contained in:
parent
25c3f39c82
commit
2dca9d598d
@ -190,9 +190,8 @@ void ObjectFactory::produce(void* args) {
|
|||||||
uart::STAR_TRACKER_BAUD, startracker::MAX_FRAME_SIZE * 2 + 2);
|
uart::STAR_TRACKER_BAUD, startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||||
starTrackerCookie->setNoFixedSizeReply();
|
starTrackerCookie->setNoFixedSizeReply();
|
||||||
StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
|
StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
|
||||||
StarTrackerHandler* starTrackerHandler = new StarTrackerHandler(
|
new StarTrackerHandler(objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, strHelper,
|
||||||
objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, strHelper);
|
pcduSwitches::PDU1_CH2_STAR_TRACKER_5V);
|
||||||
starTrackerHandler->setStartUpImmediately();
|
|
||||||
|
|
||||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||||
|
|
||||||
@ -797,7 +796,8 @@ void ObjectFactory::createSyrlinksComponents() {
|
|||||||
uart::SYRLINKS_BAUD, SYRLINKS::MAX_REPLY_SIZE);
|
uart::SYRLINKS_BAUD, SYRLINKS::MAX_REPLY_SIZE);
|
||||||
syrlinksUartCookie->setParityEven();
|
syrlinksUartCookie->setParityEven();
|
||||||
|
|
||||||
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie);
|
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
|
||||||
|
pcduSwitches::PDU1_CH1_SYRLINKS_12V);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createRtdComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher) {
|
void ObjectFactory::createRtdComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher) {
|
||||||
@ -925,10 +925,9 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
|
UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
|
||||||
mpsocCookie->setNoFixedSizeReply();
|
mpsocCookie->setNoFixedSizeReply();
|
||||||
auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
|
auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
|
||||||
auto plocMPSoC =
|
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie,
|
||||||
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie,
|
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF),
|
||||||
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF));
|
objects::PLOC_SUPERVISOR_HANDLER);
|
||||||
plocMPSoC->setStartUpImmediately();
|
|
||||||
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
||||||
|
|
||||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||||
@ -940,10 +939,11 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
gpioComIF->addGpios(supvGpioCookie);
|
gpioComIF->addGpios(supvGpioCookie);
|
||||||
auto supervisorCookie = new UartCookie(
|
auto supervisorCookie = new UartCookie(
|
||||||
objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL,
|
objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, UartModes::NON_CANONICAL,
|
||||||
uart::PLOC_SUPERVISOR_BAUD, PLOC_SPV::MAX_PACKET_SIZE * 20);
|
uart::PLOC_SUPERVISOR_BAUD, supv::MAX_PACKET_SIZE * 20);
|
||||||
supervisorCookie->setNoFixedSizeReply();
|
supervisorCookie->setNoFixedSizeReply();
|
||||||
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
|
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
|
||||||
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF));
|
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF),
|
||||||
|
pcduSwitches::PDU1_CH6_PLOC_12V);
|
||||||
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
||||||
static_cast<void>(consumer);
|
static_cast<void>(consumer);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@ class MPSoCReturnValuesIF {
|
|||||||
static const ReturnValue_t MPSOC_FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA7);
|
static const ReturnValue_t MPSOC_FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA7);
|
||||||
//! [EXPORT] : [COMMENT] Command has invalid parameter
|
//! [EXPORT] : [COMMENT] Command has invalid parameter
|
||||||
static const ReturnValue_t INVALID_PARAMETER = MAKE_RETURN_CODE(0xA8);
|
static const ReturnValue_t INVALID_PARAMETER = MAKE_RETURN_CODE(0xA8);
|
||||||
|
//! [EXPORT] : [COMMENT] Received command has file string with invalid length
|
||||||
|
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xA9);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MPSOC_RETURN_VALUES_IF_H_ */
|
#endif /* MPSOC_RETURN_VALUES_IF_H_ */
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <fsfw/timemanager/Clock.h>
|
#include <fsfw/timemanager/Clock.h>
|
||||||
#include <fsfw/tmtcpacket/SpacePacket.h>
|
#include <fsfw/tmtcpacket/SpacePacket.h>
|
||||||
|
|
||||||
namespace PLOC_SPV {
|
namespace supv {
|
||||||
|
|
||||||
/** Command IDs */
|
/** Command IDs */
|
||||||
static const DeviceCommandId_t NONE = 0;
|
static const DeviceCommandId_t NONE = 0;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "PlocMPSoCHandler.h"
|
#include "PlocMPSoCHandler.h"
|
||||||
|
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "fsfw/datapool/PoolReadGuard.h"
|
#include "fsfw/datapool/PoolReadGuard.h"
|
||||||
@ -6,14 +7,18 @@
|
|||||||
|
|
||||||
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,
|
||||||
Gpio uartIsolatorSwitch)
|
Gpio uartIsolatorSwitch, object_id_t supervisorHandler)
|
||||||
: DeviceHandlerBase(objectId, uartComIFid, comCookie),
|
: DeviceHandlerBase(objectId, uartComIFid, comCookie),
|
||||||
plocMPSoCHelper(plocMPSoCHelper),
|
plocMPSoCHelper(plocMPSoCHelper),
|
||||||
uartIsolatorSwitch(uartIsolatorSwitch) {
|
uartIsolatorSwitch(uartIsolatorSwitch),
|
||||||
|
supervisorHandler(supervisorHandler),
|
||||||
|
commandActionHelper(this) {
|
||||||
if (comCookie == nullptr) {
|
if (comCookie == nullptr) {
|
||||||
sif::error << "PlocMPSoCHandler: Invalid communication cookie" << std::endl;
|
sif::error << "PlocMPSoCHandler: Invalid communication cookie" << std::endl;
|
||||||
}
|
}
|
||||||
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||||
|
commandActionHelperQueue =
|
||||||
|
QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlocMPSoCHandler::~PlocMPSoCHandler() {}
|
PlocMPSoCHandler::~PlocMPSoCHandler() {}
|
||||||
@ -60,6 +65,10 @@ ReturnValue_t PlocMPSoCHandler::initialize() {
|
|||||||
}
|
}
|
||||||
plocMPSoCHelper->setComCookie(comCookie);
|
plocMPSoCHelper->setComCookie(comCookie);
|
||||||
plocMPSoCHelper->setSequenceCount(&sequenceCount);
|
plocMPSoCHelper->setSequenceCount(&sequenceCount);
|
||||||
|
result = commandActionHelper.initialize();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +86,14 @@ void PlocMPSoCHandler::performOperationHook() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CommandMessage message;
|
||||||
|
for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&event); result == RETURN_OK;
|
||||||
|
result = commandActionHelperQueue->receiveMessage(&event)) {
|
||||||
|
result = commandActionHelper.handleReply(&message);
|
||||||
|
if (result == RETURN_OK) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
@ -116,17 +133,34 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocMPSoCHandler::doStartUp() {
|
void PlocMPSoCHandler::doStartUp() {
|
||||||
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
switch(powerState) {
|
||||||
setMode(MODE_NORMAL);
|
case PowerState::OFF:
|
||||||
#else
|
commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC);
|
||||||
setMode(_MODE_TO_ON);
|
powerState = PowerState::BOOTING;
|
||||||
#endif
|
break;
|
||||||
uartIsolatorSwitch.pullHigh();
|
case PowerState::ON:
|
||||||
|
setMode(_MODE_TO_ON);
|
||||||
|
uartIsolatorSwitch.pullHigh();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMPSoCHandler::doShutDown() {
|
void PlocMPSoCHandler::doShutDown() {
|
||||||
uartIsolatorSwitch.pullLow();
|
switch(powerState) {
|
||||||
setMode(_MODE_POWER_DOWN);
|
case PowerState::ON:
|
||||||
|
uartIsolatorSwitch.pullLow();
|
||||||
|
commandActionHelper.commandAction(supervisorHandler, supv::SHUTDOWN_MPSOC);
|
||||||
|
powerState = PowerState::SHUTDOWN;
|
||||||
|
break;
|
||||||
|
case PowerState::OFF:
|
||||||
|
setMode(_MODE_POWER_DOWN);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sif::debug << "PlocMPSoCHandler::doShutDown: This should never happen" << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||||
@ -331,7 +365,7 @@ ReturnValue_t PlocMPSoCHandler::prepareTcMemRead(const uint8_t* commandData,
|
|||||||
ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData,
|
ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
if (commandDataLen > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
|
if (commandDataLen > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
|
||||||
return NAME_TOO_LONG;
|
return MPSoCReturnValuesIF::NAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
@ -670,6 +704,45 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
|||||||
return replyLen;
|
return replyLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageQueueIF* PlocMPSoCHandler::getCommandQueuePtr() {
|
||||||
|
return commandActionHelperQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMPSoCHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMPSoCHandler::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||||
|
ReturnValue_t returnCode) {
|
||||||
|
handleActionCommandFailure(actionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMPSoCHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMPSoCHandler::completionSuccessfulReceived(ActionId_t actionId) {
|
||||||
|
switch(actionId) {
|
||||||
|
case supv::START_MPSOC: {
|
||||||
|
powerState = PowerState::ON;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case supv::SHUTDOWN_MPSOC: {
|
||||||
|
powerState = PowerState::OFF;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sif::debug
|
||||||
|
<< "PlocMPSoCHandler::completionSuccessfulReceived: Did not expect this action reply"
|
||||||
|
<< std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocMPSoCHandler::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
||||||
|
handleActionCommandFailure(actionId);
|
||||||
|
}
|
||||||
|
|
||||||
void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
||||||
DeviceCommandId_t replyId) {
|
DeviceCommandId_t replyId) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
@ -764,3 +837,20 @@ void PlocMPSoCHandler::printStatus(const uint8_t* data) {
|
|||||||
uint16_t PlocMPSoCHandler::getStatus(const uint8_t* data) {
|
uint16_t PlocMPSoCHandler::getStatus(const uint8_t* data) {
|
||||||
return *(data + STATUS_OFFSET) << 8 | *(data + STATUS_OFFSET + 1);
|
return *(data + STATUS_OFFSET) << 8 | *(data + STATUS_OFFSET + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) {
|
||||||
|
switch (actionId) {
|
||||||
|
case supv::START_MPSOC:
|
||||||
|
powerState = PowerState::ON;
|
||||||
|
break;
|
||||||
|
case supv::SHUTDOWN_MPSOC:
|
||||||
|
triggerEvent(MPSOC_SHUTDOWN_FAILED);
|
||||||
|
// TODO: Setting state to on or off here?
|
||||||
|
powerState = PowerState::OFF;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sif::debug << "PlocMPSoCHandler::handleActionCommandFailure: Received unexpected action reply"
|
||||||
|
<< std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "PlocMPSoCHelper.h"
|
#include "PlocMPSoCHelper.h"
|
||||||
|
#include "fsfw/action/CommandActionHelper.h"
|
||||||
|
#include "fsfw/action/CommandsActionsIF.h"
|
||||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
|
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
|
||||||
@ -26,15 +28,33 @@
|
|||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
class PlocMPSoCHandler : public DeviceHandlerBase {
|
class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructor
|
||||||
|
*
|
||||||
|
* @param ojectId Object ID of the MPSoC handler
|
||||||
|
* @param uartcomIFid Object ID of the UART communication interface
|
||||||
|
* @param comCookie UART communication cookie
|
||||||
|
* @param plocMPSoCHelper Pointer to MPSoC helper object
|
||||||
|
* @param uartIsolatorSwitch Gpio object representing the GPIO connected to the UART isolator
|
||||||
|
* module in the programmable logic
|
||||||
|
* @param supervisorHandler Object ID of the supervisor handler
|
||||||
|
*/
|
||||||
PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
|
PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
|
||||||
PlocMPSoCHelper* plocMPSoCHelper, Gpio uartIsolatorSwitch);
|
PlocMPSoCHelper* plocMPSoCHelper, Gpio uartIsolatorSwitch,
|
||||||
|
object_id_t supervisorHandler);
|
||||||
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,
|
||||||
const uint8_t* data, size_t size) override;
|
const uint8_t* data, size_t size) override;
|
||||||
void performOperationHook() override;
|
void performOperationHook() override;
|
||||||
|
MessageQueueIF* getCommandQueuePtr() override;
|
||||||
|
void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) override;
|
||||||
|
void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) override;
|
||||||
|
void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) override;
|
||||||
|
void completionSuccessfulReceived(ActionId_t actionId) override;
|
||||||
|
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void doStartUp() override;
|
void doStartUp() override;
|
||||||
@ -74,15 +94,16 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
|
|||||||
//! [EXPORT] : [COMMENT] Packet sequence count in received space packet does not match expected
|
//! [EXPORT] : [COMMENT] Packet sequence count in received space packet does not match expected
|
||||||
//! count P1: Expected sequence count P2: Received sequence count
|
//! count P1: Expected sequence count P2: Received sequence count
|
||||||
static const Event MPSOC_HANDLER_SEQ_CNT_MISMATCH = MAKE_EVENT(5, severity::LOW);
|
static const Event MPSOC_HANDLER_SEQ_CNT_MISMATCH = MAKE_EVENT(5, severity::LOW);
|
||||||
|
//! [EXPORT] : [COMMENT] Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and
|
||||||
//! [EXPORT] : [COMMENT] Received command has file string with invalid length
|
//! thus also to shutdown the supervisor.
|
||||||
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xD0);
|
static const Event MPSOC_SHUTDOWN_FAILED = MAKE_EVENT(6, severity::HIGH);
|
||||||
|
|
||||||
static const uint16_t APID_MASK = 0x7FF;
|
static const uint16_t APID_MASK = 0x7FF;
|
||||||
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
||||||
static const uint8_t STATUS_OFFSET = 10;
|
static const uint8_t STATUS_OFFSET = 10;
|
||||||
|
|
||||||
MessageQueueIF* eventQueue = nullptr;
|
MessageQueueIF* eventQueue = nullptr;
|
||||||
|
MessageQueueIF* commandActionHelperQueue = nullptr;
|
||||||
|
|
||||||
SourceSequenceCounter sequenceCount;
|
SourceSequenceCounter sequenceCount;
|
||||||
|
|
||||||
@ -99,6 +120,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
|
|||||||
|
|
||||||
PlocMPSoCHelper* plocMPSoCHelper = nullptr;
|
PlocMPSoCHelper* plocMPSoCHelper = nullptr;
|
||||||
Gpio uartIsolatorSwitch;
|
Gpio uartIsolatorSwitch;
|
||||||
|
object_id_t supervisorHandler = 0;
|
||||||
|
CommandActionHelper commandActionHelper;
|
||||||
|
|
||||||
// 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;
|
||||||
@ -111,6 +134,10 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
|
|||||||
|
|
||||||
TmMemReadReport tmMemReadReport;
|
TmMemReadReport tmMemReadReport;
|
||||||
|
|
||||||
|
enum class PowerState { OFF, BOOTING, SHUTDOWN, ON };
|
||||||
|
|
||||||
|
PowerState powerState = PowerState::OFF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Handles events received from the PLOC MPSoC helper
|
* @brief Handles events received from the PLOC MPSoC helper
|
||||||
*/
|
*/
|
||||||
@ -212,6 +239,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
|
|||||||
ReturnValue_t prepareTcModeReplay();
|
ReturnValue_t prepareTcModeReplay();
|
||||||
|
|
||||||
uint16_t getStatus(const uint8_t* data);
|
uint16_t getStatus(const uint8_t* data);
|
||||||
|
|
||||||
|
void handleActionCommandFailure(ActionId_t actionId);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */
|
#endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */
|
||||||
|
@ -105,10 +105,10 @@ void PlocMemoryDumper::doStateMachine() {
|
|||||||
case State::IDLE:
|
case State::IDLE:
|
||||||
break;
|
break;
|
||||||
case State::COMMAND_FIRST_MRAM_DUMP:
|
case State::COMMAND_FIRST_MRAM_DUMP:
|
||||||
commandNextMramDump(PLOC_SPV::FIRST_MRAM_DUMP);
|
commandNextMramDump(supv::FIRST_MRAM_DUMP);
|
||||||
break;
|
break;
|
||||||
case State::COMMAND_CONSECUTIVE_MRAM_DUMP:
|
case State::COMMAND_CONSECUTIVE_MRAM_DUMP:
|
||||||
commandNextMramDump(PLOC_SPV::CONSECUTIVE_MRAM_DUMP);
|
commandNextMramDump(supv::CONSECUTIVE_MRAM_DUMP);
|
||||||
break;
|
break;
|
||||||
case State::EXECUTING_MRAM_DUMP:
|
case State::EXECUTING_MRAM_DUMP:
|
||||||
break;
|
break;
|
||||||
@ -127,8 +127,8 @@ void PlocMemoryDumper::dataReceived(ActionId_t actionId, const uint8_t* data, ui
|
|||||||
|
|
||||||
void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
case (PLOC_SPV::FIRST_MRAM_DUMP):
|
case (supv::FIRST_MRAM_DUMP):
|
||||||
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
case (supv::CONSECUTIVE_MRAM_DUMP):
|
||||||
if (mram.endAddress == mram.startAddress) {
|
if (mram.endAddress == mram.startAddress) {
|
||||||
triggerEvent(MRAM_DUMP_FINISHED);
|
triggerEvent(MRAM_DUMP_FINISHED);
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
@ -146,8 +146,8 @@ void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
|
|
||||||
void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
case (PLOC_SPV::FIRST_MRAM_DUMP):
|
case (supv::FIRST_MRAM_DUMP):
|
||||||
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
case (supv::CONSECUTIVE_MRAM_DUMP):
|
||||||
triggerEvent(MRAM_DUMP_FAILED, mram.lastStartAddress);
|
triggerEvent(MRAM_DUMP_FAILED, mram.lastStartAddress);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,7 @@
|
|||||||
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,
|
||||||
Gpio uartIsolatorSwitch);
|
Gpio uartIsolatorSwitch, power::Switch_t powerSwitch);
|
||||||
virtual ~PlocSupervisorHandler();
|
virtual ~PlocSupervisorHandler();
|
||||||
|
|
||||||
virtual ReturnValue_t initialize() override;
|
virtual ReturnValue_t initialize() override;
|
||||||
@ -105,24 +105,24 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
static const uint16_t APID_MASK = 0x7FF;
|
static const uint16_t APID_MASK = 0x7FF;
|
||||||
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
||||||
|
|
||||||
uint8_t commandBuffer[PLOC_SPV::MAX_COMMAND_SIZE];
|
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This variable is used to store the id of the next reply to receive. This is necessary
|
* This variable is used to store the id of the next reply to receive. This is necessary
|
||||||
* because the PLOC sends as reply to each command at least one acknowledgment and execution
|
* because the PLOC sends as reply to each command at least one acknowledgment and execution
|
||||||
* report.
|
* report.
|
||||||
*/
|
*/
|
||||||
DeviceCommandId_t nextReplyId = PLOC_SPV::NONE;
|
DeviceCommandId_t nextReplyId = supv::NONE;
|
||||||
|
|
||||||
UartComIF* uartComIf = nullptr;
|
UartComIF* uartComIf = nullptr;
|
||||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||||
Gpio uartIsolatorSwitch;
|
Gpio uartIsolatorSwitch;
|
||||||
|
|
||||||
PLOC_SPV::HkSet hkset;
|
supv::HkSet hkset;
|
||||||
PLOC_SPV::BootStatusReport bootStatusReport;
|
supv::BootStatusReport bootStatusReport;
|
||||||
PLOC_SPV::LatchupStatusReport latchupStatusReport;
|
supv::LatchupStatusReport latchupStatusReport;
|
||||||
|
|
||||||
const power::Switch_t powerSwitch = pcduSwitches::PDU1_CH6_PLOC_12V;
|
const power::Switch_t powerSwitch = power::NO_SWITCH;
|
||||||
|
|
||||||
/** Number of expected replies following the MRAM dump command */
|
/** Number of expected replies following the MRAM dump command */
|
||||||
uint32_t expectedMramDumpPackets = 0;
|
uint32_t expectedMramDumpPackets = 0;
|
||||||
@ -133,7 +133,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
uint16_t bufferTop = 0;
|
uint16_t bufferTop = 0;
|
||||||
|
|
||||||
/** This buffer is used to concatenate space packets received in two different read steps */
|
/** This buffer is used to concatenate space packets received in two different read steps */
|
||||||
uint8_t spacePacketBuffer[PLOC_SPV::MAX_PACKET_SIZE];
|
uint8_t spacePacketBuffer[supv::MAX_PACKET_SIZE];
|
||||||
|
|
||||||
#ifdef TE0720_1CFA
|
#ifdef TE0720_1CFA
|
||||||
SdCardManager* sdcMan = nullptr;
|
SdCardManager* sdcMan = nullptr;
|
||||||
|
@ -123,9 +123,6 @@ void PlocUpdater::readCommandQueue() {
|
|||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sif::debug << "PlocUpdater::readCommandQueue: Received message with invalid format"
|
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +142,6 @@ void PlocUpdater::doStateMachine() {
|
|||||||
case State::COMMAND_EXECUTING:
|
case State::COMMAND_EXECUTING:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sif::debug << "PlocUpdater::doStateMachine: Invalid state" << std::endl;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,10 +195,10 @@ void PlocUpdater::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_
|
|||||||
|
|
||||||
void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
case (PLOC_SPV::UPDATE_AVAILABLE):
|
case (supv::UPDATE_AVAILABLE):
|
||||||
state = State::UPDATE_TRANSFER;
|
state = State::UPDATE_TRANSFER;
|
||||||
break;
|
break;
|
||||||
case (PLOC_SPV::UPDATE_IMAGE_DATA):
|
case (supv::UPDATE_IMAGE_DATA):
|
||||||
if (remainingPackets == 0) {
|
if (remainingPackets == 0) {
|
||||||
packetsSent = 0; // Reset packets sent variable for next update sequence
|
packetsSent = 0; // Reset packets sent variable for next update sequence
|
||||||
state = State::UPDATE_VERIFY;
|
state = State::UPDATE_VERIFY;
|
||||||
@ -210,14 +206,12 @@ void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
state = State::UPDATE_TRANSFER;
|
state = State::UPDATE_TRANSFER;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case (PLOC_SPV::UPDATE_VERIFY):
|
case (supv::UPDATE_VERIFY):
|
||||||
triggerEvent(UPDATE_FINISHED);
|
triggerEvent(UPDATE_FINISHED);
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
pendingCommand = PLOC_SPV::NONE;
|
pendingCommand = supv::NONE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sif::debug << "PlocUpdater::completionSuccessfulReceived: Invalid pending command"
|
|
||||||
<< std::endl;
|
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -225,20 +219,19 @@ void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
|
|
||||||
void PlocUpdater::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
void PlocUpdater::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
case (PLOC_SPV::UPDATE_AVAILABLE): {
|
case (supv::UPDATE_AVAILABLE): {
|
||||||
triggerEvent(UPDATE_AVAILABLE_FAILED);
|
triggerEvent(UPDATE_AVAILABLE_FAILED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (PLOC_SPV::UPDATE_IMAGE_DATA): {
|
case (supv::UPDATE_IMAGE_DATA): {
|
||||||
triggerEvent(UPDATE_TRANSFER_FAILED, packetsSent);
|
triggerEvent(UPDATE_TRANSFER_FAILED, packetsSent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (PLOC_SPV::UPDATE_VERIFY): {
|
case (supv::UPDATE_VERIFY): {
|
||||||
triggerEvent(UPDATE_VERIFY_FAILED);
|
triggerEvent(UPDATE_VERIFY_FAILED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
sif::debug << "PlocUpdater::completionFailedReceived: Invalid pending command " << std::endl;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
@ -268,23 +261,23 @@ void PlocUpdater::commandUpdateAvailable() {
|
|||||||
|
|
||||||
calcImageCrc();
|
calcImageCrc();
|
||||||
|
|
||||||
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
|
supv::UpdateInfo packet(supv::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
|
||||||
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
||||||
numOfUpdatePackets);
|
numOfUpdatePackets);
|
||||||
|
|
||||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||||
PLOC_SPV::UPDATE_AVAILABLE, packet.getWholeData(),
|
supv::UPDATE_AVAILABLE, packet.getWholeData(),
|
||||||
packet.getFullSize());
|
packet.getFullSize());
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
||||||
<< " packet to supervisor handler" << std::endl;
|
<< " packet to supervisor handler" << std::endl;
|
||||||
triggerEvent(ACTION_COMMANDING_FAILED, result, PLOC_SPV::UPDATE_AVAILABLE);
|
triggerEvent(ACTION_COMMANDING_FAILED, result, supv::UPDATE_AVAILABLE);
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
pendingCommand = PLOC_SPV::NONE;
|
pendingCommand = supv::NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pendingCommand = PLOC_SPV::UPDATE_AVAILABLE;
|
pendingCommand = supv::UPDATE_AVAILABLE;
|
||||||
state = State::COMMAND_EXECUTING;
|
state = State::COMMAND_EXECUTING;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -308,56 +301,56 @@ void PlocUpdater::commandUpdatePacket() {
|
|||||||
payloadLength = MAX_SP_DATA;
|
payloadLength = MAX_SP_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
PLOC_SPV::UpdatePacket packet(payloadLength);
|
supv::UpdatePacket packet(payloadLength);
|
||||||
file.read(reinterpret_cast<char*>(packet.getDataFieldPointer()), payloadLength);
|
file.read(reinterpret_cast<char*>(packet.getDataFieldPointer()), payloadLength);
|
||||||
file.close();
|
file.close();
|
||||||
// sequence count of first packet is 1
|
// sequence count of first packet is 1
|
||||||
packet.setPacketSequenceCount((packetsSent + 1) & PLOC_SPV::SEQUENCE_COUNT_MASK);
|
packet.setPacketSequenceCount((packetsSent + 1) & supv::SEQUENCE_COUNT_MASK);
|
||||||
if (numOfUpdatePackets > 1) {
|
if (numOfUpdatePackets > 1) {
|
||||||
adjustSequenceFlags(packet);
|
adjustSequenceFlags(packet);
|
||||||
}
|
}
|
||||||
packet.makeCrc();
|
packet.makeCrc();
|
||||||
|
|
||||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||||
PLOC_SPV::UPDATE_IMAGE_DATA, packet.getWholeData(),
|
supv::UPDATE_IMAGE_DATA, packet.getWholeData(),
|
||||||
packet.getFullSize());
|
packet.getFullSize());
|
||||||
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update"
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update"
|
||||||
<< " packet to supervisor handler" << std::endl;
|
<< " packet to supervisor handler" << std::endl;
|
||||||
triggerEvent(ACTION_COMMANDING_FAILED, result, PLOC_SPV::UPDATE_IMAGE_DATA);
|
triggerEvent(ACTION_COMMANDING_FAILED, result, supv::UPDATE_IMAGE_DATA);
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
pendingCommand = PLOC_SPV::NONE;
|
pendingCommand = supv::NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
remainingPackets--;
|
remainingPackets--;
|
||||||
packetsSent++;
|
packetsSent++;
|
||||||
|
|
||||||
pendingCommand = PLOC_SPV::UPDATE_IMAGE_DATA;
|
pendingCommand = supv::UPDATE_IMAGE_DATA;
|
||||||
state = State::COMMAND_EXECUTING;
|
state = State::COMMAND_EXECUTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocUpdater::commandUpdateVerify() {
|
void PlocUpdater::commandUpdateVerify() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
|
supv::UpdateInfo packet(supv::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
|
||||||
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
||||||
numOfUpdatePackets);
|
numOfUpdatePackets);
|
||||||
|
|
||||||
result =
|
result =
|
||||||
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, PLOC_SPV::UPDATE_VERIFY,
|
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, supv::UPDATE_VERIFY,
|
||||||
packet.getWholeData(), packet.getFullSize());
|
packet.getWholeData(), packet.getFullSize());
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
||||||
<< " packet to supervisor handler" << std::endl;
|
<< " packet to supervisor handler" << std::endl;
|
||||||
triggerEvent(ACTION_COMMANDING_FAILED, result, PLOC_SPV::UPDATE_VERIFY);
|
triggerEvent(ACTION_COMMANDING_FAILED, result, supv::UPDATE_VERIFY);
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
pendingCommand = PLOC_SPV::NONE;
|
pendingCommand = supv::NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state = State::COMMAND_EXECUTING;
|
state = State::COMMAND_EXECUTING;
|
||||||
pendingCommand = PLOC_SPV::UPDATE_VERIFY;
|
pendingCommand = supv::UPDATE_VERIFY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,12 +377,12 @@ void PlocUpdater::calcImageCrc() {
|
|||||||
imageCrc = (remainder ^ FINAL_XOR_VALUE_32);
|
imageCrc = (remainder ^ FINAL_XOR_VALUE_32);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocUpdater::adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet) {
|
void PlocUpdater::adjustSequenceFlags(supv::UpdatePacket& packet) {
|
||||||
if (packetsSent == 0) {
|
if (packetsSent == 0) {
|
||||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT));
|
packet.setSequenceFlags(static_cast<uint8_t>(supv::SequenceFlags::FIRST_PKT));
|
||||||
} else if (remainingPackets == 1) {
|
} else if (remainingPackets == 1) {
|
||||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT));
|
packet.setSequenceFlags(static_cast<uint8_t>(supv::SequenceFlags::LAST_PKT));
|
||||||
} else {
|
} else {
|
||||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::CONTINUED_PKT));
|
packet.setSequenceFlags(static_cast<uint8_t>(supv::SequenceFlags::CONTINUED_PKT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* packets and sent to the PlocSupervisorHandler.
|
* packets and sent to the PlocSupervisorHandler.
|
||||||
*
|
*
|
||||||
* @details The MPSoC has two boot memories (NVM0 and NVM1) where each stores two images (Partition
|
* @details The MPSoC has two boot memories (NVM0 and NVM1) where each stores two images (Partition
|
||||||
* A and Partition B)
|
* A and Partition B)
|
||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
@ -122,7 +122,7 @@ class PlocUpdater : public SystemObject,
|
|||||||
|
|
||||||
State state = State::IDLE;
|
State state = State::IDLE;
|
||||||
|
|
||||||
ActionId_t pendingCommand = PLOC_SPV::NONE;
|
ActionId_t pendingCommand = supv::NONE;
|
||||||
|
|
||||||
enum class Image : uint8_t { NONE, A, B };
|
enum class Image : uint8_t { NONE, A, B };
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ class PlocUpdater : public SystemObject,
|
|||||||
|
|
||||||
void calcImageCrc();
|
void calcImageCrc();
|
||||||
|
|
||||||
void adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet);
|
void adjustSequenceFlags(supv::UpdatePacket& packet);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_PLOCUPDATER_H_ */
|
#endif /* MISSION_DEVICES_PLOCUPDATER_H_ */
|
||||||
|
@ -15,7 +15,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
||||||
StrHelper* strHelper)
|
StrHelper* strHelper, power::Switch_t powerSwitch)
|
||||||
: DeviceHandlerBase(objectId, comIF, comCookie),
|
: DeviceHandlerBase(objectId, comIF, comCookie),
|
||||||
temperatureSet(this),
|
temperatureSet(this),
|
||||||
versionSet(this),
|
versionSet(this),
|
||||||
@ -39,7 +39,8 @@ StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF,
|
|||||||
subscriptionSet(this),
|
subscriptionSet(this),
|
||||||
logSubscriptionSet(this),
|
logSubscriptionSet(this),
|
||||||
debugCameraSet(this),
|
debugCameraSet(this),
|
||||||
strHelper(strHelper) {
|
strHelper(strHelper),
|
||||||
|
powerSwitch(powerSwitch) {
|
||||||
if (comCookie == nullptr) {
|
if (comCookie == nullptr) {
|
||||||
sif::error << "StarTrackerHandler: Invalid com cookie" << std::endl;
|
sif::error << "StarTrackerHandler: Invalid com cookie" << std::endl;
|
||||||
}
|
}
|
||||||
@ -1223,8 +1224,10 @@ ReturnValue_t StarTrackerHandler::doSendReadHook() {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::getSwitches(const uint8_t** switches,
|
ReturnValue_t StarTrackerHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
|
||||||
uint8_t* numberOfSwitches) {
|
if (powerSwitch == power::NO_SWITCH) {
|
||||||
|
return DeviceHandlerBase::NO_SWITCH;
|
||||||
|
}
|
||||||
*numberOfSwitches = 1;
|
*numberOfSwitches = 1;
|
||||||
*switches = &powerSwitch;
|
*switches = &powerSwitch;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
|
@ -35,7 +35,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
|||||||
* to high to enable the device.
|
* to high to enable the device.
|
||||||
*/
|
*/
|
||||||
StarTrackerHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
StarTrackerHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
||||||
StrHelper* strHelper);
|
StrHelper* strHelper, power::Switch_t powerSwitch);
|
||||||
virtual ~StarTrackerHandler();
|
virtual ~StarTrackerHandler();
|
||||||
|
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
@ -163,14 +163,12 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
|||||||
static const uint32_t BOOT_TIMEOUT = 1000;
|
static const uint32_t BOOT_TIMEOUT = 1000;
|
||||||
static const uint32_t DEFAULT_TRANSITION_DELAY = 15000;
|
static const uint32_t DEFAULT_TRANSITION_DELAY = 15000;
|
||||||
|
|
||||||
class FlashReadCmd {
|
struct FlashReadCmd {
|
||||||
public:
|
|
||||||
// Minimum length of a read command (region, length and filename)
|
// Minimum length of a read command (region, length and filename)
|
||||||
static const size_t MIN_LENGTH = 7;
|
static const size_t MIN_LENGTH = 7;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ChecksumCmd {
|
struct ChecksumCmd {
|
||||||
public:
|
|
||||||
static const uint8_t ADDRESS_OFFSET = 1;
|
static const uint8_t ADDRESS_OFFSET = 1;
|
||||||
static const uint8_t LENGTH_OFFSET = 5;
|
static const uint8_t LENGTH_OFFSET = 5;
|
||||||
// Length of checksum command
|
// Length of checksum command
|
||||||
@ -270,7 +268,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
|||||||
|
|
||||||
bool strHelperExecuting = false;
|
bool strHelperExecuting = false;
|
||||||
|
|
||||||
const power::Switch_t powerSwitch = pcduSwitches::PDU1_CH2_STAR_TRACKER_5V;
|
const power::Switch_t powerSwitch = power::NO_SWITCH;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Handles internal state
|
* @brief Handles internal state
|
||||||
|
@ -4,8 +4,12 @@
|
|||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
|
|
||||||
SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie)
|
SyrlinksHkHandler::SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
||||||
: DeviceHandlerBase(objectId, comIF, comCookie), rxDataset(this), txDataset(this) {
|
power::Switch_t powerSwitch)
|
||||||
|
: DeviceHandlerBase(objectId, comIF, comCookie),
|
||||||
|
rxDataset(this),
|
||||||
|
txDataset(this),
|
||||||
|
powerSwitch(powerSwitch) {
|
||||||
if (comCookie == NULL) {
|
if (comCookie == NULL) {
|
||||||
sif::error << "SyrlinksHkHandler: Invalid com cookie" << std::endl;
|
sif::error << "SyrlinksHkHandler: Invalid com cookie" << std::endl;
|
||||||
}
|
}
|
||||||
@ -146,6 +150,22 @@ void SyrlinksHkHandler::fillCommandAndReplyMap() {
|
|||||||
SYRLINKS::RX_STATUS_REGISTERS_REPLY_SIZE);
|
SYRLINKS::RX_STATUS_REGISTERS_REPLY_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ReturnValue_t SyrlinksHkHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
||||||
|
// uint8_t expectedReplies, bool useAlternateId,
|
||||||
|
// DeviceCommandId_t alternateReplyID) {
|
||||||
|
// switch (command->first) {
|
||||||
|
// case SYRLINKS::RESET_UNIT: {
|
||||||
|
// case SYRLINKS::SET_TX_MODE_STANDBY:
|
||||||
|
// case SYRLINKS::SET_TX_MODE_MODULATION:
|
||||||
|
// case SYRLINKS::SET_TX_MODE_CW:
|
||||||
|
// return DeviceHandlerBase::enableReplyInReplyMap(command, 1, true, SYRLINKS::ACK_REPLY);
|
||||||
|
// }
|
||||||
|
// default:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// return DeviceHandlerBase::enableReplyInReplyMap(command);
|
||||||
|
//}
|
||||||
|
|
||||||
ReturnValue_t SyrlinksHkHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
ReturnValue_t SyrlinksHkHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
@ -177,6 +197,15 @@ ReturnValue_t SyrlinksHkHandler::scanForReply(const uint8_t* start, size_t remai
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t SyrlinksHkHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
|
||||||
|
if (powerSwitch == power::NO_SWITCH) {
|
||||||
|
return DeviceHandlerBase::NO_SWITCH;
|
||||||
|
}
|
||||||
|
*numberOfSwitches = 1;
|
||||||
|
*switches = &powerSwitch;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
|
ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
|
|
||||||
@ -184,7 +213,7 @@ ReturnValue_t SyrlinksHkHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
case (SYRLINKS::ACK_REPLY):
|
case (SYRLINKS::ACK_REPLY):
|
||||||
result = verifyReply(packet, SYRLINKS::ACK_SIZE);
|
result = verifyReply(packet, SYRLINKS::ACK_SIZE);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::error << "SyrlinksHkHandler::interpretDeviceReply: Acknowledgement reply has "
|
sif::error << "SyrlinksHkHandler::interpretDeviceReply: Acknowledgment reply has "
|
||||||
"invalid crc"
|
"invalid crc"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return CRC_FAILURE;
|
return CRC_FAILURE;
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#ifndef MISSION_DEVICES_SYRLINKSHKHANDLER_H_
|
#ifndef MISSION_DEVICES_SYRLINKSHKHANDLER_H_
|
||||||
#define MISSION_DEVICES_SYRLINKSHKHANDLER_H_
|
#define MISSION_DEVICES_SYRLINKSHKHANDLER_H_
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
#include "devices/powerSwitcherList.h"
|
||||||
#include <mission/devices/devicedefinitions/SyrlinksDefinitions.h>
|
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||||
|
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,7 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
class SyrlinksHkHandler : public DeviceHandlerBase {
|
class SyrlinksHkHandler : public DeviceHandlerBase {
|
||||||
public:
|
public:
|
||||||
SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie);
|
SyrlinksHkHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
||||||
|
power::Switch_t powerSwitch);
|
||||||
virtual ~SyrlinksHkHandler();
|
virtual ~SyrlinksHkHandler();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,12 +30,16 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
|
|||||||
void doShutDown() override;
|
void doShutDown() override;
|
||||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
void fillCommandAndReplyMap() override;
|
|
||||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
||||||
size_t commandDataLen) override;
|
size_t commandDataLen) override;
|
||||||
|
void fillCommandAndReplyMap() override;
|
||||||
|
// ReturnValue_t enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
||||||
|
// uint8_t expectedReplies = 1, bool useAlternateId = false,
|
||||||
|
// DeviceCommandId_t alternateReplyID = 0) override;
|
||||||
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||||
size_t* foundLen) override;
|
size_t* foundLen) override;
|
||||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||||
|
ReturnValue_t getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) override;
|
||||||
void setNormalDatapoolEntriesInvalid() override;
|
void setNormalDatapoolEntriesInvalid() override;
|
||||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
@ -75,6 +81,8 @@ class SyrlinksHkHandler : public DeviceHandlerBase {
|
|||||||
SYRLINKS::RxDataset rxDataset;
|
SYRLINKS::RxDataset rxDataset;
|
||||||
SYRLINKS::TxDataset txDataset;
|
SYRLINKS::TxDataset txDataset;
|
||||||
|
|
||||||
|
const power::Switch_t powerSwitch = power::NO_SWITCH;
|
||||||
|
|
||||||
uint8_t agcValueHighByte;
|
uint8_t agcValueHighByte;
|
||||||
|
|
||||||
uint8_t commandBuffer[SYRLINKS::MAX_COMMAND_SIZE];
|
uint8_t commandBuffer[SYRLINKS::MAX_COMMAND_SIZE];
|
||||||
|
Loading…
Reference in New Issue
Block a user