esrf

Beamline Instrument Software Support
SPEC Macro documentation: [ Macro Index | BCU Home ]

XDS_cub.mac
See other macros in category: All
Description:
    XDS board control
Documentation:
    DESCRIPTION
    Control of XDS boards for acquisition.
    In the spec setup, the user should define:
    • - XDS_setup <device0> <virtex0> <spartan0> <device1> <virtex1> ...
      which defines the devices, virtex files and spartan list file.
    • - The definition of ROIs that the user wants by board/mezzanin/channel.

    *****************************************
    The XDS boards may have 1 or 2 mezzanines.
    board numbers: [0..n]
    mezzanin: [1,2]
    channels: [1,2,3,4]
    *****************************************
    We apply the following conventions for all the boards:
    - if 2 mezzanins, always mezzanin 1 will be the master and mezzanin 2 will be the slave
    - timer bit is disabled (stop acquisition done by a software stop and the data are normalized with the real acquisition time).
    - modes for acquisition: there are 3 modes:
    -- softare mode: each board is started independently
    -- hardware mode: a board is defined by the user as master trig board and is supposed to be daisy chained to all the other to transmit the start of acquisition. master trig board is started by soft.
    -- hardware external mode: same as previous but the master trig board is started by a hardware external signal.
    Modifications since the previous version:
    - XDS_get_hwctrl_new: now takes one file per board/mezz XDS_get_hwctrl remains the same
    - XDS_xxx instead of xds_xxx on useful commands
    - XDS_savegain/XDS_getgain: storage to file in spec format
    - XDS_ARR["FIR"] and XDS_ARR["hwctrl"]
    - XDS_load_virtex_spartan (instead of XDS_load_virtex_spartan)
    - XDS_savespec: remove .txt extension on data files (for matlab)
    - XDS_readroimatlab <file>
    - XDS_write_hwctrl <file>
    - XDS_debug

Macros:
    XDS_setup
    Usage: XDS_setup <device> <virtex> <spartanlist>
    list of XDS devices with virtex and spartan. The path to these files is /users/blissadm/local/spec/userconf/CUB/XDS/BIT.

    XDS_load_virtex_spartan
    Usage: XDS_load_virtex_spartan [0,1,2]
    load list of XDS devices with virtex and spartan. The path to these files is /users/blissadm/local/spec/userconf/CUB/XDS/BIT.
    0 (or no parameter): load virtex then spartan
    1: load virtex only
    2: load spartan only

    XDS_roisetup
    Usage: XDS_roisetup <roi_mne> <roi_mne> ...
    declares how many ROIs to implement and the associated mnemonics

    XDSROISall
    Usage: XDSROISall <roi1lo> <roi1hi> <roi2lo> <roi2hi> ...
    defines the rois for everybody.

    XDSROISdisplay
    Usage: XDSROISdisplay <roi1lo> <roi1hi> <roi2lo> <roi2hi> ...
    defines the rois for everybody.

    XDSROISinit
    Usage: XDSROISinit <how_many_ROIs>
    declares how many ROIs to implement

    XDSROISadd
    Usage: XDSROISadd <board[0..]> <mezz[1,2]> <ch[1,2,3,4]> <roinb[0..]> <roilo> <roihi>
    defines a roi for a board/mezz/channel.

    XDS_showconf
    Usage: XDS_showconf
    Shows the XDS_ARR definitions

    XDS_askforconf
    Usage: XDS_askforconf
    Proposes to change some parameters of the global XDS boards configuration.

    XDSh_applyarray
    Usage: XDSh_applyarray
    applies the XDS_ARR information on the boards in use
    - hw bit -
    - timer bit -
    - master/slave bit -
    - channels in use -

    XDS_enable
    Usage: XDS_enable <XDS_index>
    define a board as in use

    XDS_disable
    Usage: XDS_disable <XDS_index>
    define a board as unused

    XDS_enable_ch
    Usage: XDS_enable_ch <XDS_index> <mezz 1:2> <ch1:4>
    enables channel for a board,mezzanin
    - XDS_index: 0..
    - mezz: 1,2
    - ch: 1,2,3,4

    XDS_disable_ch
    Usage: XDS_disable_ch <XDS_index> <mezz 1:2> <ch1:4>
    disable a channel for a board,mezza
    - XDS_index: 0..
    - mezz: 1,2
    - ch: 1,2,3,4

    XDSh_selectmez
    Usage: XDSh_selectmez (<XDS_index>, <val>)
    select mezzanine (val:1 or 2)

    XDS_setmodehard
    Usage: XDS_setmodehard
    Set mode hardware on all the XDS boards. They are supposed to be hardware trigged (daisy chain) by the mezzanine 1 of the master trig XDS board.
    the mezzanine 1 of master trig board is supposed to be software started -hw bit- is set to 1 to everybody but the mezzanine 1 of the master trig board.

    XDS_setmodehardext
    Usage: XDS_setmodehardext
    Set mode hardware on all the XDS boards. They are supposed to be hardware trigged (daisy chain) by the mezzanine 1 of the master trig board. -hw bit- will be set to 1 to every used board.

    XDS_setmodesoft
    Usage: XDS_setmodesoft
    Set mode sofware on the all the XDS boards:
    -hw bit- will be set to 0 for every used board.

    XDS_setmastertrig
    Usage: XDS_setmastertrig <XDS_index>
    Redefines the master trig board.

    XDS_setparam
    Usage: XDS_setparam <silent>
    Proposes to change some parameters of the XDS boards global configuration before applying it to the hardware
    if give one parameter to the macro, applies the XDS_ARR conf without asking for confirmation

    XDSCsrR
    Usage: XDSCsrR <XDS_index>
    read csr of an already selected mezzanine

    XDSLedR
    Usage: XDSLedR <XDS_index>
    read LED_register of an already selected mezzanine

    XDSRegR
    Usage: XDSRegR <XDS_index> <CSR_add>
    provide address and read any XDS register of an already selected mezzanine

    XDSRegW
    Usage: XDSRegW (<XDS_index>,<val>)
    write the value <val> in TST Register on board <XDS_index>

    XDSLedW
    Usage: XDSLedW <XDS_index> <val>
    Write LED_register of an already selected mezzanine

    XDSTstR
    Usage: XDSTstR <XDS_index>
    seg=2, add=24h=36d MACRO: read TST Register

    XDSTstW
    Usage: XDSTstW <val>
    applies the TST_register setup (32bits) on the boards in use

    _XDSTstW
    Usage: _XDSTstW (<XDS_index>,<val>)
    write the value <val> in TST Register on board <XDS_index>

    XDSIdR
    Usage: XDSIdR <XDS_index>
    seg=2, add=2Ch=44d MACRO: read SDAC_ld Register

    XDSSDacW
    Usage: XDSSDacW <XDS_index> <channel 1,2,3,4> <dac_type G,O,H,L> <12bit_val>
    seg=2, add=30h to 3Ch = 48d to 60d for SDAC_reg then seg=2, add=2Ch = 44d for SDAC_ld MACRO: write the value <val> in channel <cha> SDAC_reg at G(ain), O(ffset), H(igh_in_dscri), L(ow_in_discri) then load with SDAC_ld

    _XDS_setstatchan
    Usage: _XDS_setstatchan (<XDS_index>,<mezz:1,2>,<ch1:4>)
    for that board/mezz, sets the channel number to be used for statistics

    _XDS_getstatcnt
    Usage: _XDS_getstatcnt (<XDS_index>,<mezz:1,2>,<val:0..5>)
    for that board/mezz, defines the statistics to be read

    _XDS_clearstat
    Usage: _XDS_clearstat (<XDS_index>,<mezz:1,2>)
    MACRO:for that board/mezzanin, clear statistics counters

    XDS_setstat
    Usage: XDS_setstat <XDS_index> <mezz:1,2> <ch:1..4>
    MACRO:for that board/mezzanin, sets channel for statistics

    XDS_getstat
    Usage: XDS_getstat <XDS_index> <mezz:1,2>
    MACRO:for that board/mezzanin, gets statistics for the previously selected channel

    XDSTimeR
    Usage: XDSTimeR (XDS_index)
    read TIMER_register of an already selected mezzanine

    XDSRout
    Usage: XDSRout (<XDS_index>,<val>)
    seg=2, add_ch4=4Ch, add_ch3=48h, add_ch2=44h, add_ch1=40h MACRO: Readout all channels together Read Channel 4,3,2,1 (front panel order top to bottom)

    XDScton
    Usage: XDScton
    enables pseudo count.

    XDSscanon
    Usage: XDSscanon
    enables pseudo count.

    XDSctoff
    Usage: XDSctoff
    disables pseudo count.

    XDSscanoff
    Usage: XDSscanoff
    enables pseudo count.

    XDSAcqStop
    Usage: XDSAcqStop (XDS_index)
    stop acquisition on the specified board, on the already selected mezzanin

    XDS_putconf
    Usage: XDS_putconf <filename>
    stores the present XDS configuration on <filename> (under ~blissadm/local/spec/userconf)

    XDS_getFIR
    Usage: XDS_getFIR <filename>
    reads a configuration file (under ~blissadm/local/spec/userconf) and applies it to the hardware

    XDS_readroimatlab
    Usage: XDS_readroimatlab <filename>
    reads a roi file (under ~blissadm/local/spec/userconf/CUB/XDS/ROI)

    XDSh_applyFIR
    Usage: XDSh_applyFIR
    applies the FIR coefs on the boards in use

    XDS_get_hwctrl
    Usage: XDS_get_hwctrl <filename>
    reads a configuration file (under ~blissadm/local/spec/userconf/HDW) and applies it to the hardware

    _SDDch2bmc
    Usage: _SDDch2bmc (<SDDetector channel>)
    lookup table : SDDetector vs board / mez / chan

    XDSh_apply_hwctrl
    Usage: XDSh_apply_hwctrl
    applies the XDSch arrays to the boards in use

    XDS_sethisto
    Usage: XDS_sethisto
    set histo mode and fir_en + blr_en on the boards in use

    XDS_setscope
    Usage: XDS_setscope
    set scope mode + trigonpul on the boards in use

    XDS_setblr
    Usage: XDS_setblr
    set scope mode + view blr on the boards in use

    XDS_savegain
    Usage: XDS_savegain <filename>
    save gain structure to file

    XDS_getgain
    Usage: XDS_getgain <filename>
    get gain structure from file

    XDS_getconf
    Usage: XDS_getconf <filename>
    reads a configuration file (under ~blissadm/local/spec/userconf) and applies it to the hardware

    XDS_showrois
    Usage: XDS_showrois
    Shows the ROI contents by board/mezzanin/channel

    xdsplot
    Usage: xdsplot <board> <mez>
    Plot the channels in use of a mezzanin of a board

    XDS_mca
    Usage: XDS_mca <board> <mezza> <ch>
    mcaguion done in MCA_DATA filled with the last acquired data

    XDS_saveroi
    Usage: XDS_saveroi <filename>


    XDS_getroi
    Usage: XDS_getroi <filename>


    XDS_savespec
    Usage: XDS_savespec <root_file_name>
    saves in the present directory
    - <root>_head.txt
    - <root>_<board>_<mezza>_<ch>

    XDS_saveone
    Usage: XDS_saveone <root_file_name>
    saves in the present directory
    - <root>_head.txt
    - <root>_<board>_<mezza>_<ch>

    XDS_debug
    Usage: XDS_debug <0/1>
    set debug mode

Internal Macros:
    _XDS_LoadVirtex
    Usage: _XDS_LoadVirtex <board> <bit file>
    loads virtex. A timeout of 40 sec is set for the load on the device

    _XDS_LoadSpartanList
    Usage: _XDS_LoadSpartanList <board> <bit file>
    loads spartan. A timeout of 40 sec is set for the load on the device

    _XDS_checkifset
    Usage: _XDS_checkifset
    checks if XDS_ARR global associative array has been already set

    _XDS_preparearray
    Usage: _XDS_preparearray
    prepare the XDS_ARR array with some information.
    Should be called inside XDS_setup.
    - reads if mezzanine 2 is present
    If following not already set decide that:
    - all boards are in use (can be changed with XDS_enable, XDS_disable)
    - work in software mode (can be changed with XDS_setmodehard, setmodehardext, setmodesoft)
    - enable all 4 channels on each mezzanine
    for all, mezzanine 1 is master and mezzanine 2 is slave (cannot be changed)

    _XDS_isused
    Usage: _XDS_isused (XDS_index)
    returns 1 if used, 0 if not in use

    _XDSh_ismez2
    Usage: _XDSh_ismez2 (<XDS_index>)
    returns 1 if mezzanine 2 is present, 0 if not

    _XDSh_sethwbit
    Usage: _XDSh_sethwbit <XDS_index> <val:0,1>
    set hardware bit to <val> on the selected mezzanine
    do nothing if board not in use

    _XDSh_settimerbit
    Usage: _XDSh_settimerbit <XDS_index> <val:0,1>
    set timer bit to <val> on the selected mezzanine
    do nothing if board not in use

    _XDSh_sethmasterbit
    Usage: _XDSh_sethmasterbit <XDS_index> <val:0,1>
    set timer bit to <val> on the selected mezzanine
    do nothing if board not in use

    _XDSh_setchannel
    Usage: _XDSh_setchannel <XDS_index> <ch1> <ch2> <ch3> <ch4>
    set channels on or off on an already selected mezzanine
    do nothing if board not in use

    _XDSh_razhisto
    Usage: _XDSh_razhisto <XDS_index>
    Raz histogram memory of an already selected mezzanine
    do nothing if board not in use

    XDSsetdim
    Usage: XDSsetdim


    XDSbody
    Usage: XDSbody(mode)
    For blmenu (use blmenu.mac).

    XDScount_precount
    Usage: XDScount_precount
    precount pseudo mechanism.Enables acqui on all boards mezzanines and finishing with the mezzanin 1 of master trig board

    XDSAcq_precount
    Usage: XDSAcq_precount <XDS_index>
    enables acquisitions on a board, on the already selected mezzanin.
    - Stop acqui
    - Read CSR
    - set acq_en bit in CSR

    XDSctcalc_getcounts
    Usage: XDSctcalc_getcounts
    pseudo reading data mechanism. gets the data for mezzanin 1, and mezzanin 2 (if exists)

    XDSctnico_getcounts
    Usage: XDSctnico_getcounts
    pseudo reading data mechanism. gets the data for mezzanin 1, and mezzanin 2 (if exists)

    _XDSctcalc_getcounts
    Usage: _XDSctcalc_getcounts (xds_index,mezza)
    get data for a particular mezzanin (1 or 2)
    this macro provides also 4 blocks of data corresponding to each channel of the mezzanin.
    - xds_index : 0..
    - mezza: 1,2

    XDS_calc
    Usage: XDS_calc (xds_index,mezza)
    calculate data for a particular board/mezzanin
    - xds_index : 0..
    - mezza: 1,2

    XDS_calcdef
    Usage: XDS_calcdef (XDS_index,mezzac,ch)
    calculates the ROIs for a particular board/mezzanin/channel
    raw data to be extracted from tablu
    - XDS_index : 0..
    - mezzac: 1,2
    - ch: 1,2,3,4

    XDS_calcdefbm
    Usage: XDS_calcdefbm (XDS_index,mezzac)
    calculates the ROIs for a particular board/mezzanin
    raw data to be extracted from tablu
    - XDS_index : 0..
    - mezzac: 1,2

    _XDS_compat_nbdev
    Usage: _XDS_compat_nbdev (nb_devref,nb_dev)
    verifies if the number of elements are compatible to the reference number.
    return: 0 if not ok, 1 if ok

    _XDS_getFIR
    Usage: _XDS_getFIR <filename>
    reads the FIR file in ~blissadm/local/spec/userconf

    _XDS_readroimatlab
    Usage: _XDS_readroimatlab <filename>
    reads the roi file in ~blissadm/local/spec/userconf/CUB/XDS/ROI

    _XDSh_applyFIR
    Usage: _XDSh_applyFIR (<XDS_index>)
    applies the FIR coefs on a selected board / mez

    _XDS_get_hwctrl
    Usage: _XDS_get_hwctrl <filename>
    reads the hardware control file in ~blissadm/local/spec/userconf/HDW and puts in SPEC array structure

    XDS_write_hwctrl
    Usage: XDS_write_hwctrl <filename>
    writes a hardware control file in ~blissadm/local/spec/userconf/HDW

    _XDS_sethisto
    Usage: _XDS_sethisto (<XDS_index>)
    applies histo mode bit and fir_en + blr_en to the selected board / mezzanine

    _XDS_setscope
    Usage: _XDS_setscope (<XDS_index>)
    applies scope mode bit and trigonpul to the selected board / mezzanine

    _XDS_setblr
    Usage: _XDS_setblr (<XDS_index>)
    applies scope mode bit and view blr to the selected board / mezzanine

    _XDSh_setmez_ctrl
    Usage: _XDSh_setmez_ctrl (<XDS_index>,<mezza>)
    applies the XDSch arrays to the selected board / mezzanine

    XDS_setgainfactor
    Usage: XDS_setgainfactor <XDS_index> <mezza> <ch> <gain>
    applies the gain factor to the selected board / mezzanine

    XDS_setallgainfactor
    Usage: XDS_setallgainfactor <gainfactor>
    applies the gain factor to all

    _XDSh_setgainfactor
    Usage: _XDSh_setgainfactor (<XDS_index>,<mezza>,<ch>,<gainfactor>)
    applies the XDSch arrays of gain and ramplo to the selected board / mezzanine

    _XDS_getconf
    Usage: _XDS_getconf <filename>
    reads the file in ~blissadm/local/spec/userconf

    _XDS_compatarchi
    Usage: _XDS_compatarchi()
    checks if the architecture loaded in XDS_m_xx is compatible with the present devices. it checks:
    - presence of requested devices
    - number of mezzanin on the devices.
    creates an array XDS_m_corres for corrspondance XDS_m_xx -> XDS_ARR

    _XDS_cpconf
    Usage: _XDS_cpconf
    copies the configuration loaded in the XDS_ARR array

    _xds_check_board
    Usage: _xds_check_board (board)
    chack validity of a board number: returns 1 if board number is a valid number

    _xds_check_mezz
    Usage: _xds_check_mezz (mezz)
    check validity of a mezzanin number :returns 1 if mezzanin is [1,2], 0 else

    _xds_check_ch
    Usage: _xds_check_ch (ch)
    check validity of a channel number: returns 1 if ch is [1,2,3,4], 0 else

    _xds_plotch
    Usage: _xds_plotch (board, mezzanin, ch, 1)
    plot the selected channel to an opened filter
    check on validity of board,mezzanin and parameters are supposed to be already done.

    XDS_file_data
    Usage: XDS_file_data


    XDS_filedataon
    Usage: XDS_filedataon


    XDS_filedataoff
    Usage: XDS_filedataoff


Filename: XDS_cub.mac
Author: G.Goujon, MCD
Last mod.: 06/01/2012 14:12 by domingue