Skip to content

Commit 32054ed

Browse files
committed
Change some usb block settings
1 parent d4ad0ce commit 32054ed

5 files changed

Lines changed: 13 additions & 7 deletions

File tree

Source/Plugins/IntanRecordingController/RHD2000Thread.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ void RHD2000Thread::scanPorts()
566566
}
567567
// Read the resulting single data block from the USB interface.
568568
evalBoard->readDataBlock(dataBlock, INIT_STEP);
569-
569+
570570
// Read the Intan chip ID number from each RHD2000 chip found.
571571
// Record delay settings that yield good communication with the chip.
572572
for (hs = 0; hs < MAX_NUM_HEADSTAGES; ++hs)//MAX_NUM_DATA_STREAMS; ++stream)
@@ -626,6 +626,9 @@ void RHD2000Thread::scanPorts()
626626
enableHeadstage(hs, false);
627627
}
628628
}
629+
630+
// for (int i = 0; i < 16; i++)
631+
// enableHeadstage(i, true, 2, 32);
629632
updateBoardStreams();
630633

631634

Source/Plugins/IntanRecordingController/rhythm-api/rhd2000datablockusb3.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,15 @@ int Rhd2000DataBlockUsb3::convertUsbWord(unsigned char usbBuffer[], int index)
165165
}
166166

167167
// Fill data block with raw data from USB input buffer.
168-
void Rhd2000DataBlockUsb3::fillFromUsbBuffer(unsigned char usbBuffer[], int blockIndex, int numDataStreams)
168+
void Rhd2000DataBlockUsb3::fillFromUsbBuffer(unsigned char usbBuffer[], int blockIndex, int numDataStreams, int nSamples)
169169
{
170170
int index, t, channel, stream, i;
171171

172+
int samplesToRead = nSamples <= 0 ? SAMPLES_PER_DATA_BLOCK : nSamples;
173+
172174
int ampIndex = 0;
173175
index = blockIndex * 2 * calculateDataBlockSizeInWords(numDataStreams);
174-
for (t = 0; t < SAMPLES_PER_DATA_BLOCK; ++t) {
176+
for (t = 0; t < samplesToRead; ++t) {
175177
if (!checkUsbHeader(usbBuffer, index)) {
176178
cout << "Error in Rhd2000DataBlockUsb3::fillFromUsbBuffer: Incorrect header." << endl;
177179
}

Source/Plugins/IntanRecordingController/rhythm-api/rhd2000datablockusb3.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Rhd2000DataBlockUsb3
4646

4747
static unsigned int calculateDataBlockSizeInWords(int numDataStreams, int nSamples = -1);
4848
static unsigned int getSamplesPerDataBlock();
49-
void fillFromUsbBuffer(unsigned char usbBuffer[], int blockIndex, int numDataStreams);
49+
void fillFromUsbBuffer(unsigned char usbBuffer[], int blockIndex, int numDataStreams, int nSamples = -1);
5050
void print(int stream) const;
5151
void write(ofstream &saveOut, int numDataStreams) const;
5252
static bool checkUsbHeader(unsigned char usbBuffer[], int index);

Source/Plugins/IntanRecordingController/rhythm-api/rhd2000evalboardusb3.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,16 +1471,17 @@ bool Rhd2000EvalBoardUsb3::readDataBlock(Rhd2000DataBlockUsb3 *dataBlock, int nS
14711471
"Increase value of MAX_NUM_BLOCKS." << endl;
14721472
return false;
14731473
}
1474-
1474+
std::cout << " Reading " << nSamples << " samples " << numBytesToRead << " bytes with block size " << USB3_BLOCK_SIZE << std::endl;
14751475
result = dev->ReadFromBlockPipeOut(PipeOutData, USB3_BLOCK_SIZE, USB3_BLOCK_SIZE * max(numBytesToRead / USB3_BLOCK_SIZE, (unsigned int)1), usbBuffer);
1476+
std::cout << "Read " << result << std::endl;
14761477

14771478
if (result == ok_Failed) {
14781479
cerr << "CRITICAL (readDataBlock): Failure on pipe read. Check block and buffer sizes." << endl;
14791480
} else if (result == ok_Timeout) {
14801481
cerr << "CRITICAL (readDataBlock): Timeout on pipe read. Check block and buffer sizes." << endl;
14811482
}
14821483

1483-
dataBlock->fillFromUsbBuffer(usbBuffer, 0, numDataStreams);
1484+
dataBlock->fillFromUsbBuffer(usbBuffer, 0, numDataStreams, nSamples);
14841485

14851486
return true;
14861487
}

Source/Plugins/IntanRecordingController/rhythm-api/rhd2000evalboardusb3.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
#define FIFO_CAPACITY_WORDS 67108864
3535

36-
#define USB3_BLOCK_SIZE 2048
36+
#define USB3_BLOCK_SIZE 1024
3737
#define RAM_BURST_SIZE 32
3838

3939
#include <queue>

0 commit comments

Comments
 (0)