that should do the job
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-06-22 14:25:11 +02:00
parent afcc0cc21d
commit 788fbb72f0
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
4 changed files with 68 additions and 2 deletions

View File

@ -32,6 +32,7 @@ will consitute of a breaking change warranting a new major release:
- APB bus access busy checking is not done anymore as this is performed by the bus itself now. - APB bus access busy checking is not done anymore as this is performed by the bus itself now.
- Core controller will now announce version and image information event in addition to reboot - Core controller will now announce version and image information event in addition to reboot
event in the `inititalize` function. event in the `inititalize` function.
- Added core controller action to read reboot mechansm information
## Added ## Added

View File

@ -319,7 +319,6 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
return HasActionsIF::INVALID_PARAMETERS; return HasActionsIF::INVALID_PARAMETERS;
} }
std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_FILE; std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_FILE;
// Disable the reboot file mechanism
parseRebootFile(path, rebootFile); parseRebootFile(path, rebootFile);
if (data[0] == 0) { if (data[0] == 0) {
rebootFile.enabled = false; rebootFile.enabled = false;
@ -332,6 +331,16 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
} }
return HasActionsIF::EXECUTION_FINISHED; return HasActionsIF::EXECUTION_FINISHED;
} }
case (READ_REBOOT_MECHANISM_INFO): {
std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_FILE;
parseRebootFile(path, rebootFile);
RebootMechanismPacket packet(rebootFile);
ReturnValue_t result = actionHelper.reportData(commandedBy, actionId, &packet);
if (result != returnvalue::OK) {
return result;
}
return HasActionsIF::EXECUTION_FINISHED;
}
case (RESET_REBOOT_COUNTERS): { case (RESET_REBOOT_COUNTERS): {
if (size == 0) { if (size == 0) {
resetRebootCount(xsc::ALL_CHIP, xsc::ALL_COPY); resetRebootCount(xsc::ALL_CHIP, xsc::ALL_COPY);
@ -1998,7 +2007,6 @@ bool CoreController::parseRebootFile(std::string path, RebootFile &rf) {
void CoreController::resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy) { void CoreController::resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy) {
std::string path = currMntPrefix + REBOOT_FILE; std::string path = currMntPrefix + REBOOT_FILE;
// Disable the reboot file mechanism
parseRebootFile(path, rebootFile); parseRebootFile(path, rebootFile);
if (tgtChip == xsc::ALL_CHIP and tgtCopy == xsc::ALL_COPY) { if (tgtChip == xsc::ALL_CHIP and tgtCopy == xsc::ALL_COPY) {
rebootFile.img00Cnt = 0; rebootFile.img00Cnt = 0;
@ -2428,6 +2436,7 @@ void CoreController::announceVersionInfo() {
} }
void CoreController::announceCurrentImageInfo() { void CoreController::announceCurrentImageInfo() {
using namespace core;
triggerEvent(CURRENT_IMAGE_INFO, CURRENT_CHIP, CURRENT_COPY); triggerEvent(CURRENT_IMAGE_INFO, CURRENT_CHIP, CURRENT_COPY);
} }

View File

@ -45,6 +45,61 @@ struct RebootFile {
xsc::Copy mechanismNextCopy = xsc::Copy::NO_COPY; xsc::Copy mechanismNextCopy = xsc::Copy::NO_COPY;
}; };
class RebootMechanismPacket : public SerialLinkedListAdapter<SerializeIF> {
public:
RebootMechanismPacket(RebootFile& rf) {
enabled = rf.enabled;
maxCount = rf.maxCount;
img00Count = rf.img00Cnt;
img01Count = rf.img01Cnt;
img10Count = rf.img10Cnt;
img11Count = rf.img11Cnt;
img00Lock = rf.img00Lock;
img01Lock = rf.img01Lock;
img10Lock = rf.img10Lock;
img11Lock = rf.img11Lock;
lastChip = static_cast<uint8_t>(rf.lastChip);
lastCopy = static_cast<uint8_t>(rf.lastCopy);
nextChip = static_cast<uint8_t>(rf.mechanismNextChip);
nextCopy = static_cast<uint8_t>(rf.mechanismNextCopy);
setLinks();
}
private:
void setLinks() {
setStart(&enabled);
enabled.setNext(&maxCount);
maxCount.setNext(&img00Count);
img00Count.setNext(&img01Count);
img01Count.setNext(&img10Count);
img10Count.setNext(&img11Count);
img11Count.setNext(&img00Lock);
img00Lock.setNext(&img01Lock);
img01Lock.setNext(&img10Lock);
img10Lock.setNext(&img11Lock);
img11Lock.setNext(&lastChip);
lastChip.setNext(&lastCopy);
lastCopy.setNext(&nextChip);
nextChip.setNext(&nextCopy);
setLast(&nextCopy);
}
SerializeElement<uint8_t> enabled = false;
SerializeElement<uint32_t> maxCount = 0;
SerializeElement<uint32_t> img00Count = 0;
SerializeElement<uint32_t> img01Count = 0;
SerializeElement<uint32_t> img10Count = 0;
SerializeElement<uint32_t> img11Count = 0;
SerializeElement<uint8_t> img00Lock = false;
SerializeElement<uint8_t> img01Lock = false;
SerializeElement<uint8_t> img10Lock = false;
SerializeElement<uint8_t> img11Lock = false;
SerializeElement<uint8_t> lastChip = 0;
SerializeElement<uint8_t> lastCopy = 0;
SerializeElement<uint8_t> nextChip = 0;
SerializeElement<uint8_t> nextCopy = 0;
};
class CoreController : public ExtendedControllerBase, public ReceivesParameterMessagesIF { class CoreController : public ExtendedControllerBase, public ReceivesParameterMessagesIF {
public: public:
enum ParamId : uint8_t { PREF_SD = 0, NUM_IDS }; enum ParamId : uint8_t { PREF_SD = 0, NUM_IDS };

View File

@ -53,6 +53,7 @@ static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5;
static constexpr ActionId_t RESET_REBOOT_COUNTERS = 6; static constexpr ActionId_t RESET_REBOOT_COUNTERS = 6;
static constexpr ActionId_t SWITCH_IMG_LOCK = 7; static constexpr ActionId_t SWITCH_IMG_LOCK = 7;
static constexpr ActionId_t SET_MAX_REBOOT_CNT = 8; static constexpr ActionId_t SET_MAX_REBOOT_CNT = 8;
static constexpr ActionId_t READ_REBOOT_MECHANISM_INFO = 9;
static constexpr ActionId_t OBSW_UPDATE_FROM_SD_0 = 10; static constexpr ActionId_t OBSW_UPDATE_FROM_SD_0 = 10;
static constexpr ActionId_t OBSW_UPDATE_FROM_SD_1 = 11; static constexpr ActionId_t OBSW_UPDATE_FROM_SD_1 = 11;