summaryrefslogtreecommitdiff
path: root/src/product
diff options
context:
space:
mode:
authorBdale Garbee <bdale@gag.com>2013-05-16 00:36:23 -0600
committerBdale Garbee <bdale@gag.com>2013-05-16 00:36:23 -0600
commit02d111b1b53ef01fc6e9ab6c4bc60b8af1be0067 (patch)
tree8356f4a019969ee99a45e264c87d38555cf316cc /src/product
parent7a2e1f05adad990a6b161865267abf07ffec7a7e (diff)
parent7699a55aed3a9a7daeb4c6a5a9a280f43edf455f (diff)
Merge branch 'branch-1.2' into debian
Diffstat (limited to 'src/product')
-rw-r--r--src/product/Makefile.telebt97
-rw-r--r--src/product/ao_flash_pins.h40
-rw-r--r--src/product/ao_flash_task.c137
-rw-r--r--src/product/ao_flash_task.h24
-rw-r--r--src/product/ao_telebt.c61
-rw-r--r--src/product/ao_teledongle.c2
-rw-r--r--src/product/ao_telelaunch.c2
-rw-r--r--src/product/ao_telemetrum.c2
-rw-r--r--src/product/ao_telemini.c2
-rw-r--r--src/product/ao_telenano.c2
-rw-r--r--src/product/ao_telepyro.c2
-rw-r--r--src/product/ao_telescience.c8
-rw-r--r--src/product/ao_teleterra.c2
-rw-r--r--src/product/ao_teleterra_0_2.c2
-rw-r--r--src/product/ao_test.c2
-rw-r--r--src/product/ao_tidongle.c3
16 files changed, 230 insertions, 158 deletions
diff --git a/src/product/Makefile.telebt b/src/product/Makefile.telebt
deleted file mode 100644
index fd52cec4..00000000
--- a/src/product/Makefile.telebt
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# TeleBT build file
-#
-# Define TELEBT_VER, TELEBT_DEF, TELEBT_INC and TELEBT_SRC
-# and include this file
-
-vpath %.c ..:../core:../cc1111:../drivers:../product
-vpath %.h ..:../core:../cc1111:../drivers:../product
-vpath ao-make-product.5c ../util
-
-ifndef VERSION
-include ../Version
-endif
-
-INC = \
- ao.h \
- ao_pins.h \
- ao_arch.h \
- ao_arch_funcs.h \
- cc1111.h \
- ao_product.h \
- $(TELEBT_INC)
-
-CORE_SRC = \
- ao_cmd.c \
- ao_config.c \
- ao_gps_print.c \
- ao_monitor.c \
- ao_mutex.c \
- ao_panic.c \
- ao_state.c \
- ao_stdio.c \
- ao_task.c \
- ao_freq.c
-
-CC1111_SRC = \
- ao_dbg.c \
- ao_dma.c \
- ao_led.c \
- ao_packet.c \
- ao_packet_master.c \
- ao_radio.c \
- ao_romconfig.c \
- ao_serial.c \
- ao_string.c \
- ao_timer.c \
- ao_usb.c \
- _bp.c
-
-DRIVER_SRC = \
- ao_btm.c
-
-PRODUCT_SRC = \
- ao_telebt.c
-
-SRC = \
- $(CORE_SRC) \
- $(CC1111_SRC) \
- $(DRIVER_SRC) \
- $(PRODUCT_SRC) \
- $(TELEBT_SRC)
-
-PROGNAME = telebt-v$(TELEBT_VER)
-PROG = $(PROGNAME)-$(VERSION).ihx
-PRODUCT=TeleBT-v$(TELEBT_VER)
-PRODUCT_DEF=-DTELEBT_V_$(TELEBT_DEF)
-IDPRODUCT=0x000e
-
-include ../cc1111/Makefile.cc1111
-
-NICKLE=nickle
-CHECK_STACK=sh ../util/check-stack
-
-V=0
-# The user has explicitly enabled quiet compilation.
-ifeq ($(V),0)
-quiet = @printf " $1 $2 $@\n"; $($1)
-endif
-# Otherwise, print the full command line.
-quiet ?= $($1)
-
-all: $(PROG)
-
-$(PROG): $(REL) Makefile
- $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) ..
- $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@
-
-ao_product.h: ao-make-product.5c ../Version
- $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
-
-distclean: clean
-
-clean: clean-cc1111
-
-install:
-
-uninstall:
diff --git a/src/product/ao_flash_pins.h b/src/product/ao_flash_pins.h
new file mode 100644
index 00000000..b774df6d
--- /dev/null
+++ b/src/product/ao_flash_pins.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2013 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; version 2 of the License.
+ *
+ * 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.
+ */
+
+#ifndef _AO_FLASH_PINS_H_
+#define _AO_FLASH_PINS_H_
+
+/* Common definitions for the USB flash loader */
+
+#define HAS_TASK_QUEUE 0
+
+#define HAS_USB 1
+#define USE_USB_STDIO 0
+#define HAS_BEEP 0
+#define HAS_TASK 0
+#define HAS_ECHO 0
+#define HAS_TICK 0
+
+#define PACKET_HAS_SLAVE 0
+
+#define HAS_TASK_INFO 0
+#define HAS_VERSION 0
+
+#define AO_BOOT_CHAIN 1
+#define AO_BOOT_PIN 1
+
+#endif /* _AO_FLASH_PINS_H_ */
diff --git a/src/product/ao_flash_task.c b/src/product/ao_flash_task.c
new file mode 100644
index 00000000..fdc4d0aa
--- /dev/null
+++ b/src/product/ao_flash_task.c
@@ -0,0 +1,137 @@
+/*
+ * Copyright © 2013 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; version 2 of the License.
+ *
+ * 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.
+ */
+
+#include "ao.h"
+#include <ao_exti.h>
+#include <ao_boot.h>
+#include <ao_flash.h>
+#include <ao_flash_task.h>
+
+void
+ao_panic(uint8_t reason)
+{
+}
+
+void
+ao_put_string(__code char *s)
+{
+ char c;
+ while ((c = *s++)) {
+ if (c == '\n')
+ ao_usb_putchar('\r');
+ ao_usb_putchar(c);
+ }
+}
+
+static void
+ao_application(void)
+{
+ ao_boot_reboot(AO_BOOT_APPLICATION_BASE);
+}
+
+static uint32_t
+ao_get_hex32(void)
+{
+ int8_t n;
+ uint32_t v = 0;
+
+ for (;;) {
+ n = ao_usb_getchar();
+ if (n != ' ')
+ break;
+ }
+ for(;;) {
+ if ('0' <= n && n <= '9')
+ n = n - '0';
+ else if ('a' <= n && n <= 'f')
+ n = n - ('a' - 10);
+ else if ('A' <= n && n <= 'F')
+ n = n - ('A' - 10);
+ else
+ break;
+ v = (v << 4) | n;
+ n = ao_usb_getchar();
+ }
+ return v;
+}
+
+static void
+ao_block_erase(void)
+{
+ uint32_t addr = ao_get_hex32();
+ uint32_t *p = (uint32_t *) addr;
+
+ ao_flash_erase_page(p);
+}
+
+static void
+ao_block_write(void)
+{
+ uint32_t addr = ao_get_hex32();
+ uint32_t *p = (uint32_t *) addr;
+ union {
+ uint8_t data8[256];
+ uint32_t data32[64];
+ } u;
+ uint16_t i;
+
+ if (addr < (uint32_t) AO_BOOT_APPLICATION_BASE) {
+ ao_put_string("Invalid address\n");
+ return;
+ }
+ for (i = 0; i < 256; i++)
+ u.data8[i] = ao_usb_getchar();
+ ao_flash_page(p, u.data32);
+}
+
+static void
+ao_block_read(void)
+{
+ uint32_t addr = ao_get_hex32();
+ uint8_t *p = (uint8_t *) addr;
+ uint16_t i;
+ uint8_t c;
+
+ for (i = 0; i < 256; i++) {
+ c = *p++;
+ ao_usb_putchar(c);
+ }
+}
+
+static void
+ao_show_version(void)
+{
+ ao_put_string("altos-loader");
+ ao_put_string("\nmanufacturer "); ao_put_string(ao_manufacturer);
+ ao_put_string("\nproduct "); ao_put_string(ao_product);
+ ao_put_string("\nsoftware-version "); ao_put_string(ao_version);
+ ao_put_string("\n");
+}
+
+void
+ao_flash_task(void) {
+ for (;;) {
+ ao_usb_flush();
+ switch (ao_usb_getchar()) {
+ case 'v': ao_show_version(); break;
+ case 'a': ao_application(); break;
+ case 'X': ao_block_erase(); break;
+ case 'W': ao_block_write(); break;
+ case 'R': ao_block_read(); break;
+ }
+ }
+}
diff --git a/src/product/ao_flash_task.h b/src/product/ao_flash_task.h
new file mode 100644
index 00000000..0a2fbb35
--- /dev/null
+++ b/src/product/ao_flash_task.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright © 2013 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; version 2 of the License.
+ *
+ * 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.
+ */
+
+#ifndef _AO_FLASH_TASK_H_
+#define _AO_FLASH_TASK_H_
+
+void
+ao_flash_task(void);
+
+#endif /* _AO_FLASH_TASK_H_ */
diff --git a/src/product/ao_telebt.c b/src/product/ao_telebt.c
deleted file mode 100644
index 46c63418..00000000
--- a/src/product/ao_telebt.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright © 2011 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; version 2 of the License.
- *
- * 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.
- */
-
-#include "ao.h"
-
-#if HAS_LOG
-__code uint8_t ao_log_format = AO_LOG_FORMAT_NONE; /* until we actually log stuff */
-#endif
-
-void
-main(void)
-{
- ao_clock_init();
-
- /* Turn on the LED until the system is stable */
- ao_led_init(LEDS_AVAILABLE);
- ao_led_on(AO_LED_RED);
- ao_timer_init();
-#if HAS_BEEP
- ao_beep_init();
-#endif
- ao_cmd_init();
-#if HAS_EEPROM
- ao_spi_init();
- ao_storage_init();
-#endif
- ao_usb_init();
- ao_monitor_init();
-#if HAS_LOG
- ao_report_init();
-#endif
- ao_radio_init();
- ao_packet_master_init();
- ao_btm_init();
-#if HAS_LOG
- ao_log_single_init();
-#endif
-#if HAS_DBG
- ao_dbg_init();
-#endif
-#if HAS_AES
- ao_aes_init();
- ao_radio_cmac_init();
-#endif
- ao_config_init();
- ao_start_scheduler();
-}
diff --git a/src/product/ao_teledongle.c b/src/product/ao_teledongle.c
index 25ebe73e..8bfd8b84 100644
--- a/src/product/ao_teledongle.c
+++ b/src/product/ao_teledongle.c
@@ -26,6 +26,8 @@ main(void)
/* Turn on the LED until the system is stable */
ao_led_init(LEDS_AVAILABLE);
ao_led_on(AO_LED_RED);
+ ao_task_init();
+
ao_timer_init();
ao_cmd_init();
ao_usb_init();
diff --git a/src/product/ao_telelaunch.c b/src/product/ao_telelaunch.c
index b6e4bfc1..dde66090 100644
--- a/src/product/ao_telelaunch.c
+++ b/src/product/ao_telelaunch.c
@@ -27,6 +27,8 @@ main(void)
ao_led_init(LEDS_AVAILABLE);
ao_led_on(AO_LED_RED);
+ ao_task_init();
+
ao_timer_init();
ao_adc_init();
ao_beep_init();
diff --git a/src/product/ao_telemetrum.c b/src/product/ao_telemetrum.c
index ea77f5af..221498d6 100644
--- a/src/product/ao_telemetrum.c
+++ b/src/product/ao_telemetrum.c
@@ -42,6 +42,8 @@ main(void)
while (P1_3 == 0)
;
}
+ ao_task_init();
+
ao_timer_init();
ao_adc_init();
ao_beep_init();
diff --git a/src/product/ao_telemini.c b/src/product/ao_telemini.c
index 21551ee9..a0d8e18a 100644
--- a/src/product/ao_telemini.c
+++ b/src/product/ao_telemini.c
@@ -46,6 +46,8 @@ main(void)
;
}
+ ao_task_init();
+
ao_timer_init();
ao_adc_init();
ao_cmd_init();
diff --git a/src/product/ao_telenano.c b/src/product/ao_telenano.c
index d91983d0..77750efd 100644
--- a/src/product/ao_telenano.c
+++ b/src/product/ao_telenano.c
@@ -28,6 +28,8 @@ main(void)
ao_led_init(LEDS_AVAILABLE);
ao_led_on(AO_LED_RED);
+ ao_task_init();
+
ao_timer_init();
ao_adc_init();
ao_cmd_init();
diff --git a/src/product/ao_telepyro.c b/src/product/ao_telepyro.c
index 79454fb7..6f09be64 100644
--- a/src/product/ao_telepyro.c
+++ b/src/product/ao_telepyro.c
@@ -25,6 +25,8 @@ main(void)
PORTE |= (1 << 6);
DDRE |= (1 << 6);
+ ao_task_init();
+
ao_avr_stdio_init();
ao_timer_init();
ao_cmd_init();
diff --git a/src/product/ao_telescience.c b/src/product/ao_telescience.c
index 45b6d40e..2888c266 100644
--- a/src/product/ao_telescience.c
+++ b/src/product/ao_telescience.c
@@ -16,6 +16,9 @@
*/
#include "ao.h"
+#if HAS_ICP3_COUNT
+#include "ao_pwmin.h"
+#endif
int
main(void)
@@ -25,6 +28,8 @@ main(void)
PORTE |= (1 << 6);
DDRE |= (1 << 6);
+ ao_task_init();
+
ao_avr_stdio_init();
ao_timer_init();
ao_cmd_init();
@@ -34,6 +39,9 @@ main(void)
ao_usb_init();
ao_adc_init();
ao_log_single_init();
+#if HAS_ICP3_COUNT
+ ao_pwmin_init();
+#endif
ao_start_scheduler();
return 0;
}
diff --git a/src/product/ao_teleterra.c b/src/product/ao_teleterra.c
index d696b914..e739ae0b 100644
--- a/src/product/ao_teleterra.c
+++ b/src/product/ao_teleterra.c
@@ -26,6 +26,8 @@ main(void)
/* Turn on the red LED until the system is stable */
ao_led_init(AO_LED_RED|AO_LED_GREEN);
ao_led_on(AO_LED_RED);
+ ao_task_init();
+
ao_timer_init();
ao_beep_init();
ao_cmd_init();
diff --git a/src/product/ao_teleterra_0_2.c b/src/product/ao_teleterra_0_2.c
index 68f02596..4f7530f7 100644
--- a/src/product/ao_teleterra_0_2.c
+++ b/src/product/ao_teleterra_0_2.c
@@ -23,6 +23,8 @@ main(void)
{
ao_clock_init();
+ ao_task_init();
+
ao_timer_init();
ao_beep_init();
ao_cmd_init();
diff --git a/src/product/ao_test.c b/src/product/ao_test.c
index 14c2eb75..273a73b5 100644
--- a/src/product/ao_test.c
+++ b/src/product/ao_test.c
@@ -102,6 +102,8 @@ main(void)
{
ao_clock_init();
+ ao_task_init();
+
// ao_add_task(&blink_0_task, blink_0);
// ao_add_task(&blink_1_task, blink_1);
// ao_add_task(&wakeup_task, wakeup);
diff --git a/src/product/ao_tidongle.c b/src/product/ao_tidongle.c
index cba0b122..b1a96bdd 100644
--- a/src/product/ao_tidongle.c
+++ b/src/product/ao_tidongle.c
@@ -27,6 +27,9 @@ main(void)
/* Turn on the LED until the system is stable */
ao_led_init(AO_LED_RED);
ao_led_on(AO_LED_RED);
+
+ ao_task_init();
+
ao_timer_init();
ao_cmd_init();
ao_usb_init();