Merge remote-tracking branch 'upstream/master' into mueller/devices/FDIR
This commit is contained in:
commit
2a74c8d150
@ -10,7 +10,7 @@ class ActionMessage {
|
||||
private:
|
||||
ActionMessage();
|
||||
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 STEP_SUCCESS = MAKE_COMMAND_ID(2);
|
||||
static const Command_t STEP_FAILED = MAKE_COMMAND_ID(3);
|
||||
|
@ -1,10 +1,13 @@
|
||||
#ifndef SINGLYLINKEDLIST_H_
|
||||
#define SINGLYLINKEDLIST_H_
|
||||
#ifndef FRAMEWORK_CONTAINER_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>
|
||||
class LinkedElement {
|
||||
@ -12,11 +15,8 @@ public:
|
||||
T *value;
|
||||
class Iterator {
|
||||
public:
|
||||
LinkedElement<T> *value;
|
||||
Iterator() :
|
||||
value(NULL) {
|
||||
|
||||
}
|
||||
LinkedElement<T> *value = nullptr;
|
||||
Iterator() {}
|
||||
|
||||
Iterator(LinkedElement<T> *element) :
|
||||
value(element) {
|
||||
@ -45,12 +45,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
LinkedElement(T* setElement, LinkedElement<T>* setNext = NULL) : value(setElement),
|
||||
next(setNext) {
|
||||
}
|
||||
virtual ~LinkedElement(){
|
||||
LinkedElement(T* setElement, LinkedElement<T>* setNext = nullptr):
|
||||
value(setElement), next(setNext) {}
|
||||
|
||||
virtual ~LinkedElement(){}
|
||||
|
||||
}
|
||||
virtual LinkedElement* getNext() const {
|
||||
return next;
|
||||
}
|
||||
@ -58,11 +57,16 @@ public:
|
||||
virtual void setNext(LinkedElement* next) {
|
||||
this->next = next;
|
||||
}
|
||||
|
||||
virtual void setEnd() {
|
||||
this->next = nullptr;
|
||||
}
|
||||
|
||||
LinkedElement* begin() {
|
||||
return this;
|
||||
}
|
||||
LinkedElement* end() {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
private:
|
||||
LinkedElement *next;
|
||||
@ -71,37 +75,80 @@ private:
|
||||
template<typename T>
|
||||
class SinglyLinkedList {
|
||||
public:
|
||||
SinglyLinkedList() :
|
||||
start(NULL) {
|
||||
}
|
||||
using ElementIterator = typename LinkedElement<T>::Iterator;
|
||||
|
||||
SinglyLinkedList() {}
|
||||
|
||||
SinglyLinkedList(ElementIterator start) :
|
||||
start(start.value) {}
|
||||
|
||||
SinglyLinkedList(typename LinkedElement<T>::Iterator start) :
|
||||
start(start.value) {
|
||||
}
|
||||
SinglyLinkedList(LinkedElement<T>* startElement) :
|
||||
start(startElement) {
|
||||
}
|
||||
typename LinkedElement<T>::Iterator begin() const {
|
||||
return LinkedElement<T>::Iterator::Iterator(start);
|
||||
}
|
||||
typename LinkedElement<T>::Iterator::Iterator end() const {
|
||||
return LinkedElement<T>::Iterator::Iterator();
|
||||
start(startElement) {}
|
||||
|
||||
ElementIterator begin() const {
|
||||
return ElementIterator::Iterator(start);
|
||||
}
|
||||
|
||||
uint32_t getSize() const {
|
||||
uint32_t size = 0;
|
||||
/** Returns iterator to nulltr */
|
||||
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;
|
||||
while (element != NULL) {
|
||||
while (element != nullptr) {
|
||||
size++;
|
||||
element = element->getNext();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
void setStart(LinkedElement<T>* setStart) {
|
||||
start = setStart;
|
||||
void setStart(LinkedElement<T>* firstElement) {
|
||||
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:
|
||||
LinkedElement<T> *start;
|
||||
LinkedElement<T> *start = nullptr;
|
||||
};
|
||||
|
||||
#endif /* SINGLYLINKEDLIST_H_ */
|
||||
|
@ -61,7 +61,7 @@ ReturnValue_t DataPool::freeDataPoolLock() {
|
||||
}
|
||||
|
||||
ReturnValue_t DataPool::lockDataPool() {
|
||||
ReturnValue_t status = mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
ReturnValue_t status = mutex->lockMutex(MutexIF::BLOCKING);
|
||||
if ( status != RETURN_OK ) {
|
||||
sif::error << "DataPool::DataPool: lock of mutex failed with error code: " << status << std::endl;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
/**
|
||||
* 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_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
|
||||
|
@ -147,7 +147,7 @@ void EventManager::printEvent(EventMessage* message) {
|
||||
#endif
|
||||
|
||||
void EventManager::lockMutex() {
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
}
|
||||
|
||||
void EventManager::unlockMutex() {
|
||||
|
@ -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.
|
||||
# Valid API settings: rtems, linux, freeRTOS, host
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
class HealthMessage {
|
||||
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_ANNOUNCE = MAKE_COMMAND_ID(3); //NO REPLY!
|
||||
static const Command_t HEALTH_INFO = MAKE_COMMAND_ID(5);
|
||||
|
@ -26,7 +26,7 @@ ReturnValue_t HealthTable::registerObject(object_id_t object,
|
||||
|
||||
void HealthTable::setHealth(object_id_t object,
|
||||
HasHealthIF::HealthState newState) {
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
HealthMap::iterator iter = healthMap.find(object);
|
||||
if (iter != healthMap.end()) {
|
||||
iter->second = newState;
|
||||
@ -36,7 +36,7 @@ void HealthTable::setHealth(object_id_t object,
|
||||
|
||||
HasHealthIF::HealthState HealthTable::getHealth(object_id_t object) {
|
||||
HasHealthIF::HealthState state = HasHealthIF::HEALTHY;
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
HealthMap::iterator iter = healthMap.find(object);
|
||||
if (iter != healthMap.end()) {
|
||||
state = iter->second;
|
||||
@ -46,7 +46,7 @@ HasHealthIF::HealthState HealthTable::getHealth(object_id_t object) {
|
||||
}
|
||||
|
||||
uint32_t HealthTable::getPrintSize() {
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
uint32_t size = healthMap.size() * 5 + 2;
|
||||
mutex->unlockMutex();
|
||||
return size;
|
||||
@ -54,7 +54,7 @@ uint32_t HealthTable::getPrintSize() {
|
||||
|
||||
bool HealthTable::hasHealth(object_id_t object) {
|
||||
bool exits = false;
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
HealthMap::iterator iter = healthMap.find(object);
|
||||
if (iter != healthMap.end()) {
|
||||
exits = true;
|
||||
@ -64,7 +64,7 @@ bool HealthTable::hasHealth(object_id_t object) {
|
||||
}
|
||||
|
||||
void HealthTable::printAll(uint8_t* pointer, size_t maxSize) {
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
size_t size = 0;
|
||||
uint16_t count = healthMap.size();
|
||||
ReturnValue_t result = SerializeAdapter::serialize(&count,
|
||||
@ -85,7 +85,7 @@ void HealthTable::printAll(uint8_t* pointer, size_t maxSize) {
|
||||
ReturnValue_t HealthTable::iterate(
|
||||
std::pair<object_id_t, HasHealthIF::HealthState> *value, bool reset) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
if (reset) {
|
||||
mapIterator = healthMap.begin();
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ void InternalErrorReporter::lostTm() {
|
||||
|
||||
uint32_t InternalErrorReporter::getAndResetQueueHits() {
|
||||
uint32_t value;
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
value = queueHits;
|
||||
queueHits = 0;
|
||||
mutex->unlockMutex();
|
||||
@ -63,21 +63,21 @@ uint32_t InternalErrorReporter::getAndResetQueueHits() {
|
||||
|
||||
uint32_t InternalErrorReporter::getQueueHits() {
|
||||
uint32_t value;
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
value = queueHits;
|
||||
mutex->unlockMutex();
|
||||
return value;
|
||||
}
|
||||
|
||||
void InternalErrorReporter::incrementQueueHits() {
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
queueHits++;
|
||||
mutex->unlockMutex();
|
||||
}
|
||||
|
||||
uint32_t InternalErrorReporter::getAndResetTmHits() {
|
||||
uint32_t value;
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
value = tmHits;
|
||||
tmHits = 0;
|
||||
mutex->unlockMutex();
|
||||
@ -86,14 +86,14 @@ uint32_t InternalErrorReporter::getAndResetTmHits() {
|
||||
|
||||
uint32_t InternalErrorReporter::getTmHits() {
|
||||
uint32_t value;
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
value = tmHits;
|
||||
mutex->unlockMutex();
|
||||
return value;
|
||||
}
|
||||
|
||||
void InternalErrorReporter::incrementTmHits() {
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
tmHits++;
|
||||
mutex->unlockMutex();
|
||||
}
|
||||
@ -104,7 +104,7 @@ void InternalErrorReporter::storeFull() {
|
||||
|
||||
uint32_t InternalErrorReporter::getAndResetStoreHits() {
|
||||
uint32_t value;
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
value = storeHits;
|
||||
storeHits = 0;
|
||||
mutex->unlockMutex();
|
||||
@ -113,14 +113,14 @@ uint32_t InternalErrorReporter::getAndResetStoreHits() {
|
||||
|
||||
uint32_t InternalErrorReporter::getStoreHits() {
|
||||
uint32_t value;
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
value = storeHits;
|
||||
mutex->unlockMutex();
|
||||
return value;
|
||||
}
|
||||
|
||||
void InternalErrorReporter::incrementStoreHits() {
|
||||
mutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
storeHits++;
|
||||
mutex->unlockMutex();
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "../tmstorage/TmStoreMessage.h"
|
||||
#include "../parameters/ParameterMessage.h"
|
||||
|
||||
namespace MESSAGE_TYPE {
|
||||
namespace messagetypes {
|
||||
void clearMissionMessage(CommandMessage* message);
|
||||
}
|
||||
|
||||
@ -67,35 +67,35 @@ void CommandMessage::setParameter2(uint32_t parameter2) {
|
||||
|
||||
void CommandMessage::clearCommandMessage() {
|
||||
switch((getCommand()>>8) & 0xff){
|
||||
case MESSAGE_TYPE::MODE_COMMAND:
|
||||
case messagetypes::MODE_COMMAND:
|
||||
ModeMessage::clear(this);
|
||||
break;
|
||||
case MESSAGE_TYPE::HEALTH_COMMAND:
|
||||
case messagetypes::HEALTH_COMMAND:
|
||||
HealthMessage::clear(this);
|
||||
break;
|
||||
case MESSAGE_TYPE::MODE_SEQUENCE:
|
||||
case messagetypes::MODE_SEQUENCE:
|
||||
ModeSequenceMessage::clear(this);
|
||||
break;
|
||||
case MESSAGE_TYPE::ACTION:
|
||||
case messagetypes::ACTION:
|
||||
ActionMessage::clear(this);
|
||||
break;
|
||||
case MESSAGE_TYPE::DEVICE_HANDLER_COMMAND:
|
||||
case messagetypes::DEVICE_HANDLER_COMMAND:
|
||||
DeviceHandlerMessage::clear(this);
|
||||
break;
|
||||
case MESSAGE_TYPE::MEMORY:
|
||||
case messagetypes::MEMORY:
|
||||
MemoryMessage::clear(this);
|
||||
break;
|
||||
case MESSAGE_TYPE::MONITORING:
|
||||
case messagetypes::MONITORING:
|
||||
MonitoringMessage::clear(this);
|
||||
break;
|
||||
case MESSAGE_TYPE::TM_STORE:
|
||||
case messagetypes::TM_STORE:
|
||||
TmStoreMessage::clear(this);
|
||||
break;
|
||||
case MESSAGE_TYPE::PARAMETER:
|
||||
case messagetypes::PARAMETER:
|
||||
ParameterMessage::clear(this);
|
||||
break;
|
||||
default:
|
||||
MESSAGE_TYPE::clearMissionMessage(this);
|
||||
messagetypes::clearMissionMessage(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
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 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef FRAMEWORK_IPC_FWMESSAGETYPES_H_
|
||||
#define FRAMEWORK_IPC_FWMESSAGETYPES_H_
|
||||
|
||||
namespace MESSAGE_TYPE {
|
||||
namespace messagetypes {
|
||||
//Remember to add new Message Types to the clearCommandMessage function!
|
||||
enum FW_MESSAGE_TYPE {
|
||||
COMMAND = 0,
|
||||
|
@ -6,15 +6,21 @@
|
||||
|
||||
class MutexHelper {
|
||||
public:
|
||||
MutexHelper(MutexIF* mutex, uint32_t timeoutMs) :
|
||||
MutexHelper(MutexIF* mutex, MutexIF::TimeoutType timeoutType =
|
||||
MutexIF::TimeoutType::BLOCKING, uint32_t timeoutMs = 0) :
|
||||
internalMutex(mutex) {
|
||||
ReturnValue_t status = mutex->lockMutex(timeoutMs);
|
||||
if(status != HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "MutexHelper: Lock of Mutex failed " << status << std::endl;
|
||||
ReturnValue_t status = mutex->lockMutex(timeoutType,
|
||||
timeoutMs);
|
||||
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() {
|
||||
internalMutex->unlockMutex();
|
||||
}
|
||||
|
@ -3,9 +3,33 @@
|
||||
|
||||
#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 {
|
||||
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;
|
||||
/**
|
||||
@ -57,9 +81,7 @@ public:
|
||||
*/
|
||||
static const ReturnValue_t MUTEX_DESTROYED_WHILE_WAITING = MAKE_RETURN_CODE(12);
|
||||
|
||||
virtual ~MutexIF() {}
|
||||
virtual ReturnValue_t lockMutex(uint32_t timeoutMs) = 0;
|
||||
virtual ReturnValue_t unlockMutex() = 0;
|
||||
virtual ~MutexIF() {}
|
||||
};
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ class MemoryMessage {
|
||||
private:
|
||||
MemoryMessage(); //A private ctor inhibits instantiation
|
||||
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_DUMP = MAKE_COMMAND_ID( 0x02 );
|
||||
static const Command_t CMD_MEMORY_CHECK = MAKE_COMMAND_ID( 0x03 );
|
||||
|
@ -17,7 +17,7 @@ class ModeMessage {
|
||||
private:
|
||||
ModeMessage();
|
||||
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_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
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
class MonitoringMessage: public CommandMessage {
|
||||
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).
|
||||
static const Command_t LIMIT_VIOLATION_REPORT = MAKE_COMMAND_ID(10);
|
||||
virtual ~MonitoringMessage();
|
||||
|
@ -155,7 +155,7 @@ ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_) {
|
||||
if (checkOrCreateClockMutex() != HasReturnvaluesIF::RETURN_OK) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
ReturnValue_t result = timeMutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
ReturnValue_t result = timeMutex->lockMutex(MutexIF::BLOCKING);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
@ -170,7 +170,7 @@ ReturnValue_t Clock::getLeapSeconds(uint16_t* leapSeconds_) {
|
||||
if (timeMutex == NULL) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
ReturnValue_t result = timeMutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
ReturnValue_t result = timeMutex->lockMutex(MutexIF::BLOCKING);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
@ -5,11 +5,12 @@
|
||||
uint32_t FixedTimeslotTask::deadlineMissedCount = 0;
|
||||
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,
|
||||
void (*setDeadlineMissedFunc)()) :
|
||||
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.
|
||||
this->deadlineMissedFunc = setDeadlineMissedFunc;
|
||||
}
|
||||
@ -82,7 +83,7 @@ ReturnValue_t FixedTimeslotTask::checkSequence() const {
|
||||
void FixedTimeslotTask::taskFunctionality() {
|
||||
// A local iterator for the Polling Sequence Table is created to find the
|
||||
// start time for the first entry.
|
||||
FixedSlotSequence::SlotListIter slotListIter = pst.current;
|
||||
auto slotListIter = pst.current;
|
||||
|
||||
//The start time for the first entry is read.
|
||||
uint32_t intervalMs = slotListIter->pollingTimeMs;
|
||||
@ -155,3 +156,7 @@ ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) {
|
||||
vTaskDelay(pdMS_TO_TICKS(ms));
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
TaskHandle_t FixedTimeslotTask::getTaskHandle() {
|
||||
return handle;
|
||||
}
|
||||
|
@ -1,14 +1,16 @@
|
||||
#ifndef FRAMEWORK_OSAL_FREERTOS_FIXEDTIMESLOTTASK_H_
|
||||
#define FRAMEWORK_OSAL_FREERTOS_FIXEDTIMESLOTTASK_H_
|
||||
|
||||
#include "FreeRTOSTaskIF.h"
|
||||
#include "../../devicehandlers/FixedSlotSequence.h"
|
||||
#include "../../tasks/FixedTimeslotTaskIF.h"
|
||||
#include "../../tasks/Typedef.h"
|
||||
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
|
||||
class FixedTimeslotTask: public FixedTimeslotTaskIF {
|
||||
class FixedTimeslotTask: public FixedTimeslotTaskIF, public FreeRTOSTaskIF {
|
||||
public:
|
||||
|
||||
/**
|
||||
@ -23,7 +25,7 @@ public:
|
||||
* @param setDeadlineMissedFunc Callback if a deadline was missed.
|
||||
* @return Pointer to the newly created task.
|
||||
*/
|
||||
FixedTimeslotTask(const char *name, TaskPriority setPriority,
|
||||
FixedTimeslotTask(TaskName name, TaskPriority setPriority,
|
||||
TaskStackSize setStack, TaskPeriod overallPeriod,
|
||||
void (*setDeadlineMissedFunc)());
|
||||
|
||||
@ -57,6 +59,8 @@ public:
|
||||
|
||||
ReturnValue_t sleepFor(uint32_t ms) override;
|
||||
|
||||
TaskHandle_t getTaskHandle() override;
|
||||
|
||||
protected:
|
||||
bool started;
|
||||
TaskHandle_t handle;
|
||||
|
13
osal/FreeRTOS/FreeRTOSTaskIF.h
Normal file
13
osal/FreeRTOS/FreeRTOSTaskIF.h
Normal 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_ */
|
@ -2,27 +2,31 @@
|
||||
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
const uint32_t MutexIF::NO_TIMEOUT = 0;
|
||||
|
||||
Mutex::Mutex() {
|
||||
handle = xSemaphoreCreateMutex();
|
||||
//TODO print error
|
||||
if(handle == nullptr) {
|
||||
sif::error << "Mutex::Mutex(FreeRTOS): Creation failure" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
Mutex::~Mutex() {
|
||||
if (handle != 0) {
|
||||
if (handle != nullptr) {
|
||||
vSemaphoreDelete(handle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) {
|
||||
if (handle == 0) {
|
||||
//TODO Does not exist
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType,
|
||||
uint32_t timeoutMs) {
|
||||
if (handle == nullptr) {
|
||||
return MutexIF::MUTEX_NOT_FOUND;
|
||||
}
|
||||
TickType_t timeout = portMAX_DELAY;
|
||||
if (timeoutMs != NO_TIMEOUT) {
|
||||
// If the timeout type is BLOCKING, this will be the correct value.
|
||||
uint32_t timeout = portMAX_DELAY;
|
||||
if(timeoutType == TimeoutType::POLLING) {
|
||||
timeout = 0;
|
||||
}
|
||||
else if(timeoutType == TimeoutType::WAITING){
|
||||
timeout = pdMS_TO_TICKS(timeoutMs);
|
||||
}
|
||||
|
||||
@ -30,21 +34,18 @@ ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) {
|
||||
if (returncode == pdPASS) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
} else {
|
||||
//TODO could not be acquired/timeout
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
return MutexIF::MUTEX_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t Mutex::unlockMutex() {
|
||||
if (handle == 0) {
|
||||
//TODO Does not exist
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
if (handle == nullptr) {
|
||||
return MutexIF::MUTEX_NOT_FOUND;
|
||||
}
|
||||
BaseType_t returncode = xSemaphoreGive(handle);
|
||||
if (returncode == pdPASS) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
} else {
|
||||
//TODO is not owner
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
return MutexIF::CURR_THREAD_DOES_NOT_OWN_MUTEX;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,29 @@
|
||||
#ifndef OS_RTEMS_MUTEX_H_
|
||||
#define OS_RTEMS_MUTEX_H_
|
||||
#ifndef FRAMEWORK_FREERTOS_MUTEX_H_
|
||||
#define FRAMEWORK_FREERTOS_MUTEX_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 {
|
||||
public:
|
||||
Mutex();
|
||||
~Mutex();
|
||||
ReturnValue_t lockMutex(uint32_t timeoutMs);
|
||||
ReturnValue_t unlockMutex();
|
||||
ReturnValue_t lockMutex(TimeoutType timeoutType,
|
||||
uint32_t timeoutMs) override;
|
||||
ReturnValue_t unlockMutex() override;
|
||||
|
||||
private:
|
||||
SemaphoreHandle_t handle;
|
||||
};
|
||||
|
||||
#endif /* OS_RTEMS_MUTEX_H_ */
|
||||
#endif /* FRAMEWORK_FREERTOS_MUTEX_H_ */
|
||||
|
@ -5,12 +5,13 @@
|
||||
|
||||
PeriodicTask::PeriodicTask(const char *name, TaskPriority setPriority,
|
||||
TaskStackSize setStack, TaskPeriod setPeriod,
|
||||
void (*setDeadlineMissedFunc)()) :
|
||||
TaskDeadlineMissedFunction 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,
|
||||
setStack, this, setPriority, &handle);
|
||||
stackSize, this, setPriority, &handle);
|
||||
if(status != pdPASS){
|
||||
sif::debug << "PeriodicTask Insufficient heap memory remaining. "
|
||||
"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>(
|
||||
object);
|
||||
if (newObject == nullptr) {
|
||||
sif::error << "PeriodicTask::addComponent: Invalid object. Make sure"
|
||||
"it implements ExecutableObjectIF!" << std::endl;
|
||||
"it implement ExecutableObjectIF" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
objectList.push_back(newObject);
|
||||
newObject->setTaskIF(this);
|
||||
|
||||
if(setTaskIF) {
|
||||
newObject->setTaskIF(this);
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -124,6 +123,10 @@ void PeriodicTask::checkMissedDeadline(const TickType_t xLastWakeTime,
|
||||
}
|
||||
}
|
||||
|
||||
TaskHandle_t PeriodicTask::getTaskHandle() {
|
||||
return handle;
|
||||
}
|
||||
|
||||
void PeriodicTask::handleMissedDeadline() {
|
||||
#ifdef DEBUG
|
||||
sif::warning << "PeriodicTask: " << pcTaskGetName(NULL) <<
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "../../objectmanager/ObjectManagerIF.h"
|
||||
#include "../../tasks/PeriodicTaskIF.h"
|
||||
#include "../../tasks/Typedef.h"
|
||||
#include "FreeRTOSTaskIF.h"
|
||||
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
@ -17,7 +19,7 @@ class ExecutableObjectIF;
|
||||
* periodic activities of multiple objects.
|
||||
* @ingroup task_handling
|
||||
*/
|
||||
class PeriodicTask: public PeriodicTaskIF {
|
||||
class PeriodicTask: public PeriodicTaskIF, public FreeRTOSTaskIF {
|
||||
public:
|
||||
/**
|
||||
* 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
|
||||
* be assigned.
|
||||
*/
|
||||
PeriodicTask(const char *name, TaskPriority setPriority,
|
||||
PeriodicTask(TaskName name, TaskPriority setPriority,
|
||||
TaskStackSize setStack, TaskPeriod setPeriod,
|
||||
void (*setDeadlineMissedFunc)());
|
||||
TaskDeadlineMissedFunction deadlineMissedFunc);
|
||||
/**
|
||||
* @brief Currently, the executed object's lifetime is not coupled with
|
||||
* the task object's lifetime, so the destructor is empty.
|
||||
@ -63,12 +65,13 @@ public:
|
||||
* -@c RETURN_OK on success
|
||||
* -@c RETURN_FAILED if the object could not be added.
|
||||
*/
|
||||
ReturnValue_t addComponent(object_id_t object,
|
||||
bool setTaskIF = true) override;
|
||||
ReturnValue_t addComponent(object_id_t object) override;
|
||||
|
||||
uint32_t getPeriodMs() const override;
|
||||
|
||||
ReturnValue_t sleepFor(uint32_t ms) override;
|
||||
|
||||
TaskHandle_t getTaskHandle() override;
|
||||
protected:
|
||||
bool started;
|
||||
TaskHandle_t handle;
|
||||
|
24
osal/FreeRTOS/TaskManagement.cpp
Normal file
24
osal/FreeRTOS/TaskManagement.cpp
Normal 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);
|
||||
}
|
64
osal/FreeRTOS/TaskManagement.h
Normal file
64
osal/FreeRTOS/TaskManagement.h
Normal 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_ */
|
@ -179,7 +179,7 @@ ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_) {
|
||||
if(checkOrCreateClockMutex()!=HasReturnvaluesIF::RETURN_OK){
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
ReturnValue_t result = timeMutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
ReturnValue_t result = timeMutex->lockMutex(MutexIF::BLOCKING);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
@ -194,7 +194,7 @@ ReturnValue_t Clock::getLeapSeconds(uint16_t* leapSeconds_) {
|
||||
if(timeMutex==NULL){
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
ReturnValue_t result = timeMutex->lockMutex(MutexIF::NO_TIMEOUT);
|
||||
ReturnValue_t result = timeMutex->lockMutex(MutexIF::BLOCKING);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../../timemanager/Clock.h"
|
||||
|
||||
const uint32_t MutexIF::NO_TIMEOUT = 0;
|
||||
uint8_t Mutex::count = 0;
|
||||
|
||||
|
||||
@ -25,7 +24,9 @@ Mutex::Mutex() {
|
||||
sif::error << "Mutex: creation with name, id " << mutex.__data.__count
|
||||
<< ", " << " 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);
|
||||
if (status != 0) {
|
||||
sif::error << "Mutex: Attribute destroy failed with " << strerror(status) << std::endl;
|
||||
@ -37,9 +38,13 @@ Mutex::~Mutex() {
|
||||
pthread_mutex_destroy(&mutex);
|
||||
}
|
||||
|
||||
ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) {
|
||||
ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) {
|
||||
int status = 0;
|
||||
if (timeoutMs != MutexIF::NO_TIMEOUT) {
|
||||
|
||||
if(timeoutType == TimeoutType::POLLING) {
|
||||
status = pthread_mutex_trylock(&mutex);
|
||||
}
|
||||
else if (timeoutType == TimeoutType::WAITING) {
|
||||
timespec timeOut;
|
||||
clock_gettime(CLOCK_REALTIME, &timeOut);
|
||||
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_nsec = nseconds - timeOut.tv_sec * 1000000000;
|
||||
status = pthread_mutex_timedlock(&mutex, &timeOut);
|
||||
} else {
|
||||
}
|
||||
else if(timeoutType == TimeoutType::BLOCKING) {
|
||||
status = pthread_mutex_lock(&mutex);
|
||||
}
|
||||
|
||||
switch (status) {
|
||||
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;
|
||||
//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 value specified by mutex does not refer to an initialized mutex object.
|
||||
// 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 value specified by mutex does not refer to an initialized mutex object.
|
||||
//return MUTEX_NOT_FOUND;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
case 0:
|
||||
//Success
|
||||
|
@ -1,14 +1,15 @@
|
||||
#ifndef OS_RTEMS_MUTEX_H_
|
||||
#define OS_RTEMS_MUTEX_H_
|
||||
#ifndef OS_LINUX_MUTEX_H_
|
||||
#define OS_LINUX_MUTEX_H_
|
||||
|
||||
#include "../../ipc/MutexIF.h"
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
class Mutex : public MutexIF {
|
||||
public:
|
||||
Mutex();
|
||||
virtual ~Mutex();
|
||||
virtual ReturnValue_t lockMutex(uint32_t timeoutMs);
|
||||
virtual ReturnValue_t lockMutex(TimeoutType timeoutType, uint32_t timeoutMs);
|
||||
virtual ReturnValue_t unlockMutex();
|
||||
private:
|
||||
pthread_mutex_t mutex;
|
||||
|
@ -21,8 +21,7 @@ void* PeriodicPosixTask::taskEntryPoint(void* arg) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ReturnValue_t PeriodicPosixTask::addComponent(object_id_t object,
|
||||
bool addTaskIF) {
|
||||
ReturnValue_t PeriodicPosixTask::addComponent(object_id_t object) {
|
||||
ExecutableObjectIF* newObject = objectManager->get<ExecutableObjectIF>(
|
||||
object);
|
||||
if (newObject == nullptr) {
|
||||
|
@ -39,8 +39,7 @@ public:
|
||||
* @param object Id of the object to add.
|
||||
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
|
||||
*/
|
||||
ReturnValue_t addComponent(object_id_t object,
|
||||
bool addTaskIF = true) override;
|
||||
ReturnValue_t addComponent(object_id_t object) override;
|
||||
|
||||
uint32_t getPeriodMs() const override;
|
||||
|
||||
|
@ -78,6 +78,8 @@ ReturnValue_t MultiObjectTask::addComponent(object_id_t object) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
objectList.push_back(newObject);
|
||||
newObject->setTaskIF(this);
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,5 @@
|
||||
/**
|
||||
* @file MultiObjectTask.h
|
||||
* @brief This file defines the MultiObjectTask class.
|
||||
* @date 30.01.2014
|
||||
* @author baetz
|
||||
*/
|
||||
#ifndef MULTIOBJECTTASK_H_
|
||||
#define MULTIOBJECTTASK_H_
|
||||
#ifndef FSFW_OSAL_RTEMS_MULTIOBJECTTASK_H_
|
||||
#define FSFW_OSAL_RTEMS_MULTIOBJECTTASK_H_
|
||||
|
||||
#include "../../objectmanager/ObjectManagerIF.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
|
||||
* multiple objects that implement the ExecutableObjectIF interface. The objects must be
|
||||
* added prior to starting the task.
|
||||
*
|
||||
* @author baetz
|
||||
* @ingroup task_handling
|
||||
*/
|
||||
class MultiObjectTask: public TaskBase, public PeriodicTaskIF {
|
||||
@ -63,11 +57,11 @@ public:
|
||||
* @param object Id of the object to add.
|
||||
* @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:
|
||||
typedef std::vector<ExecutableObjectIF*> ObjectList; //!< Typedef for the List of objects.
|
||||
/**
|
||||
@ -110,4 +104,4 @@ protected:
|
||||
void taskFunctionality(void);
|
||||
};
|
||||
|
||||
#endif /* MULTIOBJECTTASK_H_ */
|
||||
#endif /* FSFW_OSAL_RTEMS_MULTIOBJECTTASK_H_ */
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "Mutex.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
const uint32_t MutexIF::NO_TIMEOUT = RTEMS_NO_TIMEOUT;
|
||||
uint8_t Mutex::count = 0;
|
||||
|
||||
Mutex::Mutex() :
|
||||
@ -24,8 +23,22 @@ Mutex::~Mutex() {
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) {
|
||||
rtems_status_code status = rtems_semaphore_obtain(mutexId, RTEMS_WAIT, timeoutMs);
|
||||
ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType =
|
||||
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){
|
||||
case RTEMS_SUCCESSFUL:
|
||||
//semaphore obtained successfully
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef OS_RTEMS_MUTEX_H_
|
||||
#define OS_RTEMS_MUTEX_H_
|
||||
#ifndef FRAMEWORK_OSAL_RTEMS_MUTEX_H_
|
||||
#define FRAMEWORK_OSAL_RTEMS_MUTEX_H_
|
||||
|
||||
#include "../../ipc/MutexIF.h"
|
||||
#include "RtemsBasic.h"
|
||||
@ -8,7 +8,7 @@ class Mutex : public MutexIF {
|
||||
public:
|
||||
Mutex();
|
||||
~Mutex();
|
||||
ReturnValue_t lockMutex(uint32_t timeoutMs);
|
||||
ReturnValue_t lockMutex(TimeoutType timeoutType, uint32_t timeoutMs = 0);
|
||||
ReturnValue_t unlockMutex();
|
||||
private:
|
||||
rtems_id mutexId;
|
||||
|
@ -9,7 +9,7 @@ class ParameterMessage {
|
||||
private:
|
||||
ParameterMessage();
|
||||
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_DUMP = MAKE_COMMAND_ID( 0x02 );
|
||||
static const Command_t REPLY_PARAMETER_DUMP = MAKE_COMMAND_ID( 0x03 );
|
||||
|
@ -1,94 +1,129 @@
|
||||
#include "SerialBufferAdapter.h"
|
||||
#include <cstring>
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
SerialBufferAdapter<T>::SerialBufferAdapter(const uint8_t* buffer,
|
||||
T bufferLength, bool serializeLenght) :
|
||||
serializeLength(serializeLenght), constBuffer(buffer), buffer(NULL), bufferLength(
|
||||
bufferLength) {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
SerialBufferAdapter<T>::SerialBufferAdapter(uint8_t* buffer, T bufferLength,
|
||||
bool serializeLenght) :
|
||||
serializeLength(serializeLenght), constBuffer(NULL), buffer(buffer), bufferLength(
|
||||
bufferLength) {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
SerialBufferAdapter<T>::~SerialBufferAdapter() {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ReturnValue_t SerialBufferAdapter<T>::serialize(uint8_t** buffer, size_t* size,
|
||||
size_t maxSize, Endianness streamEndianness) const {
|
||||
uint32_t serializedLength = bufferLength;
|
||||
if (serializeLength) {
|
||||
serializedLength += SerializeAdapter::getSerializedSize(
|
||||
&bufferLength);
|
||||
}
|
||||
if (*size + serializedLength > maxSize) {
|
||||
return BUFFER_TOO_SHORT;
|
||||
} else {
|
||||
if (serializeLength) {
|
||||
SerializeAdapter::serialize(&bufferLength, buffer, size,
|
||||
maxSize, streamEndianness);
|
||||
}
|
||||
if (this->constBuffer != NULL) {
|
||||
memcpy(*buffer, this->constBuffer, bufferLength);
|
||||
} else if (this->buffer != NULL) {
|
||||
memcpy(*buffer, this->buffer, bufferLength);
|
||||
} else {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
*size += bufferLength;
|
||||
(*buffer) += bufferLength;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
size_t SerialBufferAdapter<T>::getSerializedSize() const {
|
||||
if (serializeLength) {
|
||||
return bufferLength + SerializeAdapter::getSerializedSize(&bufferLength);
|
||||
} else {
|
||||
return bufferLength;
|
||||
}
|
||||
}
|
||||
template<typename T>
|
||||
ReturnValue_t SerialBufferAdapter<T>::deSerialize(const uint8_t** buffer,
|
||||
size_t* size, Endianness streamEndianness) {
|
||||
//TODO Ignores Endian flag!
|
||||
if (buffer != NULL) {
|
||||
if(serializeLength){
|
||||
T serializedSize = SerializeAdapter::getSerializedSize(
|
||||
&bufferLength);
|
||||
if((*size - bufferLength - serializedSize) >= 0){
|
||||
*buffer += serializedSize;
|
||||
*size -= serializedSize;
|
||||
}else{
|
||||
return STREAM_TOO_SHORT;
|
||||
}
|
||||
}
|
||||
//No Else If, go on with buffer
|
||||
if (*size - bufferLength >= 0) {
|
||||
*size -= bufferLength;
|
||||
memcpy(this->buffer, *buffer, bufferLength);
|
||||
(*buffer) += bufferLength;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
} else {
|
||||
return STREAM_TOO_SHORT;
|
||||
}
|
||||
} else {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//forward Template declaration for linker
|
||||
template class SerialBufferAdapter<uint8_t>;
|
||||
template class SerialBufferAdapter<uint16_t>;
|
||||
template class SerialBufferAdapter<uint32_t>;
|
||||
|
||||
#include "../serialize/SerialBufferAdapter.h"
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include <cstring>
|
||||
|
||||
template<typename count_t>
|
||||
SerialBufferAdapter<count_t>::SerialBufferAdapter(const uint8_t* buffer,
|
||||
count_t bufferLength, bool serializeLength) :
|
||||
serializeLength(serializeLength),
|
||||
constBuffer(buffer), buffer(nullptr),
|
||||
bufferLength(bufferLength) {}
|
||||
|
||||
template<typename count_t>
|
||||
SerialBufferAdapter<count_t>::SerialBufferAdapter(uint8_t* buffer,
|
||||
count_t bufferLength, bool serializeLength) :
|
||||
serializeLength(serializeLength), constBuffer(buffer), buffer(buffer),
|
||||
bufferLength(bufferLength) {}
|
||||
|
||||
|
||||
template<typename count_t>
|
||||
SerialBufferAdapter<count_t>::~SerialBufferAdapter() {
|
||||
}
|
||||
|
||||
template<typename count_t>
|
||||
ReturnValue_t SerialBufferAdapter<count_t>::serialize(uint8_t** buffer,
|
||||
size_t* size, size_t maxSize, Endianness streamEndianness) const {
|
||||
if (serializeLength) {
|
||||
ReturnValue_t result = SerializeAdapter::serialize(&bufferLength,
|
||||
buffer, size, maxSize, streamEndianness);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (*size + bufferLength > maxSize) {
|
||||
return BUFFER_TOO_SHORT;
|
||||
}
|
||||
|
||||
if (this->constBuffer != nullptr) {
|
||||
std::memcpy(*buffer, this->constBuffer, bufferLength);
|
||||
}
|
||||
else if (this->buffer != nullptr) {
|
||||
// This will propably be never reached, constBuffer should always be
|
||||
// set if non-const buffer is set.
|
||||
std::memcpy(*buffer, this->buffer, bufferLength);
|
||||
}
|
||||
else {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
*size += bufferLength;
|
||||
(*buffer) += bufferLength;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
|
||||
}
|
||||
|
||||
template<typename count_t>
|
||||
size_t SerialBufferAdapter<count_t>::getSerializedSize() const {
|
||||
if (serializeLength) {
|
||||
return bufferLength + SerializeAdapter::getSerializedSize(&bufferLength);
|
||||
} else {
|
||||
return bufferLength;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename count_t>
|
||||
ReturnValue_t SerialBufferAdapter<count_t>::deSerialize(const uint8_t** buffer,
|
||||
size_t* size, Endianness streamEndianness) {
|
||||
if (this->buffer == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
if(serializeLength){
|
||||
count_t lengthField = 0;
|
||||
ReturnValue_t result = SerializeAdapter::deSerialize(&lengthField,
|
||||
buffer, size, streamEndianness);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
if(lengthField > bufferLength) {
|
||||
return TOO_MANY_ELEMENTS;
|
||||
}
|
||||
bufferLength = lengthField;
|
||||
}
|
||||
|
||||
if (bufferLength <= *size) {
|
||||
*size -= bufferLength;
|
||||
std::memcpy(this->buffer, *buffer, bufferLength);
|
||||
(*buffer) += bufferLength;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
else {
|
||||
return STREAM_TOO_SHORT;
|
||||
}
|
||||
}
|
||||
|
||||
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>;
|
||||
|
||||
|
@ -1,35 +1,78 @@
|
||||
#ifndef SERIALBUFFERADAPTER_H_
|
||||
#define SERIALBUFFERADAPTER_H_
|
||||
|
||||
#include "SerializeIF.h"
|
||||
#include "SerializeAdapter.h"
|
||||
|
||||
/**
|
||||
* \ingroup serialize
|
||||
*/
|
||||
template<typename T>
|
||||
class SerialBufferAdapter: public SerializeIF {
|
||||
public:
|
||||
SerialBufferAdapter(const uint8_t * buffer, T bufferLength, bool serializeLenght = false);
|
||||
SerialBufferAdapter(uint8_t* buffer, T bufferLength,
|
||||
bool serializeLenght = 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;
|
||||
|
||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||
Endianness streamEndianness) override;
|
||||
private:
|
||||
bool serializeLength;
|
||||
const uint8_t *constBuffer;
|
||||
uint8_t *buffer;
|
||||
T bufferLength;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* SERIALBUFFERADAPTER_H_ */
|
||||
#ifndef SERIALBUFFERADAPTER_H_
|
||||
#define SERIALBUFFERADAPTER_H_
|
||||
|
||||
#include "../serialize/SerializeIF.h"
|
||||
#include "../serialize/SerializeAdapter.h"
|
||||
|
||||
/**
|
||||
* This adapter provides an interface for SerializeIF to serialize or deserialize
|
||||
* buffers with no length header but a known size.
|
||||
*
|
||||
* Additionally, the buffer length can be serialized too and will be put in
|
||||
* front of the serialized buffer.
|
||||
*
|
||||
* Can be used with SerialLinkedListAdapter by declaring a SerializeElement with
|
||||
* SerialElement<SerialBufferAdapter<bufferLengthType(will be uint8_t mostly)>>.
|
||||
* Right now, the SerialBufferAdapter must always
|
||||
* be initialized with the buffer and size !
|
||||
*
|
||||
* \ingroup serialize
|
||||
*/
|
||||
template<typename count_t>
|
||||
class SerialBufferAdapter: public SerializeIF {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor for 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
|
||||
*/
|
||||
SerialBufferAdapter(const uint8_t* buffer, count_t bufferLength,
|
||||
bool serializeLength = false);
|
||||
|
||||
/**
|
||||
* 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_ */
|
||||
|
@ -17,7 +17,7 @@ inline PoolManager<NUMBER_OF_POOLS>::~PoolManager(void) {
|
||||
template<uint8_t NUMBER_OF_POOLS>
|
||||
inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::reserveSpace(
|
||||
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,
|
||||
address,ignoreFault);
|
||||
return status;
|
||||
@ -29,7 +29,7 @@ inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(
|
||||
// debug << "PoolManager( " << translateObject(getObjectId()) <<
|
||||
// " )::deleteData from store " << packet_id.pool_index <<
|
||||
// ". 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);
|
||||
return status;
|
||||
}
|
||||
@ -37,7 +37,7 @@ inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(
|
||||
template<uint8_t NUMBER_OF_POOLS>
|
||||
inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(uint8_t* buffer,
|
||||
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,
|
||||
size, storeId);
|
||||
return status;
|
||||
@ -46,7 +46,7 @@ inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(uint8_t* buffer,
|
||||
template<uint8_t NUMBER_OF_POOLS>
|
||||
inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::modifyData(
|
||||
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,
|
||||
packet_ptr, size);
|
||||
return status;
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
class ModeSequenceMessage {
|
||||
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_TABLE = MAKE_COMMAND_ID(0x02);
|
||||
|
@ -36,8 +36,7 @@ public:
|
||||
* to the component.
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t addComponent(object_id_t object,
|
||||
bool setTaskIF = true) {
|
||||
virtual ReturnValue_t addComponent(object_id_t object) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef FRAMEWORK_TASKS_TYPEDEF_H_
|
||||
#define FRAMEWORK_TASKS_TYPEDEF_H_
|
||||
|
||||
//TODO more generic?
|
||||
typedef const char* TaskName;
|
||||
typedef uint8_t TaskPriority;
|
||||
typedef size_t TaskStackSize;
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
|
||||
static store_address_t getStoreId(const CommandMessage* cmd);
|
||||
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 DELETE_STORE_CONTENT = MAKE_COMMAND_ID(2);
|
||||
static const Command_t DOWNLINK_STORE_CONTENT = MAKE_COMMAND_ID(3);
|
||||
|
Loading…
Reference in New Issue
Block a user