forked from j-hoppe/QUniBone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautostart.sh.example
More file actions
96 lines (84 loc) · 2.56 KB
/
Copy pathautostart.sh.example
File metadata and controls
96 lines (84 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
# Actions to start in "screen" session after boot.
# set -x
GPIO_ROOT=/sys/class/gpio
####################################################################
# get_switches()
# read the 4 UniBone/QBone user switches.
# Switch vlaues: 0 = "up" = "OFF", 1 = "down" = "ON".
# sw0 = bank1, pin 4 = gpio36
# sw1 = bank1, pin 5 = gpio37
# sw2 = bann1, pin 6 = gpio38
# sw3 = bann1, pin 7 = gpio39
function get_switches() {
# set up GPIOs every time
# enable gpios
echo 36 >$GPIO_ROOT/export 2>/dev/null
echo 37 >$GPIO_ROOT/export 2>/dev/null
echo 38 >$GPIO_ROOT/export 2>/dev/null
echo 39 >$GPIO_ROOT/export 2>/dev/null
# set as inputs
echo in >$GPIO_ROOT/gpio36/direction
echo in >$GPIO_ROOT/gpio37/direction
echo in >$GPIO_ROOT/gpio38/direction
echo in >$GPIO_ROOT/gpio39/direction
# read out
sw0=`cat $GPIO_ROOT/gpio36/value`
sw1=`cat $GPIO_ROOT/gpio37/value`
sw2=`cat $GPIO_ROOT/gpio38/value`
sw3=`cat $GPIO_ROOT/gpio39/value`
# return final value
switches_val=$(expr $sw0 + 2 \* $sw1 + 4 \* $sw2 + 8 \* $sw3)
}
####################################################################
# get_config() {
# Set up "config_info" and "config_cmd" for config "n"
# Called applications ("demo") should echo "n" onto the LEDs on start.
# Adapt to your own needs!
function get_config() {
# param $1: selection number from switches
n=$1
case $n in
1)
config_info="Just memory"
config_cmd="./memory.sh --leds $n"
;;
2)
config_info="XXDP on RL1"
config_cmd="./xxdp2.5_dl1.sh --leds $n"
;;
3)
config_info="RT11 5.5 single on RL1"
config_cmd="./rt11v5.5sj_dl1_34.sh --leds $n"
;;
4)
config_info="11/34: RT11 5.5 FB on DU0:"
config_cmd="./rt11v5.5fb_du0_34.sh --leds $n"
;;
5)
config_info="11/34: RSX11M4.8 on DU0:"
config_cmd="./rsx11m4.8_du0+rl_34.sh --leds $n"
;;
6)
config_info="11/34: Unix V6 on RK05"
config_cmd="./unixv6_dk0_34.sh --leds $n"
;;
*)
config_info=
config_cmd=
;;
esac
}
####################################################################
# main()
# read decimal number 0..15 into "switches_val"
get_switches
# get info and command call for selected application
get_config $switches_val
if [ -z "$config_cmd" ]
then
echo "Switch value $switches_val does not select an application!"
else
echo "Switch value $switches_val selects \"$config_info\"."
$config_cmd
fi