v1.10.0 #220
@ -3,8 +3,8 @@
|
||||
#include "InitMission.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include "OBSWVersion.h"
|
||||
#include "fsfw/version.h"
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
#include "fsfw/version.h"
|
||||
|
||||
/**
|
||||
* @brief This is the main program entry point for the egse (raspberry pi 4)
|
||||
|
@ -19,12 +19,6 @@
|
||||
#include "bsp_q7s/callbacks/pcduSwitchCb.h"
|
||||
#include "bsp_q7s/callbacks/rwSpiCallback.h"
|
||||
#include "bsp_q7s/core/CoreController.h"
|
||||
#include "linux/devices/ploc/PlocMemoryDumper.h"
|
||||
#include "linux/devices/ploc/PlocSupervisorHandler.h"
|
||||
#include "linux/devices/ploc/PlocUpdater.h"
|
||||
#include "linux/devices/ploc/PlocMPSoCHandler.h"
|
||||
#include "linux/devices/ploc/PlocMPSoCHelper.h"
|
||||
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
||||
#include "bsp_q7s/memory/FileSystemHandler.h"
|
||||
#include "busConf.h"
|
||||
#include "ccsdsConfig.h"
|
||||
@ -38,7 +32,13 @@
|
||||
#include "linux/csp/CspComIF.h"
|
||||
#include "linux/csp/CspCookie.h"
|
||||
#include "linux/devices/GPSHyperionLinuxController.h"
|
||||
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||
#include "linux/devices/ploc/PlocMPSoCHandler.h"
|
||||
#include "linux/devices/ploc/PlocMPSoCHelper.h"
|
||||
#include "linux/devices/ploc/PlocMemoryDumper.h"
|
||||
#include "linux/devices/ploc/PlocSupervisorHandler.h"
|
||||
#include "linux/devices/ploc/PlocUpdater.h"
|
||||
#include "linux/devices/startracker/StarTrackerHandler.h"
|
||||
#include "linux/devices/startracker/StrHelper.h"
|
||||
#include "tmtc/apid.h"
|
||||
@ -181,12 +181,12 @@ void ObjectFactory::produce(void* args) {
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_PLOC_MPSOC == 1
|
||||
UartCookie* plocMpsocCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER,
|
||||
q7s::UART_PLOC_MPSOC_DEV, UartModes::NON_CANONICAL, uart::PLOC_MPSOC_BAUD,
|
||||
mpsoc::MAX_REPLY_SIZE);
|
||||
UartCookie* plocMpsocCookie =
|
||||
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);
|
||||
plocMPSoCHandler->setStartUpImmediately();
|
||||
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include "FilesystemHelper.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
#include "bsp_q7s/memory/SdCardManager.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
FilesystemHelper::FilesystemHelper() {
|
||||
}
|
||||
FilesystemHelper::FilesystemHelper() {}
|
||||
|
||||
FilesystemHelper::~FilesystemHelper() {
|
||||
}
|
||||
FilesystemHelper::~FilesystemHelper() {}
|
||||
|
||||
ReturnValue_t FilesystemHelper::checkPath(std::string path) {
|
||||
SdCardManager* sdcMan = SdCardManager::instance();
|
||||
@ -16,14 +16,14 @@ ReturnValue_t FilesystemHelper::checkPath(std::string path) {
|
||||
sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
if (path.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT))
|
||||
== std::string(SdCardManager::SD_0_MOUNT_POINT)) {
|
||||
if (path.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT)) ==
|
||||
std::string(SdCardManager::SD_0_MOUNT_POINT)) {
|
||||
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
|
||||
sif::warning << "FilesystemHelper::checkPath: SD card 0 not mounted" << std::endl;
|
||||
return SD_NOT_MOUNTED;
|
||||
}
|
||||
} else if (path.substr(0, sizeof(SdCardManager::SD_1_MOUNT_POINT))
|
||||
== std::string(SdCardManager::SD_1_MOUNT_POINT)) {
|
||||
} else if (path.substr(0, sizeof(SdCardManager::SD_1_MOUNT_POINT)) ==
|
||||
std::string(SdCardManager::SD_1_MOUNT_POINT)) {
|
||||
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
|
||||
sif::warning << "FilesystemHelper::checkPath: SD card 1 not mounted" << std::endl;
|
||||
return SD_NOT_MOUNTED;
|
||||
|
@ -2,8 +2,9 @@
|
||||
#define BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_
|
||||
|
||||
#include <string>
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
#include "commonClassIds.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
/**
|
||||
* @brief This class implements often used functions concerning the file system management.
|
||||
@ -11,8 +12,7 @@
|
||||
* @author J. Meier
|
||||
*/
|
||||
class FilesystemHelper : public HasReturnvaluesIF {
|
||||
public:
|
||||
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::FILE_SYSTEM_HELPER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] SD card specified with path string not mounted
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
class MPSoCReturnValuesIF {
|
||||
public:
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::MPSOC_RETURN_VALUES_IF;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Space Packet received from PLOC has invalid CRC
|
||||
|
@ -1,13 +1,12 @@
|
||||
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_
|
||||
#define MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_
|
||||
|
||||
#include "MPSoCReturnValuesIF.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include "eive/definitions.h"
|
||||
#include "fsfw/globalfunctions/CRC.h"
|
||||
#include "fsfw/serialize/SerializeAdapter.h"
|
||||
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||
#include "eive/definitions.h"
|
||||
|
||||
#include "MPSoCReturnValuesIF.h"
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
namespace mpsoc {
|
||||
|
||||
|
@ -2,31 +2,32 @@
|
||||
#define BSP_Q7S_DEVICES_PLOC_PLOCMPSOCHANDLER_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "PlocMPSoCHelper.h"
|
||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||
#include "fsfw/ipc/QueueFactory.h"
|
||||
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
|
||||
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
||||
#include "PlocMPSoCHelper.h"
|
||||
#include "fsfw_hal/linux/uart/UartComIF.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.
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* @author J. Meier
|
||||
*/
|
||||
class PlocMPSoCHandler: public DeviceHandlerBase {
|
||||
public:
|
||||
|
||||
PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF * comCookie,
|
||||
class PlocMPSoCHandler : public DeviceHandlerBase {
|
||||
public:
|
||||
PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
|
||||
PlocMPSoCHelper* plocMPSoCHelper);
|
||||
virtual ~PlocMPSoCHandler();
|
||||
virtual ReturnValue_t initialize() override;
|
||||
@ -34,18 +35,17 @@ public:
|
||||
const uint8_t* data, size_t size) override;
|
||||
void performOperationHook() override;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void doStartUp() override;
|
||||
void doShutDown() override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t * id) override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
||||
void fillCommandAndReplyMap() override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t * commandData,size_t commandDataLen) override;
|
||||
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize,
|
||||
DeviceCommandId_t *foundId, size_t *foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t *packet) override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
||||
size_t commandDataLen) override;
|
||||
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||
size_t* foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||
void setNormalDatapoolEntriesInvalid() override;
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
@ -55,8 +55,7 @@ protected:
|
||||
DeviceCommandId_t alternateReplyID = 0) override;
|
||||
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HANDLER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] PLOC crc failure in telemetry packet
|
||||
@ -71,9 +70,8 @@ private:
|
||||
static const Event EXE_FAILURE = MAKE_EVENT(3, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] PLOC reply has invalid crc
|
||||
static const Event MPSOC_HANDLER_CRC_FAILURE = MAKE_EVENT(4, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Packet sequence count in received space packet does not match expected count
|
||||
//! P1: Expected sequence count
|
||||
//! P2: Received sequence count
|
||||
//! [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
|
||||
@ -116,14 +114,14 @@ private:
|
||||
*/
|
||||
void handleEvent(EventMessage* eventMessage);
|
||||
|
||||
ReturnValue_t prepareTcMemWrite(const uint8_t * commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcMemRead(const uint8_t * commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcFlashDelete(const uint8_t * commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcReplayStart(const uint8_t * commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcMemWrite(const uint8_t* commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcMemRead(const uint8_t* commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcFlashDelete(const uint8_t* commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcReplayStart(const uint8_t* commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcReplayStop();
|
||||
ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t * commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcDownlinkPwrOff();
|
||||
ReturnValue_t prepareTcReplayWriteSequence(const uint8_t * commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen);
|
||||
|
||||
/**
|
||||
* @brief Copies space packet into command buffer
|
||||
|
@ -1,24 +1,28 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include "PlocSupervisorHandler.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include <fsfw/globalfunctions/CRC.h>
|
||||
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw/globalfunctions/CRC.h>
|
||||
#include <fsfw/timemanager/Clock.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid,
|
||||
CookieIF * comCookie) :
|
||||
DeviceHandlerBase(objectId, uartComIFid, comCookie), hkset(this), bootStatusReport(this), latchupStatusReport(
|
||||
this) {
|
||||
CookieIF* comCookie)
|
||||
: DeviceHandlerBase(objectId, uartComIFid, comCookie),
|
||||
hkset(this),
|
||||
bootStatusReport(this),
|
||||
latchupStatusReport(this) {
|
||||
if (comCookie == NULL) {
|
||||
sif::error << "PlocSupervisorHandler: Invalid com cookie" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
PlocSupervisorHandler::~PlocSupervisorHandler() {
|
||||
}
|
||||
PlocSupervisorHandler::~PlocSupervisorHandler() {}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::initialize() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
@ -37,8 +41,7 @@ ReturnValue_t PlocSupervisorHandler::initialize() {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void PlocSupervisorHandler::doStartUp(){
|
||||
void PlocSupervisorHandler::doStartUp() {
|
||||
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
||||
setMode(MODE_NORMAL);
|
||||
#else
|
||||
@ -46,210 +49,206 @@ void PlocSupervisorHandler::doStartUp(){
|
||||
#endif
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::doShutDown(){
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
}
|
||||
void PlocSupervisorHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(
|
||||
DeviceCommandId_t * id) {
|
||||
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::buildTransitionDeviceCommand(
|
||||
DeviceCommandId_t * id){
|
||||
ReturnValue_t PlocSupervisorHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(
|
||||
DeviceCommandId_t deviceCommand, const uint8_t * commandData,
|
||||
ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
ReturnValue_t result = RETURN_FAILED;
|
||||
switch(deviceCommand) {
|
||||
case(PLOC_SPV::GET_HK_REPORT): {
|
||||
switch (deviceCommand) {
|
||||
case (PLOC_SPV::GET_HK_REPORT): {
|
||||
prepareEmptyCmd(PLOC_SPV::APID_GET_HK_REPORT);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::RESTART_MPSOC): {
|
||||
case (PLOC_SPV::RESTART_MPSOC): {
|
||||
prepareEmptyCmd(PLOC_SPV::APID_RESTART_MPSOC);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::START_MPSOC): {
|
||||
case (PLOC_SPV::START_MPSOC): {
|
||||
prepareEmptyCmd(PLOC_SPV::APID_START_MPSOC);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SHUTDOWN_MPSOC): {
|
||||
case (PLOC_SPV::SHUTDOWN_MPSOC): {
|
||||
prepareEmptyCmd(PLOC_SPV::APID_SHUTWOWN_MPSOC);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SEL_MPSOC_BOOT_IMAGE): {
|
||||
case (PLOC_SPV::SEL_MPSOC_BOOT_IMAGE): {
|
||||
prepareSelBootImageCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::RESET_MPSOC): {
|
||||
case (PLOC_SPV::RESET_MPSOC): {
|
||||
prepareEmptyCmd(PLOC_SPV::APID_RESET_MPSOC);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SET_TIME_REF): {
|
||||
case (PLOC_SPV::SET_TIME_REF): {
|
||||
result = prepareSetTimeRefCmd();
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SET_BOOT_TIMEOUT): {
|
||||
case (PLOC_SPV::SET_BOOT_TIMEOUT): {
|
||||
prepareSetBootTimeoutCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SET_MAX_RESTART_TRIES): {
|
||||
case (PLOC_SPV::SET_MAX_RESTART_TRIES): {
|
||||
prepareRestartTriesCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::DISABLE_PERIOIC_HK_TRANSMISSION): {
|
||||
case (PLOC_SPV::DISABLE_PERIOIC_HK_TRANSMISSION): {
|
||||
prepareDisableHk();
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::GET_BOOT_STATUS_REPORT): {
|
||||
case (PLOC_SPV::GET_BOOT_STATUS_REPORT): {
|
||||
prepareEmptyCmd(PLOC_SPV::APID_GET_BOOT_STATUS_RPT);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::WATCHDOGS_ENABLE): {
|
||||
case (PLOC_SPV::WATCHDOGS_ENABLE): {
|
||||
prepareWatchdogsEnableCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::WATCHDOGS_CONFIG_TIMEOUT): {
|
||||
case (PLOC_SPV::WATCHDOGS_CONFIG_TIMEOUT): {
|
||||
result = prepareWatchdogsConfigTimeoutCmd(commandData);
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::ENABLE_LATCHUP_ALERT): {
|
||||
case (PLOC_SPV::ENABLE_LATCHUP_ALERT): {
|
||||
result = prepareLatchupConfigCmd(commandData, deviceCommand);
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::DISABLE_LATCHUP_ALERT): {
|
||||
case (PLOC_SPV::DISABLE_LATCHUP_ALERT): {
|
||||
result = prepareLatchupConfigCmd(commandData, deviceCommand);
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::AUTO_CALIBRATE_ALERT): {
|
||||
case (PLOC_SPV::AUTO_CALIBRATE_ALERT): {
|
||||
result = prepareAutoCalibrateAlertCmd(commandData);
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SET_ALERT_LIMIT): {
|
||||
case (PLOC_SPV::SET_ALERT_LIMIT): {
|
||||
result = prepareSetAlertLimitCmd(commandData);
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SET_ALERT_IRQ_FILTER): {
|
||||
case (PLOC_SPV::SET_ALERT_IRQ_FILTER): {
|
||||
result = prepareSetAlertIrqFilterCmd(commandData);
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SET_ADC_SWEEP_PERIOD): {
|
||||
case (PLOC_SPV::SET_ADC_SWEEP_PERIOD): {
|
||||
result = prepareSetAdcSweetPeriodCmd(commandData);
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SET_ADC_ENABLED_CHANNELS): {
|
||||
case (PLOC_SPV::SET_ADC_ENABLED_CHANNELS): {
|
||||
prepareSetAdcEnabledChannelsCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SET_ADC_WINDOW_AND_STRIDE): {
|
||||
case (PLOC_SPV::SET_ADC_WINDOW_AND_STRIDE): {
|
||||
prepareSetAdcWindowAndStrideCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SET_ADC_THRESHOLD): {
|
||||
case (PLOC_SPV::SET_ADC_THRESHOLD): {
|
||||
prepareSetAdcThresholdCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::GET_LATCHUP_STATUS_REPORT): {
|
||||
case (PLOC_SPV::GET_LATCHUP_STATUS_REPORT): {
|
||||
prepareEmptyCmd(PLOC_SPV::APID_GET_LATCHUP_STATUS_REPORT);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::COPY_ADC_DATA_TO_MRAM): {
|
||||
case (PLOC_SPV::COPY_ADC_DATA_TO_MRAM): {
|
||||
prepareEmptyCmd(PLOC_SPV::APID_COPY_ADC_DATA_TO_MRAM);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::ENABLE_NVMS): {
|
||||
case (PLOC_SPV::ENABLE_NVMS): {
|
||||
prepareEnableNvmsCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SELECT_NVM): {
|
||||
case (PLOC_SPV::SELECT_NVM): {
|
||||
prepareSelectNvmCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::RUN_AUTO_EM_TESTS): {
|
||||
case (PLOC_SPV::RUN_AUTO_EM_TESTS): {
|
||||
result = prepareRunAutoEmTest(commandData);
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::WIPE_MRAM): {
|
||||
case (PLOC_SPV::WIPE_MRAM): {
|
||||
result = prepareWipeMramCmd(commandData);
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::FIRST_MRAM_DUMP):
|
||||
case(PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
||||
case (PLOC_SPV::FIRST_MRAM_DUMP):
|
||||
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
||||
result = prepareDumpMramCmd(commandData);
|
||||
break;
|
||||
case(PLOC_SPV::PRINT_CPU_STATS): {
|
||||
case (PLOC_SPV::PRINT_CPU_STATS): {
|
||||
preparePrintCpuStatsCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SET_DBG_VERBOSITY): {
|
||||
case (PLOC_SPV::SET_DBG_VERBOSITY): {
|
||||
prepareSetDbgVerbosityCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::CAN_LOOPBACK_TEST): {
|
||||
case (PLOC_SPV::CAN_LOOPBACK_TEST): {
|
||||
prepareEmptyCmd(PLOC_SPV::APID_CAN_LOOPBACK_TEST);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::SET_GPIO): {
|
||||
case (PLOC_SPV::SET_GPIO): {
|
||||
prepareSetGpioCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::READ_GPIO): {
|
||||
case (PLOC_SPV::READ_GPIO): {
|
||||
prepareReadGpioCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::RESTART_SUPERVISOR): {
|
||||
case (PLOC_SPV::RESTART_SUPERVISOR): {
|
||||
prepareEmptyCmd(PLOC_SPV::APID_RESTART_SUPERVISOR);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::FACTORY_RESET_CLEAR_ALL): {
|
||||
case (PLOC_SPV::FACTORY_RESET_CLEAR_ALL): {
|
||||
PLOC_SPV::FactoryReset packet(PLOC_SPV::FactoryReset::Op::CLEAR_ALL);
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::FACTORY_RESET_CLEAR_MIRROR): {
|
||||
case (PLOC_SPV::FACTORY_RESET_CLEAR_MIRROR): {
|
||||
PLOC_SPV::FactoryReset packet(PLOC_SPV::FactoryReset::Op::MIRROR_ENTRIES);
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::FACTORY_RESET_CLEAR_CIRCULAR): {
|
||||
case (PLOC_SPV::FACTORY_RESET_CLEAR_CIRCULAR): {
|
||||
PLOC_SPV::FactoryReset packet(PLOC_SPV::FactoryReset::Op::CIRCULAR_ENTRIES);
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::UPDATE_AVAILABLE):
|
||||
case(PLOC_SPV::UPDATE_IMAGE_DATA):
|
||||
case(PLOC_SPV::UPDATE_VERIFY):
|
||||
case (PLOC_SPV::UPDATE_AVAILABLE):
|
||||
case (PLOC_SPV::UPDATE_IMAGE_DATA):
|
||||
case (PLOC_SPV::UPDATE_VERIFY):
|
||||
// Simply forward data from PLOC Updater to supervisor
|
||||
std::memcpy(commandBuffer, commandData, commandDataLen);
|
||||
rawPacket = commandBuffer;
|
||||
@ -326,14 +325,12 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT);
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t *start,
|
||||
size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP) {
|
||||
*foundId = PLOC_SPV::FIRST_MRAM_DUMP;
|
||||
return parseMramPackets(start, remainingSize, foundLen);
|
||||
}
|
||||
else if (nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
||||
} else if (nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
||||
*foundId = PLOC_SPV::CONSECUTIVE_MRAM_DUMP;
|
||||
return parseMramPackets(start, remainingSize, foundLen);
|
||||
}
|
||||
@ -342,32 +339,32 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t *start,
|
||||
|
||||
uint16_t apid = (*(start) << 8 | *(start + 1)) & APID_MASK;
|
||||
|
||||
switch(apid) {
|
||||
case(PLOC_SPV::APID_ACK_SUCCESS):
|
||||
switch (apid) {
|
||||
case (PLOC_SPV::APID_ACK_SUCCESS):
|
||||
*foundLen = PLOC_SPV::SIZE_ACK_REPORT;
|
||||
*foundId = PLOC_SPV::ACK_REPORT;
|
||||
break;
|
||||
case(PLOC_SPV::APID_ACK_FAILURE):
|
||||
case (PLOC_SPV::APID_ACK_FAILURE):
|
||||
*foundLen = PLOC_SPV::SIZE_ACK_REPORT;
|
||||
*foundId = PLOC_SPV::ACK_REPORT;
|
||||
break;
|
||||
case(PLOC_SPV::APID_HK_REPORT):
|
||||
case (PLOC_SPV::APID_HK_REPORT):
|
||||
*foundLen = PLOC_SPV::SIZE_HK_REPORT;
|
||||
*foundId = PLOC_SPV::HK_REPORT;
|
||||
break;
|
||||
case(PLOC_SPV::APID_BOOT_STATUS_REPORT):
|
||||
case (PLOC_SPV::APID_BOOT_STATUS_REPORT):
|
||||
*foundLen = PLOC_SPV::SIZE_BOOT_STATUS_REPORT;
|
||||
*foundId = PLOC_SPV::BOOT_STATUS_REPORT;
|
||||
break;
|
||||
case(PLOC_SPV::APID_LATCHUP_STATUS_REPORT):
|
||||
case (PLOC_SPV::APID_LATCHUP_STATUS_REPORT):
|
||||
*foundLen = PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT;
|
||||
*foundId = PLOC_SPV::LATCHUP_REPORT;
|
||||
break;
|
||||
case(PLOC_SPV::APID_EXE_SUCCESS):
|
||||
case (PLOC_SPV::APID_EXE_SUCCESS):
|
||||
*foundLen = PLOC_SPV::SIZE_EXE_REPORT;
|
||||
*foundId = PLOC_SPV::EXE_REPORT;
|
||||
break;
|
||||
case(PLOC_SPV::APID_EXE_FAILURE):
|
||||
case (PLOC_SPV::APID_EXE_FAILURE):
|
||||
*foundLen = PLOC_SPV::SIZE_EXE_REPORT;
|
||||
*foundId = PLOC_SPV::EXE_REPORT;
|
||||
break;
|
||||
@ -382,8 +379,7 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t *start,
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t *packet) {
|
||||
|
||||
const uint8_t* packet) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
switch (id) {
|
||||
@ -412,7 +408,8 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
sif::debug << "PlocSupervisorHandler::interpretDeviceReply: Unknown device reply id" << std::endl;
|
||||
sif::debug << "PlocSupervisorHandler::interpretDeviceReply: Unknown device reply id"
|
||||
<< std::endl;
|
||||
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
|
||||
}
|
||||
}
|
||||
@ -420,63 +417,58 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
return result;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::setNormalDatapoolEntriesInvalid(){
|
||||
void PlocSupervisorHandler::setNormalDatapoolEntriesInvalid() {}
|
||||
|
||||
}
|
||||
|
||||
uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){
|
||||
return 500;
|
||||
}
|
||||
uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) {
|
||||
localDataPoolMap.emplace(PLOC_SPV::NUM_TMS, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::TEMP_PS, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::TEMP_PL, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::SOC_STATE, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::NVM0_1_STATE, new PoolEntry<uint8_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::NVM3_STATE, new PoolEntry<uint8_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::MISSION_IO_STATE, new PoolEntry<uint8_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::FMC_STATE, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::NUM_TCS, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::UPTIME, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CPULOAD, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::AVAILABLEHEAP, new PoolEntry<uint32_t>({0}));
|
||||
|
||||
localDataPoolMap.emplace(PLOC_SPV::NUM_TMS, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::TEMP_PS, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::TEMP_PL, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::SOC_STATE, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::NVM0_1_STATE, new PoolEntry<uint8_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::NVM3_STATE, new PoolEntry<uint8_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::MISSION_IO_STATE, new PoolEntry<uint8_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::FMC_STATE, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::NUM_TCS, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::UPTIME, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CPULOAD, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::AVAILABLEHEAP, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::BOOT_SIGNAL, new PoolEntry<uint8_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::RESET_COUNTER, new PoolEntry<uint8_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::BOOT_AFTER_MS, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::BOOT_TIMEOUT_MS, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::ACTIVE_NVM, new PoolEntry<uint8_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::BP0_STATE, new PoolEntry<uint8_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::BP1_STATE, new PoolEntry<uint8_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::BP2_STATE, new PoolEntry<uint8_t>({0}));
|
||||
|
||||
localDataPoolMap.emplace(PLOC_SPV::BOOT_SIGNAL, new PoolEntry<uint8_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::RESET_COUNTER, new PoolEntry<uint8_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::BOOT_AFTER_MS, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::BOOT_TIMEOUT_MS, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::ACTIVE_NVM, new PoolEntry<uint8_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::BP0_STATE, new PoolEntry<uint8_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::BP1_STATE, new PoolEntry<uint8_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::BP2_STATE, new PoolEntry<uint8_t>( { 0 }));
|
||||
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_ID, new PoolEntry<uint8_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT0, new PoolEntry<uint16_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT1, new PoolEntry<uint16_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT2, new PoolEntry<uint16_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT3, new PoolEntry<uint16_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT4, new PoolEntry<uint16_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT5, new PoolEntry<uint16_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT6, new PoolEntry<uint16_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_SEC, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_MIN, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_HOUR, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_DAY, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_MON, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_YEAR, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_MSEC, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_IS_SET, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_ID, new PoolEntry<uint8_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT0, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT1, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT2, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT3, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT4, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT5, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::CNT6, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_SEC, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_MIN, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_HOUR, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_DAY, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_MON, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_YEAR, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_MSEC, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(PLOC_SPV::LATCHUP_RPT_TIME_IS_SET, new PoolEntry<uint32_t>({0}));
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
||||
uint8_t expectedReplies, bool useAlternateId,
|
||||
uint8_t expectedReplies,
|
||||
bool useAlternateId,
|
||||
DeviceCommandId_t alternateReplyID) {
|
||||
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
uint8_t enabledReplies = 0;
|
||||
@ -581,15 +573,15 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
||||
* Every command causes at least one acknowledgment and one execution report. Therefore both
|
||||
* replies will be enabled here.
|
||||
*/
|
||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||
PLOC_SPV::ACK_REPORT);
|
||||
result =
|
||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, PLOC_SPV::ACK_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||
<< PLOC_SPV::ACK_REPORT << " not in replyMap" << std::endl;
|
||||
}
|
||||
|
||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||
PLOC_SPV::EXE_REPORT);
|
||||
result =
|
||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, PLOC_SPV::EXE_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||
<< PLOC_SPV::EXE_REPORT << " not in replyMap" << std::endl;
|
||||
@ -608,11 +600,10 @@ ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t f
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
||||
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
result = verifyPacket(data, PLOC_SPV::SIZE_ACK_REPORT);
|
||||
if(result == CRC_FAILURE) {
|
||||
if (result == CRC_FAILURE) {
|
||||
sif::error << "PlocSupervisorHandler::handleAckReport: CRC failure" << std::endl;
|
||||
nextReplyId = PLOC_SPV::NONE;
|
||||
replyRawReplyIfnotWiretapped(data, PLOC_SPV::SIZE_ACK_REPORT);
|
||||
@ -624,10 +615,11 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
||||
|
||||
uint16_t apid = (*(data) << 8 | *(data + 1)) & APID_MASK;
|
||||
|
||||
switch(apid) {
|
||||
switch (apid) {
|
||||
case PLOC_SPV::APID_ACK_FAILURE: {
|
||||
//TODO: Interpretation of status field in acknowledgment report
|
||||
sif::debug << "PlocSupervisorHandler::handleAckReport: Received Ack failure report" << std::endl;
|
||||
// TODO: Interpretation of status field in acknowledgment report
|
||||
sif::debug << "PlocSupervisorHandler::handleAckReport: Received Ack failure report"
|
||||
<< std::endl;
|
||||
DeviceCommandId_t commandId = getPendingCommand();
|
||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||
triggerEvent(SUPV_ACK_FAILURE, commandId);
|
||||
@ -643,7 +635,8 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
sif::debug << "PlocSupervisorHandler::handleAckReport: Invalid APID in Ack report" << std::endl;
|
||||
sif::debug << "PlocSupervisorHandler::handleAckReport: Invalid APID in Ack report"
|
||||
<< std::endl;
|
||||
result = RETURN_FAILED;
|
||||
break;
|
||||
}
|
||||
@ -653,11 +646,10 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data) {
|
||||
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
result = verifyPacket(data, PLOC_SPV::SIZE_EXE_REPORT);
|
||||
if(result == CRC_FAILURE) {
|
||||
if (result == CRC_FAILURE) {
|
||||
sif::error << "PlocSupervisorHandler::handleExecutionReport: CRC failure" << std::endl;
|
||||
nextReplyId = PLOC_SPV::NONE;
|
||||
return result;
|
||||
@ -670,15 +662,16 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
||||
break;
|
||||
}
|
||||
case (PLOC_SPV::APID_EXE_FAILURE): {
|
||||
//TODO: Interpretation of status field in execution report
|
||||
sif::error << "PlocSupervisorHandler::handleExecutionReport: Received execution failure report"
|
||||
// TODO: Interpretation of status field in execution report
|
||||
sif::error
|
||||
<< "PlocSupervisorHandler::handleExecutionReport: Received execution failure report"
|
||||
<< std::endl;
|
||||
DeviceCommandId_t commandId = getPendingCommand();
|
||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||
triggerEvent(SUPV_EXE_FAILURE, commandId);
|
||||
}
|
||||
else {
|
||||
sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id" << std::endl;
|
||||
} else {
|
||||
sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id"
|
||||
<< std::endl;
|
||||
}
|
||||
sendFailureReport(PLOC_SPV::EXE_REPORT, RECEIVED_EXE_FAILURE);
|
||||
disableExeReportReply();
|
||||
@ -698,43 +691,41 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
||||
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
result = verifyPacket(data, PLOC_SPV::SIZE_HK_REPORT);
|
||||
|
||||
if(result == CRC_FAILURE) {
|
||||
sif::error << "PlocSupervisorHandler::handleHkReport: Hk report has invalid crc"
|
||||
<< std::endl;
|
||||
if (result == CRC_FAILURE) {
|
||||
sif::error << "PlocSupervisorHandler::handleHkReport: Hk report has invalid crc" << std::endl;
|
||||
}
|
||||
|
||||
uint16_t offset = PLOC_SPV::DATA_FIELD_OFFSET;
|
||||
hkset.tempPs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
hkset.tempPs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||
*(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.tempPl = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
hkset.tempPl = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||
*(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.tempSup = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
hkset.tempSup = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||
*(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.uptime = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
hkset.uptime = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||
*(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.cpuLoad = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
hkset.cpuLoad = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||
*(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.availableHeap = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
hkset.availableHeap = *(data + offset) << 24 | *(data + offset + 1) << 16 |
|
||||
*(data + offset + 2) << 8 | *(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.numTcs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
hkset.numTcs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||
*(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.numTms = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
hkset.numTms = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||
*(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.socState = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
hkset.socState = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
||||
*(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.nvm0_1_state = *(data + offset);
|
||||
offset += 1;
|
||||
@ -753,7 +744,8 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: temp_sup: " << hkset.tempSup << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: uptime: " << hkset.uptime << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: cpu_load: " << hkset.cpuLoad << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: available_heap: " << hkset.availableHeap << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: available_heap: " << hkset.availableHeap
|
||||
<< std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: num_tcs: " << hkset.numTcs << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: num_tms: " << hkset.numTms << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: soc_state: " << hkset.socState << std::endl;
|
||||
@ -772,14 +764,14 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data) {
|
||||
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
result = verifyPacket(data, PLOC_SPV::SIZE_BOOT_STATUS_REPORT);
|
||||
|
||||
if(result == CRC_FAILURE) {
|
||||
if (result == CRC_FAILURE) {
|
||||
sif::error << "PlocSupervisorHandler::handleBootStatusReport: Boot status report has invalid"
|
||||
" crc" << std::endl;
|
||||
" crc"
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -827,12 +819,11 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data)
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* data) {
|
||||
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
result = verifyPacket(data, PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT);
|
||||
|
||||
if(result == CRC_FAILURE) {
|
||||
if (result == CRC_FAILURE) {
|
||||
sif::error << "PlocSupervisorHandler::handleLatchupStatusReport: Latchup status report has "
|
||||
<< "invalid crc" << std::endl;
|
||||
return result;
|
||||
@ -913,15 +904,15 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da
|
||||
<< latchupStatusReport.timeYear << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Msec: "
|
||||
<< latchupStatusReport.timeMsec << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: isSet: 0x"
|
||||
<< std::hex << latchupStatusReport.timeMsec << std::dec << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: isSet: 0x" << std::hex
|
||||
<< latchupStatusReport.timeMsec << std::dec << std::endl;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::setNextReplyId() {
|
||||
switch(getPendingCommand()) {
|
||||
switch (getPendingCommand()) {
|
||||
case PLOC_SPV::GET_HK_REPORT:
|
||||
nextReplyId = PLOC_SPV::HK_REPORT;
|
||||
break;
|
||||
@ -944,16 +935,14 @@ void PlocSupervisorHandler::setNextReplyId() {
|
||||
}
|
||||
}
|
||||
|
||||
size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId){
|
||||
|
||||
size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
||||
size_t replyLen = 0;
|
||||
|
||||
if (nextReplyId == PLOC_SPV::NONE) {
|
||||
return replyLen;
|
||||
}
|
||||
|
||||
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP
|
||||
|| nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
||||
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP || nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
||||
/**
|
||||
* Try to read 20 MRAM packets. If reply is larger, the packets will be read with the
|
||||
* next doSendRead call. The command will be as long active as the packet with the sequence
|
||||
@ -970,8 +959,7 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId){
|
||||
return replyLen;
|
||||
}
|
||||
replyLen = iter->second.replyLen;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sif::debug << "PlocSupervisorHandler::getNextReplyLength: No entry for reply with reply id "
|
||||
<< std::hex << nextReplyId << " in deviceReplyMap" << std::endl;
|
||||
}
|
||||
@ -979,8 +967,8 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId){
|
||||
return replyLen;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId) {
|
||||
|
||||
void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
||||
DeviceCommandId_t replyId) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
if (wiretappingMode == RAW) {
|
||||
@ -1010,7 +998,7 @@ void PlocSupervisorHandler::prepareEmptyCmd(uint16_t apid) {
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::prepareSelBootImageCmd(const uint8_t * commandData) {
|
||||
void PlocSupervisorHandler::prepareSelBootImageCmd(const uint8_t* commandData) {
|
||||
PLOC_SPV::MPSoCBootSelect packet(*commandData, *(commandData + 1), *(commandData + 2),
|
||||
*(commandData + 3));
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
@ -1034,20 +1022,20 @@ void PlocSupervisorHandler::prepareDisableHk() {
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t * commandData) {
|
||||
uint32_t timeout = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8
|
||||
| *(commandData + 3);
|
||||
void PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t* commandData) {
|
||||
uint32_t timeout = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
|
||||
*(commandData + 3);
|
||||
PLOC_SPV::SetBootTimeout packet(timeout);
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::prepareRestartTriesCmd(const uint8_t * commandData) {
|
||||
void PlocSupervisorHandler::prepareRestartTriesCmd(const uint8_t* commandData) {
|
||||
uint8_t restartTries = *(commandData);
|
||||
PLOC_SPV::SetRestartTries packet(restartTries);
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::prepareWatchdogsEnableCmd(const uint8_t * commandData) {
|
||||
void PlocSupervisorHandler::prepareWatchdogsEnableCmd(const uint8_t* commandData) {
|
||||
uint8_t offset = 0;
|
||||
uint8_t watchdogPs = *(commandData + offset);
|
||||
offset += 1;
|
||||
@ -1058,15 +1046,15 @@ void PlocSupervisorHandler::prepareWatchdogsEnableCmd(const uint8_t * commandDat
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::prepareWatchdogsConfigTimeoutCmd(const uint8_t * commandData) {
|
||||
ReturnValue_t PlocSupervisorHandler::prepareWatchdogsConfigTimeoutCmd(const uint8_t* commandData) {
|
||||
uint8_t offset = 0;
|
||||
uint8_t watchdog = *(commandData + offset);
|
||||
offset += 1;
|
||||
if (watchdog > 2) {
|
||||
return INVALID_WATCHDOG;
|
||||
}
|
||||
uint32_t timeout = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16
|
||||
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||
uint32_t timeout = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
|
||||
*(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||
if (timeout < 1000 || timeout > 360000) {
|
||||
return INVALID_WATCHDOG_TIMEOUT;
|
||||
}
|
||||
@ -1107,8 +1095,8 @@ ReturnValue_t PlocSupervisorHandler::prepareAutoCalibrateAlertCmd(const uint8_t*
|
||||
uint8_t offset = 0;
|
||||
uint8_t latchupId = *commandData;
|
||||
offset += 1;
|
||||
uint32_t mg = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16
|
||||
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||
uint32_t mg = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
|
||||
*(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||
if (latchupId > 6) {
|
||||
return INVALID_LATCHUP_ID;
|
||||
}
|
||||
@ -1133,8 +1121,8 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAlertLimitCmd(const uint8_t* comm
|
||||
uint8_t offset = 0;
|
||||
uint8_t latchupId = *commandData;
|
||||
offset += 1;
|
||||
uint32_t dutycycle = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16
|
||||
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||
uint32_t dutycycle = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
|
||||
*(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||
if (latchupId > 6) {
|
||||
return INVALID_LATCHUP_ID;
|
||||
}
|
||||
@ -1144,8 +1132,8 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAlertLimitCmd(const uint8_t* comm
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::prepareSetAdcSweetPeriodCmd(const uint8_t* commandData) {
|
||||
uint32_t sweepPeriod = *(commandData) << 24 | *(commandData + 1) << 16
|
||||
| *(commandData + 2) << 8 | *(commandData + 3);
|
||||
uint32_t sweepPeriod = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
|
||||
*(commandData + 3);
|
||||
if (sweepPeriod < 21) {
|
||||
return SWEEP_PERIOD_TOO_SMALL;
|
||||
}
|
||||
@ -1170,8 +1158,8 @@ void PlocSupervisorHandler::prepareSetAdcWindowAndStrideCmd(const uint8_t* comma
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::prepareSetAdcThresholdCmd(const uint8_t* commandData) {
|
||||
uint32_t threshold = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8
|
||||
| *(commandData + 3);
|
||||
uint32_t threshold = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
|
||||
*(commandData + 3);
|
||||
PLOC_SPV::SetAdcThreshold packet(threshold);
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
}
|
||||
@ -1267,12 +1255,11 @@ void PlocSupervisorHandler::packetToOutBuffer(uint8_t* packetData, size_t fullSi
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::disableAllReplies() {
|
||||
|
||||
DeviceReplyMap::iterator iter;
|
||||
|
||||
/* Disable ack reply */
|
||||
iter = deviceReplyMap.find(PLOC_SPV::ACK_REPORT);
|
||||
DeviceReplyInfo *info = &(iter->second);
|
||||
DeviceReplyInfo* info = &(iter->second);
|
||||
info->delayCycles = 0;
|
||||
info->command = deviceCommandMap.end();
|
||||
|
||||
@ -1297,7 +1284,6 @@ void PlocSupervisorHandler::disableAllReplies() {
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) {
|
||||
|
||||
DeviceReplyIter iter = deviceReplyMap.find(replyId);
|
||||
|
||||
if (iter == deviceReplyMap.end()) {
|
||||
@ -1308,7 +1294,8 @@ void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnV
|
||||
DeviceCommandInfo* info = &(iter->second.command->second);
|
||||
|
||||
if (info == nullptr) {
|
||||
sif::debug << "PlocSupervisorHandler::sendFailureReport: Reply has no active command" << std::endl;
|
||||
sif::debug << "PlocSupervisorHandler::sendFailureReport: Reply has no active command"
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1320,14 +1307,14 @@ void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnV
|
||||
|
||||
void PlocSupervisorHandler::disableExeReportReply() {
|
||||
DeviceReplyIter iter = deviceReplyMap.find(PLOC_SPV::EXE_REPORT);
|
||||
DeviceReplyInfo *info = &(iter->second);
|
||||
DeviceReplyInfo* info = &(iter->second);
|
||||
info->delayCycles = 0;
|
||||
info->command = deviceCommandMap.end();
|
||||
/* Expected replies is set to one here. The value will set to 0 in replyToReply() */
|
||||
info->command->second.expectedReplies = 1;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::parseMramPackets(const uint8_t *packet, size_t remainingSize,
|
||||
ReturnValue_t PlocSupervisorHandler::parseMramPackets(const uint8_t* packet, size_t remainingSize,
|
||||
size_t* foundLen) {
|
||||
ReturnValue_t result = IGNORE_FULL_PACKET;
|
||||
uint16_t packetLen = 0;
|
||||
@ -1359,7 +1346,6 @@ ReturnValue_t PlocSupervisorHandler::parseMramPackets(const uint8_t *packet, siz
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id) {
|
||||
|
||||
ReturnValue_t result = RETURN_FAILED;
|
||||
|
||||
// Prepare packet for downlink
|
||||
@ -1372,8 +1358,7 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id)
|
||||
}
|
||||
handleMramDumpFile(id);
|
||||
if (downlinkMramDump == true) {
|
||||
handleDeviceTM(spacePacketBuffer + PLOC_SPV::SPACE_PACKET_HEADER_LENGTH, packetLen - 1,
|
||||
id);
|
||||
handleDeviceTM(spacePacketBuffer + PLOC_SPV::SPACE_PACKET_HEADER_LENGTH, packetLen - 1, id);
|
||||
}
|
||||
packetInBuffer = false;
|
||||
receivedMramDumpPackets++;
|
||||
@ -1399,35 +1384,34 @@ void PlocSupervisorHandler::increaseExpectedMramReplies(DeviceCommandId_t id) {
|
||||
<< "in reply map" << std::endl;
|
||||
return;
|
||||
}
|
||||
DeviceReplyInfo *mramReplyInfo = &(mramDumpIter->second);
|
||||
DeviceReplyInfo* mramReplyInfo = &(mramDumpIter->second);
|
||||
if (mramReplyInfo == nullptr) {
|
||||
sif::debug << "PlocSupervisorHandler::increaseExpectedReplies: MRAM reply info nullptr"
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
DeviceReplyInfo *exeReplyInfo = &(exeReportIter->second);
|
||||
DeviceReplyInfo* exeReplyInfo = &(exeReportIter->second);
|
||||
if (exeReplyInfo == nullptr) {
|
||||
sif::debug << "PlocSupervisorHandler::increaseExpectedReplies: Execution reply info"
|
||||
<< " nullptr" << std::endl;
|
||||
return;
|
||||
}
|
||||
DeviceCommandInfo* info = &(mramReplyInfo->command->second);
|
||||
if (info == nullptr){
|
||||
if (info == nullptr) {
|
||||
sif::debug << "PlocSupervisorHandler::increaseExpectedReplies: Command info nullptr"
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
uint8_t sequenceFlags = spacePacketBuffer[2] >> 6;
|
||||
if (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT)
|
||||
&& (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
||||
if (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT) &&
|
||||
(sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
||||
// Command expects at least one MRAM packet more and the execution report
|
||||
info->expectedReplies = 2;
|
||||
// Wait maximum of 2 cycles for next MRAM packet
|
||||
mramReplyInfo->delayCycles = 2;
|
||||
// Also adapting delay cycles for execution report
|
||||
exeReplyInfo->delayCycles = 3;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Command expects the execution report
|
||||
info->expectedReplies = 1;
|
||||
mramReplyInfo->delayCycles = 0;
|
||||
@ -1448,8 +1432,8 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
|
||||
uint16_t packetLen = readSpacePacketLength(spacePacketBuffer);
|
||||
uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer);
|
||||
if (id == PLOC_SPV::FIRST_MRAM_DUMP) {
|
||||
if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT)
|
||||
|| (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
||||
if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT) ||
|
||||
(sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
||||
result = createMramDumpFile();
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
@ -1515,8 +1499,8 @@ ReturnValue_t PlocSupervisorHandler::getTimeStampString(std::string& timeStamp)
|
||||
<< std::endl;
|
||||
return GET_TIME_FAILURE;
|
||||
}
|
||||
timeStamp = std::to_string(time.year) + "-" + std::to_string(time.month) + "-"
|
||||
+ std::to_string(time.day) + "--" + std::to_string(time.hour) + "-"
|
||||
+ std::to_string(time.minute) + "-" + std::to_string(time.second);
|
||||
timeStamp = std::to_string(time.year) + "-" + std::to_string(time.month) + "-" +
|
||||
std::to_string(time.day) + "--" + std::to_string(time.hour) + "-" +
|
||||
std::to_string(time.minute) + "-" + std::to_string(time.second);
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
#ifndef MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
||||
#define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
||||
|
||||
#include "OBSWConfig.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 <linux/devices/devicedefinitions/PlocSupervisorDefinitions.h>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
/**
|
||||
* @brief This is the device handler for the supervisor of the PLOC which is programmed by
|
||||
@ -19,26 +20,24 @@
|
||||
* Arbeitsdaten/08_Used%20Components/PLOC&fileid=940960
|
||||
* @author J. Meier
|
||||
*/
|
||||
class PlocSupervisorHandler: public DeviceHandlerBase {
|
||||
public:
|
||||
|
||||
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF * comCookie);
|
||||
class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
public:
|
||||
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie);
|
||||
virtual ~PlocSupervisorHandler();
|
||||
|
||||
virtual ReturnValue_t initialize() override;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void doStartUp() override;
|
||||
void doShutDown() override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t * id) override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
||||
void fillCommandAndReplyMap() override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t * commandData,size_t commandDataLen) override;
|
||||
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize,
|
||||
DeviceCommandId_t *foundId, size_t *foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t *packet) override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
||||
size_t commandDataLen) override;
|
||||
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||
size_t* foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||
void setNormalDatapoolEntriesInvalid() override;
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
@ -48,8 +47,7 @@ protected:
|
||||
DeviceCommandId_t alternateReplyID = 0) override;
|
||||
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_SUPERVISOR_HANDLER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Space Packet received from PLOC supervisor has invalid CRC
|
||||
@ -62,25 +60,32 @@ private:
|
||||
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3);
|
||||
//! [EXPORT] : [COMMENT] Failed to read current system time
|
||||
static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA4);
|
||||
//! [EXPORT] : [COMMENT] Received command with invalid watchdog parameter. Valid watchdogs are 0 for PS, 1 for PL and 2 for INT
|
||||
//! [EXPORT] : [COMMENT] Received command with invalid watchdog parameter. Valid watchdogs are 0
|
||||
//! for PS, 1 for PL and 2 for INT
|
||||
static const ReturnValue_t INVALID_WATCHDOG = MAKE_RETURN_CODE(0xA5);
|
||||
//! [EXPORT] : [COMMENT] Received watchdog timeout config command with invalid timeout. Valid timeouts must be in the range between 1000 and 360000 ms.
|
||||
//! [EXPORT] : [COMMENT] Received watchdog timeout config command with invalid timeout. Valid
|
||||
//! timeouts must be in the range between 1000 and 360000 ms.
|
||||
static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA6);
|
||||
//! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID
|
||||
static const ReturnValue_t INVALID_LATCHUP_ID = MAKE_RETURN_CODE(0xA7);
|
||||
//! [EXPORT] : [COMMENT] Received set adc sweep period command with invalid sweep period. Must be larger than 21.
|
||||
//! [EXPORT] : [COMMENT] Received set adc sweep period command with invalid sweep period. Must be
|
||||
//! larger than 21.
|
||||
static const ReturnValue_t SWEEP_PERIOD_TOO_SMALL = MAKE_RETURN_CODE(0xA8);
|
||||
//! [EXPORT] : [COMMENT] Receive auto EM test command with invalid test param. Valid params are 1 and 2.
|
||||
//! [EXPORT] : [COMMENT] Receive auto EM test command with invalid test param. Valid params are 1
|
||||
//! and 2.
|
||||
static const ReturnValue_t INVALID_TEST_PARAM = MAKE_RETURN_CODE(0xA9);
|
||||
//! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed.
|
||||
static const ReturnValue_t MRAM_PACKET_PARSING_FAILURE = MAKE_RETURN_CODE(0xAA);
|
||||
//! [EXPORT] : [COMMENT] Returned when the start and stop addresses of the MRAM dump or MRAM wipe commands are invalid (e.g. start address bigger than stop address)
|
||||
//! [EXPORT] : [COMMENT] Returned when the start and stop addresses of the MRAM dump or MRAM wipe
|
||||
//! commands are invalid (e.g. start address bigger than stop address)
|
||||
static const ReturnValue_t INVALID_MRAM_ADDRESSES = MAKE_RETURN_CODE(0xAB);
|
||||
//! [EXPORT] : [COMMENT] Expect reception of an MRAM dump packet but received space packet with other apid.
|
||||
//! [EXPORT] : [COMMENT] Expect reception of an MRAM dump packet but received space packet with
|
||||
//! other apid.
|
||||
static const ReturnValue_t NO_MRAM_PACKET = MAKE_RETURN_CODE(0xAC);
|
||||
//! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist
|
||||
static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAD);
|
||||
//! [EXPORT] : [COMMENT] MRAM dump file does not exists. The file should actually already have been created with the reception of the first dump packet.
|
||||
//! [EXPORT] : [COMMENT] MRAM dump file does not exists. The file should actually already have
|
||||
//! been created with the reception of the first dump packet.
|
||||
static const ReturnValue_t MRAM_FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xAE);
|
||||
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
|
||||
@ -207,7 +212,7 @@ private:
|
||||
/**
|
||||
* @brief This function initializes the space packet to select the boot image of the MPSoC.
|
||||
*/
|
||||
void prepareSelBootImageCmd(const uint8_t * commandData);
|
||||
void prepareSelBootImageCmd(const uint8_t* commandData);
|
||||
|
||||
void prepareDisableHk();
|
||||
|
||||
@ -221,21 +226,21 @@ private:
|
||||
* @brief This function fills the commandBuffer with the data to change the boot timeout
|
||||
* value in the PLOC supervisor.
|
||||
*/
|
||||
void prepareSetBootTimeoutCmd(const uint8_t * commandData);
|
||||
void prepareSetBootTimeoutCmd(const uint8_t* commandData);
|
||||
|
||||
void prepareRestartTriesCmd(const uint8_t * commandData);
|
||||
void prepareRestartTriesCmd(const uint8_t* commandData);
|
||||
|
||||
/**
|
||||
* @brief This function fills the command buffer with the packet to enable or disable the
|
||||
* watchdogs on the PLOC.
|
||||
*/
|
||||
void prepareWatchdogsEnableCmd(const uint8_t * commandData);
|
||||
void prepareWatchdogsEnableCmd(const uint8_t* commandData);
|
||||
|
||||
/**
|
||||
* @brief This function fills the command buffer with the packet to set the watchdog timer
|
||||
* of one of the three watchdogs (PS, PL, INT).
|
||||
*/
|
||||
ReturnValue_t prepareWatchdogsConfigTimeoutCmd(const uint8_t * commandData);
|
||||
ReturnValue_t prepareWatchdogsConfigTimeoutCmd(const uint8_t* commandData);
|
||||
|
||||
ReturnValue_t prepareLatchupConfigCmd(const uint8_t* commandData,
|
||||
DeviceCommandId_t deviceCommand);
|
||||
@ -256,7 +261,6 @@ private:
|
||||
void prepareSetGpioCmd(const uint8_t* commandData);
|
||||
void prepareReadGpioCmd(const uint8_t* commandData);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Copies the content of a space packet to the command buffer.
|
||||
*/
|
||||
@ -288,7 +292,7 @@ private:
|
||||
* @brief Function is called in scanForReply and fills the spacePacketBuffer with the read
|
||||
* data until a full packet has been received.
|
||||
*/
|
||||
ReturnValue_t parseMramPackets(const uint8_t *packet, size_t remainingSize, size_t* foundlen);
|
||||
ReturnValue_t parseMramPackets(const uint8_t* packet, size_t remainingSize, size_t* foundlen);
|
||||
|
||||
/**
|
||||
* @brief This function generates the Service 8 packets for the MRAM dump data.
|
||||
|
@ -1,11 +1,10 @@
|
||||
#ifndef MISSION_DEVICES_PLOCUPDATER_H_
|
||||
#define MISSION_DEVICES_PLOCUPDATER_H_
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include <linux/devices/devicedefinitions/PlocSupervisorDefinitions.h>
|
||||
#include "fsfw/action/CommandActionHelper.h"
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "bsp_q7s/memory/SdCardManager.h"
|
||||
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
||||
#include "eive/definitions.h"
|
||||
#include "fsfw/action/ActionHelper.h"
|
||||
#include "fsfw/action/CommandActionHelper.h"
|
||||
@ -15,6 +14,7 @@
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
||||
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user