PDEC DTB update
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-09-12 12:54:24 +02:00
parent db74d0490b
commit cdf63f0d42
Signed by: muellerr
GPG Key ID: A649FB78196E3849
3 changed files with 24 additions and 11 deletions

View File

@ -190,6 +190,7 @@ ReturnValue_t PdecConfig::createFirstWord(uint32_t* word) {
return result;
}
*word |= static_cast<uint32_t>(positiveWindow);
printf("Word 1: 0x%08x\n", *word);
return returnvalue::OK;
}
@ -205,6 +206,7 @@ ReturnValue_t PdecConfig::createSecondWord(uint32_t* word) {
*word |= (static_cast<uint32_t>(negativeWindow) << 24);
*word |= (HIGH_AU_MAP_ID << 16);
*word |= (ENABLE_DERANDOMIZER << 8);
printf("Word 2: 0x%08x\n", *word);
return returnvalue::OK;
}

View File

@ -53,23 +53,30 @@ ReturnValue_t PdecHandler::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
ReturnValue_t result = returnvalue::OK;
UioMapper regMapper(uioNames.registers);
result = regMapper.getMappedAdress(&registerBaseAddress, UioMapper::Permissions::READ_WRITE);
ReturnValue_t result =
regMapper.getMappedAdress(&registerBaseAddress, UioMapper::Permissions::READ_WRITE);
if (result != returnvalue::OK) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
UioMapper configMemMapper(uioNames.configMemory);
result = configMemMapper.getMappedAdress(&memoryBaseAddress, UioMapper::Permissions::READ_WRITE);
if (result != returnvalue::OK) {
int fd = 0;
if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {
sif::error << "PdecHandler::initialize: Opening /dev/mem failed" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
};
memoryBaseAddress = static_cast<uint32_t*>(
mmap(0, PDEC_CFG_MEM_SIZE, static_cast<int>(UioMapper::Permissions::READ_WRITE), MAP_SHARED,
fd, PDEC_RAM_PHY_ADDR));
if (memoryBaseAddress == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
} else {
pdecConfig.setMemoryBaseAddress(memoryBaseAddress);
}
UioMapper ramMapper(uioNames.ramMemory);
result = ramMapper.getMappedAdress(&ramBaseAddress, UioMapper::Permissions::READ_WRITE);
if (result != returnvalue::OK) {
pdecConfig.setMemoryBaseAddress(memoryBaseAddress);
ramBaseAddress = static_cast<uint32_t*>(mmap(0, PDEC_RAM_SIZE,
static_cast<int>(UioMapper::Permissions::READ_WRITE),
MAP_SHARED, fd, PDEC_RAM_PHY_ADDR));
if (ramBaseAddress == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}

View File

@ -51,6 +51,10 @@ class PdecHandler : public SystemObject,
public ReceivesParameterMessagesIF {
public:
static constexpr dur_millis_t IRQ_TIMEOUT_MS = 500;
static constexpr uint32_t PDEC_CFG_MEM_SIZE = 0x1000;
static constexpr uint32_t PDEC_CFG_MEM_PHY_ADDR = 0x24000000;
static constexpr uint32_t PDEC_RAM_SIZE = 0x10000;
static constexpr uint32_t PDEC_RAM_PHY_ADDR = 0x26000000;
enum class Modes { POLLED, IRQ };