rework SUS polling
This commit is contained in:
@ -164,8 +164,8 @@ ReturnValue_t PdecHandler::polledOperation() {
|
||||
|
||||
// See https://yurovsky.github.io/2014/10/10/linux-uio-gpio-interrupt.html for more information.
|
||||
ReturnValue_t PdecHandler::irqOperation() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
int fd = -1;
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
int fd = -1;
|
||||
// Used to unmask IRQ
|
||||
uint32_t info = 1;
|
||||
|
||||
@ -183,7 +183,7 @@ ReturnValue_t PdecHandler::irqOperation() {
|
||||
case State::INIT: {
|
||||
result = handleInitState();
|
||||
if (result == returnvalue::OK) {
|
||||
openIrqFile(&fd);
|
||||
openIrqFile(&fd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -196,7 +196,7 @@ ReturnValue_t PdecHandler::irqOperation() {
|
||||
break;
|
||||
}
|
||||
case State::RUNNING: {
|
||||
checkLocks();
|
||||
checkLocks();
|
||||
checkAndHandleIrqs(fd, info);
|
||||
break;
|
||||
}
|
||||
@ -238,13 +238,13 @@ ReturnValue_t PdecHandler::handleInitState() {
|
||||
}
|
||||
|
||||
void PdecHandler::openIrqFile(int* fd) {
|
||||
*fd = open(uioNames.irq, O_RDWR);
|
||||
if (*fd < 0) {
|
||||
sif::error << "PdecHandler::irqOperation: Opening UIO IRQ file" << uioNames.irq << " failed"
|
||||
<< std::endl;
|
||||
triggerEvent(OPEN_IRQ_FILE_FAILED);
|
||||
state = State::WAIT_FOR_RECOVERY;
|
||||
}
|
||||
*fd = open(uioNames.irq, O_RDWR);
|
||||
if (*fd < 0) {
|
||||
sif::error << "PdecHandler::irqOperation: Opening UIO IRQ file" << uioNames.irq << " failed"
|
||||
<< std::endl;
|
||||
triggerEvent(OPEN_IRQ_FILE_FAILED);
|
||||
state = State::WAIT_FOR_RECOVERY;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PdecHandler::checkAndHandleIrqs(int fd, uint32_t& info) {
|
||||
|
@ -105,8 +105,7 @@ class PdecHandler : public SystemObject,
|
||||
//! [EXPORT] : [COMMENT] Failed to pull PDEC reset to low
|
||||
static constexpr Event PDEC_RESET_FAILED = event::makeEvent(SUBSYSTEM_ID, 10, severity::HIGH);
|
||||
//! [EXPORT] : [COMMENT] Failed to open the IRQ uio file
|
||||
static constexpr Event OPEN_IRQ_FILE_FAILED =
|
||||
event::makeEvent(SUBSYSTEM_ID, 11, severity::HIGH);
|
||||
static constexpr Event OPEN_IRQ_FILE_FAILED = event::makeEvent(SUBSYSTEM_ID, 11, severity::HIGH);
|
||||
|
||||
private:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER;
|
||||
|
Reference in New Issue
Block a user