From a6777067da544fccb21ad652242ee1f2ad28b228 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 19 Aug 2021 14:16:26 +0200 Subject: [PATCH] moved test --- bsp_q7s/boardtest/Q7STestTask.cpp | 42 +++++++++++++++++++++++++++++++ bsp_q7s/boardtest/Q7STestTask.h | 4 +++ bsp_q7s/core/CoreController.cpp | 3 --- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp index f9439fc1..c254e138 100644 --- a/bsp_q7s/boardtest/Q7STestTask.cpp +++ b/bsp_q7s/boardtest/Q7STestTask.cpp @@ -1,3 +1,4 @@ +#include #include #include #include "Q7STestTask.h" @@ -24,6 +25,7 @@ ReturnValue_t Q7STestTask::performOneShotAction() { //testScratchApi(); //testJsonLibDirect(); //testDummyParams(); + testProtHandler(); //FsOpCodes opCode = FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY; //testFileSystemHandlerDirect(opCode); return TestTask::performOneShotAction(); @@ -131,6 +133,46 @@ void Q7STestTask::testDummyParams() { sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl; } +ReturnValue_t Q7STestTask::initialize() { + coreController = ObjectManager::instance()->get(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) { auto fsHandler = ObjectManager::instance()-> get(objects::FILE_SYSTEM_HANDLER); diff --git a/bsp_q7s/boardtest/Q7STestTask.h b/bsp_q7s/boardtest/Q7STestTask.h index a14d8428..b0153ce9 100644 --- a/bsp_q7s/boardtest/Q7STestTask.h +++ b/bsp_q7s/boardtest/Q7STestTask.h @@ -6,7 +6,10 @@ class Q7STestTask: public TestTask { public: Q7STestTask(object_id_t objectId); + + ReturnValue_t initialize() override; private: + CoreController* coreController = nullptr; ReturnValue_t performOneShotAction() override; void testSdCard(); @@ -15,6 +18,7 @@ private: void testScratchApi(); void testJsonLibDirect(); void testDummyParams(); + void testProtHandler(); enum FsOpCodes { CREATE_EMPTY_FILE_IN_TMP, diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 976cfffb..89f9d450 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -1052,9 +1052,6 @@ ReturnValue_t CoreController::updateProtInfo(bool regenerateChipStateFile) { "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; }