#include <trbnet.h>
#include <trberror.h>
-static const char pulser_version[] = "$Revision: 1.5 $";
+static const char pulser_version[] = "$Revision: 1.6 $";
-#define bufferSize 16385
+/* 1MByte for 6 Sectors should be enough */
+#define BUFFER_SIZE (1024 * 1024 / 4)
/* ------ MAIN ---------------------------------------------------------- */
static FILE *hldFile = NULL;
static unsigned int evtCounter = 0;
+static uint32_t *buffer = NULL;
static void atexit0()
{
if (hldFile != NULL) {
fclose(hldFile);
}
+ free(buffer);
fprintf(stderr, "%d Triggers were send\n", evtCounter);
}
uint8_t triggerType = 0;
uint8_t input = 0;
unsigned int numEvts = UINT_MAX;
- uint32_t buffer[bufferSize];
sigset_t blockSet;
int size;
int writeToStdout = 0;
exit(EXIT_FAILURE);
}
+ /* allocate buffer */
+ buffer = (uint32_t*)malloc(sizeof(uint32_t) * BUFFER_SIZE);
+ if (buffer == NULL) abort();
+
trg_number = 0;
srand(time(NULL));
}
size = trb_ipu_data_read(triggerType, 0xcc, 0xdd, 0x0001,
- buffer, bufferSize);
+ buffer, BUFFER_SIZE);
if (size == -1) {
trb_error("Error IPU Read");
exit(EXIT_FAILURE);