Note:   For the latest version of this README file, see the bsaDriver EPICS module.

 

#==============================================================
#
#  Name: bsaDriver
#
#  Rem:  
#        EPICS driver module
#        LCLS-II Timing System
#
#  Side: None
#
#  Auth: 17-Mar-2017, Kukhee Kim      (KHKIM)
#  Rev:  dd-mmm-yyyy, Reviewer's Name (USERNAME)
#--------------------------------------------------------------
#  Mod:
#        dd-mmm-yyyy, Reviewer's Name (USERNAME)
#          coment
#
#==============================================================
#
# NOTE:

This is an epics driver module to provide BSA interface for LCLS-II High Performance System (HPS)
which is based on ATCA platform.
It provides epics shell command to configure/setup the BSA names and also provides epics database
templates for BSA PVs in epics ioc application.

Requirements:

- The epics ioc application should build with yamlLoader driver and with CPSW framework.
- The yamlLoader driver should provide register hierarchy and path information.
- The application firmware should have BSA functionallity

yamlLoader Driver:

- the yamlLoader driver should load up the hierarchy file before BSA initialization

ex)  cpswLoadYamlFile("000TopLevel.yaml", "NetIODev", "", "10.0.3.105")

- please, check up more details in README file in yamlLoader driver 

Adding BSA names for the driver:

- before the driver intialization, ioc application engineer should make BSA name list.
- the order of the name should be matched with the BSA data order in application firmware.
- the driver provides ioc shell command "addBsa(<BSA name string>, <BSA data type string>"),
   ioc engineer can use the command to add up bsa name into the list
- the driver proides ioc shell command "listBsa()" to print out the BSA name list,
   ioc engineer could verify the bsa name list with the command
   
ex) 
# ====================================
# Setup BSA Driver
# ====================================
# add BSA 
addBsa("PIDL",       "double")
addBsa("PIDU",       "double")
addBsa("TSL",        "double")
addBsa("TSU",        "double")
addBsa("RATES",      "double")
addBsa("BEAMREQ",    "double")
addBsa("BEAMNRG01",  "double")
addBsa("BEAMNRG23",  "double")
addBsa("MPSSTAT",    "double")
addBsa("MPSCLASS01", "double")
addBsa("MPSCLASS23", "double")

ex) 
vioc-b84-ev01>listBsa()
Total 31 BSA(s) has(have) been registered
        0       PIDL, double
        1       PIDU, double
        2       TSL, double
        3       TSU, double
        4       RATES, double
        5       BEAMREQ, double
        6       BEAMNRG01, double
        7       BEAMNRG23, double
        8       MPSSTAT, double
        9       MPSCLASS01, double

driver initialization:
- the driver provide ioc shell command 
  "bsaAsynDriverConfigure(<asyn port name for BSA>, <path for register space>, <path for dram space>)"
  for the driver initialization
- the driver initialization command should be called after completing the hierarchy loading by yamlLoader driver
  and also after the BSA name list is built.
- the register path and dram path should be consistent with the hierarchy files.
  (in the example, ROOT path of hierarchy is NetIODev,
   the register space is located at NetIODev/mmio/AmcCarrierTimingGenerator/AmcCarrierCore/AmcCarrierBsa,
   and the stream dram is located at NetIODev/strm/AmcCarrierDRAM/dram.)

ex)  bsaAsynDriverConfigure("bsaPort", "mmio/AmcCarrierTimingGenerator/AmcCarrierCore/AmcCarrierBsa","strm/AmcCarrierDRAM/dram")

EPICS database template loading:

- the driver module provide epics database template for the BSA history buffer PVs
- the template has few macros to set up PV name, BSA name and BSA buffer length for the history buffer PVs
- followings are an example BSA history buffer

  $(DEV):$(SECN)HST<n>          ; BSA history for average value
  $(DEV):$(SECN)CNTHST<n>       ; number of samples for an average value
  $(DEV):$(SECN)RMSHST<n>       ; RMS value
  $(DEV):$(SECN)PIDUHST<n>      ; pulse id upper word
  $(DEV):$(SECN)PIDLHST<n>      ; pulse id lower word
  
  $(DEV)         ; macro
  $(SECN)        ; macro, bsa PV name
  $(BSAKEY)      ; macro, bsa key, it should be matched with the bsa name string in addBsa()
  $(MAXLENGTH)   ; macro, history buffer length, recommend to fix it to 20000
  $(PORT)        ; macro, asyn port name for bsa driver, should be matched with the port name in the driver initialization
  
ex) 

# BSA driver DB
dbLoadRecords("db/bsa.db", "DEV=TPG2:BSA,PORT=bsaPort,MAXLENGTH=20000,BSAKEY=PIDU,SECN=PIDU")
dbLoadRecords("db/bsa.db", "DEV=TPG2:BSA,PORT=bsaPort,MAXLENGTH=20000,BSAKEY=PIDL,SECN=PIDL")
dbLoadRecords("db/bsa.db", "DEV=TPG2:BSA,PORT=bsaPort,MAXLENGTH=20000,BSAKEY=TSU,SECN=TSU")
dbLoadRecords("db/bsa.db", "DEV=TPG2:BSA,PORT=bsaPort,MAXLENGTH=20000,BSAKEY=TSL,SECN=TSL")
dbLoadRecords("db/bsa.db", "DEV=TPG2:BSA,PORT=bsaPort,MAXLENGTH=20000,BSAKEY=RATES,SECN=RATES")
dbLoadRecords("db/bsa.db", "DEV=TPG2:BSA,PORT=bsaPort,MAXLENGTH=20000,BSAKEY=BEAMREQ,SECN=BEAMREQ")
dbLoadRecords("db/bsa.db", "DEV=TPG2:BSA,PORT=bsaPort,MAXLENGTH=20000,BSAKEY=BEAMNRG01,SECN=BEAMNRG01")
dbLoadRecords("db/bsa.db", "DEV=TPG2:BSA,PORT=bsaPort,MAXLENGTH=20000,BSAKEY=BEAMNRG23,SECN=BEAMNRG23")
dbLoadRecords("db/bsa.db", "DEV=TPG2:BSA,PORT=bsaPort,MAXLENGTH=20000,BSAKEY=MPSSTAT,SECN=MPSSTAT")
dbLoadRecords("db/bsa.db", "DEV=TPG2:BSA,PORT=bsaPort,MAXLENGTH=20000,BSAKEY=MPSCLASS01,SECN=MPSCLASS01")

- the database template loading can be located before driver initialization


Linear Conversion

BSA database template has slope and offset PVs for each bsa name (bsakey).
The linear conversion affect the followings:

  bsa_data       = slope * raw_bsa_data + offset
  bsa_rmsa_value = slope * raw_rms_value
  
  
Slope and Offset PV names are:

  $(DEV):$(SECN)_SLOPE
  $(DEV):$(SECN)_OFFSET
  
These will be in autosave list.
The database template bsa.db has default value for SLOPE=1 and OFFSET=0.
These will be override by the autosave, once the user setting is saved.

# End of file

 

 

  • No labels