From 6b84f857f6cd57658848b5b1bf6960fb9a7a0774 Mon Sep 17 00:00:00 2001 From: hadaq Date: Mon, 10 Oct 2011 21:09:59 +0000 Subject: [PATCH] update fpga_register_read ... --- trbnetd/trbnetrpc.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/trbnetd/trbnetrpc.c b/trbnetd/trbnetrpc.c index 3161db3..0bcc8f6 100644 --- a/trbnetd/trbnetrpc.c +++ b/trbnetd/trbnetrpc.c @@ -5,7 +5,7 @@ #include "trbnet.h" -const char trbnet_version[] = "$Revision: 1.6 $"; +const char trbnet_version[] = "$Revision: 1.7 $"; unsigned int trb_debug = 0; unsigned int trb_dma = 0; @@ -371,9 +371,29 @@ int trb_send_trigger_rich(uint8_t input, int fpga_register_read(uint16_t reg_address, uint32_t* value) { - return -1; -} + enum clnt_stat status; + RetVal retVal; + + if (trb_client == NULL) return -1; + retVal.data.Buffer_val = value; + retVal.data.Buffer_len = 1; + + status = fpga_register_read_1(reg_address, + &retVal, trb_client); + + if (status != RPC_SUCCESS) { + /* + * An error occurred while calling the server. + * Print error message and stop. + */ + clnt_perror(trb_client, trb_server); + return -1; + } + + copyStatus(&retVal.status); + return retVal.status.retVal; +} int fpga_register_write(uint16_t reg_address, uint32_t value) { -- 2.43.0