get boot status report wip

This commit is contained in:
Jakob.Meier 2021-07-24 13:57:05 +02:00
parent de1f61a804
commit c4616e3633
4 changed files with 125 additions and 11 deletions

View File

@ -6,7 +6,7 @@
#include <fsfw/timemanager/Clock.h>
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF * comCookie) :
DeviceHandlerBase(objectId, uartComIFid, comCookie), hkset(this) {
DeviceHandlerBase(objectId, uartComIFid, comCookie), hkset(this), bootStatusReport(this) {
if (comCookie == NULL) {
sif::error << "PlocSupervisorHandler: Invalid com cookie" << std::endl;
}
@ -106,6 +106,11 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(
result = RETURN_OK;
break;
}
case(PLOC_SPV::GET_BOOT_STATUS_REPORT): {
prepareEmptyCmd(PLOC_SPV::APID_GET_BOOT_STATUS_RPT);
result = RETURN_OK;
break;
}
default:
sif::debug << "PlocSupervisorHandler::buildCommandFromCommand: Command not implemented"
<< std::endl;
@ -134,6 +139,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(PLOC_SPV::RESET_MPSOC);
this->insertInCommandMap(PLOC_SPV::SET_TIME_REF);
this->insertInCommandMap(PLOC_SPV::DISABLE_PERIOIC_HK_TRANSMISSION);
this->insertInCommandMap(PLOC_SPV::GET_BOOT_STATUS_REPORT);
this->insertInReplyMap(PLOC_SPV::ACK_REPORT, 3, nullptr, PLOC_SPV::SIZE_ACK_REPORT);
this->insertInReplyMap(PLOC_SPV::EXE_REPORT, 3, nullptr, PLOC_SPV::SIZE_EXE_REPORT);
this->insertInReplyMap(PLOC_SPV::HK_REPORT, 3, nullptr, PLOC_SPV::SIZE_HK_REPORT);
@ -191,6 +197,10 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
result = handleHkReport(packet);
break;
}
case (PLOC_SPV::BOOT_STATUS_REPORT): {
result = handleBootStatusReport(packet);
break;
}
case (PLOC_SPV::EXE_REPORT): {
result = handleExecutionReport(packet);
break;
@ -228,6 +238,15 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool
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 }));
return HasReturnvaluesIF::RETURN_OK;
}
@ -408,6 +427,53 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
return result;
}
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) {
sif::error << "PlocSupervisorHandler::handleBootStatusReport: Boot status report has invalid"
" crc" << std::endl;
return result;
}
uint16_t offset = PLOC_SPV::DATA_FIELD_OFFSET;
bootStatusReport.bootSignal = *(data + offset);
offest += 1;
bootStatusReport.resetCounter = *(data + offset);
offest += 1;
bootStatusReport.bootAfterMs = *(data + offset) << 24 | *(data + offset + 1) << 16 |
*(data + offset + 2) << 8 | *(data + offset + 3);
offest += 4;
bootStatusReport.bootTimeoutMs = *(data + offset) << 24 | *(data + offset + 1) << 16 |
*(data + offset + 2) << 8 | *(data + offset + 3);
offest += 4;
bootStatusReport.activeNvm = *(data + offset);
offest += 1;
bootStatusReport.bp0State = *(data + offset);
offest += 1;
bootStatusReport.bp1State = *(data + offset);
offest += 1;
bootStatusReport.bp2State = *(data + offset);
nextReplyId = PLOC_SPV::EXE_REPORT;
#if OBSW_VERBOSE_LEVEL >= 1 && PLOC_SUPERVISOR_DEBUG == 1
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Boot signal: " << static_cast<unsigned int>(bootStatusReport.bootSignal.value) << std::endl;
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Reset counter: " << static_cast<unsigned int>(bootStatusReport.resetCounter.value) << std::endl;
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BootAfterMs: " << bootStatusReport.bootAfterMs << " ms" << std::endl;
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BootTimeoutMs: " << bootStatusReport.bootTimeoutMs << " ms" << std::endl;
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Active NVM: " << static_cast<unsigned int>(bootStatusReport.activeNvm.value) << std::endl;
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BP0: " << static_cast<unsigned int>(bootStatusReport.bp0State) << std::endl;
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BP1: " << static_cast<unsigned int>(bootStatusReport.bp1State) << std::endl;
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BP2: " << static_cast<unsigned int>(bootStatusReport.bp2State) << std::endl;
#endif
return result;
}
ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
uint8_t expectedReplies, bool useAlternateId,
DeviceCommandId_t alternateReplyID) {

View File

@ -100,6 +100,7 @@ private:
DeviceCommandId_t nextReplyId = PLOC_SPV::NONE;
PLOC_SPV::HkSet hkset;
PLOC_SPV::BootStatusReport bootStatusReport;
UartComIF* uartComIf = nullptr;
@ -141,6 +142,12 @@ private:
*/
ReturnValue_t handleHkReport(const uint8_t* data);
/**
* @brief This function calls the function to check the CRC of the received boot status report
* and fills the associated dataset with the boot status information.
*/
ReturnValue_t handleBootStatusReport(const uint8_t* data);
/**
* @brief Depending on the current active command, this function sets the reply id of the
* next reply after a successful acknowledgment report has been received. This is

View File

@ -20,15 +20,18 @@ static const DeviceCommandId_t SET_MAX_RESTART_TRIES = 7;
static const DeviceCommandId_t RESET_MPSOC = 8;
static const DeviceCommandId_t SET_TIME_REF = 9;
static const DeviceCommandId_t DISABLE_PERIOIC_HK_TRANSMISSION = 10;
static const DeviceCommandId_t GET_BOOT_STATUS_REPORT = 11;
/** 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 = 5§;
static const uint16_t SIZE_ACK_REPORT = 14;
static const uint16_t SIZE_EXE_REPORT = 14;
static const uint16_t SIZE_HK_REPORT = 48;
static const uint16_t SIZE_BOOT_STATUS_REPORT = 22;
/**
* SpacePacket apids of telemetry packets
@ -100,12 +103,22 @@ enum PoolIds
TEMP_SUP,
UPTIME,
CPULOAD,
AVAILABLEHEAP
AVAILABLEHEAP,
BOOT_SIGNAL,
RESET_COUNTER,
BOOT_AFTER_MS,
BOOT_TIMEOUT_MS,
ACTIVE_NVM,
BP0_STATE,
BP1_STATE,
BP2_STATE
};
static const uint8_t HK_SET_ENTRIES = 13;
static const uint8_t BOOT_REPORT_SET_ENTRIES = 8;
static const uint32_t HK_SET_ID = HK_REPORT;
static const uint32_t BOOT_REPORT_SET_ID = APID_BOOT_STATUS_REPORT;
/**
* @brief With this class a space packet can be created which does not contain any data.
@ -363,7 +376,7 @@ private:
};
/**
* @brief This dataset to store the housekeeping data of the supervisor.
* @brief This dataset stores the housekeeping data of the supervisor.
*/
class HkSet: public StaticLocalDataSet<HK_SET_ENTRIES> {
public:
@ -376,21 +389,49 @@ public:
StaticLocalDataSet(sid_t(objectId, HK_SET_ID)) {
}
lp_var_t<uint32_t> numTms = lp_var_t<uint32_t>(sid.objectId, PoolIds::NUM_TMS, this);
lp_var_t<uint32_t> tempPs = lp_var_t<uint32_t>(sid.objectId, PoolIds::TEMP_PS, this);
lp_var_t<uint32_t> tempPl = lp_var_t<uint32_t>(sid.objectId, PoolIds::TEMP_PS, this);
lp_var_t<uint32_t> tempSup = lp_var_t<uint32_t>(sid.objectId, PoolIds::TEMP_SUP, this);
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, PoolIds::UPTIME, this);
lp_var_t<uint32_t> cpuLoad = lp_var_t<uint32_t>(sid.objectId, PoolIds::CPULOAD, this);
lp_var_t<uint32_t> availableHeap = lp_var_t<uint32_t>(sid.objectId, PoolIds::AVAILABLEHEAP,
this);
lp_var_t<uint32_t> numTcs = lp_var_t<uint32_t>(sid.objectId, PoolIds::NUM_TCS, this);
lp_var_t<uint32_t> numTms = lp_var_t<uint32_t>(sid.objectId, PoolIds::NUM_TMS, this);
lp_var_t<uint32_t> socState = lp_var_t<uint32_t>(sid.objectId, PoolIds::SOC_STATE, this);
lp_var_t<uint8_t> nvm0_1_state = lp_var_t<uint8_t>(sid.objectId, PoolIds::NVM0_1_STATE, this);
lp_var_t<uint8_t> nvm3_state = lp_var_t<uint8_t>(sid.objectId, PoolIds::NVM3_STATE, this);
lp_var_t<uint8_t> missionIoState = lp_var_t<uint8_t>(sid.objectId, PoolIds::MISSION_IO_STATE,
this);
lp_var_t<uint8_t> fmcState = lp_var_t<uint8_t>(sid.objectId, PoolIds::FMC_STATE, this);
lp_var_t<uint32_t> numTcs = lp_var_t<uint32_t>(sid.objectId, PoolIds::NUM_TCS, this);
lp_var_t<uint32_t> tempSup = lp_var_t<uint32_t>(sid.objectId, PoolIds::TEMP_SUP, this);
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, PoolIds::UPTIME, this);
lp_var_t<uint32_t> cpuLoad = lp_var_t<uint32_t>(sid.objectId, PoolIds::CPULOAD, this);
lp_var_t<uint32_t> availableHeap = lp_var_t<uint32_t>(sid.objectId, PoolIds::AVAILABLEHEAP,
this);
};
/**
* @brief This dataset stores the boot status report of the supervisor.
*/
class BootStatusReport: public StaticLocalDataSet<BOOT_REPORT_SET_ENTRIES> {
public:
BootStatusReport(HasLocalDataPoolIF* owner) :
StaticLocalDataSet(owner, BOOT_REPORT_SET_ID) {
}
BootStatusReport(object_id_t objectId) :
StaticLocalDataSet(sid_t(objectId, BOOT_REPORT_SET_ID)) {
}
/** Information about boot status of MPSoC */
lp_var_t<uint8_t> bootSignal = lp_var_t<uint8_t>(sid.objectId, PoolIds::BOOT_SIGNAL, this);
lp_var_t<uint8_t> resetCounter = lp_var_t<uint8_t>(sid.objectId, PoolIds::RESET_COUNTER, this);
/** Time the MPSoC needs for last boot */
lp_var_t<uint32_t> bootAfterMs = lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_AFTER_MS, this);
/** The currently set boot timeout */
lp_var_t<uint32_t> bootTimeoutMs = lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_TIMEOUT_MS, this);
lp_var_t<uint8_t> activeNvm = lp_var_t<uint32_t>(sid.objectId, PoolIds::ACTIVE_NVM, this);
/** States of the boot partition pins */
lp_var_t<uint8_t> bp0State = lp_var_t<uint32_t>(sid.objectId, PoolIds::BP0_STATE, this);
lp_var_t<uint8_t> bp1State = lp_var_t<uint32_t>(sid.objectId, PoolIds::BP1_STATE, this);
lp_var_t<uint8_t> bp2State = lp_var_t<uint32_t>(sid.objectId, PoolIds::BP2_STATE, this);
};
}

2
tmtc

@ -1 +1 @@
Subproject commit 941f46401e13fb6ee5fc653875eebff8496133ec
Subproject commit e552a92db4800cec4e81af75c33ee0e7f739c460