add start method for uart man
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
This commit is contained in:
parent
38e74e6eaf
commit
2b4ec6d274
@ -95,13 +95,13 @@ void ObjectFactory::produce(void* args) {
|
|||||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||||
std::string plocSupvString = "/dev/ploc_supv";
|
std::string plocSupvString = "/dev/ploc_supv";
|
||||||
auto supervisorCookie =
|
auto supervisorCookie =
|
||||||
new UartCookie(objects::PLOC_SUPERVISOR_HANDLER, plocSupvString, uart::PLOC_SUPV_BAUD,
|
new SerialCookie(objects::PLOC_SUPERVISOR_HANDLER, plocSupvString, uart::PLOC_SUPV_BAUD,
|
||||||
supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL);
|
supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL);
|
||||||
supervisorCookie->setNoFixedSizeReply();
|
supervisorCookie->setNoFixedSizeReply();
|
||||||
auto supvHelper = new PlocSupvUartManager(objects::PLOC_SUPERVISOR_HELPER);
|
auto supvHelper = new PlocSupvUartManager(objects::PLOC_SUPERVISOR_HELPER);
|
||||||
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::PLOC_SUPERVISOR_HELPER,
|
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::PLOC_SUPERVISOR_HELPER,
|
||||||
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, dummyGpioIF),
|
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, dummyGpioIF),
|
||||||
pcdu::PDU1_CH6_PLOC_12V, supvHelper);
|
pcdu::PDU1_CH6_PLOC_12V, *supvHelper);
|
||||||
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ using namespace returnvalue;
|
|||||||
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid,
|
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid,
|
||||||
CookieIF* comCookie, Gpio uartIsolatorSwitch,
|
CookieIF* comCookie, Gpio uartIsolatorSwitch,
|
||||||
power::Switch_t powerSwitch,
|
power::Switch_t powerSwitch,
|
||||||
PlocSupvUartManager* supvHelper)
|
PlocSupvUartManager& supvHelper)
|
||||||
: DeviceHandlerBase(objectId, uartComIFid, comCookie),
|
: DeviceHandlerBase(objectId, uartComIFid, comCookie),
|
||||||
uartIsolatorSwitch(uartIsolatorSwitch),
|
uartIsolatorSwitch(uartIsolatorSwitch),
|
||||||
hkset(this),
|
hkset(this),
|
||||||
@ -33,9 +33,6 @@ PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t u
|
|||||||
if (comCookie == nullptr) {
|
if (comCookie == nullptr) {
|
||||||
sif::error << "PlocSupervisorHandler: Invalid com cookie" << std::endl;
|
sif::error << "PlocSupervisorHandler: Invalid com cookie" << std::endl;
|
||||||
}
|
}
|
||||||
if (supvHelper == nullptr) {
|
|
||||||
sif::error << "PlocSupervisorHandler: Invalid PlocSupvHelper object" << std::endl;
|
|
||||||
}
|
|
||||||
spParams.buf = commandBuffer;
|
spParams.buf = commandBuffer;
|
||||||
spParams.maxSize = sizeof(commandBuffer);
|
spParams.maxSize = sizeof(commandBuffer);
|
||||||
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||||
@ -52,10 +49,6 @@ ReturnValue_t PlocSupervisorHandler::initialize() {
|
|||||||
#ifdef XIPHOS_Q7S
|
#ifdef XIPHOS_Q7S
|
||||||
sdcMan = SdCardManager::instance();
|
sdcMan = SdCardManager::instance();
|
||||||
#endif /* TE0720_1CFA */
|
#endif /* TE0720_1CFA */
|
||||||
if (supvHelper == nullptr) {
|
|
||||||
sif::warning << "PlocSupervisorHandler::initialize: Invalid supervisor helper" << std::endl;
|
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = eventSubscription();
|
result = eventSubscription();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
@ -87,10 +80,6 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
|
|||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
switch (actionId) {
|
switch (actionId) {
|
||||||
case TERMINATE_SUPV_HELPER: {
|
|
||||||
supvHelper->stop();
|
|
||||||
return EXECUTION_FINISHED;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -114,7 +103,7 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
|
|||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = supvHelper->performUpdate(params);
|
result = supvHelper.performUpdate(params);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -122,7 +111,7 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
|
|||||||
return EXECUTION_FINISHED;
|
return EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
case CONTINUE_UPDATE: {
|
case CONTINUE_UPDATE: {
|
||||||
supvHelper->initiateUpdateContinuation();
|
supvHelper.initiateUpdateContinuation();
|
||||||
plocSupvHelperExecuting = true;
|
plocSupvHelperExecuting = true;
|
||||||
return EXECUTION_FINISHED;
|
return EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
@ -135,7 +124,7 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
|
|||||||
if (not std::filesystem::exists(params.file)) {
|
if (not std::filesystem::exists(params.file)) {
|
||||||
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
supvHelper->performMemCheck(params.file, params.memId, params.startAddr);
|
supvHelper.performMemCheck(params.file, params.memId, params.startAddr);
|
||||||
plocSupvHelperExecuting = true;
|
plocSupvHelperExecuting = true;
|
||||||
return EXECUTION_FINISHED;
|
return EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
@ -150,6 +139,7 @@ void PlocSupervisorHandler::doStartUp() {
|
|||||||
switch (startupState) {
|
switch (startupState) {
|
||||||
case StartupState::OFF: {
|
case StartupState::OFF: {
|
||||||
bootTimeout.resetTimer();
|
bootTimeout.resetTimer();
|
||||||
|
supvHelper.start();
|
||||||
startupState = StartupState::BOOTING;
|
startupState = StartupState::BOOTING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -177,6 +167,7 @@ void PlocSupervisorHandler::doStartUp() {
|
|||||||
|
|
||||||
void PlocSupervisorHandler::doShutDown() {
|
void PlocSupervisorHandler::doShutDown() {
|
||||||
setMode(_MODE_POWER_DOWN);
|
setMode(_MODE_POWER_DOWN);
|
||||||
|
supvHelper.stop();
|
||||||
uartIsolatorSwitch.pullLow();
|
uartIsolatorSwitch.pullLow();
|
||||||
startupState = StartupState::OFF;
|
startupState = StartupState::OFF;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
public:
|
public:
|
||||||
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
|
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF* comCookie,
|
||||||
Gpio uartIsolatorSwitch, power::Switch_t powerSwitch,
|
Gpio uartIsolatorSwitch, power::Switch_t powerSwitch,
|
||||||
PlocSupvUartManager* supvHelper);
|
PlocSupvUartManager& supvHelper);
|
||||||
virtual ~PlocSupervisorHandler();
|
virtual ~PlocSupervisorHandler();
|
||||||
|
|
||||||
virtual ReturnValue_t initialize() override;
|
virtual ReturnValue_t initialize() override;
|
||||||
@ -130,7 +130,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
const power::Switch_t powerSwitch = power::NO_SWITCH;
|
const power::Switch_t powerSwitch = power::NO_SWITCH;
|
||||||
supv::TmBase tmReader;
|
supv::TmBase tmReader;
|
||||||
|
|
||||||
PlocSupvUartManager* supvHelper = nullptr;
|
PlocSupvUartManager& supvHelper;
|
||||||
MessageQueueIF* eventQueue = nullptr;
|
MessageQueueIF* eventQueue = nullptr;
|
||||||
|
|
||||||
/** Number of expected replies following the MRAM dump command */
|
/** Number of expected replies following the MRAM dump command */
|
||||||
|
@ -94,6 +94,9 @@ ReturnValue_t PlocSupvUartManager::initialize() {
|
|||||||
ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
|
ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
|
||||||
bool putTaskToSleep = false;
|
bool putTaskToSleep = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
lock->lockMutex();
|
||||||
|
state = InternalState::SLEEPING;
|
||||||
|
lock->unlockMutex();
|
||||||
semaphore->acquire();
|
semaphore->acquire();
|
||||||
while (true) {
|
while (true) {
|
||||||
putTaskToSleep = handleUartReception();
|
putTaskToSleep = handleUartReception();
|
||||||
@ -289,6 +292,14 @@ void PlocSupvUartManager::stop() {
|
|||||||
state = InternalState::GO_TO_SLEEP;
|
state = InternalState::GO_TO_SLEEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlocSupvUartManager::start() {
|
||||||
|
MutexGuard mg(lock);
|
||||||
|
if (state == InternalState::SLEEPING or state == InternalState::GO_TO_SLEEP) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
semaphore->release();
|
||||||
|
}
|
||||||
|
|
||||||
void PlocSupvUartManager::executeFullCheckMemoryCommand() {
|
void PlocSupvUartManager::executeFullCheckMemoryCommand() {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
if (update.crcShouldBeChecked) {
|
if (update.crcShouldBeChecked) {
|
||||||
|
@ -148,10 +148,15 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
|
|||||||
// ReturnValue_t startEventBufferRequest(std::string path);
|
// ReturnValue_t startEventBufferRequest(std::string path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Can be used to interrupt a running data transfer.
|
* @brief Can be used to stop the UART reception and put the task to sleep
|
||||||
*/
|
*/
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Can be used to start the UART reception
|
||||||
|
*/
|
||||||
|
void start();
|
||||||
|
|
||||||
static uint32_t buildProgParams1(uint8_t percent, uint16_t seqCount);
|
static uint32_t buildProgParams1(uint8_t percent, uint16_t seqCount);
|
||||||
static uint32_t buildApidServiceParam1(uint8_t apid, uint8_t serviceId);
|
static uint32_t buildApidServiceParam1(uint8_t apid, uint8_t serviceId);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user