# Increase the callback queue size for the record processing
callbackSetQueueSize(12000)

# Initialize the IOC and start processing records
iocInit()

# Initialize caPutLog
caPutLogInit("${EPICS_CA_PUT_LOG_ADDR}")

# Generate the autosave PV list
# Note we need change directory to
# where we are saving the restore
# request file.
cd("${IOC_DATA}/${IOC}/autosave-req")
makeAutosaveFiles()

# Start the save_restore task
# save changes on change, but no faster
# than every 5 seconds.
# Note: the last arg cannot be set to 0
create_monitor_set("info_positions.req", 5 )
create_monitor_set("info_settings.req" , 5 )
create_monitor_set("${IOC}.req",60,"")

# change directory to TOP of application
cd("${TOP}")

#DAQMUX configurations
dbpf ${P}:DAQMUX1_FORMATDATAWIDTH0 1
dbpf ${P}:DAQMUX1_AUTOREARM 1

#STREAM CONFIGURATIONS
dbpf ${P}:STR0:STREAM_TYPE0 3

#WAVEFORM ENGINE CONFIGURATIONS
dbpf ${P}:WFENG1_INIT 1


#Diagnostic bus trigger delay (ns).
dbpf ${P}:0:TRG11_SYS2_TDES 800


# Load the 31 position array in the preamp table
system("caput -a ${P}:PreAmpTable 31 ${PRE_AMP_TABLE_1} ${PRE_AMP_TABLE_2} ${PRE_AMP_TABLE_3}")
