1
0
forked from fsfw/fsfw

Merge remote-tracking branch 'upstream/master' into mueller_MutexImprovements

This commit is contained in:
2020-07-13 22:18:08 +02:00
105 changed files with 2999 additions and 2026 deletions

View File

@ -1,16 +1,18 @@
#include <framework/timemanager/Clock.h>
#include <framework/globalfunctions/timevalOperations.h>
#include <stdlib.h>
#include "Timekeeper.h"
#include <framework/osal/FreeRTOS/Timekeeper.h>
#include <FreeRTOS.h>
#include <task.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <stdlib.h>
#include <time.h>
//TODO sanitize input?
//TODO much of this code can be reused for tick-only systems
uint16_t Clock::leapSeconds = 0;
MutexIF* Clock::timeMutex = NULL;
MutexIF* Clock::timeMutex = nullptr;
uint32_t Clock::getTicksPerSecond(void) {
return 1000;
@ -56,7 +58,6 @@ ReturnValue_t Clock::getUptime(timeval* uptime) {
timeval Clock::getUptime() {
TickType_t ticksSinceStart = xTaskGetTickCount();
return Timekeeper::ticksToTimeval(ticksSinceStart);
}
@ -128,7 +129,7 @@ ReturnValue_t Clock::convertTimevalToJD2000(timeval time, double* JD2000) {
ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval* tt) {
//SHOULDDO: works not for dates in the past (might have less leap seconds)
if (timeMutex == NULL) {
if (timeMutex == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -82,10 +82,10 @@ 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.
std::list<FixedSequenceSlot*>::iterator it = pst.current;
auto slotListIter = pst.current;
//The start time for the first entry is read.
uint32_t intervalMs = (*it)->pollingTimeMs;
uint32_t intervalMs = slotListIter->pollingTimeMs;
TickType_t interval = pdMS_TO_TICKS(intervalMs);
TickType_t xLastWakeTime;
@ -120,4 +120,3 @@ ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) {
vTaskDelay(pdMS_TO_TICKS(ms));
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -5,8 +5,10 @@
#include <framework/tasks/FixedTimeslotTaskIF.h>
#include <framework/tasks/Typedef.h>
#include <FreeRTOS.h>
extern "C" {
#include "FreeRTOS.h"
#include "task.h"
}
class FixedTimeslotTask: public FixedTimeslotTaskIF {
public:

View File

@ -25,8 +25,8 @@ QueueFactory::~QueueFactory() {
}
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t message_depth,
uint32_t max_message_size) {
return new MessageQueue(message_depth, max_message_size);
size_t maxMessageSize) {
return new MessageQueue(message_depth, maxMessageSize);
}
void QueueFactory::deleteMessageQueue(MessageQueueIF* queue) {

View File

@ -1,20 +1,19 @@
#include "Timekeeper.h"
#include <FreeRTOSConfig.h>
#include <framework/osal/FreeRTOS/Timekeeper.h>
Timekeeper::Timekeeper() :
offset( { 0, 0 }) {
// TODO Auto-generated constructor stub
#include "FreeRTOSConfig.h"
}
Timekeeper * Timekeeper::myinstance = nullptr;
Timekeeper * Timekeeper::myinstance = NULL;
Timekeeper::Timekeeper() : offset( { 0, 0 } ) {}
Timekeeper::~Timekeeper() {}
const timeval& Timekeeper::getOffset() const {
return offset;
}
Timekeeper* Timekeeper::instance() {
if (myinstance == NULL) {
if (myinstance == nullptr) {
myinstance = new Timekeeper();
}
return myinstance;
@ -24,10 +23,6 @@ void Timekeeper::setOffset(const timeval& offset) {
this->offset = offset;
}
Timekeeper::~Timekeeper() {
// TODO Auto-generated destructor stub
}
timeval Timekeeper::ticksToTimeval(TickType_t ticks) {
timeval uptime;
uptime.tv_sec = ticks / configTICK_RATE_HZ;
@ -40,3 +35,7 @@ timeval Timekeeper::ticksToTimeval(TickType_t ticks) {
return uptime;
}
TickType_t Timekeeper::getTicks() {
return xTaskGetTickCount();
}

View File

@ -3,7 +3,9 @@
#include <framework/timemanager/Clock.h>
#include <FreeRTOS.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
/**
* A Class to basically store the time difference between uptime and UTC
@ -25,6 +27,11 @@ public:
virtual ~Timekeeper();
static timeval ticksToTimeval(TickType_t ticks);
/**
* Get elapsed time in system ticks.
* @return
*/
static TickType_t getTicks();
const timeval& getOffset() const;
void setOffset(const timeval& offset);