bugfixes for PAPB IF
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-10-13 09:27:24 +02:00
parent ffe1281eb9
commit 99192606a2
Signed by: muellerr
GPG Key ID: A649FB78196E3849
2 changed files with 13 additions and 9 deletions

View File

@ -37,7 +37,7 @@ ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size, size_t& w
abortPacketTransfer();
return returnvalue::FAILED;
}
return finishWritePartialOpt(data, size, true);
return finishWriteInternal(data, size, writtenSize);
}
void PapbVcInterface::startPacketTransfer(ByteWidthCfg initWidth) {
@ -53,11 +53,20 @@ bool PapbVcInterface::pollReadyForPacket() const {
return (reg >> 6) & 0b1;
}
ReturnValue_t PapbVcInterface::finishWritePartialOpt(const uint8_t* data, size_t remainingSize,
bool handlePartial) {
ReturnValue_t PapbVcInterface::finishWrite(const uint8_t* data, size_t remainingSize) {
if (not pollReadyForPacket()) {
return returnvalue::FAILED;
}
size_t dummy = 0;
return finishWriteInternal(data, remainingSize, dummy);
}
ReturnValue_t PapbVcInterface::finishWriteInternal(const uint8_t* data, size_t remainingSize,
size_t& writtenSize) {
for (size_t idx = 0; idx < remainingSize; idx++) {
if (not pollReadyForOctet(MAX_BUSY_POLLS)) {
if (not pollReadyForPacket()) {
writtenSize = idx;
return PARTIALLY_WRITTEN;
}
abortPacketTransfer();
@ -109,8 +118,4 @@ inline bool PapbVcInterface::pollReadyForOctet(uint32_t maxCycles) const {
return false;
}
ReturnValue_t PapbVcInterface::finishWrite(const uint8_t* data, size_t remainingSize) {
return finishWritePartialOpt(data, remainingSize, false);
}
void PapbVcInterface::abortPacketTransfer() { *vcBaseReg = CONFIG_ABORT; }

View File

@ -43,8 +43,7 @@ class PapbVcInterface : public VirtualChannelIF {
ReturnValue_t write(const uint8_t* data, size_t size, size_t& writtenSize) override;
ReturnValue_t finishWrite(const uint8_t* data, size_t remainingSize) override;
ReturnValue_t finishWritePartialOpt(const uint8_t* data, size_t remainingSize,
bool handlePartial);
ReturnValue_t finishWriteInternal(const uint8_t* data, size_t remainingSize, size_t& writtenSize);
void cancelTransfer() override;