PDEC Config Persistent #398
@ -40,6 +40,7 @@
|
|||||||
#include "linux/ipcore/PdecHandler.h"
|
#include "linux/ipcore/PdecHandler.h"
|
||||||
#include "linux/ipcore/Ptme.h"
|
#include "linux/ipcore/Ptme.h"
|
||||||
#include "linux/ipcore/PtmeConfig.h"
|
#include "linux/ipcore/PtmeConfig.h"
|
||||||
|
#include "mission/config/configfile.h"
|
||||||
#include "mission/csp/CspCookie.h"
|
#include "mission/csp/CspCookie.h"
|
||||||
#include "mission/system/fdir/AcsBoardFdir.h"
|
#include "mission/system/fdir/AcsBoardFdir.h"
|
||||||
#include "mission/system/fdir/GomspacePowerFdir.h"
|
#include "mission/system/fdir/GomspacePowerFdir.h"
|
||||||
@ -54,7 +55,6 @@
|
|||||||
#include "mission/system/tree/payloadModeTree.h"
|
#include "mission/system/tree/payloadModeTree.h"
|
||||||
#include "mission/system/tree/tcsModeTree.h"
|
#include "mission/system/tree/tcsModeTree.h"
|
||||||
#include "mission/utility/GlobalConfigHandler.h"
|
#include "mission/utility/GlobalConfigHandler.h"
|
||||||
#include "mission/config/configfile.h"
|
|
||||||
#include "tmtc/pusIds.h"
|
#include "tmtc/pusIds.h"
|
||||||
#if OBSW_TEST_LIBGPIOD == 1
|
#if OBSW_TEST_LIBGPIOD == 1
|
||||||
#include "linux/boardtest/LibgpiodTest.h"
|
#include "linux/boardtest/LibgpiodTest.h"
|
||||||
|
@ -1,42 +1,41 @@
|
|||||||
#include "LocalParameterHandler.h"
|
#include "LocalParameterHandler.h"
|
||||||
|
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
|
||||||
LocalParameterHandler::LocalParameterHandler(std::string sdRelativeName, SdCardMountedIF* sdcMan)
|
LocalParameterHandler::LocalParameterHandler(std::string sdRelativeName, SdCardMountedIF* sdcMan)
|
||||||
: NVMParameterBase(), sdRelativeName(sdRelativeName), sdcMan(sdcMan) {}
|
: NVMParameterBase(), sdRelativeName(sdRelativeName), sdcMan(sdcMan) {}
|
||||||
|
|
||||||
LocalParameterHandler::~LocalParameterHandler() {
|
LocalParameterHandler::~LocalParameterHandler() {}
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t LocalParameterHandler::initialize() {
|
ReturnValue_t LocalParameterHandler::initialize() {
|
||||||
ReturnValue_t result = updateFullName();
|
ReturnValue_t result = updateFullName();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = readJsonFile();
|
result = readJsonFile();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalParameterHandler::writeJsonFile() {
|
ReturnValue_t LocalParameterHandler::writeJsonFile() {
|
||||||
ReturnValue_t result = updateFullName();
|
ReturnValue_t result = updateFullName();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return NVMParameterBase::writeJsonFile();
|
return NVMParameterBase::writeJsonFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalParameterHandler::updateFullName() {
|
ReturnValue_t LocalParameterHandler::updateFullName() {
|
||||||
std::string mountPrefix;
|
std::string mountPrefix;
|
||||||
auto activeSd = sdcMan->getActiveSdCard();
|
auto activeSd = sdcMan->getActiveSdCard();
|
||||||
if (activeSd and sdcMan->isSdCardUsable(activeSd.value())) {
|
if (activeSd and sdcMan->isSdCardUsable(activeSd.value())) {
|
||||||
mountPrefix = sdcMan->getCurrentMountPrefix();
|
mountPrefix = sdcMan->getCurrentMountPrefix();
|
||||||
} else {
|
} else {
|
||||||
return SD_NOT_READY;
|
return SD_NOT_READY;
|
||||||
}
|
}
|
||||||
std::string fullname = mountPrefix + "/" + sdRelativeName;
|
std::string fullname = mountPrefix + "/" + sdRelativeName;
|
||||||
NVMParameterBase::setFullName(fullname);
|
NVMParameterBase::setFullName(fullname);
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_
|
#ifndef BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_
|
||||||
#define BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_
|
#define BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <mission/memory/NVMParameterBase.h>
|
#include <mission/memory/NVMParameterBase.h>
|
||||||
#include <mission/memory/SdCardMountedIF.h>
|
#include <mission/memory/SdCardMountedIF.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Class to handle persistent parameters
|
* @brief Class to handle persistent parameters
|
||||||
*
|
*
|
||||||
@ -13,17 +13,17 @@
|
|||||||
*/
|
*/
|
||||||
class LocalParameterHandler : public NVMParameterBase {
|
class LocalParameterHandler : public NVMParameterBase {
|
||||||
public:
|
public:
|
||||||
|
static constexpr uint8_t INTERFACE_ID = CLASS_ID::LOCAL_PARAM_HANDLER;
|
||||||
|
|
||||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::LOCAL_PARAM_HANDLER;
|
static constexpr ReturnValue_t SD_NOT_READY = returnvalue::makeCode(INTERFACE_ID, 0);
|
||||||
|
/**
|
||||||
static constexpr ReturnValue_t SD_NOT_READY = returnvalue::makeCode(INTERFACE_ID, 0);
|
* @brief Constructor
|
||||||
/**
|
*
|
||||||
* @brief Constructor
|
* @param sdRelativeName Absolute name of json file relative to mount
|
||||||
*
|
* directory of SD card.
|
||||||
* @param sdRelativeName Absolute name of json file relative to mount
|
* E.g. conf/example.json
|
||||||
* directory of SD card. E.g. conf/example.json
|
* @param sdcMan Pointer to SD card manager
|
||||||
* @param sdcMan Pointer to SD card manager
|
*/
|
||||||
*/
|
|
||||||
LocalParameterHandler(std::string sdRelativeName, SdCardMountedIF* sdcMan);
|
LocalParameterHandler(std::string sdRelativeName, SdCardMountedIF* sdcMan);
|
||||||
virtual ~LocalParameterHandler();
|
virtual ~LocalParameterHandler();
|
||||||
|
|
||||||
@ -46,7 +46,8 @@ class LocalParameterHandler : public NVMParameterBase {
|
|||||||
* @details The function will add the parameter only if it is not already
|
* @details The function will add the parameter only if it is not already
|
||||||
* present in the json file
|
* present in the json file
|
||||||
*/
|
*/
|
||||||
template<typename T> ReturnValue_t addParameter(std::string key, T value);
|
template <typename T>
|
||||||
|
ReturnValue_t addParameter(std::string key, T value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function will update a parameter which already exists in the json
|
* @brief Function will update a parameter which already exists in the json
|
||||||
@ -57,10 +58,10 @@ class LocalParameterHandler : public NVMParameterBase {
|
|||||||
*
|
*
|
||||||
* @return OK if successful, otherwise error return value
|
* @return OK if successful, otherwise error return value
|
||||||
*/
|
*/
|
||||||
template<typename T> ReturnValue_t updateParameter(std::string key, T value);
|
template <typename T>
|
||||||
|
ReturnValue_t updateParameter(std::string key, T value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Name relative to mount point of SD card where parameters will be stored
|
// Name relative to mount point of SD card where parameters will be stored
|
||||||
std::string sdRelativeName;
|
std::string sdRelativeName;
|
||||||
|
|
||||||
@ -77,28 +78,30 @@ class LocalParameterHandler : public NVMParameterBase {
|
|||||||
ReturnValue_t updateFullName();
|
ReturnValue_t updateFullName();
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T> inline ReturnValue_t LocalParameterHandler::addParameter(std::string key, T value) {
|
template <typename T>
|
||||||
ReturnValue_t result = insertValue(key, value);
|
inline ReturnValue_t LocalParameterHandler::addParameter(std::string key, T value) {
|
||||||
if (result != returnvalue::OK) {
|
ReturnValue_t result = insertValue(key, value);
|
||||||
return result;
|
if (result != returnvalue::OK) {
|
||||||
}
|
return result;
|
||||||
result = writeJsonFile();
|
}
|
||||||
if (result != returnvalue::OK) {
|
result = writeJsonFile();
|
||||||
return result;
|
if (result != returnvalue::OK) {
|
||||||
}
|
return result;
|
||||||
return returnvalue::OK;
|
}
|
||||||
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline ReturnValue_t LocalParameterHandler::updateParameter(std::string key, T value) {
|
template <typename T>
|
||||||
ReturnValue_t result = setValue(key, value);
|
inline ReturnValue_t LocalParameterHandler::updateParameter(std::string key, T value) {
|
||||||
if (result != returnvalue::OK) {
|
ReturnValue_t result = setValue(key, value);
|
||||||
return result;
|
if (result != returnvalue::OK) {
|
||||||
}
|
return result;
|
||||||
result = writeJsonFile();
|
}
|
||||||
if (result != returnvalue::OK) {
|
result = writeJsonFile();
|
||||||
return result;
|
if (result != returnvalue::OK) {
|
||||||
}
|
return result;
|
||||||
return returnvalue::OK;
|
}
|
||||||
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_ */
|
#endif /* BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_ */
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
namespace CLASS_ID {
|
namespace CLASS_ID {
|
||||||
enum {
|
enum {
|
||||||
CLASS_ID_START = COMMON_CLASS_ID_END,
|
CLASS_ID_START = COMMON_CLASS_ID_END,
|
||||||
SD_CARD_MANAGER, // SDMA
|
SD_CARD_MANAGER, // SDMA
|
||||||
SCRATCH_BUFFER, // SCBU
|
SCRATCH_BUFFER, // SCBU
|
||||||
LOCAL_PARAM_HANDLER, // LPH
|
LOCAL_PARAM_HANDLER, // LPH
|
||||||
CLASS_ID_END // [EXPORT] : [END]
|
CLASS_ID_END // [EXPORT] : [END]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "pdecconfigdefs.h"
|
#include "pdecconfigdefs.h"
|
||||||
|
|
||||||
PdecConfig::PdecConfig() : localParameterHandler("conf/pdecconfig.json", SdCardManager::instance()) {}
|
PdecConfig::PdecConfig()
|
||||||
|
: localParameterHandler("conf/pdecconfig.json", SdCardManager::instance()) {}
|
||||||
|
|
||||||
PdecConfig::~PdecConfig() {}
|
PdecConfig::~PdecConfig() {}
|
||||||
|
|
||||||
@ -19,28 +20,28 @@ ReturnValue_t PdecConfig::write() {
|
|||||||
}
|
}
|
||||||
ReturnValue_t result = initializePersistentParameters();
|
ReturnValue_t result = initializePersistentParameters();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = writeFrameHeaderFirstOctet();
|
result = writeFrameHeaderFirstOctet();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = writeFrameHeaderSecondOctet();
|
result = writeFrameHeaderSecondOctet();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
writeMapConfig();
|
writeMapConfig();
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PdecConfig::initializePersistentParameters() {
|
ReturnValue_t PdecConfig::initializePersistentParameters() {
|
||||||
ReturnValue_t result = localParameterHandler.initialize();
|
ReturnValue_t result = localParameterHandler.initialize();
|
||||||
if (result == HasFileSystemIF::FILE_DOES_NOT_EXIST) {
|
if (result == HasFileSystemIF::FILE_DOES_NOT_EXIST) {
|
||||||
result = createPersistentConfig();
|
result = createPersistentConfig();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,8 +52,8 @@ ReturnValue_t PdecConfig::createPersistentConfig() {
|
|||||||
sif::error << "PdecConfig::createPersistentConfig: Failed to set positive window" << std::endl;
|
sif::error << "PdecConfig::createPersistentConfig: Failed to set positive window" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = localParameterHandler.addParameter(
|
result = localParameterHandler.addParameter(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW,
|
||||||
pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, pdecconfigdefs::defaultvalue::negativeWindow);
|
pdecconfigdefs::defaultvalue::negativeWindow);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "PdecConfig::createPersistentConfig: Failed to set negative window" << std::endl;
|
sif::error << "PdecConfig::createPersistentConfig: Failed to set negative window" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "bsp_q7s/memory/LocalParameterHandler.h"
|
|
||||||
#include "bsp_q7s/fs/SdCardManager.h"
|
#include "bsp_q7s/fs/SdCardManager.h"
|
||||||
|
#include "bsp_q7s/memory/LocalParameterHandler.h"
|
||||||
#include "fsfw/returnvalues/returnvalue.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "pdec.h"
|
#include "pdec.h"
|
||||||
|
|
||||||
@ -19,9 +19,9 @@
|
|||||||
*/
|
*/
|
||||||
class PdecConfig {
|
class PdecConfig {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
PdecConfig();
|
PdecConfig();
|
||||||
virtual ~PdecConfig();
|
virtual ~PdecConfig();
|
||||||
|
|
||||||
@ -49,7 +49,6 @@ class PdecConfig {
|
|||||||
ReturnValue_t getNegativeWindow(uint8_t& negativeWindow);
|
ReturnValue_t getNegativeWindow(uint8_t& negativeWindow);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// TC transfer frame configuration parameters
|
// TC transfer frame configuration parameters
|
||||||
static const uint8_t VERSION_ID = 0;
|
static const uint8_t VERSION_ID = 0;
|
||||||
// BD Frames
|
// BD Frames
|
||||||
@ -66,25 +65,25 @@ class PdecConfig {
|
|||||||
static const uint8_t CONFIG_WORDS_NUM = 2;
|
static const uint8_t CONFIG_WORDS_NUM = 2;
|
||||||
|
|
||||||
// 0x200 / 4 = 0x80
|
// 0x200 / 4 = 0x80
|
||||||
static const uint32_t FRAME_HEADER_OFFSET = 0x80;
|
static const uint32_t FRAME_HEADER_OFFSET = 0x80;
|
||||||
|
|
||||||
static const uint32_t MAP_ADDR_LUT_OFFSET = 0xA0;
|
static const uint32_t MAP_ADDR_LUT_OFFSET = 0xA0;
|
||||||
static const uint32_t MAP_CLK_FREQ_OFFSET = 0x90;
|
static const uint32_t MAP_CLK_FREQ_OFFSET = 0x90;
|
||||||
// MAP clock frequency. Must be a value between 1 and 13 otherwise the TC segment will be
|
// MAP clock frequency. Must be a value between 1 and 13 otherwise the TC segment will be
|
||||||
// discarded
|
// discarded
|
||||||
static const uint8_t MAP_CLK_FREQ = 2;
|
static const uint8_t MAP_CLK_FREQ = 2;
|
||||||
|
|
||||||
static const uint8_t MAX_MAP_ADDR = 63;
|
static const uint8_t MAX_MAP_ADDR = 63;
|
||||||
// Writing this to the map address in the look up table will invalidate a MAP ID.
|
// Writing this to the map address in the look up table will invalidate a MAP ID.
|
||||||
static const uint8_t NO_DESTINATION = 0;
|
static const uint8_t NO_DESTINATION = 0;
|
||||||
static const uint8_t VALID_POSITION = 6;
|
static const uint8_t VALID_POSITION = 6;
|
||||||
static const uint8_t PARITY_POSITION = 7;
|
static const uint8_t PARITY_POSITION = 7;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TCs with map addresses (also know as Map IDs) assigned to this channel will be stored in
|
* TCs with map addresses (also know as Map IDs) assigned to this channel will be stored in
|
||||||
* the PDEC memory.
|
* the PDEC memory.
|
||||||
*/
|
*/
|
||||||
static const uint8_t PM_BUFFER = 7;
|
static const uint8_t PM_BUFFER = 7;
|
||||||
|
|
||||||
uint32_t* memoryBaseAddress = nullptr;
|
uint32_t* memoryBaseAddress = nullptr;
|
||||||
|
|
||||||
@ -103,30 +102,30 @@ class PdecConfig {
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t createPersistentConfig();
|
ReturnValue_t createPersistentConfig();
|
||||||
|
|
||||||
ReturnValue_t writeFrameHeaderFirstOctet();
|
ReturnValue_t writeFrameHeaderFirstOctet();
|
||||||
ReturnValue_t writeFrameHeaderSecondOctet();
|
ReturnValue_t writeFrameHeaderSecondOctet();
|
||||||
void writeMapConfig();
|
void writeMapConfig();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function calculates the entry for the configuration of the MAP ID routing.
|
* @brief This function calculates the entry for the configuration of the MAP ID routing.
|
||||||
*
|
*
|
||||||
* @param mapAddr The MAP ID to configure
|
* @param mapAddr The MAP ID to configure
|
||||||
* @param moduleId The destination module where all TCs with the map id mapAddr will be routed
|
* @param moduleId The destination module where all TCs with the map id mapAddr will be routed
|
||||||
* to.
|
* to.
|
||||||
*
|
*
|
||||||
* @details The PDEC has different modules where the TCs can be routed to. A lookup table is
|
* @details The PDEC has different modules where the TCs can be routed to. A lookup table is
|
||||||
* used which links the MAP ID field to the destination module. The entry for this
|
* used which links the MAP ID field to the destination module. The entry for this
|
||||||
* lookup table is created by this function and must be stored in the configuration
|
* lookup table is created by this function and must be stored in the configuration
|
||||||
* memory region of the PDEC. The entry has a specific format
|
* memory region of the PDEC. The entry has a specific format
|
||||||
*/
|
*/
|
||||||
uint8_t calcMapAddrEntry(uint8_t moduleId);
|
uint8_t calcMapAddrEntry(uint8_t moduleId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This functions calculates the odd parity of the bits in number.
|
* @brief This functions calculates the odd parity of the bits in number.
|
||||||
*
|
*
|
||||||
* @param number The number from which to calculate the odd parity.
|
* @param number The number from which to calculate the odd parity.
|
||||||
*/
|
*/
|
||||||
uint8_t getOddParity(uint8_t number);
|
uint8_t getOddParity(uint8_t number);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* LINUX_OBC_PDECCONFIG_H_ */
|
#endif /* LINUX_OBC_PDECCONFIG_H_ */
|
||||||
|
@ -30,7 +30,7 @@ PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId,
|
|||||||
pdecReset(pdecReset),
|
pdecReset(pdecReset),
|
||||||
actionHelper(this, nullptr),
|
actionHelper(this, nullptr),
|
||||||
uioNames(names),
|
uioNames(names),
|
||||||
paramHelper(this) {
|
paramHelper(this) {
|
||||||
auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
|
auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(
|
commandQueue = QueueFactory::instance()->createMessageQueue(
|
||||||
QUEUE_SIZE, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
QUEUE_SIZE, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
||||||
@ -91,33 +91,33 @@ ReturnValue_t PdecHandler::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PdecHandler::firstLoop() {
|
ReturnValue_t PdecHandler::firstLoop() {
|
||||||
ReturnValue_t result = pdecConfig.write();
|
ReturnValue_t result = pdecConfig.write();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (result == LocalParameterHandler::SD_NOT_READY) {
|
if (result == LocalParameterHandler::SD_NOT_READY) {
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
sif::error << "PdecHandler::firstLoop: Failed to write PDEC config" << std::endl;
|
sif::error << "PdecHandler::firstLoop: Failed to write PDEC config" << std::endl;
|
||||||
}
|
}
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = releasePdec();
|
result = releasePdec();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This configuration must be done while the PDEC is not held in reset.
|
// This configuration must be done while the PDEC is not held in reset.
|
||||||
if (OP_MODE == Modes::IRQ) {
|
if (OP_MODE == Modes::IRQ) {
|
||||||
// Configure interrupt mask register to enable interrupts
|
// Configure interrupt mask register to enable interrupts
|
||||||
*(registerBaseAddress + PDEC_IMR_OFFSET) = pdecConfig.getImrReg();
|
*(registerBaseAddress + PDEC_IMR_OFFSET) = pdecConfig.getImrReg();
|
||||||
}
|
}
|
||||||
result = resetFarStatFlag();
|
result = resetFarStatFlag();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
// Requires reconfiguration and reinitialization of PDEC
|
// Requires reconfiguration and reinitialization of PDEC
|
||||||
triggerEvent(INVALID_FAR);
|
triggerEvent(INVALID_FAR);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) {
|
ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) {
|
||||||
@ -134,7 +134,7 @@ ReturnValue_t PdecHandler::polledOperation() {
|
|||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case State::INIT: {
|
case State::INIT: {
|
||||||
handleInitState();
|
handleInitState();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case State::RUNNING: {
|
case State::RUNNING: {
|
||||||
@ -145,13 +145,13 @@ ReturnValue_t PdecHandler::polledOperation() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case State::PDEC_RESET: {
|
case State::PDEC_RESET: {
|
||||||
ReturnValue_t result = pdecToReset();
|
ReturnValue_t result = pdecToReset();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
triggerEvent(PDEC_RESET_FAILED);
|
triggerEvent(PDEC_RESET_FAILED);
|
||||||
}
|
}
|
||||||
state = State::INIT;
|
state = State::INIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case State::WAIT_FOR_RECOVERY:
|
case State::WAIT_FOR_RECOVERY:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -191,12 +191,12 @@ ReturnValue_t PdecHandler::irqOperation() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case State::PDEC_RESET: {
|
case State::PDEC_RESET: {
|
||||||
ReturnValue_t result = pdecToReset();
|
ReturnValue_t result = pdecToReset();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
triggerEvent(PDEC_RESET_FAILED);
|
triggerEvent(PDEC_RESET_FAILED);
|
||||||
}
|
}
|
||||||
state = State::INIT;
|
state = State::INIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case State::RUNNING: {
|
case State::RUNNING: {
|
||||||
checkAndHandleIrqs(fd, info);
|
checkAndHandleIrqs(fd, info);
|
||||||
@ -218,24 +218,24 @@ ReturnValue_t PdecHandler::irqOperation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PdecHandler::handleInitState() {
|
void PdecHandler::handleInitState() {
|
||||||
ReturnValue_t result = firstLoop();
|
ReturnValue_t result = firstLoop();
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (result == LocalParameterHandler::SD_NOT_READY) {
|
if (result == LocalParameterHandler::SD_NOT_READY) {
|
||||||
TaskFactory::delayTask(400);
|
TaskFactory::delayTask(400);
|
||||||
if (initTries == MAX_INIT_TRIES) {
|
if (initTries == MAX_INIT_TRIES) {
|
||||||
sif::error << "PdecHandler::handleInitState: SD card never "
|
sif::error << "PdecHandler::handleInitState: SD card never "
|
||||||
"becomes ready"
|
"becomes ready"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
state = State::WAIT_FOR_RECOVERY;
|
state = State::WAIT_FOR_RECOVERY;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
state = State::INIT;
|
state = State::INIT;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state = State::WAIT_FOR_RECOVERY;
|
state = State::WAIT_FOR_RECOVERY;
|
||||||
}
|
}
|
||||||
state = State::RUNNING;
|
state = State::RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PdecHandler::checkAndHandleIrqs(int fd, uint32_t& info) {
|
ReturnValue_t PdecHandler::checkAndHandleIrqs(int fd, uint32_t& info) {
|
||||||
@ -422,7 +422,8 @@ ReturnValue_t PdecHandler::pdecToReset() {
|
|||||||
result = gpioComIF->pullLow(pdecReset);
|
result = gpioComIF->pullLow(pdecReset);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "PdecHandler::pdecToReset: Failed to pull PDEC reset line"
|
sif::error << "PdecHandler::pdecToReset: Failed to pull PDEC reset line"
|
||||||
" to low" << std::endl;
|
" to low"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
#include "eive/definitions.h"
|
#include "eive/definitions.h"
|
||||||
#include "fsfw/action/ActionHelper.h"
|
#include "fsfw/action/ActionHelper.h"
|
||||||
#include "fsfw/action/HasActionsIF.h"
|
#include "fsfw/action/HasActionsIF.h"
|
||||||
#include "fsfw/parameters/ReceivesParameterMessagesIF.h"
|
|
||||||
#include "fsfw/parameters/ParameterHelper.h"
|
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
|
#include "fsfw/parameters/ParameterHelper.h"
|
||||||
|
#include "fsfw/parameters/ReceivesParameterMessagesIF.h"
|
||||||
#include "fsfw/returnvalues/returnvalue.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
@ -103,8 +103,7 @@ class PdecHandler : public SystemObject,
|
|||||||
static constexpr Event WRITE_SYSCALL_ERROR_PDEC =
|
static constexpr Event WRITE_SYSCALL_ERROR_PDEC =
|
||||||
event::makeEvent(SUBSYSTEM_ID, 9, severity::MEDIUM);
|
event::makeEvent(SUBSYSTEM_ID, 9, severity::MEDIUM);
|
||||||
//! [EXPORT] : [COMMENT] Failed to pull PDEC reset to low
|
//! [EXPORT] : [COMMENT] Failed to pull PDEC reset to low
|
||||||
static constexpr Event PDEC_RESET_FAILED =
|
static constexpr Event PDEC_RESET_FAILED = event::makeEvent(SUBSYSTEM_ID, 10, severity::HIGH);
|
||||||
event::makeEvent(SUBSYSTEM_ID, 10, severity::HIGH);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER;
|
static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER;
|
||||||
@ -175,11 +174,11 @@ class PdecHandler : public SystemObject,
|
|||||||
static const uint32_t MAX_INIT_TRIES = 20;
|
static const uint32_t MAX_INIT_TRIES = 20;
|
||||||
|
|
||||||
class ParameterId {
|
class ParameterId {
|
||||||
public:
|
public:
|
||||||
// ID of the parameter to update the positive window of AD frames
|
// ID of the parameter to update the positive window of AD frames
|
||||||
static const uint8_t POSITIVE_WINDOW = 0;
|
static const uint8_t POSITIVE_WINDOW = 0;
|
||||||
// ID of the parameter to update the negative window of AD frames
|
// ID of the parameter to update the negative window of AD frames
|
||||||
static const uint8_t NEGATIVE_WINDOW = 1;
|
static const uint8_t NEGATIVE_WINDOW = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr uint32_t MAX_ALLOWED_IRQS_PER_WINDOW = 800;
|
static constexpr uint32_t MAX_ALLOWED_IRQS_PER_WINDOW = 800;
|
||||||
@ -377,7 +376,6 @@ class PdecHandler : public SystemObject,
|
|||||||
*/
|
*/
|
||||||
uint8_t calcMapAddrEntry(uint8_t moduleId);
|
uint8_t calcMapAddrEntry(uint8_t moduleId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* brief Returns the 32-bit wide communication link control word (CLCW)
|
* brief Returns the 32-bit wide communication link control word (CLCW)
|
||||||
*/
|
*/
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
namespace pdecconfigdefs {
|
namespace pdecconfigdefs {
|
||||||
|
|
||||||
namespace paramkeys {
|
namespace paramkeys {
|
||||||
static const std::string POSITIVE_WINDOW = "positive_window";
|
static const std::string POSITIVE_WINDOW = "positive_window";
|
||||||
static const std::string NEGATIVE_WINDOW = "negattive_window";
|
static const std::string NEGATIVE_WINDOW = "negattive_window";
|
||||||
}
|
} // namespace paramkeys
|
||||||
|
|
||||||
namespace defaultvalue {
|
namespace defaultvalue {
|
||||||
static const uint8_t positiveWindow = 10;
|
static const uint8_t positiveWindow = 10;
|
||||||
static const uint8_t negativeWindow = 151;
|
static const uint8_t negativeWindow = 151;
|
||||||
}
|
} // namespace defaultvalue
|
||||||
|
|
||||||
}
|
} // namespace pdecconfigdefs
|
||||||
|
|
||||||
#endif /* LINUX_IPCORE_PDECCONFIGDEFS_H_ */
|
#endif /* LINUX_IPCORE_PDECCONFIGDEFS_H_ */
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#define MISSION_CONFIG_CONFIGFILE_H_
|
#define MISSION_CONFIG_CONFIGFILE_H_
|
||||||
|
|
||||||
namespace configfile {
|
namespace configfile {
|
||||||
// Name of global config file relative to currently mounted SD card
|
// Name of global config file relative to currently mounted SD card
|
||||||
static const char sdrelative[] = "config/global_config.json";
|
static const char sdrelative[] = "config/global_config.json";
|
||||||
}
|
} // namespace configfile
|
||||||
|
|
||||||
#endif /* MISSION_CONFIG_CONFIGFILE_H_ */
|
#endif /* MISSION_CONFIG_CONFIGFILE_H_ */
|
||||||
|
@ -111,8 +111,7 @@ void Guidance::targetQuatPtgSingleAxis(timeval now, double posSatE[3], double ve
|
|||||||
if (sightAngleSun < critSightAngle) {
|
if (sightAngleSun < critSightAngle) {
|
||||||
strBlindAvoidFlag = true;
|
strBlindAvoidFlag = true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (sightAngleSun < blindEnd * exclAngle) {
|
if (sightAngleSun < blindEnd * exclAngle) {
|
||||||
double normBlindRefRate = acsParameters.targetModeControllerParameters.blindRotRate;
|
double normBlindRefRate = acsParameters.targetModeControllerParameters.blindRotRate;
|
||||||
double blindRefRate[3] = {0, 0, 0};
|
double blindRefRate[3] = {0, 0, 0};
|
||||||
|
@ -1098,7 +1098,7 @@ void MultiplicativeKalmanFilter::reset(acsctrl::MekfData *mekfData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MultiplicativeKalmanFilter::updateDataSetWithoutData(acsctrl::MekfData *mekfData,
|
void MultiplicativeKalmanFilter::updateDataSetWithoutData(acsctrl::MekfData *mekfData,
|
||||||
MekfStatus mekfStatus) {
|
MekfStatus mekfStatus) {
|
||||||
{
|
{
|
||||||
PoolReadGuard pg(mekfData);
|
PoolReadGuard pg(mekfData);
|
||||||
if (pg.getReadResult() == returnvalue::OK) {
|
if (pg.getReadResult() == returnvalue::OK) {
|
||||||
@ -1114,9 +1114,8 @@ void MultiplicativeKalmanFilter::updateDataSetWithoutData(acsctrl::MekfData *mek
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiplicativeKalmanFilter::updateDataSet(acsctrl::MekfData *mekfData,
|
void MultiplicativeKalmanFilter::updateDataSet(acsctrl::MekfData *mekfData, MekfStatus mekfStatus,
|
||||||
MekfStatus mekfStatus, double quat[4],
|
double quat[4], double satRotRate[3]) {
|
||||||
double satRotRate[3]) {
|
|
||||||
{
|
{
|
||||||
PoolReadGuard pg(mekfData);
|
PoolReadGuard pg(mekfData);
|
||||||
if (pg.getReadResult() == returnvalue::OK) {
|
if (pg.getReadResult() == returnvalue::OK) {
|
||||||
|
@ -69,7 +69,7 @@ inline ReturnValue_t NVMParameterBase::insertValue(std::string key, T value) {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline ReturnValue_t NVMParameterBase::setValue(std::string key, T value) {
|
inline ReturnValue_t NVMParameterBase::setValue(std::string key, T value) {
|
||||||
json[key] = value;
|
json[key] = value;
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF {
|
|||||||
* @param maxNumberOfSequences
|
* @param maxNumberOfSequences
|
||||||
* @param maxNumberOfTables
|
* @param maxNumberOfTables
|
||||||
* @param transmitterTimeout Maximum time the transmitter of the syrlinks
|
* @param transmitterTimeout Maximum time the transmitter of the syrlinks
|
||||||
* will be
|
* will
|
||||||
* enabled
|
* be enabled
|
||||||
*/
|
*/
|
||||||
ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables,
|
ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables,
|
||||||
uint32_t transmitterTimeout);
|
uint32_t transmitterTimeout);
|
||||||
|
@ -11,12 +11,6 @@
|
|||||||
static constexpr double PARAM0_DEFAULT = 5.0;
|
static constexpr double PARAM0_DEFAULT = 5.0;
|
||||||
static constexpr int PARAM1_DEFAULT = 905;
|
static constexpr int PARAM1_DEFAULT = 905;
|
||||||
|
|
||||||
enum ParamIds : uint8_t {
|
enum ParamIds : uint8_t { PARAM0 = 0, PARAM1 = 1, PARAM2 = 2, PDEC_PW = 3, PDEC_NW = 4 };
|
||||||
PARAM0 = 0,
|
|
||||||
PARAM1 = 1,
|
|
||||||
PARAM2 = 2,
|
|
||||||
PDEC_PW = 3,
|
|
||||||
PDEC_NW = 4
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* MISSION_UTILITY_GLOBALCONFIGFILEDEFINITIONS_H_ */
|
#endif /* MISSION_UTILITY_GLOBALCONFIGFILEDEFINITIONS_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user