Writeprotection handler in CoreController #87
@ -1,3 +1,4 @@
|
|||||||
|
#include <bsp_q7s/core/CoreController.h>
|
||||||
#include <bsp_q7s/memory/FileSystemHandler.h>
|
#include <bsp_q7s/memory/FileSystemHandler.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include "Q7STestTask.h"
|
#include "Q7STestTask.h"
|
||||||
@ -24,6 +25,7 @@ ReturnValue_t Q7STestTask::performOneShotAction() {
|
|||||||
//testScratchApi();
|
//testScratchApi();
|
||||||
//testJsonLibDirect();
|
//testJsonLibDirect();
|
||||||
//testDummyParams();
|
//testDummyParams();
|
||||||
|
testProtHandler();
|
||||||
//FsOpCodes opCode = FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY;
|
//FsOpCodes opCode = FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY;
|
||||||
//testFileSystemHandlerDirect(opCode);
|
//testFileSystemHandlerDirect(opCode);
|
||||||
return TestTask::performOneShotAction();
|
return TestTask::performOneShotAction();
|
||||||
@ -131,6 +133,46 @@ void Q7STestTask::testDummyParams() {
|
|||||||
sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl;
|
sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Q7STestTask::initialize() {
|
||||||
|
coreController = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
||||||
|
if(coreController == nullptr) {
|
||||||
|
sif::warning << "Q7STestTask::initialize: Could not retrieve CORE_CONTROLLER object" <<
|
||||||
|
std::endl;
|
||||||
|
}
|
||||||
|
return TestTask::initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Q7STestTask::testProtHandler() {
|
||||||
|
bool opPerformed = false;
|
||||||
|
ReturnValue_t result = coreController->checkAndSetBootCopyProtection(
|
||||||
|
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, false,
|
||||||
|
opPerformed, true);
|
||||||
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
|
}
|
||||||
|
if(not opPerformed) {
|
||||||
|
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||||
|
}
|
||||||
|
int retval = std::system("print-chip-prot-status.sh");
|
||||||
|
if(retval != 0) {
|
||||||
|
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||||
|
}
|
||||||
|
|
||||||
|
result = coreController->checkAndSetBootCopyProtection(
|
||||||
|
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, true,
|
||||||
|
opPerformed, true);
|
||||||
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
|
}
|
||||||
|
if(not opPerformed) {
|
||||||
|
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||||
|
}
|
||||||
|
retval = std::system("print-chip-prot-status.sh");
|
||||||
|
if(retval != 0) {
|
||||||
|
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
||||||
auto fsHandler = ObjectManager::instance()->
|
auto fsHandler = ObjectManager::instance()->
|
||||||
get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);
|
get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);
|
||||||
|
@ -6,7 +6,10 @@
|
|||||||
class Q7STestTask: public TestTask {
|
class Q7STestTask: public TestTask {
|
||||||
public:
|
public:
|
||||||
Q7STestTask(object_id_t objectId);
|
Q7STestTask(object_id_t objectId);
|
||||||
|
|
||||||
|
ReturnValue_t initialize() override;
|
||||||
private:
|
private:
|
||||||
|
CoreController* coreController = nullptr;
|
||||||
ReturnValue_t performOneShotAction() override;
|
ReturnValue_t performOneShotAction() override;
|
||||||
|
|
||||||
void testSdCard();
|
void testSdCard();
|
||||||
@ -15,6 +18,7 @@ private:
|
|||||||
void testScratchApi();
|
void testScratchApi();
|
||||||
void testJsonLibDirect();
|
void testJsonLibDirect();
|
||||||
void testDummyParams();
|
void testDummyParams();
|
||||||
|
void testProtHandler();
|
||||||
|
|
||||||
enum FsOpCodes {
|
enum FsOpCodes {
|
||||||
CREATE_EMPTY_FILE_IN_TMP,
|
CREATE_EMPTY_FILE_IN_TMP,
|
||||||
|
@ -1052,9 +1052,6 @@ ReturnValue_t CoreController::updateProtInfo(bool regenerateChipStateFile) {
|
|||||||
"Line counter larger than 4" << std::endl;
|
"Line counter larger than 4" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(uint8_t idx = 0; idx < 4; idx ++) {
|
|
||||||
sif::debug << (int) protArray[idx] << std::endl;
|
|
||||||
}
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user