i2c tools better naming scheme
[cr816-sim.git] / tools / bq_boot_eeprom_flash_1
blob0dc8d2c8ea2b0afcba030367f8e5101bc4f23ed3
1 #!/bin/sh
2 #writes 1 byte to ADDR of flash region (base is 0x0 (ram))
3 #won't erase, so new value is ANDed with old one
5 if [ -z "${1}" ] || [ -z "${2}" ]; then
6 echo "writes 1 byte to ADDR of flash region (base is 0 from data space)" >&2
7 echo "Usage:" >&2
8 echo " ${0} <addr> <val>" >&2
9 exit
12 echo "will write 1 byte to data flash!!" >&2
13 echo "enter to continue, ctrl+c to quit" >&2
14 read
16 ADDR=$((${1}))
17 VAL=$((${2}))
19 LOW=`printf 0x%02x $((${ADDR} & 0xff ))`
20 HIGH=`printf 0x%02x $((${ADDR} >> 8 ))`
22 . ./i2c_config.sh
24 smb_init
25 smb_write 5 0xf 3 ${LOW} ${HIGH} ${VAL}
26 smb_commit