i2c tools better naming scheme
[cr816-sim.git] / tools / bq_boot_code_read_32
blobea25fe17d3b5b3ce3924a29f6752701770a66dd2
1 #!/bin/sh
2 #read from prog flash, 32 code words (1 word = 3 bytes, 22bits), 96 smb block
4 if [ -z "${1}" ]; then
5 echo "read 32 code words from flash program space" >&2
6 echo "Usage:" >&2
7 echo " ${0} <row>" >&2
8 exit
9 fi
11 ROW_LO=$((${1} & 0xff))
12 ROW_HI=$(((${1} >> 8) & 0xff))
14 . ./i2c_config.sh
16 smb_init
17 #column argument seems to be constant
18 smb_write 5 0x0 3 ${ROW_LO} ${ROW_HI} 0
19 smb_commit
21 smb_init
22 smb_write 1 0x2
23 smb_read 100
24 TMP=$(smb_commit)
25 CNT=${TMP%% *}
26 ARGS=${TMP#* }
27 STR="`echo $ARGS | cut -d " " -f 1-$(($CNT)) `"
29 echo $STR