43 lines
735 B
Bash
Executable File
43 lines
735 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Load puzzlefw kernel driver.
|
|
#
|
|
|
|
start() {
|
|
|
|
# Check that the FPGA is running.
|
|
# If the PuzzleFW firmware is not running on the FPGA,
|
|
# attempting to load the driver will crash the system.
|
|
read fpga_state </sys/class/fpga_manager/fpga0/state
|
|
if [ "$fpga_state" != "operating" ]; then
|
|
echo "ERROR: FPGA not operating" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Load module.
|
|
echo "Loading puzzlefw driver ..."
|
|
insmod /opt/puzzlefw/driver/puzzlefw.ko
|
|
}
|
|
|
|
stop() {
|
|
echo -n "Unloading puzzlefw driver ..."
|
|
rmmod puzzlefw
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
restart|reload)
|
|
stop
|
|
start
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
exit 1
|
|
esac
|
|
|