meier/pdec #110
@ -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_0_DEV[] = "/dev/ttyUL0";
|
||||||
static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2";
|
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 {
|
namespace gpioNames {
|
||||||
static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select";
|
static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select";
|
||||||
static constexpr char GYRO_1_L3G_CS[] = "gyro_1_l3g_chip_select";
|
static constexpr char GYRO_1_L3G_CS[] = "gyro_1_l3g_chip_select";
|
||||||
|
@ -960,7 +960,8 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) {
|
|||||||
|
|
||||||
gpioComIF->addGpios(gpioCookiePdec);
|
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
|
#if BOARD_TE0720 == 0
|
||||||
GpioCookie* gpioRS485Chip = new GpioCookie;
|
GpioCookie* gpioRS485Chip = new GpioCookie;
|
||||||
|
@ -2,6 +2,7 @@ target_sources(${TARGET_NAME} PUBLIC
|
|||||||
PapbVcInterface.cpp
|
PapbVcInterface.cpp
|
||||||
Ptme.cpp
|
Ptme.cpp
|
||||||
PdecHandler.cpp
|
PdecHandler.cpp
|
||||||
|
PdecConfig.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
33
linux/obc/PdecConfig.cpp
Normal file
33
linux/obc/PdecConfig.cpp
Normal 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];
|
||||||
|
}
|
@ -5,29 +5,46 @@
|
|||||||
#include <cstring>
|
#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
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
namespace PdecConfig {
|
class PdecConfig {
|
||||||
|
|
||||||
// Access to register space of PDEC via the AXI to AHB bridge
|
public:
|
||||||
static const char UIO_PDEC_REGISTERS[] = "/dev/uio0";
|
PdecConfig();
|
||||||
// Direct access to memory area in DDR assigned to PDEC
|
virtual ~PdecConfig();
|
||||||
static const char UIO_PDEC_MEMORY[] = "/dev/uio2";
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the configuration word by specifying the position.
|
||||||
|
*/
|
||||||
|
uint32_t getConfigWord(uint8_t wordNo);
|
||||||
|
|
||||||
|
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;
|
||||||
// static const uint8_t BYPASS_FLAG = 1;
|
// BD Frames
|
||||||
// static const uint8_t CONTROL_COMMAND_FLAG = 1;
|
static const uint8_t BYPASS_FLAG = 1;
|
||||||
static const uint8_t BYPASS_FLAG = 0;
|
|
||||||
static const uint8_t CONTROL_COMMAND_FLAG = 0;
|
static const uint8_t CONTROL_COMMAND_FLAG = 0;
|
||||||
|
|
||||||
static const uint8_t VIRTUAL_CHANNEL = 0;
|
static const uint8_t VIRTUAL_CHANNEL = 0;
|
||||||
static const uint8_t RESERVED_FIELD_A = 0;
|
static const uint8_t RESERVED_FIELD_A = 0;
|
||||||
static const uint16_t SPACECRAFT_ID = 0x274;
|
static const uint16_t SPACECRAFT_ID = 0x274;
|
||||||
|
static const uint16_t DUMMY_BITS = 0;
|
||||||
// Parameters to control the FARM for AD frames
|
// Parameters to control the FARM for AD frames
|
||||||
|
// Set here for future use
|
||||||
static const uint8_t POSITIVE_WINDOW = 10;
|
static const uint8_t POSITIVE_WINDOW = 10;
|
||||||
static const uint8_t NEGATIVE_WINDOW = 151;
|
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_ */
|
#endif /* LINUX_OBC_PDECCONFIG_H_ */
|
||||||
|
@ -9,10 +9,11 @@
|
|||||||
#include "fsfw/tmtcservices/TmTcMessage.h"
|
#include "fsfw/tmtcservices/TmTcMessage.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
|
|
||||||
PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId, LinuxLibgpioIF* gpioComIF,
|
PdecHandler::PdecHandler(object_id_t objectId, object_id_t tcDestinationId,
|
||||||
gpioId_t pdecReset) :
|
LinuxLibgpioIF* gpioComIF, gpioId_t pdecReset, std::string uioMemory,
|
||||||
|
std::string uioRegisters) :
|
||||||
SystemObject(objectId), tcDestinationId(tcDestinationId), gpioComIF(gpioComIF), pdecReset(
|
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() {
|
ReturnValue_t PdecHandler::getRegisterAddress() {
|
||||||
int fd = open(PdecConfig::UIO_PDEC_REGISTERS, O_RDWR);
|
int fd = open(uioRegisters.c_str(), O_RDWR);
|
||||||
if (fd < 1) {
|
if (fd < 1) {
|
||||||
sif::warning << "PdecHandler::getRegisterAddress: Invalid UIO device file" << std::endl;
|
sif::warning << "PdecHandler::getRegisterAddress: Invalid UIO device file" << std::endl;
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
@ -76,7 +77,7 @@ ReturnValue_t PdecHandler::getRegisterAddress() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PdecHandler::getMemoryBaseAddress() {
|
ReturnValue_t PdecHandler::getMemoryBaseAddress() {
|
||||||
int fd = open(PdecConfig::UIO_PDEC_MEMORY, O_RDWR);
|
int fd = open(uioMemory.c_str(), O_RDWR);
|
||||||
if (fd < 1) {
|
if (fd < 1) {
|
||||||
sif::warning << "PdecHandler::getMemoryBaseAddress: Invalid UIO device file" << std::endl;
|
sif::warning << "PdecHandler::getMemoryBaseAddress: Invalid UIO device file" << std::endl;
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
@ -94,17 +95,11 @@ ReturnValue_t PdecHandler::getMemoryBaseAddress() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PdecHandler::writePdecConfig() {
|
void PdecHandler::writePdecConfig() {
|
||||||
PdecParams_t pdecParams;
|
|
||||||
pdecParams.versionId = 0;
|
PdecConfig pdecConfig;
|
||||||
pdecParams.bypassFlag = PdecConfig::BYPASS_FLAG;
|
|
||||||
pdecParams.controlCommandFlag = PdecConfig::CONTROL_COMMAND_FLAG;
|
*memoryBaseAddress = pdecConfig.getConfigWord(0);
|
||||||
pdecParams.reservedFieldA = 0;
|
*(memoryBaseAddress + 1) = pdecConfig.getConfigWord(1);
|
||||||
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));
|
|
||||||
|
|
||||||
// uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER);
|
// uint8_t routeToPm = calcMapAddrEntry(PM_BUFFER);
|
||||||
// Configure all MAP IDs as invalid
|
// Configure all MAP IDs as invalid
|
||||||
|
@ -37,9 +37,11 @@ public:
|
|||||||
* @param tcDestinationId Object ID of object responsible for processing TCs.
|
* @param tcDestinationId Object ID of object responsible for processing TCs.
|
||||||
* @param gpioComIF Pointer to GPIO interace responsible for driving GPIOs.
|
* @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 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,
|
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();
|
virtual ~PdecHandler();
|
||||||
|
|
||||||
@ -148,25 +150,6 @@ private:
|
|||||||
INCORRECT_BC_CC
|
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 {
|
enum class State: uint8_t {
|
||||||
INIT,
|
INIT,
|
||||||
RUNNING,
|
RUNNING,
|
||||||
@ -269,10 +252,6 @@ private:
|
|||||||
|
|
||||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
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
|
* Reset signal is required to hold PDEC in reset state until the configuration has been
|
||||||
* written to the appropriate memory space.
|
* written to the appropriate memory space.
|
||||||
@ -280,6 +259,16 @@ private:
|
|||||||
*/
|
*/
|
||||||
gpioId_t pdecReset = gpio::NO_GPIO;
|
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.
|
* 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
|
* This address is equivalent with the base address of the section named configuration area in
|
||||||
|
Loading…
Reference in New Issue
Block a user