Kleinere Änderungen
This commit is contained in:
+36
-31
@@ -14,7 +14,6 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "axi_crc_dma.h"
|
||||
#include "gip.h"
|
||||
|
||||
|
||||
// #define DEBUG
|
||||
@@ -38,7 +37,23 @@ uint32_t calcCRC32(
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int testRuns;
|
||||
// Testlaeufe, Paketgroesse und Paketanzahl
|
||||
int testRuns = TEST_RUNS;
|
||||
// int maxPacketSize = MAX_PACKET_SIZE;
|
||||
// int maxNumberPackets = MAX_NUMBER_PACKETS;
|
||||
|
||||
// Argumente auswerten
|
||||
if (argc > 1) {
|
||||
testRuns = atoi(argv[1]);
|
||||
}
|
||||
// if (argc > 2) {
|
||||
// maxPacketSize = atoi(argv[2]);
|
||||
// }
|
||||
// if (argc > 3) {
|
||||
// maxNumberPackets = atoi(argv[3]);
|
||||
// }
|
||||
|
||||
// Logdatei anlegen
|
||||
char logFileName[100];
|
||||
time_t now = time(NULL);
|
||||
struct tm *t = localtime(&now);
|
||||
@@ -51,13 +66,6 @@ int main(int argc, char** argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
testRuns = TEST_RUNS;
|
||||
}
|
||||
else {
|
||||
testRuns = atoi(argv[1]);
|
||||
}
|
||||
|
||||
// some established CRC32 Parameter sets. Source: https://reveng.sourceforge.io/crc-catalogue/ (13.02.2025)
|
||||
const CrcParameterSet CRC32_AIXM = {
|
||||
.Polynomial = 0x814141ab,
|
||||
@@ -110,9 +118,6 @@ int main(int argc, char** argv)
|
||||
PCRC_DMA_Typedef CRC = (PCRC_DMA_Typedef) mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fdCRC, 0);
|
||||
uint32_t* pMem = (uint32_t*) mmap(NULL, 0x20000000, PROT_READ | PROT_WRITE, MAP_SHARED, fdMem, 0);
|
||||
|
||||
// Interrupt zuruecksetzen
|
||||
CRC->InterruptStatus = 0;
|
||||
|
||||
// Physische Adressen anlegen
|
||||
uint32_t uio16PhysBase = 0x30000000; // UIO16 physical Baseaddress
|
||||
uint32_t* pDataPhy = (uint32_t*) uio16PhysBase;
|
||||
@@ -170,6 +175,21 @@ int main(int argc, char** argv)
|
||||
fprintf(logFile, "CRC-Berechnung in Hardware starten\n");
|
||||
CRC->Control |= (1<<0);
|
||||
|
||||
// Auf INT warten
|
||||
printf("Auf Interrupt warten...\n");
|
||||
fprintf(logFile, "Auf Interrupt warten...\n");
|
||||
int pending;
|
||||
read(fdCRC, (void*) &pending, 4);
|
||||
CRC->InterruptStatus = 0;
|
||||
write(fdCRC, (void*) &reenable, 4);
|
||||
printf("Interrupt erhalten\n");
|
||||
fprintf(logFile, "Interrupt erhalten\n");
|
||||
|
||||
// Hardwareergebnis in Array ablegen
|
||||
for (int p = 0; p < number_packets; p++) {
|
||||
crc_hw[p] = DataDest[p][packet_size];
|
||||
}
|
||||
|
||||
// CRC Berechnung in Software durchfuehren
|
||||
printf("CRC-Berechnung in Software durchfuehren\n");
|
||||
fprintf(logFile, "CRC-Berechnung in Software durchfuehren\n");
|
||||
@@ -187,21 +207,6 @@ int main(int argc, char** argv)
|
||||
// fprintf(logFile, "Packet %i:\t0x%08x\n", p, crc_sw[p]);
|
||||
}
|
||||
|
||||
// Auf INT warten
|
||||
printf("Auf Interrupt warten...\n");
|
||||
fprintf(logFile, "Auf Interrupt warten...\n");
|
||||
int pending;
|
||||
read(fdCRC, (void*) &pending, 4);
|
||||
CRC->InterruptStatus = 0;
|
||||
write(fdCRC, (void*) &reenable, 4);
|
||||
printf("Interrupt erhalten\n");
|
||||
fprintf(logFile, "Interrupt erhalten\n");
|
||||
|
||||
// Hardwareergebnis in Array ablegen
|
||||
for (int p = 0; p < number_packets; p++) {
|
||||
crc_hw[p] = DataDest[p][packet_size];
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// data und DataDest komplett ausgeben
|
||||
printf("\ndata\tDataDest:\n");
|
||||
@@ -225,8 +230,8 @@ int main(int argc, char** argv)
|
||||
|
||||
// Daten und Ergebnisse vergleichen
|
||||
unsigned int wrongWords = 0; // Zaehler fuer Anzahl der fehlerhaften Worte im (Ziel-)Speicher
|
||||
printf("Daten und Ergebnisse vergleichen\n\n");
|
||||
fprintf(logFile, "Daten und Ergebnisse vergleichen\n\n");
|
||||
printf("Daten und Ergebnisse vergleichen:\n");
|
||||
fprintf(logFile, "Daten und Ergebnisse vergleichen:\n");
|
||||
bool allPaketsOK = true;
|
||||
for (int p = 0; p < number_packets; p++) {
|
||||
bool dataOK = true;
|
||||
@@ -272,8 +277,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
if (allPaketsOK) {
|
||||
printf("Alle Pakete OK\nTestdurchlauf erfolgreich abgeschlossen!\n");
|
||||
fprintf(logFile, "Alle Pakete OK\nTestdurchlauf erfolgreich abgeschlossen!\n");
|
||||
printf("Alle Pakete OK\nTestlauf erfolgreich abgeschlossen!\n");
|
||||
fprintf(logFile, "Alle Pakete OK\nTestlauf erfolgreich abgeschlossen!\n");
|
||||
} else {
|
||||
allTestrunsOK = false;
|
||||
printf("Ein oder mehrere Pakete nicht OK.\n");
|
||||
|
||||
Reference in New Issue
Block a user