save before endianess change

This commit is contained in:
Jakob Meier 2021-05-16 21:53:07 +02:00
parent a39d47cff5
commit fbad470836
2 changed files with 6 additions and 5 deletions

View File

@ -26,7 +26,7 @@ ReturnValue_t CCSDSIPCoreBridge::initialize() {
* Map uio device in virtual address space
* PROT_WRITE: Map uio device in writable only mode
*/
ptmeBaseAddress = static_cast<uint32_t*>(mmap(NULL, MAP_SIZE, PROT_WRITE, MAP_SHARED, fd, 0));
ptmeBaseAddress = mmap(NULL, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (ptmeBaseAddress == MAP_FAILED) {
sif::error << "CCSDSIPCoreBridge::initialize: Failed to map uio address" << std::endl;
@ -61,7 +61,8 @@ ReturnValue_t CCSDSIPCoreBridge::sendTm(const uint8_t * data, size_t dataLen) {
for(size_t idx = 0; idx < dataLen; idx++) {
if(pollPapbSignal() == RETURN_OK) {
*(ptmeBaseAddress + PTME_DATA_REG_OFFSET) = static_cast<uint32_t>(*(data + idx));
*(static_cast<uint32_t*>(ptmeBaseAddress) + PTME_DATA_REG_OFFSET) =
static_cast<uint32_t>(*(data + idx));
}
else {
sif::debug << "CCSDSIPCoreBridge::sendTm: Only written " << idx - 1 << " of " << dataLen
@ -77,11 +78,11 @@ ReturnValue_t CCSDSIPCoreBridge::sendTm(const uint8_t * data, size_t dataLen) {
}
void CCSDSIPCoreBridge::startPacketTransfer() {
*(ptmeBaseAddress) = PTME_CONFIG_START;
*(static_cast<uint32_t*>(ptmeBaseAddress)) = PTME_CONFIG_START;
}
void CCSDSIPCoreBridge::endPacketTransfer() {
*(ptmeBaseAddress) = PTME_CONFIG_END;
*(static_cast<uint32_t*>(ptmeBaseAddress)) = PTME_CONFIG_END;
}
ReturnValue_t CCSDSIPCoreBridge::pollPapbSignal() {

View File

@ -90,7 +90,7 @@ private:
int fd;
/** PTME base address */
uint32_t* ptmeBaseAddress = nullptr;
void* ptmeBaseAddress = nullptr;
/**
* @brief This function sends the config byte to the PTME IP Core to initiate a packet