echo "Entering st.cmd" 

# =========================================
# Timing - evr pci device managment
# =========================================
loadModule.sh $EPICS_CPU_LIB/evrma.ko
chmod 666 /dev/evr0mng

evrManager /dev/evr0mng init
 
# Print EVR firmware version:
evrManager /dev/evr0mng version

# Create vevr0:
# wait a bit to device become visible
evrManager /dev/evr0mng create vevr0
sleep 1
chmod 666 /dev/vevr0

# allocate output 0
evrManager /dev/evr0mng alloc vevr0 output 0

# allocate pulsegen
evrManager /dev/evr0mng alloc vevr0 pulsegen

# map 1st pulse generator to 1st output channel
evrManager /dev/evr0mng output vevr0 0 P 0
evrManager /dev/evr0mng alloc vevr0 output 1
evrManager /dev/evr0mng alloc vevr0 pulsegen

evrManager /dev/evr0mng output vevr0 1 P 1

# =========================================
# ADDI-DATA and SLAC counter kernel modules
# =========================================
loadModule.sh $EPICS_CPU_LIB/apci1710.ko
loadModule.sh $EPICS_CPU_LIB/apci1710ctr.ko
chmod o+rw /dev/apci1710ctr_*

# =========================================
# EtherCat
# =========================================
# Install Ethercat kernel drivers and
# configure master (eth3)
EthCat_MAC_ADDR=0C:C4:7A:AA:07:B9
scannerModule.sh $EthCat_MAC_ADDR 192.168.0.5

# Configure ATCA crate (eth1)
EthCat_MAC_ADDR=0C:C4:7A:8F:AB:3D
scannerConfig.sh $EthCat_MAC_ADDR 10.0.1.1
 
# Start Ethercat Scanner 
su ${IOC_USER} -c '$(which scannerStartup.sh)'

# ========================================
# Turn on local IPMI Client support
# ========================================
echo "Load IPMI..."
sleep 10
modprobe ipmi_devintf
ipmitool lan print

echo "Exiting st.cmd" 
# End of scropt



