Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
authorBdale Garbee <bdale@gag.com>
Wed, 19 Aug 2009 00:09:38 +0000 (18:09 -0600)
committerBdale Garbee <bdale@gag.com>
Wed, 19 Aug 2009 00:09:38 +0000 (18:09 -0600)
Conflicts:
ao-tools/ao-bitbang/Makefile.am
ao-tools/ao-eeprom/Makefile.am
ao-tools/ao-load/Makefile.am
ao-tools/ao-load/ao-load.c
ao-tools/ao-rawload/Makefile.am

25 files changed:
.gitignore
ao-tools/ao-bitbang/Makefile.am
ao-tools/ao-bitbang/ao-bitbang.1 [new file with mode: 0644]
ao-tools/ao-bitbang/ao-bitbang.c
ao-tools/ao-dbg/ao-dbg-main.c
ao-tools/ao-dbg/ao-dbg-parse.c
ao-tools/ao-dbg/ao-dbg.1
ao-tools/ao-dbg/ao-dbg.h
ao-tools/ao-eeprom/Makefile.am
ao-tools/ao-eeprom/ao-eeprom.1 [new file with mode: 0644]
ao-tools/ao-eeprom/ao-eeprom.c
ao-tools/ao-load/Makefile.am
ao-tools/ao-load/ao-load.1 [new file with mode: 0644]
ao-tools/ao-load/ao-load.c
ao-tools/ao-rawload/Makefile.am
ao-tools/ao-rawload/ao-rawload.1 [new file with mode: 0644]
ao-tools/ao-rawload/ao-rawload.c
ao-tools/lib/ccdbg-io.c
ao-tools/lib/ccdbg.h
ao-tools/lib/cp-usb-async.c
ao-view/Makefile.am
ao-view/ao-view.1 [new file with mode: 0644]
ao-view/aoview.glade
ao-view/aoview.h
ao-view/aoview_main.c

index 71b0a61465d5582ccaffe1b0337e5142346567d6..b3d2d5627233bebf65cafa6fecde3c2341de37b9 100644 (file)
 *.rst
 *.sym
 .deps
+TAGS
 aclocal.m4
-ao_flight_test
+src/ao_flight_test
+src/ao_gps_test
 ao-teledongle.h
 ao-telemetrum.h
 ao-teleterra.h
 ao-tidongle.h
-aoload/aoload
-ccdump/ccdump
-ccmanual/ccmanual
-aoview/Makefile
-aoview/aoview
+ao-tools/ao-bitbang/ao-bitbang
+ao-tools/ao-dbg/ao-dbg
+ao-tools/ao-eeprom/ao-eeprom
+ao-tools/ao-load/ao-load
+ao-tools/ao-rawload/ao-rawload
+ao-view/Makefile
+ao-view/ao-view
 autom4te.cache
 config.*
 config.h
index f094c7bd9bf4942ec39d775f8501842e42241b46..f01cddd47d5e940f34d6efcbda9194cff7452838 100644 (file)
@@ -8,3 +8,5 @@ ao_bitbang_DEPENDENCIES = $(AO_BITBANG_LIBS)
 ao_bitbang_LDADD=$(AO_BITBANG_LIBS) $(LIBUSB_LIBS)
 
 ao_bitbang_SOURCES = ao-bitbang.c
+
+man_MANS=ao-bitbang.1
diff --git a/ao-tools/ao-bitbang/ao-bitbang.1 b/ao-tools/ao-bitbang/ao-bitbang.1
new file mode 100644 (file)
index 0000000..44eea1e
--- /dev/null
@@ -0,0 +1,196 @@
+.\"
+.\" Copyright © 2009 Keith Packard <keithp@keithp.com>
+.\"
+.\" This program is free software; you can redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as published by
+.\" the Free Software Foundation; either version 2 of the License, or
+.\" (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful, but
+.\" WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+.\" General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License along
+.\" with this program; if not, write to the Free Software Foundation, Inc.,
+.\" 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+.\"
+.\"
+.TH AO-BITBANG 1 "ao-bitbang" ""
+.SH NAME
+ao-bitbang \- Low-level cc1111 interface diagnostic tool
+.SH SYNOPSIS
+.B "ao-bitbang"
+.SH DESCRIPTION
+.I ao-bitbang
+connects through a CP2103 usb-to-serial converter and uses the GPIO
+pins to communicate with the debug port on a cc1111 device. It
+provides raw access to the debug pins to help debug the lowest level
+communication path.
+.SH USAGE
+.I ao-bitbang
+reads a sequence of bit manipulations from stdin, sends them to the
+device and reports status on stdout.
+.P
+Each line on stdin should contain a single letter command for each of
+the three debug lines on the cc1111 -- clock, data and reset. Each bit
+can be in one of three states -- on (C, D or R), off (.) or tri-state
+(-) for input. Empty lines, or lines starting with '#' are
+ignored. Anything beyond the last bit in a line is also ignored. The
+bits must be listed in the correct order, and the 'on' values must
+match the desired bit.
+.SH EXAMPLE
+.IP "Reset the target device"
+# reset
+.br
+C D R
+.br
+C D R
+.br
+C D R
+.br
+C D R
+.IP "Get Chip ID"
+#
+.br
+# Debug mode - drive RESET_N low for two clock cycles
+.br
+#
+.br
+C D R
+.br
+. D .
+.br
+C D .
+.br
+. D .
+.br
+C D .
+.br
+. D R
+.br
+
+.br
+#
+.br
+# GET_CHIP_ID
+.br
+
+.br
+C . R  0
+.br
+. . R
+.br
+C D R  1
+.br
+. D R
+.br
+C D R  1
+.br
+. D R
+.br
+C . R  0
+.br
+. . R
+.br
+
+.br
+C D R  1
+.br
+. D R
+.br
+C . R  0
+.br
+. . R
+.br
+C . R  0
+.br
+. . R
+.br
+C . R  0
+.br
+. . R
+.br
+
+.br
+#
+.br
+# start reading again
+.br
+
+.br
+C D R
+.br
+. - R
+.br
+C - R
+.br
+. - R
+.br
+C - R
+.br
+. - R
+.br
+C - R
+.br
+. - R
+.br
+
+.br
+C - R
+.br
+. - R
+.br
+C - R
+.br
+. - R
+.br
+C - R
+.br
+. - R
+.br
+C - R
+.br
+. - R
+.br
+
+.br
+C - R
+.br
+. - R
+.br
+C - R
+.br
+. - R
+.br
+C - R
+.br
+. - R
+.br
+C - R
+.br
+. - R
+.br
+
+.br
+C - R
+.br
+. - R
+.br
+C - R
+.br
+. - R
+.br
+C - R
+.br
+. - R
+.br
+C - R
+.br
+. - R
+.br
+
+.br
+C D R
+.SH AUTHOR
+Keith Packard
index 7090c9a364dbca0f35bf7f5370537464cefb5839..e8dff6bf784f10e0318246f5c81812177e505b86 100644 (file)
@@ -23,7 +23,7 @@ main (int argc, char **argv)
 {
        struct ccdbg    *dbg;
 
-       dbg = ccdbg_open();
+       dbg = ccdbg_open("BITBANG");
        if (!dbg)
                exit (1);
 
index 72249a6b0855402d65f5093eb925a893dc2ec239..f1e2c11199122a5ca4b1ca5b19a5c59fb7f839b7 100644 (file)
@@ -24,6 +24,7 @@
 #include <signal.h>
 #include <stdarg.h>
 #include <poll.h>
+#include <getopt.h>
 
 static int s51_port = 0;
 static char *cpu = "8051";
@@ -32,6 +33,7 @@ char *s51_prompt = "> ";
 struct ccdbg *s51_dbg;
 int s51_interrupted = 0;
 int s51_monitor = 0;
+char *s51_tty = NULL;
 
 static FILE *s51_input;
 static FILE *s51_output;
@@ -48,6 +50,11 @@ void s51_sigint()
        s51_interrupted = 1;
 }
 
+static const struct option options[] = {
+       { .name = "tty", .has_arg = 1, .val = 'T' },
+       { 0, 0, 0, 0 },
+};
+
 int
 main(int argc, char **argv)
 {
@@ -55,7 +62,7 @@ main(int argc, char **argv)
        char *endptr;
        struct sigvec vec, ovec;
 
-       while ((opt = getopt(argc, argv, "PVvHhmt:X:c:r:Z:s:S:p:")) != -1) {
+       while ((opt = getopt_long(argc, argv, "PVvHhmt:X:c:r:Z:s:S:p:T:", options, NULL)) != -1) {
                switch (opt) {
                case 't':
                        cpu = optarg;
@@ -104,6 +111,9 @@ main(int argc, char **argv)
                case 'm':
                        s51_monitor = 1;
                        break;
+               case 'T':
+                       s51_tty = optarg;
+                       break;
                }
        }
        if (s51_port) {
index 5db6c01c1e9dc2bbc3bb7fe3649537c52df63dfc..825d0e9c74972d72bf809ed69c0d42e0624af89f 100644 (file)
@@ -195,11 +195,9 @@ command_read (void)
        enum command_result result;
        struct command_function *func;
 
-       s51_dbg = ccdbg_open ();
-       if (!s51_dbg) {
-               perror("ccdbg_open");
+       s51_dbg = ccdbg_open (s51_tty);
+       if (!s51_dbg)
                exit(1);
-       }
        ccdbg_debug_mode(s51_dbg);
        ccdbg_halt(s51_dbg);
        s51_printf("Welcome to the non-simulated processor\n");
index f2f59a5286a6709fb96f4a66c5984cc381f3e680..a850c45407ed76b7e845c92ac2ea109bc1cee84f 100644 (file)
 .\" 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
 .\"
 .\"
-.TH S51 1 "s51" ""
+.TH AO-DBG 1 "ao-dbg" ""
 .SH NAME
-s51 \- hex debugger for cc1111 processors
+ao-dbg \- hex debugger for cc1111 processors
 .SH SYNOPSIS
-.B "s51"
+.B "ao-dbg"
 [\-t \fIcpu-type\fP]
 [\-X \fIfrequency\fP]
 [\-c]
@@ -34,14 +34,16 @@ s51 \- hex debugger for cc1111 processors
 [\-H]
 [\-h]
 [\-m]
+[\-T \fItty-device\fP]
 .SH DESCRIPTION
-.I s51
-connects to a cc1111 processor through a cp1203-based USB-to-serial
-converter board, using the GPIO pins available on that chip. It provides an
-interface compatible with the 8051 emulator of the same name (s51), but
-communicating with the real chip instead of an emulation. Using a modified
-version of the SDCC debugger (sdcdb), you can control program execution
-on the target machine at source-level.
+.I ao-dbg
+connects to a cc1111 processor through either a suitable cc1111 board
+or a cp2103 usb to serial converter board, using the GPIO pins
+available on that chip. It provides an interface compatible with the
+8051 emulator from sdcc called s51, but communicating with the real
+chip instead of an emulation. Using a modified version of the SDCC
+debugger (sdcdb), you can control program execution on the target
+machine at source-level.
 
 .SH OPTIONS
 The command line options are designed to be compatible with the 8051
@@ -64,9 +66,9 @@ The emulator and sdcdb communicate through a network socket. This option
 switches the debugger from communicating through stdin/stdout to listening
 on a specific network port instead. Once a connection is made, the debugger
 continues on, using that network port for command input and output. The
-debugger uses port 9756, and attempts to connect before launching s51, so if
-s51 is listening on this port before sdcdb is started, sdcdb will end up
-talking to the existing s51 instance. That's often useful for debugging s51
+debugger uses port 9756, and attempts to connect before launching ao-dbg, so if
+ao-dbg is listening on this port before sdcdb is started, sdcdb will end up
+talking to the existing ao-dbg instance. That's often useful for debugging ao-dbg
 itself.
 .IP "\-p \fIprompt\fP"
 This sets the command prompt to the specified string.
@@ -76,14 +78,19 @@ sdcdb.
 .IP "\-h"
 This should print a usage message, but does nothing useful currently.
 .IP "\-m"
-This option is not present in the original 8051 emulator, and causes s51 to
+This option is not present in the original 8051 emulator, and causes ao-dbg to
 dump all commands and replies that are received from and sent to sdcdb.
+.IP "\-T"
+This selects which tty device the debugger uses to communicate with
+the target device. The special name 'BITBANG' directs ao-dbg to use
+the cp2103 connection, otherwise this should be a usb serial port
+connected to a suitable cc1111 debug node.
 .SH COMMANDS
-Once started, s51 connects to the cc1111 via the CP2103 using libusb2 and
-then reads and executes commands, either from stdin, or the nework
-connection to sdcdb.
+Once started, ao-dbg connects to the cc1111 and then reads and
+executes commands, either from stdin, or the nework connection to
+sdcdb.
 .PP
-Unlike the command line, s51 contains built-in help for each of these
+Unlike the command line, ao-dbg contains built-in help for each of these
 commands, via the 'help' command. Most of the commands are available in a
 long form and a single character short form. Below, the short form follows
 the long form after a comma.
@@ -155,13 +162,12 @@ the original 8051 emulator.
 While the original purpose for this program was to connect the source
 debugger with the hardware, it can also be used as a low-level hex debugger
 all on its own. In particular, all of the cc1111 peripherals can be
-manipulated directly from the s51 command line.
-.IP "Starting s51"
-If the CP2103 is plugged in, and the CC1111 is connected correctly, the
-\'s51\' command itself should connect to the device without trouble.
-Note that the CP2103 must have the GPIO pins configured correctly as well.
+manipulated directly from the ao-dbg command line.
+.IP "Starting ao-dbg"
+First ensure that the target cc1111 device and intermediate cp2103 or
+cc111 board are all hooked up correctly.
 .IP
-$ s51
+$ ao-dbg
 .br
 Welcome to the non-simulated processor
 .br
index f4dcce66d259b6ea20159daaddea9fa1acb879eb..c1789d10e30cfb930f380c7089763b05b51fecce 100644 (file)
@@ -22,6 +22,7 @@ extern char *s51_prompt;
 extern struct ccdbg *s51_dbg;
 extern int s51_interrupted;
 extern int s51_monitor;
+extern char *s51_tty;
 
 enum command_result {
        command_success, command_debug, command_syntax, command_interrupt, command_error,
index 587acee7898e025139773cc12e831e2f05074ce4..efeed97689d40c832d7b4c4a249c4f973a023b7d 100644 (file)
@@ -8,3 +8,5 @@ ao_eeprom_DEPENDENCIES = $(AO_EEPROM_LIBS)
 ao_eeprom_LDADD=$(AO_EEPROM_LIBS) $(LIBUSB_LIBS)
 
 ao_eeprom_SOURCES = ao-eeprom.c
+
+man_MANS = ao-eeprom.1
diff --git a/ao-tools/ao-eeprom/ao-eeprom.1 b/ao-tools/ao-eeprom/ao-eeprom.1
new file mode 100644 (file)
index 0000000..8caff9d
--- /dev/null
@@ -0,0 +1,33 @@
+.\"
+.\" Copyright © 2009 Keith Packard <keithp@keithp.com>
+.\"
+.\" This program is free software; you can redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as published by
+.\" the Free Software Foundation; either version 2 of the License, or
+.\" (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful, but
+.\" WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+.\" General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License along
+.\" with this program; if not, write to the Free Software Foundation, Inc.,
+.\" 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+.\"
+.\"
+.TH AO-EEPROM 1 "ao-eeprom" ""
+.SH NAME
+ao-eeprom \- Fetch eeprom contents from TeleMetrum device
+.SH SYNOPSIS
+.B "ao-eeprom"
+[\-tty \fItty-device\fP]
+.SH DESCRIPTION
+.I ao-eeprom
+downloads the eeprom contents from a connected TeleMetrum device.
+.SH USAGE
+.I ao-eeprom
+connects to the specified target device and dumps each block of the
+eeprom to stdout in hexidecimal bytes.
+.SH AUTHOR
+Keith Packard
index 399732d9f1fea9b9b7e230ac782c52943035d440..726cc22cafd0e0c1a8becbe4ef52ab03c5e1b547 100644 (file)
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
+#include <getopt.h>
 #include "cc-usb.h"
 
 #define NUM_BLOCK      512
 
+static const struct option options[] = {
+       { .name = "tty", .has_arg = 1, .val = 'T' },
+       { 0, 0, 0, 0},
+};
+
+static void usage(char *program)
+{
+       fprintf(stderr, "usage: %s [--tty <tty-name>]\n", program);
+       exit(1);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -31,10 +44,26 @@ main (int argc, char **argv)
        uint8_t         *b;
        int             i, j;
        uint32_t        addr;
-       char            *tty;
+       char            *tty = NULL;
+       int             c;
 
-       tty = getenv("CCDBG_TTY");
+       while ((c = getopt_long(argc, argv, "T:", options, NULL)) != -1) {
+               switch (c) {
+               case 'T':
+                       tty = optarg;
+                       break;
+               default:
+                       usage(argv[0]);
+                       break;
+               }
+       }
+       if (!tty)
+               tty = getenv("ALTOS_TTY");
+       if (!tty)
+               tty="/dev/ttyACM0";
        cc = cc_usb_open(tty);
+       if (!cc)
+               exit(1);
        for (block = 0; block < NUM_BLOCK; block++) {
                cc_queue_read(cc, bytes, sizeof (bytes));
                cc_usb_printf(cc, "e %x\n", block);
index 8a8392afb6d4fd76c09bd84b2e848705c3916d2d..3c48dc27eb4a70ed1801d1c3ac125043a2f80499 100644 (file)
@@ -8,3 +8,5 @@ ao_load_DEPENDENCIES = $(AO_LOAD_LIBS)
 ao_load_LDADD=$(AO_LOAD_LIBS) $(LIBUSB_LIBS)
 
 ao_load_SOURCES = ao-load.c
+
+man_MANS = ao-load.1
diff --git a/ao-tools/ao-load/ao-load.1 b/ao-tools/ao-load/ao-load.1
new file mode 100644 (file)
index 0000000..10484f3
--- /dev/null
@@ -0,0 +1,38 @@
+.\"
+.\" Copyright © 2009 Keith Packard <keithp@keithp.com>
+.\"
+.\" This program is free software; you can redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as published by
+.\" the Free Software Foundation; either version 2 of the License, or
+.\" (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful, but
+.\" WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+.\" General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License along
+.\" with this program; if not, write to the Free Software Foundation, Inc.,
+.\" 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+.\"
+.\"
+.TH AO-LOAD 1 "ao-load" ""
+.SH NAME
+ao-load \- flash a program to a AltOS device
+.SH SYNOPSIS
+.B "ao-load"
+[\-tty \fItty-device\fP]
+\fIfile.ihx\fP
+\fIdevice serial number\fP
+.SH DESCRIPTION
+.I ao-load
+loads the specified .ihx file into the target device flash memory,
+customizing the AltOS image with the specified serial number.
+.SH USAGE
+.I ao-load
+reads the specified .ihx file into memory, locates the matching .map
+file and edits the image to customize it using the specified serial
+number. It then connects to the specified target device and writes the
+program to the target device flash memory.
+.SH AUTHOR
+Keith Packard
index 6966dd3a98bf2909f6bd294e0b26ab6163316016..642af2fed7ada02beccf08c2fe4e1fe35c9b1e3a 100644 (file)
 
 #define AO_USB_DESC_STRING             3
 
-void
-usage(char *program)
-{
-       fprintf(stderr, "usage: %s <filename.ihx> <serial>\n", program);
-       exit(1);
-}
-
 struct sym {
        unsigned        addr;
        char            *name;
@@ -96,7 +89,21 @@ rewrite(struct hex_image *image, unsigned addr, char *data, int len)
        memcpy(image->data + addr - image->address, data, len);
 }
 
+<<<<<<< HEAD:ao-tools/ao-load/ao-load.c
 static const struct option
+=======
+static const struct option options[] = {
+       { .name = "tty", .has_arg = 1, .val = 'T' },
+       { 0, 0, 0, 0},
+};
+
+static void usage(char *program)
+{
+       fprintf(stderr, "usage: %s [--tty <tty-name>] file.ihx serial-number\n", program);
+       exit(1);
+}
+
+>>>>>>> c29275b72438637d46d7a50742882d2736eb176a:ao-tools/ao-load/ao-load.c
 int
 main (int argc, char **argv)
 {
@@ -105,12 +112,12 @@ main (int argc, char **argv)
        uint16_t        pc;
        struct hex_file *hex;
        struct hex_image *image;
-       char *filename;
-       FILE *file;
-       FILE *map;
-       char *serial_string;
-       unsigned int serial;
-       char *mapname, *dot;
+       char            *filename;
+       FILE            *file;
+       FILE            *map;
+       char            *serial_string;
+       unsigned int    serial;
+       char            *mapname, *dot;
        char            *serial_ucs2;
        int             serial_ucs2_len;
        char            serial_int[2];
@@ -118,8 +125,20 @@ main (int argc, char **argv)
        int             i;
        unsigned        usb_descriptors;
        int             string_num;
-
-       filename = argv[1];
+       char            *tty = NULL;
+       int             c;
+
+       while ((c = getopt_long(argc, argv, "T:", options, NULL)) != -1) {
+               switch (c) {
+               case 'T':
+                       tty = optarg;
+                       break;
+               default:
+                       usage(argv[0]);
+                       break;
+               }
+       }
+       filename = argv[optind];
        if (filename == NULL)
                usage(argv[0]);
        mapname = strdup(filename);
@@ -128,7 +147,7 @@ main (int argc, char **argv)
                usage(argv[0]);
        strcpy(dot, ".map");
 
-       serial_string = argv[2];
+       serial_string = argv[optind + 1];
        if (serial_string == NULL)
                usage(argv[0]);
 
@@ -163,7 +182,7 @@ main (int argc, char **argv)
 
        serial = strtoul(serial_string, NULL, 0);
        if (!serial)
-               usage(argv[0]);
+(argv[0]);
 
        serial_int[0] = serial & 0xff;
        serial_int[1] = (serial >> 8) & 0xff;
@@ -204,7 +223,7 @@ main (int argc, char **argv)
        if (!rewrite(image, usb_descriptors + 2 + image->address, serial_ucs2, serial_ucs2_len))
                usage(argv[0]);
 
-       dbg = ccdbg_open();
+       dbg = ccdbg_open(tty);
        if (!dbg)
                exit (1);
 
index 24013a85694727580fd60bd374d5708ad29bfb2c..d2c55658804419875bf31d8fa1e668185c5e5055 100644 (file)
@@ -8,3 +8,5 @@ ao_rawload_DEPENDENCIES = $(AO_RAWLOAD_LIBS)
 ao_rawload_LDADD=$(AO_RAWLOAD_LIBS) $(LIBUSB_LIBS)
 
 ao_rawload_SOURCES = ao-rawload.c
+
+man_MANS=ao-rawload.1
diff --git a/ao-tools/ao-rawload/ao-rawload.1 b/ao-tools/ao-rawload/ao-rawload.1
new file mode 100644 (file)
index 0000000..e79645f
--- /dev/null
@@ -0,0 +1,36 @@
+.\"
+.\" Copyright © 2009 Keith Packard <keithp@keithp.com>
+.\"
+.\" This program is free software; you can redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as published by
+.\" the Free Software Foundation; either version 2 of the License, or
+.\" (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful, but
+.\" WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+.\" General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License along
+.\" with this program; if not, write to the Free Software Foundation, Inc.,
+.\" 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+.\"
+.\"
+.TH AO-RAWLOAD 1 "ao-rawload" ""
+.SH NAME
+ao-rawload \- flash a program to a AltOS device
+.SH SYNOPSIS
+.B "ao-rawload"
+[\-tty \fItty-device\fP]
+\fIfile.ihx\fP
+.SH DESCRIPTION
+.I ao-rawload
+loads the specified .ihx file, without modification, into the target
+device flash memory.
+.SH USAGE
+.I ao-rawload
+reads the specified .ihx file into memory. It then connects to the
+specified target device and writes the program to the target device
+flash memory.
+.SH AUTHOR
+Keith Packard
index 5f7708fd2f8c93ac4b1d8da40fefc0baaa71b2ca..1f1537b9f12d59eb49f6de87c7e96ed39e7e1e1f 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
+#include <unistd.h>
+#include <getopt.h>
 #include "ccdbg.h"
 
+static const struct option options[] = {
+       { .name = "tty", .has_arg = 1, .val = 'T' },
+       { 0, 0, 0, 0},
+};
+
+static void usage(char *program)
+{
+       fprintf(stderr, "usage: %s [--tty <tty-name>] file.ihx\n", program);
+       exit(1);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -26,10 +39,22 @@ main (int argc, char **argv)
        uint16_t        pc;
        struct hex_file *hex;
        struct hex_image *image;
-       char *filename;
-       FILE *file;
+       char            *filename;
+       FILE            *file;
+       char            *tty = NULL;
+       int             c;
 
-       filename = argv[1];
+       while ((c = getopt_long(argc, argv, "T:", options, NULL)) != -1) {
+               switch (c) {
+               case 'T':
+                       tty = optarg;
+                       break;
+               default:
+                       usage(argv[0]);
+                       break;
+               }
+       }
+       filename = argv[optind];
        if (filename == NULL) {
                fprintf(stderr, "usage: %s <filename.ihx>\n", argv[0]);
                exit(1);
@@ -50,7 +75,7 @@ main (int argc, char **argv)
        }
 
        ccdbg_hex_file_free(hex);
-       dbg = ccdbg_open();
+       dbg = ccdbg_open(tty);
        if (!dbg)
                exit (1);
 
index 9c6693cdbe0ad5a0698cdcfc8b214761b877b148..d3f8727433fa40d90a68c753f803a27cc8f95241 100644 (file)
 #include "cc-bitbang.h"
 
 struct ccdbg *
-ccdbg_open(void)
+ccdbg_open(char *tty)
 {
        struct ccdbg *dbg;
-       char *tty;
 
        dbg = calloc(sizeof (struct ccdbg), 1);
        if (!dbg) {
                perror("calloc");
                return NULL;
        }
-       tty = getenv("CCDBG_TTY");
-       if (!tty || tty[0] == '/')
-               dbg->usb = cc_usb_open(tty);
-       if (!dbg->usb) {
+       if (!tty)
+               tty = getenv("ALTOS_TTY");
+       if (!tty)
+               tty="/dev/ttyACM0";
+
+       if (!strcmp(tty, "BITBANG")) {
                dbg->bb = cc_bitbang_open();
                if (!dbg->bb) {
                        free(dbg);
                        return NULL;
                }
+       } else {
+               dbg->usb = cc_usb_open(tty);
+               if (!dbg->usb) {
+                       free(dbg);
+                       return NULL;
+               }
        }
        return dbg;
 }
index 4a2e3b9f00c9222118f93386024a206d06ab5ffd..ca5961432d8926b649c916e7182e962221d88921 100644 (file)
@@ -258,7 +258,7 @@ ccdbg_hex_image_equal(struct hex_image *a, struct hex_image *b);
 
 /* ccdbg-io.c */
 struct ccdbg *
-ccdbg_open(void);
+ccdbg_open(char *tty);
 
 void
 ccdbg_close(struct ccdbg *dbg);
index 6539394b541a95ec4c2761d75d7a9c739e253048..3e75b5079a793a73c316ba1bc3e4c3e428dee5c3 100644 (file)
@@ -60,6 +60,7 @@ cp_usb_async_open(void)
                                                     0x10c4, 0xea60);
        cp->ack = -1;
        if (!cp->handle) {
+               fprintf(stderr, "Cannot find USB device 10c4:ea60\n");
                libusb_exit(cp->ctx);
                free(cp);
                return NULL;
index e0cd068c8fbc656ab347aa0d131d207d544fe629..17661c8e09d95f31fd09394ec86307c3f157bb08 100644 (file)
@@ -29,5 +29,7 @@ BUILT_SOURCES = aoview_glade.h
 
 CLEANFILES = aoview_glade.h
 
+man_MANS=ao-view.1
+
 aoview_glade.h: aoview.glade
        sed -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/"/' $< > $@
diff --git a/ao-view/ao-view.1 b/ao-view/ao-view.1
new file mode 100644 (file)
index 0000000..99834c4
--- /dev/null
@@ -0,0 +1,50 @@
+.\"
+.\" Copyright © 2009 Keith Packard <keithp@keithp.com>
+.\"
+.\" This program is free software; you can redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as published by
+.\" the Free Software Foundation; either version 2 of the License, or
+.\" (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful, but
+.\" WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+.\" General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License along
+.\" with this program; if not, write to the Free Software Foundation, Inc.,
+.\" 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+.\"
+.\"
+.TH AO-VIEW 1 "ao-view" ""
+.SH NAME
+ao-view \- Rocket flight monitor
+.SH SYNOPSIS
+.B "ao-view"
+[\--tty \fItty-device\fP]
+.SH DESCRIPTION
+.I ao-view
+connects to a TeleDongle or TeleMetrum device through a USB serial device.
+It provides a user interface to monitor, record and review rocket flight data.
+.SH OPTIONS
+The usual Gtk+ command line options can be used, along with
+.IP "\--tty"
+This selects a target device to connect at startup time to.
+The target device may also be selected through the user interface.
+.SH USAGE
+When connected to a TeleDongle device, ao-view turns on the radio
+receiver and listens for telemetry packets. It displays the received
+telemetry data, and reports flight status via voice synthesis. All
+received telemetry information is recorded to a file.
+.P
+When connected to a TeleMetrum device, ao-view downloads the eeprom
+data and stores it in a file.
+.SH FILES
+All data log files are recorded into a user-specified directory
+(default ~/AltOS). Files are named using the current date, the serial
+number of the reporting device, the flight number recorded in the data
+and either '.telem' for telemetry data or '.eeprom' for eeprom data.
+.SH "SEE ALSO"
+ao-load(1), ao-eeprom(1)
+.SH AUTHOR
+Keith Packard
index df08b83cdb472044545b9a3647480b1c126e159f..3481a7798996367616bb7ad879014b0de0f999e2 100644 (file)
@@ -651,7 +651,6 @@ You should have received a copy of the GNU General Public License along with AoV
     <property name="type_hint">normal</property>
     <property name="skip_taskbar_hint">True</property>
     <property name="transient_for">aoview</property>
-    <property name="has_separator">False</property>
     <property name="buttons">close</property>
     <property name="text">Saving EEPROM data as</property>
     <property name="secondary_text">&lt;filename&gt;</property>
index 62d0640b9a182b42101263cea45ff3a1936729b6..e8334e5b2693388117036e8ddca79f6f206626ae 100644 (file)
@@ -308,4 +308,8 @@ aoview_flite_start(void);
 void
 aoview_flite_stop(void);
 
+/* aoview_main.c */
+
+extern char *aoview_tty;
+
 #endif /* _AOVIEW_H_ */
index 36a82e0e1212dc3da35006dc8e42708266495c51..64c1c0273a90c2c5e857af4b53d5fa07077a41db 100644 (file)
@@ -32,29 +32,29 @@ static void destroy_event(GtkWidget *widget, gpointer data)
 }
 
 extern int _Xdebug;
+char *aoview_tty = NULL;
 
 int main(int argc, char **argv)
 {
        GladeXML *xml = NULL;
        GtkWidget *mainwindow;
-       char *device = NULL;
        GtkAboutDialog *about_dialog;
 
        static struct option long_options[] = {
-               { "device", 1, 0, 'd'},
+               { "tty", 1, 0, 'T'},
                { "sync", 0, 0, 's'},
                { 0, 0, 0, 0 }
        };
        for (;;) {
                int c, temp;
 
-               c = getopt_long_only(argc, argv, "sd:", long_options, &temp);
+               c = getopt_long_only(argc, argv, "sT:", long_options, &temp);
                if (c == -1)
                        break;
 
                switch (c) {
-               case 'd':
-                       device = optarg;
+               case 'T':
+                       aoview_tty = optarg;
                        break;
                case 's':
                        _Xdebug = 1;
@@ -102,6 +102,12 @@ int main(int argc, char **argv)
 
        aoview_label_init(xml);
 
+       if (aoview_tty) {
+               if (!aoview_monitor_connect(aoview_tty)) {
+                       perror(aoview_tty);
+                       exit(1);
+               }
+       }
        aoview_voice_speak("rocket flight monitor ready\n");
 
        gtk_main();