chiark / gitweb /
Moved from norway, now includes odyssey-train script and make install target etc.
authorian <ian>
Sat, 2 Oct 2004 02:14:22 +0000 (02:14 +0000)
committerian <ian>
Sat, 2 Oct 2004 02:14:22 +0000 (02:14 +0000)
parport/Makefile
parport/odyssey-train [new file with mode: 0755]

index 26232631fb5a78575ea432eec28e770172e291ae..d1fee23bd144cf5f27aa28ba3ee27e86c1ffbb78 100644 (file)
@@ -2,9 +2,20 @@ CFLAGS=        -Wall -Wwrite-strings -Wpointer-arith \
        -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes \
        -O2
 
-targets:       parport-ctl train-pic-prog-select siggen
+CPROGS_I=      parport-ctl train-pic-prog-select
+SCRIPTS_I=     odyssey-train
+TARGETS=       siggen $(CPROGS_I)
+
+all:           $(TARGETS)
+
+install:
+               install -m 755 -o root -g staff $(CPROGS_I) /usr/local/bin/.
+               install -m 755 -o root -g staff $(SCRIPTS_I) /usr/local/bin/.
 
 train-pic-prog-select: train-pic-prog-select.o lib.o
 siggen:                        siggen.o lib.o
 
 train-pic-prog-select.o siggen.o lib.o: lib.h
+
+clean:
+               rm -f $(TARGETS)
diff --git a/parport/odyssey-train b/parport/odyssey-train
new file mode 100755 (executable)
index 0000000..8f4fa69
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+set -e
+
+badusage () {
+       odyssey || true
+       echo >&2 'usage: odyssey-train [<picno>|all] operation [filename]'
+       echo >&2
+       exit 1
+}
+
+which=$1
+
+case "$which" in
+all)
+       train-pic-prog-select 0-55
+       whichconfig=all
+       ;;
+[0-9]|[0-9][0-9])
+       train-pic-prog-select $which
+       whichconfig=single
+       ;;
+*)
+       badusage
+       ;;
+esac
+
+shift
+echo "Selected $which"
+echo
+
+operation=$1
+
+case "$operation" in
+check|write|update|read|verify|erase|blankcheck)
+       chiptype=PIC18F458
+       ;;
+init|test)
+       chiptype=''
+       ;;
+*)
+       badusage
+       ;;
+esac
+
+export HOME=/etc/odyssey
+
+exec odyssey -f $whichconfig $chiptype "$@"