Section: TRLO II Manual (3)
Updated: January 2, 2014
Index Return to Main Contents


trlo_setup_readout_control, trlo_read_event, trlo_read_multi_event, trlo_readout_clear, trlo_readout_next_first_evcnt, trlo_read_trig_scalers - Read event-wise data from TRLO II.  


#include "trlo_functions.h"

void trlo_setup_readout_control(volatile trlo_register_map *hardware,
                                struct trlo_readout_control *ctrl,
                                uint32_t multi_trig_event_header_id,
                                uint32_t trig_scalers_header_id,
                                uint32_t failure_corrupt_data,
                                uint32_t failure_too_much_data);

uint32_t trlo_read_event(volatile trlo_register_map *hardware, struct trlo_readout_control *ctrl, uint32_t expect_cnt_incr, uint32_t expect_trlo_trig_type);
uint32_t trlo_read_multi_event(volatile trlo_register_map *hardware, struct trlo_readout_control *ctrl, uint32_t **outbuf, uint32_t *endbuf, uint64_t **timebuf); void trlo_readout_clear(volatile trlo_register_map *hardware); uint32_t trlo_readout_next_first_evcnt(struct trlo_readout_control *ctrl); uint32_t trlo_read_trig_scalers(volatile trlo_register_map *hardware, struct trlo_readout_control *ctrl, uint32_t **outbuf, uint32_t *endbuf, int use_as_next_ref); Link with -ltrloctrllib.



For all functions, hardware is a pointer to a TRLO II module, see trlo_setup_map_hardware() or trlo_setup_check_version().

trlo_setup_readout_control() initialises control and statistics structures ctrl for future event-wise readout, such that readout function can operate efficiently. Trigger-related setup must be done before this function is called:

TPAT to trigger mappings have been set. This is needed as the readout verifies that each trigger has at least one associated TPAT. Note that this implies not to generate triggers based on TPATs by the pending trigger mechanism.

Multi-event trigger number, if used.

Logic matrix of triggers. This is needed as only scalers associated with used TPATs are read out. However, it does not matter ff a TPAT is enabled or not.

Header markers for multi-trigger and trigger scaler output data are also given to trlo_setup_readout_control(). The high 8 bits of multi_trig_event_header_id and trig_scalers_header_id will be used to mark the output data by trlo_read_multi_event() and trlo_read_trig_scalers(), respectively.

Error codes returned by the readout functions in case of corruption (as transferred from VME) or overflowing the provided output buffer are given in failure_corrupt_data and failure_too_much_data.

The trlo_readout_clear() function is used to sanitise the TRLO II state after a failed readout, by clearing the multi-event trigger buffer. Note that this does not perform a complete reinitialisation of the module, which has to be done by other means if desired.

trlo_readout_next_first_evcnt() retrieves the next TRLO event counter. This us useful for initialisation in multi-event readout schemes.



On success, 0 is returned from the readout functions. On error, an error code (as specified to trlo_setup_readout_control() is returned).

trlo_readout_next_first_evcnt() returns the next TRLO event counter.



Håkan T. Johansson <>



trlo_setup_map_hardware(3), trlo_setup_check_version(3), trlo_unmap_hardware(3), trlo_clear_config(3), trlo_read_config_file(3), trlolib(7), trloii(7),




This document was created by man2html, using the manual pages.
Time: 04:29:24 GMT, July 10, 2017