# File: lipcnfg.src
#
# This procedure configures the Image Processor.
#
#lbic program mnemonic decription
#  3  extr1024  ex1k   extract standard 1024x1024 fgram from memory 0.
#  4  extr256a  ex256  extract central 256x256 from memory 0.
#  5  pack4x4c  1pk4   4x4 sum of single image from memory 0.

program "@(#) MODULE: lipcnfg.src RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/eof/src/lipcnfg.src"
descr " lipcnfg - Load IP built in code"

display "Executing procedure lipcnfg."
write  !GS9 "Executing procedure lipcnfg :"
write  !GS9 " %s" !DATE
writen !GS9 " %s" !TIME
writen !GS9 " "

# select IP built-in code to load

startCNFG:

setstr !LS9 = "Which IP program?"
setstr !LS3 = "extr1024"
setstr !LS4 = "extr256a"
setstr !LS5 = "pack4x4c"

menu !LS8 !LS9 !LS3 !LS4 !LS5

if !LS8 = !LS3  then
  set !GI5 = 3
  goto doCNFG
end if
if !LS8 = !LS4 then
  set !GI5 = 4
  goto doCNFG
end if
if !LS8 = !LS5  then
  set !GI5 = 5
  goto doCNFG
end if

doCNFG:

tcblock mbipldin 0x140 0x20 !GI5

write  !GS9 "3=ext1k 4=ex256 5=1pak4"
writen !GS9 "IP Code Selected: %d" !GI5

display "configuring for %8s, " !LS8 to 31

# configure for redundant side based on mktmsel

setstr !LS1 = getdig(mktmsel)

if !LS1 = 2 then
  perform  "liptlm2_v01"
end if

# select IP built-in code to load

startCOMP:

setstr !LS9 = "What compression?"
setstr !LS3 = "none    "
setstr !LS4 = "n=14,k=5"
setstr !LS5 = "other   "

menu !LS8 !LS9 !LS3 !LS4 !LS5

if !LS8 = !LS3  then
  set !LI0 = 0
  goto doCOMP
end if
if !LS8 = !LS4 then
  set !LI0 = 0xE5
  goto doCOMP
end if
if !LS8 = !LS5 then
  set !LI1 = 0xE0		## only use 14
  ask !LI2 "Enter k value (n is 14): "
  set !LI0 = !LI1 + !LI2
  goto doCOMP
end if

doCOMP:

tcblock mbipldin 0x140 0x3d !LI0

write  !GS9 "0=no compression"
writen !GS9 "Compression selected: %d" !LI0

display "configuring for %8s, " !LS8 to 31

# set initial camera header

tcblock mbcmhdr1 0x4040 0x4040 0 1 0

Done:

writen !GS9 "Finished procedure lipcnfg : %s" !TIME
writen !GS9 " "


