i2c tools better naming scheme
[cr816-sim.git] / tools / bq_norm_data_write_1
blob171dc1c5e36f70ac90f8cca73bd0080516fc82fd
1 #!/bin/sh
2 #writes 1 byte to ADDR of data space
4 if [ -z "${1}" ] || [ -z "${2}" ]; then
5 echo "writes 1 byte to ADDR of data space" >&2
6 echo "Usage:" >&2
7 echo " ${0} <addr> <val>" >&2
8 exit
9 fi
11 ADDR=$((${1}))
12 VAL=$((${2}))
14 LOW=`printf 0x%02x $((${ADDR} & 0xff ))`
15 HIGH=`printf 0x%02x $((${ADDR} >> 8 ))`
17 . ./i2c_config.sh
19 #i2ctransfer -y ${SMB_IFACE} w3@${SMB_ADDR} 0x40 ${LOW} ${HIGH}
20 #i2ctransfer -y ${SMB_IFACE} w3@${SMB_ADDR} 0x41 ${VAL} 0
22 smb_init
23 smb_write 3 0x40 ${LOW} ${HIGH}
24 smb_commit
26 ./bq_norm_unlock
28 smb_init
29 smb_write 3 0x41 ${VAL} 0
30 smb_commit