static int hexMode = HEXMODE;
-static const char trbcmd_version[] = "$Revision: 2.32 $";
+static const char trbcmd_version[] = "$Revision: 2.33 $";
/* ---- User Buffer Size ----------------------------------------------- */
"as hexadecimal-numbers\n");
printf(" -V Version number\n");
printf("\nCommands:\n");
- printf(" r <trbaddress> <register> -> read register\n");
- printf(" w <trbaddress> <register> <data> -> write register\n");
- printf(" rm <trbaddress> <register> <size> <mode> -> read "
- "register-memory\n");
- printf(" wm <trbaddress> <register> <mode> <file> -> write to "
- "register-memory from ASCII-file ('-' = stdin)\n");
- printf(" i <trbaddress> -> read unique ID\n");
- printf(" s <uid> <endpoint> <trbaddress> -> set trb-address\n");
- printf(" T <type> <random> <info> <number> -> send trigger\n");
- printf(" TR <input> <type> <random> <info> <number> -> send trigger to "
- "RICH only\n");
- printf(" I <type> <random> <info> <number> -> read IPU data\n");
- printf(" reload <trbaddress> -> reload FPGA\n");
- printf(" reset -> reset "
- "TRBNetwork\n");
- printf(" f <channel> -> flush FIFO of "
- "channel\n");
- printf(" R <register> -> "
- "read register of the FPGA"
- " \n");
- printf(" W <register> <value> -> "
- "write to register of the FPGA"
- " \n");
+ printf(" r <trbaddress> <register> -> "
+ "read register\n");
+ printf(" w <trbaddress> <register> <data> -> "
+ "write register\n");
+ printf(" rm <trbaddress> <register> <size> <mode> -> "
+ "read register-memory\n");
+ printf(" wm <trbaddress> <register> <mode> <file> -> "
+ "write to register-memory from ASCII-file ('-' = stdin)\n");
+ printf(" i <trbaddress> -> "
+ "read unique ID\n");
+ printf(" s <uid> <endpoint> <trbaddress> -> "
+ "set trb-address\n");
+ printf(" T <type> <random> <info> <number|%cctr> -> "
+ "send trigger\n", '%');
+ printf(" TR <input> <type> <random> <info> <number|%cctr> -> "
+ "send trigger to RICH only\n", '%');
+ printf(" I <type> <random> <info> <number|%cctr> -> "
+ "read IPU data\n", '%');
+ printf(" reload <trbaddress> -> "
+ "reload FPGA\n");
+ printf(" reset -> "
+ "reset TRBNetwork\n");
+ printf(" f <channel> -> "
+ "flush FIFO of channel\n");
+ printf(" R <register> -> "
+ "read register of the FPGA\n");
+
+ printf(" W <register> <value> -> "
+ "write to register of the FPGA\n");
+
}
#define CMD_SIZE 256
uint16_t reg_address = 0;
int loop = 1;
int loopCtr = 0;
+ uint16_t trgCtr = 0; /* counter for the %ctr option */
int opt;
/* LowMem Settings, i.e. 3 MBye maximum */
type = strtoul(cmd[1], NULL, hexMode == 1 ? 16 : 0) & 0x0f;
random = strtoul(cmd[2], NULL, hexMode == 1 ? 16 : 0);
info = strtoul(cmd[3], NULL, hexMode == 1 ? 16 : 0);
- number = strtoul(cmd[4], NULL, hexMode == 1 ? 16 : 0);
-
+ if (strncmp(cmd[4], "%ctr", CMD_SIZE) == 0) {
+ if (scriptFile == NULL) {
+ usage(basename(argv[0]));
+ exit(EXIT_FAILURE);
+ }
+ number = trgCtr++;
+ } else {
+ number = strtoul(cmd[4], NULL, hexMode == 1 ? 16 : 0);
+ }
+
/* DEBUG Info */
if (trb_debug > 0) {
fprintf(stderr,
type = strtoul(cmd[2], NULL, hexMode == 1 ? 16 : 0) & 0x0f;
random = strtoul(cmd[3], NULL, hexMode == 1 ? 16 : 0);
info = strtoul(cmd[4], NULL, hexMode == 1 ? 16 : 0);
- number = strtoul(cmd[5], NULL, hexMode == 1 ? 16 : 0);
-
+
+ if (strncmp(cmd[5], "%ctr", CMD_SIZE) == 0) {
+ if (scriptFile == NULL) {
+ usage(basename(argv[0]));
+ exit(EXIT_FAILURE);
+ }
+ number = trgCtr++;
+ } else {
+ number = strtoul(cmd[5], NULL, hexMode == 1 ? 16 : 0);
+ }
+
/* DEBUG Info */
if (trb_debug > 0) {
fprintf(stderr,
type = strtoul(cmd[1], NULL, hexMode == 1 ? 16 : 0) & 0x0f;
random = strtoul(cmd[2], NULL, hexMode == 1 ? 16 : 0);
info = strtoul(cmd[3], NULL, hexMode == 1 ? 16 : 0);
- number = strtoul(cmd[4], NULL, hexMode == 1 ? 16 : 0);
-
+ if (strncmp(cmd[4], "%ctr", CMD_SIZE) == 0) {
+ if (scriptFile == NULL) {
+ usage(basename(argv[0]));
+ exit(EXIT_FAILURE);
+ }
+ number = trgCtr;
+ } else {
+ number = strtoul(cmd[4], NULL, hexMode == 1 ? 16 : 0);
+ }
+
/* DEBUG Info */
if (trb_debug > 0) {
fprintf(stderr,