v1.14.0 #304

Merged
muellerr merged 366 commits from develop into main 2022-10-10 17:46:38 +02:00
7 changed files with 36 additions and 31 deletions
Showing only changes of commit 05adc91f94 - Show all commits

View File

@ -23,6 +23,7 @@
#include "bsp_q7s/fs/SdCardManager.h"
#include "bsp_q7s/memory/scratchApi.h"
#include "bsp_q7s/xadc/Xadc.h"
#include "eive/definitions.h"
#include "linux/utility/utility.h"
xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
@ -357,9 +358,9 @@ ReturnValue_t CoreController::sdStateMachine() {
#if OBSW_VERBOSE_LEVEL >= 1
std::string mountString;
if (sdInfo.pref == sd::SdCard::SLOT_0) {
mountString = SdCardManager::SD_0_MOUNT_POINT;
mountString = config::SD_0_MOUNT_POINT;
} else {
mountString = SdCardManager::SD_1_MOUNT_POINT;
mountString = config::SD_1_MOUNT_POINT;
}
sif::info << "SD card " << sdInfo.prefChar << " already on and mounted at " << mountString
<< std::endl;
@ -579,9 +580,9 @@ ReturnValue_t CoreController::sdCardSetup(sd::SdCard sdCard, sd::SdState targetS
std::string mountString;
sdcMan->setPrintCommandOutput(printOutput);
if (sdCard == sd::SdCard::SLOT_0) {
mountString = SdCardManager::SD_0_MOUNT_POINT;
mountString = config::SD_0_MOUNT_POINT;
} else {
mountString = SdCardManager::SD_1_MOUNT_POINT;
mountString = config::SD_1_MOUNT_POINT;
}
sd::SdState state = sd::SdState::OFF;
@ -1262,11 +1263,11 @@ void CoreController::performMountedSdCardOperations() {
}
};
if (sdInfo.pref == sd::SdCard::SLOT_1) {
mountedSdCardOp(sdInfo.mountSwitch.second, sd::SdCard::SLOT_1, SdCardManager::SD_1_MOUNT_POINT);
mountedSdCardOp(sdInfo.mountSwitch.first, sd::SdCard::SLOT_0, SdCardManager::SD_0_MOUNT_POINT);
mountedSdCardOp(sdInfo.mountSwitch.second, sd::SdCard::SLOT_1, config::SD_1_MOUNT_POINT);
mountedSdCardOp(sdInfo.mountSwitch.first, sd::SdCard::SLOT_0, config::SD_0_MOUNT_POINT);
} else {
mountedSdCardOp(sdInfo.mountSwitch.first, sd::SdCard::SLOT_0, SdCardManager::SD_0_MOUNT_POINT);
mountedSdCardOp(sdInfo.mountSwitch.second, sd::SdCard::SLOT_1, SdCardManager::SD_1_MOUNT_POINT);
mountedSdCardOp(sdInfo.mountSwitch.first, sd::SdCard::SLOT_0, config::SD_0_MOUNT_POINT);
mountedSdCardOp(sdInfo.mountSwitch.second, sd::SdCard::SLOT_1, config::SD_1_MOUNT_POINT);
}
timeFileHandler();
}

View File

@ -54,8 +54,6 @@ class CoreController : public ExtendedControllerBase {
static constexpr char CONF_FOLDER[] = "conf";
static constexpr char OBSW_UPDATE_ARCHIVE_FILE_NAME[] = "eive-sw-update.tar.xz";
static constexpr char STRIPPED_OBSW_BINARY_FILE_NAME[] = "eive-obsw-stripped";
static constexpr char OBSW_VERSION_FILE_NAME[] = "obsw_version.txt";
static constexpr char VERSION_FILE_NAME[] = "version.txt";
static constexpr char REBOOT_FILE_NAME[] = "reboot.txt";

View File

@ -4,6 +4,7 @@
#include <fstream>
#include "SdCardManager.h"
#include "eive/definitions.h"
#include "fsfw/serviceinterface.h"
FilesystemHelper::FilesystemHelper() {}
@ -14,14 +15,13 @@ ReturnValue_t FilesystemHelper::checkPath(std::string path) {
sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl;
return returnvalue::FAILED;
}
if (path.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT)) ==
std::string(SdCardManager::SD_0_MOUNT_POINT)) {
if (path.substr(0, sizeof(config::SD_0_MOUNT_POINT)) == std::string(config::SD_0_MOUNT_POINT)) {
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
sif::warning << "FilesystemHelper::checkPath: SD card 0 not mounted" << std::endl;
return SD_NOT_MOUNTED;
}
} else if (path.substr(0, sizeof(SdCardManager::SD_1_MOUNT_POINT)) ==
std::string(SdCardManager::SD_1_MOUNT_POINT)) {
} else if (path.substr(0, sizeof(config::SD_1_MOUNT_POINT)) ==
std::string(config::SD_1_MOUNT_POINT)) {
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
sif::warning << "FilesystemHelper::checkPath: SD card 1 not mounted" << std::endl;
return SD_NOT_MOUNTED;

View File

@ -11,6 +11,7 @@
#include "OBSWConfig.h"
#include "bsp_q7s/memory/scratchApi.h"
#include "eive/definitions.h"
#include "eive/objects.h"
#include "fsfw/ipc/MutexFactory.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
@ -229,10 +230,10 @@ ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
string mountPoint;
if (sdCard == sd::SdCard::SLOT_0) {
mountDev = SD_0_DEV_NAME;
mountPoint = SD_0_MOUNT_POINT;
mountPoint = config::SD_0_MOUNT_POINT;
} else if (sdCard == sd::SdCard::SLOT_1) {
mountDev = SD_1_DEV_NAME;
mountPoint = SD_1_MOUNT_POINT;
mountPoint = config::SD_1_MOUNT_POINT;
}
if (not filesystem::exists(mountDev)) {
sif::warning << "SdCardManager::mountSdCard: Device file does not exists. Make sure to"
@ -265,9 +266,9 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
}
string mountPoint;
if (sdCard == sd::SdCard::SLOT_0) {
mountPoint = SD_0_MOUNT_POINT;
mountPoint = config::SD_0_MOUNT_POINT;
} else if (sdCard == sd::SdCard::SLOT_1) {
mountPoint = SD_1_MOUNT_POINT;
mountPoint = config::SD_1_MOUNT_POINT;
}
if (not filesystem::exists(mountPoint)) {
sif::error << "SdCardManager::unmountSdCard: Default mount point " << mountPoint
@ -415,9 +416,9 @@ ReturnValue_t SdCardManager::updateSdCardStateFile() {
std::string SdCardManager::getCurrentMountPrefix() const {
MutexGuard mg(mutex);
if (sdInfo.active == sd::SdCard::SLOT_0) {
return SD_0_MOUNT_POINT;
return config::SD_0_MOUNT_POINT;
} else {
return SD_1_MOUNT_POINT;
return config::SD_1_MOUNT_POINT;
}
}
@ -494,9 +495,9 @@ bool SdCardManager::isSdCardMounted(sd::SdCard sdCard) {
ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& readOnly) {
std::ostringstream command;
if (sdcard == sd::SdCard::SLOT_0) {
command << "grep -q '" << SD_0_MOUNT_POINT << " vfat ro,' /proc/mounts";
command << "grep -q '" << config::SD_0_MOUNT_POINT << " vfat ro,' /proc/mounts";
} else {
command << "grep -q '" << SD_1_MOUNT_POINT << " vfat ro,' /proc/mounts";
command << "grep -q '" << config::SD_1_MOUNT_POINT << " vfat ro,' /proc/mounts";
}
ReturnValue_t result = cmdExecutor.load(command.str(), true, false);
if (result != returnvalue::OK) {
@ -523,9 +524,9 @@ ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& re
ReturnValue_t SdCardManager::remountReadWrite(sd::SdCard sdcard) {
std::ostringstream command;
if (sdcard == sd::SdCard::SLOT_0) {
command << "mount -o remount,rw " << SD_0_DEV_NAME << " " << SD_0_MOUNT_POINT;
command << "mount -o remount,rw " << SD_0_DEV_NAME << " " << config::SD_0_MOUNT_POINT;
} else {
command << "mount -o remount,rw " << SD_1_DEV_NAME << " " << SD_1_MOUNT_POINT;
command << "mount -o remount,rw " << SD_1_DEV_NAME << " " << config::SD_1_MOUNT_POINT;
}
ReturnValue_t result = cmdExecutor.load(command.str(), true, false);
if (result != returnvalue::OK) {

View File

@ -64,8 +64,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
// C++17 does not support constexpr std::string yet
static constexpr char SD_0_DEV_NAME[] = "/dev/mmcblk0p1";
static constexpr char SD_1_DEV_NAME[] = "/dev/mmcblk1p1";
static constexpr char SD_0_MOUNT_POINT[] = "/mnt/sd0";
static constexpr char SD_1_MOUNT_POINT[] = "/mnt/sd1";
static constexpr char SD_STATE_FILE[] = "/tmp/sd_status.txt";
virtual ~SdCardManager();

View File

@ -5,6 +5,12 @@
namespace config {
static constexpr char SD_0_MOUNT_POINT[] = "/mnt/sd0";
static constexpr char SD_1_MOUNT_POINT[] = "/mnt/sd1";
static constexpr char OBSW_UPDATE_ARCHIVE_FILE_NAME[] = "eive-sw-update.tar.xz";
static constexpr char STRIPPED_OBSW_BINARY_FILE_NAME[] = "eive-obsw-stripped";
static constexpr uint16_t EIVE_PUS_APID = 0x65;
static constexpr uint16_t EIVE_CFDP_APID = 0x66;
static constexpr uint16_t EIVE_LOCAL_CFDP_ENTITY_ID = EIVE_CFDP_APID;

View File

@ -4,6 +4,7 @@
#include <fstream>
#include "OBSWConfig.h"
#include "eive/definitions.h"
#include "fsfw/timemanager/Countdown.h"
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
#include "mission/utility/Filenaming.h"
@ -541,14 +542,13 @@ ReturnValue_t StrHelper::checkReplyPosition(uint32_t expectedPosition) {
#ifdef XIPHOS_Q7S
ReturnValue_t StrHelper::checkPath(std::string name) {
if (name.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT)) ==
std::string(SdCardManager::SD_0_MOUNT_POINT)) {
if (name.substr(0, sizeof(config::SD_0_MOUNT_POINT)) == std::string(config::SD_0_MOUNT_POINT)) {
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
sif::warning << "StrHelper::checkPath: SD card 0 not mounted" << std::endl;
return SD_NOT_MOUNTED;
}
} else if (name.substr(0, sizeof(SdCardManager::SD_1_MOUNT_POINT)) ==
std::string(SdCardManager::SD_1_MOUNT_POINT)) {
} else if (name.substr(0, sizeof(config::SD_1_MOUNT_POINT)) ==
std::string(config::SD_1_MOUNT_POINT)) {
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
sif::warning << "StrHelper::checkPath: SD card 1 not mounted" << std::endl;
return SD_NOT_MOUNTED;