This commit is contained in:
2023-01-26 13:40:44 +01:00
parent 941bf61f28
commit e37af4fe70
32 changed files with 94 additions and 104 deletions

View File

@ -1,8 +1,8 @@
#ifndef FSFW_MEMORY_HASFILESYSTEMIF_H_
#define FSFW_MEMORY_HASFILESYSTEMIF_H_
#include <filesystem>
#include <cstddef>
#include <filesystem>
#include "FileSystemArgsIF.h"
#include "fsfw/ipc/MessageQueueIF.h"

View File

@ -58,7 +58,7 @@ class Type : public SerializeIF {
template <typename T>
struct PodTypeConversion {
static_assert(! std::is_same<T, bool>::value,
static_assert(!std::is_same<T, bool>::value,
"Do not use boolean for the PoolEntry type, use uint8_t "
"instead! The ECSS standard defines a boolean as a one bit "
"field. Therefore it is preferred to store a boolean as an "

View File

@ -84,9 +84,9 @@ void arrayprinter::printDec(const uint8_t *data, size_t size, size_t maxCharPerL
#else
// General format: 32,243,-12 so it is number of chars times 4
// plus line break plus small safety margin.
for (size_t i = 0; i < size; i++) {
//TODO
// TODO
}
#endif
}

View File

@ -24,8 +24,8 @@
#else
#ifdef WIN32
#include <winsock2.h>
#include <windows.h>
#include <winsock2.h>
#if REG_DWORD == REG_DWORD_LITTLE_ENDIAN
#define BYTE_ORDER_SYSTEM LITTLE_ENDIAN
#else

View File

@ -40,6 +40,3 @@ timeval Clock::getUptime() {
// timeval uptime = getUptime();
// return uptime.tv_sec;
// }

View File

@ -78,4 +78,3 @@ timeval Clock::getUptime() {
#endif
return timeval;
}

View File

@ -10,7 +10,6 @@
#if defined(PLATFORM_WIN)
#include "fsfw/osal/windows/winTaskHelpers.h"
#elif defined(PLATFORM_UNIX)
#include <pthread.h>

View File

@ -3,8 +3,8 @@
#include <fsfw/returnvalues/returnvalue.h>
#include <thread>
#include <string>
#include <thread>
namespace tasks {

View File

@ -34,7 +34,7 @@ ReturnValue_t Clock::getClock_timeval(timeval* time) {
}
timeval Clock::getUptime() {
timeval uptime{0,0};
timeval uptime{0, 0};
double uptimeSeconds;
if (std::ifstream("/proc/uptime", std::ios::in) >> uptimeSeconds) {
uptime.tv_sec = uptimeSeconds;

View File

@ -2,7 +2,7 @@
#include <rtems/rtems/sem.h>
//TODO
// TODO
BinarySemaphore::BinarySemaphore() {}

View File

@ -6,7 +6,6 @@
#include "fsfw/ipc/MutexGuard.h"
#include "fsfw/osal/rtems/RtemsBasic.h"
ReturnValue_t Clock::setClock(const timeval* time) {
TimeOfDay_t time_tod;
ReturnValue_t result = convertTimevalToTimeOfDay(time, &time_tod);
@ -20,7 +19,8 @@ ReturnValue_t Clock::setClock(const timeval* time) {
timeRtems.hour = time_tod.hour;
timeRtems.minute = time_tod.minute;
timeRtems.second = time_tod.second;
timeRtems.ticks = static_cast<uint64_t>(time_tod.usecond) * rtems_clock_get_ticks_per_second() / 1e6;
timeRtems.ticks =
static_cast<uint64_t>(time_tod.usecond) * rtems_clock_get_ticks_per_second() / 1e6;
rtems_status_code status = rtems_clock_set(&timeRtems);
switch (status) {
case RTEMS_SUCCESSFUL:

View File

@ -35,19 +35,19 @@ ReturnValue_t InternalErrorCodes::translate(uint8_t code) {
return OUT_OF_PROXIES;
case INTERNAL_ERROR_INVALID_GLOBAL_ID:
return INVALID_GLOBAL_ID;
//TODO this one is not there anymore in rtems-6 (5 as well?)
//case INTERNAL_ERROR_BAD_STACK_HOOK:
// return BAD_STACK_HOOK;
// case INTERNAL_ERROR_BAD_ATTRIBUTES:
// return BAD_ATTRIBUTES;
// case INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY:
// return IMPLEMENTATION_KEY_CREATE_INCONSISTENCY;
// case INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL:
// return IMPLEMENTATION_BLOCKING_OPERATION_CANCEL;
// case INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE:
// return MUTEX_OBTAIN_FROM_BAD_STATE;
// case INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0:
// return UNLIMITED_AND_MAXIMUM_IS_0;
// TODO this one is not there anymore in rtems-6 (5 as well?)
// case INTERNAL_ERROR_BAD_STACK_HOOK:
// return BAD_STACK_HOOK;
// case INTERNAL_ERROR_BAD_ATTRIBUTES:
// return BAD_ATTRIBUTES;
// case INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY:
// return IMPLEMENTATION_KEY_CREATE_INCONSISTENCY;
// case INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL:
// return IMPLEMENTATION_BLOCKING_OPERATION_CANCEL;
// case INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE:
// return MUTEX_OBTAIN_FROM_BAD_STATE;
// case INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0:
// return UNLIMITED_AND_MAXIMUM_IS_0;
default:
return returnvalue::FAILED;
}

View File

@ -1,5 +1,5 @@
#include "fsfw/osal/rtems/BinarySemaphore.h"
//#include "fsfw/osal/rtems/CountingSemaphore.h"
// #include "fsfw/osal/rtems/CountingSemaphore.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tasks/SemaphoreFactory.h"
@ -19,8 +19,8 @@ SemaphoreFactory* SemaphoreFactory::instance() {
SemaphoreIF* SemaphoreFactory::createBinarySemaphore(uint32_t argument) {
return nullptr;
//TODO
//return new BinarySemaphore();
// TODO
// return new BinarySemaphore();
}
SemaphoreIF* SemaphoreFactory::createCountingSemaphore(uint8_t maxCount, uint8_t initCount,

View File

@ -5,8 +5,8 @@
#ifdef _WIN32
#include <windows.h>
#include <processthreadsapi.h>
#include <windows.h>
namespace tasks {

View File

@ -10,11 +10,11 @@
//////////////////////////////////////////////////////////////////////////////////
// RMAP command bits
//#define RMAP_COMMAND_BIT_INCREMENT 2
//#define RMAP_COMMAND_BIT_REPLY 3
//#define RMAP_COMMAND_BIT_WRITE 5
//#define RMAP_COMMAND_BIT_VERIFY 4
//#define RMAP_COMMAND_BIT 6
// #define RMAP_COMMAND_BIT_INCREMENT 2
// #define RMAP_COMMAND_BIT_REPLY 3
// #define RMAP_COMMAND_BIT_WRITE 5
// #define RMAP_COMMAND_BIT_VERIFY 4
// #define RMAP_COMMAND_BIT 6
namespace RMAPIds {
@ -32,14 +32,14 @@ static const uint8_t RMAP_COMMAND_READ = ((1 << RMAP_COMMAND_BIT) | (1 << RMAP_C
static const uint8_t RMAP_REPLY_WRITE =
((1 << RMAP_COMMAND_BIT_WRITE) | (1 << RMAP_COMMAND_BIT_REPLY));
static const uint8_t RMAP_REPLY_READ = ((1 << RMAP_COMMAND_BIT_REPLY));
//#define RMAP_COMMAND_WRITE ((1<<RMAP_COMMAND_BIT) | (1<<RMAP_COMMAND_BIT_WRITE)
// #define RMAP_COMMAND_WRITE ((1<<RMAP_COMMAND_BIT) | (1<<RMAP_COMMAND_BIT_WRITE)
//| (1<<RMAP_COMMAND_BIT_REPLY)) #define RMAP_COMMAND_WRITE_VERIFY ((1<<RMAP_COMMAND_BIT) |
//(1<<RMAP_COMMAND_BIT_WRITE) | (1<<RMAP_COMMAND_BIT_REPLY) | (1<<RMAP_COMMAND_BIT_VERIFY)) #define
// RMAP_COMMAND_READ ((1<<RMAP_COMMAND_BIT) | (1<<RMAP_COMMAND_BIT_REPLY))
// RMAP_COMMAND_READ ((1<<RMAP_COMMAND_BIT) | (1<<RMAP_COMMAND_BIT_REPLY))
//#define RMAP_REPLY_WRITE ((1<<RMAP_COMMAND_BIT_WRITE) |
// #define RMAP_REPLY_WRITE ((1<<RMAP_COMMAND_BIT_WRITE) |
//(1<<RMAP_COMMAND_BIT_REPLY))
//#define RMAP_REPLY_WRITE_VERIFY ((1<<RMAP_COMMAND_BIT_WRITE) |
// #define RMAP_REPLY_WRITE_VERIFY ((1<<RMAP_COMMAND_BIT_WRITE) |
//(1<<RMAP_COMMAND_BIT_REPLY) | (1<<RMAP_COMMAND_BIT_VERIFY)) #define RMAP_REPLY_READ
//((1<<RMAP_COMMAND_BIT_REPLY))
@ -49,9 +49,9 @@ static const uint8_t RMAP_COMMAND_HEADER_LEN = 16;
static const uint8_t RMAP_WRITE_REPLY_HEADER_LEN = 8;
static const uint8_t RMAP_READ_REPLY_HEADER_LEN = 12;
static const uint8_t RMAP_DATA_FOOTER_SIZE = 1; // SIZE OF CRC
//#define RMAP_COMMAND_HEADER_LEN 16
//#define RMAP_WRITE_REPLY_HEADER_LEN 8
//#define RMAP_READ_REPLY_HEADER_LEN 12
// #define RMAP_COMMAND_HEADER_LEN 16
// #define RMAP_WRITE_REPLY_HEADER_LEN 8
// #define RMAP_READ_REPLY_HEADER_LEN 12
} // namespace RMAPIds

View File

@ -14,10 +14,9 @@
#include <ctime>
#endif
class Clock {
public:
// https://xkcd.com/927/
// https://xkcd.com/927/
typedef struct {
uint32_t year; //!< Year, A.D.
uint32_t month; //!< Month, 1 .. 12.

View File

@ -1,5 +1,5 @@
#include <ctime>
#include <cstdlib>
#include <ctime>
#include "fsfw/ipc/MutexGuard.h"
#include "fsfw/timemanager/Clock.h"
@ -110,7 +110,7 @@ ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval*
to->tv_sec = seconds;
to->tv_usec = from->usecond;
if (seconds == (time_t) -1) {
if (seconds == (time_t)-1) {
return returnvalue::FAILED;
}

View File

@ -38,6 +38,4 @@ uint32_t Countdown::getRemainingMillis() const {
}
}
uint32_t Countdown::getCurrentTime() const {
return Clock::getUptime_ms();
}
uint32_t Countdown::getCurrentTime() const { return Clock::getUptime_ms(); }

View File

@ -1,17 +1,17 @@
#ifndef FSFW_TIMEMANAGER_TIMEREADERIF_H
#define FSFW_TIMEMANAGER_TIMEREADERIF_H
#include <cstdio>
#include <cstdlib>
#include <sys/time.h>
#include <cstdio>
#include <cstdlib>
#include "fsfw/platform.h"
#ifdef PLATFORM_WIN
// wtf? Required for timeval!
#include <winsock2.h>
#include <winsock.h>
#include <winsock2.h>
#endif
#include "TimeStampIF.h"

View File

@ -15,7 +15,8 @@ class HostFilesystem : public HasFileSystemIF {
ReturnValue_t readFromFile(FileOpParams fileOpInfo, uint8_t **buffer, size_t &readSize,
size_t maxSize) override;
ReturnValue_t createFile(FilesystemParams params, const uint8_t *data, size_t size) override;
ReturnValue_t removeFile(const std::filesystem::path::value_type *path, FileSystemArgsIF *args) override;
ReturnValue_t removeFile(const std::filesystem::path::value_type *path,
FileSystemArgsIF *args) override;
ReturnValue_t createDirectory(FilesystemParams params, bool createParentDirs) override;
ReturnValue_t removeDirectory(FilesystemParams params, bool deleteRecurively) override;
ReturnValue_t rename(const std::filesystem::path::value_type *oldPath,