Programming the DevKit Silicon Labs PLL ยป pgm-pll-uboot.sh
| 1 |
#!/bin/bash
|
|---|---|
| 2 |
# Create uBoot commands to program SI5332 PLL Chip from
|
| 3 |
# a clock generator CSV output file.
|
| 4 |
#
|
| 5 |
# usage: pgm-pll-uboot.sh file.csv > uboot_script.cmd
|
| 6 |
#
|
| 7 |
|
| 8 |
# this is the standard bus for the mitysom-a5e devkit
|
| 9 |
bus=3 |
| 10 |
# this is the standard I2C address for the SI5332 PLL
|
| 11 |
dev=0x6a |
| 12 |
|
| 13 |
if [ $# -ne 1 ]; then |
| 14 |
echo "usage: $0 <register-csv>" |
| 15 |
exit 1
|
| 16 |
fi
|
| 17 |
|
| 18 |
echo "i2c dev $bus" |
| 19 |
|
| 20 |
while read -r reg; do |
| 21 |
echo "i2c mw $dev $reg" |
| 22 |
|
| 23 |
# Strip lines that aren't register values, convert "addr,data" to "addr data"
|
| 24 |
# (and strip any carriage returns), and iterate the result
|
| 25 |
done < <(sed -n 's/^\(0x..\),\(0x..\).*/\1 \2/p' "$1") |