Zhongfu Luo | 0781bec | 2020-04-03 15:02:33 +0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | EXEC_BASEDIR=$(dirname $(readlink -f $0)) |
| 4 | |
| 5 | # |
| 6 | # Settings |
| 7 | # |
| 8 | VERSION=0.1 |
| 9 | |
| 10 | usage() { |
| 11 | cat << EOF |
| 12 | Usage: $(basename $0) --help |
| 13 | $(basename $0) --version |
| 14 | $(basename $0) --audio-id audio_id_value \\ |
Zhongfu Luo | 0385e12 | 2024-04-04 16:02:44 +0800 | [diff] [blame] | 15 | --soc [axg | txhd | g12a | g12b | sm1 | tl1 | tm2 | a1 | c1 |c2 | t5 | t5d | t5w | |
Zhongfu Luo | 73c427f | 2024-08-09 11:01:46 +0800 | [diff] [blame] | 16 | sc2 | t7 | s4 | t3 | s4d | p1 | a5 | c3| s5 | t5m | a4 | t3x | txhd2 | s1a | s7 | s7d | s6 | t6d] \\ |
Zhongfu Luo | 0781bec | 2020-04-03 15:02:33 +0800 | [diff] [blame] | 17 | -o audio_id.efuse |
| 18 | EOF |
| 19 | exit 1 |
| 20 | } |
| 21 | |
| 22 | function generate_audio_id_pattern() { |
| 23 | local argv=("$@") |
| 24 | local i=0 |
| 25 | # Parse args |
| 26 | i=0 |
| 27 | while [ $i -lt $# ]; do |
| 28 | arg="${argv[$i]}" |
| 29 | #echo "i=$i argv[$i]=${argv[$i]}" |
| 30 | i=$((i + 1)) |
| 31 | case "$arg" in |
| 32 | --soc) |
| 33 | soc="${argv[$i]}" ;; |
| 34 | --audio-id) |
| 35 | audio_id_value="${argv[$i]}" ;; |
| 36 | -o) |
| 37 | output="${argv[$i]}" ;; |
| 38 | *) |
| 39 | echo "Unknown option $arg"; exit 1 |
| 40 | ;; |
| 41 | esac |
| 42 | i=$((i + 1)) |
| 43 | done |
| 44 | |
| 45 | if [ -z $audio_id_value ]; then |
| 46 | echo Error: invalid audio_id_value |
| 47 | exit 1 |
| 48 | fi |
| 49 | |
| 50 | if [ -z $output ]; then |
| 51 | echo Error: invalid output |
| 52 | exit 1 |
| 53 | fi |
| 54 | |
| 55 | if [ ${soc} == "s4d" ]; then |
| 56 | soc=s4 |
| 57 | fi |
| 58 | |
Zhongfu Luo | c7f866f | 2022-06-08 17:03:13 +0800 | [diff] [blame] | 59 | if [ ${soc} == "sc2" ] || [ ${soc} == "t7" ] || [ ${soc} == "s4" ] || [ ${soc} == "t3" ] \ |
Zhongfu Luo | 2c43751 | 2023-03-24 10:31:04 +0800 | [diff] [blame] | 60 | || [ ${soc} == "p1" ] || [ ${soc} == "a5" ] || [ ${soc} == "c3" ] || [ ${soc} == "s5" ] \ |
Zhongfu Luo | 9bd84d8 | 2024-01-11 15:37:03 +0800 | [diff] [blame] | 61 | || [ ${soc} == "t5m" ] || [ ${soc} == "a4" ] || [ ${soc} == "t3x" ] || [ ${soc} == "s1a" ] \ |
Zhongfu Luo | 73c427f | 2024-08-09 11:01:46 +0800 | [diff] [blame] | 62 | || [ ${soc} == "s7" ] || [ ${soc} == "s7d" ] || [ ${soc} == "s6" ] || [ ${soc} == "t6d" ]; then |
Zhongfu Luo | 0781bec | 2020-04-03 15:02:33 +0800 | [diff] [blame] | 63 | ${EXEC_BASEDIR}/${soc}/bin/efuse-gen.sh --audio-id ${audio_id_value} -o ${output} |
| 64 | elif [ "$soc" == "axg" ] || [ "$soc" == "txhd" ] || [ "$soc" == "g12a" ] \ |
| 65 | || [ "$soc" == "sm1" ] || [ "$soc" == "g12b" ] || [ "$soc" == "tl1" ] || [ "$soc" == "tm2" ] \ |
| 66 | || [ "$soc" == "a1" ] || [ "$soc" == "c1" ] || [ "$soc" == "c2" ] \ |
Zhongfu Luo | 566f47b | 2023-06-02 10:54:49 +0800 | [diff] [blame] | 67 | || [ "$soc" == "t5" ] || [ "$soc" == "t5d" ] || [ "$soc" == "t5w" ] || [ "$soc" == "txhd2" ]; then |
Zhongfu Luo | 0781bec | 2020-04-03 15:02:33 +0800 | [diff] [blame] | 68 | ${EXEC_BASEDIR}/stool/efuse.sh --audio-id ${audio_id_value} --soc ${soc} -o ${output} |
| 69 | else |
| 70 | echo Error: invalid soc [$soc] |
| 71 | exit 1 |
| 72 | fi |
| 73 | } |
| 74 | |
| 75 | parse_main() { |
| 76 | case "$@" in |
| 77 | --help) |
| 78 | usage |
| 79 | ;; |
| 80 | --version) |
| 81 | echo "$(basename $0) version $VERSION" |
| 82 | ;; |
| 83 | *--audio-id*) |
| 84 | generate_audio_id_pattern "$@" |
| 85 | ;; |
| 86 | *) |
| 87 | usage "$@" |
| 88 | ;; |
| 89 | esac |
| 90 | } |
| 91 | |
| 92 | parse_main "$@" |