From: hadaq Date: Sun, 2 Aug 2009 23:26:44 +0000 (+0000) Subject: . X-Git-Tag: v6.0~407 X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=0e1f0c315af423cc99118efd8bc16d379dde73e8;p=trbnettools.git . --- diff --git a/libtrbnet/trbnet.h b/libtrbnet/trbnet.h index 78d1814..81b4568 100644 --- a/libtrbnet/trbnet.h +++ b/libtrbnet/trbnet.h @@ -11,8 +11,6 @@ extern unsigned int trb_dma; int init_ports(); -int trb_fifo_flush(uint8_t channel); - int trb_register_read(uint16_t trb_address, uint16_t reg_address, uint32_t* data, @@ -37,7 +35,7 @@ int trb_register_write_mem(uint16_t trb_address, uint16_t dsize); int trb_read_uid(uint16_t trb_address, - uint32_t* uidBuffer, + uint32_t* data, unsigned int dsize); int trb_set_address(uint64_t uid, @@ -63,10 +61,18 @@ int trb_send_trigger_rich(uint8_t input, uint8_t random, uint16_t number); +int trb_fifo_flush(uint8_t channel); + /* ---------------------------------------------------------------------- */ +/* This library provides several function to access the trbnet on a + Etrax-Board. + +*/ + /************************************************************************/ -/* In case of an error trb_errno is set, see trberror.h for details. */ +/* In case of any error the gloabl varianble 'trb_errno' will be set, */ +/* see trberror.h for details. */ /************************************************************************/ @@ -74,47 +80,116 @@ int trb_send_trigger_rich(uint8_t input, /* int trb_register_read(uint16_t trb_address, uint16_t reg_address, uint32_t* data, - unsigned int size); + unsigned int dsize); - trb_address: TRB-Address of TRB-Endpoint - reg_address: Register-Address to be read - data: Pointer to uint32_t Data-Buffer - size: Size of the Data-Buffer in units of 32bit-words + trb_address: TRB-Address of the TRB-Endpoint + reg_address: Register-Address to be read from, broadcasts are supported + data: Pointer to a uint32_t Data-Buffer + dsize: Size of the Data-Buffer in units of 32bit-words - ReturnValue: == -1 on error + ReturnValue: == -1 on error, trberrno will be set >= 0 number of 32bit-words which were stored in Data-Buffer TRB-Channel used: slow control (3) reads the register reg_address of a TRB-Endpoint with address trb_address. The received data is stored in the Data-Buffer data. + The format of the Data-Buffer is: - first word: TRB-Address of sender + first word: TRB-Address of the sender second word: register value - --> Data-Buffer-Size size must be at least 2 + --> The size of the Data-Buffer must be at least >= 2 */ +/************************************************************************/ /* int trb_register_write(uint16_t trb_address, uint16_t reg_address, uint32_t value); - trb_address: TRB-Address of TRB-Endpoint - reg_address: Register-Address to be written - value: 32bit-word to write to register + trb_address: TRB-Address of the TRB-Endpoint, broadcasts are supported + reg_address: Register-Address to be written to + value: 32bit-word to be writen to the register + + ReturnValue: == -1 on error, trberrno will be set + + TRB-Channel used: slow control (3) - ReturnValue: == -1 on error + writes the value to the register reg_address of a TRB-Endpoint with address + trb_address. +*/ + +/************************************************************************/ +/* int trb_read_uid(uint16_t trb_address, + uint32_t* data, + unsigned int dsize); + + trb_address: TRB-Address of the TRB-Endpoint, broadcasts are supported + data: Pointer to a uint32_t Data-Buffer + dsize: Size of the Data-Buffer in units of 32bit-words + + ReturnValue: == -1 on error, trberrno will be set >= 0 number of 32bit-words which were stored in Data-Buffer + + TRB-Channel used: slow control (3) + + reads the Unique-Id of a TRB-Endpoint with address trb_address. The + received data is stored in the Data-Buffer data. + + The format of the Data-Buffer is: + first word: UID High-32Bit Word + second word: UID Low-32Bit Word + third word: Endpoint Number + fourth word: TRB-Address of the sender + + --> The size of the Data-Buffer must be at least >= 4 + +*/ + +/************************************************************************/ +/* int trb_set_address(uint64_t uid, + uint8_t endpoint, + uint16_t trb_address); + + uint64_t uid: the UID of the Endpoint + uint8_t endpoint: Number of the TRBNet-Endpoint + uint16_t trb_address: the new TRB-Netaddress, broadcasts are not supported + + ReturnValue: == -1 on error, trberrno will be set + == 0 on success TRB-Channel used: slow control (3) - writes value to the register reg_address of a TRB-Endpoint with address - trb_address. + sets a new TRB-Address trb_address of the give TRFNet-endpoint. */ +/************************************************************************/ +/* int trb_ipu_data_read(uint8_t type, + uint8_t trg_info, + uint8_t trg_random, + uint16_t trg_number, + uint32_t* data, + unsigned int dsize); + + data: Pointer to a uint32_t Data-Buffer + dsize: Size of the Data-Buffer in units of 32bit-words + + ReturnValue: == -1 on error, trberrno will be set + >= 0 0 number of 32bit-words which were stored in Data-Buffer + + send a request to all TRBNet-Endpoints to readout the IPU-Data. The IPU + Datastream will be stored in the user DataBufer. +*/ + +/************************************************************************/ +/* int trb_send_trigger(uint8_t type, + uint8_t info, + uint8_t random, + uint16_t number); +*/ #endif