From 4745712be6f527d4d02524c7613a81ff9154cfa2 Mon Sep 17 00:00:00 2001 From: hadaq Date: Wed, 2 Feb 2011 12:28:12 +0000 Subject: [PATCH] fgpa_read/write pexor ready (32-bit address) --- libtrbnet/trbcmd.c | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/libtrbnet/trbcmd.c b/libtrbnet/trbcmd.c index a1657a6..a1d381f 100644 --- a/libtrbnet/trbcmd.c +++ b/libtrbnet/trbcmd.c @@ -25,7 +25,7 @@ static int hexMode = HEXMODE; -static const char trbcmd_version[] = "$Revision: 2.64 $"; +static const char trbcmd_version[] = "$Revision: 2.65 $"; #define BACKLOG 10 static uint16_t tcp_port = 55555; @@ -1049,8 +1049,11 @@ int start(int argc, char **argv) /*******************************************/ uint32_t value = 0; +#ifndef PEXOR uint16_t reg_address = 0; - +#else + uint32_t reg_address = 0; +#endif if (cmdLen != 2) { logError(ERROR, "Invalid command, try -h option\n"); return -1; @@ -1060,8 +1063,13 @@ int start(int argc, char **argv) if (trb_debug > 0) { fprintf(stderr, - "Command: READ_FIFO_REGISTER:" - "reg_address: 0x%04x\n", reg_address); + "Command: READ_FIFO_REGISTER: reg_address: " +#ifndef PEXOR + "0x%04x " +#else + "0x%08x ", +#endif + "\n", reg_address); } if (fpga_register_read(reg_address, &value) == -1) { @@ -1069,7 +1077,14 @@ int start(int argc, char **argv) trb_strerror()); return -1; } else { - fprintf(stdout, "0x%04x 0x%08x\n", reg_address, value); + + fprintf(stdout, +#ifndef PEXOR + "0x%04x " +#else + "0x%08x " +#endif + "0x%08x\n", reg_address, value); } } else if (strncmp(cmd[0], "W", CMD_SIZE) == 0) { @@ -1079,23 +1094,33 @@ int start(int argc, char **argv) /*******************************************/ uint32_t value = 0; +#ifndef PEXOR uint16_t reg_address = 0; - +#else + uint32_t reg_address = 0; +#endif + if (cmdLen != 3) { logError(ERROR, "Invalid command, try -h option\n"); return -1; } - + reg_address = strtoul(cmd[1], NULL, hexMode == 1 ? 16 : 0); value = strtoul(cmd[2], NULL, hexMode == 1 ? 16 : 0); if (trb_debug > 0) { + fprintf(stderr, "Command: WRITE_FIFO_REGISTER:" - "reg_address: 0x%04x, " + "reg_address: " +#ifndef PEXOR + "0x%04x, " +#else + "0x%08x, " +#endif "value: 0x%08x\n", reg_address, value); } - + if (fpga_register_write(reg_address, value) == -1) { logError(ERROR, "fpga_register_write failed\n"); return -1; -- 2.43.0