ptme ip core packet insertion

This commit is contained in:
Jakob Meier
2021-09-26 08:29:30 +02:00
parent 773627dc3d
commit 5b26564058
20 changed files with 252 additions and 722 deletions

View File

@ -2,6 +2,7 @@
#include "ObjectFactory.h"
#include "OBSWConfig.h"
#include "devConf.h"
#include "ccsdsConfig.h"
#include "busConf.h"
#include "tmtc/apid.h"
#include "devices/addresses.h"
@ -47,6 +48,8 @@
#include "mission/devices/devicedefinitions/RwDefinitions.h"
#include "mission/devices/devicedefinitions/StarTrackerDefinitions.h"
#include "mission/devices/GPSHyperionHandler.h"
#include "mission/tmtc/CCSDSHandler.h"
#include "mission/tmtc/VirtualChannel.h"
#include "mission/utility/TmFunnel.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
@ -84,6 +87,7 @@
#include <linux/obc/Ptme.h>
#include <linux/obc/PapbVcInterface.h>
#include <linux/obc/PtmeConfig.h>
ResetArgs resetArgsGnss0;
ResetArgs resetArgsGnss1;
@ -101,7 +105,12 @@ void Factory::setStaticFrameworkObjectIds() {
//DeviceHandlerBase::powerSwitcherId = objects::PCDU_HANDLER;
DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
#if OBSW_TM_TO_PTME == 1
TmFunnel::downlinkDestination = objects::CCSDS_HANDLER;
#else
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
#endif /* OBSW_TM_TO_PTME == 1 */
// No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT;
@ -174,53 +183,7 @@ void ObjectFactory::produce(void* args) {
#endif /* TE7020 != 0 */
#if OBSW_USE_CCSDS_IP_CORE == 1
// GPIO definitions of signals connected to the virtual channel interfaces of the PTME IP Core
GpioCookie* gpioCookiePtmeIp = new GpioCookie;
GpiodRegular* vcSignal = new GpiodRegular("PAPB VC0 Busy Signal",
q7s::GPIO_VC_STATUS_SIGNALS_LABEL, q7s::VC0_PAPB_BUSY_LINE);
gpioCookiePtmeIp->addGpio(gpioIds::VC0_PAPB_BUSY, vcSignal);
vcSignal = new GpiodRegular("PAPB VC0 Empty Signal", q7s::GPIO_VC_STATUS_SIGNALS_LABEL,
q7s::VC0_PAPB_EMPTY_LINE);
gpioCookiePtmeIp->addGpio(gpioIds::VC0_PAPB_EMPTY, vcSignal);
vcSignal = new GpiodRegular("PAPB VC1 Busy Signal", q7s::GPIO_VC_STATUS_SIGNALS_LABEL,
q7s::VC1_PAPB_BUSY_LINE);
gpioCookiePtmeIp->addGpio(gpioIds::VC1_PAPB_BUSY, vcSignal);
vcSignal = new GpiodRegular("PAPB VC1 Empty Signal", q7s::GPIO_VC_STATUS_SIGNALS_LABEL,
q7s::VC1_PAPB_EMPTY_LINE);
gpioCookiePtmeIp->addGpio(gpioIds::VC1_PAPB_EMPTY, vcSignal);
vcSignal = new GpiodRegular("PAPB VC2 Busy Signal", q7s::GPIO_VC_STATUS_SIGNALS_LABEL,
q7s::VC2_PAPB_BUSY_LINE);
gpioCookiePtmeIp->addGpio(gpioIds::VC2_PAPB_BUSY, vcSignal);
vcSignal = new GpiodRegular("PAPB VC2 Empty Signal", q7s::GPIO_VC_STATUS_SIGNALS_LABEL,
q7s::VC2_PAPB_EMPTY_LINE);
gpioCookiePtmeIp->addGpio(gpioIds::VC2_PAPB_EMPTY, vcSignal);
vcSignal = new GpiodRegular("PAPB VC3 Busy Signal", q7s::GPIO_VC_STATUS_SIGNALS_LABEL,
q7s::VC3_PAPB_BUSY_LINE);
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_BUSY, vcSignal);
vcSignal = new GpiodRegular("PAPB VC3 Empty Signal", q7s::GPIO_VC_STATUS_SIGNALS_LABEL,
q7s::VC3_PAPB_EMPTY_LINE);
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_EMPTY, vcSignal);
gpioComIF->addGpios(gpioCookiePtmeIp);
// Creating virtual channel interfaces
PapbVcInterface* vc = new PapbVcInterface(objects::PAPB_VC0, gpioComIF, gpioIds::VC0_PAPB_BUSY,
gpioIds::VC0_PAPB_EMPTY);
PapbVcInterface* vc = new PapbVcInterface(objects::PAPB_VC1, gpioComIF, gpioIds::VC1_PAPB_BUSY,
gpioIds::VC1_PAPB_EMPTY);
PapbVcInterface* vc = new PapbVcInterface(objects::PAPB_VC2, gpioComIF, gpioIds::VC2_PAPB_BUSY,
gpioIds::VC2_PAPB_EMPTY);
PapbVcInterface* vc = new PapbVcInterface(objects::PAPB_VC3, gpioComIF, gpioIds::VC3_PAPB_BUSY,
gpioIds::VC3_PAPB_EMPTY);
// Creating ptme object and adding virtual channel interfaces
Ptme* ptme = new Ptme(objects::PTME);
ptme->addVcInterface(0, vc);
ptme->addVcInterface(1, vc);
ptme->addVcInterface(2, vc);
ptme->addVcInterface(3, vc);
createCcsdsComponents(gpioComIF);
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
@ -922,6 +885,75 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
rw4SpiCookie->setCallbackArgs(rwHandler4);
}
void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) {
// GPIO definitions of signals connected to the virtual channel interfaces of the PTME IP Core
GpioCookie* gpioCookiePtmeIp = new GpioCookie;
GpiodRegularByLineName* gpio = nullptr;
std::stringstream consumer;
consumer << "0x" << std::hex << objects::PAPB_VC0;
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC0, consumer.str());
gpioCookiePtmeIp->addGpio(gpioIds::VC0_PAPB_BUSY, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::PAPB_VC0;
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC0, consumer.str());
gpioCookiePtmeIp->addGpio(gpioIds::VC0_PAPB_EMPTY, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::PAPB_VC1;
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC1, consumer.str());
gpioCookiePtmeIp->addGpio(gpioIds::VC1_PAPB_BUSY, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::PAPB_VC1;
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC1, consumer.str());
gpioCookiePtmeIp->addGpio(gpioIds::VC1_PAPB_EMPTY, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::PAPB_VC2;
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC2, consumer.str());
gpioCookiePtmeIp->addGpio(gpioIds::VC2_PAPB_BUSY, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::PAPB_VC2;
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC2, consumer.str());
gpioCookiePtmeIp->addGpio(gpioIds::VC2_PAPB_EMPTY, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::PAPB_VC3;
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC3, consumer.str());
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_BUSY, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::PAPB_VC3;
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC3, consumer.str());
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_EMPTY, gpio);
gpioComIF->addGpios(gpioCookiePtmeIp);
// Creating virtual channel interfaces
VcInterfaceIF* vc0 = new PapbVcInterface(objects::PAPB_VC0, gpioComIF, gpioIds::VC0_PAPB_BUSY,
gpioIds::VC0_PAPB_EMPTY, PtmeConfig::VC0_OFFSETT);
VcInterfaceIF* vc1 = new PapbVcInterface(objects::PAPB_VC1, gpioComIF, gpioIds::VC1_PAPB_BUSY,
gpioIds::VC1_PAPB_EMPTY, PtmeConfig::VC1_OFFSETT);
VcInterfaceIF* vc2 = new PapbVcInterface(objects::PAPB_VC2, gpioComIF, gpioIds::VC2_PAPB_BUSY,
gpioIds::VC2_PAPB_EMPTY, PtmeConfig::VC2_OFFSETT);
VcInterfaceIF* vc3 = new PapbVcInterface(objects::PAPB_VC3, gpioComIF, gpioIds::VC3_PAPB_BUSY,
gpioIds::VC3_PAPB_EMPTY, PtmeConfig::VC3_OFFSETT);
// Creating ptme object and adding virtual channel interfaces
Ptme* ptme = new Ptme(objects::PTME);
ptme->addVcInterface(ccsds::VC0, vc0);
ptme->addVcInterface(ccsds::VC1, vc1);
ptme->addVcInterface(ccsds::VC2, vc2);
ptme->addVcInterface(ccsds::VC3, vc3);
CCSDSHandler* ccsdsHandler = new CCSDSHandler(objects::CCSDS_HANDLER, objects::PTME);
VirtualChannel* vc = nullptr;
vc = new VirtualChannel(ccsds::VC0, config::VC0_QUEUE_SIZE);
ccsdsHandler->addVirtualChannel(ccsds::VC0, vc);
vc = new VirtualChannel(ccsds::VC1, config::VC1_QUEUE_SIZE);
ccsdsHandler->addVirtualChannel(ccsds::VC1, vc);
vc = new VirtualChannel(2, config::VC2_QUEUE_SIZE);
ccsdsHandler->addVirtualChannel(ccsds::VC2, vc);
vc = new VirtualChannel(3, config::VC3_QUEUE_SIZE);
ccsdsHandler->addVirtualChannel(ccsds::VC3, vc);
}
void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#if BOARD_TE0720 == 0