#!/bin/bash

# AlineT510.bash 
# Author: Janice Nelson
# Created: 12 Feb 2014	
# Modified:
#
# Description:
#  Script used by AlineTimingTable.edl to set timing masks for PM1 & BYKIK to 5 Hz and DAQ to 1 Hz
#
# Syntax: 
#

# Define Constants
BYKIK="EVNT:SYS0:1:LCBYKIKCHCK1" # For A-Line kickers to fire, BYKIK must fire at same time
PM1="EVNT:SYS0:1:LCALKIKCHCK1"   # A-Line kicker triggers
BXKIK="EVNT:SYS0:1:LCBXKIKCHCK"  # Used for data aquisition triggers
MOD2_INC="I"                     # Pattern 2 Mod 2 Inclusion Mask PV
MOD2_EXC="N"                     # Pattern 2 Mod 2 Exclusion Mask PV
MOD3_INC="J"                     # Pattern 2 Mod 3 Inclusion Mask PV
MOD5_INC="L"                     # Pattern 2 Mod 5 Inclusion Mask PV

# Rates
ONE_HERTZ_AND_POCK=0x80080
FIVE_HERTZ_AND_POCK=0x90000

# User Modes
TS1ONLY=0x3E

# Init Variables

# Set BYKIK and PM1 timing masks
for i in $BYKIK $PM1; do
    caput $i.$MOD2_INC 0x0
    caput $i.$MOD2_EXC 0x3E
    caput $i.$MOD3_INC 0x90000
    caput $i.$MOD5_INC 0x0
done
for i in $BXKIK; do
    caput $i.$MOD2_INC 0x0
    caput $i.$MOD2_EXC 0x3E
    caput $i.$MOD3_INC 0x80080
    caput $i.$MOD5_INC 0x0
done



exit 0
