Merge branch 'develop' into meier/debug

This commit is contained in:
Jakob Meier 2024-03-27 10:37:02 +01:00
commit ede89de552
6 changed files with 32 additions and 12 deletions

View File

@ -1,5 +1,6 @@
#include "fsfw/container/SharedRingBuffer.h"
#include "SharedRingBuffer.h"
#include "fsfw/ipc/MutexFactory.h"
#include "fsfw/ipc/MutexGuard.h"
@ -15,7 +16,12 @@ SharedRingBuffer::SharedRingBuffer(object_id_t objectId, uint8_t* buffer, const
mutex = MutexFactory::instance()->createMutex();
}
SharedRingBuffer::~SharedRingBuffer() { MutexFactory::instance()->deleteMutex(mutex); }
SharedRingBuffer::~SharedRingBuffer() {
MutexFactory::instance()->deleteMutex(mutex);
if (receiveSizesFifo != nullptr) {
delete (receiveSizesFifo);
}
}
void SharedRingBuffer::setToUseReceiveSizeFIFO(size_t fifoDepth) { this->fifoDepth = fifoDepth; }
@ -30,18 +36,30 @@ MutexIF* SharedRingBuffer::getMutexHandle() const { return mutex; }
ReturnValue_t SharedRingBuffer::initialize() {
if (fifoDepth > 0) {
receiveSizesFIFO = new DynamicFIFO<size_t>(fifoDepth);
receiveSizesFifo = new DynamicFIFO<size_t>(fifoDepth);
}
return SystemObject::initialize();
}
DynamicFIFO<size_t>* SharedRingBuffer::getReceiveSizesFIFO() {
if (receiveSizesFIFO == nullptr) {
DynamicFIFO<size_t>* SharedRingBuffer::getReceiveSizesFifo() {
if (receiveSizesFifo == nullptr) {
// Configuration error.
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "SharedRingBuffer::getReceiveSizesFIFO: Ring buffer"
<< " was not configured to have sizes FIFO, returning nullptr!" << std::endl;
#endif
}
return receiveSizesFIFO;
return receiveSizesFifo;
}
ReturnValue_t SharedRingBuffer::fifoEmpty(bool& empty, MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
if(receiveSizesFifo == nullptr) {
return returnvalue::FAILED;
}
MutexGuard mg(mutex, timeoutType, timeoutMs);
if(mg.getLockResult() != returnvalue::OK) {
return mg.getLockResult();
}
empty = receiveSizesFifo->empty();
return returnvalue::OK;
}

View File

@ -78,13 +78,15 @@ class SharedRingBuffer : public SystemObject, public SimpleRingBuffer {
* Do not forget to protect access with a lock if required!
* @return
*/
DynamicFIFO<size_t>* getReceiveSizesFIFO();
DynamicFIFO<size_t>* getReceiveSizesFifo();
ReturnValue_t fifoEmpty(bool& empty, MutexIF::TimeoutType timeoutType, uint32_t timeoutMs);
private:
MutexIF* mutex = nullptr;
size_t fifoDepth = 0;
DynamicFIFO<size_t>* receiveSizesFIFO = nullptr;
DynamicFIFO<size_t>* receiveSizesFifo = nullptr;
};
#endif /* FSFW_CONTAINER_SHAREDRINGBUFFER_H_ */
#endif /* FSFW_CONTAINER_SHAREDRINGBUFFER_H_ */

View File

@ -3,9 +3,9 @@
#include <atomic>
#include <condition_variable>
#include <string>
#include <thread>
#include <vector>
#include <string>
#include "fsfw/objectmanager/ObjectManagerIF.h"
#include "fsfw/tasks/FixedSlotSequence.h"

View File

@ -3,9 +3,9 @@
#include <atomic>
#include <condition_variable>
#include <string>
#include <thread>
#include <vector>
#include <string>
#include "fsfw/objectmanager/ObjectManagerIF.h"
#include "fsfw/tasks/PeriodicTaskBase.h"

View File

@ -3,8 +3,8 @@
#include <fsfw/returnvalues/returnvalue.h>
#include <thread>
#include <string>
#include <thread>
namespace tasks {

View File

@ -150,7 +150,7 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleResetCom
template <size_t MAX_NUM_TCS>
inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doInsertActivity(
const uint8_t *data, size_t size) {
if(telecommandMap.full()) {
if (telecommandMap.full()) {
return MAP_IS_FULL;
}
uint32_t timestamp = 0;