v1.9.0 #175
@ -17,7 +17,16 @@ static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL7";
|
|||||||
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
|
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
|
||||||
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
|
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
|
||||||
static constexpr char UIO_PDEC_RAM[] = "/dev/uio3";
|
static constexpr char UIO_PDEC_RAM[] = "/dev/uio3";
|
||||||
static constexpr char UIO_PTME_CONFIG[] = "/dev/uio4";
|
static constexpr char UIO_PTME[] = "/dev/uio1";
|
||||||
|
static constexpr int MAP_ID_PTME_CONFIG = 3;
|
||||||
|
|
||||||
|
namespace uiomapids {
|
||||||
|
static const int PTME_VC0 = 0;
|
||||||
|
static const int PTME_VC1 = 1;
|
||||||
|
static const int PTME_VC2 = 2;
|
||||||
|
static const int PTME_VC3 = 3;
|
||||||
|
static const int PTME_CONFIG = 4;
|
||||||
|
}
|
||||||
|
|
||||||
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";
|
||||||
|
@ -115,12 +115,14 @@ void initmission::initTasks() {
|
|||||||
}
|
}
|
||||||
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||||
|
|
||||||
|
#if OBSW_ADD_ACS_HANDLERS == 1
|
||||||
PeriodicTaskIF* acsCtrl = factory->createPeriodicTask(
|
PeriodicTaskIF* acsCtrl = factory->createPeriodicTask(
|
||||||
"ACS_CTRL", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
"ACS_CTRL", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||||
result = acsCtrl->addComponent(objects::GPS_CONTROLLER);
|
result = acsCtrl->addComponent(objects::GPS_CONTROLLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("ACS_CTRL", objects::GPS_CONTROLLER);
|
initmission::printAddObjectError("ACS_CTRL", objects::GPS_CONTROLLER);
|
||||||
}
|
}
|
||||||
|
#endif /* OBSW_ADD_ACS_HANDLERS */
|
||||||
|
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
||||||
|
@ -928,14 +928,18 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
gpioComIF->addGpios(gpioCookiePtmeIp);
|
gpioComIF->addGpios(gpioCookiePtmeIp);
|
||||||
|
|
||||||
// Creating virtual channel interfaces
|
// Creating virtual channel interfaces
|
||||||
VcInterfaceIF* vc0 = new PapbVcInterface(objects::PAPB_VC0, gpioComIF, gpioIds::VC0_PAPB_BUSY,
|
VcInterfaceIF* vc0 =
|
||||||
gpioIds::VC0_PAPB_EMPTY, PtmeConfig::VC0_OFFSETT);
|
new PapbVcInterface(objects::PAPB_VC0, gpioComIF, gpioIds::VC0_PAPB_BUSY,
|
||||||
VcInterfaceIF* vc1 = new PapbVcInterface(objects::PAPB_VC1, gpioComIF, gpioIds::VC1_PAPB_BUSY,
|
gpioIds::VC0_PAPB_EMPTY, q7s::UIO_PTME, q7s::uiomapids::PTME_VC0);
|
||||||
gpioIds::VC1_PAPB_EMPTY, PtmeConfig::VC1_OFFSETT);
|
VcInterfaceIF* vc1 =
|
||||||
VcInterfaceIF* vc2 = new PapbVcInterface(objects::PAPB_VC2, gpioComIF, gpioIds::VC2_PAPB_BUSY,
|
new PapbVcInterface(objects::PAPB_VC1, gpioComIF, gpioIds::VC1_PAPB_BUSY,
|
||||||
gpioIds::VC2_PAPB_EMPTY, PtmeConfig::VC2_OFFSETT);
|
gpioIds::VC1_PAPB_EMPTY, q7s::UIO_PTME, q7s::uiomapids::PTME_VC1);
|
||||||
VcInterfaceIF* vc3 = new PapbVcInterface(objects::PAPB_VC3, gpioComIF, gpioIds::VC3_PAPB_BUSY,
|
VcInterfaceIF* vc2 =
|
||||||
gpioIds::VC3_PAPB_EMPTY, PtmeConfig::VC3_OFFSETT);
|
new PapbVcInterface(objects::PAPB_VC2, gpioComIF, gpioIds::VC2_PAPB_BUSY,
|
||||||
|
gpioIds::VC2_PAPB_EMPTY, q7s::UIO_PTME, q7s::uiomapids::PTME_VC2);
|
||||||
|
VcInterfaceIF* vc3 =
|
||||||
|
new PapbVcInterface(objects::PAPB_VC3, gpioComIF, gpioIds::VC3_PAPB_BUSY,
|
||||||
|
gpioIds::VC3_PAPB_EMPTY, q7s::UIO_PTME, q7s::uiomapids::PTME_VC3);
|
||||||
|
|
||||||
// Creating ptme object and adding virtual channel interfaces
|
// Creating ptme object and adding virtual channel interfaces
|
||||||
Ptme* ptme = new Ptme(objects::PTME);
|
Ptme* ptme = new Ptme(objects::PTME);
|
||||||
@ -944,8 +948,8 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
ptme->addVcInterface(ccsds::VC2, vc2);
|
ptme->addVcInterface(ccsds::VC2, vc2);
|
||||||
ptme->addVcInterface(ccsds::VC3, vc3);
|
ptme->addVcInterface(ccsds::VC3, vc3);
|
||||||
|
|
||||||
PtmeAxiConfig* ptmeAxiConfig = new PtmeAxiConfig(objects::PTME_AXI_CONFIG,
|
PtmeAxiConfig* ptmeAxiConfig =
|
||||||
std::string(q7s::UIO_PTME_CONFIG));
|
new PtmeAxiConfig(objects::PTME_AXI_CONFIG, q7s::UIO_PTME, q7s::uiomapids::PTME_CONFIG);
|
||||||
TxRateSetterIF* txRateSetterIF = new PtmeRateSetter(objects::TX_RATE_SETTER, ptmeAxiConfig);
|
TxRateSetterIF* txRateSetterIF = new PtmeRateSetter(objects::TX_RATE_SETTER, ptmeAxiConfig);
|
||||||
CCSDSHandler* ccsdsHandler = new CCSDSHandler(
|
CCSDSHandler* ccsdsHandler = new CCSDSHandler(
|
||||||
objects::CCSDS_HANDLER, objects::PTME, objects::CCSDS_PACKET_DISTRIBUTOR, txRateSetterIF,
|
objects::CCSDS_HANDLER, objects::PTME, objects::CCSDS_PACKET_DISTRIBUTOR, txRateSetterIF,
|
||||||
|
@ -1,45 +1,47 @@
|
|||||||
#include <linux/obc/PapbVcInterface.h>
|
#include <linux/obc/PapbVcInterface.h>
|
||||||
|
#include <fsfw_hal/linux/uio/UioMapper.h>
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
PapbVcInterface::PapbVcInterface(object_id_t objectId, LinuxLibgpioIF* gpioComIF,
|
PapbVcInterface::PapbVcInterface(object_id_t objectId, LinuxLibgpioIF* gpioComIF,
|
||||||
gpioId_t papbBusyId, gpioId_t papbEmptyId, uint32_t vcOffset)
|
gpioId_t papbBusyId, gpioId_t papbEmptyId, std::string uioFile, int mapNum) :
|
||||||
: SystemObject(objectId),
|
SystemObject(objectId), gpioComIF(gpioComIF), papbBusyId(papbBusyId), papbEmptyId(
|
||||||
gpioComIF(gpioComIF),
|
papbEmptyId), uioFile(uioFile), mapNum(mapNum) {
|
||||||
papbBusyId(papbBusyId),
|
}
|
||||||
papbEmptyId(papbEmptyId),
|
|
||||||
vcOffset(vcOffset) {}
|
|
||||||
|
|
||||||
PapbVcInterface::~PapbVcInterface() {}
|
PapbVcInterface::~PapbVcInterface() {
|
||||||
|
}
|
||||||
|
|
||||||
void PapbVcInterface::setRegisterAddress(uint32_t* ptmeBaseAddress) {
|
ReturnValue_t PapbVcInterface::initialize() {
|
||||||
vcBaseReg = ptmeBaseAddress + vcOffset;
|
UioMapper uioMapper(uioFile, mapNum);
|
||||||
|
return uioMapper.getMappedAdress(&vcBaseReg, UioMapper::Permissions::WRITE_ONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) {
|
ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) {
|
||||||
if (pollPapbBusySignal() == RETURN_OK) {
|
if (pollPapbBusySignal() == RETURN_OK) {
|
||||||
startPacketTransfer();
|
startPacketTransfer();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t idx = 0; idx < size; idx++) {
|
for (size_t idx = 0; idx < size; idx++) {
|
||||||
if (pollPapbBusySignal() == RETURN_OK) {
|
if (pollPapbBusySignal() == RETURN_OK) {
|
||||||
*(vcBaseReg + DATA_REG_OFFSET) = static_cast<uint32_t>(*(data + idx));
|
*(vcBaseReg + DATA_REG_OFFSET) = static_cast<uint32_t>(*(data + idx));
|
||||||
} else {
|
} else {
|
||||||
sif::warning << "PapbVcInterface::write: Only written " << idx << " of " << size << " data"
|
sif::warning << "PapbVcInterface::write: Only written " << idx << " of " << size
|
||||||
<< std::endl;
|
<< " data" << std::endl;
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pollPapbBusySignal() == RETURN_OK) {
|
if (pollPapbBusySignal() == RETURN_OK) {
|
||||||
endPacketTransfer();
|
endPacketTransfer();
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PapbVcInterface::startPacketTransfer() { *vcBaseReg = CONFIG_START; }
|
void PapbVcInterface::startPacketTransfer() {
|
||||||
|
*vcBaseReg = CONFIG_START;
|
||||||
|
}
|
||||||
|
|
||||||
void PapbVcInterface::endPacketTransfer() { *vcBaseReg = CONFIG_END; }
|
void PapbVcInterface::endPacketTransfer() {
|
||||||
|
*vcBaseReg = CONFIG_END;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t PapbVcInterface::pollPapbBusySignal() {
|
ReturnValue_t PapbVcInterface::pollPapbBusySignal() {
|
||||||
int papbBusyState = 0;
|
int papbBusyState = 0;
|
||||||
@ -67,7 +69,8 @@ void PapbVcInterface::isVcInterfaceBufferEmpty() {
|
|||||||
result = gpioComIF->readGpio(papbEmptyId, &papbEmptyState);
|
result = gpioComIF->readGpio(papbEmptyId, &papbEmptyState);
|
||||||
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PapbVcInterface::isVcInterfaceBufferEmpty: Failed to read papb empty signal"
|
sif::warning
|
||||||
|
<< "PapbVcInterface::isVcInterfaceBufferEmpty: Failed to read papb empty signal"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -27,14 +27,16 @@ class PapbVcInterface : public SystemObject, public VcInterfaceIF, public HasRet
|
|||||||
* @param papbEmptyId The ID of the GPIO which is connected to the PAPBEmpty signal of the
|
* @param papbEmptyId The ID of the GPIO which is connected to the PAPBEmpty signal of the
|
||||||
* VcInterface IP Core. The signal is high when there are no packets in the
|
* VcInterface IP Core. The signal is high when there are no packets in the
|
||||||
* external buffer memory (BRAM).
|
* external buffer memory (BRAM).
|
||||||
|
* @param uioFile UIO file providing access to the PAPB bus
|
||||||
|
* @param mapNum Map number of UIO map associated with this virtual channel
|
||||||
*/
|
*/
|
||||||
PapbVcInterface(object_id_t objectId, LinuxLibgpioIF* gpioComIF, gpioId_t papbBusyId,
|
PapbVcInterface(object_id_t objectId, LinuxLibgpioIF* gpioComIF, gpioId_t papbBusyId,
|
||||||
gpioId_t papbEmptyId, uint32_t vcOffset);
|
gpioId_t papbEmptyId, std::string uioFile, int mapNum);
|
||||||
virtual ~PapbVcInterface();
|
virtual ~PapbVcInterface();
|
||||||
|
|
||||||
ReturnValue_t write(const uint8_t* data, size_t size) override;
|
ReturnValue_t write(const uint8_t* data, size_t size) override;
|
||||||
|
|
||||||
void setRegisterAddress(uint32_t* ptmeBaseAddress) override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::CCSDS_IP_CORE_BRIDGE;
|
static const uint8_t INTERFACE_ID = CLASS_ID::CCSDS_IP_CORE_BRIDGE;
|
||||||
@ -69,6 +71,9 @@ class PapbVcInterface : public SystemObject, public VcInterfaceIF, public HasRet
|
|||||||
/** High when external buffer memory of virtual channel is empty */
|
/** High when external buffer memory of virtual channel is empty */
|
||||||
gpioId_t papbEmptyId = gpio::NO_GPIO;
|
gpioId_t papbEmptyId = gpio::NO_GPIO;
|
||||||
|
|
||||||
|
std::string uioFile;
|
||||||
|
int mapNum = 0;
|
||||||
|
|
||||||
uint32_t* vcBaseReg = nullptr;
|
uint32_t* vcBaseReg = nullptr;
|
||||||
|
|
||||||
uint32_t vcOffset = 0;
|
uint32_t vcOffset = 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <linux/obc/Ptme.h>
|
#include <linux/obc/Ptme.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include "PtmeConfig.h"
|
#include "PtmeConfig.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
@ -20,7 +20,8 @@ ReturnValue_t Ptme::initialize() {
|
|||||||
* Map uio device in virtual address space
|
* Map uio device in virtual address space
|
||||||
* PROT_WRITE: Map uio device in writable only mode
|
* PROT_WRITE: Map uio device in writable only mode
|
||||||
*/
|
*/
|
||||||
ptmeBaseAddress = static_cast<uint32_t*>(mmap(NULL, MAP_SIZE, PROT_WRITE, MAP_SHARED, fd, 0));
|
ptmeBaseAddress = static_cast<uint32_t*>(mmap(NULL, MAP_SIZE, PROT_WRITE, MAP_SHARED, fd,
|
||||||
|
0 * getpagesize()));
|
||||||
|
|
||||||
if (ptmeBaseAddress == MAP_FAILED) {
|
if (ptmeBaseAddress == MAP_FAILED) {
|
||||||
sif::error << "Ptme::initialize: Failed to map uio address" << std::endl;
|
sif::error << "Ptme::initialize: Failed to map uio address" << std::endl;
|
||||||
@ -29,7 +30,7 @@ ReturnValue_t Ptme::initialize() {
|
|||||||
|
|
||||||
VcInterfaceMapIter iter;
|
VcInterfaceMapIter iter;
|
||||||
for (iter = vcInterfaceMap.begin(); iter != vcInterfaceMap.end(); iter++) {
|
for (iter = vcInterfaceMap.begin(); iter != vcInterfaceMap.end(); iter++) {
|
||||||
iter->second->setRegisterAddress(ptmeBaseAddress);
|
iter->second->initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
|
@ -49,7 +49,7 @@ class Ptme : public PtmeIF, public SystemObject, public HasReturnvaluesIF {
|
|||||||
static const int MAP_SIZE = 0x40000;
|
static const int MAP_SIZE = 0x40000;
|
||||||
#else
|
#else
|
||||||
/** Size of mapped address space */
|
/** Size of mapped address space */
|
||||||
static const int MAP_SIZE = 0x40000;
|
static const int MAP_SIZE = 0x1000;
|
||||||
#endif /* BOARD_TE0720 == 1 */
|
#endif /* BOARD_TE0720 == 1 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
#include <fcntl.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include "PtmeAxiConfig.h"
|
#include "PtmeAxiConfig.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
#include "fsfw_hal/linux/uio/UioMapper.h"
|
||||||
|
|
||||||
PtmeAxiConfig::PtmeAxiConfig(object_id_t objectId, std::string configAxiUio) :
|
PtmeAxiConfig::PtmeAxiConfig(object_id_t objectId, std::string configAxiUio, int mapNum) :
|
||||||
SystemObject(objectId), configAxiUio(configAxiUio) {
|
SystemObject(objectId), configAxiUio(configAxiUio) {
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
if (mutex == nullptr) {
|
if (mutex == nullptr) {
|
||||||
@ -15,18 +14,11 @@ PtmeAxiConfig::~PtmeAxiConfig() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PtmeAxiConfig::initialize() {
|
ReturnValue_t PtmeAxiConfig::initialize() {
|
||||||
int fd = open(configAxiUio.c_str(), O_RDWR);
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
if (fd < 1) {
|
UioMapper uioMapper(configAxiUio, mapNum);
|
||||||
sif::warning << "PtmeAxiConfig::initialize: Invalid UIO device file" << std::endl;
|
result = uioMapper.getMappedAdress(&baseAddress, UioMapper::Permissions::READ_WRITE);
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
}
|
return result;
|
||||||
|
|
||||||
baseAddress = static_cast<uint32_t*>(mmap(NULL, MAP_SIZE, PROT_WRITE | PROT_READ, MAP_SHARED,
|
|
||||||
fd, 0));
|
|
||||||
|
|
||||||
if (baseAddress == MAP_FAILED) {
|
|
||||||
sif::warning << "PtmeAxiConfig::initialize: Failed to map uio address" << std::endl;
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
* @param configAxiUio Device file of UIO belonging to the AXI configuration interface.
|
* @param configAxiUio Device file of UIO belonging to the AXI configuration interface.
|
||||||
|
* @param mapNum Number of map belonging to axi configuration interface.
|
||||||
*/
|
*/
|
||||||
PtmeAxiConfig(object_id_t objectId, std::string configAxiUio);
|
PtmeAxiConfig(object_id_t objectId, std::string configAxiUio, int mapNum);
|
||||||
virtual ~PtmeAxiConfig();
|
virtual ~PtmeAxiConfig();
|
||||||
|
|
||||||
virtual ReturnValue_t initialize() override;
|
virtual ReturnValue_t initialize() override;
|
||||||
@ -26,9 +27,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
// Address of register storing the bitrate configuration parameter
|
// Address of register storing the bitrate configuration parameter
|
||||||
static const uint32_t CADU_BITRATE_REG = 0x0;
|
static const uint32_t CADU_BITRATE_REG = 0x0;
|
||||||
static const int MAP_SIZE = 0x1000;
|
|
||||||
|
|
||||||
std::string configAxiUio;
|
std::string configAxiUio;
|
||||||
|
std::string uioMap;
|
||||||
|
int mapNum = 0;
|
||||||
MutexIF* mutex = nullptr;
|
MutexIF* mutex = nullptr;
|
||||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||||
uint32_t mutexTimeout = 20;
|
uint32_t mutexTimeout = 20;
|
||||||
|
@ -24,7 +24,7 @@ class VcInterfaceIF {
|
|||||||
*/
|
*/
|
||||||
virtual ReturnValue_t write(const uint8_t* data, size_t size) = 0;
|
virtual ReturnValue_t write(const uint8_t* data, size_t size) = 0;
|
||||||
|
|
||||||
virtual void setRegisterAddress(uint32_t* ptmeBaseAddress) = 0;
|
virtual ReturnValue_t initialize() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* LINUX_OBC_VCINTERFACEIF_H_ */
|
#endif /* LINUX_OBC_VCINTERFACEIF_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user