##// END OF EJS Templates
Functions added to the plugin to get the number of CCSDS packets...
Functions added to the plugin to get the number of CCSDS packets transmitted (linked to the lfrcontrol plugin counter of TC transmitted, it is possible to flush the TC transmission before changing the spacewire link in use)

File last commit:

r0:2d12462f4460 default
r40:cda6b4e8adc1 Patch 3 from Paul on spwplugin default
Show More
genericmemoryspacecheck.cpp
61 lines | 2.0 KiB | text/x-c | CppLexer
/ memctrlrplugin / genericmemoryspacecheck.cpp
#include "genericmemoryspacecheck.h"
genericmemoryspacecheck::genericmemoryspacecheck( const QString Name, unsigned int baseAddress, unsigned int size,QWidget *parent):
QWidget(parent)
{
this->mainLayout = new QVBoxLayout;
this->secondLayout = new QHBoxLayout;
this->MemoryName = new QLabel(Name);
this->AddrQHspBx = new QHexSpinBox;
this->AddrQHspBx->setValue(baseAddress);
this->MemSize=new MemSizeWdgt(size);
this->LaunchtestQPB = new QPushButton(tr("Start Test"));
this->result = new QLabel(tr("Test result: Start test"));
this->mainLayout->addWidget(this->MemoryName);
this->secondLayout->addWidget(this->AddrQHspBx);
this->secondLayout->addWidget(this->MemSize);
this->secondLayout->addWidget(this->LaunchtestQPB);
this->mainLayout->addLayout(this->secondLayout);
this->mainLayout->addWidget(this->result);
this->setLayout(this->mainLayout);
connect(this->LaunchtestQPB,SIGNAL(clicked()),this,SLOT(launchTestSlt()));
}
bool genericmemoryspacecheck::launchTest(genericmemoryspacecheck* instance,unsigned int baseAddress,unsigned int size)
{
unsigned int* dataLocal = (unsigned int*)malloc(size);
unsigned int* dataOnBoard = (unsigned int*)malloc(size);
bool res=true;
for(int i=0;(unsigned int)i<(size>>2);i++)
{
dataLocal[i]= (0xFFFF&rand())+(rand()<<16);
}
emit instance->WriteSig(dataLocal,size>>2,baseAddress);
emit instance->ReadSig(dataOnBoard,size>>2,baseAddress);
for(int i=0;(unsigned int)i<(size>>2);i++)
{
if(dataLocal[i]!=dataOnBoard[i])
res=false;
}
free(dataLocal);
free(dataOnBoard);
return res;
}
void genericmemoryspacecheck::launchTestSlt()
{
this->result->setText(tr("Test result: Pending"));
if(this->launchTest(this,this->AddrQHspBx->value(),this->MemSize->getsize()))
this->result->setText(tr("Test result: Success"));
else
this->result->setText(tr("Test result: failed"));
}