Add some contrib scripts to show different uses of eeprog

This commit is contained in:
Antonio Ospite 2014-02-12 17:08:29 +01:00 committed by Stefano Barbato
parent 3f4886d988
commit 7c6c0d3b3c
6 changed files with 110 additions and 0 deletions

21
contrib/dump_24LC08B.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh
set -e
I2C_DEVICE=/dev/i2c-1
START_ADDRESS=0x50
PAGE_SIZE=256
NUM_PAGES=4
OUTPUT_FILE=OUTPUT_24C08B.bin
PAGES=$(seq 0 $((NUM_PAGES - 1)))
rm -rf "$OUTPUT_FILE"
for i in $PAGES;
do
ADDRESS=$(($START_ADDRESS + $i))
sudo eeprog -f -r 0:$PAGE_SIZE $I2C_DEVICE $ADDRESS >> $OUTPUT_FILE
done

21
contrib/dump_24LC16.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh
set -e
I2C_DEVICE=/dev/i2c-1
START_ADDRESS=0x50
PAGE_SIZE=256
NUM_PAGES=8
OUTPUT_FILE=OUTPUT_24C16.bin
PAGES=$(seq 0 $((NUM_PAGES - 1)))
rm -rf "$OUTPUT_FILE"
for i in $PAGES;
do
ADDRESS=$(($START_ADDRESS + $i))
sudo eeprog -f -r 0:$PAGE_SIZE $I2C_DEVICE $ADDRESS >> $OUTPUT_FILE
done

14
contrib/dump_24LC64.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
set -e
I2C_DEVICE=/dev/i2c-1
START_ADDRESS=0x50
BYTES=8192
OUTPUT_FILE=OUTPUT_24C64.bin
rm -rf "$OUTPUT_FILE"
sudo eeprog -f -16 -r 0:$BYTES $I2C_DEVICE $ADDRESS >> $OUTPUT_FILE

21
contrib/write_24LC08B.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh
set -e
I2C_DEVICE=/dev/i2c-1
START_ADDRESS=0x50
PAGE_SIZE=256
NUM_PAGES=4
INPUT_FILE=INPUT_24C08B.bin
PAGES=$(seq 0 $((NUM_PAGES - 1)))
for i in $PAGES;
do
ADDRESS=$(($START_ADDRESS + $i))
OFFSET=$(($PAGE_SIZE * $i))
dd if=$INPUT_FILE bs=1 skip=$OFFSET count=$PAGE_SIZE | \
sudo eeprog -f -w 0 $I2C_DEVICE $ADDRESS
done

21
contrib/write_24LC16.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh
set -e
I2C_DEVICE=/dev/i2c-1
START_ADDRESS=0x50
PAGE_SIZE=256
NUM_PAGES=8
INPUT_FILE=INPUT_24C16.bin
PAGES=$(seq 0 $((NUM_PAGES - 1)))
for i in $PAGES;
do
ADDRESS=$(($START_ADDRESS + $i))
OFFSET=$(($PAGE_SIZE * $i))
dd if=$INPUT_FILE bs=1 skip=$OFFSET count=$PAGE_SIZE | \
sudo eeprog -f -w 0 $I2C_DEVICE $ADDRESS
done

12
contrib/write_24LC64.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
set -e
I2C_DEVICE=/dev/i2c-1
START_ADDRESS=0x50
BYTES=8192
INPUT_FILE=INPUT_24C16.bin
cat "$INPUT_FILE" | sudo eeprog -f -16 -w 0 $I2C_DEVICE $ADDRESS