xdrproc_t xdr_result, caddr_t result)
{
xdr_free(xdr_result, result);
-
/*
* Insert additional freeing code here, if needed
*/
-
return 1;
}
/* allocate buffer memory */
retVal->data.Buffer_val = (uint32_t *) malloc(sizeof(uint32_t) * dsize);
if (retVal->data.Buffer_val == NULL) {
- return FALSE;
+ fprintf(stderr, "register_read: malloc failed\n");
+ retVal->status.retVal = -1;
+ retVal->status.trb_errno = TRB_RPC_ERROR;
+ return TRUE;
}
status = trb_register_read(trb_address, reg_address,
struct svc_req * rqstp)
{
int status;
-
+ fprintf(stderr, "read: Len: %d, dsize: %d\n",
+ retVal->data.Buffer_len, dsize);
/* allocate buffer memory */
retVal->data.Buffer_val = (uint32_t *) malloc(sizeof(uint32_t) * dsize);
if (retVal->data.Buffer_val == NULL) {
- return FALSE;
+ fprintf(stderr, "registertime_read: malloc failed\n");
+ retVal->status.trb_errno = TRB_RPC_ERROR;
+ retVal->status.retVal = -1;
+ return TRUE;
}
-
+
status = trb_registertime_read(trb_address, reg_address,
(uint32_t *) retVal->data.Buffer_val, dsize);
retVal->data.Buffer_len = status == -1 ? 0 : status;
/* allocate buffer memory */
retVal->data.Buffer_val = (uint32_t *) malloc(sizeof(uint32_t) * dsize);
- if (retVal->data.Buffer_val == NULL)
- return FALSE;
-
+ if (retVal->data.Buffer_val == NULL) {
+ fprintf(stderr, "register_read_mem: malloc failed\n");
+ retVal->status.trb_errno = TRB_RPC_ERROR;
+ retVal->status.retVal = -1;
+ return TRUE;
+ }
+
status = trb_register_read_mem(trb_address, reg_address, option, size,
(uint32_t *) retVal->data.Buffer_val, dsize);
/* allocate buffer memory */
retVal->data.Buffer_val = (uint32_t *) malloc(sizeof(uint32_t) * dsize);
- if (retVal->data.Buffer_val == NULL)
- return FALSE;
+ if (retVal->data.Buffer_val == NULL) {
+ fprintf(stderr, "registertime_read_mem: malloc failed\n");
+ retVal->status.trb_errno = TRB_RPC_ERROR;
+ retVal->status.retVal = -1;
+ return TRUE;
+ }
status = trb_registertime_read_mem(trb_address, reg_address, option, size,
(uint32_t *) retVal->data.Buffer_val, dsize);
struct svc_req* rqstp)
{
int status;
+
/* allocate buffer memory */
- retVal->data.Buffer_val = (uint32_t *) malloc(sizeof(uint32_t) * dsize);
+ retVal->data.Buffer_val = NULL;
+ retVal->data.Buffer_len = 0;
+ retVal->data.Buffer_val = (uint32_t*)malloc(sizeof(uint32_t) * dsize);
+
if (retVal->data.Buffer_val == NULL) {
- return FALSE;
+ fprintf(stderr, "read_uid: malloc failed\n");
+ retVal->status.trb_errno = TRB_RPC_ERROR;
+ retVal->status.retVal = -1;
+ return TRUE;
}
-
+
status = trb_read_uid(trb_address,
(uint32_t*)retVal->data.Buffer_val,
dsize);
retVal->status.retVal = status;
retVal->data.Buffer_len = status == -1 ? 0 : status;
copyStatus(&retVal->status);
+
return TRUE;
}
/* allocate buffer memory */
retVal->data.Buffer_val = (uint32_t *) malloc(sizeof(uint32_t) * dsize);
- if (retVal->data.Buffer_val == NULL)
- return FALSE;
+ if (retVal->data.Buffer_val == NULL) {
+ fprintf(stderr, "ipu_data_read: malloc failed\n");
+ retVal->status.trb_errno = TRB_RPC_ERROR;
+ retVal->status.retVal = -1;
+ return TRUE;
+ }
status = trb_ipu_data_read(type, trg_info, trg_random, trg_number,
(uint32_t *)retVal->data.Buffer_val, dsize);
/* allocate buffer memory */
retVal->data.Buffer_val = (uint32_t *) malloc(sizeof(uint32_t) * 1);
- if (retVal->data.Buffer_val == NULL)
- return FALSE;
+ if (retVal->data.Buffer_val == NULL) {
+ fprintf(stderr, "fpga_register_read: malloc failed\n");
+ retVal->status.trb_errno = TRB_RPC_ERROR;
+ retVal->status.retVal = -1;
+ return TRUE;
+ }
status = fpga_register_read(reg_address,
(uint32_t *)retVal->data.Buffer_val);
return TRUE;
}
-void trbnetrpcprog_1(struct svc_req *rqstp, register SVCXPRT * transp);
-
+extern void trbnetrpcprog_1(struct svc_req *rqstp, register SVCXPRT * transp);
/* ------ MAIN ---------------------------------------------------------- */
#include "trbnet.h"
-const char trbnet_version[] = "$Revision: 1.4 $";
+const char trbnet_version[] = "$Revision: 1.5 $";
unsigned int trb_debug = 0;
unsigned int trb_dma = 0;
status =
register_read_1(trb_address, reg_address, dsize,
&retVal, trb_client);
- copyStatus(&retVal.status);
if (status != RPC_SUCCESS) {
/*
clnt_perror(trb_client, trb_server);
return -1;
}
-
+
+ copyStatus(&retVal.status);
return retVal.status.retVal;
}
status =
registertime_read_1(trb_address, reg_address, dsize,
&retVal, trb_client);
- copyStatus(&retVal.status);
if (status != RPC_SUCCESS) {
/*
clnt_perror(trb_client, trb_server);
return -1;
}
-
+
+ copyStatus(&retVal.status);
return retVal.status.retVal;
}
status =
register_read_mem_1(trb_address, reg_address, option, size, dsize,
&retVal, trb_client);
- copyStatus(&retVal.status);
if (status != RPC_SUCCESS) {
/*
return -1;
}
+ copyStatus(&retVal.status);
return retVal.status.retVal;
}
status =
registertime_read_mem_1(trb_address, reg_address, option, size, dsize,
&retVal, trb_client);
- copyStatus(&retVal.status);
if (status != RPC_SUCCESS) {
/*
clnt_perror(trb_client, trb_server);
return -1;
}
-
+
+ copyStatus(&retVal.status);
return retVal.status.retVal;
}
retVal.data.Buffer_len = dsize;
status = read_uid_1(trb_address, dsize, &retVal, trb_client);
- copyStatus(&retVal.status);
if (status != RPC_SUCCESS) {
/*
return -1;
}
+ copyStatus(&retVal.status);
return retVal.status.retVal;
}
status = register_write_1(trb_address, reg_address, value,
&retVal, trb_client);
- copyStatus(&retVal);
-
+
if (status != RPC_SUCCESS) {
/*
* An error occurred while calling the server.
return -1;
}
+ copyStatus(&retVal);
return retVal.retVal;
}
status = register_write_mem_1(trb_address, reg_address, option, buffer,
&retVal, trb_client);
- copyStatus(&retVal);
if (status != RPC_SUCCESS) {
/*
clnt_perror(trb_client, trb_server);
return -1;
}
-
+
+ copyStatus(&retVal);
return retVal.retVal;
}
status = set_address_1(uid, endpoint, trb_address,
&retVal, trb_client);
- copyStatus(&retVal);
if (status != RPC_SUCCESS) {
/*
return -1;
}
+ copyStatus(&retVal);
return retVal.retVal;
}
status =
ipu_data_read_1(type, trg_info, trg_random, trg_number, dsize,
&retVal, trb_client);
- copyStatus(&retVal.status);
if (status != RPC_SUCCESS) {
/*
clnt_perror(trb_client, trb_server);
return -1;
}
-
+
+ copyStatus(&retVal.status);
return retVal.status.retVal;
}
if (trb_client == NULL) return -1;
status = send_trigger_1(type, info, random, number, &retVal, trb_client);
- copyStatus(&retVal);
if (status != RPC_SUCCESS) {
/*
return -1;
}
+ copyStatus(&retVal);
return retVal.retVal;
}
status = send_trigger_rich_1(input, type, info, random, number,
&retVal, trb_client);
- copyStatus(&retVal);
if (status != RPC_SUCCESS) {
/*
clnt_perror(trb_client, trb_server);
return -1;
}
-
+
+ copyStatus(&retVal);
return retVal.retVal;
}
if (trb_client == NULL) return -1;
status = fpga_register_write_1(reg_address, value, &retVal, trb_client);
- copyStatus(&retVal);
if (status != RPC_SUCCESS) {
/*
clnt_perror(trb_client, trb_server);
return -1;
}
-
+
+ copyStatus(&retVal);
return retVal.retVal;
}
if (trb_client == NULL) return -1;
status = trb_fifo_flush_1(channel, &retVal, trb_client);
- copyStatus(&retVal);
if (status != RPC_SUCCESS) {
/*
clnt_perror(trb_client, trb_server);
return -1;
}
-
+
+ copyStatus(&retVal);
return retVal.retVal;
}
if (trb_client == NULL) return -1;
status = network_reset_1(&retVal, trb_client);
- copyStatus(&retVal);
if (status != RPC_SUCCESS) {
/*
clnt_perror(trb_client, trb_server);
return -1;
}
-
+
+ copyStatus(&retVal);
return retVal.retVal;
}
status =
register_modify_1(trb_address, reg_address, mode, bitMask, bitValue,
&retVal, trb_client);
- copyStatus(&retVal);
if (status != RPC_SUCCESS) {
/*
return -1;
}
+ copyStatus(&retVal);
return retVal.retVal;
}