meier/ptme #129
@ -893,35 +893,32 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
GpioCookie* gpioCookiePtmeIp = new GpioCookie;
|
GpioCookie* gpioCookiePtmeIp = new GpioCookie;
|
||||||
GpiodRegularByLineName* gpio = nullptr;
|
GpiodRegularByLineName* gpio = nullptr;
|
||||||
std::stringstream consumer;
|
std::stringstream consumer;
|
||||||
consumer << "0x" << std::hex << objects::PAPB_VC0;
|
consumer.str("PAPB VC0");
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC0, consumer.str());
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC0, consumer.str());
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC0_PAPB_BUSY, gpio);
|
gpioCookiePtmeIp->addGpio(gpioIds::VC0_PAPB_BUSY, gpio);
|
||||||
consumer.str("");
|
consumer.str("PAPB VC0");
|
||||||
consumer << "0x" << std::hex << objects::PAPB_VC0;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC0, consumer.str());
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC0, consumer.str());
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC0_PAPB_EMPTY, gpio);
|
gpioCookiePtmeIp->addGpio(gpioIds::VC0_PAPB_EMPTY, gpio);
|
||||||
consumer.str("");
|
consumer.str("PAPB VC 1");
|
||||||
consumer << "0x" << std::hex << objects::PAPB_VC1;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC1, consumer.str());
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC1, consumer.str());
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC1_PAPB_BUSY, gpio);
|
gpioCookiePtmeIp->addGpio(gpioIds::VC1_PAPB_BUSY, gpio);
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
consumer << "0x" << std::hex << objects::PAPB_VC1;
|
consumer.str("PAPB VC 1");
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC1, consumer.str());
|
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC1_PAPB_EMPTY, gpio);
|
gpioCookiePtmeIp->addGpio(gpioIds::VC1_PAPB_EMPTY, gpio);
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
consumer << "0x" << std::hex << objects::PAPB_VC2;
|
consumer.str("PAPB VC 2");
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC2, consumer.str());
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC2, consumer.str());
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC2_PAPB_BUSY, gpio);
|
gpioCookiePtmeIp->addGpio(gpioIds::VC2_PAPB_BUSY, gpio);
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
consumer << "0x" << std::hex << objects::PAPB_VC2;
|
consumer.str("PAPB VC 2");
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC2, consumer.str());
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC2, consumer.str());
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC2_PAPB_EMPTY, gpio);
|
gpioCookiePtmeIp->addGpio(gpioIds::VC2_PAPB_EMPTY, gpio);
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
consumer << "0x" << std::hex << objects::PAPB_VC3;
|
consumer.str("PAPB VC 3");
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC3, consumer.str());
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC3, consumer.str());
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_BUSY, gpio);
|
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_BUSY, gpio);
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
consumer << "0x" << std::hex << objects::PAPB_VC3;
|
consumer.str("PAPB VC 3");
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC3, consumer.str());
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC3, consumer.str());
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_EMPTY, gpio);
|
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_EMPTY, gpio);
|
||||||
|
|
||||||
@ -929,17 +926,17 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
|
|
||||||
// Creating virtual channel interfaces
|
// Creating virtual channel interfaces
|
||||||
VcInterfaceIF* vc0 =
|
VcInterfaceIF* vc0 =
|
||||||
new PapbVcInterface(objects::PAPB_VC0, gpioComIF, gpioIds::VC0_PAPB_BUSY,
|
new PapbVcInterface(gpioComIF, gpioIds::VC0_PAPB_BUSY, gpioIds::VC0_PAPB_EMPTY, q7s::UIO_PTME,
|
||||||
gpioIds::VC0_PAPB_EMPTY, q7s::UIO_PTME, q7s::uiomapids::PTME_VC0);
|
q7s::uiomapids::PTME_VC0);
|
||||||
VcInterfaceIF* vc1 =
|
VcInterfaceIF* vc1 =
|
||||||
new PapbVcInterface(objects::PAPB_VC1, gpioComIF, gpioIds::VC1_PAPB_BUSY,
|
new PapbVcInterface(gpioComIF, gpioIds::VC1_PAPB_BUSY, gpioIds::VC1_PAPB_EMPTY, q7s::UIO_PTME,
|
||||||
gpioIds::VC1_PAPB_EMPTY, q7s::UIO_PTME, q7s::uiomapids::PTME_VC1);
|
q7s::uiomapids::PTME_VC1);
|
||||||
VcInterfaceIF* vc2 =
|
VcInterfaceIF* vc2 =
|
||||||
new PapbVcInterface(objects::PAPB_VC2, gpioComIF, gpioIds::VC2_PAPB_BUSY,
|
new PapbVcInterface(gpioComIF, gpioIds::VC2_PAPB_BUSY, gpioIds::VC2_PAPB_EMPTY, q7s::UIO_PTME,
|
||||||
gpioIds::VC2_PAPB_EMPTY, q7s::UIO_PTME, q7s::uiomapids::PTME_VC2);
|
q7s::uiomapids::PTME_VC2);
|
||||||
VcInterfaceIF* vc3 =
|
VcInterfaceIF* vc3 =
|
||||||
new PapbVcInterface(objects::PAPB_VC3, gpioComIF, gpioIds::VC3_PAPB_BUSY,
|
new PapbVcInterface(gpioComIF, gpioIds::VC3_PAPB_BUSY, gpioIds::VC3_PAPB_EMPTY, q7s::UIO_PTME,
|
||||||
gpioIds::VC3_PAPB_EMPTY, q7s::UIO_PTME, q7s::uiomapids::PTME_VC3);
|
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);
|
||||||
|
@ -12,11 +12,7 @@ enum commonObjects: uint32_t {
|
|||||||
TMTC_POLLING_TASK = 0x50000400,
|
TMTC_POLLING_TASK = 0x50000400,
|
||||||
FILE_SYSTEM_HANDLER = 0x50000500,
|
FILE_SYSTEM_HANDLER = 0x50000500,
|
||||||
PTME = 0x50000600,
|
PTME = 0x50000600,
|
||||||
PAPB_VC0 = 0x50000700,
|
PDEC_HANDLER = 0x50000700,
|
||||||
PAPB_VC1 = 0x50000701,
|
|
||||||
PAPB_VC2 = 0x50000702,
|
|
||||||
PAPB_VC3 = 0x50000703,
|
|
||||||
PDEC_HANDLER = 0x50000704,
|
|
||||||
CCSDS_HANDLER = 0x50000800,
|
CCSDS_HANDLER = 0x50000800,
|
||||||
|
|
||||||
/* 0x43 ('C') for Controllers */
|
/* 0x43 ('C') for Controllers */
|
||||||
|
@ -1,101 +1,97 @@
|
|||||||
#include <linux/obc/PapbVcInterface.h>
|
|
||||||
#include <fsfw_hal/linux/uio/UioMapper.h>
|
#include <fsfw_hal/linux/uio/UioMapper.h>
|
||||||
|
#include <linux/obc/PapbVcInterface.h>
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
PapbVcInterface::PapbVcInterface(object_id_t objectId, LinuxLibgpioIF* gpioComIF,
|
PapbVcInterface::PapbVcInterface(LinuxLibgpioIF* gpioComIF, gpioId_t papbBusyId,
|
||||||
gpioId_t papbBusyId, gpioId_t papbEmptyId, std::string uioFile, int mapNum) :
|
gpioId_t papbEmptyId, std::string uioFile, int mapNum)
|
||||||
SystemObject(objectId), gpioComIF(gpioComIF), papbBusyId(papbBusyId), papbEmptyId(
|
: gpioComIF(gpioComIF),
|
||||||
papbEmptyId), uioFile(uioFile), mapNum(mapNum) {
|
papbBusyId(papbBusyId),
|
||||||
}
|
papbEmptyId(papbEmptyId),
|
||||||
|
uioFile(uioFile),
|
||||||
|
mapNum(mapNum) {}
|
||||||
|
|
||||||
PapbVcInterface::~PapbVcInterface() {
|
PapbVcInterface::~PapbVcInterface() {}
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t PapbVcInterface::initialize() {
|
ReturnValue_t PapbVcInterface::initialize() {
|
||||||
UioMapper uioMapper(uioFile, mapNum);
|
UioMapper uioMapper(uioFile, mapNum);
|
||||||
return uioMapper.getMappedAdress(&vcBaseReg, UioMapper::Permissions::WRITE_ONLY);
|
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) {
|
||||||
|
startPacketTransfer();
|
||||||
|
}
|
||||||
|
for (size_t idx = 0; idx < size; idx++) {
|
||||||
if (pollPapbBusySignal() == RETURN_OK) {
|
if (pollPapbBusySignal() == RETURN_OK) {
|
||||||
startPacketTransfer();
|
*(vcBaseReg + DATA_REG_OFFSET) = static_cast<uint32_t>(*(data + idx));
|
||||||
|
} else {
|
||||||
|
sif::warning << "PapbVcInterface::write: Only written " << idx << " of " << size << " data"
|
||||||
|
<< std::endl;
|
||||||
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
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));
|
endPacketTransfer();
|
||||||
} else {
|
}
|
||||||
sif::warning << "PapbVcInterface::write: Only written " << idx << " of " << size
|
return RETURN_OK;
|
||||||
<< " data" << std::endl;
|
|
||||||
return RETURN_FAILED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pollPapbBusySignal() == RETURN_OK) {
|
|
||||||
endPacketTransfer();
|
|
||||||
}
|
|
||||||
return RETURN_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PapbVcInterface::startPacketTransfer() {
|
void PapbVcInterface::startPacketTransfer() { *vcBaseReg = CONFIG_START; }
|
||||||
*vcBaseReg = CONFIG_START;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PapbVcInterface::endPacketTransfer() {
|
void PapbVcInterface::endPacketTransfer() { *vcBaseReg = CONFIG_END; }
|
||||||
*vcBaseReg = CONFIG_END;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t PapbVcInterface::pollPapbBusySignal() {
|
ReturnValue_t PapbVcInterface::pollPapbBusySignal() {
|
||||||
int papbBusyState = 0;
|
int papbBusyState = 0;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
/** Check if PAPB interface is ready to receive data */
|
/** Check if PAPB interface is ready to receive data */
|
||||||
result = gpioComIF->readGpio(papbBusyId, &papbBusyState);
|
result = gpioComIF->readGpio(papbBusyId, &papbBusyState);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PapbVcInterface::pollPapbBusySignal: Failed to read papb busy signal"
|
sif::warning << "PapbVcInterface::pollPapbBusySignal: Failed to read papb busy signal"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if (!papbBusyState) {
|
if (!papbBusyState) {
|
||||||
sif::warning << "PapbVcInterface::pollPapbBusySignal: PAPB busy" << std::endl;
|
sif::warning << "PapbVcInterface::pollPapbBusySignal: PAPB busy" << std::endl;
|
||||||
return PAPB_BUSY;
|
return PAPB_BUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PapbVcInterface::isVcInterfaceBufferEmpty() {
|
void PapbVcInterface::isVcInterfaceBufferEmpty() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
int papbEmptyState = 1;
|
int papbEmptyState = 1;
|
||||||
|
|
||||||
result = gpioComIF->readGpio(papbEmptyId, &papbEmptyState);
|
result = gpioComIF->readGpio(papbEmptyId, &papbEmptyState);
|
||||||
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning
|
sif::warning << "PapbVcInterface::isVcInterfaceBufferEmpty: Failed to read papb empty signal"
|
||||||
<< "PapbVcInterface::isVcInterfaceBufferEmpty: Failed to read papb empty signal"
|
<< std::endl;
|
||||||
<< std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (papbEmptyState == 1) {
|
|
||||||
sif::debug << "PapbVcInterface::isVcInterfaceBufferEmpty: Buffer is empty" << std::endl;
|
|
||||||
} else {
|
|
||||||
sif::debug << "PapbVcInterface::isVcInterfaceBufferEmpty: Buffer is not empty" << std::endl;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (papbEmptyState == 1) {
|
||||||
|
sif::debug << "PapbVcInterface::isVcInterfaceBufferEmpty: Buffer is empty" << std::endl;
|
||||||
|
} else {
|
||||||
|
sif::debug << "PapbVcInterface::isVcInterfaceBufferEmpty: Buffer is not empty" << std::endl;
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PapbVcInterface::sendTestFrame() {
|
ReturnValue_t PapbVcInterface::sendTestFrame() {
|
||||||
/** Size of one complete transfer frame data field amounts to 1105 bytes */
|
/** Size of one complete transfer frame data field amounts to 1105 bytes */
|
||||||
uint8_t testPacket[1105];
|
uint8_t testPacket[1105];
|
||||||
|
|
||||||
/** Fill one test packet */
|
/** Fill one test packet */
|
||||||
for (int idx = 0; idx < 1105; idx++) {
|
for (int idx = 0; idx < 1105; idx++) {
|
||||||
testPacket[idx] = static_cast<uint8_t>(idx & 0xFF);
|
testPacket[idx] = static_cast<uint8_t>(idx & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t result = write(testPacket, 1105);
|
ReturnValue_t result = write(testPacket, 1105);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,7 @@
|
|||||||
|
|
||||||
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
||||||
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "linux/obc/VcInterfaceIF.h"
|
#include "linux/obc/VcInterfaceIF.h"
|
||||||
|
|
||||||
@ -15,12 +13,11 @@
|
|||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
class PapbVcInterface : public SystemObject, public VcInterfaceIF, public HasReturnvaluesIF {
|
class PapbVcInterface : public VcInterfaceIF, public HasReturnvaluesIF {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*
|
*
|
||||||
* @param objectId
|
|
||||||
* @param papbBusyId The ID of the GPIO which is connected to the PAPBBusy_N signal of the
|
* @param papbBusyId The ID of the GPIO which is connected to the PAPBBusy_N signal of the
|
||||||
* VcInterface IP Core. A low logic level indicates the VcInterface is not
|
* VcInterface IP Core. A low logic level indicates the VcInterface is not
|
||||||
* ready to receive more data.
|
* ready to receive more data.
|
||||||
@ -30,8 +27,8 @@ class PapbVcInterface : public SystemObject, public VcInterfaceIF, public HasRet
|
|||||||
* @param uioFile UIO file providing access to the PAPB bus
|
* @param uioFile UIO file providing access to the PAPB bus
|
||||||
* @param mapNum Map number of UIO map associated with this virtual channel
|
* @param mapNum Map number of UIO map associated with this virtual channel
|
||||||
*/
|
*/
|
||||||
PapbVcInterface(object_id_t objectId, LinuxLibgpioIF* gpioComIF, gpioId_t papbBusyId,
|
PapbVcInterface(LinuxLibgpioIF* gpioComIF, gpioId_t papbBusyId, gpioId_t papbEmptyId,
|
||||||
gpioId_t papbEmptyId, std::string uioFile, int mapNum);
|
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user