summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Nikolaus Schaller <hns@goldelico.com>2011-12-22 20:58:49 +0100
committerH. Nikolaus Schaller <hns@goldelico.com>2011-12-22 20:58:49 +0100
commit5255625dfd859f9caadd292f582f2b7018d8d9f4 (patch)
tree4a51a60d697bdd8da2fd54a2df83f15857766167
parent0e8fe219fde0a31420afb7a6b5e4156572e1e523 (diff)
downloadbootable_bootloader_goldelico_gta04-5255625dfd859f9caadd292f582f2b7018d8d9f4.zip
bootable_bootloader_goldelico_gta04-5255625dfd859f9caadd292f582f2b7018d8d9f4.tar.gz
bootable_bootloader_goldelico_gta04-5255625dfd859f9caadd292f582f2b7018d8d9f4.tar.bz2
auto-wakeup GPS chip
-rw-r--r--board/goldelico/gta04/gps.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/board/goldelico/gta04/gps.c b/board/goldelico/gta04/gps.c
index e6c23e5..7f74dc8 100644
--- a/board/goldelico/gta04/gps.c
+++ b/board/goldelico/gta04/gps.c
@@ -87,6 +87,9 @@ void gps_off(void)
}
static int lastant=-1;
+static long timer;
+
+#define TIMEOUT 2 // in seconds
void gps_echo(void)
{
@@ -106,12 +109,28 @@ void gps_echo(void)
lastant=ant;
}
if(NS16550_tstc((NS16550_t)CONFIG_SYS_NS16550_COM2))
+ {
putc(NS16550_getc((NS16550_t)CONFIG_SYS_NS16550_COM2)); // from GPS to console
- // fixme: until we press ctl-C
+ timer=0; // data received
+ }
if(tstc())
- break; // NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM2, getc());
+ {
+ int c=getc();
+ if(c == 0x03) // ctrl-C
+ break;
+ // NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM2, c);
+ break;
+ }
+ if(timer++ > 2*10000)
+ { // timeout - try to wakeup/reset the chip
+ printf("no data: on-off impulse\n");
+ omap_set_gpio_dataout(GPIO_GPS_ON, 1);
+ udelay(5000);
+ omap_set_gpio_dataout(GPIO_GPS_ON, 1);
+ timer=0;
+ }
+ udelay(100); // 10 kHz @ 9 kbit/s
}
- getc();
printf("\n");
}