CFDP Source Handler Testing #803

Merged
muellerr merged 14 commits from cfdp-source-handler-testing into cfdp-source-handler 2023-10-13 17:10:44 +02:00
14 changed files with 61 additions and 23 deletions
Showing only changes of commit b8beddc11b - Show all commits

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 314 translations. * @brief Auto-generated event translation file. Contains 314 translations.
* @details * @details
* Generated on: 2023-10-13 09:44:05 * Generated on: 2023-10-13 15:23:30
*/ */
#include "translateEvents.h" #include "translateEvents.h"

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 174 translations. * Contains 174 translations.
* Generated on: 2023-10-13 09:44:05 * Generated on: 2023-10-13 15:23:30
*/ */
#include "translateObjects.h" #include "translateObjects.h"

View File

@ -521,5 +521,5 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x6e01;PTM_BusyDumping;No description;1;PERSISTENT_TM_STORE;mission/tmtc/PersistentTmStore.h 0x6e01;PTM_BusyDumping;No description;1;PERSISTENT_TM_STORE;mission/tmtc/PersistentTmStore.h
0x6f00;TMS_IsBusy;No description;0;TM_SINK;mission/tmtc/DirectTmSinkIF.h 0x6f00;TMS_IsBusy;No description;0;TM_SINK;mission/tmtc/DirectTmSinkIF.h
0x6f01;TMS_PartiallyWritten;No description;1;TM_SINK;mission/tmtc/DirectTmSinkIF.h 0x6f01;TMS_PartiallyWritten;No description;1;TM_SINK;mission/tmtc/DirectTmSinkIF.h
0x6f02;TMS_IncompletePartialWrite;No description;2;TM_SINK;mission/tmtc/DirectTmSinkIF.h 0x6f02;TMS_NoWriteActive;No description;2;TM_SINK;mission/tmtc/DirectTmSinkIF.h
0x7000;VCS_ChannelDoesNotExist;No description;0;VIRTUAL_CHANNEL;mission/com/VirtualChannel.h 0x7000;VCS_ChannelDoesNotExist;No description;0;VIRTUAL_CHANNEL;mission/com/VirtualChannel.h

1 Full ID (hex) Name Description Unique ID Subsytem Name File Path
521 0x6e01 PTM_BusyDumping No description 1 PERSISTENT_TM_STORE mission/tmtc/PersistentTmStore.h
522 0x6f00 TMS_IsBusy No description 0 TM_SINK mission/tmtc/DirectTmSinkIF.h
523 0x6f01 TMS_PartiallyWritten No description 1 TM_SINK mission/tmtc/DirectTmSinkIF.h
524 0x6f02 TMS_IncompletePartialWrite TMS_NoWriteActive No description 2 TM_SINK mission/tmtc/DirectTmSinkIF.h
525 0x7000 VCS_ChannelDoesNotExist No description 0 VIRTUAL_CHANNEL mission/com/VirtualChannel.h

View File

@ -616,6 +616,6 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x6e01;PTM_BusyDumping;No description;1;PERSISTENT_TM_STORE;mission/tmtc/PersistentTmStore.h 0x6e01;PTM_BusyDumping;No description;1;PERSISTENT_TM_STORE;mission/tmtc/PersistentTmStore.h
0x6f00;TMS_IsBusy;No description;0;TM_SINK;mission/tmtc/DirectTmSinkIF.h 0x6f00;TMS_IsBusy;No description;0;TM_SINK;mission/tmtc/DirectTmSinkIF.h
0x6f01;TMS_PartiallyWritten;No description;1;TM_SINK;mission/tmtc/DirectTmSinkIF.h 0x6f01;TMS_PartiallyWritten;No description;1;TM_SINK;mission/tmtc/DirectTmSinkIF.h
0x6f02;TMS_IncompletePartialWrite;No description;2;TM_SINK;mission/tmtc/DirectTmSinkIF.h 0x6f02;TMS_NoWriteActive;No description;2;TM_SINK;mission/tmtc/DirectTmSinkIF.h
0x7000;VCS_ChannelDoesNotExist;No description;0;VIRTUAL_CHANNEL;mission/com/VirtualChannel.h 0x7000;VCS_ChannelDoesNotExist;No description;0;VIRTUAL_CHANNEL;mission/com/VirtualChannel.h
0x7200;SCBU_KeyNotFound;No description;0;SCRATCH_BUFFER;bsp_q7s/memory/scratchApi.h 0x7200;SCBU_KeyNotFound;No description;0;SCRATCH_BUFFER;bsp_q7s/memory/scratchApi.h

1 Full ID (hex) Name Description Unique ID Subsytem Name File Path
616 0x6e01 PTM_BusyDumping No description 1 PERSISTENT_TM_STORE mission/tmtc/PersistentTmStore.h
617 0x6f00 TMS_IsBusy No description 0 TM_SINK mission/tmtc/DirectTmSinkIF.h
618 0x6f01 TMS_PartiallyWritten No description 1 TM_SINK mission/tmtc/DirectTmSinkIF.h
619 0x6f02 TMS_IncompletePartialWrite TMS_NoWriteActive No description 2 TM_SINK mission/tmtc/DirectTmSinkIF.h
620 0x7000 VCS_ChannelDoesNotExist No description 0 VIRTUAL_CHANNEL mission/com/VirtualChannel.h
621 0x7200 SCBU_KeyNotFound No description 0 SCRATCH_BUFFER bsp_q7s/memory/scratchApi.h

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 314 translations. * @brief Auto-generated event translation file. Contains 314 translations.
* @details * @details
* Generated on: 2023-10-13 09:44:05 * Generated on: 2023-10-13 15:23:30
*/ */
#include "translateEvents.h" #include "translateEvents.h"

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 178 translations. * Contains 178 translations.
* Generated on: 2023-10-13 09:44:05 * Generated on: 2023-10-13 15:23:30
*/ */
#include "translateObjects.h" #include "translateObjects.h"

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 314 translations. * @brief Auto-generated event translation file. Contains 314 translations.
* @details * @details
* Generated on: 2023-10-13 09:44:05 * Generated on: 2023-10-13 15:23:30
*/ */
#include "translateEvents.h" #include "translateEvents.h"

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 178 translations. * Contains 178 translations.
* Generated on: 2023-10-13 09:44:05 * Generated on: 2023-10-13 15:23:30
*/ */
#include "translateObjects.h" #include "translateObjects.h"

View File

@ -32,8 +32,8 @@ ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size, size_t& w
if (size < 4) { if (size < 4) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
// The user must call finishWrite before starting a new packet transfer. // The user must call advance until completion before starting a new packet transfer.
if (writeActive) { if (writeActiveStatus) {
return IS_BUSY; return IS_BUSY;
} }
if (size > packetBuf.capacity()) { if (size > packetBuf.capacity()) {
@ -60,11 +60,6 @@ void PapbVcInterface::startPacketTransfer(ByteWidthCfg initWidth) {
*vcBaseReg = CONFIG_DATA_INPUT | initWidth; *vcBaseReg = CONFIG_DATA_INPUT | initWidth;
} }
void PapbVcInterface::completePacketTransfer() {
*vcBaseReg = CONFIG_END;
writeActive = false;
}
bool PapbVcInterface::pollReadyForPacket() const { bool PapbVcInterface::pollReadyForPacket() const {
// Check if PAPB interface is ready to receive data. Use the configuration register for this. // Check if PAPB interface is ready to receive data. Use the configuration register for this.
// Bit 5, see PTME ptme_001_01-0-7-r2 Table 31. // Bit 5, see PTME ptme_001_01-0-7-r2 Table 31.
@ -73,6 +68,9 @@ bool PapbVcInterface::pollReadyForPacket() const {
} }
ReturnValue_t PapbVcInterface::advanceWrite(size_t& writtenSize) { ReturnValue_t PapbVcInterface::advanceWrite(size_t& writtenSize) {
if (!writeActiveStatus) {
return NO_WRITE_ACTIVE;
}
if (not pollReadyForPacket()) { if (not pollReadyForPacket()) {
return IS_BUSY; return IS_BUSY;
} }
@ -95,6 +93,8 @@ ReturnValue_t PapbVcInterface::advanceWrite(size_t& writtenSize) {
return returnvalue::OK; return returnvalue::OK;
} }
bool PapbVcInterface::writeActive() const { return writeActiveStatus; }
bool PapbVcInterface::isVcInterfaceBufferEmpty() { bool PapbVcInterface::isVcInterfaceBufferEmpty() {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
gpio::Levels papbEmptyState = gpio::Levels::HIGH; gpio::Levels papbEmptyState = gpio::Levels::HIGH;
@ -131,4 +131,16 @@ inline bool PapbVcInterface::pollReadyForOctet(uint32_t maxCycles) const {
return false; return false;
} }
void PapbVcInterface::abortPacketTransfer() { *vcBaseReg = CONFIG_ABORT; } void PapbVcInterface::abortPacketTransfer() {
*vcBaseReg = CONFIG_ABORT;
writeActiveStatus = false;
currentPacketIndex = 0;
currentPacketSize = 0;
}
void PapbVcInterface::completePacketTransfer() {
*vcBaseReg = CONFIG_END;
writeActiveStatus = false;
currentPacketIndex = 0;
currentPacketSize = 0;
}

View File

@ -50,6 +50,8 @@ class PapbVcInterface : public VirtualChannelIF {
void cancelTransfer() override; void cancelTransfer() override;
bool writeActive() const override;
ReturnValue_t initialize() override; ReturnValue_t initialize() override;
private: private:
@ -95,12 +97,11 @@ class PapbVcInterface : public VirtualChannelIF {
std::vector<uint8_t> packetBuf; std::vector<uint8_t> packetBuf;
std::string uioFile; std::string uioFile;
int mapNum = 0; int mapNum = 0;
bool writeActive = false; bool writeActiveStatus = false;
size_t currentPacketIndex = 0; size_t currentPacketIndex = 0;
size_t currentPacketSize = 0; size_t currentPacketSize = 0;
mutable struct timespec nextDelay = {.tv_sec = 0, .tv_nsec = 0}; mutable struct timespec nextDelay = {.tv_sec = 0, .tv_nsec = 0};
const struct timespec BETWEEN_POLL_DELAY = {.tv_sec = 0, .tv_nsec = 10}; const struct timespec BETWEEN_POLL_DELAY = {.tv_sec = 0, .tv_nsec = 10};
mutable struct timespec remDelay;
volatile uint32_t* vcBaseReg = nullptr; volatile uint32_t* vcBaseReg = nullptr;

View File

@ -28,6 +28,13 @@ ReturnValue_t VirtualChannel::advanceWrite(size_t& writtenSize) {
return ptme.getVirtChannel(vcId)->advanceWrite(writtenSize); return ptme.getVirtChannel(vcId)->advanceWrite(writtenSize);
} }
bool VirtualChannel::writeActive() const {
if (!ptme.containsVc(vcId)) {
return CHANNEL_DOES_NOT_EXIST;
}
return ptme.getVirtChannel(vcId)->writeActive();
}
const char* VirtualChannel::getName() const { return vcName.c_str(); } const char* VirtualChannel::getName() const { return vcName.c_str(); }
bool VirtualChannel::isBusy() const { bool VirtualChannel::isBusy() const {

View File

@ -35,6 +35,7 @@ class VirtualChannel : public SystemObject, public VirtualChannelIF {
ReturnValue_t advanceWrite(size_t& writtenSize) override; ReturnValue_t advanceWrite(size_t& writtenSize) override;
ReturnValue_t handleWriteCompletionSynchronously(size_t& writtenSize, ReturnValue_t handleWriteCompletionSynchronously(size_t& writtenSize,
unsigned maxCompletionTimeMs); unsigned maxCompletionTimeMs);
bool writeActive() const override;
void cancelTransfer() override; void cancelTransfer() override;
uint8_t getVcid() const; uint8_t getVcid() const;
bool isTxOn() const; bool isTxOn() const;

View File

@ -14,21 +14,38 @@ class DirectTmSinkIF {
static constexpr ReturnValue_t IS_BUSY = returnvalue::makeCode(CLASS_ID, 0); static constexpr ReturnValue_t IS_BUSY = returnvalue::makeCode(CLASS_ID, 0);
static constexpr ReturnValue_t PARTIALLY_WRITTEN = returnvalue::makeCode(CLASS_ID, 1); static constexpr ReturnValue_t PARTIALLY_WRITTEN = returnvalue::makeCode(CLASS_ID, 1);
static constexpr ReturnValue_t NO_WRITE_ACTIVE = returnvalue::makeCode(CLASS_ID, 2);
/** /**
* @brief Implements the functionality to write to a TM sink directly * @brief Implements the functionality to write to a TM sink directly.
*
* The write might not be completed immediately! If PARTIALLY_WRITTEN is returned, the user
* should poll the ready for packet status bit and call @advanceWrite continuously until
* the transfer is completed.
* *
* @param data Pointer to buffer holding the data to write * @param data Pointer to buffer holding the data to write
* @param size Number of bytes to write * @param size Number of bytes to write
* @return returnvalue::OK on success, returnvalue::FAILED on failure, IS_BUSY * @param writtenSize Size written during write call.
* if the TM sink is busy, PARTIALLY_WRITTEN if only a portion of the bytes could be * @return returnvalue::OK on full write success, IS_BUSY if a previous write transfer has not
* written. * been completed yet or the PAPB interface is not ready for a packet, PARTIALLY_WRITTEN
* if some bytes were written, but the transfer has not been completed yet.
*/ */
virtual ReturnValue_t write(const uint8_t* data, size_t size, size_t& writtenSize) = 0; virtual ReturnValue_t write(const uint8_t* data, size_t size, size_t& writtenSize) = 0;
/**
* Advances a active file transfer.
* @param writtenSize
* @return returnvalue::OK if the packet write process is complete, PARTIALLY_WRITTEN if
* some bytes were written but the transfer is not complete yet.
*/
virtual ReturnValue_t advanceWrite(size_t& writtenSize) = 0; virtual ReturnValue_t advanceWrite(size_t& writtenSize) = 0;
virtual bool isBusy() const = 0; virtual bool isBusy() const = 0;
/**
* The PAPB interface is currently busy writing a packet and a new packet can not be written yet.
* @return
*/
virtual bool writeActive() const = 0;
}; };
#endif /* MISSION_TMTC_DIRECTTMSINKIF_H_ */ #endif /* MISSION_TMTC_DIRECTTMSINKIF_H_ */

2
tmtc

@ -1 +1 @@
Subproject commit 10e163be752a6a259b6d3dabea825acc9c9725f8 Subproject commit 60f7ae5453b387ee5ebcf6a338c34284004dbce7