Merge remote-tracking branch 'upstream/master' into mueller/devices/FDIR

This commit is contained in:
Robin Müller 2020-08-27 19:55:22 +02:00
commit 2a74c8d150
44 changed files with 603 additions and 306 deletions

View File

@ -10,7 +10,7 @@ class ActionMessage {
private: private:
ActionMessage(); ActionMessage();
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::ACTION; static const uint8_t MESSAGE_ID = messagetypes::ACTION;
static const Command_t EXECUTE_ACTION = MAKE_COMMAND_ID(1); static const Command_t EXECUTE_ACTION = MAKE_COMMAND_ID(1);
static const Command_t STEP_SUCCESS = MAKE_COMMAND_ID(2); static const Command_t STEP_SUCCESS = MAKE_COMMAND_ID(2);
static const Command_t STEP_FAILED = MAKE_COMMAND_ID(3); static const Command_t STEP_FAILED = MAKE_COMMAND_ID(3);

View File

@ -1,10 +1,13 @@
#ifndef SINGLYLINKEDLIST_H_ #ifndef FRAMEWORK_CONTAINER_SINGLYLINKEDLIST_H_
#define SINGLYLINKEDLIST_H_ #define FRAMEWORK_CONTAINER_SINGLYLINKEDLIST_H_
#include <cstddef>
#include <cstdint>
#include <stddef.h>
#include <stdint.h>
/** /**
* \ingroup container * @brief Linked list data structure,
* each entry has a pointer to the next entry (singly)
* @ingroup container
*/ */
template<typename T> template<typename T>
class LinkedElement { class LinkedElement {
@ -12,11 +15,8 @@ public:
T *value; T *value;
class Iterator { class Iterator {
public: public:
LinkedElement<T> *value; LinkedElement<T> *value = nullptr;
Iterator() : Iterator() {}
value(NULL) {
}
Iterator(LinkedElement<T> *element) : Iterator(LinkedElement<T> *element) :
value(element) { value(element) {
@ -45,12 +45,11 @@ public:
} }
}; };
LinkedElement(T* setElement, LinkedElement<T>* setNext = NULL) : value(setElement), LinkedElement(T* setElement, LinkedElement<T>* setNext = nullptr):
next(setNext) { value(setElement), next(setNext) {}
}
virtual ~LinkedElement(){ virtual ~LinkedElement(){}
}
virtual LinkedElement* getNext() const { virtual LinkedElement* getNext() const {
return next; return next;
} }
@ -58,11 +57,16 @@ public:
virtual void setNext(LinkedElement* next) { virtual void setNext(LinkedElement* next) {
this->next = next; this->next = next;
} }
virtual void setEnd() {
this->next = nullptr;
}
LinkedElement* begin() { LinkedElement* begin() {
return this; return this;
} }
LinkedElement* end() { LinkedElement* end() {
return NULL; return nullptr;
} }
private: private:
LinkedElement *next; LinkedElement *next;
@ -71,37 +75,80 @@ private:
template<typename T> template<typename T>
class SinglyLinkedList { class SinglyLinkedList {
public: public:
SinglyLinkedList() : using ElementIterator = typename LinkedElement<T>::Iterator;
start(NULL) {
} SinglyLinkedList() {}
SinglyLinkedList(ElementIterator start) :
start(start.value) {}
SinglyLinkedList(typename LinkedElement<T>::Iterator start) :
start(start.value) {
}
SinglyLinkedList(LinkedElement<T>* startElement) : SinglyLinkedList(LinkedElement<T>* startElement) :
start(startElement) { start(startElement) {}
}
typename LinkedElement<T>::Iterator begin() const { ElementIterator begin() const {
return LinkedElement<T>::Iterator::Iterator(start); return ElementIterator::Iterator(start);
}
typename LinkedElement<T>::Iterator::Iterator end() const {
return LinkedElement<T>::Iterator::Iterator();
} }
uint32_t getSize() const { /** Returns iterator to nulltr */
uint32_t size = 0; ElementIterator end() const {
return ElementIterator::Iterator();
}
/**
* Returns last element in singly linked list.
* @return
*/
ElementIterator back() const {
LinkedElement<T> *element = start;
while (element->getNext() != nullptr) {
element = element->getNext();
}
return ElementIterator::Iterator(element);
}
size_t getSize() const {
size_t size = 0;
LinkedElement<T> *element = start; LinkedElement<T> *element = start;
while (element != NULL) { while (element != nullptr) {
size++; size++;
element = element->getNext(); element = element->getNext();
} }
return size; return size;
} }
void setStart(LinkedElement<T>* setStart) { void setStart(LinkedElement<T>* firstElement) {
start = setStart; start = firstElement;
} }
void setNext(LinkedElement<T>* currentElement,
LinkedElement<T>* nextElement) {
currentElement->setNext(nextElement);
}
void setLast(LinkedElement<T>* lastElement) {
lastElement->setEnd();
}
void insertElement(LinkedElement<T>* element, size_t position) {
LinkedElement<T> *currentElement = start;
for(size_t count = 0; count < position; count++) {
if(currentElement == nullptr) {
return;
}
currentElement = currentElement->getNext();
}
LinkedElement<T>* elementAfterCurrent = currentElement->next;
currentElement->setNext(element);
if(elementAfterCurrent != nullptr) {
element->setNext(elementAfterCurrent);
}
}
void insertBack(LinkedElement<T>* lastElement) {
back().value->setNext(lastElement);
}
protected: protected:
LinkedElement<T> *start; LinkedElement<T> *start = nullptr;
}; };
#endif /* SINGLYLINKEDLIST_H_ */ #endif /* SINGLYLINKEDLIST_H_ */

View File

@ -61,7 +61,7 @@ ReturnValue_t DataPool::freeDataPoolLock() {
} }
ReturnValue_t DataPool::lockDataPool() { ReturnValue_t DataPool::lockDataPool() {
ReturnValue_t status = mutex->lockMutex(MutexIF::NO_TIMEOUT); ReturnValue_t status = mutex->lockMutex(MutexIF::BLOCKING);
if ( status != RETURN_OK ) { if ( status != RETURN_OK ) {
sif::error << "DataPool::DataPool: lock of mutex failed with error code: " << status << std::endl; sif::error << "DataPool::DataPool: lock of mutex failed with error code: " << status << std::endl;
} }

View File

@ -25,7 +25,7 @@ public:
/** /**
* These are the commands that can be sent to a DeviceHandlerBase * These are the commands that can be sent to a DeviceHandlerBase
*/ */
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::DEVICE_HANDLER_COMMAND; static const uint8_t MESSAGE_ID = messagetypes::DEVICE_HANDLER_COMMAND;
static const Command_t CMD_RAW = MAKE_COMMAND_ID( 1 ); //!< Sends a raw command, setParameter is a ::store_id_t containing the raw packet to send static const Command_t CMD_RAW = MAKE_COMMAND_ID( 1 ); //!< Sends a raw command, setParameter is a ::store_id_t containing the raw packet to send
// static const Command_t CMD_DIRECT = MAKE_COMMAND_ID( 2 ); //!< Sends a direct command, setParameter is a ::DeviceCommandId_t, setParameter2 is a ::store_id_t containing the data needed for the command // static const Command_t CMD_DIRECT = MAKE_COMMAND_ID( 2 ); //!< Sends a direct command, setParameter is a ::DeviceCommandId_t, setParameter2 is a ::store_id_t containing the data needed for the command
static const Command_t CMD_SWITCH_IOBOARD = MAKE_COMMAND_ID( 3 ); //!< Requests a IO-Board switch, setParameter() is the IO-Board identifier static const Command_t CMD_SWITCH_IOBOARD = MAKE_COMMAND_ID( 3 ); //!< Requests a IO-Board switch, setParameter() is the IO-Board identifier

View File

@ -147,7 +147,7 @@ void EventManager::printEvent(EventMessage* message) {
#endif #endif
void EventManager::lockMutex() { void EventManager::lockMutex() {
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
} }
void EventManager::unlockMutex() { void EventManager::unlockMutex() {

View File

@ -1,3 +1,4 @@
# This submake file needs to be included by the primary Makefile.
# This file needs FRAMEWORK_PATH and OS_FSFW set correctly by another Makefile. # This file needs FRAMEWORK_PATH and OS_FSFW set correctly by another Makefile.
# Valid API settings: rtems, linux, freeRTOS, host # Valid API settings: rtems, linux, freeRTOS, host

View File

@ -6,7 +6,7 @@
class HealthMessage { class HealthMessage {
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::HEALTH_COMMAND; static const uint8_t MESSAGE_ID = messagetypes::HEALTH_COMMAND;
static const Command_t HEALTH_SET = MAKE_COMMAND_ID(1);//REPLY_COMMAND_OK/REPLY_REJECTED static const Command_t HEALTH_SET = MAKE_COMMAND_ID(1);//REPLY_COMMAND_OK/REPLY_REJECTED
static const Command_t HEALTH_ANNOUNCE = MAKE_COMMAND_ID(3); //NO REPLY! static const Command_t HEALTH_ANNOUNCE = MAKE_COMMAND_ID(3); //NO REPLY!
static const Command_t HEALTH_INFO = MAKE_COMMAND_ID(5); static const Command_t HEALTH_INFO = MAKE_COMMAND_ID(5);

View File

@ -26,7 +26,7 @@ ReturnValue_t HealthTable::registerObject(object_id_t object,
void HealthTable::setHealth(object_id_t object, void HealthTable::setHealth(object_id_t object,
HasHealthIF::HealthState newState) { HasHealthIF::HealthState newState) {
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
HealthMap::iterator iter = healthMap.find(object); HealthMap::iterator iter = healthMap.find(object);
if (iter != healthMap.end()) { if (iter != healthMap.end()) {
iter->second = newState; iter->second = newState;
@ -36,7 +36,7 @@ void HealthTable::setHealth(object_id_t object,
HasHealthIF::HealthState HealthTable::getHealth(object_id_t object) { HasHealthIF::HealthState HealthTable::getHealth(object_id_t object) {
HasHealthIF::HealthState state = HasHealthIF::HEALTHY; HasHealthIF::HealthState state = HasHealthIF::HEALTHY;
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
HealthMap::iterator iter = healthMap.find(object); HealthMap::iterator iter = healthMap.find(object);
if (iter != healthMap.end()) { if (iter != healthMap.end()) {
state = iter->second; state = iter->second;
@ -46,7 +46,7 @@ HasHealthIF::HealthState HealthTable::getHealth(object_id_t object) {
} }
uint32_t HealthTable::getPrintSize() { uint32_t HealthTable::getPrintSize() {
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
uint32_t size = healthMap.size() * 5 + 2; uint32_t size = healthMap.size() * 5 + 2;
mutex->unlockMutex(); mutex->unlockMutex();
return size; return size;
@ -54,7 +54,7 @@ uint32_t HealthTable::getPrintSize() {
bool HealthTable::hasHealth(object_id_t object) { bool HealthTable::hasHealth(object_id_t object) {
bool exits = false; bool exits = false;
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
HealthMap::iterator iter = healthMap.find(object); HealthMap::iterator iter = healthMap.find(object);
if (iter != healthMap.end()) { if (iter != healthMap.end()) {
exits = true; exits = true;
@ -64,7 +64,7 @@ bool HealthTable::hasHealth(object_id_t object) {
} }
void HealthTable::printAll(uint8_t* pointer, size_t maxSize) { void HealthTable::printAll(uint8_t* pointer, size_t maxSize) {
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
size_t size = 0; size_t size = 0;
uint16_t count = healthMap.size(); uint16_t count = healthMap.size();
ReturnValue_t result = SerializeAdapter::serialize(&count, ReturnValue_t result = SerializeAdapter::serialize(&count,
@ -85,7 +85,7 @@ void HealthTable::printAll(uint8_t* pointer, size_t maxSize) {
ReturnValue_t HealthTable::iterate( ReturnValue_t HealthTable::iterate(
std::pair<object_id_t, HasHealthIF::HealthState> *value, bool reset) { std::pair<object_id_t, HasHealthIF::HealthState> *value, bool reset) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
if (reset) { if (reset) {
mapIterator = healthMap.begin(); mapIterator = healthMap.begin();
} }

View File

@ -54,7 +54,7 @@ void InternalErrorReporter::lostTm() {
uint32_t InternalErrorReporter::getAndResetQueueHits() { uint32_t InternalErrorReporter::getAndResetQueueHits() {
uint32_t value; uint32_t value;
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
value = queueHits; value = queueHits;
queueHits = 0; queueHits = 0;
mutex->unlockMutex(); mutex->unlockMutex();
@ -63,21 +63,21 @@ uint32_t InternalErrorReporter::getAndResetQueueHits() {
uint32_t InternalErrorReporter::getQueueHits() { uint32_t InternalErrorReporter::getQueueHits() {
uint32_t value; uint32_t value;
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
value = queueHits; value = queueHits;
mutex->unlockMutex(); mutex->unlockMutex();
return value; return value;
} }
void InternalErrorReporter::incrementQueueHits() { void InternalErrorReporter::incrementQueueHits() {
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
queueHits++; queueHits++;
mutex->unlockMutex(); mutex->unlockMutex();
} }
uint32_t InternalErrorReporter::getAndResetTmHits() { uint32_t InternalErrorReporter::getAndResetTmHits() {
uint32_t value; uint32_t value;
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
value = tmHits; value = tmHits;
tmHits = 0; tmHits = 0;
mutex->unlockMutex(); mutex->unlockMutex();
@ -86,14 +86,14 @@ uint32_t InternalErrorReporter::getAndResetTmHits() {
uint32_t InternalErrorReporter::getTmHits() { uint32_t InternalErrorReporter::getTmHits() {
uint32_t value; uint32_t value;
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
value = tmHits; value = tmHits;
mutex->unlockMutex(); mutex->unlockMutex();
return value; return value;
} }
void InternalErrorReporter::incrementTmHits() { void InternalErrorReporter::incrementTmHits() {
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
tmHits++; tmHits++;
mutex->unlockMutex(); mutex->unlockMutex();
} }
@ -104,7 +104,7 @@ void InternalErrorReporter::storeFull() {
uint32_t InternalErrorReporter::getAndResetStoreHits() { uint32_t InternalErrorReporter::getAndResetStoreHits() {
uint32_t value; uint32_t value;
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
value = storeHits; value = storeHits;
storeHits = 0; storeHits = 0;
mutex->unlockMutex(); mutex->unlockMutex();
@ -113,14 +113,14 @@ uint32_t InternalErrorReporter::getAndResetStoreHits() {
uint32_t InternalErrorReporter::getStoreHits() { uint32_t InternalErrorReporter::getStoreHits() {
uint32_t value; uint32_t value;
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
value = storeHits; value = storeHits;
mutex->unlockMutex(); mutex->unlockMutex();
return value; return value;
} }
void InternalErrorReporter::incrementStoreHits() { void InternalErrorReporter::incrementStoreHits() {
mutex->lockMutex(MutexIF::NO_TIMEOUT); mutex->lockMutex(MutexIF::BLOCKING);
storeHits++; storeHits++;
mutex->unlockMutex(); mutex->unlockMutex();
} }

View File

@ -15,7 +15,7 @@
#include "../tmstorage/TmStoreMessage.h" #include "../tmstorage/TmStoreMessage.h"
#include "../parameters/ParameterMessage.h" #include "../parameters/ParameterMessage.h"
namespace MESSAGE_TYPE { namespace messagetypes {
void clearMissionMessage(CommandMessage* message); void clearMissionMessage(CommandMessage* message);
} }
@ -67,35 +67,35 @@ void CommandMessage::setParameter2(uint32_t parameter2) {
void CommandMessage::clearCommandMessage() { void CommandMessage::clearCommandMessage() {
switch((getCommand()>>8) & 0xff){ switch((getCommand()>>8) & 0xff){
case MESSAGE_TYPE::MODE_COMMAND: case messagetypes::MODE_COMMAND:
ModeMessage::clear(this); ModeMessage::clear(this);
break; break;
case MESSAGE_TYPE::HEALTH_COMMAND: case messagetypes::HEALTH_COMMAND:
HealthMessage::clear(this); HealthMessage::clear(this);
break; break;
case MESSAGE_TYPE::MODE_SEQUENCE: case messagetypes::MODE_SEQUENCE:
ModeSequenceMessage::clear(this); ModeSequenceMessage::clear(this);
break; break;
case MESSAGE_TYPE::ACTION: case messagetypes::ACTION:
ActionMessage::clear(this); ActionMessage::clear(this);
break; break;
case MESSAGE_TYPE::DEVICE_HANDLER_COMMAND: case messagetypes::DEVICE_HANDLER_COMMAND:
DeviceHandlerMessage::clear(this); DeviceHandlerMessage::clear(this);
break; break;
case MESSAGE_TYPE::MEMORY: case messagetypes::MEMORY:
MemoryMessage::clear(this); MemoryMessage::clear(this);
break; break;
case MESSAGE_TYPE::MONITORING: case messagetypes::MONITORING:
MonitoringMessage::clear(this); MonitoringMessage::clear(this);
break; break;
case MESSAGE_TYPE::TM_STORE: case messagetypes::TM_STORE:
TmStoreMessage::clear(this); TmStoreMessage::clear(this);
break; break;
case MESSAGE_TYPE::PARAMETER: case messagetypes::PARAMETER:
ParameterMessage::clear(this); ParameterMessage::clear(this);
break; break;
default: default:
MESSAGE_TYPE::clearMissionMessage(this); messagetypes::clearMissionMessage(this);
break; break;
} }
} }

View File

@ -23,7 +23,7 @@ public:
static const ReturnValue_t UNKNOWN_COMMAND = MAKE_RETURN_CODE(0x01); static const ReturnValue_t UNKNOWN_COMMAND = MAKE_RETURN_CODE(0x01);
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::COMMAND; static const uint8_t MESSAGE_ID = messagetypes::COMMAND;
static const Command_t CMD_NONE = MAKE_COMMAND_ID( 0 );//!< Used internally, will be ignored static const Command_t CMD_NONE = MAKE_COMMAND_ID( 0 );//!< Used internally, will be ignored
static const Command_t REPLY_COMMAND_OK = MAKE_COMMAND_ID( 3 ); static const Command_t REPLY_COMMAND_OK = MAKE_COMMAND_ID( 3 );
static const Command_t REPLY_REJECTED = MAKE_COMMAND_ID( 0xD1 );//!< Reply indicating that the current command was rejected, par1 should contain the error code static const Command_t REPLY_REJECTED = MAKE_COMMAND_ID( 0xD1 );//!< Reply indicating that the current command was rejected, par1 should contain the error code

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_IPC_FWMESSAGETYPES_H_ #ifndef FRAMEWORK_IPC_FWMESSAGETYPES_H_
#define FRAMEWORK_IPC_FWMESSAGETYPES_H_ #define FRAMEWORK_IPC_FWMESSAGETYPES_H_
namespace MESSAGE_TYPE { namespace messagetypes {
//Remember to add new Message Types to the clearCommandMessage function! //Remember to add new Message Types to the clearCommandMessage function!
enum FW_MESSAGE_TYPE { enum FW_MESSAGE_TYPE {
COMMAND = 0, COMMAND = 0,

View File

@ -6,15 +6,21 @@
class MutexHelper { class MutexHelper {
public: public:
MutexHelper(MutexIF* mutex, uint32_t timeoutMs) : MutexHelper(MutexIF* mutex, MutexIF::TimeoutType timeoutType =
MutexIF::TimeoutType::BLOCKING, uint32_t timeoutMs = 0) :
internalMutex(mutex) { internalMutex(mutex) {
ReturnValue_t status = mutex->lockMutex(timeoutMs); ReturnValue_t status = mutex->lockMutex(timeoutType,
if(status != HasReturnvaluesIF::RETURN_OK){ timeoutMs);
sif::error << "MutexHelper: Lock of Mutex failed " << status << std::endl; if(status == MutexIF::MUTEX_TIMEOUT) {
sif::error << "MutexHelper: Lock of mutex failed with timeout of "
<< timeoutMs << " milliseconds!" << std::endl;
}
else if(status != HasReturnvaluesIF::RETURN_OK){
sif::error << "MutexHelper: Lock of Mutex failed with code " <<
status << std::endl;
} }
} }
~MutexHelper() { ~MutexHelper() {
internalMutex->unlockMutex(); internalMutex->unlockMutex();
} }

View File

@ -3,9 +3,33 @@
#include "../returnvalues/HasReturnvaluesIF.h" #include "../returnvalues/HasReturnvaluesIF.h"
/**
* @brief Common interface for OS Mutex objects which provide MUTual EXclusion.
* @details https://en.wikipedia.org/wiki/Lock_(computer_science)
* @ingroup osal
* @ingroup interface
*/
class MutexIF { class MutexIF {
public: public:
static const uint32_t NO_TIMEOUT; //!< Needs to be defined in implementation. /**
* Different types of timeout for the mutex lock.
*/
enum TimeoutType {
POLLING, //!< If mutex is not available, return immediately
WAITING, //!< Wait a specified time for the mutex to become available
BLOCKING //!< Block indefinitely until the mutex becomes available.
};
/**
* Lock the mutex. The timeout value will only be used for
* TimeoutType::WAITING
* @param timeoutType
* @param timeoutMs
* @return
*/
virtual ReturnValue_t lockMutex(TimeoutType timeoutType =
TimeoutType::BLOCKING, uint32_t timeoutMs = 0) = 0;
virtual ReturnValue_t unlockMutex() = 0;
static const uint8_t INTERFACE_ID = CLASS_ID::MUTEX_IF; static const uint8_t INTERFACE_ID = CLASS_ID::MUTEX_IF;
/** /**
@ -57,9 +81,7 @@ public:
*/ */
static const ReturnValue_t MUTEX_DESTROYED_WHILE_WAITING = MAKE_RETURN_CODE(12); static const ReturnValue_t MUTEX_DESTROYED_WHILE_WAITING = MAKE_RETURN_CODE(12);
virtual ~MutexIF() {} virtual ~MutexIF() {}
virtual ReturnValue_t lockMutex(uint32_t timeoutMs) = 0;
virtual ReturnValue_t unlockMutex() = 0;
}; };

View File

@ -9,7 +9,7 @@ class MemoryMessage {
private: private:
MemoryMessage(); //A private ctor inhibits instantiation MemoryMessage(); //A private ctor inhibits instantiation
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::MEMORY; static const uint8_t MESSAGE_ID = messagetypes::MEMORY;
static const Command_t CMD_MEMORY_LOAD = MAKE_COMMAND_ID( 0x01 ); static const Command_t CMD_MEMORY_LOAD = MAKE_COMMAND_ID( 0x01 );
static const Command_t CMD_MEMORY_DUMP = MAKE_COMMAND_ID( 0x02 ); static const Command_t CMD_MEMORY_DUMP = MAKE_COMMAND_ID( 0x02 );
static const Command_t CMD_MEMORY_CHECK = MAKE_COMMAND_ID( 0x03 ); static const Command_t CMD_MEMORY_CHECK = MAKE_COMMAND_ID( 0x03 );

View File

@ -17,7 +17,7 @@ class ModeMessage {
private: private:
ModeMessage(); ModeMessage();
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::MODE_COMMAND; static const uint8_t MESSAGE_ID = messagetypes::MODE_COMMAND;
static const Command_t CMD_MODE_COMMAND = MAKE_COMMAND_ID(0x01);//!> Command to set the specified Mode, replies are: REPLY_MODE_REPLY, REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any replies, as this will break the subsystem mode machine!! static const Command_t CMD_MODE_COMMAND = MAKE_COMMAND_ID(0x01);//!> Command to set the specified Mode, replies are: REPLY_MODE_REPLY, REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any replies, as this will break the subsystem mode machine!!
static const Command_t CMD_MODE_COMMAND_FORCED = MAKE_COMMAND_ID(0xF1);//!> Command to set the specified Mode, regardless of external control flag, replies are: REPLY_MODE_REPLY, REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any replies, as this will break the subsystem mode machine!! static const Command_t CMD_MODE_COMMAND_FORCED = MAKE_COMMAND_ID(0xF1);//!> Command to set the specified Mode, regardless of external control flag, replies are: REPLY_MODE_REPLY, REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any replies, as this will break the subsystem mode machine!!
static const Command_t REPLY_MODE_REPLY = MAKE_COMMAND_ID(0x02);//!> Reply to a CMD_MODE_COMMAND or CMD_MODE_READ static const Command_t REPLY_MODE_REPLY = MAKE_COMMAND_ID(0x02);//!> Reply to a CMD_MODE_COMMAND or CMD_MODE_READ

View File

@ -6,7 +6,7 @@
class MonitoringMessage: public CommandMessage { class MonitoringMessage: public CommandMessage {
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::MONITORING; static const uint8_t MESSAGE_ID = messagetypes::MONITORING;
//Object id could be useful, but we better manage that on service level (register potential reporters). //Object id could be useful, but we better manage that on service level (register potential reporters).
static const Command_t LIMIT_VIOLATION_REPORT = MAKE_COMMAND_ID(10); static const Command_t LIMIT_VIOLATION_REPORT = MAKE_COMMAND_ID(10);
virtual ~MonitoringMessage(); virtual ~MonitoringMessage();

View File

@ -155,7 +155,7 @@ ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_) {
if (checkOrCreateClockMutex() != HasReturnvaluesIF::RETURN_OK) { if (checkOrCreateClockMutex() != HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
ReturnValue_t result = timeMutex->lockMutex(MutexIF::NO_TIMEOUT); ReturnValue_t result = timeMutex->lockMutex(MutexIF::BLOCKING);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
@ -170,7 +170,7 @@ ReturnValue_t Clock::getLeapSeconds(uint16_t* leapSeconds_) {
if (timeMutex == NULL) { if (timeMutex == NULL) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
ReturnValue_t result = timeMutex->lockMutex(MutexIF::NO_TIMEOUT); ReturnValue_t result = timeMutex->lockMutex(MutexIF::BLOCKING);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }

View File

@ -5,11 +5,12 @@
uint32_t FixedTimeslotTask::deadlineMissedCount = 0; uint32_t FixedTimeslotTask::deadlineMissedCount = 0;
const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = configMINIMAL_STACK_SIZE; const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = configMINIMAL_STACK_SIZE;
FixedTimeslotTask::FixedTimeslotTask(const char *name, TaskPriority setPriority, FixedTimeslotTask::FixedTimeslotTask(TaskName name, TaskPriority setPriority,
TaskStackSize setStack, TaskPeriod overallPeriod, TaskStackSize setStack, TaskPeriod overallPeriod,
void (*setDeadlineMissedFunc)()) : void (*setDeadlineMissedFunc)()) :
started(false), handle(NULL), pst(overallPeriod * 1000) { started(false), handle(NULL), pst(overallPeriod * 1000) {
xTaskCreate(taskEntryPoint, name, setStack, this, setPriority, &handle); configSTACK_DEPTH_TYPE stackSize = setStack / sizeof(configSTACK_DEPTH_TYPE);
xTaskCreate(taskEntryPoint, name, stackSize, this, setPriority, &handle);
// All additional attributes are applied to the object. // All additional attributes are applied to the object.
this->deadlineMissedFunc = setDeadlineMissedFunc; this->deadlineMissedFunc = setDeadlineMissedFunc;
} }
@ -82,7 +83,7 @@ ReturnValue_t FixedTimeslotTask::checkSequence() const {
void FixedTimeslotTask::taskFunctionality() { void FixedTimeslotTask::taskFunctionality() {
// A local iterator for the Polling Sequence Table is created to find the // A local iterator for the Polling Sequence Table is created to find the
// start time for the first entry. // start time for the first entry.
FixedSlotSequence::SlotListIter slotListIter = pst.current; auto slotListIter = pst.current;
//The start time for the first entry is read. //The start time for the first entry is read.
uint32_t intervalMs = slotListIter->pollingTimeMs; uint32_t intervalMs = slotListIter->pollingTimeMs;
@ -155,3 +156,7 @@ ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) {
vTaskDelay(pdMS_TO_TICKS(ms)); vTaskDelay(pdMS_TO_TICKS(ms));
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
TaskHandle_t FixedTimeslotTask::getTaskHandle() {
return handle;
}

View File

@ -1,14 +1,16 @@
#ifndef FRAMEWORK_OSAL_FREERTOS_FIXEDTIMESLOTTASK_H_ #ifndef FRAMEWORK_OSAL_FREERTOS_FIXEDTIMESLOTTASK_H_
#define FRAMEWORK_OSAL_FREERTOS_FIXEDTIMESLOTTASK_H_ #define FRAMEWORK_OSAL_FREERTOS_FIXEDTIMESLOTTASK_H_
#include "FreeRTOSTaskIF.h"
#include "../../devicehandlers/FixedSlotSequence.h" #include "../../devicehandlers/FixedSlotSequence.h"
#include "../../tasks/FixedTimeslotTaskIF.h" #include "../../tasks/FixedTimeslotTaskIF.h"
#include "../../tasks/Typedef.h" #include "../../tasks/Typedef.h"
#include <freertos/FreeRTOS.h> #include <freertos/FreeRTOS.h>
#include <freertos/task.h> #include <freertos/task.h>
class FixedTimeslotTask: public FixedTimeslotTaskIF { class FixedTimeslotTask: public FixedTimeslotTaskIF, public FreeRTOSTaskIF {
public: public:
/** /**
@ -23,7 +25,7 @@ public:
* @param setDeadlineMissedFunc Callback if a deadline was missed. * @param setDeadlineMissedFunc Callback if a deadline was missed.
* @return Pointer to the newly created task. * @return Pointer to the newly created task.
*/ */
FixedTimeslotTask(const char *name, TaskPriority setPriority, FixedTimeslotTask(TaskName name, TaskPriority setPriority,
TaskStackSize setStack, TaskPeriod overallPeriod, TaskStackSize setStack, TaskPeriod overallPeriod,
void (*setDeadlineMissedFunc)()); void (*setDeadlineMissedFunc)());
@ -57,6 +59,8 @@ public:
ReturnValue_t sleepFor(uint32_t ms) override; ReturnValue_t sleepFor(uint32_t ms) override;
TaskHandle_t getTaskHandle() override;
protected: protected:
bool started; bool started;
TaskHandle_t handle; TaskHandle_t handle;

View File

@ -0,0 +1,13 @@
#ifndef FRAMEWORK_OSAL_FREERTOS_FREERTOSTASKIF_H_
#define FRAMEWORK_OSAL_FREERTOS_FREERTOSTASKIF_H_
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
class FreeRTOSTaskIF {
public:
virtual~ FreeRTOSTaskIF() {}
virtual TaskHandle_t getTaskHandle() = 0;
};
#endif /* FRAMEWORK_OSAL_FREERTOS_FREERTOSTASKIF_H_ */

View File

@ -2,27 +2,31 @@
#include "../../serviceinterface/ServiceInterfaceStream.h" #include "../../serviceinterface/ServiceInterfaceStream.h"
const uint32_t MutexIF::NO_TIMEOUT = 0;
Mutex::Mutex() { Mutex::Mutex() {
handle = xSemaphoreCreateMutex(); handle = xSemaphoreCreateMutex();
//TODO print error if(handle == nullptr) {
sif::error << "Mutex::Mutex(FreeRTOS): Creation failure" << std::endl;
}
} }
Mutex::~Mutex() { Mutex::~Mutex() {
if (handle != 0) { if (handle != nullptr) {
vSemaphoreDelete(handle); vSemaphoreDelete(handle);
} }
} }
ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) { ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType,
if (handle == 0) { uint32_t timeoutMs) {
//TODO Does not exist if (handle == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return MutexIF::MUTEX_NOT_FOUND;
} }
TickType_t timeout = portMAX_DELAY; // If the timeout type is BLOCKING, this will be the correct value.
if (timeoutMs != NO_TIMEOUT) { uint32_t timeout = portMAX_DELAY;
if(timeoutType == TimeoutType::POLLING) {
timeout = 0;
}
else if(timeoutType == TimeoutType::WAITING){
timeout = pdMS_TO_TICKS(timeoutMs); timeout = pdMS_TO_TICKS(timeoutMs);
} }
@ -30,21 +34,18 @@ ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) {
if (returncode == pdPASS) { if (returncode == pdPASS) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} else { } else {
//TODO could not be acquired/timeout return MutexIF::MUTEX_TIMEOUT;
return HasReturnvaluesIF::RETURN_FAILED;
} }
} }
ReturnValue_t Mutex::unlockMutex() { ReturnValue_t Mutex::unlockMutex() {
if (handle == 0) { if (handle == nullptr) {
//TODO Does not exist return MutexIF::MUTEX_NOT_FOUND;
return HasReturnvaluesIF::RETURN_FAILED;
} }
BaseType_t returncode = xSemaphoreGive(handle); BaseType_t returncode = xSemaphoreGive(handle);
if (returncode == pdPASS) { if (returncode == pdPASS) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} else { } else {
//TODO is not owner return MutexIF::CURR_THREAD_DOES_NOT_OWN_MUTEX;
return HasReturnvaluesIF::RETURN_FAILED;
} }
} }

View File

@ -1,22 +1,29 @@
#ifndef OS_RTEMS_MUTEX_H_ #ifndef FRAMEWORK_FREERTOS_MUTEX_H_
#define OS_RTEMS_MUTEX_H_ #define FRAMEWORK_FREERTOS_MUTEX_H_
#include "../../ipc/MutexIF.h" #include "../../ipc/MutexIF.h"
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#include <FreeRTOS.h> /**
#include "semphr.h" * @brief OS component to implement MUTual EXclusion
*
* @details
* Mutexes are binary semaphores which include a priority inheritance mechanism.
* Documentation: https://www.freertos.org/Real-time-embedded-RTOS-mutexes.html
* @ingroup osal
*/
class Mutex : public MutexIF { class Mutex : public MutexIF {
public: public:
Mutex(); Mutex();
~Mutex(); ~Mutex();
ReturnValue_t lockMutex(uint32_t timeoutMs); ReturnValue_t lockMutex(TimeoutType timeoutType,
ReturnValue_t unlockMutex(); uint32_t timeoutMs) override;
ReturnValue_t unlockMutex() override;
private: private:
SemaphoreHandle_t handle; SemaphoreHandle_t handle;
}; };
#endif /* OS_RTEMS_MUTEX_H_ */ #endif /* FRAMEWORK_FREERTOS_MUTEX_H_ */

View File

@ -5,12 +5,13 @@
PeriodicTask::PeriodicTask(const char *name, TaskPriority setPriority, PeriodicTask::PeriodicTask(const char *name, TaskPriority setPriority,
TaskStackSize setStack, TaskPeriod setPeriod, TaskStackSize setStack, TaskPeriod setPeriod,
void (*setDeadlineMissedFunc)()) : TaskDeadlineMissedFunction deadlineMissedFunc) :
started(false), handle(NULL), period(setPeriod), deadlineMissedFunc( started(false), handle(NULL), period(setPeriod), deadlineMissedFunc(
setDeadlineMissedFunc) deadlineMissedFunc)
{ {
configSTACK_DEPTH_TYPE stackSize = setStack / sizeof(configSTACK_DEPTH_TYPE);
BaseType_t status = xTaskCreate(taskEntryPoint, name, BaseType_t status = xTaskCreate(taskEntryPoint, name,
setStack, this, setPriority, &handle); stackSize, this, setPriority, &handle);
if(status != pdPASS){ if(status != pdPASS){
sif::debug << "PeriodicTask Insufficient heap memory remaining. " sif::debug << "PeriodicTask Insufficient heap memory remaining. "
"Status: " << status << std::endl; "Status: " << status << std::endl;
@ -81,19 +82,17 @@ void PeriodicTask::taskFunctionality() {
} }
} }
ReturnValue_t PeriodicTask::addComponent(object_id_t object, bool setTaskIF) { ReturnValue_t PeriodicTask::addComponent(object_id_t object) {
ExecutableObjectIF* newObject = objectManager->get<ExecutableObjectIF>( ExecutableObjectIF* newObject = objectManager->get<ExecutableObjectIF>(
object); object);
if (newObject == nullptr) { if (newObject == nullptr) {
sif::error << "PeriodicTask::addComponent: Invalid object. Make sure" sif::error << "PeriodicTask::addComponent: Invalid object. Make sure"
"it implements ExecutableObjectIF!" << std::endl; "it implement ExecutableObjectIF" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
objectList.push_back(newObject); objectList.push_back(newObject);
newObject->setTaskIF(this);
if(setTaskIF) {
newObject->setTaskIF(this);
}
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -124,6 +123,10 @@ void PeriodicTask::checkMissedDeadline(const TickType_t xLastWakeTime,
} }
} }
TaskHandle_t PeriodicTask::getTaskHandle() {
return handle;
}
void PeriodicTask::handleMissedDeadline() { void PeriodicTask::handleMissedDeadline() {
#ifdef DEBUG #ifdef DEBUG
sif::warning << "PeriodicTask: " << pcTaskGetName(NULL) << sif::warning << "PeriodicTask: " << pcTaskGetName(NULL) <<

View File

@ -4,6 +4,8 @@
#include "../../objectmanager/ObjectManagerIF.h" #include "../../objectmanager/ObjectManagerIF.h"
#include "../../tasks/PeriodicTaskIF.h" #include "../../tasks/PeriodicTaskIF.h"
#include "../../tasks/Typedef.h" #include "../../tasks/Typedef.h"
#include "FreeRTOSTaskIF.h"
#include <freertos/FreeRTOS.h> #include <freertos/FreeRTOS.h>
#include <freertos/task.h> #include <freertos/task.h>
@ -17,7 +19,7 @@ class ExecutableObjectIF;
* periodic activities of multiple objects. * periodic activities of multiple objects.
* @ingroup task_handling * @ingroup task_handling
*/ */
class PeriodicTask: public PeriodicTaskIF { class PeriodicTask: public PeriodicTaskIF, public FreeRTOSTaskIF {
public: public:
/** /**
* Keep in Mind that you need to call before this vTaskStartScheduler()! * Keep in Mind that you need to call before this vTaskStartScheduler()!
@ -38,9 +40,9 @@ public:
* The function pointer to the deadline missed function that shall * The function pointer to the deadline missed function that shall
* be assigned. * be assigned.
*/ */
PeriodicTask(const char *name, TaskPriority setPriority, PeriodicTask(TaskName name, TaskPriority setPriority,
TaskStackSize setStack, TaskPeriod setPeriod, TaskStackSize setStack, TaskPeriod setPeriod,
void (*setDeadlineMissedFunc)()); TaskDeadlineMissedFunction deadlineMissedFunc);
/** /**
* @brief Currently, the executed object's lifetime is not coupled with * @brief Currently, the executed object's lifetime is not coupled with
* the task object's lifetime, so the destructor is empty. * the task object's lifetime, so the destructor is empty.
@ -63,12 +65,13 @@ public:
* -@c RETURN_OK on success * -@c RETURN_OK on success
* -@c RETURN_FAILED if the object could not be added. * -@c RETURN_FAILED if the object could not be added.
*/ */
ReturnValue_t addComponent(object_id_t object, ReturnValue_t addComponent(object_id_t object) override;
bool setTaskIF = true) override;
uint32_t getPeriodMs() const override; uint32_t getPeriodMs() const override;
ReturnValue_t sleepFor(uint32_t ms) override; ReturnValue_t sleepFor(uint32_t ms) override;
TaskHandle_t getTaskHandle() override;
protected: protected:
bool started; bool started;
TaskHandle_t handle; TaskHandle_t handle;

View File

@ -0,0 +1,24 @@
#include "../../osal/FreeRTOS/TaskManagement.h"
void TaskManagement::vRequestContextSwitchFromTask() {
vTaskDelay(0);
}
void TaskManagement::requestContextSwitch(
CallContext callContext = CallContext::TASK) {
if(callContext == CallContext::ISR) {
// This function depends on the partmacro.h definition for the specific device
vRequestContextSwitchFromISR();
} else {
vRequestContextSwitchFromTask();
}
}
TaskHandle_t TaskManagement::getCurrentTaskHandle() {
return xTaskGetCurrentTaskHandle();
}
size_t TaskManagement::getTaskStackHighWatermark(
TaskHandle_t task) {
return uxTaskGetStackHighWaterMark(task) * sizeof(StackType_t);
}

View File

@ -0,0 +1,64 @@
#ifndef FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_
#define FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_
#include "../../returnvalues/HasReturnvaluesIF.h"
extern "C" {
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
}
#include <cstdint>
/**
* Architecture dependant portmacro.h function call.
* Should be implemented in bsp.
*/
extern void vRequestContextSwitchFromISR();
/*!
* Used by functions to tell if they are being called from
* within an ISR or from a regular task. This is required because FreeRTOS
* has different functions for handling semaphores and messages from within
* an ISR and task.
*/
enum class CallContext {
TASK = 0x00,//!< task_context
ISR = 0xFF //!< isr_context
};
class TaskManagement {
public:
/**
* @brief In this function, a function dependant on the portmacro.h header
* function calls to request a context switch can be specified.
* This can be used if sending to the queue from an ISR caused a task
* to unblock and a context switch is required.
*/
static void requestContextSwitch(CallContext callContext);
/**
* If task preemption in FreeRTOS is disabled, a context switch
* can be requested manually by calling this function.
*/
static void vRequestContextSwitchFromTask(void);
/**
* @return The current task handle
*/
static TaskHandle_t getCurrentTaskHandle();
/**
* Get returns the minimum amount of remaining stack space in words
* that was a available to the task since the task started executing.
* Please note that the actual value in bytes depends
* on the stack depth type.
* E.g. on a 32 bit machine, a value of 200 means 800 bytes.
* @return Smallest value of stack remaining since the task was started in
* words.
*/
static size_t getTaskStackHighWatermark(
TaskHandle_t task = nullptr);
};
#endif /* FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_ */

View File

@ -179,7 +179,7 @@ ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_) {
if(checkOrCreateClockMutex()!=HasReturnvaluesIF::RETURN_OK){ if(checkOrCreateClockMutex()!=HasReturnvaluesIF::RETURN_OK){
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
ReturnValue_t result = timeMutex->lockMutex(MutexIF::NO_TIMEOUT); ReturnValue_t result = timeMutex->lockMutex(MutexIF::BLOCKING);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
@ -194,7 +194,7 @@ ReturnValue_t Clock::getLeapSeconds(uint16_t* leapSeconds_) {
if(timeMutex==NULL){ if(timeMutex==NULL){
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
ReturnValue_t result = timeMutex->lockMutex(MutexIF::NO_TIMEOUT); ReturnValue_t result = timeMutex->lockMutex(MutexIF::BLOCKING);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }

View File

@ -2,7 +2,6 @@
#include "../../serviceinterface/ServiceInterfaceStream.h" #include "../../serviceinterface/ServiceInterfaceStream.h"
#include "../../timemanager/Clock.h" #include "../../timemanager/Clock.h"
const uint32_t MutexIF::NO_TIMEOUT = 0;
uint8_t Mutex::count = 0; uint8_t Mutex::count = 0;
@ -25,7 +24,9 @@ Mutex::Mutex() {
sif::error << "Mutex: creation with name, id " << mutex.__data.__count sif::error << "Mutex: creation with name, id " << mutex.__data.__count
<< ", " << " failed with " << strerror(status) << std::endl; << ", " << " failed with " << strerror(status) << std::endl;
} }
//After a mutex attributes object has been used to initialize one or more mutexes, any function affecting the attributes object (including destruction) shall not affect any previously initialized mutexes. // After a mutex attributes object has been used to initialize one or more
// mutexes, any function affecting the attributes object
// (including destruction) shall not affect any previously initialized mutexes.
status = pthread_mutexattr_destroy(&mutexAttr); status = pthread_mutexattr_destroy(&mutexAttr);
if (status != 0) { if (status != 0) {
sif::error << "Mutex: Attribute destroy failed with " << strerror(status) << std::endl; sif::error << "Mutex: Attribute destroy failed with " << strerror(status) << std::endl;
@ -37,9 +38,13 @@ Mutex::~Mutex() {
pthread_mutex_destroy(&mutex); pthread_mutex_destroy(&mutex);
} }
ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) { ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) {
int status = 0; int status = 0;
if (timeoutMs != MutexIF::NO_TIMEOUT) {
if(timeoutType == TimeoutType::POLLING) {
status = pthread_mutex_trylock(&mutex);
}
else if (timeoutType == TimeoutType::WAITING) {
timespec timeOut; timespec timeOut;
clock_gettime(CLOCK_REALTIME, &timeOut); clock_gettime(CLOCK_REALTIME, &timeOut);
uint64_t nseconds = timeOut.tv_sec * 1000000000 + timeOut.tv_nsec; uint64_t nseconds = timeOut.tv_sec * 1000000000 + timeOut.tv_nsec;
@ -47,27 +52,35 @@ ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) {
timeOut.tv_sec = nseconds / 1000000000; timeOut.tv_sec = nseconds / 1000000000;
timeOut.tv_nsec = nseconds - timeOut.tv_sec * 1000000000; timeOut.tv_nsec = nseconds - timeOut.tv_sec * 1000000000;
status = pthread_mutex_timedlock(&mutex, &timeOut); status = pthread_mutex_timedlock(&mutex, &timeOut);
} else { }
else if(timeoutType == TimeoutType::BLOCKING) {
status = pthread_mutex_lock(&mutex); status = pthread_mutex_lock(&mutex);
} }
switch (status) { switch (status) {
case EINVAL: case EINVAL:
//The mutex was created with the protocol attribute having the value PTHREAD_PRIO_PROTECT and the calling thread's priority is higher than the mutex's current priority ceiling. // The mutex was created with the protocol attribute having the value
// PTHREAD_PRIO_PROTECT and the calling thread's priority is higher
// than the mutex's current priority ceiling.
return WRONG_ATTRIBUTE_SETTING; return WRONG_ATTRIBUTE_SETTING;
//The process or thread would have blocked, and the abs_timeout parameter specified a nanoseconds field value less than zero or greater than or equal to 1000 million. // The process or thread would have blocked, and the abs_timeout
//The value specified by mutex does not refer to an initialized mutex object. // parameter specified a nanoseconds field value less than zero or
// greater than or equal to 1000 million.
// The value specified by mutex does not refer to an initialized mutex object.
//return MUTEX_NOT_FOUND; //return MUTEX_NOT_FOUND;
case EBUSY: case EBUSY:
//The mutex could not be acquired because it was already locked. // The mutex could not be acquired because it was already locked.
return MUTEX_ALREADY_LOCKED; return MUTEX_ALREADY_LOCKED;
case ETIMEDOUT: case ETIMEDOUT:
//The mutex could not be locked before the specified timeout expired. // The mutex could not be locked before the specified timeout expired.
return MUTEX_TIMEOUT; return MUTEX_TIMEOUT;
case EAGAIN: case EAGAIN:
//The mutex could not be acquired because the maximum number of recursive locks for mutex has been exceeded. // The mutex could not be acquired because the maximum number of
// recursive locks for mutex has been exceeded.
return MUTEX_MAX_LOCKS; return MUTEX_MAX_LOCKS;
case EDEADLK: case EDEADLK:
//A deadlock condition was detected or the current thread already owns the mutex. // A deadlock condition was detected or the current thread
// already owns the mutex.
return CURR_THREAD_ALREADY_OWNS_MUTEX; return CURR_THREAD_ALREADY_OWNS_MUTEX;
case 0: case 0:
//Success //Success

View File

@ -1,14 +1,15 @@
#ifndef OS_RTEMS_MUTEX_H_ #ifndef OS_LINUX_MUTEX_H_
#define OS_RTEMS_MUTEX_H_ #define OS_LINUX_MUTEX_H_
#include "../../ipc/MutexIF.h" #include "../../ipc/MutexIF.h"
#include <pthread.h> #include <pthread.h>
class Mutex : public MutexIF { class Mutex : public MutexIF {
public: public:
Mutex(); Mutex();
virtual ~Mutex(); virtual ~Mutex();
virtual ReturnValue_t lockMutex(uint32_t timeoutMs); virtual ReturnValue_t lockMutex(TimeoutType timeoutType, uint32_t timeoutMs);
virtual ReturnValue_t unlockMutex(); virtual ReturnValue_t unlockMutex();
private: private:
pthread_mutex_t mutex; pthread_mutex_t mutex;

View File

@ -21,8 +21,7 @@ void* PeriodicPosixTask::taskEntryPoint(void* arg) {
return NULL; return NULL;
} }
ReturnValue_t PeriodicPosixTask::addComponent(object_id_t object, ReturnValue_t PeriodicPosixTask::addComponent(object_id_t object) {
bool addTaskIF) {
ExecutableObjectIF* newObject = objectManager->get<ExecutableObjectIF>( ExecutableObjectIF* newObject = objectManager->get<ExecutableObjectIF>(
object); object);
if (newObject == nullptr) { if (newObject == nullptr) {

View File

@ -39,8 +39,7 @@ public:
* @param object Id of the object to add. * @param object Id of the object to add.
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added. * @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
*/ */
ReturnValue_t addComponent(object_id_t object, ReturnValue_t addComponent(object_id_t object) override;
bool addTaskIF = true) override;
uint32_t getPeriodMs() const override; uint32_t getPeriodMs() const override;

View File

@ -78,6 +78,8 @@ ReturnValue_t MultiObjectTask::addComponent(object_id_t object) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
objectList.push_back(newObject); objectList.push_back(newObject);
newObject->setTaskIF(this);
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -1,11 +1,5 @@
/** #ifndef FSFW_OSAL_RTEMS_MULTIOBJECTTASK_H_
* @file MultiObjectTask.h #define FSFW_OSAL_RTEMS_MULTIOBJECTTASK_H_
* @brief This file defines the MultiObjectTask class.
* @date 30.01.2014
* @author baetz
*/
#ifndef MULTIOBJECTTASK_H_
#define MULTIOBJECTTASK_H_
#include "../../objectmanager/ObjectManagerIF.h" #include "../../objectmanager/ObjectManagerIF.h"
#include "../../tasks/PeriodicTaskIF.h" #include "../../tasks/PeriodicTaskIF.h"
@ -21,7 +15,7 @@ class ExecutableObjectIF;
* @details MultiObjectTask is an extension to ObjectTask in the way that it is able to execute * @details MultiObjectTask is an extension to ObjectTask in the way that it is able to execute
* multiple objects that implement the ExecutableObjectIF interface. The objects must be * multiple objects that implement the ExecutableObjectIF interface. The objects must be
* added prior to starting the task. * added prior to starting the task.
* * @author baetz
* @ingroup task_handling * @ingroup task_handling
*/ */
class MultiObjectTask: public TaskBase, public PeriodicTaskIF { class MultiObjectTask: public TaskBase, public PeriodicTaskIF {
@ -63,11 +57,11 @@ public:
* @param object Id of the object to add. * @param object Id of the object to add.
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added. * @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
*/ */
ReturnValue_t addComponent(object_id_t object); ReturnValue_t addComponent(object_id_t object) override;
uint32_t getPeriodMs() const; uint32_t getPeriodMs() const override;
ReturnValue_t sleepFor(uint32_t ms); ReturnValue_t sleepFor(uint32_t ms) override;
protected: protected:
typedef std::vector<ExecutableObjectIF*> ObjectList; //!< Typedef for the List of objects. typedef std::vector<ExecutableObjectIF*> ObjectList; //!< Typedef for the List of objects.
/** /**
@ -110,4 +104,4 @@ protected:
void taskFunctionality(void); void taskFunctionality(void);
}; };
#endif /* MULTIOBJECTTASK_H_ */ #endif /* FSFW_OSAL_RTEMS_MULTIOBJECTTASK_H_ */

View File

@ -1,7 +1,6 @@
#include "Mutex.h" #include "Mutex.h"
#include "../../serviceinterface/ServiceInterfaceStream.h" #include "../../serviceinterface/ServiceInterfaceStream.h"
const uint32_t MutexIF::NO_TIMEOUT = RTEMS_NO_TIMEOUT;
uint8_t Mutex::count = 0; uint8_t Mutex::count = 0;
Mutex::Mutex() : Mutex::Mutex() :
@ -24,8 +23,22 @@ Mutex::~Mutex() {
} }
} }
ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) { ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType =
rtems_status_code status = rtems_semaphore_obtain(mutexId, RTEMS_WAIT, timeoutMs); TimeoutType::BLOCKING, uint32_t timeoutMs) {
if(timeoutMs == MutexIF::TimeoutType::BLOCKING) {
rtems_status_code status = rtems_semaphore_obtain(mutexId,
RTEMS_WAIT, RTEMS_NO_TIMEOUT);
}
else if(timeoutMs == MutexIF::TimeoutType::POLLING) {
timeoutMs = RTEMS_NO_TIMEOUT;
rtems_status_code status = rtems_semaphore_obtain(mutexId,
RTEMS_NO_WAIT, 0);
}
else {
rtems_status_code status = rtems_semaphore_obtain(mutexId,
RTEMS_WAIT, timeoutMs);
}
switch(status){ switch(status){
case RTEMS_SUCCESSFUL: case RTEMS_SUCCESSFUL:
//semaphore obtained successfully //semaphore obtained successfully

View File

@ -1,5 +1,5 @@
#ifndef OS_RTEMS_MUTEX_H_ #ifndef FRAMEWORK_OSAL_RTEMS_MUTEX_H_
#define OS_RTEMS_MUTEX_H_ #define FRAMEWORK_OSAL_RTEMS_MUTEX_H_
#include "../../ipc/MutexIF.h" #include "../../ipc/MutexIF.h"
#include "RtemsBasic.h" #include "RtemsBasic.h"
@ -8,7 +8,7 @@ class Mutex : public MutexIF {
public: public:
Mutex(); Mutex();
~Mutex(); ~Mutex();
ReturnValue_t lockMutex(uint32_t timeoutMs); ReturnValue_t lockMutex(TimeoutType timeoutType, uint32_t timeoutMs = 0);
ReturnValue_t unlockMutex(); ReturnValue_t unlockMutex();
private: private:
rtems_id mutexId; rtems_id mutexId;

View File

@ -9,7 +9,7 @@ class ParameterMessage {
private: private:
ParameterMessage(); ParameterMessage();
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::PARAMETER; static const uint8_t MESSAGE_ID = messagetypes::PARAMETER;
static const Command_t CMD_PARAMETER_LOAD = MAKE_COMMAND_ID( 0x01 ); static const Command_t CMD_PARAMETER_LOAD = MAKE_COMMAND_ID( 0x01 );
static const Command_t CMD_PARAMETER_DUMP = MAKE_COMMAND_ID( 0x02 ); static const Command_t CMD_PARAMETER_DUMP = MAKE_COMMAND_ID( 0x02 );
static const Command_t REPLY_PARAMETER_DUMP = MAKE_COMMAND_ID( 0x03 ); static const Command_t REPLY_PARAMETER_DUMP = MAKE_COMMAND_ID( 0x03 );

View File

@ -1,94 +1,129 @@
#include "SerialBufferAdapter.h" #include "../serialize/SerialBufferAdapter.h"
#include <cstring> #include "../serviceinterface/ServiceInterfaceStream.h"
#include <cstring>
template<typename count_t>
template<typename T> SerialBufferAdapter<count_t>::SerialBufferAdapter(const uint8_t* buffer,
SerialBufferAdapter<T>::SerialBufferAdapter(const uint8_t* buffer, count_t bufferLength, bool serializeLength) :
T bufferLength, bool serializeLenght) : serializeLength(serializeLength),
serializeLength(serializeLenght), constBuffer(buffer), buffer(NULL), bufferLength( constBuffer(buffer), buffer(nullptr),
bufferLength) { bufferLength(bufferLength) {}
}
template<typename count_t>
template<typename T> SerialBufferAdapter<count_t>::SerialBufferAdapter(uint8_t* buffer,
SerialBufferAdapter<T>::SerialBufferAdapter(uint8_t* buffer, T bufferLength, count_t bufferLength, bool serializeLength) :
bool serializeLenght) : serializeLength(serializeLength), constBuffer(buffer), buffer(buffer),
serializeLength(serializeLenght), constBuffer(NULL), buffer(buffer), bufferLength( bufferLength(bufferLength) {}
bufferLength) {
}
template<typename count_t>
template<typename T> SerialBufferAdapter<count_t>::~SerialBufferAdapter() {
SerialBufferAdapter<T>::~SerialBufferAdapter() { }
}
template<typename count_t>
template<typename T> ReturnValue_t SerialBufferAdapter<count_t>::serialize(uint8_t** buffer,
ReturnValue_t SerialBufferAdapter<T>::serialize(uint8_t** buffer, size_t* size, size_t* size, size_t maxSize, Endianness streamEndianness) const {
size_t maxSize, Endianness streamEndianness) const { if (serializeLength) {
uint32_t serializedLength = bufferLength; ReturnValue_t result = SerializeAdapter::serialize(&bufferLength,
if (serializeLength) { buffer, size, maxSize, streamEndianness);
serializedLength += SerializeAdapter::getSerializedSize( if(result != HasReturnvaluesIF::RETURN_OK) {
&bufferLength); return result;
} }
if (*size + serializedLength > maxSize) { }
return BUFFER_TOO_SHORT;
} else { if (*size + bufferLength > maxSize) {
if (serializeLength) { return BUFFER_TOO_SHORT;
SerializeAdapter::serialize(&bufferLength, buffer, size, }
maxSize, streamEndianness);
} if (this->constBuffer != nullptr) {
if (this->constBuffer != NULL) { std::memcpy(*buffer, this->constBuffer, bufferLength);
memcpy(*buffer, this->constBuffer, bufferLength); }
} else if (this->buffer != NULL) { else if (this->buffer != nullptr) {
memcpy(*buffer, this->buffer, bufferLength); // This will propably be never reached, constBuffer should always be
} else { // set if non-const buffer is set.
return HasReturnvaluesIF::RETURN_FAILED; std::memcpy(*buffer, this->buffer, bufferLength);
} }
*size += bufferLength; else {
(*buffer) += bufferLength; return HasReturnvaluesIF::RETURN_FAILED;
return HasReturnvaluesIF::RETURN_OK; }
} *size += bufferLength;
} (*buffer) += bufferLength;
return HasReturnvaluesIF::RETURN_OK;
template<typename T>
size_t SerialBufferAdapter<T>::getSerializedSize() const { }
if (serializeLength) {
return bufferLength + SerializeAdapter::getSerializedSize(&bufferLength); template<typename count_t>
} else { size_t SerialBufferAdapter<count_t>::getSerializedSize() const {
return bufferLength; if (serializeLength) {
} return bufferLength + SerializeAdapter::getSerializedSize(&bufferLength);
} } else {
template<typename T> return bufferLength;
ReturnValue_t SerialBufferAdapter<T>::deSerialize(const uint8_t** buffer, }
size_t* size, Endianness streamEndianness) { }
//TODO Ignores Endian flag!
if (buffer != NULL) { template<typename count_t>
if(serializeLength){ ReturnValue_t SerialBufferAdapter<count_t>::deSerialize(const uint8_t** buffer,
T serializedSize = SerializeAdapter::getSerializedSize( size_t* size, Endianness streamEndianness) {
&bufferLength); if (this->buffer == nullptr) {
if((*size - bufferLength - serializedSize) >= 0){ return HasReturnvaluesIF::RETURN_FAILED;
*buffer += serializedSize; }
*size -= serializedSize;
}else{ if(serializeLength){
return STREAM_TOO_SHORT; count_t lengthField = 0;
} ReturnValue_t result = SerializeAdapter::deSerialize(&lengthField,
} buffer, size, streamEndianness);
//No Else If, go on with buffer if(result != HasReturnvaluesIF::RETURN_OK) {
if (*size - bufferLength >= 0) { return result;
*size -= bufferLength; }
memcpy(this->buffer, *buffer, bufferLength); if(lengthField > bufferLength) {
(*buffer) += bufferLength; return TOO_MANY_ELEMENTS;
return HasReturnvaluesIF::RETURN_OK; }
} else { bufferLength = lengthField;
return STREAM_TOO_SHORT; }
}
} else { if (bufferLength <= *size) {
return HasReturnvaluesIF::RETURN_FAILED; *size -= bufferLength;
} std::memcpy(this->buffer, *buffer, bufferLength);
} (*buffer) += bufferLength;
return HasReturnvaluesIF::RETURN_OK;
}
//forward Template declaration for linker else {
template class SerialBufferAdapter<uint8_t>; return STREAM_TOO_SHORT;
template class SerialBufferAdapter<uint16_t>; }
template class SerialBufferAdapter<uint32_t>; }
template<typename count_t>
uint8_t * SerialBufferAdapter<count_t>::getBuffer() {
if(buffer == nullptr) {
sif::error << "Wrong access function for stored type !"
" Use getConstBuffer()." << std::endl;
return nullptr;
}
return buffer;
}
template<typename count_t>
const uint8_t * SerialBufferAdapter<count_t>::getConstBuffer() {
if(constBuffer == nullptr) {
sif::error << "SerialBufferAdapter::getConstBuffer:"
" Buffers are unitialized!" << std::endl;
return nullptr;
}
return constBuffer;
}
template<typename count_t>
void SerialBufferAdapter<count_t>::setBuffer(uint8_t* buffer,
count_t bufferLength) {
this->buffer = buffer;
this->constBuffer = buffer;
this->bufferLength = bufferLength;
}
//forward Template declaration for linker
template class SerialBufferAdapter<uint8_t>;
template class SerialBufferAdapter<uint16_t>;
template class SerialBufferAdapter<uint32_t>;
template class SerialBufferAdapter<uint64_t>;

View File

@ -1,35 +1,78 @@
#ifndef SERIALBUFFERADAPTER_H_ #ifndef SERIALBUFFERADAPTER_H_
#define SERIALBUFFERADAPTER_H_ #define SERIALBUFFERADAPTER_H_
#include "SerializeIF.h" #include "../serialize/SerializeIF.h"
#include "SerializeAdapter.h" #include "../serialize/SerializeAdapter.h"
/** /**
* \ingroup serialize * This adapter provides an interface for SerializeIF to serialize or deserialize
*/ * buffers with no length header but a known size.
template<typename T> *
class SerialBufferAdapter: public SerializeIF { * Additionally, the buffer length can be serialized too and will be put in
public: * front of the serialized buffer.
SerialBufferAdapter(const uint8_t * buffer, T bufferLength, bool serializeLenght = false); *
SerialBufferAdapter(uint8_t* buffer, T bufferLength, * Can be used with SerialLinkedListAdapter by declaring a SerializeElement with
bool serializeLenght = false); * SerialElement<SerialBufferAdapter<bufferLengthType(will be uint8_t mostly)>>.
* Right now, the SerialBufferAdapter must always
virtual ~SerialBufferAdapter(); * be initialized with the buffer and size !
*
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, * \ingroup serialize
size_t maxSize, Endianness streamEndianness) const override; */
template<typename count_t>
virtual size_t getSerializedSize() const override; class SerialBufferAdapter: public SerializeIF {
public:
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) override; /**
private: * Constructor for constant uint8_t buffer. Length field can be serialized optionally.
bool serializeLength; * Type of length can be supplied as template type.
const uint8_t *constBuffer; * @param buffer
uint8_t *buffer; * @param bufferLength
T bufferLength; * @param serializeLength
}; */
SerialBufferAdapter(const uint8_t* buffer, count_t bufferLength,
bool serializeLength = false);
#endif /* SERIALBUFFERADAPTER_H_ */ /**
* Constructor for non-constant uint8_t buffer.
* Length field can be serialized optionally.
* Type of length can be supplied as template type.
* @param buffer
* @param bufferLength
* @param serializeLength Length field will be serialized with size count_t
*/
SerialBufferAdapter(uint8_t* buffer, count_t bufferLength,
bool serializeLength = false);
virtual ~SerialBufferAdapter();
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
size_t maxSize, Endianness streamEndianness) const override;
virtual size_t getSerializedSize() const override;
/**
* @brief This function deserializes a buffer into the member buffer.
* @details
* If a length field is present, it is ignored, as the size should have
* been set in the constructor. If the size is not known beforehand,
* consider using SerialFixedArrayListAdapter instead.
* @param buffer [out] Resulting buffer
* @param size remaining size to deserialize, should be larger than buffer
* + size field size
* @param bigEndian
* @return
*/
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) override;
uint8_t * getBuffer();
const uint8_t * getConstBuffer();
void setBuffer(uint8_t* buffer, count_t bufferLength);
private:
bool serializeLength = false;
const uint8_t *constBuffer = nullptr;
uint8_t *buffer = nullptr;
count_t bufferLength = 0;
};
#endif /* SERIALBUFFERADAPTER_H_ */

View File

@ -17,7 +17,7 @@ inline PoolManager<NUMBER_OF_POOLS>::~PoolManager(void) {
template<uint8_t NUMBER_OF_POOLS> template<uint8_t NUMBER_OF_POOLS>
inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::reserveSpace( inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::reserveSpace(
const uint32_t size, store_address_t* address, bool ignoreFault) { const uint32_t size, store_address_t* address, bool ignoreFault) {
MutexHelper mutexHelper(mutex,MutexIF::NO_TIMEOUT); MutexHelper mutexHelper(mutex,MutexIF::BLOCKING);
ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::reserveSpace(size, ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::reserveSpace(size,
address,ignoreFault); address,ignoreFault);
return status; return status;
@ -29,7 +29,7 @@ inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(
// debug << "PoolManager( " << translateObject(getObjectId()) << // debug << "PoolManager( " << translateObject(getObjectId()) <<
// " )::deleteData from store " << packet_id.pool_index << // " )::deleteData from store " << packet_id.pool_index <<
// ". id is "<< packet_id.packet_index << std::endl; // ". id is "<< packet_id.packet_index << std::endl;
MutexHelper mutexHelper(mutex,MutexIF::NO_TIMEOUT); MutexHelper mutexHelper(mutex,MutexIF::BLOCKING);
ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::deleteData(packet_id); ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::deleteData(packet_id);
return status; return status;
} }
@ -37,7 +37,7 @@ inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(
template<uint8_t NUMBER_OF_POOLS> template<uint8_t NUMBER_OF_POOLS>
inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(uint8_t* buffer, inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(uint8_t* buffer,
size_t size, store_address_t* storeId) { size_t size, store_address_t* storeId) {
MutexHelper mutexHelper(mutex,MutexIF::NO_TIMEOUT); MutexHelper mutexHelper(mutex,MutexIF::BLOCKING);
ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::deleteData(buffer, ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::deleteData(buffer,
size, storeId); size, storeId);
return status; return status;
@ -46,7 +46,7 @@ inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(uint8_t* buffer,
template<uint8_t NUMBER_OF_POOLS> template<uint8_t NUMBER_OF_POOLS>
inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::modifyData( inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::modifyData(
store_address_t packet_id, uint8_t** packet_ptr, size_t* size) { store_address_t packet_id, uint8_t** packet_ptr, size_t* size) {
MutexHelper mutexHelper(mutex,MutexIF::NO_TIMEOUT); MutexHelper mutexHelper(mutex,MutexIF::BLOCKING);
ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::modifyData(packet_id, ReturnValue_t status = LocalPool<NUMBER_OF_POOLS>::modifyData(packet_id,
packet_ptr, size); packet_ptr, size);
return status; return status;

View File

@ -7,7 +7,7 @@
class ModeSequenceMessage { class ModeSequenceMessage {
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::MODE_SEQUENCE; static const uint8_t MESSAGE_ID = messagetypes::MODE_SEQUENCE;
static const Command_t ADD_SEQUENCE = MAKE_COMMAND_ID(0x01); static const Command_t ADD_SEQUENCE = MAKE_COMMAND_ID(0x01);
static const Command_t ADD_TABLE = MAKE_COMMAND_ID(0x02); static const Command_t ADD_TABLE = MAKE_COMMAND_ID(0x02);

View File

@ -36,8 +36,7 @@ public:
* to the component. * to the component.
* @return * @return
*/ */
virtual ReturnValue_t addComponent(object_id_t object, virtual ReturnValue_t addComponent(object_id_t object) {
bool setTaskIF = true) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
}; };

View File

@ -1,7 +1,6 @@
#ifndef FRAMEWORK_TASKS_TYPEDEF_H_ #ifndef FRAMEWORK_TASKS_TYPEDEF_H_
#define FRAMEWORK_TASKS_TYPEDEF_H_ #define FRAMEWORK_TASKS_TYPEDEF_H_
//TODO more generic?
typedef const char* TaskName; typedef const char* TaskName;
typedef uint8_t TaskPriority; typedef uint8_t TaskPriority;
typedef size_t TaskStackSize; typedef size_t TaskStackSize;

View File

@ -41,7 +41,7 @@ public:
static store_address_t getStoreId(const CommandMessage* cmd); static store_address_t getStoreId(const CommandMessage* cmd);
virtual ~TmStoreMessage(); virtual ~TmStoreMessage();
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::TM_STORE; static const uint8_t MESSAGE_ID = messagetypes::TM_STORE;
static const Command_t ENABLE_STORING = MAKE_COMMAND_ID(1); static const Command_t ENABLE_STORING = MAKE_COMMAND_ID(1);
static const Command_t DELETE_STORE_CONTENT = MAKE_COMMAND_ID(2); static const Command_t DELETE_STORE_CONTENT = MAKE_COMMAND_ID(2);
static const Command_t DOWNLINK_STORE_CONTENT = MAKE_COMMAND_ID(3); static const Command_t DOWNLINK_STORE_CONTENT = MAKE_COMMAND_ID(3);