irq working

This commit is contained in:
Robin Müller 2022-11-02 18:58:29 +01:00
parent b2e3bc7e7a
commit 2d821ef8df
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
6 changed files with 19 additions and 23 deletions

View File

@ -6,8 +6,7 @@
#include <cmath> #include <cmath>
#include <cstdlib> #include <cstdlib>
CoreControllerDummy::CoreControllerDummy(object_id_t objectId) CoreControllerDummy::CoreControllerDummy(object_id_t objectId) : ExtendedControllerBase(objectId) {}
: ExtendedControllerBase(objectId) {}
ReturnValue_t CoreControllerDummy::initialize() { ReturnValue_t CoreControllerDummy::initialize() {
static bool done = false; static bool done = false;

View File

@ -5,8 +5,7 @@
#include <cmath> #include <cmath>
#include <cstdlib> #include <cstdlib>
SusDummy::SusDummy() SusDummy::SusDummy() : ExtendedControllerBase(objects::SUS_0_N_LOC_XFYFZM_PT_XF), susSet(this) {
: ExtendedControllerBase(objects::SUS_0_N_LOC_XFYFZM_PT_XF), susSet(this) {
ObjectManager::instance()->insert(objects::SUS_6_R_LOC_XFYBZM_PT_XF, this); ObjectManager::instance()->insert(objects::SUS_6_R_LOC_XFYBZM_PT_XF, this);
ObjectManager::instance()->insert(objects::SUS_1_N_LOC_XBYFZM_PT_XB, this); ObjectManager::instance()->insert(objects::SUS_1_N_LOC_XBYFZM_PT_XB, this);
ObjectManager::instance()->insert(objects::SUS_7_R_LOC_XBYBZM_PT_XB, this); ObjectManager::instance()->insert(objects::SUS_7_R_LOC_XBYBZM_PT_XB, this);

View File

@ -72,14 +72,19 @@ ReturnValue_t PdecHandler::initialize() {
sif::error << "Can not use IRQ mode if IRQ UIO name is invalid" << std::endl; sif::error << "Can not use IRQ mode if IRQ UIO name is invalid" << std::endl;
return returnvalue::FAILED; return returnvalue::FAILED;
} }
PdecConfig pdecConfig;
writePdecConfig(); writePdecConfigDuringReset(pdecConfig);
result = releasePdec(); result = releasePdec();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
// This configuration must be done while the PDEC is not held in reset.
if (OP_MODE == Modes::IRQ) {
// Configure interrupt mask register to enable interrupts
*(registerBaseAddress + PDEC_IMR_OFFSET) = pdecConfig.getImrReg();
}
result = actionHelper.initialize(commandQueue); result = actionHelper.initialize(commandQueue);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
@ -170,8 +175,6 @@ ReturnValue_t PdecHandler::irqOperation() {
// No TCs for timeout period // No TCs for timeout period
checkLocks(); checkLocks();
lockCheckCd.resetTimer(); lockCheckCd.resetTimer();
uint32_t pisr = *(registerBaseAddress + PDEC_PISR_OFFSET);
sif::debug << "Current PISR: " << pisr << std::endl;
} else if (ret >= 1) { } else if (ret >= 1) {
nb = read(fd, &info, sizeof(info)); nb = read(fd, &info, sizeof(info));
if (nb == static_cast<ssize_t>(sizeof(info))) { if (nb == static_cast<ssize_t>(sizeof(info))) {
@ -230,17 +233,10 @@ void PdecHandler::readCommandQueue(void) {
MessageQueueId_t PdecHandler::getCommandQueue() const { return commandQueue->getId(); } MessageQueueId_t PdecHandler::getCommandQueue() const { return commandQueue->getId(); }
void PdecHandler::writePdecConfig() { void PdecHandler::writePdecConfigDuringReset(PdecConfig& pdecConfig) {
PdecConfig pdecConfig;
*(memoryBaseAddress + FRAME_HEADER_OFFSET) = pdecConfig.getConfigWord(0); *(memoryBaseAddress + FRAME_HEADER_OFFSET) = pdecConfig.getConfigWord(0);
*(memoryBaseAddress + FRAME_HEADER_OFFSET + 1) = pdecConfig.getConfigWord(1); *(memoryBaseAddress + FRAME_HEADER_OFFSET + 1) = pdecConfig.getConfigWord(1);
if (OP_MODE == Modes::IRQ) {
// Configure interrupt mask register to enable interrupts
*(registerBaseAddress + PDEC_IMR_OFFSET) = pdecConfig.getImrReg();
}
// Configure all MAP IDs as invalid // Configure all MAP IDs as invalid
for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) { for (int idx = 0; idx <= MAX_MAP_ADDR; idx += 4) {
*(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx / 4) = *(memoryBaseAddress + MAP_ADDR_LUT_OFFSET + idx / 4) =
@ -261,8 +257,8 @@ void PdecHandler::writePdecConfig() {
ReturnValue_t PdecHandler::resetFarStatFlag() { ReturnValue_t PdecHandler::resetFarStatFlag() {
uint32_t pdecFar = readFar(); uint32_t pdecFar = readFar();
if (pdecFar != FAR_RESET) { if ((pdecFar & FAR_STAT_MASK) != FAR_STAT_MASK) {
sif::warning << "PdecHandler::resetFarStatFlag: FAR register did not match expected value." sif::warning << "PdecHandler::resetFarStatFlag: FAR register stat bit is not set."
<< " Read value: 0x" << std::hex << static_cast<unsigned int>(pdecFar) << " Read value: 0x" << std::hex << static_cast<unsigned int>(pdecFar)
<< std::endl; << std::endl;
CURRENT_FAR = pdecFar; CURRENT_FAR = pdecFar;

View File

@ -262,7 +262,7 @@ class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasAc
* @brief This functions writes the configuration parameters to the configuration * @brief This functions writes the configuration parameters to the configuration
* section of the PDEC. * section of the PDEC.
*/ */
void writePdecConfig(); void writePdecConfigDuringReset(PdecConfig& config);
/** /**
* @brief Reading the FAR resets the set stat flag which signals a new TC. Without clearing * @brief Reading the FAR resets the set stat flag which signals a new TC. Without clearing

View File

@ -15,6 +15,8 @@ static constexpr uint32_t NEW_FAR_MASK = 1 << 2;
static constexpr uint32_t TC_ABORT_MASK = 1 << 1; static constexpr uint32_t TC_ABORT_MASK = 1 << 1;
static constexpr uint32_t TC_NEW_MASK = 1 << 0; static constexpr uint32_t TC_NEW_MASK = 1 << 0;
static constexpr uint32_t FAR_STAT_MASK = 1 << 31;
static const uint32_t FRAME_ANA_MASK = 0x70000000; static const uint32_t FRAME_ANA_MASK = 0x70000000;
static const uint32_t IREASON_MASK = 0x0E000000; static const uint32_t IREASON_MASK = 0x0E000000;

View File

@ -80,14 +80,14 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
StorageManagerIF* tcStore; StorageManagerIF* tcStore;
StorageManagerIF* tmStore; StorageManagerIF* tmStore;
{ {
PoolManager::LocalPoolConfig poolCfg = {{200, 16}, {200, 32}, {150, 64}, PoolManager::LocalPoolConfig poolCfg = {{250, 16}, {250, 32}, {250, 64},
{100, 128}, {100, 1024}, {100, 2048}}; {150, 128}, {120, 1024}, {120, 2048}};
tcStore = new PoolManager(objects::TC_STORE, poolCfg); tcStore = new PoolManager(objects::TC_STORE, poolCfg);
} }
{ {
PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {300, 32}, {100, 64}, PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {300, 32}, {250, 64},
{100, 128}, {100, 1024}, {100, 2048}}; {150, 128}, {120, 1024}, {120, 2048}};
tmStore = new PoolManager(objects::TM_STORE, poolCfg); tmStore = new PoolManager(objects::TM_STORE, poolCfg);
} }