diff options
Diffstat (limited to 'src/lpc')
-rw-r--r-- | src/lpc/Makefile-lpc.defs | 4 | ||||
-rw-r--r-- | src/lpc/ao_adc_lpc.c | 2 | ||||
-rw-r--r-- | src/lpc/ao_arch.h | 9 | ||||
-rw-r--r-- | src/lpc/ao_boot.h | 39 | ||||
-rw-r--r-- | src/lpc/ao_boot_chain.c | 4 | ||||
-rw-r--r-- | src/lpc/ao_exti_lpc.c | 4 | ||||
-rw-r--r-- | src/lpc/ao_interrupt.c | 2 | ||||
-rw-r--r-- | src/lpc/ao_led_lpc.c | 20 | ||||
-rw-r--r-- | src/lpc/ao_serial_lpc.c | 4 | ||||
-rw-r--r-- | src/lpc/ao_usb_lpc.c | 4 |
10 files changed, 28 insertions, 64 deletions
diff --git a/src/lpc/Makefile-lpc.defs b/src/lpc/Makefile-lpc.defs index fecb9135..bccea5bc 100644 --- a/src/lpc/Makefile-lpc.defs +++ b/src/lpc/Makefile-lpc.defs @@ -4,7 +4,7 @@ endif include $(TOPDIR)/Makedefs -vpath % $(TOPDIR)/lpc:$(TOPDIR)/product:$(TOPDIR)/drivers:$(TOPDIR)/core:$(TOPDIR)/util:$(TOPDIR)/kalman:$(TOPDIR/aes):$(TOPDIR):$(TOPDIR)/math +vpath % $(TOPDIR)/lpc:$(TOPDIR)/product:$(TOPDIR)/drivers:$(TOPDIR)/kernel:$(TOPDIR)/util:$(TOPDIR)/kalman:$(TOPDIR/aes):$(TOPDIR):$(TOPDIR)/math vpath make-altitude $(TOPDIR)/util vpath make-kalman $(TOPDIR)/util vpath kalman.5c $(TOPDIR)/kalman @@ -28,7 +28,7 @@ CC=$(ARM_CC) WARN_FLAGS=-Wall -Wextra -Werror -AO_CFLAGS=-I. -I$(TOPDIR)/lpc -I$(TOPDIR)/core -I$(TOPDIR)/drivers -I$(TOPDIR)/product -I$(TOPDIR) -I$(TOPDIR)/math -I$(TOPDIR) $(PDCLIB_INCLUDES) +AO_CFLAGS=-I. -I$(TOPDIR)/lpc -I$(TOPDIR)/kernel -I$(TOPDIR)/drivers -I$(TOPDIR)/product -I$(TOPDIR) -I$(TOPDIR)/math -I$(TOPDIR) $(PDCLIB_INCLUDES) LPC_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m0 -mthumb\ -ffreestanding -nostdlib $(AO_CFLAGS) $(WARN_FLAGS) diff --git a/src/lpc/ao_adc_lpc.c b/src/lpc/ao_adc_lpc.c index e1aae0e4..b24163ee 100644 --- a/src/lpc/ao_adc_lpc.c +++ b/src/lpc/ao_adc_lpc.c @@ -160,7 +160,7 @@ ao_adc_dump(void) __reentrant #else printf("tick: %5u", packet.tick); d = (int16_t *) (&packet.adc); - for (i = 0; i < AO_NUM_ADC; i++) + for (i = 0; i < AO_ADC_NUM; i++) printf (" %2d: %5d", i, d[i]); printf("\n"); #endif diff --git a/src/lpc/ao_arch.h b/src/lpc/ao_arch.h index d04bf2c8..5fbb8dfa 100644 --- a/src/lpc/ao_arch.h +++ b/src/lpc/ao_arch.h @@ -28,10 +28,10 @@ #define AO_STACK_SIZE 512 #endif -#define AO_LED_TYPE uint16_t - #define AO_PORT_TYPE uint32_t +#define AO_LED_TYPE AO_PORT_TYPE + #ifndef AO_TICK_TYPE #define AO_TICK_TYPE uint16_t #define AO_TICK_SIGNED int16_t @@ -140,7 +140,12 @@ ao_serial_init(void); #define AO_SPI_SPEED_FAST AO_SPI_SPEED_12MHz #define AO_BOOT_APPLICATION_BASE ((uint32_t *) 0x00001000) +#define AO_BOOT_APPLICATION_BOUND ((uint32_t *) (0x00000000 + 32 * 1024)) #define AO_BOOT_LOADER_BASE ((uint32_t *) 0x00000000) #define HAS_BOOT_LOADER 1 +/* ADC definitions */ + +#define AO_ADC_MAX 32767 + #endif /* _AO_ARCH_H_ */ diff --git a/src/lpc/ao_boot.h b/src/lpc/ao_boot.h deleted file mode 100644 index e0ed4de7..00000000 --- a/src/lpc/ao_boot.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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_BOOT_H_ -#define _AO_BOOT_H_ - -void -ao_boot_chain(uint32_t *base); - -void -ao_boot_check_pin(void); - -/* Return true to switch to application (if present) */ -int -ao_boot_check_chain(void); - -void -ao_boot_reboot(uint32_t *base); - -static inline void -ao_boot_loader(void) { - ao_boot_reboot(AO_BOOT_LOADER_BASE); -} - -#endif /* _AO_BOOT_H_ */ diff --git a/src/lpc/ao_boot_chain.c b/src/lpc/ao_boot_chain.c index a08d1f2c..9e45ba27 100644 --- a/src/lpc/ao_boot_chain.c +++ b/src/lpc/ao_boot_chain.c @@ -43,14 +43,14 @@ struct ao_boot { }; static struct ao_boot __attribute__ ((section(".boot"))) ao_boot; - + int ao_boot_check_chain(void) { if (ao_boot.signal == AO_BOOT_SIGNAL && ao_boot.check == AO_BOOT_CHECK) { ao_boot.signal = 0; ao_boot.check = 0; - if (ao_boot.base == 0) + if (ao_boot.base == AO_BOOT_FORCE_LOADER) return 0; ao_boot_chain(ao_boot.base); } diff --git a/src/lpc/ao_exti_lpc.c b/src/lpc/ao_exti_lpc.c index 941aa965..fdb6a1ca 100644 --- a/src/lpc/ao_exti_lpc.c +++ b/src/lpc/ao_exti_lpc.c @@ -69,7 +69,7 @@ _ao_exti_set_enable(uint8_t pint) lpc_gpio_pin.sienr = mask; else lpc_gpio_pin.cienr = mask; - + if (mode & AO_EXTI_MODE_FALLING) lpc_gpio_pin.sienf = mask; else @@ -98,7 +98,7 @@ ao_exti_setup (uint8_t port, uint8_t pin, uint8_t mode, void (*callback)(void)) mask = (1 << pint); ao_pint_inuse |= mask; ao_pint_enabled &= ~mask; - + ao_pint_map[id] = pint; ao_exti_callback[pint] = callback; diff --git a/src/lpc/ao_interrupt.c b/src/lpc/ao_interrupt.c index c4dc7867..3318db2b 100644 --- a/src/lpc/ao_interrupt.c +++ b/src/lpc/ao_interrupt.c @@ -172,5 +172,5 @@ const void *lpc_interrupt_vector[] = { i(0xb0, hardfault), /* IRQ28 */ i(0xb4, hardfault), i(0xb8, usb_wakeup), - i(0xbc, hardfault), + i(0xbc, hardfault), }; diff --git a/src/lpc/ao_led_lpc.c b/src/lpc/ao_led_lpc.c index 7bef51ba..d983437c 100644 --- a/src/lpc/ao_led_lpc.c +++ b/src/lpc/ao_led_lpc.c @@ -17,38 +17,38 @@ #include <ao.h> -__pdata uint16_t ao_led_enable; +__pdata AO_PORT_TYPE ao_led_enable; void -ao_led_on(uint16_t colors) +ao_led_on(AO_PORT_TYPE colors) { lpc_gpio.pin[LED_PORT] |= colors; } void -ao_led_off(uint16_t colors) +ao_led_off(AO_PORT_TYPE colors) { lpc_gpio.pin[LED_PORT] &= ~colors; } void -ao_led_set(uint16_t colors) +ao_led_set(AO_PORT_TYPE colors) { - uint16_t on = colors & ao_led_enable; - uint16_t off = ~colors & ao_led_enable; + AO_PORT_TYPE on = colors & ao_led_enable; + AO_PORT_TYPE off = ~colors & ao_led_enable; ao_led_off(off); ao_led_on(on); } void -ao_led_toggle(uint16_t colors) +ao_led_toggle(AO_PORT_TYPE colors) { lpc_gpio.pin[LED_PORT] ^= colors; } void -ao_led_for(uint16_t colors, uint16_t ticks) __reentrant +ao_led_for(AO_PORT_TYPE colors, uint16_t ticks) __reentrant { ao_led_on(colors); ao_delay(ticks); @@ -56,10 +56,8 @@ ao_led_for(uint16_t colors, uint16_t ticks) __reentrant } void -ao_led_init(uint16_t enable) +ao_led_init(AO_PORT_TYPE enable) { - int bit; - ao_led_enable = enable; lpc_scb.sysahbclkctrl |= (1 << LPC_SCB_SYSAHBCLKCTRL_GPIO); lpc_gpio.dir[LED_PORT] |= enable; diff --git a/src/lpc/ao_serial_lpc.c b/src/lpc/ao_serial_lpc.c index 431ae98a..b0d5fcbc 100644 --- a/src/lpc/ao_serial_lpc.c +++ b/src/lpc/ao_serial_lpc.c @@ -206,8 +206,8 @@ ao_serial_init(void) lpc_nvic_set_enable(LPC_ISR_USART_POS); lpc_nvic_set_priority(LPC_ISR_USART_POS, 0); #if USE_SERIAL_0_STDIN - ao_add_stdio(_ao_serial_pollchar, - ao_serial_putchar, + ao_add_stdio(_ao_serial0_pollchar, + ao_serial0_putchar, NULL); #endif } diff --git a/src/lpc/ao_usb_lpc.c b/src/lpc/ao_usb_lpc.c index d02ccdd6..12f5d8e6 100644 --- a/src/lpc/ao_usb_lpc.c +++ b/src/lpc/ao_usb_lpc.c @@ -109,7 +109,7 @@ static uint8_t ao_usb_in_pending; * but not pulled to the shadow buffer. */ static uint8_t ao_usb_out_avail; -static uint8_t ao_usb_running; +uint8_t ao_usb_running; static uint8_t ao_usb_configuration; #define AO_USB_EP0_GOT_RESET 1 @@ -875,7 +875,7 @@ ao_usb_enable(void) int t; /* Enable USB pins */ -#if HAS_USB_CONNECT +#if HAS_LPC_USB_CONNECT lpc_ioconf.pio0_6 = ((LPC_IOCONF_FUNC_USB_CONNECT << LPC_IOCONF_FUNC) | (LPC_IOCONF_MODE_INACTIVE << LPC_IOCONF_MODE) | (0 << LPC_IOCONF_HYS) | |