Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt6 port and a bunch of compiler warning fixes #5

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Validate Metadata
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Create Build Environment
run: cd contrib/ci/ && podman build -t intanrhx_validate -f ./Dockerfile-debian-testing .
Expand All @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -40,7 +40,7 @@ jobs:
./contrib/ci/auto-build-deb.sh

- name: Upload Debian package artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Debian Package
path: |
Expand All @@ -53,7 +53,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -66,7 +66,7 @@ jobs:
./contrib/ci/auto-build-deb.sh

- name: Upload Ubuntu package artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Ubuntu LTS Package
path: |
Expand Down
9 changes: 4 additions & 5 deletions Engine/API/Abstract/abstractrhxcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ AbstractRHXController::AbstractRHXController(ControllerType type_, AmplifierSamp
pipeReadErrorCode(0)
{
usbBufferSize = MaxNumBlocksToRead * BytesPerWord * RHXDataBlock::dataBlockSizeInWords(type, maxNumDataStreams());
cout << "RHXController: Allocating " << usbBufferSize / 1.0e6 << " MBytes for USB buffer.\n";
std::cout << "RHXController: Allocating " << usbBufferSize / 1.0e6 << " MBytes for USB buffer." << std::endl;
usbBuffer = nullptr;
usbBuffer = new uint8_t [usbBufferSize];
numDataStreams = 0;
Expand Down Expand Up @@ -665,14 +665,13 @@ unsigned int AbstractRHXController::fifoCapacityInWords()
// Print a command list to the console in readable form.
void AbstractRHXController::printCommandList(const vector<unsigned int> &commandList) const
{
unsigned int i, cmd;
int channel, reg, data, uFlag, mFlag, dFlag, hFlag;

cout << '\n';
for (i = 0; i < commandList.size(); ++i) {
cmd = commandList[i];
for (uint i = 0; i < commandList.size(); ++i) {
auto cmd = commandList[i];
if (type != ControllerStimRecord) {
if (cmd < 0 || cmd > 0xffff) {
if ((int)cmd < 0 || cmd > 0xffff) {
cout << " command[" << i << "] = INVALID COMMAND: " << cmd << '\n';
} else if ((cmd & 0xc000) == 0x0000) {
channel = (cmd & 0x3f00) >> 8;
Expand Down
4 changes: 2 additions & 2 deletions Engine/API/Hardware/rhxcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ bool RHXController::uploadFPGABitfile(const string& filename)
boardId = dev->GetWireOutValue(WireOutBoardId);
boardVersion = dev->GetWireOutValue(WireOutBoardVersion);

cout << "Rhythm configuration file successfully loaded. Rhythm version number: " <<
boardVersion << "\n\n";
std::cout << "Rhythm configuration file successfully loaded. Rhythm version number: " <<
boardVersion << "\n" << std::endl;

return true;
}
Expand Down
8 changes: 4 additions & 4 deletions Engine/API/Hardware/rhxregisters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,15 +1122,15 @@ unsigned int RHXRegisters::createRHXCommand(RHXCommandType commandType, unsigned
} else {
switch (commandType) {
case RHXCommandConvert:
if ((arg1 < 0) || (arg1 > 63)) {
if (((int)arg1 < 0) || (arg1 > 63)) {
cerr << "Error in RHXRegisters::createRHXCommand: " <<
"Channel number out of range.\n";
return -1;
}
return 0x0000 + (arg1 << 8); // 00cccccc0000000h; if the command is 'Convert',
// arg1 is the channel number.
case RHXCommandRegRead:
if ((arg1 < 0) || (arg1 > 63)) {
if (((int)arg1 < 0) || (arg1 > 63)) {
cerr << "Error in RHXRegisters::createRHXCommand: " <<
"Register address out of range.\n";
return -1;
Expand Down Expand Up @@ -1182,12 +1182,12 @@ unsigned int RHXRegisters::createRHXCommand(RHXCommandType commandType, unsigned
} else {
switch (commandType) {
case RHXCommandRegWrite:
if ((arg1 < 0) || (arg1 > 63)) {
if (((int)arg1 < 0) || (arg1 > 63)) {
cerr << "Error in RHXRegisters::createRHXCommand: " <<
"Register address out of range.\n";
return -1;
}
if ((arg2 < 0) || (arg2 > 255)) {
if (((int)arg2 < 0) || (arg2 > 255)) {
cerr << "Error in RHXRegisters::createRHXCommand: " <<
"Register data out of range.\n";
return -1;
Expand Down
2 changes: 1 addition & 1 deletion Engine/API/Synthetic/synthdatablockgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ SynthDataBlockGenerator::SynthDataBlockGenerator(ControllerType type_, double sa
{
int bufferSizeInWords = MaxNumBlocksToRead *
RHXDataBlock::dataBlockSizeInWords(type, AbstractRHXController::maxNumDataStreams(type));
cout << "SynthDataBlockGenerator: Allocating " << BytesPerWord * bufferSizeInWords / 1.0e6 << " MBytes for synthetic USB data generator.\n";
std::cout << "SynthDataBlockGenerator: Allocating " << BytesPerWord * bufferSizeInWords / 1.0e6 << " MBytes for synthetic USB data generator." << std::endl;
usbWords = nullptr;
usbWords = new uint16_t [bufferSizeInWords];
dataBlockPeriodInNsec = 1.0e9 * ((double)RHXDataBlock::samplesPerDataBlock(type)) / sampleRate;
Expand Down
3 changes: 2 additions & 1 deletion Engine/Processing/DataFileReaders/fileperchannelmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include <QFileInfo>
#include <iostream>
#include <thread>
#include "rhxglobals.h"
#include "datafilereader.h"
#include "fileperchannelmanager.h"
Expand Down Expand Up @@ -511,7 +512,7 @@ void FilePerChannelManager::updateEndOfData()
// TODO - polish up to get the actual end of all data, not just assume from end of shortest amp file
int tempTotalNumSamples = 0;
for (int stream = 0; stream < info->numDataStreams; ++stream) {
for (int channel = 0; channel < amplifierFiles[stream].size(); ++channel) {
for (uint channel = 0; channel < amplifierFiles[stream].size(); ++channel) {
if (amplifierWasSaved[stream][channel]) {
int64_t numAmpSamples = amplifierFiles[stream][channel]->fileSize() / 2;
if (numAmpSamples < tempTotalNumSamples || tempTotalNumSamples == 0) {
Expand Down
2 changes: 1 addition & 1 deletion Engine/Processing/DataFileReaders/fileperchannelmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class FilePerChannelManager : public DataFileManager
DataFileReader* parent);
~FilePerChannelManager();

long readDataBlocksRaw(int numBlocks, uint8_t* buffer);
long readDataBlocksRaw(int numBlocks, uint8_t* buffer) override;
int64_t getLastTimeStamp() override;
int64_t jumpToTimeStamp(int64_t target) override;
void loadDataFrame() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ int64_t TraditionalIntanFileManager::blocksPresent()
{
// Should remain accurate even if data file continues growing
int dataSizeBytes = 0;
for (int i = 0; i < consecutiveFiles.size(); i++) {
for (uint i = 0; i < consecutiveFiles.size(); i++) {
dataSizeBytes += QFileInfo(consecutiveFiles[i].fileName).size() - info->headerSizeInBytes;
}
return dataSizeBytes / info->bytesPerDataBlock;
Expand Down
6 changes: 5 additions & 1 deletion Engine/Processing/XPUInterfaces/gpuinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,12 @@ bool GPUInterface::createKernel(int devIndex)
state->writeToLog("Completed clCreateContext()");

state->writeToLog("About to call clCreateCommandQueue");
cl_queue_properties properties[] = {
CL_QUEUE_PROPERTIES,
0 // Terminates the list
};
// Create command queue.
commandQueue = clCreateCommandQueue(context, id, 0, &ret);
commandQueue = clCreateCommandQueueWithProperties(context, id, properties, &ret);
if (ret != CL_SUCCESS) {
state->writeToLog("Failure creating OpenCL commandqueue. Ret: " + QString::number(ret));
gpuErrorMessage("Error creating OpenCL commandqueue. Returned error code: " + QString::number(ret));
Expand Down
10 changes: 7 additions & 3 deletions Engine/Processing/XPUInterfaces/xpucontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

XPUController::XPUController(SystemState *state_, bool useOpenCL_, QObject *parent) :
QObject(parent),
useOpenCL(useOpenCL_),
state(state_),
usedXPUIndex(-1),
useOpenCL(useOpenCL_)
usedXPUIndex(-1)
{
state->writeToLog("Entered XPUController ctor");
connect(state, SIGNAL(stateChanged()), this, SLOT(updateFromState()));
Expand Down Expand Up @@ -126,7 +126,11 @@ void XPUController::updateFromState()
if (state->usedXPUIndex() != usedXPUIndex) {
activeInterface->cleanupMemory();
usedXPUIndex = state->usedXPUIndex();
activeInterface = (usedXPUIndex == 0) ? activeInterface = cpuInterface : activeInterface = gpuInterface;
if (usedXPUIndex == 0) {
activeInterface = cpuInterface;
} else {
activeInterface = gpuInterface;
}
activeInterface->setupMemory();
}
activeInterface->updateFromState();
Expand Down
8 changes: 7 additions & 1 deletion Engine/Processing/commandparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

CommandParser::CommandParser(SystemState* state_, ControllerInterface *controllerInterface_, QObject *parent) :
QObject(parent),
controllerInterface(controllerInterface_),
controlWindow(nullptr),
controllerInterface(controllerInterface_),
state(state_)
{
// These connections allow for interactions with communicators that may live in another thread
Expand Down Expand Up @@ -871,6 +871,8 @@ QString CommandParser::validateStimParams(StimParameters *stimParams) const
if (stimParams->pulseTrainPeriod->getValue() < stimDuration)
return "PulseTrainPeriodMicroseconds cannot be less than total pulse duration (sum of all phases used for this Shape)";

break;

case BoardDacSignal:
// PulseTrainPeriod cannot be less than stimDuration (which depends on Shape)
// Biphasic: stimDuration = FirstPhaseDuration + SecondPhaseDuration
Expand All @@ -888,11 +890,15 @@ QString CommandParser::validateStimParams(StimParameters *stimParams) const
if (stimParams->pulseTrainPeriod->getValue() < stimDuration)
return "PulseTrainPeriodMicroseconds cannot be less than total pulse duration (sum of all phases used for this Shape)";

break;

case BoardDigitalOutSignal:
// PulseTrainPeriod cannot be less than FirstPhaseDuration
if (stimParams->pulseTrainPeriod->getValue() < stimParams->firstPhaseDuration->getValue())
return "PulseTrainPeriodMicroseconds cannot be less than pulse duration (FirstPhaseDurationMicroseconds)";

break;

default:
break;
}
Expand Down
3 changes: 1 addition & 2 deletions Engine/Processing/controllerinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ int ControllerInterface::scanPorts(vector<ChipType> &chipType, vector<int> &port
state->lastDetectedChip->getValue(),
state->lastDetectedNumStreams->getValue());

for (int i = 0; i < chipType.size(); i++) {
qDebug() << "Here... i: " << i << " chip type: " << (int) chipType[i];
for (uint i = 0; i < chipType.size(); i++) {
if (chipType[i] != NoChip) {
state->lastDetectedChip->setValue((int) chipType[i]);
break;
Expand Down
6 changes: 3 additions & 3 deletions Engine/Processing/datastreamfifo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ DataStreamFifo::DataStreamFifo(int bufferSize_, int maxReadLength_) :
{
int bufferSizeWithExtra = bufferSize + maxReadLength;
memoryNeededGB = sizeof(uint16_t) * bufferSizeWithExtra / (1024.0 * 1024.0 * 1024.0);
cout << "DataStreamFifo: Allocating " << 2 * bufferSizeWithExtra / 1.0e6 << " MBytes for FIFO buffer." << '\n';
std::cout << "DataStreamFifo: Allocating " << 2 * bufferSizeWithExtra / 1.0e6 << " MBytes for FIFO buffer." << std::endl;
buffer = nullptr;

memoryAllocated = true;
try {
buffer = new uint16_t [bufferSizeWithExtra];
} catch (std::bad_alloc&) {
memoryAllocated = false;
cerr << "Error: DataStreamFifo constructor could not allocate " << memoryNeededGB << " GB of memory." << '\n';
std::cerr << "Error: DataStreamFifo constructor could not allocate " << memoryNeededGB << " GB of memory." << std::endl;
}

if (!buffer) {
cerr << "Error: DataStreamFifo constructor could not allocate " << 2 * bufferSizeWithExtra << " bytes of memory." << '\n';
std::cerr << "Error: DataStreamFifo constructor could not allocate " << 2 * bufferSizeWithExtra << " bytes of memory." << std::endl;
}
resetBuffer();
}
Expand Down
2 changes: 1 addition & 1 deletion Engine/Processing/softwarereferenceprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void SoftwareReferenceProcessor::readReferenceSamples(vector<StreamChannelPair>
{
const uint16_t* pRead;

for (int i = 0; i < addresses.size(); ++i) {
for (uint i = 0; i < addresses.size(); ++i) {
pRead = start;
pRead += 6; // Skip header and timestamp.
pRead += misoWordSize * (numDataStreams * 3); // Skip auxiliary channels.
Expand Down
2 changes: 1 addition & 1 deletion Engine/Processing/stateitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class StateFilenameItem : public StateItem
bool isValid() const { return !path.isEmpty() && !baseFilename.isEmpty(); }
QString getFullFilename() const { return isValid() ? path + "/" + baseFilename : ""; }

QString getValidValues() const { return "Path: [path/to/file], BaseFilename: [filename.rhx]"; }
QString getValidValues() const override { return "Path: [path/to/file], BaseFilename: [filename.rhx]"; }

private:
QString path;
Expand Down
6 changes: 3 additions & 3 deletions Engine/Processing/waveformfifo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
#include "waveformfifo.h"

WaveformFifo::WaveformFifo(SignalSources *signalSources_, int bufferSizeInDataBlocks_, int memorySizeInDataBlocks_, int maxWriteSizeInDataBlocks_, SystemState* state_) :
state(state_),
signalSources(signalSources_),
bufferSizeInDataBlocks(bufferSizeInDataBlocks_),
memorySizeInDataBlocks(memorySizeInDataBlocks_),
maxWriteSizeInDataBlocks(maxWriteSizeInDataBlocks_),
numReaders(NumberOfReaders),
state(state_)
numReaders(NumberOfReaders)
{
if (numReaders < 1) {
cerr << "WaveformFifo constructor: numReaders must be one or greater." << '\n';
Expand All @@ -64,7 +64,7 @@ WaveformFifo::WaveformFifo(SignalSources *signalSources_, int bufferSizeInDataBl
bufferAllocateSize = bufferSize + maxWriteSizeInSamples;
bufferAllocateSizeInBlocks = bufferSizeInDataBlocks + maxWriteSizeInDataBlocks;

usedWordsNewData = new Semaphore [numReaders];
usedWordsNewData = new Semaphore[numReaders];
bufferReadIndex.resize(numReaders);
bufferMemoryIndex.resize(numReaders);
numWordsToBeRead.resize(numReaders);
Expand Down
3 changes: 1 addition & 2 deletions Engine/Processing/waveformfifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <map>
#include <vector>
#include <mutex>
#include "rhxglobals.h"
#include "semaphore.h"
#include "minmax.h"
#include "signalsources.h"
Expand Down Expand Up @@ -76,7 +75,7 @@ const uint8_t SpikeIdLikelyArtifact = 0x80u;
class WaveformFifo
{
public:
enum Reader {
enum Reader : uint {
ReaderDisplay = 0,
ReaderDisk,
ReaderAudio,
Expand Down
Loading