v1.12.0 #269
@ -67,10 +67,9 @@ new UartComIF(objects::UART_COM_IF);
|
||||
supervisorCookie->setNoFixedSizeReply();
|
||||
auto supvGpioIF = new DummyGpioIF();
|
||||
auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER);
|
||||
auto plocSupervisor = 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, supvGpioIF),
|
||||
pcdu::PDU1_CH6_PLOC_12V, supvHelper);
|
||||
plocSupervisor->setStartUpImmediately();
|
||||
|
||||
new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER);
|
||||
#endif
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit 789668ae50a26cda299cfd125011f9fb345824d9
|
||||
Subproject commit 19bd26d9983d97c8daf010649e9142afac7e2650
|
@ -55,15 +55,16 @@ static const DeviceCommandId_t LOGGING_CLEAR_COUNTERS = 55;
|
||||
static const DeviceCommandId_t LOGGING_SET_TOPIC = 56;
|
||||
static const DeviceCommandId_t REQUEST_ADC_REPORT = 57;
|
||||
static const DeviceCommandId_t RESET_PL = 58;
|
||||
static const DeviceCommandId_t ENABLE_NVMS = 59;
|
||||
|
||||
/** Reply IDs */
|
||||
static const DeviceCommandId_t ACK_REPORT = 50;
|
||||
static const DeviceCommandId_t EXE_REPORT = 51;
|
||||
static const DeviceCommandId_t HK_REPORT = 52;
|
||||
static const DeviceCommandId_t BOOT_STATUS_REPORT = 53;
|
||||
static const DeviceCommandId_t LATCHUP_REPORT = 54;
|
||||
static const DeviceCommandId_t LOGGING_REPORT = 55;
|
||||
static const DeviceCommandId_t ADC_REPORT = 56;
|
||||
static const DeviceCommandId_t ACK_REPORT = 100;
|
||||
static const DeviceCommandId_t EXE_REPORT = 101;
|
||||
static const DeviceCommandId_t HK_REPORT = 102;
|
||||
static const DeviceCommandId_t BOOT_STATUS_REPORT = 103;
|
||||
static const DeviceCommandId_t LATCHUP_REPORT = 104;
|
||||
static const DeviceCommandId_t LOGGING_REPORT = 105;
|
||||
static const DeviceCommandId_t ADC_REPORT = 106;
|
||||
|
||||
// Size of complete space packet (6 byte header + size of data + 2 byte CRC)
|
||||
static const uint16_t SIZE_ACK_REPORT = 14;
|
||||
@ -122,6 +123,7 @@ static const uint16_t APID_SET_ADC_THRESHOLD = 0xE3;
|
||||
static const uint16_t APID_GET_LATCHUP_STATUS_REPORT = 0xD9;
|
||||
static const uint16_t APID_COPY_ADC_DATA_TO_MRAM = 0xDA;
|
||||
static const uint16_t APID_REQUEST_ADC_REPORT = 0xDB;
|
||||
static const uint16_t APID_ENABLE_NVMS = 0xF0;
|
||||
static const uint16_t APID_RUN_AUTO_EM_TESTS = 0xF2;
|
||||
static const uint16_t APID_WIPE_MRAM = 0xF3;
|
||||
static const uint16_t APID_DUMP_MRAM = 0xF4;
|
||||
@ -357,6 +359,50 @@ class MPSoCBootSelect : public SpacePacket {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class creates the command to enable or disable the NVMs connected to the
|
||||
* supervisor.
|
||||
*/
|
||||
class EnableNvms : public SpacePacket {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param mem The memory to boot from: NVM0 (0), NVM1 (1)
|
||||
* @param bp0 Partition pin 0
|
||||
* @param bp1 Partition pin 1
|
||||
* @param bp2 Partition pin 2
|
||||
*/
|
||||
EnableNvms(uint8_t nvm01, uint8_t nvm3)
|
||||
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_ENABLE_NVMS, DEFAULT_SEQUENCE_COUNT),
|
||||
nvm01(nvm01),
|
||||
nvm3(nvm3) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
static const uint8_t DATA_FIELD_LENGTH = 4;
|
||||
static const uint8_t CRC_OFFSET = 2;
|
||||
uint8_t nvm01 = 0;
|
||||
uint8_t nvm3 = 0;
|
||||
|
||||
void initPacket() {
|
||||
*(this->localData.fields.buffer) = nvm01;
|
||||
*(this->localData.fields.buffer + 1) = nvm3;
|
||||
|
||||
/* Calculate crc */
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
||||
|
||||
/* Add crc to packet data field of space packet */
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
|
||||
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class generates the space packet to update the time of the PLOC supervisor.
|
||||
*/
|
||||
@ -1664,13 +1710,7 @@ class BootStatusReport : public StaticLocalDataSet<BOOT_REPORT_SET_ENTRIES> {
|
||||
*/
|
||||
class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
|
||||
public:
|
||||
|
||||
enum class SocState {
|
||||
OFF = 0,
|
||||
BOOTING = 1,
|
||||
OPERATIONAL = 3,
|
||||
SHUTDOWN = 4
|
||||
};
|
||||
enum class SocState { OFF = 0, BOOTING = 1, OPERATIONAL = 3, SHUTDOWN = 4 };
|
||||
|
||||
HkSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_SET_ID) {}
|
||||
|
||||
|
@ -121,7 +121,10 @@ void PlocMemoryDumper::doStateMachine() {
|
||||
void PlocMemoryDumper::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) {}
|
||||
|
||||
void PlocMemoryDumper::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||
ReturnValue_t returnCode) {}
|
||||
ReturnValue_t returnCode) {
|
||||
triggerEvent(MRAM_DUMP_FAILED);
|
||||
state = State::IDLE;
|
||||
}
|
||||
|
||||
void PlocMemoryDumper::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {}
|
||||
|
||||
|
@ -137,7 +137,6 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::doStartUp() {
|
||||
#ifdef XIPHOS_Q7S
|
||||
switch (startupState) {
|
||||
case StartupState::OFF: {
|
||||
bootTimeout.resetTimer();
|
||||
@ -159,9 +158,6 @@ void PlocSupervisorHandler::doStartUp() {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
setMode(_MODE_TO_ON);
|
||||
#endif
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::doShutDown() {
|
||||
@ -178,7 +174,7 @@ ReturnValue_t PlocSupervisorHandler::buildTransitionDeviceCommand(DeviceCommandI
|
||||
if (startupState == StartupState::SET_TIME) {
|
||||
*id = supv::SET_TIME_REF;
|
||||
startupState = StartupState::SET_TIME_EXECUTING;
|
||||
return RETURN_OK;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
@ -376,6 +372,10 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case ENABLE_NVMS: {
|
||||
result = prepareEnableNvmsCommand(commandData);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "PlocSupervisorHandler::buildCommandFromCommand: Command not implemented"
|
||||
<< std::endl;
|
||||
@ -431,8 +431,11 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
this->insertInCommandMap(LOGGING_CLEAR_COUNTERS);
|
||||
this->insertInCommandMap(LOGGING_SET_TOPIC);
|
||||
this->insertInCommandMap(RESET_PL);
|
||||
this->insertInCommandAndReplyMap(FIRST_MRAM_DUMP, 3);
|
||||
this->insertInCommandAndReplyMap(CONSECUTIVE_MRAM_DUMP, 3);
|
||||
this->insertInCommandMap(ENABLE_NVMS);
|
||||
this->insertInCommandAndReplyMap(FIRST_MRAM_DUMP, 0, nullptr, 0, false, false, FIRST_MRAM_DUMP,
|
||||
&mramDumpTimeout);
|
||||
this->insertInCommandAndReplyMap(CONSECUTIVE_MRAM_DUMP, 0, nullptr, 0, false, false,
|
||||
CONSECUTIVE_MRAM_DUMP, &mramDumpTimeout);
|
||||
this->insertInReplyMap(ACK_REPORT, 3, nullptr, SIZE_ACK_REPORT);
|
||||
this->insertInReplyMap(EXE_REPORT, 0, nullptr, SIZE_EXE_REPORT, false, &executionTimeout);
|
||||
this->insertInReplyMap(HK_REPORT, 3, &hkset, SIZE_HK_REPORT);
|
||||
@ -551,6 +554,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
||||
case LOGGING_CLEAR_COUNTERS:
|
||||
case LOGGING_SET_TOPIC:
|
||||
case RESET_PL:
|
||||
case ENABLE_NVMS:
|
||||
enabledReplies = 2;
|
||||
break;
|
||||
default:
|
||||
@ -1310,6 +1314,10 @@ ReturnValue_t PlocSupervisorHandler::doSendReadHook() {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::doOffActivity() {
|
||||
startupState = StartupState::OFF;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
||||
DeviceCommandId_t replyId) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
@ -1532,11 +1540,21 @@ ReturnValue_t PlocSupervisorHandler::prepareLoggingRequest(const uint8_t* comman
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::prepareEnableNvmsCommand(const uint8_t* commandData) {
|
||||
using namespace supv;
|
||||
uint8_t nvm01 = *(commandData);
|
||||
uint8_t nvm3 = *(commandData + 1);
|
||||
EnableNvms packet(nvm01, nvm3);
|
||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::disableAllReplies() {
|
||||
using namespace supv;
|
||||
DeviceReplyMap::iterator iter;
|
||||
|
||||
/* Disable ack reply */
|
||||
iter = deviceReplyMap.find(supv::ACK_REPORT);
|
||||
iter = deviceReplyMap.find(ACK_REPORT);
|
||||
DeviceReplyInfo* info = &(iter->second);
|
||||
info->delayCycles = 0;
|
||||
info->command = deviceCommandMap.end();
|
||||
@ -1545,21 +1563,29 @@ void PlocSupervisorHandler::disableAllReplies() {
|
||||
|
||||
/* If the command expects a telemetry packet the appropriate tm reply will be disabled here */
|
||||
switch (commandId) {
|
||||
case supv::GET_HK_REPORT: {
|
||||
iter = deviceReplyMap.find(supv::GET_HK_REPORT);
|
||||
info = &(iter->second);
|
||||
info->delayCycles = 0;
|
||||
info->active = false;
|
||||
info->command = deviceCommandMap.end();
|
||||
case GET_HK_REPORT: {
|
||||
disableReply(GET_HK_REPORT);
|
||||
break;
|
||||
}
|
||||
case supv::FIRST_MRAM_DUMP:
|
||||
case supv::CONSECUTIVE_MRAM_DUMP: {
|
||||
iter = deviceReplyMap.find(commandId);
|
||||
info = &(iter->second);
|
||||
info->delayCycles = 0;
|
||||
info->active = false;
|
||||
info->command = deviceCommandMap.end();
|
||||
case FIRST_MRAM_DUMP:
|
||||
case CONSECUTIVE_MRAM_DUMP: {
|
||||
disableReply(commandId);
|
||||
break;
|
||||
}
|
||||
case REQUEST_ADC_REPORT: {
|
||||
disableReply(ADC_REPORT);
|
||||
break;
|
||||
}
|
||||
case GET_BOOT_STATUS_REPORT: {
|
||||
disableReply(BOOT_STATUS_REPORT);
|
||||
break;
|
||||
}
|
||||
case GET_LATCHUP_STATUS_REPORT: {
|
||||
disableReply(LATCHUP_REPORT);
|
||||
break;
|
||||
}
|
||||
case LOGGING_REQUEST_COUNTERS: {
|
||||
disableReply(LOGGING_REPORT);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@ -1571,6 +1597,14 @@ void PlocSupervisorHandler::disableAllReplies() {
|
||||
disableExeReportReply();
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::disableReply(DeviceCommandId_t replyId) {
|
||||
DeviceReplyMap::iterator iter = deviceReplyMap.find(replyId);
|
||||
DeviceReplyInfo* info = &(iter->second);
|
||||
info->delayCycles = 0;
|
||||
info->active = false;
|
||||
info->command = deviceCommandMap.end();
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) {
|
||||
DeviceReplyIter iter = deviceReplyMap.find(replyId);
|
||||
|
||||
@ -1648,9 +1682,13 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id)
|
||||
sif::warning << "PlocSupervisorHandler::handleMramDumpPacket: CRC failure" << std::endl;
|
||||
return result;
|
||||
}
|
||||
handleMramDumpFile(id);
|
||||
if (downlinkMramDump == true) {
|
||||
handleDeviceTM(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH, packetLen - 1, id);
|
||||
result = handleMramDumpFile(id);
|
||||
if (result != RETURN_OK) {
|
||||
DeviceCommandMap::iterator iter = deviceCommandMap.find(id);
|
||||
actionHelper.finish(false, iter->second.sendReplyTo, id, result);
|
||||
disableAllReplies();
|
||||
nextReplyId = supv::NONE;
|
||||
return result;
|
||||
}
|
||||
packetInBuffer = false;
|
||||
receivedMramDumpPackets++;
|
||||
@ -1699,23 +1737,19 @@ void PlocSupervisorHandler::increaseExpectedMramReplies(DeviceCommandId_t id) {
|
||||
(sequenceFlags != static_cast<uint8_t>(supv::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;
|
||||
mramReplyInfo->countdown->resetTimer();
|
||||
} else {
|
||||
// Command expects the execution report
|
||||
info->expectedReplies = 1;
|
||||
mramReplyInfo->delayCycles = 0;
|
||||
mramReplyInfo->active = false;
|
||||
}
|
||||
exeReplyInfo->countdown->resetTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::checkMramPacketApid() {
|
||||
uint16_t apid = (spacePacketBuffer[0] << 8 | spacePacketBuffer[1]) & supv::APID_MASK;
|
||||
if (apid != supv::APID_MRAM_DUMP_TM) {
|
||||
sif::warning << "PlocSupervisorHandler::checkMramPacketApid: 0x" << std::hex << apid
|
||||
<< std::endl;
|
||||
return SupvReturnValuesIF::NO_MRAM_PACKET;
|
||||
}
|
||||
return APERIODIC_REPLY;
|
||||
@ -1788,7 +1822,7 @@ ReturnValue_t PlocSupervisorHandler::getTimeStampString(std::string& timeStamp)
|
||||
Clock::TimeOfDay_t time;
|
||||
ReturnValue_t result = Clock::getDateAndTime(&time);
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocSupervisorHandler::createMramDumpFile: Failed to get current time"
|
||||
sif::warning << "PlocSupervisorHandler::getTimeStampString: Failed to get current time"
|
||||
<< std::endl;
|
||||
return SupvReturnValuesIF::GET_TIME_FAILURE;
|
||||
}
|
||||
@ -1871,8 +1905,8 @@ void PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* data) {
|
||||
}
|
||||
uint8_t data[sizeof(gpioState)];
|
||||
size_t size = 0;
|
||||
ReturnValue_t result = SerializeAdapter::serialize(
|
||||
&gpioState, data, &size, sizeof(gpioState), SerializeIF::Endianness::BIG);
|
||||
ReturnValue_t result = SerializeAdapter::serialize(&gpioState, data, &size, sizeof(gpioState),
|
||||
SerializeIF::Endianness::BIG);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler: Failed to deserialize GPIO state" << std::endl;
|
||||
}
|
||||
|
@ -56,7 +56,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
uint8_t expectedReplies = 1, bool useAlternateId = false,
|
||||
DeviceCommandId_t alternateReplyID = 0) override;
|
||||
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
|
||||
virtual ReturnValue_t doSendReadHook() override;
|
||||
ReturnValue_t doSendReadHook() override;
|
||||
void doOffActivity() override;
|
||||
|
||||
private:
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
|
||||
@ -86,6 +87,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
static const uint32_t MRAM_DUMP_EXECUTION_TIMEOUT = 60000;
|
||||
// 70 s
|
||||
static const uint32_t COPY_ADC_TO_MRAM_TIMEOUT = 70000;
|
||||
// 60 s
|
||||
static const uint32_t MRAM_DUMP_TIMEOUT = 60000;
|
||||
// 2 s
|
||||
static const uint32_t BOOT_TIMEOUT = 2000;
|
||||
enum class StartupState: uint8_t {
|
||||
@ -141,15 +144,13 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
std::string supervisorFilePath = "ploc/supervisor";
|
||||
std::string activeMramFile;
|
||||
|
||||
// Setting this variable to true will enable direct downlink of MRAM packets
|
||||
bool downlinkMramDump = false;
|
||||
|
||||
// Supervisor helper class currently executing a command
|
||||
bool plocSupvHelperExecuting = false;
|
||||
|
||||
Countdown executionTimeout = Countdown(EXECUTION_DEFAULT_TIMEOUT, false);
|
||||
// Vorago nees some time to boot properly
|
||||
Countdown bootTimeout = Countdown(BOOT_TIMEOUT);
|
||||
Countdown mramDumpTimeout = Countdown(MRAM_DUMP_TIMEOUT);
|
||||
|
||||
/**
|
||||
* @brief Adjusts the timeout of the execution report dependent on command
|
||||
@ -280,6 +281,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
void prepareSetGpioCmd(const uint8_t* commandData);
|
||||
void prepareReadGpioCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareLoggingRequest(const uint8_t* commandData, size_t commandDataLen);
|
||||
ReturnValue_t prepareEnableNvmsCommand(const uint8_t* commandData);
|
||||
|
||||
/**
|
||||
* @brief Copies the content of a space packet to the command buffer.
|
||||
@ -293,6 +295,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
*/
|
||||
void disableAllReplies();
|
||||
|
||||
void disableReply(DeviceCommandId_t replyId);
|
||||
|
||||
/**
|
||||
* @brief This function sends a failure report if the active action was commanded by an other
|
||||
* object.
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit a4bf730b22125a5e28f9186e13b7d3a419442b82
|
||||
Subproject commit e62484ee80d160de704ec5a69a1f29c64f31b8d6
|
Loading…
Reference in New Issue
Block a user