forked from Sepanta/pcie-driver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
1.2 KiB
76 lines
1.2 KiB
#include "MainWindow.h"
|
|
#include "ui_MainWindow.h"
|
|
|
|
#include <QDebug>
|
|
|
|
MainWindow::MainWindow(QWidget* parent)
|
|
: QMainWindow(parent)
|
|
, ui(new Ui::MainWindow)
|
|
{
|
|
ui->setupUi(this);
|
|
sd = new SonoDevice();
|
|
sd->init();
|
|
_counter = 0;
|
|
}
|
|
|
|
MainWindow::~MainWindow()
|
|
{
|
|
delete ui;
|
|
delete sd;
|
|
}
|
|
|
|
void MainWindow::on_pushButton_clicked()
|
|
{
|
|
sd->setRamOffsetAddress(0);
|
|
sd->setTransferLength(1024 * 1024);
|
|
sd->setOptions(false);
|
|
sd->setMode(true);
|
|
sd->setTransferRate(8.4f);
|
|
sd->startTransfer();
|
|
|
|
_counter = sd->getCounter();
|
|
int buffersTransferred = 0;
|
|
|
|
while(true)
|
|
{
|
|
auto cnt = sd->getCounter();
|
|
if(cnt == 0)
|
|
{
|
|
continue;
|
|
}
|
|
if(_counter != cnt)
|
|
{
|
|
_counter++;
|
|
if(_counter == 17)
|
|
{
|
|
_counter = 1;
|
|
}
|
|
qDebug() << _counter << " --- " << cnt;
|
|
sd->copy(_counter - 1);
|
|
buffersTransferred++;
|
|
}
|
|
if(buffersTransferred == 16)
|
|
{
|
|
//buffersTransferred = 0;
|
|
//sd->startTransfer();
|
|
break;
|
|
}
|
|
}
|
|
sd->stopTransfer();
|
|
|
|
for(auto i = 0; i < 16; i++)
|
|
{
|
|
qDebug() << i << " ----------------------------- ";
|
|
sd->show(i);
|
|
}
|
|
}
|
|
|
|
void MainWindow::on_pushButton_2_clicked()
|
|
{
|
|
sd->stopTransfer();
|
|
}
|
|
|
|
void MainWindow::on_pushButton_3_clicked()
|
|
{
|
|
sd->fillRam();
|
|
}
|
|
|