A lot of new features and tweaks #12
27
container/DynamicFIFO.h
Normal file
27
container/DynamicFIFO.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef FRAMEWORK_CONTAINER_DYNAMICFIFO_H_
|
||||||
|
#define FRAMEWORK_CONTAINER_DYNAMICFIFO_H_
|
||||||
|
|
||||||
|
#include <framework/container/FIFOBase.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Simple First-In-First-Out data structure. The maximum size
|
||||||
|
* can be set in the constructor.
|
||||||
|
* @details
|
||||||
|
* The maximum capacity can be determined at run-time, so this container
|
||||||
|
* performs dynamic memory allocation!
|
||||||
|
* The public interface of FIFOBase exposes the user interface for the FIFO.
|
||||||
|
* @tparam T Entry Type
|
||||||
|
* @tparam capacity Maximum capacity
|
||||||
|
*/
|
||||||
|
template<typename T>
|
||||||
|
class DynamicFIFO: public FIFOBase<T> {
|
||||||
|
public:
|
||||||
|
DynamicFIFO(size_t maxCapacity): FIFOBase<T>(values.data(), maxCapacity),
|
||||||
|
values(maxCapacity) {};
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<T> values;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* FRAMEWORK_CONTAINER_DYNAMICFIFO_H_ */
|
@ -1,31 +1,26 @@
|
|||||||
#ifndef FRAMEWORK_CONTAINER_FIFO_H_
|
#ifndef FRAMEWORK_CONTAINER_FIFO_H_
|
||||||
#define FRAMEWORK_CONTAINER_FIFO_H_
|
#define FRAMEWORK_CONTAINER_FIFO_H_
|
||||||
|
|
||||||
|
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||||
#include <framework/container/FIFOBase.h>
|
#include <framework/container/FIFOBase.h>
|
||||||
#include <vector>
|
#include <array>
|
||||||
|
|
||||||
namespace fsfw {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Simple First-In-First-Out data structure. The maximum size
|
* @brief Simple First-In-First-Out data structure with size fixed at
|
||||||
* can be set in the constructor.
|
* compile time
|
||||||
* @details
|
* @details
|
||||||
* The maximum capacity can be determined at run-time, so this container
|
* Performs no dynamic memory allocation.
|
||||||
* performs dynamic memory allocation!
|
|
||||||
* The public interface of FIFOBase exposes the user interface for the FIFO.
|
* The public interface of FIFOBase exposes the user interface for the FIFO.
|
||||||
* @tparam T Entry Type
|
* @tparam T Entry Type
|
||||||
* @tparam capacity Maximum capacity
|
* @tparam capacity Maximum capacity
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T, size_t capacity>
|
||||||
class FIFO: public FIFOBase<T> {
|
class FIFO: public FIFOBase<T> {
|
||||||
public:
|
public:
|
||||||
FIFO(size_t maxCapacity): FIFOBase<T>(values.data(), maxCapacity),
|
FIFO(): FIFOBase<T>(values.data(), capacity) {};
|
||||||
values(maxCapacity) {};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<T> values;
|
std::array<T, capacity> values;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
#endif /* FRAMEWORK_CONTAINERS_STATICFIFO_H_ */
|
||||||
|
|
||||||
#endif /* FRAMEWORK_CONTAINER_FIFO_H_ */
|
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace fsfw {
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class FIFOBase {
|
class FIFOBase {
|
||||||
public:
|
public:
|
||||||
@ -60,6 +58,4 @@ private:
|
|||||||
|
|
||||||
#include <framework/container/FIFOBase.tpp>
|
#include <framework/container/FIFOBase.tpp>
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* FRAMEWORK_CONTAINER_FIFOBASE_H_ */
|
#endif /* FRAMEWORK_CONTAINER_FIFOBASE_H_ */
|
||||||
|
@ -17,7 +17,7 @@ SimpleRingBuffer::~SimpleRingBuffer() {
|
|||||||
|
|
||||||
ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data,
|
ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data,
|
||||||
uint32_t amount) {
|
uint32_t amount) {
|
||||||
if (availableWriteSpace() >= amount || overwriteOld) {
|
if (availableWriteSpace() >= amount or overwriteOld) {
|
||||||
uint32_t amountTillWrap = writeTillWrap();
|
uint32_t amountTillWrap = writeTillWrap();
|
||||||
if (amountTillWrap >= amount) {
|
if (amountTillWrap >= amount) {
|
||||||
memcpy(&buffer[write], data, amount);
|
memcpy(&buffer[write], data, amount);
|
||||||
@ -43,7 +43,7 @@ ReturnValue_t SimpleRingBuffer::readData(uint8_t* data, uint32_t amount,
|
|||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (trueAmount != NULL) {
|
if (trueAmount != nullptr) {
|
||||||
*trueAmount = amount;
|
*trueAmount = amount;
|
||||||
}
|
}
|
||||||
if (amountTillWrap >= amount) {
|
if (amountTillWrap >= amount) {
|
||||||
@ -65,7 +65,7 @@ ReturnValue_t SimpleRingBuffer::deleteData(uint32_t amount,
|
|||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (trueAmount != NULL) {
|
if (trueAmount != nullptr) {
|
||||||
*trueAmount = amount;
|
*trueAmount = amount;
|
||||||
}
|
}
|
||||||
incrementRead(amount, READ_PTR);
|
incrementRead(amount, READ_PTR);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define FRAMEWORK_CONTAINER_SIMPLERINGBUFFER_H_
|
#define FRAMEWORK_CONTAINER_SIMPLERINGBUFFER_H_
|
||||||
|
|
||||||
#include <framework/container/RingBufferBase.h>
|
#include <framework/container/RingBufferBase.h>
|
||||||
#include <stddef.h>
|
#include <cstddef>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Circular buffer implementation, useful for buffering
|
* @brief Circular buffer implementation, useful for buffering
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
#ifndef FRAMEWORK_CONTAINER_STATICFIFO_H_
|
|
||||||
#define FRAMEWORK_CONTAINER_STATICFIFO_H_
|
|
||||||
|
|
||||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
|
||||||
#include <framework/container/FIFOBase.h>
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
namespace fsfw {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Simple First-In-First-Out data structure with size fixed at
|
|
||||||
* compile time
|
|
||||||
* @details
|
|
||||||
* Performs no dynamic memory allocation.
|
|
||||||
* The public interface of FIFOBase exposes the user interface for the FIFO.
|
|
||||||
* @tparam T Entry Type
|
|
||||||
* @tparam capacity Maximum capacity
|
|
||||||
*/
|
|
||||||
template<typename T, size_t capacity>
|
|
||||||
class StaticFIFO: public FIFOBase<T> {
|
|
||||||
public:
|
|
||||||
StaticFIFO(): FIFOBase<T>(values.data(), capacity) {};
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::array<T, capacity> values;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* FRAMEWORK_CONTAINERS_STATICFIFO_H_ */
|
|
@ -10,7 +10,7 @@
|
|||||||
#include <framework/tmtcservices/VerificationReporter.h>
|
#include <framework/tmtcservices/VerificationReporter.h>
|
||||||
#include <framework/ipc/CommandMessage.h>
|
#include <framework/ipc/CommandMessage.h>
|
||||||
#include <framework/container/FixedMap.h>
|
#include <framework/container/FixedMap.h>
|
||||||
#include <framework/container/StaticFIFO.h>
|
#include <framework/container/FIFO.h>
|
||||||
#include <framework/serialize/SerializeIF.h>
|
#include <framework/serialize/SerializeIF.h>
|
||||||
|
|
||||||
class TcPacketStored;
|
class TcPacketStored;
|
||||||
@ -199,7 +199,7 @@ protected:
|
|||||||
uint32_t state;
|
uint32_t state;
|
||||||
Command_t command;
|
Command_t command;
|
||||||
object_id_t objectId;
|
object_id_t objectId;
|
||||||
fsfw::StaticFIFO<store_address_t, 3> fifo;
|
FIFO<store_address_t, 3> fifo;
|
||||||
};
|
};
|
||||||
|
|
||||||
using CommandMapIter = FixedMap<MessageQueueId_t,
|
using CommandMapIter = FixedMap<MessageQueueId_t,
|
||||||
|
@ -64,7 +64,7 @@ ReturnValue_t PusParser::readMultiplePackets(const uint8_t *frame,
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
fsfw::FIFO<PusParser::indexSizePair>* PusParser::fifo(){
|
DynamicFIFO<PusParser::indexSizePair>* PusParser::fifo(){
|
||||||
return &indexSizePairFIFO;
|
return &indexSizePairFIFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#ifndef FRAMEWORK_TMTCSERVICES_PUSPARSER_H_
|
#ifndef FRAMEWORK_TMTCSERVICES_PUSPARSER_H_
|
||||||
#define FRAMEWORK_TMTCSERVICES_PUSPARSER_H_
|
#define FRAMEWORK_TMTCSERVICES_PUSPARSER_H_
|
||||||
|
|
||||||
#include <framework/container/FIFO.h>
|
#include <framework/container/DynamicFIFO.h>
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ public:
|
|||||||
* by the parsePusPackets() function.
|
* by the parsePusPackets() function.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
fsfw::FIFO<indexSizePair>* fifo();
|
DynamicFIFO<indexSizePair>* fifo();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the next index and packet size pair from the FIFO.
|
* Retrieve the next index and packet size pair from the FIFO.
|
||||||
@ -69,7 +68,7 @@ private:
|
|||||||
//! A FIFO is used to store information about multiple PUS packets
|
//! A FIFO is used to store information about multiple PUS packets
|
||||||
//! inside the receive buffer. The maximum number of entries is defined
|
//! inside the receive buffer. The maximum number of entries is defined
|
||||||
//! by the first constructor argument.
|
//! by the first constructor argument.
|
||||||
fsfw::FIFO<indexSizePair> indexSizePairFIFO;
|
DynamicFIFO<indexSizePair> indexSizePairFIFO;
|
||||||
|
|
||||||
bool storeSplitPackets = false;
|
bool storeSplitPackets = false;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef FRAMEWORK_TMTCSERVICES_TMTCBRIDGE_H_
|
#ifndef FRAMEWORK_TMTCSERVICES_TMTCBRIDGE_H_
|
||||||
#define FRAMEWORK_TMTCSERVICES_TMTCBRIDGE_H_
|
#define FRAMEWORK_TMTCSERVICES_TMTCBRIDGE_H_
|
||||||
|
|
||||||
|
#include <framework/container/FIFO.h>
|
||||||
#include <framework/tmtcservices/AcceptsTelemetryIF.h>
|
#include <framework/tmtcservices/AcceptsTelemetryIF.h>
|
||||||
#include <framework/tasks/ExecutableObjectIF.h>
|
#include <framework/tasks/ExecutableObjectIF.h>
|
||||||
#include <framework/ipc/MessageQueueIF.h>
|
#include <framework/ipc/MessageQueueIF.h>
|
||||||
@ -8,7 +9,6 @@
|
|||||||
#include <framework/objectmanager/SystemObject.h>
|
#include <framework/objectmanager/SystemObject.h>
|
||||||
|
|
||||||
#include <framework/tmtcservices/TmTcMessage.h>
|
#include <framework/tmtcservices/TmTcMessage.h>
|
||||||
#include <framework/container/StaticFIFO.h>
|
|
||||||
|
|
||||||
class TmTcBridge : public AcceptsTelemetryIF,
|
class TmTcBridge : public AcceptsTelemetryIF,
|
||||||
public ExecutableObjectIF,
|
public ExecutableObjectIF,
|
||||||
@ -143,7 +143,7 @@ protected:
|
|||||||
* This fifo can be used to store downlink data
|
* This fifo can be used to store downlink data
|
||||||
* which can not be sent at the moment.
|
* which can not be sent at the moment.
|
||||||
*/
|
*/
|
||||||
fsfw::StaticFIFO<store_address_t, LIMIT_DOWNLINK_PACKETS_STORED> tmFifo;
|
FIFO<store_address_t, LIMIT_DOWNLINK_PACKETS_STORED> tmFifo;
|
||||||
uint8_t sentPacketsPerCycle = DEFAULT_STORED_DATA_SENT_PER_CYCLE;
|
uint8_t sentPacketsPerCycle = DEFAULT_STORED_DATA_SENT_PER_CYCLE;
|
||||||
uint8_t maxNumberOfPacketsStored = DEFAULT_DOWNLINK_PACKETS_STORED;
|
uint8_t maxNumberOfPacketsStored = DEFAULT_DOWNLINK_PACKETS_STORED;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user