#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, int write_header); 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 -ltrlo_ctrl.
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:
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.
trlo_readout_next_first_evcnt() returns the next TRLO event counter.