Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/KSat/fsfw into mueller/master
This commit is contained in:
commit
9ff3a8537c
@ -9,6 +9,7 @@ SharedRingBuffer::SharedRingBuffer(object_id_t objectId, const size_t size,
|
|||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SharedRingBuffer::SharedRingBuffer(object_id_t objectId, uint8_t *buffer,
|
SharedRingBuffer::SharedRingBuffer(object_id_t objectId, uint8_t *buffer,
|
||||||
const size_t size, bool overwriteOld, size_t maxExcessBytes):
|
const size_t size, bool overwriteOld, size_t maxExcessBytes):
|
||||||
SystemObject(objectId), SimpleRingBuffer(buffer, size, overwriteOld,
|
SystemObject(objectId), SimpleRingBuffer(buffer, size, overwriteOld,
|
||||||
@ -16,6 +17,11 @@ SharedRingBuffer::SharedRingBuffer(object_id_t objectId, uint8_t *buffer,
|
|||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SharedRingBuffer::setToUseReceiveSizeFIFO(uint32_t fifoDepth) {
|
||||||
|
this->fifoDepth = fifoDepth;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t SharedRingBuffer::lockRingBufferMutex(
|
ReturnValue_t SharedRingBuffer::lockRingBufferMutex(
|
||||||
MutexIF::TimeoutType timeoutType, dur_millis_t timeout) {
|
MutexIF::TimeoutType timeoutType, dur_millis_t timeout) {
|
||||||
return mutex->lockMutex(timeoutType, timeout);
|
return mutex->lockMutex(timeoutType, timeout);
|
||||||
@ -25,6 +31,25 @@ ReturnValue_t SharedRingBuffer::unlockRingBufferMutex() {
|
|||||||
return mutex->unlockMutex();
|
return mutex->unlockMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MutexIF* SharedRingBuffer::getMutexHandle() const {
|
MutexIF* SharedRingBuffer::getMutexHandle() const {
|
||||||
return mutex;
|
return mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t SharedRingBuffer::initialize() {
|
||||||
|
if(fifoDepth > 0) {
|
||||||
|
receiveSizesFIFO = new DynamicFIFO<size_t>(fifoDepth);
|
||||||
|
}
|
||||||
|
return SystemObject::initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicFIFO<size_t>* SharedRingBuffer::getReceiveSizesFIFO() {
|
||||||
|
if(receiveSizesFIFO == nullptr) {
|
||||||
|
// Configuration error.
|
||||||
|
sif::warning << "SharedRingBuffer::getReceiveSizesFIFO: Ring buffer"
|
||||||
|
<< " was not configured to have sizes FIFO, returning nullptr!"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
return receiveSizesFIFO;
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define FSFW_CONTAINER_SHAREDRINGBUFFER_H_
|
#define FSFW_CONTAINER_SHAREDRINGBUFFER_H_
|
||||||
|
|
||||||
#include "SimpleRingBuffer.h"
|
#include "SimpleRingBuffer.h"
|
||||||
|
#include "DynamicFIFO.h"
|
||||||
#include "../ipc/MutexIF.h"
|
#include "../ipc/MutexIF.h"
|
||||||
#include "../objectmanager/SystemObject.h"
|
#include "../objectmanager/SystemObject.h"
|
||||||
#include "../timemanager/Clock.h"
|
#include "../timemanager/Clock.h"
|
||||||
@ -26,6 +27,8 @@ public:
|
|||||||
SharedRingBuffer(object_id_t objectId, const size_t size,
|
SharedRingBuffer(object_id_t objectId, const size_t size,
|
||||||
bool overwriteOld, size_t maxExcessBytes);
|
bool overwriteOld, size_t maxExcessBytes);
|
||||||
|
|
||||||
|
void setToUseReceiveSizeFIFO(uint32_t fifoDepth);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This constructor takes an external buffer with the specified size.
|
* This constructor takes an external buffer with the specified size.
|
||||||
* @param buffer
|
* @param buffer
|
||||||
@ -59,8 +62,21 @@ public:
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
MutexIF* getMutexHandle() const;
|
MutexIF* getMutexHandle() const;
|
||||||
|
|
||||||
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the shared ring buffer was configured to have a sizes FIFO, a handle
|
||||||
|
* to that FIFO can be retrieved with this function.
|
||||||
|
* Do not forget to protect access with a lock if required!
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
DynamicFIFO<size_t>* getReceiveSizesFIFO();
|
||||||
private:
|
private:
|
||||||
MutexIF* mutex = nullptr;
|
MutexIF* mutex = nullptr;
|
||||||
|
|
||||||
|
size_t fifoDepth = 0;
|
||||||
|
DynamicFIFO<size_t>* receiveSizesFIFO = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,14 +1,7 @@
|
|||||||
/**
|
#include "Countdown.h"
|
||||||
* @file Countdown.cpp
|
|
||||||
* @brief This file defines the Countdown class.
|
|
||||||
* @date 21.03.2013
|
|
||||||
* @author baetz
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
Countdown::Countdown(uint32_t initialTimeout): startTime(0),
|
||||||
#include "../timemanager/Countdown.h"
|
timeout(initialTimeout) {
|
||||||
|
|
||||||
Countdown::Countdown(uint32_t initialTimeout) : startTime(0), timeout(initialTimeout) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Countdown::~Countdown() {
|
Countdown::~Countdown() {
|
||||||
|
@ -1,18 +1,13 @@
|
|||||||
|
#ifndef FSFW_TIMEMANAGER_COUNTDOWN_H_
|
||||||
|
#define FSFW_TIMEMANAGER_COUNTDOWN_H_
|
||||||
|
|
||||||
|
#include "Clock.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file Countdown.h
|
|
||||||
* @brief This file defines the Countdown class.
|
* @brief This file defines the Countdown class.
|
||||||
* @date 21.03.2013
|
|
||||||
* @author baetz
|
* @author baetz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef COUNTDOWN_H_
|
|
||||||
#define COUNTDOWN_H_
|
|
||||||
|
|
||||||
#include "../timemanager/Clock.h"
|
|
||||||
|
|
||||||
class Countdown {
|
class Countdown {
|
||||||
private:
|
|
||||||
uint32_t startTime;
|
|
||||||
public:
|
public:
|
||||||
uint32_t timeout;
|
uint32_t timeout;
|
||||||
Countdown(uint32_t initialTimeout = 0);
|
Countdown(uint32_t initialTimeout = 0);
|
||||||
@ -23,9 +18,14 @@ public:
|
|||||||
|
|
||||||
bool isBusy() const;
|
bool isBusy() const;
|
||||||
|
|
||||||
ReturnValue_t resetTimer(); //!< Use last set timeout value and restart timer.
|
//!< Use last set timeout value and restart timer.
|
||||||
|
ReturnValue_t resetTimer();
|
||||||
|
|
||||||
void timeOut(); //!< Make hasTimedOut() return true
|
//!< Make hasTimedOut() return true
|
||||||
|
void timeOut();
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32_t startTime = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* COUNTDOWN_H_ */
|
#endif /* FSFW_TIMEMANAGER_COUNTDOWN_H_ */
|
||||||
|
@ -384,10 +384,10 @@ void CommandingServiceBase::acceptPacket(uint8_t reportId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CommandingServiceBase::checkAndExecuteFifo(CommandMapIter iter) {
|
void CommandingServiceBase::checkAndExecuteFifo(CommandMapIter& iter) {
|
||||||
store_address_t address;
|
store_address_t address;
|
||||||
if (iter->second.fifo.retrieve(&address) != RETURN_OK) {
|
if (iter->second.fifo.retrieve(&address) != RETURN_OK) {
|
||||||
commandMap.erase(iter->first);
|
commandMap.erase(&iter);
|
||||||
} else {
|
} else {
|
||||||
TcPacketStored newPacket(address);
|
TcPacketStored newPacket(address);
|
||||||
startExecution(&newPacket, iter);
|
startExecution(&newPacket, iter);
|
||||||
@ -411,12 +411,7 @@ void CommandingServiceBase::checkTimeout() {
|
|||||||
uint32_t uptime;
|
uint32_t uptime;
|
||||||
Clock::getUptime(&uptime);
|
Clock::getUptime(&uptime);
|
||||||
CommandMapIter iter;
|
CommandMapIter iter;
|
||||||
// TODO: BUG HERE! Problems with comparison operator of iterator.
|
|
||||||
for (iter = commandMap.begin(); iter != commandMap.end(); ++iter) {
|
for (iter = commandMap.begin(); iter != commandMap.end(); ++iter) {
|
||||||
if(commandMap.empty()) {
|
|
||||||
// intermediate solution!
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ((iter->second.uptimeOfStart + (timeoutSeconds * 1000)) < uptime) {
|
if ((iter->second.uptimeOfStart + (timeoutSeconds * 1000)) < uptime) {
|
||||||
verificationReporter.sendFailureReport(
|
verificationReporter.sendFailureReport(
|
||||||
TC_VERIFY::COMPLETION_FAILURE, iter->second.tcInfo.ackFlags,
|
TC_VERIFY::COMPLETION_FAILURE, iter->second.tcInfo.ackFlags,
|
||||||
|
@ -316,7 +316,7 @@ protected:
|
|||||||
ReturnValue_t sendTmPacket(uint8_t subservice, SerializeIF* content,
|
ReturnValue_t sendTmPacket(uint8_t subservice, SerializeIF* content,
|
||||||
SerializeIF* header = nullptr);
|
SerializeIF* header = nullptr);
|
||||||
|
|
||||||
void checkAndExecuteFifo(CommandMapIter iter);
|
void checkAndExecuteFifo(CommandMapIter& iter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -95,8 +95,9 @@ ReturnValue_t TmTcBridge::handleTm() {
|
|||||||
ReturnValue_t status = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t status = HasReturnvaluesIF::RETURN_OK;
|
||||||
ReturnValue_t result = handleTmQueue();
|
ReturnValue_t result = handleTmQueue();
|
||||||
if(result != RETURN_OK) {
|
if(result != RETURN_OK) {
|
||||||
sif::error << "TmTcBridge::handleTm: Error handling TM queue!"
|
sif::error << "TmTcBridge::handleTm: Error handling TM queue with "
|
||||||
<< std::endl;
|
<< "error code 0x" << std::hex << result << std::dec
|
||||||
|
<< "!" << std::endl;
|
||||||
status = result;
|
status = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user