#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <semLib.h>
#include "BBC/BUG.h"
#include "BBC/BSWP.ih"
#include "BBC/IVTE.ih"
#include "BBC/RNG.h"
#include "BBC/SPIN.ih"
#include "BVME/VME.h"
#include "BVME/UNIV.h"
#include "BVME/UNIV_print.h"
#include "BFU/BFA.h"
#include "BFU/BFR.h"
#include "BFU/BFU_fileDsc.h"
Data Structures | |
| struct | _BFR_lst |
| List head for the various readout types. More... | |
| struct | _BFR_rod |
| Describes and controls an object to be readout. More... | |
| struct | _BFR_roi |
| Defines a readout image. More... | |
| struct | _BFR_rop |
| Defines a readout program. More... | |
| struct | _BFR_ros |
| Describes the synchronization structure. More... | |
Defines | |
| #define | BFR_K_RO_MAX 32 |
| The maximum number of types of readout. | |
| #define | BFR_K_MAX_FIFO_CNT 4096 |
| Maximum number events in the FIFO. | |
| #define | DCTL_SUP |
| DMA control word for SUPERVISOR mode BLT. More... | |
| #define | DCTL_USR |
| DMA control word for USER mode BLT. More... | |
Typedefs | |
| typedef _BFR_rod | BFR_rod |
| Typedef for struct _BFR_rod. More... | |
| typedef _BFR_ros | BFR_ros |
| Typedef for struct _BFR_ros. | |
| typedef _BFR_lst | BFR_lst |
| Typedef for struct _BFR_lst. | |
Functions | |
| void | dma_service (BFR_ros *dma_synch) |
| Services a DMA completion interrupt. More... | |
| int | cnt_bits (unsigned int word) |
| Simple internal routine to count the bits in a 32 bit word. More... | |
| int | get_input_position (const BFR_id *input_order, unsigned int ro_list, BFR_id which) |
| Returns a number representing which input record this corresponds to. More... | |
| UNIV_dcp * | bind1_indirect (UNIV_dcp *dcpp, const BFR_rod *rod, int nread) |
| Completes the binding of indirect readout descriptors. More... | |
| UNIV_dcp * | bind1_direct (UNIV_dcp *dcpp, BFU_fileDsc *dsc, BFR_roi *roi, const BFR_rop *rop, int nread) |
| Binds all the readouts. More... | |
| int | BFR_rop_sizeof (int rod_max) |
| Calculates the size of a BFR readout control structure which can hold rod_max readout descriptors. More... | |
| BFR_rop * | BFR_rop_get (int rod_max) |
| Allocates a BFR readout control structure which can hold rod_max readout descriptors. More... | |
| BFR_rop * | BFR_rop_init (BFR_rop *rop, unsigned int hdr_id, int rod_max, unsigned int tlr_id, int sum_cnt, int sum_size) |
| Initializes a previously allocated readout program. More... | |
| int | BFR_rod_add (BFR_rop *rop, int input, BFR_id rid, unsigned int id, int size, unsigned int data_fifo, unsigned int size_fifo, BFR_rdRtn rdRtn, void *rdPrm) |
| Adds a readout descriptor to the readout program. More... | |
| const BFR_rop * | BFR_rop_configure (unsigned int hdr_id, unsigned int ro_list, unsigned int tlr_id, int sum_cnt, int sum_size, const BFR_id *output_order, const BFR_id *input_order, const unsigned int *ivte_ids, const int *data_sizes, const unsigned int *tem_vmes, const int *data_fifos, const int *size_fifos, const BFR_rdRtn *rdRtns, void *const *rdPrms) |
| High level routine to construct a readout program. More... | |
| void | BFR_rop_print (const BFR_rop *rop) |
| Diagnostic routine to print the contents of an readout program. rod_max readout descriptors. More... | |
| BFR_roi * | BFR_roi_construct (const BFR_rop *rop) |
| Constructs a template readout image from an readout program. More... | |
| int | BFR_roi_bind0 (BFR_roi *roi, int nread, unsigned int sequence) |
| Does the phase 0 of binding the readout image to a specific readout instance. More... | |
| int | BFR_roi_read0 (BFR_roi *roi) |
| Does phase 0 of reading out the event. More... | |
| int | BFR_roi_pend0 (BFR_roi *roi) |
| Waits for any asynchronous activity associated with the 0th phase of the readout to complete. More... | |
| int | BFR_roi_bind1 (BFR_roi *roi, struct _BFA_acb *acb) |
| Does the phase1 of binding the readout image to a specific readout instance. More... | |
| int | BFR_roi_read1 (BFR_roi *roi) |
| Does the first phase of reading out the event. More... | |
| int | BFR_roi_pend1 (BFR_roi *roi) |
| Waits for any asynchronous activity associated with the phase 1 of the readout to complete. More... | |
| int | BFR_roi_copy1 (BFR_roi *roi, struct _BFA_acb *acb) |
| Completes the output record by copying an indirectly read data into the output record. More... | |
| int | BFR_roi_finish (BFR_roi *roi, struct _BFA_acb *acb) |
| Performs any work needed after the event and all summary information has been read in. More... | |
| _BFU_fileDsc * | BFR_roi_evtDscGet (const BFR_roi *roi) |
| Returns a pointer to an event descriptor structure. More... | |
| void | BFR_roi_print (const BFR_roi *roi) |
| Diagnostic print routine to display the contents of a readout image. More... | |
|
|
Value: (UNIV_K_DCTL_VDW_32 | \
UNIV_K_DCTL_VAS_A32 | \
UNIV_K_DCTL_PGM_DATA | \
UNIV_K_DCTL_SUPER_SUPER | \
UNIV_K_DCTL_VCT_BLT | \
UNIV_K_DCTL_LD64EN )
|
|
|
Value: (UNIV_K_DCTL_VDW_32 | \
UNIV_K_DCTL_VAS_A32 | \
UNIV_K_DCTL_PGM_DATA | \
UNIV_K_DCTL_SUPER_USER | \
UNIV_K_DCTL_VCT_BLT | \
UNIV_K_DCTL_LD64EN )
|
|
|
Typedef for struct _BFR_rod.
Readouts come in a various types. The are classified by whether they are direct or indirect, fixed or variable and USER or SUPERVISOR VME assess mode. The direct or indirect refers to whether the data from a FIFO can be read direcly into the readout memory or whether it first needs to be read into a holding array and then copied into the readout memory. This occurs, for example, if the data from the FIFO needs to be processed. The L1T FIFO is an example of this. Because its FIFO is only byte-wide, 4 bytes must be packed into a 32-bit quantity before it is placed into the readout memory. The fixed or variable refers to whether the data from a FIFO is fixed length or variable length. All variable length data must have a supporting FIFO which holds the actual length of each event. Currently only the TKR data is variable length. Finally a FIFO may be assessed either in VME USER mode or VME SUPERVISOR mode. Currently only the L1T FIFO is assessed in VME SUPERVISOR mode. |
|
||||||||||||||||||||||||||||||||||||||||
|
Adds a readout descriptor to the readout program.
|
|
||||||||||||||||
|
Does the phase 0 of binding the readout image to a specific readout instance.
|
|
||||||||||||
|
Does the phase1 of binding the readout image to a specific readout instance.
|
|
|
Constructs a template readout image from an readout program.
|
|
||||||||||||
|
Completes the output record by copying an indirectly read data into the output record.
|
|
|
Returns a pointer to an event descriptor structure.
|
|
||||||||||||
|
Performs any work needed after the event and all summary information has been read in.
|
|
|
Waits for any asynchronous activity associated with the 0th phase of the readout to complete.
Now, under the truth in advertising, the only IO activity associated with this phase must be performed synchronously, but calling BFR_roi_pend0() gives this the same look and feel as the next phase of readout. |
|
|
Waits for any asynchronous activity associated with the phase 1 of the readout to complete.
|
|
|
Diagnostic print routine to display the contents of a readout image.
|
|
|
Does phase 0 of reading out the event.
Now, under the truth in advertising, the only IO activity associated with this phase must be performed synchronously, but calling BFR_roi_pend0() gives this the same look and feel as the next phase of readout. |
|
|
Does the first phase of reading out the event.
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
High level routine to construct a readout program.
|
|
|
Allocates a BFR readout control structure which can hold rod_max readout descriptors.
This is merely a convenience routine. The user can control his own memory allocation by calling BFR_sizeof_rop() to get the size of the readout program, then using his favorite allocator to obtain the memory. |
|
||||||||||||||||||||||||||||
|
Initializes a previously allocated readout program.
|
|
|
Diagnostic routine to print the contents of an readout program. rod_max readout descriptors.
|
|
|
Calculates the size of a BFR readout control structure which can hold rod_max readout descriptors.
|
|
||||||||||||||||||||||||
|
Binds all the readouts.
1. The header/directories for all data read are constructed.
2. The DMA packets for all directly read records (both the fixed
direct and the variable direct) are completed.
NOTE: Direct readouts are those which have their data read directly
into the output data structure records.
|
|
||||||||||||||||
|
Completes the binding of indirect readout descriptors.
Two fields of the dma command packets must be modified
1. The transfer count, since this depends on the number of events
to be read.
2. The DONE and TERMINATION bits must be cleared.
The data itself is read into a fixed location, stored with the readout image. |
|
|
Simple internal routine to count the bits in a 32 bit word.
|
|
|
Services a DMA completion interrupt.
|
|
||||||||||||||||
|
Returns a number representing which input record this corresponds to.
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002