chiark / gitweb /
undo broken deletion
[trains.git] / parport / odyssey-train
1 #!/bin/sh
2 set -e
3
4 badusage () {
5         odyssey || true
6         echo >&2 'usage: odyssey-train [<picno>|all] operation [filename]'
7         echo >&2
8         exit 1
9 }
10
11 which=$1
12
13 tpps="train-pic-prog-select -i${TRAIN_PPWDATA_SEL_BIT-0}"
14
15 case "$which" in
16 all)
17         $tpps 0-55
18         whichconfig=all
19         echo "Selected $which"
20         ;;
21 [0-9]|[0-9][0-9])
22         $tpps $which
23         whichconfig=single
24         echo "Selected #$which"
25         ;;
26 comb-*)
27         $tpps ${which#comb-}
28         whichconfig=all
29         echo "Trying $which"
30         ;;
31 *)
32         badusage
33         ;;
34 esac
35
36 shift
37 echo
38
39 operation=$1
40
41 case "$operation" in
42 check|write|update|read|verify|erase|blankcheck)
43         chiptype=PIC18F458
44         ;;
45 init|test)
46         chiptype=''
47         ;;
48 *)
49         badusage
50         ;;
51 esac
52
53 export HOME=/etc/odyssey
54
55 exec odyssey -f $whichconfig $chiptype "$@"