WIP: PL PCDU #142
16
README.md
16
README.md
@ -442,12 +442,24 @@ Beagle Bone Black for download here
|
||||
Download it and unzip it somewhere in the Xilinx installation folder.
|
||||
You can use the following command if `wget` can be used or for CI/CD:
|
||||
|
||||
```
|
||||
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/agnJGYeRf6fw2ci/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz
|
||||
```sh
|
||||
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/SyXpdBBQX32xPgE/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz
|
||||
```
|
||||
|
||||
Then, create a new environmental variables `Q7S_SYSROOT` and set it to the local system root path.
|
||||
|
||||
### Updating system root for CI
|
||||
|
||||
If the system root is updated, it needs to be manually updated on the buggy file server.
|
||||
If access on `buggy.irs.uni-stuttgart.de` is possible with `ssh` and the rootfs in the cloud
|
||||
[was updated](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/rootfs&fileid=831849)
|
||||
as well, you can update the rootfs like this:
|
||||
|
||||
```sh
|
||||
cd /var/www/eive/tools
|
||||
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/SyXpdBBQX32xPgE/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz
|
||||
```
|
||||
|
||||
## Setting up UNIX environment for real-time functionalities
|
||||
|
||||
Please note that on most UNIX environments (e.g. Ubuntu), the real time functionalities
|
||||
|
@ -142,13 +142,13 @@ void Q7STestTask::testDummyParams() {
|
||||
param.print();
|
||||
|
||||
int test = 0;
|
||||
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, &test);
|
||||
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, test);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
||||
<< " does not exist" << std::endl;
|
||||
}
|
||||
std::string test2;
|
||||
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, &test2);
|
||||
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, test2);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
||||
<< " does not exist" << std::endl;
|
||||
@ -170,15 +170,15 @@ void Q7STestTask::testProtHandler() {
|
||||
bool opPerformed = false;
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
// If any chips are unlocked, lock them here
|
||||
result = coreController->setBootCopyProtection(
|
||||
CoreController::Chip::ALL_CHIP, CoreController::Copy::ALL_COPY, true, opPerformed, true);
|
||||
result = coreController->setBootCopyProtection(xsc::Chip::ALL_CHIP, xsc::Copy::ALL_COPY, true,
|
||||
opPerformed, true);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||
}
|
||||
|
||||
// unlock own copy
|
||||
result = coreController->setBootCopyProtection(
|
||||
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, false, opPerformed, true);
|
||||
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, false,
|
||||
opPerformed, true);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||
}
|
||||
@ -191,8 +191,8 @@ void Q7STestTask::testProtHandler() {
|
||||
}
|
||||
|
||||
// lock own copy
|
||||
result = coreController->setBootCopyProtection(
|
||||
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, true, opPerformed, true);
|
||||
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
||||
opPerformed, true);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||
}
|
||||
@ -205,8 +205,8 @@ void Q7STestTask::testProtHandler() {
|
||||
}
|
||||
|
||||
// unlock specific copy
|
||||
result = coreController->setBootCopyProtection(
|
||||
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, false, opPerformed, true);
|
||||
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, false,
|
||||
opPerformed, true);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||
}
|
||||
@ -219,8 +219,8 @@ void Q7STestTask::testProtHandler() {
|
||||
}
|
||||
|
||||
// lock specific copy
|
||||
result = coreController->setBootCopyProtection(
|
||||
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, true, opPerformed, true);
|
||||
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, true,
|
||||
opPerformed, true);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "CoreController.h"
|
||||
|
||||
#include <fsfw/events/EventManager.h>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "OBSWVersion.h"
|
||||
#include "fsfw/FSFWVersion.h"
|
||||
@ -20,8 +22,8 @@
|
||||
#include "bsp_q7s/memory/SdCardManager.h"
|
||||
#include "bsp_q7s/memory/scratchApi.h"
|
||||
|
||||
CoreController::Chip CoreController::CURRENT_CHIP = Chip::NO_CHIP;
|
||||
CoreController::Copy CoreController::CURRENT_COPY = Copy::NO_COPY;
|
||||
xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
|
||||
xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY;
|
||||
|
||||
CoreController::CoreController(object_id_t objectId)
|
||||
: ExtendedControllerBase(objectId, objects::NO_OBJECT, 5), opDivider(5) {
|
||||
@ -57,6 +59,7 @@ ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
|
||||
void CoreController::performControlOperation() {
|
||||
performWatchdogControlOperation();
|
||||
sdStateMachine();
|
||||
performRebootFileHandling(false);
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
@ -77,6 +80,8 @@ ReturnValue_t CoreController::initialize() {
|
||||
}
|
||||
|
||||
sdStateMachine();
|
||||
|
||||
triggerEvent(REBOOT_SW, CURRENT_CHIP, CURRENT_COPY);
|
||||
return ExtendedControllerBase::initialize();
|
||||
}
|
||||
|
||||
@ -102,6 +107,59 @@ ReturnValue_t CoreController::initializeAfterTaskCreation() {
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t *data, size_t size) {
|
||||
switch (actionId) {
|
||||
case (LIST_DIRECTORY_INTO_FILE): {
|
||||
return actionListDirectoryIntoFile(actionId, commandedBy, data, size);
|
||||
}
|
||||
case (SWITCH_REBOOT_FILE_HANDLING): {
|
||||
if (size < 1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE;
|
||||
// Disable the reboot file mechanism
|
||||
parseRebootFile(path, rebootFile);
|
||||
if (data[0] == 0) {
|
||||
rebootFile.enabled = false;
|
||||
rewriteRebootFile(rebootFile);
|
||||
} else if (data[0] == 1) {
|
||||
rebootFile.enabled = true;
|
||||
rewriteRebootFile(rebootFile);
|
||||
} else {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (RESET_ALL_REBOOT_COUNTERS): {
|
||||
resetRebootCount(xsc::ALL_CHIP, xsc::ALL_COPY);
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (RESET_REBOOT_COUNTER_00): {
|
||||
resetRebootCount(xsc::CHIP_0, xsc::COPY_0);
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (RESET_REBOOT_COUNTER_01): {
|
||||
resetRebootCount(xsc::CHIP_0, xsc::COPY_1);
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (RESET_REBOOT_COUNTER_10): {
|
||||
resetRebootCount(xsc::CHIP_1, xsc::COPY_0);
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (RESET_REBOOT_COUNTER_11): {
|
||||
resetRebootCount(xsc::CHIP_1, xsc::COPY_1);
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (REBOOT_OBC): {
|
||||
return actionPerformReboot(data, size);
|
||||
}
|
||||
default: {
|
||||
return HasActionsIF::INVALID_ACTION_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t *msToReachTheMode) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
@ -500,21 +558,6 @@ ReturnValue_t CoreController::sdCardSetup(sd::SdCard sdCard, sd::SdState targetS
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t *data, size_t size) {
|
||||
switch (actionId) {
|
||||
case (LIST_DIRECTORY_INTO_FILE): {
|
||||
return actionListDirectoryIntoFile(actionId, commandedBy, data, size);
|
||||
}
|
||||
case (REBOOT_OBC): {
|
||||
return actionPerformReboot(data, size);
|
||||
}
|
||||
default: {
|
||||
return HasActionsIF::INVALID_ACTION_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::sdColdRedundantBlockingInit() {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
|
||||
@ -689,7 +732,7 @@ ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
|
||||
|
||||
ReturnValue_t CoreController::initBootCopy() {
|
||||
if (not std::filesystem::exists(CURR_COPY_FILE)) {
|
||||
// Thils file is created by the systemd service eive-early-config so this should
|
||||
// This file is created by the systemd service eive-early-config so this should
|
||||
// not happen normally
|
||||
std::string cmd = "xsc_boot_copy > " + std::string(CURR_COPY_FILE);
|
||||
int result = std::system(cmd.c_str());
|
||||
@ -697,22 +740,18 @@ ReturnValue_t CoreController::initBootCopy() {
|
||||
utility::handleSystemError(result, "CoreController::initBootCopy");
|
||||
}
|
||||
}
|
||||
std::ifstream file(CURR_COPY_FILE);
|
||||
std::string line;
|
||||
std::getline(file, line);
|
||||
std::istringstream iss(line);
|
||||
int value = 0;
|
||||
iss >> value;
|
||||
CURRENT_CHIP = static_cast<Chip>(value);
|
||||
iss >> value;
|
||||
CURRENT_COPY = static_cast<Copy>(value);
|
||||
|
||||
getCurrentBootCopy(CURRENT_CHIP, CURRENT_COPY);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void CoreController::getCurrentBootCopy(Chip &chip, Copy ©) {
|
||||
void CoreController::getCurrentBootCopy(xsc::Chip &chip, xsc::Copy ©) {
|
||||
xsc_libnor_chip_t xscChip;
|
||||
xsc_libnor_copy_t xscCopy;
|
||||
xsc_boot_get_chip_copy(&xscChip, &xscCopy);
|
||||
// Not really thread-safe but it does not need to be
|
||||
chip = CURRENT_CHIP;
|
||||
copy = CURRENT_COPY;
|
||||
chip = static_cast<xsc::Chip>(xscChip);
|
||||
copy = static_cast<xsc::Copy>(xscCopy);
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::initWatchdogFifo() {
|
||||
@ -759,8 +798,8 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
|
||||
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_0);
|
||||
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_1);
|
||||
// If any boot copies are unprotected
|
||||
ReturnValue_t retval =
|
||||
setBootCopyProtection(Chip::SELF_CHIP, Copy::SELF_COPY, true, protOpPerformed, false);
|
||||
ReturnValue_t retval = setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
||||
protOpPerformed, false);
|
||||
if (retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
||||
sif::info << "Running slot was writeprotected before reboot" << std::endl;
|
||||
}
|
||||
@ -771,7 +810,7 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
|
||||
}
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
if (size < 3) {
|
||||
if (size < 3 or (data[1] > 1 or data[2] > 1)) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
@ -782,21 +821,53 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
|
||||
// Check that the target chip and copy is writeprotected first
|
||||
generateChipStateFile();
|
||||
// If any boot copies are unprotected, protect them here
|
||||
ReturnValue_t retval = setBootCopyProtection(
|
||||
static_cast<Chip>(data[1]), static_cast<Copy>(data[2]), true, protOpPerformed, false);
|
||||
auto tgtChip = static_cast<xsc::Chip>(data[1]);
|
||||
auto tgtCopy = static_cast<xsc::Copy>(data[2]);
|
||||
|
||||
ReturnValue_t retval =
|
||||
setBootCopyProtection(static_cast<xsc::Chip>(data[1]), static_cast<xsc::Copy>(data[2]), true,
|
||||
protOpPerformed, false);
|
||||
if (retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
||||
sif::info << "Target slot was writeprotected before reboot" << std::endl;
|
||||
}
|
||||
|
||||
// The second byte in data is the target chip, the third byte is the target copy
|
||||
std::string cmdString =
|
||||
"xsc_boot_copy " + std::to_string(data[1]) + " " + std::to_string(data[2]);
|
||||
int result = std::system(cmdString.c_str());
|
||||
if (result != 0) {
|
||||
utility::handleSystemError(result, "CoreController::executeAction");
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
switch (tgtChip) {
|
||||
case (xsc::Chip::CHIP_0): {
|
||||
switch (tgtCopy) {
|
||||
case (xsc::Copy::COPY_0): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_NOMINAL);
|
||||
break;
|
||||
}
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
case (xsc::Copy::COPY_1): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_GOLD);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (xsc::Chip::CHIP_1): {
|
||||
switch (tgtCopy) {
|
||||
case (xsc::Copy::COPY_0): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_NOMINAL);
|
||||
break;
|
||||
}
|
||||
case (xsc::Copy::COPY_1): {
|
||||
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_GOLD);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
CoreController::~CoreController() {}
|
||||
@ -850,8 +921,8 @@ ReturnValue_t CoreController::generateChipStateFile() {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::setBootCopyProtection(Chip targetChip, Copy targetCopy, bool protect,
|
||||
bool &protOperationPerformed,
|
||||
ReturnValue_t CoreController::setBootCopyProtection(xsc::Chip targetChip, xsc::Copy targetCopy,
|
||||
bool protect, bool &protOperationPerformed,
|
||||
bool updateProtFile) {
|
||||
bool allChips = false;
|
||||
bool allCopies = false;
|
||||
@ -860,14 +931,14 @@ ReturnValue_t CoreController::setBootCopyProtection(Chip targetChip, Copy target
|
||||
protOperationPerformed = false;
|
||||
|
||||
switch (targetChip) {
|
||||
case (Chip::ALL_CHIP): {
|
||||
case (xsc::Chip::ALL_CHIP): {
|
||||
allChips = true;
|
||||
break;
|
||||
}
|
||||
case (Chip::NO_CHIP): {
|
||||
case (xsc::Chip::NO_CHIP): {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
case (Chip::SELF_CHIP): {
|
||||
case (xsc::Chip::SELF_CHIP): {
|
||||
selfChip = true;
|
||||
targetChip = CURRENT_CHIP;
|
||||
break;
|
||||
@ -877,14 +948,14 @@ ReturnValue_t CoreController::setBootCopyProtection(Chip targetChip, Copy target
|
||||
}
|
||||
}
|
||||
switch (targetCopy) {
|
||||
case (Copy::ALL_COPY): {
|
||||
case (xsc::Copy::ALL_COPY): {
|
||||
allCopies = true;
|
||||
break;
|
||||
}
|
||||
case (Copy::NO_COPY): {
|
||||
case (xsc::Copy::NO_COPY): {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
case (Copy::SELF_COPY): {
|
||||
case (xsc::Copy::SELF_COPY): {
|
||||
selfCopy = true;
|
||||
targetCopy = CURRENT_COPY;
|
||||
break;
|
||||
@ -907,10 +978,10 @@ ReturnValue_t CoreController::setBootCopyProtection(Chip targetChip, Copy target
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
int CoreController::handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
|
||||
bool &protOperationPerformed, bool selfChip,
|
||||
bool selfCopy, bool allChips, bool allCopies,
|
||||
uint8_t arrIdx) {
|
||||
int CoreController::handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy targetCopy,
|
||||
bool protect, bool &protOperationPerformed,
|
||||
bool selfChip, bool selfCopy, bool allChips,
|
||||
bool allCopies, uint8_t arrIdx) {
|
||||
bool currentProt = protArray[arrIdx];
|
||||
std::ostringstream oss;
|
||||
bool performOp = false;
|
||||
@ -923,22 +994,22 @@ int CoreController::handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy,
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Chip currentChip;
|
||||
Copy currentCopy;
|
||||
xsc::Chip currentChip;
|
||||
xsc::Copy currentCopy;
|
||||
oss << "writeprotect ";
|
||||
if (arrIdx == 0 or arrIdx == 1) {
|
||||
oss << "0 ";
|
||||
currentChip = Chip::CHIP_0;
|
||||
currentChip = xsc::Chip::CHIP_0;
|
||||
} else {
|
||||
oss << "1 ";
|
||||
currentChip = Chip::CHIP_1;
|
||||
currentChip = xsc::Chip::CHIP_1;
|
||||
}
|
||||
if (arrIdx == 0 or arrIdx == 2) {
|
||||
oss << "0 ";
|
||||
currentCopy = Copy::COPY_0;
|
||||
currentCopy = xsc::Copy::COPY_0;
|
||||
} else {
|
||||
oss << "1 ";
|
||||
currentCopy = Copy::COPY_1;
|
||||
currentCopy = xsc::Copy::COPY_1;
|
||||
}
|
||||
if (protect) {
|
||||
oss << "1";
|
||||
@ -1033,29 +1104,29 @@ ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
|
||||
uint8_t wordIdx = 0;
|
||||
uint8_t arrayIdx = 0;
|
||||
istringstream iss(nextLine);
|
||||
Chip currentChip = Chip::CHIP_0;
|
||||
Copy currentCopy = Copy::COPY_0;
|
||||
xsc::Chip currentChip = xsc::Chip::CHIP_0;
|
||||
xsc::Copy currentCopy = xsc::Copy::COPY_0;
|
||||
while (iss >> word) {
|
||||
if (wordIdx == 1) {
|
||||
currentChip = static_cast<Chip>(stoi(word));
|
||||
currentChip = static_cast<xsc::Chip>(stoi(word));
|
||||
}
|
||||
if (wordIdx == 3) {
|
||||
currentCopy = static_cast<Copy>(stoi(word));
|
||||
currentCopy = static_cast<xsc::Copy>(stoi(word));
|
||||
}
|
||||
|
||||
if (wordIdx == 3) {
|
||||
if (currentChip == Chip::CHIP_0) {
|
||||
if (currentCopy == Copy::COPY_0) {
|
||||
if (currentChip == xsc::Chip::CHIP_0) {
|
||||
if (currentCopy == xsc::Copy::COPY_0) {
|
||||
arrayIdx = 0;
|
||||
} else if (currentCopy == Copy::COPY_1) {
|
||||
} else if (currentCopy == xsc::Copy::COPY_1) {
|
||||
arrayIdx = 1;
|
||||
}
|
||||
}
|
||||
|
||||
else if (currentChip == Chip::CHIP_1) {
|
||||
if (currentCopy == Copy::COPY_0) {
|
||||
else if (currentChip == xsc::Chip::CHIP_1) {
|
||||
if (currentCopy == xsc::Copy::COPY_0) {
|
||||
arrayIdx = 2;
|
||||
} else if (currentCopy == Copy::COPY_1) {
|
||||
} else if (currentCopy == xsc::Copy::COPY_1) {
|
||||
arrayIdx = 3;
|
||||
}
|
||||
}
|
||||
@ -1101,3 +1172,363 @@ void CoreController::performWatchdogControlOperation() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CoreController::performRebootFileHandling(bool recreateFile) {
|
||||
bool sdCardMounted = false;
|
||||
if (not recreateFile and doPerformRebootFileHandling) {
|
||||
sdCardMounted = sdcMan->isSdCardMounted(sdInfo.pref);
|
||||
}
|
||||
if ((doPerformRebootFileHandling and sdCardMounted) or recreateFile) {
|
||||
using namespace std;
|
||||
if (recreateFile) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "CoreController::performRebootFileHandling: Recreating reboot file" << std::endl;
|
||||
#endif
|
||||
}
|
||||
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE;
|
||||
if (not std::filesystem::exists(path) or recreateFile) {
|
||||
rebootFile.enabled = true;
|
||||
rebootFile.img00Cnt = 0;
|
||||
rebootFile.img01Cnt = 0;
|
||||
rebootFile.img10Cnt = 0;
|
||||
rebootFile.img11Cnt = 0;
|
||||
rebootFile.lastChip = xsc::Chip::CHIP_0;
|
||||
rebootFile.lastCopy = xsc::Copy::COPY_0;
|
||||
rebootFile.bootFlag = false;
|
||||
rewriteRebootFile(rebootFile);
|
||||
} else {
|
||||
if (not parseRebootFile(path, rebootFile)) {
|
||||
performRebootFileHandling(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (rebootFile.bootFlag) {
|
||||
// Trigger event to inform ground that a reboot was triggered
|
||||
uint32_t p1 = rebootFile.lastChip << 16 | rebootFile.lastCopy;
|
||||
uint32_t p2 = rebootFile.img00Cnt << 24 | rebootFile.img01Cnt << 16 |
|
||||
rebootFile.img10Cnt << 8 | rebootFile.img11Cnt;
|
||||
triggerEvent(REBOOT_MECHANISM_TRIGGERED, p1, p2);
|
||||
// Clear the boot flag
|
||||
rebootFile.bootFlag = false;
|
||||
}
|
||||
|
||||
switch (CURRENT_CHIP) {
|
||||
case (xsc::CHIP_0): {
|
||||
switch (CURRENT_COPY) {
|
||||
case (xsc::COPY_0): {
|
||||
rebootFile.img00Cnt++;
|
||||
break;
|
||||
}
|
||||
case (xsc::COPY_1): {
|
||||
rebootFile.img01Cnt++;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (xsc::CHIP_1): {
|
||||
switch (CURRENT_COPY) {
|
||||
case (xsc::COPY_0): {
|
||||
rebootFile.img10Cnt++;
|
||||
break;
|
||||
}
|
||||
case (xsc::COPY_1): {
|
||||
rebootFile.img11Cnt++;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (CURRENT_CHIP == xsc::CHIP_0 and CURRENT_COPY == xsc::COPY_0) {
|
||||
}
|
||||
if (rebootFile.relevantBootCnt > rebootFile.maxCount) {
|
||||
// Reboot to other image
|
||||
bool doReboot = false;
|
||||
determineAndExecuteReboot(rebootFile, doReboot, rebootFile.lastChip, rebootFile.lastCopy);
|
||||
if (doReboot) {
|
||||
rebootFile.bootFlag = true;
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "Boot counter for image " << CURRENT_CHIP << " " << CURRENT_COPY
|
||||
<< "too high. Rebooting to " << rebootFile.lastChip << " " << rebootFile.lastCopy
|
||||
<< std::endl;
|
||||
#endif
|
||||
rewriteRebootFile(rebootFile);
|
||||
xsc_boot_copy(static_cast<xsc_libnor_chip_t>(rebootFile.lastChip),
|
||||
static_cast<xsc_libnor_copy_t>(rebootFile.lastCopy));
|
||||
}
|
||||
} else {
|
||||
rewriteRebootFile(rebootFile);
|
||||
}
|
||||
doPerformRebootFileHandling = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CoreController::determineAndExecuteReboot(RebootFile &rf, bool &needsReboot,
|
||||
xsc::Chip &tgtChip, xsc::Copy &tgtCopy) {
|
||||
tgtChip = xsc::CHIP_0;
|
||||
tgtCopy = xsc::COPY_0;
|
||||
needsReboot = false;
|
||||
if ((CURRENT_COPY == xsc::COPY_0) and (CURRENT_CHIP == xsc::CHIP_0) and
|
||||
(rf.img00Cnt >= rf.maxCount)) {
|
||||
needsReboot = true;
|
||||
if (rf.img01Cnt >= rf.maxCount) {
|
||||
if (rf.img10Cnt >= rf.maxCount) {
|
||||
if (rf.img11Cnt >= rf.maxCount) {
|
||||
// Can't really do much here. Stay on image
|
||||
sif::warning << "All reboot counts too high, but already on fallback image" << std::endl;
|
||||
return;
|
||||
} else {
|
||||
tgtChip = xsc::CHIP_1;
|
||||
tgtCopy = xsc::COPY_1;
|
||||
}
|
||||
} else {
|
||||
tgtChip = xsc::CHIP_0;
|
||||
tgtCopy = xsc::COPY_1;
|
||||
}
|
||||
} else {
|
||||
tgtCopy = xsc::COPY_1;
|
||||
}
|
||||
}
|
||||
if ((CURRENT_COPY == xsc::COPY_0) and (CURRENT_CHIP == xsc::CHIP_1) and
|
||||
(rf.img01Cnt >= rf.maxCount)) {
|
||||
needsReboot = true;
|
||||
if (rf.img00Cnt >= rf.maxCount) {
|
||||
if (rf.img10Cnt >= rf.maxCount) {
|
||||
if (rf.img11Cnt >= rf.maxCount) {
|
||||
// Reboot to fallback image
|
||||
} else {
|
||||
tgtChip = xsc::CHIP_1;
|
||||
tgtCopy = xsc::COPY_1;
|
||||
}
|
||||
} else {
|
||||
tgtChip = xsc::CHIP_1;
|
||||
tgtCopy = xsc::COPY_0;
|
||||
}
|
||||
} else {
|
||||
// Reboot on fallback image
|
||||
}
|
||||
}
|
||||
if ((CURRENT_COPY == xsc::COPY_1) and (CURRENT_CHIP == xsc::CHIP_0) and
|
||||
(rf.img10Cnt >= rf.maxCount)) {
|
||||
needsReboot = true;
|
||||
if (rf.img11Cnt >= rf.maxCount) {
|
||||
if (rf.img00Cnt >= rf.maxCount) {
|
||||
if (rf.img01Cnt >= rf.maxCount) {
|
||||
// Reboot to fallback image
|
||||
} else {
|
||||
tgtChip = xsc::CHIP_0;
|
||||
tgtCopy = xsc::COPY_1;
|
||||
}
|
||||
} else {
|
||||
tgtChip = xsc::CHIP_0;
|
||||
tgtCopy = xsc::COPY_0;
|
||||
}
|
||||
} else {
|
||||
tgtChip = xsc::CHIP_1;
|
||||
tgtCopy = xsc::COPY_1;
|
||||
}
|
||||
}
|
||||
if ((CURRENT_COPY == xsc::COPY_1) and (CURRENT_CHIP == xsc::CHIP_1) and
|
||||
(rf.img11Cnt >= rf.maxCount)) {
|
||||
needsReboot = true;
|
||||
if (rf.img10Cnt >= rf.maxCount) {
|
||||
if (rf.img00Cnt >= rf.maxCount) {
|
||||
if (rf.img01Cnt >= rf.maxCount) {
|
||||
// Reboot to fallback image
|
||||
} else {
|
||||
tgtChip = xsc::CHIP_0;
|
||||
tgtCopy = xsc::COPY_1;
|
||||
}
|
||||
} else {
|
||||
tgtChip = xsc::CHIP_0;
|
||||
tgtCopy = xsc::COPY_0;
|
||||
}
|
||||
} else {
|
||||
tgtChip = xsc::CHIP_1;
|
||||
tgtCopy = xsc::COPY_0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CoreController::parseRebootFile(std::string path, RebootFile &rf) {
|
||||
using namespace std;
|
||||
std::string selfMatch;
|
||||
if (CURRENT_CHIP == xsc::CHIP_0) {
|
||||
if (CURRENT_COPY == xsc::COPY_0) {
|
||||
selfMatch = "00";
|
||||
} else {
|
||||
selfMatch = "01";
|
||||
}
|
||||
} else {
|
||||
if (CURRENT_COPY == xsc::COPY_0) {
|
||||
selfMatch = "10";
|
||||
} else {
|
||||
selfMatch = "11";
|
||||
}
|
||||
}
|
||||
ifstream file(path);
|
||||
string word;
|
||||
string line;
|
||||
uint8_t lineIdx = 0;
|
||||
while (std::getline(file, line)) {
|
||||
istringstream iss(line);
|
||||
switch (lineIdx) {
|
||||
case 0: {
|
||||
iss >> word;
|
||||
if (word.find("on:") == string::npos) {
|
||||
// invalid file
|
||||
return false;
|
||||
}
|
||||
iss >> rf.enabled;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
iss >> word;
|
||||
if (word.find("maxcnt:") == string::npos) {
|
||||
return false;
|
||||
}
|
||||
iss >> rf.maxCount;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
iss >> word;
|
||||
if (word.find("img00:") == string::npos) {
|
||||
return false;
|
||||
}
|
||||
iss >> rf.img00Cnt;
|
||||
if (word.find(selfMatch) != string::npos) {
|
||||
rf.relevantBootCnt = rf.img00Cnt;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
iss >> word;
|
||||
if (word.find("img01:") == string::npos) {
|
||||
return false;
|
||||
}
|
||||
iss >> rf.img01Cnt;
|
||||
if (word.find(selfMatch) != string::npos) {
|
||||
rf.relevantBootCnt = rf.img01Cnt;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
iss >> word;
|
||||
if (word.find("img10:") == string::npos) {
|
||||
return false;
|
||||
}
|
||||
iss >> rf.img10Cnt;
|
||||
if (word.find(selfMatch) != string::npos) {
|
||||
rf.relevantBootCnt = rf.img10Cnt;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
iss >> word;
|
||||
if (word.find("img11:") == string::npos) {
|
||||
return false;
|
||||
}
|
||||
iss >> rf.img11Cnt;
|
||||
if (word.find(selfMatch) != string::npos) {
|
||||
rf.relevantBootCnt = rf.img11Cnt;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
iss >> word;
|
||||
if (word.find("bootflag:") == string::npos) {
|
||||
return false;
|
||||
}
|
||||
iss >> rf.bootFlag;
|
||||
break;
|
||||
}
|
||||
case 7: {
|
||||
iss >> word;
|
||||
if (word.find("bootflag:") == string::npos) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
iss >> word;
|
||||
uint8_t copyRaw = 0;
|
||||
uint8_t chipRaw = 0;
|
||||
if (word.find("last:") == string::npos) {
|
||||
return false;
|
||||
}
|
||||
iss >> chipRaw;
|
||||
if (iss.fail()) {
|
||||
return false;
|
||||
}
|
||||
iss >> copyRaw;
|
||||
if (iss.fail()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (chipRaw > 1 or copyRaw > 1) {
|
||||
return false;
|
||||
}
|
||||
rf.lastChip = static_cast<xsc::Chip>(chipRaw);
|
||||
rf.lastCopy = static_cast<xsc::Copy>(copyRaw);
|
||||
}
|
||||
}
|
||||
if (iss.fail()) {
|
||||
return false;
|
||||
}
|
||||
lineIdx++;
|
||||
}
|
||||
if (lineIdx < 8) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CoreController::resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy) {
|
||||
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE;
|
||||
// Disable the reboot file mechanism
|
||||
parseRebootFile(path, rebootFile);
|
||||
if (tgtChip == xsc::ALL_CHIP and tgtCopy == xsc::ALL_COPY) {
|
||||
rebootFile.img00Cnt = 0;
|
||||
rebootFile.img01Cnt = 0;
|
||||
rebootFile.img10Cnt = 0;
|
||||
rebootFile.img11Cnt = 0;
|
||||
} else {
|
||||
if (tgtChip == xsc::CHIP_0) {
|
||||
if (tgtCopy == xsc::COPY_0) {
|
||||
rebootFile.img00Cnt = 0;
|
||||
} else {
|
||||
rebootFile.img01Cnt = 0;
|
||||
}
|
||||
} else {
|
||||
if (tgtCopy == xsc::COPY_0) {
|
||||
rebootFile.img10Cnt = 0;
|
||||
} else {
|
||||
rebootFile.img11Cnt = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
rewriteRebootFile(rebootFile);
|
||||
}
|
||||
|
||||
void CoreController::rewriteRebootFile(RebootFile file) {
|
||||
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE;
|
||||
std::ofstream rebootFile(path);
|
||||
if (rebootFile.is_open()) {
|
||||
// Initiate reboot file first. Reboot handling will be on on initialization
|
||||
rebootFile << "on: " << file.enabled << "\nmaxcnt: " << file.maxCount
|
||||
<< "\nimg00: " << file.img00Cnt << "\nimg01: " << file.img01Cnt
|
||||
<< "\nimg10: " << file.img10Cnt << "\nimg11: " << file.img11Cnt
|
||||
<< "\nbootflag: " << file.bootFlag << "\nlast: " << file.lastChip << " "
|
||||
<< file.lastCopy << "\n";
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,9 @@
|
||||
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
||||
|
||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||
#include <libxiphos.h>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "bsp_q7s/memory/SdCardManager.h"
|
||||
#include "events/subsystemIdRanges.h"
|
||||
@ -10,24 +13,64 @@
|
||||
class Timer;
|
||||
class SdCardManager;
|
||||
|
||||
namespace xsc {
|
||||
|
||||
enum Chip : uint8_t { CHIP_0, CHIP_1, NO_CHIP, SELF_CHIP, ALL_CHIP };
|
||||
enum Copy : uint8_t { COPY_0, COPY_1, NO_COPY, SELF_COPY, ALL_COPY };
|
||||
|
||||
} // namespace xsc
|
||||
|
||||
struct RebootFile {
|
||||
static constexpr uint8_t DEFAULT_MAX_BOOT_CNT = 10;
|
||||
|
||||
bool enabled = false;
|
||||
size_t maxCount = DEFAULT_MAX_BOOT_CNT;
|
||||
uint8_t img00Cnt = 0;
|
||||
uint8_t img01Cnt = 0;
|
||||
uint8_t img10Cnt = 0;
|
||||
uint8_t img11Cnt = 0;
|
||||
uint8_t relevantBootCnt = 0;
|
||||
bool bootFlag = false;
|
||||
xsc::Chip lastChip = xsc::Chip::CHIP_0;
|
||||
xsc::Copy lastCopy = xsc::Copy::COPY_0;
|
||||
};
|
||||
|
||||
class CoreController : public ExtendedControllerBase {
|
||||
public:
|
||||
enum Chip : uint8_t { CHIP_0, CHIP_1, NO_CHIP, SELF_CHIP, ALL_CHIP };
|
||||
|
||||
enum Copy : uint8_t { COPY_0, COPY_1, NO_COPY, SELF_COPY, ALL_COPY };
|
||||
static xsc::Chip CURRENT_CHIP;
|
||||
static xsc::Copy CURRENT_COPY;
|
||||
|
||||
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
|
||||
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
||||
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
|
||||
static constexpr char VERSION_FILE[] = "/conf/sd_status";
|
||||
static constexpr char VERSION_FILE[] = "/conf/version.txt";
|
||||
static constexpr char REBOOT_FILE[] = "/conf/reboot.txt";
|
||||
|
||||
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
||||
static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5;
|
||||
static constexpr ActionId_t RESET_ALL_REBOOT_COUNTERS = 6;
|
||||
static constexpr ActionId_t RESET_REBOOT_COUNTER_00 = 7;
|
||||
static constexpr ActionId_t RESET_REBOOT_COUNTER_01 = 8;
|
||||
static constexpr ActionId_t RESET_REBOOT_COUNTER_10 = 9;
|
||||
static constexpr ActionId_t RESET_REBOOT_COUNTER_11 = 10;
|
||||
static constexpr ActionId_t SET_MAX_REBOOT_CNT = 11;
|
||||
|
||||
static constexpr ActionId_t REBOOT_OBC = 32;
|
||||
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
||||
|
||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
||||
|
||||
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||
//! [EXPORT] : [COMMENT] Software reboot occured. Can also be a systemd reboot.
|
||||
//! P1: Current Chip, P2: Current Copy
|
||||
static constexpr Event REBOOT_SW = event::makeEvent(SUBSYSTEM_ID, 1, severity::MEDIUM);
|
||||
//! [EXPORT] : [COMMENT] The reboot mechanism was triggered.
|
||||
//! P1: First 16 bits: Last Chip, Last 16 bits: Last Copy,
|
||||
//! P2: Each byte is the respective reboot count for the slots
|
||||
static constexpr Event REBOOT_MECHANISM_TRIGGERED =
|
||||
event::makeEvent(SUBSYSTEM_ID, 2, severity::MEDIUM);
|
||||
//! Trying to find a way how to determine that the reboot came from ProASIC3 or PCDU..
|
||||
static constexpr Event REBOOT_HW = event::makeEvent(SUBSYSTEM_ID, 3, severity::MEDIUM);
|
||||
|
||||
CoreController(object_id_t objectId);
|
||||
virtual ~CoreController();
|
||||
@ -48,7 +91,7 @@ class CoreController : public ExtendedControllerBase {
|
||||
*/
|
||||
static ReturnValue_t generateChipStateFile();
|
||||
static ReturnValue_t incrementAllocationFailureCount();
|
||||
static void getCurrentBootCopy(Chip& chip, Copy& copy);
|
||||
static void getCurrentBootCopy(xsc::Chip& chip, xsc::Copy& copy);
|
||||
|
||||
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
|
||||
|
||||
@ -63,15 +106,12 @@ class CoreController : public ExtendedControllerBase {
|
||||
* @param updateProtFile Specify whether the protection info file is updated
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t setBootCopyProtection(Chip targetChip, Copy targetCopy, bool protect,
|
||||
ReturnValue_t setBootCopyProtection(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect,
|
||||
bool& protOperationPerformed, bool updateProtFile = true);
|
||||
|
||||
bool sdInitFinished() const;
|
||||
|
||||
private:
|
||||
static Chip CURRENT_CHIP;
|
||||
static Copy CURRENT_COPY;
|
||||
|
||||
// Designated value for rechecking FIFO open
|
||||
static constexpr int RETRY_FIFO_OPEN = -2;
|
||||
int watchdogFifoFd = 0;
|
||||
@ -122,6 +162,8 @@ class CoreController : public ExtendedControllerBase {
|
||||
sd::SdState commandedState = sd::SdState::OFF;
|
||||
};
|
||||
SdInfo sdInfo;
|
||||
RebootFile rebootFile = {};
|
||||
bool doPerformRebootFileHandling = true;
|
||||
|
||||
/**
|
||||
* Index 0: Chip 0 Copy 0
|
||||
@ -152,6 +194,7 @@ class CoreController : public ExtendedControllerBase {
|
||||
void determinePreferredSdCard();
|
||||
void executeNextExternalSdCommand();
|
||||
void checkExternalSdCommandStatus();
|
||||
void performRebootFileHandling(bool recreateFile);
|
||||
|
||||
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size);
|
||||
@ -160,9 +203,14 @@ class CoreController : public ExtendedControllerBase {
|
||||
void performWatchdogControlOperation();
|
||||
|
||||
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
|
||||
int handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
|
||||
int handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect,
|
||||
bool& protOperationPerformed, bool selfChip, bool selfCopy,
|
||||
bool allChips, bool allCopies, uint8_t arrIdx);
|
||||
void determineAndExecuteReboot(RebootFile& rf, bool& needsReboot, xsc::Chip& tgtChip,
|
||||
xsc::Copy& tgtCopy);
|
||||
void resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy);
|
||||
bool parseRebootFile(std::string path, RebootFile& file);
|
||||
void rewriteRebootFile(RebootFile file);
|
||||
};
|
||||
|
||||
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
||||
|
@ -28,6 +28,13 @@
|
||||
#include "linux/boardtest/UartTestClass.h"
|
||||
#include "linux/csp/CspComIF.h"
|
||||
#include "linux/csp/CspCookie.h"
|
||||
#include "linux/devices/GPSHyperionLinuxController.h"
|
||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||
#include "linux/devices/startracker/StarTrackerHandler.h"
|
||||
#include "linux/devices/startracker/StrHelper.h"
|
||||
#include "linux/boardtest/SpiTestClass.h"
|
||||
#include "linux/csp/CspComIF.h"
|
||||
#include "linux/csp/CspCookie.h"
|
||||
#include "tmtc/apid.h"
|
||||
#include "tmtc/pusIds.h"
|
||||
#if OBSW_TEST_LIBGPIOD == 1
|
||||
@ -51,13 +58,7 @@
|
||||
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||
#include "fsfw_hal/linux/uart/UartCookie.h"
|
||||
#include "linux/boardtest/SpiTestClass.h"
|
||||
#include "linux/csp/CspComIF.h"
|
||||
#include "linux/csp/CspCookie.h"
|
||||
#include "linux/devices/GPSHyperionLinuxController.h"
|
||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||
#include "linux/devices/startracker/StarTrackerHandler.h"
|
||||
#include "linux/devices/startracker/StrHelper.h"
|
||||
|
||||
#include "mission/core/GenericFactory.h"
|
||||
#include "mission/devices/ACUHandler.h"
|
||||
#include "mission/devices/BpxBatteryHandler.h"
|
||||
@ -69,6 +70,7 @@
|
||||
#include "mission/devices/PCDUHandler.h"
|
||||
#include "mission/devices/PDU1Handler.h"
|
||||
#include "mission/devices/PDU2Handler.h"
|
||||
#include "mission/devices/PayloadPcduHandler.h"
|
||||
#include "mission/devices/PlocMPSoCHandler.h"
|
||||
#include "mission/devices/RadiationSensorHandler.h"
|
||||
#include "mission/devices/RwHandler.h"
|
||||
@ -83,6 +85,7 @@
|
||||
#include "mission/devices/devicedefinitions/RwDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/SusDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
|
||||
#include "mission/tmtc/CCSDSHandler.h"
|
||||
#include "mission/tmtc/VirtualChannel.h"
|
||||
#include "mission/utility/TmFunnel.h"
|
||||
@ -1168,15 +1171,6 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
|
||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_DRO, consumer, gpio::DIR_OUT,
|
||||
gpio::Levels::LOW);
|
||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_DRO, gpio);
|
||||
consumer = "PLPCDU_ENB_HPA";
|
||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_HPA, consumer, gpio::DIR_OUT,
|
||||
gpio::Levels::LOW);
|
||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_HPA, gpio);
|
||||
consumer = "PLPCDU_ENB_MPA";
|
||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_MPA, consumer, gpio::DIR_OUT,
|
||||
gpio::Levels::LOW);
|
||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_MPA, gpio);
|
||||
|
||||
consumer = "PLPCDU_ENB_X8";
|
||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_X8, consumer, gpio::DIR_OUT,
|
||||
gpio::Levels::LOW);
|
||||
@ -1185,6 +1179,14 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
|
||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_TX, consumer, gpio::DIR_OUT,
|
||||
gpio::Levels::LOW);
|
||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_TX, gpio);
|
||||
consumer = "PLPCDU_ENB_MPA";
|
||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_MPA, consumer, gpio::DIR_OUT,
|
||||
gpio::Levels::LOW);
|
||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_MPA, gpio);
|
||||
consumer = "PLPCDU_ENB_HPA";
|
||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_HPA, consumer, gpio::DIR_OUT,
|
||||
gpio::Levels::LOW);
|
||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_HPA, gpio);
|
||||
|
||||
// Chip select pin is active low
|
||||
consumer = "PLPCDU_ADC_CS";
|
||||
@ -1192,6 +1194,22 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
|
||||
gpio::Levels::HIGH);
|
||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ADC_CS, gpio);
|
||||
gpioComIF->addGpios(plPcduGpios);
|
||||
SpiCookie* spiCookie = new SpiCookie(addresses::PLPCDU_ADC, gpioIds::PLPCDU_ADC_CS,
|
||||
q7s::SPI_DEFAULT_DEV, plpcdu::MAX_ADC_REPLY_SIZE,
|
||||
spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
||||
// Create device handler components
|
||||
auto plPcduHandler =
|
||||
new PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_COM_IF, spiCookie, gpioComIF,
|
||||
SdCardManager::instance(), false);
|
||||
spiCookie->setCallbackMode(PayloadPcduHandler::extConvAsTwoCallback, plPcduHandler);
|
||||
static_cast<void>(plPcduHandler);
|
||||
#if OBSW_TEST_PL_PCDU == 1
|
||||
plPcduHandler->setStartUpImmediately();
|
||||
#if OBSW_DEBUG_PL_PCDU == 1
|
||||
plPcduHandler->setToGoToNormalModeImmediately(true);
|
||||
plPcduHandler->enablePeriodicPrintout(true, 5);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
|
||||
|
2107
bsp_q7s/devices/startracker/StarTrackerHandler.cpp
Normal file
2107
bsp_q7s/devices/startracker/StarTrackerHandler.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
||||
#include "SdCardManager.h"
|
||||
|
||||
#include <fsfw/ipc/MutexGuard.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cstring>
|
||||
@ -7,6 +8,7 @@
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
|
||||
#include "common/config/commonObjects.h"
|
||||
#include "fsfw/ipc/MutexFactory.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
#include "linux/utility/utility.h"
|
||||
@ -14,7 +16,9 @@
|
||||
|
||||
SdCardManager* SdCardManager::factoryInstance = nullptr;
|
||||
|
||||
SdCardManager::SdCardManager() : cmdExecutor(256) {}
|
||||
SdCardManager::SdCardManager() : SystemObject(objects::SDC_MANAGER), cmdExecutor(256) {
|
||||
mutex = MutexFactory::instance()->createMutex();
|
||||
}
|
||||
|
||||
SdCardManager::~SdCardManager() {}
|
||||
|
||||
@ -161,6 +165,7 @@ ReturnValue_t SdCardManager::setSdCardState(sd::SdCard sdCard, bool on) {
|
||||
|
||||
ReturnValue_t SdCardManager::getSdCardActiveStatus(SdStatePair& active) {
|
||||
using namespace std;
|
||||
MutexGuard mg(mutex);
|
||||
if (not filesystem::exists(SD_STATE_FILE)) {
|
||||
return STATUS_FILE_NEXISTS;
|
||||
}
|
||||
@ -365,6 +370,7 @@ ReturnValue_t SdCardManager::updateSdCardStateFile() {
|
||||
if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) {
|
||||
return CommandExecutor::COMMAND_PENDING;
|
||||
}
|
||||
MutexGuard mg(mutex);
|
||||
// Use q7hw utility and pipe the command output into the state file
|
||||
std::string updateCmd = "q7hw sd info all > " + std::string(SD_STATE_FILE);
|
||||
cmdExecutor.load(updateCmd, blocking, printCmdOutput);
|
||||
@ -439,6 +445,7 @@ void SdCardManager::setPrintCommandOutput(bool print) { this->printCmdOutput = p
|
||||
bool SdCardManager::isSdCardMounted(sd::SdCard sdCard) {
|
||||
SdCardManager::SdStatePair active;
|
||||
ReturnValue_t result = this->getSdCardActiveStatus(active);
|
||||
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::debug << "SdCardManager::isSdCardMounted: Failed to get SD card active state";
|
||||
return false;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_
|
||||
#define BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_
|
||||
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include <array>
|
||||
@ -9,11 +10,12 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "definitions.h"
|
||||
#include "events/subsystemIdRanges.h"
|
||||
#include "fsfw/events/Event.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw_hal/linux/CommandExecutor.h"
|
||||
#include "mission/memory/SdCardMountedIF.h"
|
||||
#include "mission/memory/definitions.h"
|
||||
#include "returnvalues/classIds.h"
|
||||
|
||||
class MutexIF;
|
||||
@ -22,10 +24,12 @@ class MutexIF;
|
||||
* @brief Manages handling of SD cards like switching them on or off or getting the current
|
||||
* state
|
||||
*/
|
||||
class SdCardManager {
|
||||
class SdCardManager : public SystemObject, public SdCardMountedIF {
|
||||
friend class SdCardAccess;
|
||||
|
||||
public:
|
||||
using mountInitCb = ReturnValue_t (*)(void* args);
|
||||
|
||||
enum class Operations { SWITCHING_ON, SWITCHING_OFF, MOUNTING, UNMOUNTING, IDLE };
|
||||
|
||||
enum class OpStatus { IDLE, TIMEOUT, ONGOING, SUCCESS, FAIL };
|
||||
@ -54,6 +58,7 @@ class SdCardManager {
|
||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FILE_SYSTEM;
|
||||
|
||||
static constexpr Event SANITIZATION_FAILED = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW);
|
||||
static constexpr Event MOUNTED_SD_CARD = event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO);
|
||||
|
||||
// C++17 does not support constexpr std::string yet
|
||||
static constexpr char SD_0_DEV_NAME[] = "/dev/mmcblk0p1";
|
||||
@ -86,7 +91,7 @@ class SdCardManager {
|
||||
* @param sdCard
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t getPreferredSdCard(sd::SdCard& sdCard) const;
|
||||
ReturnValue_t getPreferredSdCard(sd::SdCard& sdCard) const override;
|
||||
|
||||
/**
|
||||
* Switch on the specified SD card.
|
||||
@ -168,7 +173,7 @@ class SdCardManager {
|
||||
* @param prefSdCardPtr
|
||||
* @return
|
||||
*/
|
||||
std::string getCurrentMountPrefix(sd::SdCard prefSdCardPtr = sd::SdCard::NONE);
|
||||
std::string getCurrentMountPrefix(sd::SdCard prefSdCardPtr = sd::SdCard::NONE) override;
|
||||
|
||||
OpStatus checkCurrentOp(Operations& currentOp);
|
||||
|
||||
@ -181,19 +186,20 @@ class SdCardManager {
|
||||
void setPrintCommandOutput(bool print);
|
||||
|
||||
/**
|
||||
* @brief Checks if an SD card is mounted
|
||||
* @brief Checks if an SD card is mounted.
|
||||
*
|
||||
* @param sdCard The SD crad to check
|
||||
* @param sdCard The SD card to check
|
||||
*
|
||||
* @return true if mounted, otherwise false
|
||||
*/
|
||||
bool isSdCardMounted(sd::SdCard sdCard);
|
||||
bool isSdCardMounted(sd::SdCard sdCard) override;
|
||||
|
||||
private:
|
||||
CommandExecutor cmdExecutor;
|
||||
Operations currentOp = Operations::IDLE;
|
||||
bool blocking = false;
|
||||
bool printCmdOutput = true;
|
||||
MutexIF* mutex = nullptr;
|
||||
|
||||
SdCardManager();
|
||||
|
||||
|
@ -81,8 +81,19 @@ set(CMAKE_PREFIX_PATH
|
||||
# "${SYSROOT_PATH}/usr/lib/${CROSS_COMPILE}"
|
||||
)
|
||||
|
||||
set(C_FLAGS
|
||||
-mcpu=cortex-a9
|
||||
-mfpu=neon-vfpv3
|
||||
-mfloat-abi=hard
|
||||
${COMMON_FLAGS}
|
||||
-lgpiod
|
||||
-lxiphos
|
||||
)
|
||||
|
||||
string (REPLACE ";" " " C_FLAGS "${C_FLAGS}")
|
||||
|
||||
set(CMAKE_C_FLAGS
|
||||
"-mcpu=cortex-a9 -mfpu=neon-vfpv3 -mfloat-abi=hard ${COMMON_FLAGS} -lgpiod"
|
||||
${C_FLAGS}
|
||||
CACHE STRING "C flags for Q7S"
|
||||
)
|
||||
set(CMAKE_CXX_FLAGS
|
||||
|
@ -19,6 +19,7 @@ enum: uint8_t {
|
||||
PLOC_MEMORY_DUMPER = 118,
|
||||
PDEC_HANDLER = 119,
|
||||
STR_HELPER = 120,
|
||||
PL_PCDU_HANDLER = 121,
|
||||
COMMON_SUBSYSTEM_ID_END
|
||||
};
|
||||
}
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit eacb4ac4079ff2bf5e0648626332e59046a409da
|
||||
Subproject commit 2d9216ba19f1931225daa5b6b6f244a48c09f1b9
|
@ -1,139 +1,152 @@
|
||||
2200;STORE_SEND_WRITE_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2201;STORE_WRITE_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2202;STORE_SEND_READ_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2203;STORE_READ_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2204;UNEXPECTED_MSG;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2205;STORING_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2206;TM_DUMP_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2207;STORE_INIT_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2208;STORE_INIT_EMPTY;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2209;STORE_CONTENT_CORRUPTED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2210;STORE_INITIALIZE;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2211;INIT_DONE;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2212;DUMP_FINISHED;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2213;DELETION_FINISHED;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2214;DELETION_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2215;AUTO_CATALOGS_SENDING_FAILED;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2600;GET_DATA_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h
|
||||
2601;STORE_DATA_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/storagemanager/StorageManagerIF.h
|
||||
2800;DEVICE_BUILDING_COMMAND_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2801;DEVICE_SENDING_COMMAND_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2802;DEVICE_REQUESTING_REPLY_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2803;DEVICE_READING_REPLY_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2804;DEVICE_INTERPRETING_REPLY_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2805;DEVICE_MISSED_REPLY;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2806;DEVICE_UNKNOWN_REPLY;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2807;DEVICE_UNREQUESTED_REPLY;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2808;INVALID_DEVICE_COMMAND;LOW;Indicates a SW bug in child class.;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2809;MONITORING_LIMIT_EXCEEDED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2810;MONITORING_AMBIGUOUS;HIGH;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2811;DEVICE_WANTS_HARD_REBOOT;HIGH;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
4201;FUSE_CURRENT_HIGH;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/power/Fuse.h
|
||||
4202;FUSE_WENT_OFF;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/power/Fuse.h
|
||||
4204;POWER_ABOVE_HIGH_LIMIT;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/power/Fuse.h
|
||||
4205;POWER_BELOW_LOW_LIMIT;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/power/Fuse.h
|
||||
4300;SWITCH_WENT_OFF;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/power/PowerSwitchIF.h
|
||||
5000;HEATER_ON;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h
|
||||
5001;HEATER_OFF;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h
|
||||
5002;HEATER_TIMEOUT;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h
|
||||
5003;HEATER_STAYED_ON;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h
|
||||
5004;HEATER_STAYED_OFF;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/thermal/Heater.h
|
||||
5200;TEMP_SENSOR_HIGH;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||
5201;TEMP_SENSOR_LOW;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||
5202;TEMP_SENSOR_GRADIENT;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||
5901;COMPONENT_TEMP_LOW;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5902;COMPONENT_TEMP_HIGH;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5903;COMPONENT_TEMP_OOL_LOW;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5904;COMPONENT_TEMP_OOL_HIGH;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5905;TEMP_NOT_IN_OP_RANGE;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
7101;FDIR_CHANGED_STATE;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||
7102;FDIR_STARTS_RECOVERY;MEDIUM;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||
7103;FDIR_TURNS_OFF_DEVICE;MEDIUM;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||
7201;MONITOR_CHANGED_STATE;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7202;VALUE_BELOW_LOW_LIMIT;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7203;VALUE_ABOVE_HIGH_LIMIT;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7204;VALUE_OUT_OF_RANGE;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7400;CHANGING_MODE;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7401;MODE_INFO;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7402;FALLBACK_FAILED;HIGH;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7403;MODE_TRANSITION_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7404;CANT_KEEP_MODE;HIGH;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7405;OBJECT_IN_INVALID_MODE;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7406;FORCING_MODE;MEDIUM;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7407;MODE_CMD_REJECTED;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7506;HEALTH_INFO;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7507;CHILD_CHANGED_HEALTH;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7508;CHILD_PROBLEMS;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7509;OVERWRITING_HEALTH;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7510;TRYING_RECOVERY;MEDIUM;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7511;RECOVERY_STEP;MEDIUM;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7512;RECOVERY_DONE;MEDIUM;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7900;RF_AVAILABLE;INFO;A RF available signal was detected. P1: raw RFA state, P2: 0;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7901;RF_LOST;INFO;A previously found RF available signal was lost. P1: raw RFA state, P2: 0;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7902;BIT_LOCK;INFO;A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7903;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7905;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
8900;CLOCK_SET;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8901;CLOCK_SET_FAILURE;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
9700;TEST;INFO;;C:\Users\jakob\eive-software\eive_obsw/fsfw/src/fsfw/pus/Service17Test.h
|
||||
10600;CHANGE_OF_SETUP_PARAMETER;LOW;;C:\Users\jakob\eive-software\eive_obsw/fsfw/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h
|
||||
10900;GPIO_PULL_HIGH_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/HeaterHandler.h
|
||||
10901;GPIO_PULL_LOW_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/HeaterHandler.h
|
||||
10902;SWITCH_ALREADY_ON;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/HeaterHandler.h
|
||||
10903;SWITCH_ALREADY_OFF;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/HeaterHandler.h
|
||||
10904;MAIN_SWITCH_TIMEOUT;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/HeaterHandler.h
|
||||
11000;MAIN_SWITCH_ON_TIMEOUT;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/SolarArrayDeploymentHandler.h
|
||||
11001;MAIN_SWITCH_OFF_TIMEOUT;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/SolarArrayDeploymentHandler.h
|
||||
11002;DEPLOYMENT_FAILED;HIGH;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/SolarArrayDeploymentHandler.h
|
||||
11003;DEPL_SA1_GPIO_SWTICH_ON_FAILED;HIGH;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/SolarArrayDeploymentHandler.h
|
||||
11004;DEPL_SA2_GPIO_SWTICH_ON_FAILED;HIGH;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/SolarArrayDeploymentHandler.h
|
||||
11101;MEMORY_READ_RPT_CRC_FAILURE;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/PlocMPSoCHandler.h
|
||||
11102;ACK_FAILURE;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/PlocMPSoCHandler.h
|
||||
11103;EXE_FAILURE;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/PlocMPSoCHandler.h
|
||||
11104;CRC_FAILURE_EVENT;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/PlocMPSoCHandler.h
|
||||
11201;SELF_TEST_I2C_FAILURE;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/IMTQHandler.h
|
||||
11202;SELF_TEST_SPI_FAILURE;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/IMTQHandler.h
|
||||
11203;SELF_TEST_ADC_FAILURE;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/IMTQHandler.h
|
||||
11204;SELF_TEST_PWM_FAILURE;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/IMTQHandler.h
|
||||
11205;SELF_TEST_TC_FAILURE;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/IMTQHandler.h
|
||||
11206;SELF_TEST_MTM_RANGE_FAILURE;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/IMTQHandler.h
|
||||
11207;SELF_TEST_COIL_CURRENT_FAILURE;LOW;;C:\Users\jakob\eive-software\eive_obsw/mission/devices/IMTQHandler.h
|
||||
11208;INVALID_ERROR_BYTE;LOW;Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.;C:\Users\jakob\eive-software\eive_obsw/mission/devices/IMTQHandler.h
|
||||
11301;ERROR_STATE;HIGH;Reaction wheel signals an error state;C:\Users\jakob\eive-software\eive_obsw/mission/devices/RwHandler.h
|
||||
11401;BOOTING_FIRMWARE_FAILED;LOW;Failed to boot firmware;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StarTrackerHandler.h
|
||||
11402;BOOTING_BOOTLOADER_FAILED;LOW;Failed to boot star tracker into bootloader mode;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StarTrackerHandler.h
|
||||
11501;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
|
||||
11502;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
|
||||
11503;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
|
||||
11504;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/devices/PlocSupervisorHandler.h
|
||||
11600;SANITIZATION_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/memory/SdCardManager.h
|
||||
11700;UPDATE_FILE_NOT_EXISTS;LOW;;C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
|
||||
11701;ACTION_COMMANDING_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
|
||||
11702;UPDATE_AVAILABLE_FAILED;LOW;Supervisor handler replied action message indicating a command execution failure of the update available command;C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
|
||||
11703;UPDATE_TRANSFER_FAILED;LOW;Supervisor handler failed to transfer an update space packet. P1: Parameter holds the number of update packets already sent (inclusive the failed packet);C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
|
||||
11704;UPDATE_VERIFY_FAILED;LOW;Supervisor failed to execute the update verify command.;C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
|
||||
11705;UPDATE_FINISHED;INFO;MPSoC update successful completed;C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/devices/PlocUpdater.h
|
||||
11800;SEND_MRAM_DUMP_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h
|
||||
11801;MRAM_DUMP_FAILED;LOW;Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command;C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h
|
||||
11802;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;C:\Users\jakob\eive-software\eive_obsw/bsp_q7s/devices/PlocMemoryDumper.h
|
||||
11901;INVALID_TC_FRAME;HIGH;;C:\Users\jakob\eive-software\eive_obsw/linux/obc/PdecHandler.h
|
||||
11902;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;C:\Users\jakob\eive-software\eive_obsw/linux/obc/PdecHandler.h
|
||||
11903;CARRIER_LOCK;INFO;Carrier lock detected;C:\Users\jakob\eive-software\eive_obsw/linux/obc/PdecHandler.h
|
||||
11904;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);C:\Users\jakob\eive-software\eive_obsw/linux/obc/PdecHandler.h
|
||||
12000;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12001;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12002;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12003;IMAGE_DOWNLOAD_SUCCESSFUL;LOW;Image download was successful;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12004;FLASH_WRITE_SUCCESSFUL;LOW;Finished flash write procedure successfully;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12005;FLASH_READ_SUCCESSFUL;LOW;Finished flash read procedure successfully;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12006;FLASH_READ_FAILED;LOW;Flash read procedure failed;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12007;FIRMWARE_UPDATE_SUCCESSFUL;LOW;Firmware update was successful;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12008;FIRMWARE_UPDATE_FAILED;LOW;Firmware update failed;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12009;STR_HELPER_READING_REPLY_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12010;STR_HELPER_COM_ERROR;LOW;;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12011;STR_HELPER_NO_REPLY;LOW;Star tracker did not send replies (maybe device is powered off) P1: Position of upload or download packet for which no reply was sent;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12012;STR_HELPER_DEC_ERROR;LOW;;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12013;POSITION_MISMATCH;LOW;Position mismatch P1: The expected position and thus the position for which the image upload/download failed;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12014;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12015;STR_HELPER_SENDING_PACKET_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
12016;STR_HELPER_REQUESTING_MSG_FAILED;LOW;;C:\Users\jakob\eive-software\eive_obsw/linux/devices/startracker/StrHelper.h
|
||||
2200;STORE_SEND_WRITE_FAILED;LOW;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2201;STORE_WRITE_FAILED;LOW;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2202;STORE_SEND_READ_FAILED;LOW;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2203;STORE_READ_FAILED;LOW;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2204;UNEXPECTED_MSG;LOW;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2205;STORING_FAILED;LOW;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2206;TM_DUMP_FAILED;LOW;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2207;STORE_INIT_FAILED;LOW;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2208;STORE_INIT_EMPTY;INFO;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2209;STORE_CONTENT_CORRUPTED;LOW;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2210;STORE_INITIALIZE;INFO;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2211;INIT_DONE;INFO;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2212;DUMP_FINISHED;INFO;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2213;DELETION_FINISHED;INFO;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2214;DELETION_FAILED;LOW;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2215;AUTO_CATALOGS_SENDING_FAILED;INFO;;./fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2600;GET_DATA_FAILED;LOW;;./fsfw/src/fsfw/storagemanager/StorageManagerIF.h
|
||||
2601;STORE_DATA_FAILED;LOW;;./fsfw/src/fsfw/storagemanager/StorageManagerIF.h
|
||||
2800;DEVICE_BUILDING_COMMAND_FAILED;LOW;;./fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2801;DEVICE_SENDING_COMMAND_FAILED;LOW;;./fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2802;DEVICE_REQUESTING_REPLY_FAILED;LOW;;./fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2803;DEVICE_READING_REPLY_FAILED;LOW;;./fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2804;DEVICE_INTERPRETING_REPLY_FAILED;LOW;;./fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2805;DEVICE_MISSED_REPLY;LOW;;./fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2806;DEVICE_UNKNOWN_REPLY;LOW;;./fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2807;DEVICE_UNREQUESTED_REPLY;LOW;;./fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2808;INVALID_DEVICE_COMMAND;LOW;Indicates a SW bug in child class.;./fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2809;MONITORING_LIMIT_EXCEEDED;LOW;;./fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2810;MONITORING_AMBIGUOUS;HIGH;;./fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
2811;DEVICE_WANTS_HARD_REBOOT;HIGH;;./fsfw/src/fsfw/devicehandlers/DeviceHandlerIF.h
|
||||
4201;FUSE_CURRENT_HIGH;LOW;;./fsfw/src/fsfw/power/Fuse.h
|
||||
4202;FUSE_WENT_OFF;LOW;;./fsfw/src/fsfw/power/Fuse.h
|
||||
4204;POWER_ABOVE_HIGH_LIMIT;LOW;;./fsfw/src/fsfw/power/Fuse.h
|
||||
4205;POWER_BELOW_LOW_LIMIT;LOW;;./fsfw/src/fsfw/power/Fuse.h
|
||||
4300;SWITCH_WENT_OFF;LOW;;./fsfw/src/fsfw/power/PowerSwitchIF.h
|
||||
5000;HEATER_ON;INFO;;./fsfw/src/fsfw/thermal/Heater.h
|
||||
5001;HEATER_OFF;INFO;;./fsfw/src/fsfw/thermal/Heater.h
|
||||
5002;HEATER_TIMEOUT;LOW;;./fsfw/src/fsfw/thermal/Heater.h
|
||||
5003;HEATER_STAYED_ON;LOW;;./fsfw/src/fsfw/thermal/Heater.h
|
||||
5004;HEATER_STAYED_OFF;LOW;;./fsfw/src/fsfw/thermal/Heater.h
|
||||
5200;TEMP_SENSOR_HIGH;LOW;;./fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||
5201;TEMP_SENSOR_LOW;LOW;;./fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||
5202;TEMP_SENSOR_GRADIENT;LOW;;./fsfw/src/fsfw/thermal/AbstractTemperatureSensor.h
|
||||
5901;COMPONENT_TEMP_LOW;LOW;;./fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5902;COMPONENT_TEMP_HIGH;LOW;;./fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5903;COMPONENT_TEMP_OOL_LOW;LOW;;./fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5904;COMPONENT_TEMP_OOL_HIGH;LOW;;./fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
5905;TEMP_NOT_IN_OP_RANGE;LOW;;./fsfw/src/fsfw/thermal/ThermalComponentIF.h
|
||||
7101;FDIR_CHANGED_STATE;INFO;;./fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||
7102;FDIR_STARTS_RECOVERY;MEDIUM;;./fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||
7103;FDIR_TURNS_OFF_DEVICE;MEDIUM;;./fsfw/src/fsfw/fdir/FailureIsolationBase.h
|
||||
7201;MONITOR_CHANGED_STATE;LOW;;./fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7202;VALUE_BELOW_LOW_LIMIT;LOW;;./fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7203;VALUE_ABOVE_HIGH_LIMIT;LOW;;./fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7204;VALUE_OUT_OF_RANGE;LOW;;./fsfw/src/fsfw/monitoring/MonitoringIF.h
|
||||
7400;CHANGING_MODE;INFO;;./fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7401;MODE_INFO;INFO;;./fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7402;FALLBACK_FAILED;HIGH;;./fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7403;MODE_TRANSITION_FAILED;LOW;;./fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7404;CANT_KEEP_MODE;HIGH;;./fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7405;OBJECT_IN_INVALID_MODE;LOW;;./fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7406;FORCING_MODE;MEDIUM;;./fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7407;MODE_CMD_REJECTED;LOW;;./fsfw/src/fsfw/modes/HasModesIF.h
|
||||
7506;HEALTH_INFO;INFO;;./fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7507;CHILD_CHANGED_HEALTH;INFO;;./fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7508;CHILD_PROBLEMS;LOW;;./fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7509;OVERWRITING_HEALTH;LOW;;./fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7510;TRYING_RECOVERY;MEDIUM;;./fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7511;RECOVERY_STEP;MEDIUM;;./fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7512;RECOVERY_DONE;MEDIUM;;./fsfw/src/fsfw/health/HasHealthIF.h
|
||||
7900;RF_AVAILABLE;INFO;A RF available signal was detected. P1: raw RFA state, P2: 0;./fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7901;RF_LOST;INFO;A previously found RF available signal was lost. P1: raw RFA state, P2: 0;./fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7902;BIT_LOCK;INFO;A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0;./fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7903;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;./fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7905;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;./fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
8900;CLOCK_SET;INFO;;./fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8901;CLOCK_SET_FAILURE;LOW;;./fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
9700;TEST;INFO;;./fsfw/src/fsfw/pus/Service17Test.h
|
||||
10600;CHANGE_OF_SETUP_PARAMETER;LOW;;./fsfw/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h
|
||||
10900;GPIO_PULL_HIGH_FAILED;LOW;;./mission/devices/HeaterHandler.h
|
||||
10901;GPIO_PULL_LOW_FAILED;LOW;;./mission/devices/HeaterHandler.h
|
||||
10902;SWITCH_ALREADY_ON;LOW;;./mission/devices/HeaterHandler.h
|
||||
10903;SWITCH_ALREADY_OFF;LOW;;./mission/devices/HeaterHandler.h
|
||||
10904;MAIN_SWITCH_TIMEOUT;LOW;;./mission/devices/HeaterHandler.h
|
||||
11000;MAIN_SWITCH_ON_TIMEOUT;LOW;;./mission/devices/SolarArrayDeploymentHandler.h
|
||||
11001;MAIN_SWITCH_OFF_TIMEOUT;LOW;;./mission/devices/SolarArrayDeploymentHandler.h
|
||||
11002;DEPLOYMENT_FAILED;HIGH;;./mission/devices/SolarArrayDeploymentHandler.h
|
||||
11003;DEPL_SA1_GPIO_SWTICH_ON_FAILED;HIGH;;./mission/devices/SolarArrayDeploymentHandler.h
|
||||
11004;DEPL_SA2_GPIO_SWTICH_ON_FAILED;HIGH;;./mission/devices/SolarArrayDeploymentHandler.h
|
||||
11101;MEMORY_READ_RPT_CRC_FAILURE;LOW;;./mission/devices/PlocMPSoCHandler.h
|
||||
11102;ACK_FAILURE;LOW;;./mission/devices/PlocMPSoCHandler.h
|
||||
11103;EXE_FAILURE;LOW;;./mission/devices/PlocMPSoCHandler.h
|
||||
11104;CRC_FAILURE_EVENT;LOW;;./mission/devices/PlocMPSoCHandler.h
|
||||
11201;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;./mission/devices/IMTQHandler.h
|
||||
11202;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;./mission/devices/IMTQHandler.h
|
||||
11203;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;./mission/devices/IMTQHandler.h
|
||||
11204;SELF_TEST_PWM_FAILURE;LOW;Get self test result returns PWM failure which concerns the coil actuation. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;./mission/devices/IMTQHandler.h
|
||||
11205;SELF_TEST_TC_FAILURE;LOW;Get self test result returns TC failure (system failure) P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;./mission/devices/IMTQHandler.h
|
||||
11206;SELF_TEST_MTM_RANGE_FAILURE;LOW;Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;./mission/devices/IMTQHandler.h
|
||||
11207;SELF_TEST_COIL_CURRENT_FAILURE;LOW;Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;./mission/devices/IMTQHandler.h
|
||||
11208;INVALID_ERROR_BYTE;LOW;Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.;./mission/devices/IMTQHandler.h
|
||||
11301;ERROR_STATE;HIGH;Reaction wheel signals an error state;./mission/devices/RwHandler.h
|
||||
11401;BOOTING_FIRMWARE_FAILED;LOW;Failed to boot firmware;./linux/devices/startracker/StarTrackerHandler.h
|
||||
11402;BOOTING_BOOTLOADER_FAILED;LOW;Failed to boot star tracker into bootloader mode;./linux/devices/startracker/StarTrackerHandler.h
|
||||
11501;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;./bsp_q7s/devices/PlocSupervisorHandler.h
|
||||
11502;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;./bsp_q7s/devices/PlocSupervisorHandler.h
|
||||
11503;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;./bsp_q7s/devices/PlocSupervisorHandler.h
|
||||
11504;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;./bsp_q7s/devices/PlocSupervisorHandler.h
|
||||
11600;ALLOC_FAILURE;MEDIUM;;./bsp_q7s/core/CoreController.h
|
||||
11601;REBOOT_SW;MEDIUM; Software reboot occured. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;./bsp_q7s/core/CoreController.h
|
||||
11603;REBOOT_HW;MEDIUM;;./bsp_q7s/core/CoreController.h
|
||||
11700;UPDATE_FILE_NOT_EXISTS;LOW;;./bsp_q7s/devices/PlocUpdater.h
|
||||
11701;ACTION_COMMANDING_FAILED;LOW;Failed to send command to supervisor handler P1: Return value of CommandActionHelper::commandAction P2: Action ID of command to send;./bsp_q7s/devices/PlocUpdater.h
|
||||
11702;UPDATE_AVAILABLE_FAILED;LOW;Supervisor handler replied action message indicating a command execution failure of the update available command;./bsp_q7s/devices/PlocUpdater.h
|
||||
11703;UPDATE_TRANSFER_FAILED;LOW;Supervisor handler failed to transfer an update space packet. P1: Parameter holds the number of update packets already sent (inclusive the failed packet);./bsp_q7s/devices/PlocUpdater.h
|
||||
11704;UPDATE_VERIFY_FAILED;LOW;Supervisor failed to execute the update verify command.;./bsp_q7s/devices/PlocUpdater.h
|
||||
11705;UPDATE_FINISHED;INFO;MPSoC update successful completed;./bsp_q7s/devices/PlocUpdater.h
|
||||
11800;SEND_MRAM_DUMP_FAILED;LOW;Failed to send mram dump command to supervisor handler P1: Return value of commandAction function P2: Start address of MRAM to dump with this command;./bsp_q7s/devices/PlocMemoryDumper.h
|
||||
11801;MRAM_DUMP_FAILED;LOW;Received completion failure report form PLOC supervisor handler P1: MRAM start address of failing dump command;./bsp_q7s/devices/PlocMemoryDumper.h
|
||||
11802;MRAM_DUMP_FINISHED;LOW;MRAM dump finished successfully;./bsp_q7s/devices/PlocMemoryDumper.h
|
||||
11901;INVALID_TC_FRAME;HIGH;;./linux/obc/PdecHandler.h
|
||||
11902;INVALID_FAR;HIGH;Read invalid FAR from PDEC after startup;./linux/obc/PdecHandler.h
|
||||
11903;CARRIER_LOCK;INFO;Carrier lock detected;./linux/obc/PdecHandler.h
|
||||
11904;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);./linux/obc/PdecHandler.h
|
||||
12000;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;./linux/devices/startracker/StrHelper.h
|
||||
12001;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;./linux/devices/startracker/StrHelper.h
|
||||
12002;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;./linux/devices/startracker/StrHelper.h
|
||||
12003;IMAGE_DOWNLOAD_SUCCESSFUL;LOW;Image download was successful;./linux/devices/startracker/StrHelper.h
|
||||
12004;FLASH_WRITE_SUCCESSFUL;LOW;Finished flash write procedure successfully;./linux/devices/startracker/StrHelper.h
|
||||
12005;FLASH_READ_SUCCESSFUL;LOW;Finished flash read procedure successfully;./linux/devices/startracker/StrHelper.h
|
||||
12006;FLASH_READ_FAILED;LOW;Flash read procedure failed;./linux/devices/startracker/StrHelper.h
|
||||
12007;FIRMWARE_UPDATE_SUCCESSFUL;LOW;Firmware update was successful;./linux/devices/startracker/StrHelper.h
|
||||
12008;FIRMWARE_UPDATE_FAILED;LOW;Firmware update failed;./linux/devices/startracker/StrHelper.h
|
||||
12009;STR_HELPER_READING_REPLY_FAILED;LOW;Failed to read communication interface reply data P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;./linux/devices/startracker/StrHelper.h
|
||||
12010;STR_HELPER_COM_ERROR;LOW;Unexpected stop of decoding sequence P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;./linux/devices/startracker/StrHelper.h
|
||||
12011;STR_HELPER_NO_REPLY;LOW;Star tracker did not send replies (maybe device is powered off) P1: Position of upload or download packet for which no reply was sent;./linux/devices/startracker/StrHelper.h
|
||||
12012;STR_HELPER_DEC_ERROR;LOW;Error during decoding of received reply occurred P1: Return value of decoding function P2: Position of upload/download packet, or address of flash write/read request;./linux/devices/startracker/StrHelper.h
|
||||
12013;POSITION_MISMATCH;LOW;Position mismatch P1: The expected position and thus the position for which the image upload/download failed;./linux/devices/startracker/StrHelper.h
|
||||
12014;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;./linux/devices/startracker/StrHelper.h
|
||||
12015;STR_HELPER_SENDING_PACKET_FAILED;LOW;;./linux/devices/startracker/StrHelper.h
|
||||
12016;STR_HELPER_REQUESTING_MSG_FAILED;LOW;;./linux/devices/startracker/StrHelper.h
|
||||
12101;NEG_V_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;./mission/devices/PayloadPcduHandler.h
|
||||
12102;U_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;./mission/devices/PayloadPcduHandler.h
|
||||
12103;I_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;./mission/devices/PayloadPcduHandler.h
|
||||
12104;U_X8_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;./mission/devices/PayloadPcduHandler.h
|
||||
12105;I_X8_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;./mission/devices/PayloadPcduHandler.h
|
||||
12106;U_TX_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;./mission/devices/PayloadPcduHandler.h
|
||||
12107;I_TX_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;./mission/devices/PayloadPcduHandler.h
|
||||
12108;U_MPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;./mission/devices/PayloadPcduHandler.h
|
||||
12109;I_MPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;./mission/devices/PayloadPcduHandler.h
|
||||
12110;U_HPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;./mission/devices/PayloadPcduHandler.h
|
||||
12111;I_HPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;./mission/devices/PayloadPcduHandler.h
|
||||
|
|
File diff suppressed because it is too large
Load Diff
@ -2,9 +2,18 @@ import os
|
||||
import enum
|
||||
from pathlib import Path
|
||||
|
||||
PATH_VAR_ROOT = Path(os.path.abspath(os.curdir))
|
||||
ROOT_DIR = PATH_VAR_ROOT.absolute()
|
||||
OBSW_ROOT_DIR = PATH_VAR_ROOT.parent.absolute()
|
||||
|
||||
def determine_obsw_root_path() -> str:
|
||||
for _ in range(5):
|
||||
if os.path.exists("CMakeLists.txt"):
|
||||
return os.curdir
|
||||
else:
|
||||
os.chdir("..")
|
||||
|
||||
|
||||
PATH_VAR_ROOT = os.path.dirname(os.path.realpath(__file__))
|
||||
ROOT_DIR = PATH_VAR_ROOT
|
||||
OBSW_ROOT_DIR = Path(determine_obsw_root_path())
|
||||
DATABASE_NAME = "eive_mod.db"
|
||||
|
||||
|
||||
|
@ -3,12 +3,17 @@ Event exporter.
|
||||
"""
|
||||
import datetime
|
||||
import time
|
||||
import os
|
||||
|
||||
from fsfwgen.events.event_parser import handle_csv_export, handle_cpp_export, \
|
||||
SubsystemDefinitionParser, EventParser
|
||||
from fsfwgen.events.event_parser import (
|
||||
handle_csv_export,
|
||||
handle_cpp_export,
|
||||
SubsystemDefinitionParser,
|
||||
EventParser,
|
||||
)
|
||||
from fsfwgen.parserbase.file_list_parser import FileListParser
|
||||
from fsfwgen.utility.printer import PrettyPrinter
|
||||
from fsfwgen.utility.file_management import copy_file, move_file
|
||||
from fsfwgen.utility.file_management import copy_file
|
||||
from fsfwgen.core import get_console_logger
|
||||
from definitions import BspType, ROOT_DIR, OBSW_ROOT_DIR
|
||||
|
||||
@ -25,15 +30,16 @@ MOVE_CSV_FILE = True
|
||||
|
||||
PARSE_HOST_BSP = True
|
||||
|
||||
CPP_FILENAME = f'{__package__}/translateEvents.cpp'
|
||||
CPP_H_FILENAME = f'{__package__}/translateEvents.h'
|
||||
# Store these files relative to the events folder
|
||||
CPP_FILENAME = f"{os.path.dirname(os.path.realpath(__file__))}/translateEvents.cpp"
|
||||
CPP_H_FILENAME = f"{os.path.dirname(os.path.realpath(__file__))}/translateEvents.h"
|
||||
|
||||
BSP_SELECT = BspType.BSP_Q7S
|
||||
|
||||
BSP_DIR_NAME = BSP_SELECT.value
|
||||
|
||||
CSV_FILENAME = f"{BSP_SELECT.value}_events.csv"
|
||||
CSV_MOVE_DESTINATION = f'{ROOT_DIR}'
|
||||
# Store this file in the root of the generators folder
|
||||
CSV_FILENAME = f"{ROOT_DIR}/{BSP_SELECT.value}_events.csv"
|
||||
|
||||
if BSP_SELECT == BspType.BSP_Q7S or BSP_SELECT == BspType.BSP_LINUX_BOARD:
|
||||
FSFW_CONFIG_ROOT = f"{OBSW_ROOT_DIR}/linux/fsfwconfig"
|
||||
@ -47,11 +53,15 @@ FILE_SEPARATOR = ";"
|
||||
SUBSYSTEM_DEFINITION_DESTINATIONS = [
|
||||
f"{FSFW_CONFIG_ROOT}/events/subsystemIdRanges.h",
|
||||
f"{OBSW_ROOT_DIR}/fsfw/src/fsfw/events/fwSubsystemIdRanges.h",
|
||||
f"{OBSW_ROOT_DIR}/common/config/commonSubsystemIds.h"
|
||||
f"{OBSW_ROOT_DIR}/common/config/commonSubsystemIds.h",
|
||||
]
|
||||
HEADER_DEFINITION_DESTINATIONS = [
|
||||
f"{OBSW_ROOT_DIR}/mission/", f"{OBSW_ROOT_DIR}/fsfw/", f"{FSFW_CONFIG_ROOT}",
|
||||
f"{OBSW_ROOT_DIR}/test/", f"{OBSW_ROOT_DIR}/bsp_q7s", f"{OBSW_ROOT_DIR}/linux/"
|
||||
f"{OBSW_ROOT_DIR}/mission/",
|
||||
f"{OBSW_ROOT_DIR}/fsfw/",
|
||||
f"{FSFW_CONFIG_ROOT}",
|
||||
f"{OBSW_ROOT_DIR}/test/",
|
||||
f"{OBSW_ROOT_DIR}/bsp_q7s",
|
||||
f"{OBSW_ROOT_DIR}/linux/",
|
||||
]
|
||||
|
||||
|
||||
@ -73,11 +83,14 @@ def parse_events(
|
||||
)
|
||||
if generate_cpp:
|
||||
handle_cpp_export(
|
||||
event_list=event_list, date_string=DATE_STRING_FULL, file_name=CPP_FILENAME,
|
||||
generate_header=GENERATE_CPP_H, header_file_name=CPP_H_FILENAME
|
||||
event_list=event_list,
|
||||
date_string=DATE_STRING_FULL,
|
||||
file_name=CPP_FILENAME,
|
||||
generate_header=GENERATE_CPP_H,
|
||||
header_file_name=CPP_H_FILENAME,
|
||||
)
|
||||
if COPY_CPP_FILE:
|
||||
LOGGER.info(f'EventParser: Copying file to {CPP_COPY_DESTINATION}')
|
||||
LOGGER.info(f"EventParser: Copying file to {CPP_COPY_DESTINATION}")
|
||||
copy_file(CPP_FILENAME, CPP_COPY_DESTINATION)
|
||||
copy_file(CPP_H_FILENAME, CPP_COPY_DESTINATION)
|
||||
|
||||
@ -85,7 +98,7 @@ def parse_events(
|
||||
def generate_event_list() -> list:
|
||||
subsystem_parser = SubsystemDefinitionParser(SUBSYSTEM_DEFINITION_DESTINATIONS)
|
||||
subsystem_table = subsystem_parser.parse_files()
|
||||
LOGGER.info(f'Found {len(subsystem_table)} subsystem definitions.')
|
||||
LOGGER.info(f"Found {len(subsystem_table)} subsystem definitions.")
|
||||
PrettyPrinter.pprint(subsystem_table)
|
||||
event_header_parser = FileListParser(HEADER_DEFINITION_DESTINATIONS)
|
||||
event_headers = event_header_parser.parse_header_files(
|
||||
@ -94,8 +107,9 @@ def generate_event_list() -> list:
|
||||
# PrettyPrinter.pprint(event_headers)
|
||||
# myEventList = parseHeaderFiles(subsystem_table, event_headers)
|
||||
event_parser = EventParser(event_headers, subsystem_table)
|
||||
event_parser.obsw_root_path = OBSW_ROOT_DIR
|
||||
event_parser.set_moving_window_mode(moving_window_size=7)
|
||||
event_table = event_parser.parse_files()
|
||||
event_list = sorted(event_table.items())
|
||||
LOGGER.info(f'Found {len(event_list)} entries')
|
||||
LOGGER.info(f"Found {len(event_list)} entries")
|
||||
return event_list
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 139 translations.
|
||||
* @brief Auto-generated event translation file. Contains 152 translations.
|
||||
* @details
|
||||
* Generated on: 2022-02-27 15:36:42
|
||||
* Generated on: 2022-03-01 15:15:11
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -113,7 +113,9 @@ const char *SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING = "SUPV_MEMORY_READ_RPT_CRC_
|
||||
const char *SUPV_ACK_FAILURE_STRING = "SUPV_ACK_FAILURE";
|
||||
const char *SUPV_EXE_FAILURE_STRING = "SUPV_EXE_FAILURE";
|
||||
const char *SUPV_CRC_FAILURE_EVENT_STRING = "SUPV_CRC_FAILURE_EVENT";
|
||||
const char *SANITIZATION_FAILED_STRING = "SANITIZATION_FAILED";
|
||||
const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE";
|
||||
const char *REBOOT_SW_STRING = "REBOOT_SW";
|
||||
const char *REBOOT_HW_STRING = "REBOOT_HW";
|
||||
const char *UPDATE_FILE_NOT_EXISTS_STRING = "UPDATE_FILE_NOT_EXISTS";
|
||||
const char *ACTION_COMMANDING_FAILED_STRING = "ACTION_COMMANDING_FAILED";
|
||||
const char *UPDATE_AVAILABLE_FAILED_STRING = "UPDATE_AVAILABLE_FAILED";
|
||||
@ -144,287 +146,324 @@ const char *POSITION_MISMATCH_STRING = "POSITION_MISMATCH";
|
||||
const char *STR_HELPER_FILE_NOT_EXISTS_STRING = "STR_HELPER_FILE_NOT_EXISTS";
|
||||
const char *STR_HELPER_SENDING_PACKET_FAILED_STRING = "STR_HELPER_SENDING_PACKET_FAILED";
|
||||
const char *STR_HELPER_REQUESTING_MSG_FAILED_STRING = "STR_HELPER_REQUESTING_MSG_FAILED";
|
||||
const char *NEG_V_OUT_OF_BOUNDS_STRING = "NEG_V_OUT_OF_BOUNDS";
|
||||
const char *U_DRO_OUT_OF_BOUNDS_STRING = "U_DRO_OUT_OF_BOUNDS";
|
||||
const char *I_DRO_OUT_OF_BOUNDS_STRING = "I_DRO_OUT_OF_BOUNDS";
|
||||
const char *U_X8_OUT_OF_BOUNDS_STRING = "U_X8_OUT_OF_BOUNDS";
|
||||
const char *I_X8_OUT_OF_BOUNDS_STRING = "I_X8_OUT_OF_BOUNDS";
|
||||
const char *U_TX_OUT_OF_BOUNDS_STRING = "U_TX_OUT_OF_BOUNDS";
|
||||
const char *I_TX_OUT_OF_BOUNDS_STRING = "I_TX_OUT_OF_BOUNDS";
|
||||
const char *U_MPA_OUT_OF_BOUNDS_STRING = "U_MPA_OUT_OF_BOUNDS";
|
||||
const char *I_MPA_OUT_OF_BOUNDS_STRING = "I_MPA_OUT_OF_BOUNDS";
|
||||
const char *U_HPA_OUT_OF_BOUNDS_STRING = "U_HPA_OUT_OF_BOUNDS";
|
||||
const char *I_HPA_OUT_OF_BOUNDS_STRING = "I_HPA_OUT_OF_BOUNDS";
|
||||
|
||||
const char * translateEvents(Event event) {
|
||||
switch( (event & 0xffff) ) {
|
||||
case(2200):
|
||||
const char *translateEvents(Event event) {
|
||||
switch((event & 0xFFFF)) {
|
||||
case (2200):
|
||||
return STORE_SEND_WRITE_FAILED_STRING;
|
||||
case(2201):
|
||||
case (2201):
|
||||
return STORE_WRITE_FAILED_STRING;
|
||||
case(2202):
|
||||
case (2202):
|
||||
return STORE_SEND_READ_FAILED_STRING;
|
||||
case(2203):
|
||||
case (2203):
|
||||
return STORE_READ_FAILED_STRING;
|
||||
case(2204):
|
||||
case (2204):
|
||||
return UNEXPECTED_MSG_STRING;
|
||||
case(2205):
|
||||
case (2205):
|
||||
return STORING_FAILED_STRING;
|
||||
case(2206):
|
||||
case (2206):
|
||||
return TM_DUMP_FAILED_STRING;
|
||||
case(2207):
|
||||
case (2207):
|
||||
return STORE_INIT_FAILED_STRING;
|
||||
case(2208):
|
||||
case (2208):
|
||||
return STORE_INIT_EMPTY_STRING;
|
||||
case(2209):
|
||||
case (2209):
|
||||
return STORE_CONTENT_CORRUPTED_STRING;
|
||||
case(2210):
|
||||
case (2210):
|
||||
return STORE_INITIALIZE_STRING;
|
||||
case(2211):
|
||||
case (2211):
|
||||
return INIT_DONE_STRING;
|
||||
case(2212):
|
||||
case (2212):
|
||||
return DUMP_FINISHED_STRING;
|
||||
case(2213):
|
||||
case (2213):
|
||||
return DELETION_FINISHED_STRING;
|
||||
case(2214):
|
||||
case (2214):
|
||||
return DELETION_FAILED_STRING;
|
||||
case(2215):
|
||||
case (2215):
|
||||
return AUTO_CATALOGS_SENDING_FAILED_STRING;
|
||||
case(2600):
|
||||
case (2600):
|
||||
return GET_DATA_FAILED_STRING;
|
||||
case(2601):
|
||||
case (2601):
|
||||
return STORE_DATA_FAILED_STRING;
|
||||
case(2800):
|
||||
case (2800):
|
||||
return DEVICE_BUILDING_COMMAND_FAILED_STRING;
|
||||
case(2801):
|
||||
case (2801):
|
||||
return DEVICE_SENDING_COMMAND_FAILED_STRING;
|
||||
case(2802):
|
||||
case (2802):
|
||||
return DEVICE_REQUESTING_REPLY_FAILED_STRING;
|
||||
case(2803):
|
||||
case (2803):
|
||||
return DEVICE_READING_REPLY_FAILED_STRING;
|
||||
case(2804):
|
||||
case (2804):
|
||||
return DEVICE_INTERPRETING_REPLY_FAILED_STRING;
|
||||
case(2805):
|
||||
case (2805):
|
||||
return DEVICE_MISSED_REPLY_STRING;
|
||||
case(2806):
|
||||
case (2806):
|
||||
return DEVICE_UNKNOWN_REPLY_STRING;
|
||||
case(2807):
|
||||
case (2807):
|
||||
return DEVICE_UNREQUESTED_REPLY_STRING;
|
||||
case(2808):
|
||||
case (2808):
|
||||
return INVALID_DEVICE_COMMAND_STRING;
|
||||
case(2809):
|
||||
case (2809):
|
||||
return MONITORING_LIMIT_EXCEEDED_STRING;
|
||||
case(2810):
|
||||
case (2810):
|
||||
return MONITORING_AMBIGUOUS_STRING;
|
||||
case(2811):
|
||||
case (2811):
|
||||
return DEVICE_WANTS_HARD_REBOOT_STRING;
|
||||
case(4201):
|
||||
case (4201):
|
||||
return FUSE_CURRENT_HIGH_STRING;
|
||||
case(4202):
|
||||
case (4202):
|
||||
return FUSE_WENT_OFF_STRING;
|
||||
case(4204):
|
||||
case (4204):
|
||||
return POWER_ABOVE_HIGH_LIMIT_STRING;
|
||||
case(4205):
|
||||
case (4205):
|
||||
return POWER_BELOW_LOW_LIMIT_STRING;
|
||||
case(4300):
|
||||
case (4300):
|
||||
return SWITCH_WENT_OFF_STRING;
|
||||
case(5000):
|
||||
case (5000):
|
||||
return HEATER_ON_STRING;
|
||||
case(5001):
|
||||
case (5001):
|
||||
return HEATER_OFF_STRING;
|
||||
case(5002):
|
||||
case (5002):
|
||||
return HEATER_TIMEOUT_STRING;
|
||||
case(5003):
|
||||
case (5003):
|
||||
return HEATER_STAYED_ON_STRING;
|
||||
case(5004):
|
||||
case (5004):
|
||||
return HEATER_STAYED_OFF_STRING;
|
||||
case(5200):
|
||||
case (5200):
|
||||
return TEMP_SENSOR_HIGH_STRING;
|
||||
case(5201):
|
||||
case (5201):
|
||||
return TEMP_SENSOR_LOW_STRING;
|
||||
case(5202):
|
||||
case (5202):
|
||||
return TEMP_SENSOR_GRADIENT_STRING;
|
||||
case(5901):
|
||||
case (5901):
|
||||
return COMPONENT_TEMP_LOW_STRING;
|
||||
case(5902):
|
||||
case (5902):
|
||||
return COMPONENT_TEMP_HIGH_STRING;
|
||||
case(5903):
|
||||
case (5903):
|
||||
return COMPONENT_TEMP_OOL_LOW_STRING;
|
||||
case(5904):
|
||||
case (5904):
|
||||
return COMPONENT_TEMP_OOL_HIGH_STRING;
|
||||
case(5905):
|
||||
case (5905):
|
||||
return TEMP_NOT_IN_OP_RANGE_STRING;
|
||||
case(7101):
|
||||
case (7101):
|
||||
return FDIR_CHANGED_STATE_STRING;
|
||||
case(7102):
|
||||
case (7102):
|
||||
return FDIR_STARTS_RECOVERY_STRING;
|
||||
case(7103):
|
||||
case (7103):
|
||||
return FDIR_TURNS_OFF_DEVICE_STRING;
|
||||
case(7201):
|
||||
case (7201):
|
||||
return MONITOR_CHANGED_STATE_STRING;
|
||||
case(7202):
|
||||
case (7202):
|
||||
return VALUE_BELOW_LOW_LIMIT_STRING;
|
||||
case(7203):
|
||||
case (7203):
|
||||
return VALUE_ABOVE_HIGH_LIMIT_STRING;
|
||||
case(7204):
|
||||
case (7204):
|
||||
return VALUE_OUT_OF_RANGE_STRING;
|
||||
case(7400):
|
||||
case (7400):
|
||||
return CHANGING_MODE_STRING;
|
||||
case(7401):
|
||||
case (7401):
|
||||
return MODE_INFO_STRING;
|
||||
case(7402):
|
||||
case (7402):
|
||||
return FALLBACK_FAILED_STRING;
|
||||
case(7403):
|
||||
case (7403):
|
||||
return MODE_TRANSITION_FAILED_STRING;
|
||||
case(7404):
|
||||
case (7404):
|
||||
return CANT_KEEP_MODE_STRING;
|
||||
case(7405):
|
||||
case (7405):
|
||||
return OBJECT_IN_INVALID_MODE_STRING;
|
||||
case(7406):
|
||||
case (7406):
|
||||
return FORCING_MODE_STRING;
|
||||
case(7407):
|
||||
case (7407):
|
||||
return MODE_CMD_REJECTED_STRING;
|
||||
case(7506):
|
||||
case (7506):
|
||||
return HEALTH_INFO_STRING;
|
||||
case(7507):
|
||||
case (7507):
|
||||
return CHILD_CHANGED_HEALTH_STRING;
|
||||
case(7508):
|
||||
case (7508):
|
||||
return CHILD_PROBLEMS_STRING;
|
||||
case(7509):
|
||||
case (7509):
|
||||
return OVERWRITING_HEALTH_STRING;
|
||||
case(7510):
|
||||
case (7510):
|
||||
return TRYING_RECOVERY_STRING;
|
||||
case(7511):
|
||||
case (7511):
|
||||
return RECOVERY_STEP_STRING;
|
||||
case(7512):
|
||||
case (7512):
|
||||
return RECOVERY_DONE_STRING;
|
||||
case(7900):
|
||||
case (7900):
|
||||
return RF_AVAILABLE_STRING;
|
||||
case(7901):
|
||||
case (7901):
|
||||
return RF_LOST_STRING;
|
||||
case(7902):
|
||||
case (7902):
|
||||
return BIT_LOCK_STRING;
|
||||
case(7903):
|
||||
case (7903):
|
||||
return BIT_LOCK_LOST_STRING;
|
||||
case(7905):
|
||||
case (7905):
|
||||
return FRAME_PROCESSING_FAILED_STRING;
|
||||
case(8900):
|
||||
case (8900):
|
||||
return CLOCK_SET_STRING;
|
||||
case(8901):
|
||||
case (8901):
|
||||
return CLOCK_SET_FAILURE_STRING;
|
||||
case(9700):
|
||||
case (9700):
|
||||
return TEST_STRING;
|
||||
case(10600):
|
||||
case (10600):
|
||||
return CHANGE_OF_SETUP_PARAMETER_STRING;
|
||||
case(10900):
|
||||
case (10900):
|
||||
return GPIO_PULL_HIGH_FAILED_STRING;
|
||||
case(10901):
|
||||
case (10901):
|
||||
return GPIO_PULL_LOW_FAILED_STRING;
|
||||
case(10902):
|
||||
case (10902):
|
||||
return SWITCH_ALREADY_ON_STRING;
|
||||
case(10903):
|
||||
case (10903):
|
||||
return SWITCH_ALREADY_OFF_STRING;
|
||||
case(10904):
|
||||
case (10904):
|
||||
return MAIN_SWITCH_TIMEOUT_STRING;
|
||||
case(11000):
|
||||
case (11000):
|
||||
return MAIN_SWITCH_ON_TIMEOUT_STRING;
|
||||
case(11001):
|
||||
case (11001):
|
||||
return MAIN_SWITCH_OFF_TIMEOUT_STRING;
|
||||
case(11002):
|
||||
case (11002):
|
||||
return DEPLOYMENT_FAILED_STRING;
|
||||
case(11003):
|
||||
case (11003):
|
||||
return DEPL_SA1_GPIO_SWTICH_ON_FAILED_STRING;
|
||||
case(11004):
|
||||
case (11004):
|
||||
return DEPL_SA2_GPIO_SWTICH_ON_FAILED_STRING;
|
||||
case(11101):
|
||||
case (11101):
|
||||
return MEMORY_READ_RPT_CRC_FAILURE_STRING;
|
||||
case(11102):
|
||||
case (11102):
|
||||
return ACK_FAILURE_STRING;
|
||||
case(11103):
|
||||
case (11103):
|
||||
return EXE_FAILURE_STRING;
|
||||
case(11104):
|
||||
case (11104):
|
||||
return CRC_FAILURE_EVENT_STRING;
|
||||
case(11201):
|
||||
case (11201):
|
||||
return SELF_TEST_I2C_FAILURE_STRING;
|
||||
case(11202):
|
||||
case (11202):
|
||||
return SELF_TEST_SPI_FAILURE_STRING;
|
||||
case(11203):
|
||||
case (11203):
|
||||
return SELF_TEST_ADC_FAILURE_STRING;
|
||||
case(11204):
|
||||
case (11204):
|
||||
return SELF_TEST_PWM_FAILURE_STRING;
|
||||
case(11205):
|
||||
case (11205):
|
||||
return SELF_TEST_TC_FAILURE_STRING;
|
||||
case(11206):
|
||||
case (11206):
|
||||
return SELF_TEST_MTM_RANGE_FAILURE_STRING;
|
||||
case(11207):
|
||||
case (11207):
|
||||
return SELF_TEST_COIL_CURRENT_FAILURE_STRING;
|
||||
case(11208):
|
||||
case (11208):
|
||||
return INVALID_ERROR_BYTE_STRING;
|
||||
case(11301):
|
||||
case (11301):
|
||||
return ERROR_STATE_STRING;
|
||||
case(11401):
|
||||
case (11401):
|
||||
return BOOTING_FIRMWARE_FAILED_STRING;
|
||||
case(11402):
|
||||
case (11402):
|
||||
return BOOTING_BOOTLOADER_FAILED_STRING;
|
||||
case(11501):
|
||||
case (11501):
|
||||
return SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING;
|
||||
case(11502):
|
||||
case (11502):
|
||||
return SUPV_ACK_FAILURE_STRING;
|
||||
case(11503):
|
||||
case (11503):
|
||||
return SUPV_EXE_FAILURE_STRING;
|
||||
case(11504):
|
||||
case (11504):
|
||||
return SUPV_CRC_FAILURE_EVENT_STRING;
|
||||
case(11600):
|
||||
return SANITIZATION_FAILED_STRING;
|
||||
case(11700):
|
||||
case (11600):
|
||||
return ALLOC_FAILURE_STRING;
|
||||
case (11601):
|
||||
return REBOOT_SW_STRING;
|
||||
case (11603):
|
||||
return REBOOT_HW_STRING;
|
||||
case (11700):
|
||||
return UPDATE_FILE_NOT_EXISTS_STRING;
|
||||
case(11701):
|
||||
case (11701):
|
||||
return ACTION_COMMANDING_FAILED_STRING;
|
||||
case(11702):
|
||||
case (11702):
|
||||
return UPDATE_AVAILABLE_FAILED_STRING;
|
||||
case(11703):
|
||||
case (11703):
|
||||
return UPDATE_TRANSFER_FAILED_STRING;
|
||||
case(11704):
|
||||
case (11704):
|
||||
return UPDATE_VERIFY_FAILED_STRING;
|
||||
case(11705):
|
||||
case (11705):
|
||||
return UPDATE_FINISHED_STRING;
|
||||
case(11800):
|
||||
case (11800):
|
||||
return SEND_MRAM_DUMP_FAILED_STRING;
|
||||
case(11801):
|
||||
case (11801):
|
||||
return MRAM_DUMP_FAILED_STRING;
|
||||
case(11802):
|
||||
case (11802):
|
||||
return MRAM_DUMP_FINISHED_STRING;
|
||||
case(11901):
|
||||
case (11901):
|
||||
return INVALID_TC_FRAME_STRING;
|
||||
case(11902):
|
||||
case (11902):
|
||||
return INVALID_FAR_STRING;
|
||||
case(11903):
|
||||
case (11903):
|
||||
return CARRIER_LOCK_STRING;
|
||||
case(11904):
|
||||
case (11904):
|
||||
return BIT_LOCK_PDEC_STRING;
|
||||
case(12000):
|
||||
case (12000):
|
||||
return IMAGE_UPLOAD_FAILED_STRING;
|
||||
case(12001):
|
||||
case (12001):
|
||||
return IMAGE_DOWNLOAD_FAILED_STRING;
|
||||
case(12002):
|
||||
case (12002):
|
||||
return IMAGE_UPLOAD_SUCCESSFUL_STRING;
|
||||
case(12003):
|
||||
case (12003):
|
||||
return IMAGE_DOWNLOAD_SUCCESSFUL_STRING;
|
||||
case(12004):
|
||||
case (12004):
|
||||
return FLASH_WRITE_SUCCESSFUL_STRING;
|
||||
case(12005):
|
||||
case (12005):
|
||||
return FLASH_READ_SUCCESSFUL_STRING;
|
||||
case(12006):
|
||||
case (12006):
|
||||
return FLASH_READ_FAILED_STRING;
|
||||
case(12007):
|
||||
case (12007):
|
||||
return FIRMWARE_UPDATE_SUCCESSFUL_STRING;
|
||||
case(12008):
|
||||
case (12008):
|
||||
return FIRMWARE_UPDATE_FAILED_STRING;
|
||||
case(12009):
|
||||
case (12009):
|
||||
return STR_HELPER_READING_REPLY_FAILED_STRING;
|
||||
case(12010):
|
||||
case (12010):
|
||||
return STR_HELPER_COM_ERROR_STRING;
|
||||
case(12011):
|
||||
case (12011):
|
||||
return STR_HELPER_NO_REPLY_STRING;
|
||||
case(12012):
|
||||
case (12012):
|
||||
return STR_HELPER_DEC_ERROR_STRING;
|
||||
case(12013):
|
||||
case (12013):
|
||||
return POSITION_MISMATCH_STRING;
|
||||
case(12014):
|
||||
case (12014):
|
||||
return STR_HELPER_FILE_NOT_EXISTS_STRING;
|
||||
case(12015):
|
||||
case (12015):
|
||||
return STR_HELPER_SENDING_PACKET_FAILED_STRING;
|
||||
case(12016):
|
||||
case (12016):
|
||||
return STR_HELPER_REQUESTING_MSG_FAILED_STRING;
|
||||
case (12101):
|
||||
return NEG_V_OUT_OF_BOUNDS_STRING;
|
||||
case (12102):
|
||||
return U_DRO_OUT_OF_BOUNDS_STRING;
|
||||
case (12103):
|
||||
return I_DRO_OUT_OF_BOUNDS_STRING;
|
||||
case (12104):
|
||||
return U_X8_OUT_OF_BOUNDS_STRING;
|
||||
case (12105):
|
||||
return I_X8_OUT_OF_BOUNDS_STRING;
|
||||
case (12106):
|
||||
return U_TX_OUT_OF_BOUNDS_STRING;
|
||||
case (12107):
|
||||
return I_TX_OUT_OF_BOUNDS_STRING;
|
||||
case (12108):
|
||||
return U_MPA_OUT_OF_BOUNDS_STRING;
|
||||
case (12109):
|
||||
return I_MPA_OUT_OF_BOUNDS_STRING;
|
||||
case (12110):
|
||||
return U_HPA_OUT_OF_BOUNDS_STRING;
|
||||
case (12111):
|
||||
return I_HPA_OUT_OF_BOUNDS_STRING;
|
||||
default:
|
||||
return "UNKNOWN_EVENT";
|
||||
}
|
||||
|
@ -3,6 +3,6 @@
|
||||
|
||||
#include "fsfw/events/Event.h"
|
||||
|
||||
const char * translateEvents(Event event);
|
||||
const char *translateEvents(Event event);
|
||||
|
||||
#endif /* FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ */
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 636670f7a0075533974ca0a668efa9b623a52749
|
||||
Subproject commit bd76760052482f6f8fcdd84b88da963e61c9a48c
|
@ -4,26 +4,31 @@ import time
|
||||
from objects.objects import parse_objects
|
||||
from events.event_parser import parse_events
|
||||
from returnvalues.returnvalues_parser import parse_returnvalues
|
||||
from fsfwgen.core import return_generic_args_parser, init_printout, get_console_logger, ParserTypes
|
||||
from fsfwgen.core import (
|
||||
return_generic_args_parser,
|
||||
init_printout,
|
||||
get_console_logger,
|
||||
ParserTypes,
|
||||
)
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
def main():
|
||||
init_printout(project_string='EIVE')
|
||||
init_printout(project_string="EIVE")
|
||||
parser = return_generic_args_parser()
|
||||
args = parser.parse_args()
|
||||
if args.type == 'objects':
|
||||
LOGGER.info(f'Generating objects data..')
|
||||
if args.type == "objects":
|
||||
LOGGER.info(f"Generating objects data..")
|
||||
time.sleep(0.05)
|
||||
parse_objects()
|
||||
elif args.type == 'events':
|
||||
LOGGER.info(f'Generating event data')
|
||||
elif args.type == "events":
|
||||
LOGGER.info(f"Generating event data")
|
||||
time.sleep(0.05)
|
||||
parse_events()
|
||||
elif args.type == 'returnvalues':
|
||||
LOGGER.info('Generating returnvalue data')
|
||||
elif args.type == "returnvalues":
|
||||
LOGGER.info("Generating returnvalue data")
|
||||
time.sleep(0.05)
|
||||
parse_returnvalues()
|
||||
pass
|
||||
|
@ -2,13 +2,18 @@
|
||||
Object exporter.
|
||||
"""
|
||||
import datetime
|
||||
import os
|
||||
|
||||
from fsfwgen.core import get_console_logger
|
||||
from fsfwgen.objects.objects import sql_object_exporter, ObjectDefinitionParser, \
|
||||
write_translation_file, \
|
||||
export_object_file, write_translation_header_file
|
||||
from fsfwgen.objects.objects import (
|
||||
sql_object_exporter,
|
||||
ObjectDefinitionParser,
|
||||
write_translation_file,
|
||||
export_object_file,
|
||||
write_translation_header_file,
|
||||
)
|
||||
from fsfwgen.utility.printer import PrettyPrinter
|
||||
from fsfwgen.utility.file_management import copy_file, move_file
|
||||
from fsfwgen.utility.file_management import copy_file
|
||||
|
||||
from definitions import BspType, DATABASE_NAME, OBSW_ROOT_DIR, ROOT_DIR
|
||||
|
||||
@ -34,16 +39,17 @@ else:
|
||||
EXPORT_TO_SQL = True
|
||||
|
||||
CPP_COPY_DESTINATION = f"{FSFW_CONFIG_ROOT}/objects/"
|
||||
CSV_MOVE_DESTINATION = f"{ROOT_DIR}"
|
||||
CPP_FILENAME = f'{__package__}/translateObjects.cpp'
|
||||
CPP_H_FILENAME = f'{__package__}/translateObjects.h'
|
||||
CSV_OBJECT_FILENAME = f"{BSP_SELECT.value}_objects.csv"
|
||||
CPP_FILENAME = f"{os.path.dirname(os.path.realpath(__file__))}//translateObjects.cpp"
|
||||
CPP_H_FILENAME = f"{os.path.dirname(os.path.realpath(__file__))}//translateObjects.h"
|
||||
CSV_OBJECT_FILENAME = f"{ROOT_DIR}/{BSP_SELECT.value}_objects.csv"
|
||||
FILE_SEPARATOR = ";"
|
||||
|
||||
|
||||
OBJECTS_PATH = f"{FSFW_CONFIG_ROOT}/objects/systemObjectList.h"
|
||||
FRAMEWORK_OBJECT_PATH = f'{OBSW_ROOT_DIR}/fsfw/src/fsfw/objectmanager/frameworkObjects.h'
|
||||
COMMON_OBJECTS_PATH = f'{OBSW_ROOT_DIR}/common/config/commonObjects.h'
|
||||
FRAMEWORK_OBJECT_PATH = (
|
||||
f"{OBSW_ROOT_DIR}/fsfw/src/fsfw/objectmanager/frameworkObjects.h"
|
||||
)
|
||||
COMMON_OBJECTS_PATH = f"{OBSW_ROOT_DIR}/common/config/commonObjects.h"
|
||||
OBJECTS_DEFINITIONS = [OBJECTS_PATH, FRAMEWORK_OBJECT_PATH, COMMON_OBJECTS_PATH]
|
||||
|
||||
SQL_DELETE_OBJECTS_CMD = """
|
||||
@ -70,35 +76,41 @@ def parse_objects(print_object_list: bool = True):
|
||||
subsystem_definitions = object_parser.parse_files()
|
||||
# id_subsystem_definitions.update(framework_subsystem_definitions)
|
||||
list_items = sorted(subsystem_definitions.items())
|
||||
LOGGER.info(f'ObjectParser: Number of objects: {len(list_items)}')
|
||||
LOGGER.info(f"ObjectParser: Number of objects: {len(list_items)}")
|
||||
|
||||
if print_object_list:
|
||||
PrettyPrinter.pprint(list_items)
|
||||
|
||||
handle_file_export(list_items)
|
||||
if EXPORT_TO_SQL:
|
||||
LOGGER.info('ObjectParser: Exporting to SQL')
|
||||
LOGGER.info("ObjectParser: Exporting to SQL")
|
||||
sql_object_exporter(
|
||||
object_table=list_items, delete_cmd=SQL_DELETE_OBJECTS_CMD,
|
||||
object_table=list_items,
|
||||
delete_cmd=SQL_DELETE_OBJECTS_CMD,
|
||||
insert_cmd=SQL_INSERT_INTO_OBJECTS_CMD,
|
||||
create_cmd=SQL_CREATE_OBJECTS_CMD, db_filename=f"{ROOT_DIR}/{DATABASE_NAME}"
|
||||
create_cmd=SQL_CREATE_OBJECTS_CMD,
|
||||
db_filename=f"{ROOT_DIR}/{DATABASE_NAME}",
|
||||
)
|
||||
|
||||
|
||||
def handle_file_export(list_items):
|
||||
if GENERATE_CPP:
|
||||
LOGGER.info('ObjectParser: Generating translation C++ file')
|
||||
LOGGER.info("ObjectParser: Generating C++ translation file")
|
||||
write_translation_file(
|
||||
filename=CPP_FILENAME, list_of_entries=list_items, date_string_full=DATE_STRING_FULL
|
||||
filename=CPP_FILENAME,
|
||||
list_of_entries=list_items,
|
||||
date_string_full=DATE_STRING_FULL,
|
||||
)
|
||||
if COPY_CPP:
|
||||
print("ObjectParser: Copying object file to " + CPP_COPY_DESTINATION)
|
||||
LOGGER.info("ObjectParser: Copying object file to " + CPP_COPY_DESTINATION)
|
||||
copy_file(CPP_FILENAME, CPP_COPY_DESTINATION)
|
||||
if GENERATE_HEADER:
|
||||
write_translation_header_file(filename=CPP_H_FILENAME)
|
||||
copy_file(filename=CPP_H_FILENAME, destination=CPP_COPY_DESTINATION)
|
||||
if GENERATE_CSV:
|
||||
print("ObjectParser: Generating text export.")
|
||||
LOGGER.info("ObjectParser: Generating text export")
|
||||
export_object_file(
|
||||
filename=CSV_OBJECT_FILENAME, object_list=list_items, file_separator=FILE_SEPARATOR
|
||||
filename=CSV_OBJECT_FILENAME,
|
||||
object_list=list_items,
|
||||
file_separator=FILE_SEPARATOR,
|
||||
)
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 112 translations.
|
||||
* Generated on: 2022-02-27 15:36:48
|
||||
* Generated on: 2022-03-01 15:15:27
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
@ -119,8 +119,8 @@ const char *TM_FUNNEL_STRING = "TM_FUNNEL";
|
||||
const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE";
|
||||
const char *NO_OBJECT_STRING = "NO_OBJECT";
|
||||
|
||||
const char* translateObject(object_id_t object) {
|
||||
switch( (object & 0xFFFFFFFF) ) {
|
||||
const char *translateObject(object_id_t object) {
|
||||
switch ((object & 0xFFFFFFFF)) {
|
||||
case 0x00005060:
|
||||
return P60DOCK_TEST_TASK_STRING;
|
||||
case 0x43000003:
|
||||
|
@ -3,6 +3,6 @@
|
||||
|
||||
#include <fsfw/objectmanager/SystemObjectIF.h>
|
||||
|
||||
const char* translateObject(object_id_t object);
|
||||
const char *translateObject(object_id_t object);
|
||||
|
||||
#endif /* FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ */
|
||||
|
@ -24,33 +24,34 @@ EXPORT_TO_SQL = True
|
||||
PRINT_TABLES = True
|
||||
|
||||
|
||||
FILE_SEPARATOR = ';'
|
||||
FILE_SEPARATOR = ";"
|
||||
MAX_STRING_LENGTH = 32
|
||||
|
||||
BSP_SELECT = BspType.BSP_Q7S
|
||||
BSP_DIR_NAME = BSP_SELECT.value
|
||||
CSV_RETVAL_FILENAME = f'{BSP_SELECT.value}_returnvalues.csv'
|
||||
CSV_MOVE_DESTINATION = f'{ROOT_DIR}'
|
||||
CSV_RETVAL_FILENAME = f"{ROOT_DIR}/{BSP_SELECT.value}_returnvalues.csv"
|
||||
ADD_LINUX_FOLDER = False
|
||||
|
||||
if BSP_SELECT == BspType.BSP_Q7S or BSP_SELECT == BspType.BSP_LINUX_BOARD:
|
||||
FSFW_CONFIG_ROOT = f'{OBSW_ROOT_DIR}/linux/fsfwconfig'
|
||||
FSFW_CONFIG_ROOT = f"{OBSW_ROOT_DIR}/linux/fsfwconfig"
|
||||
ADD_LINUX_FOLDER = True
|
||||
else:
|
||||
FSFW_CONFIG_ROOT = f'{OBSW_ROOT_DIR}/{BSP_DIR_NAME}/fsfwconfig'
|
||||
FSFW_CONFIG_ROOT = f"{OBSW_ROOT_DIR}/{BSP_DIR_NAME}/fsfwconfig"
|
||||
BSP_PATH = f"{OBSW_ROOT_DIR}/{BSP_DIR_NAME}"
|
||||
|
||||
INTERFACE_DEFINITION_FILES = [
|
||||
f'{OBSW_ROOT_DIR}/fsfw/src/fsfw/returnvalues/FwClassIds.h',
|
||||
f'{OBSW_ROOT_DIR}/common/config/commonClassIds.h',
|
||||
f'{FSFW_CONFIG_ROOT}/returnvalues/classIds.h'
|
||||
f"{OBSW_ROOT_DIR}/fsfw/src/fsfw/returnvalues/FwClassIds.h",
|
||||
f"{OBSW_ROOT_DIR}/common/config/commonClassIds.h",
|
||||
f"{FSFW_CONFIG_ROOT}/returnvalues/classIds.h",
|
||||
]
|
||||
RETURNVALUE_SOURCES = [
|
||||
f'{OBSW_ROOT_DIR}/mission/', f'{OBSW_ROOT_DIR}/fsfw/', f'{BSP_PATH}'
|
||||
f"{OBSW_ROOT_DIR}/mission/",
|
||||
f"{OBSW_ROOT_DIR}/fsfw/",
|
||||
f"{BSP_PATH}",
|
||||
]
|
||||
|
||||
if ADD_LINUX_FOLDER:
|
||||
RETURNVALUE_SOURCES.append(f'{OBSW_ROOT_DIR}/linux')
|
||||
RETURNVALUE_SOURCES.append(f"{OBSW_ROOT_DIR}/linux")
|
||||
|
||||
SQL_DELETE_RETURNVALUES_CMD = """
|
||||
DROP TABLE IF EXISTS Returnvalues
|
||||
@ -76,16 +77,20 @@ VALUES(?,?,?,?,?)
|
||||
def parse_returnvalues():
|
||||
returnvalue_table = generate_returnvalue_table()
|
||||
if EXPORT_TO_FILE:
|
||||
ReturnValueParser.export_to_file(CSV_RETVAL_FILENAME, returnvalue_table, FILE_SEPARATOR)
|
||||
ReturnValueParser.export_to_file(
|
||||
CSV_RETVAL_FILENAME, returnvalue_table, FILE_SEPARATOR
|
||||
)
|
||||
# if MOVE_CSV_FILE:
|
||||
# move_file(file_name=CSV_RETVAL_FILENAME, destination=CSV_MOVE_DESTINATION)
|
||||
if EXPORT_TO_SQL:
|
||||
LOGGER.info('ReturnvalueParser: Exporting to SQL')
|
||||
sql_retval_exporter(returnvalue_table, db_filename=f"{ROOT_DIR}/{DATABASE_NAME}")
|
||||
LOGGER.info("ReturnvalueParser: Exporting to SQL")
|
||||
sql_retval_exporter(
|
||||
returnvalue_table, db_filename=f"{ROOT_DIR}/{DATABASE_NAME}"
|
||||
)
|
||||
|
||||
|
||||
def generate_returnvalue_table():
|
||||
""" Core function to parse for the return values """
|
||||
"""Core function to parse for the return values"""
|
||||
interface_parser = InterfaceParser(
|
||||
file_list=INTERFACE_DEFINITION_FILES, print_table=PRINT_TABLES
|
||||
)
|
||||
@ -104,10 +109,8 @@ def sql_retval_exporter(returnvalue_table, db_filename: str):
|
||||
sql_writer.open(SQL_CREATE_RETURNVALUES_CMD)
|
||||
for entry in returnvalue_table.items():
|
||||
sql_writer.write_entries(
|
||||
SQL_INSERT_RETURNVALUES_CMD, (entry[0],
|
||||
entry[1][2],
|
||||
entry[1][4],
|
||||
entry[1][3],
|
||||
entry[1][1]))
|
||||
SQL_INSERT_RETURNVALUES_CMD,
|
||||
(entry[0], entry[1][2], entry[1][4], entry[1][3], entry[1][1]),
|
||||
)
|
||||
sql_writer.commit()
|
||||
sql_writer.close()
|
||||
|
@ -1,5 +1,7 @@
|
||||
target_sources(${OBSW_NAME} PRIVATE
|
||||
if(EIVE_BUILD_GPSD_GPS_HANDLER)
|
||||
target_sources(${OBSW_NAME} PRIVATE
|
||||
GPSHyperionLinuxController.cpp
|
||||
)
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectory(startracker)
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 139 translations.
|
||||
* @brief Auto-generated event translation file. Contains 152 translations.
|
||||
* @details
|
||||
* Generated on: 2022-02-27 15:36:42
|
||||
* Generated on: 2022-03-01 15:15:11
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -113,7 +113,9 @@ const char *SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING = "SUPV_MEMORY_READ_RPT_CRC_
|
||||
const char *SUPV_ACK_FAILURE_STRING = "SUPV_ACK_FAILURE";
|
||||
const char *SUPV_EXE_FAILURE_STRING = "SUPV_EXE_FAILURE";
|
||||
const char *SUPV_CRC_FAILURE_EVENT_STRING = "SUPV_CRC_FAILURE_EVENT";
|
||||
const char *SANITIZATION_FAILED_STRING = "SANITIZATION_FAILED";
|
||||
const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE";
|
||||
const char *REBOOT_SW_STRING = "REBOOT_SW";
|
||||
const char *REBOOT_HW_STRING = "REBOOT_HW";
|
||||
const char *UPDATE_FILE_NOT_EXISTS_STRING = "UPDATE_FILE_NOT_EXISTS";
|
||||
const char *ACTION_COMMANDING_FAILED_STRING = "ACTION_COMMANDING_FAILED";
|
||||
const char *UPDATE_AVAILABLE_FAILED_STRING = "UPDATE_AVAILABLE_FAILED";
|
||||
@ -144,9 +146,20 @@ const char *POSITION_MISMATCH_STRING = "POSITION_MISMATCH";
|
||||
const char *STR_HELPER_FILE_NOT_EXISTS_STRING = "STR_HELPER_FILE_NOT_EXISTS";
|
||||
const char *STR_HELPER_SENDING_PACKET_FAILED_STRING = "STR_HELPER_SENDING_PACKET_FAILED";
|
||||
const char *STR_HELPER_REQUESTING_MSG_FAILED_STRING = "STR_HELPER_REQUESTING_MSG_FAILED";
|
||||
const char *NEG_V_OUT_OF_BOUNDS_STRING = "NEG_V_OUT_OF_BOUNDS";
|
||||
const char *U_DRO_OUT_OF_BOUNDS_STRING = "U_DRO_OUT_OF_BOUNDS";
|
||||
const char *I_DRO_OUT_OF_BOUNDS_STRING = "I_DRO_OUT_OF_BOUNDS";
|
||||
const char *U_X8_OUT_OF_BOUNDS_STRING = "U_X8_OUT_OF_BOUNDS";
|
||||
const char *I_X8_OUT_OF_BOUNDS_STRING = "I_X8_OUT_OF_BOUNDS";
|
||||
const char *U_TX_OUT_OF_BOUNDS_STRING = "U_TX_OUT_OF_BOUNDS";
|
||||
const char *I_TX_OUT_OF_BOUNDS_STRING = "I_TX_OUT_OF_BOUNDS";
|
||||
const char *U_MPA_OUT_OF_BOUNDS_STRING = "U_MPA_OUT_OF_BOUNDS";
|
||||
const char *I_MPA_OUT_OF_BOUNDS_STRING = "I_MPA_OUT_OF_BOUNDS";
|
||||
const char *U_HPA_OUT_OF_BOUNDS_STRING = "U_HPA_OUT_OF_BOUNDS";
|
||||
const char *I_HPA_OUT_OF_BOUNDS_STRING = "I_HPA_OUT_OF_BOUNDS";
|
||||
|
||||
const char *translateEvents(Event event) {
|
||||
switch ((event & 0xffff)) {
|
||||
switch((event & 0xFFFF)) {
|
||||
case (2200):
|
||||
return STORE_SEND_WRITE_FAILED_STRING;
|
||||
case (2201):
|
||||
@ -364,7 +377,11 @@ const char *translateEvents(Event event) {
|
||||
case (11504):
|
||||
return SUPV_CRC_FAILURE_EVENT_STRING;
|
||||
case (11600):
|
||||
return SANITIZATION_FAILED_STRING;
|
||||
return ALLOC_FAILURE_STRING;
|
||||
case (11601):
|
||||
return REBOOT_SW_STRING;
|
||||
case (11603):
|
||||
return REBOOT_HW_STRING;
|
||||
case (11700):
|
||||
return UPDATE_FILE_NOT_EXISTS_STRING;
|
||||
case (11701):
|
||||
@ -425,6 +442,28 @@ const char *translateEvents(Event event) {
|
||||
return STR_HELPER_SENDING_PACKET_FAILED_STRING;
|
||||
case (12016):
|
||||
return STR_HELPER_REQUESTING_MSG_FAILED_STRING;
|
||||
case (12101):
|
||||
return NEG_V_OUT_OF_BOUNDS_STRING;
|
||||
case (12102):
|
||||
return U_DRO_OUT_OF_BOUNDS_STRING;
|
||||
case (12103):
|
||||
return I_DRO_OUT_OF_BOUNDS_STRING;
|
||||
case (12104):
|
||||
return U_X8_OUT_OF_BOUNDS_STRING;
|
||||
case (12105):
|
||||
return I_X8_OUT_OF_BOUNDS_STRING;
|
||||
case (12106):
|
||||
return U_TX_OUT_OF_BOUNDS_STRING;
|
||||
case (12107):
|
||||
return I_TX_OUT_OF_BOUNDS_STRING;
|
||||
case (12108):
|
||||
return U_MPA_OUT_OF_BOUNDS_STRING;
|
||||
case (12109):
|
||||
return I_MPA_OUT_OF_BOUNDS_STRING;
|
||||
case (12110):
|
||||
return U_HPA_OUT_OF_BOUNDS_STRING;
|
||||
case (12111):
|
||||
return I_HPA_OUT_OF_BOUNDS_STRING;
|
||||
default:
|
||||
return "UNKNOWN_EVENT";
|
||||
}
|
||||
|
@ -3,6 +3,6 @@
|
||||
|
||||
#include "fsfw/events/Event.h"
|
||||
|
||||
const char* translateEvents(Event event);
|
||||
const char *translateEvents(Event event);
|
||||
|
||||
#endif /* FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ */
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 112 translations.
|
||||
* Generated on: 2022-02-27 15:36:48
|
||||
* Generated on: 2022-03-01 15:15:27
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -3,6 +3,6 @@
|
||||
|
||||
#include <fsfw/objectmanager/SystemObjectIF.h>
|
||||
|
||||
const char* translateObject(object_id_t object);
|
||||
const char *translateObject(object_id_t object);
|
||||
|
||||
#endif /* FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ */
|
||||
|
@ -24,6 +24,13 @@ ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence) {
|
||||
ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
static_cast<void>(length);
|
||||
#if OBSW_ADD_PL_PCDU == 1
|
||||
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
#endif
|
||||
#if OBSW_ADD_TMP_DEVICES == 1
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
|
@ -24,7 +24,9 @@ PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId,
|
||||
uioRamMemory(uioRamMemory),
|
||||
uioRegisters(uioRegisters),
|
||||
actionHelper(this, nullptr) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
||||
auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(
|
||||
QUEUE_SIZE, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
||||
}
|
||||
|
||||
PdecHandler::~PdecHandler() {}
|
||||
|
@ -17,5 +17,6 @@ target_sources(${LIB_EIVE_MISSION} PRIVATE
|
||||
RwHandler.cpp
|
||||
max1227.cpp
|
||||
SusHandler.cpp
|
||||
PayloadPcduHandler.cpp
|
||||
SolarArrayDeploymentHandler.cpp
|
||||
)
|
||||
|
@ -12,8 +12,9 @@ PCDUHandler::PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize)
|
||||
pdu2HkTableDataset(this),
|
||||
pdu1HkTableDataset(this),
|
||||
cmdQueueSize(cmdQueueSize) {
|
||||
auto mqArgs = MqArgs(setObjectId, static_cast<void*>(this));
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(
|
||||
cmdQueueSize, MessageQueueMessage::MAX_MESSAGE_SIZE);
|
||||
cmdQueueSize, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
||||
}
|
||||
|
||||
PCDUHandler::~PCDUHandler() {}
|
||||
|
688
mission/devices/PayloadPcduHandler.cpp
Normal file
688
mission/devices/PayloadPcduHandler.cpp
Normal file
@ -0,0 +1,688 @@
|
||||
#include "PayloadPcduHandler.h"
|
||||
|
||||
#include <fsfw/src/fsfw/datapool/PoolReadGuard.h>
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
#include <fsfw_hal/linux/UnixFileGuard.h>
|
||||
#include <fsfw_hal/linux/spi/SpiComIF.h>
|
||||
#include <fsfw_hal/linux/spi/SpiCookie.h>
|
||||
#include <fsfw_hal/linux/utility.h>
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include "devices/gpioIds.h"
|
||||
|
||||
PayloadPcduHandler::PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie,
|
||||
GpioIF* gpioIF, SdCardMountedIF* sdcMan,
|
||||
bool periodicPrintout)
|
||||
: DeviceHandlerBase(objectId, comIF, cookie),
|
||||
adcSet(this),
|
||||
periodicPrintout(periodicPrintout),
|
||||
gpioIF(gpioIF),
|
||||
sdcMan(sdcMan) {}
|
||||
|
||||
void PayloadPcduHandler::doStartUp() {
|
||||
if ((state != States::PCDU_OFF) and (state != States::ON_TRANS_SSR)) {
|
||||
// Config error
|
||||
sif::error << "PayloadPcduHandler::doStartUp: Invalid state" << std::endl;
|
||||
}
|
||||
if (state == States::PCDU_OFF) {
|
||||
// Switch on relays here
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT0);
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT1);
|
||||
state = States::ON_TRANS_SSR;
|
||||
transitionOk = true;
|
||||
}
|
||||
if (state == States::ON_TRANS_SSR) {
|
||||
// If necessary, check whether a certain amount of time has elapsed
|
||||
if (transitionOk) {
|
||||
transitionOk = false;
|
||||
state = States::ON_TRANS_ADC_CLOSE_ZERO;
|
||||
// We are now in ON mode
|
||||
startTransition(MODE_NORMAL, 0);
|
||||
adcCountdown.setTimeout(50);
|
||||
adcCountdown.resetTimer();
|
||||
adcState = AdcStates::BOOT_DELAY;
|
||||
// The ADC can now be read. If the values are not close to zero, we should not allow
|
||||
// transition
|
||||
monMode = MonitoringMode::CLOSE_TO_ZERO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::stateMachineToNormal() {
|
||||
using namespace plpcdu;
|
||||
if (adcState == AdcStates::BOOT_DELAY) {
|
||||
if (adcCountdown.hasTimedOut()) {
|
||||
adcState = AdcStates::SEND_SETUP;
|
||||
adcCmdExecuted = false;
|
||||
}
|
||||
}
|
||||
if (adcState == AdcStates::SEND_SETUP) {
|
||||
if (adcCmdExecuted) {
|
||||
adcState = AdcStates::NORMAL;
|
||||
setMode(MODE_NORMAL, NORMAL_ADC_ONLY);
|
||||
adcCountdown.setTimeout(100);
|
||||
adcCountdown.resetTimer();
|
||||
adcCmdExecuted = false;
|
||||
}
|
||||
}
|
||||
if (submode == plpcdu::NORMAL_ALL_ON) {
|
||||
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
|
||||
if (not commandExecuted) {
|
||||
float waitTime = SSR_TO_DRO_WAIT_TIME;
|
||||
params.getValue(PlPcduParameter::SSR_TO_DRO_WAIT_TIME_K, waitTime);
|
||||
countdown.setTimeout(std::round(waitTime * 1000));
|
||||
countdown.resetTimer();
|
||||
commandExecuted = true;
|
||||
// TODO: For now, skip ADC check
|
||||
transitionOk = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_DRO;
|
||||
// Now start monitoring for negative voltages instead
|
||||
monMode = MonitoringMode::NEGATIVE;
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
if (state == States::ON_TRANS_DRO) {
|
||||
if (not commandExecuted) {
|
||||
float waitTime = DRO_TO_X8_WAIT_TIME;
|
||||
params.getValue(PlPcduParameter::DRO_TO_X8_WAIT_TIME_K, waitTime);
|
||||
countdown.setTimeout(std::round(waitTime * 1000));
|
||||
countdown.resetTimer();
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "Enabling PL PCDU DRO module" << std::endl;
|
||||
#endif
|
||||
// Switch on DRO and start monitoring for negative voltages
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_DRO);
|
||||
adcCountdown.setTimeout(100);
|
||||
adcCountdown.resetTimer();
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_X8;
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
if (state == States::ON_TRANS_X8) {
|
||||
if (not commandExecuted) {
|
||||
float waitTime = X8_TO_TX_WAIT_TIME;
|
||||
params.getValue(PlPcduParameter::X8_TO_TX_WAIT_TIME_K, waitTime);
|
||||
countdown.setTimeout(std::round(waitTime * 1000));
|
||||
countdown.resetTimer();
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "Enabling PL PCDU X8 module" << std::endl;
|
||||
#endif
|
||||
// Switch on X8
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_X8);
|
||||
adcCountdown.setTimeout(100);
|
||||
adcCountdown.resetTimer();
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_TX;
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
if (state == States::ON_TRANS_TX) {
|
||||
if (not commandExecuted) {
|
||||
float waitTime = TX_TO_MPA_WAIT_TIME;
|
||||
params.getValue(PlPcduParameter::TX_TO_MPA_WAIT_TIME_K, waitTime);
|
||||
countdown.setTimeout(std::round(waitTime * 1000));
|
||||
countdown.resetTimer();
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "Enabling PL PCDU TX module" << std::endl;
|
||||
#endif
|
||||
// Switch on TX
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_TX);
|
||||
// Wait for 100 ms before checking ADC values
|
||||
adcCountdown.setTimeout(100);
|
||||
adcCountdown.resetTimer();
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_MPA;
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
if (state == States::ON_TRANS_MPA) {
|
||||
if (not commandExecuted) {
|
||||
float waitTime = MPA_TO_HPA_WAIT_TIME;
|
||||
params.getValue(PlPcduParameter::MPA_TO_HPA_WAIT_TIME_K, waitTime);
|
||||
countdown.setTimeout(std::round(waitTime * 1000));
|
||||
countdown.resetTimer();
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "Enabling PL PCDU MPA module" << std::endl;
|
||||
#endif
|
||||
// Switch on MPA
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_MPA);
|
||||
// Wait for 100 ms before checking ADC values
|
||||
adcCountdown.setTimeout(100);
|
||||
adcCountdown.resetTimer();
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::ON_TRANS_HPA;
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
if (state == States::ON_TRANS_HPA) {
|
||||
if (not commandExecuted) {
|
||||
// Switch on HPA
|
||||
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_HPA);
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "Enabling PL PCDU HPA module" << std::endl;
|
||||
#endif
|
||||
commandExecuted = true;
|
||||
}
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::PCDU_ON;
|
||||
setMode(MODE_NORMAL, plpcdu::NORMAL_ALL_ON);
|
||||
countdown.resetTimer();
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||
if (mode == _MODE_TO_NORMAL) {
|
||||
stateMachineToNormal();
|
||||
}
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::doShutDown() { transitionBackToOff(); }
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||
switch (adcState) {
|
||||
case (AdcStates::SEND_SETUP): {
|
||||
*id = plpcdu::SETUP_CMD;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
case (AdcStates::NORMAL): {
|
||||
*id = plpcdu::READ_WITH_TEMP_EXT;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||
if (adcState == AdcStates::SEND_SETUP) {
|
||||
*id = plpcdu::SETUP_CMD;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
if (mode == _MODE_TO_NORMAL) {
|
||||
return buildNormalDeviceCommand(id);
|
||||
}
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::fillCommandAndReplyMap() {
|
||||
insertInCommandAndReplyMap(plpcdu::READ_CMD, 2, &adcSet);
|
||||
insertInCommandAndReplyMap(plpcdu::READ_TEMP_EXT, 1, &adcSet);
|
||||
insertInCommandAndReplyMap(plpcdu::READ_WITH_TEMP_EXT, 1, &adcSet);
|
||||
insertInCommandAndReplyMap(plpcdu::SETUP_CMD, 1);
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
switch (deviceCommand) {
|
||||
case (plpcdu::SETUP_CMD): {
|
||||
cmdBuf[0] = plpcdu::SETUP_BYTE;
|
||||
rawPacket = cmdBuf.data();
|
||||
rawPacketLen = 1;
|
||||
break;
|
||||
}
|
||||
case (plpcdu::READ_CMD): {
|
||||
max1227::prepareExternallyClockedRead0ToN(cmdBuf.data(), plpcdu::CHANNEL_N, rawPacketLen);
|
||||
rawPacket = cmdBuf.data();
|
||||
break;
|
||||
}
|
||||
case (plpcdu::READ_TEMP_EXT): {
|
||||
max1227::prepareExternallyClockedTemperatureRead(cmdBuf.data(), rawPacketLen);
|
||||
rawPacket = cmdBuf.data();
|
||||
break;
|
||||
}
|
||||
case (plpcdu::READ_WITH_TEMP_EXT): {
|
||||
size_t sz = 0;
|
||||
max1227::prepareExternallyClockedRead0ToN(cmdBuf.data(), plpcdu::CHANNEL_N, sz);
|
||||
max1227::prepareExternallyClockedTemperatureRead(cmdBuf.data() + sz, sz);
|
||||
rawPacketLen = sz;
|
||||
rawPacket = cmdBuf.data();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||
// SPI is full duplex
|
||||
*foundId = getPendingCommand();
|
||||
*foundLen = remainingSize;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t* packet) {
|
||||
using namespace plpcdu;
|
||||
switch (id) {
|
||||
case (SETUP_CMD): {
|
||||
if (mode == _MODE_TO_NORMAL) {
|
||||
adcCmdExecuted = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case (READ_TEMP_EXT): {
|
||||
uint8_t tempStartIdx = TEMP_REPLY_SIZE - 2;
|
||||
adcSet.tempC.value =
|
||||
max1227::getTemperature(packet[tempStartIdx] << 8 | packet[tempStartIdx + 1]);
|
||||
break;
|
||||
}
|
||||
case (READ_CMD): {
|
||||
PoolReadGuard pg(&adcSet);
|
||||
if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||
return pg.getReadResult();
|
||||
}
|
||||
handleExtConvRead(packet);
|
||||
checkAdcValues();
|
||||
adcSet.setValidity(true, true);
|
||||
handlePrintout();
|
||||
break;
|
||||
}
|
||||
case (READ_WITH_TEMP_EXT): {
|
||||
PoolReadGuard pg(&adcSet);
|
||||
if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||
return pg.getReadResult();
|
||||
}
|
||||
handleExtConvRead(packet);
|
||||
uint8_t tempStartIdx = ADC_REPLY_SIZE + TEMP_REPLY_SIZE - 2;
|
||||
adcSet.tempC.value =
|
||||
max1227::getTemperature(packet[tempStartIdx] << 8 | packet[tempStartIdx + 1]);
|
||||
checkAdcValues();
|
||||
adcSet.setValidity(true, true);
|
||||
handlePrintout();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
uint32_t PayloadPcduHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
|
||||
// 20 minutes transition delay is allowed
|
||||
return 20 * 60 * 60;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) {
|
||||
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::CHANNEL_VEC, &channelValues);
|
||||
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::PROCESSED_VEC, &processedValues);
|
||||
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::TEMP, &tempC);
|
||||
poolManager.subscribeForPeriodicPacket(adcSet.getSid(), false, 0.1, true);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::setToGoToNormalModeImmediately(bool enable) {
|
||||
this->goToNormalMode = enable;
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::handleExtConvRead(const uint8_t* bufStart) {
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
adcSet.channels[idx] = bufStart[idx * 2 + 1] << 8 | bufStart[idx * 2 + 2];
|
||||
}
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::handlePrintout() {
|
||||
using namespace plpcdu;
|
||||
if (periodicPrintout) {
|
||||
if (opDivider.checkAndIncrement()) {
|
||||
sif::info << "PL PCDU ADC hex [" << std::setfill('0') << std::hex;
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
sif::info << std::setw(3) << adcSet.channels[idx];
|
||||
if (idx < 11) {
|
||||
sif::info << ",";
|
||||
}
|
||||
}
|
||||
sif::info << "] | T[C] " << std::dec << adcSet.tempC.value << std::endl;
|
||||
sif::info << "Neg V: " << adcSet.processed[U_NEG_V_FB] << std::endl;
|
||||
sif::info << "I HPA [mA]: " << adcSet.processed[I_HPA] << std::endl;
|
||||
sif::info << "U HPA [V]: " << adcSet.processed[U_HPA_DIV_6] << std::endl;
|
||||
sif::info << "I MPA [mA]: " << adcSet.processed[I_MPA] << std::endl;
|
||||
sif::info << "U MPA [V]: " << adcSet.processed[U_MPA_DIV_6] << std::endl;
|
||||
sif::info << "I TX [mA]: " << adcSet.processed[I_TX] << std::endl;
|
||||
sif::info << "U TX [V]: " << adcSet.processed[U_TX_DIV_6] << std::endl;
|
||||
sif::info << "I X8 [mA]: " << adcSet.processed[I_X8] << std::endl;
|
||||
sif::info << "U X8 [V]: " << adcSet.processed[U_X8_DIV_6] << std::endl;
|
||||
sif::info << "I DRO [mA]: " << adcSet.processed[I_DRO] << std::endl;
|
||||
sif::info << "U DRO [V]: " << adcSet.processed[U_DRO_DIV_6] << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::enablePeriodicPrintout(bool enable, uint8_t divider) {
|
||||
this->periodicPrintout = enable;
|
||||
opDivider.setDivider(divider);
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::transitionBackToOff() {
|
||||
States currentState = state;
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_HPA);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_MPA);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_X8);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_DRO);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT0);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT1);
|
||||
state = States::PCDU_OFF;
|
||||
adcState = AdcStates::OFF;
|
||||
setMode(MODE_OFF);
|
||||
// Notify FDIR
|
||||
triggerEvent(TRANSITION_BACK_TO_OFF, static_cast<uint32_t>(currentState));
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::checkAdcValues() {
|
||||
using namespace plpcdu;
|
||||
checkJsonFileInit();
|
||||
adcSet.processed[U_BAT_DIV_6] =
|
||||
static_cast<float>(adcSet.channels[0]) * VOLTAGE_DIV / MAX122X_BIT * MAX122X_VREF;
|
||||
adcSet.processed[U_NEG_V_FB] =
|
||||
V_POS - VOLTAGE_DIV_U_NEG *
|
||||
(V_POS - static_cast<float>(adcSet.channels[1]) / MAX122X_BIT * MAX122X_VREF);
|
||||
adcSet.processed[I_HPA] = static_cast<float>(adcSet.channels[2]) * SCALE_CURRENT_HPA * 1000.0;
|
||||
adcSet.processed[U_HPA_DIV_6] = static_cast<float>(adcSet.channels[3]) * SCALE_VOLTAGE;
|
||||
adcSet.processed[I_MPA] = static_cast<float>(adcSet.channels[4]) * SCALE_CURRENT_MPA * 1000.0;
|
||||
adcSet.processed[U_MPA_DIV_6] = static_cast<float>(adcSet.channels[5]) * SCALE_VOLTAGE;
|
||||
adcSet.processed[I_TX] = static_cast<float>(adcSet.channels[6]) * SCALE_CURRENT_TX * 1000.0;
|
||||
adcSet.processed[U_TX_DIV_6] = static_cast<float>(adcSet.channels[7]) * SCALE_VOLTAGE;
|
||||
adcSet.processed[I_X8] = static_cast<float>(adcSet.channels[8]) * SCALE_CURRENT_X8 * 1000.0;
|
||||
adcSet.processed[U_X8_DIV_6] = static_cast<float>(adcSet.channels[9]) * SCALE_VOLTAGE;
|
||||
adcSet.processed[I_DRO] = static_cast<float>(adcSet.channels[10]) * SCALE_CURRENT_DRO * 1000.0;
|
||||
adcSet.processed[U_DRO_DIV_6] = static_cast<float>(adcSet.channels[11]) * SCALE_VOLTAGE;
|
||||
float lowerBound = 0.0;
|
||||
float upperBound = 0.0;
|
||||
bool adcTransition = false;
|
||||
adcTransition = state == States::ON_TRANS_DRO and adcCountdown.isBusy();
|
||||
// Now check against voltage and current limits, depending on state
|
||||
if (state >= States::ON_TRANS_DRO and not adcTransition) {
|
||||
params.getValue(PlPcduParameter::NEG_V_LOWER_BOUND_K, lowerBound);
|
||||
params.getValue(PlPcduParameter::NEG_V_UPPER_BOUND_K, upperBound);
|
||||
if (not checkVoltage(adcSet.processed[U_NEG_V_FB], lowerBound, upperBound,
|
||||
NEG_V_OUT_OF_BOUNDS)) {
|
||||
return;
|
||||
}
|
||||
params.getValue(PlPcduParameter::DRO_U_LOWER_BOUND_K, lowerBound);
|
||||
params.getValue(PlPcduParameter::DRO_U_UPPER_BOUND_K, upperBound);
|
||||
if (not checkVoltage(adcSet.processed[U_DRO_DIV_6], lowerBound, upperBound,
|
||||
U_DRO_OUT_OF_BOUNDS)) {
|
||||
return;
|
||||
}
|
||||
params.getValue(PlPcduParameter::DRO_I_UPPER_BOUND_K, upperBound);
|
||||
if (not checkCurrent(adcSet.processed[I_DRO], upperBound, I_DRO_OUT_OF_BOUNDS)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
adcTransition = state == States::ON_TRANS_X8 and adcCountdown.isBusy();
|
||||
if (state >= States::ON_TRANS_X8 and not adcTransition) {
|
||||
params.getValue(PlPcduParameter::X8_U_LOWER_BOUND_K, lowerBound);
|
||||
params.getValue(PlPcduParameter::X8_U_UPPER_BOUND_K, upperBound);
|
||||
if (not checkVoltage(adcSet.processed[U_X8_DIV_6], lowerBound, upperBound,
|
||||
U_X8_OUT_OF_BOUNDS)) {
|
||||
return;
|
||||
}
|
||||
params.getValue(PlPcduParameter::X8_I_UPPER_BOUND_K, upperBound);
|
||||
if (not checkCurrent(adcSet.processed[I_X8], upperBound, I_X8_OUT_OF_BOUNDS)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
adcTransition = state == States::ON_TRANS_TX and adcCountdown.isBusy();
|
||||
if (state >= States::ON_TRANS_TX and not adcTransition) {
|
||||
params.getValue(PlPcduParameter::TX_U_LOWER_BOUND_K, lowerBound);
|
||||
params.getValue(PlPcduParameter::TX_U_UPPER_BOUND_K, upperBound);
|
||||
if (not checkVoltage(adcSet.processed[U_TX_DIV_6], lowerBound, upperBound,
|
||||
U_TX_OUT_OF_BOUNDS)) {
|
||||
return;
|
||||
}
|
||||
params.getValue(PlPcduParameter::TX_I_UPPER_BOUND_K, upperBound);
|
||||
if (not checkCurrent(adcSet.processed[I_TX], upperBound, I_TX_OUT_OF_BOUNDS)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
adcTransition = state == States::ON_TRANS_MPA and adcCountdown.isBusy();
|
||||
if (state >= States::ON_TRANS_MPA and not adcTransition) {
|
||||
params.getValue(PlPcduParameter::MPA_U_LOWER_BOUND_K, lowerBound);
|
||||
params.getValue(PlPcduParameter::MPA_U_UPPER_BOUND_K, upperBound);
|
||||
if (not checkVoltage(adcSet.processed[U_MPA_DIV_6], lowerBound, upperBound,
|
||||
U_MPA_OUT_OF_BOUNDS)) {
|
||||
return;
|
||||
}
|
||||
params.getValue(PlPcduParameter::MPA_I_UPPER_BOUND_K, upperBound);
|
||||
if (not checkCurrent(adcSet.processed[I_MPA], upperBound, I_MPA_OUT_OF_BOUNDS)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
adcTransition = state == States::ON_TRANS_HPA and adcCountdown.isBusy();
|
||||
if (state >= States::ON_TRANS_HPA and not adcTransition) {
|
||||
params.getValue(PlPcduParameter::HPA_U_LOWER_BOUND_K, lowerBound);
|
||||
params.getValue(PlPcduParameter::HPA_U_UPPER_BOUND_K, upperBound);
|
||||
if (not checkVoltage(adcSet.processed[U_HPA_DIV_6], lowerBound, upperBound,
|
||||
U_HPA_OUT_OF_BOUNDS)) {
|
||||
return;
|
||||
}
|
||||
params.getValue(PlPcduParameter::HPA_I_UPPER_BOUND_K, upperBound);
|
||||
if (not checkCurrent(adcSet.processed[I_HPA], upperBound, I_HPA_OUT_OF_BOUNDS)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
transitionOk = true;
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::checkJsonFileInit() {
|
||||
if (not jsonFileInitComplete) {
|
||||
sd::SdCard prefSd;
|
||||
sdcMan->getPreferredSdCard(prefSd);
|
||||
if (sdcMan->isSdCardMounted(prefSd)) {
|
||||
params.initialize(sdcMan->getCurrentMountPrefix(prefSd));
|
||||
jsonFileInitComplete = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool PayloadPcduHandler::checkVoltage(float val, float lowerBound, float upperBound, Event event) {
|
||||
bool tooLarge = false;
|
||||
if (val < lowerBound or val > upperBound) {
|
||||
if (val > upperBound) {
|
||||
tooLarge = true;
|
||||
} else {
|
||||
tooLarge = false;
|
||||
}
|
||||
uint32_t p2 = 0;
|
||||
serializeFloat(p2, val);
|
||||
triggerEvent(event, tooLarge, p2);
|
||||
transitionOk = false;
|
||||
transitionBackToOff();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PayloadPcduHandler::checkCurrent(float val, float upperBound, Event event) {
|
||||
if (val > upperBound) {
|
||||
uint32_t p2 = 0;
|
||||
serializeFloat(p2, val);
|
||||
triggerEvent(event, true, p2);
|
||||
transitionOk = false;
|
||||
transitionBackToOff();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::isModeCombinationValid(Mode_t mode, Submode_t submode) {
|
||||
if (mode == MODE_NORMAL and submode <= 1) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
return DeviceHandlerBase::isModeCombinationValid(mode, submode);
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::serializeFloat(uint32_t& param, float val) {
|
||||
size_t dummy = 0;
|
||||
return SerializeAdapter::serialize(&val, reinterpret_cast<uint8_t*>(¶m), &dummy, 4,
|
||||
SerializeIF::Endianness::NETWORK);
|
||||
}
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
ReturnValue_t PayloadPcduHandler::extConvAsTwoCallback(SpiComIF* comIf, SpiCookie* cookie,
|
||||
const uint8_t* sendData, size_t sendLen,
|
||||
void* args) {
|
||||
auto handler = reinterpret_cast<PayloadPcduHandler*>(args);
|
||||
if (handler == nullptr) {
|
||||
sif::error << "GyroADIS16507Handler::spiSendCallback: Passed handler pointer is invalid!"
|
||||
<< std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
DeviceCommandId_t currentCommand = handler->getPendingCommand();
|
||||
switch (currentCommand) {
|
||||
case (plpcdu::READ_WITH_TEMP_EXT): {
|
||||
return transferAsTwo(comIf, cookie, sendData, sendLen, false);
|
||||
}
|
||||
case (plpcdu::READ_TEMP_EXT): {
|
||||
return transferAsTwo(comIf, cookie, sendData, sendLen, true);
|
||||
}
|
||||
default: {
|
||||
return comIf->performRegularSendOperation(cookie, sendData, sendLen);
|
||||
}
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cookie,
|
||||
const uint8_t* sendData, size_t sendLen,
|
||||
bool tempOnly) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
int retval = 0;
|
||||
// Prepare transfer
|
||||
int fileDescriptor = 0;
|
||||
std::string device = cookie->getSpiDevice();
|
||||
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "SpiComIF::sendMessage");
|
||||
if (fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||
return SpiComIF::OPENING_FILE_FAILED;
|
||||
}
|
||||
spi::SpiModes spiMode = spi::SpiModes::MODE_0;
|
||||
uint32_t spiSpeed = 0;
|
||||
cookie->getSpiParameters(spiMode, spiSpeed, nullptr);
|
||||
comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
|
||||
cookie->assignWriteBuffer(sendData);
|
||||
size_t transferLen = plpcdu::TEMP_REPLY_SIZE;
|
||||
if (not tempOnly) {
|
||||
transferLen += plpcdu::ADC_REPLY_SIZE;
|
||||
}
|
||||
cookie->setTransferSize(transferLen);
|
||||
|
||||
gpioId_t gpioId = cookie->getChipSelectPin();
|
||||
GpioIF* gpioIF = comIf->getGpioInterface();
|
||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||
uint32_t timeoutMs = 0;
|
||||
MutexIF* mutex = comIf->getMutex(&timeoutType, &timeoutMs);
|
||||
if (mutex == nullptr or gpioIF == nullptr) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::warning << "GyroADIS16507Handler::spiSendCallback: "
|
||||
"Mutex or GPIO interface invalid"
|
||||
<< std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
result = mutex->lockMutex(timeoutType, timeoutMs);
|
||||
if (result != RETURN_OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "SpiComIF::sendMessage: Failed to lock mutex" << std::endl;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
}
|
||||
spi_ioc_transfer* transferStruct = cookie->getTransferStructHandle();
|
||||
uint64_t origTx = transferStruct->tx_buf;
|
||||
uint64_t origRx = transferStruct->rx_buf;
|
||||
if (tempOnly) {
|
||||
transferLen = 1;
|
||||
} else {
|
||||
transferLen = plpcdu::ADC_REPLY_SIZE + 1;
|
||||
}
|
||||
transferStruct->len = transferLen;
|
||||
// Pull SPI CS low. For now, no support for active high given
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
gpioIF->pullLow(gpioId);
|
||||
}
|
||||
|
||||
// Execute transfer
|
||||
// Initiate a full duplex SPI transfer.
|
||||
retval = ioctl(fileDescriptor, SPI_IOC_MESSAGE(1), cookie->getTransferStructHandle());
|
||||
if (retval < 0) {
|
||||
utility::handleIoctlError("SpiComIF::sendMessage: ioctl error.");
|
||||
result = SpiComIF::FULL_DUPLEX_TRANSFER_FAILED;
|
||||
}
|
||||
#if FSFW_HAL_SPI_WIRETAPPING == 1
|
||||
comIf->performSpiWiretapping(cookie);
|
||||
#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */
|
||||
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
gpioIF->pullHigh(gpioId);
|
||||
}
|
||||
|
||||
transferStruct->tx_buf += transferLen;
|
||||
transferStruct->rx_buf += transferLen;
|
||||
transferStruct->len = plpcdu::TEMP_REPLY_SIZE - 1;
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
gpioIF->pullLow(gpioId);
|
||||
}
|
||||
|
||||
// Execute transfer
|
||||
// Initiate a full duplex SPI transfer.
|
||||
retval = ioctl(fileDescriptor, SPI_IOC_MESSAGE(1), cookie->getTransferStructHandle());
|
||||
if (retval < 0) {
|
||||
utility::handleIoctlError("SpiComIF::sendMessage: ioctl error.");
|
||||
result = SpiComIF::FULL_DUPLEX_TRANSFER_FAILED;
|
||||
}
|
||||
#if FSFW_HAL_SPI_WIRETAPPING == 1
|
||||
comIf->performSpiWiretapping(cookie);
|
||||
#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */
|
||||
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
gpioIF->pullHigh(gpioId);
|
||||
}
|
||||
|
||||
transferStruct->tx_buf = origTx;
|
||||
transferStruct->rx_buf = origRx;
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
mutex->unlockMutex();
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
#endif
|
155
mission/devices/PayloadPcduHandler.h
Normal file
155
mission/devices/PayloadPcduHandler.h
Normal file
@ -0,0 +1,155 @@
|
||||
#ifndef LINUX_DEVICES_PLPCDUHANDLER_H_
|
||||
#define LINUX_DEVICES_PLPCDUHANDLER_H_
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||
#include <fsfw/timemanager/Countdown.h>
|
||||
|
||||
#include "events/subsystemIdRanges.h"
|
||||
#include "fsfw/FSFW.h"
|
||||
#include "fsfw_hal/common/gpio/GpioIF.h"
|
||||
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
|
||||
#include "mission/memory/SdCardMountedIF.h"
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
class SpiComIF;
|
||||
class SpiCookie;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Device handler for the EIVE Payload PCDU
|
||||
* @details
|
||||
* Documentation:
|
||||
* https://egit.irs.uni-stuttgart.de/eive/eive_dokumente/src/branch/master/400_Raumsegment/412_PayloaPCDUDocumentation/release/EIVE-D-421-001_PLPCDU_Documentation.pdf
|
||||
*
|
||||
* Important components:
|
||||
* - SSR - Solid State Relay: Decouples voltages from battery
|
||||
* - DRO - Dielectric Resonsant Oscillator: Generates modulation signal
|
||||
* - X8: Frequency X8 Multiplicator
|
||||
* - TX: Transmitter/Sender module. Modulates data onto carrier signal
|
||||
* - MPA - Medium Power Amplifier
|
||||
* - HPA - High Power Amplifier
|
||||
*/
|
||||
class PayloadPcduHandler : public DeviceHandlerBase {
|
||||
public:
|
||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PL_PCDU_HANDLER;
|
||||
//! [EXPORT] : [COMMENT] Could not transition properly and went back to ALL OFF
|
||||
static constexpr Event TRANSITION_BACK_TO_OFF =
|
||||
event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||
//! [EXPORT] : [COMMENT] P1: 0 -> too low, 1 -> too high P2: Float value
|
||||
static constexpr Event NEG_V_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 1, severity::MEDIUM);
|
||||
//! [EXPORT] : [COMMENT] P1: 0 -> too low, 1 -> too high P2: Float value
|
||||
static constexpr Event U_DRO_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 2, severity::MEDIUM);
|
||||
//! [EXPORT] : [COMMENT] P1: 0 -> too low, 1 -> too high P2: Float value
|
||||
static constexpr Event I_DRO_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 3, severity::MEDIUM);
|
||||
//! [EXPORT] : [COMMENT] P1: 0 -> too low, 1 -> too high P2: Float value
|
||||
static constexpr Event U_X8_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 4, severity::MEDIUM);
|
||||
//! [EXPORT] : [COMMENT] P1: 0 -> too low, 1 -> too high P2: Float value
|
||||
static constexpr Event I_X8_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 5, severity::MEDIUM);
|
||||
//! [EXPORT] : [COMMENT] P1: 0 -> too low, 1 -> too high P2: Float value
|
||||
static constexpr Event U_TX_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 6, severity::MEDIUM);
|
||||
//! [EXPORT] : [COMMENT] P1: 0 -> too low, 1 -> too high P2: Float value
|
||||
static constexpr Event I_TX_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 7, severity::MEDIUM);
|
||||
//! [EXPORT] : [COMMENT] P1: 0 -> too low, 1 -> too high P2: Float value
|
||||
static constexpr Event U_MPA_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 8, severity::MEDIUM);
|
||||
//! [EXPORT] : [COMMENT] P1: 0 -> too low, 1 -> too high P2: Float value
|
||||
static constexpr Event I_MPA_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 9, severity::MEDIUM);
|
||||
//! [EXPORT] : [COMMENT] P1: 0 -> too low, 1 -> too high P2: Float value
|
||||
static constexpr Event U_HPA_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 10, severity::MEDIUM);
|
||||
//! [EXPORT] : [COMMENT] P1: 0 -> too low, 1 -> too high P2: Float value
|
||||
static constexpr Event I_HPA_OUT_OF_BOUNDS = event::makeEvent(SUBSYSTEM_ID, 11, severity::MEDIUM);
|
||||
|
||||
PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie, GpioIF* gpioIF,
|
||||
SdCardMountedIF* sdcMan, bool periodicPrintout);
|
||||
|
||||
void setToGoToNormalModeImmediately(bool enable);
|
||||
void enablePeriodicPrintout(bool enable, uint8_t divider);
|
||||
|
||||
static ReturnValue_t extConvAsTwoCallback(SpiComIF* comIf, SpiCookie* cookie,
|
||||
const uint8_t* sendData, size_t sendLen, void* args);
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
static ReturnValue_t transferAsTwo(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sendData,
|
||||
size_t sendLen, bool tempOnly);
|
||||
#endif
|
||||
|
||||
private:
|
||||
enum class States : uint8_t {
|
||||
PCDU_OFF,
|
||||
// Solid State Relay, enable battery voltages VBAT0 and VBAT1. This will also switch on
|
||||
// the ADC
|
||||
ON_TRANS_SSR,
|
||||
ON_TRANS_ADC_CLOSE_ZERO,
|
||||
// Enable Dielectric Resonant Oscillator and start monitoring voltages as
|
||||
// soon as DRO voltage reaches 6V
|
||||
ON_TRANS_DRO,
|
||||
// Switch on X8 compoennt and monitor voltages for 5 seconds
|
||||
ON_TRANS_X8,
|
||||
// Switch on TX component and monitor voltages for 5 seconds
|
||||
ON_TRANS_TX,
|
||||
// Switch on MPA component and monitor voltages for 5 seconds
|
||||
ON_TRANS_MPA,
|
||||
// Switch on HPA component and monitor voltages for 5 seconds
|
||||
ON_TRANS_HPA,
|
||||
// All components of the experiment are on
|
||||
PCDU_ON,
|
||||
} state = States::PCDU_OFF;
|
||||
|
||||
enum class AdcMode { EXT_CONV, INT_CONV } adcMode = AdcMode::INT_CONV;
|
||||
|
||||
enum class MonitoringMode { NONE, CLOSE_TO_ZERO, NEGATIVE } monMode = MonitoringMode::NONE;
|
||||
|
||||
enum class AdcStates { OFF, BOOT_DELAY, SEND_SETUP, NORMAL } adcState = AdcStates::OFF;
|
||||
|
||||
bool goToNormalMode = false;
|
||||
plpcdu::PlPcduAdcSet adcSet;
|
||||
std::array<uint8_t, plpcdu::MAX_ADC_REPLY_SIZE> cmdBuf = {};
|
||||
// This variable is tied to DRO +6 V voltage. Voltages, currents are monitored and the experiment
|
||||
// is shut down immediately if there is a negative voltage.
|
||||
bool transitionOk = false;
|
||||
bool commandExecuted = false;
|
||||
bool adcCmdExecuted = false;
|
||||
bool periodicPrintout = false;
|
||||
bool jsonFileInitComplete = false;
|
||||
PeriodicOperationDivider opDivider = PeriodicOperationDivider(5);
|
||||
uint8_t tempReadDivisor = 1;
|
||||
Countdown countdown = Countdown(5000);
|
||||
Countdown adcCountdown = Countdown(50);
|
||||
GpioIF* gpioIF;
|
||||
SdCardMountedIF* sdcMan;
|
||||
plpcdu::PlPcduParameter params;
|
||||
|
||||
PoolEntry<uint16_t> channelValues = PoolEntry<uint16_t>({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
|
||||
PoolEntry<float> processedValues =
|
||||
PoolEntry<float>({0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0});
|
||||
PoolEntry<float> tempC = PoolEntry<float>({0.0});
|
||||
|
||||
void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
|
||||
void doStartUp() override;
|
||||
void doShutDown() override;
|
||||
// Main FDIR function which goes from any PL PCDU state back to all off
|
||||
void transitionBackToOff();
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
||||
void fillCommandAndReplyMap() override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
||||
size_t commandDataLen) override;
|
||||
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||
size_t* foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override;
|
||||
|
||||
void handleExtConvRead(const uint8_t* bufStart);
|
||||
void handlePrintout();
|
||||
void checkAdcValues();
|
||||
void checkJsonFileInit();
|
||||
void stateMachineToNormal();
|
||||
bool checkVoltage(float val, float lowerBound, float upperBound, Event event);
|
||||
bool checkCurrent(float val, float upperBound, Event event);
|
||||
ReturnValue_t serializeFloat(uint32_t& param, float val);
|
||||
};
|
||||
|
||||
#endif /* LINUX_DEVICES_PLPCDUHANDLER_H_ */
|
208
mission/devices/devicedefinitions/payloadPcduDefinitions.h
Normal file
208
mission/devices/devicedefinitions/payloadPcduDefinitions.h
Normal file
@ -0,0 +1,208 @@
|
||||
#ifndef LINUX_DEVICES_DEVICEDEFINITIONS_PAYLOADPCDUDEFINITIONS_H_
|
||||
#define LINUX_DEVICES_DEVICEDEFINITIONS_PAYLOADPCDUDEFINITIONS_H_
|
||||
|
||||
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <filesystem>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "mission/devices/max1227.h"
|
||||
#include "mission/memory/NVMParameterBase.h"
|
||||
|
||||
namespace plpcdu {
|
||||
|
||||
using namespace max1227;
|
||||
|
||||
enum PlPcduAdcChannels : uint8_t {
|
||||
U_BAT_DIV_6 = 0,
|
||||
// According to schematic, will be 2.2158V for Vneg = +0V and 0.2446V for Vneg = -6V
|
||||
// Full Forumula: V_neg = V_post - (R1 + R2) / R1 * (V_pos - V_out) with R1 being 27.4k
|
||||
// and R2 being 49.9k. FB = Feedback
|
||||
U_NEG_V_FB = 1,
|
||||
I_HPA = 2,
|
||||
U_HPA_DIV_6 = 3,
|
||||
I_MPA = 4,
|
||||
U_MPA_DIV_6 = 5,
|
||||
I_TX = 6,
|
||||
U_TX_DIV_6 = 7,
|
||||
I_X8 = 8,
|
||||
U_X8_DIV_6 = 9,
|
||||
I_DRO = 10,
|
||||
U_DRO_DIV_6 = 11,
|
||||
NUM_CHANNELS = 12
|
||||
};
|
||||
|
||||
enum PlPcduPoolIds : uint32_t { CHANNEL_VEC = 0, PROCESSED_VEC = 1, TEMP = 2 };
|
||||
|
||||
static constexpr size_t MAX_ADC_REPLY_SIZE = 64;
|
||||
|
||||
static constexpr DeviceCommandId_t READ_CMD = 0;
|
||||
static constexpr DeviceCommandId_t SETUP_CMD = 1;
|
||||
static constexpr DeviceCommandId_t READ_TEMP_EXT = 2;
|
||||
static constexpr DeviceCommandId_t READ_WITH_TEMP_EXT = 3;
|
||||
|
||||
static constexpr Submode_t NORMAL_ADC_ONLY = 0;
|
||||
static constexpr Submode_t NORMAL_ALL_ON = 1;
|
||||
|
||||
// 12 ADC values * 2 + trailing zero
|
||||
static constexpr size_t ADC_REPLY_SIZE = 25;
|
||||
// Conversion byte + 24 * zero
|
||||
static constexpr size_t TEMP_REPLY_SIZE = 25;
|
||||
|
||||
static constexpr uint8_t SETUP_BYTE =
|
||||
max1227::buildSetupByte(ClkSel::EXT_CONV_EXT_TIMED, RefSel::INT_REF_NO_WAKEUP, DiffSel::NONE_0);
|
||||
|
||||
static constexpr uint32_t ADC_SET_ID = READ_CMD;
|
||||
static constexpr uint8_t CHANNELS_NUM = 12;
|
||||
static constexpr uint8_t CHANNEL_N = CHANNELS_NUM - 1;
|
||||
// Store temperature as well
|
||||
static constexpr size_t DATASET_ENTRIES = CHANNELS_NUM + 1;
|
||||
|
||||
static constexpr uint8_t VOLTAGE_DIV = 6;
|
||||
// 12-bit ADC: 2 to the power of 12 minus 1
|
||||
static constexpr uint16_t MAX122X_BIT = 4095;
|
||||
static constexpr float MAX122X_VREF = 2.5;
|
||||
static constexpr float GAIN_INA169 = 100.0;
|
||||
static constexpr float R_SHUNT_HPA = 0.008;
|
||||
static constexpr float R_SHUNT_MPA = 0.015;
|
||||
static constexpr float R_SHUNT_TX = 0.05;
|
||||
static constexpr float R_SHUNT_X8 = 0.015;
|
||||
static constexpr float R_SHUNT_DRO = 0.022;
|
||||
static constexpr float V_POS = 3.3;
|
||||
static constexpr float VOLTAGE_DIV_U_NEG = (49.9 + 27.4) / 27.4;
|
||||
static constexpr float MAX122X_SCALE = MAX122X_VREF / MAX122X_BIT;
|
||||
static constexpr float SCALE_VOLTAGE = MAX122X_SCALE * VOLTAGE_DIV;
|
||||
static constexpr float SCALE_CURRENT_HPA = MAX122X_SCALE / (GAIN_INA169 * R_SHUNT_HPA);
|
||||
static constexpr float SCALE_CURRENT_MPA = MAX122X_SCALE / (GAIN_INA169 * R_SHUNT_MPA);
|
||||
static constexpr float SCALE_CURRENT_TX = MAX122X_SCALE / (GAIN_INA169 * R_SHUNT_TX);
|
||||
static constexpr float SCALE_CURRENT_X8 = MAX122X_SCALE / (GAIN_INA169 * R_SHUNT_X8);
|
||||
static constexpr float SCALE_CURRENT_DRO = MAX122X_SCALE / (GAIN_INA169 * R_SHUNT_DRO);
|
||||
|
||||
// TODO: Make these configurable parameters using a JSON file
|
||||
// Upper bound of currents in milliamperes [mA]
|
||||
static constexpr double NEG_V_LOWER_BOUND = -6.5;
|
||||
static constexpr double NEG_V_UPPER_BOUND = -2.7;
|
||||
|
||||
static constexpr double DRO_U_LOWER_BOUND = 5.0;
|
||||
static constexpr double DRO_U_UPPER_BOUND = 7.0;
|
||||
static constexpr double DRO_I_UPPER_BOUND = 40.0;
|
||||
|
||||
static constexpr double X8_U_LOWER_BOUND = 2.6;
|
||||
static constexpr double X8_U_UPPER_BOUND = 4.0;
|
||||
static constexpr double X8_I_UPPER_BOUND = 100.0;
|
||||
|
||||
static constexpr double TX_U_LOWER_BOUND = 2.6;
|
||||
static constexpr double TX_U_UPPER_BOUND = 4.0;
|
||||
static constexpr double TX_I_UPPER_BOUND = 250.0;
|
||||
|
||||
static constexpr double MPA_U_LOWER_BOUND = 2.6;
|
||||
static constexpr double MPA_U_UPPER_BOUND = 4.0;
|
||||
static constexpr double MPA_I_UPPER_BOUND = 650.0;
|
||||
|
||||
static constexpr double HPA_U_LOWER_BOUND = 9.4;
|
||||
static constexpr double HPA_U_UPPER_BOUND = 11.0;
|
||||
static constexpr double HPA_I_UPPER_BOUND = 3000.0;
|
||||
|
||||
// Wait time in floating point seconds
|
||||
static constexpr double SSR_TO_DRO_WAIT_TIME = 5.0;
|
||||
static constexpr double DRO_TO_X8_WAIT_TIME = 905.0;
|
||||
static constexpr double X8_TO_TX_WAIT_TIME = 5.0;
|
||||
static constexpr double TX_TO_MPA_WAIT_TIME = 5.0;
|
||||
static constexpr double MPA_TO_HPA_WAIT_TIME = 5.0;
|
||||
|
||||
/**
|
||||
* The current of the processed values is calculated and stored as a milliamperes [mA].
|
||||
* The voltages are stored as Volt values.
|
||||
*/
|
||||
class PlPcduAdcSet : public StaticLocalDataSet<DATASET_ENTRIES> {
|
||||
public:
|
||||
PlPcduAdcSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, ADC_SET_ID) {}
|
||||
|
||||
PlPcduAdcSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, ADC_SET_ID)) {}
|
||||
|
||||
lp_vec_t<uint16_t, 12> channels = lp_vec_t<uint16_t, 12>(sid.objectId, CHANNEL_VEC, this);
|
||||
lp_vec_t<float, 12> processed = lp_vec_t<float, 12>(sid.objectId, PROCESSED_VEC, this);
|
||||
lp_var_t<float> tempC = lp_var_t<float>(sid.objectId, TEMP, this);
|
||||
};
|
||||
|
||||
class PlPcduParameter : public NVMParameterBase {
|
||||
public:
|
||||
static constexpr char SSR_TO_DRO_WAIT_TIME_K[] = "ssrToDroWait";
|
||||
static constexpr char DRO_TO_X8_WAIT_TIME_K[] = "droToX8Wait";
|
||||
static constexpr char X8_TO_TX_WAIT_TIME_K[] = "X8ToTxWait";
|
||||
static constexpr char TX_TO_MPA_WAIT_TIME_K[] = "txToMpaWait";
|
||||
static constexpr char MPA_TO_HPA_WAIT_TIME_K[] = "mpaToHpaWait";
|
||||
|
||||
static constexpr char NEG_V_LOWER_BOUND_K[] = "negVoltLowerBound";
|
||||
static constexpr char NEG_V_UPPER_BOUND_K[] = "negVoltUpperBound";
|
||||
|
||||
static constexpr char DRO_U_LOWER_BOUND_K[] = "droVoltLowerBound";
|
||||
static constexpr char DRO_U_UPPER_BOUND_K[] = "droVoltUpperBound";
|
||||
static constexpr char DRO_I_UPPER_BOUND_K[] = "droCurrUpperBound";
|
||||
|
||||
static constexpr char X8_U_LOWER_BOUND_K[] = "x8VoltLowerBound";
|
||||
static constexpr char X8_U_UPPER_BOUND_K[] = "x8VoltUpperBound";
|
||||
static constexpr char X8_I_UPPER_BOUND_K[] = "x8CurrUpperBound";
|
||||
|
||||
static constexpr char TX_U_LOWER_BOUND_K[] = "txVoltLowerBound";
|
||||
static constexpr char TX_U_UPPER_BOUND_K[] = "txVoltUpperBound";
|
||||
static constexpr char TX_I_UPPER_BOUND_K[] = "txCurrUpperBound";
|
||||
|
||||
static constexpr char MPA_U_LOWER_BOUND_K[] = "mpaVoltLowerBound";
|
||||
static constexpr char MPA_U_UPPER_BOUND_K[] = "mpaVoltUpperBound";
|
||||
static constexpr char MPA_I_UPPER_BOUND_K[] = "mpaCurrUpperBound";
|
||||
|
||||
static constexpr char HPA_U_LOWER_BOUND_K[] = "hpaVoltLowerBound";
|
||||
static constexpr char HPA_U_UPPER_BOUND_K[] = "hpaVoltUpperBound";
|
||||
static constexpr char HPA_I_UPPER_BOUND_K[] = "hpaCurrUpperBound";
|
||||
|
||||
PlPcduParameter() : NVMParameterBase(""), mountPrefix("") {
|
||||
// Initialize with default values
|
||||
insertValue(SSR_TO_DRO_WAIT_TIME_K, SSR_TO_DRO_WAIT_TIME);
|
||||
insertValue(DRO_TO_X8_WAIT_TIME_K, DRO_TO_X8_WAIT_TIME);
|
||||
insertValue(X8_TO_TX_WAIT_TIME_K, X8_TO_TX_WAIT_TIME);
|
||||
insertValue(TX_TO_MPA_WAIT_TIME_K, TX_TO_MPA_WAIT_TIME);
|
||||
insertValue(MPA_TO_HPA_WAIT_TIME_K, MPA_TO_HPA_WAIT_TIME);
|
||||
insertValue(NEG_V_LOWER_BOUND_K, NEG_V_LOWER_BOUND);
|
||||
insertValue(NEG_V_UPPER_BOUND_K, NEG_V_UPPER_BOUND);
|
||||
insertValue(DRO_U_LOWER_BOUND_K, DRO_U_LOWER_BOUND);
|
||||
insertValue(DRO_U_UPPER_BOUND_K, DRO_U_UPPER_BOUND);
|
||||
insertValue(DRO_I_UPPER_BOUND_K, DRO_I_UPPER_BOUND);
|
||||
insertValue(X8_U_LOWER_BOUND_K, X8_U_LOWER_BOUND);
|
||||
insertValue(X8_U_UPPER_BOUND_K, X8_U_UPPER_BOUND);
|
||||
insertValue(X8_I_UPPER_BOUND_K, X8_I_UPPER_BOUND);
|
||||
insertValue(TX_U_LOWER_BOUND_K, TX_U_LOWER_BOUND);
|
||||
insertValue(TX_U_UPPER_BOUND_K, TX_U_UPPER_BOUND);
|
||||
insertValue(TX_I_UPPER_BOUND_K, TX_I_UPPER_BOUND);
|
||||
insertValue(MPA_U_LOWER_BOUND_K, MPA_U_LOWER_BOUND);
|
||||
insertValue(MPA_U_UPPER_BOUND_K, MPA_U_UPPER_BOUND);
|
||||
insertValue(MPA_I_UPPER_BOUND_K, MPA_I_UPPER_BOUND);
|
||||
insertValue(HPA_U_LOWER_BOUND_K, HPA_U_LOWER_BOUND);
|
||||
insertValue(HPA_U_UPPER_BOUND_K, HPA_U_UPPER_BOUND);
|
||||
insertValue(HPA_I_UPPER_BOUND_K, HPA_I_UPPER_BOUND);
|
||||
}
|
||||
|
||||
ReturnValue_t initialize(std::string mountPrefix) {
|
||||
setFullName(mountPrefix + "/conf/plpcdu.json");
|
||||
ReturnValue_t result = readJsonFile();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
// File does not exist. Create it. Keys and appropriate init values were
|
||||
// specified in constructor
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "Creating PL PCDU JSON file at " << getFullName() << std::endl;
|
||||
#endif
|
||||
writeJsonFile();
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string mountPrefix;
|
||||
};
|
||||
|
||||
} // namespace plpcdu
|
||||
|
||||
#endif /* LINUX_DEVICES_DEVICEDEFINITIONS_PAYLOADPCDUDEFINITIONS_H_ */
|
@ -65,7 +65,7 @@ void prepareExternallyClockedSingleChannelRead(uint8_t* spiBuf, uint8_t channel,
|
||||
* the first byte (first conversion byte) the the rest of the SPI buffer.
|
||||
* @param spiBuf
|
||||
* @param n Channel number. Example: If the ADC has 6 channels, n will be 5
|
||||
* @param sz
|
||||
* @param sz Will be incremented by amount which should be sent
|
||||
*/
|
||||
void prepareExternallyClockedRead0ToN(uint8_t* spiBuf, uint8_t n, size_t& sz);
|
||||
|
||||
@ -73,7 +73,7 @@ void prepareExternallyClockedRead0ToN(uint8_t* spiBuf, uint8_t n, size_t& sz);
|
||||
* Prepare an externally clocked temperature read. 25 bytes have to be sent
|
||||
* and the raw temperature value will appear on the last 2 bytes of the reply.
|
||||
* @param spiBuf
|
||||
* @param sz
|
||||
* @param sz Will be incremented by amount which should be sent
|
||||
*/
|
||||
void prepareExternallyClockedTemperatureRead(uint8_t* spiBuf, size_t& sz);
|
||||
|
||||
|
@ -19,7 +19,7 @@ ReturnValue_t NVMParameterBase::readJsonFile() {
|
||||
|
||||
ReturnValue_t NVMParameterBase::writeJsonFile() {
|
||||
std::ofstream o(fullName);
|
||||
o << std::setw(4) << json;
|
||||
o << std::setw(4) << json << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class NVMParameterBase : public HasReturnvaluesIF {
|
||||
ReturnValue_t setValue(std::string key, T value);
|
||||
|
||||
template <typename T>
|
||||
ReturnValue_t getValue(std::string key, T* value) const;
|
||||
ReturnValue_t getValue(std::string key, T& value) const;
|
||||
|
||||
void printKeys() const;
|
||||
void print() const;
|
||||
@ -67,11 +67,11 @@ inline ReturnValue_t NVMParameterBase::setValue(std::string key, T value) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline ReturnValue_t NVMParameterBase::getValue(std::string key, T* value) const {
|
||||
inline ReturnValue_t NVMParameterBase::getValue(std::string key, T& value) const {
|
||||
if (!json.contains(key)) {
|
||||
return KEY_NOT_EXISTS;
|
||||
}
|
||||
*value = json[key];
|
||||
value = json[key];
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
|
18
mission/memory/SdCardMountedIF.h
Normal file
18
mission/memory/SdCardMountedIF.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef MISSION_MEMORY_SDCARDMOUNTERIF_H_
|
||||
#define MISSION_MEMORY_SDCARDMOUNTERIF_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "definitions.h"
|
||||
|
||||
class SdCardMountedIF {
|
||||
public:
|
||||
virtual ~SdCardMountedIF(){};
|
||||
virtual std::string getCurrentMountPrefix(sd::SdCard prefSdCardPtr = sd::SdCard::NONE) = 0;
|
||||
virtual bool isSdCardMounted(sd::SdCard sdCard) = 0;
|
||||
virtual ReturnValue_t getPreferredSdCard(sd::SdCard& sdCard) const = 0;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif /* MISSION_MEMORY_SDCARDMOUNTERIF_H_ */
|
2
thirdparty/arcsec_star_tracker
vendored
2
thirdparty/arcsec_star_tracker
vendored
@ -1 +1 @@
|
||||
Subproject commit 7cb426a6a1f1b25ac02d7bfd0792c412451c70af
|
||||
Subproject commit b1594df9303056456604726592635d8a1c987e75
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit 85b5c756ea395155eff5b7cc2f4777ce62e45aa7
|
||||
Subproject commit 56d414d9fc0d6b05f967c47a0bd124fc06de2ad3
|
1
unittest/rebootLogic/.gitignore
vendored
Normal file
1
unittest/rebootLogic/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
11
unittest/rebootLogic/CMakeLists.txt
Normal file
11
unittest/rebootLogic/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
project(reboot-logic VERSION 0.1.0)
|
||||
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
|
||||
add_executable(reboot-logic main.cpp)
|
||||
|
||||
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
|
||||
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
|
||||
include(CPack)
|
5
unittest/rebootLogic/main.cpp
Normal file
5
unittest/rebootLogic/main.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include <iostream>
|
||||
|
||||
int main(int, char**) {
|
||||
std::cout << "Hello, world!\n";
|
||||
}
|
Loading…
Reference in New Issue
Block a user