#%TITLE% can_icb.mac
#%NAME%
# Access to Canbera ICB bus
#%CATEGORY% Detection, MCA
#%DESCRIPTION%
# These macros provide access to modules on the Canberra
# ICB bus. They are typically used by modules like the 9635 and the 9660.
# The first argument in the macros is the device. This understands the
# ESRF domain device name like "idxx/mca/yyyicb".
#%BR%
#%BR%
#
#%LOG%
# Modifications history: %BR%
# Creation unknown date %BR%
# Feb 2002 HW seperate macros from the can9635 macros and put them here. %BR%
#
# $Revision: 1.2 $
#%END%
#%UU% (device, addr, reg)
#%MDESC% Read register <reg> from ICB device address <addr> on MCA
# device <device>
def icb_read (device, addr, reg) '{
local ICB ICBOUT
ICB[0] = 1 ;
ICB[1] = reg + 0x10 * addr
esrf_io(device,"DevMcaReadICB",ICB,ICBOUT)
return ICBOUT[0]
}'
#%UU% (device, addr, reg)
#%MDESC% Put value <value> into register <reg> on ICB device on
# address <addr> on MCA device <device>
def icb_write (device, addr, reg, value) '{
local ICB
ICB[0]=1
ICB[1]=reg + 0x10 * addr
ICB[2]=value
return esrf_io(device, "DevMcaSendICB",ICB)
}'
#%UU% (device, addr, from_reg, to_reg, outarr)
#%MDESC% Read registers <from_reg> to <to_reg> on ICB device
# address <addr> on MCA device <device>. Put the results in the array outarr.
# The outarr will have to be indexed with the register. For example, reading
# from 4 to 7, the value of register 7 will be in outarr[7].
def icb_mread (device, addr, from_reg, to_reg, outarr) '{
local i ICB ICBread no_reg
ADR=0x10 * addr
ICB[0] = no_reg = to_reg - from_reg + 1
for (i = 0 ; i < no_reg ; i ++)
ICB[i + 1] = from_reg + i + ADR
esrf_io(device, "DevMcaReadICB", ICB, ICBread)
for (i = 0 ; i < no_reg ; i ++) {
pos = from_reg + i
outarr[pos]=ICBread[i]
}
}'
#%UU% (device, addr, from_reg, to_reg, inarr)
#%MDESC% Write registers <from_reg> to <to_reg> to ICB device
# address <addr> on MCA device <device>. Write what is in array inarr.
# Inarr will have to be indexed with the register. For example, reading
# from 4 to 7, the value of register 7 will be in inarr[7].
def icb_mwrite (device, addr, from_reg, to_reg, inarr) '{
local ICB ADR I
ADR = 0x10 * addr
ICB[0] = no_reg = to_reg - from_reg + 1
for (i = 0 ; i < no_reg ; i ++) {
ICB[2*i + 1] = from_reg + i + ADR
ICB[2*i + 2] = inarr[from_reg + i]
}
esrf_io(device, "DevMcaSendICB", ICB)
}'
#%MACROS%
#%IMACROS%
#%TOC%
#%AUTHOR% JK
|