v1.9.0 #175

Merged
muellerr merged 623 commits from develop into main 2022-03-08 10:32:41 +01:00
7 changed files with 89 additions and 50 deletions
Showing only changes of commit 3e2f4e7a10 - Show all commits

View File

@ -16,6 +16,9 @@ static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8";
static constexpr char UART_GNSS_0_DEV[] = "/dev/ttyUL0";
static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2";
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
static constexpr char UIO_PDEC_MEMORY[] = "/dev/uio2";
namespace gpioNames {
static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select";
static constexpr char GYRO_1_L3G_CS[] = "gyro_1_l3g_chip_select";

View File

@ -960,7 +960,8 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) {
gpioComIF->addGpios(gpioCookiePdec);
new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET);
new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET,
std::string(q7s::UIO_PDEC_MEMORY), std::string(q7s::UIO_PDEC_REGISTERS));
#if BOARD_TE0720 == 0
GpioCookie* gpioRS485Chip = new GpioCookie;

View File

@ -2,6 +2,7 @@ target_sources(${TARGET_NAME} PUBLIC
PapbVcInterface.cpp
Ptme.cpp
PdecHandler.cpp
PdecConfig.cpp
)

33
linux/obc/PdecConfig.cpp Normal file
View File

@ -0,0 +1,33 @@
#include "PdecConfig.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
PdecConfig::PdecConfig() {
initialize();
}
PdecConfig::~PdecConfig() {
}
void PdecConfig::initialize() {
uint32_t word = 0;
word |= (VERSION_ID << 30);
word |= (BYPASS_FLAG << 29);
word |= (CONTROL_COMMAND_FLAG << 28);
word |= (RESERVED_FIELD_A << 26);
word |= (SPACECRAFT_ID << 16);
word |= (VIRTUAL_CHANNEL << 10);
word |= (DUMMY_BITS << 8);
word |= POSITIVE_WINDOW;
configWords[0] = word;
word = 0;
word |= (NEGATIVE_WINDOW << 24);
}
uint32_t PdecConfig::getConfigWord(uint8_t wordNo) {
if (wordNo >= CONFIG_WORDS_NUM) {
sif::error << "PdecConfig::getConfigWord: Invalid word number" << std::endl;
return 0;
}
return configWords[wordNo];
}

View File

@ -5,29 +5,46 @@
#include <cstring>
/**
* @brief PDEC specific configuration parameters.
* @brief This class generates the configuration words for the configuration memory of the PDEC
* IP Cores.
*
* @details Fields are initialized according to pecification in PDEC datasheet section 6.11.3.1
* PROM usage.
*
* @author J. Meier
*/
namespace PdecConfig {
class PdecConfig {
// Access to register space of PDEC via the AXI to AHB bridge
static const char UIO_PDEC_REGISTERS[] = "/dev/uio0";
// Direct access to memory area in DDR assigned to PDEC
static const char UIO_PDEC_MEMORY[] = "/dev/uio2";
public:
PdecConfig();
virtual ~PdecConfig();
/**
* @brief Returns the configuration word by specifying the position.
*/
uint32_t getConfigWord(uint8_t wordNo);
private:
// TC transfer frame configuration parameters
static const uint8_t VERSION_ID = 0;
// static const uint8_t BYPASS_FLAG = 1;
// static const uint8_t CONTROL_COMMAND_FLAG = 1;
static const uint8_t BYPASS_FLAG = 0;
// BD Frames
static const uint8_t BYPASS_FLAG = 1;
static const uint8_t CONTROL_COMMAND_FLAG = 0;
static const uint8_t VIRTUAL_CHANNEL = 0;
static const uint8_t RESERVED_FIELD_A = 0;
static const uint16_t SPACECRAFT_ID = 0x274;
static const uint16_t DUMMY_BITS = 0;
// Parameters to control the FARM for AD frames
// Set here for future use
static const uint8_t POSITIVE_WINDOW = 10;
static const uint8_t NEGATIVE_WINDOW = 151;
static const uint8_t CONFIG_WORDS_NUM = 2;
uint32_t configWords[CONFIG_WORDS_NUM];
void initialize();
};
#endif /* LINUX_OBC_PDECCONFIG_H_ */

View File

@ -9,10 +9,11 @@
#include "fsfw/tmtcservices/TmTcMessage.h"
#include "fsfw/objectmanager/ObjectManager.h"
PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId, LinuxLibgpioIF* gpioComIF,
gpioId_t pdecReset) :
PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId,
LinuxLibgpioIF* gpioComIF, gpioId_t pdecReset, std::string uioMemory,
std::string uioRegisters) :
SystemObject(objectId), tcDestinationId(tcDestinationId), gpioComIF(gpioComIF), pdecReset(
pdecReset) {
pdecReset), uioMemory(uioMemory), uioRegisters(uioRegisters) {
}
@ -58,7 +59,7 @@ ReturnValue_t PdecHandler::initialize() {
}
ReturnValue_t PdecHandler::getRegisterAddress() {
int fd = open(PdecConfig::UIO_PDEC_REGISTERS, O_RDWR);
int fd = open(uioRegisters.c_str(), O_RDWR);
if (fd < 1) {
sif::warning << "PdecHandler::getRegisterAddress: Invalid UIO device file" << std::endl;
return RETURN_FAILED;
@ -76,7 +77,7 @@ ReturnValue_t PdecHandler::getRegisterAddress() {
}
ReturnValue_t PdecHandler::getMemoryBaseAddress() {
int fd = open(PdecConfig::UIO_PDEC_MEMORY, O_RDWR);
int fd = open(uioMemory.c_str(), O_RDWR);
if (fd < 1) {
sif::warning << "PdecHandler::getMemoryBaseAddress: Invalid UIO device file" << std::endl;
return RETURN_FAILED;
@ -94,17 +95,11 @@ ReturnValue_t PdecHandler::getMemoryBaseAddress() {
}
void PdecHandler::writePdecConfig() {
PdecParams_t pdecParams;
pdecParams.versionId = 0;
pdecParams.bypassFlag = PdecConfig::BYPASS_FLAG;
pdecParams.controlCommandFlag = PdecConfig::CONTROL_COMMAND_FLAG;
pdecParams.reservedFieldA = 0;
pdecParams.spacecraftId = PdecConfig::SPACECRAFT_ID;
pdecParams.virtualChannelId = PdecConfig::VIRTUAL_CHANNEL;
pdecParams.dummy = 0;
pdecParams.positiveWindow = PdecConfig::POSITIVE_WINDOW;
pdecParams.negativeWindow = PdecConfig::NEGATIVE_WINDOW;
std::memcpy(memoryBaseAddress, &pdecParams, sizeof(pdecParams));
PdecConfig pdecConfig;
*memoryBaseAddress = pdecConfig.getConfigWord(0);
*(memoryBaseAddress + 1) = pdecConfig.getConfigWord(1);
// uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER);
// Configure all MAP IDs as invalid

View File

@ -37,9 +37,11 @@ public:
* @param tcDestinationId Object ID of object responsible for processing TCs.
* @param gpioComIF Pointer to GPIO interace responsible for driving GPIOs.
* @param pdecReset GPIO ID of GPIO connected to the reset signal of the PDEC.
* @param uioMemory String of uio device file same mapped to the PDEC memory space
* @param uioregsiters String of uio device file same mapped to the PDEC register space
*/
PdecHandler(object_id_t objectId, object_id_t tcDestinationId, LinuxLibgpioIF* gpioComIF,
gpioId_t pdecReset);
gpioId_t pdecReset, std::string uioMemory, std::string uioRegisters);
virtual ~PdecHandler();
@ -148,25 +150,6 @@ private:
INCORRECT_BC_CC
};
typedef struct PdecParams {
uint8_t versionId : 2 ;
uint8_t bypassFlag : 1;
uint8_t controlCommandFlag : 1;
uint8_t reservedFieldA : 2;
uint16_t spacecraftId : 10;
uint8_t virtualChannelId : 6;
uint8_t dummy : 2;
uint8_t positiveWindow;
uint8_t negativeWindow;
//Authentication unit not used for EIVE
uint8_t auMapIdPointer = 0;
// De-randomizing enabled
uint8_t derandomiserConfig = 1;
// Only used when AU is enabled. Enables the use of an external recovery lac counter.
// The AU requires a lac counter to generate the signature.
uint8_t recoveryLacConfig = 0;
} PdecParams_t;
enum class State: uint8_t {
INIT,
RUNNING,
@ -269,10 +252,6 @@ private:
LinuxLibgpioIF* gpioComIF = nullptr;
StorageManagerIF* tcStore = nullptr;
State state = State::INIT;
/**
* Reset signal is required to hold PDEC in reset state until the configuration has been
* written to the appropriate memory space.
@ -280,6 +259,16 @@ private:
*/
gpioId_t pdecReset = gpio::NO_GPIO;
// UIO device file giving access to the PDEC memory space
std::string uioMemory;
// UIO device file giving access to the PDEC register space
std::string uioRegisters;
StorageManagerIF* tcStore = nullptr;
State state = State::INIT;
/**
* Pointer pointing to base address of the PDEC memory space.
* This address is equivalent with the base address of the section named configuration area in