From ace75919cafe73a533b29f46c67ae5f57f4381e4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 18 Oct 2023 12:24:22 +0200 Subject: [PATCH] more testing --- common/config/eive/definitions.h | 8 ++++---- linux/ipcore/PapbVcInterface.cpp | 11 +++++------ mission/com/LiveTmTask.cpp | 4 ++++ mission/com/VirtualChannel.cpp | 3 +++ 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/common/config/eive/definitions.h b/common/config/eive/definitions.h index 9274878f..9ed032a6 100644 --- a/common/config/eive/definitions.h +++ b/common/config/eive/definitions.h @@ -50,7 +50,7 @@ static constexpr uint32_t LEGACY_SA_DEPL_CHANNEL_ALTERNATION_INTERVAL_SECS = 5; // Maximum allowed burn time allowed by the software. static constexpr uint32_t SA_DEPL_MAX_BURN_TIME = 180; -static constexpr size_t CFDP_MAX_FILE_SEGMENT_LEN = 990; +static constexpr size_t CFDP_MAX_FILE_SEGMENT_LEN = 300; static constexpr uint32_t CCSDS_HANDLER_QUEUE_SIZE = 50; static constexpr uint8_t NUMBER_OF_VIRTUAL_CHANNELS = 4; @@ -63,11 +63,11 @@ static constexpr uint32_t HK_STORE_QUEUE_SIZE = 300; static constexpr uint32_t CFDP_STORE_QUEUE_SIZE = 300; static constexpr uint32_t LIVE_CHANNEL_NORMAL_QUEUE_SIZE = 250; -static constexpr uint32_t LIVE_CHANNEL_CFDP_QUEUE_SIZE = 400; +static constexpr uint32_t LIVE_CHANNEL_CFDP_QUEUE_SIZE = 450; -static constexpr uint32_t CFDP_MAX_FSM_CALL_COUNT_SRC_HANDLER = 60; +static constexpr uint32_t CFDP_MAX_FSM_CALL_COUNT_SRC_HANDLER = 50; static constexpr uint32_t CFDP_MAX_FSM_CALL_COUNT_DEST_HANDLER = 300; -static constexpr uint32_t CFDP_SHORT_DELAY_MS = 50; +static constexpr uint32_t CFDP_SHORT_DELAY_MS = 40; static constexpr uint32_t CFDP_REGULAR_DELAY_MS = 200; static constexpr uint32_t MAX_PUS_FUNNEL_QUEUE_DEPTH = 100; diff --git a/linux/ipcore/PapbVcInterface.cpp b/linux/ipcore/PapbVcInterface.cpp index bc324489..d11b6c9b 100644 --- a/linux/ipcore/PapbVcInterface.cpp +++ b/linux/ipcore/PapbVcInterface.cpp @@ -34,6 +34,7 @@ ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size, size_t& w } // The user must call advance until completion before starting a new packet transfer. if (writeActiveStatus) { + sif::debug << "is busy with writing" << std::endl; return IS_BUSY; } if (size > packetBuf.capacity()) { @@ -47,12 +48,9 @@ ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size, size_t& w if (pollReadyForPacket()) { startPacketTransfer(ByteWidthCfg::ONE); } else { + sif::debug << "is busy can not even start" << std::endl; return DirectTmSinkIF::IS_BUSY; } - if (not pollReadyForOctet(MAX_BUSY_POLLS)) { - abortPacketTransfer(); - return returnvalue::FAILED; - } return advanceWrite(writtenSize); } @@ -75,15 +73,16 @@ ReturnValue_t PapbVcInterface::advanceWrite(size_t& writtenSize) { if (not pollReadyForPacket()) { return IS_BUSY; } - for (size_t idx = currentPacketIndex; idx < currentPacketSize; idx++) { + while (currentPacketIndex < currentPacketSize) { if (not pollReadyForOctet(MAX_BUSY_POLLS)) { if (not pollReadyForPacket()) { return PARTIALLY_WRITTEN; } + sif::debug << "aborting unexpectedly" << std::endl; abortPacketTransfer(); return returnvalue::FAILED; } - *(vcBaseReg + DATA_REG_OFFSET) = static_cast(packetBuf[currentPacketIndex]); + *(vcBaseReg + DATA_REG_OFFSET) = static_cast(packetBuf[currentPacketIndex++]); writtenSize++; } if (not pollReadyForOctet(MAX_BUSY_POLLS)) { diff --git a/mission/com/LiveTmTask.cpp b/mission/com/LiveTmTask.cpp index 48e7476c..2792125c 100644 --- a/mission/com/LiveTmTask.cpp +++ b/mission/com/LiveTmTask.cpp @@ -173,12 +173,16 @@ ReturnValue_t LiveTmTask::handleGenericTmQueue(MessageQueueIF& queue, bool isCfd size_t writtenSize = 0; result = channel.write(data, size, writtenSize); if (result == DirectTmSinkIF::PARTIALLY_WRITTEN) { + sif::debug << "only partial write" << std::endl; result = channel.handleWriteCompletionSynchronously(writtenSize, 200); if (result != returnvalue::OK) { // TODO: Event? Might lead to dangerous spam though.. sif::warning << "LiveTmTask: Synchronous write of last segment failed with code 0x" << std::setw(4) << std::hex << result << std::dec << std::endl; } + } else if(result != returnvalue::OK) { + sif::error << "LiveTmTask: Channel write failed with code 0x" << std::hex << std::setw(4) << + result << std::dec << std::endl; } } // Try delete in any case, ignore failures (which should not happen), it is more important to diff --git a/mission/com/VirtualChannel.cpp b/mission/com/VirtualChannel.cpp index e531727e..11678180 100644 --- a/mission/com/VirtualChannel.cpp +++ b/mission/com/VirtualChannel.cpp @@ -67,12 +67,15 @@ ReturnValue_t VirtualChannel::handleWriteCompletionSynchronously(size_t& written } ReturnValue_t result = advanceWrite(writtenSize); if (result == returnvalue::OK) { + sif::debug << "transfer complete" << std::endl; // Transfer complete return result; } else if (result != PARTIALLY_WRITTEN) { + sif::debug << "transfer completion error" << std::endl; // Some error where we can not or should not continue the transfer. return result; } } + sif::debug << "wtf" << std::endl; return returnvalue::FAILED; }