# startup
# DO NO CHANGE THE LINE ABOVE!!!
# Root IOC script /PE 990823
#
# No revision history in this file check RCS revision history for changes.
#
echo -text "Start of IOC"
invoke -entry cacheEnable -arg 0 -nomode -errlabel ERROR
invoke -entry cacheEnable -arg 1 -nomode -errlabel ERROR

# Creat dispat tasks
task -slotname tDispLTask -entp dispat_ts -pri 200 -vwopt 0 -stcks 8000 -nosync -auto
task -slotname tDispMTask -entp dispat_ts -pri 52 -vwopt 0 -stcks 8000 -nosync -auto
task -slotname tDispHTask -entp dispat_ts -pri 50 -vwopt 0 -stcks 8000 -nosync -auto
task -slotname tDispPTask -entp dispat_ts -pri 49 -vwopt 0 -stcks 8000 -nosync -auto
invoke -entry dispat_act_ls -strarg tDispHTask -nomode -errlabel ERROR
delay -time 500
invoke -entry gtime_init
invoke -entry IoMgrInit -errlabel ERROR

elog

invoke -entry IoMgrRemoteInit -errlabel ERROR
invoke -entry c82527_init -strarg /can -nomode -errlabel ERROR
invoke -entry Sio860DevInit -errlabel ERROR
invoke -entry Sio860DevInit2 -errlabel ERROR
invoke -entry Sio860CreateDevs -errlabel ERROR
 
open -name /sio4: -mode1 0
# Half duplex
ioctl -command 7002
# New IOC with external crystal
#ioctl -command 7004
# Speed
ioctl -command 201 -arg 38400

invoke -entry timer_init -errlabel ERROR
invoke -entry delay_init -errlabel ERROR
invoke -entry repeat_init -errlabel ERROR

# These tasks should be decimated to only two
task -slotname delay_low -entp delay_ts -pri 150 -vwopt 0 -stcks 8000 -nosync -auto
task -slotname delay_medium -entp delay_ts -pri 100 -vwopt 0 -stcks 8000 -nosync -auto
task -slotname delay_high -entp delay_ts -pri 60 -vwopt 0 -stcks 8000 -nosync -auto

delay -time 500
iomgrinstall -entry DDCMP -name /ddcmp
creat -name /ddcmp/tpu1:/sio4: -pmode 0
 
task -slotname tpu1 -entp ddcmp_ts -pri 80 -vwopt 0 -stcks 8000 -nosync -auto
 
invoke -entry tpi_init -arg 1

 
creat -name /can/can1:/can -pmode 0
creat -name /can/can2:/can -pmode 0

open -name /can1: -mode1 0
ioctl -command 102 -strarg CAN1
ioctl -command 101 -strarg CAN1
ioctl -command 201 -arg 500
ioctl -command 502 -arg 0

open -name /can2: -mode1 0
ioctl -command 102 -strarg CAN2
ioctl -command 101 -strarg CAN2


invoke -entry eiomsg_init -arg 100 -nomode -errlabel ERROR

task -slotname repeat00 -entp repeat_ts -pri 51 -vwopt 0 -stcks 10000 -nosync -auto

invoke -entry dcan_init -strarg /dcan -nomode -errlabel ERROR

creat -name /dcan/dcan1:/can1: -pmode 0
# Start the Timekeeper
ioctl -command 2111 -arg 0

creat -name /dcan/dcan2:/can2: -pmode 0

invoke -entry eiosdp_init -strarg /eiosdp -nomode -errlabel ERROR

invoke -entry eiofdp_init -strarg /eiofdp -nomode -errlabel ERROR

iomgrinstall -entry eiodev -name /eiodev

creat -name /eiodev/eiodev1:/dcan1: -pmode 0
creat -name /eiodev/eiodev2:/dcan2: -pmode 0

iomgrinstall -entry UserSio -name /usersio

creat -name /usersio/tyCo -pmode 0

iomgrinstall -entry scan -name /scan

creat -name /scan/scan1:/can1: -pmode 0

# Install DNSIO driver and device
iomgrinstall -entry dnsio -name /dnsio1:

invoke -entry read_init -errlabel ERROR

task -slotname BASE1 -entp read_ts -pri 55 -vwopt 0 -stcks 4000 -nosync -auto
readparam -devicename /eiodev1:/device -rmode 1 -buffersize 100

task -slotname BASE2 -entp read_ts -pri 56 -vwopt 0 -stcks 4000 -nosync -auto
readparam -devicename /eiodev2:/device -rmode 1 -buffersize 100

# Remove start of ARCITEC read task. Is started by class Scan.c, when option
# ARCITEC is selected.
# task -slotname ARCITEC -entp read_ts -pri 62 -vwopt 0 -stcks 2000 -nosync -auto
# readparam -devicename /scan1:/device -rmode 1 -buffersize 512

iomgrinstall -entry DnetFBC -name /BASE

invoke -entry watchdog_init -nomode
invoke -entry watchdog_create -strarg "/pci0" -nomode

# Change the priority of the tNetTask to prevent loss of panelboard
taskset -pri 120 -slotname tNetTask

release

goto -label END
#ERROR
echo -text "ERROR durring startup"
#END
