Merge branch 'mueller_framework' into front_branch
This commit is contained in:
@ -2,12 +2,14 @@
|
||||
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
|
||||
// TODO I guess we should have a way of checking if we are in an ISR and then use the "fromISR" versions of all calls
|
||||
// As a first step towards this, introduces system context variable which needs to be switched manually
|
||||
// TODO I guess we should have a way of checking if we are in an ISR and then
|
||||
// use the "fromISR" versions of all calls
|
||||
// As a first step towards this, introduces system context variable which needs
|
||||
// to be switched manually
|
||||
// Haven't found function to find system context.
|
||||
MessageQueue::MessageQueue(size_t message_depth, size_t max_message_size) :
|
||||
MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize) :
|
||||
defaultDestination(0),lastPartner(0), callContext(CallContext::task) {
|
||||
handle = xQueueCreate(message_depth, max_message_size);
|
||||
handle = xQueueCreate(messageDepth, maxMessageSize);
|
||||
if (handle == NULL) {
|
||||
sif::error << "MessageQueue creation failed" << std::endl;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "PeriodicTask.h"
|
||||
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <framework/tasks/ExecutableObjectIF.h>
|
||||
#include "PeriodicTask.h"
|
||||
|
||||
PeriodicTask::PeriodicTask(const char *name, TaskPriority setPriority,
|
||||
TaskStackSize setStack, TaskPeriod setPeriod,
|
||||
@ -31,7 +32,7 @@ void PeriodicTask::taskEntryPoint(void* argument) {
|
||||
// if it is not set and we get here, the scheduler was started before #startTask() was called and we need to suspend
|
||||
// if it is set, the scheduler was not running before #startTask() was called and we can continue
|
||||
|
||||
if (!originalTask->started) {
|
||||
if (not originalTask->started) {
|
||||
vTaskSuspend(NULL);
|
||||
}
|
||||
|
||||
@ -70,8 +71,19 @@ void PeriodicTask::taskFunctionality() {
|
||||
it != objectList.end(); ++it) {
|
||||
(*it)->performOperation();
|
||||
}
|
||||
//TODO deadline missed check
|
||||
|
||||
/* If all operations are finished and the difference of the
|
||||
* current time minus the last wake time is larger than the
|
||||
* wait period, a deadline was missed. */
|
||||
if(xTaskGetTickCount() - xLastWakeTime >= xPeriod) {
|
||||
sif::warning << "PeriodicTask: " << pcTaskGetName(NULL) <<
|
||||
" missed deadline!\n" << std::flush;
|
||||
if(deadlineMissedFunc != nullptr) {
|
||||
this->deadlineMissedFunc();
|
||||
}
|
||||
}
|
||||
vTaskDelayUntil(&xLastWakeTime, xPeriod);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,10 @@
|
||||
#include <framework/tasks/PeriodicTaskIF.h>
|
||||
#include <framework/tasks/Typedef.h>
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include "task.h"
|
||||
extern "C" {
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
}
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -3,16 +3,18 @@
|
||||
#include <framework/osal/FreeRTOS/MessageQueue.h>
|
||||
|
||||
|
||||
QueueFactory* QueueFactory::factoryInstance = NULL;
|
||||
QueueFactory* QueueFactory::factoryInstance = nullptr;
|
||||
|
||||
|
||||
ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo,
|
||||
MessageQueueMessage* message, MessageQueueId_t sentFrom,bool ignoreFault) {
|
||||
return MessageQueue::sendMessageFromMessageQueue(sendTo,message,sentFrom,ignoreFault);
|
||||
MessageQueueMessage* message, MessageQueueId_t sentFrom,
|
||||
bool ignoreFault) {
|
||||
return MessageQueue::sendMessageFromMessageQueue(sendTo,message,
|
||||
sentFrom,ignoreFault);
|
||||
}
|
||||
|
||||
QueueFactory* QueueFactory::instance() {
|
||||
if (factoryInstance == NULL) {
|
||||
if (factoryInstance == nullptr) {
|
||||
factoryInstance = new QueueFactory;
|
||||
}
|
||||
return factoryInstance;
|
||||
@ -24,9 +26,9 @@ QueueFactory::QueueFactory() {
|
||||
QueueFactory::~QueueFactory() {
|
||||
}
|
||||
|
||||
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t message_depth,
|
||||
uint32_t max_message_size) {
|
||||
return new MessageQueue(message_depth, max_message_size);
|
||||
MessageQueueIF* QueueFactory::createMessageQueue(size_t messageDepth,
|
||||
size_t maxMessageSize) {
|
||||
return new MessageQueue(messageDepth, maxMessageSize);
|
||||
}
|
||||
|
||||
void QueueFactory::deleteMessageQueue(MessageQueueIF* queue) {
|
||||
|
Reference in New Issue
Block a user