Merge branch 'windows-tweaks' into develop

This commit is contained in:
Robin Müller 2022-09-28 00:03:51 +02:00
commit c932e51818
7 changed files with 26 additions and 2 deletions

View File

@ -1,5 +1,6 @@
#include "fsfw/osal/common/TcpIpBase.h"
#include "fsfw/serviceinterface.h"
#include "fsfw/platform.h"
#ifdef PLATFORM_UNIX

View File

@ -8,6 +8,7 @@
#if defined(PLATFORM_WIN)
#include <sysinfoapi.h>
#define timegm _mkgmtime
#elif defined(PLATFORM_UNIX)
#include <fstream>
#endif

View File

@ -1,6 +1,7 @@
#include "fsfw/osal/windows/winTaskHelpers.h"
#include <mutex>
#include <windows.h>
TaskPriority tasks::makeWinPriority(PriorityClass prioClass, PriorityNumber prioNumber) {
return (static_cast<uint16_t>(prioClass) << 16) | static_cast<uint16_t>(prioNumber);

View File

@ -1,10 +1,12 @@
#include <map>
#include <thread>
#include "../../tasks/TaskFactory.h"
#include "fsfw/tasks/TaskFactory.h"
#ifdef _WIN32
#include <minwindef.h>
namespace tasks {
enum PriorityClass : uint16_t {

View File

@ -61,10 +61,16 @@ ReturnValue_t Clock::convertTimevalToTimeOfDay(const timeval* from, TimeOfDay_t*
if (result != returnvalue::OK) {
return result;
}
MutexGuard helper(timeMutex);
// gmtime writes its output in a global buffer which is not Thread Safe
// Therefore we have to use a Mutex here
MutexGuard helper(timeMutex);
#ifdef PLATFORM_WIN
time_t time;
time = from->tv_sec;
timeInfo = gmtime(&time);
#else
timeInfo = gmtime(&from->tv_sec);
#endif
to->year = timeInfo->tm_year + 1900;
to->month = timeInfo->tm_mon + 1;
to->day = timeInfo->tm_mday;

View File

@ -2,6 +2,12 @@
#define FSFW_TIMEMANAGER_TIMEREADERIF_H
#include <cstdlib>
#include "fsfw/platform.h"
#ifdef PLATFORM_WIN
// wtf? Required for timeval!
#include <winsock.h>
#endif
#include "TimeStampIF.h"
#include "fsfw/returnvalues/returnvalue.h"

View File

@ -5,6 +5,13 @@
#include <string>
#include <unordered_map>
#ifdef PLATFORM_WIN
// What is this crap?
#undef IN
#undef OUT
#undef CALLBACK
#endif
using gpioId_t = uint16_t;
namespace gpio {