format
This commit is contained in:
parent
941bf61f28
commit
e37af4fe70
@ -1,8 +1,8 @@
|
|||||||
#ifndef FSFW_MEMORY_HASFILESYSTEMIF_H_
|
#ifndef FSFW_MEMORY_HASFILESYSTEMIF_H_
|
||||||
#define FSFW_MEMORY_HASFILESYSTEMIF_H_
|
#define FSFW_MEMORY_HASFILESYSTEMIF_H_
|
||||||
|
|
||||||
#include <filesystem>
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
#include "FileSystemArgsIF.h"
|
#include "FileSystemArgsIF.h"
|
||||||
#include "fsfw/ipc/MessageQueueIF.h"
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <winsock2.h>
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <winsock2.h>
|
||||||
#if REG_DWORD == REG_DWORD_LITTLE_ENDIAN
|
#if REG_DWORD == REG_DWORD_LITTLE_ENDIAN
|
||||||
#define BYTE_ORDER_SYSTEM LITTLE_ENDIAN
|
#define BYTE_ORDER_SYSTEM LITTLE_ENDIAN
|
||||||
#else
|
#else
|
||||||
|
@ -40,6 +40,3 @@ timeval Clock::getUptime() {
|
|||||||
// timeval uptime = getUptime();
|
// timeval uptime = getUptime();
|
||||||
// return uptime.tv_sec;
|
// return uptime.tv_sec;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,4 +78,3 @@ timeval Clock::getUptime() {
|
|||||||
#endif
|
#endif
|
||||||
return timeval;
|
return timeval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#if defined(PLATFORM_WIN)
|
#if defined(PLATFORM_WIN)
|
||||||
|
|
||||||
|
|
||||||
#include "fsfw/osal/windows/winTaskHelpers.h"
|
#include "fsfw/osal/windows/winTaskHelpers.h"
|
||||||
#elif defined(PLATFORM_UNIX)
|
#elif defined(PLATFORM_UNIX)
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#include <fsfw/returnvalues/returnvalue.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
|
|
||||||
#include <thread>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
namespace tasks {
|
namespace tasks {
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "fsfw/ipc/MutexGuard.h"
|
#include "fsfw/ipc/MutexGuard.h"
|
||||||
#include "fsfw/osal/rtems/RtemsBasic.h"
|
#include "fsfw/osal/rtems/RtemsBasic.h"
|
||||||
|
|
||||||
|
|
||||||
ReturnValue_t Clock::setClock(const timeval* time) {
|
ReturnValue_t Clock::setClock(const timeval* time) {
|
||||||
TimeOfDay_t time_tod;
|
TimeOfDay_t time_tod;
|
||||||
ReturnValue_t result = convertTimevalToTimeOfDay(time, &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.hour = time_tod.hour;
|
||||||
timeRtems.minute = time_tod.minute;
|
timeRtems.minute = time_tod.minute;
|
||||||
timeRtems.second = time_tod.second;
|
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);
|
rtems_status_code status = rtems_clock_set(&timeRtems);
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case RTEMS_SUCCESSFUL:
|
case RTEMS_SUCCESSFUL:
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <processthreadsapi.h>
|
#include <processthreadsapi.h>
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
namespace tasks {
|
namespace tasks {
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
class Clock {
|
class Clock {
|
||||||
public:
|
public:
|
||||||
// https://xkcd.com/927/
|
// https://xkcd.com/927/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <ctime>
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
#include "fsfw/ipc/MutexGuard.h"
|
#include "fsfw/ipc/MutexGuard.h"
|
||||||
#include "fsfw/timemanager/Clock.h"
|
#include "fsfw/timemanager/Clock.h"
|
||||||
|
@ -38,6 +38,4 @@ uint32_t Countdown::getRemainingMillis() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Countdown::getCurrentTime() const {
|
uint32_t Countdown::getCurrentTime() const { return Clock::getUptime_ms(); }
|
||||||
return Clock::getUptime_ms();
|
|
||||||
}
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#ifndef FSFW_TIMEMANAGER_TIMEREADERIF_H
|
#ifndef FSFW_TIMEMANAGER_TIMEREADERIF_H
|
||||||
#define FSFW_TIMEMANAGER_TIMEREADERIF_H
|
#define FSFW_TIMEMANAGER_TIMEREADERIF_H
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN
|
#ifdef PLATFORM_WIN
|
||||||
// wtf? Required for timeval!
|
// wtf? Required for timeval!
|
||||||
#include <winsock2.h>
|
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
|
#include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "TimeStampIF.h"
|
#include "TimeStampIF.h"
|
||||||
|
@ -15,7 +15,8 @@ class HostFilesystem : public HasFileSystemIF {
|
|||||||
ReturnValue_t readFromFile(FileOpParams fileOpInfo, uint8_t **buffer, size_t &readSize,
|
ReturnValue_t readFromFile(FileOpParams fileOpInfo, uint8_t **buffer, size_t &readSize,
|
||||||
size_t maxSize) override;
|
size_t maxSize) override;
|
||||||
ReturnValue_t createFile(FilesystemParams params, const uint8_t *data, size_t size) 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 createDirectory(FilesystemParams params, bool createParentDirs) override;
|
||||||
ReturnValue_t removeDirectory(FilesystemParams params, bool deleteRecurively) override;
|
ReturnValue_t removeDirectory(FilesystemParams params, bool deleteRecurively) override;
|
||||||
ReturnValue_t rename(const std::filesystem::path::value_type *oldPath,
|
ReturnValue_t rename(const std::filesystem::path::value_type *oldPath,
|
||||||
|
@ -20,9 +20,9 @@ add_subdirectory(globalfunctions)
|
|||||||
add_subdirectory(timemanager)
|
add_subdirectory(timemanager)
|
||||||
add_subdirectory(tmtcpacket)
|
add_subdirectory(tmtcpacket)
|
||||||
add_subdirectory(cfdp)
|
add_subdirectory(cfdp)
|
||||||
IF(NOT FSFW_OSAL MATCHES "rtems")
|
if(NOT FSFW_OSAL MATCHES "rtems")
|
||||||
add_subdirectory(hal)
|
add_subdirectory(hal)
|
||||||
ENDIF()
|
endif()
|
||||||
add_subdirectory(internalerror)
|
add_subdirectory(internalerror)
|
||||||
add_subdirectory(devicehandler)
|
add_subdirectory(devicehandler)
|
||||||
add_subdirectory(tmtcservices)
|
add_subdirectory(tmtcservices)
|
||||||
|
@ -57,8 +57,7 @@ void exit_qemu_failing(int error) {
|
|||||||
|
|
||||||
/* Exit status code. Host QEMU process exits with that status. */
|
/* Exit status code. Host QEMU process exits with that status. */
|
||||||
asm("mov x0, %[error]\n\t" : : [error] "r"(error));
|
asm("mov x0, %[error]\n\t" : : [error] "r"(error));
|
||||||
asm(
|
asm("str x0, [sp,#8]\n\t"
|
||||||
"str x0, [sp,#8]\n\t"
|
|
||||||
|
|
||||||
/* x1 contains the address of parameter block.
|
/* x1 contains the address of parameter block.
|
||||||
* Any memory address could be used. */
|
* Any memory address could be used. */
|
||||||
@ -68,8 +67,7 @@ void exit_qemu_failing(int error) {
|
|||||||
"mov w0, #0x18\n\t"
|
"mov w0, #0x18\n\t"
|
||||||
|
|
||||||
/* Do the semihosting call on A64. */
|
/* Do the semihosting call on A64. */
|
||||||
"hlt 0xf000\n\t"
|
"hlt 0xf000\n\t");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <rtemsConfig.h>
|
#include <rtemsConfig.h>
|
||||||
|
@ -157,8 +157,8 @@ TEST_CASE("DataSetTest", "[DataSetTest]") {
|
|||||||
CHECK(maxSize == sizeof(uint8_t) + sizeof(uint16_t) * 3 + sizeof(float) + 1);
|
CHECK(maxSize == sizeof(uint8_t) + sizeof(uint16_t) * 3 + sizeof(float) + 1);
|
||||||
serSize = 0;
|
serSize = 0;
|
||||||
buffPtr = buffer.data();
|
buffPtr = buffer.data();
|
||||||
CHECK(localSet.serialize(&buffPtr, &serSize, buffer.size(), SerializeIF::Endianness::MACHINE) ==
|
CHECK(localSet.serialize(&buffPtr, &serSize, buffer.size(),
|
||||||
returnvalue::OK);
|
SerializeIF::Endianness::MACHINE) == returnvalue::OK);
|
||||||
CHECK(rawUint8 == 232);
|
CHECK(rawUint8 == 232);
|
||||||
std::memcpy(&rawFloat, buffer.data() + sizeof(uint8_t), sizeof(float));
|
std::memcpy(&rawFloat, buffer.data() + sizeof(uint8_t), sizeof(float));
|
||||||
CHECK(rawFloat == Catch::Approx(-2324.322));
|
CHECK(rawFloat == Catch::Approx(-2324.322));
|
||||||
@ -205,8 +205,8 @@ TEST_CASE("DataSetTest", "[DataSetTest]") {
|
|||||||
/* Common fault test cases */
|
/* Common fault test cases */
|
||||||
// LocalPoolObjectBase* variableHandle = poolOwner.getPoolObjectHandle(lpool::uint32VarId);
|
// LocalPoolObjectBase* variableHandle = poolOwner.getPoolObjectHandle(lpool::uint32VarId);
|
||||||
// CHECK(variableHandle != nullptr);
|
// CHECK(variableHandle != nullptr);
|
||||||
//CHECK(localSet.registerVariable(variableHandle) == static_cast<int>(DataSetIF::DATA_SET_FULL));
|
// CHECK(localSet.registerVariable(variableHandle) ==
|
||||||
//variableHandle = nullptr;
|
// static_cast<int>(DataSetIF::DATA_SET_FULL)); variableHandle = nullptr;
|
||||||
// REQUIRE(localSet.registerVariable(variableHandle) ==
|
// REQUIRE(localSet.registerVariable(variableHandle) ==
|
||||||
// static_cast<int>(DataSetIF::POOL_VAR_NULL));
|
// static_cast<int>(DataSetIF::POOL_VAR_NULL));
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include <etl/crc32.h>
|
#include <etl/crc32.h>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include "fsfw/serialize/SerializeIF.h"
|
#include "fsfw/serialize/SerializeIF.h"
|
||||||
#include "fsfw_hal/host/HostFilesystem.h"
|
#include "fsfw_hal/host/HostFilesystem.h"
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
#include "fsfw/serialize/SerializeIF.h"
|
#include "fsfw/serialize/SerializeIF.h"
|
||||||
|
|
||||||
ReturnValue_t FilesystemMock::feedFile(const std::string &filename, std::ifstream &file) {
|
ReturnValue_t FilesystemMock::feedFile(const std::string &filename, std::ifstream &file) {
|
||||||
|
|
||||||
// not multibyte encoding safe!
|
// not multibyte encoding safe!
|
||||||
std::basic_string<std::filesystem::path::value_type> native_filename(filename.begin(), filename.end());
|
std::basic_string<std::filesystem::path::value_type> native_filename(filename.begin(),
|
||||||
|
filename.end());
|
||||||
|
|
||||||
if (not std::filesystem::exists(native_filename)) {
|
if (not std::filesystem::exists(native_filename)) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
class FilesystemMock : public HasFileSystemIF {
|
class FilesystemMock : public HasFileSystemIF {
|
||||||
public:
|
public:
|
||||||
struct FileWriteInfo {
|
struct FileWriteInfo {
|
||||||
FileWriteInfo(std::basic_string<std::filesystem::path::value_type> filename, size_t offset, const uint8_t *data, size_t len)
|
FileWriteInfo(std::basic_string<std::filesystem::path::value_type> filename, size_t offset,
|
||||||
|
const uint8_t *data, size_t len)
|
||||||
: offset(offset) {
|
: offset(offset) {
|
||||||
this->filename = filename;
|
this->filename = filename;
|
||||||
this->data.insert(this->data.end(), data, data + len);
|
this->data.insert(this->data.end(), data, data + len);
|
||||||
@ -56,8 +57,7 @@ class FilesystemMock : public HasFileSystemIF {
|
|||||||
};
|
};
|
||||||
std::queue<RenameInfo> renameQueue;
|
std::queue<RenameInfo> renameQueue;
|
||||||
std::basic_string<std::filesystem::path::value_type> truncateCalledOnFile;
|
std::basic_string<std::filesystem::path::value_type> truncateCalledOnFile;
|
||||||
ReturnValue_t feedFile(const std::string &filename,
|
ReturnValue_t feedFile(const std::string &filename, std::ifstream &file);
|
||||||
std::ifstream &file);
|
|
||||||
|
|
||||||
bool fileExists(FilesystemParams params) override;
|
bool fileExists(FilesystemParams params) override;
|
||||||
ReturnValue_t truncateFile(FilesystemParams params) override;
|
ReturnValue_t truncateFile(FilesystemParams params) override;
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("Binary Semaphore Test", "[BinSemaphore]") {
|
TEST_CASE("Binary Semaphore Test", "[BinSemaphore]") {
|
||||||
// perform set-up here
|
// perform set-up here
|
||||||
SemaphoreIF* binSemaph = SemaphoreFactory::instance()->createBinarySemaphore();
|
SemaphoreIF* binSemaph = SemaphoreFactory::instance()->createBinarySemaphore();
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
#include <rtems/extension.h>
|
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
#include <rtems/extension.h>
|
||||||
void user_handle_fatal(Internal_errors_Source source, bool internal, Internal_errors_t error_code);
|
void user_handle_fatal(Internal_errors_Source source, bool internal, Internal_errors_t error_code);
|
||||||
|
|
||||||
#define RTEMS_USE_UNLIMITED_OBJECTS_ALLOCATION 0
|
#define RTEMS_USE_UNLIMITED_OBJECTS_ALLOCATION 0
|
||||||
@ -24,7 +23,8 @@ void user_handle_fatal(Internal_errors_Source source, bool internal, Internal_e
|
|||||||
//! Around 41 kB extra task stack for now.
|
//! Around 41 kB extra task stack for now.
|
||||||
#define CONFIGURE_EXTRA_TASK_STACKS (10 * RTEMS_MINIMUM_STACK_SIZE)
|
#define CONFIGURE_EXTRA_TASK_STACKS (10 * RTEMS_MINIMUM_STACK_SIZE)
|
||||||
|
|
||||||
#define CONFIGURE_INITIAL_EXTENSIONS { NULL, NULL, NULL, NULL, NULL, NULL, NULL, user_handle_fatal, NULL }
|
#define CONFIGURE_INITIAL_EXTENSIONS \
|
||||||
|
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, user_handle_fatal, NULL }
|
||||||
|
|
||||||
#define CONFIGURE_INIT
|
#define CONFIGURE_INIT
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user