-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgpio.sh
More file actions
executable file
·28 lines (24 loc) · 996 Bytes
/
Copy pathgpio.sh
File metadata and controls
executable file
·28 lines (24 loc) · 996 Bytes
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
#!/usr/bin/env bash
set -e
rm -rf gpio
mkdir -p gpio
cargo build --release --no-default-features --features debug_xram
target/release/ecsim 2>&1 | tee gpio/gpio.log || true
grep ' (GPIO ' gpio/gpio.log |
grep ' store ' |
cut -d ' ' -f 5,9 |
sed 's/)/ =/' | sed 's/]/;/' |
sed 's/\(GPCR.*\) = 0x00;/\1 = GPIO_ALT;/' |
sed 's/\(GPCR.*\) = 0x02;/\1 = GPIO_ALT | GPIO_DOWN;/' |
sed 's/\(GPCR.*\) = 0x04;/\1 = GPIO_ALT | GPIO_UP;/' |
sed 's/\(GPCR.*\) = 0x06;/\1 = GPIO_ALT | GPIO_UP | GPIO_DOWN;/' |
sed 's/\(GPCR.*\) = 0x40;/\1 = GPIO_OUT;/' |
sed 's/\(GPCR.*\) = 0x42;/\1 = GPIO_OUT | GPIO_DOWN;/' |
sed 's/\(GPCR.*\) = 0x44;/\1 = GPIO_OUT | GPIO_UP;/' |
sed 's/\(GPCR.*\) = 0x46;/\1 = GPIO_OUT | GPIO_UP | GPIO_DOWN;/' |
sed 's/\(GPCR.*\) = 0x80;/\1 = GPIO_IN;/' |
sed 's/\(GPCR.*\) = 0x82;/\1 = GPIO_IN | GPIO_DOWN;/' |
sed 's/\(GPCR.*\) = 0x84;/\1 = GPIO_IN | GPIO_UP;/' |
sed 's/\(GPCR.*\) = 0x86;/\1 = GPIO_IN | GPIO_UP | GPIO_DOWN;/' |
tee gpio/gpio.h
echo "Results saved in gpio/gpio.h"