mirror of
https://github.com/EEVengers/ThunderScope.git
synced 2025-04-08 06:25:30 +00:00
XKCD Commit it works KEKW
This commit is contained in:
parent
c5a57ca3aa
commit
e126655967
Software/waveview/scope_link/src
@ -286,16 +286,13 @@ void runPCIeTest() {
|
||||
uint8_t* buff = (uint8_t*)malloc(sizeof(uint8_t) * (1 << 23));
|
||||
pcieLink->Read(buff);
|
||||
|
||||
std::ofstream fout{ "ReadData.txt" };
|
||||
if(!fout) {
|
||||
INFO << "Could Not Open File";
|
||||
} else {
|
||||
for(int i = 0; i < (1 << 23); i+= 8) {
|
||||
printf("%X,%X,%X,%X,%X,%X,%X,%X\n",
|
||||
buff[i],buff[i + 1],buff[i + 2],buff[i + 3],buff[i + 4],buff[i + 5],buff[i + 6],buff[i + 7]);
|
||||
}
|
||||
FILE* fp = fopen("TestData.txt","w");
|
||||
for(int i = 0; i < (1 << 23); i+= 8) {
|
||||
fprintf(fp,"%X,%X,%X,%X,%X,%X,%X,%X\n",
|
||||
buff[i],buff[i + 1],buff[i + 2],buff[i + 3],buff[i + 4],buff[i + 5],buff[i + 6],buff[i + 7]);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
free(buff);
|
||||
delete pcieLink;
|
||||
}
|
@ -138,8 +138,24 @@ void PCIeLink::Read(uint8_t* buff) {
|
||||
INFO << "Current Chunk: " << current_chunk;
|
||||
if(last_chunk_read == -1) {
|
||||
enoughData = (kbytes_4_moved >= (1 << 11));
|
||||
if(enoughData && current_chunk == 0) {
|
||||
enoughData = false;
|
||||
continue;
|
||||
} else {
|
||||
current_chunk = current_chunk - 1;
|
||||
}
|
||||
} else {
|
||||
enoughData = (current_chunk != last_chunk_read);
|
||||
if(enoughData && (current_chunk - last_chunk_read == 1 || (current_chunk == 0 && last_chunk_read == 31))) { //if the datamover is still writing to the next chunk, dont read it
|
||||
enoughData = false;
|
||||
continue;
|
||||
} else { //otherwise decretment the current chunk by 1 to read the next finished chunk
|
||||
if(current_chunk == 0) {
|
||||
current_chunk = 31;
|
||||
} else {
|
||||
current_chunk = current_chunk - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
last_chunk_read = current_chunk;
|
||||
|
Loading…
Reference in New Issue
Block a user