# File: ipon.src
#
# This procedure powers up the Image Processor.
#

program "@(#) MODULE: ipon.src RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/flight/src/restart_ip_v01.src"
descr "   ipon - Power on image processor"

display "Executing procedure ipon."

tcblock mbpwipon
wait time 10

tcblock mbiprsal                ## reset all
wait time 5

expect mspwipn "ON" 1
expect mspwipr "ON" 1
expect mkpwip "ON" 2
enable mspwipn
enable mspwipr
enable mkpwip


wait mf 2

if getdig(mkpwip) <> "          ON" then
  display "Image processor is NOT on"
end if


# load IP built-in code

tcblock mbiplbic 6 6	 ## Load Flight WCS code
wait time 60
tcblock mbipcmd 5        ## Run Initialization code

perf ip_patches_v01

perf ipedac_v02

perf ldimages_v01                ## Load basic imaging programs
tcblock mbiplbic  5 5        ## Set 256x256 extract program as default
tcblock mbsqreg 5 1          ## Enable HR downlink (R5 is Dynamics flag)
tcblock mbipldin 0x140 61 0  ## Downlink RAW format
tcblock mbipldin 0x140 33 0  ## Downlink via Prime TLM channel

#   Initialize stack items  (ipfc1709 & above)
tcb mbipldin 0x11c

# set initial camera header
display "Setting Initial camera header"
tcblock mbcmhdr1 0x4040 0x4040 0 1 0

display "Finished procedure ipon : %s" !TIME
