mpsoc startup command

This commit is contained in:
Jakob Meier
2022-03-30 09:19:30 +02:00
parent 25c3f39c82
commit 2dca9d598d
14 changed files with 571 additions and 414 deletions

View File

@ -4,6 +4,8 @@
#include <string>
#include "PlocMPSoCHelper.h"
#include "fsfw/action/CommandActionHelper.h"
#include "fsfw/action/CommandsActionsIF.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
@ -26,15 +28,33 @@
*
* @author J. Meier
*/
class PlocMPSoCHandler : public DeviceHandlerBase {
class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
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,
PlocMPSoCHelper* plocMPSoCHelper, Gpio uartIsolatorSwitch);
PlocMPSoCHelper* plocMPSoCHelper, Gpio uartIsolatorSwitch,
object_id_t supervisorHandler);
virtual ~PlocMPSoCHandler();
virtual ReturnValue_t initialize() override;
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) 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:
void doStartUp() override;
@ -74,15 +94,16 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
//! [EXPORT] : [COMMENT] Packet sequence count in received space packet does not match expected
//! count P1: Expected sequence count P2: Received sequence count
static const Event MPSOC_HANDLER_SEQ_CNT_MISMATCH = MAKE_EVENT(5, severity::LOW);
//! [EXPORT] : [COMMENT] Received command has file string with invalid length
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xD0);
//! [EXPORT] : [COMMENT] Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and
//! thus also to shutdown the supervisor.
static const Event MPSOC_SHUTDOWN_FAILED = MAKE_EVENT(6, severity::HIGH);
static const uint16_t APID_MASK = 0x7FF;
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
static const uint8_t STATUS_OFFSET = 10;
MessageQueueIF* eventQueue = nullptr;
MessageQueueIF* commandActionHelperQueue = nullptr;
SourceSequenceCounter sequenceCount;
@ -99,6 +120,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
PlocMPSoCHelper* plocMPSoCHelper = nullptr;
Gpio uartIsolatorSwitch;
object_id_t supervisorHandler = 0;
CommandActionHelper commandActionHelper;
// Used to block incoming commands when MPSoC helper class is currently executing a command
bool plocMPSoCHelperExecuting = false;
@ -111,6 +134,10 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
TmMemReadReport tmMemReadReport;
enum class PowerState { OFF, BOOTING, SHUTDOWN, ON };
PowerState powerState = PowerState::OFF;
/**
* @brief Handles events received from the PLOC MPSoC helper
*/
@ -212,6 +239,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase {
ReturnValue_t prepareTcModeReplay();
uint16_t getStatus(const uint8_t* data);
void handleActionCommandFailure(ActionId_t actionId);
};
#endif /* BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_ */