-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathrc.local
executable file
·56 lines (45 loc) · 1.32 KB
/
rc.local
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
#!/bin/sh
FILE=$(echo /sys/devices/bone_capemgr.*/slots)
PATH="${PATH}:."
cd $(dirname $(readlink -f $0))
echo BB-SPI0-01 > $FILE
echo BB-SPI1-01 > $FILE
echo BB-I2C1-MUX > $FILE
# gpio 49 = PWR_EN
echo 49 > /sys/class/gpio/export
# P8.39 = gpio2_12 = DC/DC reset
echo 76 > /sys/class/gpio/export
echo high > /sys/class/gpio/gpio76/direction
# gpio2_6 = 70 = red LED
echo 70 > /sys/class/gpio/export
# gpio2_7 = 71 = green LED
echo 71 > /sys/class/gpio/export
# P8.7 = gpio2_2 = CONF_DONE
echo 66 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio66/direction
# P8.8 = gpio2_3 = nCONFIG
echo 67 > /sys/class/gpio/export
echo high > /sys/class/gpio/gpio67/direction
# P8.9 = gpio2_5 = nSTATUS
echo 69 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio69/direction
# gpio1_27 = clock_enable
echo 59 > /sys/class/gpio/export
echo high > /sys/class/gpio/gpio59/direction
# Turn ON red LED, turn ON green LED
echo low > /sys/class/gpio/gpio70/direction
echo low > /sys/class/gpio/gpio71/direction
chmod a+rw /sys/class/gpio/*/direction
chmod a+rw /sys/class/gpio/*/value
# Enable IO-board power
io-pwr init
# Program FPGA
program-fpga spimux.rbf
knc-led 0 1 0
lcd-message "Starting..."
ip=$(ip -4 addr show eth0 | grep inet | awk '{print $2}' | cut -d/ -f1)
if [ "$ip" != "" ]; then
lcd-message $ip
else
lcd-message Disconnected
fi