#!/bin/bash
echo "The switch needs to be power cycled after fpga update."

PROMPT="Do you want to update the FPGA [N] "
while true
do
 read -ep "$PROMPT" REPLY
 case `echo $REPLY | /usr/bin/tr [:lower:] [:upper:]` in
  N|NO|"") exit 0 ;;
  Y|YES) break ;;
 esac
done
echo "Please avoid powering off the switch during programming."
echo "After JTAG programming is complete, please power cycle the switch!"
echo ""
echo "4B ff" > /proc/system/fpga
echo "48 ff" > /proc/system/fpga
echo 1 > /proc/system/intr_ctl
/fabos/share/jtagpgm -f /fabos/share/fpga_v88-csum05b2_cpld_v03.xsvf
