From ba37db43741fde8a08080fa65f5bcf76b1f745ee Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Mon, 8 Oct 2018 21:41:30 -0600 Subject: capture changes to Releasing discovered during 1.8.7 release --- Releasing | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Releasing b/Releasing index a20b6dc0..6540383b 100644 --- a/Releasing +++ b/Releasing @@ -48,14 +48,6 @@ These are Bdale's notes on how to do a release. - update the version in configure.ac if Keith hasn't already - - make sure the Google Maps API key is in the build chroot and root - (cd ~/altusmetrumllc; git pull) - sudo mkdir -p /var/cache/pbuilder/base.cow/opt/google /opt/google - sudo cp ~/altusmetrumllc/google-maps-api-key \ - /var/cache/pbuilder/base.cow/opt/google/maps-api-key - sudo ln -sf /home/bdale/altusmetrumllc/google-maps-api-key \ - /opt/google/maps-api-key - - if this is an x.y release, then: git checkout -b branch- -- cgit v1.2.3 From 34b5144dbfd565ee2b9fb1e0dff388a49253f93b Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Tue, 9 Oct 2018 11:46:09 -0600 Subject: update turnon_telebt to use new approach for saving cal value on TeleBT --- ao-bringup/turnon_telebt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ao-bringup/turnon_telebt b/ao-bringup/turnon_telebt index 8bf9bcb5..3e9fddaa 100755 --- a/ao-bringup/turnon_telebt +++ b/ao-bringup/turnon_telebt @@ -64,11 +64,18 @@ case "$dev" in ;; esac +CALFILE=cal-$SERIAL.txt + echo 'E 0' > $dev -SERIAL=$SERIAL ./cal-freq $dev +../ao-tools/ao-cal-freq/ao-cal-freq --nosave --output=$CALFILE --tty=$dev + +# echo 'E 1' > $dev -echo 'E 1' > $dev +CAL_VALUE=`cat $CALFILE` +echo $SERIAL","$CAL_VALUE >> cal_values +echo "Reflashing with calibration: $CAL_VALUE" +$USBLOAD --cal=$CAL_VALUE --tty=$dev $ALTOS_FILE || exit 1 echo -n "checking BlueTooth functionality... " btdev=`hcitool scan | awk -F \- '/TeleBT/ { print $2 }'` -- cgit v1.2.3 From fe3ff829d4c2fde8d4e80f721204b18e7831bb97 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Wed, 10 Oct 2018 20:41:40 -0600 Subject: doc: add bootloader force instructions for TeleBT v4.0 --- doc/updating-firmware.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/updating-firmware.inc b/doc/updating-firmware.inc index 91aa58f2..d2883829 100644 --- a/doc/updating-firmware.inc +++ b/doc/updating-firmware.inc @@ -131,6 +131,12 @@ to the USB wires on the row of pins towards the center of the board. Ground is available on the capacitor next to it, on the end towards the USB wires. + + TeleBT v4:: + + Connect pin 30 on the CPU to ground. Pin 30 is the 6th + pin from the right on the top when the unit is oriented + such that the SMA is at the top. endif::telemetrum[] Once you've located the right pins: -- cgit v1.2.3 From 393a5e929b530d9ee4f78cd01faa4dd90c95fe3a Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Fri, 12 Oct 2018 23:32:57 -0600 Subject: altos: first cut at easymega v2.0 support .. nothing working yet --- src/easymega-v2.0/Makefile | 139 ++++++++++++ src/easymega-v2.0/ao_easymega.c | 97 +++++++++ src/easymega-v2.0/ao_pins.h | 351 +++++++++++++++++++++++++++++++ src/easymega-v2.0/flash-loader/Makefile | 8 + src/easymega-v2.0/flash-loader/ao_pins.h | 35 +++ 5 files changed, 630 insertions(+) create mode 100644 src/easymega-v2.0/Makefile create mode 100644 src/easymega-v2.0/ao_easymega.c create mode 100644 src/easymega-v2.0/ao_pins.h create mode 100644 src/easymega-v2.0/flash-loader/Makefile create mode 100644 src/easymega-v2.0/flash-loader/ao_pins.h diff --git a/src/easymega-v2.0/Makefile b/src/easymega-v2.0/Makefile new file mode 100644 index 00000000..9d490d0f --- /dev/null +++ b/src/easymega-v2.0/Makefile @@ -0,0 +1,139 @@ +# +# AltOS build +# +# + +include ../stm/Makefile.defs + +INC = \ + ao.h \ + ao_arch.h \ + ao_arch_funcs.h \ + ao_boot.h \ + ao_companion.h \ + ao_data.h \ + ao_sample.h \ + ao_pins.h \ + altitude-pa.h \ + ao_kalman.h \ + ao_product.h \ + ao_ms5607.h \ + ao_mpu9250.h \ + ao_profile.h \ + ao_task.h \ + ao_whiten.h \ + ao_sample_profile.h \ + ao_quaternion.h \ + math.h \ + ao_mpu.h \ + stm32l.h \ + math.h \ + Makefile + +# +# Common AltOS sources +# + +#PROFILE=ao_profile.c +#PROFILE_DEF=-DAO_PROFILE=1 + +#SAMPLE_PROFILE=ao_sample_profile.c \ +# ao_sample_profile_timer.c +#SAMPLE_PROFILE_DEF=-DHAS_SAMPLE_PROFILE=1 + +#STACK_GUARD=ao_mpu_stm.c +#STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 + +MATH_SRC=\ + ef_acos.c \ + ef_sqrt.c \ + ef_rem_pio2.c \ + kf_cos.c \ + kf_sin.c \ + kf_rem_pio2.c \ + sf_copysign.c \ + sf_cos.c \ + sf_fabs.c \ + sf_floor.c \ + sf_scalbn.c \ + sf_sin.c \ + ef_log.c + +ALTOS_SRC = \ + ao_boot_chain.c \ + ao_interrupt.c \ + ao_product.c \ + ao_romconfig.c \ + ao_cmd.c \ + ao_config.c \ + ao_task.c \ + ao_led.c \ + ao_stdio.c \ + ao_panic.c \ + ao_timer.c \ + ao_mutex.c \ + ao_ignite.c \ + ao_freq.c \ + ao_dma_stm.c \ + ao_spi_stm.c \ + ao_data.c \ + ao_ms5607.c \ + ao_mpu9250.c \ + ao_adc_stm.c \ + ao_beep_stm.c \ + ao_eeprom_stm.c \ + ao_storage.c \ + ao_m25.c \ + ao_usb_stm.c \ + ao_exti_stm.c \ + ao_report.c \ + ao_i2c_stm.c \ + ao_convert_pa.c \ + ao_convert_volt.c \ + ao_log.c \ + ao_log_mega.c \ + ao_sample.c \ + ao_kalman.c \ + ao_flight.c \ + ao_companion.c \ + ao_pyro.c \ + $(MATH_SRC) \ + $(PROFILE) \ + $(SAMPLE_PROFILE) \ + $(STACK_GUARD) + +PRODUCT=EasyMega-v2.0 +PRODUCT_DEF=-DEASYMEGA +IDPRODUCT=0x0028 + +CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) $(SAMPLE_PROFILE_DEF) $(STACK_GUARD_DEF) -Os -g + +PROGNAME=easymega-v1.0 +PROG=$(PROGNAME)-$(VERSION).elf +HEX=$(PROGNAME)-$(VERSION).ihx + +SRC=$(ALTOS_SRC) ao_easymega.c +OBJ=$(SRC:.c=.o) + +all: $(PROG) $(HEX) + +$(PROG): Makefile $(OBJ) altos.ld + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) + +../altitude-pa.h: make-altitude-pa + nickle $< > $@ + +$(OBJ): $(INC) + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +distclean: clean + +clean: + rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx + rm -f ao_product.h + +install: + +uninstall: diff --git a/src/easymega-v2.0/ao_easymega.c b/src/easymega-v2.0/ao_easymega.c new file mode 100644 index 00000000..9848c367 --- /dev/null +++ b/src/easymega-v2.0/ao_easymega.c @@ -0,0 +1,97 @@ +/* + * Copyright © 2014 Bdale Garbee + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if HAS_SAMPLE_PROFILE +#include +#endif +#include +#if HAS_STACK_GUARD +#include +#endif + +int +main(void) +{ + ao_clock_init(); + +#if HAS_STACK_GUARD + ao_mpu_init(); +#endif + + ao_task_init(); + ao_led_init(LEDS_AVAILABLE); + ao_led_on(LEDS_AVAILABLE); + ao_timer_init(); + + ao_i2c_init(); + ao_spi_init(); + ao_dma_init(); + ao_exti_init(); + + ao_adc_init(); +#if HAS_BEEP + ao_beep_init(); +#endif + ao_cmd_init(); + +#if HAS_MS5607 + ao_ms5607_init(); +#endif +#if HAS_HMC5883 + ao_hmc5883_init(); +#endif +#if HAS_MPU6000 + ao_mpu6000_init(); +#endif +#if HAS_MMA655X + ao_mma655x_init(); +#endif + + ao_eeprom_init(); + ao_storage_init(); + + ao_flight_init(); + ao_log_init(); + ao_report_init(); + + ao_usb_init(); + ao_igniter_init(); + ao_companion_init(); + ao_pyro_init(); + + ao_config_init(); +#if AO_PROFILE + ao_profile_init(); +#endif +#if HAS_SAMPLE_PROFILE + ao_sample_profile_init(); +#endif + + ao_led_off(LEDS_AVAILABLE); + ao_start_scheduler(); + return 0; +} diff --git a/src/easymega-v2.0/ao_pins.h b/src/easymega-v2.0/ao_pins.h new file mode 100644 index 00000000..aff06cdd --- /dev/null +++ b/src/easymega-v2.0/ao_pins.h @@ -0,0 +1,351 @@ +/* + * Copyright © 2014 Bdale Garbee + * + * 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. + */ + +#ifndef _AO_PINS_H_ +#define _AO_PINS_H_ + +#define HAS_TASK_QUEUE 1 + +/* 16MHz High speed external crystal */ +#define AO_HSE 16000000 + +/* PLLVCO = 96MHz (so that USB will work) */ +#define AO_PLLMUL 12 +#define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_12) + +/* SYSCLK = 32MHz (no need to go faster than CPU) */ +#define AO_PLLDIV 3 +#define AO_RCC_CFGR_PLLDIV (STM_RCC_CFGR_PLLDIV_3) + +/* HCLK = 32MHz (CPU clock) */ +#define AO_AHB_PRESCALER 1 +#define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1 + +/* Run APB1 at 16MHz (HCLK/2) */ +#define AO_APB1_PRESCALER 2 +#define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE2_DIV_2 + +/* Run APB2 at 16MHz (HCLK/2) */ +#define AO_APB2_PRESCALER 2 +#define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_2 + +#define HAS_SERIAL_1 0 +#define USE_SERIAL_1_STDIN 0 +#define SERIAL_1_PB6_PB7 0 +#define SERIAL_1_PA9_PA10 0 + +#define HAS_SERIAL_2 0 +#define USE_SERIAL_2_STDIN 0 +#define SERIAL_2_PA2_PA3 0 +#define SERIAL_2_PD5_PD6 0 + +#define HAS_SERIAL_3 0 +#define USE_SERIAL_3_STDIN 0 +#define SERIAL_3_PB10_PB11 0 +#define SERIAL_3_PC10_PC11 0 +#define SERIAL_3_PD8_PD9 0 + +#define ao_gps_getchar ao_serial1_getchar +#define ao_gps_putchar ao_serial1_putchar +#define ao_gps_set_speed ao_serial1_set_speed +#define ao_gps_fifo (ao_stm_usart1.rx_fifo) + +#define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX (1024 * 1024) +#define AO_CONFIG_MAX_SIZE 1024 +#define LOG_ERASE_MARK 0x55 +#define LOG_MAX_ERASE 128 +#define AO_LOG_FORMAT AO_LOG_FORMAT_TELEMEGA + +#define HAS_EEPROM 1 +#define USE_INTERNAL_FLASH 0 +#define USE_EEPROM_CONFIG 1 +#define USE_STORAGE_CONFIG 0 +#define HAS_USB 1 +#define HAS_BEEP 1 +#define HAS_BATTERY_REPORT 1 +#define HAS_RADIO 0 +#define HAS_TELEMETRY 0 +#define HAS_APRS 0 +#define HAS_COMPANION 1 + +#define HAS_SPI_1 1 +#define SPI_1_PA5_PA6_PA7 1 /* Barometer */ +#define SPI_1_PB3_PB4_PB5 1 /* Accelerometer, Gyro */ +#define SPI_1_PE13_PE14_PE15 0 +#define SPI_1_OSPEEDR STM_OSPEEDR_10MHz + +#define HAS_SPI_2 1 +#define SPI_2_PB13_PB14_PB15 1 /* Flash, Companion */ +#define SPI_2_PD1_PD3_PD4 0 +#define SPI_2_OSPEEDR STM_OSPEEDR_10MHz + +#define SPI_2_PORT (&stm_gpiob) +#define SPI_2_SCK_PIN 13 +#define SPI_2_MISO_PIN 14 +#define SPI_2_MOSI_PIN 15 + +#define HAS_I2C_1 1 +#define I2C_1_PB8_PB9 1 + +#define HAS_I2C_2 0 +#define I2C_2_PB10_PB11 0 + +#define PACKET_HAS_SLAVE 0 +#define PACKET_HAS_MASTER 0 + +#define LOW_LEVEL_DEBUG 0 + +#define LED_PORT_ENABLE STM_RCC_AHBENR_GPIOAEN +#define LED_PORT (&stm_gpioa) +#define LED_PIN_RED 9 +#define LED_PIN_GREEN 10 +#define AO_LED_RED (1 << LED_PIN_RED) +#define AO_LED_GREEN (1 << LED_PIN_GREEN) + +#define LEDS_AVAILABLE (AO_LED_RED | AO_LED_GREEN) + +#define HAS_GPS 0 +#define HAS_FLIGHT 1 +#define HAS_ADC 1 +#define HAS_ADC_TEMP 1 +#define HAS_LOG 1 + +/* + * Igniter + */ + +#define HAS_IGNITE 1 +#define HAS_IGNITE_REPORT 1 + +#define AO_SENSE_PYRO(p,n) ((p)->adc.sense[n]) +#define AO_SENSE_DROGUE(p) ((p)->adc.sense[4]) +#define AO_SENSE_MAIN(p) ((p)->adc.sense[5]) +#define AO_IGNITER_CLOSED 400 +#define AO_IGNITER_OPEN 60 + +/* Pyro A */ +#define AO_PYRO_PORT_0 (&stm_gpioa) +#define AO_PYRO_PIN_0 15 + +/* Pyro B */ +#define AO_PYRO_PORT_1 (&stm_gpioc) +#define AO_PYRO_PIN_1 10 + +/* Pyro C */ +#define AO_PYRO_PORT_2 (&stm_gpiob) +#define AO_PYRO_PIN_2 11 + +/* Pyro D */ +#define AO_PYRO_PORT_3 (&stm_gpiob) +#define AO_PYRO_PIN_3 10 + +/* Drogue */ +#define AO_IGNITER_DROGUE_PORT (&stm_gpioa) +#define AO_IGNITER_DROGUE_PIN 0 + +/* Main */ +#define AO_IGNITER_MAIN_PORT (&stm_gpioa) +#define AO_IGNITER_MAIN_PIN 1 + +/* Number of general purpose pyro channels available */ +#define AO_PYRO_NUM 4 + +#define AO_IGNITER_SET_DROGUE(v) stm_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, v) +#define AO_IGNITER_SET_MAIN(v) stm_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, v) + +/* + * ADC + */ +#define AO_DATA_RING 32 +#define AO_ADC_NUM_SENSE 6 + +struct ao_adc { + int16_t sense[AO_ADC_NUM_SENSE]; + int16_t v_batt; + int16_t v_pbatt; + int16_t temp; +}; + +#define AO_ADC_DUMP(p) \ + printf("tick: %5u A: %5d B: %5d C: %5d D: %5d drogue: %5d main: %5d batt: %5d pbatt: %5d temp: %5d\n", \ + (p)->tick, \ + (p)->adc.sense[0], (p)->adc.sense[1], (p)->adc.sense[2], \ + (p)->adc.sense[3], (p)->adc.sense[4], (p)->adc.sense[5], \ + (p)->adc.v_batt, (p)->adc.v_pbatt, (p)->adc.temp) + +#define AO_ADC_SENSE_A 14 +#define AO_ADC_SENSE_A_PORT (&stm_gpioc) +#define AO_ADC_SENSE_A_PIN 4 + +#define AO_ADC_SENSE_B 15 +#define AO_ADC_SENSE_B_PORT (&stm_gpioc) +#define AO_ADC_SENSE_B_PIN 5 + +#define AO_ADC_SENSE_C 13 +#define AO_ADC_SENSE_C_PORT (&stm_gpioc) +#define AO_ADC_SENSE_C_PIN 3 + +#define AO_ADC_SENSE_D 12 +#define AO_ADC_SENSE_D_PORT (&stm_gpioc) +#define AO_ADC_SENSE_D_PIN 2 + +#define AO_ADC_SENSE_DROGUE 11 +#define AO_ADC_SENSE_DROGUE_PORT (&stm_gpioc) +#define AO_ADC_SENSE_DROGUE_PIN 1 + +#define AO_ADC_SENSE_MAIN 10 +#define AO_ADC_SENSE_MAIN_PORT (&stm_gpioc) +#define AO_ADC_SENSE_MAIN_PIN 0 + +#define AO_ADC_V_BATT 8 +#define AO_ADC_V_BATT_PORT (&stm_gpiob) +#define AO_ADC_V_BATT_PIN 0 + +#define AO_ADC_V_PBATT 9 +#define AO_ADC_V_PBATT_PORT (&stm_gpiob) +#define AO_ADC_V_PBATT_PIN 1 + +#define AO_ADC_TEMP 16 + +#define AO_ADC_RCC_AHBENR ((1 << STM_RCC_AHBENR_GPIOAEN) | \ + (1 << STM_RCC_AHBENR_GPIOEEN) | \ + (1 << STM_RCC_AHBENR_GPIOBEN)) + +#define AO_NUM_ADC_PIN (AO_ADC_NUM_SENSE + 2) + +#define AO_ADC_PIN0_PORT AO_ADC_SENSE_A_PORT +#define AO_ADC_PIN0_PIN AO_ADC_SENSE_A_PIN +#define AO_ADC_PIN1_PORT AO_ADC_SENSE_B_PORT +#define AO_ADC_PIN1_PIN AO_ADC_SENSE_B_PIN +#define AO_ADC_PIN2_PORT AO_ADC_SENSE_C_PORT +#define AO_ADC_PIN2_PIN AO_ADC_SENSE_C_PIN +#define AO_ADC_PIN3_PORT AO_ADC_SENSE_D_PORT +#define AO_ADC_PIN3_PIN AO_ADC_SENSE_D_PIN +#define AO_ADC_PIN4_PORT AO_ADC_SENSE_DROGUE_PORT +#define AO_ADC_PIN4_PIN AO_ADC_SENSE_DROGUE_PIN +#define AO_ADC_PIN5_PORT AO_ADC_SENSE_MAIN_PORT +#define AO_ADC_PIN5_PIN AO_ADC_SENSE_MAIN_PIN +#define AO_ADC_PIN6_PORT AO_ADC_V_BATT_PORT +#define AO_ADC_PIN6_PIN AO_ADC_V_BATT_PIN +#define AO_ADC_PIN7_PORT AO_ADC_V_PBATT_PORT +#define AO_ADC_PIN7_PIN AO_ADC_V_PBATT_PIN + +#define AO_NUM_ADC (AO_ADC_NUM_SENSE + 3) + +#define AO_ADC_SQ1 AO_ADC_SENSE_A +#define AO_ADC_SQ2 AO_ADC_SENSE_B +#define AO_ADC_SQ3 AO_ADC_SENSE_C +#define AO_ADC_SQ4 AO_ADC_SENSE_D +#define AO_ADC_SQ5 AO_ADC_SENSE_DROGUE +#define AO_ADC_SQ6 AO_ADC_SENSE_MAIN +#define AO_ADC_SQ7 AO_ADC_V_BATT +#define AO_ADC_SQ8 AO_ADC_V_PBATT +#define AO_ADC_SQ9 AO_ADC_TEMP + +/* + * Voltage divider on ADC battery sampler + */ +#define AO_BATTERY_DIV_PLUS 56 /* 5.6k */ +#define AO_BATTERY_DIV_MINUS 100 /* 10k */ + +/* + * Voltage divider on ADC igniter samplers + */ +#define AO_IGNITE_DIV_PLUS 100 /* 100k */ +#define AO_IGNITE_DIV_MINUS 27 /* 27k */ + +/* + * ADC reference in decivolts + */ +#define AO_ADC_REFERENCE_DV 33 + +/* + * Pressure sensor settings + */ +#define HAS_MS5607 1 +#define HAS_MS5611 0 +#define AO_MS5607_PRIVATE_PINS 1 +#define AO_MS5607_CS_PORT (&stm_gpioa) +#define AO_MS5607_CS_PIN 3 +#define AO_MS5607_CS_MASK (1 << AO_MS5607_CS_PIN) +#define AO_MS5607_MISO_PORT (&stm_gpioa) +#define AO_MS5607_MISO_PIN 6 +#define AO_MS5607_MISO_MASK (1 << AO_MS5607_MISO_PIN) +#define AO_MS5607_SPI_INDEX AO_SPI_1_PA5_PA6_PA7 + +/* + * SPI Flash memory + */ + +#define M25_MAX_CHIPS 1 +#define AO_M25_SPI_CS_PORT (&stm_gpiob) +#define AO_M25_SPI_CS_PIN 12 +#define AO_M25_SPI_CS_MASK (1 << AO_M25_SPI_CS_PIN) +#define AO_M25_SPI_BUS AO_SPI_2_PB13_PB14_PB15 + +/* + * mpu9250 + */ + +#define HAS_MPU9250 1 +#define AO_MPU9250_INT_PORT (&stm_gpioe) +#define AO_MPU9250_INT_PIN 0 +#define AO_MPU9250_SPI_BUS AO_SPI_1_PE13_PE14_PE15 +#define AO_MPU9250_SPI_CS_PORT (&stm_gpiod) +#define AO_MPU9250_SPI_CS_PIN 2 +#define HAS_IMU 1 + +/* + * mma655x + */ + +#define HAS_MMA655X 0 +#define AO_MMA655X_INVERT 0 +#define AO_MMA655X_SPI_INDEX AO_SPI_1_PB3_PB4_PB5 +#define AO_MMA655X_CS_PORT (&stm_gpioc) +#define AO_MMA655X_CS_PIN 12 + +#define NUM_CMDS 16 + +/* + * Companion + */ + +#define AO_COMPANION_CS_PORT (&stm_gpiob) +#define AO_COMPANION_CS_PIN (6) +#define AO_COMPANION_SPI_BUS AO_SPI_2_PB13_PB14_PB15 + +/* + * Monitor + */ + +#define HAS_MONITOR 0 +#define LEGACY_MONITOR 0 +#define HAS_MONITOR_PUT 0 +#define AO_MONITOR_LED 0 +#define HAS_RSSI 0 + +/* + * Profiling Viterbi decoding + */ + +#ifndef AO_PROFILE +#define AO_PROFILE 0 +#endif + +#endif /* _AO_PINS_H_ */ diff --git a/src/easymega-v2.0/flash-loader/Makefile b/src/easymega-v2.0/flash-loader/Makefile new file mode 100644 index 00000000..a5594006 --- /dev/null +++ b/src/easymega-v2.0/flash-loader/Makefile @@ -0,0 +1,8 @@ +# +# AltOS flash loader build +# +# + +TOPDIR=../.. +HARDWARE=easymega-v2.0 +include $(TOPDIR)/stm/Makefile-flash.defs diff --git a/src/easymega-v2.0/flash-loader/ao_pins.h b/src/easymega-v2.0/flash-loader/ao_pins.h new file mode 100644 index 00000000..324b0eb9 --- /dev/null +++ b/src/easymega-v2.0/flash-loader/ao_pins.h @@ -0,0 +1,35 @@ +/* + * Copyright © 2018 Bdale Garbee + * + * 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. + */ + +#ifndef _AO_PINS_H_ +#define _AO_PINS_H_ + +/* External crystal at 16MHz */ +#define AO_HSE 16000000 + +#include + +/* Companion port cs_companion0 PB6 */ + +#define AO_BOOT_PIN 1 +#define AO_BOOT_APPLICATION_GPIO stm_gpiob +#define AO_BOOT_APPLICATION_PIN 6 +#define AO_BOOT_APPLICATION_VALUE 1 +#define AO_BOOT_APPLICATION_MODE AO_EXTI_MODE_PULL_UP + +#endif /* _AO_PINS_H_ */ -- cgit v1.2.3 From e830d803d3e289f0f1a6d92ce208682af28d3f52 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 13 Oct 2018 07:44:10 -0700 Subject: altosdroid: Bump version to 18 for 1.8.7 Signed-off-by: Keith Packard --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7f7eec93..9dba0a5e 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ dnl Process this file with autoconf to create configure. AC_PREREQ(2.57) AC_INIT([altos], 1.8.7) -ANDROID_VERSION=17 +ANDROID_VERSION=18 AC_CONFIG_SRCDIR([src/kernel/ao.h]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE -- cgit v1.2.3 From 803c68d7933d03aaebda19786b63055d4a6d3d22 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 13 Oct 2018 07:50:59 -0700 Subject: altos/stm: Make flash loader work with either 8MHz or 16MHz xtal Provide PLL definitions for both values. Signed-off-by: Keith Packard --- src/stm/ao_flash_stm_pins.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/stm/ao_flash_stm_pins.h b/src/stm/ao_flash_stm_pins.h index d5893c80..b82046d7 100644 --- a/src/stm/ao_flash_stm_pins.h +++ b/src/stm/ao_flash_stm_pins.h @@ -21,6 +21,10 @@ #include +#ifndef AO_PLLMUL + +#if AO_HSE == 8000000 + /* PLLVCO = 96MHz (so that USB will work) */ #define AO_PLLMUL 12 #define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_12) @@ -29,6 +33,22 @@ #define AO_PLLDIV 3 #define AO_RCC_CFGR_PLLDIV (STM_RCC_CFGR_PLLDIV_3) +#endif + +#if AO_HSE == 16000000 + +/* PLLVCO = 96MHz (so that USB will work) */ +#define AO_PLLMUL 6 +#define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_6) + +/* SYSCLK = 32MHz */ +#define AO_PLLDIV 3 +#define AO_RCC_CFGR_PLLDIV (STM_RCC_CFGR_PLLDIV_3) + +#endif + +#endif + /* HCLK = 32MHZ (CPU clock) */ #define AO_AHB_PRESCALER 1 #define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1 -- cgit v1.2.3 From 382b3ef62a09e580834b07faf9ed2d00e5ce1621 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 00:06:44 -0700 Subject: altos: use %lu for APRS altitude in sprintf It's a long. Signed-off-by: Keith Packard --- src/drivers/ao_aprs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/ao_aprs.c b/src/drivers/ao_aprs.c index a8016673..2f17d044 100644 --- a/src/drivers/ao_aprs.c +++ b/src/drivers/ao_aprs.c @@ -804,10 +804,10 @@ static int tncPositionPacket(void) /* Convert from meters to feet */ alt = (alt * 328 + 50) / 100; - buf += sprintf((char *) tncBuffer, "!%02u%02u.%02u%c/%03u%02u.%02u%c'/A=%06u ", + buf += sprintf((char *) tncBuffer, "!%02u%02u.%02u%c/%03u%02u.%02u%c'/A=%06lu ", lat_deg, lat_min, lat_frac, lat_sign, lon_deg, lon_min, lon_frac, lon_sign, - alt); + (long) alt); break; } } -- cgit v1.2.3 From 56629222711ba3ef7853405c9b07ad614fb29b95 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 5 Aug 2018 12:17:19 +0800 Subject: altos: Remove cc1111 products We're not testing these anyways; building new firmware for them is not helpful. Signed-off-by: Keith Packard --- altosui/Makefile.am | 16 +- altosui/altos-windows.nsi.in | 6 - configure.ac | 32 - src/Makefile | 19 +- src/cc1111/Makefile.cc1111 | 39 - src/cc1111/_bp.c | 26 - src/cc1111/ao_adc.c | 239 ------ src/cc1111/ao_aes.c | 147 ---- src/cc1111/ao_arch.h | 338 -------- src/cc1111/ao_arch_funcs.h | 152 ---- src/cc1111/ao_battery.c | 61 -- src/cc1111/ao_beep.c | 53 -- src/cc1111/ao_button.c | 159 ---- src/cc1111/ao_dbg.c | 334 -------- src/cc1111/ao_dma.c | 131 ---- src/cc1111/ao_exti.c | 34 - src/cc1111/ao_exti.h | 57 -- src/cc1111/ao_intflash.c | 212 ----- src/cc1111/ao_launch.c | 212 ----- src/cc1111/ao_launch.h | 44 -- src/cc1111/ao_lcd_port.c | 51 -- src/cc1111/ao_led.c | 62 -- src/cc1111/ao_pins.h | 655 ---------------- src/cc1111/ao_radio.c | 689 ---------------- src/cc1111/ao_reboot.c | 29 - src/cc1111/ao_romconfig.c | 33 - src/cc1111/ao_serial.c | 392 ---------- src/cc1111/ao_spi.c | 339 -------- src/cc1111/ao_string.c | 51 -- src/cc1111/ao_timer.c | 145 ---- src/cc1111/ao_usb.c | 489 ------------ src/cc1111/cc1111.h | 1390 --------------------------------- src/product/Makefile.teledongle | 98 --- src/product/Makefile.telelaunch | 100 --- src/product/Makefile.telemetrum | 113 --- src/product/Makefile.telemini | 101 --- src/product/Makefile.telenano | 100 --- src/spiradio-v0.1/.gitignore | 2 - src/spiradio-v0.1/.sdcdbrc | 2 - src/spiradio-v0.1/Makefile | 92 --- src/spiradio-v0.1/ao_pins.h | 66 -- src/spiradio-v0.1/ao_spiradio.c | 40 - src/teleballoon-v1.1/.gitignore | 2 - src/teleballoon-v1.1/Makefile | 119 --- src/teleballoon-v1.1/ao_pins.h | 231 ------ src/teleballoon-v1.1/ao_teleballoon.c | 82 -- src/telebt-v1.0/.gitignore | 2 - src/telebt-v1.0/.sdcdbrc | 2 - src/telebt-v1.0/Makefile | 97 --- src/telebt-v1.0/ao_pins.h | 104 --- src/telebt-v1.0/ao_telebt.c | 45 -- src/teledongle-v0.1/.gitignore | 2 - src/teledongle-v0.1/.sdcdbrc | 1 - src/teledongle-v0.1/Makefile | 8 - src/teledongle-v0.2/.gitignore | 2 - src/teledongle-v0.2/.sdcdbrc | 1 - src/teledongle-v0.2/Makefile | 8 - src/telefire-v0.1/.gitignore | 2 - src/telefire-v0.1/.sdcdbrc | 2 - src/telefire-v0.1/Makefile | 102 --- src/telefire-v0.1/ao_pins.h | 136 ---- src/telefire-v0.1/ao_telefire.c | 47 -- src/telefire-v0.2/.gitignore | 2 - src/telefire-v0.2/.sdcdbrc | 2 - src/telefire-v0.2/Makefile | 102 --- src/telefire-v0.2/ao_pins.h | 155 ---- src/telefire-v0.2/ao_telefire.c | 46 -- src/telelco-v0.1/.gitignore | 2 - src/telelco-v0.1/Makefile | 99 --- src/telelco-v0.1/ao_lco.c | 392 ---------- src/telelco-v0.1/ao_lco.h | 25 - src/telelco-v0.1/ao_pins.h | 226 ------ src/telelco-v0.1/ao_telelco.c | 72 -- src/telemetrum-v0.1-sirf/.gitignore | 2 - src/telemetrum-v0.1-sirf/Makefile | 17 - src/telemetrum-v0.1-sky/.gitignore | 2 - src/telemetrum-v0.1-sky/.sdcdbrc | 1 - src/telemetrum-v0.1-sky/Makefile | 18 - src/telemetrum-v1.0/.gitignore | 2 - src/telemetrum-v1.0/.sdcdbrc | 1 - src/telemetrum-v1.0/Makefile | 17 - src/telemetrum-v1.1/.gitignore | 2 - src/telemetrum-v1.1/.sdcdbrc | 1 - src/telemetrum-v1.1/Makefile | 18 - src/telemetrum-v1.2/.gitignore | 2 - src/telemetrum-v1.2/.sdcdbrc | 1 - src/telemetrum-v1.2/Makefile | 18 - src/telemini-v1.0/.gitignore | 2 - src/telemini-v1.0/.sdcdbrc | 2 - src/telemini-v1.0/Makefile | 8 - src/telemini-v2.0/.gitignore | 2 - src/telemini-v2.0/.sdcdbrc | 2 - src/telemini-v2.0/Makefile | 116 --- src/telemini-v2.0/ao_pins.h | 192 ----- src/telemini-v2.0/ao_telemini.c | 64 -- src/telenano-v0.1/.gitignore | 2 - src/telenano-v0.1/.sdcdbrc | 1 - src/telenano-v0.1/Makefile | 9 - src/telerepeat-v1.0/.gitignore | 2 - src/telerepeat-v1.0/.sdcdbrc | 2 - src/telerepeat-v1.0/Makefile | 100 --- src/telerepeat-v1.0/ao_pins.h | 112 --- src/telerepeat-v1.0/ao_telerepeat.c | 48 -- src/teleshield-v0.1/.gitignore | 2 - src/teleshield-v0.1/Makefile | 111 --- src/teleshield-v0.1/ao_ardu_serial.c | 40 - src/teleshield-v0.1/ao_pins.h | 225 ------ src/teleshield-v0.1/ao_teleshield.c | 54 -- src/teleterra-v0.2/.gitignore | 2 - src/teleterra-v0.2/.sdcdbrc | 1 - src/teleterra-v0.2/Makefile | 105 --- src/teleterra-v0.2/ao_pins.h | 237 ------ src/tidongle/.gitignore | 2 - src/tidongle/Makefile | 91 --- telegps/Makefile.am | 6 +- telegps/telegps-windows.nsi.in | 2 - 116 files changed, 7 insertions(+), 11105 deletions(-) delete mode 100644 src/cc1111/Makefile.cc1111 delete mode 100644 src/cc1111/_bp.c delete mode 100644 src/cc1111/ao_adc.c delete mode 100644 src/cc1111/ao_aes.c delete mode 100644 src/cc1111/ao_arch.h delete mode 100644 src/cc1111/ao_arch_funcs.h delete mode 100644 src/cc1111/ao_battery.c delete mode 100644 src/cc1111/ao_beep.c delete mode 100644 src/cc1111/ao_button.c delete mode 100644 src/cc1111/ao_dbg.c delete mode 100644 src/cc1111/ao_dma.c delete mode 100644 src/cc1111/ao_exti.c delete mode 100644 src/cc1111/ao_exti.h delete mode 100644 src/cc1111/ao_intflash.c delete mode 100644 src/cc1111/ao_launch.c delete mode 100644 src/cc1111/ao_launch.h delete mode 100644 src/cc1111/ao_lcd_port.c delete mode 100644 src/cc1111/ao_led.c delete mode 100644 src/cc1111/ao_pins.h delete mode 100644 src/cc1111/ao_radio.c delete mode 100644 src/cc1111/ao_reboot.c delete mode 100644 src/cc1111/ao_romconfig.c delete mode 100644 src/cc1111/ao_serial.c delete mode 100644 src/cc1111/ao_spi.c delete mode 100644 src/cc1111/ao_string.c delete mode 100644 src/cc1111/ao_timer.c delete mode 100644 src/cc1111/ao_usb.c delete mode 100644 src/cc1111/cc1111.h delete mode 100644 src/product/Makefile.teledongle delete mode 100644 src/product/Makefile.telelaunch delete mode 100644 src/product/Makefile.telemetrum delete mode 100644 src/product/Makefile.telemini delete mode 100644 src/product/Makefile.telenano delete mode 100644 src/spiradio-v0.1/.gitignore delete mode 100644 src/spiradio-v0.1/.sdcdbrc delete mode 100644 src/spiradio-v0.1/Makefile delete mode 100644 src/spiradio-v0.1/ao_pins.h delete mode 100644 src/spiradio-v0.1/ao_spiradio.c delete mode 100644 src/teleballoon-v1.1/.gitignore delete mode 100644 src/teleballoon-v1.1/Makefile delete mode 100644 src/teleballoon-v1.1/ao_pins.h delete mode 100644 src/teleballoon-v1.1/ao_teleballoon.c delete mode 100644 src/telebt-v1.0/.gitignore delete mode 100644 src/telebt-v1.0/.sdcdbrc delete mode 100644 src/telebt-v1.0/Makefile delete mode 100644 src/telebt-v1.0/ao_pins.h delete mode 100644 src/telebt-v1.0/ao_telebt.c delete mode 100644 src/teledongle-v0.1/.gitignore delete mode 100644 src/teledongle-v0.1/.sdcdbrc delete mode 100644 src/teledongle-v0.1/Makefile delete mode 100644 src/teledongle-v0.2/.gitignore delete mode 100644 src/teledongle-v0.2/.sdcdbrc delete mode 100644 src/teledongle-v0.2/Makefile delete mode 100644 src/telefire-v0.1/.gitignore delete mode 100644 src/telefire-v0.1/.sdcdbrc delete mode 100644 src/telefire-v0.1/Makefile delete mode 100644 src/telefire-v0.1/ao_pins.h delete mode 100644 src/telefire-v0.1/ao_telefire.c delete mode 100644 src/telefire-v0.2/.gitignore delete mode 100644 src/telefire-v0.2/.sdcdbrc delete mode 100644 src/telefire-v0.2/Makefile delete mode 100644 src/telefire-v0.2/ao_pins.h delete mode 100644 src/telefire-v0.2/ao_telefire.c delete mode 100644 src/telelco-v0.1/.gitignore delete mode 100644 src/telelco-v0.1/Makefile delete mode 100644 src/telelco-v0.1/ao_lco.c delete mode 100644 src/telelco-v0.1/ao_lco.h delete mode 100644 src/telelco-v0.1/ao_pins.h delete mode 100644 src/telelco-v0.1/ao_telelco.c delete mode 100644 src/telemetrum-v0.1-sirf/.gitignore delete mode 100644 src/telemetrum-v0.1-sirf/Makefile delete mode 100644 src/telemetrum-v0.1-sky/.gitignore delete mode 100644 src/telemetrum-v0.1-sky/.sdcdbrc delete mode 100644 src/telemetrum-v0.1-sky/Makefile delete mode 100644 src/telemetrum-v1.0/.gitignore delete mode 100644 src/telemetrum-v1.0/.sdcdbrc delete mode 100644 src/telemetrum-v1.0/Makefile delete mode 100644 src/telemetrum-v1.1/.gitignore delete mode 100644 src/telemetrum-v1.1/.sdcdbrc delete mode 100644 src/telemetrum-v1.1/Makefile delete mode 100644 src/telemetrum-v1.2/.gitignore delete mode 100644 src/telemetrum-v1.2/.sdcdbrc delete mode 100644 src/telemetrum-v1.2/Makefile delete mode 100644 src/telemini-v1.0/.gitignore delete mode 100644 src/telemini-v1.0/.sdcdbrc delete mode 100644 src/telemini-v1.0/Makefile delete mode 100644 src/telemini-v2.0/.gitignore delete mode 100644 src/telemini-v2.0/.sdcdbrc delete mode 100644 src/telemini-v2.0/Makefile delete mode 100644 src/telemini-v2.0/ao_pins.h delete mode 100644 src/telemini-v2.0/ao_telemini.c delete mode 100644 src/telenano-v0.1/.gitignore delete mode 100644 src/telenano-v0.1/.sdcdbrc delete mode 100644 src/telenano-v0.1/Makefile delete mode 100644 src/telerepeat-v1.0/.gitignore delete mode 100644 src/telerepeat-v1.0/.sdcdbrc delete mode 100644 src/telerepeat-v1.0/Makefile delete mode 100644 src/telerepeat-v1.0/ao_pins.h delete mode 100644 src/telerepeat-v1.0/ao_telerepeat.c delete mode 100644 src/teleshield-v0.1/.gitignore delete mode 100644 src/teleshield-v0.1/Makefile delete mode 100644 src/teleshield-v0.1/ao_ardu_serial.c delete mode 100644 src/teleshield-v0.1/ao_pins.h delete mode 100644 src/teleshield-v0.1/ao_teleshield.c delete mode 100644 src/teleterra-v0.2/.gitignore delete mode 100644 src/teleterra-v0.2/.sdcdbrc delete mode 100644 src/teleterra-v0.2/Makefile delete mode 100644 src/teleterra-v0.2/ao_pins.h delete mode 100644 src/tidongle/.gitignore delete mode 100644 src/tidongle/Makefile diff --git a/altosui/Makefile.am b/altosui/Makefile.am index 144d21d7..cddc78d3 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -118,26 +118,18 @@ LINUX_MIMETYPE =\ $(ICONDIR)/org-altusmetrum-mimetypes.xml # Firmware -FIRMWARE_TD_0_2=$(top_srcdir)/src/teledongle-v0.2/teledongle-v0.2-$(VERSION).ihx FIRMWARE_TD_3_0=$(top_srcdir)/src/teledongle-v3.0/teledongle-v3.0-$(VERSION).ihx -FIRMWARE_TD=$(FIRMWARE_TD_0_2) $(FIRMWARE_TD_3_0) +FIRMWARE_TD=$(FIRMWARE_TD_3_0) -FIRMWARE_TM_1_0=$(top_srcdir)/src/telemetrum-v1.0/telemetrum-v1.0-$(VERSION).ihx -FIRMWARE_TM_1_1=$(top_srcdir)/src/telemetrum-v1.1/telemetrum-v1.1-$(VERSION).ihx -FIRMWARE_TM_1_2=$(top_srcdir)/src/telemetrum-v1.2/telemetrum-v1.2-$(VERSION).ihx FIRMWARE_TM_2_0=$(top_srcdir)/src/telemetrum-v2.0/telemetrum-v2.0-$(VERSION).ihx -#FIRMWARE_TM_3_0=$(top_srcdir)/src/telemetrum-v3.0/telemetrum-v3.0-$(VERSION).ihx -#FIRMWARE_TM=$(FIRMWARE_TM_1_0) $(FIRMWARE_TM_1_1) $(FIRMWARE_TM_1_2) $(FIRMWARE_TM_2_0) $(FIRMWARE_TM_3_0) -FIRMWARE_TM=$(FIRMWARE_TM_1_0) $(FIRMWARE_TM_1_1) $(FIRMWARE_TM_1_2) $(FIRMWARE_TM_2_0) +FIRMWARE_TM=$(FIRMWARE_TM_2_0) -FIRMWARE_TELEMINI_1_0=$(top_srcdir)/src/telemini-v1.0/telemini-v1.0-$(VERSION).ihx FIRMWARE_TELEMINI_3_0=$(top_srcdir)/src/telemini-v3.0/telemini-v3.0-$(VERSION).ihx -FIRMWARE_TELEMINI=$(FIRMWARE_TELEMINI_1_0) $(FIRMWARE_TELEMINI_3_0) +FIRMWARE_TELEMINI=$(FIRMWARE_TELEMINI_3_0) -FIRMWARE_TBT_1_0=$(top_srcdir)/src/telebt-v1.0/telebt-v1.0-$(VERSION).ihx FIRMWARE_TBT_3_0=$(top_srcdir)/src/telebt-v3.0/telebt-v3.0-$(VERSION).ihx FIRMWARE_TBT_4_0=$(top_srcdir)/src/telebt-v4.0/telebt-v4.0-$(VERSION).ihx -FIRMWARE_TBT=$(FIRMWARE_TBT_1_0) $(FIRMWARE_TBT_3_0) $(FIRMWARE_TBT_4_0) +FIRMWARE_TBT=$(FIRMWARE_TBT_3_0) $(FIRMWARE_TBT_4_0) FIRMWARE_TMEGA_1_0=$(top_srcdir)/src/telemega-v1.0/telemega-v1.0-$(VERSION).ihx FIRMWARE_TMEGA_2_0=$(top_srcdir)/src/telemega-v2.0/telemega-v2.0-$(VERSION).ihx diff --git a/altosui/altos-windows.nsi.in b/altosui/altos-windows.nsi.in index be9fb433..7aca30e2 100644 --- a/altosui/altos-windows.nsi.in +++ b/altosui/altos-windows.nsi.in @@ -120,18 +120,12 @@ Section "Firmware" SetOutPath $INSTDIR - File "../src/telemetrum-v1.0/telemetrum-v1.0-${VERSION}.ihx" - File "../src/telemetrum-v1.1/telemetrum-v1.1-${VERSION}.ihx" - File "../src/telemetrum-v1.2/telemetrum-v1.2-${VERSION}.ihx" File "../src/telemetrum-v2.0/telemetrum-v2.0-${VERSION}.ihx" ; File "../src/telemetrum-v3.0/telemetrum-v3.0-${VERSION}.ihx" - File "../src/telemini-v1.0/telemini-v1.0-${VERSION}.ihx" File "../src/telemini-v3.0/telemini-v3.0-${VERSION}.ihx" File "../src/telegps-v1.0/telegps-v1.0-${VERSION}.ihx" File "../src/telegps-v2.0/telegps-v2.0-${VERSION}.ihx" - File "../src/teledongle-v0.2/teledongle-v0.2-${VERSION}.ihx" File "../src/teledongle-v3.0/teledongle-v3.0-${VERSION}.ihx" - File "../src/telebt-v1.0/telebt-v1.0-${VERSION}.ihx" File "../src/telebt-v3.0/telebt-v3.0-${VERSION}.ihx" File "../src/telebt-v4.0/telebt-v4.0-${VERSION}.ihx" File "../src/telemega-v1.0/telemega-v1.0-${VERSION}.ihx" diff --git a/configure.ac b/configure.ac index 9dba0a5e..519f18f1 100644 --- a/configure.ac +++ b/configure.ac @@ -209,36 +209,6 @@ if test "x$GCC" = "xyes"; then fi AC_SUBST(WARN_CFLAGS) -# -# Configure SDCC -# - -AC_ARG_WITH([sdcc], - [AS_HELP_STRING([--with-sdcc], - [Name of SDCC])], - [], - [with_sdcc=auto]) - -if test "x$with_sdcc" != "xno"; then - if test "x$with_sdcc" = "xauto"; then - with_sdcc="sdcc" - AC_CHECK_PROG([HAVE_SDCC],[$with_sdcc], yes, no) - else - HAVE_SDCC=yes - fi -else - HAVE_SDCC=no -fi - -if test "x$HAVE_SDCC" = "xno"; then - AC_MSG_WARN([SDCC not found, cc1111 binaries will not be built]) -else - SDCC=$with_sdcc -fi - -AC_SUBST(SDCC) -AC_SUBST(HAVE_SDCC) - # # Configure ARM compiler for STM32L and LPC11U14 # @@ -587,8 +557,6 @@ echo " Configuration" echo " Arm compiler................: ${ARM_CC}" echo " STM32L support..............: ${HAVE_ARM_M3_CC}" echo " LPC11U14 support............: ${HAVE_ARM_M0_CC}" -echo " SDCC........................: ${SDCC}" -echo " CC1111 support..............: ${HAVE_SDCC}" echo " AVR compiler................: ${AVR_CC} ${AVR_OBJCOPY}" echo " AVR support.................: ${HAVE_AVR_CC}" echo " Android support.............: ${HAVE_ANDROID_SDK}" diff --git a/src/Makefile b/src/Makefile index a1ff84c2..3e00d70c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -16,14 +16,6 @@ include Version TOPDIR=. include Makedefs -SDCCDIRS=\ - telemetrum-v1.2 telemetrum-v1.1 telemetrum-v1.0 \ - teledongle-v0.2 \ - telemini-v1.0 \ - telebt-v1.0 \ - telefire-v0.1 telefire-v0.2 \ - telerepeat-v1.0 - ARMM3DIRS=\ easymega-v1.0 easymega-v1.0/flash-loader \ telemega-v0.1 telemega-v0.1/flash-loader \ @@ -59,15 +51,6 @@ AVRDIRS=\ SUBDIRS= -ifeq ($(strip $(HAVE_PDCLIB)),yes) -PDCLIB=pdclib -CLEAN_PDCLIB=clean-pdclib -endif - -ifeq ($(strip $(HAVE_SDCC)),yes) -SUBDIRS+=$(SDCCDIRS) -endif - ifeq ($(strip $(HAVE_ARM_M3_CC)),yes) SUBDIRS+=$(ARMM3DIRS) foo=bar @@ -82,7 +65,7 @@ ifeq ($(strip $(HAVE_AVR_CC)),yes) SUBDIRS += $(AVRDIRS) endif -ALLDIRS=$(SDCCDIRS) $(ARMM3DIRS) $(ARMM0DIRS) $(AVRDIRS) +ALLDIRS=$(ARMM3DIRS) $(ARMM0DIRS) $(AVRDIRS) all: all-local all-recursive diff --git a/src/cc1111/Makefile.cc1111 b/src/cc1111/Makefile.cc1111 deleted file mode 100644 index cb2d3db4..00000000 --- a/src/cc1111/Makefile.cc1111 +++ /dev/null @@ -1,39 +0,0 @@ -include ../Makedefs -CC=$(SDCC) - -CFLAGS=--model-small --debug --opt-code-speed -DCODESIZE=$(CODESIZE) -DCC1111 - -CFLAGS += $(PRODUCT_DEF) -I. -I.. -I../kernel -I../cc1111 -I../drivers -I../product - -CODESIZE ?= 0x8000 - -LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size $(CODESIZE) \ - --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff - -REL=$(SRC:.c=.rel) ao_product.rel -ADB=$(REL:.rel=.adb) -ASM=$(REL:.rel=.asm) -LNK=$(REL:.rel=.lnk) -LST=$(REL:.rel=.lst) -RST=$(REL:.rel=.rst) -SYM=$(REL:.rel=.sym) - -PCDB=$(PROG:.ihx=.cdb) -PLNK=$(PROG:.ihx=.lnk) -PMAP=$(PROG:.ihx=.map) -PMEM=$(PROG:.ihx=.mem) -PAOM=$(PROG:.ihx=) - -%.rel : %.c $(INC) - $(call quiet,CC,$(PRODUCT_DEF)) $(CFLAGS) -c -o$@ $< - -all: - -clean-cc1111: - rm -f *.adb *.asm *.lnk *.lst *.rel *.rst *.sym - rm -f $(PROGNAME)-* - rm -f ao_product.h - rm -f ../$(PROGNAME)-* - -../ao_kalman.h: - +(cd .. && make ao_kalman.h) diff --git a/src/cc1111/_bp.c b/src/cc1111/_bp.c deleted file mode 100644 index 6bf135bc..00000000 --- a/src/cc1111/_bp.c +++ /dev/null @@ -1,26 +0,0 @@ -/*------------------------------------------------------------------------- - - _bp.c :- just declares bp as a variable - - Written By - Sandeep Dutta . sandeep.dutta@usa.net (1999) - - This library is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - This library 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 Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this program; if not, write to the Free Software - Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - In other words, you are welcome to use, share and improve this program. - You are forbidden to forbid anyone else to use, share and improve - what you give them. Help stamp out software-hoarding! --------------------------------------------------------------------------*/ - -__data unsigned char bp ; diff --git a/src/cc1111/ao_adc.c b/src/cc1111/ao_adc.c deleted file mode 100644 index 94af5cda..00000000 --- a/src/cc1111/ao_adc.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * 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. - */ - -#include "ao.h" - -volatile __xdata struct ao_data ao_data_ring[AO_DATA_RING]; -volatile __data uint8_t ao_data_head; -#if (AO_DATA_ALL & ~(AO_DATA_ADC)) -volatile __data uint8_t ao_data_present; -#endif - -#ifdef TELENANO_V_0_1 -# define AO_ADC_FIRST_PIN 1 -#endif - -#if HAS_ACCEL_REF -# define AO_ADC_FIRST_PIN 2 -#endif - -#ifndef AO_ADC_FIRST_PIN -# define AO_ADC_FIRST_PIN 0 -#endif - -void -ao_adc_poll(void) -{ - ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | AO_ADC_FIRST_PIN; -} - -void -ao_data_get(__xdata struct ao_data *packet) -{ -#if HAS_FLIGHT - uint8_t i = ao_data_ring_prev(ao_sample_data); -#else - uint8_t i = ao_data_ring_prev(ao_data_head); -#endif - ao_xmemcpy(packet, (void __xdata *) &ao_data_ring[i], sizeof (struct ao_data)); -} - -void -ao_adc_isr(void) __interrupt 1 -{ - uint8_t sequence; - uint8_t __xdata *a; - - sequence = (ADCCON2 & ADCCON2_SCH_MASK) >> ADCCON2_SCH_SHIFT; -#if TELEMETRUM_V_0_1 || TELEMETRUM_V_0_2 || TELEMETRUM_V_1_0 || TELEMETRUM_V_1_1 || TELEMETRUM_V_1_2 || TELELAUNCH_V_0_1 || TELEBALLOON_V_1_1 - /* TeleMetrum readings */ -#if HAS_ACCEL_REF - if (sequence == 2) { - a = (uint8_t __xdata *) (&ao_data_ring[ao_data_head].adc.accel_ref); - sequence = 0; - } else -#endif - { - if (sequence == ADCCON3_ECH_TEMP) - sequence = 2; - a = (uint8_t __xdata *) (&ao_data_ring[ao_data_head].adc.accel + sequence); - sequence++; - } -#define GOT_ADC - a[0] = ADCL; - a[1] = ADCH; - if (sequence < 6) { -#if HAS_EXTERNAL_TEMP == 0 - /* start next channel conversion */ - /* v0.2 replaces external temp sensor with internal one */ - if (sequence == 2) - ADCCON3 = ADCCON3_EREF_1_25 | ADCCON3_EDIV_512 | ADCCON3_ECH_TEMP; - else -#endif - ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | sequence; - return; - } -#endif - -#if TELEMINI_V_1_0 || TELENANO_V_0_1 - /* TeleMini readings */ - a = (uint8_t __xdata *) (&ao_data_ring[ao_data_head].adc.pres); -#if TELEMINI_V_1_0 - switch (sequence) { - case 0: - /* pressure */ - a += 0; - sequence = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | 1; - break; - case 1: - /* drogue sense */ - a += 6; - sequence = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | 2; - break; - case 2: - /* main sense */ - a += 8; - sequence = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | 3; - break; - case 3: - /* battery */ - a += 4; - sequence = ADCCON3_EREF_1_25 | ADCCON3_EDIV_512 | ADCCON3_ECH_TEMP; - break; - case ADCCON3_ECH_TEMP: - a += 2; - sequence = 0; - break; - } -#define GOT_ADC -#endif -#ifdef TELENANO_V_0_1 - switch (sequence) { - case 1: - /* pressure */ - a += 0; - sequence = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | 3; - break; - case 3: - /* battery */ - a += 4; - sequence = ADCCON3_EREF_1_25 | ADCCON3_EDIV_512 | ADCCON3_ECH_TEMP; - break; - case ADCCON3_ECH_TEMP: - a += 2; - sequence = 0; - break; - } -#define GOT_ADC -#endif - a[0] = ADCL; - a[1] = ADCH; - if (sequence) { - /* Start next conversion */ - ADCCON3 = sequence; - return; - } -#endif /* telemini || telenano */ - -#if defined(TELEFIRE_V_0_1) || defined(TELEFIRE_V_0_2) - a = (uint8_t __xdata *) (&ao_data_ring[ao_data_head].adc.sense[0] + sequence - AO_ADC_FIRST_PIN); - a[0] = ADCL; - a[1] = ADCH; - if (sequence < 5) { - ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | (sequence + 1); - return; - } -#define GOT_ADC -#endif /* TELEFIRE_V_0_1 */ - -#ifdef TELEBT_V_1_0 - a = (uint8_t __xdata *) (&ao_data_ring[ao_data_head].adc.batt); - a[0] = ADCL; - a[1] = ADCH; -#define GOT_ADC -#endif - -#ifdef FETCH_ADC - FETCH_ADC(); -#define GOT_ADC -#endif - -#ifndef GOT_ADC -#error No known ADC configuration set -#endif - - /* record this conversion series */ - ao_data_ring[ao_data_head].tick = ao_time(); - ao_data_head = ao_data_ring_next(ao_data_head); - ao_wakeup(DATA_TO_XDATA(&ao_data_head)); -} - -static void -ao_adc_dump(void) __reentrant -{ - static __xdata struct ao_data packet; - ao_data_get(&packet); -#ifndef AO_ADC_DUMP - printf("tick: %5u accel: %5d pres: %5d temp: %5d batt: %5d drogue: %5d main: %5d\n", - packet.tick, packet.adc.accel, packet.adc.pres, packet.adc.temp, - packet.adc.v_batt, packet.adc.sense_d, packet.adc.sense_m); -#else - AO_ADC_DUMP(&packet); -#endif -} - -__code struct ao_cmds ao_adc_cmds[] = { - { ao_adc_dump, "a\0Current ADC" }, - { 0, NULL }, -}; - -void -ao_adc_init(void) -{ -#ifdef AO_ADC_PINS - ADCCFG = AO_ADC_PINS; - -#else - -#if IGNITE_ON_P2 - /* TeleMetrum configuration */ - ADCCFG = ((1 << 0) | /* acceleration */ - (1 << 1) | /* pressure */ -#if HAS_EXTERNAL_TEMP - (1 << 2) | /* v0.1 temperature */ -#endif - (1 << 3) | /* battery voltage */ - (1 << 4) | /* drogue sense */ - (1 << 5)); /* main sense */ -#endif - -#if IGNITE_ON_P0 - /* TeleMini configuration */ - ADCCFG = ((1 << 0) | /* pressure */ - (1 << 1) | /* drogue sense */ - (1 << 2) | /* main sense */ - (1 << 3)); /* battery voltage */ -#endif - -#endif /* else AO_ADC_PINS */ - - /* enable interrupts */ - ADCIF = 0; - IEN0 |= IEN0_ADCIE; - ao_cmd_register(&ao_adc_cmds[0]); -} diff --git a/src/cc1111/ao_aes.c b/src/cc1111/ao_aes.c deleted file mode 100644 index e845a928..00000000 --- a/src/cc1111/ao_aes.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" - -#if !HAS_AES -#error Must define HAS_AES 1 -#endif - -__xdata uint8_t ao_aes_mutex; -__xdata uint8_t ao_aes_done; -__xdata uint8_t ao_aes_dma_in, ao_aes_dma_out; -__xdata uint8_t ao_aes_dma_in_done, ao_aes_dma_out_done; -__pdata enum ao_aes_mode ao_aes_current_mode; - -void -ao_aes_isr(void) __interrupt 4 -{ - S0CON = 0; - if (ENCCCS & ENCCCS_RDY) { - ao_aes_done = 1; - ao_wakeup(&ao_aes_done); - } -} - -void -ao_aes_set_mode(enum ao_aes_mode mode) -{ - ao_aes_current_mode = mode; -} - -void -ao_aes_set_key(__xdata uint8_t *in) -{ - ao_dma_set_transfer(ao_aes_dma_in, - in, - &ENCDIXADDR, - AO_AES_LEN, - DMA_CFG0_WORDSIZE_8 | - DMA_CFG0_TMODE_SINGLE | - DMA_CFG0_TRIGGER_ENC_DW, - DMA_CFG1_SRCINC_1 | - DMA_CFG1_DESTINC_0 | - DMA_CFG1_PRIORITY_LOW); - ao_dma_start(ao_aes_dma_in); - ao_aes_done = 0; - ENCCCS = ENCCCS_MODE_CBC_MAC | - ENCCCS_CMD_LOAD_KEY; - ENCCCS |= ENCCCS_START; - __critical while (!ao_aes_done) - ao_sleep(&ao_aes_done); -} - -void -ao_aes_zero_iv(void) -{ - uint8_t b; - - ENCCCS = ENCCCS_MODE_CBC_MAC | ENCCCS_CMD_LOAD_IV | ENCCCS_START; - for (b = 0; b < AO_AES_LEN; b++) - ENCDI = 0; -} - -void -ao_aes_run(__xdata uint8_t *in, - __xdata uint8_t *out) -{ - uint8_t b; - if (in) { - ao_dma_set_transfer(ao_aes_dma_in, - in, - &ENCDIXADDR, - AO_AES_LEN, - DMA_CFG0_WORDSIZE_8 | - DMA_CFG0_TMODE_SINGLE | - DMA_CFG0_TRIGGER_ENC_DW, - DMA_CFG1_SRCINC_1 | - DMA_CFG1_DESTINC_0 | - DMA_CFG1_PRIORITY_LOW); - } - if (out) { - ao_dma_set_transfer(ao_aes_dma_out, - &ENCDOXADDR, - out, - AO_AES_LEN, - DMA_CFG0_WORDSIZE_8 | - DMA_CFG0_TMODE_SINGLE | - DMA_CFG0_TRIGGER_ENC_UP, - DMA_CFG1_SRCINC_0 | - DMA_CFG1_DESTINC_1 | - DMA_CFG1_PRIORITY_LOW); - } - switch (ao_aes_current_mode) { - case ao_aes_mode_cbc_mac: - if (out) - b = (ENCCCS_MODE_CBC | - ENCCCS_CMD_ENCRYPT); - else - b = (ENCCCS_MODE_CBC_MAC | - ENCCCS_CMD_ENCRYPT); - break; - default: - return; - } - ao_aes_done = 0; - if (in) - ao_dma_start(ao_aes_dma_in); - if (out) - ao_dma_start(ao_aes_dma_out); - ENCCCS = b; - ENCCCS |= ENCCCS_START; - if (out) { - __critical while (!ao_aes_dma_out_done) - ao_sleep(&ao_aes_dma_out_done); - } else { - __critical while (!ao_aes_done) - ao_sleep(&ao_aes_done); - } -} - -void -ao_aes_init(void) -{ -#if DMA_SHARE_AES_RADIO - ao_aes_dma_in = ao_radio_dma; -#else - ao_aes_dma_in = ao_dma_alloc(&ao_aes_dma_in_done); -#endif - ao_aes_dma_out = ao_dma_alloc(&ao_aes_dma_out_done); - S0CON = 0; - ENCIE = 1; -} diff --git a/src/cc1111/ao_arch.h b/src/cc1111/ao_arch.h deleted file mode 100644 index 937e6d0c..00000000 --- a/src/cc1111/ao_arch.h +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -/* - * CC1111 definitions and code fragments for AltOS - */ - -#ifndef _AO_ARCH_H_ -#define _AO_ARCH_H_ - -#include "cc1111.h" - -/* Convert a __data pointer into an __xdata pointer */ -#define DATA_TO_XDATA(a) ((void __xdata *) ((uint8_t) (a) | 0xff00)) - -/* Code and xdata use the same address space */ -#define CODE_TO_XDATA(a) ((__xdata void *) ((uint16_t) (a))) - -/* Pdata lives at the start of xdata */ -#define PDATA_TO_XDATA(a) ((void __xdata *) ((uint8_t) (a) | 0xf000)) - -/* Stack runs from above the allocated __data space to 0xfe, which avoids - * writing to 0xff as that triggers the stack overflow indicator - */ -#define AO_STACK_START 0x90 -#define AO_STACK_END 0xfe -#define AO_STACK_SIZE (AO_STACK_END - AO_STACK_START + 1) - -#define AO_PORT_TYPE uint8_t - -#define ao_arch_reboot() do { \ - WDCTL = WDCTL_EN | WDCTL_MODE_WATCHDOG | WDCTL_INT_64; \ - ao_delay(AO_SEC_TO_TICKS(2)); \ - } while (0) - -#define ao_arch_nop() __asm nop __endasm -#define ao_arch_interrupt(n) __interrupt n - -#define ao_arch_naked_declare __naked -#define ao_arch_naked_define __naked - -/* CC1111-specific drivers */ - -/* - * ao_romconfig.c - */ - -#define AO_ROMCONFIG_VERSION 2 - -#define AO_ROMCONFIG_SYMBOL(a) __code __at(a) - -extern AO_ROMCONFIG_SYMBOL(0x00a0) uint16_t ao_romconfig_version; -extern AO_ROMCONFIG_SYMBOL(0x00a2) uint16_t ao_romconfig_check; -extern AO_ROMCONFIG_SYMBOL(0x00a4) uint16_t ao_serial_number; -extern AO_ROMCONFIG_SYMBOL(0x00a6) uint32_t ao_radio_cal; - -#ifndef HAS_USB -#error Please define HAS_USB -#endif - -#define ao_arch_task_members\ - uint8_t stack_count; /* amount of saved stack */ - -/* Initialize stack */ -#define ao_arch_init_stack(task, start) { \ - uint8_t __xdata *stack = task->stack; \ - uint8_t t; \ - *stack++ = ((uint16_t) start); /* 0 */ \ - *stack++ = ((uint16_t) start) >> 8; /* 1 */ \ - \ - /* and the stuff saved by ao_switch */ \ - *stack++ = 0; /* 2 acc */ \ - *stack++ = 0x80; /* 3 IE */ \ - \ - /* 4 DPL \ - * 5 DPH \ - * 6 B \ - * 7 R2 \ - * 8 R3 \ - * 9 R4 \ - * 10 R5 \ - * 11 R6 \ - * 12 R7 \ - * 13 R0 \ - * 14 R1 \ - * 15 PSW \ - * 16 BP \ - */ \ - for (t = 0; t < 13; t++) \ - *stack++ = 0; \ - task->stack_count = 17; \ - } - - - -/* Save current context */ - -#define ao_arch_save_regs() \ - __asm \ - /* Push ACC first, as when restoring the context it must be restored \ - * last (it is used to set the IE register). */ \ - push ACC \ - push _IEN0 \ - push DPL \ - push DPH \ - push b \ - push ar2 \ - push ar3 \ - push ar4 \ - push ar5 \ - push ar6 \ - push ar7 \ - push ar0 \ - push ar1 \ - push PSW \ - __endasm; \ - PSW = 0; \ - __asm \ - push _bp \ - __endasm - -#define ao_arch_save_stack() { \ - uint8_t stack_len; \ - __data uint8_t *stack_ptr; \ - __xdata uint8_t *save_ptr; \ - /* Save the current stack */ \ - stack_len = SP - (AO_STACK_START - 1); \ - ao_cur_task->stack_count = stack_len; \ - stack_ptr = (uint8_t __data *) AO_STACK_START; \ - save_ptr = (uint8_t __xdata *) ao_cur_task->stack; \ - do \ - *save_ptr++ = *stack_ptr++; \ - while (--stack_len); \ - } - -/* Empty the stack; might as well let interrupts have the whole thing */ -#define ao_arch_isr_stack() (SP = AO_STACK_START - 1) - -#define ao_arch_block_interrupts() __asm clr _EA __endasm -#define ao_arch_release_interrupts() __asm setb _EA __endasm - -/* Idle the CPU, waking when an interrupt occurs */ -#define ao_arch_wait_interrupt() do { \ - ao_arch_release_interrupts(); \ - (PCON = PCON_IDLE); \ - ao_arch_block_interrupts(); \ - } while (0) - -#define ao_arch_restore_stack() { \ - uint8_t stack_len; \ - __data uint8_t *stack_ptr; \ - __xdata uint8_t *save_ptr; \ - \ - /* Restore the old stack */ \ - stack_len = ao_cur_task->stack_count; \ - SP = AO_STACK_START - 1 + stack_len; \ - \ - stack_ptr = (uint8_t __data *) AO_STACK_START; \ - save_ptr = (uint8_t __xdata *) ao_cur_task->stack; \ - do \ - *stack_ptr++ = *save_ptr++; \ - while (--stack_len); \ - \ - __asm \ - pop _bp \ - pop PSW \ - pop ar1 \ - pop ar0 \ - pop ar7 \ - pop ar6 \ - pop ar5 \ - pop ar4 \ - pop ar3 \ - pop ar2 \ - pop b \ - pop DPH \ - pop DPL \ - /* The next byte of the stack is the IE register. Only the global \ - enable bit forms part of the task context. Pop off the IE then set \ - the global enable bit to match that of the stored IE register. */ \ - pop ACC \ - JB ACC.7,0098$ \ - CLR _EA \ - LJMP 0099$ \ - 0098$: \ - SETB _EA \ - 0099$: \ - /* Finally restore ACC, which was the first register saved. */ \ - pop ACC \ - ret \ - __endasm; \ -} - -#define ao_arch_critical(b) __critical { b } - -#define AO_DATA_RING 32 - -/* ao_button.c */ -#ifdef HAS_BUTTON -void -ao_p0_isr(void) ao_arch_interrupt(13); - -void -ao_p1_isr(void) ao_arch_interrupt(15); - -void -ao_p2_isr(void); - -#define HAS_P2_ISR 1 - -#endif - -void -ao_button_init(void); - -char -ao_button_get(uint16_t timeout) __critical; - -void -ao_button_clear(void) __critical; - -/* console I/O funcs */ -#define ao_getchar getchar -#define ao_putchar putchar - -/* ao_string.c */ - -void -_ao_xmemcpy(__xdata void *dst, __xdata void *src, uint16_t count); - -#define ao_xmemcpy(d,s,c) _ao_xmemcpy(d,s,c) - -void -_ao_xmemset(__xdata void *dst, uint8_t value, uint16_t count); - -#define ao_xmemset(d,v,c) _ao_xmemset(d,v,c) - -int8_t -_ao_xmemcmp(__xdata void *a, __xdata void *b, uint16_t count); - -#define ao_xmemcmp(d,s,c) _ao_xmemcmp((d), (s), (c)) - -struct ao_serial_speed { - uint8_t baud; - uint8_t gcr; -}; - -extern const __code struct ao_serial_speed ao_serial_speeds[]; - -/* - * ao_dma.c - */ - -/* Allocate a DMA channel. the 'done' parameter will be set when the - * dma is finished and will be used to wakeup any waiters - */ - -uint8_t -ao_dma_alloc(__xdata uint8_t * done); - -/* Setup a DMA channel */ -void -ao_dma_set_transfer(uint8_t id, - void __xdata *srcaddr, - void __xdata *dstaddr, - uint16_t count, - uint8_t cfg0, - uint8_t cfg1); - -/* Start a DMA channel */ -void -ao_dma_start(uint8_t id); - -/* Manually trigger a DMA channel */ -void -ao_dma_trigger(uint8_t id); - -/* Abort a running DMA transfer */ -void -ao_dma_abort(uint8_t id); - -/* DMA interrupt routine */ -void -ao_dma_isr(void) ao_arch_interrupt(8); - -/* ao_adc.c */ - -#if HAS_ADC -/* The A/D interrupt handler */ -void -ao_adc_isr(void) ao_arch_interrupt(1); -#endif - -#if HAS_USB -/* USB interrupt handler */ -void -ao_usb_isr(void) ao_arch_interrupt(6); -#endif - -#if HAS_SERIAL_0 -void -ao_serial0_rx_isr(void) ao_arch_interrupt(2); - -void -ao_serial0_tx_isr(void) ao_arch_interrupt(7); -#endif - -#if HAS_SERIAL_1 -void -ao_serial1_rx_isr(void) ao_arch_interrupt(3); - -void -ao_serial1_tx_isr(void) ao_arch_interrupt(14); -#endif - -#if HAS_EXTI_0 -void -ao_p0_isr(void) __interrupt(13); -#endif - -#define AO_ADC_MAX 32767 - -#endif /* _AO_ARCH_H_ */ diff --git a/src/cc1111/ao_arch_funcs.h b/src/cc1111/ao_arch_funcs.h deleted file mode 100644 index d849655b..00000000 --- a/src/cc1111/ao_arch_funcs.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -/* - * ao_spi.c - */ - -#if !HAS_SPI_0 && !HAS_SPI_1 -#define HAS_SPI_0 1 -#define SPI_0_ALT_2 1 -#endif - -#if HAS_SPI_0 && HAS_SPI_1 -#define MULTI_SPI 1 -#define N_SPI 2 -#else -#define MULTI_SPI 0 -#define N_SPI 1 -#endif - -extern __xdata uint8_t ao_spi_mutex[N_SPI]; - -#if MULTI_SPI -#define ao_spi_get(bus) ao_mutex_get(&ao_spi_mutex[bus]) -#define ao_spi_put(bus) ao_mutex_put(&ao_spi_mutex[bus]) -#else -#define ao_spi_get(bus) ao_mutex_get(&ao_spi_mutex[0]) -#define ao_spi_put(bus) ao_mutex_put(&ao_spi_mutex[0]) -#endif - -#define AO_SPI_SPEED_FAST 17 -#define AO_SPI_SPEED_200kHz 13 - -#if MULTI_SPI -#define ao_spi_set_speed(bus,speed) (*(bus ? &U1GCR : &U0GCR) =(UxGCR_CPOL_NEGATIVE | \ - UxGCR_CPHA_FIRST_EDGE | \ - UxGCR_ORDER_MSB | \ - ((speed) << UxGCR_BAUD_E_SHIFT))) -#else -#define ao_spi_set_speed(bus,speed) (U0GCR = (UxGCR_CPOL_NEGATIVE | \ - UxGCR_CPHA_FIRST_EDGE | \ - UxGCR_ORDER_MSB | \ - ((speed) << UxGCR_BAUD_E_SHIFT))) -#endif - -#define ao_spi_get_slave(bus) do { \ - ao_spi_get(bus); \ - ao_spi_set_speed(bus,AO_SPI_SPEED_FAST); \ - } while (0) - -#define ao_spi_put_slave(bus) do { \ - ao_spi_put(bus); \ - } while (0) - -#define ao_spi_get_mask(reg,mask,bus,speed) do { \ - ao_spi_get(bus); \ - ao_spi_set_speed(bus,speed); \ - (reg) &= ~(mask); \ - } while (0) - -#define ao_spi_put_mask(reg,mask,bus) do { \ - (reg) |= (mask); \ - ao_spi_put(bus); \ - } while (0) - - -#define ao_spi_get_bit(reg,bit,pin,bus,speed) do { \ - ao_spi_get(bus); \ - ao_spi_set_speed(bus,speed); \ - pin = 0; \ - } while (0) - -#define ao_spi_put_bit(reg,bit,pin,bus) do { \ - pin = 1; \ - ao_spi_put(bus); \ - } while (0) - - -/* - * The SPI mutex must be held to call either of these - * functions -- this mutex covers the entire SPI operation, - * from chip select low to chip select high - */ - -#if MULTI_SPI -void -ao_spi_send(void __xdata *block, uint16_t len, uint8_t bus) __reentrant; - -void -ao_spi_recv(void __xdata *block, uint16_t len, uint8_t bus) __reentrant; -#else -void -ao_spi_send_bus(void __xdata *block, uint16_t len) __reentrant; - -void -ao_spi_recv_bus(void __xdata *block, uint16_t len) __reentrant; - -#define ao_spi_send(block, len, bus) ao_spi_send_bus(block, len) -#define ao_spi_recv(block, len, bus) ao_spi_recv_bus(block, len) -#endif - -#if AO_SPI_SLAVE -void -ao_spi_send_wait(void); - -void -ao_spi_recv_wait(void); -#endif - -void -ao_spi_init(void); - -#define token_paster(x,y) x ## y -#define token_paster3(x,y,z) x ## y ## z -#define token_evaluator(x,y) token_paster(x,y) -#define token_evaluator3(x,y,z) token_paster3(x,y,z) - -#define ao_spi_init_cs(port, mask) do { \ - port |= mask; \ - token_evaluator(port,DIR) |= mask; \ - token_evaluator(port,SEL) &= ~mask; \ - } while (0) - -#define cc1111_enable_output(port,dir,sel,pin,bit,v) do { \ - pin = v; \ - dir |= (1 << bit); \ - sel &= ~(1 << bit); \ - } while (0) - -#define disable_unreachable _Pragma("disable_warning 126") - -#define ao_enable_output(port,bit,pin,v) cc1111_enable_output(port,token_evaluator(port,DIR), token_evaluator(port,SEL), pin, bit, v) -#define ao_gpio_set(port, bit, pin, v) ((pin) = (v)) -#define ao_gpio_get(port, bit, pin) (pin) -#define ao_gpio_get_bits(port) (port) -#define ao_gpio_set_bits(port, bits) ((port) |= bits) -#define ao_gpio_clr_bits(port, bits) ((port) &= ~bits) diff --git a/src/cc1111/ao_battery.c b/src/cc1111/ao_battery.c deleted file mode 100644 index 9fb4c26b..00000000 --- a/src/cc1111/ao_battery.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" -static __data union { - uint8_t d[2]; - int16_t v; -} ao_battery_value; - -void -ao_battery_isr(void) ao_arch_interrupt(1) -{ - ao_battery_value.d[0] = ADCL; - ao_battery_value.d[1] = ADCH; - ao_wakeup(DATA_TO_XDATA(&ao_battery_value)); -} - -uint16_t -ao_battery_get(void) -{ - ao_arch_critical( - ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | BATTERY_PIN; - ao_sleep(DATA_TO_XDATA(&ao_battery_value)); - ); - return (uint16_t) ((int32_t) ao_battery_value.v * (int32_t) 4950 >> 15); -} - -static void -ao_battery_show(void) -{ - printf("Battery: %u mV\n", ao_battery_get()); -} - -__code struct ao_cmds ao_battery_cmds[] = { - { ao_battery_show, "B\0Show battery voltage" }, - { 0, NULL }, -}; - -void -ao_battery_init(void) -{ - ADCCFG = (1 << BATTERY_PIN); - ADCIF = 0; - IEN0 |= IEN0_ADCIE; - ao_cmd_register(&ao_battery_cmds[0]); -} diff --git a/src/cc1111/ao_beep.c b/src/cc1111/ao_beep.c deleted file mode 100644 index 04d10485..00000000 --- a/src/cc1111/ao_beep.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * 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. - */ - -#include "ao.h" - -void -ao_beep(uint8_t beep) -{ - if (beep == 0) { - P2_0 = 0; - P2SEL = (P2SEL & ~P2SEL_SELP2_0_MASK) | P2SEL_SELP2_0_GPIO; - T4CTL = 0; - } else { - P2SEL = (P2SEL & ~P2SEL_SELP2_0_MASK) | P2SEL_SELP2_0_PERIPHERAL; - T4CC0 = beep; - T4CTL = TxCTL_DIV_32 | TxCTL_MODE_MODULO | TxCTL_START; - } -} - -void -ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant -{ - ao_beep(beep); - ao_delay(ticks); - ao_beep(0); -} - -void -ao_beep_init(void) -{ - /* Our beeper is on P2_0, which is hooked to timer 4 using - * configuration alternative 2 - */ - P2_0 = 0; - P2SEL = (P2SEL & ~P2SEL_SELP2_0_MASK) | P2SEL_SELP2_0_GPIO; - PERCFG = (PERCFG & ~PERCFG_T4CFG_ALT_MASK) | PERCFG_T4CFG_ALT_2; - T4CCTL0 = TxCCTLy_CMP_TOGGLE|TxCCTLy_CMP_MODE_ENABLE; -} diff --git a/src/cc1111/ao_button.c b/src/cc1111/ao_button.c deleted file mode 100644 index 0496a32f..00000000 --- a/src/cc1111/ao_button.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" - -volatile __xdata struct ao_fifo ao_button_fifo; - -static __code struct { - uint8_t mask; - uint8_t reg; -} ao_buttons[] = { -#ifdef BUTTON_1_MASK - { BUTTON_1_MASK, BUTTON_1_REG }, -#endif -#ifdef BUTTON_2_MASK - { BUTTON_2_MASK, BUTTON_2_REG }, -#endif -#ifdef BUTTON_3_MASK - { BUTTON_3_MASK, BUTTON_3_REG }, -#endif -}; - -#define NUM_BUTTONS ((sizeof ao_buttons) / sizeof (ao_buttons[0])) - -static __xdata uint16_t ao_button_tick[NUM_BUTTONS]; - -static void -ao_button_insert(char n) -{ - uint16_t now = ao_time(); - if ((now - ao_button_tick[n]) > 20) { - ao_button_tick[n] = now; - ao_fifo_insert(ao_button_fifo, n); - ao_wakeup(&ao_button_fifo); - } -} - -static void -ao_button_isr(uint8_t flag, uint8_t reg) -{ - uint8_t b; - - for (b = 0; b < NUM_BUTTONS; b++) - if (ao_buttons[b].reg == reg && (ao_buttons[b].mask & flag)) - ao_button_insert(b + 1); -} - -static uint8_t -ao_button_mask(uint8_t reg) -{ - uint8_t b; - uint8_t mask = 0; - - for (b = 0; b < NUM_BUTTONS; b++) - if (ao_buttons[b].reg == reg) - mask |= ao_buttons[b].mask; - return mask; -} - -char -ao_button_get(uint16_t timeout) __critical -{ - char b; - - while (ao_fifo_empty(ao_button_fifo)) - if (ao_sleep_for(&ao_button_fifo, timeout)) - return 0; - ao_fifo_remove(ao_button_fifo, b); - return b; -} - -void -ao_button_clear(void) __critical -{ - char b; - - while (!ao_fifo_empty(ao_button_fifo)) - ao_fifo_remove(ao_button_fifo, b); -} - -void -ao_p0_isr(void) ao_arch_interrupt(13) -{ - P0IF = 0; - ao_button_isr(P0IFG, 0); - P0IFG = 0; -} - -void -ao_p1_isr(void) ao_arch_interrupt(15) -{ - P1IF = 0; - ao_button_isr(P1IFG, 1); - P1IFG = 0; -} - -/* Shared with USB */ -void -ao_p2_isr(void) -{ - ao_button_isr(P2IFG, 2); - P2IFG = 0; -} - -void -ao_button_init(void) -{ - uint8_t mask; - - /* Pins are configured as inputs with pull-up by default */ - - /* Enable interrupts for P0 inputs */ - mask = ao_button_mask(0); - if (mask) { - if (mask & 0x0f) - PICTL |= PICTL_P0IENL; - if (mask & 0xf0) - PICTL |= PICTL_P0IENH; - P0IFG = 0; - P0IF = 0; - IEN1 |= IEN1_P0IE; - PICTL |= PICTL_P0ICON; - } - - /* Enable interrupts for P1 inputs */ - mask = ao_button_mask(1); - if (mask) { - P1IEN |= mask; - P1IFG = 0; - P1IF = 0; - IEN2 |= IEN2_P1IE; - PICTL |= PICTL_P1ICON; - } - - /* Enable interrupts for P2 inputs */ - mask = ao_button_mask(2); - if (mask) { - PICTL |= PICTL_P2IEN; - P2IFG = 0; - P2IF = 0; - IEN2 |= IEN2_P2IE; - PICTL |= PICTL_P2ICON; - } -} diff --git a/src/cc1111/ao_dbg.c b/src/cc1111/ao_dbg.c deleted file mode 100644 index ca751b88..00000000 --- a/src/cc1111/ao_dbg.c +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * 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. - */ - -#include "ao.h" -#include "ao_pins.h" - -static void -ao_dbg_send_bits(uint8_t msk, uint8_t val) __reentrant -{ - DBG_PORT = (DBG_PORT & ~msk) | (val & msk); - __asm - nop - nop - __endasm; -} - -void -ao_dbg_send_byte(uint8_t byte) -{ - __pdata uint8_t b, d; - - DBG_PORT |= DBG_DATA; - DBG_PORT_DIR |= DBG_DATA; - for (b = 0; b < 8; b++) { - d = 0; - if (byte & 0x80) - d = DBG_DATA; - byte <<= 1; - ao_dbg_send_bits(DBG_CLOCK|DBG_DATA, DBG_CLOCK|d); - ao_dbg_send_bits(DBG_CLOCK|DBG_DATA, 0 |d); - } - DBG_PORT_DIR &= ~DBG_DATA; -} - -uint8_t -ao_dbg_recv_byte(void) -{ - __pdata uint8_t byte, b; - - byte = 0; - for (b = 0; b < 8; b++) { - byte = byte << 1; - ao_dbg_send_bits(DBG_CLOCK, DBG_CLOCK); - if (DBG_DATA_PIN) - byte |= 1; - ao_dbg_send_bits(DBG_CLOCK, 0); - } - return byte; -} - -/* 8051 instructions - */ -#define NOP 0x00 -#define MOV_direct_data 0x75 -#define LJMP 0x02 -#define MOV_Rn_data(n) (0x78 | (n)) -#define DJNZ_Rn_rel(n) (0xd8 | (n)) -#define MOV_A_direct 0xe5 -#define MOV_direct1_direct2 0x85 -#define MOV_direct_A 0xf5 -#define MOV_DPTR_data16 0x90 -#define MOV_A_data 0x74 -#define MOVX_atDPTR_A 0xf0 -#define MOVX_A_atDPTR 0xe0 -#define INC_DPTR 0xa3 -#define TRAP 0xa5 -#define SJMP 0x80 -#define JB 0x20 - -#define DEBUG_INSTR(l) (0x54 | (l)) - -#define SFR_PSW 0xD0 -#define SFR_DPL0 0x82 -#define SFR_DPH0 0x83 -#define SFR_DPL1 0x84 -#define SFR_DPH1 0x85 - -__pdata uint8_t save_acc; -__pdata uint8_t save_psw; -__pdata uint8_t save_dpl0; -__pdata uint8_t save_dph0; -__pdata uint8_t save_dpl1; -__pdata uint8_t save_dph1; - -static uint8_t -ao_dbg_inst1(uint8_t a) __reentrant -{ - ao_dbg_send_byte(DEBUG_INSTR(1)); - ao_dbg_send_byte(a); - return ao_dbg_recv_byte(); -} - -static uint8_t -ao_dbg_inst2(uint8_t a, uint8_t b) __reentrant -{ - ao_dbg_send_byte(DEBUG_INSTR(2)); - ao_dbg_send_byte(a); - ao_dbg_send_byte(b); - return ao_dbg_recv_byte(); -} - -static uint8_t -ao_dbg_inst3(uint8_t a, uint8_t b, uint8_t c) __reentrant -{ - ao_dbg_send_byte(DEBUG_INSTR(3)); - ao_dbg_send_byte(a); - ao_dbg_send_byte(b); - ao_dbg_send_byte(c); - return ao_dbg_recv_byte(); -} - -void -ao_dbg_start_transfer(uint16_t addr) -{ - save_acc = ao_dbg_inst1(NOP); - save_psw = ao_dbg_inst2(MOV_A_direct, SFR_PSW); - save_dpl0 = ao_dbg_inst2(MOV_A_direct, SFR_DPL0); - save_dph0 = ao_dbg_inst2(MOV_A_direct, SFR_DPH0); - save_dpl1 = ao_dbg_inst2(MOV_A_direct, SFR_DPL1); - save_dph1 = ao_dbg_inst2(MOV_A_direct, SFR_DPH1); - ao_dbg_inst3(MOV_DPTR_data16, addr >> 8, addr); -} - -void -ao_dbg_end_transfer(void) -{ - ao_dbg_inst3(MOV_direct_data, SFR_DPL0, save_dpl0); - ao_dbg_inst3(MOV_direct_data, SFR_DPH0, save_dph0); - ao_dbg_inst3(MOV_direct_data, SFR_DPL1, save_dpl1); - ao_dbg_inst3(MOV_direct_data, SFR_DPH1, save_dph1); - ao_dbg_inst3(MOV_direct_data, SFR_PSW, save_psw); - ao_dbg_inst2(MOV_A_data, save_acc); -} - -void -ao_dbg_write_byte(uint8_t byte) -{ - ao_dbg_inst2(MOV_A_data, byte); - ao_dbg_inst1(MOVX_atDPTR_A); - ao_dbg_inst1(INC_DPTR); -} - -uint8_t -ao_dbg_read_byte(void) -{ - ao_dbg_inst1(MOVX_A_atDPTR); - return ao_dbg_inst1(INC_DPTR); -} - -static void -ao_dbg_set_pins(void) -{ - /* Make the DBG pins GPIOs. On TeleMetrum, this will - * disable the SPI link, so don't expect SPI to work after - * using the debugger. - */ - DBG_PORT_SEL &= ~(DBG_CLOCK|DBG_DATA|DBG_RESET_N); - - /* make DBG_DATA tri-state */ - DBG_PORT_INP |= DBG_DATA; - - /* Raise RESET_N and CLOCK */ - DBG_PORT |= DBG_RESET_N | DBG_CLOCK; - - /* RESET_N and CLOCK are outputs now */ - DBG_PORT_DIR |= DBG_RESET_N | DBG_CLOCK; - DBG_PORT_DIR &= ~DBG_DATA; -} - -static void -ao_dbg_long_delay(void) -{ - uint8_t n; - - for (n = 0; n < 20; n++) - __asm nop __endasm; -} - -#define AO_RESET_LOW_DELAY AO_MS_TO_TICKS(100) -#define AO_RESET_HIGH_DELAY AO_MS_TO_TICKS(100) - -static void -ao_dbg_send_bits_delay(uint8_t msk, uint8_t val) -{ - ao_dbg_long_delay(); - ao_dbg_send_bits(msk, val); -} - -void -ao_dbg_do_reset(uint8_t clock_up) -{ - ao_dbg_set_pins(); - ao_dbg_send_bits_delay(DBG_CLOCK|DBG_DATA|DBG_RESET_N, DBG_CLOCK|DBG_DATA|DBG_RESET_N); - ao_dbg_send_bits_delay(DBG_CLOCK|DBG_DATA|DBG_RESET_N, clock_up |DBG_DATA| 0 ); - ao_delay(AO_RESET_LOW_DELAY); - ao_dbg_send_bits (DBG_CLOCK|DBG_DATA|DBG_RESET_N, DBG_CLOCK|DBG_DATA| 0 ); - ao_dbg_send_bits_delay(DBG_CLOCK|DBG_DATA|DBG_RESET_N, clock_up |DBG_DATA| 0 ); - ao_dbg_send_bits_delay(DBG_CLOCK|DBG_DATA|DBG_RESET_N, DBG_CLOCK|DBG_DATA| 0 ); - ao_dbg_send_bits_delay(DBG_CLOCK|DBG_DATA|DBG_RESET_N, clock_up |DBG_DATA|DBG_RESET_N); - ao_delay(AO_RESET_HIGH_DELAY); -} - -static void -debug_enable(void) -{ - /* toggle clock line while holding reset low */ - ao_dbg_do_reset(0); -} - -static void -debug_reset(void) -{ - /* hold clock high while holding reset low */ - ao_dbg_do_reset(DBG_CLOCK); -} - -static void -debug_put(void) -{ - for (;;) { - ao_cmd_white (); - if (ao_cmd_lex_c == '\n') - break; - ao_cmd_hex(); - if (ao_cmd_status != ao_cmd_success) - break; - ao_dbg_send_byte(ao_cmd_lex_i); - } -} - -static void -debug_get(void) -{ - __pdata uint16_t count; - __pdata uint16_t i; - __pdata uint8_t byte; - ao_cmd_hex(); - if (ao_cmd_status != ao_cmd_success) - return; - count = ao_cmd_lex_i; - if (count > 256) { - ao_cmd_status = ao_cmd_syntax_error; - return; - } - for (i = 0; i < count; i++) { - if (i && (i & 7) == 0) - putchar('\n'); - byte = ao_dbg_recv_byte(); - ao_cmd_put8(byte); - putchar(' '); - } - putchar('\n'); -} - -static void -debug_input(void) -{ - __pdata uint16_t count; - __pdata uint16_t addr; - __pdata uint8_t b; - __pdata uint8_t i; - - ao_cmd_hex(); - count = ao_cmd_lex_i; - ao_cmd_hex(); - addr = ao_cmd_lex_i; - if (ao_cmd_status != ao_cmd_success) - return; - ao_dbg_start_transfer(addr); - i = 0; - while (count--) { - if (!(i++ & 7)) - putchar('\n'); - b = ao_dbg_read_byte(); - ao_cmd_put8(b); - } - ao_dbg_end_transfer(); - putchar('\n'); -} - -static void -debug_output(void) -{ - __pdata uint16_t count; - __pdata uint16_t addr; - __pdata uint8_t b; - - ao_cmd_hex(); - count = ao_cmd_lex_i; - ao_cmd_hex(); - addr = ao_cmd_lex_i; - if (ao_cmd_status != ao_cmd_success) - return; - ao_dbg_start_transfer(addr); - while (count--) { - b = ao_getnibble() << 4; - b |= ao_getnibble(); - if (ao_cmd_status != ao_cmd_success) - return; - ao_dbg_write_byte(b); - } - ao_dbg_end_transfer(); -} - -__code struct ao_cmds ao_dbg_cmds[7] = { - { debug_enable, "D\0Enable debug" }, - { debug_get, "G \0Get data" }, - { debug_input, "I \0Input at " }, - { debug_output, "O \0Output at " }, - { debug_put, "P ...\0Put data" }, - { debug_reset, "R\0Reset" }, - { 0, NULL }, -}; - -void -ao_dbg_init(void) -{ - ao_cmd_register(&ao_dbg_cmds[0]); -} diff --git a/src/cc1111/ao_dma.c b/src/cc1111/ao_dma.c deleted file mode 100644 index 18266518..00000000 --- a/src/cc1111/ao_dma.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * 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. - */ - -#include "ao.h" - -#define NUM_DMA 5 - -/* - * The config address for DMA0 is programmed - * separately from that of DMA1-4, but for simplicity, - * we make them all contiguous. - */ - -static __xdata struct cc_dma_channel ao_dma_config[NUM_DMA]; -static __xdata uint8_t * __xdata ao_dma_done[NUM_DMA]; -static __data uint8_t ao_next_dma; - -uint8_t -ao_dma_alloc(__xdata uint8_t *done) -{ - uint8_t id; - - if (ao_next_dma == NUM_DMA) - ao_panic(AO_PANIC_DMA); - id = ao_next_dma++; - ao_dma_done[id] = done; - - /* When the first dma object is allocated, set up the DMA - * controller - */ - if (id == 0) { - DMAIRQ = 0; - DMAIF = 0; - IEN1 |= IEN1_DMAIE; - DMA0CFGH = ((uint16_t) (&ao_dma_config[0])) >> 8; - DMA0CFGL = ((uint16_t) (&ao_dma_config[0])); - DMA1CFGH = ((uint16_t) (&ao_dma_config[1])) >> 8; - DMA1CFGL = ((uint16_t) (&ao_dma_config[1])); - } - - return id; -} - -void -ao_dma_set_transfer(uint8_t id, - void __xdata *srcaddr, - void __xdata *dstaddr, - uint16_t count, - uint8_t cfg0, - uint8_t cfg1) -{ - if (DMAARM & (1 << id)) - ao_panic(AO_PANIC_DMA); - ao_dma_config[id].src_high = ((uint16_t) srcaddr) >> 8; - ao_dma_config[id].src_low = ((uint16_t) srcaddr); - ao_dma_config[id].dst_high = ((uint16_t) dstaddr) >> 8; - ao_dma_config[id].dst_low = ((uint16_t) dstaddr); - ao_dma_config[id].len_high = count >> 8; - ao_dma_config[id].len_low = count; - ao_dma_config[id].cfg0 = cfg0; - ao_dma_config[id].cfg1 = cfg1 | DMA_CFG1_IRQMASK; -} - -#define nop() __asm nop __endasm; - -void -ao_dma_start(uint8_t id) -{ - uint8_t mask = (1 << id); - DMAIRQ &= ~mask; - if (DMAARM & mask) { - DMAARM = 0x80 | mask; - nop(); nop(); nop(); nop(); - nop(); nop(); nop(); nop(); - } - *(ao_dma_done[id]) = 0; - DMAARM = mask; - nop(); nop(); nop(); nop(); - nop(); nop(); nop(); nop(); - nop(); -} - -void -ao_dma_trigger(uint8_t id) -{ - DMAREQ |= (1 << id); -} - -void -ao_dma_abort(uint8_t id) -{ - uint8_t mask = (1 << id); - DMAARM = 0x80 | mask; - DMAIRQ &= ~mask; -} - -void -ao_dma_isr(void) __interrupt 8 -{ - uint8_t id, mask; - - /* Find the first DMA channel which is done */ - mask = 1; - for (id = 0; id < ao_next_dma; id++) { - if (DMAIRQ & mask) { - /* Clear CPU interrupt flag */ - DMAIF = 0; - /* Clear the completed ID */ - DMAIRQ = ~mask; - *(ao_dma_done[id]) = 1; - ao_wakeup(ao_dma_done[id]); - break; - } - mask <<= 1; - } -} diff --git a/src/cc1111/ao_exti.c b/src/cc1111/ao_exti.c deleted file mode 100644 index e21e417c..00000000 --- a/src/cc1111/ao_exti.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#include -#include - -#if HAS_EXTI_0 -__xdata void (*ao_int_callback)(void); - -void -ao_p0_isr(void) __interrupt(13) -{ - if (P0IF && (P0IFG & (AO_MS5607_MISO_MASK))) { - (*ao_int_callback)(); - } - P0IFG = 0; - P0IF = 0; -} -#endif diff --git a/src/cc1111/ao_exti.h b/src/cc1111/ao_exti.h deleted file mode 100644 index 927a4f09..00000000 --- a/src/cc1111/ao_exti.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#ifndef _AO_EXTI_H_ -#define _AO_EXTI_H_ - -#define AO_EXTI_MODE_RISING 1 -#define AO_EXTI_MODE_FALLING 2 -#define AO_EXTI_MODE_PULL_UP 4 -#define AO_EXTI_MODE_PULL_DOWN 8 -#define AO_EXTI_PRIORITY_LOW 16 -#define AO_EXTI_PRIORITY_MED 0 -#define AO_EXTI_PRIORITY_HIGH 32 - -extern void (*ao_int_callback)(void); - -#define ao_exti_setup(gpio, pin, mode, callback) do { \ - ao_int_callback = callback; \ - } while (0) - -#define ao_exti_set_mode(gpio, pin, mode) do { \ - } while (0) - -#define ao_exti_set_callback(port, pin, callback) do { \ - ao_int_callback = callback; \ - } while (0) - -#define ao_exti_init() - -#define ao_exti_enable(port, pin) do { \ - P0IFG &= ~(1 << pin); \ - P0IF = 0; \ - PICTL |= PICTL_P0IENL; \ - IEN1 |= IEN1_P0IE; \ - } while (0) - -#define ao_exti_disable(port, pin) do { \ - IEN1 &= ~IEN1_P0IE; \ - PICTL &= ~PICTL_P0IENL; \ - } while (0) - -#endif /* _AO_EXTI_H_ */ diff --git a/src/cc1111/ao_intflash.c b/src/cc1111/ao_intflash.c deleted file mode 100644 index 154b3c25..00000000 --- a/src/cc1111/ao_intflash.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright © 2011 Anthony Towns - * - * 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. - */ - -#include "ao.h" -#include "cc1111.h" - -#define ENDOFCODE (CODESIZE) -#define AO_INTFLASH_BLOCK 1024 -#define AO_INTFLASH_BLOCKS ((0x8000 - ENDOFCODE)/AO_INTFLASH_BLOCK) -#define AO_INTFLASH_SIZE (AO_INTFLASH_BLOCK * AO_INTFLASH_BLOCKS) -#define AO_INTFLASH_LOCATION (0x8000 - AO_INTFLASH_SIZE) - -/* - * 21000 * 24e6 - * FWT = ------------ - * 16e9 - * - * = 31.5 - * - * Round up and use 32 - */ - -#define FLASH_TIMING 0x20 - -#if AO_INTFLASH_BLOCKS < 2 -#error "Too few pages" -#endif - -#if AO_INFTLASH_LOCATION % 1024 != 0 -#error "Pages aren't aligned properly" -#endif - -__xdata __at(AO_INTFLASH_LOCATION) uint8_t ao_intflash[AO_INTFLASH_SIZE]; - -/* Total bytes of available storage */ -__pdata uint32_t ao_storage_total = sizeof(ao_intflash); - -/* Block size - device is erased in these units. */ -__pdata uint32_t ao_storage_block = AO_INTFLASH_BLOCK; - -/* Byte offset of config block. Will be ao_storage_block bytes long */ -__pdata uint32_t ao_storage_config = sizeof(ao_intflash) - AO_INTFLASH_BLOCK; - -/* Storage unit size - device reads and writes must be within blocks of this size. */ -__pdata uint16_t ao_storage_unit = AO_INTFLASH_BLOCK; - -__xdata static uint8_t ao_intflash_dma_done; -static uint8_t ao_intflash_dma; - -/* - * The internal flash chip is arranged in 1kB sectors; the - * chip cannot erase in units smaller than that. - * - * Writing happens in units of 2 bytes and - * can only change bits from 1 to 0. So, you can rewrite - * the same contents, or append to an existing page easily enough - */ - -/* - * Erase the specified sector - */ -uint8_t -ao_storage_erase(uint32_t pos) __reentrant -{ - uint16_t addr; - - if (pos >= ao_storage_total || pos + ao_storage_block > ao_storage_total) - return 0; - - addr = ((uint16_t)(ao_intflash + pos) >> 1); - - FADDRH = addr >> 8; - FADDRL = addr; - - __critical { - _asm - .even - orl _FCTL, #FCTL_ERASE; ; FCTL |= FCTL_ERASE - nop ; Required, see datasheet. - _endasm; - } - - return 1; -} - -/* - * Write to flash - */ - -static void -ao_intflash_write_aligned(uint16_t pos, __xdata void *d, uint16_t len) __reentrant -{ - pos = ((uint16_t) ao_intflash + pos) >> 1; - - ao_dma_set_transfer(ao_intflash_dma, - d, - &FWDATAXADDR, - len, - DMA_CFG0_WORDSIZE_8 | - DMA_CFG0_TMODE_SINGLE | - DMA_CFG0_TRIGGER_FLASH, - DMA_CFG1_SRCINC_1 | - DMA_CFG1_DESTINC_0 | - DMA_CFG1_PRIORITY_HIGH); - - FADDRH = pos >> 8; - FADDRL = pos; - - ao_dma_start(ao_intflash_dma); - - __critical { - _asm - .even - orl _FCTL, #FCTL_WRITE; ; FCTL |= FCTL_WRITE - nop - _endasm; - } - __critical while (!ao_intflash_dma_done) - ao_sleep(&ao_intflash_dma_done); -} - -static void -ao_intflash_write_byte(uint16_t pos, uint8_t byte) __reentrant -{ - static __xdata uint8_t b[2]; - - if (pos & 1) { - b[0] = 0xff; - b[1] = byte; - } else { - b[0] = byte; - b[1] = 0xff; - } - ao_intflash_write_aligned(pos, b, 2); -} - -uint8_t -ao_storage_device_write(uint32_t pos32, __xdata void *v, uint16_t len) __reentrant -{ - uint16_t pos = pos32; - __xdata uint8_t *d = v; - uint8_t oddlen; - - if (pos >= ao_storage_total || pos + len > ao_storage_total) - return 0; - if (len == 0) - return 1; - - if (pos & 1) { - ao_intflash_write_byte(pos++, *d++); - len--; - } - oddlen = len & 1; - len -= oddlen; - if (len) - ao_intflash_write_aligned(pos, d, len); - if (oddlen) - ao_intflash_write_byte(pos + len, d[len]); - - return 1; -} - -/* - * Read from flash - */ -uint8_t -ao_storage_device_read(uint32_t pos, __xdata void *d, uint16_t len) __reentrant -{ - if (pos >= ao_storage_total || pos + len > ao_storage_total) - return 0; - ao_xmemcpy(d, ao_intflash+pos, len); - return 1; -} - -void -ao_storage_flush(void) __reentrant -{ -} - -void -ao_storage_setup(void) -{ -} - -void -ao_storage_device_info(void) __reentrant -{ - printf ("Using internal flash, starting at 0x%04x\n", AO_INTFLASH_LOCATION); -} - -void -ao_storage_device_init(void) -{ - ao_intflash_dma = ao_dma_alloc(&ao_intflash_dma_done); - - FWT = FLASH_TIMING; -} diff --git a/src/cc1111/ao_launch.c b/src/cc1111/ao_launch.c deleted file mode 100644 index 76d6d13b..00000000 --- a/src/cc1111/ao_launch.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include -#include -#include - -__xdata uint16_t ao_launch_ignite; - -#if 0 -#define PRINTD(...) printf(__VA_ARGS__) -#else -#define PRINTD(...) -#endif - -static void -ao_launch_run(void) -{ - for (;;) { - while (!ao_launch_ignite) - ao_sleep(&ao_launch_ignite); - ao_ignition[ao_igniter_drogue].firing = 1; - ao_ignition[ao_igniter_main].firing = 1; - AO_IGNITER_DIR |= AO_IGNITER_DROGUE_BIT | AO_IGNITER_MAIN_BIT; - AO_IGNITER_DROGUE = 1; - while (ao_launch_ignite) { - ao_launch_ignite = 0; - ao_delay(AO_MS_TO_TICKS(500)); - } - AO_IGNITER_DROGUE = 0; - ao_ignition[ao_igniter_drogue].firing = 0; - ao_ignition[ao_igniter_main].firing = 0; - } -} - -static void -ao_launch_status(void) -{ - uint8_t i; - for (;;) { - ao_delay(AO_SEC_TO_TICKS(1)); - if (ao_igniter_status(ao_igniter_drogue) == ao_igniter_ready) { - if (ao_igniter_status(ao_igniter_main) == ao_igniter_ready) { - for (i = 0; i < 5; i++) { - ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(50)); - ao_delay(AO_MS_TO_TICKS(100)); - } - } else { - ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200)); - } - } - } -} - -static __pdata uint8_t ao_launch_armed; -static __pdata uint16_t ao_launch_arm_time; - -static void -ao_launch(void) -{ - static __xdata struct ao_launch_command command; - static __xdata struct ao_launch_query query; - int16_t time_difference; - - ao_led_off(AO_LED_RED); - ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200)); - for (;;) { - flush(); - if (ao_radio_cmac_recv(&command, sizeof (command), 0) != AO_RADIO_CMAC_OK) - continue; - - PRINTD ("tick %d serial %d cmd %d channel %d\n", - command.tick, command.serial, command.cmd, command.channel); - - switch (command.cmd) { - case AO_LAUNCH_QUERY: - if (command.serial != ao_serial_number) { - PRINTD ("serial number mismatch\n"); - break; - } - - if (command.channel == 0) { - query.valid = 1; - query.arm_status = ao_igniter_status(ao_igniter_drogue); - query.igniter_status = ao_igniter_status(ao_igniter_main); - } else { - query.valid = 0; - } - query.tick = ao_time(); - query.serial = ao_serial_number; - query.channel = command.channel; - PRINTD ("query tick %d serial %d channel %d valid %d arm %d igniter %d\n", - query.tick, query.serial, query.channel, query.valid, query.arm_status, - query.igniter_status); - ao_radio_cmac_send(&query, sizeof (query)); - break; - case AO_LAUNCH_ARM: - if (command.serial != ao_serial_number) { - PRINTD ("serial number mismatch\n"); - break; - } - - if (command.channel != 0) - break; - time_difference = command.tick - ao_time(); - PRINTD ("arm tick %d local tick %d\n", command.tick, ao_time()); - if (time_difference < 0) - time_difference = -time_difference; - if (time_difference > 10) { - PRINTD ("time difference too large %d\n", time_difference); - break; - } - PRINTD ("armed\n"); - ao_launch_armed = 1; - ao_launch_arm_time = ao_time(); - break; - case AO_LAUNCH_FIRE: - if (!ao_launch_armed) { - PRINTD ("not armed\n"); - break; - } - if ((uint16_t) (ao_time() - ao_launch_arm_time) > AO_SEC_TO_TICKS(20)) { - PRINTD ("late launch arm_time %d time %d\n", - ao_launch_arm_time, ao_time()); - break; - } - time_difference = command.tick - ao_time(); - if (time_difference < 0) - time_difference = -time_difference; - if (time_difference > 10) { - PRINTD ("time different too large %d\n", time_difference); - break; - } - PRINTD ("ignite\n"); - ao_launch_ignite = 1; - ao_wakeup(&ao_launch_ignite); - break; - } - } -} - -void -ao_launch_test(void) -{ - switch (ao_igniter_status(ao_igniter_drogue)) { - case ao_igniter_ready: - case ao_igniter_active: - printf ("Armed: "); - switch (ao_igniter_status(ao_igniter_main)) { - default: - printf("unknown status\n"); - break; - case ao_igniter_ready: - printf("igniter good\n"); - break; - case ao_igniter_open: - printf("igniter bad\n"); - break; - } - break; - default: - printf("Disarmed\n"); - } -} - -void -ao_launch_manual(void) -{ - ao_cmd_white(); - if (!ao_match_word("DoIt")) - return; - ao_cmd_white(); - ao_launch_ignite = 1; - ao_wakeup(&ao_launch_ignite); -} - -static __xdata struct ao_task ao_launch_task; -static __xdata struct ao_task ao_launch_ignite_task; -static __xdata struct ao_task ao_launch_status_task; - -__code struct ao_cmds ao_launch_cmds[] = { - { ao_launch_test, "t\0Test launch continuity" }, - { ao_launch_manual, "i \0Fire igniter. is doit with D&I" }, - { 0, NULL } -}; - -void -ao_launch_init(void) -{ - AO_IGNITER_DROGUE = 0; - AO_IGNITER_MAIN = 0; - AO_IGNITER_DIR |= AO_IGNITER_DROGUE_BIT | AO_IGNITER_MAIN_BIT; - ao_cmd_register(&ao_launch_cmds[0]); - ao_add_task(&ao_launch_task, ao_launch, "launch listener"); - ao_add_task(&ao_launch_ignite_task, ao_launch_run, "launch igniter"); - ao_add_task(&ao_launch_status_task, ao_launch_status, "launch status"); -} diff --git a/src/cc1111/ao_launch.h b/src/cc1111/ao_launch.h deleted file mode 100644 index 966b5cea..00000000 --- a/src/cc1111/ao_launch.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright © 2017 Keith Packard - * - * 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. - */ - -#ifndef _AO_LAUNCH_H_ -#define _AO_LAUNCH_H_ -/* ao_launch.c */ - -struct ao_launch_command { - uint16_t tick; - uint16_t serial; - uint8_t cmd; - uint8_t channel; - uint16_t unused; -}; - -#define AO_LAUNCH_QUERY 1 - -struct ao_launch_query { - uint16_t tick; - uint16_t serial; - uint8_t channel; - uint8_t valid; - uint8_t arm_status; - uint8_t igniter_status; -}; - -#define AO_LAUNCH_ARM 2 -#define AO_LAUNCH_FIRE 3 - -void -ao_launch_init(void); - -#endif /* _AO_LAUNCH_H_ */ diff --git a/src/cc1111/ao_lcd_port.c b/src/cc1111/ao_lcd_port.c deleted file mode 100644 index 9b588090..00000000 --- a/src/cc1111/ao_lcd_port.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" - -static void -ao_lcd_port_delay(void) -{ - uint8_t i; - - for (i = 0; i < 100; i++) - ao_arch_nop(); -} - -void -ao_lcd_port_put_nibble(uint8_t rs, uint8_t nibble) -{ - P0 = (P0 & 0xf0) | (nibble & 0x0f); - P1_1 = rs; - P1_0 = 1; - ao_lcd_port_delay(); - P1_0 = 0; - ao_lcd_port_delay(); -} - -void -ao_lcd_port_init(void) -{ - /* LCD_E and LCD_RS are GPIO outputs */ - P1DIR |= 0x03; - P1SEL &= ~0x03; - - /* LCD D4-D7 are GPIO outputs */ - P0DIR |= 0x0f; - P0SEL &= ~0x0f; -} diff --git a/src/cc1111/ao_led.c b/src/cc1111/ao_led.c deleted file mode 100644 index 5fae46c2..00000000 --- a/src/cc1111/ao_led.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * 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. - */ - -#include "ao.h" - -__pdata uint8_t ao_led_enable; - -void -ao_led_on(uint8_t colors) -{ - P1 |= (colors & ao_led_enable); -} - -void -ao_led_off(uint8_t colors) -{ - P1 &= ~(colors & ao_led_enable); -} - -void -ao_led_set(uint8_t colors) -{ - P1 = (P1 & ~(ao_led_enable)) | (colors & ao_led_enable); -} - -void -ao_led_toggle(uint8_t colors) -{ - P1 ^= (colors & ao_led_enable); -} - -void -ao_led_for(uint8_t colors, uint16_t ticks) __reentrant -{ - ao_led_on(colors); - ao_delay(ticks); - ao_led_off(colors); -} - -void -ao_led_init(uint8_t enable) -{ - ao_led_enable = enable; - P1SEL &= ~enable; - P1 &= ~enable; - P1DIR |= enable; -} diff --git a/src/cc1111/ao_pins.h b/src/cc1111/ao_pins.h deleted file mode 100644 index 9d6e1c1d..00000000 --- a/src/cc1111/ao_pins.h +++ /dev/null @@ -1,655 +0,0 @@ -/* - * Copyright © 2010 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#define HAS_RADIO 1 -#define DISABLE_LOG_SPACE 1 -#define AO_VALUE_32 0 -#define HAS_WIDE_GPS 0 - -#if defined(TELEMETRUM_V_1_0) - /* Discontinued and was never built with CC1111 chips needing this */ - #define NEEDS_CC1111_CLOCK_HACK 0 - #define HAS_FLIGHT 1 - #define HAS_USB 1 - #define HAS_BEEP 1 - #define HAS_BEEP_CONFIG 0 - #define HAS_GPS 1 - #define HAS_SERIAL_1 1 - #define HAS_ADC 1 - #define HAS_EEPROM 1 - #define HAS_LOG 1 - #define USE_INTERNAL_FLASH 0 - #define HAS_DBG 1 - #define DBG_ON_P1 1 - #define DBG_ON_P0 0 - #define IGNITE_ON_P2 1 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 0 - #define PACKET_HAS_SLAVE 1 - #define NOISY_ACCEL 1 - - #define HAS_COMPANION 1 - #define COMPANION_CS_ON_P1 1 - #define AO_COMPANION_CS_PORT P1 - #define AO_COMPANION_CS_PIN 2 - #define AO_COMPANION_CS P1_2 - - #define AO_LED_RED 1 - #define LEDS_AVAILABLE (AO_LED_RED) - #define HAS_EXTERNAL_TEMP 0 - #define HAS_ACCEL_REF 0 - #define HAS_ACCEL 1 - #define HAS_IGNITE 1 - #define HAS_MONITOR 0 - #define HAS_TELEMETRY 1 - #define HAS_RADIO_RATE 0 /* not enough space for this */ - #define HAS_MUTEX_TRY 0 - #define HAS_TASK_INFO 0 /* not enough space for this either */ - #define AO_LOG_FORMAT AO_LOG_FORMAT_FULL -#endif - -#if defined(TELEMETRUM_V_1_1) - /* Discontinued and was never built with CC1111 chips needing this */ - #define NEEDS_CC1111_CLOCK_HACK 0 - #define HAS_FLIGHT 1 - #define HAS_USB 1 - #define HAS_BEEP 1 - #define HAS_BEEP_CONFIG 0 - #define HAS_BATTERY_REPORT 1 - #define HAS_GPS 1 - #define HAS_SERIAL_1 1 - #define HAS_ADC 1 - #define HAS_EEPROM 1 - #define HAS_LOG 1 - #define USE_INTERNAL_FLASH 0 - #define HAS_DBG 1 - #define DBG_ON_P1 1 - #define DBG_ON_P0 0 - #define IGNITE_ON_P2 1 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 0 - #define PACKET_HAS_SLAVE 1 - - #define HAS_COMPANION 1 - #define AO_COMPANION_CS_PORT P1 - #define AO_COMPANION_CS_PIN 2 - #define AO_COMPANION_CS P1_2 - - #define AO_LED_RED 1 - #define LEDS_AVAILABLE (AO_LED_RED) - #define HAS_EXTERNAL_TEMP 0 - #define HAS_ACCEL_REF 1 - #define SPI_CS_ON_P1 1 - #define SPI_CS_ON_P0 0 - #define AO_M25_SPI_CS_MASK 0x02 /* CS0 is P1_1 */ - #define M25_MAX_CHIPS 1 - #define HAS_ACCEL 1 - #define HAS_IGNITE 1 - #define HAS_MONITOR 0 - #define HAS_TELEMETRY 1 - #define HAS_RADIO_RATE 0 /* not enough space for this */ - #define HAS_MUTEX_TRY 0 - #define AO_LOG_FORMAT AO_LOG_FORMAT_FULL -#endif - -#if defined(TELEMETRUM_V_1_2) - /* Discontinued and was never built with CC1111 chips needing this */ - #define NEEDS_CC1111_CLOCK_HACK 0 - #define HAS_FLIGHT 1 - #define HAS_USB 1 - #define HAS_BEEP 1 - #define HAS_BEEP_CONFIG 0 - #define HAS_BATTERY_REPORT 1 - #define HAS_GPS 1 - #define HAS_SERIAL_1 1 - #define HAS_ADC 1 - #define HAS_EEPROM 1 - #define HAS_LOG 1 - #define USE_INTERNAL_FLASH 0 - #define HAS_DBG 1 - #define DBG_ON_P1 1 - #define DBG_ON_P0 0 - #define IGNITE_ON_P2 1 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 0 - #define PACKET_HAS_SLAVE 1 - - #define HAS_COMPANION 1 - #define AO_COMPANION_CS_PORT P1 - #define AO_COMPANION_CS_PIN 2 - #define AO_COMPANION_CS P1_2 - - #define AO_LED_RED 1 - #define LEDS_AVAILABLE (AO_LED_RED) - #define HAS_EXTERNAL_TEMP 0 - #define HAS_ACCEL_REF 1 - #define SPI_CS_ON_P1 1 - #define SPI_CS_ON_P0 0 - #define AO_M25_SPI_CS_MASK 0x02 /* CS0 is P1_1 */ - #define M25_MAX_CHIPS 1 - #define HAS_ACCEL 1 - #define HAS_IGNITE 1 - #define HAS_MONITOR 0 - #define HAS_TELEMETRY 1 - #define HAS_RADIO_RATE 0 /* not enough space for this */ - #define HAS_MUTEX_TRY 0 - #define AO_LOG_FORMAT AO_LOG_FORMAT_FULL -#endif - -#if defined(TELEDONGLE_V_0_2) - #define HAS_FLIGHT 0 - #define HAS_USB 1 - #define HAS_BEEP 0 - #define HAS_SERIAL_1 0 - #define HAS_ADC 0 - #define HAS_DBG 1 - #define HAS_EEPROM 0 - #define HAS_LOG 0 - #define DBG_ON_P1 1 - #define DBG_ON_P0 0 - #define IGNITE_ON_P2 0 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 1 - #define PACKET_HAS_SLAVE 0 - #define AO_LED_RED 1 - #define AO_LED_GREEN 2 - #define AO_MONITOR_LED AO_LED_GREEN - #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN) - #define SPI_CS_ON_P1 1 - #define SPI_CS_ON_P0 0 - #define HAS_IGNITE 0 - #define HAS_MONITOR 1 - #define LEGACY_MONITOR 1 - #define HAS_RSSI 1 - #define HAS_AES 0 - #define HAS_TELEMETRY 0 - #define AO_RADIO_REG_TEST 1 -#endif - -#if defined(TELEMINI_V_1_0) - /* Discontinued and was never built with CC1111 chips needing this */ - #define NEEDS_CC1111_CLOCK_HACK 0 - #define HAS_FLIGHT 1 - #define HAS_USB 0 - #define HAS_BEEP 0 - #define HAS_GPS 0 - #define HAS_SERIAL_1 0 - #define HAS_ADC 1 - #define HAS_EEPROM 1 - #define HAS_LOG 1 - #define HAS_FORCE_FREQ 1 - #define USE_INTERNAL_FLASH 1 - #define HAS_DBG 0 - #define IGNITE_ON_P2 0 - #define IGNITE_ON_P0 1 - #define PACKET_HAS_MASTER 0 - #define PACKET_HAS_SLAVE 1 - #define USE_FAST_ASCENT_LOG 1 - - #define AO_LED_GREEN 1 - #define AO_LED_RED 2 - #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN) - #define HAS_EXTERNAL_TEMP 0 - #define HAS_ACCEL 0 - #define HAS_IGNITE 1 - #define HAS_MONITOR 0 - #define HAS_TELEMETRY 1 - #define HAS_RADIO_RATE 0 /* not enough space for this */ - #define AO_LOG_FORMAT AO_LOG_FORMAT_TINY -#endif - -#if defined(TELENANO_V_0_1) - /* Discontinued and was never built with CC1111 chips needing this */ - #define NEEDS_CC1111_CLOCK_HACK 0 - #define HAS_FLIGHT 1 - #define HAS_USB 0 - #define HAS_BEEP 0 - #define HAS_GPS 0 - #define HAS_SERIAL_1 0 - #define HAS_ADC 1 - #define HAS_EEPROM 1 - #define HAS_LOG 1 - #define USE_INTERNAL_FLASH 1 - #define HAS_DBG 0 - #define IGNITE_ON_P2 0 - #define IGNITE_ON_P0 1 - #define PACKET_HAS_MASTER 0 - #define PACKET_HAS_SLAVE 1 - - #define AO_LED_GREEN 1 - #define AO_LED_RED 2 - #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN) - #define HAS_EXTERNAL_TEMP 0 - #define HAS_ACCEL 0 - #define HAS_IGNITE 0 - #define HAS_MONITOR 0 - #define HAS_TELEMETRY 1 - #define HAS_RADIO_RATE 0 /* not enough space for this */ -#endif - -#if defined(TELEMETRUM_V_0_1) - /* Discontinued and was never built with CC1111 chips needing this */ - #define NEEDS_CC1111_CLOCK_HACK 0 - #define HAS_FLIGHT 1 - #define HAS_USB 1 - #define HAS_BEEP 1 - #define HAS_BEEP_CONFIG 0 - #define HAS_GPS 1 - #define HAS_SERIAL_1 1 - #define HAS_ADC 1 - #define HAS_DBG 0 - #define HAS_EEPROM 1 - #define HAS_LOG 1 - #define USE_INTERNAL_FLASH 0 - #define DBG_ON_P1 0 - #define DBG_ON_P0 1 - #define IGNITE_ON_P2 1 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 0 - #define PACKET_HAS_SLAVE 1 - #define AO_LED_RED 2 - #define AO_LED_GREEN 1 - #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN) - #define HAS_EXTERNAL_TEMP 1 - #define HAS_ACCEL_REF 0 - #define SPI_CS_ON_P1 1 - #define SPI_CS_ON_P0 0 - #define HAS_ACCEL 1 - #define HAS_IGNITE 1 - #define HAS_MONITOR 0 - #define HAS_TELEMETRY 1 - #define HAS_RADIO_RATE 0 /* not enough space for this */ - #define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX ((uint32_t) 127 * (uint32_t) 1024) - #define AO_LOG_FORMAT AO_LOG_FORMAT_FULL -#endif - -#if defined(TELEDONGLE_V_0_1) - /* Discontinued and was never built with CC1111 chips needing this */ - #define NEEDS_CC1111_CLOCK_HACK 0 - #define HAS_FLIGHT 0 - #define HAS_USB 1 - #define HAS_BEEP 0 - #define HAS_SERIAL_1 0 - #define HAS_ADC 0 - #define HAS_DBG 0 - #define HAS_EEPROM 0 - #define HAS_LOG 0 - #define DBG_ON_P1 0 - #define DBG_ON_P0 1 - #define IGNITE_ON_P2 0 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 1 - #define PACKET_HAS_SLAVE 0 - #define AO_LED_RED 2 - #define AO_LED_GREEN 1 - #define AO_MONITOR_LED AO_LED_GREEN - #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN) - #define SPI_CS_ON_P1 0 - #define SPI_CS_ON_P0 1 - #define HAS_IGNITE 0 - #define HAS_MONITOR 1 - #define LEGACY_MONITOR 1 - #define HAS_RSSI 1 - #define HAS_AES 0 - #define HAS_TELEMETRY 0 -#endif - -#if defined(TIDONGLE) - /* Discontinued and was never built with CC1111 chips needing this */ - #define NEEDS_CC1111_CLOCK_HACK 0 - #define HAS_FLIGHT 0 - #define HAS_USB 1 - #define HAS_BEEP 0 - #define HAS_SERIAL_1 0 - #define HAS_ADC 0 - #define HAS_DBG 1 - #define HAS_EEPROM 0 - #define HAS_LOG 0 - #define DBG_ON_P1 0 - #define DBG_ON_P0 1 - #define IGNITE_ON_P2 0 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 1 - #define PACKET_HAS_SLAVE 0 - #define AO_LED_RED 2 - #define AO_MONITOR_LED AO_LED_RED - #define LEDS_AVAILABLE (AO_LED_RED) - #define SPI_CS_ON_P1 0 - #define SPI_CS_ON_P0 1 - #define HAS_IGNITE 0 - #define HAS_MONITOR 1 - #define LEGACY_MONITOR 1 - #define HAS_RSSI 1 - #define HAS_AES 0 - #define HAS_TELEMETRY 0 -#endif - -#if defined(TELEBT_V_0_0) - /* Discontinued and was never built with CC1111 chips needing this */ - #define NEEDS_CC1111_CLOCK_HACK 0 - #define HAS_FLIGHT 0 - #define HAS_USB 1 - #define HAS_BEEP 0 - #define HAS_SERIAL_1 1 - #define USE_SERIAL_1_STDIN 1 - #define DELAY_SERIAL_1_STDIN 1 - #define HAS_ADC 0 - #define HAS_DBG 1 - #define HAS_EEPROM 0 - #define HAS_LOG 0 - #define HAS_BTM 1 - #define DBG_ON_P1 0 - #define DBG_ON_P0 1 - #define IGNITE_ON_P2 0 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 1 - #define PACKET_HAS_SLAVE 0 - #define AO_LED_RED 2 - #define AO_LED_GREEN 1 - #define AO_MONITOR_LED AO_LED_RED - #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN) - #define SPI_CS_ON_P1 1 - #define SPI_CS_ON_P0 0 - #define HAS_IGNITE 0 - #define HAS_IGNITE_REPORT 1 - #define BT_LINK_ON_P2 1 - #define BT_LINK_ON_P1 0 - #define BT_LINK_PIN_INDEX 7 - #define BT_LINK_PIN P2_1 - #define HAS_MONITOR 1 - #define LEGACY_MONITOR 1 - #define HAS_RSSI 0 - #define HAS_AES 0 - #define HAS_TELEMETRY 0 - #define AO_RADIO_REG_TEST 1 -#endif - -#if defined(TELEBT_V_0_1) - /* Discontinued and was never built with CC1111 chips needing this */ - #define NEEDS_CC1111_CLOCK_HACK 0 - #define HAS_FLIGHT 0 - #define HAS_USB 1 - #define HAS_BEEP 1 - #define HAS_BEEP_CONFIG 0 - #define HAS_SERIAL_1 1 - #define HAS_SERIAL_1_ALT_1 1 - #define HAS_SERIAL_1_ALT_2 0 - #define HAS_SERIAL_1_HW_FLOW 1 - #define USE_SERIAL_1_STDIN 1 - #define DELAY_SERIAL_1_STDIN 1 - #define HAS_ADC 0 - #define HAS_DBG 1 - #define HAS_EEPROM 1 - #define HAS_LOG 1 - #define USE_INTERNAL_FLASH 0 - #define HAS_BTM 1 - #define DBG_ON_P1 1 - #define DBG_ON_P0 0 - #define IGNITE_ON_P2 0 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 1 - #define PACKET_HAS_SLAVE 0 - #define AO_LED_RED 1 - #define AO_LED_GREEN 2 - #define AO_MONITOR_LED AO_LED_RED - #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN) - #define SPI_CS_ON_P1 1 - #define SPI_CS_ON_P0 0 - #define AO_M25_SPI_CS_MASK 0x04 /* CS0 is P1_2 */ - #define M25_MAX_CHIPS 1 - #define HAS_ACCEL 0 - #define HAS_IGNITE 0 - #define HAS_IGNITE_REPORT 1 - #define BT_LINK_ON_P2 0 - #define BT_LINK_ON_P1 1 - #define BT_LINK_PIN_INDEX 7 - #define BT_LINK_PIN P1_7 - #define HAS_MONITOR 1 - #define LEGACY_MONITOR 1 - #define HAS_RSSI 0 - #define HAS_AES 0 - #define HAS_TELEMETRY 0 - #define AO_RADIO_REG_TEST 1 -#endif - -#if defined(TELELAUNCH_V_0_1) - /* Discontinued and was never built with CC1111 chips needing this */ - #define NEEDS_CC1111_CLOCK_HACK 0 - #define HAS_FLIGHT 0 - #define HAS_USB 1 - #define HAS_BEEP 1 - #define HAS_GPS 0 - #define HAS_SERIAL_1 1 - #define HAS_ADC 1 - #define HAS_DBG 0 - #define HAS_EEPROM 1 - #define HAS_LOG 0 - #define USE_INTERNAL_FLASH 1 - #define DBG_ON_P1 0 - #define DBG_ON_P0 1 - #define IGNITE_ON_P2 1 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 0 - #define PACKET_HAS_SLAVE 0 - #define AO_LED_RED 2 - #define AO_LED_GREEN 1 - #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN) - #define HAS_EXTERNAL_TEMP 1 - #define HAS_ACCEL_REF 0 - #define SPI_CS_ON_P1 1 - #define SPI_CS_ON_P0 0 - #define HAS_ACCEL 0 - #define HAS_IGNITE 1 - #define HAS_MONITOR 0 - #define HAS_AES 1 - #define HAS_TELEMETRY 0 -#endif - -#if DBG_ON_P1 - - #define DBG_CLOCK (1 << 4) /* mi0 */ - #define DBG_DATA (1 << 5) /* mo0 */ - #define DBG_RESET_N (1 << 3) /* c0 */ - - #define DBG_CLOCK_PIN (P1_4) - #define DBG_DATA_PIN (P1_5) - #define DBG_RESET_N_PIN (P1_3) - - #define DBG_PORT_NUM 1 - #define DBG_PORT P1 - #define DBG_PORT_SEL P1SEL - #define DBG_PORT_INP P1INP - #define DBG_PORT_DIR P1DIR - -#endif /* DBG_ON_P1 */ - -#if DBG_ON_P0 - - #define DBG_CLOCK (1 << 3) - #define DBG_DATA (1 << 4) - #define DBG_RESET_N (1 << 5) - - #define DBG_CLOCK_PIN (P0_3) - #define DBG_DATA_PIN (P0_4) - #define DBG_RESET_N_PIN (P0_5) - - #define DBG_PORT_NUM 0 - #define DBG_PORT P0 - #define DBG_PORT_SEL P0SEL - #define DBG_PORT_INP P0INP - #define DBG_PORT_DIR P0DIR - -#endif /* DBG_ON_P0 */ - -#if COMPANION_CS_ON_P1 - #define COMPANION_CS_PORT P1 - #define COMPANION_CS_SEL P1SEL - #define COMPANION_CS_DIR P1DIR -#endif - -#if SPI_CS_ON_P1 - #define SPI_CS_PORT P1 - #define SPI_CS_SEL P1SEL - #define SPI_CS_DIR P1DIR -#endif - -#if SPI_CS_ON_P0 - #define SPI_CS_PORT P0 - #define SPI_CS_SEL P0SEL - #define SPI_CS_DIR P0DIR -#endif - -#define AO_M25_SPI_CS_PORT SPI_CS_PORT - -#ifndef IGNITE_ON_P2 -#error Please define IGNITE_ON_P2 -#endif - -#ifndef IGNITE_ON_P0 -#error Please define IGNITE_ON_P0 -#endif - -#ifndef HAS_ADC -#error Please define HAS_ADC -#endif - -#ifndef HAS_EEPROM -#error Please define HAS_EEPROM -#endif - -#ifndef HAS_LOG -#error Please define HAS_LOG -#endif - -#if HAS_EEPROM -#ifndef USE_INTERNAL_FLASH -#error Please define USE_INTERNAL_FLASH -#endif -#endif - -#ifndef HAS_DBG -#error Please define HAS_DBG -#endif - -#ifndef HAS_IGNITE -#error Please define HAS_IGNITE -#endif - -#if HAS_IGNITE -#define HAS_IGNITE_REPORT 1 -#endif - -#ifndef PACKET_HAS_MASTER -#error Please define PACKET_HAS_MASTER -#endif - -#ifndef PACKET_HAS_SLAVE -#error Please define PACKET_HAS_SLAVE -#endif - -#ifndef HAS_MONITOR -#error Please define HAS_MONITOR -#endif - -#if HAS_MONITOR -#ifndef HAS_RSSI -#error Please define HAS_RSSI -#endif -#endif - -#ifndef HAS_ADC -#error Please define HAS_ADC -#endif - -#if HAS_ADC - -#if HAS_ACCEL -#ifndef HAS_ACCEL_REF -#error Please define HAS_ACCEL_REF -#endif -#else -#define HAS_ACCEL_REF 0 -#endif - -#endif /* HAS_ADC */ - -#if IGNITE_ON_P2 -#define AO_IGNITER_PORT P2 -#define AO_IGNITER_DROGUE_PORT AO_IGNITER_PORT -#define AO_IGNITER_DROGUE P2_3 -#define AO_IGNITER_MAIN P2_4 -#define AO_IGNITER_DIR P2DIR -#define AO_IGNITER_DROGUE_BIT (1 << 3) -#define AO_IGNITER_MAIN_BIT (1 << 4) -#define AO_IGNITER_DROGUE_PIN 3 -#define AO_IGNITER_MAIN_PIN 4 -#endif - -#if IGNITE_ON_P0 -#define AO_IGNITER_PORT P0 -#define AO_IGNITER_DROGUE P0_5 -#define AO_IGNITER_MAIN P0_4 -#define AO_IGNITER_DIR P0DIR -#define AO_IGNITER_DROGUE_BIT (1 << 5) -#define AO_IGNITER_MAIN_BIT (1 << 4) -#define AO_IGNITER_DROGUE_PIN 5 -#define AO_IGNITER_MAIN_PIN 4 -#endif - -#define AO_IGNITER_DROGUE_PORT AO_IGNITER_PORT -#define AO_IGNITER_MAIN_PORT AO_IGNITER_PORT - -/* test these values with real igniters */ -#define AO_IGNITER_OPEN 1000 -#define AO_IGNITER_CLOSED 7000 -#define AO_IGNITER_FIRE_TIME AO_MS_TO_TICKS(50) -#define AO_IGNITER_CHARGE_TIME AO_MS_TO_TICKS(2000) - -struct ao_adc { - int16_t accel; /* accelerometer */ - int16_t pres; /* pressure sensor */ - int16_t temp; /* temperature sensor */ - int16_t v_batt; /* battery voltage */ - int16_t sense_d; /* drogue continuity sense */ - int16_t sense_m; /* main continuity sense */ -#if HAS_ACCEL_REF - uint16_t accel_ref; /* acceleration reference */ -#endif -}; - -/* - * Voltage divider on ADC battery sampler - */ -#define AO_BATTERY_DIV_PLUS 5 /* 5k */ -#define AO_BATTERY_DIV_MINUS 10 /* 10k */ - -/* - * Voltage divider on ADC igniter samplers - */ -#define AO_IGNITE_DIV_PLUS 100 /* 100k */ -#define AO_IGNITE_DIV_MINUS 27 /* 27k */ - -/* - * ADC reference in decivolts - */ -#define AO_ADC_REFERENCE_DV 33 - -#endif /* _AO_PINS_H_ */ diff --git a/src/cc1111/ao_radio.c b/src/cc1111/ao_radio.c deleted file mode 100644 index 166d14d5..00000000 --- a/src/cc1111/ao_radio.c +++ /dev/null @@ -1,689 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * 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. - */ - -#include "ao.h" -#if HAS_PAD -#include -#endif - -/* Values from SmartRF® Studio for: - * - * Deviation: 20.507812 kHz - * Datarate: 38.360596 kBaud - * Modulation: GFSK - * RF Freq: 434.549927 MHz - * Channel: 99.975586 kHz - * Channel: 0 - * RX filter: 93.75 kHz - */ - -/* - * For IF freq of 140.62kHz, the IF value is: - * - * 140.62e3 / (24e6 / 2**10) = 6 - */ - -#define IF_FREQ_CONTROL 6 - -/* - * http://www.ntia.doc.gov/files/ntia/publications/84-168.pdf - * - * Necessary bandwidth for a FSK modulated signal: - * - * bw = 2.6d + 0.55b 1.5 < m < 5.5 - * bw = 2.1d + 1.9b 5.5 < m < 20 - * - * b is the modulation rate in bps - * d is the peak deviation (from the center) - * - * m = 2d / b - * - * 20.5 kHz deviation 38.4kbps signal: - * - * m = 41 / 38.4, which is < 5.5: - * - * bw = 2.6 * 20.5 + 0.55 * 38.4 = 74.42kHz - * - * M = 1, E = 3, bw = 75kHz - * - * 5.125 kHz deviation, 9.6kbps signal - * - * m = 10.25 / 9.6, which is < 5.5: - * - * bw = 2.6 * 5.125 + 0.55 * 9.6 = 18.6kHz - * - * M = 2, E = 3, bw = 53.6kHz - * - * 1.28125kHz deviation, 2.4kbps signal - * - * m = 2.565 / 2.4, which is < 5.5: - * - * bw = 2.6 * 20.5 + 1.9 * 2.4 = 47.61kHz - * - * M = 3, E = 3, bw = 53.6kHz - * - * For channel bandwidth of 93.75 kHz, the CHANBW_E and CHANBW_M values are - * - * BW = 24e6 / (8 * (4 + M) * 2 ** E) - * - * So, M = 0 and E = 3 - */ - -#define CHANBW_M_384 1 -#define CHANBW_M_96 3 -#define CHANBW_M_24 3 -#define CHANBW_E 3 - -/* - * For a symbol rate of 38360kBaud, the DRATE_E and DRATE_M values are: - * - * R = (256 + M) * 2** E * 24e6 / 2**28 - * - * So for 38360kBaud, M is 163 and E is 10 - */ - -#define DRATE_M 163 - -#define DRATE_E_384 10 - -/* For 9600 baud, M is 163 and E is 8 - */ - -#define DRATE_E_96 8 - -/* For 2400 baud, M is 163 and E is 6 - */ - -#define DRATE_E_24 6 - -/* - * For a channel deviation of 20.5kHz, the DEVIATION_E and DEVIATION_M values are: - * - * F = 24e6/2**17 * (8 + DEVIATION_M) * 2**DEVIATION_E - * - * For 20.5kHz deviation, M is 6 and E is 3 - * For 5.125kHz deviation, M is 6 and E is 1 - * For 1.28125kHz deviation, M is 0 and E is 0 - */ - -#define DEVIATION_M_384 6 -#define DEVIATION_E_384 3 - -#define DEVIATION_M_96 6 -#define DEVIATION_E_96 1 - -#define DEVIATION_M_24 0 -#define DEVIATION_E_24 0 - -/* - * For our RDF beacon, set the symbol rate to 2kBaud (for a 1kHz tone), - * so the DRATE_E and DRATE_M values are: - * - * M is 94 and E is 6 - * - * To make the tone last for 200ms, we need 2000 * .2 = 400 bits or 50 bytes - */ - -#define RDF_DRATE_E 6 -#define RDF_DRATE_M 94 -#define RDF_PACKET_LEN 50 - -/* - * RDF deviation should match the normal NFM value of 5kHz - * - * M is 6 and E is 1 - * - */ - -#define RDF_DEVIATION_M 6 -#define RDF_DEVIATION_E 1 - -/* This are from the table for 433MHz */ - -#define RF_POWER_M30_DBM 0x12 -#define RF_POWER_M20_DBM 0x0e -#define RF_POWER_M15_DBM 0x1d -#define RF_POWER_M10_DBM 0x34 -#define RF_POWER_M5_DBM 0x2c -#define RF_POWER_0_DBM 0x60 -#define RF_POWER_5_DBM 0x84 -#define RF_POWER_7_DBM 0xc8 -#define RF_POWER_10_DBM 0xc0 - -#define RF_POWER RF_POWER_10_DBM - -static __code uint8_t radio_setup[] = { - RF_PA_TABLE7_OFF, RF_POWER, - RF_PA_TABLE6_OFF, RF_POWER, - RF_PA_TABLE5_OFF, RF_POWER, - RF_PA_TABLE4_OFF, RF_POWER, - RF_PA_TABLE3_OFF, RF_POWER, - RF_PA_TABLE2_OFF, RF_POWER, - RF_PA_TABLE1_OFF, RF_POWER, - RF_PA_TABLE0_OFF, RF_POWER, - - RF_FSCTRL1_OFF, (IF_FREQ_CONTROL << RF_FSCTRL1_FREQ_IF_SHIFT), - RF_FSCTRL0_OFF, (0 << RF_FSCTRL0_FREQOFF_SHIFT), - - RF_MDMCFG3_OFF, (DRATE_M << RF_MDMCFG3_DRATE_M_SHIFT), - RF_MDMCFG2_OFF, (RF_MDMCFG2_DEM_DCFILT_ON | - RF_MDMCFG2_MOD_FORMAT_GFSK | - RF_MDMCFG2_SYNC_MODE_15_16), - RF_MDMCFG1_OFF, (RF_MDMCFG1_FEC_EN | - RF_MDMCFG1_NUM_PREAMBLE_4 | - (2 << RF_MDMCFG1_CHANSPC_E_SHIFT)), - RF_MDMCFG0_OFF, (17 << RF_MDMCFG0_CHANSPC_M_SHIFT), - - RF_CHANNR_OFF, 0, - - /* SmartRF says set LODIV_BUF_CURRENT_TX to 0 - * And, we're not using power ramping, so use PA_POWER 0 - */ - RF_FREND0_OFF, ((1 << RF_FREND0_LODIV_BUF_CURRENT_TX_SHIFT) | - (0 << RF_FREND0_PA_POWER_SHIFT)), - - RF_FREND1_OFF, ((1 << RF_FREND1_LNA_CURRENT_SHIFT) | - (1 << RF_FREND1_LNA2MIX_CURRENT_SHIFT) | - (1 << RF_FREND1_LODIV_BUF_CURRENT_RX_SHIFT) | - (2 << RF_FREND1_MIX_CURRENT_SHIFT)), - - RF_FSCAL3_OFF, 0xE9, - RF_FSCAL2_OFF, 0x0A, - RF_FSCAL1_OFF, 0x00, - RF_FSCAL0_OFF, 0x1F, - - RF_TEST2_OFF, RF_TEST2_RX_LOW_DATA_RATE_MAGIC, - RF_TEST1_OFF, RF_TEST1_RX_LOW_DATA_RATE_MAGIC, - RF_TEST0_OFF, 0x09, - - /* default sync values */ - RF_SYNC1_OFF, 0xD3, - RF_SYNC0_OFF, 0x91, - - /* max packet length */ - RF_PKTCTRL1_OFF, ((1 << PKTCTRL1_PQT_SHIFT)| - PKTCTRL1_APPEND_STATUS| - PKTCTRL1_ADR_CHK_NONE), - RF_PKTCTRL0_OFF, (RF_PKTCTRL0_WHITE_DATA| - RF_PKTCTRL0_PKT_FORMAT_NORMAL| - RF_PKTCTRL0_CRC_EN| - RF_PKTCTRL0_LENGTH_CONFIG_FIXED), - RF_ADDR_OFF, 0x00, - RF_MCSM2_OFF, (RF_MCSM2_RX_TIME_END_OF_PACKET), - RF_MCSM1_OFF, (RF_MCSM1_CCA_MODE_RSSI_BELOW_UNLESS_RECEIVING| - RF_MCSM1_RXOFF_MODE_IDLE| - RF_MCSM1_TXOFF_MODE_IDLE), - RF_MCSM0_OFF, (RF_MCSM0_FS_AUTOCAL_FROM_IDLE| - RF_MCSM0_MAGIC_3| - RF_MCSM0_CLOSE_IN_RX_0DB), - RF_FOCCFG_OFF, (RF_FOCCFG_FOC_PRE_K_3K, - RF_FOCCFG_FOC_POST_K_PRE_K, - RF_FOCCFG_FOC_LIMIT_BW_OVER_4), - RF_BSCFG_OFF, (RF_BSCFG_BS_PRE_K_2K| - RF_BSCFG_BS_PRE_KP_3KP| - RF_BSCFG_BS_POST_KI_PRE_KI| - RF_BSCFG_BS_POST_KP_PRE_KP| - RF_BSCFG_BS_LIMIT_0), - RF_AGCCTRL2_OFF, (RF_AGCCTRL2_MAX_DVGA_GAIN_ALL| - RF_AGCCTRL2_MAX_LNA_GAIN_0| - RF_AGCCTRL2_MAGN_TARGET_33dB), - RF_AGCCTRL1_OFF, (RF_AGCCTRL1_AGC_LNA_PRIORITY_0 | - RF_AGCCTRL1_CARRIER_SENSE_REL_THR_DISABLE | - RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_0DB), - RF_AGCCTRL0_OFF, (RF_AGCCTRL0_HYST_LEVEL_NONE | - RF_AGCCTRL0_WAIT_TIME_8 | - RF_AGCCTRL0_AGC_FREEZE_NORMAL | - RF_AGCCTRL0_FILTER_LENGTH_8), - RF_IOCFG2_OFF, 0x00, - RF_IOCFG1_OFF, 0x00, - RF_IOCFG0_OFF, 0x00, -}; - -static __code uint8_t rdf_setup[] = { - RF_MDMCFG4_OFF, ((CHANBW_E << RF_MDMCFG4_CHANBW_E_SHIFT) | - (CHANBW_M_384 << RF_MDMCFG4_CHANBW_M_SHIFT) | - (RDF_DRATE_E << RF_MDMCFG4_DRATE_E_SHIFT)), - RF_MDMCFG3_OFF, (RDF_DRATE_M << RF_MDMCFG3_DRATE_M_SHIFT), - RF_MDMCFG2_OFF, (RF_MDMCFG2_DEM_DCFILT_OFF | - RF_MDMCFG2_MOD_FORMAT_GFSK | - RF_MDMCFG2_SYNC_MODE_NONE), - RF_MDMCFG1_OFF, (RF_MDMCFG1_FEC_DIS | - RF_MDMCFG1_NUM_PREAMBLE_2 | - (2 << RF_MDMCFG1_CHANSPC_E_SHIFT)), - - RF_DEVIATN_OFF, ((RDF_DEVIATION_E << RF_DEVIATN_DEVIATION_E_SHIFT) | - (RDF_DEVIATION_M << RF_DEVIATN_DEVIATION_M_SHIFT)), - - /* packet length is set in-line */ - RF_PKTCTRL1_OFF, ((0 << PKTCTRL1_PQT_SHIFT)| - PKTCTRL1_ADR_CHK_NONE), - RF_PKTCTRL0_OFF, (RF_PKTCTRL0_PKT_FORMAT_NORMAL| - RF_PKTCTRL0_LENGTH_CONFIG_FIXED), -}; - -static __code uint8_t fixed_pkt_setup[] = { -#if !HAS_RADIO_RATE - RF_MDMCFG4_OFF, ((CHANBW_E << RF_MDMCFG4_CHANBW_E_SHIFT) | - (CHANBW_M_384 << RF_MDMCFG4_CHANBW_M_SHIFT) | - (DRATE_E_384 << RF_MDMCFG4_DRATE_E_SHIFT)), -#endif - RF_MDMCFG3_OFF, (DRATE_M << RF_MDMCFG3_DRATE_M_SHIFT), - RF_MDMCFG2_OFF, (RF_MDMCFG2_DEM_DCFILT_ON | - RF_MDMCFG2_MOD_FORMAT_GFSK | - RF_MDMCFG2_SYNC_MODE_15_16), - RF_MDMCFG1_OFF, (RF_MDMCFG1_FEC_EN | - RF_MDMCFG1_NUM_PREAMBLE_4 | - (2 << RF_MDMCFG1_CHANSPC_E_SHIFT)), - -#if !HAS_RADIO_RATE - RF_DEVIATN_OFF, ((DEVIATION_E_384 << RF_DEVIATN_DEVIATION_E_SHIFT) | - (DEVIATION_M_384 << RF_DEVIATN_DEVIATION_M_SHIFT)), -#endif - - /* max packet length -- now set inline */ - RF_PKTCTRL1_OFF, ((1 << PKTCTRL1_PQT_SHIFT)| - PKTCTRL1_APPEND_STATUS| - PKTCTRL1_ADR_CHK_NONE), - RF_PKTCTRL0_OFF, (RF_PKTCTRL0_WHITE_DATA| - RF_PKTCTRL0_PKT_FORMAT_NORMAL| - RF_PKTCTRL0_CRC_EN| - RF_PKTCTRL0_LENGTH_CONFIG_FIXED), -}; - -#if HAS_RADIO_RATE -static __code struct { - uint8_t mdmcfg4; - uint8_t deviatn; -} packet_rate_setup[] = { - /* 38400 */ - { - ((CHANBW_E << RF_MDMCFG4_CHANBW_E_SHIFT) | - (CHANBW_M_384 << RF_MDMCFG4_CHANBW_M_SHIFT) | - (DRATE_E_384 << RF_MDMCFG4_DRATE_E_SHIFT)), - ((DEVIATION_E_384 << RF_DEVIATN_DEVIATION_E_SHIFT) | - (DEVIATION_M_384 << RF_DEVIATN_DEVIATION_M_SHIFT)), - }, - /* 9600 */ - { - ((CHANBW_E << RF_MDMCFG4_CHANBW_E_SHIFT) | - (CHANBW_M_96 << RF_MDMCFG4_CHANBW_M_SHIFT) | - (DRATE_E_96 << RF_MDMCFG4_DRATE_E_SHIFT)), - ((DEVIATION_E_96 << RF_DEVIATN_DEVIATION_E_SHIFT) | - (DEVIATION_M_96 << RF_DEVIATN_DEVIATION_M_SHIFT)), - }, - /* 2400 */ - { - ((CHANBW_E << RF_MDMCFG4_CHANBW_E_SHIFT) | - (CHANBW_M_24 << RF_MDMCFG4_CHANBW_M_SHIFT) | - (DRATE_E_24 << RF_MDMCFG4_DRATE_E_SHIFT)), - ((DEVIATION_E_24 << RF_DEVIATN_DEVIATION_E_SHIFT) | - (DEVIATION_M_24 << RF_DEVIATN_DEVIATION_M_SHIFT)), - }, -}; -#endif - -__xdata uint8_t ao_radio_dma; -__xdata uint8_t ao_radio_dma_done; -__xdata uint8_t ao_radio_done; -__xdata uint8_t ao_radio_abort; -__xdata uint8_t ao_radio_mutex; - -#if PACKET_HAS_MASTER || HAS_AES -#define NEED_RADIO_RSSI 1 -#endif - -#ifndef NEED_RADIO_RSSI -#define NEED_RADIO_RSSI 0 -#endif - -#if NEED_RADIO_RSSI -__xdata int8_t ao_radio_rssi; -#endif - -void -ao_radio_general_isr(void) __interrupt 16 -{ - S1CON &= ~0x03; - if (RFIF & RFIF_IM_TIMEOUT) { - ao_radio_recv_abort(); - RFIF &= ~ RFIF_IM_TIMEOUT; - } else if (RFIF & RFIF_IM_DONE) { - ao_radio_done = 1; - ao_wakeup(&ao_radio_done); - RFIF &= ~RFIF_IM_DONE; - } -} - -static void -ao_radio_set_packet(void) -{ - uint8_t i; - for (i = 0; i < sizeof (fixed_pkt_setup); i += 2) - RF[fixed_pkt_setup[i]] = fixed_pkt_setup[i+1]; -} - -static void -ao_radio_idle(void) -{ - if (RF_MARCSTATE != RF_MARCSTATE_IDLE) - { - do { - RFST = RFST_SIDLE; - ao_yield(); - } while (RF_MARCSTATE != RF_MARCSTATE_IDLE); - } -} - -#define ao_radio_put() ao_mutex_put(&ao_radio_mutex) - -static void -ao_radio_get(uint8_t len) -{ - ao_config_get(); - ao_mutex_get(&ao_radio_mutex); - ao_radio_idle(); - RF_CHANNR = 0; - RF_FREQ2 = (uint8_t) (ao_config.radio_setting >> 16); - RF_FREQ1 = (uint8_t) (ao_config.radio_setting >> 8); - RF_FREQ0 = (uint8_t) (ao_config.radio_setting); - RF_PKTLEN = len; -#if HAS_RADIO_RATE - RF_MDMCFG4 = packet_rate_setup[ao_config.radio_rate].mdmcfg4; - RF_DEVIATN = packet_rate_setup[ao_config.radio_rate].deviatn; -#endif -} - - -void -ao_radio_send(__xdata void *packet, uint8_t size) __reentrant -{ - ao_radio_get(size); - ao_radio_done = 0; - ao_dma_set_transfer(ao_radio_dma, - packet, - &RFDXADDR, - size, - DMA_CFG0_WORDSIZE_8 | - DMA_CFG0_TMODE_SINGLE | - DMA_CFG0_TRIGGER_RADIO, - DMA_CFG1_SRCINC_1 | - DMA_CFG1_DESTINC_0 | - DMA_CFG1_PRIORITY_HIGH); - ao_dma_start(ao_radio_dma); - RFST = RFST_STX; - __critical while (!ao_radio_done) - ao_sleep(&ao_radio_done); - ao_radio_put(); -} - -uint8_t -ao_radio_recv(__xdata void *packet, uint8_t size, uint8_t timeout) __reentrant -{ - ao_radio_abort = 0; - ao_radio_get(size - 2); - ao_dma_set_transfer(ao_radio_dma, - &RFDXADDR, - packet, - size, - DMA_CFG0_WORDSIZE_8 | - DMA_CFG0_TMODE_SINGLE | - DMA_CFG0_TRIGGER_RADIO, - DMA_CFG1_SRCINC_0 | - DMA_CFG1_DESTINC_1 | - DMA_CFG1_PRIORITY_HIGH); - ao_dma_start(ao_radio_dma); - RFST = RFST_SRX; - - /* Wait for DMA to be done, for the radio receive process to - * get aborted or for a receive timeout to fire - */ - __critical while (!ao_radio_dma_done && !ao_radio_abort) - if (ao_sleep_for(&ao_radio_dma_done, timeout)) - break; - - /* If recv was aborted, clean up by stopping the DMA engine - * and idling the radio - */ - if (!ao_radio_dma_done) { - ao_dma_abort(ao_radio_dma); - ao_radio_idle(); -#if NEED_RADIO_RSSI - ao_radio_rssi = 0; -#endif - } -#if NEED_RADIO_RSSI - else - ao_radio_rssi = AO_RSSI_FROM_RADIO(((uint8_t *)packet)[size - 2]); -#endif - ao_radio_put(); - return ao_radio_dma_done; -} - -/* - * Wake up a task waiting to receive a radio packet - * and tell them to abort the transfer - */ - -void -ao_radio_recv_abort(void) -{ - ao_radio_abort = 1; - ao_wakeup(&ao_radio_dma_done); -} - -__code ao_radio_rdf_value = 0x55; - -static void -ao_radio_rdf_start(void) -{ - uint8_t i; - ao_radio_abort = 0; - ao_radio_get(AO_RADIO_RDF_LEN); - ao_radio_done = 0; - for (i = 0; i < sizeof (rdf_setup); i += 2) - RF[rdf_setup[i]] = rdf_setup[i+1]; -} - -static void -ao_radio_rdf_run(void) -{ - ao_dma_start(ao_radio_dma); - RFST = RFST_STX; - __critical while (!ao_radio_done && !ao_radio_abort) - ao_sleep(&ao_radio_done); - if (!ao_radio_done) { - ao_dma_abort(ao_radio_dma); - ao_radio_idle(); - } - ao_radio_set_packet(); - ao_radio_put(); -} - -void -ao_radio_rdf(void) -{ - ao_radio_rdf_start(); - - ao_dma_set_transfer(ao_radio_dma, - CODE_TO_XDATA(&ao_radio_rdf_value), - &RFDXADDR, - AO_RADIO_RDF_LEN, - DMA_CFG0_WORDSIZE_8 | - DMA_CFG0_TMODE_SINGLE | - DMA_CFG0_TRIGGER_RADIO, - DMA_CFG1_SRCINC_0 | - DMA_CFG1_DESTINC_0 | - DMA_CFG1_PRIORITY_HIGH); - ao_radio_rdf_run(); -} - -#define PA 0x00 -#define BE 0x55 - -#define CONT_PAUSE_8 PA, PA, PA, PA, PA, PA, PA, PA -#define CONT_PAUSE_16 CONT_PAUSE_8, CONT_PAUSE_8 -#define CONT_PAUSE_24 CONT_PAUSE_16, CONT_PAUSE_8 - -#define CONT_BEEP_8 BE, BE, BE, BE, BE, BE, BE, BE - -#if AO_RADIO_CONT_PAUSE_LEN == 24 -#define CONT_PAUSE CONT_PAUSE_24 -#endif - -#if AO_RADIO_CONT_TONE_LEN == 8 -#define CONT_BEEP CONT_BEEP_8 -#define CONT_PAUSE_SHORT CONT_PAUSE_8 -#endif - -#define CONT_ADDR(c) CODE_TO_XDATA(&ao_radio_cont[(3-(c)) * (AO_RADIO_CONT_PAUSE_LEN + AO_RADIO_CONT_TONE_LEN)]) - -__code uint8_t ao_radio_cont[] = { - CONT_PAUSE, CONT_BEEP, - CONT_PAUSE, CONT_BEEP, - CONT_PAUSE, CONT_BEEP, - CONT_PAUSE, CONT_PAUSE_SHORT, - CONT_PAUSE, CONT_PAUSE_SHORT, - CONT_PAUSE, -}; - -void -ao_radio_continuity(uint8_t c) -{ - ao_radio_rdf_start(); - ao_dma_set_transfer(ao_radio_dma, - CONT_ADDR(c), - &RFDXADDR, - AO_RADIO_CONT_TOTAL_LEN, - DMA_CFG0_WORDSIZE_8 | - DMA_CFG0_TMODE_SINGLE | - DMA_CFG0_TRIGGER_RADIO, - DMA_CFG1_SRCINC_1 | - DMA_CFG1_DESTINC_0 | - DMA_CFG1_PRIORITY_HIGH); - ao_radio_rdf_run(); -} - -void -ao_radio_rdf_abort(void) -{ - ao_radio_abort = 1; - ao_wakeup(&ao_radio_done); -} - - -/* Output carrier */ - -static __xdata radio_test_on; - -void -ao_radio_test(uint8_t on) -{ - if (on) { - if (!radio_test_on) { -#if HAS_MONITOR - ao_monitor_disable(); -#endif -#if PACKET_HAS_SLAVE - ao_packet_slave_stop(); -#endif -#if HAS_PAD - ao_pad_disable(); -#endif - ao_radio_get(0xff); - RFST = RFST_STX; - radio_test_on = 1; - } - } else { - if (radio_test_on) { - ao_radio_idle(); - ao_radio_put(); - radio_test_on = 0; -#if HAS_MONITOR - ao_monitor_enable(); -#endif -#if HAS_PAD - ao_pad_enable(); -#endif - } - } -} - -static void -ao_radio_test_cmd(void) -{ - uint8_t mode = 2; - static __xdata radio_on; - ao_cmd_white(); - if (ao_cmd_lex_c != '\n') { - ao_cmd_decimal(); - mode = (uint8_t) ao_cmd_lex_u32; - } - mode++; - if ((mode & 2)) - ao_radio_test(1); - if (mode == 3) { - printf ("Hit a character to stop..."); flush(); - getchar(); - putchar('\n'); - } - if ((mode & 1)) - ao_radio_test(0); -} - -#if AO_RADIO_REG_TEST -static void -ao_radio_set_reg(void) -{ - uint8_t offset; - ao_cmd_hex(); - offset = ao_cmd_lex_i; - if (ao_cmd_status != ao_cmd_success) - return; - ao_cmd_hex(); - printf("RF[%x] %x", offset, RF[offset]); - if (ao_cmd_status == ao_cmd_success) { - RF[offset] = ao_cmd_lex_i; - printf (" -> %x", RF[offset]); - } - ao_cmd_status = ao_cmd_success; - printf("\n"); -} -#endif - -__code struct ao_cmds ao_radio_cmds[] = { - { ao_radio_test_cmd, "C <1 start, 0 stop, none both>\0Radio carrier test" }, -#if AO_RADIO_REG_TEST - { ao_radio_set_reg, "V \0Set radio register" }, -#endif - { 0, NULL }, -}; - -void -ao_radio_init(void) -{ - uint8_t i; - for (i = 0; i < sizeof (radio_setup); i += 2) - RF[radio_setup[i]] = radio_setup[i+1]; - ao_radio_set_packet(); - ao_radio_dma_done = 1; - ao_radio_dma = ao_dma_alloc(&ao_radio_dma_done); - RFIF = 0; - RFIM = RFIM_IM_TIMEOUT|RFIM_IM_DONE; - IEN2 |= IEN2_RFIE; - ao_cmd_register(&ao_radio_cmds[0]); -} diff --git a/src/cc1111/ao_reboot.c b/src/cc1111/ao_reboot.c deleted file mode 100644 index 6e1de7a3..00000000 --- a/src/cc1111/ao_reboot.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * 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. - */ - -#include "ao.h" - -/* Use the watchdog timer to force a complete reboot - */ -void -ao_reboot(void) -{ - WDCTL = WDCTL_EN | WDCTL_MODE_WATCHDOG | WDCTL_INT_32768; - ao_delay(AO_SEC_TO_TICKS(2)); - ao_panic(AO_PANIC_REBOOT); -} diff --git a/src/cc1111/ao_romconfig.c b/src/cc1111/ao_romconfig.c deleted file mode 100644 index abd51b23..00000000 --- a/src/cc1111/ao_romconfig.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright © 2010 Keith Packard - * - * 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. - */ - -#include "ao.h" - -__code __at (0x00a0) uint16_t ao_romconfig_version = AO_ROMCONFIG_VERSION; -__code __at (0x00a2) uint16_t ao_romconfig_check = ~AO_ROMCONFIG_VERSION; -__code __at (0x00a4) uint16_t ao_serial_number = 0; -/* - * For 434.550MHz, the frequency value is: - * - * 434.550e6 / (24e6 / 2**16) = 1186611.2 - * - * This value is stored in a const variable so that - * ao-load can change it during programming for - * devices that have no eeprom for config data. - */ -__code __at (0x00a6) uint32_t ao_radio_cal = 1186611; diff --git a/src/cc1111/ao_serial.c b/src/cc1111/ao_serial.c deleted file mode 100644 index 70293b4e..00000000 --- a/src/cc1111/ao_serial.c +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * 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. - */ - -#include "ao.h" - -const __code struct ao_serial_speed ao_serial_speeds[] = { - /* [AO_SERIAL_SPEED_4800] = */ { - /* .baud = */ 163, - /* .gcr = */ (7 << UxGCR_BAUD_E_SHIFT) | UxGCR_ORDER_LSB - }, - /* [AO_SERIAL_SPEED_9600] = */ { - /* .baud = */ 163, - /* .gcr = */ (8 << UxGCR_BAUD_E_SHIFT) | UxGCR_ORDER_LSB - }, - /* [AO_SERIAL_SPEED_19200] = */ { - /* .baud = */ 163, - /* .gcr = */ (9 << UxGCR_BAUD_E_SHIFT) | UxGCR_ORDER_LSB - }, - /* [AO_SERIAL_SPEED_57600] = */ { - /* .baud = */ 59, - /* .gcr = */ (11 << UxGCR_BAUD_E_SHIFT) | UxGCR_ORDER_LSB - }, - /* [AO_SERIAL_SPEED_115200] = */ { - /* .baud = */ 59, - /* .gcr = */ (12 << UxGCR_BAUD_E_SHIFT) | UxGCR_ORDER_LSB - }, -}; - -#define AO_SERIAL_SPEED_MAX AO_SERIAL_SPEED_115200 - -#if HAS_SERIAL_1_ALT_1 -#define SERIAL_1_RTS P0_3 -#else -#define SERIAL_1_RTS P1_5 -#endif - -#if HAS_SERIAL_0_ALT_1 -#define SERIAL_0_RTS P0_5 -#else -#define SERIAL_0_RTS P1_3 -#endif - -#if HAS_SERIAL_0 - -volatile __xdata struct ao_fifo ao_serial0_rx_fifo; -volatile __xdata struct ao_fifo ao_serial0_tx_fifo; - -void -ao_serial0_rx_isr(void) __interrupt 2 -{ - if (!ao_fifo_full(ao_serial0_rx_fifo)) - ao_fifo_insert(ao_serial0_rx_fifo, U0DBUF); - ao_wakeup(&ao_serial0_rx_fifo); -#if USE_SERIAL_0_STDIN - ao_wakeup(&ao_stdin_ready); -#endif -#if HAS_SERIAL_0_HW_FLOW - if (ao_fifo_mostly(ao_serial0_rx_fifo)) - SERIAL_0_RTS = 1; -#endif -} - -static __xdata uint8_t ao_serial0_tx_started; - -static void -ao_serial0_tx_start(void) -{ - if (!ao_fifo_empty(ao_serial0_tx_fifo) && - !ao_serial0_tx_started) - { - ao_serial0_tx_started = 1; - ao_fifo_remove(ao_serial0_tx_fifo, U0DBUF); - } -} - -void -ao_serial0_tx_isr(void) __interrupt 7 -{ - UTX0IF = 0; - ao_serial0_tx_started = 0; - ao_serial0_tx_start(); - ao_wakeup(&ao_serial0_tx_fifo); -} - -char -ao_serial0_getchar(void) __critical -{ - char c; - while (ao_fifo_empty(ao_serial0_rx_fifo)) - ao_sleep(&ao_serial0_rx_fifo); - ao_fifo_remove(ao_serial0_rx_fifo, c); -#if HAS_SERIAL_0_HW_FLOW - if (ao_fifo_barely(ao_serial0_rx_fifo)) - SERIAL_0_RTS = 0; -#endif - return c; -} - -#if USE_SERIAL_0_STDIN -int -_ao_serial0_pollchar(void) -{ - uint8_t c; - if (ao_fifo_empty(ao_serial0_rx_fifo)) - return AO_READ_AGAIN; - ao_fifo_remove(ao_serial0_rx_fifo,c); -#if HAS_SERIAL_0_HW_FLOW - if (ao_fifo_barely(ao_serial0_rx_fifo)) - SERIAL_0_RTS = 0; -#endif - return c; -} -#endif - -void -ao_serial0_putchar(char c) __critical -{ - while (ao_fifo_full(ao_serial0_tx_fifo)) - ao_sleep(&ao_serial0_tx_fifo); - ao_fifo_insert(ao_serial0_tx_fifo, c); - ao_serial0_tx_start(); -} - -void -ao_serial0_drain(void) __critical -{ - while (!ao_fifo_empty(ao_serial0_tx_fifo)) - ao_sleep(&ao_serial0_tx_fifo); -} - -void -ao_serial0_set_speed(uint8_t speed) -{ - ao_serial0_drain(); - if (speed > AO_SERIAL_SPEED_MAX) - return; - U0UCR |= UxUCR_FLUSH; - U0BAUD = ao_serial_speeds[speed].baud; - U0GCR = ao_serial_speeds[speed].gcr; -} -#endif /* HAS_SERIAL_0 */ - -#if HAS_SERIAL_1 - -volatile __xdata struct ao_fifo ao_serial1_rx_fifo; -volatile __xdata struct ao_fifo ao_serial1_tx_fifo; - -void -ao_serial1_rx_isr(void) __interrupt 3 -{ - if (!ao_fifo_full(ao_serial1_rx_fifo)) - ao_fifo_insert(ao_serial1_rx_fifo, U1DBUF); - ao_wakeup(&ao_serial1_rx_fifo); -#if USE_SERIAL_1_STDIN - ao_wakeup(&ao_stdin_ready); -#endif -#if HAS_SERIAL_1_HW_FLOW - if (ao_fifo_mostly(ao_serial1_rx_fifo)) - SERIAL_1_RTS = 1; -#endif -} - -static __xdata uint8_t ao_serial1_tx_started; - -static void -ao_serial1_tx_start(void) -{ - if (!ao_fifo_empty(ao_serial1_tx_fifo) && - !ao_serial1_tx_started) - { - ao_serial1_tx_started = 1; - ao_fifo_remove(ao_serial1_tx_fifo, U1DBUF); - } -} - -void -ao_serial1_tx_isr(void) __interrupt 14 -{ - UTX1IF = 0; - ao_serial1_tx_started = 0; - ao_serial1_tx_start(); - ao_wakeup(&ao_serial1_tx_fifo); -} - -char -ao_serial1_getchar(void) __critical -{ - char c; - while (ao_fifo_empty(ao_serial1_rx_fifo)) - ao_sleep(&ao_serial1_rx_fifo); - ao_fifo_remove(ao_serial1_rx_fifo, c); -#if HAS_SERIAL_1_HW_FLOW - if (ao_fifo_barely(ao_serial1_rx_fifo)) - SERIAL_1_RTS = 0; -#endif - return c; -} - -#if USE_SERIAL_1_STDIN -int -_ao_serial1_pollchar(void) -{ - uint8_t c; - if (ao_fifo_empty(ao_serial1_rx_fifo)) - return AO_READ_AGAIN; - ao_fifo_remove(ao_serial1_rx_fifo,c); -#if HAS_SERIAL_1_HW_FLOW - if (ao_fifo_barely(ao_serial1_rx_fifo)) - SERIAL_1_RTS = 0; -#endif - return c; -} -#endif - -void -ao_serial1_putchar(char c) __critical -{ - while (ao_fifo_full(ao_serial1_tx_fifo)) - ao_sleep(&ao_serial1_tx_fifo); - ao_fifo_insert(ao_serial1_tx_fifo, c); - ao_serial1_tx_start(); -} - -void -ao_serial1_drain(void) __critical -{ - while (!ao_fifo_empty(ao_serial1_tx_fifo)) - ao_sleep(&ao_serial1_tx_fifo); -} - -void -ao_serial1_set_speed(uint8_t speed) -{ - ao_serial1_drain(); - if (speed > AO_SERIAL_SPEED_MAX) - return; - U1UCR |= UxUCR_FLUSH; - U1BAUD = ao_serial_speeds[speed].baud; - U1GCR = ao_serial_speeds[speed].gcr; -} - -#endif /* HAS_SERIAL_1 */ - -void -ao_serial_init(void) -{ -#if HAS_SERIAL_0 -#if HAS_SERIAL_0_ALT_1 - /* Set up the USART pin assignment */ - PERCFG = (PERCFG & ~PERCFG_U0CFG_ALT_MASK) | PERCFG_U0CFG_ALT_1; - - P2DIR = (P2DIR & ~P2DIR_PRIP0_MASK) | P2DIR_PRIP0_USART0_USART1; - - /* Make the USART pins be controlled by the USART */ - P0SEL |= (1 << 2) | (1 << 3); -#if HAS_SERIAL_0_HW_FLOW - SERIAL_0_RTS = 0; - P0DIR |= (1 << 5); - - P0SEL |= (1 << 4); - P0INP |= (1 << 4); -#endif -#else - /* Set up the USART pin assignment */ - PERCFG = (PERCFG & ~PERCFG_U0CFG_ALT_MASK) | PERCFG_U0CFG_ALT_2; - - P2SEL = (P2SEL & ~(P2SEL_PRI3P1_MASK | P2SEL_PRI0P1_MASK)) | - (P2SEL_PRI3P1_USART0 | P2SEL_PRI0P1_USART0); - - /* Make the USART pins be controlled by the USART */ - P1SEL |= (1 << 5) | (1 << 4); -#if HAS_SERIAL_0_HW_FLOW - SERIAL_0_RTS = 0; - P1DIR |= (1 << 3); - - P1SEL |= (1 << 2); - P1INP |= (1 << 2); -#endif -#endif - - /* UART mode with receiver enabled */ - U0CSR = (UxCSR_MODE_UART | UxCSR_RE); - - /* Pick a 9600 baud rate */ - ao_serial0_set_speed(AO_SERIAL_SPEED_9600); - - /* Reasonable serial parameters */ - U0UCR = (UxUCR_FLUSH | -#if HAS_SERIAL_0_HW_FLOW - UxUCR_FLOW_ENABLE | -#else - UxUCR_FLOW_DISABLE | -#endif - UxUCR_D9_EVEN_PARITY | - UxUCR_BIT9_8_BITS | - UxUCR_PARITY_DISABLE | - UxUCR_SPB_1_STOP_BIT | - UxUCR_STOP_HIGH | - UxUCR_START_LOW); - - IEN0 |= IEN0_URX0IE; - IEN2 |= IEN2_UTX0IE; -#if USE_SERIAL_0_STDIN && !DELAY_SERIAL_0_STDIN - ao_add_stdio(_ao_serial0_pollchar, - ao_serial0_putchar, - NULL); -#endif -#endif /* HAS_SERIAL_0 */ - -#if HAS_SERIAL_1 -#if HAS_SERIAL_1_ALT_1 - /* Set up the USART pin assignment */ - PERCFG = (PERCFG & ~PERCFG_U1CFG_ALT_MASK) | PERCFG_U1CFG_ALT_1; - - P2DIR = (P2DIR & ~P2DIR_PRIP0_MASK) | P2DIR_PRIP0_USART1_USART0; - - /* Make the USART pins be controlled by the USART */ - P0SEL |= (1 << 5) | (1 << 4); -#if HAS_SERIAL_1_HW_FLOW - /* SW RTS control (hw doesn't work) */ - SERIAL_1_RTS = 0; - P0DIR |= 1 << 3; - - /* HW CTS. Maybe this works? */ - P0SEL |= 1 << 2; - P0INP |= 1 << 2; -#endif -#else - /* Set up the USART pin assignment */ - PERCFG = (PERCFG & ~PERCFG_U1CFG_ALT_MASK) | PERCFG_U1CFG_ALT_2; - - P2SEL = (P2SEL & ~(P2SEL_PRI3P1_MASK | P2SEL_PRI2P1_MASK)) | - (P2SEL_PRI3P1_USART1 | P2SEL_PRI2P1_USART1); - - /* Make the USART pins be controlled by the USART */ - P1SEL |= (1 << 6) | (1 << 7); -#if HAS_SERIAL_1_HW_FLOW - /* SW RTS control (hw doesn't work) */ - SERIAL_1_RTS = 0; - P1DIR |= (1 << 5); - - /* HW CTS. Maybe this works? */ - P1SEL |= (1 << 4); - P1INP |= (1 << 4); -#endif -#endif - - /* UART mode with receiver enabled */ - U1CSR = (UxCSR_MODE_UART | UxCSR_RE); - - /* Pick a 4800 baud rate */ - ao_serial1_set_speed(AO_SERIAL_SPEED_4800); - - /* Reasonable serial parameters */ - U1UCR = (UxUCR_FLUSH | -#if HAS_SERIAL_1_HW_FLOW - UxUCR_FLOW_ENABLE | -#else - UxUCR_FLOW_DISABLE | -#endif - UxUCR_D9_EVEN_PARITY | - UxUCR_BIT9_8_BITS | - UxUCR_PARITY_DISABLE | - UxUCR_SPB_1_STOP_BIT | - UxUCR_STOP_HIGH | - UxUCR_START_LOW); - - IEN0 |= IEN0_URX1IE; - IEN2 |= IEN2_UTX1IE; - -#if USE_SERIAL_1_STDIN && !DELAY_SERIAL_1_STDIN - ao_add_stdio(_ao_serial1_pollchar, - ao_serial1_putchar, - NULL); -#endif -#endif /* HAS_SERIAL_1 */ -} diff --git a/src/cc1111/ao_spi.c b/src/cc1111/ao_spi.c deleted file mode 100644 index 124e09cb..00000000 --- a/src/cc1111/ao_spi.c +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright © 2010 Keith Packard - * - * 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. - */ - -#include "ao.h" - -/* Default pin usage for existing Altus Metrum devices */ - -#ifndef SPI_CONST -#define SPI_CONST 0xff -#endif - -/* - * USART0 SPI config alt 1 - * - * MO P0_3 - * MI P0_2 - * CLK P0_5 - * SS P0_4 - * - * USART0 SPI config alt 2 - * - * MO P1_5 - * MI P1_4 - * CLK P1_3 - * CSS P1_2 - * - * USART1 SPI config alt 1 - * - * MO P0_4 - * MI P0_5 - * CLK P0_3 - * SS P0_2 - * - * USART1 SPI config alt 2 - * - * MO P1_6 - * MI P1_7 - * CLK P1_5 - * SS P1_4 - * - * - * Chip select is the responsibility of the caller in master mode - */ - -#if HAS_SPI_0 -#define SPI_BUF_0 &U0DBUFXADDR -#define SPI_CSR_0 U0CSR -#define SPI_BAUD_0 U0BAUD -#define SPI_GCR_0 U0GCR -#define SPI_CFG_MASK_0 PERCFG_U0CFG_ALT_MASK -#define SPI_DMA_TX_0 DMA_CFG0_TRIGGER_UTX0 -#define SPI_DMA_RX_0 DMA_CFG0_TRIGGER_URX0 - -#if SPI_0_ALT_1 -#define SPI_CFG_0 PERCFG_U0CFG_ALT_1 -#define SPI_SEL_0 P0SEL -#define SPI_BITS_0 (1 << 3) | (1 << 2) | (1 << 5) -#define SPI_CSS_BIT_0 (1 << 4) -#endif - -#if SPI_0_ALT_2 -#define SPI_CFG_0 PERCFG_U0CFG_ALT_2 -#define SPI_SEL_0 P1SEL -#define SPI_PRI_0 P2SEL_PRI3P1_USART0 -#define SPI_BITS_0 (1 << 5) | (1 << 4) | (1 << 3) -#define SPI_CSS_BIT_0 (1 << 2) -#endif - -#endif - -#if HAS_SPI_1 -#define SPI_BUF_1 &U1DBUFXADDR -#define SPI_CSR_1 U1CSR -#define SPI_BAUD_1 U1BAUD -#define SPI_GCR_1 U1GCR -#define SPI_CFG_MASK_1 PERCFG_U1CFG_ALT_MASK -#define SPI_DMA_TX_1 DMA_CFG0_TRIGGER_UTX1 -#define SPI_DMA_RX_1 DMA_CFG0_TRIGGER_URX1 - -#if SPI_1_ALT_1 -#define SPI_CFG_1 PERCFG_U1CFG_ALT_1 -#define SPI_SEL_1 P0SEL -#define SPI_BITS_1 (1 << 4) | (1 << 5) | (1 << 3) -#define SPI_CSS_BIT_1 (1 << 2) -#endif - -#if SPI_1_ALT_2 -#define SPI_CFG_1 PERCFG_U1CFG_ALT_2 -#define SPI_SEL_1 P1SEL -#define SPI_PRI_1 P2SEL_PRI3P1_USART1 -#define SPI_BITS_1 (1 << 6) | (1 << 7) | (1 << 5) -#define SPI_CSS_BIT_1 (1 << 4) -#endif - -#endif - -#if MULTI_SPI - -#define SPI_BUF(bus) ((bus) ? SPI_BUF_1 : SPI_BUF_0) -#define SPI_CSR(bus) ((bus) ? SPI_CSR_1 : SPI_CSR_0) -#define SPI_BAUD(bus) ((bus) ? SPI_BAUD_1 : SPI_BAUD_0) -#define SPI_GCR(bus) ((bus) ? SPI_GCR_1 : SPI_GCR_0) -#define SPI_CFG_MASK(bus) ((bus) ? SPI_CFG_MASK_1 : SPI_CFG_MASK_0) -#define SPI_DMA_TX(bus) ((bus) ? SPI_DMA_TX_1 : SPI_DMA_TX_0) -#define SPI_DMA_RX(bus) ((bus) ? SPI_DMA_RX_1 : SPI_DMA_RX_0) -#define SPI_CFG(bus) ((bus) ? SPI_CFG_1 : SPI_CFG_0) -#define SPI_SEL(bus) ((bus) ? SPI_SEL_1 : SPI_SEL_0) -#define SPI_BITS(bus) ((bus) ? SPI_BITS_1 : SPI_BITS_0) -#define SPI_CSS_BIT(bus) ((bus) ? SPI_CSS_BIT_1 : SPI_CSS_BIT_0) - -#else - -#if HAS_SPI_0 -#define SPI_BUF(bus) SPI_BUF_0 -#define SPI_CSR(bus) SPI_CSR_0 -#define SPI_BAUD(bus) SPI_BAUD_0 -#define SPI_GCR(bus) SPI_GCR_0 -#define SPI_CFG_MASK(bus) SPI_CFG_MASK_0 -#define SPI_DMA_TX(bus) SPI_DMA_TX_0 -#define SPI_DMA_RX(bus) SPI_DMA_RX_0 -#define SPI_CFG(bus) SPI_CFG_0 -#define SPI_SEL(bus) SPI_SEL_0 -#define SPI_BITS(bus) SPI_BITS_0 -#define SPI_CSS_BIT(bus) SPI_CSS_BIT_0 -#endif -#if HAS_SPI_1 -#define SPI_BUF(bus) SPI_BUF_1 -#define SPI_CSR(bus) SPI_CSR_1 -#define SPI_BAUD(bus) SPI_BAUD_1 -#define SPI_GCR(bus) SPI_GCR_1 -#define SPI_CFG_MASK(bus) SPI_CFG_MASK_1 -#define SPI_DMA_TX(bus) SPI_DMA_TX_1 -#define SPI_DMA_RX(bus) SPI_DMA_RX_1 -#define SPI_CFG(bus) SPI_CFG_1 -#define SPI_SEL(bus) SPI_SEL_1 -#define SPI_BITS(bus) SPI_BITS_1 -#define SPI_CSS_BIT(bus) SPI_CSS_BIT_1 -#endif - -#endif /* MULTI_SPI */ - -#if AO_SPI_SLAVE -#define CSS(bus) SPI_CSS_BIT(bus) -#define UxCSR_DIRECTION UxCSR_SLAVE -#else -#define CSS(bus) 0 -#define UxCSR_DIRECTION UxCSR_MASTER -#endif - -/* Shared mutex to protect SPI bus, must cover the entire - * operation, from CS low to CS high. This means that any SPI - * user must protect the SPI bus with this mutex - */ -__xdata uint8_t ao_spi_mutex[N_SPI]; -__xdata uint8_t ao_spi_dma_in_done[N_SPI]; -__xdata uint8_t ao_spi_dma_out_done[N_SPI]; - -uint8_t ao_spi_dma_out_id[N_SPI]; -uint8_t ao_spi_dma_in_id[N_SPI]; - -static __xdata uint8_t ao_spi_const; - - -/* Send bytes over SPI. - * - * This sets up two DMA engines, one writing the data and another reading - * bytes coming back. We use the bytes coming back to tell when the transfer - * is complete, as the transmit register is double buffered and hence signals - * completion one byte before the transfer is actually complete - */ -#if MULTI_SPI -void -ao_spi_send(void __xdata *block, uint16_t len, uint8_t bus) __reentrant -#else -void -ao_spi_send_bus(void __xdata *block, uint16_t len) __reentrant -#define bus 0 -#endif -{ - ao_dma_set_transfer(ao_spi_dma_in_id[bus], - SPI_BUF(bus), - &ao_spi_const, - len, - DMA_CFG0_WORDSIZE_8 | - DMA_CFG0_TMODE_SINGLE | - SPI_DMA_RX(bus), - DMA_CFG1_SRCINC_0 | - DMA_CFG1_DESTINC_0 | - DMA_CFG1_PRIORITY_NORMAL); - ao_dma_set_transfer(ao_spi_dma_out_id[bus], - block, - SPI_BUF(bus), - len, - DMA_CFG0_WORDSIZE_8 | - DMA_CFG0_TMODE_SINGLE | - SPI_DMA_TX(bus), - DMA_CFG1_SRCINC_1 | - DMA_CFG1_DESTINC_0 | - DMA_CFG1_PRIORITY_NORMAL); - - ao_dma_start(ao_spi_dma_in_id[bus]); - ao_dma_start(ao_spi_dma_out_id[bus]); - ao_dma_trigger(ao_spi_dma_out_id[bus]); -#if !AO_SPI_SLAVE - __critical while (!ao_spi_dma_in_done[bus]) - ao_sleep(&ao_spi_dma_in_done[bus]); -#endif -#undef bus -} - -#if AO_SPI_SLAVE -void -ao_spi_send_wait(void) -{ - __critical while (!ao_spi_dma_in_done[0]) - ao_sleep(&ao_spi_dma_in_done[0]); -} -#endif - -/* Receive bytes over SPI. - * - * This sets up tow DMA engines, one reading the data and another - * writing constant values to the SPI transmitter as that is what - * clocks the data coming in. - */ -#if MULTI_SPI -void -ao_spi_recv(void __xdata *block, uint16_t len, uint8_t bus) __reentrant -#else -void -ao_spi_recv_bus(void __xdata *block, uint16_t len) __reentrant -#define bus 0 -#endif -{ - ao_dma_set_transfer(ao_spi_dma_in_id[bus], - SPI_BUF(bus), - block, - len, - DMA_CFG0_WORDSIZE_8 | - DMA_CFG0_TMODE_SINGLE | - SPI_DMA_RX(bus), - DMA_CFG1_SRCINC_0 | - DMA_CFG1_DESTINC_1 | - DMA_CFG1_PRIORITY_NORMAL); - - ao_spi_const = SPI_CONST; - -#if !AO_SPI_SLAVE - ao_dma_set_transfer(ao_spi_dma_out_id[bus], - &ao_spi_const, - SPI_BUF(bus), - len, - DMA_CFG0_WORDSIZE_8 | - DMA_CFG0_TMODE_SINGLE | - SPI_DMA_TX(bus), - DMA_CFG1_SRCINC_0 | - DMA_CFG1_DESTINC_0 | - DMA_CFG1_PRIORITY_NORMAL); -#endif - - ao_dma_start(ao_spi_dma_in_id[bus]); -#if !AO_SPI_SLAVE - ao_dma_start(ao_spi_dma_out_id[bus]); - ao_dma_trigger(ao_spi_dma_out_id[bus]); - __critical while (!ao_spi_dma_in_done[bus]) - ao_sleep(&ao_spi_dma_in_done[bus]); -#endif -} - -#if AO_SPI_SLAVE -void -ao_spi_recv_wait(void) -{ - __critical while (!ao_spi_dma_in_done[0]) - ao_sleep(&ao_spi_dma_in_done[0]); -} -#endif - -/* Set up the USART. - * - * SPI master/slave mode - */ -/* Set the baud rate and signal parameters - * - * The cc1111 is limited to a 24/8 MHz SPI clock. - * Every peripheral I've ever seen goes faster than that, - * so set the clock to 3MHz (BAUD_E 17, BAUD_M 0) - */ -#define SPI_INIT(bus,o) do { \ - /* Set up the USART pin assignment */ \ - PERCFG = (PERCFG & ~SPI_CFG_MASK(bus)) | SPI_CFG(bus); \ - \ - /* Make the SPI pins be controlled by the USART peripheral */ \ - SPI_SEL(bus) |= SPI_BITS(bus) | CSS(bus); \ - SPI_CSR(bus) = (UxCSR_MODE_SPI | UxCSR_RE | UxCSR_DIRECTION); \ - SPI_BAUD(bus) = 0; \ - SPI_GCR(bus) = (UxGCR_CPOL_NEGATIVE | \ - UxGCR_CPHA_FIRST_EDGE | \ - UxGCR_ORDER_MSB | \ - (17 << UxGCR_BAUD_E_SHIFT)); \ - /* Set up OUT DMA */ \ - ao_spi_dma_out_id[o] = ao_dma_alloc(&ao_spi_dma_out_done[o]); \ - \ - /* Set up IN DMA */ \ - ao_spi_dma_in_id[o] = ao_dma_alloc(&ao_spi_dma_in_done[o]); \ - } while (0) - -void -ao_spi_init(void) -{ - /* Ensure that SPI USART takes precidence over the other USART - * for pins that they share - */ -#ifdef SPI_PRI - P2SEL = (P2SEL & ~P2SEL_PRI3P1_MASK) | SPI_PRI; -#endif - -#if HAS_SPI_0 - SPI_INIT(0, 0); -#endif -#if HAS_SPI_1 - SPI_INIT(1, MULTI_SPI); -#endif -} diff --git a/src/cc1111/ao_string.c b/src/cc1111/ao_string.c deleted file mode 100644 index dd62ca3d..00000000 --- a/src/cc1111/ao_string.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" - -void -_ao_xmemcpy(__xdata void *dst, __xdata void *src, uint16_t count) -{ - while (count--) { - *(__xdata uint8_t *) dst = *(__xdata uint8_t *) src; - dst = (__xdata uint8_t *) dst + 1; - src = (__xdata uint8_t *) src + 1; - } -} - -void -_ao_xmemset(__xdata void *dst, uint8_t v, uint16_t count) -{ - while (count--) { - *(__xdata uint8_t *) dst = v; - dst = (__xdata uint8_t *) dst + 1; - } -} - -int8_t -_ao_xmemcmp(__xdata void *a, __xdata void *b, uint16_t count) -{ - while (count--) { - int8_t d = *(__xdata int8_t *) a - *(__xdata int8_t *) b; - if (d) - return d; - a = (__xdata int8_t *) a + 1; - b = (__xdata int8_t *) b + 1; - } - return 0; -} diff --git a/src/cc1111/ao_timer.c b/src/cc1111/ao_timer.c deleted file mode 100644 index a3d454da..00000000 --- a/src/cc1111/ao_timer.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * 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. - */ - -#include "ao.h" - -volatile __data uint16_t ao_tick_count; - -uint16_t ao_time(void) __critical -{ - return ao_tick_count; -} - -#define T1_CLOCK_DIVISOR 8 /* 24e6/8 = 3e6 */ -#define T1_SAMPLE_TIME 30000 /* 3e6/30000 = 100 */ - -#if HAS_ADC -volatile __data uint8_t ao_adc_interval = 1; -volatile __data uint8_t ao_adc_count; -#endif - -void ao_timer_isr(void) __interrupt 9 -{ - ++ao_tick_count; -#if HAS_ADC - if (++ao_adc_count == ao_adc_interval) { - ao_adc_count = 0; - ao_adc_poll(); -#if (AO_DATA_ALL & ~(AO_DATA_ADC)) - ao_wakeup(DATA_TO_XDATA(&ao_adc_count)); -#endif - } -#endif -} - -#if HAS_ADC -void -ao_timer_set_adc_interval(uint8_t interval) __critical -{ - ao_adc_interval = interval; - ao_adc_count = 0; -} -#endif - -void -ao_timer_init(void) -{ - /* NOTE: This uses a timer only present on cc1111 architecture. */ - - /* disable timer 1 */ -/* T1CTL = 0; */ - - /* set the sample rate */ - T1CC0H = T1_SAMPLE_TIME >> 8; - T1CC0L = (uint8_t) T1_SAMPLE_TIME; - - T1CCTL0 = T1CCTL_MODE_COMPARE; - T1CCTL1 = 0; - T1CCTL2 = 0; - - /* clear timer value */ - T1CNTL = 0; - - /* enable overflow interrupt */ - OVFIM = 1; - /* enable timer 1 interrupt */ - T1IE = 1; - - /* enable timer 1 in module mode, dividing by 8 */ - T1CTL = T1CTL_MODE_MODULO | T1CTL_DIV_8; -} - -#ifndef NEEDS_CC1111_CLOCK_HACK -#define NEEDS_CC1111_CLOCK_HACK 1 -#endif - -#if NEEDS_CC1111_CLOCK_HACK -static void -ao_clock_delay(void) -{ - uint16_t i = 0; - - while (--i) - ao_arch_nop(); -} -#endif - -/* - * AltOS always cranks the clock to the max frequency - */ -void -ao_clock_init(void) -{ -#if NEEDS_CC1111_CLOCK_HACK - /* Power up both oscillators */ - SLEEP &= ~(SLEEP_OSC_PD); - - /* Switch to the HFRC oscillator */ - CLKCON = (CLKCON & ~CLKCON_OSC_MASK) | (CLKCON_OSC_RC); - - /* Wait for the HFRC oscillator to be stable */ - while (!(SLEEP & SLEEP_HFRC_STB)) - ; - - /* Delay for 'a while' waiting for the crystal to - * stabilize -- the XOSC_STB bit isn't reliable - * - * http://www.ti.com/lit/er/swrz022c/swrz022c.pdf - */ - - ao_clock_delay(); -#endif - - /* Switch system clock to crystal oscilator */ - CLKCON = (CLKCON & ~CLKCON_OSC_MASK) | (CLKCON_OSC_XTAL); - - /* Wait for the HFRC oscillator to be stable */ - while (!(SLEEP & SLEEP_XOSC_STB)) - ; - - /* Power down the unused HFRC oscillator */ - SLEEP |= SLEEP_OSC_PD; - - /* Crank up the timer tick and system clock speed */ - CLKCON = ((CLKCON & ~(CLKCON_TICKSPD_MASK | CLKCON_CLKSPD_MASK)) | - (CLKCON_TICKSPD_1 | CLKCON_CLKSPD_1)); - - while ((CLKCON & (CLKCON_TICKSPD_MASK|CLKCON_CLKSPD_MASK)) != - (CLKCON_TICKSPD_1 | CLKCON_CLKSPD_1)) - ; -} diff --git a/src/cc1111/ao_usb.c b/src/cc1111/ao_usb.c deleted file mode 100644 index 259f6512..00000000 --- a/src/cc1111/ao_usb.c +++ /dev/null @@ -1,489 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * 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. - */ - -#include "ao.h" -#include "ao_usb.h" - -struct ao_task __xdata ao_usb_task; - -static __xdata uint16_t ao_usb_in_bytes; -static __pdata uint16_t ao_usb_in_bytes_last; -static __xdata uint16_t ao_usb_out_bytes; -static __pdata uint8_t ao_usb_iif; -__pdata uint8_t ao_usb_running; - -static void -ao_usb_set_interrupts(void) -{ - /* IN interrupts on the control an IN endpoints */ - USBIIE = (1 << AO_USB_CONTROL_EP) | (1 << AO_USB_IN_EP); - - /* OUT interrupts on the OUT endpoint */ - USBOIE = (1 << AO_USB_OUT_EP); - - /* Only care about reset */ - USBCIE = USBCIE_RSTIE; -} - -/* This interrupt is shared with port 2, - * so when we hook that up, fix this - */ -void -ao_usb_isr(void) __interrupt 6 -{ - USBIF = 0; - ao_usb_iif |= USBIIF; - if (ao_usb_iif & 1) - ao_wakeup(&ao_usb_task); - if (ao_usb_iif & (1 << AO_USB_IN_EP)) - ao_wakeup(&ao_usb_in_bytes); - - if (USBOIF & (1 << AO_USB_OUT_EP)) - ao_wakeup(&ao_stdin_ready); - - if (USBCIF & USBCIF_RSTIF) - ao_usb_set_interrupts(); -#if HAS_BTM -#if BT_LINK_ON_P2 - ao_btm_isr(); -#endif -#endif -#if HAS_P2_ISR - ao_p2_isr(); -#endif -} - -struct ao_usb_setup { - uint8_t dir_type_recip; - uint8_t request; - uint16_t value; - uint16_t index; - uint16_t length; -} __xdata ao_usb_setup; - -__pdata uint8_t ao_usb_ep0_state; -uint8_t * __pdata ao_usb_ep0_in_data; -__pdata uint8_t ao_usb_ep0_in_len; -__pdata uint8_t ao_usb_ep0_in_buf[2]; -__pdata uint8_t ao_usb_ep0_out_len; -__xdata uint8_t *__pdata ao_usb_ep0_out_data; -__pdata uint8_t ao_usb_configuration; - -/* Send an IN data packet */ -static void -ao_usb_ep0_flush(void) -{ - __pdata uint8_t this_len; - __pdata uint8_t cs0; - - /* If the IN packet hasn't been picked up, just return */ - USBINDEX = 0; - cs0 = USBCS0; - if (cs0 & USBCS0_INPKT_RDY) - return; - - this_len = ao_usb_ep0_in_len; - if (this_len > AO_USB_CONTROL_SIZE) - this_len = AO_USB_CONTROL_SIZE; - cs0 = USBCS0_INPKT_RDY; - if (this_len != AO_USB_CONTROL_SIZE) { - cs0 = USBCS0_INPKT_RDY | USBCS0_DATA_END; - ao_usb_ep0_state = AO_USB_EP0_IDLE; - } - ao_usb_ep0_in_len -= this_len; - while (this_len--) - USBFIFO[0] = *ao_usb_ep0_in_data++; - USBINDEX = 0; - USBCS0 = cs0; -} - -__xdata struct ao_usb_line_coding ao_usb_line_coding = {115200, 0, 0, 8}; - -/* Walk through the list of descriptors and find a match - */ -static void -ao_usb_get_descriptor(uint16_t value) -{ - __code uint8_t *__pdata descriptor; - __pdata uint8_t type = value >> 8; - __pdata uint8_t index = value; - - descriptor = ao_usb_descriptors; - while (descriptor[0] != 0) { - if (descriptor[1] == type && index-- == 0) { - if (type == AO_USB_DESC_CONFIGURATION) - ao_usb_ep0_in_len = descriptor[2]; - else - ao_usb_ep0_in_len = descriptor[0]; - ao_usb_ep0_in_data = descriptor; - break; - } - descriptor += descriptor[0]; - } -} - -/* Read data from the ep0 OUT fifo - */ -static void -ao_usb_ep0_fill(void) -{ - __pdata uint8_t len; - - USBINDEX = 0; - len = USBCNT0; - if (len > ao_usb_ep0_out_len) - len = ao_usb_ep0_out_len; - ao_usb_ep0_out_len -= len; - while (len--) - *ao_usb_ep0_out_data++ = USBFIFO[0]; -} - -static void -ao_usb_ep0_queue_byte(uint8_t a) -{ - ao_usb_ep0_in_buf[ao_usb_ep0_in_len++] = a; -} - -static void -ao_usb_set_address(uint8_t address) -{ - ao_usb_running = 1; - USBADDR = address; -} - -static void -ao_usb_set_configuration(void) -{ - /* Set the IN max packet size, double buffered */ - USBINDEX = AO_USB_IN_EP; - USBMAXI = AO_USB_IN_SIZE >> 3; - USBCSIH |= USBCSIH_IN_DBL_BUF; - - /* Set the OUT max packet size, double buffered */ - USBINDEX = AO_USB_OUT_EP; - USBMAXO = AO_USB_OUT_SIZE >> 3; - USBCSOH = USBCSOH_OUT_DBL_BUF; -} - -static void -ao_usb_ep0_setup(void) -{ - /* Pull the setup packet out of the fifo */ - ao_usb_ep0_out_data = (__xdata uint8_t *) &ao_usb_setup; - ao_usb_ep0_out_len = 8; - ao_usb_ep0_fill(); - if (ao_usb_ep0_out_len != 0) - return; - - ao_usb_ep0_in_data = ao_usb_ep0_in_buf; - ao_usb_ep0_in_len = 0; - switch(ao_usb_setup.dir_type_recip & AO_USB_SETUP_TYPE_MASK) { - case AO_USB_TYPE_STANDARD: - switch(ao_usb_setup.dir_type_recip & AO_USB_SETUP_RECIP_MASK) { - case AO_USB_RECIP_DEVICE: - switch(ao_usb_setup.request) { - case AO_USB_REQ_GET_STATUS: - ao_usb_ep0_queue_byte(0); - ao_usb_ep0_queue_byte(0); - break; - case AO_USB_REQ_SET_ADDRESS: -#if USB_FORCE_FLIGHT_IDLE - /* Go to idle mode if USB is connected - */ - ao_flight_force_idle = 1; -#endif - ao_usb_set_address(ao_usb_setup.value); - break; - case AO_USB_REQ_GET_DESCRIPTOR: - ao_usb_get_descriptor(ao_usb_setup.value); - break; - case AO_USB_REQ_GET_CONFIGURATION: - ao_usb_ep0_queue_byte(ao_usb_configuration); - break; - case AO_USB_REQ_SET_CONFIGURATION: - ao_usb_configuration = ao_usb_setup.value; - ao_usb_set_configuration(); - break; - } - break; - case AO_USB_RECIP_INTERFACE: - #pragma disable_warning 110 - switch(ao_usb_setup.request) { - case AO_USB_REQ_GET_STATUS: - ao_usb_ep0_queue_byte(0); - ao_usb_ep0_queue_byte(0); - break; - case AO_USB_REQ_GET_INTERFACE: - ao_usb_ep0_queue_byte(0); - break; - case AO_USB_REQ_SET_INTERFACE: - break; - } - break; - case AO_USB_RECIP_ENDPOINT: - switch(ao_usb_setup.request) { - case AO_USB_REQ_GET_STATUS: - ao_usb_ep0_queue_byte(0); - ao_usb_ep0_queue_byte(0); - break; - } - break; - } - break; - case AO_USB_TYPE_CLASS: - switch (ao_usb_setup.request) { - case AO_USB_SET_LINE_CODING: - ao_usb_ep0_out_len = 7; - ao_usb_ep0_out_data = (__xdata uint8_t *) &ao_usb_line_coding; - break; - case AO_USB_GET_LINE_CODING: - ao_usb_ep0_in_len = 7; - ao_usb_ep0_in_data = (uint8_t *) &ao_usb_line_coding; - break; - case AO_USB_SET_CONTROL_LINE_STATE: - break; - } - break; - } - - /* Figure out how to ACK the setup packet and the - * next state - */ - USBINDEX = 0; - if (ao_usb_ep0_in_len) { - - /* Sending data back to the host - */ - ao_usb_ep0_state = AO_USB_EP0_DATA_IN; - USBCS0 = USBCS0_CLR_OUTPKT_RDY; - if (ao_usb_setup.length < ao_usb_ep0_in_len) - ao_usb_ep0_in_len = ao_usb_setup.length; - ao_usb_ep0_flush(); - } else if (ao_usb_ep0_out_len) { - - /* Receiving data from the host - */ - ao_usb_ep0_state = AO_USB_EP0_DATA_OUT; - USBCS0 = USBCS0_CLR_OUTPKT_RDY; - } else if (ao_usb_setup.length) { - - /* Uh-oh, the host expected to send or receive data - * and we don't know what to do. - */ - ao_usb_ep0_state = AO_USB_EP0_STALL; - USBCS0 = USBCS0_CLR_OUTPKT_RDY | USBCS0_SEND_STALL; - } else { - - /* Simple setup packet with no data - */ - ao_usb_ep0_state = AO_USB_EP0_IDLE; - USBCS0 = USBCS0_CLR_OUTPKT_RDY | USBCS0_DATA_END; - } -} - -/* End point 0 receives all of the control messages. */ -static void -ao_usb_ep0(void) -{ - __pdata uint8_t cs0; - - ao_usb_ep0_state = AO_USB_EP0_IDLE; - for (;;) { - __critical for (;;) { - if (ao_usb_iif & 1) { - ao_usb_iif &= ~1; - break; - } - ao_sleep(&ao_usb_task); - } - USBINDEX = 0; - cs0 = USBCS0; - if (cs0 & USBCS0_SETUP_END) { - USBCS0 = USBCS0_CLR_SETUP_END; - ao_usb_ep0_state = AO_USB_EP0_IDLE; - } - if (cs0 & USBCS0_SENT_STALL) { - USBCS0 = 0; - ao_usb_ep0_state = AO_USB_EP0_IDLE; - } - if (ao_usb_ep0_state == AO_USB_EP0_DATA_IN && - (cs0 & USBCS0_INPKT_RDY) == 0) - { - ao_usb_ep0_flush(); - } - if (cs0 & USBCS0_OUTPKT_RDY) { - switch (ao_usb_ep0_state) { - case AO_USB_EP0_IDLE: - ao_usb_ep0_setup(); - break; - case AO_USB_EP0_DATA_OUT: - ao_usb_ep0_fill(); - USBINDEX = 0; - if (ao_usb_ep0_out_len == 0) { - ao_usb_ep0_state = AO_USB_EP0_IDLE; - USBCS0 = USBCS0_CLR_OUTPKT_RDY | USBCS0_DATA_END; - } else - USBCS0 = USBCS0_CLR_OUTPKT_RDY; - break; - } - } - } -} - -/* Wait for a free IN buffer */ -static void -ao_usb_in_wait(void) -{ - for (;;) { - USBINDEX = AO_USB_IN_EP; - if ((USBCSIL & USBCSIL_INPKT_RDY) == 0) - break; - ao_sleep(&ao_usb_in_bytes); - } -} - -/* Send the current IN packet */ -static void -ao_usb_in_send(void) -{ - USBINDEX = AO_USB_IN_EP; - USBCSIL |= USBCSIL_INPKT_RDY; - ao_usb_in_bytes_last = ao_usb_in_bytes; - ao_usb_in_bytes = 0; -} - -void -ao_usb_flush(void) __critical -{ - if (!ao_usb_running) - return; - - /* If there are pending bytes, or if the last packet was full, - * send another IN packet - */ - if (ao_usb_in_bytes || (ao_usb_in_bytes_last == AO_USB_IN_SIZE)) { - ao_usb_in_wait(); - ao_usb_in_send(); - } -} - -void -ao_usb_putchar(char c) __critical __reentrant -{ - if (!ao_usb_running) - return; - - ao_usb_in_wait(); - - /* Queue a byte, sending the packet when full */ - USBFIFO[AO_USB_IN_EP << 1] = c; - if (++ao_usb_in_bytes == AO_USB_IN_SIZE) - ao_usb_in_send(); -} - -int -_ao_usb_pollchar(void) -{ - uint8_t c; - if (ao_usb_out_bytes == 0) { - USBINDEX = AO_USB_OUT_EP; - if ((USBCSOL & USBCSOL_OUTPKT_RDY) == 0) - return AO_READ_AGAIN; - ao_usb_out_bytes = (USBCNTH << 8) | USBCNTL; - if (ao_usb_out_bytes == 0) { - USBINDEX = AO_USB_OUT_EP; - USBCSOL &= ~USBCSOL_OUTPKT_RDY; - return AO_READ_AGAIN; - } - } - --ao_usb_out_bytes; - c = USBFIFO[AO_USB_OUT_EP << 1]; - if (ao_usb_out_bytes == 0) { - USBINDEX = AO_USB_OUT_EP; - USBCSOL &= ~USBCSOL_OUTPKT_RDY; - } - return c; -} - -char -ao_usb_getchar(void) -{ - int c; - - ao_arch_block_interrupts(); - while ((c = _ao_usb_pollchar()) == AO_READ_AGAIN) - ao_sleep(&ao_stdin_ready); - ao_arch_release_interrupts(); - return c; -} - -void -ao_usb_enable(void) -{ - /* Turn on the USB controller */ - SLEEP |= SLEEP_USB_EN; - - ao_usb_set_configuration(); - - ao_usb_set_interrupts(); - - /* enable USB interrupts */ - IEN2 |= IEN2_USBIE; - - /* Clear any pending interrupts */ - USBCIF = 0; - USBOIF = 0; - USBIIF = 0; -#if HAS_USB_PULLUP - ao_gpio_set(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, AO_USB_PULLUP, 0); -#endif -} - -void -ao_usb_disable(void) -{ - /* Disable USB interrupts */ - USBIIE = 0; - USBOIE = 0; - USBCIE = 0; - IEN2 &= ~IEN2_USBIE; - -#if HAS_USB_PULLUP - ao_gpio_set(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, AO_USB_PULLUP, 0); -#endif - - /* Clear any pending interrupts */ - USBCIF = 0; - USBOIF = 0; - USBIIF = 0; - - /* Turn off the USB controller */ - SLEEP &= ~SLEEP_USB_EN; -} - -void -ao_usb_init(void) -{ -#if HAS_USB_PULLUP - ao_enable_output(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, AO_USB_PULLUP, 0); -#endif - ao_usb_enable(); - - ao_add_task(&ao_usb_task, ao_usb_ep0, "usb"); - ao_add_stdio(_ao_usb_pollchar, ao_usb_putchar, ao_usb_flush); -} diff --git a/src/cc1111/cc1111.h b/src/cc1111/cc1111.h deleted file mode 100644 index 7d7c3a20..00000000 --- a/src/cc1111/cc1111.h +++ /dev/null @@ -1,1390 +0,0 @@ -/*------------------------------------------------------------------------- - Register Declarations for the ChipCon CC1111 Processor Range - - Copyright © 2008 Keith Packard - - 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. - - Adapted from the Cygnal C8051F12x config file which is: - - Copyright (C) 2003 - Maarten Brock, sourceforge.brock@dse.nl - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --------------------------------------------------------------------------*/ - -#ifndef _CC1111_H_ -#define _CC1111_H_ -#include -#include - -__sfr __at 0xA8 IEN0; /* Interrupt Enable 0 Register */ - -__sbit __at 0xA8 RFTXRXIE; /* RF TX/RX done interrupt enable */ -__sbit __at 0xA9 ADCIE; /* ADC interrupt enable */ -__sbit __at 0xAA URX0IE; /* USART0 RX interrupt enable */ -__sbit __at 0xAB URX1IE; /* USART1 RX interrupt enable (shared with I2S RX) */ -__sbit __at 0xAB I2SRXIE; /* I2S RX interrupt enable (shared with USART1 RX) */ -__sbit __at 0xAC ENCIE; /* AES encryption/decryption interrupt enable */ -__sbit __at 0xAD STIE; /* Sleep Timer interrupt enable */ -__sbit __at 0xAF EA; /* Enable All */ - -#define IEN0_EA (1 << 7) -#define IEN0_STIE (1 << 5) -#define IEN0_ENCIE (1 << 4) -#define IEN0_URX1IE (1 << 3) -#define IEN0_I2SRXIE (1 << 3) -#define IEN0_URX0IE (1 << 2) -#define IEN0_ADCIE (1 << 1) -#define IEN0_RFTXRXIE (1 << 0) - -__sfr __at 0xB8 IEN1; /* Interrupt Enable 1 Register */ - -#define IEN1_P0IE (1 << 5) /* Port 0 interrupt enable */ -#define IEN1_T4IE (1 << 4) /* Timer 4 interrupt enable */ -#define IEN1_T3IE (1 << 3) /* Timer 3 interrupt enable */ -#define IEN1_T2IE (1 << 2) /* Timer 2 interrupt enable */ -#define IEN1_T1IE (1 << 1) /* Timer 1 interrupt enable */ -#define IEN1_DMAIE (1 << 0) /* DMA transfer interrupt enable */ - -/* IEN2 */ -__sfr __at 0x9A IEN2; /* Interrupt Enable 2 Register */ - -#define IEN2_WDTIE (1 << 5) /* Watchdog timer interrupt enable */ -#define IEN2_P1IE (1 << 4) /* Port 1 interrupt enable */ -#define IEN2_UTX1IE (1 << 3) /* USART1 TX interrupt enable */ -#define IEN2_I2STXIE (1 << 3) /* I2S TX interrupt enable */ -#define IEN2_UTX0IE (1 << 2) /* USART0 TX interrupt enable */ -#define IEN2_P2IE (1 << 1) /* Port 2 interrupt enable */ -#define IEN2_USBIE (1 << 1) /* USB interrupt enable */ -#define IEN2_RFIE (1 << 0) /* RF general interrupt enable */ - -/* CLKCON 0xC6 */ -__sfr __at 0xC6 CLKCON; /* Clock Control */ - -#define CLKCON_OSC32K_RC (1 << 7) -#define CLKCON_OSC32K_XTAL (0 << 7) -#define CLKCON_OSC32K_MASK (1 << 7) -#define CLKCON_OSC_RC (1 << 6) -#define CLKCON_OSC_XTAL (0 << 6) -#define CLKCON_OSC_MASK (1 << 6) -#define CLKCON_TICKSPD_MASK (7 << 3) -# define CLKCON_TICKSPD_1 (0 << 3) -# define CLKCON_TICKSPD_1_2 (1 << 3) -# define CLKCON_TICKSPD_1_4 (2 << 3) -# define CLKCON_TICKSPD_1_8 (3 << 3) -# define CLKCON_TICKSPD_1_16 (4 << 3) -# define CLKCON_TICKSPD_1_32 (5 << 3) -# define CLKCON_TICKSPD_1_64 (6 << 3) -# define CLKCON_TICKSPD_1_128 (7 << 3) - -#define CLKCON_CLKSPD_MASK (7 << 0) -# define CLKCON_CLKSPD_1 (0 << 0) -# define CLKCON_CLKSPD_1_2 (1 << 0) -# define CLKCON_CLKSPD_1_4 (2 << 0) -# define CLKCON_CLKSPD_1_8 (3 << 0) -# define CLKCON_CLKSPD_1_16 (4 << 0) -# define CLKCON_CLKSPD_1_32 (5 << 0) -# define CLKCON_CLKSPD_1_64 (6 << 0) -# define CLKCON_CLKSPD_1_128 (7 << 0) - -/* SLEEP 0xBE */ -#define SLEEP_USB_EN (1 << 7) -#define SLEEP_XOSC_STB (1 << 6) -#define SLEEP_HFRC_STB (1 << 5) -#define SLEEP_RST_POWER (0 << 3) -#define SLEEP_RST_EXTERNAL (1 << 3) -#define SLEEP_RST_WATCHDOG (2 << 3) -#define SLEEP_RST_MASK (3 << 3) -#define SLEEP_OSC_PD (1 << 2) -#define SLEEP_MODE_PM0 (0 << 0) -#define SLEEP_MODE_PM1 (1 << 0) -#define SLEEP_MODE_PM2 (2 << 0) -#define SLEEP_MODE_PM3 (3 << 0) -#define SLEEP_MODE_MASK (3 << 0) - -/* PCON 0x87 */ -__sfr __at 0x87 PCON; /* Power Mode Control Register */ - -#define PCON_IDLE (1 << 0) - -/* - * TCON - */ -__sfr __at 0x88 TCON; /* CPU Interrupt Flag 1 */ - -__sbit __at 0x8F URX1IF; /* USART1 RX interrupt flag. Automatically cleared */ -__sbit __at 0x8F I2SRXIF; /* I2S RX interrupt flag. Automatically cleared */ -__sbit __at 0x8D ADCIF; /* ADC interrupt flag. Automatically cleared */ -__sbit __at 0x8B URX0IF; /* USART0 RX interrupt flag. Automatically cleared */ -__sbit __at 0x89 RFTXRXIF; /* RF TX/RX complete interrupt flag. Automatically cleared */ - -#define TCON_URX1IF (1 << 7) -#define TCON_I2SRXIF (1 << 7) -#define TCON_ADCIF (1 << 5) -#define TCON_URX0IF (1 << 3) -#define TCON_RFTXRXIF (1 << 1) - -/* - * S0CON - */ -__sfr __at 0x98 S0CON; /* CPU Interrupt Flag 2 */ - -__sbit __at 0x98 ENCIF_0; /* AES interrupt 0. */ -__sbit __at 0x99 ENCIF_1; /* AES interrupt 1. */ - -#define S0CON_ENCIF_1 (1 << 1) -#define S0CON_ENCIF_0 (1 << 0) - -/* - * S1CON - */ -__sfr __at 0x9B S1CON; /* CPU Interrupt Flag 3 */ - -#define S1CON_RFIF_1 (1 << 1) -#define S1CON_RFIF_0 (1 << 0) - -/* - * IRCON - */ -__sfr __at 0xC0 IRCON; /* CPU Interrupt Flag 4 */ - -__sbit __at 0xC0 DMAIF; /* DMA complete interrupt flag */ -__sbit __at 0xC1 T1IF; /* Timer 1 interrupt flag. Automatically cleared */ -__sbit __at 0xC2 T2IF; /* Timer 2 interrupt flag. Automatically cleared */ -__sbit __at 0xC3 T3IF; /* Timer 3 interrupt flag. Automatically cleared */ -__sbit __at 0xC4 T4IF; /* Timer 4 interrupt flag. Automatically cleared */ -__sbit __at 0xC5 P0IF; /* Port0 interrupt flag */ -__sbit __at 0xC7 STIF; /* Sleep Timer interrupt flag */ - -#define IRCON_DMAIF (1 << 0) /* DMA complete interrupt flag */ -#define IRCON_T1IF (1 << 1) /* Timer 1 interrupt flag. Automatically cleared */ -#define IRCON_T2IF (1 << 2) /* Timer 2 interrupt flag. Automatically cleared */ -#define IRCON_T3IF (1 << 3) /* Timer 3 interrupt flag. Automatically cleared */ -#define IRCON_T4IF (1 << 4) /* Timer 4 interrupt flag. Automatically cleared */ -#define IRCON_P0IF (1 << 5) /* Port0 interrupt flag */ -#define IRCON_STIF (1 << 7) /* Sleep Timer interrupt flag */ - -/* - * IRCON2 - */ -__sfr __at 0xE8 IRCON2; /* CPU Interrupt Flag 5 */ - -__sbit __at 0xE8 USBIF; /* USB interrupt flag (shared with Port2) */ -__sbit __at 0xE8 P2IF; /* Port2 interrupt flag (shared with USB) */ -__sbit __at 0xE9 UTX0IF; /* USART0 TX interrupt flag */ -__sbit __at 0xEA UTX1IF; /* USART1 TX interrupt flag (shared with I2S TX) */ -__sbit __at 0xEA I2STXIF; /* I2S TX interrupt flag (shared with USART1 TX) */ -__sbit __at 0xEB P1IF; /* Port1 interrupt flag */ -__sbit __at 0xEC WDTIF; /* Watchdog timer interrupt flag */ - -#define IRCON2_USBIF (1 << 0) /* USB interrupt flag (shared with Port2) */ -#define IRCON2_P2IF (1 << 0) /* Port2 interrupt flag (shared with USB) */ -#define IRCON2_UTX0IF (1 << 1) /* USART0 TX interrupt flag */ -#define IRCON2_UTX1IF (1 << 2) /* USART1 TX interrupt flag (shared with I2S TX) */ -#define IRCON2_I2STXIF (1 << 2) /* I2S TX interrupt flag (shared with USART1 TX) */ -#define IRCON2_P1IF (1 << 3) /* Port1 interrupt flag */ -#define IRCON2_WDTIF (1 << 4) /* Watchdog timer interrupt flag */ - -/* - * IP1 - Interrupt Priority 1 - */ - -/* - * Interrupt priority groups: - * - * IPG0 RFTXRX RF DMA - * IPG1 ADC T1 P2INT/USB - * IPG2 URX0 T2 UTX0 - * IPG3 URX1/I2SRX T3 UTX1 / I2STX - * IPG4 ENC T4 P1INT - * IPG5 ST P0INT WDT - * - * Priority = (IP1 << 1) | IP0. Higher priority interrupts served first - */ - -__sfr __at 0xB9 IP1; /* Interrupt Priority 1 */ -__sfr __at 0xA9 IP0; /* Interrupt Priority 0 */ - -#define IP1_IPG5 (1 << 5) -#define IP1_IPG4 (1 << 4) -#define IP1_IPG3 (1 << 3) -#define IP1_IPG2 (1 << 2) -#define IP1_IPG1 (1 << 1) -#define IP1_IPG0 (1 << 0) - -#define IP0_IPG5 (1 << 5) -#define IP0_IPG4 (1 << 4) -#define IP0_IPG3 (1 << 3) -#define IP0_IPG2 (1 << 2) -#define IP0_IPG1 (1 << 1) -#define IP0_IPG0 (1 << 0) - -/* - * Timer 1 - */ -#define T1CTL_MODE_SUSPENDED (0 << 0) -#define T1CTL_MODE_FREE (1 << 0) -#define T1CTL_MODE_MODULO (2 << 0) -#define T1CTL_MODE_UP_DOWN (3 << 0) -#define T1CTL_MODE_MASK (3 << 0) -#define T1CTL_DIV_1 (0 << 2) -#define T1CTL_DIV_8 (1 << 2) -#define T1CTL_DIV_32 (2 << 2) -#define T1CTL_DIV_128 (3 << 2) -#define T1CTL_DIV_MASK (3 << 2) -#define T1CTL_OVFIF (1 << 4) -#define T1CTL_CH0IF (1 << 5) -#define T1CTL_CH1IF (1 << 6) -#define T1CTL_CH2IF (1 << 7) - -#define T1CCTL_NO_CAPTURE (0 << 0) -#define T1CCTL_CAPTURE_RISING (1 << 0) -#define T1CCTL_CAPTURE_FALLING (2 << 0) -#define T1CCTL_CAPTURE_BOTH (3 << 0) -#define T1CCTL_CAPTURE_MASK (3 << 0) - -#define T1CCTL_MODE_CAPTURE (0 << 2) -#define T1CCTL_MODE_COMPARE (1 << 2) - -#define T1CTL_CMP_SET (0 << 3) -#define T1CTL_CMP_CLEAR (1 << 3) -#define T1CTL_CMP_TOGGLE (2 << 3) -#define T1CTL_CMP_SET_CLEAR (3 << 3) -#define T1CTL_CMP_CLEAR_SET (4 << 3) - -#define T1CTL_IM_DISABLED (0 << 6) -#define T1CTL_IM_ENABLED (1 << 6) - -#define T1CTL_CPSEL_NORMAL (0 << 7) -#define T1CTL_CPSEL_RF (1 << 7) - -/* - * Timer 3 and Timer 4 - */ - -/* Timer count */ -__sfr __at 0xCA T3CNT; -__sfr __at 0xEA T4CNT; - -/* Timer control */ - -__sfr __at 0xCB T3CTL; -__sfr __at 0xEB T4CTL; - -#define TxCTL_DIV_1 (0 << 5) -#define TxCTL_DIV_2 (1 << 5) -#define TxCTL_DIV_4 (2 << 5) -#define TxCTL_DIV_8 (3 << 5) -#define TxCTL_DIV_16 (4 << 5) -#define TxCTL_DIV_32 (5 << 5) -#define TxCTL_DIV_64 (6 << 5) -#define TxCTL_DIV_128 (7 << 5) -#define TxCTL_START (1 << 4) -#define TxCTL_OVFIM (1 << 3) -#define TxCTL_CLR (1 << 2) -#define TxCTL_MODE_FREE (0 << 0) -#define TxCTL_MODE_DOWN (1 << 0) -#define TxCTL_MODE_MODULO (2 << 0) -#define TxCTL_MODE_UP_DOWN (3 << 0) - -/* Timer 4 channel 0 compare control */ - -__sfr __at 0xCC T3CCTL0; -__sfr __at 0xCE T3CCTL1; -__sfr __at 0xEC T4CCTL0; -__sfr __at 0xEE T4CCTL1; - -#define TxCCTLy_IM (1 << 6) -#define TxCCTLy_CMP_SET (0 << 3) -#define TxCCTLy_CMP_CLEAR (1 << 3) -#define TxCCTLy_CMP_TOGGLE (2 << 3) -#define TxCCTLy_CMP_SET_UP_CLEAR_DOWN (3 << 3) -#define TxCCTLy_CMP_CLEAR_UP_SET_DOWN (4 << 3) -#define TxCCTLy_CMP_SET_CLEAR_FF (5 << 3) -#define TxCCTLy_CMP_CLEAR_SET_00 (6 << 3) -#define TxCCTLy_CMP_MODE_ENABLE (1 << 2) - -/* Timer compare value */ -__sfr __at 0xCD T3CC0; -__sfr __at 0xCF T3CC1; -__sfr __at 0xED T4CC0; -__sfr __at 0xEF T4CC1; - -/* - * Peripheral control - */ - -__sfr __at 0xf1 PERCFG; -#define PERCFG_T1CFG_ALT_1 (0 << 6) -#define PERCFG_T1CFG_ALT_2 (1 << 6) -#define PERCFG_T1CFG_ALT_MASK (1 << 6) - -#define PERCFG_T3CFG_ALT_1 (0 << 5) -#define PERCFG_T3CFG_ALT_2 (1 << 5) -#define PERCFG_T3CFG_ALT_MASK (1 << 5) - -#define PERCFG_T4CFG_ALT_1 (0 << 4) -#define PERCFG_T4CFG_ALT_2 (1 << 4) -#define PERCFG_T4CFG_ALT_MASK (1 << 4) - -#define PERCFG_U1CFG_ALT_1 (0 << 1) -#define PERCFG_U1CFG_ALT_2 (1 << 1) -#define PERCFG_U1CFG_ALT_MASK (1 << 1) - -#define PERCFG_U0CFG_ALT_1 (0 << 0) -#define PERCFG_U0CFG_ALT_2 (1 << 0) -#define PERCFG_U0CFG_ALT_MASK (1 << 0) - -/* directly addressed USB registers */ -__xdata __at (0xde00) volatile uint8_t USBADDR; -__xdata __at (0xde01) volatile uint8_t USBPOW; -__xdata __at (0xde02) volatile uint8_t USBIIF; - -__xdata __at (0xde04) volatile uint8_t USBOIF; - -__xdata __at (0xde06) volatile uint8_t USBCIF; - -# define USBCIF_SOFIF (1 << 3) -# define USBCIF_RSTIF (1 << 2) -# define USBCIF_RESUMEIF (1 << 1) -# define USBCIF_SUSPENDIF (1 << 0) - -__xdata __at (0xde07) volatile uint8_t USBIIE; - -__xdata __at (0xde09) volatile uint8_t USBOIE; - -__xdata __at (0xde0b) volatile uint8_t USBCIE; - -# define USBCIE_SOFIE (1 << 3) -# define USBCIE_RSTIE (1 << 2) -# define USBCIE_RESUMEIE (1 << 1) -# define USBCIE_SUSPENDIE (1 << 0) - -__xdata __at (0xde0c) volatile uint8_t USBFRML; -__xdata __at (0xde0d) volatile uint8_t USBFRMH; -__xdata __at (0xde0e) volatile uint8_t USBINDEX; - -/* indexed USB registers, must set USBINDEX to 0-5 */ -__xdata __at (0xde10) volatile uint8_t USBMAXI; -__xdata __at (0xde11) volatile uint8_t USBCS0; - -# define USBCS0_CLR_SETUP_END (1 << 7) -# define USBCS0_CLR_OUTPKT_RDY (1 << 6) -# define USBCS0_SEND_STALL (1 << 5) -# define USBCS0_SETUP_END (1 << 4) -# define USBCS0_DATA_END (1 << 3) -# define USBCS0_SENT_STALL (1 << 2) -# define USBCS0_INPKT_RDY (1 << 1) -# define USBCS0_OUTPKT_RDY (1 << 0) - -__xdata __at (0xde11) volatile uint8_t USBCSIL; - -# define USBCSIL_CLR_DATA_TOG (1 << 6) -# define USBCSIL_SENT_STALL (1 << 5) -# define USBCSIL_SEND_STALL (1 << 4) -# define USBCSIL_FLUSH_PACKET (1 << 3) -# define USBCSIL_UNDERRUN (1 << 2) -# define USBCSIL_PKT_PRESENT (1 << 1) -# define USBCSIL_INPKT_RDY (1 << 0) - -__xdata __at (0xde12) volatile uint8_t USBCSIH; - -# define USBCSIH_AUTOSET (1 << 7) -# define USBCSIH_ISO (1 << 6) -# define USBCSIH_FORCE_DATA_TOG (1 << 3) -# define USBCSIH_IN_DBL_BUF (1 << 0) - -__xdata __at (0xde13) volatile uint8_t USBMAXO; -__xdata __at (0xde14) volatile uint8_t USBCSOL; - -# define USBCSOL_CLR_DATA_TOG (1 << 7) -# define USBCSOL_SENT_STALL (1 << 6) -# define USBCSOL_SEND_STALL (1 << 5) -# define USBCSOL_FLUSH_PACKET (1 << 4) -# define USBCSOL_DATA_ERROR (1 << 3) -# define USBCSOL_OVERRUN (1 << 2) -# define USBCSOL_FIFO_FULL (1 << 1) -# define USBCSOL_OUTPKT_RDY (1 << 0) - -__xdata __at (0xde15) volatile uint8_t USBCSOH; - -# define USBCSOH_AUTOCLEAR (1 << 7) -# define USBCSOH_ISO (1 << 6) -# define USBCSOH_OUT_DBL_BUF (1 << 0) - -__xdata __at (0xde16) volatile uint8_t USBCNT0; -__xdata __at (0xde16) volatile uint8_t USBCNTL; -__xdata __at (0xde17) volatile uint8_t USBCNTH; - -__xdata __at (0xde20) volatile uint8_t USBFIFO[12]; - -/* ADC Data register, low and high */ -__sfr __at 0xBA ADCL; -__sfr __at 0xBB ADCH; -__xdata __at (0xDFBA) volatile uint16_t ADCXDATA; - -/* ADC Control Register 1 */ -__sfr __at 0xB4 ADCCON1; - -# define ADCCON1_EOC (1 << 7) /* conversion complete */ -# define ADCCON1_ST (1 << 6) /* start conversion */ - -# define ADCCON1_STSEL_MASK (3 << 4) /* start select */ -# define ADCCON1_STSEL_EXTERNAL (0 << 4) /* P2_0 pin triggers */ -# define ADCCON1_STSEL_FULLSPEED (1 << 4) /* full speed, no waiting */ -# define ADCCON1_STSEL_TIMER1 (2 << 4) /* timer 1 channel 0 */ -# define ADCCON1_STSEL_START (3 << 4) /* set start bit */ - -# define ADCCON1_RCTRL_MASK (3 << 2) /* random number control */ -# define ADCCON1_RCTRL_COMPLETE (0 << 2) /* operation completed */ -# define ADCCON1_RCTRL_CLOCK_LFSR (1 << 2) /* Clock the LFSR once */ - -/* ADC Control Register 2 */ -__sfr __at 0xB5 ADCCON2; - -# define ADCCON2_SREF_MASK (3 << 6) /* reference voltage */ -# define ADCCON2_SREF_1_25V (0 << 6) /* internal 1.25V */ -# define ADCCON2_SREF_EXTERNAL (1 << 6) /* external on AIN7 cc1110 */ -# define ADCCON2_SREF_VDD (2 << 6) /* VDD on the AVDD pin */ -# define ADCCON2_SREF_EXTERNAL_DIFF (3 << 6) /* external on AIN6-7 cc1110 */ - -# define ADCCON2_SDIV_MASK (3 << 4) /* decimation rate */ -# define ADCCON2_SDIV_64 (0 << 4) /* 7 bits */ -# define ADCCON2_SDIV_128 (1 << 4) /* 9 bits */ -# define ADCCON2_SDIV_256 (2 << 4) /* 10 bits */ -# define ADCCON2_SDIV_512 (3 << 4) /* 12 bits */ - -# define ADCCON2_SCH_MASK (0xf << 0) /* Sequence channel select */ -# define ADCCON2_SCH_SHIFT 0 -# define ADCCON2_SCH_AIN0 (0 << 0) -# define ADCCON2_SCH_AIN1 (1 << 0) -# define ADCCON2_SCH_AIN2 (2 << 0) -# define ADCCON2_SCH_AIN3 (3 << 0) -# define ADCCON2_SCH_AIN4 (4 << 0) -# define ADCCON2_SCH_AIN5 (5 << 0) -# define ADCCON2_SCH_AIN6 (6 << 0) -# define ADCCON2_SCH_AIN7 (7 << 0) -# define ADCCON2_SCH_AIN0_AIN1 (8 << 0) -# define ADCCON2_SCH_AIN2_AIN3 (9 << 0) -# define ADCCON2_SCH_AIN4_AIN5 (0xa << 0) -# define ADCCON2_SCH_AIN6_AIN7 (0xb << 0) -# define ADCCON2_SCH_GND (0xc << 0) -# define ADCCON2_SCH_VREF (0xd << 0) -# define ADCCON2_SCH_TEMP (0xe << 0) -# define ADCCON2_SCH_VDD_3 (0xf << 0) - - -/* ADC Control Register 3 */ -__sfr __at 0xB6 ADCCON3; - -# define ADCCON3_EREF_MASK (3 << 6) /* extra conversion reference */ -# define ADCCON3_EREF_1_25 (0 << 6) /* internal 1.25V */ -# define ADCCON3_EREF_EXTERNAL (1 << 6) /* external AIN7 cc1110 */ -# define ADCCON3_EREF_VDD (2 << 6) /* VDD on the AVDD pin */ -# define ADCCON3_EREF_EXTERNAL_DIFF (3 << 6) /* external AIN6-7 cc1110 */ -# define ADCCON3_EDIV_MASK (3 << 4) /* extral decimation */ -# define ADCCON3_EDIV_64 (0 << 4) /* 7 bits */ -# define ADCCON3_EDIV_128 (1 << 4) /* 9 bits */ -# define ADCCON3_EDIV_256 (2 << 4) /* 10 bits */ -# define ADCCON3_EDIV_512 (3 << 4) /* 12 bits */ -# define ADCCON3_ECH_MASK (0xf << 0) /* Sequence channel select */ -# define ADCCON3_ECH_SHIFT 0 -# define ADCCON3_ECH_AIN0 (0 << 0) -# define ADCCON3_ECH_AIN1 (1 << 0) -# define ADCCON3_ECH_AIN2 (2 << 0) -# define ADCCON3_ECH_AIN3 (3 << 0) -# define ADCCON3_ECH_AIN4 (4 << 0) -# define ADCCON3_ECH_AIN5 (5 << 0) -# define ADCCON3_ECH_AIN6 (6 << 0) -# define ADCCON3_ECH_AIN7 (7 << 0) -# define ADCCON3_ECH_AIN0_AIN1 (8 << 0) -# define ADCCON3_ECH_AIN2_AIN3 (9 << 0) -# define ADCCON3_ECH_AIN4_AIN5 (0xa << 0) -# define ADCCON3_ECH_AIN6_AIN7 (0xb << 0) -# define ADCCON3_ECH_GND (0xc << 0) -# define ADCCON3_ECH_VREF (0xd << 0) -# define ADCCON3_ECH_TEMP (0xe << 0) -# define ADCCON3_ECH_VDD_3 (0xf << 0) - -/* - * ADC configuration register, this selects which - * GPIO pins are to be used as ADC inputs - */ -__sfr __at 0xF2 ADCCFG; - -/* - * Watchdog timer - */ - -__sfr __at 0xc9 WDCTL; - -#define WDCTL_CLEAR_FIRST (0xa << 4) -#define WDCTL_CLEAR_SECOND (0x5 << 4) -#define WDCTL_EN (1 << 3) -#define WDCTL_MODE_WATCHDOG (0 << 2) -#define WDCTL_MODE_TIMER (1 << 2) -#define WDCTL_MODE_MASK (1 << 2) -#define WDCTL_INT_32768 (0 << 0) -#define WDCTL_INT_8192 (1 << 0) -#define WDCTL_INT_512 (2 << 0) -#define WDCTL_INT_64 (3 << 0) - -/* - * Pin selectors, these set which pins are - * using their peripheral function - */ -__sfr __at 0xF3 P0SEL; -__sfr __at 0xF4 P1SEL; -__sfr __at 0xF5 P2SEL; - -#define P2SEL_PRI3P1_USART0 (0 << 6) -#define P2SEL_PRI3P1_USART1 (1 << 6) -#define P2SEL_PRI3P1_MASK (1 << 6) -#define P2SEL_PRI2P1_USART1 (0 << 5) -#define P2SEL_PRI2P1_TIMER3 (1 << 5) -#define P2SEL_PRI2P1_MASK (1 << 5) -#define P2SEL_PRI1P1_TIMER1 (0 << 4) -#define P2SEL_PRI1P1_TIMER4 (1 << 4) -#define P2SEL_PRI1P1_MASK (1 << 4) -#define P2SEL_PRI0P1_USART0 (0 << 3) -#define P2SEL_PRI0P1_TIMER1 (1 << 3) -#define P2SEL_PRI0P1_MASK (1 << 3) -#define P2SEL_SELP2_4_GPIO (0 << 2) -#define P2SEL_SELP2_4_PERIPHERAL (1 << 2) -#define P2SEL_SELP2_4_MASK (1 << 2) -#define P2SEL_SELP2_3_GPIO (0 << 1) -#define P2SEL_SELP2_3_PERIPHERAL (1 << 1) -#define P2SEL_SELP2_3_MASK (1 << 1) -#define P2SEL_SELP2_0_GPIO (0 << 0) -#define P2SEL_SELP2_0_PERIPHERAL (1 << 0) -#define P2SEL_SELP2_0_MASK (1 << 0) - -/* - * For pins used as GPIOs, these set which are used as outputs - */ -__sfr __at 0xFD P0DIR; -__sfr __at 0xFE P1DIR; -__sfr __at 0xFF P2DIR; - -#define P2DIR_PRIP0_USART0_USART1 (0 << 6) -#define P2DIR_PRIP0_USART1_USART0 (1 << 6) -#define P2DIR_PRIP0_TIMER1_01_USART1 (2 << 6) -#define P2DIR_PRIP0_TIMER1_2_USART0 (3 << 6) -#define P2DIR_PRIP0_MASK (3 << 6) - -__sfr __at 0x8F P0INP; - -/* Select between tri-state and pull up/down - * for pins P0_0 - P0_7. - */ -#define P0INP_MDP0_7_PULL (0 << 7) -#define P0INP_MDP0_7_TRISTATE (1 << 7) -#define P0INP_MDP0_6_PULL (0 << 6) -#define P0INP_MDP0_6_TRISTATE (1 << 6) -#define P0INP_MDP0_5_PULL (0 << 5) -#define P0INP_MDP0_5_TRISTATE (1 << 5) -#define P0INP_MDP0_4_PULL (0 << 4) -#define P0INP_MDP0_4_TRISTATE (1 << 4) -#define P0INP_MDP0_3_PULL (0 << 3) -#define P0INP_MDP0_3_TRISTATE (1 << 3) -#define P0INP_MDP0_2_PULL (0 << 2) -#define P0INP_MDP0_2_TRISTATE (1 << 2) -#define P0INP_MDP0_1_PULL (0 << 1) -#define P0INP_MDP0_1_TRISTATE (1 << 1) -#define P0INP_MDP0_0_PULL (0 << 0) -#define P0INP_MDP0_0_TRISTATE (1 << 0) - -__sfr __at 0xF6 P1INP; - -/* Select between tri-state and pull up/down - * for pins P1_2 - P1_7. Pins P1_0 and P1_1 are - * always tri-stated - */ -#define P1INP_MDP1_7_PULL (0 << 7) -#define P1INP_MDP1_7_TRISTATE (1 << 7) -#define P1INP_MDP1_6_PULL (0 << 6) -#define P1INP_MDP1_6_TRISTATE (1 << 6) -#define P1INP_MDP1_5_PULL (0 << 5) -#define P1INP_MDP1_5_TRISTATE (1 << 5) -#define P1INP_MDP1_4_PULL (0 << 4) -#define P1INP_MDP1_4_TRISTATE (1 << 4) -#define P1INP_MDP1_3_PULL (0 << 3) -#define P1INP_MDP1_3_TRISTATE (1 << 3) -#define P1INP_MDP1_2_PULL (0 << 2) -#define P1INP_MDP1_2_TRISTATE (1 << 2) - -__sfr __at 0xF7 P2INP; -/* P2INP has three extra bits which are used to choose - * between pull-up and pull-down when they are not tri-stated - */ -#define P2INP_PDUP2_PULL_UP (0 << 7) -#define P2INP_PDUP2_PULL_DOWN (1 << 7) -#define P2INP_PDUP1_PULL_UP (0 << 6) -#define P2INP_PDUP1_PULL_DOWN (1 << 6) -#define P2INP_PDUP0_PULL_UP (0 << 5) -#define P2INP_PDUP0_PULL_DOWN (1 << 5) - -/* For the P2 pins, choose between tri-state and pull up/down - * mode - */ -#define P2INP_MDP2_4_PULL (0 << 4) -#define P2INP_MDP2_4_TRISTATE (1 << 4) -#define P2INP_MDP2_3_PULL (0 << 3) -#define P2INP_MDP2_3_TRISTATE (1 << 3) -#define P2INP_MDP2_2_PULL (0 << 2) -#define P2INP_MDP2_2_TRISTATE (1 << 2) -#define P2INP_MDP2_1_PULL (0 << 1) -#define P2INP_MDP2_1_TRISTATE (1 << 1) -#define P2INP_MDP2_0_PULL (0 << 0) -#define P2INP_MDP2_0_TRISTATE (1 << 0) - -/* GPIO interrupt status flags */ -__sfr __at 0x89 P0IFG; -__sfr __at 0x8A P1IFG; -__sfr __at 0x8B P2IFG; - -#define P0IFG_USB_RESUME (1 << 7) - -__sfr __at 0x8C PICTL; -#define PICTL_P2IEN (1 << 5) -#define PICTL_P0IENH (1 << 4) -#define PICTL_P0IENL (1 << 3) -#define PICTL_P2ICON (1 << 2) -#define PICTL_P1ICON (1 << 1) -#define PICTL_P0ICON (1 << 0) - -/* GPIO pins */ -__sfr __at 0x80 P0; - -__sbit __at 0x80 P0_0; -__sbit __at 0x81 P0_1; -__sbit __at 0x82 P0_2; -__sbit __at 0x83 P0_3; -__sbit __at 0x84 P0_4; -__sbit __at 0x85 P0_5; -__sbit __at 0x86 P0_6; -__sbit __at 0x87 P0_7; - -__sfr __at 0x90 P1; - -__sbit __at 0x90 P1_0; -__sbit __at 0x91 P1_1; -__sbit __at 0x92 P1_2; -__sbit __at 0x93 P1_3; -__sbit __at 0x94 P1_4; -__sbit __at 0x95 P1_5; -__sbit __at 0x96 P1_6; -__sbit __at 0x97 P1_7; - -__sfr __at 0xa0 P2; - -__sbit __at 0xa0 P2_0; -__sbit __at 0xa1 P2_1; -__sbit __at 0xa2 P2_2; -__sbit __at 0xa3 P2_3; -__sbit __at 0xa4 P2_4; - -/* DMA controller */ -struct cc_dma_channel { - uint8_t src_high; - uint8_t src_low; - uint8_t dst_high; - uint8_t dst_low; - uint8_t len_high; - uint8_t len_low; - uint8_t cfg0; - uint8_t cfg1; -}; - -# define DMA_LEN_HIGH_VLEN_MASK (7 << 5) -# define DMA_LEN_HIGH_VLEN_LEN (0 << 5) -# define DMA_LEN_HIGH_VLEN_PLUS_1 (1 << 5) -# define DMA_LEN_HIGH_VLEN (2 << 5) -# define DMA_LEN_HIGH_VLEN_PLUS_2 (3 << 5) -# define DMA_LEN_HIGH_VLEN_PLUS_3 (4 << 5) -# define DMA_LEN_HIGH_MASK (0x1f) - -# define DMA_CFG0_WORDSIZE_8 (0 << 7) -# define DMA_CFG0_WORDSIZE_16 (1 << 7) -# define DMA_CFG0_TMODE_MASK (3 << 5) -# define DMA_CFG0_TMODE_SINGLE (0 << 5) -# define DMA_CFG0_TMODE_BLOCK (1 << 5) -# define DMA_CFG0_TMODE_REPEATED_SINGLE (2 << 5) -# define DMA_CFG0_TMODE_REPEATED_BLOCK (3 << 5) - -/* - * DMA triggers - */ -# define DMA_CFG0_TRIGGER_NONE 0 -# define DMA_CFG0_TRIGGER_PREV 1 -# define DMA_CFG0_TRIGGER_T1_CH0 2 -# define DMA_CFG0_TRIGGER_T1_CH1 3 -# define DMA_CFG0_TRIGGER_T1_CH2 4 -# define DMA_CFG0_TRIGGER_T2_OVFL 6 -# define DMA_CFG0_TRIGGER_T3_CH0 7 -# define DMA_CFG0_TRIGGER_T3_CH1 8 -# define DMA_CFG0_TRIGGER_T4_CH0 9 -# define DMA_CFG0_TRIGGER_T4_CH1 10 -# define DMA_CFG0_TRIGGER_IOC_0 12 -# define DMA_CFG0_TRIGGER_IOC_1 13 -# define DMA_CFG0_TRIGGER_URX0 14 -# define DMA_CFG0_TRIGGER_UTX0 15 -# define DMA_CFG0_TRIGGER_URX1 16 -# define DMA_CFG0_TRIGGER_UTX1 17 -# define DMA_CFG0_TRIGGER_FLASH 18 -# define DMA_CFG0_TRIGGER_RADIO 19 -# define DMA_CFG0_TRIGGER_ADC_CHALL 20 -# define DMA_CFG0_TRIGGER_ADC_CH0 21 -# define DMA_CFG0_TRIGGER_ADC_CH1 22 -# define DMA_CFG0_TRIGGER_ADC_CH2 23 -# define DMA_CFG0_TRIGGER_ADC_CH3 24 -# define DMA_CFG0_TRIGGER_ADC_CH4 25 -# define DMA_CFG0_TRIGGER_ADC_CH5 26 -# define DMA_CFG0_TRIGGER_ADC_CH6 27 -# define DMA_CFG0_TRIGGER_I2SRX 27 -# define DMA_CFG0_TRIGGER_ADC_CH7 28 -# define DMA_CFG0_TRIGGER_I2STX 28 -# define DMA_CFG0_TRIGGER_ENC_DW 29 -# define DMA_CFG0_TRIGGER_ENC_UP 30 - -# define DMA_CFG1_SRCINC_MASK (3 << 6) -# define DMA_CFG1_SRCINC_0 (0 << 6) -# define DMA_CFG1_SRCINC_1 (1 << 6) -# define DMA_CFG1_SRCINC_2 (2 << 6) -# define DMA_CFG1_SRCINC_MINUS_1 (3 << 6) - -# define DMA_CFG1_DESTINC_MASK (3 << 4) -# define DMA_CFG1_DESTINC_0 (0 << 4) -# define DMA_CFG1_DESTINC_1 (1 << 4) -# define DMA_CFG1_DESTINC_2 (2 << 4) -# define DMA_CFG1_DESTINC_MINUS_1 (3 << 4) - -# define DMA_CFG1_IRQMASK (1 << 3) -# define DMA_CFG1_M8 (1 << 2) - -# define DMA_CFG1_PRIORITY_MASK (3 << 0) -# define DMA_CFG1_PRIORITY_LOW (0 << 0) -# define DMA_CFG1_PRIORITY_NORMAL (1 << 0) -# define DMA_CFG1_PRIORITY_HIGH (2 << 0) - -/* - * DMAARM - DMA Channel Arm - */ - -__sfr __at 0xD6 DMAARM; - -# define DMAARM_ABORT (1 << 7) -# define DMAARM_DMAARM4 (1 << 4) -# define DMAARM_DMAARM3 (1 << 3) -# define DMAARM_DMAARM2 (1 << 2) -# define DMAARM_DMAARM1 (1 << 1) -# define DMAARM_DMAARM0 (1 << 0) - -/* - * DMAREQ - DMA Channel Start Request and Status - */ - -__sfr __at 0xD7 DMAREQ; - -# define DMAREQ_DMAREQ4 (1 << 4) -# define DMAREQ_DMAREQ3 (1 << 3) -# define DMAREQ_DMAREQ2 (1 << 2) -# define DMAREQ_DMAREQ1 (1 << 1) -# define DMAREQ_DMAREQ0 (1 << 0) - -/* - * DMA configuration 0 address - */ - -__sfr __at 0xD5 DMA0CFGH; -__sfr __at 0xD4 DMA0CFGL; - -/* - * DMA configuration 1-4 address - */ - -__sfr __at 0xD3 DMA1CFGH; -__sfr __at 0xD2 DMA1CFGL; - -/* - * DMAIRQ - DMA Interrupt Flag - */ - -__sfr __at 0xD1 DMAIRQ; - -# define DMAIRQ_DMAIF4 (1 << 4) -# define DMAIRQ_DMAIF3 (1 << 3) -# define DMAIRQ_DMAIF2 (1 << 2) -# define DMAIRQ_DMAIF1 (1 << 1) -# define DMAIRQ_DMAIF0 (1 << 0) - -/* - * UART registers - */ - -/* USART config/status registers */ -__sfr __at 0x86 U0CSR; -__sfr __at 0xF8 U1CSR; - -# define UxCSR_MODE_UART (1 << 7) -# define UxCSR_MODE_SPI (0 << 7) -# define UxCSR_RE (1 << 6) -# define UxCSR_SLAVE (1 << 5) -# define UxCSR_MASTER (0 << 5) -# define UxCSR_FE (1 << 4) -# define UxCSR_ERR (1 << 3) -# define UxCSR_RX_BYTE (1 << 2) -# define UxCSR_TX_BYTE (1 << 1) -# define UxCSR_ACTIVE (1 << 0) - -/* UART configuration registers */ -__sfr __at 0xc4 U0UCR; -__sfr __at 0xfb U1UCR; - -# define UxUCR_FLUSH (1 << 7) -# define UxUCR_FLOW_DISABLE (0 << 6) -# define UxUCR_FLOW_ENABLE (1 << 6) -# define UxUCR_D9_EVEN_PARITY (0 << 5) -# define UxUCR_D9_ODD_PARITY (1 << 5) -# define UxUCR_BIT9_8_BITS (0 << 4) -# define UxUCR_BIT9_9_BITS (1 << 4) -# define UxUCR_PARITY_DISABLE (0 << 3) -# define UxUCR_PARITY_ENABLE (1 << 3) -# define UxUCR_SPB_1_STOP_BIT (0 << 2) -# define UxUCR_SPB_2_STOP_BITS (1 << 2) -# define UxUCR_STOP_LOW (0 << 1) -# define UxUCR_STOP_HIGH (1 << 1) -# define UxUCR_START_LOW (0 << 0) -# define UxUCR_START_HIGH (1 << 0) - -/* USART General configuration registers (mostly SPI) */ -__sfr __at 0xc5 U0GCR; -__sfr __at 0xfc U1GCR; - -# define UxGCR_CPOL_NEGATIVE (0 << 7) -# define UxGCR_CPOL_POSITIVE (1 << 7) -# define UxGCR_CPHA_FIRST_EDGE (0 << 6) -# define UxGCR_CPHA_SECOND_EDGE (1 << 6) -# define UxGCR_ORDER_LSB (0 << 5) -# define UxGCR_ORDER_MSB (1 << 5) -# define UxGCR_BAUD_E_MASK (0x1f) -# define UxGCR_BAUD_E_SHIFT 0 - -/* USART data registers */ -__sfr __at 0xc1 U0DBUF; -__xdata __at (0xDFC1) volatile uint8_t U0DBUFXADDR; -__sfr __at 0xf9 U1DBUF; -__xdata __at (0xDFF9) volatile uint8_t U1DBUFXADDR; - -/* USART baud rate registers, M value */ -__sfr __at 0xc2 U0BAUD; -__sfr __at 0xfa U1BAUD; - -/* Flash controller */ - -__sfr __at 0xAE FCTL; -#define FCTL_BUSY (1 << 7) -#define FCTL_SWBSY (1 << 6) -#define FCTL_CONTRD_ENABLE (1 << 4) -#define FCTL_WRITE (1 << 1) -#define FCTL_ERASE (1 << 0) - -/* Flash write data. Write two bytes here */ -__sfr __at 0xAF FWDATA; -__xdata __at (0xDFAF) volatile uint8_t FWDATAXADDR; - -/* Flash write/erase address */ -__sfr __at 0xAD FADDRH; -__sfr __at 0xAC FADDRL; - -/* Flash timing */ -__sfr __at 0xAB FWT; - -/* Radio */ - -__sfr __at 0xD9 RFD; -__xdata __at (0xDFD9) volatile uint8_t RFDXADDR; - -__sfr __at 0xE9 RFIF; -#define RFIF_IM_TXUNF (1 << 7) -#define RFIF_IM_RXOVF (1 << 6) -#define RFIF_IM_TIMEOUT (1 << 5) -#define RFIF_IM_DONE (1 << 4) -#define RFIF_IM_CS (1 << 3) -#define RFIF_IM_PQT (1 << 2) -#define RFIF_IM_CCA (1 << 1) -#define RFIF_IM_SFD (1 << 0) - -__sfr __at 0x91 RFIM; -#define RFIM_IM_TXUNF (1 << 7) -#define RFIM_IM_RXOVF (1 << 6) -#define RFIM_IM_TIMEOUT (1 << 5) -#define RFIM_IM_DONE (1 << 4) -#define RFIM_IM_CS (1 << 3) -#define RFIM_IM_PQT (1 << 2) -#define RFIM_IM_CCA (1 << 1) -#define RFIM_IM_SFD (1 << 0) - -__sfr __at 0xE1 RFST; - -#define RFST_SFSTXON 0x00 -#define RFST_SCAL 0x01 -#define RFST_SRX 0x02 -#define RFST_STX 0x03 -#define RFST_SIDLE 0x04 - -__xdata __at (0xdf00) uint8_t RF[0x3c]; - -__xdata __at (0xdf2f) uint8_t RF_IOCFG2; -#define RF_IOCFG2_OFF 0x2f - -__xdata __at (0xdf30) uint8_t RF_IOCFG1; -#define RF_IOCFG1_OFF 0x30 - -__xdata __at (0xdf31) uint8_t RF_IOCFG0; -#define RF_IOCFG0_OFF 0x31 - -__xdata __at (0xdf00) uint8_t RF_SYNC1; -#define RF_SYNC1_OFF 0x00 - -__xdata __at (0xdf01) uint8_t RF_SYNC0; -#define RF_SYNC0_OFF 0x01 - -__xdata __at (0xdf02) uint8_t RF_PKTLEN; -#define RF_PKTLEN_OFF 0x02 - -__xdata __at (0xdf03) uint8_t RF_PKTCTRL1; -#define RF_PKTCTRL1_OFF 0x03 -#define PKTCTRL1_PQT_MASK (0x7 << 5) -#define PKTCTRL1_PQT_SHIFT 5 -#define PKTCTRL1_APPEND_STATUS (1 << 2) -#define PKTCTRL1_ADR_CHK_NONE (0 << 0) -#define PKTCTRL1_ADR_CHK_NO_BROADCAST (1 << 0) -#define PKTCTRL1_ADR_CHK_00_BROADCAST (2 << 0) -#define PKTCTRL1_ADR_CHK_00_FF_BROADCAST (3 << 0) - -/* If APPEND_STATUS is used, two bytes will be added to the packet data */ -#define PKT_APPEND_STATUS_0_RSSI_MASK (0xff) -#define PKT_APPEND_STATUS_0_RSSI_SHIFT 0 -#define PKT_APPEND_STATUS_1_CRC_OK (1 << 7) -#define PKT_APPEND_STATUS_1_LQI_MASK (0x7f) -#define PKT_APPEND_STATUS_1_LQI_SHIFT 0 - -__xdata __at (0xdf04) uint8_t RF_PKTCTRL0; -#define RF_PKTCTRL0_OFF 0x04 -#define RF_PKTCTRL0_WHITE_DATA (1 << 6) -#define RF_PKTCTRL0_PKT_FORMAT_NORMAL (0 << 4) -#define RF_PKTCTRL0_PKT_FORMAT_RANDOM (2 << 4) -#define RF_PKTCTRL0_CRC_EN (1 << 2) -#define RF_PKTCTRL0_LENGTH_CONFIG_FIXED (0 << 0) -#define RF_PKTCTRL0_LENGTH_CONFIG_VARIABLE (1 << 0) - -__xdata __at (0xdf05) uint8_t RF_ADDR; -#define RF_ADDR_OFF 0x05 - -__xdata __at (0xdf06) uint8_t RF_CHANNR; -#define RF_CHANNR_OFF 0x06 - -__xdata __at (0xdf07) uint8_t RF_FSCTRL1; -#define RF_FSCTRL1_OFF 0x07 - -#define RF_FSCTRL1_FREQ_IF_SHIFT (0) - -__xdata __at (0xdf08) uint8_t RF_FSCTRL0; -#define RF_FSCTRL0_OFF 0x08 - -#define RF_FSCTRL0_FREQOFF_SHIFT (0) - -__xdata __at (0xdf09) uint8_t RF_FREQ2; -#define RF_FREQ2_OFF 0x09 - -__xdata __at (0xdf0a) uint8_t RF_FREQ1; -#define RF_FREQ1_OFF 0x0a - -__xdata __at (0xdf0b) uint8_t RF_FREQ0; -#define RF_FREQ0_OFF 0x0b - -__xdata __at (0xdf0c) uint8_t RF_MDMCFG4; -#define RF_MDMCFG4_OFF 0x0c - -#define RF_MDMCFG4_CHANBW_E_SHIFT 6 -#define RF_MDMCFG4_CHANBW_M_SHIFT 4 -#define RF_MDMCFG4_DRATE_E_SHIFT 0 - -__xdata __at (0xdf0d) uint8_t RF_MDMCFG3; -#define RF_MDMCFG3_OFF 0x0d - -#define RF_MDMCFG3_DRATE_M_SHIFT 0 - -__xdata __at (0xdf0e) uint8_t RF_MDMCFG2; -#define RF_MDMCFG2_OFF 0x0e - -#define RF_MDMCFG2_DEM_DCFILT_OFF (1 << 7) -#define RF_MDMCFG2_DEM_DCFILT_ON (0 << 7) - -#define RF_MDMCFG2_MOD_FORMAT_MASK (7 << 4) -#define RF_MDMCFG2_MOD_FORMAT_2_FSK (0 << 4) -#define RF_MDMCFG2_MOD_FORMAT_GFSK (1 << 4) -#define RF_MDMCFG2_MOD_FORMAT_ASK_OOK (3 << 4) -#define RF_MDMCFG2_MOD_FORMAT_MSK (7 << 4) - -#define RF_MDMCFG2_MANCHESTER_EN (1 << 3) - -#define RF_MDMCFG2_SYNC_MODE_MASK (0x7 << 0) -#define RF_MDMCFG2_SYNC_MODE_NONE (0x0 << 0) -#define RF_MDMCFG2_SYNC_MODE_15_16 (0x1 << 0) -#define RF_MDMCFG2_SYNC_MODE_16_16 (0x2 << 0) -#define RF_MDMCFG2_SYNC_MODE_30_32 (0x3 << 0) -#define RF_MDMCFG2_SYNC_MODE_NONE_THRES (0x4 << 0) -#define RF_MDMCFG2_SYNC_MODE_15_16_THRES (0x5 << 0) -#define RF_MDMCFG2_SYNC_MODE_16_16_THRES (0x6 << 0) -#define RF_MDMCFG2_SYNC_MODE_30_32_THRES (0x7 << 0) - -__xdata __at (0xdf0f) uint8_t RF_MDMCFG1; -#define RF_MDMCFG1_OFF 0x0f - -#define RF_MDMCFG1_FEC_EN (1 << 7) -#define RF_MDMCFG1_FEC_DIS (0 << 7) - -#define RF_MDMCFG1_NUM_PREAMBLE_MASK (7 << 4) -#define RF_MDMCFG1_NUM_PREAMBLE_2 (0 << 4) -#define RF_MDMCFG1_NUM_PREAMBLE_3 (1 << 4) -#define RF_MDMCFG1_NUM_PREAMBLE_4 (2 << 4) -#define RF_MDMCFG1_NUM_PREAMBLE_6 (3 << 4) -#define RF_MDMCFG1_NUM_PREAMBLE_8 (4 << 4) -#define RF_MDMCFG1_NUM_PREAMBLE_12 (5 << 4) -#define RF_MDMCFG1_NUM_PREAMBLE_16 (6 << 4) -#define RF_MDMCFG1_NUM_PREAMBLE_24 (7 << 4) - -#define RF_MDMCFG1_CHANSPC_E_MASK (3 << 0) -#define RF_MDMCFG1_CHANSPC_E_SHIFT (0) - -__xdata __at (0xdf10) uint8_t RF_MDMCFG0; -#define RF_MDMCFG0_OFF 0x10 - -#define RF_MDMCFG0_CHANSPC_M_SHIFT (0) - -__xdata __at (0xdf11) uint8_t RF_DEVIATN; -#define RF_DEVIATN_OFF 0x11 - -#define RF_DEVIATN_DEVIATION_E_SHIFT 4 -#define RF_DEVIATN_DEVIATION_M_SHIFT 0 - -__xdata __at (0xdf12) uint8_t RF_MCSM2; -#define RF_MCSM2_OFF 0x12 -#define RF_MCSM2_RX_TIME_RSSI (1 << 4) -#define RF_MCSM2_RX_TIME_QUAL (1 << 3) -#define RF_MCSM2_RX_TIME_MASK (0x7) -#define RF_MCSM2_RX_TIME_SHIFT 0 -#define RF_MCSM2_RX_TIME_END_OF_PACKET (7) - -__xdata __at (0xdf13) uint8_t RF_MCSM1; -#define RF_MCSM1_OFF 0x13 -#define RF_MCSM1_CCA_MODE_ALWAYS (0 << 4) -#define RF_MCSM1_CCA_MODE_RSSI_BELOW (1 << 4) -#define RF_MCSM1_CCA_MODE_UNLESS_RECEIVING (2 << 4) -#define RF_MCSM1_CCA_MODE_RSSI_BELOW_UNLESS_RECEIVING (3 << 4) -#define RF_MCSM1_RXOFF_MODE_IDLE (0 << 2) -#define RF_MCSM1_RXOFF_MODE_FSTXON (1 << 2) -#define RF_MCSM1_RXOFF_MODE_TX (2 << 2) -#define RF_MCSM1_RXOFF_MODE_RX (3 << 2) -#define RF_MCSM1_TXOFF_MODE_IDLE (0 << 0) -#define RF_MCSM1_TXOFF_MODE_FSTXON (1 << 0) -#define RF_MCSM1_TXOFF_MODE_TX (2 << 0) -#define RF_MCSM1_TXOFF_MODE_RX (3 << 0) - -__xdata __at (0xdf14) uint8_t RF_MCSM0; -#define RF_MCSM0_OFF 0x14 -#define RF_MCSM0_FS_AUTOCAL_NEVER (0 << 4) -#define RF_MCSM0_FS_AUTOCAL_FROM_IDLE (1 << 4) -#define RF_MCSM0_FS_AUTOCAL_TO_IDLE (2 << 4) -#define RF_MCSM0_FS_AUTOCAL_TO_IDLE_EVERY_4 (3 << 4) -#define RF_MCSM0_MAGIC_3 (1 << 3) -#define RF_MCSM0_MAGIC_2 (1 << 2) -#define RF_MCSM0_CLOSE_IN_RX_0DB (0 << 0) -#define RF_MCSM0_CLOSE_IN_RX_6DB (1 << 0) -#define RF_MCSM0_CLOSE_IN_RX_12DB (2 << 0) -#define RF_MCSM0_CLOSE_IN_RX_18DB (3 << 0) - -__xdata __at (0xdf15) uint8_t RF_FOCCFG; -#define RF_FOCCFG_OFF 0x15 -#define RF_FOCCFG_FOC_BS_CS_GATE (1 << 5) -#define RF_FOCCFG_FOC_PRE_K_1K (0 << 3) -#define RF_FOCCFG_FOC_PRE_K_2K (1 << 3) -#define RF_FOCCFG_FOC_PRE_K_3K (2 << 3) -#define RF_FOCCFG_FOC_PRE_K_4K (3 << 3) -#define RF_FOCCFG_FOC_POST_K_PRE_K (0 << 2) -#define RF_FOCCFG_FOC_POST_K_PRE_K_OVER_2 (1 << 2) -#define RF_FOCCFG_FOC_LIMIT_0 (0 << 0) -#define RF_FOCCFG_FOC_LIMIT_BW_OVER_8 (1 << 0) -#define RF_FOCCFG_FOC_LIMIT_BW_OVER_4 (2 << 0) -#define RF_FOCCFG_FOC_LIMIT_BW_OVER_2 (3 << 0) - -__xdata __at (0xdf16) uint8_t RF_BSCFG; -#define RF_BSCFG_OFF 0x16 -#define RF_BSCFG_BS_PRE_K_1K (0 << 6) -#define RF_BSCFG_BS_PRE_K_2K (1 << 6) -#define RF_BSCFG_BS_PRE_K_3K (2 << 6) -#define RF_BSCFG_BS_PRE_K_4K (3 << 6) -#define RF_BSCFG_BS_PRE_KP_1KP (0 << 4) -#define RF_BSCFG_BS_PRE_KP_2KP (1 << 4) -#define RF_BSCFG_BS_PRE_KP_3KP (2 << 4) -#define RF_BSCFG_BS_PRE_KP_4KP (3 << 4) -#define RF_BSCFG_BS_POST_KI_PRE_KI (0 << 3) -#define RF_BSCFG_BS_POST_KI_PRE_KI_OVER_2 (1 << 3) -#define RF_BSCFG_BS_POST_KP_PRE_KP (0 << 2) -#define RF_BSCFG_BS_POST_KP_PRE_KP_OVER_2 (1 << 2) -#define RF_BSCFG_BS_LIMIT_0 (0 << 0) -#define RF_BSCFG_BS_LIMIT_3_125 (1 << 0) -#define RF_BSCFG_BS_LIMIT_6_25 (2 << 0) -#define RF_BSCFG_BS_LIMIT_12_5 (3 << 0) - -__xdata __at (0xdf17) uint8_t RF_AGCCTRL2; -#define RF_AGCCTRL2_OFF 0x17 - -#define RF_AGCCTRL2_MAX_DVGA_GAIN_ALL (0 << 6) -#define RF_AGCCTRL2_MAX_DVGA_GAIN_BUT_1 (1 << 6) -#define RF_AGCCTRL2_MAX_DVGA_GAIN_BUT_2 (2 << 6) -#define RF_AGCCTRL2_MAX_DVGA_GAIN_BUT_3 (3 << 6) -#define RF_AGCCTRL2_MAX_LNA_GAIN_0 (0 << 3) -#define RF_AGCCTRL2_MAX_LNA_GAIN_2_6 (1 << 3) -#define RF_AGCCTRL2_MAX_LNA_GAIN_6_1 (2 << 3) -#define RF_AGCCTRL2_MAX_LNA_GAIN_7_4 (3 << 3) -#define RF_AGCCTRL2_MAX_LNA_GAIN_9_2 (4 << 3) -#define RF_AGCCTRL2_MAX_LNA_GAIN_11_5 (5 << 3) -#define RF_AGCCTRL2_MAX_LNA_GAIN_14_6 (6 << 3) -#define RF_AGCCTRL2_MAX_LNA_GAIN_17_1 (7 << 3) -#define RF_AGCCTRL2_MAGN_TARGET_24dB (0 << 0) -#define RF_AGCCTRL2_MAGN_TARGET_27dB (1 << 0) -#define RF_AGCCTRL2_MAGN_TARGET_30dB (2 << 0) -#define RF_AGCCTRL2_MAGN_TARGET_33dB (3 << 0) -#define RF_AGCCTRL2_MAGN_TARGET_36dB (4 << 0) -#define RF_AGCCTRL2_MAGN_TARGET_38dB (5 << 0) -#define RF_AGCCTRL2_MAGN_TARGET_40dB (6 << 0) -#define RF_AGCCTRL2_MAGN_TARGET_42dB (7 << 0) - -__xdata __at (0xdf18) uint8_t RF_AGCCTRL1; -#define RF_AGCCTRL1_OFF 0x18 - -#define RF_AGCCTRL1_AGC_LNA_PRIORITY_0 (0 << 6) -#define RF_AGCCTRL1_AGC_LNA_PRIORITY_1 (1 << 6) -#define RF_AGCCTRL1_CARRIER_SENSE_REL_THR_DISABLE (0 << 4) -#define RF_AGCCTRL1_CARRIER_SENSE_REL_THR_6DB (1 << 4) -#define RF_AGCCTRL1_CARRIER_SENSE_REL_THR_10DB (2 << 4) -#define RF_AGCCTRL1_CARRIER_SENSE_REL_THR_14DB (3 << 4) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_DISABLE (0x8 << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_7DB_BELOW (0x9 << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_6DB_BELOW (0xa << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_5DB_BELOW (0xb << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_4DB_BELOW (0xc << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_3DB_BELOW (0xd << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_2DB_BELOW (0xe << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_1DB_BELOW (0xf << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_0DB (0x0 << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_1DB_ABOVE (0x1 << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_2DB_ABOVE (0x2 << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_3DB_ABOVE (0x3 << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_4DB_ABOVE (0x4 << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_5DB_ABOVE (0x5 << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_6DB_ABOVE (0x6 << 0) -#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_7DB_ABOVE (0x7 << 0) - -__xdata __at (0xdf19) uint8_t RF_AGCCTRL0; -#define RF_AGCCTRL0_OFF 0x19 - -#define RF_AGCCTRL0_HYST_LEVEL_NONE (0 << 6) -#define RF_AGCCTRL0_HYST_LEVEL_LOW (1 << 6) -#define RF_AGCCTRL0_HYST_LEVEL_MEDIUM (2 << 6) -#define RF_AGCCTRL0_HYST_LEVEL_HIGH (3 << 6) -#define RF_AGCCTRL0_WAIT_TIME_8 (0 << 4) -#define RF_AGCCTRL0_WAIT_TIME_16 (1 << 4) -#define RF_AGCCTRL0_WAIT_TIME_24 (2 << 4) -#define RF_AGCCTRL0_WAIT_TIME_32 (3 << 4) -#define RF_AGCCTRL0_AGC_FREEZE_NORMAL (0 << 2) -#define RF_AGCCTRL0_AGC_FREEZE_SYNC (1 << 2) -#define RF_AGCCTRL0_AGC_FREEZE_MANUAL_ANALOG (2 << 2) -#define RF_AGCCTRL0_AGC_FREEZE_MANUAL_BOTH (3 << 2) -#define RF_AGCCTRL0_FILTER_LENGTH_8 (0 << 0) -#define RF_AGCCTRL0_FILTER_LENGTH_16 (1 << 0) -#define RF_AGCCTRL0_FILTER_LENGTH_32 (2 << 0) -#define RF_AGCCTRL0_FILTER_LENGTH_64 (3 << 0) - -__xdata __at (0xdf1a) uint8_t RF_FREND1; -#define RF_FREND1_OFF 0x1a - -#define RF_FREND1_LNA_CURRENT_SHIFT 6 -#define RF_FREND1_LNA2MIX_CURRENT_SHIFT 4 -#define RF_FREND1_LODIV_BUF_CURRENT_RX_SHIFT 2 -#define RF_FREND1_MIX_CURRENT_SHIFT 0 - -__xdata __at (0xdf1b) uint8_t RF_FREND0; -#define RF_FREND0_OFF 0x1b - -#define RF_FREND0_LODIV_BUF_CURRENT_TX_MASK (0x3 << 4) -#define RF_FREND0_LODIV_BUF_CURRENT_TX_SHIFT 4 -#define RF_FREND0_PA_POWER_MASK (0x7) -#define RF_FREND0_PA_POWER_SHIFT 0 - -__xdata __at (0xdf1c) uint8_t RF_FSCAL3; -#define RF_FSCAL3_OFF 0x1c - -__xdata __at (0xdf1d) uint8_t RF_FSCAL2; -#define RF_FSCAL2_OFF 0x1d - -__xdata __at (0xdf1e) uint8_t RF_FSCAL1; -#define RF_FSCAL1_OFF 0x1e - -__xdata __at (0xdf1f) uint8_t RF_FSCAL0; -#define RF_FSCAL0_OFF 0x1f - -__xdata __at (0xdf23) uint8_t RF_TEST2; -#define RF_TEST2_OFF 0x23 - -#define RF_TEST2_NORMAL_MAGIC 0x88 -#define RF_TEST2_RX_LOW_DATA_RATE_MAGIC 0x81 - -__xdata __at (0xdf24) uint8_t RF_TEST1; -#define RF_TEST1_OFF 0x24 - -#define RF_TEST1_TX_MAGIC 0x31 -#define RF_TEST1_RX_LOW_DATA_RATE_MAGIC 0x35 - -__xdata __at (0xdf25) uint8_t RF_TEST0; -#define RF_TEST0_OFF 0x25 - -#define RF_TEST0_7_2_MASK (0xfc) -#define RF_TEST0_VCO_SEL_CAL_EN (1 << 1) -#define RF_TEST0_0_MASK (1) - -/* These are undocumented, and must be computed - * using the provided tool. - */ -__xdata __at (0xdf27) uint8_t RF_PA_TABLE7; -#define RF_PA_TABLE7_OFF 0x27 - -__xdata __at (0xdf28) uint8_t RF_PA_TABLE6; -#define RF_PA_TABLE6_OFF 0x28 - -__xdata __at (0xdf29) uint8_t RF_PA_TABLE5; -#define RF_PA_TABLE5_OFF 0x29 - -__xdata __at (0xdf2a) uint8_t RF_PA_TABLE4; -#define RF_PA_TABLE4_OFF 0x2a - -__xdata __at (0xdf2b) uint8_t RF_PA_TABLE3; -#define RF_PA_TABLE3_OFF 0x2b - -__xdata __at (0xdf2c) uint8_t RF_PA_TABLE2; -#define RF_PA_TABLE2_OFF 0x2c - -__xdata __at (0xdf2d) uint8_t RF_PA_TABLE1; -#define RF_PA_TABLE1_OFF 0x2d - -__xdata __at (0xdf2e) uint8_t RF_PA_TABLE0; -#define RF_PA_TABLE0_OFF 0x2e - -__xdata __at (0xdf36) uint8_t RF_PARTNUM; -#define RF_PARTNUM_OFF 0x36 - -__xdata __at (0xdf37) uint8_t RF_VERSION; -#define RF_VERSION_OFF 0x37 - -__xdata __at (0xdf38) uint8_t RF_FREQEST; -#define RF_FREQEST_OFF 0x38 - -__xdata __at (0xdf39) uint8_t RF_LQI; -#define RF_LQI_OFF 0x39 - -#define RF_LQI_CRC_OK (1 << 7) -#define RF_LQI_LQI_EST_MASK (0x7f) - -__xdata __at (0xdf3a) uint8_t RF_RSSI; -#define RF_RSSI_OFF 0x3a - -__xdata __at (0xdf3b) uint8_t RF_MARCSTATE; -#define RF_MARCSTATE_OFF 0x3b - -#define RF_MARCSTATE_MASK 0x1f -#define RF_MARCSTATE_SLEEP 0x00 -#define RF_MARCSTATE_IDLE 0x01 -#define RF_MARCSTATE_VCOON_MC 0x03 -#define RF_MARCSTATE_REGON_MC 0x04 -#define RF_MARCSTATE_MANCAL 0x05 -#define RF_MARCSTATE_VCOON 0x06 -#define RF_MARCSTATE_REGON 0x07 -#define RF_MARCSTATE_STARTCAL 0x08 -#define RF_MARCSTATE_BWBOOST 0x09 -#define RF_MARCSTATE_FS_LOCK 0x0a -#define RF_MARCSTATE_IFADCON 0x0b -#define RF_MARCSTATE_ENDCAL 0x0c -#define RF_MARCSTATE_RX 0x0d -#define RF_MARCSTATE_RX_END 0x0e -#define RF_MARCSTATE_RX_RST 0x0f -#define RF_MARCSTATE_TXRX_SWITCH 0x10 -#define RF_MARCSTATE_RX_OVERFLOW 0x11 -#define RF_MARCSTATE_FSTXON 0x12 -#define RF_MARCSTATE_TX 0x13 -#define RF_MARCSTATE_TX_END 0x14 -#define RF_MARCSTATE_RXTX_SWITCH 0x15 -#define RF_MARCSTATE_TX_UNDERFLOW 0x16 - - -__xdata __at (0xdf3c) uint8_t RF_PKTSTATUS; -#define RF_PKTSTATUS_OFF 0x3c - -#define RF_PKTSTATUS_CRC_OK (1 << 7) -#define RF_PKTSTATUS_CS (1 << 6) -#define RF_PKTSTATUS_PQT_REACHED (1 << 5) -#define RF_PKTSTATUS_CCA (1 << 4) -#define RF_PKTSTATUS_SFD (1 << 3) - -__xdata __at (0xdf3d) uint8_t RF_VCO_VC_DAC; -#define RF_VCO_VC_DAC_OFF 0x3d - -/* AES engine */ - -__sfr __at 0xB1 ENCDI; -__sfr __at 0xB2 ENCDO; -__xdata __at (0xDFB1) volatile uint8_t ENCDIXADDR; -__xdata __at (0xDFB2) volatile uint8_t ENCDOXADDR; - -__sfr __at 0xB3 ENCCCS; - -#define ENCCCS_MODE_CBC (0 << 4) -#define ENCCCS_MODE_CFB (1 << 4) -#define ENCCCS_MODE_OFB (2 << 4) -#define ENCCCS_MODE_CTR (3 << 4) -#define ENCCCS_MODE_ECB (4 << 4) -#define ENCCCS_MODE_CBC_MAC (5 << 4) -#define ENCCCS_RDY (1 << 3) -#define ENCCCS_CMD_ENCRYPT (0 << 1) -#define ENCCCS_CMD_DECRYPT (1 << 1) -#define ENCCCS_CMD_LOAD_KEY (2 << 1) -#define ENCCCS_CMD_LOAD_IV (3 << 1) -#define ENCCCS_START (1 << 0) - -#endif diff --git a/src/product/Makefile.teledongle b/src/product/Makefile.teledongle deleted file mode 100644 index b7c28987..00000000 --- a/src/product/Makefile.teledongle +++ /dev/null @@ -1,98 +0,0 @@ -# -# TeleDongle build file -# -# The various teledongle versions differ only -# in minor pin variations -# so the per-board makefiles simply define -# TD_VER, TD_DEF and include -# this file - -vpath %.c ..:../kernel:../cc1111:../drivers:../product -vpath %.h ..:../kernel:../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 - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_gps_print.c \ - ao_monitor.c \ - ao_mutex.c \ - ao_panic.c \ - ao_rssi.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_send_packet.c \ - ao_romconfig.c \ - ao_string.c \ - ao_timer.c \ - ao_usb.c \ - _bp.c - -DRIVER_SRC = - -PRODUCT_SRC = \ - ao_teledongle.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(DRIVER_SRC) \ - $(PRODUCT_SRC) - -PROGNAME = teledongle-v$(TD_VER) -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=TeleDongle-v$(TD_VER) -PRODUCT_DEF=-DTELEDONGLE_V_$(TD_DEF) -IDPRODUCT=0x000c - -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) - $(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/Makefile.telelaunch b/src/product/Makefile.telelaunch deleted file mode 100644 index 7311c21e..00000000 --- a/src/product/Makefile.telelaunch +++ /dev/null @@ -1,100 +0,0 @@ -# -# TeleLaunch build file -# -# define TELELAUNCH_VER, TELELAUNCH_DEF -# this file - -vpath %.c ..:../kernel:../cc1111:../drivers:../product -vpath %.h ..:../kernel:../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 - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_convert.c \ - ao_launch.c \ - ao_mutex.c \ - ao_panic.c \ - ao_stdio.c \ - ao_storage.c \ - ao_task.c \ - ao_freq.c - -CC1111_SRC = \ - ao_adc.c \ - ao_aes.c \ - ao_beep.c \ - ao_dbg.c \ - ao_dma.c \ - ao_ignite.c \ - ao_intflash.c \ - ao_led.c \ - ao_radio.c \ - ao_radio_cmac.c \ - ao_romconfig.c \ - ao_serial.c \ - ao_spi.c \ - ao_string.c \ - ao_timer.c \ - ao_usb.c \ - _bp.c - -DRIVER_SRC = - -PRODUCT_SRC = \ - ao_telelaunch.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(DRIVER_SRC) \ - $(PRODUCT_SRC) - -PROGNAME = telelaunch-v$(TELELAUNCH_VER) -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=TeleLaunch-v$(TELELAUNCH_VER) -PRODUCT_DEF=-DTELELAUNCH_V_$(TELELAUNCH_DEF) -IDPRODUCT=0x000f -CODESIZE=0x6700 - -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) - $(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/Makefile.telemetrum b/src/product/Makefile.telemetrum deleted file mode 100644 index e9b144c0..00000000 --- a/src/product/Makefile.telemetrum +++ /dev/null @@ -1,113 +0,0 @@ -# -# TeleMetrum build file -# -# The various telemetrum versions differ only -# in which flash and GPS drivers are included, -# so the per-board makefiles simply define -# TM_VER, TM_DEF, TM_INC and TM_SRC and include -# this file - -vpath %.c .:..:../kernel:../cc1111:../drivers:../product -vpath %.h .:..:../kernel:../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 \ - altitude.h \ - ao_kalman.h \ - ao_product.h \ - ao_telemetry.h \ - $(TM_INC) - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_convert.c \ - ao_gps_report.c \ - ao_mutex.c \ - ao_panic.c \ - ao_stdio.c \ - ao_storage.c \ - ao_task.c \ - ao_flight.c \ - ao_sample.c \ - ao_kalman.c \ - ao_log.c \ - ao_log_big.c \ - ao_report.c \ - ao_telemetry.c \ - ao_freq.c - -CC1111_SRC = \ - ao_adc.c \ - ao_beep.c \ - ao_dbg.c \ - ao_dma.c \ - ao_ignite.c \ - ao_led.c \ - ao_packet.c \ - ao_packet_slave.c \ - ao_radio.c \ - ao_romconfig.c \ - ao_serial.c \ - ao_string.c \ - ao_spi.c \ - ao_timer.c \ - ao_usb.c \ - _bp.c - -DRIVER_SRC = \ - $(TM_SRC) - -PRODUCT_SRC = \ - ao_telemetrum.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(DRIVER_SRC) \ - $(PRODUCT_SRC) - -PROGNAME = telemetrum-v$(TM_VER)$(TM_EXTRA) -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=TeleMetrum-v$(TM_VER) -PRODUCT_DEF=-DTELEMETRUM_V_$(TM_DEF) -IDPRODUCT=0x000b - -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) - $(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/Makefile.telemini b/src/product/Makefile.telemini deleted file mode 100644 index ff8b9d56..00000000 --- a/src/product/Makefile.telemini +++ /dev/null @@ -1,101 +0,0 @@ -# -# TeleMini build file -# -# Define TELEMINI_VER and TELEMINI_DEF and then -# include this file - -vpath %.c ..:../kernel:../cc1111:../drivers:../product -vpath %.h ..:../kernel:../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 - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_convert.c \ - ao_flight.c \ - ao_kalman.c \ - ao_log.c \ - ao_log_tiny.c \ - ao_mutex.c \ - ao_panic.c \ - ao_report.c \ - ao_sample.c \ - ao_stdio.c \ - ao_storage.c \ - ao_task.c \ - ao_telemetry.c \ - ao_freq.c - -CC1111_SRC = \ - ao_adc.c \ - ao_dma.c \ - ao_ignite.c \ - ao_intflash.c \ - ao_led.c \ - ao_packet.c \ - ao_packet_slave.c \ - ao_radio.c \ - ao_romconfig.c \ - ao_string.c \ - ao_timer.c \ - _bp.c - -DRIVER_SRC = - -PRODUCT_SRC = \ - ao_telemini.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(DRIVER_SRC) \ - $(PRODUCT_SRC) - -PROGNAME = telemini-v$(TELEMINI_VER) -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=TeleMini-v$(TELEMINI_VER) -PRODUCT_DEF=-DTELEMINI_V_$(TELEMINI_DEF) -IDPRODUCT=0x000a -CODESIZE=0x6700 - -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) - $(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/Makefile.telenano b/src/product/Makefile.telenano deleted file mode 100644 index e1e350a6..00000000 --- a/src/product/Makefile.telenano +++ /dev/null @@ -1,100 +0,0 @@ -# -# TeleNano build file -# -# Define TELENANO_VER and TELENANO_DEF and then -# include this file - -vpath %.c ..:../kernel:../cc1111:../drivers:../product -vpath %.h ..:../kernel:../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 - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_convert.c \ - ao_flight_nano.c \ - ao_kalman.c \ - ao_log.c \ - ao_log_tiny.c \ - ao_mutex.c \ - ao_panic.c \ - ao_report.c \ - ao_sample.c \ - ao_stdio.c \ - ao_storage.c \ - ao_task.c \ - ao_telemetry.c \ - ao_freq.c - -CC1111_SRC = \ - ao_adc.c \ - ao_dma.c \ - ao_intflash.c \ - ao_led.c \ - ao_packet.c \ - ao_packet_slave.c \ - ao_radio.c \ - ao_romconfig.c \ - ao_string.c \ - ao_timer.c \ - _bp.c - -DRIVER_SRC = - -PRODUCT_SRC = \ - ao_telenano.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(DRIVER_SRC) \ - $(PRODUCT_SRC) - -PROGNAME = telenano-v$(TELENANO_VER) -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=TeleNano-v$(TELENANO_VER) -PRODUCT_DEF=-DTELENANO_V_$(TELENANO_DEF) -IDPRODUCT=0x000a -CODESIZE=0x6700 - -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) - $(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/spiradio-v0.1/.gitignore b/src/spiradio-v0.1/.gitignore deleted file mode 100644 index 8e39138e..00000000 --- a/src/spiradio-v0.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -spiradio-* -ao_product.h diff --git a/src/spiradio-v0.1/.sdcdbrc b/src/spiradio-v0.1/.sdcdbrc deleted file mode 100644 index 2c77e32b..00000000 --- a/src/spiradio-v0.1/.sdcdbrc +++ /dev/null @@ -1,2 +0,0 @@ ---directory=../cc1111:../product:../kernel:../drivers:. - diff --git a/src/spiradio-v0.1/Makefile b/src/spiradio-v0.1/Makefile deleted file mode 100644 index cd7a9cde..00000000 --- a/src/spiradio-v0.1/Makefile +++ /dev/null @@ -1,92 +0,0 @@ -# -# SpiRadio build file -# - -SPIRADIO_VER=0.1 -SPIRADIO_DEF=0_1 - -vpath %.c ..:../kernel:../cc1111:../drivers:../product -vpath %.h ..:../kernel:../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 \ - ao_radio_spi.h - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_mutex.c \ - ao_panic.c \ - ao_stdio.c \ - ao_task.c \ - ao_freq.c - -CC1111_SRC = \ - ao_aes.c \ - ao_dma.c \ - ao_led.c \ - ao_radio.c \ - ao_radio_cmac.c \ - ao_radio_slave.c \ - ao_romconfig.c \ - ao_serial.c \ - ao_spi.c \ - ao_string.c \ - ao_timer.c \ - _bp.c - -PRODUCT_SRC = \ - ao_spiradio.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(PRODUCT_SRC) - -PROGNAME = spiradio-v$(SPIRADIO_VER) -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=SpiRadio-v$(SPIRADIO_VER) -PRODUCT_DEF=-DSPIRADIO_V_$(SPIRADIO_DEF) -IDPRODUCT=0x000f -CODESIZE=0x6700 - -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) - $(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/spiradio-v0.1/ao_pins.h b/src/spiradio-v0.1/ao_pins.h deleted file mode 100644 index 472da16f..00000000 --- a/src/spiradio-v0.1/ao_pins.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright © 2010 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#define HAS_RADIO 1 - -#define HAS_FLIGHT 0 -#define HAS_USB 0 -#define HAS_BEEP 0 -#define HAS_GPS 0 -#define HAS_SERIAL_0 0 -#define HAS_SERIAL_0_ALT_1 0 -#define HAS_SERIAL_0_HW_FLOW 0 -#define USE_SERIAL_0_STDIN 0 -#define HAS_SERIAL_1 1 -#define HAS_SERIAL_1_ALT_1 1 -#define HAS_SERIAL_1_HW_FLOW 0 -#define USE_SERIAL_1_STDIN 1 -#define DELAY_SERIAL_1_STDIN 0 -#define HAS_ADC 0 -#define HAS_DBG 0 -#define HAS_EEPROM 0 -#define HAS_LOG 0 -#define USE_INTERNAL_FLASH 0 -#define DBG_ON_P1 0 -#define PACKET_HAS_MASTER 0 -#define PACKET_HAS_SLAVE 0 -#define AO_LED_TX 1 -#define AO_LED_RX 2 -#define AO_LED_RED AO_LED_TX -#define LEDS_AVAILABLE (AO_LED_TX|AO_LED_RX) -#define HAS_EXTERNAL_TEMP 0 -#define HAS_ACCEL_REF 0 -#define SPI_CS_ON_P1 1 -#define HAS_AES 1 - -#define SPI_CS_PORT P1 -#define SPI_CS_SEL P1SEL -#define SPI_CS_DIR P1DIR -#define AO_SPI_SLAVE 1 -#define HAS_SPI_0 1 -#define SPI_0_ALT_2 1 -#define HAS_SPI_1 0 - -#define AO_RADIO_SLAVE_INT_PORT P1 -#define AO_RADIO_SLAVE_INT_BIT 6 -#define AO_RADIO_SLAVE_INT_PIN P1_6 - -#endif /* _AO_PINS_H_ */ diff --git a/src/spiradio-v0.1/ao_spiradio.c b/src/spiradio-v0.1/ao_spiradio.c deleted file mode 100644 index 07d33aa4..00000000 --- a/src/spiradio-v0.1/ao_spiradio.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#include -#include - -void -main(void) -{ - ao_clock_init(); - - ao_led_init(LEDS_AVAILABLE); - - ao_task_init(); - - ao_serial_init(); - ao_timer_init(); - ao_cmd_init(); - ao_spi_init(); - ao_radio_init(); - ao_aes_init(); - ao_config_init(); - ao_radio_slave_init(); - ao_start_scheduler(); -} diff --git a/src/teleballoon-v1.1/.gitignore b/src/teleballoon-v1.1/.gitignore deleted file mode 100644 index 21b236c0..00000000 --- a/src/teleballoon-v1.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -teleballoon-* -ao_product.h diff --git a/src/teleballoon-v1.1/Makefile b/src/teleballoon-v1.1/Makefile deleted file mode 100644 index c6f6345a..00000000 --- a/src/teleballoon-v1.1/Makefile +++ /dev/null @@ -1,119 +0,0 @@ -# -# TeleBalloon build file -# -# The various telemetrum versions differ only -# in which flash and GPS drivers are included, -# so the per-board makefiles simply define -# TM_VER, TM_DEF, TM_INC and TM_SRC and include -# this file - -TELEBALLOON_VER=1.1 -TELEBALLOON_DEF=1_1 - -TELEBALLOON_INC = - -TELEBALLOON_SRC = \ - ao_companion.c \ - ao_gps_skytraq.c \ - ao_m25.c - -vpath %.c ..:../kernel:../cc1111:../drivers:../product:. -vpath %.h ..:../kernel:../cc1111:../drivers:../product:. -vpath ao-make-product.5c ../util - -ifndef VERSION -include ../Version -endif - -INC = \ - ao.h \ - ao_pins.h \ - cc1111.h \ - altitude.h \ - ao_kalman.h \ - ao_product.h \ - $(TELEBALLOON_INC) - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_convert.c \ - ao_gps_report.c \ - ao_mutex.c \ - ao_panic.c \ - ao_stdio.c \ - ao_storage.c \ - ao_task.c \ - ao_balloon.c \ - ao_sample.c \ - ao_kalman.c \ - ao_log.c \ - ao_log_big.c \ - ao_report.c \ - ao_telemetry.c - -CC1111_SRC = \ - ao_adc.c \ - ao_beep.c \ - ao_dbg.c \ - ao_dma.c \ - ao_led.c \ - ao_packet.c \ - ao_packet_slave.c \ - ao_radio.c \ - ao_romconfig.c \ - ao_serial.c \ - ao_string.c \ - ao_spi.c \ - ao_timer.c \ - ao_usb.c \ - _bp.c - -DRIVER_SRC = \ - $(TELEBALLOON_SRC) - -PRODUCT_SRC = \ - ao_teleballoon.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(DRIVER_SRC) \ - $(PRODUCT_SRC) - -PROGNAME = teleballoon-v$(TELEBALLOON_VER) -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=TeleBalloon-v$(TELEBALLOON_VER) -PRODUCT_DEF=-DTELEBALLOON_V_$(TELEBALLOON_DEF) -IDPRODUCT=0x000b - -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) - $(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/teleballoon-v1.1/ao_pins.h b/src/teleballoon-v1.1/ao_pins.h deleted file mode 100644 index 2bf4d593..00000000 --- a/src/teleballoon-v1.1/ao_pins.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright © 2010 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#if defined(TELEBALLOON_V_1_1) - - #define AO_SENSOR_INTERVAL_ASCENT AO_MS_TO_TICKS(1000) - #define AO_SENSOR_INTERVAL_DESCENT AO_MS_TO_TICKS(1000) - #define AO_OTHER_INTERVAL AO_MS_TO_TICKS(1000) - #define AO_TELEMETRY_INTERVAL_BALLOON AO_MS_TO_TICKS(1000) - - #define HAS_FLIGHT 1 - #define HAS_USB 1 - #define HAS_BEEP 1 - #define HAS_BATTERY_REPORT 1 - #define HAS_GPS 1 - #define HAS_SERIAL_1 1 - #define HAS_ADC 1 - #define HAS_EEPROM 1 - #define HAS_LOG 1 - #define USE_INTERNAL_FLASH 0 - #define HAS_DBG 1 - #define DBG_ON_P1 1 - #define DBG_ON_P0 0 - #define IGNITE_ON_P2 1 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 0 - #define PACKET_HAS_SLAVE 1 - - #define HAS_COMPANION 1 - #define AO_COMPANION_CS_PORT P1 - #define AO_COMPANION_CS_PIN 2 - #define AO_COMPANION_CS P1_2 - - #define AO_LED_RED 1 - #define LEDS_AVAILABLE (AO_LED_RED) - #define HAS_EXTERNAL_TEMP 0 - #define HAS_ACCEL_REF 1 - #define SPI_CS_ON_P1 1 - #define SPI_CS_ON_P0 0 - #define AO_M25_SPI_CS_MASK 0x02 /* CS0 is P1_1 */ - #define M25_MAX_CHIPS 1 - #define HAS_ACCEL 1 - #define HAS_IGNITE 0 - #define HAS_MONITOR 0 -#endif - -#if DBG_ON_P1 - - #define DBG_CLOCK (1 << 4) /* mi0 */ - #define DBG_DATA (1 << 5) /* mo0 */ - #define DBG_RESET_N (1 << 3) /* c0 */ - - #define DBG_CLOCK_PIN (P1_4) - #define DBG_DATA_PIN (P1_5) - #define DBG_RESET_N_PIN (P1_3) - - #define DBG_PORT_NUM 1 - #define DBG_PORT P1 - #define DBG_PORT_SEL P1SEL - #define DBG_PORT_INP P1INP - #define DBG_PORT_DIR P1DIR - -#endif /* DBG_ON_P1 */ - -#if DBG_ON_P0 - - #define DBG_CLOCK (1 << 3) - #define DBG_DATA (1 << 4) - #define DBG_RESET_N (1 << 5) - - #define DBG_CLOCK_PIN (P0_3) - #define DBG_DATA_PIN (P0_4) - #define DBG_RESET_N_PIN (P0_5) - - #define DBG_PORT_NUM 0 - #define DBG_PORT P0 - #define DBG_PORT_SEL P0SEL - #define DBG_PORT_INP P0INP - #define DBG_PORT_DIR P0DIR - -#endif /* DBG_ON_P0 */ - -#if COMPANION_CS_ON_P1 - #define COMPANION_CS_PORT P1 - #define COMPANION_CS_SEL P1SEL - #define COMPANION_CS_DIR P1DIR -#endif - -#if SPI_CS_ON_P1 - #define SPI_CS_PORT P1 - #define SPI_CS_SEL P1SEL - #define SPI_CS_DIR P1DIR -#endif - -#if SPI_CS_ON_P0 - #define SPI_CS_PORT P0 - #define SPI_CS_SEL P0SEL - #define SPI_CS_DIR P0DIR -#endif - -#define AO_M25_SPI_CS_PORT SPI_CS_PORT - -#ifndef IGNITE_ON_P2 -#error Please define IGNITE_ON_P2 -#endif - -#ifndef IGNITE_ON_P0 -#error Please define IGNITE_ON_P0 -#endif - -#ifndef HAS_SERIAL_1 -#error Please define HAS_SERIAL_1 -#endif - -#ifndef HAS_ADC -#error Please define HAS_ADC -#endif - -#ifndef HAS_EEPROM -#error Please define HAS_EEPROM -#endif - -#ifndef HAS_LOG -#error Please define HAS_LOG -#endif - -#if HAS_EEPROM -#ifndef USE_INTERNAL_FLASH -#error Please define USE_INTERNAL_FLASH -#endif -#endif - -#ifndef HAS_DBG -#error Please define HAS_DBG -#endif - -#ifndef HAS_IGNITE -#error Please define HAS_IGNITE -#endif - -#if HAS_IGNITE -#define HAS_IGNITE_REPORT 1 -#endif - -#ifndef PACKET_HAS_MASTER -#error Please define PACKET_HAS_MASTER -#endif - -#ifndef PACKET_HAS_SLAVE -#error Please define PACKET_HAS_SLAVE -#endif - -#ifndef HAS_MONITOR -#error Please define HAS_MONITOR -#endif - -#if HAS_MONITOR -#ifndef HAS_RSSI -#error Please define HAS_RSSI -#endif -#endif - -#ifndef HAS_ADC -#error Please define HAS_ADC -#endif - -#if HAS_ADC - -#if HAS_ACCEL -#ifndef HAS_ACCEL_REF -#error Please define HAS_ACCEL_REF -#endif -#else -#define HAS_ACCEL_REF 0 -#endif - -#endif /* HAS_ADC */ - -#if IGNITE_ON_P2 -#define AO_IGNITER_DROGUE P2_3 -#define AO_IGNITER_MAIN P2_4 -#define AO_IGNITER_DIR P2DIR -#define AO_IGNITER_DROGUE_BIT (1 << 3) -#define AO_IGNITER_MAIN_BIT (1 << 4) -#endif - -#if IGNITE_ON_P0 -#define AO_IGNITER_DROGUE P0_5 -#define AO_IGNITER_MAIN P0_4 -#define AO_IGNITER_DIR P0DIR -#define AO_IGNITER_DROGUE_BIT (1 << 5) -#define AO_IGNITER_MAIN_BIT (1 << 4) -#endif - -/* test these values with real igniters */ -#define AO_IGNITER_OPEN 1000 -#define AO_IGNITER_CLOSED 7000 -#define AO_IGNITER_FIRE_TIME AO_MS_TO_TICKS(50) -#define AO_IGNITER_CHARGE_TIME AO_MS_TO_TICKS(2000) - -struct ao_adc { - int16_t accel; /* accelerometer */ - int16_t pres; /* pressure sensor */ - int16_t temp; /* temperature sensor */ - int16_t v_batt; /* battery voltage */ - int16_t sense_d; /* drogue continuity sense */ - int16_t sense_m; /* main continuity sense */ -#if HAS_ACCEL_REF - uint16_t accel_ref; /* acceleration reference */ -#endif -}; - -#endif /* _AO_PINS_H_ */ diff --git a/src/teleballoon-v1.1/ao_teleballoon.c b/src/teleballoon-v1.1/ao_teleballoon.c deleted file mode 100644 index bdbf91d4..00000000 --- a/src/teleballoon-v1.1/ao_teleballoon.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * 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. - */ - -#include "ao.h" -#include "ao_pins.h" - -void -ao_ignite_set_pins(void) -{ - AO_IGNITER_DROGUE = 0; - AO_IGNITER_MAIN = 0; - AO_IGNITER_DIR |= AO_IGNITER_DROGUE_BIT | AO_IGNITER_MAIN_BIT; -} - -__pdata uint16_t ao_motor_number; - -void -main(void) -{ - /* - * Reduce the transient on the ignite pins at startup by - * pulling the pins low as soon as possible at power up - */ - ao_ignite_set_pins(); - - ao_clock_init(); - - /* Turn on the red LED until the system is stable */ - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_RED); - - /* A hack -- look at the SPI clock pin, if it's sitting at - * ground, then we force the computer to idle mode instead of - * flight mode - */ - if (P1_3 == 0) { - ao_flight_force_idle = 1; - while (P1_3 == 0) - ; - } - ao_task_init(); - - ao_timer_init(); - ao_adc_init(); - ao_beep_init(); - ao_cmd_init(); - ao_spi_init(); - ao_storage_init(); - ao_flight_init(); - ao_log_init(); - ao_report_init(); - ao_usb_init(); - ao_serial_init(); - ao_gps_init(); - ao_gps_report_init(); - ao_telemetry_init(); - ao_radio_init(); - ao_packet_slave_init(TRUE); -#if HAS_DBG - ao_dbg_init(); -#endif -#if HAS_COMPANION - ao_companion_init(); -#endif - ao_config_init(); - ao_start_scheduler(); -} diff --git a/src/telebt-v1.0/.gitignore b/src/telebt-v1.0/.gitignore deleted file mode 100644 index 1acfbfcc..00000000 --- a/src/telebt-v1.0/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telebt-* -ao_product.h diff --git a/src/telebt-v1.0/.sdcdbrc b/src/telebt-v1.0/.sdcdbrc deleted file mode 100644 index 2c77e32b..00000000 --- a/src/telebt-v1.0/.sdcdbrc +++ /dev/null @@ -1,2 +0,0 @@ ---directory=../cc1111:../product:../kernel:../drivers:. - diff --git a/src/telebt-v1.0/Makefile b/src/telebt-v1.0/Makefile deleted file mode 100644 index a7797499..00000000 --- a/src/telebt-v1.0/Makefile +++ /dev/null @@ -1,97 +0,0 @@ -# -# TeleBT build file -# - -TELEBT_VER=1.0 -TELEBT_DEF=1_0 - -vpath %.c ..:../kernel:../cc1111:../drivers:../product -vpath %.h ..:../kernel:../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 - -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_adc.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) - -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) - $(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/telebt-v1.0/ao_pins.h b/src/telebt-v1.0/ao_pins.h deleted file mode 100644 index ca751be3..00000000 --- a/src/telebt-v1.0/ao_pins.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright © 2010 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#define HAS_RADIO 1 -#define HAS_FLIGHT 0 -#define HAS_USB 1 -#define HAS_BEEP 0 -#define HAS_SERIAL_1 1 -#define HAS_SERIAL_1_ALT_1 1 -#define HAS_SERIAL_1_ALT_2 0 -#define HAS_SERIAL_1_HW_FLOW 1 -#define USE_SERIAL_1_STDIN 1 -#define DELAY_SERIAL_1_STDIN 1 -#define HAS_DBG 1 -#define HAS_EEPROM 0 -#define HAS_LOG 0 -#define USE_INTERNAL_FLASH 0 -#define HAS_BTM 1 -#define DBG_ON_P1 1 -#define DBG_ON_P0 0 -#define PACKET_HAS_MASTER 1 -#define PACKET_HAS_SLAVE 0 -#define AO_LED_RED 1 -#define AO_LED_BLUE 2 -#define LEDS_AVAILABLE (AO_LED_RED|AO_LED_BLUE) -#define AO_MONITOR_LED AO_LED_RED -#define AO_BT_LED AO_LED_BLUE -#define BT_LINK_ON_P2 0 -#define BT_LINK_ON_P1 1 -#define BT_LINK_PIN_INDEX 7 -#define BT_LINK_PIN P1_7 -#define HAS_MONITOR 1 -#define LEGACY_MONITOR 0 -#define HAS_TELEMETRY 0 -#define AO_RADIO_REG_TEST 1 - -#define HAS_ADC 1 -#define AO_PAD_ADC_BATT 0 -#define AO_ADC_PINS (1 << AO_PAD_ADC_BATT) - -struct ao_adc { - int16_t batt; -}; - -#define AO_ADC_DUMP(p) \ - printf ("tick: %5u batt %5d\n", \ - (p)->tick, \ - (p)->adc.batt) - -#if DBG_ON_P1 - - #define DBG_CLOCK (1 << 4) /* mi0 */ - #define DBG_DATA (1 << 5) /* mo0 */ - #define DBG_RESET_N (1 << 3) /* c0 */ - - #define DBG_CLOCK_PIN (P1_4) - #define DBG_DATA_PIN (P1_5) - #define DBG_RESET_N_PIN (P1_3) - - #define DBG_PORT_NUM 1 - #define DBG_PORT P1 - #define DBG_PORT_SEL P1SEL - #define DBG_PORT_INP P1INP - #define DBG_PORT_DIR P1DIR - -#endif /* DBG_ON_P1 */ - -#if DBG_ON_P0 - - #define DBG_CLOCK (1 << 3) - #define DBG_DATA (1 << 4) - #define DBG_RESET_N (1 << 5) - - #define DBG_CLOCK_PIN (P0_3) - #define DBG_DATA_PIN (P0_4) - #define DBG_RESET_N_PIN (P0_5) - - #define DBG_PORT_NUM 0 - #define DBG_PORT P0 - #define DBG_PORT_SEL P0SEL - #define DBG_PORT_INP P0INP - #define DBG_PORT_DIR P0DIR - -#endif /* DBG_ON_P0 */ - -#endif /* _AO_PINS_H_ */ diff --git a/src/telebt-v1.0/ao_telebt.c b/src/telebt-v1.0/ao_telebt.c deleted file mode 100644 index a56adc92..00000000 --- a/src/telebt-v1.0/ao_telebt.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" - -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_task_init(); - - ao_timer_init(); - ao_cmd_init(); - ao_usb_init(); - ao_monitor_init(); - ao_radio_init(); - ao_packet_master_init(); - ao_adc_init(); - ao_btm_init(); -#if HAS_DBG - ao_dbg_init(); -#endif - ao_config_init(); - ao_start_scheduler(); -} diff --git a/src/teledongle-v0.1/.gitignore b/src/teledongle-v0.1/.gitignore deleted file mode 100644 index 9826814b..00000000 --- a/src/teledongle-v0.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -teledongle-v0.1* -ao_product.h diff --git a/src/teledongle-v0.1/.sdcdbrc b/src/teledongle-v0.1/.sdcdbrc deleted file mode 100644 index 710b4a2f..00000000 --- a/src/teledongle-v0.1/.sdcdbrc +++ /dev/null @@ -1 +0,0 @@ ---directory=.. diff --git a/src/teledongle-v0.1/Makefile b/src/teledongle-v0.1/Makefile deleted file mode 100644 index 48425107..00000000 --- a/src/teledongle-v0.1/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# TeleDongle v0.2 build -# - -TD_VER=0.1 -TD_DEF=0_1 - -include ../product/Makefile.teledongle diff --git a/src/teledongle-v0.2/.gitignore b/src/teledongle-v0.2/.gitignore deleted file mode 100644 index f6ea8c6c..00000000 --- a/src/teledongle-v0.2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -teledongle-v0.2* -ao_product.h diff --git a/src/teledongle-v0.2/.sdcdbrc b/src/teledongle-v0.2/.sdcdbrc deleted file mode 100644 index 710b4a2f..00000000 --- a/src/teledongle-v0.2/.sdcdbrc +++ /dev/null @@ -1 +0,0 @@ ---directory=.. diff --git a/src/teledongle-v0.2/Makefile b/src/teledongle-v0.2/Makefile deleted file mode 100644 index ce4ab437..00000000 --- a/src/teledongle-v0.2/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# TeleDongle v0.2 build -# - -TD_VER=0.2 -TD_DEF=0_2 - -include ../product/Makefile.teledongle \ No newline at end of file diff --git a/src/telefire-v0.1/.gitignore b/src/telefire-v0.1/.gitignore deleted file mode 100644 index 4d4f4200..00000000 --- a/src/telefire-v0.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telefire-* -ao_product.h diff --git a/src/telefire-v0.1/.sdcdbrc b/src/telefire-v0.1/.sdcdbrc deleted file mode 100644 index 2c77e32b..00000000 --- a/src/telefire-v0.1/.sdcdbrc +++ /dev/null @@ -1,2 +0,0 @@ ---directory=../cc1111:../product:../kernel:../drivers:. - diff --git a/src/telefire-v0.1/Makefile b/src/telefire-v0.1/Makefile deleted file mode 100644 index 99d29826..00000000 --- a/src/telefire-v0.1/Makefile +++ /dev/null @@ -1,102 +0,0 @@ -# -# TeleFire build file -# - -TELEFIRE_VER=0.1 -TELEFIRE_DEF=0_1 - -vpath %.c ..:../kernel:../cc1111:../drivers:../product -vpath %.h ..:../kernel:../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 \ - ao_pad.h \ - cc1111.h \ - ao_product.h - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_mutex.c \ - ao_panic.c \ - ao_stdio.c \ - ao_storage.c \ - ao_task.c \ - ao_freq.c - -CC1111_SRC = \ - ao_adc.c \ - ao_aes.c \ - ao_beep.c \ - ao_dma.c \ - ao_intflash.c \ - ao_radio.c \ - ao_radio_cmac.c \ - ao_romconfig.c \ - ao_serial.c \ - ao_spi.c \ - ao_string.c \ - ao_timer.c \ - ao_usb.c \ - _bp.c - -DRIVER_SRC = \ - ao_pca9922.c \ - ao_74hc497.c \ - ao_pad.c \ - ao_radio_cmac_cmd.c - -PRODUCT_SRC = \ - ao_telefire.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(DRIVER_SRC) \ - $(PRODUCT_SRC) - -PROGNAME = telefire-v$(TELEFIRE_VER) -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=TeleFire-v$(TELEFIRE_VER) -PRODUCT_DEF=-DTELEFIRE_V_$(TELEFIRE_DEF) -IDPRODUCT=0x000f -CODESIZE=0x6700 - -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) - $(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/telefire-v0.1/ao_pins.h b/src/telefire-v0.1/ao_pins.h deleted file mode 100644 index 8266589e..00000000 --- a/src/telefire-v0.1/ao_pins.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright © 2010 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#define HAS_RADIO 1 -#define HAS_TELEMETRY 0 - -#define HAS_FLIGHT 0 -#define HAS_USB 1 -#define HAS_BEEP 1 -#define HAS_GPS 0 -#define HAS_SERIAL_1 0 -#define HAS_ADC 1 -#define HAS_DBG 0 -#define HAS_EEPROM 1 -#define HAS_LOG 0 -#define HAS_PAD 1 -#define USE_INTERNAL_FLASH 1 -#define DBG_ON_P1 0 -#define IGNITE_ON_P2 0 -#define IGNITE_ON_P1 1 -#define IGNITE_ON_P0 0 -#define PACKET_HAS_MASTER 0 -#define PACKET_HAS_SLAVE 0 - -#define PAD_BOX 0 - -#define AO_LED_CONTINUITY(c) (1 << ((c) + 2)) -#define AO_LED_CONTINUITY_MASK (0xc) -#define AO_LED_ARMED 0x10 -#define AO_LED_RED 0x20 -#define AO_LED_AMBER 0x40 -#define AO_LED_GREEN 0x80 - -#define LEDS_AVAILABLE (0xff) -#define HAS_EXTERNAL_TEMP 0 -#define HAS_ACCEL_REF 0 -#define SPI_CS_ON_P1 1 -#define HAS_AES 1 -#define DMA_SHARE_AES_RADIO 1 - -#define SPI_CS_PORT P1 -#define SPI_CS_SEL P1SEL -#define SPI_CS_DIR P1DIR - -#define SPI_CONST 0x00 - -#define HAS_SPI_0 0 -#define HAS_SPI_1 1 -#define SPI_1_ALT_1 0 -#define SPI_1_ALT_2 1 - -#define AO_74HC497_CS_PORT P1 -#define AO_74HC497_CS_PIN 4 -#define AO_74HC497_CS P1_4 - -#define AO_PCA9922_CS_PORT P1 -#define AO_PCA9922_CS_PIN 4 -#define AO_PCA9922_CS P1_4 - -#define AO_PAD_NUM 2 -#define AO_PAD_PORT P1 -#define AO_PAD_DIR P1DIR - -#define AO_PAD_PIN_0 2 -#define AO_PAD_0 P1_2 -#define AO_PAD_ADC_0 2 - -#define AO_PAD_PIN_1 3 -#define AO_PAD_1 P1_3 -#define AO_PAD_ADC_1 3 - -#define AO_PAD_ALL_PINS ((1 << AO_PAD_PIN_0) | (1 << AO_PAD_PIN_1)) -#define AO_PAD_ALL_CHANNELS ((1 << 0) | (1 << 1)) - -#define AO_SIREN_PORT P1 -#define AO_SIREN_DIR P1DIR -#define AO_SIREN_PIN 0 -#define AO_SIREN P1_0 - -#define AO_STROBE_PORT P1 -#define AO_STROBE_DIR P1DIR -#define AO_STROBE_PIN 1 -#define AO_STROBE P1_1 - -#define AO_ADC_REFERENCE_DV 33 -#define AO_PAD_R_V_BATT_BATT_SENSE 100 -#define AO_PAD_R_BATT_SENSE_GND 27 - -#define AO_PAD_R_V_BATT_V_PYRO 100 -#define AO_PAD_R_V_PYRO_PYRO_SENSE 100 -#define AO_PAD_R_PYRO_SENSE_GND 27 - -#define AO_PAD_R_V_PYRO_IGNITER 100 -#define AO_PAD_R_IGNITER_IGNITER_SENSE 100 -#define AO_PAD_R_IGNITER_SENSE_GND 27 - -#define AO_PAD_ADC_PYRO 4 -#define AO_PAD_ADC_BATT 5 - -#define AO_ADC_FIRST_PIN 2 - -struct ao_adc { - int16_t sense[AO_PAD_NUM]; - int16_t pyro; - int16_t batt; -}; - -#define AO_ADC_DUMP(p) \ - printf ("tick: %5u 0: %5d 1: %5d pyro: %5d batt %5d\n", \ - (p)->tick, \ - (p)->adc.sense[0], \ - (p)->adc.sense[1], \ - (p)->adc.pyro, \ - (p)->adc.batt) - -#define AO_ADC_PINS ((1 << AO_PAD_ADC_0) | (1 << AO_PAD_ADC_1) | (1 << AO_PAD_ADC_PYRO) | (1 << AO_PAD_ADC_BATT)) - -#endif /* _AO_PINS_H_ */ diff --git a/src/telefire-v0.1/ao_telefire.c b/src/telefire-v0.1/ao_telefire.c deleted file mode 100644 index 706a23a6..00000000 --- a/src/telefire-v0.1/ao_telefire.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#include -#include -#include -#include - -void -main(void) -{ - ao_clock_init(); - - ao_led_init(LEDS_AVAILABLE); - - ao_task_init(); - - ao_timer_init(); - ao_adc_init(); - ao_beep_init(); - ao_cmd_init(); - ao_spi_init(); - ao_74hc497_init(); - ao_storage_init(); - ao_usb_init(); - ao_radio_init(); - ao_aes_init(); - ao_pad_init(); -// ao_radio_cmac_cmd_init(); - ao_config_init(); - ao_start_scheduler(); -} diff --git a/src/telefire-v0.2/.gitignore b/src/telefire-v0.2/.gitignore deleted file mode 100644 index 4d4f4200..00000000 --- a/src/telefire-v0.2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telefire-* -ao_product.h diff --git a/src/telefire-v0.2/.sdcdbrc b/src/telefire-v0.2/.sdcdbrc deleted file mode 100644 index 2c77e32b..00000000 --- a/src/telefire-v0.2/.sdcdbrc +++ /dev/null @@ -1,2 +0,0 @@ ---directory=../cc1111:../product:../kernel:../drivers:. - diff --git a/src/telefire-v0.2/Makefile b/src/telefire-v0.2/Makefile deleted file mode 100644 index 944543c5..00000000 --- a/src/telefire-v0.2/Makefile +++ /dev/null @@ -1,102 +0,0 @@ -# -# TeleFire build file -# - -TELEFIRE_VER=0.2 -TELEFIRE_DEF=0_2 - -vpath %.c ..:../kernel:../cc1111:../drivers:../product -vpath %.h ..:../kernel:../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 \ - ao_pad.h \ - cc1111.h \ - ao_product.h - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_mutex.c \ - ao_panic.c \ - ao_stdio.c \ - ao_storage.c \ - ao_task.c \ - ao_freq.c - -CC1111_SRC = \ - ao_adc.c \ - ao_aes.c \ - ao_beep.c \ - ao_dma.c \ - ao_intflash.c \ - ao_radio.c \ - ao_radio_cmac.c \ - ao_romconfig.c \ - ao_serial.c \ - ao_spi.c \ - ao_string.c \ - ao_timer.c \ - ao_usb.c \ - _bp.c - -DRIVER_SRC = \ - ao_pca9922.c \ - ao_74hc165.c \ - ao_pad.c \ - ao_radio_cmac_cmd.c - -PRODUCT_SRC = \ - ao_telefire.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(DRIVER_SRC) \ - $(PRODUCT_SRC) - -PROGNAME = telefire-v$(TELEFIRE_VER) -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=TeleFire-v$(TELEFIRE_VER) -PRODUCT_DEF=-DTELEFIRE_V_$(TELEFIRE_DEF) -IDPRODUCT=0x000f -CODESIZE=0x6700 - -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) - $(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/telefire-v0.2/ao_pins.h b/src/telefire-v0.2/ao_pins.h deleted file mode 100644 index 65f5bdcc..00000000 --- a/src/telefire-v0.2/ao_pins.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright © 2010 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#define HAS_RADIO 1 -#define HAS_RADIO_RATE 1 -#define HAS_TELEMETRY 0 - -#define HAS_FLIGHT 0 -#define HAS_USB 1 -#define HAS_BEEP 0 -#define HAS_GPS 0 -#define HAS_SERIAL_1 0 -#define HAS_ADC 1 -#define HAS_DBG 0 -#define HAS_EEPROM 1 -#define HAS_LOG 0 -#define HAS_PAD 1 -#define USE_INTERNAL_FLASH 1 -#define DBG_ON_P1 0 -#define IGNITE_ON_P2 0 -#define IGNITE_ON_P1 1 -#define IGNITE_ON_P0 0 -#define PACKET_HAS_MASTER 0 -#define PACKET_HAS_SLAVE 0 - -#define AO_LED_CONTINUITY(c) (1 << (c)) -#define AO_LED_CONTINUITY_MASK (0xf) -#define AO_LED_ARMED 0x10 -#define AO_LED_RED 0x20 -#define AO_LED_AMBER 0x40 -#define AO_LED_GREEN 0x80 - -#define LEDS_AVAILABLE (0xff) -#define HAS_EXTERNAL_TEMP 0 -#define HAS_ACCEL_REF 0 -#define SPI_CS_ON_P1 1 -#define HAS_AES 1 -#define DMA_SHARE_AES_RADIO 1 - -#define SPI_CS_PORT P1 -#define SPI_CS_SEL P1SEL -#define SPI_CS_DIR P1DIR - -#define SPI_CONST 0x00 - -#define HAS_SPI_0 0 -#define HAS_SPI_1 1 -#define SPI_1_ALT_1 0 -#define SPI_1_ALT_2 1 - -#define HAS_74HC165 1 -#define AO_74HC165_CS_PORT P1 -#define AO_74HC165_CS_PIN 4 -#define AO_74HC165_CS P1_4 - -#define AO_PCA9922_CS_PORT P2 -#define AO_PCA9922_CS_PIN 0 -#define AO_PCA9922_CS P2_0 - -#define AO_PAD_NUM 4 -#define AO_PAD_PORT P1 -#define AO_PAD_DIR P1DIR - -#define AO_PAD_PIN_0 0 -#define AO_PAD_0 P1_0 -#define AO_PAD_ADC_0 0 - -#define AO_PAD_PIN_1 1 -#define AO_PAD_1 P1_1 -#define AO_PAD_ADC_1 1 - -#define AO_PAD_PIN_2 2 -#define AO_PAD_2 P1_2 -#define AO_PAD_ADC_2 2 - -#define AO_PAD_PIN_3 3 -#define AO_PAD_3 P1_3 -#define AO_PAD_ADC_3 3 - -#define AO_PAD_ALL_PINS ((1 << AO_PAD_PIN_0) | (1 << AO_PAD_PIN_1) | (1 << AO_PAD_PIN_2) | (1 << AO_PAD_PIN_3)) -#define AO_PAD_ALL_CHANNELS ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)) - -/* Alarm 2 */ -#define AO_SIREN_PORT P2 -#define AO_SIREN_DIR P2DIR -#define AO_SIREN_PIN 3 -#define AO_SIREN P2_3 - -/* Alarm 1 */ -#define AO_STROBE_PORT P2 -#define AO_STROBE_DIR P2DIR -#define AO_STROBE_PIN 4 -#define AO_STROBE P2_4 - -/* test these values with real igniters */ -#define AO_PAD_ADC_PYRO 4 -#define AO_PAD_ADC_BATT 5 - -#define AO_ADC_FIRST_PIN 0 - -#define AO_ADC_REFERENCE_DV 33 -#define AO_PAD_R_V_BATT_BATT_SENSE 100 -#define AO_PAD_R_BATT_SENSE_GND 27 - -#define AO_PAD_R_V_BATT_V_PYRO 100 -#define AO_PAD_R_V_PYRO_PYRO_SENSE 100 -#define AO_PAD_R_PYRO_SENSE_GND 27 - -#define AO_PAD_R_V_PYRO_IGNITER 100 -#define AO_PAD_R_IGNITER_IGNITER_SENSE 100 -#define AO_PAD_R_IGNITER_SENSE_GND 27 - - -struct ao_adc { - int16_t sense[AO_PAD_NUM]; - int16_t pyro; - int16_t batt; -}; - -#define AO_ADC_DUMP(p) \ - printf ("tick: %5u 0: %5d 1: %5d 2: %5d 3: %5d pyro: %5d batt %5d\n", \ - (p)->tick, \ - (p)->adc.sense[0], \ - (p)->adc.sense[1], \ - (p)->adc.sense[2], \ - (p)->adc.sense[3], \ - (p)->adc.pyro, \ - (p)->adc.batt) - -#define AO_ADC_PINS ((1 << AO_PAD_ADC_0) | \ - (1 << AO_PAD_ADC_1) | \ - (1 << AO_PAD_ADC_2) | \ - (1 << AO_PAD_ADC_3) | \ - (1 << AO_PAD_ADC_PYRO) | \ - (1 << AO_PAD_ADC_BATT)) - -#endif /* _AO_PINS_H_ */ diff --git a/src/telefire-v0.2/ao_telefire.c b/src/telefire-v0.2/ao_telefire.c deleted file mode 100644 index 5187d5b9..00000000 --- a/src/telefire-v0.2/ao_telefire.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#include -#include -#include -#include - -void -main(void) -{ - ao_clock_init(); - - ao_led_init(LEDS_AVAILABLE); - - ao_task_init(); - - ao_timer_init(); - ao_adc_init(); - ao_cmd_init(); - ao_spi_init(); - ao_74hc165_init(); - ao_storage_init(); - ao_usb_init(); - ao_radio_init(); - ao_aes_init(); - ao_pad_init(); -// ao_radio_cmac_cmd_init(); - ao_config_init(); - ao_start_scheduler(); -} diff --git a/src/telelco-v0.1/.gitignore b/src/telelco-v0.1/.gitignore deleted file mode 100644 index 54267ec1..00000000 --- a/src/telelco-v0.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -ao_product.h -telelco-* diff --git a/src/telelco-v0.1/Makefile b/src/telelco-v0.1/Makefile deleted file mode 100644 index f7628c30..00000000 --- a/src/telelco-v0.1/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -# -# AltOS build for TeleLCO -# -# - -include ../stm/Makefile.defs - -INC = \ - ao.h \ - ao_arch.h \ - ao_arch_funcs.h \ - ao_boot.h \ - ao_companion.h \ - ao_data.h \ - ao_sample.h \ - ao_pins.h \ - ao_product.h \ - ao_seven_segment.h \ - ao_lco.h \ - ao_lco_cmd.h \ - ao_lco_func.h \ - ao_radio_spi.h \ - ao_radio_cmac.h \ - stm32l.h - -# -# Common AltOS sources -# - -#PROFILE=ao_profile.c -#PROFILE_DEF=-DAO_PROFILE=1 - -ALTOS_SRC = \ - ao_boot_chain.c \ - ao_interrupt.c \ - ao_product.c \ - ao_romconfig.c \ - ao_cmd.c \ - ao_config.c \ - ao_task.c \ - ao_led.c \ - ao_stdio.c \ - ao_panic.c \ - ao_timer.c \ - ao_mutex.c \ - ao_freq.c \ - ao_dma_stm.c \ - ao_spi_stm.c \ - ao_beep_stm.c \ - ao_storage.c \ - ao_eeprom_stm.c \ - ao_lcd_stm.c \ - ao_usb_stm.c \ - ao_exti_stm.c \ - ao_radio_master.c \ - ao_seven_segment.c \ - ao_quadrature.c \ - ao_button.c \ - ao_event.c \ - ao_lco.c \ - ao_lco_cmd.c \ - ao_lco_func.c \ - ao_radio_cmac_cmd.c - -PRODUCT=TeleLCO-v0.1 -PRODUCT_DEF=-DTELEMEGA -IDPRODUCT=0x0023 - -CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) -Os -g - -PROGNAME=telelco-v0.1 -PROG=$(PROGNAME)-$(VERSION).elf -HEX=$(PROGNAME)-$(VERSION).ihx - -SRC=$(ALTOS_SRC) ao_telelco.c -OBJ=$(SRC:.c=.o) - -all: $(PROG) $(HEX) - -$(PROG): Makefile $(OBJ) altos.ld - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) - -../altitude.h: make-altitude - nickle $< > $@ - -$(OBJ): $(INC) - -ao_product.h: ao-make-product.5c ../Version - $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ - -distclean: clean - -clean: - rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx - rm -f ao_product.h - -install: - -uninstall: diff --git a/src/telelco-v0.1/ao_lco.c b/src/telelco-v0.1/ao_lco.c deleted file mode 100644 index 649bf586..00000000 --- a/src/telelco-v0.1/ao_lco.c +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include - -#define DEBUG 1 - -#if DEBUG -static uint8_t ao_lco_debug; -#define PRINTD(...) do { if (!ao_lco_debug) break; printf ("\r%5u %s: ", ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } while(0) -#else -#define PRINTD(...) -#endif - -#define AO_LCO_PAD_DIGIT 0 -#define AO_LCO_BOX_DIGIT_1 1 -#define AO_LCO_BOX_DIGIT_10 2 - -static uint8_t ao_lco_min_box, ao_lco_max_box; -static uint8_t ao_lco_mutex; -static uint8_t ao_lco_pad; -static uint8_t ao_lco_box; -static uint8_t ao_lco_armed; -static uint8_t ao_lco_firing; -static uint8_t ao_lco_valid; -static uint8_t ao_lco_got_channels; -static uint16_t ao_lco_tick_offset; - -static struct ao_pad_query ao_pad_query; - -static void -ao_lco_set_pad(void) -{ - ao_seven_segment_set(AO_LCO_PAD_DIGIT, ao_lco_pad + 1); -} - -static void -ao_lco_set_box(void) -{ - ao_seven_segment_set(AO_LCO_BOX_DIGIT_1, ao_lco_box % 10); - ao_seven_segment_set(AO_LCO_BOX_DIGIT_10, ao_lco_box / 10); -} - -#define MASK_SIZE(n) (((n) + 7) >> 3) -#define MASK_ID(n) ((n) >> 3) -#define MASK_SHIFT(n) ((n) & 7) - -static uint8_t ao_lco_box_mask[MASK_SIZE(AO_PAD_MAX_BOXES)]; - -static uint8_t -ao_lco_box_present(uint8_t box) -{ - if (box >= AO_PAD_MAX_BOXES) - return 0; - return (ao_lco_box_mask[MASK_ID(box)] >> MASK_SHIFT(box)) & 1; -} - -static uint8_t -ao_lco_pad_present(uint8_t pad) -{ - if (!ao_lco_got_channels || !ao_pad_query.channels) - return pad == 0; - if (pad >= AO_PAD_MAX_CHANNELS) - return 0; - return (ao_pad_query.channels >> pad) & 1; -} - -static uint8_t -ao_lco_pad_first(void) -{ - uint8_t pad; - - for (pad = 0; pad < AO_PAD_MAX_CHANNELS; pad++) - if (ao_lco_pad_present(pad)) - return pad; - return 0; -} - -static void -ao_lco_input(void) -{ - static struct ao_event event; - int8_t dir, new_box, new_pad; - - ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200)); - ao_lco_set_pad(); - ao_lco_set_box(); - for (;;) { - ao_event_get(&event); - PRINTD("event type %d unit %d value %d\n", - event.type, event.unit, event.value); - switch (event.type) { - case AO_EVENT_QUADRATURE: - switch (event.unit) { - case AO_QUADRATURE_PAD: - if (!ao_lco_armed) { - if (event.value == ao_lco_pad) - break; - dir = ((int8_t) event.value - (int8_t) ao_lco_pad) > 0 ? 1 : -1; - new_pad = event.value; - while (!ao_lco_pad_present(new_pad)) { - new_pad += dir; - if (new_pad > AO_PAD_MAX_CHANNELS) - new_pad = 0; - else if (new_pad < 0) - new_pad = AO_PAD_MAX_CHANNELS - 1; - if (new_pad == ao_lco_pad) - break; - } - if (new_pad != ao_lco_pad) { - ao_lco_pad = new_pad; - ao_quadrature_count[AO_QUADRATURE_PAD] = ao_lco_pad; - ao_lco_set_pad(); - } - } - break; - case AO_QUADRATURE_BOX: - if (!ao_lco_armed) { - if (event.value == ao_lco_box) - break; - dir = ((int8_t) event.value - (int8_t) ao_lco_box) > 0 ? 1 : -1; - new_box = event.value; - while (!ao_lco_box_present(new_box)) { - new_box += dir; - if (new_box > ao_lco_max_box) - new_box = ao_lco_min_box; - else if (new_box < ao_lco_min_box) - new_box = ao_lco_min_box; - if (new_box == ao_lco_box) - break; - } - ao_quadrature_count[AO_QUADRATURE_PAD] = new_box; - if (ao_lco_box != new_box) { - ao_lco_box = new_box; - ao_lco_got_channels = 0; - ao_lco_set_box(); - } - } - break; - } - break; - case AO_EVENT_BUTTON: - switch (event.unit) { - case AO_BUTTON_ARM: - ao_lco_armed = event.value; - PRINTD("Armed %d\n", ao_lco_armed); - ao_wakeup(&ao_lco_armed); - break; - case AO_BUTTON_FIRE: - if (ao_lco_armed) { - ao_lco_firing = event.value; - PRINTD("Firing %d\n", ao_lco_firing); - ao_wakeup(&ao_lco_armed); - } - break; - } - break; - } - } -} - -static AO_LED_TYPE continuity_led[AO_LED_CONTINUITY_NUM] = { -#ifdef AO_LED_CONTINUITY_0 - AO_LED_CONTINUITY_0, -#endif -#ifdef AO_LED_CONTINUITY_1 - AO_LED_CONTINUITY_1, -#endif -#ifdef AO_LED_CONTINUITY_2 - AO_LED_CONTINUITY_2, -#endif -#ifdef AO_LED_CONTINUITY_3 - AO_LED_CONTINUITY_3, -#endif -#ifdef AO_LED_CONTINUITY_4 - AO_LED_CONTINUITY_4, -#endif -#ifdef AO_LED_CONTINUITY_5 - AO_LED_CONTINUITY_5, -#endif -#ifdef AO_LED_CONTINUITY_6 - AO_LED_CONTINUITY_6, -#endif -#ifdef AO_LED_CONTINUITY_7 - AO_LED_CONTINUITY_7, -#endif -}; - -static void -ao_lco_update(void) -{ - int8_t r; - uint8_t c; - - r = ao_lco_query(ao_lco_box, &ao_pad_query, &ao_lco_tick_offset); - if (r == AO_RADIO_CMAC_OK) { - c = ao_lco_got_channels; - ao_lco_got_channels = 1; - ao_lco_valid = 1; - if (!c) { - ao_lco_pad = ao_lco_pad_first(); - ao_lco_set_pad(); - } - } else - ao_lco_valid = 0; - -#if 0 - PRINTD("lco_query success arm_status %d i0 %d i1 %d i2 %d i3 %d\n", - query.arm_status, - query.igniter_status[0], - query.igniter_status[1], - query.igniter_status[2], - query.igniter_status[3]); -#endif - - ao_wakeup(&ao_pad_query); -} - -static void -ao_lco_box_set_present(uint8_t box) -{ - if (box >= AO_PAD_MAX_BOXES) - return; - ao_lco_box_mask[MASK_ID(box)] |= 1 << MASK_SHIFT(box); -} - -static void -ao_lco_search(void) -{ - uint16_t tick_offset; - int8_t r; - - ao_lco_min_box = 0xff; - ao_lco_max_box = 0x00; - for (ao_lco_box = 0; ao_lco_box < AO_PAD_MAX_BOXES; ao_lco_box++) { - if ((ao_lco_box % 10) == 0) - ao_lco_set_box(); - r = ao_lco_query(ao_lco_box, &ao_pad_query, &ao_lco_tick_offset); - if (r == AO_RADIO_CMAC_OK) { - if (ao_lco_box < ao_lco_min_box) - ao_lco_min_box = ao_lco_box; - if (ao_lco_box > ao_lco_max_box) - ao_lco_max_box = ao_lco_box; - ao_lco_box_set_present(ao_lco_box); - } - } - if (ao_lco_min_box <= ao_lco_max_box) - ao_lco_box = ao_lco_min_box; - else - ao_lco_min_box = ao_lco_max_box = ao_lco_box = 0; - ao_lco_valid = 0; - ao_lco_got_channels = 0; - ao_lco_pad = 0; -} - -static void -ao_lco_igniter_status(void) -{ - uint8_t c; - uint16_t delay; - - for (;;) { - ao_sleep(&ao_pad_query); - if (!ao_lco_valid) { - ao_led_on(AO_LED_RED); - ao_led_off(AO_LED_GREEN); - continue; - } - PRINTD("RSSI %d\n", ao_radio_cmac_rssi); - if (ao_radio_cmac_rssi < -90) - ao_led_on(AO_LED_RED|AO_LED_GREEN); - else { - ao_led_on(AO_LED_GREEN); - ao_led_off(AO_LED_RED); - } - if (ao_pad_query.arm_status) - ao_led_on(AO_LED_REMOTE_ARM); - else - ao_led_off(AO_LED_REMOTE_ARM); - for (c = 0; c < AO_LED_CONTINUITY_NUM; c++) { - uint8_t status; - - if (ao_pad_query.channels & (1 << c)) - status = ao_pad_query.igniter_status[c]; - else - status = AO_PAD_IGNITER_STATUS_NO_IGNITER_RELAY_OPEN; - if (status == AO_PAD_IGNITER_STATUS_GOOD_IGNITER_RELAY_OPEN) - ao_led_on(continuity_led[c]); - else - ao_led_off(continuity_led[c]); - } - } -} - -static void -ao_lco_arm_warn(void) -{ - for (;;) { - while (!ao_lco_armed) - ao_sleep(&ao_lco_armed); - ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200)); - ao_delay(AO_MS_TO_TICKS(200)); - } -} - -static struct ao_task ao_lco_input_task; -static struct ao_task ao_lco_monitor_task; -static struct ao_task ao_lco_arm_warn_task; -static struct ao_task ao_lco_igniter_status_task; - -static void -ao_lco_monitor(void) -{ - uint16_t delay; - - ao_lco_search(); - ao_add_task(&ao_lco_input_task, ao_lco_input, "lco input"); - ao_add_task(&ao_lco_arm_warn_task, ao_lco_arm_warn, "lco arm warn"); - ao_add_task(&ao_lco_igniter_status_task, ao_lco_igniter_status, "lco igniter status"); - for (;;) { - PRINTD("monitor armed %d firing %d offset %d\n", - ao_lco_armed, ao_lco_firing, ao_lco_tick_offset); - - if (ao_lco_armed && ao_lco_firing) { - PRINTD("Firing box %d pad %d: valid %d\n", - ao_lco_box, ao_lco_pad, ao_lco_valid); - if (!ao_lco_valid) - ao_lco_update(); - if (ao_lco_valid) - ao_lco_ignite(ao_lco_box, 1 << ao_lco_pad, ao_lco_tick_offset); - } else if (ao_lco_armed) { - PRINTD("Arming box %d pad %d\n", - ao_lco_box, ao_lco_pad); - if (!ao_lco_valid) - ao_lco_update(); - ao_lco_arm(ao_lco_box, 1 << ao_lco_pad, ao_lco_tick_offset); - ao_lco_update(); - } else { - ao_lco_update(); - } - if (ao_lco_armed && ao_lco_firing) - delay = AO_MS_TO_TICKS(100); - else - delay = AO_SEC_TO_TICKS(1); - ao_sleep_for(&ao_lco_armed, delay); - } -} - -#if DEBUG -void -ao_lco_set_debug(void) -{ - ao_cmd_decimal(); - if (ao_cmd_status == ao_cmd_success) - ao_lco_debug = ao_cmd_lex_i != 0; -} - -__code struct ao_cmds ao_lco_cmds[] = { - { ao_lco_set_debug, "D <0 off, 1 on>\0Debug" }, - { 0, NULL } -}; -#endif - -void -ao_lco_init(void) -{ - ao_add_task(&ao_lco_monitor_task, ao_lco_monitor, "lco monitor"); -#if DEBUG - ao_cmd_register(&ao_lco_cmds[0]); -#endif -} diff --git a/src/telelco-v0.1/ao_lco.h b/src/telelco-v0.1/ao_lco.h deleted file mode 100644 index 5721eed5..00000000 --- a/src/telelco-v0.1/ao_lco.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#ifndef _AO_LCO_H_ -#define _AO_LCO_H_ - -void -ao_lco_init(void); - -#endif /* _AO_LCO_H_ */ diff --git a/src/telelco-v0.1/ao_pins.h b/src/telelco-v0.1/ao_pins.h deleted file mode 100644 index 23115997..00000000 --- a/src/telelco-v0.1/ao_pins.h +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -/* 8MHz High speed external crystal */ -#define AO_HSE 8000000 - -/* PLLVCO = 96MHz (so that USB will work) */ -#define AO_PLLMUL 12 -#define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_12) - -/* SYSCLK = 32MHz (no need to go faster than CPU) */ -#define AO_PLLDIV 3 -#define AO_RCC_CFGR_PLLDIV (STM_RCC_CFGR_PLLDIV_3) - -/* HCLK = 32MHz (CPU clock) */ -#define AO_AHB_PRESCALER 1 -#define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1 - -/* Run APB1 at 16MHz (HCLK/2) */ -#define AO_APB1_PRESCALER 2 -#define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE2_DIV_2 - -/* Run APB2 at 16MHz (HCLK/2) */ -#define AO_APB2_PRESCALER 2 -#define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_2 - -#define HAS_EEPROM 1 -#define USE_INTERNAL_FLASH 1 -#define HAS_USB 1 -#define HAS_BEEP 1 -#define HAS_RADIO 1 -#define HAS_TELEMETRY 0 -#define HAS_AES 1 - -#define HAS_SPI_1 0 -#define SPI_1_PA5_PA6_PA7 0 -#define SPI_1_PB3_PB4_PB5 0 -#define SPI_1_PE13_PE14_PE15 0 - -#define HAS_SPI_2 1 /* CC1111 */ -#define SPI_2_PB13_PB14_PB15 1 -#define SPI_2_PD1_PD3_PD4 0 -#define SPI_2_GPIO (&stm_gpiob) -#define SPI_2_SCK 13 -#define SPI_2_MISO 14 -#define SPI_2_MOSI 15 -#define SPI_2_OSPEEDR STM_OSPEEDR_10MHz - -#define HAS_I2C_1 0 - -#define HAS_I2C_2 0 - -#define PACKET_HAS_SLAVE 0 -#define PACKET_HAS_MASTER 0 - -/* - * Radio is a cc1111 connected via SPI - */ -#define AO_RADIO_CAL_DEFAULT 1186611 - -#define AO_RADIO_SPI_BUS AO_SPI_2_PB13_PB14_PB15 -#define AO_RADIO_CS_PORT (&stm_gpiob) -#define AO_RADIO_CS_PIN 12 - -#define AO_RADIO_INT_PORT (&stm_gpioc) -#define AO_RADIO_INT_PIN 14 - -#define LOW_LEVEL_DEBUG 0 - -#define LED_PORT_ENABLE STM_RCC_AHBENR_GPIOCEN -#define LED_PORT (&stm_gpioc) -#define LED_PIN_RED 7 -#define LED_PIN_GREEN 8 -#define LED_PIN_CONTINUITY_3 9 -#define LED_PIN_CONTINUITY_2 10 -#define LED_PIN_CONTINUITY_1 11 -#define LED_PIN_CONTINUITY_0 12 -#define LED_PIN_REMOTE_ARM 13 -#define AO_LED_RED (1 << LED_PIN_RED) -#define AO_LED_GREEN (1 << LED_PIN_GREEN) -#define AO_LED_CONTINUITY_3 (1 << LED_PIN_CONTINUITY_3) -#define AO_LED_CONTINUITY_2 (1 << LED_PIN_CONTINUITY_2) -#define AO_LED_CONTINUITY_1 (1 << LED_PIN_CONTINUITY_1) -#define AO_LED_CONTINUITY_0 (1 << LED_PIN_CONTINUITY_0) - -#define AO_LED_CONTINUITY_NUM 4 - -#define AO_LED_REMOTE_ARM (1 << LED_PIN_REMOTE_ARM) - -#define LEDS_AVAILABLE (AO_LED_RED | \ - AO_LED_GREEN | \ - AO_LED_CONTINUITY_3 | \ - AO_LED_CONTINUITY_2 | \ - AO_LED_CONTINUITY_1 | \ - AO_LED_CONTINUITY_0 | \ - AO_LED_REMOTE_ARM) - -/* LCD displays */ - -#define AO_LCD_STM_SEG_ENABLED_0 ( \ - (1 << 0) | /* PA1 */ \ - (1 << 1) | /* PA2 */ \ - (1 << 2) | /* PA3 */ \ - (1 << 3) | /* PA6 */ \ - (1 << 4) | /* PA7 */ \ - (1 << 5) | /* PB0 */ \ - (1 << 6) | /* PB1 */ \ - (1 << 7) | /* PB3 */ \ - (0 << 8) | /* PB4 */ \ - (0 << 9) | /* PB5 */ \ - (0 << 10) | /* PB10 */ \ - (0 << 11) | /* PB11 */ \ - (0 << 12) | /* PB12 */ \ - (0 << 13) | /* PB13 */ \ - (0 << 14) | /* PB14 */ \ - (0 << 15) | /* PB15 */ \ - (0 << 16) | /* PB8 */ \ - (0 << 17) | /* PA15 */ \ - (0 << 18) | /* PC0 */ \ - (0 << 19) | /* PC1 */ \ - (0 << 20) | /* PC2 */ \ - (0 << 21) | /* PC3 */ \ - (0 << 22) | /* PC4 */ \ - (0 << 23) | /* PC5 */ \ - (0 << 24) | /* PC6 */ \ - (0 << 25) | /* PC7 */ \ - (0 << 26) | /* PC8 */ \ - (0 << 27) | /* PC9 */ \ - (0 << 28) | /* PC10 or PD8 */ \ - (0 << 29) | /* PC11 or PD9 */ \ - (0 << 30) | /* PC12 or PD10 */ \ - (0 << 31)) /* PD2 or PD11 */ - -#define AO_LCD_STM_SEG_ENABLED_1 ( \ - (0 << 0) | /* PD12 */ \ - (0 << 1) | /* PD13 */ \ - (0 << 2) | /* PD14 */ \ - (0 << 3) | /* PD15 */ \ - (0 << 4) | /* PE0 */ \ - (0 << 5) | /* PE1 */ \ - (0 << 6) | /* PE2 */ \ - (0 << 7)) /* PE3 */ - -#define AO_LCD_STM_COM_ENABLED ( \ - (1 << 0) | /* PA8 */ \ - (1 << 1) | /* PA9 */ \ - (1 << 2) | /* PA10 */ \ - (0 << 3) | /* PB9 */ \ - (0 << 4) | /* PC10 */ \ - (0 << 5) | /* PC11 */ \ - (0 << 6)) /* PC12 */ - -#define AO_LCD_28_ON_C 0 - -#define AO_LCD_DUTY STM_LCD_CR_DUTY_1_4 - -#define AO_SEGMENT_0 0 -#define AO_SEGMENT_1 5 -#define AO_SEGMENT_2 1 -#define AO_SEGMENT_3 6 -#define AO_SEGMENT_4 4 -#define AO_SEGMENT_5 2 -#define AO_SEGMENT_6 3 -#define AO_SEGMENT_7 7 - -/* - * Use event queue for input devices - */ - -#define AO_EVENT 1 - -/* - * Knobs - */ - -#define AO_QUADRATURE_COUNT 2 -#define AO_QUADRATURE_MODE 0 - -#define AO_QUADRATURE_0_PORT &stm_gpioc -#define AO_QUADRATURE_0_A 3 -#define AO_QUADRATURE_0_B 2 - -#define AO_QUADRATURE_PAD 0 - -#define AO_QUADRATURE_1_PORT &stm_gpioc -#define AO_QUADRATURE_1_A 1 -#define AO_QUADRATURE_1_B 0 - -#define AO_QUADRATURE_BOX 1 - -/* - * Buttons - */ - -#define AO_BUTTON_COUNT 2 -#define AO_BUTTON_MODE AO_EXTI_MODE_PULL_UP - -#define AO_BUTTON_0_PORT &stm_gpioc -#define AO_BUTTON_0 4 - -#define AO_BUTTON_ARM 0 - -#define AO_BUTTON_1_PORT &stm_gpioc -#define AO_BUTTON_1 5 - -#define AO_BUTTON_FIRE 1 - -#endif /* _AO_PINS_H_ */ diff --git a/src/telelco-v0.1/ao_telelco.c b/src/telelco-v0.1/ao_telelco.c deleted file mode 100644 index 608f093d..00000000 --- a/src/telelco-v0.1/ao_telelco.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int -main(void) -{ - ao_clock_init(); - - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_GREEN); - ao_task_init(); - - ao_timer_init(); - - ao_spi_init(); - ao_dma_init(); - ao_exti_init(); - - ao_beep_init(); - ao_cmd_init(); - - ao_lcd_stm_init(); - ao_seven_segment_init(); - ao_quadrature_init(); - ao_button_init(); - - ao_storage_init(); - - ao_radio_init(); - - ao_usb_init(); - - ao_config_init(); - - ao_quadrature_init(); - ao_button_init(); - ao_lco_init(); - ao_lco_cmd_init(); -// ao_radio_cmac_cmd_init(); - - ao_start_scheduler(); - return 0; -} diff --git a/src/telemetrum-v0.1-sirf/.gitignore b/src/telemetrum-v0.1-sirf/.gitignore deleted file mode 100644 index 7698f5aa..00000000 --- a/src/telemetrum-v0.1-sirf/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telemetrum-v0.1-sirf* -ao_product.h diff --git a/src/telemetrum-v0.1-sirf/Makefile b/src/telemetrum-v0.1-sirf/Makefile deleted file mode 100644 index d138b5ef..00000000 --- a/src/telemetrum-v0.1-sirf/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# -# TeleMetrum v0.1 with SkyTraq GPS build -# - -TM_VER=0.1 -TM_DEF=0_1 -TM_EXTRA=-sirf - -TM_INC = \ - ao_25lc1024.h - -TM_SRC = \ - ao_gps_sirf.c \ - ao_25lc1024.c - -include ../product/Makefile.telemetrum - diff --git a/src/telemetrum-v0.1-sky/.gitignore b/src/telemetrum-v0.1-sky/.gitignore deleted file mode 100644 index d25d7ad9..00000000 --- a/src/telemetrum-v0.1-sky/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telemetrum-v0.1-sky* -ao_product.h diff --git a/src/telemetrum-v0.1-sky/.sdcdbrc b/src/telemetrum-v0.1-sky/.sdcdbrc deleted file mode 100644 index 710b4a2f..00000000 --- a/src/telemetrum-v0.1-sky/.sdcdbrc +++ /dev/null @@ -1 +0,0 @@ ---directory=.. diff --git a/src/telemetrum-v0.1-sky/Makefile b/src/telemetrum-v0.1-sky/Makefile deleted file mode 100644 index a6634c29..00000000 --- a/src/telemetrum-v0.1-sky/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# -# TeleMetrum v0.1 with SkyTraq GPS build -# - -TM_VER=0.1 -TM_DEF=0_1 -TM_EXTRA=-sky - -TM_INC = \ - ao_25lc1024.h - -TM_SRC = \ - ao_gps_skytraq.c \ - ao_gps_show.c \ - ao_25lc1024.c - -include ../product/Makefile.telemetrum - diff --git a/src/telemetrum-v1.0/.gitignore b/src/telemetrum-v1.0/.gitignore deleted file mode 100644 index c2212151..00000000 --- a/src/telemetrum-v1.0/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telemetrum-* -ao_product.h diff --git a/src/telemetrum-v1.0/.sdcdbrc b/src/telemetrum-v1.0/.sdcdbrc deleted file mode 100644 index e9a51ea6..00000000 --- a/src/telemetrum-v1.0/.sdcdbrc +++ /dev/null @@ -1 +0,0 @@ ---directory=../cc1111:../product:../kernel:../drivers:. diff --git a/src/telemetrum-v1.0/Makefile b/src/telemetrum-v1.0/Makefile deleted file mode 100644 index 476a3b0a..00000000 --- a/src/telemetrum-v1.0/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# -# TeleMetrum v1.0 build -# - -TM_VER=1.0 -TM_DEF=1_0 - -TM_INC = \ - ao_at45db161d.h - -TM_SRC = \ - ao_companion.c \ - ao_gps_skytraq.c \ - ao_gps_show.c \ - ao_at45db161d.c - -include ../product/Makefile.telemetrum diff --git a/src/telemetrum-v1.1/.gitignore b/src/telemetrum-v1.1/.gitignore deleted file mode 100644 index c2212151..00000000 --- a/src/telemetrum-v1.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telemetrum-* -ao_product.h diff --git a/src/telemetrum-v1.1/.sdcdbrc b/src/telemetrum-v1.1/.sdcdbrc deleted file mode 100644 index e9a51ea6..00000000 --- a/src/telemetrum-v1.1/.sdcdbrc +++ /dev/null @@ -1 +0,0 @@ ---directory=../cc1111:../product:../kernel:../drivers:. diff --git a/src/telemetrum-v1.1/Makefile b/src/telemetrum-v1.1/Makefile deleted file mode 100644 index 61e9273b..00000000 --- a/src/telemetrum-v1.1/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# -# AltOS build -# -# - -TM_VER=1.1 -TM_DEF=1_1 - -TM_INC = - -TM_SRC = \ - ao_companion.c \ - ao_gps_skytraq.c \ - ao_gps_show.c \ - ao_convert_volt.c \ - ao_m25.c - -include ../product/Makefile.telemetrum diff --git a/src/telemetrum-v1.2/.gitignore b/src/telemetrum-v1.2/.gitignore deleted file mode 100644 index c2212151..00000000 --- a/src/telemetrum-v1.2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telemetrum-* -ao_product.h diff --git a/src/telemetrum-v1.2/.sdcdbrc b/src/telemetrum-v1.2/.sdcdbrc deleted file mode 100644 index 710b4a2f..00000000 --- a/src/telemetrum-v1.2/.sdcdbrc +++ /dev/null @@ -1 +0,0 @@ ---directory=.. diff --git a/src/telemetrum-v1.2/Makefile b/src/telemetrum-v1.2/Makefile deleted file mode 100644 index 38ba6d49..00000000 --- a/src/telemetrum-v1.2/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# -# AltOS build -# -# - -TM_VER=1.2 -TM_DEF=1_2 - -TM_INC = - -TM_SRC = \ - ao_companion.c \ - ao_gps_skytraq.c \ - ao_gps_show.c \ - ao_convert_volt.c \ - ao_m25.c - -include ../product/Makefile.telemetrum diff --git a/src/telemini-v1.0/.gitignore b/src/telemini-v1.0/.gitignore deleted file mode 100644 index 82868aac..00000000 --- a/src/telemini-v1.0/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telemini-* -ao_product.h diff --git a/src/telemini-v1.0/.sdcdbrc b/src/telemini-v1.0/.sdcdbrc deleted file mode 100644 index 2c77e32b..00000000 --- a/src/telemini-v1.0/.sdcdbrc +++ /dev/null @@ -1,2 +0,0 @@ ---directory=../cc1111:../product:../kernel:../drivers:. - diff --git a/src/telemini-v1.0/Makefile b/src/telemini-v1.0/Makefile deleted file mode 100644 index 4f1c8b51..00000000 --- a/src/telemini-v1.0/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# TeleMini build file -# - -TELEMINI_VER=1.0 -TELEMINI_DEF=1_0 - -include ../product/Makefile.telemini diff --git a/src/telemini-v2.0/.gitignore b/src/telemini-v2.0/.gitignore deleted file mode 100644 index 568925a2..00000000 --- a/src/telemini-v2.0/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -ao_product.h -telemini-v2.0* diff --git a/src/telemini-v2.0/.sdcdbrc b/src/telemini-v2.0/.sdcdbrc deleted file mode 100644 index 2c77e32b..00000000 --- a/src/telemini-v2.0/.sdcdbrc +++ /dev/null @@ -1,2 +0,0 @@ ---directory=../cc1111:../product:../kernel:../drivers:. - diff --git a/src/telemini-v2.0/Makefile b/src/telemini-v2.0/Makefile deleted file mode 100644 index 8657e9a9..00000000 --- a/src/telemini-v2.0/Makefile +++ /dev/null @@ -1,116 +0,0 @@ -# -# TeleMini build file -# - -TELEMINI_VER=2.0 -TELEMINI_DEF=2_0 - -vpath %.c ..:../kernel:../cc1111:../drivers:../product -vpath %.h ..:../kernel:../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_ms5607.h \ - ao_ms5607_convert_8051.c \ - ao_product.h \ - ao_int64.h \ - ao_sample.h \ - ao_exti.h \ - ao_task.h \ - altitude-pa-small.h - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_flight.c \ - ao_kalman.c \ - ao_log.c \ - ao_log_mini.c \ - ao_mutex.c \ - ao_panic.c \ - ao_report.c \ - ao_sample.c \ - ao_stdio.c \ - ao_storage.c \ - ao_task.c \ - ao_telemetry.c \ - ao_freq.c \ - ao_int64.c - -CC1111_SRC = \ - ao_adc.c \ - ao_dma.c \ - ao_ignite.c \ - ao_led.c \ - ao_packet.c \ - ao_packet_slave.c \ - ao_radio.c \ - ao_romconfig.c \ - ao_string.c \ - ao_spi.c \ - ao_usb.c \ - ao_convert_pa.c \ - ao_convert_volt.c \ - ao_beep.c \ - ao_timer.c \ - ao_exti.c \ - _bp.c - -DRIVER_SRC = \ - ao_ms5607.c \ - ao_m25.c - -PRODUCT_SRC = \ - ao_telemini.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(DRIVER_SRC) \ - $(PRODUCT_SRC) - -PROGNAME = telemini-v$(TELEMINI_VER) -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=TeleMini-v$(TELEMINI_VER) -PRODUCT_DEF=-DTELEMINI_V_$(TELEMINI_DEF) -IDPRODUCT=0x0027 - -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) - $(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/telemini-v2.0/ao_pins.h b/src/telemini-v2.0/ao_pins.h deleted file mode 100644 index d2aa4c2d..00000000 --- a/src/telemini-v2.0/ao_pins.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright © 2010 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#define HAS_RADIO 1 - -#define HAS_FLIGHT 1 -#define HAS_USB 1 -#define AO_VALUE_32 0 - -#define HAS_USB_PULLUP 1 -#define AO_USB_PULLUP_PORT P1 -#define AO_USB_PULLUP_PIN 0 -#define AO_USB_PULLUP P1_0 - -#define AO_SMALL_ALTITUDE_TABLE 1 - -#define USB_FORCE_FLIGHT_IDLE 1 -#define HAS_BEEP 1 -#define HAS_BEEP_CONFIG 1 -#define HAS_BATTERY_REPORT 1 -#define HAS_GPS 0 -#define HAS_SERIAL_1 0 -#define HAS_EEPROM 1 -#define HAS_LOG 1 -#define USE_INTERNAL_FLASH 0 -#define HAS_DBG 0 -#define PACKET_HAS_SLAVE 1 -#define HAS_RADIO_RATE 1 -#define HAS_TELEMETRY 1 -#define HAS_TASK_INFO 0 - -#define AO_LED_RED 2 -#define LEDS_AVAILABLE AO_LED_RED -#define HAS_EXTERNAL_TEMP 0 -#define HAS_ACCEL 0 -#define HAS_IGNITE 1 -#define HAS_IGNITE_REPORT 1 -#define HAS_MONITOR 0 - -/* - * SPI - */ - -#define HAS_SPI_0 1 -#define SPI_0_ALT_1 1 -#define HAS_SPI_1 1 -#define SPI_1_ALT_2 1 -#define SPI_CS_PORT P1 -#define SPI_CS_SEL P1SEL -#define SPI_CS_DIR P1DIR - -/* - * Flash - */ -#define AO_M25_SPI_BUS 1 -#define AO_M25_SPI_CS_PORT SPI_CS_PORT -#define AO_M25_SPI_CS_MASK 0x04 /* cs_flash is P1_2 */ -#define M25_MAX_CHIPS 1 - -/* - * MS5607 - */ - -#define HAS_MS5607 1 -#define HAS_MS5611 0 -#define AO_MS5607_PRIVATE_PINS 0 -#define AO_MS5607_CS_PORT P1 -#define AO_MS5607_CS_PIN 3 -#define AO_MS5607_CS P1_3 -#define AO_MS5607_CS_MASK (1 << AO_MS5607_CS_PIN) -#define AO_MS5607_MISO_PORT P0 -#define AO_MS5607_MISO_PIN 2 -#define AO_MS5607_MISO P0_2 -#define AO_MS5607_MISO_MASK (1 << AO_MS5607_MISO_PIN) -#define AO_MS5607_SPI_INDEX 0 -#define HAS_EXTI_0 1 - -/* - * Igniters - */ -#define AO_IGNITER_PORT P2 -#define AO_IGNITER_DROGUE_PORT AO_IGNITER_PORT -#define AO_IGNITER_DROGUE P2_3 -#define AO_IGNITER_MAIN P2_4 -#define AO_IGNITER_DIR P2DIR -#define AO_IGNITER_DROGUE_BIT (1 << 3) -#define AO_IGNITER_MAIN_BIT (1 << 4) -#define AO_IGNITER_DROGUE_PIN 3 -#define AO_IGNITER_MAIN_PIN 4 - -#define AO_IGNITER_DROGUE_PORT AO_IGNITER_PORT -#define AO_IGNITER_MAIN_PORT AO_IGNITER_PORT - -/* test these values with real igniters */ -#define AO_IGNITER_OPEN 1000 -#define AO_IGNITER_CLOSED 7000 -#define AO_IGNITER_FIRE_TIME AO_MS_TO_TICKS(50) -#define AO_IGNITER_CHARGE_TIME AO_MS_TO_TICKS(2000) - -#define AO_SEND_MINI AO_TELEMETRY_MINI2 -#define AO_LOG_FORMAT AO_LOG_FORMAT_TELEMINI2 - -/* - * ADC - */ - -#define HAS_ADC 1 -#define AO_ADC_FIRST_PIN 0 - -struct ao_adc { - int16_t sense_a; /* apogee continuity sense */ - int16_t sense_m; /* main continuity sense */ - int16_t v_batt; /* battery voltage */ -}; - -#define ao_data_count ao_adc_count - -#define AO_SENSE_DROGUE(p) ((p)->adc.sense_a) -#define AO_SENSE_MAIN(p) ((p)->adc.sense_m) - -#define AO_NUM_TASKS 10 - -#define AO_ADC_DUMP(p) \ - printf("tick: %5u apogee: %5d main: %5d batt: %5d\n", \ - (p)->tick, (p)->adc.sense_a, (p)->adc.sense_m, (p)->adc.v_batt) - -#define AO_ADC_PINS ((1 << 0) | (1 << 1) | (1 << 4)) - -#define FETCH_ADC() do { \ - a = (uint8_t __xdata *) (&ao_data_ring[ao_data_head].adc); \ - switch (sequence) { \ - case 4: \ - a += 4; \ - sequence = 0; \ - break; \ - case 1: \ - a += 2; \ - sequence = 4; \ - break; \ - case 0: \ - sequence = 1; \ - break; \ - } \ - a[0] = ADCL; \ - a[1] = ADCH; \ - if (sequence) { \ - ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | sequence; \ - return; \ - } \ - AO_DATA_PRESENT(AO_DATA_ADC); \ - if (ao_data_present != AO_DATA_ALL) \ - return; \ - ao_data_ring[ao_data_head].ms5607_raw.pres = ao_ms5607_current.pres; \ - ao_data_ring[ao_data_head].ms5607_raw.temp = ao_ms5607_current.temp; \ - } while (0) - -/* - * Voltage divider on ADC battery sampler - */ -#define AO_BATTERY_DIV_PLUS 100 /* 100k */ -#define AO_BATTERY_DIV_MINUS 27 /* 27k */ - -/* - * Voltage divider on ADC igniter samplers - */ -#define AO_IGNITE_DIV_PLUS 100 /* 100k */ -#define AO_IGNITE_DIV_MINUS 27 /* 27k */ - -/* - * ADC reference in decivolts - */ -#define AO_ADC_REFERENCE_DV 33 - -#endif /* _AO_PINS_H_ */ diff --git a/src/telemini-v2.0/ao_telemini.c b/src/telemini-v2.0/ao_telemini.c deleted file mode 100644 index a9ee423c..00000000 --- a/src/telemini-v2.0/ao_telemini.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" -#include "ao_pins.h" -#include - -void -main(void) -{ - ao_clock_init(); - -#if HAS_STACK_GUARD - ao_mpu_init(); -#endif - ao_task_init(); - - /* Turn on the red LED until the system is stable */ - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_RED); - - ao_timer_init(); - - ao_spi_init(); - ao_exti_init(); - ao_adc_init(); -#if HAS_BEEP - ao_beep_init(); -#endif - ao_cmd_init(); -#if HAS_MS5607 - ao_ms5607_init(); -#endif - ao_storage_init(); - - ao_flight_init(); - ao_log_init(); - ao_report_init(); - - ao_usb_init(); - ao_telemetry_init(); - ao_radio_init(); - ao_packet_slave_init(TRUE); - - ao_igniter_init(); - - ao_config_init(); - ao_start_scheduler(); -} diff --git a/src/telenano-v0.1/.gitignore b/src/telenano-v0.1/.gitignore deleted file mode 100644 index 0412f7df..00000000 --- a/src/telenano-v0.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telenano-* -ao_product.h diff --git a/src/telenano-v0.1/.sdcdbrc b/src/telenano-v0.1/.sdcdbrc deleted file mode 100644 index 710b4a2f..00000000 --- a/src/telenano-v0.1/.sdcdbrc +++ /dev/null @@ -1 +0,0 @@ ---directory=.. diff --git a/src/telenano-v0.1/Makefile b/src/telenano-v0.1/Makefile deleted file mode 100644 index 2714c1e9..00000000 --- a/src/telenano-v0.1/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# -# TeleNano build file -# - -TELENANO_VER=0.1 -TELENANO_DEF=0_1 - -include ../product/Makefile.telenano - diff --git a/src/telerepeat-v1.0/.gitignore b/src/telerepeat-v1.0/.gitignore deleted file mode 100644 index 4bb125bc..00000000 --- a/src/telerepeat-v1.0/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telerepeat-* -ao_product.h diff --git a/src/telerepeat-v1.0/.sdcdbrc b/src/telerepeat-v1.0/.sdcdbrc deleted file mode 100644 index 2c77e32b..00000000 --- a/src/telerepeat-v1.0/.sdcdbrc +++ /dev/null @@ -1,2 +0,0 @@ ---directory=../cc1111:../product:../kernel:../drivers:. - diff --git a/src/telerepeat-v1.0/Makefile b/src/telerepeat-v1.0/Makefile deleted file mode 100644 index 17f68377..00000000 --- a/src/telerepeat-v1.0/Makefile +++ /dev/null @@ -1,100 +0,0 @@ -# -# TeleRepeat build file -# - -TELEREPEAT_VER=1.0 -TELEREPEAT_DEF=1_0 - -vpath %.c ..:../kernel:../cc1111:../drivers:../product -vpath %.h ..:../kernel:../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 - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_monitor.c \ - ao_mutex.c \ - ao_panic.c \ - ao_state.c \ - ao_stdio.c \ - ao_task.c \ - ao_forward.c \ - ao_storage.c \ - ao_freq.c - -CC1111_SRC = \ - ao_dbg.c \ - ao_adc.c \ - ao_dma.c \ - ao_led.c \ - ao_packet.c \ - ao_intflash.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_telerepeat.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(DRIVER_SRC) \ - $(PRODUCT_SRC) - -PROGNAME = telerepeat-v$(TELEREPEAT_VER) -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=TeleRepeat-v$(TELEREPEAT_VER) -PRODUCT_DEF=-DTELEREPEAT_V_$(TELEREPEAT_DEF) -IDPRODUCT=0x000e -CODESIZE=0x7800 - -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) - $(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/telerepeat-v1.0/ao_pins.h b/src/telerepeat-v1.0/ao_pins.h deleted file mode 100644 index e47d368c..00000000 --- a/src/telerepeat-v1.0/ao_pins.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright © 2010 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#define HAS_RADIO 1 -#define HAS_RADIO_FORWARD 1 -#define HAS_FLIGHT 0 -#define HAS_USB 1 -#define HAS_BEEP 0 -#define HAS_SERIAL_1 1 -#define HAS_SERIAL_1_ALT_1 1 -#define HAS_SERIAL_1_ALT_2 0 -#define HAS_SERIAL_1_HW_FLOW 1 -#define USE_SERIAL_1_STDIN 1 -#define DELAY_SERIAL_1_STDIN 1 -#define HAS_DBG 1 -#define HAS_EEPROM 1 -#define HAS_LOG 0 -#define USE_INTERNAL_FLASH 1 -#define HAS_BTM 1 -#define DBG_ON_P1 1 -#define DBG_ON_P0 0 -#define PACKET_HAS_MASTER 1 -#define PACKET_HAS_SLAVE 0 -#define AO_LED_RED 1 -#define AO_LED_BLUE 2 -#define LEDS_AVAILABLE (AO_LED_RED|AO_LED_BLUE) -#define AO_MONITOR_LED AO_LED_RED -#define AO_BT_LED AO_LED_BLUE -#define BT_LINK_ON_P2 0 -#define BT_LINK_ON_P1 1 -#define BT_LINK_PIN_INDEX 7 -#define BT_LINK_PIN P1_7 -#define HAS_MONITOR 1 -#define HAS_MONITOR_PUT 1 -#define LEGACY_MONITOR 0 -#define HAS_TELEMETRY 0 -#define AO_RADIO_REG_TEST 1 - -#define HAS_ADC 1 -#define AO_PAD_ADC_BATT 0 -#define AO_ADC_PINS (1 << AO_PAD_ADC_BATT) - -struct ao_adc { - int16_t batt; -}; - -#define AO_ADC_DUMP(p) \ - printf ("tick: %5u batt %5d\n", \ - (p)->tick, \ - (p)->adc.batt) - -#define FETCH_ADC() do { \ - a = (uint8_t __xdata *) (&ao_data_ring[ao_data_head].adc.batt); \ - a[0] = ADCL; \ - a[1] = ADCH; \ - } while (0) - -#if DBG_ON_P1 - - #define DBG_CLOCK (1 << 4) /* mi0 */ - #define DBG_DATA (1 << 5) /* mo0 */ - #define DBG_RESET_N (1 << 3) /* c0 */ - - #define DBG_CLOCK_PIN (P1_4) - #define DBG_DATA_PIN (P1_5) - #define DBG_RESET_N_PIN (P1_3) - - #define DBG_PORT_NUM 1 - #define DBG_PORT P1 - #define DBG_PORT_SEL P1SEL - #define DBG_PORT_INP P1INP - #define DBG_PORT_DIR P1DIR - -#endif /* DBG_ON_P1 */ - -#if DBG_ON_P0 - - #define DBG_CLOCK (1 << 3) - #define DBG_DATA (1 << 4) - #define DBG_RESET_N (1 << 5) - - #define DBG_CLOCK_PIN (P0_3) - #define DBG_DATA_PIN (P0_4) - #define DBG_RESET_N_PIN (P0_5) - - #define DBG_PORT_NUM 0 - #define DBG_PORT P0 - #define DBG_PORT_SEL P0SEL - #define DBG_PORT_INP P0INP - #define DBG_PORT_DIR P0DIR - -#endif /* DBG_ON_P0 */ - -#endif /* _AO_PINS_H_ */ diff --git a/src/telerepeat-v1.0/ao_telerepeat.c b/src/telerepeat-v1.0/ao_telerepeat.c deleted file mode 100644 index 43a5ed42..00000000 --- a/src/telerepeat-v1.0/ao_telerepeat.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" -#include "ao_forward.h" - -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_task_init(); - - ao_timer_init(); - ao_cmd_init(); - ao_usb_init(); - ao_monitor_init(); - ao_radio_init(); - ao_packet_master_init(); - ao_adc_init(); - ao_btm_init(); - ao_monitor_forward_init(); - ao_storage_init(); -#if HAS_DBG - ao_dbg_init(); -#endif - ao_config_init(); - ao_start_scheduler(); -} diff --git a/src/teleshield-v0.1/.gitignore b/src/teleshield-v0.1/.gitignore deleted file mode 100644 index 3ae78d33..00000000 --- a/src/teleshield-v0.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -teleshield-* -ao_product.h diff --git a/src/teleshield-v0.1/Makefile b/src/teleshield-v0.1/Makefile deleted file mode 100644 index f54488a2..00000000 --- a/src/teleshield-v0.1/Makefile +++ /dev/null @@ -1,111 +0,0 @@ -# -# TeleShield build file -# -# The various telemetrum versions differ only -# in which flash and GPS drivers are included, -# so the per-board makefiles simply define -# TM_VER, TM_DEF, TM_INC and TM_SRC and include -# this file - -TELESHIELD_VER=0.1 -TELESHIELD_DEF=0_1 - -TELESHIELD_INC = - -TELESHIELD_SRC = \ - ao_beep.c \ - ao_btm.c \ - ao_spi.c - -vpath %.c ..:../kernel:../cc1111:../drivers:../product:. -vpath %.h ..:../kernel:../cc1111:../drivers:../product:. -vpath ao-make-product.5c ../util - -ifndef VERSION -include ../Version -endif - -INC = \ - ao.h \ - ao_pins.h \ - cc1111.h \ - ao_product.h \ - $(TELESHIELD_INC) - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_monitor.c \ - ao_mutex.c \ - ao_panic.c \ - ao_state.c \ - ao_storage.c \ - ao_stdio.c \ - ao_task.c \ - ao_freq.c - -CC1111_SRC = \ - ao_dbg.c \ - ao_dma.c \ - ao_led.c \ - ao_intflash.c \ - ao_packet.c \ - ao_packet_slave.c \ - ao_radio.c \ - ao_romconfig.c \ - ao_serial.c \ - ao_string.c \ - ao_timer.c \ - ao_usb.c \ - _bp.c - -DRIVER_SRC = \ - $(TELESHIELD_SRC) - -PRODUCT_SRC = \ - ao_teleshield.c \ - ao_ardu_serial.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(DRIVER_SRC) \ - $(PRODUCT_SRC) - -PROGNAME = teleshield-v$(TELESHIELD_VER) -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=TeleShield-v$(TELESHIELD_VER) -PRODUCT_DEF=-DTELESHIELD_V_$(TELESHIELD_DEF) -IDPRODUCT=0x0013 -CODESIZE=0x7800 - -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) - $(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/teleshield-v0.1/ao_ardu_serial.c b/src/teleshield-v0.1/ao_ardu_serial.c deleted file mode 100644 index 535cc624..00000000 --- a/src/teleshield-v0.1/ao_ardu_serial.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" - -static void -ao_ardu_serial_recv(void) -{ - char c; - - for (;;) { - if (ao_fifo_empty(ao_serial0_rx_fifo)) - flush(); - c = ao_serial0_getchar(); - putchar (c); - } -} - -static __xdata struct ao_task ao_ardu_serial_recv_task; - -void -ao_ardu_serial_init (void) -{ - ao_add_task(&ao_ardu_serial_recv_task, ao_ardu_serial_recv, "recv"); -} diff --git a/src/teleshield-v0.1/ao_pins.h b/src/teleshield-v0.1/ao_pins.h deleted file mode 100644 index 6baa88c8..00000000 --- a/src/teleshield-v0.1/ao_pins.h +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright © 2010 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#if defined(TELESHIELD_V_0_1) - #define HAS_FLIGHT 0 - #define HAS_USB 1 - #define HAS_BEEP 0 - #define HAS_SERIAL_1 1 - #define HAS_SERIAL_1_ALT_1 1 - #define HAS_SERIAL_1_ALT_2 0 - #define HAS_SERIAL_1_HW_FLOW 1 - #define USE_SERIAL_1_STDIN 1 - #define HAS_SERIAL_0 1 - #define HAS_SERIAL_0_ALT_1 0 - #define HAS_SERIAL_0_ALT_2 1 - #define HAS_SERIAL_0_HW_FLOW 0 - #define HAS_ADC 0 - #define HAS_DBG 1 - #define HAS_EEPROM 1 - #define HAS_LOG 0 - #define USE_INTERNAL_FLASH 1 - #define HAS_BTM 1 - #define DBG_ON_P1 1 - #define DBG_ON_P0 0 - #define IGNITE_ON_P2 0 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 0 - #define PACKET_HAS_SLAVE 1 - #define AO_LED_RED 1 - #define AO_LED_GREEN 2 - #define AO_MONITOR_LED AO_LED_RED - #define AO_BT_LED AO_LED_GREEN - #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN) - #define SPI_CS_ON_P1 1 - #define SPI_CS_ON_P0 0 - #define HAS_ACCEL 0 - #define HAS_IGNITE 0 - #define HAS_IGNITE_REPORT 0 - #define BT_LINK_ON_P2 0 - #define BT_LINK_ON_P1 1 - #define BT_LINK_PIN_INDEX 7 - #define BT_LINK_PIN P1_7 - #define HAS_MONITOR 1 - #define LEGACY_MONITOR 0 - #define HAS_RSSI 0 - #define HAS_AES 0 - #define HAS_RADIO 1 - #define HAS_TELEMETRY 0 -#endif - -#if DBG_ON_P1 - - #define DBG_CLOCK (1 << 4) /* mi0 */ - #define DBG_DATA (1 << 5) /* mo0 */ - #define DBG_RESET_N (1 << 3) /* c0 */ - - #define DBG_CLOCK_PIN (P1_4) - #define DBG_DATA_PIN (P1_5) - #define DBG_RESET_N_PIN (P1_3) - - #define DBG_PORT_NUM 1 - #define DBG_PORT P1 - #define DBG_PORT_SEL P1SEL - #define DBG_PORT_INP P1INP - #define DBG_PORT_DIR P1DIR - -#endif /* DBG_ON_P1 */ - -#if DBG_ON_P0 - - #define DBG_CLOCK (1 << 3) - #define DBG_DATA (1 << 4) - #define DBG_RESET_N (1 << 5) - - #define DBG_CLOCK_PIN (P0_3) - #define DBG_DATA_PIN (P0_4) - #define DBG_RESET_N_PIN (P0_5) - - #define DBG_PORT_NUM 0 - #define DBG_PORT P0 - #define DBG_PORT_SEL P0SEL - #define DBG_PORT_INP P0INP - #define DBG_PORT_DIR P0DIR - -#endif /* DBG_ON_P0 */ - -#if COMPANION_CS_ON_P1 - #define COMPANION_CS_PORT P1 - #define COMPANION_CS_SEL P1SEL - #define COMPANION_CS_DIR P1DIR -#endif - -#if SPI_CS_ON_P1 - #define SPI_CS_PORT P1 - #define SPI_CS_SEL P1SEL - #define SPI_CS_DIR P1DIR -#endif - -#if SPI_CS_ON_P0 - #define SPI_CS_PORT P0 - #define SPI_CS_SEL P0SEL - #define SPI_CS_DIR P0DIR -#endif - -#ifndef IGNITE_ON_P2 -#error Please define IGNITE_ON_P2 -#endif - -#ifndef IGNITE_ON_P0 -#error Please define IGNITE_ON_P0 -#endif - -#ifndef HAS_SERIAL_1 -#error Please define HAS_SERIAL_1 -#endif - -#ifndef HAS_ADC -#error Please define HAS_ADC -#endif - -#ifndef HAS_EEPROM -#error Please define HAS_EEPROM -#endif - -#ifndef HAS_LOG -#error Please define HAS_LOG -#endif - -#if HAS_EEPROM -#ifndef USE_INTERNAL_FLASH -#error Please define USE_INTERNAL_FLASH -#endif -#endif - -#ifndef HAS_DBG -#error Please define HAS_DBG -#endif - -#ifndef HAS_IGNITE -#error Please define HAS_IGNITE -#endif - -#if HAS_IGNITE -#define HAS_IGNITE_REPORT 1 -#endif - -#ifndef PACKET_HAS_MASTER -#error Please define PACKET_HAS_MASTER -#endif - -#ifndef PACKET_HAS_SLAVE -#error Please define PACKET_HAS_SLAVE -#endif - -#ifndef HAS_MONITOR -#error Please define HAS_MONITOR -#endif - -#if HAS_MONITOR -#ifndef HAS_RSSI -#error Please define HAS_RSSI -#endif -#endif - -#ifndef HAS_ADC -#error Please define HAS_ADC -#endif - -#if HAS_ADC - -#if HAS_ACCEL -#ifndef HAS_ACCEL_REF -#error Please define HAS_ACCEL_REF -#endif -#else -#define HAS_ACCEL_REF 0 -#endif - -#endif /* HAS_ADC */ - -#if IGNITE_ON_P2 -#define AO_IGNITER_DROGUE P2_3 -#define AO_IGNITER_MAIN P2_4 -#define AO_IGNITER_DIR P2DIR -#define AO_IGNITER_DROGUE_BIT (1 << 3) -#define AO_IGNITER_MAIN_BIT (1 << 4) -#endif - -#if IGNITE_ON_P0 -#define AO_IGNITER_DROGUE P0_5 -#define AO_IGNITER_MAIN P0_4 -#define AO_IGNITER_DIR P0DIR -#define AO_IGNITER_DROGUE_BIT (1 << 5) -#define AO_IGNITER_MAIN_BIT (1 << 4) -#endif - -/* test these values with real igniters */ -#define AO_IGNITER_OPEN 1000 -#define AO_IGNITER_CLOSED 7000 -#define AO_IGNITER_FIRE_TIME AO_MS_TO_TICKS(50) -#define AO_IGNITER_CHARGE_TIME AO_MS_TO_TICKS(2000) - -void -ao_ardu_serial_init (void); - - -#endif /* _AO_PINS_H_ */ diff --git a/src/teleshield-v0.1/ao_teleshield.c b/src/teleshield-v0.1/ao_teleshield.c deleted file mode 100644 index 713c49f9..00000000 --- a/src/teleshield-v0.1/ao_teleshield.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" - -#if 0 -__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_task_init(); - ao_timer_init(); - ao_cmd_init(); - ao_spi_init(); - ao_storage_init(); - ao_usb_init(); - ao_monitor_init(); - ao_radio_init(); - ao_packet_slave_init(1); - ao_btm_init(); -#if HAS_DBG - ao_dbg_init(); -#endif -#if HAS_AES - ao_aes_init(); - ao_radio_cmac_init(); -#endif - ao_serial_init(); - ao_ardu_serial_init(); - ao_config_init(); - ao_start_scheduler(); -} diff --git a/src/teleterra-v0.2/.gitignore b/src/teleterra-v0.2/.gitignore deleted file mode 100644 index 9daebc3e..00000000 --- a/src/teleterra-v0.2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -teleterra-v0.2* -ao_product.h diff --git a/src/teleterra-v0.2/.sdcdbrc b/src/teleterra-v0.2/.sdcdbrc deleted file mode 100644 index e9a51ea6..00000000 --- a/src/teleterra-v0.2/.sdcdbrc +++ /dev/null @@ -1 +0,0 @@ ---directory=../cc1111:../product:../kernel:../drivers:. diff --git a/src/teleterra-v0.2/Makefile b/src/teleterra-v0.2/Makefile deleted file mode 100644 index 826c52e5..00000000 --- a/src/teleterra-v0.2/Makefile +++ /dev/null @@ -1,105 +0,0 @@ -# -# TeleTerra build file -# - -vpath %.c ..:../kernel:../cc1111:../drivers:../product -vpath %.h ..:../kernel:../cc1111:../drivers:../product -vpath ao-make-product.5c ../util - -ifndef VERSION -include ../Version -endif - -INC = \ - ao.h \ - ao_pins.h \ - cc1111.h \ - ao_product.h - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_monitor.c \ - ao_log_single.c \ - ao_log_telem.c \ - ao_mutex.c \ - ao_panic.c \ - ao_report.c \ - ao_sqrt.c \ - ao_stdio.c \ - ao_storage.c \ - ao_task.c \ - ao_freq.c - -CC1111_SRC = \ - ao_battery.c \ - ao_beep.c \ - ao_button.c \ - ao_dbg.c \ - ao_dma.c \ - ao_packet.c \ - ao_packet_master.c \ - ao_radio.c \ - ao_romconfig.c \ - ao_serial.c \ - ao_spi.c \ - ao_string.c \ - ao_timer.c \ - ao_usb.c \ - ao_lcd_port.c \ - _bp.c - -DRIVER_SRC = \ - ao_m25.c \ - ao_lcd.c \ - ao_gps_skytraq.c \ - ao_gps_show.c - -PRODUCT_SRC = \ - ao_teleterra_0_2.c \ - ao_terraui.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(DRIVER_SRC) \ - $(PRODUCT_SRC) - -TELETERRA_VER=0.2 -TELETERRA_DEF=0_2 -PROGNAME = teleterra-v$(TELETERRA_VER) -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=TeleTerra-v$(TELETERRA_VER) -PRODUCT_DEF=-DTELETERRA_V_$(TELETERRA_DEF) -IDPRODUCT=0x000d - -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) - $(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/teleterra-v0.2/ao_pins.h b/src/teleterra-v0.2/ao_pins.h deleted file mode 100644 index 5bcf2c8a..00000000 --- a/src/teleterra-v0.2/ao_pins.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#ifdef TELETERRA_V_0_2 - #define HAS_FLIGHT 0 - #define HAS_USB 1 - #define HAS_RADIO 1 - #define HAS_BEEP 1 - #define HAS_GPS 1 - #define HAS_SERIAL_1 1 - #define HAS_ADC 0 - #define HAS_LCD 1 - #define HAS_EEPROM 1 - #define HAS_LOG 1 - #define USE_INTERNAL_FLASH 0 - #define HAS_DBG 1 - #define DBG_ON_P1 1 - #define DBG_ON_P0 0 - #define IGNITE_ON_P2 0 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 1 - #define PACKET_HAS_SLAVE 0 - #define HAS_RADIO_CHANNELS 1 - - #define HAS_COMPANION 0 - - #define AO_MONITOR_LED 0 - #define LEDS_AVAILABLE 0 - #define HAS_EXTERNAL_TEMP 0 - #define HAS_ACCEL_REF 0 - #define HAS_ACCEL 0 - #define HAS_IGNITE 0 - #define HAS_MONITOR 1 - #define HAS_MONITOR_PUT 1 - #define LEGACY_MONITOR 0 - #define HAS_RSSI 0 - #define HAS_AES 0 - - #define SPI_CS_ON_P1 1 - #define SPI_CS_ON_P0 0 - #define M25_CS_MASK 0x04 - #define M25_MAX_CHIPS 1 - - #define HAS_BUTTON 1 - #define BUTTON_1_REG 0 - #define BUTTON_1_MASK (1 << 4) /* P0_4 */ - - #define BUTTON_2_REG 2 - #define BUTTON_2_MASK (1 << 3) /* P2_3 */ - - #define BUTTON_3_REG 2 - #define BUTTON_3_MASK (1 << 4) /* P2_4 */ - - #define HAS_P2_ISR 1 - - #define BATTERY_PIN 5 - #define HAS_TELEMETRY 0 - - #define AO_VALUE_32 0 - - #define AO_LOG_FORMAT AO_LOG_FORMAT_TELEMETRY -#endif - -#if DBG_ON_P1 - - #define DBG_CLOCK (1 << 4) /* mi0 */ - #define DBG_DATA (1 << 5) /* mo0 */ - #define DBG_RESET_N (1 << 3) /* c0 */ - - #define DBG_CLOCK_PIN (P1_4) - #define DBG_DATA_PIN (P1_5) - #define DBG_RESET_N_PIN (P1_3) - - #define DBG_PORT_NUM 1 - #define DBG_PORT P1 - #define DBG_PORT_SEL P1SEL - #define DBG_PORT_INP P1INP - #define DBG_PORT_DIR P1DIR - -#endif /* DBG_ON_P1 */ - -#if DBG_ON_P0 - - #define DBG_CLOCK (1 << 3) - #define DBG_DATA (1 << 4) - #define DBG_RESET_N (1 << 5) - - #define DBG_CLOCK_PIN (P0_3) - #define DBG_DATA_PIN (P0_4) - #define DBG_RESET_N_PIN (P0_5) - - #define DBG_PORT_NUM 0 - #define DBG_PORT P0 - #define DBG_PORT_SEL P0SEL - #define DBG_PORT_INP P0INP - #define DBG_PORT_DIR P0DIR - -#endif /* DBG_ON_P0 */ - -#if COMPANION_CS_ON_P1 - #define COMPANION_CS_PORT P1 - #define COMPANION_CS_SEL P1SEL - #define COMPANION_CS_DIR P1DIR -#endif - -#if SPI_CS_ON_P1 - #define SPI_CS_PORT P1 - #define SPI_CS_SEL P1SEL - #define SPI_CS_DIR P1DIR -#endif - -#if SPI_CS_ON_P0 - #define SPI_CS_PORT P0 - #define SPI_CS_SEL P0SEL - #define SPI_CS_DIR P0DIR -#endif - -#ifndef IGNITE_ON_P2 -#error Please define IGNITE_ON_P2 -#endif - -#ifndef IGNITE_ON_P0 -#error Please define IGNITE_ON_P0 -#endif - -#ifndef HAS_SERIAL_1 -#error Please define HAS_SERIAL_1 -#endif - -#ifndef HAS_ADC -#error Please define HAS_ADC -#endif - -#ifndef HAS_EEPROM -#error Please define HAS_EEPROM -#endif - -#ifndef HAS_LOG -#error Please define HAS_LOG -#endif - -#if HAS_EEPROM -#ifndef USE_INTERNAL_FLASH -#error Please define USE_INTERNAL_FLASH -#endif -#endif - -#ifndef HAS_DBG -#error Please define HAS_DBG -#endif - -#ifndef HAS_IGNITE -#error Please define HAS_IGNITE -#endif - -#if HAS_IGNITE -#define HAS_IGNITE_REPORT 1 -#endif - -#ifndef PACKET_HAS_MASTER -#error Please define PACKET_HAS_MASTER -#endif - -#ifndef PACKET_HAS_SLAVE -#error Please define PACKET_HAS_SLAVE -#endif - -#ifndef HAS_MONITOR -#error Please define HAS_MONITOR -#endif - -#if HAS_MONITOR -#ifndef HAS_RSSI -#error Please define HAS_RSSI -#endif -#endif - -#ifndef HAS_ADC -#error Please define HAS_ADC -#endif - -#if HAS_ADC - -#if HAS_ACCEL -#ifndef HAS_ACCEL_REF -#error Please define HAS_ACCEL_REF -#endif -#else -#define HAS_ACCEL_REF 0 -#endif - -#endif /* HAS_ADC */ - -#if IGNITE_ON_P2 -#define AO_IGNITER_DROGUE P2_3 -#define AO_IGNITER_MAIN P2_4 -#define AO_IGNITER_DIR P2DIR -#define AO_IGNITER_DROGUE_BIT (1 << 3) -#define AO_IGNITER_MAIN_BIT (1 << 4) -#endif - -#if IGNITE_ON_P0 -#define AO_IGNITER_DROGUE P0_5 -#define AO_IGNITER_MAIN P0_4 -#define AO_IGNITER_DIR P0DIR -#define AO_IGNITER_DROGUE_BIT (1 << 5) -#define AO_IGNITER_MAIN_BIT (1 << 4) -#endif - -/* test these values with real igniters */ -#define AO_IGNITER_OPEN 1000 -#define AO_IGNITER_CLOSED 7000 -#define AO_IGNITER_FIRE_TIME AO_MS_TO_TICKS(50) -#define AO_IGNITER_CHARGE_TIME AO_MS_TO_TICKS(2000) - -#define AO_M25_SPI_CS_PORT SPI_CS_PORT -#define AO_M25_SPI_CS_MASK M25_CS_MASK - -#endif /* _AO_PINS_H_ */ diff --git a/src/tidongle/.gitignore b/src/tidongle/.gitignore deleted file mode 100644 index 3888a0f9..00000000 --- a/src/tidongle/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -tidongle* -ao_product.h diff --git a/src/tidongle/Makefile b/src/tidongle/Makefile deleted file mode 100644 index 0e90d744..00000000 --- a/src/tidongle/Makefile +++ /dev/null @@ -1,91 +0,0 @@ -# -# TIDongle build file -# - -vpath %.c ..:../kernel:../cc1111:../drivers:../product -vpath %.h ..:../kernel:../cc1111:../drivers:../product -vpath ao-make-product.5c ../util - -ifndef VERSION -include ../Version -endif - -INC = \ - ao.h \ - ao_pins.h \ - cc1111.h \ - ao_product.h - -CORE_SRC = \ - ao_cmd.c \ - ao_config.c \ - ao_gps_print.c \ - ao_monitor.c \ - ao_mutex.c \ - ao_panic.c \ - ao_rssi.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_string.c \ - ao_timer.c \ - ao_usb.c \ - _bp.c - -DRIVER_SRC = - -PRODUCT_SRC = \ - ao_tidongle.c - -SRC = \ - $(CORE_SRC) \ - $(CC1111_SRC) \ - $(DRIVER_SRC) \ - $(PRODUCT_SRC) - -PROGNAME = tidongle -PROG = $(PROGNAME)-$(VERSION).ihx -PRODUCT=TIDongle -PRODUCT_DEF=-DTIDONGLE -IDPRODUCT=0x000a - -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) - $(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/telegps/Makefile.am b/telegps/Makefile.am index 106ce55a..3443b288 100644 --- a/telegps/Makefile.am +++ b/telegps/Makefile.am @@ -102,14 +102,12 @@ LINUX_MIMETYPE =\ $(ICONDIR)/org-altusmetrum-mimetypes.xml # Firmware -FIRMWARE_TD_0_2=$(top_srcdir)/src/teledongle-v0.2/teledongle-v0.2-$(VERSION).ihx FIRMWARE_TD_3_0=$(top_srcdir)/src/teledongle-v3.0/teledongle-v3.0-$(VERSION).ihx -FIRMWARE_TD=$(FIRMWARE_TD_0_2) $(FIRMWARE_TD_3_0) +FIRMWARE_TD=$(FIRMWARE_TD_3_0) -FIRMWARE_TBT_1_0=$(top_srcdir)/src/telebt-v1.0/telebt-v1.0-$(VERSION).ihx FIRMWARE_TBT_3_0=$(top_srcdir)/src/telebt-v3.0/telebt-v3.0-$(VERSION).ihx FIRMWARE_TBT_4_0=$(top_srcdir)/src/telebt-v4.0/telebt-v4.0-$(VERSION).ihx -FIRMWARE_TBT=$(FIRMWARE_TBT_1_0) $(FIRMWARE_TBT_3_0) $(FIRMWARE_TBT_4_0) +FIRMWARE_TBT=$(FIRMWARE_TBT_3_0) $(FIRMWARE_TBT_4_0) FIRMWARE_TG_1_0=$(top_srcdir)/src/telegps-v1.0/telegps-v1.0-$(VERSION).ihx FIRMWARE_TG_2_0=$(top_srcdir)/src/telegps-v2.0/telegps-v2.0-$(VERSION).ihx diff --git a/telegps/telegps-windows.nsi.in b/telegps/telegps-windows.nsi.in index e6ce9f84..c83b21c5 100644 --- a/telegps/telegps-windows.nsi.in +++ b/telegps/telegps-windows.nsi.in @@ -122,9 +122,7 @@ Section "TeleGPS, TeleDongle and TeleBT Firmware" File "../src/telegps-v1.0/telegps-v1.0-${VERSION}.ihx" File "../src/telegps-v2.0/telegps-v2.0-${VERSION}.ihx" - File "../src/teledongle-v0.2/teledongle-v0.2-${VERSION}.ihx" File "../src/teledongle-v3.0/teledongle-v3.0-${VERSION}.ihx" - File "../src/telebt-v1.0/telebt-v1.0-${VERSION}.ihx" File "../src/telebt-v3.0/telebt-v3.0-${VERSION}.ihx" File "../src/telebt-v4.0/telebt-v4.0-${VERSION}.ihx" -- cgit v1.2.3 From 7c04888cf9809e0c73f0813c74e8dd972facde3a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 5 Aug 2018 12:23:22 +0800 Subject: altos: Switch to newlib-nano for libc on arm Stop using pdclib Signed-off-by: Keith Packard --- Makefile.am | 6 - configure.ac | 64 +++--- src/Makedefs.in | 10 +- src/easymega-v1.0/Makefile | 18 -- src/kernel/ao.h | 9 + src/kernel/ao_stdio.c | 35 +++- src/lambdakey-v1.0/Makefile | 17 +- src/lambdakey-v1.0/ao_lambdakey.c | 15 ++ src/lambdakey-v1.0/ao_pins.h | 8 - src/lambdakey-v1.0/ao_scheme_os.h | 20 +- src/lambdakey-v1.0/lambda.ld | 114 ----------- src/lpc/Makefile-lpc.defs | 5 +- src/lpc/ao_arch.h | 8 - src/math/ef_acos.c | 84 -------- src/math/ef_log.c | 92 --------- src/math/ef_rem_pio2.c | 193 ------------------ src/math/ef_sqrt.c | 89 -------- src/math/fdlibm.h | 414 -------------------------------------- src/math/ieeefp.h | 256 ----------------------- src/math/kf_cos.c | 59 ------ src/math/kf_rem_pio2.c | 209 ------------------- src/math/kf_sin.c | 49 ----- src/math/machine/ieeefp.h | 382 ----------------------------------- src/math/math.h | 40 ---- src/math/sf_copysign.c | 50 ----- src/math/sf_cos.c | 62 ------ src/math/sf_fabs.c | 47 ----- src/math/sf_floor.c | 80 -------- src/math/sf_scalbn.c | 86 -------- src/math/sf_sin.c | 62 ------ src/stm/Makefile-flash.defs | 10 +- src/stm/Makefile.defs | 9 +- src/stm/ao_arch.h | 10 - src/stmf0/Makefile-stmf0.defs | 7 +- src/stmf0/ao_arch.h | 10 - src/teleballoon-v2.0/Makefile | 4 - src/telemega-v0.1/Makefile | 17 -- src/telemega-v1.0/Makefile | 18 -- src/telemega-v2.0/Makefile | 18 -- src/telemega-v3.0/Makefile | 18 -- src/telemetrum-v2.0/Makefile | 4 - src/telemetrum-v3.0/Makefile | 4 - 42 files changed, 119 insertions(+), 2593 deletions(-) delete mode 100644 src/lambdakey-v1.0/lambda.ld delete mode 100644 src/math/ef_acos.c delete mode 100644 src/math/ef_log.c delete mode 100644 src/math/ef_rem_pio2.c delete mode 100644 src/math/ef_sqrt.c delete mode 100644 src/math/fdlibm.h delete mode 100644 src/math/ieeefp.h delete mode 100644 src/math/kf_cos.c delete mode 100644 src/math/kf_rem_pio2.c delete mode 100644 src/math/kf_sin.c delete mode 100644 src/math/machine/ieeefp.h delete mode 100644 src/math/math.h delete mode 100644 src/math/sf_copysign.c delete mode 100644 src/math/sf_cos.c delete mode 100644 src/math/sf_fabs.c delete mode 100644 src/math/sf_floor.c delete mode 100644 src/math/sf_scalbn.c delete mode 100644 src/math/sf_sin.c diff --git a/Makefile.am b/Makefile.am index 89fdd6c9..602226f5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,12 +6,6 @@ MAINTAINERCLEANFILES = ChangeLog .PHONY: ChangeLog -all: pdclib/Makefile -all-recursive: pdclib/Makefile - -pdclib/Makefile: - git submodule update - ChangeLog: (GIT_DIR=$(top_srcdir)/.git git log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || \ (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2) diff --git a/configure.ac b/configure.ac index 519f18f1..517cdc25 100644 --- a/configure.ac +++ b/configure.ac @@ -238,27 +238,6 @@ fi AC_SUBST(HAVE_ARM_CC) AC_SUBST(ARM_CC) -if test -d pdclib -a x"$HAVE_ARM_CC" = xyes; then - PDCLIB_ROOT='$(TOPDIR)/../pdclib-root' - PDCLIB_INCLUDES='-I$(TOPDIR)/../pdclib-root/include' - PDCLIB_LIBS_M0='-L$(TOPDIR)/../pdclib-root/lib -lpdclib-cortex-m0' - PDCLIB_LIBS_M3='-L$(TOPDIR)/../pdclib-root/lib -lpdclib-cortex-m3' - HAVE_PDCLIB=yes -else - PDCLIB_INCLUDES='' - PDCLIB_LIBS_M0='-lpdclib-cortex-m0' - PDCLIB_LIBS_M3='-lpdclib-cortex-m3' - HAVE_PDCLIB=no -fi - -AM_CONDITIONAL(PDCLIB, [test x$HAVE_PDCLIB = xyes]) - -AC_SUBST(PDCLIB_INCLUDES) -AC_SUBST(PDCLIB_LIBS_M0) -AC_SUBST(PDCLIB_LIBS_M3) -AC_SUBST(PDCLIB_ROOT) -AC_SUBST(HAVE_PDCLIB) - if test "x$HAVE_ARM_CC" = "xyes"; then save_CC="$CC" save_CFLAGS="$CFLAGS" @@ -281,16 +260,6 @@ if test "x$HAVE_ARM_CC" = "xyes"; then [HAVE_ARM_M3_CC=no]) AC_MSG_RESULT([$HAVE_ARM_M3_CC]) - if test x$HAVE_PDCLIB != xyes; then - AC_CHECK_LIB(pdclib-cortex-m0,memcpy, - [], - [HAVE_ARM_M0_CC=no]) - - AC_CHECK_LIB(pdclib-cortex-m3,memcpy, - [], - [HAVE_ARM_M3_CC=no]) - fi - AC_LANG_POP([C]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" @@ -310,6 +279,37 @@ if test "x$HAVE_ARM_M0_CC" = "xno"; then AC_MSG_WARN([No cortex-m0 arm compiler found, LPC11U14 binaries will not be built]) fi +AC_ARG_WITH([newlib-nano], + [AS_HELP_STRING([--with-newlib-nano], + [Root of newlib nano install])], + [], + [with_newlib_nano=auto]) + +HAVE_NEWLIB_NANO=no +if test "x$with_newlib_nano" != "xno"; then + if test "x$with_newlib_nano" = "xauto"; then + for d in /usr/local/lib/newlib-nano /usr/lib/newlib-nano; do + if test "x$with_newlib_nano" = "xauto" -a -d "$d"; then + with_newlib_nano="$d" + HAVE_NEWLIB_NANO=yes + fi + done + else + HAVE_NEWLIB_NANO=yes + fi +fi + +if test "x$HAVE_NEWLIB_NANO" = "xno"; then + AC_MSG_WARN([No newlib-nano library found, ARM binaries will not be built]) + HAVE_ARM_M3_CC=no + HAVE_ARM_M0_CC=no +else + NEWLIB_NANO="$with_newlib_nano" +fi + +AC_SUBST(HAVE_NEWLIB_NANO) +AC_SUBST(NEWLIB_NANO) + # # Configure AVR compiler # @@ -562,7 +562,7 @@ echo " AVR support.................: ${HAVE_AVR_CC}" echo " Android support.............: ${HAVE_ANDROID_SDK}" echo " Android release support.....: ${ANDROID_RELEASE}" echo " STlink support..............: ${HAVE_STLINK}" -echo " Local pdclib................: ${HAVE_PDCLIB}" +echo " Newlib-nano support.........: ${NEWLIB_NANO}" echo " i386 and amd64 libaltos.....: ${MULTI_ARCH}" echo " install shared mime info....: ${INSTALL_SHARED_MIME_INFO}" echo "" diff --git a/src/Makedefs.in b/src/Makedefs.in index a52f96fa..b87e8846 100644 --- a/src/Makedefs.in +++ b/src/Makedefs.in @@ -1,14 +1,8 @@ ARM_CC=@ARM_CC@ HAVE_ARM_M3_CC=@HAVE_ARM_M3_CC@ HAVE_ARM_M0_CC=@HAVE_ARM_M0_CC@ -PDCLIB_INCLUDES=@PDCLIB_INCLUDES@ -PDCLIB_LIBS_M0=@PDCLIB_LIBS_M0@ -PDCLIB_LIBS_M3=@PDCLIB_LIBS_M3@ -PDCLIB_ROOT=@PDCLIB_ROOT@ -HAVE_PDCLIB=@HAVE_PDCLIB@ - -SDCC=@SDCC@ -HAVE_SDCC=@HAVE_SDCC@ +NEWLIB_NANO=@NEWLIB_NANO@ +HAVE_NEWLIB_NANO=@HAVE_NEWLIB_NANO@ AVR_CC=@AVR_CC@ AVR_OBJCOPY=@AVR_OBJCOPY@ diff --git a/src/easymega-v1.0/Makefile b/src/easymega-v1.0/Makefile index c3b360b4..3344da06 100644 --- a/src/easymega-v1.0/Makefile +++ b/src/easymega-v1.0/Makefile @@ -26,10 +26,8 @@ INC = \ ao_whiten.h \ ao_sample_profile.h \ ao_quaternion.h \ - math.h \ ao_mpu.h \ stm32l.h \ - math.h \ Makefile # @@ -47,21 +45,6 @@ INC = \ #STACK_GUARD=ao_mpu_stm.c #STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 -MATH_SRC=\ - ef_acos.c \ - ef_sqrt.c \ - ef_rem_pio2.c \ - kf_cos.c \ - kf_sin.c \ - kf_rem_pio2.c \ - sf_copysign.c \ - sf_cos.c \ - sf_fabs.c \ - sf_floor.c \ - sf_scalbn.c \ - sf_sin.c \ - ef_log.c - ALTOS_SRC = \ ao_boot_chain.c \ ao_interrupt.c \ @@ -102,7 +85,6 @@ ALTOS_SRC = \ ao_flight.c \ ao_companion.c \ ao_pyro.c \ - $(MATH_SRC) \ $(PROFILE) \ $(SAMPLE_PROFILE) \ $(STACK_GUARD) diff --git a/src/kernel/ao.h b/src/kernel/ao.h index 0a3981d7..204eaae7 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -26,6 +26,15 @@ #include #include +/* replace stdio macros with direct calls to our functions */ +#undef putchar +#undef getchar +#define putchar(c) ao_putchar(c) +#define getchar ao_getchar + +extern int ao_putchar(char c); +extern char ao_getchar(void); + #define TRUE 1 #define FALSE 0 diff --git a/src/kernel/ao_stdio.c b/src/kernel/ao_stdio.c index dc09b5c7..227499c8 100644 --- a/src/kernel/ao_stdio.c +++ b/src/kernel/ao_stdio.c @@ -83,7 +83,7 @@ __pdata int8_t ao_cur_stdio; #define ao_num_stdios 0 #endif -void +int ao_putchar(char c) { #if LOW_LEVEL_DEBUG @@ -92,12 +92,13 @@ ao_putchar(char c) if (c == '\n') ao_debug_out('\r'); ao_debug_out(c); - return; + return 0; } #endif if (c == '\n') (*ao_stdios[ao_cur_stdio].putchar)('\r'); (*ao_stdios[ao_cur_stdio].putchar)(c); + return 0; } void @@ -158,3 +159,33 @@ ao_add_stdio(int (*_pollchar)(void), return 0; #endif } + +/* + * Basic I/O functions to support newlib tinystdio package + */ + +static int +ao_putc(char c, FILE *ignore) +{ + (void) ignore; + return ao_putchar(c); +} + +static int +ao_getc(FILE *ignore) +{ + (void) ignore; + return ao_getchar(); +} + +static int +ao_flushc(FILE *ignore) +{ + (void) ignore; + flush(); + return 0; +} + +static FILE __stdio = FDEV_SETUP_STREAM(ao_putc, ao_getc, ao_flushc, _FDEV_SETUP_RW); + +FILE *const __iob[3] = { &__stdio, &__stdio, &__stdio }; diff --git a/src/lambdakey-v1.0/Makefile b/src/lambdakey-v1.0/Makefile index 33c68cf5..b94c3873 100644 --- a/src/lambdakey-v1.0/Makefile +++ b/src/lambdakey-v1.0/Makefile @@ -9,10 +9,6 @@ aoschemelib=$(shell pkg-config --variable=aoschemelib ao-scheme) include $(aoschemelib)/Makefile-scheme -NEWLIB_FULL=-lm -lc -lgcc - -LIBS=$(NEWLIB_FULL) - INC = \ ao.h \ ao_arch.h \ @@ -34,7 +30,6 @@ ALTOS_SRC = \ ao_led.c \ ao_notask.c \ ao_stdio.c \ - ao_stdio_newlib.c \ ao_panic.c \ ao_timer.c \ ao_usb_stm.c \ @@ -45,15 +40,7 @@ PRODUCT=LambdaKey-v1.0 PRODUCT_DEF=-DLAMBDAKEY IDPRODUCT=0x000a -CFLAGS = $(PRODUCT_DEF) -I. $(STMF0_CFLAGS) -Os -g - -LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stmf0 -Wl,-Tlambda.ld - -MAP=$(PROG).map -NEWLIB=/local/newlib-mini -MAPFILE=-Wl,-Map=$(MAP) -LDFLAGS=-L../stmf0 -L$(NEWLIB)/arm-none-eabi/lib/thumb/v6-m/ -Wl,-Tlambda.ld $(MAPFILE) -nostartfiles -AO_CFLAGS=-I. -I../stmf0 -I../kernel -I../drivers -I.. -I$(aoschemelib) -isystem $(NEWLIB)/arm-none-eabi/include -DNEWLIB +CFLAGS = $(PRODUCT_DEF) -I. -I$(aoschemelib) $(STMF0_CFLAGS) -Os -g PROGNAME=lambdakey-v1.0 PROG=$(PROGNAME)-$(VERSION).elf @@ -67,7 +54,7 @@ bletch: all: $(PROG) $(HEX) -$(PROG): Makefile $(OBJ) lambda.ld +$(PROG): Makefile $(OBJ) $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) $(OBJ): $(INC) diff --git a/src/lambdakey-v1.0/ao_lambdakey.c b/src/lambdakey-v1.0/ao_lambdakey.c index f1a2aa38..a608d8e4 100644 --- a/src/lambdakey-v1.0/ao_lambdakey.c +++ b/src/lambdakey-v1.0/ao_lambdakey.c @@ -24,6 +24,21 @@ static const struct ao_cmds blink_cmds[] = { { 0, 0 } }; +int +_ao_scheme_getc(void) +{ + static uint8_t at_eol; + int c; + + if (at_eol) { + ao_cmd_readline(ao_scheme_read_list ? "Λ " : "λ "); + at_eol = 0; + } + c = (unsigned char) ao_cmd_lex(); + if (c == '\n') + at_eol = 1; + return c; +} void main(void) { diff --git a/src/lambdakey-v1.0/ao_pins.h b/src/lambdakey-v1.0/ao_pins.h index 58a75080..92ed24ee 100644 --- a/src/lambdakey-v1.0/ao_pins.h +++ b/src/lambdakey-v1.0/ao_pins.h @@ -19,14 +19,6 @@ #ifndef _AO_PINS_H_ #define _AO_PINS_H_ -#define fprintf(file, ...) ({ (void) (file); printf(__VA_ARGS__); }) -#undef putc -#define putc(c,file) ({ (void) (file); putchar(c); }) -#define fputs(s,file) ({ (void) (file); ao_put_string(s); }) -#undef getc -#define getc(file) ({ (void) (file); getchar(); }) -#define fflush(file) ({ (void) (file); flush(); }) - #define HAS_TASK 0 #define HAS_AO_DELAY 1 diff --git a/src/lambdakey-v1.0/ao_scheme_os.h b/src/lambdakey-v1.0/ao_scheme_os.h index 8af199c2..41357552 100644 --- a/src/lambdakey-v1.0/ao_scheme_os.h +++ b/src/lambdakey-v1.0/ao_scheme_os.h @@ -19,6 +19,7 @@ #define _AO_SCHEME_OS_H_ #include "ao.h" +#include "ao_scheme.h" #define AO_SCHEME_POOL 3792 #define AO_SCHEME_TOKEN_MAX 64 @@ -29,22 +30,13 @@ #define __BYTE_ORDER __LITTLE_ENDIAN #endif -static inline int -_ao_scheme_getc() { - static uint8_t at_eol; - int c; - - if (at_eol) { - ao_cmd_readline(); - at_eol = 0; - } - c = ao_cmd_lex(); - if (c == '\n') - at_eol = 1; - return c; -} +extern int _ao_scheme_getc(void); #define ao_scheme_getc(f) ({ (void) (f); _ao_scheme_getc(); }) +#undef putc +#define putc(c, f) ({ (void) (f); ao_putchar(c); }) +#define fputs(s, f) ({ (void) (f); ao_put_string(s); }) +#define fiprintf(f, ...) ({ (void) (f); iprintf(__VA_ARGS__); }) static inline void ao_scheme_abort(void) diff --git a/src/lambdakey-v1.0/lambda.ld b/src/lambdakey-v1.0/lambda.ld deleted file mode 100644 index b09fdb4a..00000000 --- a/src/lambdakey-v1.0/lambda.ld +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -MEMORY { - rom (rx) : ORIGIN = 0x08001000, LENGTH = 28K - ram (!w) : ORIGIN = 0x20000000, LENGTH = 6k - 1k - stack (!w) : ORIGIN = 0x20000000 + 6k - 1k, LENGTH = 1k -} - -INCLUDE registers.ld - -EXTERN (stm_interrupt_vector) - -SECTIONS { - /* - * Rom contents - */ - - .interrupt ORIGIN(ram) : AT (ORIGIN(rom)) { - __interrupt_start__ = .; - __interrupt_rom__ = ORIGIN(rom); - *(.interrupt) /* Interrupt vectors */ - __interrupt_end__ = .; - } > ram - - .text ORIGIN(rom) + 0x100 : { - __text_start__ = .; - - /* Ick. What I want is to specify the - * addresses of some global constants so - * that I can find them across versions - * of the application. I can't figure out - * how to make gnu ld do that, so instead - * we just load the two files that include - * these defines in the right order here and - * expect things to 'just work'. Don't change - * the contents of those files, ok? - */ - ao_romconfig.o(.romconfig*) - ao_product.o(.romconfig*) - - *(.text*) /* Executable code */ - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - *(.rodata*) /* Constants */ - - } > rom - __text_end__ = .; - - - /* Boot data which must live at the start of ram so that - * the application and bootloader share the same addresses. - * This must be all uninitialized data - */ - .boot (NOLOAD) : { - __boot_start__ = .; - *(.boot) - . = ALIGN(4); - __boot_end__ = .; - } >ram - - /* Functions placed in RAM (required for flashing) - * - * Align to 8 bytes as that's what the ARM likes text - * segment alignments to be, and if we don't, then - * we end up with a mismatch between the location in - * ROM and the desired location in RAM. I don't - * entirely understand this, but at least this appears - * to work... - */ - - .textram BLOCK(8): { - __data_start__ = .; - __text_ram_start__ = .; - *(.ramtext) - __text_ram_end = .; - } >ram AT>rom - - /* Data -- relocated to RAM, but written to ROM - */ - .data BLOCK(8): { - *(.data) /* initialized data */ - . = ALIGN(8); - __data_end__ = .; - } >ram AT>rom - - .bss : { - __bss_start__ = .; - *(.bss) - *(COMMON) - . = ALIGN(4); - __bss_end__ = .; - } >ram - - PROVIDE(end = .); - - PROVIDE(__stack__ = ORIGIN(stack) + LENGTH(stack)); -} - -ENTRY(start); diff --git a/src/lpc/Makefile-lpc.defs b/src/lpc/Makefile-lpc.defs index c4521620..edeedaf0 100644 --- a/src/lpc/Makefile-lpc.defs +++ b/src/lpc/Makefile-lpc.defs @@ -29,15 +29,16 @@ CC=$(ARM_CC) WARN_FLAGS=-Wall -Wextra -Werror -Wcast-align AO_CFLAGS=-I. -I$(TOPDIR)/lpc -I$(TOPDIR)/kernel -I$(TOPDIR)/drivers \ + -DNEWLIB_INTEGER_PRINTF_SCANF \ -I$(TOPDIR)/product -I$(TOPDIR) -I$(TOPDIR)/math -I$(TOPDIR) \ - $(PDCLIB_INCLUDES) + -isystem $(NEWLIB_NANO)/arm-none-eabi/include LPC_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m0 -mthumb\ -ffreestanding -nostdlib $(AO_CFLAGS) $(WARN_FLAGS) NICKLE=nickle -LIBS=$(PDCLIB_LIBS_M0) -lgcc +LIBS=-L$(NEWLIB_NANO)/arm-none-eabi/lib/thumb/v6-m -lc -lm -lgcc V=0 # The user has explicitly enabled quiet compilation. diff --git a/src/lpc/ao_arch.h b/src/lpc/ao_arch.h index da21dc9d..f1df14eb 100644 --- a/src/lpc/ao_arch.h +++ b/src/lpc/ao_arch.h @@ -59,14 +59,6 @@ #define ao_arch_interrupt(n) /* nothing */ -#undef putchar -#undef getchar -#define putchar(c) ao_putchar(c) -#define getchar ao_getchar - -extern void putchar(char c); -extern char getchar(void); - /* * ao_romconfig.c */ diff --git a/src/math/ef_acos.c b/src/math/ef_acos.c deleted file mode 100644 index f73f97de..00000000 --- a/src/math/ef_acos.c +++ /dev/null @@ -1,84 +0,0 @@ -/* ef_acos.c -- float version of e_acos.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "fdlibm.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -one = 1.0000000000e+00, /* 0x3F800000 */ -pi = 3.1415925026e+00, /* 0x40490fda */ -pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */ -pio2_lo = 7.5497894159e-08, /* 0x33a22168 */ -pS0 = 1.6666667163e-01, /* 0x3e2aaaab */ -pS1 = -3.2556581497e-01, /* 0xbea6b090 */ -pS2 = 2.0121252537e-01, /* 0x3e4e0aa8 */ -pS3 = -4.0055535734e-02, /* 0xbd241146 */ -pS4 = 7.9153501429e-04, /* 0x3a4f7f04 */ -pS5 = 3.4793309169e-05, /* 0x3811ef08 */ -qS1 = -2.4033949375e+00, /* 0xc019d139 */ -qS2 = 2.0209457874e+00, /* 0x4001572d */ -qS3 = -6.8828397989e-01, /* 0xbf303361 */ -qS4 = 7.7038154006e-02; /* 0x3d9dc62e */ - -#ifdef __STDC__ - float __ieee754_acosf(float x) -#else - float __ieee754_acosf(x) - float x; -#endif -{ - float z,p,q,r,w,s,c,df; - __int32_t hx,ix; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix==0x3f800000) { /* |x|==1 */ - if(hx>0) return 0.0; /* acos(1) = 0 */ - else return pi+(float)2.0*pio2_lo; /* acos(-1)= pi */ - } else if(ix>0x3f800000) { /* |x| >= 1 */ - return (x-x)/(x-x); /* acos(|x|>1) is NaN */ - } - if(ix<0x3f000000) { /* |x| < 0.5 */ - if(ix<=0x23000000) return pio2_hi+pio2_lo;/*if|x|<2**-57*/ - z = x*x; - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - r = p/q; - return pio2_hi - (x - (pio2_lo-x*r)); - } else if (hx<0) { /* x < -0.5 */ - z = (one+x)*(float)0.5; - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - s = __ieee754_sqrtf(z); - r = p/q; - w = r*s-pio2_lo; - return pi - (float)2.0*(s+w); - } else { /* x > 0.5 */ - __int32_t idf; - z = (one-x)*(float)0.5; - s = __ieee754_sqrtf(z); - df = s; - GET_FLOAT_WORD(idf,df); - SET_FLOAT_WORD(df,idf&0xfffff000); - c = (z-df*df)/(s+df); - p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); - q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - r = p/q; - w = r*s+c; - return (float)2.0*(df+w); - } -} diff --git a/src/math/ef_log.c b/src/math/ef_log.c deleted file mode 100644 index 619fe909..00000000 --- a/src/math/ef_log.c +++ /dev/null @@ -1,92 +0,0 @@ -/* ef_log.c -- float version of e_log.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "fdlibm.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -ln2_hi = 6.9313812256e-01, /* 0x3f317180 */ -ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */ -two25 = 3.355443200e+07, /* 0x4c000000 */ -Lg1 = 6.6666668653e-01, /* 3F2AAAAB */ -Lg2 = 4.0000000596e-01, /* 3ECCCCCD */ -Lg3 = 2.8571429849e-01, /* 3E924925 */ -Lg4 = 2.2222198546e-01, /* 3E638E29 */ -Lg5 = 1.8183572590e-01, /* 3E3A3325 */ -Lg6 = 1.5313838422e-01, /* 3E1CD04F */ -Lg7 = 1.4798198640e-01; /* 3E178897 */ - -#ifdef __STDC__ -static const float zero = 0.0; -#else -static float zero = 0.0; -#endif - -#ifdef __STDC__ - float __ieee754_logf(float x) -#else - float __ieee754_logf(x) - float x; -#endif -{ - float hfsq,f,s,z,R,w,t1,t2,dk; - __int32_t k,ix,i,j; - - GET_FLOAT_WORD(ix,x); - - k=0; - if (FLT_UWORD_IS_ZERO(ix&0x7fffffff)) - return -two25/zero; /* log(+-0)=-inf */ - if (ix<0) return (x-x)/zero; /* log(-#) = NaN */ - if (!FLT_UWORD_IS_FINITE(ix)) return x+x; - if (FLT_UWORD_IS_SUBNORMAL(ix)) { - k -= 25; x *= two25; /* subnormal number, scale up x */ - GET_FLOAT_WORD(ix,x); - } - k += (ix>>23)-127; - ix &= 0x007fffff; - i = (ix+(0x95f64<<3))&0x800000; - SET_FLOAT_WORD(x,ix|(i^0x3f800000)); /* normalize x or x/2 */ - k += (i>>23); - f = x-(float)1.0; - if((0x007fffff&(15+ix))<16) { /* |f| < 2**-20 */ - if(f==zero) { if(k==0) return zero; else {dk=(float)k; - return dk*ln2_hi+dk*ln2_lo;}} - R = f*f*((float)0.5-(float)0.33333333333333333*f); - if(k==0) return f-R; else {dk=(float)k; - return dk*ln2_hi-((R-dk*ln2_lo)-f);} - } - s = f/((float)2.0+f); - dk = (float)k; - z = s*s; - i = ix-(0x6147a<<3); - w = z*z; - j = (0x6b851<<3)-ix; - t1= w*(Lg2+w*(Lg4+w*Lg6)); - t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); - i |= j; - R = t2+t1; - if(i>0) { - hfsq=(float)0.5*f*f; - if(k==0) return f-(hfsq-s*(hfsq+R)); else - return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); - } else { - if(k==0) return f-s*(f-R); else - return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); - } -} diff --git a/src/math/ef_rem_pio2.c b/src/math/ef_rem_pio2.c deleted file mode 100644 index 3e58f809..00000000 --- a/src/math/ef_rem_pio2.c +++ /dev/null @@ -1,193 +0,0 @@ -/* ef_rem_pio2.c -- float version of e_rem_pio2.c - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - * - */ - -/* __ieee754_rem_pio2f(x,y) - * - * return the remainder of x rem pi/2 in y[0]+y[1] - * use __kernel_rem_pio2f() - */ - -#include "fdlibm.h" - -/* - * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi - */ -#ifdef __STDC__ -static const __int32_t two_over_pi[] = { -#else -static __int32_t two_over_pi[] = { -#endif -0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC, -0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62, -0x95, 0x99, 0x3C, 0x43, 0x90, 0x41, 0xFE, 0x51, 0x63, -0xAB, 0xDE, 0xBB, 0xC5, 0x61, 0xB7, 0x24, 0x6E, 0x3A, -0x42, 0x4D, 0xD2, 0xE0, 0x06, 0x49, 0x2E, 0xEA, 0x09, -0xD1, 0x92, 0x1C, 0xFE, 0x1D, 0xEB, 0x1C, 0xB1, 0x29, -0xA7, 0x3E, 0xE8, 0x82, 0x35, 0xF5, 0x2E, 0xBB, 0x44, -0x84, 0xE9, 0x9C, 0x70, 0x26, 0xB4, 0x5F, 0x7E, 0x41, -0x39, 0x91, 0xD6, 0x39, 0x83, 0x53, 0x39, 0xF4, 0x9C, -0x84, 0x5F, 0x8B, 0xBD, 0xF9, 0x28, 0x3B, 0x1F, 0xF8, -0x97, 0xFF, 0xDE, 0x05, 0x98, 0x0F, 0xEF, 0x2F, 0x11, -0x8B, 0x5A, 0x0A, 0x6D, 0x1F, 0x6D, 0x36, 0x7E, 0xCF, -0x27, 0xCB, 0x09, 0xB7, 0x4F, 0x46, 0x3F, 0x66, 0x9E, -0x5F, 0xEA, 0x2D, 0x75, 0x27, 0xBA, 0xC7, 0xEB, 0xE5, -0xF1, 0x7B, 0x3D, 0x07, 0x39, 0xF7, 0x8A, 0x52, 0x92, -0xEA, 0x6B, 0xFB, 0x5F, 0xB1, 0x1F, 0x8D, 0x5D, 0x08, -0x56, 0x03, 0x30, 0x46, 0xFC, 0x7B, 0x6B, 0xAB, 0xF0, -0xCF, 0xBC, 0x20, 0x9A, 0xF4, 0x36, 0x1D, 0xA9, 0xE3, -0x91, 0x61, 0x5E, 0xE6, 0x1B, 0x08, 0x65, 0x99, 0x85, -0x5F, 0x14, 0xA0, 0x68, 0x40, 0x8D, 0xFF, 0xD8, 0x80, -0x4D, 0x73, 0x27, 0x31, 0x06, 0x06, 0x15, 0x56, 0xCA, -0x73, 0xA8, 0xC9, 0x60, 0xE2, 0x7B, 0xC0, 0x8C, 0x6B, -}; - -/* This array is like the one in e_rem_pio2.c, but the numbers are - single precision and the last 8 bits are forced to 0. */ -#ifdef __STDC__ -static const __int32_t npio2_hw[] = { -#else -static __int32_t npio2_hw[] = { -#endif -0x3fc90f00, 0x40490f00, 0x4096cb00, 0x40c90f00, 0x40fb5300, 0x4116cb00, -0x412fed00, 0x41490f00, 0x41623100, 0x417b5300, 0x418a3a00, 0x4196cb00, -0x41a35c00, 0x41afed00, 0x41bc7e00, 0x41c90f00, 0x41d5a000, 0x41e23100, -0x41eec200, 0x41fb5300, 0x4203f200, 0x420a3a00, 0x42108300, 0x4216cb00, -0x421d1400, 0x42235c00, 0x4229a500, 0x422fed00, 0x42363600, 0x423c7e00, -0x4242c700, 0x42490f00 -}; - -/* - * invpio2: 24 bits of 2/pi - * pio2_1: first 17 bit of pi/2 - * pio2_1t: pi/2 - pio2_1 - * pio2_2: second 17 bit of pi/2 - * pio2_2t: pi/2 - (pio2_1+pio2_2) - * pio2_3: third 17 bit of pi/2 - * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) - */ - -#ifdef __STDC__ -static const float -#else -static float -#endif -zero = 0.0000000000e+00, /* 0x00000000 */ -half = 5.0000000000e-01, /* 0x3f000000 */ -two8 = 2.5600000000e+02, /* 0x43800000 */ -invpio2 = 6.3661980629e-01, /* 0x3f22f984 */ -pio2_1 = 1.5707855225e+00, /* 0x3fc90f80 */ -pio2_1t = 1.0804334124e-05, /* 0x37354443 */ -pio2_2 = 1.0804273188e-05, /* 0x37354400 */ -pio2_2t = 6.0770999344e-11, /* 0x2e85a308 */ -pio2_3 = 6.0770943833e-11, /* 0x2e85a300 */ -pio2_3t = 6.1232342629e-17; /* 0x248d3132 */ - -#ifdef __STDC__ - __int32_t __ieee754_rem_pio2f(float x, float *y) -#else - __int32_t __ieee754_rem_pio2f(x,y) - float x,y[]; -#endif -{ - float z,w,t,r,fn; - float tx[3]; - __int32_t i,j,n,ix,hx; - int e0,nx; - - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if(ix<=0x3f490fd8) /* |x| ~<= pi/4 , no need for reduction */ - {y[0] = x; y[1] = 0; return 0;} - if(ix<0x4016cbe4) { /* |x| < 3pi/4, special case with n=+-1 */ - if(hx>0) { - z = x - pio2_1; - if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ - y[0] = z - pio2_1t; - y[1] = (z-y[0])-pio2_1t; - } else { /* near pi/2, use 24+24+24 bit pi */ - z -= pio2_2; - y[0] = z - pio2_2t; - y[1] = (z-y[0])-pio2_2t; - } - return 1; - } else { /* negative x */ - z = x + pio2_1; - if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ - y[0] = z + pio2_1t; - y[1] = (z-y[0])+pio2_1t; - } else { /* near pi/2, use 24+24+24 bit pi */ - z += pio2_2; - y[0] = z + pio2_2t; - y[1] = (z-y[0])+pio2_2t; - } - return -1; - } - } - if(ix<=0x43490f80) { /* |x| ~<= 2^7*(pi/2), medium size */ - t = fabsf(x); - n = (__int32_t) (t*invpio2+half); - fn = (float)n; - r = t-fn*pio2_1; - w = fn*pio2_1t; /* 1st round good to 40 bit */ - if(n<32&&(ix&(__int32_t)0xffffff00)!=npio2_hw[n-1]) { - y[0] = r-w; /* quick check no cancellation */ - } else { - __uint32_t high; - j = ix>>23; - y[0] = r-w; - GET_FLOAT_WORD(high,y[0]); - i = j-((high>>23)&0xff); - if(i>8) { /* 2nd iteration needed, good to 57 */ - t = r; - w = fn*pio2_2; - r = t-w; - w = fn*pio2_2t-((t-r)-w); - y[0] = r-w; - GET_FLOAT_WORD(high,y[0]); - i = j-((high>>23)&0xff); - if(i>25) { /* 3rd iteration need, 74 bits acc */ - t = r; /* will cover all possible cases */ - w = fn*pio2_3; - r = t-w; - w = fn*pio2_3t-((t-r)-w); - y[0] = r-w; - } - } - } - y[1] = (r-y[0])-w; - if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} - else return n; - } - /* - * all other (large) arguments - */ - if(!FLT_UWORD_IS_FINITE(ix)) { - y[0]=y[1]=x-x; return 0; - } - /* set z = scalbn(|x|,ilogb(x)-7) */ - e0 = (int)((ix>>23)-134); /* e0 = ilogb(z)-7; */ - SET_FLOAT_WORD(z, ix - ((__int32_t)e0<<23)); - for(i=0;i<2;i++) { - tx[i] = (float)((__int32_t)(z)); - z = (z-tx[i])*two8; - } - tx[2] = z; - nx = 3; - while(tx[nx-1]==zero) nx--; /* skip zero term */ - n = __kernel_rem_pio2f(tx,y,e0,nx,2,two_over_pi); - if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} - return n; -} diff --git a/src/math/ef_sqrt.c b/src/math/ef_sqrt.c deleted file mode 100644 index 80e7f360..00000000 --- a/src/math/ef_sqrt.c +++ /dev/null @@ -1,89 +0,0 @@ -/* ef_sqrtf.c -- float version of e_sqrt.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "fdlibm.h" - -#ifdef __STDC__ -static const float one = 1.0, tiny=1.0e-30; -#else -static float one = 1.0, tiny=1.0e-30; -#endif - -#ifdef __STDC__ - float __ieee754_sqrtf(float x) -#else - float __ieee754_sqrtf(x) - float x; -#endif -{ - float z; - __uint32_t r,hx; - __int32_t ix,s,q,m,t,i; - - GET_FLOAT_WORD(ix,x); - hx = ix&0x7fffffff; - - /* take care of Inf and NaN */ - if(!FLT_UWORD_IS_FINITE(hx)) - return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf - sqrt(-inf)=sNaN */ - /* take care of zero and -ves */ - if(FLT_UWORD_IS_ZERO(hx)) return x;/* sqrt(+-0) = +-0 */ - if(ix<0) return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ - - /* normalize x */ - m = (ix>>23); - if(FLT_UWORD_IS_SUBNORMAL(hx)) { /* subnormal x */ - for(i=0;(ix&0x00800000L)==0;i++) ix<<=1; - m -= i-1; - } - m -= 127; /* unbias exponent */ - ix = (ix&0x007fffffL)|0x00800000L; - if(m&1) /* odd m, double x to make it even */ - ix += ix; - m >>= 1; /* m = [m/2] */ - - /* generate sqrt(x) bit by bit */ - ix += ix; - q = s = 0; /* q = sqrt(x) */ - r = 0x01000000L; /* r = moving bit from right to left */ - - while(r!=0) { - t = s+r; - if(t<=ix) { - s = t+r; - ix -= t; - q += r; - } - ix += ix; - r>>=1; - } - - /* use floating add to find out rounding direction */ - if(ix!=0) { - z = one-tiny; /* trigger inexact flag */ - if (z>=one) { - z = one+tiny; - if (z>one) - q += 2; - else - q += (q&1); - } - } - ix = (q>>1)+0x3f000000L; - ix += (m <<23); - SET_FLOAT_WORD(z,ix); - return z; -} diff --git a/src/math/fdlibm.h b/src/math/fdlibm.h deleted file mode 100644 index ee9fcb22..00000000 --- a/src/math/fdlibm.h +++ /dev/null @@ -1,414 +0,0 @@ - -/* @(#)fdlibm.h 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* AltOS local */ -#include -#include -#define __int32_t int32_t -#define __uint32_t uint32_t - -#define __ieee754_acosf acosf -#define __ieee754_sqrtf sqrtf -#define __ieee754_logf logf - -/* REDHAT LOCAL: Include files. */ -#include -/* #include */ -#include - -/* REDHAT LOCAL: Default to XOPEN_MODE. */ -#define _XOPEN_MODE - -/* Most routines need to check whether a float is finite, infinite, or not a - number, and many need to know whether the result of an operation will - overflow. These conditions depend on whether the largest exponent is - used for NaNs & infinities, or whether it's used for finite numbers. The - macros below wrap up that kind of information: - - FLT_UWORD_IS_FINITE(X) - True if a positive float with bitmask X is finite. - - FLT_UWORD_IS_NAN(X) - True if a positive float with bitmask X is not a number. - - FLT_UWORD_IS_INFINITE(X) - True if a positive float with bitmask X is +infinity. - - FLT_UWORD_MAX - The bitmask of FLT_MAX. - - FLT_UWORD_HALF_MAX - The bitmask of FLT_MAX/2. - - FLT_UWORD_EXP_MAX - The bitmask of the largest finite exponent (129 if the largest - exponent is used for finite numbers, 128 otherwise). - - FLT_UWORD_LOG_MAX - The bitmask of log(FLT_MAX), rounded down. This value is the largest - input that can be passed to exp() without producing overflow. - - FLT_UWORD_LOG_2MAX - The bitmask of log(2*FLT_MAX), rounded down. This value is the - largest input than can be passed to cosh() without producing - overflow. - - FLT_LARGEST_EXP - The largest biased exponent that can be used for finite numbers - (255 if the largest exponent is used for finite numbers, 254 - otherwise) */ - -#ifdef _FLT_LARGEST_EXPONENT_IS_NORMAL -#define FLT_UWORD_IS_FINITE(x) 1 -#define FLT_UWORD_IS_NAN(x) 0 -#define FLT_UWORD_IS_INFINITE(x) 0 -#define FLT_UWORD_MAX 0x7fffffff -#define FLT_UWORD_EXP_MAX 0x43010000 -#define FLT_UWORD_LOG_MAX 0x42b2d4fc -#define FLT_UWORD_LOG_2MAX 0x42b437e0 -#define HUGE ((float)0X1.FFFFFEP128) -#else -#define FLT_UWORD_IS_FINITE(x) ((x)<0x7f800000L) -#define FLT_UWORD_IS_NAN(x) ((x)>0x7f800000L) -#define FLT_UWORD_IS_INFINITE(x) ((x)==0x7f800000L) -#define FLT_UWORD_MAX 0x7f7fffffL -#define FLT_UWORD_EXP_MAX 0x43000000 -#define FLT_UWORD_LOG_MAX 0x42b17217 -#define FLT_UWORD_LOG_2MAX 0x42b2d4fc -#define HUGE ((float)3.40282346638528860e+38) -#endif -#define FLT_UWORD_HALF_MAX (FLT_UWORD_MAX-(1L<<23)) -#define FLT_LARGEST_EXP (FLT_UWORD_MAX>>23) - -/* Many routines check for zero and subnormal numbers. Such things depend - on whether the target supports denormals or not: - - FLT_UWORD_IS_ZERO(X) - True if a positive float with bitmask X is +0. Without denormals, - any float with a zero exponent is a +0 representation. With - denormals, the only +0 representation is a 0 bitmask. - - FLT_UWORD_IS_SUBNORMAL(X) - True if a non-zero positive float with bitmask X is subnormal. - (Routines should check for zeros first.) - - FLT_UWORD_MIN - The bitmask of the smallest float above +0. Call this number - REAL_FLT_MIN... - - FLT_UWORD_EXP_MIN - The bitmask of the float representation of REAL_FLT_MIN's exponent. - - FLT_UWORD_LOG_MIN - The bitmask of |log(REAL_FLT_MIN)|, rounding down. - - FLT_SMALLEST_EXP - REAL_FLT_MIN's exponent - EXP_BIAS (1 if denormals are not supported, - -22 if they are). -*/ - -#ifdef _FLT_NO_DENORMALS -#define FLT_UWORD_IS_ZERO(x) ((x)<0x00800000L) -#define FLT_UWORD_IS_SUBNORMAL(x) 0 -#define FLT_UWORD_MIN 0x00800000 -#define FLT_UWORD_EXP_MIN 0x42fc0000 -#define FLT_UWORD_LOG_MIN 0x42aeac50 -#define FLT_SMALLEST_EXP 1 -#else -#define FLT_UWORD_IS_ZERO(x) ((x)==0) -#define FLT_UWORD_IS_SUBNORMAL(x) ((x)<0x00800000L) -#define FLT_UWORD_MIN 0x00000001 -#define FLT_UWORD_EXP_MIN 0x43160000 -#define FLT_UWORD_LOG_MIN 0x42cff1b5 -#define FLT_SMALLEST_EXP -22 -#endif - -#ifdef __STDC__ -#undef __P -#define __P(p) p -#else -#define __P(p) () -#endif - -/* - * set X_TLOSS = pi*2**52, which is possibly defined in - * (one may replace the following line by "#include ") - */ - -#define X_TLOSS 1.41484755040568800000e+16 - -/* Functions that are not documented, and are not in . */ - -#ifdef _SCALB_INT -extern double scalb __P((double, int)); -#else -extern double scalb __P((double, double)); -#endif -extern double significand __P((double)); - -/* ieee style elementary functions */ -extern double __ieee754_sqrt __P((double)); -extern double __ieee754_acos __P((double)); -extern double __ieee754_acosh __P((double)); -extern double __ieee754_log __P((double)); -extern double __ieee754_atanh __P((double)); -extern double __ieee754_asin __P((double)); -extern double __ieee754_atan2 __P((double,double)); -extern double __ieee754_exp __P((double)); -extern double __ieee754_cosh __P((double)); -extern double __ieee754_fmod __P((double,double)); -extern double __ieee754_pow __P((double,double)); -extern double __ieee754_lgamma_r __P((double,int *)); -extern double __ieee754_gamma_r __P((double,int *)); -extern double __ieee754_log10 __P((double)); -extern double __ieee754_sinh __P((double)); -extern double __ieee754_hypot __P((double,double)); -extern double __ieee754_j0 __P((double)); -extern double __ieee754_j1 __P((double)); -extern double __ieee754_y0 __P((double)); -extern double __ieee754_y1 __P((double)); -extern double __ieee754_jn __P((int,double)); -extern double __ieee754_yn __P((int,double)); -extern double __ieee754_remainder __P((double,double)); -extern __int32_t __ieee754_rem_pio2 __P((double,double*)); -#ifdef _SCALB_INT -extern double __ieee754_scalb __P((double,int)); -#else -extern double __ieee754_scalb __P((double,double)); -#endif - -/* fdlibm kernel function */ -extern double __kernel_standard __P((double,double,int)); -extern double __kernel_sin __P((double,double,int)); -extern double __kernel_cos __P((double,double)); -extern double __kernel_tan __P((double,double,int)); -extern int __kernel_rem_pio2 __P((double*,double*,int,int,int,const __int32_t*)); - -/* Undocumented float functions. */ -#ifdef _SCALB_INT -extern float scalbf __P((float, int)); -#else -extern float scalbf __P((float, float)); -#endif -extern float significandf __P((float)); - -/* ieee style elementary float functions */ -extern float __ieee754_sqrtf __P((float)); -extern float __ieee754_acosf __P((float)); -extern float __ieee754_acoshf __P((float)); -extern float __ieee754_logf __P((float)); -extern float __ieee754_atanhf __P((float)); -extern float __ieee754_asinf __P((float)); -extern float __ieee754_atan2f __P((float,float)); -extern float __ieee754_expf __P((float)); -extern float __ieee754_coshf __P((float)); -extern float __ieee754_fmodf __P((float,float)); -extern float __ieee754_powf __P((float,float)); -extern float __ieee754_lgammaf_r __P((float,int *)); -extern float __ieee754_gammaf_r __P((float,int *)); -extern float __ieee754_log10f __P((float)); -extern float __ieee754_sinhf __P((float)); -extern float __ieee754_hypotf __P((float,float)); -extern float __ieee754_j0f __P((float)); -extern float __ieee754_j1f __P((float)); -extern float __ieee754_y0f __P((float)); -extern float __ieee754_y1f __P((float)); -extern float __ieee754_jnf __P((int,float)); -extern float __ieee754_ynf __P((int,float)); -extern float __ieee754_remainderf __P((float,float)); -extern __int32_t __ieee754_rem_pio2f __P((float,float*)); -#ifdef _SCALB_INT -extern float __ieee754_scalbf __P((float,int)); -#else -extern float __ieee754_scalbf __P((float,float)); -#endif - -/* float versions of fdlibm kernel functions */ -extern float __kernel_sinf __P((float,float,int)); -extern float __kernel_cosf __P((float,float)); -extern float __kernel_tanf __P((float,float,int)); -extern int __kernel_rem_pio2f __P((float*,float*,int,int,int,const __int32_t*)); - -/* The original code used statements like - n0 = ((*(int*)&one)>>29)^1; * index of high word * - ix0 = *(n0+(int*)&x); * high word of x * - ix1 = *((1-n0)+(int*)&x); * low word of x * - to dig two 32 bit words out of the 64 bit IEEE floating point - value. That is non-ANSI, and, moreover, the gcc instruction - scheduler gets it wrong. We instead use the following macros. - Unlike the original code, we determine the endianness at compile - time, not at run time; I don't see much benefit to selecting - endianness at run time. */ - -#ifndef __IEEE_BIG_ENDIAN -#ifndef __IEEE_LITTLE_ENDIAN - #error Must define endianness -#endif -#endif - -/* A union which permits us to convert between a double and two 32 bit - ints. */ - -#ifdef __IEEE_BIG_ENDIAN - -typedef union -{ - double value; - struct - { - __uint32_t msw; - __uint32_t lsw; - } parts; -} ieee_double_shape_type; - -#endif - -#ifdef __IEEE_LITTLE_ENDIAN - -typedef union -{ - double value; - struct - { - __uint32_t lsw; - __uint32_t msw; - } parts; -} ieee_double_shape_type; - -#endif - -/* Get two 32 bit ints from a double. */ - -#define EXTRACT_WORDS(ix0,ix1,d) \ -do { \ - ieee_double_shape_type ew_u; \ - ew_u.value = (d); \ - (ix0) = ew_u.parts.msw; \ - (ix1) = ew_u.parts.lsw; \ -} while (0) - -/* Get the more significant 32 bit int from a double. */ - -#define GET_HIGH_WORD(i,d) \ -do { \ - ieee_double_shape_type gh_u; \ - gh_u.value = (d); \ - (i) = gh_u.parts.msw; \ -} while (0) - -/* Get the less significant 32 bit int from a double. */ - -#define GET_LOW_WORD(i,d) \ -do { \ - ieee_double_shape_type gl_u; \ - gl_u.value = (d); \ - (i) = gl_u.parts.lsw; \ -} while (0) - -/* Set a double from two 32 bit ints. */ - -#define INSERT_WORDS(d,ix0,ix1) \ -do { \ - ieee_double_shape_type iw_u; \ - iw_u.parts.msw = (ix0); \ - iw_u.parts.lsw = (ix1); \ - (d) = iw_u.value; \ -} while (0) - -/* Set the more significant 32 bits of a double from an int. */ - -#define SET_HIGH_WORD(d,v) \ -do { \ - ieee_double_shape_type sh_u; \ - sh_u.value = (d); \ - sh_u.parts.msw = (v); \ - (d) = sh_u.value; \ -} while (0) - -/* Set the less significant 32 bits of a double from an int. */ - -#define SET_LOW_WORD(d,v) \ -do { \ - ieee_double_shape_type sl_u; \ - sl_u.value = (d); \ - sl_u.parts.lsw = (v); \ - (d) = sl_u.value; \ -} while (0) - -/* A union which permits us to convert between a float and a 32 bit - int. */ - -typedef union -{ - float value; - __uint32_t word; -} ieee_float_shape_type; - -/* Get a 32 bit int from a float. */ - -#define GET_FLOAT_WORD(i,d) \ -do { \ - ieee_float_shape_type gf_u; \ - gf_u.value = (d); \ - (i) = gf_u.word; \ -} while (0) - -/* Set a float from a 32 bit int. */ - -#define SET_FLOAT_WORD(d,i) \ -do { \ - ieee_float_shape_type sf_u; \ - sf_u.word = (i); \ - (d) = sf_u.value; \ -} while (0) - -/* Macros to avoid undefined behaviour that can arise if the amount - of a shift is exactly equal to the size of the shifted operand. */ - -#define SAFE_LEFT_SHIFT(op,amt) \ - (((amt) < 8 * sizeof(op)) ? ((op) << (amt)) : 0) - -#define SAFE_RIGHT_SHIFT(op,amt) \ - (((amt) < 8 * sizeof(op)) ? ((op) >> (amt)) : 0) - -#ifdef _COMPLEX_H - -/* - * Quoting from ISO/IEC 9899:TC2: - * - * 6.2.5.13 Types - * Each complex type has the same representation and alignment requirements as - * an array type containing exactly two elements of the corresponding real type; - * the first element is equal to the real part, and the second element to the - * imaginary part, of the complex number. - */ -typedef union { - float complex z; - float parts[2]; -} float_complex; - -typedef union { - double complex z; - double parts[2]; -} double_complex; - -typedef union { - long double complex z; - long double parts[2]; -} long_double_complex; - -#define REAL_PART(z) ((z).parts[0]) -#define IMAG_PART(z) ((z).parts[1]) - -#endif /* _COMPLEX_H */ - diff --git a/src/math/ieeefp.h b/src/math/ieeefp.h deleted file mode 100644 index 0b06fb78..00000000 --- a/src/math/ieeefp.h +++ /dev/null @@ -1,256 +0,0 @@ -#ifndef _IEEE_FP_H_ -#define _IEEE_FP_H_ - -#include "_ansi.h" - -#include - -_BEGIN_STD_C - -/* FIXME FIXME FIXME: - Neither of __ieee_{float,double}_shape_tape seem to be used anywhere - except in libm/test. If that is the case, please delete these from here. - If that is not the case, please insert documentation here describing why - they're needed. */ - -#ifdef __IEEE_BIG_ENDIAN - -typedef union -{ - double value; - struct - { - unsigned int sign : 1; - unsigned int exponent: 11; - unsigned int fraction0:4; - unsigned int fraction1:16; - unsigned int fraction2:16; - unsigned int fraction3:16; - - } number; - struct - { - unsigned int sign : 1; - unsigned int exponent: 11; - unsigned int quiet:1; - unsigned int function0:3; - unsigned int function1:16; - unsigned int function2:16; - unsigned int function3:16; - } nan; - struct - { - unsigned long msw; - unsigned long lsw; - } parts; - long aslong[2]; -} __ieee_double_shape_type; - -#endif - -#ifdef __IEEE_LITTLE_ENDIAN - -typedef union -{ - double value; - struct - { -#ifdef __SMALL_BITFIELDS - unsigned int fraction3:16; - unsigned int fraction2:16; - unsigned int fraction1:16; - unsigned int fraction0: 4; -#else - unsigned int fraction1:32; - unsigned int fraction0:20; -#endif - unsigned int exponent :11; - unsigned int sign : 1; - } number; - struct - { -#ifdef __SMALL_BITFIELDS - unsigned int function3:16; - unsigned int function2:16; - unsigned int function1:16; - unsigned int function0:3; -#else - unsigned int function1:32; - unsigned int function0:19; -#endif - unsigned int quiet:1; - unsigned int exponent: 11; - unsigned int sign : 1; - } nan; - struct - { - unsigned long lsw; - unsigned long msw; - } parts; - - long aslong[2]; - -} __ieee_double_shape_type; - -#endif - -#ifdef __IEEE_BIG_ENDIAN - -typedef union -{ - float value; - struct - { - unsigned int sign : 1; - unsigned int exponent: 8; - unsigned int fraction0: 7; - unsigned int fraction1: 16; - } number; - struct - { - unsigned int sign:1; - unsigned int exponent:8; - unsigned int quiet:1; - unsigned int function0:6; - unsigned int function1:16; - } nan; - long p1; - -} __ieee_float_shape_type; - -#endif - -#ifdef __IEEE_LITTLE_ENDIAN - -typedef union -{ - float value; - struct - { - unsigned int fraction0: 7; - unsigned int fraction1: 16; - unsigned int exponent: 8; - unsigned int sign : 1; - } number; - struct - { - unsigned int function1:16; - unsigned int function0:6; - unsigned int quiet:1; - unsigned int exponent:8; - unsigned int sign:1; - } nan; - long p1; - -} __ieee_float_shape_type; - -#endif - - - - - -/* FLOATING ROUNDING */ - -typedef int fp_rnd; -#define FP_RN 0 /* Round to nearest */ -#define FP_RM 1 /* Round down */ -#define FP_RP 2 /* Round up */ -#define FP_RZ 3 /* Round to zero (trunate) */ - -fp_rnd _EXFUN(fpgetround,(void)); -fp_rnd _EXFUN(fpsetround, (fp_rnd)); - -/* EXCEPTIONS */ - -typedef int fp_except; -#define FP_X_INV 0x10 /* Invalid operation */ -#define FP_X_DX 0x80 /* Divide by zero */ -#define FP_X_OFL 0x04 /* Overflow exception */ -#define FP_X_UFL 0x02 /* Underflow exception */ -#define FP_X_IMP 0x01 /* imprecise exception */ - -fp_except _EXFUN(fpgetmask,(void)); -fp_except _EXFUN(fpsetmask,(fp_except)); -fp_except _EXFUN(fpgetsticky,(void)); -fp_except _EXFUN(fpsetsticky, (fp_except)); - -/* INTEGER ROUNDING */ - -typedef int fp_rdi; -#define FP_RDI_TOZ 0 /* Round to Zero */ -#define FP_RDI_RD 1 /* Follow float mode */ - -fp_rdi _EXFUN(fpgetroundtoi,(void)); -fp_rdi _EXFUN(fpsetroundtoi,(fp_rdi)); - -#undef isnan -#undef isinf - -int _EXFUN(isnan, (double)); -int _EXFUN(isinf, (double)); -int _EXFUN(finite, (double)); - - - -int _EXFUN(isnanf, (float)); -int _EXFUN(isinff, (float)); -int _EXFUN(finitef, (float)); - -#define __IEEE_DBL_EXPBIAS 1023 -#define __IEEE_FLT_EXPBIAS 127 - -#define __IEEE_DBL_EXPLEN 11 -#define __IEEE_FLT_EXPLEN 8 - - -#define __IEEE_DBL_FRACLEN (64 - (__IEEE_DBL_EXPLEN + 1)) -#define __IEEE_FLT_FRACLEN (32 - (__IEEE_FLT_EXPLEN + 1)) - -#define __IEEE_DBL_MAXPOWTWO ((double)(1L << 32 - 2) * (1L << (32-11) - 32 + 1)) -#define __IEEE_FLT_MAXPOWTWO ((float)(1L << (32-8) - 1)) - -#define __IEEE_DBL_NAN_EXP 0x7ff -#define __IEEE_FLT_NAN_EXP 0xff - -#ifndef __ieeefp_isnanf -#define __ieeefp_isnanf(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ - ((*(long *)&(x) & 0x007fffffL)!=0000000000L)) -#endif -#define isnanf(x) __ieeefp_isnanf(x) - -#ifndef __ieeefp_isinff -#define __ieeefp_isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ - ((*(long *)&(x) & 0x007fffffL)==0000000000L)) -#endif -#define isinff(x) __ieeefp_isinff(x) - -#ifndef __ieeefp_finitef -#define __ieeefp_finitef(x) (((*(long *)&(x) & 0x7f800000L)!=0x7f800000L)) -#endif -#define finitef(x) __ieeefp_finitef(x) - -#ifdef _DOUBLE_IS_32BITS -#undef __IEEE_DBL_EXPBIAS -#define __IEEE_DBL_EXPBIAS __IEEE_FLT_EXPBIAS - -#undef __IEEE_DBL_EXPLEN -#define __IEEE_DBL_EXPLEN __IEEE_FLT_EXPLEN - -#undef __IEEE_DBL_FRACLEN -#define __IEEE_DBL_FRACLEN __IEEE_FLT_FRACLEN - -#undef __IEEE_DBL_MAXPOWTWO -#define __IEEE_DBL_MAXPOWTWO __IEEE_FLT_MAXPOWTWO - -#undef __IEEE_DBL_NAN_EXP -#define __IEEE_DBL_NAN_EXP __IEEE_FLT_NAN_EXP - -#undef __ieee_double_shape_type -#define __ieee_double_shape_type __ieee_float_shape_type - -#endif /* _DOUBLE_IS_32BITS */ - -_END_STD_C - -#endif /* _IEEE_FP_H_ */ diff --git a/src/math/kf_cos.c b/src/math/kf_cos.c deleted file mode 100644 index 4f71af23..00000000 --- a/src/math/kf_cos.c +++ /dev/null @@ -1,59 +0,0 @@ -/* kf_cos.c -- float version of k_cos.c - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "fdlibm.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -one = 1.0000000000e+00, /* 0x3f800000 */ -C1 = 4.1666667908e-02, /* 0x3d2aaaab */ -C2 = -1.3888889225e-03, /* 0xbab60b61 */ -C3 = 2.4801587642e-05, /* 0x37d00d01 */ -C4 = -2.7557314297e-07, /* 0xb493f27c */ -C5 = 2.0875723372e-09, /* 0x310f74f6 */ -C6 = -1.1359647598e-11; /* 0xad47d74e */ - -#ifdef __STDC__ - float __kernel_cosf(float x, float y) -#else - float __kernel_cosf(x, y) - float x,y; -#endif -{ - float a,hz,z,r,qx; - __int32_t ix; - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; /* ix = |x|'s high word*/ - if(ix<0x32000000) { /* if x < 2**27 */ - if(((int)x)==0) return one; /* generate inexact */ - } - z = x*x; - r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); - if(ix < 0x3e99999a) /* if |x| < 0.3 */ - return one - ((float)0.5*z - (z*r - x*y)); - else { - if(ix > 0x3f480000) { /* x > 0.78125 */ - qx = (float)0.28125; - } else { - SET_FLOAT_WORD(qx,ix-0x01000000); /* x/4 */ - } - hz = (float)0.5*z-qx; - a = one-qx; - return a - (hz - (z*r-x*y)); - } -} diff --git a/src/math/kf_rem_pio2.c b/src/math/kf_rem_pio2.c deleted file mode 100644 index 1573ca9f..00000000 --- a/src/math/kf_rem_pio2.c +++ /dev/null @@ -1,209 +0,0 @@ -/* kf_rem_pio2.c -- float version of k_rem_pio2.c - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "fdlibm.h" - -/* In the float version, the input parameter x contains 8 bit - integers, not 24 bit integers. 113 bit precision is not supported. */ - -#ifdef __STDC__ -static const int init_jk[] = {4,7,9}; /* initial value for jk */ -#else -static int init_jk[] = {4,7,9}; -#endif - -#ifdef __STDC__ -static const float PIo2[] = { -#else -static float PIo2[] = { -#endif - 1.5703125000e+00, /* 0x3fc90000 */ - 4.5776367188e-04, /* 0x39f00000 */ - 2.5987625122e-05, /* 0x37da0000 */ - 7.5437128544e-08, /* 0x33a20000 */ - 6.0026650317e-11, /* 0x2e840000 */ - 7.3896444519e-13, /* 0x2b500000 */ - 5.3845816694e-15, /* 0x27c20000 */ - 5.6378512969e-18, /* 0x22d00000 */ - 8.3009228831e-20, /* 0x1fc40000 */ - 3.2756352257e-22, /* 0x1bc60000 */ - 6.3331015649e-25, /* 0x17440000 */ -}; - -#ifdef __STDC__ -static const float -#else -static float -#endif -zero = 0.0, -one = 1.0, -two8 = 2.5600000000e+02, /* 0x43800000 */ -twon8 = 3.9062500000e-03; /* 0x3b800000 */ - -#ifdef __STDC__ - int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const __int32_t *ipio2) -#else - int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2) - float x[], y[]; int e0,nx,prec; __int32_t ipio2[]; -#endif -{ - __int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; - float z,fw,f[20],fq[20],q[20]; - - /* initialize jk*/ - jk = init_jk[prec]; - jp = jk; - - /* determine jx,jv,q0, note that 3>q0 */ - jx = nx-1; - jv = (e0-3)/8; if(jv<0) jv=0; - q0 = e0-8*(jv+1); - - /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ - j = jv-jx; m = jx+jk; - for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (float) ipio2[j]; - - /* compute q[0],q[1],...q[jk] */ - for (i=0;i<=jk;i++) { - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; - q[i] = fw; - } - - jz = jk; -recompute: - /* distill q[] into iq[] reversingly */ - for(i=0,j=jz,z=q[jz];j>0;i++,j--) { - fw = (float)((__int32_t)(twon8* z)); - iq[i] = (__int32_t)(z-two8*fw); - z = q[j-1]+fw; - } - - /* compute n */ - z = scalbnf(z,(int)q0); /* actual value of z */ - z -= (float)8.0*floorf(z*(float)0.125); /* trim off integer >= 8 */ - n = (__int32_t) z; - z -= (float)n; - ih = 0; - if(q0>0) { /* need iq[jz-1] to determine n */ - i = (iq[jz-1]>>(8-q0)); n += i; - iq[jz-1] -= i<<(8-q0); - ih = iq[jz-1]>>(7-q0); - } - else if(q0==0) ih = iq[jz-1]>>8; - else if(z>=(float)0.5) ih=2; - - if(ih>0) { /* q > 0.5 */ - n += 1; carry = 0; - for(i=0;i0) { /* rare case: chance is 1 in 12 */ - switch(q0) { - case 1: - iq[jz-1] &= 0x7f; break; - case 2: - iq[jz-1] &= 0x3f; break; - } - } - if(ih==2) { - z = one - z; - if(carry!=0) z -= scalbnf(one,(int)q0); - } - } - - /* check if recomputation is needed */ - if(z==zero) { - j = 0; - for (i=jz-1;i>=jk;i--) j |= iq[i]; - if(j==0) { /* need recomputation */ - for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */ - - for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */ - f[jx+i] = (float) ipio2[jv+i]; - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; - q[i] = fw; - } - jz += k; - goto recompute; - } - } - - /* chop off zero terms */ - if(z==(float)0.0) { - jz -= 1; q0 -= 8; - while(iq[jz]==0) { jz--; q0-=8;} - } else { /* break z into 8-bit if necessary */ - z = scalbnf(z,-(int)q0); - if(z>=two8) { - fw = (float)((__int32_t)(twon8*z)); - iq[jz] = (__int32_t)(z-two8*fw); - jz += 1; q0 += 8; - iq[jz] = (__int32_t) fw; - } else iq[jz] = (__int32_t) z ; - } - - /* convert integer "bit" chunk to floating-point value */ - fw = scalbnf(one,(int)q0); - for(i=jz;i>=0;i--) { - q[i] = fw*(float)iq[i]; fw*=twon8; - } - - /* compute PIo2[0,...,jp]*q[jz,...,0] */ - for(i=jz;i>=0;i--) { - for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; - fq[jz-i] = fw; - } - - /* compress fq[] into y[] */ - switch(prec) { - case 0: - fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; - break; - case 1: - case 2: - fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; - fw = fq[0]-fw; - for (i=1;i<=jz;i++) fw += fq[i]; - y[1] = (ih==0)? fw: -fw; - break; - case 3: /* painful */ - for (i=jz;i>0;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (i=jz;i>1;i--) { - fw = fq[i-1]+fq[i]; - fq[i] += fq[i-1]-fw; - fq[i-1] = fw; - } - for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; - if(ih==0) { - y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; - } else { - y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; - } - } - return n&7; -} diff --git a/src/math/kf_sin.c b/src/math/kf_sin.c deleted file mode 100644 index e81fa0bd..00000000 --- a/src/math/kf_sin.c +++ /dev/null @@ -1,49 +0,0 @@ -/* kf_sin.c -- float version of k_sin.c - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "fdlibm.h" - -#ifdef __STDC__ -static const float -#else -static float -#endif -half = 5.0000000000e-01,/* 0x3f000000 */ -S1 = -1.6666667163e-01, /* 0xbe2aaaab */ -S2 = 8.3333337680e-03, /* 0x3c088889 */ -S3 = -1.9841270114e-04, /* 0xb9500d01 */ -S4 = 2.7557314297e-06, /* 0x3638ef1b */ -S5 = -2.5050759689e-08, /* 0xb2d72f34 */ -S6 = 1.5896910177e-10; /* 0x2f2ec9d3 */ - -#ifdef __STDC__ - float __kernel_sinf(float x, float y, int iy) -#else - float __kernel_sinf(x, y, iy) - float x,y; int iy; /* iy=0 if y is zero */ -#endif -{ - float z,r,v; - __int32_t ix; - GET_FLOAT_WORD(ix,x); - ix &= 0x7fffffff; /* high word of x */ - if(ix<0x32000000) /* |x| < 2**-27 */ - {if((int)x==0) return x;} /* generate inexact */ - z = x*x; - v = z*x; - r = S2+z*(S3+z*(S4+z*(S5+z*S6))); - if(iy==0) return x+v*(S1+z*r); - else return x-((z*(half*y-v*r)-y)-v*S1); -} diff --git a/src/math/machine/ieeefp.h b/src/math/machine/ieeefp.h deleted file mode 100644 index fffa3804..00000000 --- a/src/math/machine/ieeefp.h +++ /dev/null @@ -1,382 +0,0 @@ -#ifndef __IEEE_BIG_ENDIAN -#ifndef __IEEE_LITTLE_ENDIAN - -/* This file can define macros to choose variations of the IEEE float - format: - - _FLT_LARGEST_EXPONENT_IS_NORMAL - - Defined if the float format uses the largest exponent for finite - numbers rather than NaN and infinity representations. Such a - format cannot represent NaNs or infinities at all, but it's FLT_MAX - is twice the IEEE value. - - _FLT_NO_DENORMALS - - Defined if the float format does not support IEEE denormals. Every - float with a zero exponent is taken to be a zero representation. - - ??? At the moment, there are no equivalent macros above for doubles and - the macros are not fully supported by --enable-newlib-hw-fp. - - __IEEE_BIG_ENDIAN - - Defined if the float format is big endian. This is mutually exclusive - with __IEEE_LITTLE_ENDIAN. - - __IEEE_LITTLE_ENDIAN - - Defined if the float format is little endian. This is mutually exclusive - with __IEEE_BIG_ENDIAN. - - Note that one of __IEEE_BIG_ENDIAN or __IEEE_LITTLE_ENDIAN must be specified for a - platform or error will occur. - - __IEEE_BYTES_LITTLE_ENDIAN - - This flag is used in conjunction with __IEEE_BIG_ENDIAN to describe a situation - whereby multiple words of an IEEE floating point are in big endian order, but the - words themselves are little endian with respect to the bytes. - - _DOUBLE_IS_32BITS - - This is used on platforms that support double by using the 32-bit IEEE - float type. - - _FLOAT_ARG - - This represents what type a float arg is passed as. It is used when the type is - not promoted to double. - -*/ - -#if (defined(__arm__) || defined(__thumb__)) && !defined(__MAVERICK__) -/* ARM traditionally used big-endian words; and within those words the - byte ordering was big or little endian depending upon the target. - Modern floating-point formats are naturally ordered; in this case - __VFP_FP__ will be defined, even if soft-float. */ -#ifdef __VFP_FP__ -# ifdef __ARMEL__ -# define __IEEE_LITTLE_ENDIAN -# else -# define __IEEE_BIG_ENDIAN -# endif -#else -# define __IEEE_BIG_ENDIAN -# ifdef __ARMEL__ -# define __IEEE_BYTES_LITTLE_ENDIAN -# endif -#endif -#endif - -#ifdef __hppa__ -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __SPU__ -#define __IEEE_BIG_ENDIAN - -#define isfinite(__y) \ - (__extension__ ({int __cy; \ - (sizeof (__y) == sizeof (float)) ? (1) : \ - (__cy = fpclassify(__y)) != FP_INFINITE && __cy != FP_NAN;})) - -#define isinf(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isinfd(__x)) -#define isnan(__x) ((sizeof (__x) == sizeof (float)) ? (0) : __isnand(__x)) - -/* - * Macros for use in ieeefp.h. We can't just define the real ones here - * (like those above) as we have name space issues when this is *not* - * included via generic the ieeefp.h. - */ -#define __ieeefp_isnanf(x) 0 -#define __ieeefp_isinff(x) 0 -#define __ieeefp_finitef(x) 1 -#endif - -#ifdef __sparc__ -#ifdef __LITTLE_ENDIAN_DATA__ -#define __IEEE_LITTLE_ENDIAN -#else -#define __IEEE_BIG_ENDIAN -#endif -#endif - -#if defined(__m68k__) || defined(__mc68000__) -#define __IEEE_BIG_ENDIAN -#endif - -#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__) -#define __IEEE_BIG_ENDIAN -#ifdef __HAVE_SHORT_DOUBLE__ -# define _DOUBLE_IS_32BITS -#endif -#endif - -#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) || defined (__H8500__) || defined (__H8300SX__) -#define __IEEE_BIG_ENDIAN -#define _FLOAT_ARG float -#define _DOUBLE_IS_32BITS -#endif - -#if defined (__xc16x__) || defined (__xc16xL__) || defined (__xc16xS__) -#define __IEEE_LITTLE_ENDIAN -#define _FLOAT_ARG float -#define _DOUBLE_IS_32BITS -#endif - - -#ifdef __sh__ -#ifdef __LITTLE_ENDIAN__ -#define __IEEE_LITTLE_ENDIAN -#else -#define __IEEE_BIG_ENDIAN -#endif -#if defined(__SH2E__) || defined(__SH3E__) || defined(__SH4_SINGLE_ONLY__) || defined(__SH2A_SINGLE_ONLY__) -#define _DOUBLE_IS_32BITS -#endif -#endif - -#ifdef _AM29K -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef _WIN32 -#define __IEEE_LITTLE_ENDIAN -#endif - -#ifdef __i386__ -#define __IEEE_LITTLE_ENDIAN -#endif - -#ifdef __i960__ -#define __IEEE_LITTLE_ENDIAN -#endif - -#ifdef __lm32__ -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __M32R__ -#define __IEEE_BIG_ENDIAN -#endif - -#if defined(_C4x) || defined(_C3x) -#define __IEEE_BIG_ENDIAN -#define _DOUBLE_IS_32BITS -#endif - -#ifdef __TMS320C6X__ -#ifdef _BIG_ENDIAN -#define __IEEE_BIG_ENDIAN -#else -#define __IEEE_LITTLE_ENDIAN -#endif -#endif - -#ifdef __TIC80__ -#define __IEEE_LITTLE_ENDIAN -#endif - -#ifdef __MIPSEL__ -#define __IEEE_LITTLE_ENDIAN -#endif -#ifdef __MIPSEB__ -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __MMIX__ -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __D30V__ -#define __IEEE_BIG_ENDIAN -#endif - -/* necv70 was __IEEE_LITTLE_ENDIAN. */ - -#ifdef __W65__ -#define __IEEE_LITTLE_ENDIAN -#define _DOUBLE_IS_32BITS -#endif - -#if defined(__Z8001__) || defined(__Z8002__) -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __m88k__ -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __mn10300__ -#define __IEEE_LITTLE_ENDIAN -#endif - -#ifdef __mn10200__ -#define __IEEE_LITTLE_ENDIAN -#define _DOUBLE_IS_32BITS -#endif - -#ifdef __v800 -#define __IEEE_LITTLE_ENDIAN -#endif - -#ifdef __v850 -#define __IEEE_LITTLE_ENDIAN -#endif - -#ifdef __D10V__ -#define __IEEE_BIG_ENDIAN -#if __DOUBLE__ == 32 -#define _DOUBLE_IS_32BITS -#endif -#endif - -#ifdef __PPC__ -#if (defined(_BIG_ENDIAN) && _BIG_ENDIAN) || (defined(_AIX) && _AIX) -#define __IEEE_BIG_ENDIAN -#else -#if (defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN) || (defined(__sun__) && __sun__) || (defined(_WIN32) && _WIN32) -#define __IEEE_LITTLE_ENDIAN -#endif -#endif -#endif - -#ifdef __xstormy16__ -#define __IEEE_LITTLE_ENDIAN -#endif - -#ifdef __arc__ -#ifdef __big_endian__ -#define __IEEE_BIG_ENDIAN -#else -#define __IEEE_LITTLE_ENDIAN -#endif -#endif - -#ifdef __CRX__ -#define __IEEE_LITTLE_ENDIAN -#endif - -#ifdef __fr30__ -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __mcore__ -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __mt__ -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __frv__ -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __moxie__ -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __ia64__ -#ifdef __BIG_ENDIAN__ -#define __IEEE_BIG_ENDIAN -#else -#define __IEEE_LITTLE_ENDIAN -#endif -#endif - -#ifdef __AVR__ -#define __IEEE_LITTLE_ENDIAN -#define _DOUBLE_IS_32BITS -#endif - -#if defined(__or32__) || defined(__or1k__) || defined(__or16__) -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __IP2K__ -#define __IEEE_BIG_ENDIAN -#define __SMALL_BITFIELDS -#define _DOUBLE_IS_32BITS -#endif - -#ifdef __iq2000__ -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __MAVERICK__ -#ifdef __ARMEL__ -# define __IEEE_LITTLE_ENDIAN -#else /* must be __ARMEB__ */ -# define __IEEE_BIG_ENDIAN -#endif /* __ARMEL__ */ -#endif /* __MAVERICK__ */ - -#ifdef __m32c__ -#define __IEEE_LITTLE_ENDIAN -#define __SMALL_BITFIELDS -#endif - -#ifdef __CRIS__ -#define __IEEE_LITTLE_ENDIAN -#endif - -#ifdef __BFIN__ -#define __IEEE_LITTLE_ENDIAN -#endif - -#ifdef __x86_64__ -#define __IEEE_LITTLE_ENDIAN -#endif - -#ifdef __mep__ -#ifdef __LITTLE_ENDIAN__ -#define __IEEE_LITTLE_ENDIAN -#else -#define __IEEE_BIG_ENDIAN -#endif -#endif - -#ifdef __MICROBLAZE__ -#define __IEEE_BIG_ENDIAN -#endif - -#ifdef __RL78__ -#define __IEEE_LITTLE_ENDIAN -#define __SMALL_BITFIELDS /* 16 Bit INT */ -#define _DOUBLE_IS_32BITS -#endif - -#ifdef __RX__ - -#ifdef __RX_BIG_ENDIAN__ -#define __IEEE_BIG_ENDIAN -#else -#define __IEEE_LITTLE_ENDIAN -#endif - -#ifndef __RX_64BIT_DOUBLES__ -#define _DOUBLE_IS_32BITS -#endif - -#ifdef __RX_16BIT_INTS__ -#define __SMALL_BITFIELDS -#endif - -#endif - -#if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__)) -#define __IEEE_LITTLE_ENDIAN -#define __SMALL_BITFIELDS /* 16 Bit INT */ -#endif - -#ifndef __IEEE_BIG_ENDIAN -#ifndef __IEEE_LITTLE_ENDIAN -#error Endianess not declared!! -#endif /* not __IEEE_LITTLE_ENDIAN */ -#endif /* not __IEEE_BIG_ENDIAN */ - -#endif /* not __IEEE_LITTLE_ENDIAN */ -#endif /* not __IEEE_BIG_ENDIAN */ - diff --git a/src/math/math.h b/src/math/math.h deleted file mode 100644 index 3a279663..00000000 --- a/src/math/math.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright © 2013 Keith Packard - * - * 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. - */ - -#ifndef _MATH_H_ -#define _MATH_H_ - -float acosf(float x); - -float cosf(float x); - -float sinf(float x); - -float sqrtf(float x); - -float fabsf(float x); - -float floorf(float x); - -float scalbnf(float x, int n); - -float copysignf(float x, float y); - -float logf(float x); - -#endif diff --git a/src/math/sf_copysign.c b/src/math/sf_copysign.c deleted file mode 100644 index f547c82e..00000000 --- a/src/math/sf_copysign.c +++ /dev/null @@ -1,50 +0,0 @@ -/* sf_copysign.c -- float version of s_copysign.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* - * copysignf(float x, float y) - * copysignf(x,y) returns a value with the magnitude of x and - * with the sign bit of y. - */ - -#include "fdlibm.h" - -#ifdef __STDC__ - float copysignf(float x, float y) -#else - float copysignf(x,y) - float x,y; -#endif -{ - __uint32_t ix,iy; - GET_FLOAT_WORD(ix,x); - GET_FLOAT_WORD(iy,y); - SET_FLOAT_WORD(x,(ix&0x7fffffff)|(iy&0x80000000)); - return x; -} - -#ifdef _DOUBLE_IS_32BITS - -#ifdef __STDC__ - double copysign(double x, double y) -#else - double copysign(x,y) - double x,y; -#endif -{ - return (double) copysignf((float) x, (float) y); -} - -#endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/src/math/sf_cos.c b/src/math/sf_cos.c deleted file mode 100644 index 2f46ec32..00000000 --- a/src/math/sf_cos.c +++ /dev/null @@ -1,62 +0,0 @@ -/* sf_cos.c -- float version of s_cos.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "fdlibm.h" - -#ifdef __STDC__ - float cosf(float x) -#else - float cosf(x) - float x; -#endif -{ - float y[2],z=0.0; - __int32_t n,ix; - - GET_FLOAT_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3f490fd8) return __kernel_cosf(x,z); - - /* cos(Inf or NaN) is NaN */ - else if (!FLT_UWORD_IS_FINITE(ix)) return x-x; - - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2f(x,y); - switch(n&3) { - case 0: return __kernel_cosf(y[0],y[1]); - case 1: return -__kernel_sinf(y[0],y[1],1); - case 2: return -__kernel_cosf(y[0],y[1]); - default: - return __kernel_sinf(y[0],y[1],1); - } - } -} - -#ifdef _DOUBLE_IS_32BITS - -#ifdef __STDC__ - double cos(double x) -#else - double cos(x) - double x; -#endif -{ - return (double) cosf((float) x); -} - -#endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/src/math/sf_fabs.c b/src/math/sf_fabs.c deleted file mode 100644 index 2aaed326..00000000 --- a/src/math/sf_fabs.c +++ /dev/null @@ -1,47 +0,0 @@ -/* sf_fabs.c -- float version of s_fabs.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* - * fabsf(x) returns the absolute value of x. - */ - -#include "fdlibm.h" - -#ifdef __STDC__ - float fabsf(float x) -#else - float fabsf(x) - float x; -#endif -{ - __uint32_t ix; - GET_FLOAT_WORD(ix,x); - SET_FLOAT_WORD(x,ix&0x7fffffff); - return x; -} - -#ifdef _DOUBLE_IS_32BITS - -#ifdef __STDC__ - double fabs(double x) -#else - double fabs(x) - double x; -#endif -{ - return (double) fabsf((float) x); -} - -#endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/src/math/sf_floor.c b/src/math/sf_floor.c deleted file mode 100644 index 9264d81e..00000000 --- a/src/math/sf_floor.c +++ /dev/null @@ -1,80 +0,0 @@ -/* sf_floor.c -- float version of s_floor.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* - * floorf(x) - * Return x rounded toward -inf to integral value - * Method: - * Bit twiddling. - * Exception: - * Inexact flag raised if x not equal to floorf(x). - */ - -#include "fdlibm.h" - -#ifdef __STDC__ -static const float huge = 1.0e30; -#else -static float huge = 1.0e30; -#endif - -#ifdef __STDC__ - float floorf(float x) -#else - float floorf(x) - float x; -#endif -{ - __int32_t i0,j0; - __uint32_t i,ix; - GET_FLOAT_WORD(i0,x); - ix = (i0&0x7fffffff); - j0 = (ix>>23)-0x7f; - if(j0<23) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0>=0) {i0=0;} - else if(!FLT_UWORD_IS_ZERO(ix)) - { i0=0xbf800000;} - } - } else { - i = (0x007fffff)>>j0; - if((i0&i)==0) return x; /* x is integral */ - if(huge+x>(float)0.0) { /* raise inexact flag */ - if(i0<0) i0 += (0x00800000)>>j0; - i0 &= (~i); - } - } - } else { - if(!FLT_UWORD_IS_FINITE(ix)) return x+x; /* inf or NaN */ - else return x; /* x is integral */ - } - SET_FLOAT_WORD(x,i0); - return x; -} - -#ifdef _DOUBLE_IS_32BITS - -#ifdef __STDC__ - double floor(double x) -#else - double floor(x) - double x; -#endif -{ - return (double) floorf((float) x); -} - -#endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/src/math/sf_scalbn.c b/src/math/sf_scalbn.c deleted file mode 100644 index 70006001..00000000 --- a/src/math/sf_scalbn.c +++ /dev/null @@ -1,86 +0,0 @@ -/* sf_scalbn.c -- float version of s_scalbn.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "fdlibm.h" -#include -#include - -#if INT_MAX > 50000 -#define OVERFLOW_INT 50000 -#else -#define OVERFLOW_INT 30000 -#endif - -#ifdef __STDC__ -static const float -#else -static float -#endif -two25 = 3.355443200e+07, /* 0x4c000000 */ -twom25 = 2.9802322388e-08, /* 0x33000000 */ -huge = 1.0e+30, -tiny = 1.0e-30; - -#ifdef __STDC__ - float scalbnf (float x, int n) -#else - float scalbnf (x,n) - float x; int n; -#endif -{ - __int32_t k,ix; - __uint32_t hx; - - GET_FLOAT_WORD(ix,x); - hx = ix&0x7fffffff; - k = hx>>23; /* extract exponent */ - if (FLT_UWORD_IS_ZERO(hx)) - return x; - if (!FLT_UWORD_IS_FINITE(hx)) - return x+x; /* NaN or Inf */ - if (FLT_UWORD_IS_SUBNORMAL(hx)) { - x *= two25; - GET_FLOAT_WORD(ix,x); - k = ((ix&0x7f800000)>>23) - 25; - if (n< -50000) return tiny*x; /*underflow*/ - } - k = k+n; - if (k > FLT_LARGEST_EXP) return huge*copysignf(huge,x); /* overflow */ - if (k > 0) /* normal result */ - {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;} - if (k < FLT_SMALLEST_EXP) { - if (n > OVERFLOW_INT) /* in case integer overflow in n+k */ - return huge*copysignf(huge,x); /*overflow*/ - else return tiny*copysignf(tiny,x); /*underflow*/ - } - k += 25; /* subnormal result */ - SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); - return x*twom25; -} - -#ifdef _DOUBLE_IS_32BITS - -#ifdef __STDC__ - double scalbn(double x, int n) -#else - double scalbn(x,n) - double x; - int n; -#endif -{ - return (double) scalbnf((float) x, n); -} - -#endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/src/math/sf_sin.c b/src/math/sf_sin.c deleted file mode 100644 index da81845d..00000000 --- a/src/math/sf_sin.c +++ /dev/null @@ -1,62 +0,0 @@ -/* sf_sin.c -- float version of s_sin.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "fdlibm.h" - -#ifdef __STDC__ - float sinf(float x) -#else - float sinf(x) - float x; -#endif -{ - float y[2],z=0.0; - __int32_t n,ix; - - GET_FLOAT_WORD(ix,x); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if(ix <= 0x3f490fd8) return __kernel_sinf(x,z,0); - - /* sin(Inf or NaN) is NaN */ - else if (!FLT_UWORD_IS_FINITE(ix)) return x-x; - - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2f(x,y); - switch(n&3) { - case 0: return __kernel_sinf(y[0],y[1],1); - case 1: return __kernel_cosf(y[0],y[1]); - case 2: return -__kernel_sinf(y[0],y[1],1); - default: - return -__kernel_cosf(y[0],y[1]); - } - } -} - -#ifdef _DOUBLE_IS_32BITS - -#ifdef __STDC__ - double sin(double x) -#else - double sin(x) - double x; -#endif -{ - return (double) sinf((float) x); -} - -#endif /* defined(_DOUBLE_IS_32BITS) */ diff --git a/src/stm/Makefile-flash.defs b/src/stm/Makefile-flash.defs index dde51a68..66ad1637 100644 --- a/src/stm/Makefile-flash.defs +++ b/src/stm/Makefile-flash.defs @@ -12,10 +12,14 @@ endif include $(TOPDIR)/Makedefs CC=$(ARM_CC) -LIBS=$(PDCLIB_LIBS_M3) -lgcc +LIBS=-L$(NEWLIB_NANO)/arm-none-eabi/lib/thumb/v7-m -lc -lm -lgcc -AO_CFLAGS=-I. -I$(TOPDIR)/stm -I$(TOPDIR)/kernel -I$(TOPDIR)/drivers -I$(TOPDIR)/product -I$(TOPDIR) $(PDCLIB_INCLUDES) -STM_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m3 -mthumb -ffreestanding -nostdlib $(AO_CFLAGS) $(SAT_CFLAGS) +AO_CFLAGS=-I. -I$(TOPDIR)/stm -I$(TOPDIR)/kernel -I$(TOPDIR)/drivers \ + -DNEWLIB_INTEGER_PRINTF_SCANF \ + -I$(TOPDIR)/product -I$(TOPDIR) -isystem $(NEWLIB_NANO)/arm-none-eabi/include + +STM_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m3 -mthumb \ + -ffreestanding -nostdlib $(AO_CFLAGS) $(SAT_CFLAGS) LDFLAGS=-L$(TOPDIR)/stm -Wl,-Taltos-loader.ld diff --git a/src/stm/Makefile.defs b/src/stm/Makefile.defs index 4d0d27c7..8173b349 100644 --- a/src/stm/Makefile.defs +++ b/src/stm/Makefile.defs @@ -22,15 +22,18 @@ endif include $(TOPDIR)/Makedefs CC=$(ARM_CC) -LIBS=$(PDCLIB_LIBS_M3) -lgcc +LIBS=-L$(NEWLIB_NANO)/arm-none-eabi/lib/thumb/v7-m -lm -lc -lgcc WARN_FLAGS=-Wall -Wextra -Werror -AO_CFLAGS=-I. -I../stm -I../kernel -I../drivers -I../math -I../draw -I../lisp -I.. $(PDCLIB_INCLUDES) +AO_CFLAGS=-I. -I../stm -I../kernel -I../drivers -I../math -I../draw \ + -DNEWLIB_INTEGER_PRINTF_SCANF \ + -I../lisp -I.. -isystem $(NEWLIB_NANO)/arm-none-eabi/include + STM_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m3 -mthumb -Wcast-align \ -ffreestanding -nostdlib $(AO_CFLAGS) $(WARN_FLAGS) -LDFLAGS=-L../stm -Wl,-Taltos.ld +LDFLAGS=-L../stm -Wl,-Taltos.ld -nostartfiles -Wl,-Map=$(PROGNAME).map NICKLE=nickle ELFTOHEX=$(TOPDIR)/../ao-tools/ao-elftohex/ao-elftohex diff --git a/src/stm/ao_arch.h b/src/stm/ao_arch.h index 679dba44..7b08b891 100644 --- a/src/stm/ao_arch.h +++ b/src/stm/ao_arch.h @@ -57,16 +57,6 @@ #define ao_arch_interrupt(n) /* nothing */ -#undef putchar -#undef getchar -#define putchar(c) ao_putchar(c) -#define getchar ao_getchar - -extern void putchar(char c); -extern char getchar(void); -extern void ao_avr_stdio_init(void); - - /* * ao_romconfig.c */ diff --git a/src/stmf0/Makefile-stmf0.defs b/src/stmf0/Makefile-stmf0.defs index 4e9fa551..447ddf13 100644 --- a/src/stmf0/Makefile-stmf0.defs +++ b/src/stmf0/Makefile-stmf0.defs @@ -28,15 +28,16 @@ CC=$(ARM_CC) WARN_FLAGS=-Wall -Wextra -Werror -Wcast-align AO_CFLAGS=-I. -I$(TOPDIR)/stmf0 -I$(TOPDIR)/kernel -I$(TOPDIR)/drivers \ - -I$(TOPDIR)/product -I$(TOPDIR) -I$(TOPDIR)/math -I$(TOPDIR)/lisp \ - $(PDCLIB_INCLUDES) + -DNEWLIB_INTEGER_PRINTF_SCANF \ + -I$(TOPDIR)/product -I$(TOPDIR) -I$(TOPDIR)/math \ + -isystem $(NEWLIB_NANO)/arm-none-eabi/include STMF0_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m0 -mthumb\ -ffreestanding -nostdlib $(AO_CFLAGS) $(WARN_FLAGS) NICKLE=nickle -LIBS=$(PDCLIB_LIBS_M0) -lgcc +LIBS=-L$(NEWLIB_NANO)/arm-none-eabi/lib/thumb/v6-m -lc -lm -lgcc V=0 # The user has explicitly enabled quiet compilation. diff --git a/src/stmf0/ao_arch.h b/src/stmf0/ao_arch.h index 5c5085d9..db6324cb 100644 --- a/src/stmf0/ao_arch.h +++ b/src/stmf0/ao_arch.h @@ -59,16 +59,6 @@ #define ao_arch_interrupt(n) /* nothing */ -#undef putchar -#undef getchar -#define putchar(c) ao_putchar(c) -#define getchar ao_getchar - -extern void putchar(char c); -extern char getchar(void); -extern void ao_avr_stdio_init(void); - - /* * ao_romconfig.c */ diff --git a/src/teleballoon-v2.0/Makefile b/src/teleballoon-v2.0/Makefile index 28588778..cb2ce253 100644 --- a/src/teleballoon-v2.0/Makefile +++ b/src/teleballoon-v2.0/Makefile @@ -38,9 +38,6 @@ INC = \ #STACK_GUARD=ao_mpu_stm.c #STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 -MATH_SRC=\ - ef_log.c - ALTOS_SRC = \ ao_boot_chain.c \ ao_interrupt.c \ @@ -88,7 +85,6 @@ ALTOS_SRC = \ ao_packet.c \ ao_companion.c \ ao_aprs.c \ - $(MATH_SRC) \ $(PROFILE) \ $(SAMPLE_PROFILE) \ $(STACK_GUARD) diff --git a/src/telemega-v0.1/Makefile b/src/telemega-v0.1/Makefile index 28ed7c98..78cfdefd 100644 --- a/src/telemega-v0.1/Makefile +++ b/src/telemega-v0.1/Makefile @@ -26,7 +26,6 @@ INC = \ ao_whiten.h \ ao_sample_profile.h \ ao_quaternion.h \ - math.h \ ao_mpu.h \ stm32l.h \ Makefile @@ -46,21 +45,6 @@ INC = \ #STACK_GUARD=ao_mpu_stm.c #STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 -MATH_SRC=\ - ef_acos.c \ - ef_sqrt.c \ - ef_rem_pio2.c \ - kf_cos.c \ - kf_sin.c \ - kf_rem_pio2.c \ - sf_copysign.c \ - sf_cos.c \ - sf_sin.c \ - sf_fabs.c \ - sf_floor.c \ - sf_scalbn.c \ - ef_log.c - ALTOS_SRC = \ ao_boot_chain.c \ ao_interrupt.c \ @@ -112,7 +96,6 @@ ALTOS_SRC = \ ao_companion.c \ ao_pyro.c \ ao_aprs.c \ - $(MATH_SRC) \ $(PROFILE) \ $(SAMPLE_PROFILE) \ $(STACK_GUARD) diff --git a/src/telemega-v1.0/Makefile b/src/telemega-v1.0/Makefile index 4a1b3908..372d53b8 100644 --- a/src/telemega-v1.0/Makefile +++ b/src/telemega-v1.0/Makefile @@ -27,10 +27,8 @@ INC = \ ao_whiten.h \ ao_sample_profile.h \ ao_quaternion.h \ - math.h \ ao_mpu.h \ stm32l.h \ - math.h \ ao_ms5607_convert.c \ Makefile @@ -49,21 +47,6 @@ INC = \ #STACK_GUARD=ao_mpu_stm.c #STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 -MATH_SRC=\ - ef_acos.c \ - ef_sqrt.c \ - ef_rem_pio2.c \ - kf_cos.c \ - kf_sin.c \ - kf_rem_pio2.c \ - sf_copysign.c \ - sf_cos.c \ - sf_fabs.c \ - sf_floor.c \ - sf_scalbn.c \ - sf_sin.c \ - ef_log.c - ALTOS_SRC = \ ao_boot_chain.c \ ao_interrupt.c \ @@ -115,7 +98,6 @@ ALTOS_SRC = \ ao_companion.c \ ao_pyro.c \ ao_aprs.c \ - $(MATH_SRC) \ $(PROFILE) \ $(SAMPLE_PROFILE) \ $(STACK_GUARD) diff --git a/src/telemega-v2.0/Makefile b/src/telemega-v2.0/Makefile index 6a1c05b0..2592587a 100644 --- a/src/telemega-v2.0/Makefile +++ b/src/telemega-v2.0/Makefile @@ -27,10 +27,8 @@ INC = \ ao_whiten.h \ ao_sample_profile.h \ ao_quaternion.h \ - math.h \ ao_mpu.h \ stm32l.h \ - math.h \ ao_ms5607_convert.c \ Makefile @@ -49,21 +47,6 @@ INC = \ #STACK_GUARD=ao_mpu_stm.c #STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 -MATH_SRC=\ - ef_acos.c \ - ef_sqrt.c \ - ef_rem_pio2.c \ - kf_cos.c \ - kf_sin.c \ - kf_rem_pio2.c \ - sf_copysign.c \ - sf_cos.c \ - sf_fabs.c \ - sf_floor.c \ - sf_scalbn.c \ - sf_sin.c \ - ef_log.c - ALTOS_SRC = \ ao_boot_chain.c \ ao_interrupt.c \ @@ -114,7 +97,6 @@ ALTOS_SRC = \ ao_pyro.c \ ao_aprs.c \ ao_pwm_stm.c \ - $(MATH_SRC) \ $(PROFILE) \ $(SAMPLE_PROFILE) \ $(STACK_GUARD) diff --git a/src/telemega-v3.0/Makefile b/src/telemega-v3.0/Makefile index ae22bf01..df0f4dbb 100644 --- a/src/telemega-v3.0/Makefile +++ b/src/telemega-v3.0/Makefile @@ -26,10 +26,8 @@ INC = \ ao_whiten.h \ ao_sample_profile.h \ ao_quaternion.h \ - math.h \ ao_mpu.h \ stm32l.h \ - math.h \ ao_ms5607_convert.c \ Makefile @@ -47,21 +45,6 @@ INC = \ #STACK_GUARD=ao_mpu_stm.c #STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 -MATH_SRC=\ - ef_acos.c \ - ef_sqrt.c \ - ef_rem_pio2.c \ - kf_cos.c \ - kf_sin.c \ - kf_rem_pio2.c \ - sf_copysign.c \ - sf_cos.c \ - sf_fabs.c \ - sf_floor.c \ - sf_scalbn.c \ - sf_sin.c \ - ef_log.c - ALTOS_SRC = \ ao_boot_chain.c \ ao_interrupt.c \ @@ -111,7 +94,6 @@ ALTOS_SRC = \ ao_pyro.c \ ao_aprs.c \ ao_pwm_stm.c \ - $(MATH_SRC) \ $(PROFILE) \ $(SAMPLE_PROFILE) \ $(STACK_GUARD) diff --git a/src/telemetrum-v2.0/Makefile b/src/telemetrum-v2.0/Makefile index d77e9585..0196936b 100644 --- a/src/telemetrum-v2.0/Makefile +++ b/src/telemetrum-v2.0/Makefile @@ -38,9 +38,6 @@ INC = \ #STACK_GUARD=ao_mpu_stm.c #STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 -MATH_SRC=\ - ef_log.c - ALTOS_SRC = \ ao_boot_chain.c \ ao_interrupt.c \ @@ -88,7 +85,6 @@ ALTOS_SRC = \ ao_packet.c \ ao_companion.c \ ao_aprs.c \ - $(MATH_SRC) \ $(PROFILE) \ $(SAMPLE_PROFILE) \ $(STACK_GUARD) diff --git a/src/telemetrum-v3.0/Makefile b/src/telemetrum-v3.0/Makefile index 002cc3f6..c72e781a 100644 --- a/src/telemetrum-v3.0/Makefile +++ b/src/telemetrum-v3.0/Makefile @@ -38,9 +38,6 @@ INC = \ #STACK_GUARD=ao_mpu_stm.c #STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 -MATH_SRC=\ - ef_log.c - ALTOS_SRC = \ ao_boot_chain.c \ ao_interrupt.c \ @@ -88,7 +85,6 @@ ALTOS_SRC = \ ao_packet.c \ ao_companion.c \ ao_aprs.c \ - $(MATH_SRC) \ $(PROFILE) \ $(SAMPLE_PROFILE) \ $(STACK_GUARD) -- cgit v1.2.3 From e2e2182a6ae6c8a7290fb5f7bbb7f8e0a863ba99 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 15 Aug 2018 15:39:34 -0700 Subject: Remove pdclib --- pdclib | 1 - 1 file changed, 1 deletion(-) delete mode 160000 pdclib diff --git a/pdclib b/pdclib deleted file mode 160000 index 20f71c3a..00000000 --- a/pdclib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 20f71c3a97eb4c7ecfa9754a0ca42855db935999 -- cgit v1.2.3 From 6023ff81f1bbd240169b9548209133d3b02d475f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 15 Aug 2018 17:34:20 -0700 Subject: altos: Remove *_TO_DATA macros Now that we don't support 8051, we don't need these Signed-off-by: Keith Packard --- src/drivers/ao_companion.c | 2 +- src/drivers/ao_gps_skytraq.c | 4 ++-- src/drivers/ao_ms5607.c | 6 +++--- src/drivers/ao_packet.c | 2 +- src/drivers/ao_pad.c | 2 +- src/kernel/ao.h | 11 ----------- src/kernel/ao_balloon.c | 4 ++-- src/kernel/ao_config.c | 6 +++--- src/kernel/ao_data.h | 4 +--- src/kernel/ao_flight.c | 16 ++++++++-------- src/kernel/ao_flight_nano.c | 6 +++--- src/kernel/ao_forward.c | 2 +- src/kernel/ao_host.h | 6 +++--- src/kernel/ao_log_telem.c | 4 ++-- src/kernel/ao_log_tiny.c | 4 ++-- src/kernel/ao_monitor.c | 16 ++++++++-------- src/kernel/ao_report.c | 4 ++-- src/kernel/ao_sample.c | 4 ++-- src/kernel/ao_telemetry.c | 2 +- src/product/ao_terraui.c | 2 +- src/test/ao_flight_test.c | 2 +- 21 files changed, 48 insertions(+), 61 deletions(-) diff --git a/src/drivers/ao_companion.c b/src/drivers/ao_companion.c index f82558a3..598b5815 100644 --- a/src/drivers/ao_companion.c +++ b/src/drivers/ao_companion.c @@ -107,7 +107,7 @@ ao_companion(void) break; } while (ao_companion_running) { - if (ao_sleep_for(DATA_TO_XDATA(&ao_flight_state), ao_companion_setup.update_period)) + if (ao_sleep_for(&ao_flight_state, ao_companion_setup.update_period)) ao_companion_get_data(); else ao_companion_notify(); diff --git a/src/drivers/ao_gps_skytraq.c b/src/drivers/ao_gps_skytraq.c index c483382e..3ecae435 100644 --- a/src/drivers/ao_gps_skytraq.c +++ b/src/drivers/ao_gps_skytraq.c @@ -298,7 +298,7 @@ ao_nmea_gga(void) ao_mutex_get(&ao_gps_mutex); ao_gps_new |= AO_GPS_NEW_DATA; ao_gps_tick = ao_gps_next_tick; - ao_xmemcpy(&ao_gps_data, PDATA_TO_XDATA(&ao_gps_next), sizeof (ao_gps_data)); + ao_xmemcpy(&ao_gps_data, &ao_gps_next, sizeof (ao_gps_data)); ao_mutex_put(&ao_gps_mutex); ao_wakeup(&ao_gps_new); } @@ -357,7 +357,7 @@ ao_nmea_gsv(void) else if (done) { ao_mutex_get(&ao_gps_mutex); ao_gps_new |= AO_GPS_NEW_TRACKING; - ao_xmemcpy(&ao_gps_tracking_data, PDATA_TO_XDATA(&ao_gps_tracking_next), sizeof(ao_gps_tracking_data)); + ao_xmemcpy(&ao_gps_tracking_data, &ao_gps_tracking_next, sizeof(ao_gps_tracking_data)); ao_mutex_put(&ao_gps_mutex); ao_wakeup(&ao_gps_new); } diff --git a/src/drivers/ao_ms5607.c b/src/drivers/ao_ms5607.c index 53ed992a..4bfc17db 100644 --- a/src/drivers/ao_ms5607.c +++ b/src/drivers/ao_ms5607.c @@ -45,7 +45,7 @@ ao_ms5607_reset(void) { cmd = AO_MS5607_RESET; ao_ms5607_start(); - ao_spi_send(DATA_TO_XDATA(&cmd), 1, AO_MS5607_SPI_INDEX); + ao_spi_send(&cmd, 1, AO_MS5607_SPI_INDEX); ao_delay(AO_MS_TO_TICKS(10)); ao_ms5607_stop(); } @@ -106,7 +106,7 @@ ao_ms5607_prom_read(__xdata struct ao_ms5607_prom *prom) for (addr = 0; addr < 8; addr++) { uint8_t cmd = AO_MS5607_PROM_READ(addr); ao_ms5607_start(); - ao_spi_send(DATA_TO_XDATA(&cmd), 1, AO_MS5607_SPI_INDEX); + ao_spi_send(&cmd, 1, AO_MS5607_SPI_INDEX); ao_spi_recv(r, 2, AO_MS5607_SPI_INDEX); ao_ms5607_stop(); r++; @@ -156,7 +156,7 @@ ao_ms5607_get_sample(uint8_t cmd) { ao_ms5607_done = 0; ao_ms5607_start(); - ao_spi_send(DATA_TO_XDATA(&cmd), 1, AO_MS5607_SPI_INDEX); + ao_spi_send(&cmd, 1, AO_MS5607_SPI_INDEX); ao_exti_enable(AO_MS5607_MISO_PORT, AO_MS5607_MISO_PIN); diff --git a/src/drivers/ao_packet.c b/src/drivers/ao_packet.c index 008af5db..1c931921 100644 --- a/src/drivers/ao_packet.c +++ b/src/drivers/ao_packet.c @@ -91,7 +91,7 @@ ao_packet_recv(uint16_t timeout) if (ao_xmemcmp(ao_rx_packet.packet.callsign, ao_config.callsign, AO_MAX_CALLSIGN) != 0 && - ao_xmemcmp(ao_config.callsign, CODE_TO_XDATA("N0CALL"), 7) != 0) + ao_xmemcmp(ao_config.callsign, "N0CALL", 7) != 0) return 0; /* SYN packets carry no data */ diff --git a/src/drivers/ao_pad.c b/src/drivers/ao_pad.c index c6efc311..208841fb 100644 --- a/src/drivers/ao_pad.c +++ b/src/drivers/ao_pad.c @@ -203,7 +203,7 @@ ao_pad_monitor(void) ao_arch_critical( while (sample == ao_data_head) - ao_sleep((void *) DATA_TO_XDATA(&ao_data_head)); + ao_sleep((void *) &ao_data_head); ); diff --git a/src/kernel/ao.h b/src/kernel/ao.h index 204eaae7..520f6ef2 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -38,17 +38,6 @@ extern char ao_getchar(void); #define TRUE 1 #define FALSE 0 -/* Convert a __data pointer into an __xdata pointer */ -#ifndef DATA_TO_XDATA -#define DATA_TO_XDATA(a) (a) -#endif -#ifndef PDATA_TO_XDATA -#define PDATA_TO_XDATA(a) (a) -#endif -#ifndef CODE_TO_XDATA -#define CODE_TO_XDATA(a) (a) -#endif - #ifndef HAS_TASK #define HAS_TASK 1 #endif diff --git a/src/kernel/ao_balloon.c b/src/kernel/ao_balloon.c index 47b69e25..d0f80a5d 100644 --- a/src/kernel/ao_balloon.c +++ b/src/kernel/ao_balloon.c @@ -96,7 +96,7 @@ ao_flight(void) ao_led_off(AO_LED_RED); } /* wakeup threads due to state change */ - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); break; case ao_flight_pad: @@ -118,7 +118,7 @@ ao_flight(void) ao_wakeup(&ao_gps_new); #endif - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); } break; default: diff --git a/src/kernel/ao_config.c b/src/kernel/ao_config.c index 86d4838f..10a67116 100644 --- a/src/kernel/ao_config.c +++ b/src/kernel/ao_config.c @@ -135,7 +135,7 @@ _ao_config_get(void) /* Version 0 stuff */ ao_config.main_deploy = AO_CONFIG_DEFAULT_MAIN_DEPLOY; ao_xmemset(&ao_config.callsign, '\0', sizeof (ao_config.callsign)); - ao_xmemcpy(&ao_config.callsign, CODE_TO_XDATA(AO_CONFIG_DEFAULT_CALLSIGN), + ao_xmemcpy(&ao_config.callsign, AO_CONFIG_DEFAULT_CALLSIGN, sizeof(AO_CONFIG_DEFAULT_CALLSIGN) - 1); ao_config._legacy_radio_channel = 0; } @@ -246,7 +246,7 @@ _ao_config_get(void) #if HAS_RADIO_RATE ao_config.radio_rate = AO_CONFIG_DEFAULT_RADIO_RATE; #endif - ao_xmemcpy(&ao_config.callsign, CODE_TO_XDATA(AO_CONFIG_DEFAULT_CALLSIGN), + ao_xmemcpy(&ao_config.callsign, AO_CONFIG_DEFAULT_CALLSIGN, sizeof(AO_CONFIG_DEFAULT_CALLSIGN) - 1); } #endif @@ -421,7 +421,7 @@ ao_config_accel_calibrate_auto(char *orientation) __reentrant accel_total = 0; cal_data_ring = ao_sample_data; while (i) { - ao_sleep(DATA_TO_XDATA(&ao_sample_data)); + ao_sleep(&ao_sample_data); while (i && cal_data_ring != ao_sample_data) { accel_total += (int32_t) ao_data_accel(&ao_data_ring[cal_data_ring]); #if HAS_GYRO diff --git a/src/kernel/ao_data.h b/src/kernel/ao_data.h index 88d0e916..30616ef0 100644 --- a/src/kernel/ao_data.h +++ b/src/kernel/ao_data.h @@ -113,9 +113,7 @@ extern volatile __data uint8_t ao_data_count; * Wait until it is time to write a sensor sample; this is * signaled by the timer tick */ -#define AO_DATA_WAIT() do { \ - ao_sleep(DATA_TO_XDATA ((void *) &ao_data_count)); \ - } while (0) +#define AO_DATA_WAIT() ao_sleep((void *) &ao_data_count) #endif /* AO_DATA_RING */ diff --git a/src/kernel/ao_flight.c b/src/kernel/ao_flight.c index c2700d20..170396ff 100644 --- a/src/kernel/ao_flight.c +++ b/src/kernel/ao_flight.c @@ -175,7 +175,7 @@ ao_flight(void) #endif } /* wakeup threads due to state change */ - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); break; case ao_flight_pad: @@ -219,7 +219,7 @@ ao_flight(void) ao_wakeup(&ao_gps_new); #endif - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); } break; case ao_flight_boost: @@ -244,7 +244,7 @@ ao_flight(void) ao_flight_state = ao_flight_coast; #endif ++ao_motor_number; - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); } break; #if HAS_ACCEL @@ -257,7 +257,7 @@ ao_flight(void) if (ao_speed < AO_MS_TO_SPEED(AO_MAX_BARO_SPEED)) { ao_flight_state = ao_flight_coast; - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); } else goto check_re_boost; break; @@ -306,7 +306,7 @@ ao_flight(void) /* and enter drogue state */ ao_flight_state = ao_flight_drogue; - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); } #if HAS_ACCEL else { @@ -315,7 +315,7 @@ ao_flight(void) if (ao_coast_avg_accel > AO_MSS_TO_ACCEL(20)) { ao_boost_tick = ao_sample_tick; ao_flight_state = ao_flight_boost; - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); } } #endif @@ -352,7 +352,7 @@ ao_flight(void) ao_interval_min_height = ao_interval_max_height = ao_avg_height; ao_flight_state = ao_flight_main; - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); } break; @@ -379,7 +379,7 @@ ao_flight(void) ao_timer_set_adc_interval(0); #endif - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); } ao_interval_min_height = ao_interval_max_height = ao_avg_height; ao_interval_end = ao_sample_tick + AO_INTERVAL_TICKS; diff --git a/src/kernel/ao_flight_nano.c b/src/kernel/ao_flight_nano.c index d849dc64..797ea344 100644 --- a/src/kernel/ao_flight_nano.c +++ b/src/kernel/ao_flight_nano.c @@ -70,7 +70,7 @@ ao_flight_nano(void) ao_led_off(AO_LED_RED); /* wakeup threads due to state change */ - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); break; case ao_flight_pad: if (ao_height> AO_M_TO_HEIGHT(20)) { @@ -80,7 +80,7 @@ ao_flight_nano(void) /* start logging data */ ao_log_start(); - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); } break; case ao_flight_drogue: @@ -101,7 +101,7 @@ ao_flight_nano(void) /* turn off the ADC capture */ ao_timer_set_adc_interval(0); - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); } ao_interval_min_height = ao_interval_max_height = ao_height; ao_interval_end = ao_sample_tick + AO_INTERVAL_TICKS; diff --git a/src/kernel/ao_forward.c b/src/kernel/ao_forward.c index 721b52d0..b1ab3f54 100644 --- a/src/kernel/ao_forward.c +++ b/src/kernel/ao_forward.c @@ -27,7 +27,7 @@ ao_monitor_forward(void) for (;;) { while (ao_monitoring) - ao_sleep(DATA_TO_XDATA(&ao_monitoring)); + ao_sleep(&ao_monitoring); if (!ao_radio_recv(&packet, sizeof(packet), 0)) continue; diff --git a/src/kernel/ao_host.h b/src/kernel/ao_host.h index 50583f52..638dba99 100644 --- a/src/kernel/ao_host.h +++ b/src/kernel/ao_host.h @@ -47,9 +47,9 @@ struct ao_adc { #define __code #define __reentrant -#define DATA_TO_XDATA(a) (a) -#define PDATA_TO_XDATA(a) (a) -#define CODE_TO_XDATA(a) (a) +#define a (a) +#define a (a) +#define a (a) enum ao_flight_state { ao_flight_startup = 0, diff --git a/src/kernel/ao_log_telem.c b/src/kernel/ao_log_telem.c index 1305a84d..8969e029 100644 --- a/src/kernel/ao_log_telem.c +++ b/src/kernel/ao_log_telem.c @@ -50,7 +50,7 @@ ao_log_telem_track() { ao_flight_state = ao_log_single_write_data.telemetry.sensor.state; if (ao_flight_state == ao_flight_pad) ao_max_height = 0; - ao_wakeup(DATA_TO_XDATA(&ao_flight_state)); + ao_wakeup(&ao_flight_state); } } } @@ -111,7 +111,7 @@ ao_log_single(void) ao_log_telem_track(); } /* Wait for more telemetry data to arrive */ - ao_sleep(DATA_TO_XDATA(&ao_monitor_head)); + ao_sleep(&ao_monitor_head); } } } diff --git a/src/kernel/ao_log_tiny.c b/src/kernel/ao_log_tiny.c index 0b8e39d6..046b7b20 100644 --- a/src/kernel/ao_log_tiny.c +++ b/src/kernel/ao_log_tiny.c @@ -41,7 +41,7 @@ static void ao_log_tiny_data(uint16_t d) if (ao_log_current_pos >= ao_log_end_pos && ao_log_running) ao_log_stop(); if (ao_log_running) { - ao_storage_write(ao_log_current_pos, DATA_TO_XDATA(&d), 2); + ao_storage_write(ao_log_current_pos, &d, 2); ao_log_current_pos += 2; } } @@ -102,7 +102,7 @@ ao_log(void) /* * Add in pending sample data */ - ao_sleep(DATA_TO_XDATA(&ao_sample_data)); + ao_sleep(&ao_sample_data); while (ao_log_data != ao_sample_data) { sum += ao_data_pres(&ao_data_ring[ao_log_data]); count++; diff --git a/src/kernel/ao_monitor.c b/src/kernel/ao_monitor.c index 7cbee288..b9a39bfc 100644 --- a/src/kernel/ao_monitor.c +++ b/src/kernel/ao_monitor.c @@ -59,7 +59,7 @@ _ao_monitor_adjust(void) else ao_monitoring = ao_internal_monitoring; } - ao_wakeup(DATA_TO_XDATA(&ao_monitoring)); + ao_wakeup(&ao_monitoring); } void @@ -70,7 +70,7 @@ ao_monitor_get(void) for (;;) { switch (ao_monitoring) { case 0: - ao_sleep(DATA_TO_XDATA(&ao_monitoring)); + ao_sleep(&ao_monitoring); continue; #if LEGACY_MONITOR case AO_MONITORING_ORIG: @@ -86,7 +86,7 @@ ao_monitor_get(void) if (!ao_radio_recv(&ao_monitor_ring[ao_monitor_head], size + 2, 0)) continue; ao_monitor_head = ao_monitor_ring_next(ao_monitor_head); - ao_wakeup(DATA_TO_XDATA(&ao_monitor_head)); + ao_wakeup(&ao_monitor_head); } } @@ -100,7 +100,7 @@ ao_monitor_blink(void) uint8_t *recv; #endif for (;;) { - ao_sleep(DATA_TO_XDATA(&ao_monitor_head)); + ao_sleep(&ao_monitor_head); #ifdef AO_MONITOR_BAD recv = (uint8_t *) &ao_monitor_ring[ao_monitor_ring_prev(ao_monitor_head)]; if (ao_monitoring && !(recv[ao_monitoring + 1] & AO_RADIO_STATUS_CRC_OK)) @@ -142,9 +142,9 @@ ao_monitor_put(void) ao_monitor_tail = ao_monitor_head; for (;;) { while (!ao_external_monitoring) - ao_sleep(DATA_TO_XDATA(&ao_external_monitoring)); + ao_sleep(&ao_external_monitoring); while (ao_monitor_tail == ao_monitor_head && ao_external_monitoring) - ao_sleep(DATA_TO_XDATA(&ao_monitor_head)); + ao_sleep(&ao_monitor_head); if (!ao_external_monitoring) continue; m = &ao_monitor_ring[ao_monitor_tail]; @@ -298,8 +298,8 @@ set_monitor(void) { ao_cmd_hex(); ao_external_monitoring = ao_cmd_lex_i; - ao_wakeup(DATA_TO_XDATA(&ao_external_monitoring)); - ao_wakeup(DATA_TO_XDATA(&ao_monitor_head)); + ao_wakeup(&ao_external_monitoring); + ao_wakeup(&ao_monitor_head); _ao_monitor_adjust(); } diff --git a/src/kernel/ao_report.c b/src/kernel/ao_report.c index af48b390..73f87cdd 100644 --- a/src/kernel/ao_report.c +++ b/src/kernel/ao_report.c @@ -183,7 +183,7 @@ ao_report_battery(void) ao_data_get(&packet); if (packet.adc.v_batt != 0) break; - ao_sleep(DATA_TO_XDATA(&ao_sample_data)); + ao_sleep(&ao_sample_data); } ao_report_number(ao_battery_decivolt(packet.adc.v_batt)); } @@ -281,7 +281,7 @@ ao_report(void) } #endif while (ao_report_state == ao_flight_state) - ao_sleep(DATA_TO_XDATA(&ao_flight_state)); + ao_sleep(&ao_flight_state); } } diff --git a/src/kernel/ao_sample.c b/src/kernel/ao_sample.c index f8012e34..9f5082bb 100644 --- a/src/kernel/ao_sample.c +++ b/src/kernel/ao_sample.c @@ -321,8 +321,8 @@ static gyro_t inline ao_gyro(void) { uint8_t ao_sample(void) { - ao_wakeup(DATA_TO_XDATA(&ao_sample_data)); - ao_sleep((void *) DATA_TO_XDATA(&ao_data_head)); + ao_wakeup(&ao_sample_data); + ao_sleep((void *) &ao_data_head); while (ao_sample_data != ao_data_head) { __xdata struct ao_data *ao_data; diff --git a/src/kernel/ao_telemetry.c b/src/kernel/ao_telemetry.c index 9ed612ce..8ff28fde 100644 --- a/src/kernel/ao_telemetry.c +++ b/src/kernel/ao_telemetry.c @@ -337,7 +337,7 @@ ao_send_configuration(void) ao_config.callsign, AO_MAX_CALLSIGN); ao_xmemcpy (telemetry.configuration.version, - CODE_TO_XDATA(ao_version), + ao_version, AO_MAX_VERSION); ao_telemetry_config_cur = ao_telemetry_config_max; ao_telemetry_send(); diff --git a/src/product/ao_terraui.c b/src/product/ao_terraui.c index c2bbc30e..f8f23a0f 100644 --- a/src/product/ao_terraui.c +++ b/src/product/ao_terraui.c @@ -588,7 +588,7 @@ ao_terramonitor(void) monitor = ao_monitor_ring_next(monitor)) { while (monitor == ao_monitor_head) - ao_sleep(DATA_TO_XDATA(&ao_monitor_head)); + ao_sleep(&ao_monitor_head); if (ao_monitoring != sizeof (union ao_telemetry_all)) continue; if (!(ao_monitor_ring[monitor].all.status & PKT_APPEND_STATUS_1_CRC_OK)) diff --git a/src/test/ao_flight_test.c b/src/test/ao_flight_test.c index 746a6814..0913e7ba 100644 --- a/src/test/ao_flight_test.c +++ b/src/test/ao_flight_test.c @@ -362,7 +362,7 @@ struct ao_ms5607_prom ao_ms5607_prom; struct ao_config ao_config; -#define DATA_TO_XDATA(x) (x) +#define x (x) extern int16_t ao_ground_accel, ao_flight_accel; -- cgit v1.2.3 From c6e57291d91f1f6c4de5c54a5cfd3eef66d9f830 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 15 Aug 2018 17:47:37 -0700 Subject: altos: Remove 8051 address space specifiers Signed-off-by: Keith Packard --- src/aes/ao_aes.c | 6 +-- src/attiny/ao_arch.h | 6 --- src/attiny/ao_arch_funcs.h | 8 +-- src/attiny/ao_i2c_attiny.c | 4 +- src/attiny/ao_led.c | 4 +- src/attiny/ao_spi_attiny.c | 4 +- src/avr/ao_adc_avr.c | 12 ++--- src/avr/ao_arch.h | 6 --- src/avr/ao_arch_funcs.h | 6 +-- src/avr/ao_eeprom_avr.c | 20 ++++---- src/avr/ao_i2c_usart.c | 6 +-- src/avr/ao_led.c | 4 +- src/avr/ao_pwmin.c | 8 +-- src/avr/ao_pwmin.h | 2 +- src/avr/ao_serial_avr.c | 10 ++-- src/avr/ao_spi_usart.c | 6 +-- src/avr/ao_timer.c | 8 +-- src/avr/ao_usb_avr.c | 46 ++++++++--------- src/cortexelf-v1/ao_cortexelf.c | 2 +- src/cortexelf-v1/cortexelf.ld | 4 +- src/drivers/ao_25lc1024.c | 30 +++++------ src/drivers/ao_74hc165.c | 2 +- src/drivers/ao_74hc497.c | 2 +- src/drivers/ao_at24c.c | 12 ++--- src/drivers/ao_at45db161d.c | 40 +++++++-------- src/drivers/ao_btm.c | 14 +++--- src/drivers/ao_cc1120.c | 2 +- src/drivers/ao_cc1200.c | 2 +- src/drivers/ao_companion.c | 16 +++--- src/drivers/ao_gps_sirf.c | 42 ++++++++-------- src/drivers/ao_gps_skytraq.c | 48 +++++++++--------- src/drivers/ao_gps_ublox.c | 32 ++++++------ src/drivers/ao_lcd.c | 2 +- src/drivers/ao_lco.c | 2 +- src/drivers/ao_lco_cmd.c | 22 ++++---- src/drivers/ao_lco_func.c | 4 +- src/drivers/ao_lco_two.c | 2 +- src/drivers/ao_m25.c | 22 ++++---- src/drivers/ao_mma655x.c | 4 +- src/drivers/ao_mr25.c | 22 ++++---- src/drivers/ao_ms5607.c | 26 +++++----- src/drivers/ao_ms5607.h | 10 ++-- src/drivers/ao_ms5607_convert_8051.c | 4 +- src/drivers/ao_packet.c | 22 ++++---- src/drivers/ao_packet_master.c | 12 ++--- src/drivers/ao_pad.c | 36 +++++++------- src/drivers/ao_pca9922.c | 4 +- src/drivers/ao_pyro_slave.c | 2 +- src/drivers/ao_quadrature.c | 2 +- src/drivers/ao_quadrature.h | 2 +- src/drivers/ao_radio_master.c | 26 +++++----- src/drivers/ao_radio_slave.c | 8 +-- src/drivers/ao_watchdog.c | 2 +- src/kernel/ao.h | 94 +++++++++++++++++------------------ src/kernel/ao_aes.h | 8 +-- src/kernel/ao_balloon.c | 10 ++-- src/kernel/ao_beep.h | 2 +- src/kernel/ao_cmd.c | 46 ++++++++--------- src/kernel/ao_companion.h | 10 ++-- src/kernel/ao_config.c | 94 +++++++++++++++++------------------ src/kernel/ao_config.h | 8 +-- src/kernel/ao_convert.c | 6 +-- src/kernel/ao_data.c | 8 +-- src/kernel/ao_data.h | 10 ++-- src/kernel/ao_ee_fake.c | 4 +- src/kernel/ao_eeprom.h | 4 +- src/kernel/ao_flight.c | 24 ++++----- src/kernel/ao_flight.h | 14 +++--- src/kernel/ao_flight_nano.c | 14 +++--- src/kernel/ao_forward.c | 6 +-- src/kernel/ao_forward.h | 2 +- src/kernel/ao_freq.c | 8 +-- src/kernel/ao_gps_print.c | 6 +-- src/kernel/ao_gps_report.c | 8 +-- src/kernel/ao_gps_report_mega.c | 8 +-- src/kernel/ao_gps_report_metrum.c | 8 +-- src/kernel/ao_gps_show.c | 2 +- src/kernel/ao_host.h | 6 +-- src/kernel/ao_ignite.c | 18 +++---- src/kernel/ao_int64.c | 16 +++--- src/kernel/ao_int64.h | 16 +++--- src/kernel/ao_kalman.c | 24 ++++----- src/kernel/ao_led.h | 2 +- src/kernel/ao_log.c | 40 +++++++-------- src/kernel/ao_log.h | 20 ++++---- src/kernel/ao_log_big.c | 4 +- src/kernel/ao_log_fireone.c | 12 ++--- src/kernel/ao_log_mega.c | 4 +- src/kernel/ao_log_metrum.c | 4 +- src/kernel/ao_log_mini.c | 4 +- src/kernel/ao_log_single.c | 18 +++---- src/kernel/ao_log_telem.c | 12 ++--- src/kernel/ao_log_telescience.c | 6 +-- src/kernel/ao_log_tiny.c | 8 +-- src/kernel/ao_monitor.c | 28 +++++------ src/kernel/ao_mutex.c | 6 +-- src/kernel/ao_notask.c | 4 +- src/kernel/ao_notask.h | 4 +- src/kernel/ao_packet.h | 18 +++---- src/kernel/ao_pyro.c | 6 +-- src/kernel/ao_radio_cmac.c | 14 +++--- src/kernel/ao_radio_cmac.h | 6 +-- src/kernel/ao_radio_cmac_cmd.c | 8 +-- src/kernel/ao_report.c | 16 +++--- src/kernel/ao_report_micro.c | 8 +-- src/kernel/ao_rssi.c | 8 +-- src/kernel/ao_sample.c | 74 +++++++++++++-------------- src/kernel/ao_sample.h | 70 +++++++++++++------------- src/kernel/ao_sample_profile.c | 2 +- src/kernel/ao_send_packet.c | 8 +-- src/kernel/ao_serial.h | 16 +++--- src/kernel/ao_stdio.c | 14 +++--- src/kernel/ao_storage.c | 24 ++++----- src/kernel/ao_storage.h | 24 ++++----- src/kernel/ao_task.c | 24 ++++----- src/kernel/ao_task.h | 20 ++++---- src/kernel/ao_telemetry.c | 54 ++++++++++---------- src/kernel/ao_usb.h | 6 +-- src/lpc/altos-loader.ld | 4 +- src/lpc/altos-standalone.ld | 4 +- src/lpc/altos.ld | 4 +- src/lpc/ao_adc_lpc.c | 4 +- src/lpc/ao_arch.h | 5 -- src/lpc/ao_beep_lpc.c | 2 +- src/lpc/ao_interrupt.c | 4 +- src/lpc/ao_led_lpc.c | 4 +- src/lpc/ao_timer_lpc.c | 6 +-- src/lpc/ao_usb_lpc.c | 2 +- src/micropeak-v2.0/micropeak.ld | 4 +- src/nucleao-32/load.ld | 4 +- src/pnpservo-v1/lambda.ld | 4 +- src/product/ao_flash_task.c | 2 +- src/product/ao_terraui.c | 56 ++++++++++----------- src/product/ao_test.c | 18 +++---- src/stm-bringup/bringup.ld | 4 +- src/stm-demo/ao_demo.c | 2 +- src/stm-scheme-newlib/ao_demo.c | 2 +- src/stm-vga/ao_demo.c | 2 +- src/stm/altos-512.ld | 4 +- src/stm/altos-loader.ld | 4 +- src/stm/altos-ram.ld | 4 +- src/stm/altos.ld | 4 +- src/stm/ao_adc_single_stm.c | 2 +- src/stm/ao_adc_stm.c | 6 +-- src/stm/ao_arch.h | 5 -- src/stm/ao_beep_stm.c | 2 +- src/stm/ao_eeprom_stm.c | 6 +-- src/stm/ao_interrupt.c | 4 +- src/stm/ao_led.c | 2 +- src/stm/ao_timer.c | 4 +- src/stm/ao_usb_stm.c | 2 +- src/stmf0/altos-loader.ld | 4 +- src/stmf0/altos-raw.ld | 4 +- src/stmf0/altos.ld | 4 +- src/stmf0/ao_adc_stm.c | 2 +- src/stmf0/ao_arch.h | 5 -- src/stmf0/ao_beep_stm.c | 2 +- src/stmf0/ao_interrupt.c | 4 +- src/stmf0/ao_led.c | 4 +- src/stmf0/ao_storage_stm.c | 6 +-- src/stmf0/ao_timer.c | 4 +- src/stmf0/ao_usb_stm.c | 2 +- src/telefireone-v1.0/ao_telefireone.c | 2 +- src/telelco-v2.0/ao_lco_v2.c | 2 +- src/test/ao_aes_test.c | 6 +-- src/test/ao_eeprom_read.h | 6 +-- src/test/ao_flight_test.c | 6 +-- src/test/ao_gps_test_skytraq.c | 4 +- src/test/ao_gps_test_ublox.c | 4 +- src/test/ao_int64_test.c | 4 -- src/test/ao_ms5607_convert_test.c | 4 -- src/usbrelay-v0.1/ao_usbrelay.c | 4 +- 172 files changed, 974 insertions(+), 1025 deletions(-) diff --git a/src/aes/ao_aes.c b/src/aes/ao_aes.c index fd90c5bf..0bc8188e 100644 --- a/src/aes/ao_aes.c +++ b/src/aes/ao_aes.c @@ -372,7 +372,7 @@ ao_aes_set_mode(enum ao_aes_mode mode) } void -ao_aes_set_key(__xdata uint8_t *in) +ao_aes_set_key(uint8_t *in) { memcpy(key, in, 16); xrijndaelKeySched((word32 *) key, 128, 128, &rkk); @@ -385,8 +385,8 @@ ao_aes_zero_iv(void) } void -ao_aes_run(__xdata uint8_t *in, - __xdata uint8_t *out) +ao_aes_run(uint8_t *in, + uint8_t *out) { uint8_t i; uint8_t *_iv = (uint8_t *) iv; diff --git a/src/attiny/ao_arch.h b/src/attiny/ao_arch.h index 68f5702d..84a94be7 100644 --- a/src/attiny/ao_arch.h +++ b/src/attiny/ao_arch.h @@ -38,12 +38,6 @@ #define ao_arch_naked_declare __attribute__((naked)) #define ao_arch_naked_define -#define __pdata -#define __data -#define __xdata -#define __code const -#define __reentrant -#define __critical #define __interrupt(n) #define __at(n) diff --git a/src/attiny/ao_arch_funcs.h b/src/attiny/ao_arch_funcs.h index 0b67a407..35901154 100644 --- a/src/attiny/ao_arch_funcs.h +++ b/src/attiny/ao_arch_funcs.h @@ -57,10 +57,10 @@ void -ao_spi_send_bus(void __xdata *block, uint16_t len) __reentrant; +ao_spi_send_bus(void *block, uint16_t len); void -ao_spi_recv_bus(void __xdata *block, uint16_t len) __reentrant; +ao_spi_recv_bus(void *block, uint16_t len); #define ao_spi_send(block, len, bus) ao_spi_send_bus(block, len) #define ao_spi_recv(block, len, bus) ao_spi_recv_bus(block, len) @@ -110,10 +110,10 @@ ao_i2c_init(void); /* notask.c */ uint8_t -ao_sleep(__xdata void *wchan); +ao_sleep(void *wchan); void -ao_wakeup(__xdata void *wchan); +ao_wakeup(void *wchan); extern alt_t ao_max_height; diff --git a/src/attiny/ao_i2c_attiny.c b/src/attiny/ao_i2c_attiny.c index f29ed6a9..34185b5a 100644 --- a/src/attiny/ao_i2c_attiny.c +++ b/src/attiny/ao_i2c_attiny.c @@ -173,7 +173,7 @@ ao_i2c_stop_bus(void) * so using interrupts would take way too long */ uint8_t -ao_i2c_send_bus(void __xdata *block, uint16_t len, uint8_t stop) +ao_i2c_send_bus(void *block, uint16_t len, uint8_t stop) { uint8_t *d = block; @@ -206,7 +206,7 @@ ao_i2c_send_fixed_bus(uint8_t d, uint16_t len, uint8_t stop) * Poll, sending zeros and reading data back */ uint8_t -ao_i2c_recv_bus(void __xdata *block, uint16_t len, uint8_t stop) +ao_i2c_recv_bus(void *block, uint16_t len, uint8_t stop) { uint8_t *d = block; diff --git a/src/attiny/ao_led.c b/src/attiny/ao_led.c index 5f53129e..88505490 100644 --- a/src/attiny/ao_led.c +++ b/src/attiny/ao_led.c @@ -18,7 +18,7 @@ #include "ao.h" -__pdata uint8_t ao_led_enable; +uint8_t ao_led_enable; #define LED_PORT PORTB #define LED_DDR DDRB @@ -48,7 +48,7 @@ ao_led_toggle(uint8_t colors) } void -ao_led_for(uint8_t colors, uint16_t ticks) __reentrant +ao_led_for(uint8_t colors, uint16_t ticks) { ao_led_on(colors); ao_delay(ticks); diff --git a/src/attiny/ao_spi_attiny.c b/src/attiny/ao_spi_attiny.c index f63eb651..1c90ad56 100644 --- a/src/attiny/ao_spi_attiny.c +++ b/src/attiny/ao_spi_attiny.c @@ -82,7 +82,7 @@ ao_spi_transfer(uint8_t i) * so using interrupts would take way too long */ void -ao_spi_send_bus(void __xdata *block, uint16_t len) __reentrant +ao_spi_send_bus(void *block, uint16_t len) { uint8_t *d = block; @@ -95,7 +95,7 @@ ao_spi_send_bus(void __xdata *block, uint16_t len) __reentrant * Poll, sending zeros and reading data back */ void -ao_spi_recv_bus(void __xdata *block, uint16_t len) __reentrant +ao_spi_recv_bus(void *block, uint16_t len) { uint8_t *d = block; diff --git a/src/avr/ao_adc_avr.c b/src/avr/ao_adc_avr.c index 2732c4db..2aae95ac 100644 --- a/src/avr/ao_adc_avr.c +++ b/src/avr/ao_adc_avr.c @@ -19,8 +19,8 @@ #include "ao.h" #include "ao_pwmin.h" -volatile __xdata struct ao_data ao_data_ring[AO_DATA_RING]; -volatile __data uint8_t ao_data_head; +volatile struct ao_data ao_data_ring[AO_DATA_RING]; +volatile uint8_t ao_data_head; #ifdef TELESCIENCE const uint8_t adc_channels[AO_LOG_TELESCIENCE_NUM_ADC] = { @@ -119,16 +119,16 @@ ao_adc_poll(void) } void -ao_data_get(__xdata struct ao_data *packet) +ao_data_get(struct ao_data *packet) { uint8_t i = ao_data_ring_prev(ao_data_head); memcpy(packet, (void *) &ao_data_ring[i], sizeof (struct ao_data)); } static void -ao_adc_dump(void) __reentrant +ao_adc_dump(void) { - static __xdata struct ao_data packet; + static struct ao_data packet; uint8_t i; ao_data_get(&packet); printf("tick: %5u", packet.tick); @@ -137,7 +137,7 @@ ao_adc_dump(void) __reentrant printf("\n"); } -__code struct ao_cmds ao_adc_cmds[] = { +const struct ao_cmds ao_adc_cmds[] = { { ao_adc_dump, "a\0ADC" }, { 0, NULL }, }; diff --git a/src/avr/ao_arch.h b/src/avr/ao_arch.h index 2b1da642..6166c50e 100644 --- a/src/avr/ao_arch.h +++ b/src/avr/ao_arch.h @@ -48,12 +48,6 @@ #define ao_arch_naked_declare __attribute__((naked)) #define ao_arch_naked_define -#define __pdata -#define __data -#define __xdata -#define __code const -#define __reentrant -#define __critical #define __interrupt(n) #define __at(n) diff --git a/src/avr/ao_arch_funcs.h b/src/avr/ao_arch_funcs.h index 891ad9b1..dc248660 100644 --- a/src/avr/ao_arch_funcs.h +++ b/src/avr/ao_arch_funcs.h @@ -20,7 +20,7 @@ * ao_spi.c */ -extern __xdata uint8_t ao_spi_mutex; +extern uint8_t ao_spi_mutex; #define ao_spi_get_mask(reg,mask,bus,speed) do { \ ao_mutex_get(&ao_spi_mutex); \ @@ -66,10 +66,10 @@ extern __xdata uint8_t ao_spi_mutex; void -ao_spi_send_bus(void __xdata *block, uint16_t len) __reentrant; +ao_spi_send_bus(void *block, uint16_t len); void -ao_spi_recv_bus(void __xdata *block, uint16_t len) __reentrant; +ao_spi_recv_bus(void *block, uint16_t len); #define ao_spi_send(block, len, bus) ao_spi_send_bus(block, len) #define ao_spi_recv(block, len, bus) ao_spi_recv_bus(block, len) diff --git a/src/avr/ao_eeprom_avr.c b/src/avr/ao_eeprom_avr.c index 2fdf177b..84942cd7 100644 --- a/src/avr/ao_eeprom_avr.c +++ b/src/avr/ao_eeprom_avr.c @@ -21,16 +21,16 @@ #include /* Total bytes of available storage */ -__pdata ao_pos_t ao_storage_total = 1024; +ao_pos_t ao_storage_total = 1024; /* Block size - device is erased in these units. */ -__pdata ao_pos_t ao_storage_block = 1024; +ao_pos_t ao_storage_block = 1024; /* Byte offset of config block. Will be ao_storage_block bytes long */ -__pdata ao_pos_t ao_storage_config = 0; +ao_pos_t ao_storage_config = 0; /* Storage unit size - device reads and writes must be within blocks of this size. */ -__pdata uint16_t ao_storage_unit = 1024; +uint16_t ao_storage_unit = 1024; /* * The internal flash chip is arranged in 8 byte sectors; the @@ -45,7 +45,7 @@ __pdata uint16_t ao_storage_unit = 1024; * Erase the specified sector */ uint8_t -ao_storage_erase(ao_pos_t pos) __reentrant +ao_storage_erase(ao_pos_t pos) { /* Not necessary */ return 1; @@ -83,10 +83,10 @@ ao_intflash_read(uint16_t pos) */ uint8_t -ao_storage_device_write(ao_pos_t pos32, __xdata void *v, uint16_t len) __reentrant +ao_storage_device_write(ao_pos_t pos32, void *v, uint16_t len) { uint16_t pos = pos32; - __xdata uint8_t *d = v; + uint8_t *d = v; if (pos >= ao_storage_total || pos + len > ao_storage_total) return 0; @@ -101,7 +101,7 @@ ao_storage_device_write(ao_pos_t pos32, __xdata void *v, uint16_t len) __reentra * Read from flash */ uint8_t -ao_storage_device_read(ao_pos_t pos, __xdata void *v, uint16_t len) __reentrant +ao_storage_device_read(ao_pos_t pos, void *v, uint16_t len) { uint8_t *d = v; @@ -113,7 +113,7 @@ ao_storage_device_read(ao_pos_t pos, __xdata void *v, uint16_t len) __reentrant } void -ao_storage_flush(void) __reentrant +ao_storage_flush(void) { } @@ -123,7 +123,7 @@ ao_storage_setup(void) } void -ao_storage_device_info(void) __reentrant +ao_storage_device_info(void) { printf ("Using internal flash\n"); } diff --git a/src/avr/ao_i2c_usart.c b/src/avr/ao_i2c_usart.c index c95548d4..67bee339 100644 --- a/src/avr/ao_i2c_usart.c +++ b/src/avr/ao_i2c_usart.c @@ -22,7 +22,7 @@ * Atmega32u4 TWI master mode (I2C) */ -__xdata uint8_t ao_i2c_mutex; +uint8_t ao_i2c_mutex; /* Send bytes over I2C. * @@ -30,7 +30,7 @@ __xdata uint8_t ao_i2c_mutex; * so using interrupts would take way too long */ void -ao_i2c_send(void __xdata *block, uint16_t len) __reentrant +ao_i2c_send(void *block, uint16_t len) { uint8_t *d = block; @@ -51,7 +51,7 @@ ao_i2c_send(void __xdata *block, uint16_t len) __reentrant * clocks the data coming in. */ void -ao_i2c_recv(void __xdata *block, uint16_t len) __reentrant +ao_i2c_recv(void *block, uint16_t len) { uint8_t *d = block; diff --git a/src/avr/ao_led.c b/src/avr/ao_led.c index 8eba4898..165e95d3 100644 --- a/src/avr/ao_led.c +++ b/src/avr/ao_led.c @@ -18,7 +18,7 @@ #include "ao.h" -__pdata uint8_t ao_led_enable; +uint8_t ao_led_enable; #define LED_PORT PORTB #define LED_DDR DDRB @@ -48,7 +48,7 @@ ao_led_toggle(uint8_t colors) } void -ao_led_for(uint8_t colors, uint16_t ticks) __reentrant +ao_led_for(uint8_t colors, uint16_t ticks) { ao_led_on(colors); ao_delay(ticks); diff --git a/src/avr/ao_pwmin.c b/src/avr/ao_pwmin.c index 5eb392a4..2d83380f 100644 --- a/src/avr/ao_pwmin.c +++ b/src/avr/ao_pwmin.c @@ -26,8 +26,8 @@ * project payload developed at Challenger Middle School. */ -volatile __data uint16_t ao_icp3_count = 0; -volatile __data uint16_t ao_icp3_last = 0; +volatile uint16_t ao_icp3_count = 0; +volatile uint16_t ao_icp3_last = 0; uint16_t ao_icp3(void) { @@ -39,7 +39,7 @@ uint16_t ao_icp3(void) } static void -ao_pwmin_display(void) __reentrant +ao_pwmin_display(void) { /* display the most recent value */ printf("icp 3: %5u\n", ao_icp3()); @@ -62,7 +62,7 @@ ISR(TIMER3_CAPT_vect) ao_icp3_last = ao_icp3_this; } -__code struct ao_cmds ao_pwmin_cmds[] = { +const struct ao_cmds ao_pwmin_cmds[] = { { ao_pwmin_display, "p\0PWM input" }, { 0, NULL }, }; diff --git a/src/avr/ao_pwmin.h b/src/avr/ao_pwmin.h index 43c12f53..fcb5e267 100644 --- a/src/avr/ao_pwmin.h +++ b/src/avr/ao_pwmin.h @@ -18,4 +18,4 @@ void ao_pwmin_init(void); -extern volatile __data uint16_t ao_icp3_count; +extern volatile uint16_t ao_icp3_count; diff --git a/src/avr/ao_serial_avr.c b/src/avr/ao_serial_avr.c index ab82b7b1..cfdd7dfe 100644 --- a/src/avr/ao_serial_avr.c +++ b/src/avr/ao_serial_avr.c @@ -18,8 +18,8 @@ #include "ao.h" -__xdata struct ao_fifo ao_serial1_rx_fifo; -__xdata struct ao_fifo ao_serial1_tx_fifo; +struct ao_fifo ao_serial1_rx_fifo; +struct ao_fifo ao_serial1_tx_fifo; void ao_debug_out(char c) @@ -40,7 +40,7 @@ ISR(USART1_RX_vect) #endif } -static __xdata uint8_t ao_serial_tx1_started; +static uint8_t ao_serial_tx1_started; static void ao_serial1_tx_start(void) @@ -75,7 +75,7 @@ _ao_serial1_pollchar(void) #endif char -ao_serial1_getchar(void) __critical +ao_serial1_getchar(void) { char c; @@ -99,7 +99,7 @@ ao_serial1_putchar(char c) } void -ao_serial1_drain(void) __critical +ao_serial1_drain(void) { ao_arch_block_interrupts(); while (!ao_fifo_empty(ao_serial1_tx_fifo)) diff --git a/src/avr/ao_spi_usart.c b/src/avr/ao_spi_usart.c index 0d509cb7..6c30b025 100644 --- a/src/avr/ao_spi_usart.c +++ b/src/avr/ao_spi_usart.c @@ -22,7 +22,7 @@ * Atmega32u4 USART in MSPIM (master SPI mode) */ -__xdata uint8_t ao_spi_mutex; +uint8_t ao_spi_mutex; /* Send bytes over SPI. * @@ -30,7 +30,7 @@ __xdata uint8_t ao_spi_mutex; * so using interrupts would take way too long */ void -ao_spi_send_bus(void __xdata *block, uint16_t len) __reentrant +ao_spi_send_bus(void *block, uint16_t len) { uint8_t *d = block; @@ -47,7 +47,7 @@ ao_spi_send_bus(void __xdata *block, uint16_t len) __reentrant * Poll, sending zeros and reading data back */ void -ao_spi_recv_bus(void __xdata *block, uint16_t len) __reentrant +ao_spi_recv_bus(void *block, uint16_t len) { uint8_t *d = block; diff --git a/src/avr/ao_timer.c b/src/avr/ao_timer.c index 2eaa8b63..ff6a829a 100644 --- a/src/avr/ao_timer.c +++ b/src/avr/ao_timer.c @@ -18,7 +18,7 @@ #include "ao.h" -volatile __data uint16_t ao_tick_count; +volatile uint16_t ao_tick_count; uint16_t ao_time(void) { @@ -33,8 +33,8 @@ uint16_t ao_time(void) #define T1_SAMPLE_TIME 30000 /* 3e6/30000 = 100 */ #if HAS_ADC -volatile __data uint8_t ao_adc_interval = 1; -volatile __data uint8_t ao_adc_count; +volatile uint8_t ao_adc_interval = 1; +volatile uint8_t ao_adc_count; #endif void @@ -53,7 +53,7 @@ ISR(TIMER1_COMPA_vect) #if HAS_ADC void -ao_timer_set_adc_interval(uint8_t interval) __critical +ao_timer_set_adc_interval(uint8_t interval) { ao_adc_interval = interval; ao_adc_count = 0; diff --git a/src/avr/ao_usb_avr.c b/src/avr/ao_usb_avr.c index 41d3c1be..df800994 100644 --- a/src/avr/ao_usb_avr.c +++ b/src/avr/ao_usb_avr.c @@ -27,7 +27,7 @@ #define debug(format, args...) #endif -struct ao_task __xdata ao_usb_task; +struct ao_task ao_usb_task; struct ao_usb_setup { uint8_t dir_type_recip; @@ -35,21 +35,21 @@ struct ao_usb_setup { uint16_t value; uint16_t index; uint16_t length; -} __xdata ao_usb_setup; - -static __xdata uint8_t ao_usb_ep0_state; -static const uint8_t * __xdata ao_usb_ep0_in_data; -static __xdata uint8_t ao_usb_ep0_in_len; -static __xdata uint8_t ao_usb_ep0_in_pending; -static __xdata uint8_t ao_usb_addr_pending; -static __xdata uint8_t ao_usb_ep0_in_buf[2]; -static __xdata uint8_t ao_usb_ep0_out_len; -static __xdata uint8_t *__xdata ao_usb_ep0_out_data; - -static __xdata uint8_t ao_usb_in_flushed; -__xdata uint8_t ao_usb_running; -static __xdata uint8_t ao_usb_configuration; -static __xdata uint8_t ueienx_0; +} ao_usb_setup; + +static uint8_t ao_usb_ep0_state; +static const uint8_t * ao_usb_ep0_in_data; +static uint8_t ao_usb_ep0_in_len; +static uint8_t ao_usb_ep0_in_pending; +static uint8_t ao_usb_addr_pending; +static uint8_t ao_usb_ep0_in_buf[2]; +static uint8_t ao_usb_ep0_out_len; +static uint8_t *ao_usb_ep0_out_data; + +static uint8_t ao_usb_in_flushed; +uint8_t ao_usb_running; +static uint8_t ao_usb_configuration; +static uint8_t ueienx_0; void ao_usb_set_address(uint8_t address) @@ -143,9 +143,9 @@ struct ao_usb_line_coding ao_usb_line_coding = {115200, 0, 0, 8}; static void ao_usb_get_descriptor(uint16_t value) { - const uint8_t *__xdata descriptor; - __xdata uint8_t type = value >> 8; - __xdata uint8_t index = value; + const uint8_t *descriptor; + uint8_t type = value >> 8; + uint8_t index = value; descriptor = ao_usb_descriptors; while (descriptor[0] != 0) { @@ -174,7 +174,7 @@ ao_usb_ep0_set_in_pending(uint8_t in_pending) static void ao_usb_ep0_flush(void) { - __xdata uint8_t this_len; + uint8_t this_len; cli(); UENUM = 0; @@ -242,7 +242,7 @@ static void ao_usb_ep0_setup(void) { /* Pull the setup packet out of the fifo */ - ao_usb_ep0_out_data = (__xdata uint8_t *) &ao_usb_setup; + ao_usb_ep0_out_data = (uint8_t *) &ao_usb_setup; ao_usb_ep0_out_len = 8; ao_usb_ep0_fill(8, (1 << RXSTPI) | (1 << RXOUTI) | (1 << TXINI)); if (ao_usb_ep0_out_len != 0) { @@ -334,7 +334,7 @@ ao_usb_ep0_setup(void) case AO_USB_SET_LINE_CODING: debug ("set line coding\n"); ao_usb_ep0_out_len = 7; - ao_usb_ep0_out_data = (__xdata uint8_t *) &ao_usb_line_coding; + ao_usb_ep0_out_data = (uint8_t *) &ao_usb_line_coding; break; case AO_USB_GET_LINE_CODING: debug ("get line coding\n"); @@ -636,7 +636,7 @@ ao_usb_enable(void) } #if USB_DEBUG -struct ao_task __xdata ao_usb_echo_task; +struct ao_task ao_usb_echo_task; static void ao_usb_echo(void) diff --git a/src/cortexelf-v1/ao_cortexelf.c b/src/cortexelf-v1/ao_cortexelf.c index 5ed78bf0..6bc2624f 100644 --- a/src/cortexelf-v1/ao_cortexelf.c +++ b/src/cortexelf-v1/ao_cortexelf.c @@ -218,7 +218,7 @@ led_cmd(void) ao_as1107_write_8(start, value); } -__code struct ao_cmds ao_demo_cmds[] = { +const struct ao_cmds ao_demo_cmds[] = { { ao_video_toggle, "V\0Toggle video" }, { ao_ball_toggle, "B\0Toggle ball" }, { ao_ps2_read_keys, "K\0Read keys from keyboard" }, diff --git a/src/cortexelf-v1/cortexelf.ld b/src/cortexelf-v1/cortexelf.ld index 6ad2a679..069fe5bd 100644 --- a/src/cortexelf-v1/cortexelf.ld +++ b/src/cortexelf-v1/cortexelf.ld @@ -75,10 +75,10 @@ SECTIONS { /* Data -- relocated to RAM, but written to ROM */ .data : { - __data_start__ = .; + _start__ = .; *(.data) /* initialized data */ . = ALIGN(4); - __data_end__ = .; + _end__ = .; } >ram AT>rom .bss : { diff --git a/src/drivers/ao_25lc1024.c b/src/drivers/ao_25lc1024.c index a9c897b3..c73f54df 100644 --- a/src/drivers/ao_25lc1024.c +++ b/src/drivers/ao_25lc1024.c @@ -24,16 +24,16 @@ #define EE_DEVICE_SIZE ((uint32_t) 128 * (uint32_t) 1024) /* Total bytes of available storage */ -__pdata uint32_t ao_storage_total; +uint32_t ao_storage_total; /* Block size - device is erased in these units. At least 256 bytes */ -__pdata uint32_t ao_storage_block; +uint32_t ao_storage_block; /* Byte offset of config block. Will be ao_storage_block bytes long */ -__pdata uint32_t ao_storage_config; +uint32_t ao_storage_config; /* Storage unit size - device reads and writes must be within blocks of this size. Usually 256 bytes. */ -__pdata uint16_t ao_storage_unit; +uint16_t ao_storage_unit; /* * Using SPI on USART 0, with P1_2 as the chip select @@ -43,7 +43,7 @@ __pdata uint16_t ao_storage_unit; #define EE_CS P1_2 #define EE_CS_PIN 2 -static __xdata uint8_t ao_ee_mutex; +static uint8_t ao_ee_mutex; #define ao_ee_delay() do { \ _asm nop _endasm; \ @@ -58,7 +58,7 @@ static __xdata uint8_t ao_ee_mutex; struct ao_ee_instruction { uint8_t instruction; uint8_t address[3]; -} __xdata ao_ee_instruction; +} ao_ee_instruction; static void ao_ee_write_enable(void) @@ -92,9 +92,9 @@ ao_ee_wrsr(uint8_t status) #define EE_BLOCK_NONE 0xffff -static __xdata uint8_t ao_ee_data[EE_BLOCK_SIZE]; -static __pdata uint16_t ao_ee_block = EE_BLOCK_NONE; -static __pdata uint8_t ao_ee_block_dirty; +static uint8_t ao_ee_data[EE_BLOCK_SIZE]; +static uint16_t ao_ee_block = EE_BLOCK_NONE; +static uint8_t ao_ee_block_dirty; /* Write the current block to the EEPROM */ static void @@ -157,7 +157,7 @@ ao_ee_fill(uint16_t block) } uint8_t -ao_storage_device_write(uint32_t pos, __xdata void *buf, uint16_t len) __reentrant +ao_storage_device_write(uint32_t pos, void *buf, uint16_t len) { uint16_t block = (uint16_t) (pos >> EE_BLOCK_SHIFT); @@ -176,7 +176,7 @@ ao_storage_device_write(uint32_t pos, __xdata void *buf, uint16_t len) __reentra } uint8_t -ao_storage_device_read(uint32_t pos, __xdata void *buf, uint16_t len) __reentrant +ao_storage_device_read(uint32_t pos, void *buf, uint16_t len) { uint16_t block = (uint16_t) (pos >> EE_BLOCK_SHIFT); @@ -189,7 +189,7 @@ ao_storage_device_read(uint32_t pos, __xdata void *buf, uint16_t len) __reentran } void -ao_storage_flush(void) __reentrant +ao_storage_flush(void) { ao_mutex_get(&ao_ee_mutex); { ao_ee_flush_internal(); @@ -197,7 +197,7 @@ ao_storage_flush(void) __reentrant } uint8_t -ao_storage_erase(uint32_t pos) __reentrant +ao_storage_erase(uint32_t pos) { ao_mutex_get(&ao_ee_mutex); { ao_ee_flush_internal(); @@ -209,7 +209,7 @@ ao_storage_erase(uint32_t pos) __reentrant } static void -ee_store(void) __reentrant +ee_store(void) { } @@ -225,7 +225,7 @@ ao_storage_setup(void) } void -ao_storage_device_info(void) __reentrant +ao_storage_device_info(void) { } diff --git a/src/drivers/ao_74hc165.c b/src/drivers/ao_74hc165.c index 8842801d..b62e0134 100644 --- a/src/drivers/ao_74hc165.c +++ b/src/drivers/ao_74hc165.c @@ -27,7 +27,7 @@ uint8_t ao_74hc165_read(void) { - static __xdata state; + static state; ao_spi_get(AO_74HC165_SPI_BUS); ao_spi_set_speed(AO_74HC165_SPI_BUS, AO_SPI_SPEED_FAST); AO_74HC165_CS = 1; diff --git a/src/drivers/ao_74hc497.c b/src/drivers/ao_74hc497.c index b3fd3c91..e8c39430 100644 --- a/src/drivers/ao_74hc497.c +++ b/src/drivers/ao_74hc497.c @@ -27,7 +27,7 @@ uint8_t ao_74hc497_read(void) { - static __xdata state; + static state; ao_spi_get_bit(AO_74HC497_CS_PORT, AO_74HC497_CS_PIN, AO_74HC497_CS, AO_74HC497_SPI_BUS, AO_SPI_SPEED_FAST); ao_spi_recv(&state, 1, AO_74HC497_SPI_BUS); ao_spi_put_bit(AO_74HC497_CS_PORT, AO_74HC497_CS_PIN, AO_74HC497_CS, AO_74HC497_SPI_BUS); diff --git a/src/drivers/ao_at24c.c b/src/drivers/ao_at24c.c index 8f91e3ca..16141c73 100644 --- a/src/drivers/ao_at24c.c +++ b/src/drivers/ao_at24c.c @@ -25,10 +25,10 @@ #define AO_AT24C_PAGE_LEN 128 /* Total bytes of available storage */ -__pdata ao_pos_t ao_storage_total = 64l * 1024l; +ao_pos_t ao_storage_total = 64l * 1024l; /* Storage unit size - device reads and writes must be within blocks of this size. */ -__pdata uint16_t ao_storage_unit = 128; +uint16_t ao_storage_unit = 128; static void ao_at24c_set_address(uint8_t addr, ao_pos_t pos) @@ -45,7 +45,7 @@ ao_at24c_set_address(uint8_t addr, ao_pos_t pos) * Erase the specified sector */ uint8_t -ao_storage_erase(ao_pos_t pos) __reentrant +ao_storage_erase(ao_pos_t pos) { if (pos >= ao_storage_total || pos + AO_AT24C_PAGE_LEN > ao_storage_total) return 0; @@ -61,7 +61,7 @@ ao_storage_erase(ao_pos_t pos) __reentrant * Write to flash */ uint8_t -ao_storage_device_write(ao_pos_t pos, __xdata void *d, uint16_t len) __reentrant +ao_storage_device_write(ao_pos_t pos, void *d, uint16_t len) { if (pos >= ao_storage_total || pos + len > ao_storage_total) return 0; @@ -77,7 +77,7 @@ ao_storage_device_write(ao_pos_t pos, __xdata void *d, uint16_t len) __reentrant * Read from flash */ uint8_t -ao_storage_device_read(ao_pos_t pos, __xdata void *d, uint16_t len) __reentrant +ao_storage_device_read(ao_pos_t pos, void *d, uint16_t len) { if (pos >= ao_storage_total || pos + len > ao_storage_total) return 0; @@ -89,7 +89,7 @@ ao_storage_device_read(ao_pos_t pos, __xdata void *d, uint16_t len) __reentrant } void -ao_storage_flush(void) __reentrant +ao_storage_flush(void) { } diff --git a/src/drivers/ao_at45db161d.c b/src/drivers/ao_at45db161d.c index abba3f1f..516811b8 100644 --- a/src/drivers/ao_at45db161d.c +++ b/src/drivers/ao_at45db161d.c @@ -20,23 +20,23 @@ #include "ao_at45db161d.h" /* Total bytes of available storage */ -__pdata uint32_t ao_storage_total; +uint32_t ao_storage_total; /* Block size - device is erased in these units. At least 256 bytes */ -__pdata uint32_t ao_storage_block; +uint32_t ao_storage_block; /* Byte offset of config block. Will be ao_storage_block bytes long */ -__pdata uint32_t ao_storage_config; +uint32_t ao_storage_config; /* Storage unit size - device reads and writes must be within blocks of this size. Usually 256 bytes. */ -__pdata uint16_t ao_storage_unit; +uint16_t ao_storage_unit; #define FLASH_CS P1_1 #define FLASH_CS_INDEX 1 #define FLASH_BLOCK_SIZE_MAX 512 -__xdata uint8_t ao_flash_mutex; +uint8_t ao_flash_mutex; #define ao_flash_delay() do { \ _asm nop _endasm; \ @@ -51,7 +51,7 @@ __xdata uint8_t ao_flash_mutex; struct ao_flash_instruction { uint8_t instruction; uint8_t address[3]; -} __xdata ao_flash_instruction; +} ao_flash_instruction; static void ao_flash_set_pagesize_512(void) @@ -79,17 +79,17 @@ ao_flash_read_status(void) #define FLASH_BLOCK_NONE 0xffff -static __xdata uint8_t ao_flash_data[FLASH_BLOCK_SIZE_MAX]; -static __pdata uint16_t ao_flash_block = FLASH_BLOCK_NONE; -static __pdata uint8_t ao_flash_block_dirty; -static __pdata uint8_t ao_flash_write_pending; -static __pdata uint8_t ao_flash_setup_done; -static __pdata uint8_t ao_flash_block_shift; -static __pdata uint16_t ao_flash_block_size; -static __pdata uint16_t ao_flash_block_mask; +static uint8_t ao_flash_data[FLASH_BLOCK_SIZE_MAX]; +static uint16_t ao_flash_block = FLASH_BLOCK_NONE; +static uint8_t ao_flash_block_dirty; +static uint8_t ao_flash_write_pending; +static uint8_t ao_flash_setup_done; +static uint8_t ao_flash_block_shift; +static uint16_t ao_flash_block_size; +static uint16_t ao_flash_block_mask; void -ao_storage_setup(void) __reentrant +ao_storage_setup(void) { uint8_t status; @@ -234,7 +234,7 @@ ao_flash_fill(uint16_t block) } uint8_t -ao_storage_device_write(uint32_t pos, __xdata void *buf, uint16_t len) __reentrant +ao_storage_device_write(uint32_t pos, void *buf, uint16_t len) { uint16_t block = (uint16_t) (pos >> ao_flash_block_shift); @@ -255,7 +255,7 @@ ao_storage_device_write(uint32_t pos, __xdata void *buf, uint16_t len) __reentra } uint8_t -ao_storage_device_read(uint32_t pos, __xdata void *buf, uint16_t len) __reentrant +ao_storage_device_read(uint32_t pos, void *buf, uint16_t len) { uint16_t block = (uint16_t) (pos >> ao_flash_block_shift); @@ -270,7 +270,7 @@ ao_storage_device_read(uint32_t pos, __xdata void *buf, uint16_t len) __reentran } void -ao_storage_flush(void) __reentrant +ao_storage_flush(void) { ao_mutex_get(&ao_flash_mutex); { ao_flash_flush_internal(); @@ -278,7 +278,7 @@ ao_storage_flush(void) __reentrant } uint8_t -ao_storage_erase(uint32_t pos) __reentrant +ao_storage_erase(uint32_t pos) { ao_mutex_get(&ao_flash_mutex); { ao_flash_flush_internal(); @@ -290,7 +290,7 @@ ao_storage_erase(uint32_t pos) __reentrant } void -ao_storage_device_info(void) __reentrant +ao_storage_device_info(void) { uint8_t status; diff --git a/src/drivers/ao_btm.c b/src/drivers/ao_btm.c index c65a8548..3591f8f2 100644 --- a/src/drivers/ao_btm.c +++ b/src/drivers/ao_btm.c @@ -30,12 +30,12 @@ #endif int8_t ao_btm_stdio; -__xdata uint8_t ao_btm_connected; +uint8_t ao_btm_connected; #define BT_DEBUG 0 #if BT_DEBUG -__xdata char ao_btm_buffer[256]; +char ao_btm_buffer[256]; uint16_t ao_btm_ptr; char ao_btm_dir; @@ -137,7 +137,7 @@ ao_btm_send(void) ao_wakeup((void *) &ao_serial_btm_rx_fifo); } -__code struct ao_cmds ao_btm_cmds[] = { +const struct ao_cmds ao_btm_cmds[] = { { ao_btm_dump, "d\0Dump btm buffer." }, { ao_btm_speed, "s <19200,57600>\0Set btm serial speed." }, { ao_btm_send, "S\0BTM interactive mode. ~ to exit." }, @@ -153,7 +153,7 @@ __code struct ao_cmds ao_btm_cmds[] = { #endif #define AO_BTM_MAX_REPLY 16 -__xdata char ao_btm_reply[AO_BTM_MAX_REPLY]; +char ao_btm_reply[AO_BTM_MAX_REPLY]; /* * Read one bluetooth character. @@ -252,7 +252,7 @@ ao_btm_wait_reply(void) } void -ao_btm_string(__code char *cmd) +ao_btm_string(const char *cmd) { char c; @@ -261,7 +261,7 @@ ao_btm_string(__code char *cmd) } uint8_t -ao_btm_cmd(__code char *cmd) +ao_btm_cmd(const char *cmd) { ao_btm_drain(); @@ -351,7 +351,7 @@ ao_btm_check_link() #endif } -__xdata struct ao_task ao_btm_task; +struct ao_task ao_btm_task; /* * A thread to initialize the bluetooth device and diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c index 2f091485..d581c246 100644 --- a/src/drivers/ao_cc1120.c +++ b/src/drivers/ao_cc1120.c @@ -1066,7 +1066,7 @@ ao_radio_rx_wait(void) } uint8_t -ao_radio_recv(__xdata void *d, uint8_t size, uint8_t timeout) +ao_radio_recv(void *d, uint8_t size, uint8_t timeout) { uint8_t len; uint8_t radio_rssi = 0; diff --git a/src/drivers/ao_cc1200.c b/src/drivers/ao_cc1200.c index de282000..f2f9c372 100644 --- a/src/drivers/ao_cc1200.c +++ b/src/drivers/ao_cc1200.c @@ -988,7 +988,7 @@ ao_radio_dump_state(struct ao_radio_state *s) #endif uint8_t -ao_radio_recv(__xdata void *d, uint8_t size, uint8_t timeout) +ao_radio_recv(void *d, uint8_t size, uint8_t timeout) { uint8_t success = 0; diff --git a/src/drivers/ao_companion.c b/src/drivers/ao_companion.c index 598b5815..3967090b 100644 --- a/src/drivers/ao_companion.c +++ b/src/drivers/ao_companion.c @@ -43,12 +43,12 @@ AO_COMPANION_SPI_BUS); \ } while (0) -__xdata struct ao_companion_command ao_companion_command; -__xdata struct ao_companion_setup ao_companion_setup; +struct ao_companion_command ao_companion_command; +struct ao_companion_setup ao_companion_setup; -__xdata uint16_t ao_companion_data[AO_COMPANION_MAX_CHANNELS]; -__pdata uint8_t ao_companion_running; -__xdata uint8_t ao_companion_mutex; +uint16_t ao_companion_data[AO_COMPANION_MAX_CHANNELS]; +uint8_t ao_companion_running; +uint8_t ao_companion_mutex; static void ao_companion_send_command(uint8_t command) @@ -116,7 +116,7 @@ ao_companion(void) } void -ao_companion_status(void) __reentrant +ao_companion_status(void) { uint8_t i; printf("Companion running: %d\n", ao_companion_running); @@ -134,12 +134,12 @@ ao_companion_status(void) __reentrant printf("\n"); } -__code struct ao_cmds ao_companion_cmds[] = { +const struct ao_cmds ao_companion_cmds[] = { { ao_companion_status, "L\0Companion link status" }, { 0, NULL }, }; -static __xdata struct ao_task ao_companion_task; +static struct ao_task ao_companion_task; void ao_companion_init(void) diff --git a/src/drivers/ao_gps_sirf.c b/src/drivers/ao_gps_sirf.c index 8bebd610..bdd9410e 100644 --- a/src/drivers/ao_gps_sirf.c +++ b/src/drivers/ao_gps_sirf.c @@ -20,11 +20,11 @@ #include "ao.h" #endif -__xdata uint8_t ao_gps_new; -__xdata uint8_t ao_gps_mutex; -__pdata uint16_t ao_gps_tick; -__xdata struct ao_telemetry_location ao_gps_data; -__xdata struct ao_telemetry_satellite ao_gps_tracking_data; +uint8_t ao_gps_new; +uint8_t ao_gps_mutex; +uint16_t ao_gps_tick; +struct ao_telemetry_location ao_gps_data; +struct ao_telemetry_satellite ao_gps_tracking_data; static const char ao_gps_set_nmea[] = "\r\n$PSRF100,0,57600,8,1,0*37\r\n"; @@ -107,7 +107,7 @@ struct sirf_geodetic_nav_data { uint8_t hdop; }; -static __xdata struct sirf_geodetic_nav_data ao_sirf_data; +static struct sirf_geodetic_nav_data ao_sirf_data; struct sirf_measured_sat_data { uint8_t svid; @@ -121,10 +121,10 @@ struct sirf_measured_tracker_data { struct sirf_measured_sat_data sats[12]; }; -static __xdata struct sirf_measured_tracker_data ao_sirf_tracker_data; +static struct sirf_measured_tracker_data ao_sirf_tracker_data; -static __pdata uint16_t ao_sirf_cksum; -static __pdata uint16_t ao_sirf_len; +static uint16_t ao_sirf_cksum; +static uint16_t ao_sirf_len; #ifndef ao_sirf_getchar #define ao_sirf_getchar ao_serial1_getchar @@ -142,11 +142,11 @@ static uint8_t data_byte(void) return c; } -static char __xdata *sirf_target; +static char *sirf_target; static void sirf_u16(uint8_t offset) { - uint16_t __xdata *ptr = (uint16_t __xdata *) (sirf_target + offset); + uint16_t *ptr = (uint16_t *) (sirf_target + offset); uint16_t val; val = data_byte() << 8; @@ -156,16 +156,16 @@ static void sirf_u16(uint8_t offset) static void sirf_u8(uint8_t offset) { - uint8_t __xdata *ptr = (uint8_t __xdata *) (sirf_target + offset); + uint8_t *ptr = (uint8_t *) (sirf_target + offset); uint8_t val; val = data_byte (); *ptr = val; } -static void sirf_u32(uint8_t offset) __reentrant +static void sirf_u32(uint8_t offset) { - uint32_t __xdata *ptr = (uint32_t __xdata *) (sirf_target + offset); + uint32_t *ptr = (uint32_t *) (sirf_target + offset); uint32_t val; val = ((uint32_t) data_byte ()) << 24; @@ -194,7 +194,7 @@ struct sirf_packet_parse { }; static void -ao_sirf_parse(void __xdata *target, const struct sirf_packet_parse *parse) __reentrant +ao_sirf_parse(void *target, const struct sirf_packet_parse *parse) { uint8_t i, offset, j; @@ -258,7 +258,7 @@ static const struct sirf_packet_parse geodetic_nav_data_packet[] = { }; static void -ao_sirf_parse_41(void) __reentrant +ao_sirf_parse_41(void) { ao_sirf_parse(&ao_sirf_data, geodetic_nav_data_packet); } @@ -279,7 +279,7 @@ static const struct sirf_packet_parse measured_sat_data_packet[] = { }; static void -ao_sirf_parse_4(void) __reentrant +ao_sirf_parse_4(void) { uint8_t i; ao_sirf_parse(&ao_sirf_tracker_data, measured_tracker_data_packet); @@ -288,7 +288,7 @@ ao_sirf_parse_4(void) __reentrant } static void -ao_gps_setup(void) __reentrant +ao_gps_setup(void) { uint8_t i, k; ao_sirf_set_speed(AO_SERIAL_SPEED_4800); @@ -309,7 +309,7 @@ static const char ao_gps_set_message_rate[] = { }; void -ao_sirf_set_message_rate(uint8_t msg, uint8_t rate) __reentrant +ao_sirf_set_message_rate(uint8_t msg, uint8_t rate) { uint16_t cksum = 0x00a6; uint8_t i; @@ -337,7 +337,7 @@ static const uint8_t sirf_disable[] = { }; void -ao_gps(void) __reentrant +ao_gps(void) { uint8_t i, k; uint16_t cksum; @@ -443,7 +443,7 @@ ao_gps(void) __reentrant } } -__xdata struct ao_task ao_gps_task; +struct ao_task ao_gps_task; void ao_gps_init(void) diff --git a/src/drivers/ao_gps_skytraq.c b/src/drivers/ao_gps_skytraq.c index 3ecae435..193f20dc 100644 --- a/src/drivers/ao_gps_skytraq.c +++ b/src/drivers/ao_gps_skytraq.c @@ -33,20 +33,20 @@ #define ao_gps_set_speed ao_serial1_set_speed #endif -__xdata uint8_t ao_gps_new; -__xdata uint8_t ao_gps_mutex; -static __data char ao_gps_char; -static __data uint8_t ao_gps_cksum; -static __data uint8_t ao_gps_error; +uint8_t ao_gps_new; +uint8_t ao_gps_mutex; +static char ao_gps_char; +static uint8_t ao_gps_cksum; +static uint8_t ao_gps_error; -__pdata uint16_t ao_gps_tick; -__xdata struct ao_telemetry_location ao_gps_data; -__xdata struct ao_telemetry_satellite ao_gps_tracking_data; +uint16_t ao_gps_tick; +struct ao_telemetry_location ao_gps_data; +struct ao_telemetry_satellite ao_gps_tracking_data; -static __pdata uint16_t ao_gps_next_tick; -static __pdata struct ao_telemetry_location ao_gps_next; -static __pdata uint8_t ao_gps_date_flags; -static __pdata struct ao_telemetry_satellite ao_gps_tracking_next; +static uint16_t ao_gps_next_tick; +static struct ao_telemetry_location ao_gps_next; +static uint8_t ao_gps_date_flags; +static struct ao_telemetry_satellite ao_gps_tracking_next; #define STQ_S 0xa0, 0xa1 #define STQ_E 0x0d, 0x0a @@ -60,7 +60,7 @@ static __pdata struct ao_telemetry_satellite ao_gps_tracking_next; STQ_S, 0,15, id, a,b,c,d,e,f,g,h,i,j,k,l,m,n, \ (id^a^b^c^d^e^f^g^h^i^j^k^l^m^n), STQ_E -static __code uint8_t ao_gps_config[] = { +static const uint8_t ao_gps_config[] = { SKYTRAQ_MSG_8(0x08, 1, 0, 1, 0, 1, 0, 0, 0), /* configure nmea */ /* gga interval */ /* gsa interval */ @@ -107,7 +107,7 @@ ao_gps_skip_sep(void) ao_gps_lexchar(); } -__data static uint8_t ao_gps_num_width; +static uint8_t ao_gps_num_width; static int16_t ao_gps_decimal(uint8_t max_width) @@ -162,11 +162,11 @@ ao_gps_hex(void) } static int32_t -ao_gps_parse_pos(uint8_t deg_width) __reentrant +ao_gps_parse_pos(uint8_t deg_width) { - static __pdata uint16_t d; - static __pdata uint8_t m; - static __pdata uint16_t f; + static uint16_t d; + static uint8_t m; + static uint16_t f; char c; d = ao_gps_decimal(deg_width); @@ -414,7 +414,7 @@ ao_nmea_rmc(void) #define ao_skytraq_sendstruct(s) ao_skytraq_sendbytes((s), sizeof(s)) static void -ao_skytraq_sendbytes(__code uint8_t *b, uint8_t l) +ao_skytraq_sendbytes(const uint8_t *b, uint8_t l) { while (l--) { uint8_t c = *b++; @@ -462,7 +462,7 @@ ao_gps_nmea_parse(void) static uint8_t ao_gps_updating; void -ao_gps(void) __reentrant +ao_gps(void) { ao_gps_set_speed(AO_SERIAL_SPEED_9600); @@ -486,9 +486,9 @@ ao_gps(void) __reentrant } } -__xdata struct ao_task ao_gps_task; +struct ao_task ao_gps_task; -static __code uint8_t ao_gps_115200[] = { +static const uint8_t ao_gps_115200[] = { SKYTRAQ_MSG_3(5,0,5,0) /* Set to 115200 baud */ }; @@ -500,7 +500,7 @@ ao_gps_set_speed_delay(uint8_t speed) { } static void -gps_update(void) __reentrant +gps_update(void) { ao_gps_updating = 1; ao_task_minimize_latency = 1; @@ -517,7 +517,7 @@ gps_update(void) __reentrant ao_gps_putchar(ao_usb_getchar()); } -__code struct ao_cmds ao_gps_cmds[] = { +const struct ao_cmds ao_gps_cmds[] = { { ao_gps_show, "g\0Display GPS" }, { gps_update, "U\0Update GPS firmware" }, { 0, NULL }, diff --git a/src/drivers/ao_gps_ublox.c b/src/drivers/ao_gps_ublox.c index c720f802..f5268aa7 100644 --- a/src/drivers/ao_gps_ublox.c +++ b/src/drivers/ao_gps_ublox.c @@ -26,11 +26,11 @@ #include -__xdata uint8_t ao_gps_new; -__xdata uint8_t ao_gps_mutex; -__pdata uint16_t ao_gps_tick; -__xdata struct ao_telemetry_location ao_gps_data; -__xdata struct ao_telemetry_satellite ao_gps_tracking_data; +uint8_t ao_gps_new; +uint8_t ao_gps_mutex; +uint16_t ao_gps_tick; +struct ao_telemetry_location ao_gps_data; +struct ao_telemetry_satellite ao_gps_tracking_data; #undef AO_SERIAL_SPEED_UBLOX @@ -58,8 +58,8 @@ struct ao_ublox_cksum { uint8_t a, b; }; -static __pdata struct ao_ublox_cksum ao_ublox_cksum; -static __pdata uint16_t ao_ublox_len; +static struct ao_ublox_cksum ao_ublox_cksum; +static uint16_t ao_ublox_len; #if AO_UBLOX_DEBUG @@ -152,11 +152,11 @@ static uint8_t data_byte(void) return header_byte(); } -static char __xdata *ublox_target; +static char *ublox_target; static void ublox_u16(uint8_t offset) { - uint16_t __xdata *ptr = (uint16_t __xdata *) (void __xdata *) (ublox_target + offset); + uint16_t *ptr = (uint16_t *) (void *) (ublox_target + offset); uint16_t val; val = data_byte(); @@ -166,16 +166,16 @@ static void ublox_u16(uint8_t offset) static void ublox_u8(uint8_t offset) { - uint8_t __xdata *ptr = (uint8_t __xdata *) (ublox_target + offset); + uint8_t *ptr = (uint8_t *) (ublox_target + offset); uint8_t val; val = data_byte (); *ptr = val; } -static void ublox_u32(uint8_t offset) __reentrant +static void ublox_u32(uint8_t offset) { - uint32_t __xdata *ptr = (uint32_t __xdata *) (void __xdata *) (ublox_target + offset); + uint32_t *ptr = (uint32_t *) (void *) (ublox_target + offset); uint32_t val; val = ((uint32_t) data_byte ()); @@ -203,7 +203,7 @@ struct ublox_packet_parse { }; static void -ao_ublox_parse(void __xdata *target, const struct ublox_packet_parse *parse) __reentrant +ao_ublox_parse(void *target, const struct ublox_packet_parse *parse) { uint8_t i, offset; @@ -610,7 +610,7 @@ ao_gps_set_rate(uint8_t rate) } void -ao_gps(void) __reentrant +ao_gps(void) { uint8_t class, id; struct ao_ublox_cksum cksum; @@ -796,12 +796,12 @@ static void ao_gps_option(void) #define ao_gps_option ao_gps_show #endif -__code struct ao_cmds ao_gps_cmds[] = { +const struct ao_cmds ao_gps_cmds[] = { { ao_gps_option, "g\0Display GPS" }, { 0, NULL }, }; -__xdata struct ao_task ao_gps_task; +struct ao_task ao_gps_task; void ao_gps_init(void) diff --git a/src/drivers/ao_lcd.c b/src/drivers/ao_lcd.c index c35093bc..294361eb 100644 --- a/src/drivers/ao_lcd.c +++ b/src/drivers/ao_lcd.c @@ -20,7 +20,7 @@ static uint16_t ao_lcd_time = 3; -static __xdata uint8_t ao_lcd_mutex; +static uint8_t ao_lcd_mutex; static void ao_lcd_delay(void) diff --git a/src/drivers/ao_lco.c b/src/drivers/ao_lco.c index e892c8c0..86635200 100644 --- a/src/drivers/ao_lco.c +++ b/src/drivers/ao_lco.c @@ -324,7 +324,7 @@ ao_lco_set_debug(void) ao_lco_debug = ao_cmd_lex_i != 0; } -__code struct ao_cmds ao_lco_cmds[] = { +const struct ao_cmds ao_lco_cmds[] = { { ao_lco_set_debug, "D <0 off, 1 on>\0Debug" }, { ao_lco_search, "s\0Search for pad boxes" }, { 0, NULL } diff --git a/src/drivers/ao_lco_cmd.c b/src/drivers/ao_lco_cmd.c index dba9a76a..3fcdc859 100644 --- a/src/drivers/ao_lco_cmd.c +++ b/src/drivers/ao_lco_cmd.c @@ -26,12 +26,12 @@ #define HAS_STATIC_TEST 1 #endif -static __pdata uint16_t lco_box; -static __pdata uint8_t lco_channels; -static __pdata uint16_t tick_offset; +static uint16_t lco_box; +static uint8_t lco_channels; +static uint16_t tick_offset; static void -lco_args(void) __reentrant +lco_args(void) { ao_cmd_decimal(); lco_box = ao_cmd_lex_i; @@ -71,7 +71,7 @@ lco_ignite(uint8_t cmd) } static void -lco_report_cmd(void) __reentrant +lco_report_cmd(void) { int8_t r; uint8_t c; @@ -122,7 +122,7 @@ lco_report_cmd(void) __reentrant } static void -lco_fire_cmd(void) __reentrant +lco_fire_cmd(void) { uint8_t secs; uint8_t i; @@ -156,7 +156,7 @@ lco_fire_cmd(void) __reentrant #if HAS_STATIC_TEST static void -lco_static_cmd(void) __reentrant +lco_static_cmd(void) { uint8_t secs; uint8_t i; @@ -190,7 +190,7 @@ lco_static_cmd(void) __reentrant #endif static void -lco_arm_cmd(void) __reentrant +lco_arm_cmd(void) { uint8_t i; int8_t r; @@ -205,7 +205,7 @@ lco_arm_cmd(void) __reentrant } static void -lco_ignite_cmd(void) __reentrant +lco_ignite_cmd(void) { uint8_t i; lco_args(); @@ -216,13 +216,13 @@ lco_ignite_cmd(void) __reentrant #if HAS_STATIC_TEST static void -lco_endstatic_cmd(void) __reentrant +lco_endstatic_cmd(void) { lco_ignite(AO_PAD_ENDSTATIC); } #endif -static __code struct ao_cmds ao_lco_cmds[] = { +static const struct ao_cmds ao_lco_cmds[] = { { lco_report_cmd, "l \0Get remote status" }, { lco_fire_cmd, "F \0Fire remote igniters" }, #if HAS_STATIC_TEST diff --git a/src/drivers/ao_lco_func.c b/src/drivers/ao_lco_func.c index 92b344ed..06350694 100644 --- a/src/drivers/ao_lco_func.c +++ b/src/drivers/ao_lco_func.c @@ -21,8 +21,8 @@ #include #include -static __xdata struct ao_pad_command command; -static __xdata uint8_t ao_lco_mutex; +static struct ao_pad_command command; +static uint8_t ao_lco_mutex; int8_t ao_lco_query(uint16_t box, struct ao_pad_query *query, uint16_t *tick_offset) diff --git a/src/drivers/ao_lco_two.c b/src/drivers/ao_lco_two.c index 6f2d81ff..12c02e88 100644 --- a/src/drivers/ao_lco_two.c +++ b/src/drivers/ao_lco_two.c @@ -129,7 +129,7 @@ ao_lco_set_debug(void) ao_lco_debug = ao_cmd_lex_i; } -__code struct ao_cmds ao_lco_cmds[] = { +const struct ao_cmds ao_lco_cmds[] = { { ao_lco_set_debug, "D <0 off, 1 on>\0Debug" }, { 0, NULL } }; diff --git a/src/drivers/ao_m25.c b/src/drivers/ao_m25.c index b506b0a7..72617cc4 100644 --- a/src/drivers/ao_m25.c +++ b/src/drivers/ao_m25.c @@ -19,16 +19,16 @@ #include "ao.h" /* Total bytes of available storage */ -__pdata uint32_t ao_storage_total; +uint32_t ao_storage_total; /* Block size - device is erased in these units. At least 256 bytes */ -__pdata uint32_t ao_storage_block; +uint32_t ao_storage_block; /* Byte offset of config block. Will be ao_storage_block bytes long */ -__pdata uint32_t ao_storage_config; +uint32_t ao_storage_config; /* Storage unit size - device reads and writes must be within blocks of this size. Usually 256 bytes. */ -__pdata uint16_t ao_storage_unit; +uint16_t ao_storage_unit; #define M25_DEBUG 0 /* @@ -89,7 +89,7 @@ static uint8_t ao_m25_numchips; /* number of chips detected */ static uint8_t ao_m25_total; /* total sectors available */ static ao_port_t ao_m25_wip; /* write in progress */ -static __xdata uint8_t ao_m25_mutex; +static uint8_t ao_m25_mutex; /* * This little array is abused to send and receive data. A particular @@ -99,7 +99,7 @@ static __xdata uint8_t ao_m25_mutex; * of which touch those last three bytes. */ -static __xdata uint8_t ao_m25_instruction[4]; +static uint8_t ao_m25_instruction[4]; #define M25_SELECT(cs) ao_spi_get_mask(AO_M25_SPI_CS_PORT,cs,AO_M25_SPI_BUS, AO_SPI_SPEED_FAST) #define M25_DESELECT(cs) ao_spi_put_mask(AO_M25_SPI_CS_PORT,cs,AO_M25_SPI_BUS) @@ -239,7 +239,7 @@ ao_m25_scan(void) * Erase the specified sector */ uint8_t -ao_storage_erase(uint32_t pos) __reentrant +ao_storage_erase(uint32_t pos) { ao_port_t cs; @@ -267,7 +267,7 @@ ao_storage_erase(uint32_t pos) __reentrant * Write to flash */ uint8_t -ao_storage_device_write(uint32_t pos, __xdata void *d, uint16_t len) __reentrant +ao_storage_device_write(uint32_t pos, void *d, uint16_t len) { ao_port_t cs; @@ -294,7 +294,7 @@ ao_storage_device_write(uint32_t pos, __xdata void *d, uint16_t len) __reentrant * Read from flash */ uint8_t -ao_storage_device_read(uint32_t pos, __xdata void *d, uint16_t len) __reentrant +ao_storage_device_read(uint32_t pos, void *d, uint16_t len) { ao_port_t cs; @@ -317,7 +317,7 @@ ao_storage_device_read(uint32_t pos, __xdata void *d, uint16_t len) __reentrant } void -ao_storage_flush(void) __reentrant +ao_storage_flush(void) { } @@ -330,7 +330,7 @@ ao_storage_setup(void) } void -ao_storage_device_info(void) __reentrant +ao_storage_device_info(void) { #if M25_DEBUG ao_port_t cs; diff --git a/src/drivers/ao_mma655x.c b/src/drivers/ao_mma655x.c index 5d44bffd..a48c1db2 100644 --- a/src/drivers/ao_mma655x.c +++ b/src/drivers/ao_mma655x.c @@ -259,7 +259,7 @@ ao_mma655x_dump(void) printf ("MMA655X value %d\n", ao_mma655x_current); } -__code struct ao_cmds ao_mma655x_cmds[] = { +const struct ao_cmds ao_mma655x_cmds[] = { { ao_mma655x_dump, "A\0Display MMA655X data" }, { 0, NULL }, }; @@ -277,7 +277,7 @@ ao_mma655x(void) } } -static __xdata struct ao_task ao_mma655x_task; +static struct ao_task ao_mma655x_task; void ao_mma655x_init(void) diff --git a/src/drivers/ao_mr25.c b/src/drivers/ao_mr25.c index 2d355c9f..86dda22a 100644 --- a/src/drivers/ao_mr25.c +++ b/src/drivers/ao_mr25.c @@ -19,16 +19,16 @@ #include "ao.h" /* Total bytes of available storage */ -__pdata uint32_t ao_storage_total; +uint32_t ao_storage_total; /* Block size - device is erased in these units. At least 256 bytes */ -__pdata uint32_t ao_storage_block; +uint32_t ao_storage_block; /* Byte offset of config block. Will be ao_storage_block bytes long */ -__pdata uint32_t ao_storage_config; +uint32_t ao_storage_config; /* Storage unit size - device reads and writes must be within blocks of this size. Usually 256 bytes. */ -__pdata uint16_t ao_storage_unit; +uint16_t ao_storage_unit; /* * MRAM is entirely random access; no erase operations are required, @@ -51,7 +51,7 @@ __pdata uint16_t ao_storage_unit; #define MR25_STATUS_BP_SHIFT (2) #define MR25_STATUS_WEL (1 << 1) /* Write enable latch */ -static __xdata uint8_t ao_mr25_mutex; +static uint8_t ao_mr25_mutex; /* * This little array is abused to send and receive data. A particular @@ -61,7 +61,7 @@ static __xdata uint8_t ao_mr25_mutex; * those last three bytes. */ -static __xdata uint8_t ao_mr25_instruction[4]; +static uint8_t ao_mr25_instruction[4]; #define MR25_SELECT() ao_spi_get_mask(AO_MR25_SPI_CS_PORT,(1 << AO_MR25_SPI_CS_PIN),AO_MR25_SPI_BUS, AO_SPI_SPEED_FAST) #define MR25_DESELECT() ao_spi_put_mask(AO_MR25_SPI_CS_PORT,(1 << AO_MR25_SPI_CS_PIN),AO_MR25_SPI_BUS) @@ -93,7 +93,7 @@ ao_mr25_set_address(uint32_t pos) * Erase the specified sector (no-op for MRAM) */ uint8_t -ao_storage_erase(uint32_t pos) __reentrant +ao_storage_erase(uint32_t pos) { if (pos >= ao_storage_total || pos + ao_storage_block > ao_storage_total) return 0; @@ -104,7 +104,7 @@ ao_storage_erase(uint32_t pos) __reentrant * Write to flash */ uint8_t -ao_storage_device_write(uint32_t pos, __xdata void *d, uint16_t len) __reentrant +ao_storage_device_write(uint32_t pos, void *d, uint16_t len) { if (pos >= ao_storage_total || pos + len > ao_storage_total) return 0; @@ -128,7 +128,7 @@ ao_storage_device_write(uint32_t pos, __xdata void *d, uint16_t len) __reentrant * Read from flash */ uint8_t -ao_storage_device_read(uint32_t pos, __xdata void *d, uint16_t len) __reentrant +ao_storage_device_read(uint32_t pos, void *d, uint16_t len) { if (pos >= ao_storage_total || pos + len > ao_storage_total) return 0; @@ -147,7 +147,7 @@ ao_storage_device_read(uint32_t pos, __xdata void *d, uint16_t len) __reentrant } void -ao_storage_flush(void) __reentrant +ao_storage_flush(void) { } @@ -157,7 +157,7 @@ ao_storage_setup(void) } void -ao_storage_device_info(void) __reentrant +ao_storage_device_info(void) { printf ("Detected chips 1 size %d\n", ao_storage_total >> 8); } diff --git a/src/drivers/ao_ms5607.c b/src/drivers/ao_ms5607.c index 4bfc17db..a468fee3 100644 --- a/src/drivers/ao_ms5607.c +++ b/src/drivers/ao_ms5607.c @@ -22,8 +22,8 @@ #if HAS_MS5607 || HAS_MS5611 -__xdata struct ao_ms5607_prom ao_ms5607_prom; -static __xdata uint8_t ms5607_configured; +struct ao_ms5607_prom ao_ms5607_prom; +static uint8_t ms5607_configured; #ifndef AO_MS5607_SPI_SPEED #define AO_MS5607_SPI_SPEED AO_SPI_SPEED_FAST @@ -97,12 +97,12 @@ ao_ms5607_prom_valid(uint8_t *prom) } static void -ao_ms5607_prom_read(__xdata struct ao_ms5607_prom *prom) +ao_ms5607_prom_read(struct ao_ms5607_prom *prom) { uint8_t addr; uint16_t *r; - r = (__xdata uint16_t *) prom; + r = (uint16_t *) prom; for (addr = 0; addr < 8; addr++) { uint8_t cmd = AO_MS5607_PROM_READ(addr); ao_ms5607_start(); @@ -138,20 +138,20 @@ ao_ms5607_setup(void) ao_ms5607_prom_read(&ao_ms5607_prom); } -static __xdata volatile uint8_t ao_ms5607_done; +static volatile uint8_t ao_ms5607_done; static void ao_ms5607_isr(void) { ao_exti_disable(AO_MS5607_MISO_PORT, AO_MS5607_MISO_PIN); ao_ms5607_done = 1; - ao_wakeup((__xdata void *) &ao_ms5607_done); + ao_wakeup((void *) &ao_ms5607_done); } static uint32_t ao_ms5607_get_sample(uint8_t cmd) { - __xdata uint8_t reply[3]; - __xdata uint8_t read; + uint8_t reply[3]; + uint8_t read; ao_ms5607_done = 0; @@ -198,7 +198,7 @@ ao_ms5607_get_sample(uint8_t cmd) { #define AO_CONVERT_D2 token_evaluator(AO_MS5607_CONVERT_D2_, AO_MS5607_TEMP_OVERSAMPLE) void -ao_ms5607_sample(__xdata struct ao_ms5607_sample *sample) +ao_ms5607_sample(struct ao_ms5607_sample *sample) { sample->pres = ao_ms5607_get_sample(AO_CONVERT_D1); sample->temp = ao_ms5607_get_sample(AO_CONVERT_D2); @@ -214,7 +214,7 @@ ao_ms5607_sample(__xdata struct ao_ms5607_sample *sample) #define HAS_MS5607_TASK HAS_TASK #endif -__xdata struct ao_ms5607_sample ao_ms5607_current; +struct ao_ms5607_sample ao_ms5607_current; #if HAS_MS5607_TASK static void @@ -233,7 +233,7 @@ ao_ms5607(void) } } -__xdata struct ao_task ao_ms5607_task; +struct ao_task ao_ms5607_task; #endif #if HAS_TASK @@ -253,7 +253,7 @@ ao_ms5607_info(void) static void ao_ms5607_dump(void) { - __xdata struct ao_ms5607_value value; + struct ao_ms5607_value value; ao_ms5607_convert(&ao_ms5607_current, &value); printf ("Pressure: %8lu %8ld\n", ao_ms5607_current.pres, value.pres); @@ -261,7 +261,7 @@ ao_ms5607_dump(void) printf ("Altitude: %ld\n", ao_pa_to_altitude(value.pres)); } -__code struct ao_cmds ao_ms5607_cmds[] = { +const struct ao_cmds ao_ms5607_cmds[] = { { ao_ms5607_dump, "B\0Display MS5607 data" }, { 0, NULL }, }; diff --git a/src/drivers/ao_ms5607.h b/src/drivers/ao_ms5607.h index 18f99bf8..322cc468 100644 --- a/src/drivers/ao_ms5607.h +++ b/src/drivers/ao_ms5607.h @@ -57,8 +57,8 @@ struct ao_ms5607_value { int32_t temp; /* in °C * 100 */ }; -extern __xdata struct ao_ms5607_sample ao_ms5607_current; -extern __xdata struct ao_ms5607_prom ao_ms5607_prom; +extern struct ao_ms5607_sample ao_ms5607_current; +extern struct ao_ms5607_prom ao_ms5607_prom; void ao_ms5607_setup(void); @@ -70,10 +70,10 @@ void ao_ms5607_info(void); void -ao_ms5607_sample(__xdata struct ao_ms5607_sample *sample); +ao_ms5607_sample(struct ao_ms5607_sample *sample); void -ao_ms5607_convert(__xdata struct ao_ms5607_sample *sample, - __xdata struct ao_ms5607_value *value); +ao_ms5607_convert(struct ao_ms5607_sample *sample, + struct ao_ms5607_value *value); #endif /* _AO_MS5607_H_ */ diff --git a/src/drivers/ao_ms5607_convert_8051.c b/src/drivers/ao_ms5607_convert_8051.c index b7081107..e9052b41 100644 --- a/src/drivers/ao_ms5607_convert_8051.c +++ b/src/drivers/ao_ms5607_convert_8051.c @@ -32,8 +32,8 @@ #endif void -ao_ms5607_convert(__xdata struct ao_ms5607_sample *sample, - __xdata struct ao_ms5607_value *value) +ao_ms5607_convert(struct ao_ms5607_sample *sample, + struct ao_ms5607_value *value) { __LOCAL int32_t dT; __LOCAL int32_t TEMP; diff --git a/src/drivers/ao_packet.c b/src/drivers/ao_packet.c index 1c931921..b5a0a4b7 100644 --- a/src/drivers/ao_packet.c +++ b/src/drivers/ao_packet.c @@ -18,20 +18,20 @@ #include "ao.h" -__xdata struct ao_packet_recv ao_rx_packet; -__xdata struct ao_packet ao_tx_packet; -__pdata uint8_t ao_packet_rx_len, ao_packet_rx_used, ao_packet_tx_used; +struct ao_packet_recv ao_rx_packet; +struct ao_packet ao_tx_packet; +uint8_t ao_packet_rx_len, ao_packet_rx_used, ao_packet_tx_used; -static __xdata uint8_t tx_data[AO_PACKET_MAX]; -static __xdata uint8_t rx_data[AO_PACKET_MAX]; -static __pdata uint8_t rx_seq; +static uint8_t tx_data[AO_PACKET_MAX]; +static uint8_t rx_data[AO_PACKET_MAX]; +static uint8_t rx_seq; -__xdata struct ao_task ao_packet_task; -__xdata uint8_t ao_packet_enable; -__xdata uint8_t ao_packet_restart; +struct ao_task ao_packet_task; +uint8_t ao_packet_enable; +uint8_t ao_packet_restart; #if PACKET_HAS_MASTER -__xdata uint8_t ao_packet_master_sleeping; +uint8_t ao_packet_master_sleeping; #endif void @@ -150,7 +150,7 @@ ao_packet_flush(void) #endif /* PACKET_HAS_MASTER */ void -ao_packet_putchar(char c) __reentrant +ao_packet_putchar(char c) { /* No need to block interrupts, all variables here * are only manipulated in task context diff --git a/src/drivers/ao_packet_master.c b/src/drivers/ao_packet_master.c index e63771e5..68a5efef 100644 --- a/src/drivers/ao_packet_master.c +++ b/src/drivers/ao_packet_master.c @@ -39,7 +39,7 @@ ao_packet_getchar(void) } static void -ao_packet_echo(void) __reentrant +ao_packet_echo(void) { int c; while (ao_packet_enable) { @@ -50,9 +50,9 @@ ao_packet_echo(void) __reentrant ao_exit(); } -static __xdata struct ao_task ao_packet_echo_task; -static __xdata uint16_t ao_packet_master_delay; -static __xdata uint16_t ao_packet_master_time; +static struct ao_task ao_packet_echo_task; +static uint16_t ao_packet_master_delay; +static uint16_t ao_packet_master_time; #define AO_PACKET_MASTER_DELAY_SHORT AO_MS_TO_TICKS(100) #define AO_PACKET_MASTER_DELAY_LONG AO_MS_TO_TICKS(1000) @@ -114,7 +114,7 @@ ao_packet_master(void) } static void -ao_packet_forward(void) __reentrant +ao_packet_forward(void) { char c; ao_packet_enable = 1; @@ -152,7 +152,7 @@ ao_packet_signal(void) printf ("RSSI: %d\n", ao_radio_rssi); } -__code struct ao_cmds ao_packet_master_cmds[] = { +const struct ao_cmds ao_packet_master_cmds[] = { { ao_packet_forward, "p\0Remote packet link." }, { ao_packet_signal, "s\0Report signal strength." }, { 0, NULL }, diff --git a/src/drivers/ao_pad.c b/src/drivers/ao_pad.c index 208841fb..7e139c78 100644 --- a/src/drivers/ao_pad.c +++ b/src/drivers/ao_pad.c @@ -22,14 +22,14 @@ #include #include -static __xdata uint8_t ao_pad_ignite; -static __xdata struct ao_pad_command command; -static __xdata struct ao_pad_query query; -static __pdata uint8_t ao_pad_armed; -static __pdata uint16_t ao_pad_arm_time; -static __pdata uint8_t ao_pad_box; -static __xdata uint8_t ao_pad_disabled; -static __pdata uint16_t ao_pad_packet_time; +static uint8_t ao_pad_ignite; +static struct ao_pad_command command; +static struct ao_pad_query query; +static uint8_t ao_pad_armed; +static uint16_t ao_pad_arm_time; +static uint8_t ao_pad_box; +static uint8_t ao_pad_disabled; +static uint16_t ao_pad_packet_time; #ifndef AO_PAD_RSSI_MINIMUM #define AO_PAD_RSSI_MINIMUM -90 @@ -38,7 +38,7 @@ static __pdata uint16_t ao_pad_packet_time; #define DEBUG 1 #if DEBUG -static __pdata uint8_t ao_pad_debug; +static uint8_t ao_pad_debug; #define PRINTD(...) (ao_pad_debug ? (printf(__VA_ARGS__), 0) : 0) #define FLUSHD() (ao_pad_debug ? (flush(), 0) : 0) #else @@ -189,17 +189,17 @@ ao_pad_monitor(void) { uint8_t c; uint8_t sample; - __pdata AO_LED_TYPE prev = 0, cur = 0; - __pdata uint8_t beeping = 0; - __xdata volatile struct ao_data *packet; - __pdata uint16_t arm_beep_time = 0; + AO_LED_TYPE prev = 0, cur = 0; + uint8_t beeping = 0; + volatile struct ao_data *packet; + uint16_t arm_beep_time = 0; sample = ao_data_head; ao_led_set(LEDS_AVAILABLE); ao_delay(AO_MS_TO_TICKS(1000)); ao_led_set(0); for (;;) { - __pdata int16_t pyro; + int16_t pyro; ao_arch_critical( while (sample == ao_data_head) @@ -526,9 +526,9 @@ ao_pad_manual(void) } } -static __xdata struct ao_task ao_pad_task; -static __xdata struct ao_task ao_pad_ignite_task; -static __xdata struct ao_task ao_pad_monitor_task; +static struct ao_task ao_pad_task; +static struct ao_task ao_pad_ignite_task; +static struct ao_task ao_pad_monitor_task; #if DEBUG void @@ -560,7 +560,7 @@ ao_pad_alarm_debug(void) } #endif -__code struct ao_cmds ao_pad_cmds[] = { +const struct ao_cmds ao_pad_cmds[] = { { ao_pad_test, "t\0Test pad continuity" }, { ao_pad_manual, "i \0Fire igniter. is doit with D&I" }, #if DEBUG diff --git a/src/drivers/ao_pca9922.c b/src/drivers/ao_pca9922.c index 09f52a0e..3516f03a 100644 --- a/src/drivers/ao_pca9922.c +++ b/src/drivers/ao_pca9922.c @@ -23,7 +23,7 @@ #include -static __xdata uint8_t ao_led_state; +static uint8_t ao_led_state; static void ao_led_apply(void) @@ -93,7 +93,7 @@ ao_led_toggle(uint8_t colors) } void -ao_led_for(uint8_t colors, uint16_t ticks) __reentrant +ao_led_for(uint8_t colors, uint16_t ticks) { ao_led_on(colors); ao_delay(ticks); diff --git a/src/drivers/ao_pyro_slave.c b/src/drivers/ao_pyro_slave.c index a293d929..8ea6d858 100644 --- a/src/drivers/ao_pyro_slave.c +++ b/src/drivers/ao_pyro_slave.c @@ -33,7 +33,7 @@ static const struct ao_companion_setup ao_telepyro_setup = { struct ao_config ao_config; -extern volatile __data uint16_t ao_tick_count; +extern volatile uint16_t ao_tick_count; uint16_t ao_boost_tick; void ao_spi_slave(void) diff --git a/src/drivers/ao_quadrature.c b/src/drivers/ao_quadrature.c index 250e035f..20781c40 100644 --- a/src/drivers/ao_quadrature.c +++ b/src/drivers/ao_quadrature.c @@ -22,7 +22,7 @@ #include #include -__xdata int32_t ao_quadrature_count[AO_QUADRATURE_COUNT]; +int32_t ao_quadrature_count[AO_QUADRATURE_COUNT]; #ifndef AO_QUADRATURE_SINGLE_CODE static int8_t ao_quadrature_step[AO_QUADRATURE_COUNT]; #endif diff --git a/src/drivers/ao_quadrature.h b/src/drivers/ao_quadrature.h index a99e4cc5..ee551f65 100644 --- a/src/drivers/ao_quadrature.h +++ b/src/drivers/ao_quadrature.h @@ -19,7 +19,7 @@ #ifndef _AO_QUADRATURE_H_ #define _AO_QUADRATURE_H_ -extern __xdata int32_t ao_quadrature_count[AO_QUADRATURE_COUNT]; +extern int32_t ao_quadrature_count[AO_QUADRATURE_COUNT]; int32_t ao_quadrature_wait(uint8_t q); diff --git a/src/drivers/ao_radio_master.c b/src/drivers/ao_radio_master.c index 79e4b22b..8b62a4de 100644 --- a/src/drivers/ao_radio_master.c +++ b/src/drivers/ao_radio_master.c @@ -21,15 +21,15 @@ #include #include -static __xdata struct ao_radio_spi_reply ao_radio_spi_reply; -static __xdata struct ao_radio_spi_request ao_radio_spi_request; -static volatile __xdata uint8_t ao_radio_wait_mode; -static volatile __xdata uint8_t ao_radio_done = 0; -static volatile __xdata uint8_t ao_radio_ready = 1; -static __xdata uint8_t ao_radio_mutex; -static __xdata uint8_t ao_radio_aes_seq; +static struct ao_radio_spi_reply ao_radio_spi_reply; +static struct ao_radio_spi_request ao_radio_spi_request; +static volatile uint8_t ao_radio_wait_mode; +static volatile uint8_t ao_radio_done = 0; +static volatile uint8_t ao_radio_ready = 1; +static uint8_t ao_radio_mutex; +static uint8_t ao_radio_aes_seq; -__xdata int8_t ao_radio_cmac_rssi; +int8_t ao_radio_cmac_rssi; #if 0 #define PRINTD(...) do { printf ("\r%5u %s: ", ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } while(0) @@ -126,7 +126,7 @@ ao_radio_put(void) } static void -ao_radio_get_data(__xdata void *d, uint8_t size) +ao_radio_get_data(void *d, uint8_t size) { PRINTD ("fetch\n"); ao_radio_master_start(); @@ -157,7 +157,7 @@ ao_radio_send(const void *d, uint8_t size) uint8_t -ao_radio_recv(__xdata void *d, uint8_t size, uint8_t timeout) +ao_radio_recv(void *d, uint8_t size, uint8_t timeout) { int8_t ret; uint8_t recv; @@ -198,7 +198,7 @@ ao_radio_cmac_set_key(void) } int8_t -ao_radio_cmac_send(__xdata void *packet, uint8_t len) __reentrant +ao_radio_cmac_send(void *packet, uint8_t len) { if (len > AO_CMAC_MAX_LEN) return AO_RADIO_CMAC_LEN_ERROR; @@ -220,7 +220,7 @@ ao_radio_cmac_send(__xdata void *packet, uint8_t len) __reentrant } int8_t -ao_radio_cmac_recv(__xdata void *packet, uint8_t len, uint16_t timeout) __reentrant +ao_radio_cmac_recv(void *packet, uint8_t len, uint16_t timeout) { int8_t ret; int8_t recv; @@ -296,7 +296,7 @@ ao_radio_test_cmd(void) ao_radio_test(0); } -__code struct ao_cmds ao_radio_cmds[] = { +const struct ao_cmds ao_radio_cmds[] = { { ao_radio_test_cmd, "C <1 start, 0 stop, none both>\0Radio carrier test" }, { 0, NULL }, }; diff --git a/src/drivers/ao_radio_slave.c b/src/drivers/ao_radio_slave.c index 2f1dab29..7859d6b6 100644 --- a/src/drivers/ao_radio_slave.c +++ b/src/drivers/ao_radio_slave.c @@ -20,11 +20,11 @@ #include #include -static __xdata struct ao_radio_spi_reply ao_radio_spi_reply; +static struct ao_radio_spi_reply ao_radio_spi_reply; -static __xdata struct ao_radio_spi_request ao_radio_spi_request; +static struct ao_radio_spi_request ao_radio_spi_request; -static __xdata uint8_t slave_state; +static uint8_t slave_state; static void ao_radio_slave_low(void) @@ -123,7 +123,7 @@ ao_radio_slave_spi(void) } } -static __xdata struct ao_task ao_radio_slave_spi_task; +static struct ao_task ao_radio_slave_spi_task; void ao_radio_slave_init(void) diff --git a/src/drivers/ao_watchdog.c b/src/drivers/ao_watchdog.c index 1a877fcb..01c3cd0e 100644 --- a/src/drivers/ao_watchdog.c +++ b/src/drivers/ao_watchdog.c @@ -46,7 +46,7 @@ ao_watchdog_set(void) } -static __code struct ao_cmds ao_watchdog_cmds[] = { +static const struct ao_cmds ao_watchdog_cmds[] = { { ao_watchdog_set, "Q <0 off, 1 on>\0Enable or disable watchdog timer" }, { 0, NULL }, }; diff --git a/src/kernel/ao.h b/src/kernel/ao.h index 520f6ef2..fd1d1276 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -92,7 +92,7 @@ ao_panic(uint8_t reason); #define AO_TICK_SIGNED int16_t #endif -extern volatile __data AO_TICK_TYPE ao_tick_count; +extern volatile AO_TICK_TYPE ao_tick_count; /* Our timer runs at 100Hz */ #ifndef AO_HERTZ @@ -141,13 +141,13 @@ ao_clock_resume(void); #ifndef ao_mutex_get uint8_t -ao_mutex_try(__xdata uint8_t *ao_mutex, uint8_t task_id) __reentrant; +ao_mutex_try(uint8_t *ao_mutex, uint8_t task_id); void -ao_mutex_get(__xdata uint8_t *ao_mutex) __reentrant; +ao_mutex_get(uint8_t *ao_mutex); void -ao_mutex_put(__xdata uint8_t *ao_mutex) __reentrant; +ao_mutex_put(uint8_t *ao_mutex); #endif /* @@ -160,13 +160,13 @@ enum ao_cmd_status { ao_cmd_syntax_error = 2, }; -extern __pdata uint16_t ao_cmd_lex_i; -extern __pdata uint32_t ao_cmd_lex_u32; -extern __pdata char ao_cmd_lex_c; -extern __pdata enum ao_cmd_status ao_cmd_status; +extern uint16_t ao_cmd_lex_i; +extern uint32_t ao_cmd_lex_u32; +extern char ao_cmd_lex_c; +extern enum ao_cmd_status ao_cmd_status; void -ao_put_string(__code char *s); +ao_put_string(const char *s); void ao_cmd_readline(void); @@ -196,22 +196,22 @@ void ao_cmd_hex(void); void -ao_cmd_decimal(void) __reentrant; +ao_cmd_decimal(void); /* Read a single hex nibble off stdin. */ uint8_t ao_getnibble(void); uint8_t -ao_match_word(__code char *word); +ao_match_word(const char *word); struct ao_cmds { void (*func)(void); - __code char *help; + const char *help; }; void -ao_cmd_register(const __code struct ao_cmds *cmds); +ao_cmd_register(const struct ao_cmds *cmds); void ao_cmd_init(void); @@ -295,13 +295,13 @@ ao_report_init(void); #if HAS_BARO /* pressure from the sensor to altitude in meters */ alt_t -ao_pres_to_altitude(pres_t pres) __reentrant; +ao_pres_to_altitude(pres_t pres); pres_t -ao_altitude_to_pres(alt_t alt) __reentrant; +ao_altitude_to_pres(alt_t alt); int16_t -ao_temp_to_dC(int16_t temp) __reentrant; +ao_temp_to_dC(int16_t temp); #endif /* @@ -377,11 +377,11 @@ ao_spi_slave(void); #define AO_GPS_NEW_DATA 1 #define AO_GPS_NEW_TRACKING 2 -extern __xdata uint8_t ao_gps_new; -extern __pdata uint16_t ao_gps_tick; -extern __xdata uint8_t ao_gps_mutex; -extern __xdata struct ao_telemetry_location ao_gps_data; -extern __xdata struct ao_telemetry_satellite ao_gps_tracking_data; +extern uint8_t ao_gps_new; +extern uint16_t ao_gps_tick; +extern uint8_t ao_gps_mutex; +extern struct ao_telemetry_location ao_gps_data; +extern struct ao_telemetry_satellite ao_gps_tracking_data; struct ao_gps_orig { uint8_t year; @@ -421,13 +421,13 @@ void ao_gps(void); void -ao_gps_print(__xdata struct ao_gps_orig *gps_data); +ao_gps_print(struct ao_gps_orig *gps_data); void -ao_gps_tracking_print(__xdata struct ao_gps_tracking_orig *gps_tracking_data); +ao_gps_tracking_print(struct ao_gps_tracking_orig *gps_tracking_data); void -ao_gps_show(void) __reentrant; +ao_gps_show(void); void ao_gps_init(void); @@ -558,9 +558,9 @@ ao_telemetry_tiny_init(void); * ao_radio.c */ -extern __xdata uint8_t ao_radio_dma; +extern uint8_t ao_radio_dma; -extern __xdata int8_t ao_radio_rssi; +extern int8_t ao_radio_rssi; #ifdef PKT_APPEND_STATUS_1_CRC_OK #define AO_RADIO_STATUS_CRC_OK PKT_APPEND_STATUS_1_CRC_OK @@ -590,12 +590,12 @@ ao_radio_general_isr(void) ao_arch_interrupt(16); #if HAS_RADIO_XMIT void -ao_radio_send(const __xdata void *d, uint8_t size) __reentrant; +ao_radio_send(const void *d, uint8_t size); #endif #if HAS_RADIO_RECV uint8_t -ao_radio_recv(__xdata void *d, uint8_t size, uint8_t timeout) __reentrant; +ao_radio_recv(void *d, uint8_t size, uint8_t timeout); void ao_radio_recv_abort(void); @@ -673,14 +673,14 @@ union ao_monitor { #endif }; -extern __xdata union ao_monitor ao_monitor_ring[AO_MONITOR_RING]; +extern union ao_monitor ao_monitor_ring[AO_MONITOR_RING]; #define ao_monitor_ring_next(n) (((n) + 1) & (AO_MONITOR_RING - 1)) #define ao_monitor_ring_prev(n) (((n) - 1) & (AO_MONITOR_RING - 1)) -extern __xdata uint8_t ao_monitoring_mutex; -extern __data uint8_t ao_monitoring; -extern __data uint8_t ao_monitor_head; +extern uint8_t ao_monitoring_mutex; +extern uint8_t ao_monitoring; +extern uint8_t ao_monitor_head; void ao_monitor(void); @@ -698,7 +698,7 @@ void ao_monitor_enable(void); void -ao_monitor_init(void) __reentrant; +ao_monitor_init(void); #endif @@ -710,27 +710,27 @@ ao_monitor_init(void) __reentrant; struct ao_stdio { int (*_pollchar)(void); /* Called with interrupts blocked */ - void (*putchar)(char c) __reentrant; + void (*putchar)(char c); void (*flush)(void); uint8_t echo; }; -extern __xdata struct ao_stdio ao_stdios[]; -extern __pdata int8_t ao_cur_stdio; -extern __pdata int8_t ao_num_stdios; +extern struct ao_stdio ao_stdios[]; +extern int8_t ao_cur_stdio; +extern int8_t ao_num_stdios; void flush(void); -extern __xdata uint8_t ao_stdin_ready; +extern uint8_t ao_stdin_ready; uint8_t ao_echo(void); int8_t ao_add_stdio(int (*pollchar)(void), - void (*putchar)(char) __reentrant, - void (*flush)(void)) __reentrant; + void (*putchar)(char) , + void (*flush)(void)); /* * ao_ignite.c @@ -757,14 +757,14 @@ struct ao_ignition { uint8_t firing; }; -extern __code char * __code ao_igniter_status_names[]; +extern const char * const ao_igniter_status_names[]; -extern __xdata struct ao_ignition ao_ignition[2]; +extern struct ao_ignition ao_ignition[2]; enum ao_igniter_status ao_igniter_status(enum ao_igniter igniter); -extern __pdata uint8_t ao_igniter_present; +extern uint8_t ao_igniter_present; void ao_ignite_set_pins(void); @@ -785,7 +785,7 @@ ao_igniter_init(void); /* * Set this to force the frequency to 434.550MHz */ -extern __xdata uint8_t ao_force_freq; +extern uint8_t ao_force_freq; #endif /* @@ -885,8 +885,8 @@ union ao_log_single { uint8_t bytes[AO_LOG_SINGLE_SIZE]; }; -extern __xdata union ao_log_single ao_log_single_write_data; -extern __xdata union ao_log_single ao_log_single_read_data; +extern union ao_log_single ao_log_single_write_data; +extern union ao_log_single ao_log_single_read_data; void ao_log_single_extra_query(void); @@ -969,7 +969,7 @@ ao_sqrt(uint32_t op); * ao_freq.c */ -int32_t ao_freq_to_set(int32_t freq, int32_t cal) __reentrant; +int32_t ao_freq_to_set(int32_t freq, int32_t cal); /* * ao_ms5607.c diff --git a/src/kernel/ao_aes.h b/src/kernel/ao_aes.h index 5ae98424..f41b2e87 100644 --- a/src/kernel/ao_aes.h +++ b/src/kernel/ao_aes.h @@ -21,7 +21,7 @@ /* ao_aes.c */ -extern __xdata uint8_t ao_aes_mutex; +extern uint8_t ao_aes_mutex; /* AES keys and blocks are 128 bits */ @@ -40,14 +40,14 @@ void ao_aes_set_mode(enum ao_aes_mode mode); void -ao_aes_set_key(__xdata uint8_t *in); +ao_aes_set_key(uint8_t *in); void ao_aes_zero_iv(void); void -ao_aes_run(__xdata uint8_t *in, - __xdata uint8_t *out); +ao_aes_run(uint8_t *in, + uint8_t *out); void ao_aes_init(void); diff --git a/src/kernel/ao_balloon.c b/src/kernel/ao_balloon.c index d0f80a5d..a5be8c16 100644 --- a/src/kernel/ao_balloon.c +++ b/src/kernel/ao_balloon.c @@ -34,16 +34,16 @@ #if HAS_SENSOR_ERRORS /* Any sensor can set this to mark the flight computer as 'broken' */ -__xdata uint8_t ao_sensor_errors; +uint8_t ao_sensor_errors; #endif -__pdata uint16_t ao_motor_number; /* number of motors burned so far */ +uint16_t ao_motor_number; /* number of motors burned so far */ /* Main flight thread. */ -__pdata enum ao_flight_state ao_flight_state; /* current flight state */ +enum ao_flight_state ao_flight_state; /* current flight state */ -__pdata uint8_t ao_flight_force_idle; +uint8_t ao_flight_force_idle; void ao_flight(void) @@ -127,7 +127,7 @@ ao_flight(void) } } -static __xdata struct ao_task flight_task; +static struct ao_task flight_task; void ao_flight_init(void) diff --git a/src/kernel/ao_beep.h b/src/kernel/ao_beep.h index 1306af62..fdc150f1 100644 --- a/src/kernel/ao_beep.h +++ b/src/kernel/ao_beep.h @@ -85,7 +85,7 @@ ao_beep(uint8_t beep); /* Turn on the beeper for the specified time */ void -ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant; +ao_beep_for(uint8_t beep, uint16_t ticks); /* Initialize the beeper */ void diff --git a/src/kernel/ao_cmd.c b/src/kernel/ao_cmd.c index 7bb4654e..d28db5b7 100644 --- a/src/kernel/ao_cmd.c +++ b/src/kernel/ao_cmd.c @@ -19,10 +19,10 @@ #include "ao.h" #include "ao_task.h" -__pdata uint16_t ao_cmd_lex_i; -__pdata uint32_t ao_cmd_lex_u32; -__pdata char ao_cmd_lex_c; -__pdata enum ao_cmd_status ao_cmd_status; +uint16_t ao_cmd_lex_i; +uint32_t ao_cmd_lex_u32; +char ao_cmd_lex_c; +enum ao_cmd_status ao_cmd_status; #ifndef AO_CMD_LEN #if AO_PYRO_NUM @@ -32,12 +32,12 @@ __pdata enum ao_cmd_status ao_cmd_status; #endif #endif -static __xdata char cmd_line[AO_CMD_LEN]; -static __pdata uint8_t cmd_len; -static __pdata uint8_t cmd_i; +static char cmd_line[AO_CMD_LEN]; +static uint8_t cmd_len; +static uint8_t cmd_i; void -ao_put_string(__code char *s) +ao_put_string(const char *s) { char c; while ((c = *s++)) @@ -196,7 +196,7 @@ ao_cmd_hexbyte(void) void ao_cmd_hex(void) { - __pdata uint8_t r = ao_cmd_lex_error; + uint8_t r = ao_cmd_lex_error; int8_t n; ao_cmd_lex_i = 0; @@ -214,7 +214,7 @@ ao_cmd_hex(void) } void -ao_cmd_decimal(void) __reentrant +ao_cmd_decimal(void) { uint8_t r = ao_cmd_lex_error; @@ -234,7 +234,7 @@ ao_cmd_decimal(void) __reentrant } uint8_t -ao_match_word(__code char *word) +ao_match_word(const char *word) { while (*word) { if (ao_cmd_lex_c != *word) { @@ -321,16 +321,16 @@ version(void) #define NUM_CMDS 11 #endif -static __code struct ao_cmds *__xdata (ao_cmds[NUM_CMDS]); -static __pdata uint8_t ao_ncmds; +static const struct ao_cmds *(ao_cmds[NUM_CMDS]); +static uint8_t ao_ncmds; static void help(void) { - __pdata uint8_t cmds; - __pdata uint8_t cmd; - __code struct ao_cmds * __pdata cs; - __code const char *h; + uint8_t cmds; + uint8_t cmd; + const struct ao_cmds * cs; + const char *h; uint8_t e; for (cmds = 0; cmds < ao_ncmds; cmds++) { @@ -363,7 +363,7 @@ report(void) } void -ao_cmd_register(__code struct ao_cmds *cmds) +ao_cmd_register(const struct ao_cmds *cmds) { if (ao_ncmds >= NUM_CMDS) ao_panic(AO_PANIC_CMD); @@ -373,10 +373,10 @@ ao_cmd_register(__code struct ao_cmds *cmds) void ao_cmd(void) { - __pdata char c; + char c; uint8_t cmd, cmds; - __code struct ao_cmds * __xdata cs; - void (*__xdata func)(void); + const struct ao_cmds * cs; + void (*func)(void); for (;;) { ao_cmd_readline(); @@ -424,10 +424,10 @@ ao_loader(void) #endif #if HAS_TASK -__xdata struct ao_task ao_cmd_task; +struct ao_task ao_cmd_task; #endif -__code struct ao_cmds ao_base_cmds[] = { +const struct ao_cmds ao_base_cmds[] = { { help, "?\0Help" }, #if HAS_TASK_INFO && HAS_TASK { ao_task_info, "T\0Tasks" }, diff --git a/src/kernel/ao_companion.h b/src/kernel/ao_companion.h index 4c161455..bd702fe3 100644 --- a/src/kernel/ao_companion.h +++ b/src/kernel/ao_companion.h @@ -44,11 +44,11 @@ struct ao_companion_setup { uint8_t channels; }; -extern __pdata uint8_t ao_companion_running; -extern __xdata uint8_t ao_companion_mutex; -extern __xdata struct ao_companion_command ao_companion_command; -extern __xdata struct ao_companion_setup ao_companion_setup; -extern __xdata uint16_t ao_companion_data[AO_COMPANION_MAX_CHANNELS]; +extern uint8_t ao_companion_running; +extern uint8_t ao_companion_mutex; +extern struct ao_companion_command ao_companion_command; +extern struct ao_companion_setup ao_companion_setup; +extern uint16_t ao_companion_data[AO_COMPANION_MAX_CHANNELS]; void ao_companion_init(void); diff --git a/src/kernel/ao_config.c b/src/kernel/ao_config.c index 10a67116..277dddd9 100644 --- a/src/kernel/ao_config.c +++ b/src/kernel/ao_config.c @@ -30,13 +30,13 @@ #include #endif -__xdata struct ao_config ao_config; -__pdata uint8_t ao_config_loaded; -__pdata uint8_t ao_config_dirty; -__xdata uint8_t ao_config_mutex; +struct ao_config ao_config; +uint8_t ao_config_loaded; +uint8_t ao_config_dirty; +uint8_t ao_config_mutex; #if HAS_FORCE_FREQ -__xdata uint8_t ao_force_freq; +uint8_t ao_force_freq; #endif #ifndef AO_CONFIG_DEFAULT_APRS_INTERVAL @@ -100,7 +100,7 @@ ao_config_put(void) #if HAS_RADIO #if HAS_RADIO_FORWARD -__xdata uint32_t ao_send_radio_setting; +uint32_t ao_send_radio_setting; #endif void @@ -283,10 +283,10 @@ ao_config_callsign_show(void) } void -ao_config_callsign_set(void) __reentrant +ao_config_callsign_set(void) { uint8_t c; - static __xdata char callsign[AO_MAX_CALLSIGN + 1]; + static char callsign[AO_MAX_CALLSIGN + 1]; ao_xmemset(callsign, '\0', sizeof callsign); ao_cmd_white(); @@ -309,14 +309,14 @@ ao_config_callsign_set(void) __reentrant #if HAS_RADIO void -ao_config_frequency_show(void) __reentrant +ao_config_frequency_show(void) { printf("Frequency: %ld\n", ao_config.frequency); } void -ao_config_frequency_set(void) __reentrant +ao_config_frequency_set(void) { ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) @@ -334,14 +334,14 @@ ao_config_frequency_set(void) __reentrant #if HAS_RADIO_FORWARD void -ao_config_send_frequency_show(void) __reentrant +ao_config_send_frequency_show(void) { printf("Send frequency: %ld\n", ao_config.send_frequency); } void -ao_config_send_frequency_set(void) __reentrant +ao_config_send_frequency_set(void) { ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) @@ -360,14 +360,14 @@ ao_config_send_frequency_set(void) __reentrant #if HAS_FLIGHT void -ao_config_main_deploy_show(void) __reentrant +ao_config_main_deploy_show(void) { printf("Main deploy: %d meters\n", ao_config.main_deploy); } void -ao_config_main_deploy_set(void) __reentrant +ao_config_main_deploy_set(void) { ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) @@ -379,7 +379,7 @@ ao_config_main_deploy_set(void) __reentrant #if HAS_ACCEL void -ao_config_accel_calibrate_show(void) __reentrant +ao_config_accel_calibrate_show(void) { printf("Accel cal +1g: %d -1g: %d\n", ao_config.accel_plus_g, ao_config.accel_minus_g); @@ -401,7 +401,7 @@ static int16_t accel_cal_through; #endif static int16_t -ao_config_accel_calibrate_auto(char *orientation) __reentrant +ao_config_accel_calibrate_auto(char *orientation) { uint16_t i; int32_t accel_total; @@ -442,7 +442,7 @@ ao_config_accel_calibrate_auto(char *orientation) __reentrant } void -ao_config_accel_calibrate_set(void) __reentrant +ao_config_accel_calibrate_set(void) { int16_t up, down; #if HAS_GYRO @@ -494,14 +494,14 @@ ao_config_accel_calibrate_set(void) __reentrant #endif /* HAS_ACCEL */ void -ao_config_apogee_delay_show(void) __reentrant +ao_config_apogee_delay_show(void) { printf("Apogee delay: %d seconds\n", ao_config.apogee_delay); } void -ao_config_apogee_delay_set(void) __reentrant +ao_config_apogee_delay_set(void) { ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) @@ -512,14 +512,14 @@ ao_config_apogee_delay_set(void) __reentrant } void -ao_config_apogee_lockout_show(void) __reentrant +ao_config_apogee_lockout_show(void) { printf ("Apogee lockout: %d seconds\n", ao_config.apogee_lockout); } void -ao_config_apogee_lockout_set(void) __reentrant +ao_config_apogee_lockout_set(void) { ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) @@ -533,13 +533,13 @@ ao_config_apogee_lockout_set(void) __reentrant #if HAS_RADIO void -ao_config_radio_cal_show(void) __reentrant +ao_config_radio_cal_show(void) { printf("Radio cal: %ld\n", ao_config.radio_cal); } void -ao_config_radio_cal_set(void) __reentrant +ao_config_radio_cal_set(void) { ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) @@ -558,13 +558,13 @@ ao_config_radio_cal_set(void) __reentrant #endif void -ao_config_radio_rate_show(void) __reentrant +ao_config_radio_rate_show(void) { printf("Telemetry rate: %d\n", ao_config.radio_rate); } void -ao_config_radio_rate_set(void) __reentrant +ao_config_radio_rate_set(void) { ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) @@ -588,7 +588,7 @@ ao_config_radio_rate_set(void) __reentrant #if HAS_LOG void -ao_config_log_show(void) __reentrant +ao_config_log_show(void) { printf("Max flight log: %d kB\n", (int16_t) (ao_config.flight_log_max >> 10)); #if FLIGHT_LOG_APPEND @@ -611,7 +611,7 @@ ao_config_log_fix_append(void) #endif void -ao_config_log_set(void) __reentrant +ao_config_log_set(void) { #if FLIGHT_LOG_APPEND printf("Flight log fixed size %d kB\n", ao_storage_log_max >> 10); @@ -639,13 +639,13 @@ ao_config_log_set(void) __reentrant #if HAS_IGNITE void -ao_config_ignite_mode_show(void) __reentrant +ao_config_ignite_mode_show(void) { printf("Ignite mode: %d\n", ao_config.ignite_mode); } void -ao_config_ignite_mode_set(void) __reentrant +ao_config_ignite_mode_set(void) { ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) @@ -658,7 +658,7 @@ ao_config_ignite_mode_set(void) __reentrant #if HAS_ACCEL void -ao_config_pad_orientation_show(void) __reentrant +ao_config_pad_orientation_show(void) { printf("Pad orientation: %d\n", ao_config.pad_orientation); } @@ -668,7 +668,7 @@ ao_config_pad_orientation_show(void) __reentrant #endif void -ao_config_pad_orientation_set(void) __reentrant +ao_config_pad_orientation_set(void) { ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) @@ -688,13 +688,13 @@ ao_config_pad_orientation_set(void) __reentrant #if HAS_RADIO void -ao_config_radio_enable_show(void) __reentrant +ao_config_radio_enable_show(void) { printf("Radio enable: %d\n", ao_config.radio_enable); } void -ao_config_radio_enable_set(void) __reentrant +ao_config_radio_enable_set(void) { ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) @@ -710,10 +710,10 @@ ao_config_radio_enable_set(void) __reentrant #if HAS_AES -__xdata uint8_t ao_config_aes_seq = 1; +uint8_t ao_config_aes_seq = 1; void -ao_config_key_show(void) __reentrant +ao_config_key_show(void) { uint8_t i; printf("AES key: "); @@ -723,7 +723,7 @@ ao_config_key_show(void) __reentrant } void -ao_config_key_set(void) __reentrant +ao_config_key_set(void) { uint8_t i; @@ -950,23 +950,23 @@ ao_config_pad_idle_set(void) #endif struct ao_config_var { - __code char *str; - void (*set)(void) __reentrant; - void (*show)(void) __reentrant; + const char *str; + void (*set)(void); + void (*show)(void); }; static void -ao_config_help(void) __reentrant; +ao_config_help(void); static void -ao_config_show(void) __reentrant; +ao_config_show(void); #if HAS_EEPROM static void -ao_config_save(void) __reentrant; +ao_config_save(void); #endif -__code struct ao_config_var ao_config_vars[] = { +const struct ao_config_var ao_config_vars[] = { #if HAS_FLIGHT { "m \0Main deploy (m)", ao_config_main_deploy_set, ao_config_main_deploy_show, }, @@ -1078,7 +1078,7 @@ ao_config_set(void) } static void -ao_config_help(void) __reentrant +ao_config_help(void) { uint8_t cmd; for (cmd = 0; ao_config_vars[cmd].str != NULL; cmd++) @@ -1089,7 +1089,7 @@ ao_config_help(void) __reentrant } static void -ao_config_show(void) __reentrant +ao_config_show(void) { uint8_t cmd; ao_config_get(); @@ -1105,7 +1105,7 @@ ao_config_show(void) __reentrant #if HAS_EEPROM static void -ao_config_save(void) __reentrant +ao_config_save(void) { uint8_t saved = 0; ao_mutex_get(&ao_config_mutex); @@ -1122,7 +1122,7 @@ ao_config_save(void) __reentrant } #endif -__code struct ao_cmds ao_config_cmds[] = { +const struct ao_cmds ao_config_cmds[] = { { ao_config_set, "c \0Set config (? for help, s to show)" }, { 0, NULL }, }; diff --git a/src/kernel/ao_config.h b/src/kernel/ao_config.h index f730c73c..41aafcca 100644 --- a/src/kernel/ao_config.h +++ b/src/kernel/ao_config.h @@ -62,7 +62,7 @@ #define AO_AES_LEN 16 -extern __xdata uint8_t ao_config_aes_seq; +extern uint8_t ao_config_aes_seq; struct ao_config { uint8_t major; @@ -130,7 +130,7 @@ struct ao_config { #define AO_CONFIG_DEFAULT_APRS_FORMAT AO_APRS_FORMAT_COMPRESSED #if HAS_RADIO_FORWARD -extern __xdata uint32_t ao_send_radio_setting; +extern uint32_t ao_send_radio_setting; #endif #define AO_IGNITE_MODE_DUAL 0 @@ -151,8 +151,8 @@ extern __xdata uint32_t ao_send_radio_setting; /* Make sure AO_CONFIG_MAX_SIZE is big enough */ typedef uint8_t config_check_space[(int) (AO_CONFIG_MAX_SIZE - sizeof (struct ao_config))]; -extern __xdata struct ao_config ao_config; -extern __pdata uint8_t ao_config_loaded; +extern struct ao_config ao_config; +extern uint8_t ao_config_loaded; void _ao_config_edit_start(void); diff --git a/src/kernel/ao_convert.c b/src/kernel/ao_convert.c index 1cd62345..f3e523ec 100644 --- a/src/kernel/ao_convert.c +++ b/src/kernel/ao_convert.c @@ -30,7 +30,7 @@ static const ao_v_t altitude_table[] = { #define ALT_FRAC_MASK (ALT_FRAC_SCALE - 1) ao_v_t -ao_pres_to_altitude(int16_t pres) __reentrant +ao_pres_to_altitude(int16_t pres) { uint8_t o; int16_t part; @@ -46,7 +46,7 @@ ao_pres_to_altitude(int16_t pres) __reentrant #if AO_NEED_ALTITUDE_TO_PRES int16_t -ao_altitude_to_pres(ao_v_t alt) __reentrant +ao_altitude_to_pres(ao_v_t alt) { ao_v_t span, sub_span; uint8_t l, h, m; @@ -74,7 +74,7 @@ ao_altitude_to_pres(ao_v_t alt) __reentrant #if 0 int16_t -ao_temp_to_dC(int16_t temp) __reentrant +ao_temp_to_dC(int16_t temp) { int16_t ret; diff --git a/src/kernel/ao_data.c b/src/kernel/ao_data.c index 35d42b8f..536ffa2b 100644 --- a/src/kernel/ao_data.c +++ b/src/kernel/ao_data.c @@ -19,13 +19,13 @@ #include #include -volatile __xdata struct ao_data ao_data_ring[AO_DATA_RING]; -volatile __data uint8_t ao_data_head; -volatile __data uint8_t ao_data_present; +volatile struct ao_data ao_data_ring[AO_DATA_RING]; +volatile uint8_t ao_data_head; +volatile uint8_t ao_data_present; #ifndef ao_data_count void -ao_data_get(__xdata struct ao_data *packet) +ao_data_get(struct ao_data *packet) { #if HAS_FLIGHT uint8_t i = ao_data_ring_prev(ao_sample_data); diff --git a/src/kernel/ao_data.h b/src/kernel/ao_data.h index 30616ef0..f88b30c9 100644 --- a/src/kernel/ao_data.h +++ b/src/kernel/ao_data.h @@ -97,12 +97,12 @@ struct ao_data { /* Get a copy of the last complete sample set */ void -ao_data_get(__xdata struct ao_data *packet); +ao_data_get(struct ao_data *packet); -extern volatile __xdata struct ao_data ao_data_ring[AO_DATA_RING]; -extern volatile __data uint8_t ao_data_head; -extern volatile __data uint8_t ao_data_present; -extern volatile __data uint8_t ao_data_count; +extern volatile struct ao_data ao_data_ring[AO_DATA_RING]; +extern volatile uint8_t ao_data_head; +extern volatile uint8_t ao_data_present; +extern volatile uint8_t ao_data_count; /* * Mark a section of data as ready, check for data complete diff --git a/src/kernel/ao_ee_fake.c b/src/kernel/ao_ee_fake.c index 84c13000..cef0a438 100644 --- a/src/kernel/ao_ee_fake.c +++ b/src/kernel/ao_ee_fake.c @@ -23,7 +23,7 @@ * wants to call these functions */ uint8_t -ao_ee_write_config(uint8_t *buf, uint16_t len) __reentrant +ao_ee_write_config(uint8_t *buf, uint16_t len) { (void) buf; (void) len; @@ -31,7 +31,7 @@ ao_ee_write_config(uint8_t *buf, uint16_t len) __reentrant } uint8_t -ao_ee_read_config(uint8_t *buf, uint16_t len) __reentrant +ao_ee_read_config(uint8_t *buf, uint16_t len) { ao_xmemset(buf, '\0', len); return 1; diff --git a/src/kernel/ao_eeprom.h b/src/kernel/ao_eeprom.h index bd8b6725..f258c48c 100644 --- a/src/kernel/ao_eeprom.h +++ b/src/kernel/ao_eeprom.h @@ -26,13 +26,13 @@ extern const ao_pos_t ao_eeprom_total; */ uint8_t -ao_eeprom_write(ao_pos_t pos32, __xdata void *v, uint16_t len); +ao_eeprom_write(ao_pos_t pos32, void *v, uint16_t len); /* * Read from eeprom */ uint8_t -ao_eeprom_read(ao_pos_t pos, __xdata void *v, uint16_t len); +ao_eeprom_read(ao_pos_t pos, void *v, uint16_t len); /* * Initialize eeprom diff --git a/src/kernel/ao_flight.c b/src/kernel/ao_flight.c index 170396ff..f72efa06 100644 --- a/src/kernel/ao_flight.c +++ b/src/kernel/ao_flight.c @@ -47,28 +47,28 @@ /* Main flight thread. */ -__pdata enum ao_flight_state ao_flight_state; /* current flight state */ -__pdata uint16_t ao_boost_tick; /* time of most recent boost detect */ -__pdata uint16_t ao_launch_tick; /* time of first boost detect */ -__pdata uint16_t ao_motor_number; /* number of motors burned so far */ +enum ao_flight_state ao_flight_state; /* current flight state */ +uint16_t ao_boost_tick; /* time of most recent boost detect */ +uint16_t ao_launch_tick; /* time of first boost detect */ +uint16_t ao_motor_number; /* number of motors burned so far */ #if HAS_SENSOR_ERRORS /* Any sensor can set this to mark the flight computer as 'broken' */ -__xdata uint8_t ao_sensor_errors; +uint8_t ao_sensor_errors; #endif /* * track min/max data over a long interval to detect * resting */ -static __data uint16_t ao_interval_end; -static __data ao_v_t ao_interval_min_height; -static __data ao_v_t ao_interval_max_height; +static uint16_t ao_interval_end; +static ao_v_t ao_interval_min_height; +static ao_v_t ao_interval_max_height; #if HAS_ACCEL -static __data ao_v_t ao_coast_avg_accel; +static ao_v_t ao_coast_avg_accel; #endif -__pdata uint8_t ao_flight_force_idle; +uint8_t ao_flight_force_idle; /* We also have a clock, which can be used to sanity check things in * case of other failures @@ -463,7 +463,7 @@ ao_orient_test_select(void) ao_orient_test = !ao_orient_test; } -__code struct ao_cmds ao_flight_cmds[] = { +const struct ao_cmds ao_flight_cmds[] = { { ao_flight_dump, "F\0Dump flight status" }, { ao_gyro_test, "G\0Test gyro code" }, { ao_orient_test_select,"O\0Test orientation code" }, @@ -471,7 +471,7 @@ __code struct ao_cmds ao_flight_cmds[] = { }; #endif -static __xdata struct ao_task flight_task; +static struct ao_task flight_task; void ao_flight_init(void) diff --git a/src/kernel/ao_flight.h b/src/kernel/ao_flight.h index 005c7e84..af6b0c55 100644 --- a/src/kernel/ao_flight.h +++ b/src/kernel/ao_flight.h @@ -38,21 +38,21 @@ enum ao_flight_state { ao_flight_test = 10 }; -extern __pdata enum ao_flight_state ao_flight_state; -extern __pdata uint16_t ao_boost_tick; -extern __pdata uint16_t ao_launch_tick; -extern __pdata uint16_t ao_motor_number; +extern enum ao_flight_state ao_flight_state; +extern uint16_t ao_boost_tick; +extern uint16_t ao_launch_tick; +extern uint16_t ao_motor_number; #if HAS_IMU || HAS_MMA655X #define HAS_SENSOR_ERRORS 1 #endif #if HAS_SENSOR_ERRORS -extern __xdata uint8_t ao_sensor_errors; +extern uint8_t ao_sensor_errors; #endif -extern __pdata uint16_t ao_launch_time; -extern __pdata uint8_t ao_flight_force_idle; +extern uint16_t ao_launch_time; +extern uint8_t ao_flight_force_idle; /* Flight thread */ void diff --git a/src/kernel/ao_flight_nano.c b/src/kernel/ao_flight_nano.c index 797ea344..96d47fac 100644 --- a/src/kernel/ao_flight_nano.c +++ b/src/kernel/ao_flight_nano.c @@ -20,18 +20,18 @@ /* Main flight thread. */ -__pdata enum ao_flight_state ao_flight_state; /* current flight state */ -__pdata uint16_t ao_launch_tick; /* time of launch detect */ +enum ao_flight_state ao_flight_state; /* current flight state */ +uint16_t ao_launch_tick; /* time of launch detect */ /* * track min/max data over a long interval to detect * resting */ -__pdata uint16_t ao_interval_end; -__pdata alt_t ao_interval_min_height; -__pdata alt_t ao_interval_max_height; +uint16_t ao_interval_end; +alt_t ao_interval_min_height; +alt_t ao_interval_max_height; -__pdata uint8_t ao_flight_force_idle; +uint8_t ao_flight_force_idle; /* Landing is detected by getting constant readings from both pressure and accelerometer * for a fairly long time (AO_INTERVAL_TICKS) @@ -111,7 +111,7 @@ ao_flight_nano(void) } } -static __xdata struct ao_task flight_task; +static struct ao_task flight_task; void ao_flight_nano_init(void) diff --git a/src/kernel/ao_forward.c b/src/kernel/ao_forward.c index b1ab3f54..6f664b60 100644 --- a/src/kernel/ao_forward.c +++ b/src/kernel/ao_forward.c @@ -23,7 +23,7 @@ static void ao_monitor_forward(void) { uint32_t recv_radio_setting; - static __xdata struct ao_telemetry_all_recv packet; + static struct ao_telemetry_all_recv packet; for (;;) { while (ao_monitoring) @@ -40,10 +40,10 @@ ao_monitor_forward(void) } } -static __xdata struct ao_task ao_monitor_forward_task; +static struct ao_task ao_monitor_forward_task; void -ao_monitor_forward_init(void) __reentrant +ao_monitor_forward_init(void) { ao_add_task(&ao_monitor_forward_task, ao_monitor_forward, "monitor_forward"); } diff --git a/src/kernel/ao_forward.h b/src/kernel/ao_forward.h index 2fe28f66..5b21bf3c 100644 --- a/src/kernel/ao_forward.h +++ b/src/kernel/ao_forward.h @@ -20,6 +20,6 @@ #define _AO_FORWARD_H_ void -ao_monitor_forward_init(void) __reentrant; +ao_monitor_forward_init(void); #endif /* _AO_FORWARD_H_ */ diff --git a/src/kernel/ao_freq.c b/src/kernel/ao_freq.c index 6478dae2..81640ce8 100644 --- a/src/kernel/ao_freq.c +++ b/src/kernel/ao_freq.c @@ -26,11 +26,11 @@ * frequency, and updating the radio setting along the way */ -int32_t ao_freq_to_set(int32_t freq, int32_t cal) __reentrant +int32_t ao_freq_to_set(int32_t freq, int32_t cal) { - static __pdata int32_t set; - static __pdata uint8_t neg; - static __pdata int32_t error; + static int32_t set; + static uint8_t neg; + static int32_t error; set = 0; neg = 0; diff --git a/src/kernel/ao_gps_print.c b/src/kernel/ao_gps_print.c index b1183bad..6dfd1bdd 100644 --- a/src/kernel/ao_gps_print.c +++ b/src/kernel/ao_gps_print.c @@ -26,7 +26,7 @@ #endif void -ao_gps_print(__xdata struct ao_gps_orig *gps_data) __reentrant +ao_gps_print(struct ao_gps_orig *gps_data) { char state; @@ -82,10 +82,10 @@ ao_gps_print(__xdata struct ao_gps_orig *gps_data) __reentrant } void -ao_gps_tracking_print(__xdata struct ao_gps_tracking_orig *gps_tracking_data) __reentrant +ao_gps_tracking_print(struct ao_gps_tracking_orig *gps_tracking_data) { uint8_t c, n, v; - __xdata struct ao_gps_sat_orig *sat; + struct ao_gps_sat_orig *sat; n = gps_tracking_data->channels; if (n == 0) diff --git a/src/kernel/ao_gps_report.c b/src/kernel/ao_gps_report.c index 75c2f367..0ef9a725 100644 --- a/src/kernel/ao_gps_report.c +++ b/src/kernel/ao_gps_report.c @@ -21,9 +21,9 @@ void ao_gps_report(void) { - static __xdata struct ao_log_record gps_log; - static __xdata struct ao_telemetry_location gps_data; - static __xdata struct ao_telemetry_satellite gps_tracking_data; + static struct ao_log_record gps_log; + static struct ao_telemetry_location gps_data; + static struct ao_telemetry_satellite gps_tracking_data; uint8_t date_reported = 0; uint8_t new; @@ -85,7 +85,7 @@ ao_gps_report(void) } } -__xdata struct ao_task ao_gps_report_task; +struct ao_task ao_gps_report_task; void ao_gps_report_init(void) diff --git a/src/kernel/ao_gps_report_mega.c b/src/kernel/ao_gps_report_mega.c index 85614b85..37f1beaa 100644 --- a/src/kernel/ao_gps_report_mega.c +++ b/src/kernel/ao_gps_report_mega.c @@ -59,9 +59,9 @@ ao_gps_sparse_should_log(int32_t lat, int32_t lon, int16_t alt) void ao_gps_report_mega(void) { - static __xdata struct ao_log_mega gps_log; - static __xdata struct ao_telemetry_location gps_data; - static __xdata struct ao_telemetry_satellite gps_tracking_data; + static struct ao_log_mega gps_log; + static struct ao_telemetry_location gps_data; + static struct ao_telemetry_satellite gps_tracking_data; uint8_t new; uint8_t c, n, i; @@ -125,7 +125,7 @@ ao_gps_report_mega(void) } } -__xdata struct ao_task ao_gps_report_mega_task; +struct ao_task ao_gps_report_mega_task; void ao_gps_report_mega_init(void) diff --git a/src/kernel/ao_gps_report_metrum.c b/src/kernel/ao_gps_report_metrum.c index 523fb17f..06863fe4 100644 --- a/src/kernel/ao_gps_report_metrum.c +++ b/src/kernel/ao_gps_report_metrum.c @@ -22,9 +22,9 @@ void ao_gps_report_metrum(void) { - static __xdata struct ao_log_metrum gps_log; - static __xdata struct ao_telemetry_location gps_data; - static __xdata struct ao_telemetry_satellite gps_tracking_data; + static struct ao_log_metrum gps_log; + static struct ao_telemetry_location gps_data; + static struct ao_telemetry_satellite gps_tracking_data; uint8_t c, n, i; uint8_t svid; uint8_t new; @@ -88,7 +88,7 @@ ao_gps_report_metrum(void) } } -__xdata struct ao_task ao_gps_report_metrum_task; +struct ao_task ao_gps_report_metrum_task; void ao_gps_report_metrum_init(void) diff --git a/src/kernel/ao_gps_show.c b/src/kernel/ao_gps_show.c index ec197769..ab29e5e5 100644 --- a/src/kernel/ao_gps_show.c +++ b/src/kernel/ao_gps_show.c @@ -23,7 +23,7 @@ #include void -ao_gps_show(void) __reentrant +ao_gps_show(void) { uint8_t i; ao_mutex_get(&ao_gps_mutex); diff --git a/src/kernel/ao_host.h b/src/kernel/ao_host.h index 638dba99..592de54c 100644 --- a/src/kernel/ao_host.h +++ b/src/kernel/ao_host.h @@ -41,11 +41,7 @@ struct ao_adc { int16_t sense_m; /* main continuity sense */ }; -#define __pdata -#define __data -#define __xdata -#define __code -#define __reentrant +#define const #define a (a) #define a (a) diff --git a/src/kernel/ao_ignite.c b/src/kernel/ao_ignite.c index 52d9d77e..5f41c552 100644 --- a/src/kernel/ao_ignite.c +++ b/src/kernel/ao_ignite.c @@ -23,7 +23,7 @@ #endif #if HAS_IGNITE -__xdata struct ao_ignition ao_ignition[2]; +struct ao_ignition ao_ignition[2]; void ao_ignite(enum ao_igniter igniter) @@ -42,9 +42,9 @@ ao_ignite(enum ao_igniter igniter) enum ao_igniter_status ao_igniter_status(enum ao_igniter igniter) { - __xdata struct ao_data packet; - __pdata int16_t value; - __pdata uint8_t request, firing, fired; + struct ao_data packet; + int16_t value; + uint8_t request, firing, fired; ao_arch_critical( ao_data_get(&packet); @@ -141,7 +141,7 @@ ao_igniter_fire(enum ao_igniter igniter) void ao_igniter(void) { - __xdata enum ao_igniter igniter; + enum ao_igniter igniter; ao_config_get(); for (;;) { @@ -187,13 +187,13 @@ ao_ignite_manual(void) ao_cmd_status = ao_cmd_syntax_error; } -__code char * __code ao_igniter_status_names[] = { +const char * const ao_igniter_status_names[] = { "unknown", "ready", "active", "open" }; #if HAS_IGNITE void -ao_ignite_print_status(enum ao_igniter igniter, __code char *name) __reentrant +ao_ignite_print_status(enum ao_igniter igniter, const char *name) { enum ao_igniter_status status = ao_igniter_status(igniter); printf("Igniter: %6s Status: %s\n", @@ -214,14 +214,14 @@ ao_ignite_test(void) #endif } -__code struct ao_cmds ao_ignite_cmds[] = { +const struct ao_cmds ao_ignite_cmds[] = { { ao_ignite_manual, "i {main|drogue}\0Fire igniter. is doit with D&I" }, { ao_ignite_test, "t\0Test igniter" }, { 0, NULL }, }; #if HAS_IGNITE -__xdata struct ao_task ao_igniter_task; +struct ao_task ao_igniter_task; void ao_ignite_set_pins(void) diff --git a/src/kernel/ao_int64.c b/src/kernel/ao_int64.c index fdea61c0..dffb8556 100644 --- a/src/kernel/ao_int64.c +++ b/src/kernel/ao_int64.c @@ -18,7 +18,7 @@ #include -void ao_plus64(__pdata ao_int64_t *r, __pdata ao_int64_t *a, __pdata ao_int64_t *b) __FATTR { +void ao_plus64(ao_int64_t *r, ao_int64_t *a, ao_int64_t *b) __FATTR { __LOCAL uint32_t t; r->high = a->high + b->high; @@ -28,7 +28,7 @@ void ao_plus64(__pdata ao_int64_t *r, __pdata ao_int64_t *a, __pdata ao_int64_t r->low = t; } -void ao_minus64(__pdata ao_int64_t *r, __pdata ao_int64_t *a, __pdata ao_int64_t *b) __FATTR { +void ao_minus64(ao_int64_t *r, ao_int64_t *a, ao_int64_t *b) __FATTR { __LOCAL uint32_t t; r->high = a->high - b->high; @@ -38,7 +38,7 @@ void ao_minus64(__pdata ao_int64_t *r, __pdata ao_int64_t *a, __pdata ao_int64_t r->low = t; } -void ao_rshift64(__pdata ao_int64_t *r, __pdata ao_int64_t *a, uint8_t d) __FATTR { +void ao_rshift64(ao_int64_t *r, ao_int64_t *a, uint8_t d) __FATTR { if (d < 32) { r->low = a->low >> d; if (d) @@ -51,7 +51,7 @@ void ao_rshift64(__pdata ao_int64_t *r, __pdata ao_int64_t *a, uint8_t d) __FATT } } -void ao_lshift64(__pdata ao_int64_t *r, __pdata ao_int64_t *a, uint8_t d) __FATTR { +void ao_lshift64(ao_int64_t *r, ao_int64_t *a, uint8_t d) __FATTR { if (d < 32) { r->high = a->high << d; if (d) @@ -64,7 +64,7 @@ void ao_lshift64(__pdata ao_int64_t *r, __pdata ao_int64_t *a, uint8_t d) __FATT } } -static void ao_umul64_32_32(__ARG ao_int64_t *r, uint32_t a, uint32_t b) __reentrant { +static void ao_umul64_32_32(__ARG ao_int64_t *r, uint32_t a, uint32_t b) { __LOCAL uint32_t s; __LOCAL ao_int64_t t; r->low = (uint32_t) (uint16_t) a * (uint16_t) b; @@ -83,7 +83,7 @@ static void ao_umul64_32_32(__ARG ao_int64_t *r, uint32_t a, uint32_t b) __reent ao_plus64(r, r, &t); } -void ao_neg64(__pdata ao_int64_t *r, __pdata ao_int64_t *a) __FATTR { +void ao_neg64(ao_int64_t *r, ao_int64_t *a) __FATTR { r->high = ~a->high; if (!(r->low = ~a->low + 1)) r->high++; @@ -105,7 +105,7 @@ void ao_mul64_32_32(__ARG ao_int64_t *r, int32_t a, int32_t b) __FATTR { ao_neg64(r, r); } -static void ao_umul64(__ARG ao_int64_t *r, __ARG ao_int64_t *a, __ARG ao_int64_t *b) __reentrant { +static void ao_umul64(__ARG ao_int64_t *r, __ARG ao_int64_t *a, __ARG ao_int64_t *b) { __LOCAL ao_int64_t r2, r3; ao_umul64_32_32(&r2, a->high, b->low); @@ -135,7 +135,7 @@ void ao_mul64(__ARG ao_int64_t *r, __ARG ao_int64_t *a, __ARG ao_int64_t *b) __F ao_neg64(r, r); } -static void ao_umul64_64_16(__ARG ao_int64_t *r, __ARG ao_int64_t *a, uint16_t b) __reentrant { +static void ao_umul64_64_16(__ARG ao_int64_t *r, __ARG ao_int64_t *a, uint16_t b) { __LOCAL uint32_t h; h = a->high * b; diff --git a/src/kernel/ao_int64.h b/src/kernel/ao_int64.h index 11c16404..3014182a 100644 --- a/src/kernel/ao_int64.h +++ b/src/kernel/ao_int64.h @@ -27,14 +27,14 @@ typedef struct { } ao_int64_t; #define __FATTR -#define __ARG __pdata -#define __LOCAL static __pdata - -void ao_plus64(__pdata ao_int64_t *ao_64r, __pdata ao_int64_t *ao_64a, __pdata ao_int64_t *ao_64b) __FATTR; -void ao_minus64(__pdata ao_int64_t *ao_64r, __pdata ao_int64_t *ao_64a, __pdata ao_int64_t *ao_64b) __FATTR; -void ao_neg64(__pdata ao_int64_t *ao_64r, __pdata ao_int64_t *ao_64a) __FATTR; -void ao_rshift64(__pdata ao_int64_t *ao_64r, __pdata ao_int64_t *ao_64a, uint8_t d) __FATTR; -void ao_lshift64(__pdata ao_int64_t *ao_64r, __pdata ao_int64_t *ao_64a, uint8_t d) __FATTR; +#define __ARG +#define __LOCAL static + +void ao_plus64(ao_int64_t *ao_64r, ao_int64_t *ao_64a, ao_int64_t *ao_64b) __FATTR; +void ao_minus64(ao_int64_t *ao_64r, ao_int64_t *ao_64a, ao_int64_t *ao_64b) __FATTR; +void ao_neg64(ao_int64_t *ao_64r, ao_int64_t *ao_64a) __FATTR; +void ao_rshift64(ao_int64_t *ao_64r, ao_int64_t *ao_64a, uint8_t d) __FATTR; +void ao_lshift64(ao_int64_t *ao_64r, ao_int64_t *ao_64a, uint8_t d) __FATTR; void ao_mul64_32_32(__ARG ao_int64_t *r, __ARG int32_t a, __ARG int32_t b) __FATTR; void ao_mul64_64_16(__ARG ao_int64_t *r, __ARG ao_int64_t *a, __ARG uint16_t b) __FATTR; void ao_mul64(__ARG ao_int64_t * __ARG r, __ARG ao_int64_t * __ARG a, __ARG ao_int64_t *__ARG b) __FATTR; diff --git a/src/kernel/ao_kalman.c b/src/kernel/ao_kalman.c index e4cc6d4b..4f4ffe8f 100644 --- a/src/kernel/ao_kalman.c +++ b/src/kernel/ao_kalman.c @@ -24,9 +24,9 @@ #include "ao_sample.h" #include "ao_kalman.h" -static __pdata ao_k_t ao_k_height; -static __pdata ao_k_t ao_k_speed; -static __pdata ao_k_t ao_k_accel; +static ao_k_t ao_k_height; +static ao_k_t ao_k_speed; +static ao_k_t ao_k_accel; #define AO_K_STEP_100 to_fix_v(0.01) #define AO_K_STEP_2_2_100 to_fix_v(0.00005) @@ -37,24 +37,24 @@ static __pdata ao_k_t ao_k_accel; #define AO_K_STEP_1 to_fix_v(1) #define AO_K_STEP_2_2_1 to_fix_v(0.5) -__pdata ao_v_t ao_height; -__pdata ao_v_t ao_speed; -__pdata ao_v_t ao_accel; -__xdata ao_v_t ao_max_height; -static __pdata ao_k_t ao_avg_height_scaled; -__xdata ao_v_t ao_avg_height; +ao_v_t ao_height; +ao_v_t ao_speed; +ao_v_t ao_accel; +ao_v_t ao_max_height; +static ao_k_t ao_avg_height_scaled; +ao_v_t ao_avg_height; -__pdata ao_v_t ao_error_h; +ao_v_t ao_error_h; #if !HAS_ACCEL || AO_FLIGHT_TEST #define AO_ERROR_H_SQ_AVG 1 #endif #if AO_ERROR_H_SQ_AVG -__pdata ao_v_t ao_error_h_sq_avg; +ao_v_t ao_error_h_sq_avg; #endif #if HAS_ACCEL -__pdata ao_v_t ao_error_a; +ao_v_t ao_error_a; #endif static void diff --git a/src/kernel/ao_led.h b/src/kernel/ao_led.h index 7de09237..803f85b3 100644 --- a/src/kernel/ao_led.h +++ b/src/kernel/ao_led.h @@ -51,7 +51,7 @@ ao_led_toggle(AO_LED_TYPE colors); /* Turn on the specified LEDs for the indicated interval */ void -ao_led_for(AO_LED_TYPE colors, uint16_t ticks) __reentrant; +ao_led_for(AO_LED_TYPE colors, uint16_t ticks); /* Initialize the LEDs */ void diff --git a/src/kernel/ao_log.c b/src/kernel/ao_log.c index 5fb086ce..1119cce4 100644 --- a/src/kernel/ao_log.c +++ b/src/kernel/ao_log.c @@ -23,13 +23,13 @@ #include #endif -__xdata uint8_t ao_log_mutex; -__pdata uint32_t ao_log_current_pos; -__pdata uint32_t ao_log_end_pos; -__pdata uint32_t ao_log_start_pos; -__xdata uint8_t ao_log_running; -__pdata enum ao_flight_state ao_log_state; -__xdata int16_t ao_flight_number; +uint8_t ao_log_mutex; +uint32_t ao_log_current_pos; +uint32_t ao_log_end_pos; +uint32_t ao_log_start_pos; +uint8_t ao_log_running; +enum ao_flight_state ao_log_state; +int16_t ao_flight_number; void ao_log_flush(void) @@ -47,7 +47,7 @@ struct ao_log_erase { uint16_t flight; }; -static __xdata struct ao_log_erase erase; +static struct ao_log_erase erase; #ifndef LOG_MAX_ERASE #define LOG_MAX_ERASE 16 @@ -117,10 +117,10 @@ ao_log_erase_mark(void) * structure. */ -__xdata ao_log_type ao_log_data; +ao_log_type ao_log_data; static uint8_t -ao_log_csum(__xdata uint8_t *b) __reentrant +ao_log_csum(uint8_t *b) { uint8_t sum = 0x5a; uint8_t i; @@ -131,12 +131,12 @@ ao_log_csum(__xdata uint8_t *b) __reentrant } uint8_t -ao_log_write(__xdata ao_log_type *log) __reentrant +ao_log_write(ao_log_type *log) { uint8_t wrote = 0; /* set checksum */ log->csum = 0; - log->csum = ao_log_csum((__xdata uint8_t *) log); + log->csum = ao_log_csum((uint8_t *) log); ao_mutex_get(&ao_log_mutex); { if (ao_log_current_pos >= ao_log_end_pos && ao_log_running) ao_log_stop(); @@ -223,7 +223,7 @@ ao_log_max_flight(void) } static void -ao_log_erase(uint8_t slot) __reentrant +ao_log_erase(uint8_t slot) { uint32_t log_current_pos, log_end_pos; @@ -232,7 +232,7 @@ ao_log_erase(uint8_t slot) __reentrant log_end_pos = log_current_pos + ao_config.flight_log_max; while (log_current_pos < log_end_pos) { uint8_t i; - static __xdata uint8_t b; + static uint8_t b; /* * Check to see if we've reached the end of @@ -252,7 +252,7 @@ ao_log_erase(uint8_t slot) __reentrant } static void -ao_log_find_max_erase_flight(void) __reentrant +ao_log_find_max_erase_flight(void) { uint8_t log_slot; @@ -273,7 +273,7 @@ ao_log_find_max_erase_flight(void) __reentrant } uint8_t -ao_log_scan(void) __reentrant +ao_log_scan(void) { uint8_t log_slot; uint8_t log_slots; @@ -402,11 +402,11 @@ ao_log_full(void) #endif #if LOG_ADC -static __xdata struct ao_task ao_log_task; +static struct ao_task ao_log_task; #endif void -ao_log_list(void) __reentrant +ao_log_list(void) { uint8_t slot; uint8_t slots; @@ -426,7 +426,7 @@ ao_log_list(void) __reentrant } void -ao_log_delete(void) __reentrant +ao_log_delete(void) { uint8_t slot; uint8_t slots; @@ -462,7 +462,7 @@ ao_log_delete(void) __reentrant printf("No such flight: %d\n", cmd_flight); } -__code struct ao_cmds ao_log_cmds[] = { +const struct ao_cmds ao_log_cmds[] = { { ao_log_list, "l\0List logs" }, { ao_log_delete, "d \0Delete flight" }, { 0, NULL }, diff --git a/src/kernel/ao_log.h b/src/kernel/ao_log.h index e2f1e0e4..a9715962 100644 --- a/src/kernel/ao_log.h +++ b/src/kernel/ao_log.h @@ -29,13 +29,13 @@ * the log. Tasks may wait for this to be initialized * by sleeping on this variable. */ -extern __xdata int16_t ao_flight_number; -extern __xdata uint8_t ao_log_mutex; -extern __pdata uint32_t ao_log_current_pos; -extern __pdata uint32_t ao_log_end_pos; -extern __pdata uint32_t ao_log_start_pos; -extern __xdata uint8_t ao_log_running; -extern __pdata enum ao_flight_state ao_log_state; +extern int16_t ao_flight_number; +extern uint8_t ao_log_mutex; +extern uint32_t ao_log_current_pos; +extern uint32_t ao_log_end_pos; +extern uint32_t ao_log_start_pos; +extern uint8_t ao_log_running; +extern enum ao_flight_state ao_log_state; /* required functions from the underlying log system */ @@ -90,7 +90,7 @@ ao_log(void); /* Figure out the current flight number */ uint8_t -ao_log_scan(void) __reentrant; +ao_log_scan(void); /* Return the position of the start of the given log slot */ uint32_t @@ -507,14 +507,14 @@ typedef struct ao_log_record ao_log_type; #endif #ifndef AO_LOG_UNCOMMON -extern __xdata ao_log_type ao_log_data; +extern ao_log_type ao_log_data; #define AO_LOG_SIZE sizeof(ao_log_type) /* Write a record to the eeprom log */ uint8_t -ao_log_write(__xdata ao_log_type *log) __reentrant; +ao_log_write(ao_log_type *log); #endif void diff --git a/src/kernel/ao_log_big.c b/src/kernel/ao_log_big.c index 7d7332e9..2a8cd63d 100644 --- a/src/kernel/ao_log_big.c +++ b/src/kernel/ao_log_big.c @@ -18,7 +18,7 @@ #include "ao.h" -static __data uint8_t ao_log_data_pos; +static uint8_t ao_log_data_pos; /* a hack to make sure that ao_log_records fill the eeprom block in even units */ typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_record))] ; @@ -32,7 +32,7 @@ typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_record))] ; void ao_log(void) { - __pdata uint16_t next_sensor, next_other; + uint16_t next_sensor, next_other; ao_storage_setup(); diff --git a/src/kernel/ao_log_fireone.c b/src/kernel/ao_log_fireone.c index 1a82673d..3dd52a16 100644 --- a/src/kernel/ao_log_fireone.c +++ b/src/kernel/ao_log_fireone.c @@ -21,12 +21,12 @@ #include #include -static __xdata struct ao_log_firetwo log; +static struct ao_log_firetwo log; -__code uint8_t ao_log_format = AO_LOG_FORMAT_TELEFIRETWO; +const uint8_t ao_log_format = AO_LOG_FORMAT_TELEFIRETWO; static uint8_t -ao_log_csum(__xdata uint8_t *b) __reentrant +ao_log_csum(uint8_t *b) { uint8_t sum = 0x5a; uint8_t i; @@ -37,12 +37,12 @@ ao_log_csum(__xdata uint8_t *b) __reentrant } uint8_t -ao_log_firetwo(__xdata struct ao_log_firetwo *log) __reentrant +ao_log_firetwo(struct ao_log_firetwo *log) { uint8_t wrote = 0; /* set checksum */ log->csum = 0; - log->csum = ao_log_csum((__xdata uint8_t *) log); + log->csum = ao_log_csum((uint8_t *) log); ao_mutex_get(&ao_log_mutex); { if (ao_log_current_pos >= ao_log_end_pos && ao_log_running) ao_log_stop(); @@ -66,7 +66,7 @@ ao_log_dump_check_data(void) } #if HAS_ADC -static __data uint8_t ao_log_data_pos; +static uint8_t ao_log_data_pos; /* a hack to make sure that ao_log_metrums fill the eeprom block in even units */ typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_firetwo))] ; diff --git a/src/kernel/ao_log_mega.c b/src/kernel/ao_log_mega.c index 0ae4e536..341ff715 100644 --- a/src/kernel/ao_log_mega.c +++ b/src/kernel/ao_log_mega.c @@ -22,7 +22,7 @@ #include #if HAS_FLIGHT -static __data uint8_t ao_log_data_pos; +static uint8_t ao_log_data_pos; /* a hack to make sure that ao_log_megas fill the eeprom block in even units */ typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_mega))] ; @@ -36,7 +36,7 @@ typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_mega))] ; void ao_log(void) { - __pdata uint16_t next_sensor, next_other; + uint16_t next_sensor, next_other; uint8_t i; ao_storage_setup(); diff --git a/src/kernel/ao_log_metrum.c b/src/kernel/ao_log_metrum.c index 34729070..18fb9ffb 100644 --- a/src/kernel/ao_log_metrum.c +++ b/src/kernel/ao_log_metrum.c @@ -22,7 +22,7 @@ #include #if HAS_ADC -static __data uint8_t ao_log_data_pos; +static uint8_t ao_log_data_pos; /* a hack to make sure that ao_log_metrums fill the eeprom block in even units */ typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_metrum))] ; @@ -36,7 +36,7 @@ typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_metrum))] ; void ao_log(void) { - __pdata uint16_t next_sensor, next_other; + uint16_t next_sensor, next_other; ao_storage_setup(); diff --git a/src/kernel/ao_log_mini.c b/src/kernel/ao_log_mini.c index 12c5d6bb..03bf2265 100644 --- a/src/kernel/ao_log_mini.c +++ b/src/kernel/ao_log_mini.c @@ -21,7 +21,7 @@ #include #include -static __data uint8_t ao_log_data_pos; +static uint8_t ao_log_data_pos; /* a hack to make sure that ao_log_minis fill the eeprom block in even units */ typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_mini))] ; @@ -34,7 +34,7 @@ typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_mini))] ; void ao_log(void) { - __pdata uint16_t next_sensor; + uint16_t next_sensor; ao_storage_setup(); diff --git a/src/kernel/ao_log_single.c b/src/kernel/ao_log_single.c index 63768e1a..da627387 100644 --- a/src/kernel/ao_log_single.c +++ b/src/kernel/ao_log_single.c @@ -26,16 +26,16 @@ #include "ao.h" #include "ao_product.h" -static __xdata struct ao_task ao_log_single_task; +static struct ao_task ao_log_single_task; -__xdata uint8_t ao_log_running; -__xdata uint8_t ao_log_mutex; -__pdata uint32_t ao_log_start_pos; -__pdata uint32_t ao_log_end_pos; -__pdata uint32_t ao_log_current_pos; +uint8_t ao_log_running; +uint8_t ao_log_mutex; +uint32_t ao_log_start_pos; +uint32_t ao_log_end_pos; +uint32_t ao_log_current_pos; -__xdata union ao_log_single ao_log_single_write_data; -__xdata union ao_log_single ao_log_single_read_data; +union ao_log_single ao_log_single_write_data; +union ao_log_single ao_log_single_read_data; uint8_t ao_log_single_write(void) @@ -59,7 +59,7 @@ ao_log_single_write(void) static uint8_t ao_log_single_valid(void) { - __xdata uint8_t *d = ao_log_single_read_data.bytes; + uint8_t *d = ao_log_single_read_data.bytes; uint8_t i; for (i = 0; i < AO_LOG_SINGLE_SIZE; i++) if (*d++ != 0xff) diff --git a/src/kernel/ao_log_telem.c b/src/kernel/ao_log_telem.c index 8969e029..8c0b88e4 100644 --- a/src/kernel/ao_log_telem.c +++ b/src/kernel/ao_log_telem.c @@ -20,13 +20,13 @@ #include #include -__code uint8_t ao_log_format = AO_LOG_FORMAT_TELEMETRY; +const uint8_t ao_log_format = AO_LOG_FORMAT_TELEMETRY; -static __data uint8_t ao_log_monitor_pos; -__pdata enum ao_flight_state ao_flight_state; -__xdata int16_t ao_max_height; /* max of ao_height */ -__pdata int16_t sense_d, sense_m; -__pdata uint8_t ao_igniter_present; +static uint8_t ao_log_monitor_pos; +enum ao_flight_state ao_flight_state; +int16_t ao_max_height; /* max of ao_height */ +int16_t sense_d, sense_m; +uint8_t ao_igniter_present; static void ao_log_telem_track() { diff --git a/src/kernel/ao_log_telescience.c b/src/kernel/ao_log_telescience.c index 3f514f18..a21af71d 100644 --- a/src/kernel/ao_log_telescience.c +++ b/src/kernel/ao_log_telescience.c @@ -23,12 +23,12 @@ static uint8_t ao_log_data_pos; -__code uint8_t ao_log_format = AO_LOG_FORMAT_TELESCIENCE; +const uint8_t ao_log_format = AO_LOG_FORMAT_TELESCIENCE; static void -ao_log_telescience_csum(void) __reentrant +ao_log_telescience_csum(void) { - __xdata uint8_t *b = ao_log_single_write_data.bytes; + uint8_t *b = ao_log_single_write_data.bytes; uint8_t sum = 0x5a; uint8_t i; diff --git a/src/kernel/ao_log_tiny.c b/src/kernel/ao_log_tiny.c index 046b7b20..53003111 100644 --- a/src/kernel/ao_log_tiny.c +++ b/src/kernel/ao_log_tiny.c @@ -18,7 +18,7 @@ #include "ao.h" -static __data uint16_t ao_log_tiny_interval; +static uint16_t ao_log_tiny_interval; #define AO_LOG_TINY_INTERVAL_DEFAULT AO_MS_TO_TICKS(1000) #if USE_FAST_ASCENT_LOG @@ -46,8 +46,8 @@ static void ao_log_tiny_data(uint16_t d) } } -static __xdata uint16_t ao_log_pad_ring[AO_PAD_RING]; -static __pdata uint8_t ao_log_pad_ring_pos; +static uint16_t ao_log_pad_ring[AO_PAD_RING]; +static uint8_t ao_log_pad_ring_pos; #define ao_pad_ring_next(n) (((n) + 1) & (AO_PAD_RING - 1)) @@ -150,7 +150,7 @@ ao_log(void) int16_t ao_log_flight(uint8_t slot) { - static __xdata uint16_t flight; + static uint16_t flight; (void) slot; ao_storage_read(0, &flight, 2); diff --git a/src/kernel/ao_monitor.c b/src/kernel/ao_monitor.c index b9a39bfc..b6b8d888 100644 --- a/src/kernel/ao_monitor.c +++ b/src/kernel/ao_monitor.c @@ -36,15 +36,15 @@ #error Must define AO_MONITOR_LED #endif -__xdata uint8_t ao_monitoring_mutex; -__data uint8_t ao_monitoring; -static __data uint8_t ao_monitor_disabled; -static __data uint8_t ao_internal_monitoring; -static __data uint8_t ao_external_monitoring; +uint8_t ao_monitoring_mutex; +uint8_t ao_monitoring; +static uint8_t ao_monitor_disabled; +static uint8_t ao_internal_monitoring; +static uint8_t ao_external_monitoring; -__xdata union ao_monitor ao_monitor_ring[AO_MONITOR_RING]; +union ao_monitor ao_monitor_ring[AO_MONITOR_RING]; -__data uint8_t ao_monitor_head; +uint8_t ao_monitor_head; static void _ao_monitor_adjust(void) @@ -91,7 +91,7 @@ ao_monitor_get(void) } #if AO_MONITOR_LED -__xdata struct ao_task ao_monitor_blink_task; +struct ao_task ao_monitor_blink_task; void ao_monitor_blink(void) @@ -125,7 +125,7 @@ void ao_monitor_put(void) { #if LEGACY_MONITOR - __xdata char callsign[AO_MAX_CALLSIGN+1]; + char callsign[AO_MAX_CALLSIGN+1]; #endif #if LEGACY_MONITOR || HAS_RSSI int16_t rssi; @@ -133,7 +133,7 @@ ao_monitor_put(void) uint8_t ao_monitor_tail; uint8_t state; uint8_t sum, byte; - __xdata union ao_monitor *m; + union ao_monitor *m; #define recv_raw ((m->raw)) #define recv_orig ((m->orig)) @@ -266,10 +266,10 @@ ao_monitor_put(void) } } -__xdata struct ao_task ao_monitor_put_task; +struct ao_task ao_monitor_put_task; #endif -__xdata struct ao_task ao_monitor_get_task; +struct ao_task ao_monitor_get_task; void ao_monitor_set(uint8_t monitoring) @@ -303,14 +303,14 @@ set_monitor(void) _ao_monitor_adjust(); } -__code struct ao_cmds ao_monitor_cmds[] = { +const struct ao_cmds ao_monitor_cmds[] = { { set_monitor, "m <0 off, 1 old, 20 std>\0Set radio monitoring" }, { 0, NULL }, }; #endif void -ao_monitor_init(void) __reentrant +ao_monitor_init(void) { #if HAS_MONITOR_PUT ao_cmd_register(&ao_monitor_cmds[0]); diff --git a/src/kernel/ao_mutex.c b/src/kernel/ao_mutex.c index ff73e3bc..4ef1a9ba 100644 --- a/src/kernel/ao_mutex.c +++ b/src/kernel/ao_mutex.c @@ -25,7 +25,7 @@ #if HAS_MUTEX_TRY uint8_t -ao_mutex_try(__xdata uint8_t *mutex, uint8_t task_id) __reentrant +ao_mutex_try(uint8_t *mutex, uint8_t task_id) { uint8_t ret; if (*mutex == task_id) @@ -42,7 +42,7 @@ ao_mutex_try(__xdata uint8_t *mutex, uint8_t task_id) __reentrant #endif void -ao_mutex_get(__xdata uint8_t *mutex) __reentrant +ao_mutex_get(uint8_t *mutex) { if (*mutex == ao_cur_task->task_id) ao_panic(AO_PANIC_MUTEX); @@ -54,7 +54,7 @@ ao_mutex_get(__xdata uint8_t *mutex) __reentrant } void -ao_mutex_put(__xdata uint8_t *mutex) __reentrant +ao_mutex_put(uint8_t *mutex) { if (*mutex != ao_cur_task->task_id) ao_panic(AO_PANIC_MUTEX); diff --git a/src/kernel/ao_notask.c b/src/kernel/ao_notask.c index 7207353a..a5bdc8a7 100644 --- a/src/kernel/ao_notask.c +++ b/src/kernel/ao_notask.c @@ -21,7 +21,7 @@ static volatile void *ao_wchan; uint8_t -ao_sleep(__xdata void *wchan) +ao_sleep(void *wchan) { #if 1 ao_wchan = wchan; @@ -55,7 +55,7 @@ ao_delay(uint16_t ticks) #endif void -ao_wakeup(__xdata void *wchan) +ao_wakeup(void *wchan) { (void) wchan; ao_wchan = 0; diff --git a/src/kernel/ao_notask.h b/src/kernel/ao_notask.h index a4446726..ce622b63 100644 --- a/src/kernel/ao_notask.h +++ b/src/kernel/ao_notask.h @@ -20,9 +20,9 @@ #define _AO_NOTASK_H_ uint8_t -ao_sleep(__xdata void *wchan); +ao_sleep(void *wchan); void -ao_wakeup(__xdata void *wchan); +ao_wakeup(void *wchan); #endif /* _AO_NOTASK_H_ */ diff --git a/src/kernel/ao_packet.h b/src/kernel/ao_packet.h index 9d99b0e6..24cd7b13 100644 --- a/src/kernel/ao_packet.h +++ b/src/kernel/ao_packet.h @@ -43,13 +43,13 @@ struct ao_packet_recv { uint8_t status; }; -extern __xdata struct ao_packet_recv ao_rx_packet; -extern __xdata struct ao_packet ao_tx_packet; -extern __xdata struct ao_task ao_packet_task; -extern __xdata uint8_t ao_packet_enable; -extern __xdata uint8_t ao_packet_master_sleeping; -extern __pdata uint8_t ao_packet_rx_len, ao_packet_rx_used, ao_packet_tx_used; -extern __xdata uint8_t ao_packet_restart; +extern struct ao_packet_recv ao_rx_packet; +extern struct ao_packet ao_tx_packet; +extern struct ao_task ao_packet_task; +extern uint8_t ao_packet_enable; +extern uint8_t ao_packet_master_sleeping; +extern uint8_t ao_packet_rx_len, ao_packet_rx_used, ao_packet_tx_used; +extern uint8_t ao_packet_restart; void ao_packet_send(void); @@ -61,7 +61,7 @@ void ao_packet_flush(void); void -ao_packet_putchar(char c) __reentrant; +ao_packet_putchar(char c); int _ao_packet_pollchar(void); @@ -69,7 +69,7 @@ _ao_packet_pollchar(void); #if PACKET_HAS_MASTER /* ao_packet_master.c */ -extern __xdata int8_t ao_packet_last_rssi; +extern int8_t ao_packet_last_rssi; void ao_packet_master_init(void); diff --git a/src/kernel/ao_pyro.c b/src/kernel/ao_pyro.c index 527112ac..e24ab46b 100644 --- a/src/kernel/ao_pyro.c +++ b/src/kernel/ao_pyro.c @@ -38,8 +38,8 @@ enum ao_igniter_status ao_pyro_status(uint8_t p) { - __xdata struct ao_data packet; - __pdata int16_t value; + struct ao_data packet; + int16_t value; ao_arch_critical( ao_data_get(&packet); @@ -404,7 +404,7 @@ ao_pyro(void) ao_exit(); } -__xdata struct ao_task ao_pyro_task; +struct ao_task ao_pyro_task; static void diff --git a/src/kernel/ao_radio_cmac.c b/src/kernel/ao_radio_cmac.c index 92b365a2..155fce35 100644 --- a/src/kernel/ao_radio_cmac.c +++ b/src/kernel/ao_radio_cmac.c @@ -19,9 +19,9 @@ #include #include -static __xdata uint8_t ao_radio_cmac_mutex; -__pdata int8_t ao_radio_cmac_rssi; -static __xdata uint8_t cmac_data[AO_CMAC_MAX_LEN + AO_CMAC_KEY_LEN + 2 + AO_CMAC_KEY_LEN]; +static uint8_t ao_radio_cmac_mutex; +int8_t ao_radio_cmac_rssi; +static uint8_t cmac_data[AO_CMAC_MAX_LEN + AO_CMAC_KEY_LEN + 2 + AO_CMAC_KEY_LEN]; static uint8_t round_len(uint8_t len) @@ -45,7 +45,7 @@ round_len(uint8_t len) * Sign and deliver the data sitting in the cmac buffer */ static void -radio_cmac_send(uint8_t len) __reentrant +radio_cmac_send(uint8_t len) { uint8_t i; @@ -77,7 +77,7 @@ radio_cmac_send(uint8_t len) __reentrant */ static int8_t -radio_cmac_recv(uint8_t len, uint16_t timeout) __reentrant +radio_cmac_recv(uint8_t len, uint16_t timeout) { uint8_t i; @@ -127,7 +127,7 @@ radio_cmac_recv(uint8_t len, uint16_t timeout) __reentrant } int8_t -ao_radio_cmac_send(__xdata void *packet, uint8_t len) __reentrant +ao_radio_cmac_send(void *packet, uint8_t len) { if (len > AO_CMAC_MAX_LEN) return AO_RADIO_CMAC_LEN_ERROR; @@ -145,7 +145,7 @@ ao_radio_cmac_send(__xdata void *packet, uint8_t len) __reentrant } int8_t -ao_radio_cmac_recv(__xdata void *packet, uint8_t len, uint16_t timeout) __reentrant +ao_radio_cmac_recv(void *packet, uint8_t len, uint16_t timeout) { int8_t i; if (len > AO_CMAC_MAX_LEN) diff --git a/src/kernel/ao_radio_cmac.h b/src/kernel/ao_radio_cmac.h index 74fe8c60..5fd6e105 100644 --- a/src/kernel/ao_radio_cmac.h +++ b/src/kernel/ao_radio_cmac.h @@ -24,10 +24,10 @@ #define AO_CMAC_KEY_LEN AO_AES_LEN #define AO_CMAC_MAX_LEN (128 - AO_CMAC_KEY_LEN) -extern __pdata int8_t ao_radio_cmac_rssi; +extern int8_t ao_radio_cmac_rssi; int8_t -ao_radio_cmac_send(__xdata void *packet, uint8_t len) __reentrant; +ao_radio_cmac_send(void *packet, uint8_t len); #define AO_RADIO_CMAC_OK 0 #define AO_RADIO_CMAC_LEN_ERROR -1 @@ -36,7 +36,7 @@ ao_radio_cmac_send(__xdata void *packet, uint8_t len) __reentrant; #define AO_RADIO_CMAC_TIMEOUT -4 int8_t -ao_radio_cmac_recv(__xdata void *packet, uint8_t len, uint16_t timeout) __reentrant; +ao_radio_cmac_recv(void *packet, uint8_t len, uint16_t timeout); void ao_radio_cmac_init(void); diff --git a/src/kernel/ao_radio_cmac_cmd.c b/src/kernel/ao_radio_cmac_cmd.c index 6d29f392..e5b4ffdf 100644 --- a/src/kernel/ao_radio_cmac_cmd.c +++ b/src/kernel/ao_radio_cmac_cmd.c @@ -20,7 +20,7 @@ #include #include -static __xdata uint8_t cmac_data[AO_CMAC_MAX_LEN]; +static uint8_t cmac_data[AO_CMAC_MAX_LEN]; static uint8_t getnibble(void) @@ -45,7 +45,7 @@ getbyte(void) } static void -radio_cmac_send_cmd(void) __reentrant +radio_cmac_send_cmd(void) { uint8_t i; uint8_t len; @@ -69,7 +69,7 @@ radio_cmac_send_cmd(void) __reentrant } static void -radio_cmac_recv_cmd(void) __reentrant +radio_cmac_recv_cmd(void) { uint8_t len, i; uint16_t timeout; @@ -92,7 +92,7 @@ radio_cmac_recv_cmd(void) __reentrant printf ("ERROR %d %d\n", i, ao_radio_cmac_rssi); } -static __code struct ao_cmds ao_radio_cmac_cmds[] = { +static const struct ao_cmds ao_radio_cmac_cmds[] = { { radio_cmac_send_cmd, "s \0Send AES-CMAC packet. Bytes to send follow on next line" }, { radio_cmac_recv_cmd, "S \0Receive AES-CMAC packet. Timeout in ms" }, { 0, NULL }, diff --git a/src/kernel/ao_report.c b/src/kernel/ao_report.c index 73f87cdd..08967af8 100644 --- a/src/kernel/ao_report.c +++ b/src/kernel/ao_report.c @@ -58,7 +58,7 @@ static const uint8_t flight_reports[] = { #endif #define pause(time) ao_delay(time) -static __pdata enum ao_flight_state ao_report_state; +static enum ao_flight_state ao_report_state; /* * Farnsworth spacing @@ -115,7 +115,7 @@ static __pdata enum ao_flight_state ao_report_state; */ static void -ao_report_beep(void) __reentrant +ao_report_beep(void) { uint8_t r = flight_reports[ao_flight_state]; uint8_t l = r & 7; @@ -134,7 +134,7 @@ ao_report_beep(void) __reentrant } static void -ao_report_digit(uint8_t digit) __reentrant +ao_report_digit(uint8_t digit) { if (!digit) { mid(AO_MS_TO_TICKS(500)); @@ -151,8 +151,8 @@ ao_report_digit(uint8_t digit) __reentrant static void ao_report_number(int16_t n) { - __xdata uint8_t digits[10]; - __pdata uint8_t ndigits, i; + uint8_t digits[10]; + uint8_t ndigits, i; if (n < 0) n = 0; @@ -178,7 +178,7 @@ ao_report_altitude(void) static void ao_report_battery(void) { - __xdata struct ao_data packet; + struct ao_data packet; for (;;) { ao_data_get(&packet); if (packet.adc.v_batt != 0) @@ -204,7 +204,7 @@ ao_report_igniter(void) } static void -ao_report_continuity(void) __reentrant +ao_report_continuity(void) { uint8_t c; @@ -285,7 +285,7 @@ ao_report(void) } } -static __xdata struct ao_task ao_report_task; +static struct ao_task ao_report_task; void ao_report_init(void) diff --git a/src/kernel/ao_report_micro.c b/src/kernel/ao_report_micro.c index 9c7afdc5..efada54b 100644 --- a/src/kernel/ao_report_micro.c +++ b/src/kernel/ao_report_micro.c @@ -23,7 +23,7 @@ #define pause(time) ao_delay(time) static void -ao_report_digit(uint8_t digit) __reentrant +ao_report_digit(uint8_t digit) { if (!digit) { mid(AO_MS_TO_TICKS(1000)); @@ -40,9 +40,9 @@ ao_report_digit(uint8_t digit) __reentrant void ao_report_altitude(void) { - __pdata alt_t agl = ao_max_height; - static __xdata uint8_t digits[11]; - __pdata uint8_t ndigits, i; + alt_t agl = ao_max_height; + static uint8_t digits[11]; + uint8_t ndigits, i; if (agl < 0) agl = 0; diff --git a/src/kernel/ao_rssi.c b/src/kernel/ao_rssi.c index 66fb8b57..aacc38b2 100644 --- a/src/kernel/ao_rssi.c +++ b/src/kernel/ao_rssi.c @@ -18,9 +18,9 @@ #include "ao.h" -static __xdata uint16_t ao_rssi_time; -static __pdata uint16_t ao_rssi_delay; -static __pdata AO_LED_TYPE ao_rssi_led; +static uint16_t ao_rssi_time; +static uint16_t ao_rssi_delay; +static AO_LED_TYPE ao_rssi_led; void ao_rssi(void) @@ -43,7 +43,7 @@ ao_rssi_set(int16_t rssi_value) ao_wakeup(&ao_rssi_time); } -__xdata struct ao_task ao_rssi_task; +struct ao_task ao_rssi_task; void ao_rssi_init(AO_LED_TYPE rssi_led) diff --git a/src/kernel/ao_sample.c b/src/kernel/ao_sample.c index 9f5082bb..115eae80 100644 --- a/src/kernel/ao_sample.c +++ b/src/kernel/ao_sample.c @@ -35,63 +35,63 @@ #define ACCEL_TYPE int16_t #endif -__pdata uint16_t ao_sample_tick; /* time of last data */ -__pdata pres_t ao_sample_pres; -__pdata alt_t ao_sample_alt; -__pdata alt_t ao_sample_height; +uint16_t ao_sample_tick; /* time of last data */ +pres_t ao_sample_pres; +alt_t ao_sample_alt; +alt_t ao_sample_height; #if HAS_ACCEL -__pdata accel_t ao_sample_accel; +accel_t ao_sample_accel; #endif #if HAS_GYRO -__pdata accel_t ao_sample_accel_along; -__pdata accel_t ao_sample_accel_across; -__pdata accel_t ao_sample_accel_through; -__pdata gyro_t ao_sample_roll; -__pdata gyro_t ao_sample_pitch; -__pdata gyro_t ao_sample_yaw; -__pdata angle_t ao_sample_orient; -__pdata angle_t ao_sample_orients[AO_NUM_ORIENT]; -__pdata uint8_t ao_sample_orient_pos; +accel_t ao_sample_accel_along; +accel_t ao_sample_accel_across; +accel_t ao_sample_accel_through; +gyro_t ao_sample_roll; +gyro_t ao_sample_pitch; +gyro_t ao_sample_yaw; +angle_t ao_sample_orient; +angle_t ao_sample_orients[AO_NUM_ORIENT]; +uint8_t ao_sample_orient_pos; #endif -__data uint8_t ao_sample_data; +uint8_t ao_sample_data; /* * Sensor calibration values */ -__pdata pres_t ao_ground_pres; /* startup pressure */ -__pdata alt_t ao_ground_height; /* MSL of ao_ground_pres */ +pres_t ao_ground_pres; /* startup pressure */ +alt_t ao_ground_height; /* MSL of ao_ground_pres */ #if HAS_ACCEL -__pdata accel_t ao_ground_accel; /* startup acceleration */ -__pdata accel_t ao_accel_2g; /* factory accel calibration */ -__pdata int32_t ao_accel_scale; /* sensor to m/s² conversion */ +accel_t ao_ground_accel; /* startup acceleration */ +accel_t ao_accel_2g; /* factory accel calibration */ +int32_t ao_accel_scale; /* sensor to m/s² conversion */ #endif #if HAS_GYRO -__pdata accel_t ao_ground_accel_along; -__pdata accel_t ao_ground_accel_across; -__pdata accel_t ao_ground_accel_through; -__pdata int32_t ao_ground_pitch; -__pdata int32_t ao_ground_yaw; -__pdata int32_t ao_ground_roll; +accel_t ao_ground_accel_along; +accel_t ao_ground_accel_across; +accel_t ao_ground_accel_through; +int32_t ao_ground_pitch; +int32_t ao_ground_yaw; +int32_t ao_ground_roll; #endif -static __pdata uint8_t ao_preflight; /* in preflight mode */ +static uint8_t ao_preflight; /* in preflight mode */ -static __pdata uint16_t nsamples; -__pdata int32_t ao_sample_pres_sum; +static uint16_t nsamples; +int32_t ao_sample_pres_sum; #if HAS_ACCEL -__pdata int32_t ao_sample_accel_sum; +int32_t ao_sample_accel_sum; #endif #if HAS_GYRO -__pdata int32_t ao_sample_accel_along_sum; -__pdata int32_t ao_sample_accel_across_sum; -__pdata int32_t ao_sample_accel_through_sum; -__pdata int32_t ao_sample_pitch_sum; -__pdata int32_t ao_sample_yaw_sum; -__pdata int32_t ao_sample_roll_sum; +int32_t ao_sample_accel_along_sum; +int32_t ao_sample_accel_across_sum; +int32_t ao_sample_accel_through_sum; +int32_t ao_sample_pitch_sum; +int32_t ao_sample_yaw_sum; +int32_t ao_sample_roll_sum; static struct ao_quaternion ao_rotation; #endif @@ -324,7 +324,7 @@ ao_sample(void) ao_wakeup(&ao_sample_data); ao_sleep((void *) &ao_data_head); while (ao_sample_data != ao_data_head) { - __xdata struct ao_data *ao_data; + struct ao_data *ao_data; /* Capture a sample */ ao_data = (struct ao_data *) &ao_data_ring[ao_sample_data]; diff --git a/src/kernel/ao_sample.h b/src/kernel/ao_sample.h index 5ae389be..af6eca4e 100644 --- a/src/kernel/ao_sample.h +++ b/src/kernel/ao_sample.h @@ -115,41 +115,41 @@ typedef int16_t ao_v_t; #define AO_MS_TO_SPEED(ms) ((ao_v_t) ((ms) * 16)) #define AO_MSS_TO_ACCEL(mss) ((ao_v_t) ((mss) * 16)) -extern __pdata uint16_t ao_sample_tick; /* time of last data */ -extern __data uint8_t ao_sample_adc; /* Ring position of last processed sample */ -extern __data uint8_t ao_sample_data; /* Ring position of last processed sample */ +extern uint16_t ao_sample_tick; /* time of last data */ +extern uint8_t ao_sample_adc; /* Ring position of last processed sample */ +extern uint8_t ao_sample_data; /* Ring position of last processed sample */ #if HAS_BARO -extern __pdata pres_t ao_sample_pres; /* most recent pressure sensor reading */ -extern __pdata alt_t ao_sample_alt; /* MSL of ao_sample_pres */ -extern __pdata alt_t ao_sample_height; /* AGL of ao_sample_pres */ -extern __pdata pres_t ao_ground_pres; /* startup pressure */ -extern __pdata alt_t ao_ground_height; /* MSL of ao_ground_pres */ +extern pres_t ao_sample_pres; /* most recent pressure sensor reading */ +extern alt_t ao_sample_alt; /* MSL of ao_sample_pres */ +extern alt_t ao_sample_height; /* AGL of ao_sample_pres */ +extern pres_t ao_ground_pres; /* startup pressure */ +extern alt_t ao_ground_height; /* MSL of ao_ground_pres */ #endif #if HAS_ACCEL -extern __pdata accel_t ao_sample_accel; /* most recent accel sensor reading */ -extern __pdata accel_t ao_ground_accel; /* startup acceleration */ -extern __pdata accel_t ao_accel_2g; /* factory accel calibration */ -extern __pdata int32_t ao_accel_scale; /* sensor to m/s² conversion */ +extern accel_t ao_sample_accel; /* most recent accel sensor reading */ +extern accel_t ao_ground_accel; /* startup acceleration */ +extern accel_t ao_accel_2g; /* factory accel calibration */ +extern int32_t ao_accel_scale; /* sensor to m/s² conversion */ #endif #if HAS_GYRO -extern __pdata accel_t ao_ground_accel_along; -extern __pdata accel_t ao_ground_accel_across; -extern __pdata accel_t ao_ground_accel_through; -extern __pdata int32_t ao_ground_pitch; /* * 512 */ -extern __pdata int32_t ao_ground_yaw; /* * 512 */ -extern __pdata int32_t ao_ground_roll; /* * 512 */ -extern __pdata accel_t ao_sample_accel_along; -extern __pdata accel_t ao_sample_accel_across; -extern __pdata accel_t ao_sample_accel_through; -extern __pdata gyro_t ao_sample_roll; -extern __pdata gyro_t ao_sample_pitch; -extern __pdata gyro_t ao_sample_yaw; +extern accel_t ao_ground_accel_along; +extern accel_t ao_ground_accel_across; +extern accel_t ao_ground_accel_through; +extern int32_t ao_ground_pitch; /* * 512 */ +extern int32_t ao_ground_yaw; /* * 512 */ +extern int32_t ao_ground_roll; /* * 512 */ +extern accel_t ao_sample_accel_along; +extern accel_t ao_sample_accel_across; +extern accel_t ao_sample_accel_through; +extern gyro_t ao_sample_roll; +extern gyro_t ao_sample_pitch; +extern gyro_t ao_sample_yaw; #define AO_NUM_ORIENT 64 -extern __pdata angle_t ao_sample_orient; -extern __pdata angle_t ao_sample_orients[AO_NUM_ORIENT]; -extern __pdata uint8_t ao_sample_orient_pos; +extern angle_t ao_sample_orient; +extern angle_t ao_sample_orients[AO_NUM_ORIENT]; +extern uint8_t ao_sample_orient_pos; #endif void ao_sample_init(void); @@ -176,19 +176,19 @@ uint8_t ao_sample(void); #define from_fix(x) ((x) >> 16) -extern __pdata ao_v_t ao_height; /* meters */ -extern __pdata ao_v_t ao_speed; /* m/s * 16 */ -extern __pdata ao_v_t ao_accel; /* m/s² * 16 */ -extern __xdata ao_v_t ao_max_height; /* max of ao_height */ -extern __xdata ao_v_t ao_avg_height; /* running average of height */ +extern ao_v_t ao_height; /* meters */ +extern ao_v_t ao_speed; /* m/s * 16 */ +extern ao_v_t ao_accel; /* m/s² * 16 */ +extern ao_v_t ao_max_height; /* max of ao_height */ +extern ao_v_t ao_avg_height; /* running average of height */ -extern __pdata ao_v_t ao_error_h; +extern ao_v_t ao_error_h; #if !HAS_ACCEL -extern __pdata ao_v_t ao_error_h_sq_avg; +extern ao_v_t ao_error_h_sq_avg; #endif #if HAS_ACCEL -extern __pdata ao_v_t ao_error_a; +extern ao_v_t ao_error_a; #endif #endif diff --git a/src/kernel/ao_sample_profile.c b/src/kernel/ao_sample_profile.c index 4819a161..b9d0e07f 100644 --- a/src/kernel/ao_sample_profile.c +++ b/src/kernel/ao_sample_profile.c @@ -160,7 +160,7 @@ ao_sample_profile_cmd(void) } } -static __code struct ao_cmds ao_sample_profile_cmds[] = { +static const struct ao_cmds ao_sample_profile_cmds[] = { { ao_sample_profile_cmd, "S <1 start,0 stop, d dump,c clear>\0Sample profile" }, { 0, NULL } }; diff --git a/src/kernel/ao_send_packet.c b/src/kernel/ao_send_packet.c index c8a1d46e..3206b2d6 100644 --- a/src/kernel/ao_send_packet.c +++ b/src/kernel/ao_send_packet.c @@ -20,14 +20,14 @@ #define AO_MAX_SEND 128 -static __xdata uint8_t ao_send[AO_MAX_SEND]; +static uint8_t ao_send[AO_MAX_SEND]; static void ao_send_packet(void) { - __pdata uint16_t count; + uint16_t count; uint8_t b; - __pdata uint8_t i; + uint8_t i; ao_cmd_hex(); count = ao_cmd_lex_i; @@ -47,7 +47,7 @@ ao_send_packet(void) ao_radio_send(ao_send, count); } -static __code struct ao_cmds ao_send_packet_cmds[] = { +static const struct ao_cmds ao_send_packet_cmds[] = { { ao_send_packet, "S \0Send packet. Data on next line" }, { 0, NULL } }; diff --git a/src/kernel/ao_serial.h b/src/kernel/ao_serial.h index ef3e93d7..440b562b 100644 --- a/src/kernel/ao_serial.h +++ b/src/kernel/ao_serial.h @@ -26,8 +26,8 @@ #define AO_SERIAL_SPEED_115200 4 #if HAS_SERIAL_0 -extern volatile __xdata struct ao_fifo ao_serial0_rx_fifo; -extern volatile __xdata struct ao_fifo ao_serial0_tx_fifo; +extern volatile struct ao_fifo ao_serial0_rx_fifo; +extern volatile struct ao_fifo ao_serial0_tx_fifo; char ao_serial0_getchar(void); @@ -49,8 +49,8 @@ ao_serial0_set_speed(uint8_t speed); #endif #if HAS_SERIAL_1 -extern volatile __xdata struct ao_fifo ao_serial1_rx_fifo; -extern volatile __xdata struct ao_fifo ao_serial1_tx_fifo; +extern volatile struct ao_fifo ao_serial1_rx_fifo; +extern volatile struct ao_fifo ao_serial1_tx_fifo; char ao_serial1_getchar(void); @@ -72,8 +72,8 @@ ao_serial1_set_speed(uint8_t speed); #endif #if HAS_SERIAL_2 -extern volatile __xdata struct ao_fifo ao_serial2_rx_fifo; -extern volatile __xdata struct ao_fifo ao_serial2_tx_fifo; +extern volatile struct ao_fifo ao_serial2_rx_fifo; +extern volatile struct ao_fifo ao_serial2_tx_fifo; char ao_serial2_getchar(void); @@ -95,8 +95,8 @@ ao_serial2_set_speed(uint8_t speed); #endif #if HAS_SERIAL_3 -extern volatile __xdata struct ao_fifo ao_serial3_rx_fifo; -extern volatile __xdata struct ao_fifo ao_serial3_tx_fifo; +extern volatile struct ao_fifo ao_serial3_rx_fifo; +extern volatile struct ao_fifo ao_serial3_tx_fifo; char ao_serial3_getchar(void); diff --git a/src/kernel/ao_stdio.c b/src/kernel/ao_stdio.c index 227499c8..c3b51d12 100644 --- a/src/kernel/ao_stdio.c +++ b/src/kernel/ao_stdio.c @@ -72,13 +72,13 @@ #define AO_NUM_STDIOS (HAS_USB + PACKET_HAS_SLAVE + USE_SERIAL_STDIN + CONSOLE_STDIN) -__xdata struct ao_stdio ao_stdios[AO_NUM_STDIOS]; +struct ao_stdio ao_stdios[AO_NUM_STDIOS]; #if AO_NUM_STDIOS > 1 -__pdata int8_t ao_cur_stdio; -__pdata int8_t ao_num_stdios; +int8_t ao_cur_stdio; +int8_t ao_num_stdios; #else -__pdata int8_t ao_cur_stdio; +int8_t ao_cur_stdio; #define ao_cur_stdio 0 #define ao_num_stdios 0 #endif @@ -108,10 +108,10 @@ flush(void) ao_stdios[ao_cur_stdio].flush(); } -__xdata uint8_t ao_stdin_ready; +uint8_t ao_stdin_ready; char -ao_getchar(void) __reentrant +ao_getchar(void) { int c; int8_t stdio; @@ -145,7 +145,7 @@ ao_echo(void) int8_t ao_add_stdio(int (*_pollchar)(void), void (*putchar)(char), - void (*flush)(void)) __reentrant + void (*flush)(void)) { if (ao_num_stdios == AO_NUM_STDIOS) ao_panic(AO_PANIC_STDIO); diff --git a/src/kernel/ao_storage.c b/src/kernel/ao_storage.c index 400751de..5292e120 100644 --- a/src/kernel/ao_storage.c +++ b/src/kernel/ao_storage.c @@ -20,7 +20,7 @@ #include uint8_t -ao_storage_read(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant +ao_storage_read(ao_pos_t pos, void *buf, uint16_t len) { #ifdef CC1111 return ao_storage_device_read(pos, buf, len); @@ -54,7 +54,7 @@ ao_storage_read(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant } uint8_t -ao_storage_write(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant +ao_storage_write(ao_pos_t pos, void *buf, uint16_t len) { #ifdef CC1111 return ao_storage_device_write(pos, buf, len); @@ -87,10 +87,10 @@ ao_storage_write(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant #endif } -static __xdata uint8_t storage_data[128]; +static uint8_t storage_data[128]; static void -ao_storage_dump(void) __reentrant +ao_storage_dump(void) { uint8_t i, j; @@ -118,12 +118,12 @@ ao_storage_dump(void) __reentrant /* not enough space for this today */ static void -ao_storage_store(void) __reentrant +ao_storage_store(void) { uint16_t block; uint8_t i; uint16_t len; - static __xdata uint8_t b; + static uint8_t b; uint32_t addr; ao_cmd_hex(); @@ -147,7 +147,7 @@ ao_storage_store(void) __reentrant #endif void -ao_storage_zap(void) __reentrant +ao_storage_zap(void) { ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) @@ -156,7 +156,7 @@ ao_storage_zap(void) __reentrant } void -ao_storage_zapall(void) __reentrant +ao_storage_zapall(void) { uint32_t pos; @@ -272,7 +272,7 @@ ao_storage_incr_check_block(uint32_t pos) } static uint8_t -ao_storage_test_block(uint32_t pos) __reentrant +ao_storage_test_block(uint32_t pos) { ao_storage_erase(pos); printf(" erase"); flush(); @@ -299,7 +299,7 @@ ao_storage_test_block(uint32_t pos) __reentrant } static void -ao_storage_test(void) __reentrant +ao_storage_test(void) { uint32_t pos; @@ -316,7 +316,7 @@ ao_storage_test(void) __reentrant #endif /* AO_STORAGE_TEST */ void -ao_storage_info(void) __reentrant +ao_storage_info(void) { ao_storage_setup(); printf("Storage size: %ld\n", (long) ao_storage_total); @@ -324,7 +324,7 @@ ao_storage_info(void) __reentrant ao_storage_device_info(); } -__code struct ao_cmds ao_storage_cmds[] = { +const struct ao_cmds ao_storage_cmds[] = { { ao_storage_info, "f\0Show storage" }, { ao_storage_dump, "e \0Dump flash" }, #if HAS_STORAGE_DEBUG diff --git a/src/kernel/ao_storage.h b/src/kernel/ao_storage.h index 59b137ad..cf37a824 100644 --- a/src/kernel/ao_storage.h +++ b/src/kernel/ao_storage.h @@ -31,10 +31,10 @@ typedef ao_storage_pos_t ao_pos_t; /* Total bytes of available storage */ -extern __pdata ao_pos_t ao_storage_total; +extern ao_pos_t ao_storage_total; /* Block size - device is erased in these units. At least 256 bytes */ -extern __pdata ao_pos_t ao_storage_block; +extern ao_pos_t ao_storage_block; #ifndef USE_STORAGE_CONFIG #define USE_STORAGE_CONFIG 1 @@ -42,7 +42,7 @@ extern __pdata ao_pos_t ao_storage_block; #if USE_STORAGE_CONFIG /* Byte offset of config block. Will be ao_storage_block bytes long */ -extern __pdata ao_pos_t ao_storage_config; +extern ao_pos_t ao_storage_config; #define ao_storage_log_max ao_storage_config #else @@ -50,27 +50,27 @@ extern __pdata ao_pos_t ao_storage_config; #endif /* Storage unit size - device reads and writes must be within blocks of this size. Usually 256 bytes. */ -extern __pdata uint16_t ao_storage_unit; +extern uint16_t ao_storage_unit; /* Initialize above values. Can only be called once the OS is running */ void -ao_storage_setup(void) __reentrant; +ao_storage_setup(void); /* Write data. Returns 0 on failure, 1 on success */ uint8_t -ao_storage_write(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant; +ao_storage_write(ao_pos_t pos, void *buf, uint16_t len); /* Read data. Returns 0 on failure, 1 on success */ uint8_t -ao_storage_read(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant; +ao_storage_read(ao_pos_t pos, void *buf, uint16_t len); /* Erase a block of storage. This always clears ao_storage_block bytes */ uint8_t -ao_storage_erase(ao_pos_t pos) __reentrant; +ao_storage_erase(ao_pos_t pos); /* Flush any pending writes to stable storage */ void -ao_storage_flush(void) __reentrant; +ao_storage_flush(void); /* Initialize the storage code */ void @@ -82,11 +82,11 @@ ao_storage_init(void); /* Read data within a storage unit */ uint8_t -ao_storage_device_read(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant; +ao_storage_device_read(ao_pos_t pos, void *buf, uint16_t len); /* Write data within a storage unit */ uint8_t -ao_storage_device_write(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant; +ao_storage_device_write(ao_pos_t pos, void *buf, uint16_t len); /* Initialize low-level device bits */ void @@ -94,6 +94,6 @@ ao_storage_device_init(void); /* Print out information about flash chips */ void -ao_storage_device_info(void) __reentrant; +ao_storage_device_info(void); #endif /* _AO_STORAGE_H_ */ diff --git a/src/kernel/ao_task.c b/src/kernel/ao_task.c index de23ea02..4f7072cb 100644 --- a/src/kernel/ao_task.c +++ b/src/kernel/ao_task.c @@ -29,12 +29,12 @@ #define AO_NO_TASK_INDEX 0xff -__xdata struct ao_task * __xdata ao_tasks[AO_NUM_TASKS]; -__data uint8_t ao_num_tasks; -__xdata struct ao_task *__data ao_cur_task; +struct ao_task * ao_tasks[AO_NUM_TASKS]; +uint8_t ao_num_tasks; +struct ao_task *ao_cur_task; #if !HAS_TASK_QUEUE -static __data uint8_t ao_cur_task_index; +static uint8_t ao_cur_task_index; #endif #ifdef ao_arch_task_globals @@ -290,7 +290,7 @@ ao_task_validate(void) #endif /* HAS_TASK_QUEUE */ void -ao_add_task(__xdata struct ao_task * task, void (*start)(void), __code char *name) __reentrant +ao_add_task(struct ao_task * task, void (*start)(void), const char *name) { uint8_t task_id; uint8_t t; @@ -321,7 +321,7 @@ ao_add_task(__xdata struct ao_task * task, void (*start)(void), __code char *nam ); } -__data uint8_t ao_task_minimize_latency; +uint8_t ao_task_minimize_latency; /* Task switching function. This must not use any stack variables */ void @@ -382,7 +382,7 @@ ao_yield(void) ao_arch_naked_define ao_cur_task = ao_list_first_entry(&run_queue, struct ao_task, queue); #else { - __pdata uint8_t ao_last_task_index = ao_cur_task_index; + uint8_t ao_last_task_index = ao_cur_task_index; for (;;) { ++ao_cur_task_index; if (ao_cur_task_index == ao_num_tasks) @@ -418,7 +418,7 @@ ao_yield(void) ao_arch_naked_define } uint8_t -ao_sleep(__xdata void *wchan) +ao_sleep(void *wchan) { #if HAS_TASK_QUEUE uint32_t flags; @@ -439,7 +439,7 @@ ao_sleep(__xdata void *wchan) } void -ao_wakeup(__xdata void *wchan) __reentrant +ao_wakeup(void *wchan) { ao_validate_cur_stack(); #if HAS_TASK_QUEUE @@ -470,7 +470,7 @@ ao_wakeup(__xdata void *wchan) __reentrant } uint8_t -ao_sleep_for(__xdata void *wchan, uint16_t timeout) +ao_sleep_for(void *wchan, uint16_t timeout) { uint8_t ret; if (timeout) { @@ -504,7 +504,7 @@ ao_sleep_for(__xdata void *wchan, uint16_t timeout) return ret; } -static __xdata uint8_t ao_forever; +static uint8_t ao_forever; void ao_delay(uint16_t ticks) @@ -541,7 +541,7 @@ void ao_task_info(void) { uint8_t i; - __xdata struct ao_task *task; + struct ao_task *task; uint16_t now = ao_time(); for (i = 0; i < ao_num_tasks; i++) { diff --git a/src/kernel/ao_task.h b/src/kernel/ao_task.h index 7549b598..ffeb7313 100644 --- a/src/kernel/ao_task.h +++ b/src/kernel/ao_task.h @@ -39,11 +39,11 @@ /* An AltOS task */ struct ao_task { - __xdata void *wchan; /* current wait channel (NULL if running) */ + void *wchan; /* current wait channel (NULL if running) */ uint16_t alarm; /* abort ao_sleep time */ ao_arch_task_members /* any architecture-specific fields */ uint8_t task_id; /* unique id */ - __code char *name; /* task name */ + const char *name; /* task name */ #ifdef NEWLIB int __errno; /* storage for errno in newlib libc */ #endif @@ -66,10 +66,10 @@ struct ao_task { #define AO_NO_TASK 0 /* no task id */ -extern __xdata struct ao_task * __xdata ao_tasks[AO_NUM_TASKS]; -extern __data uint8_t ao_num_tasks; -extern __xdata struct ao_task *__data ao_cur_task; -extern __data uint8_t ao_task_minimize_latency; /* Reduce IRQ latency */ +extern struct ao_task * ao_tasks[AO_NUM_TASKS]; +extern uint8_t ao_num_tasks; +extern struct ao_task *ao_cur_task; +extern uint8_t ao_task_minimize_latency; /* Reduce IRQ latency */ #ifndef HAS_ARCH_VALIDATE_CUR_STACK #define ao_validate_cur_stack() @@ -85,7 +85,7 @@ extern __data uint8_t ao_task_minimize_latency; /* Reduce IRQ latency */ * 1 on alarm */ uint8_t -ao_sleep(__xdata void *wchan); +ao_sleep(void *wchan); /* Suspend the current task until wchan is awoken or the timeout * expires. returns: @@ -93,11 +93,11 @@ ao_sleep(__xdata void *wchan); * 1 on alarm */ uint8_t -ao_sleep_for(__xdata void *wchan, uint16_t timeout); +ao_sleep_for(void *wchan, uint16_t timeout); /* Wake all tasks sleeping on wchan */ void -ao_wakeup(__xdata void *wchan) __reentrant; +ao_wakeup(void *wchan); #if 0 /* set an alarm to go off in 'delay' ticks */ @@ -115,7 +115,7 @@ ao_yield(void) ao_arch_naked_declare; /* Add a task to the run queue */ void -ao_add_task(__xdata struct ao_task * task, void (*start)(void), __code char *name) __reentrant; +ao_add_task(struct ao_task * task, void (*start)(void), const char *name); #if HAS_TASK_QUEUE /* Called on timer interrupt to check alarms */ diff --git a/src/kernel/ao_telemetry.c b/src/kernel/ao_telemetry.c index 8ff28fde..9e1304f7 100644 --- a/src/kernel/ao_telemetry.c +++ b/src/kernel/ao_telemetry.c @@ -20,10 +20,10 @@ #include "ao_log.h" #include "ao_product.h" -static __pdata uint16_t ao_telemetry_interval; +static uint16_t ao_telemetry_interval; #if HAS_RADIO_RATE -static __xdata uint16_t ao_telemetry_desired_interval; +static uint16_t ao_telemetry_desired_interval; #endif /* TeleMetrum v1.0 just doesn't have enough space to @@ -37,10 +37,10 @@ static __xdata uint16_t ao_telemetry_desired_interval; #ifdef SIMPLIFY #define ao_telemetry_time time -#define RDF_SPACE __pdata +#define RDF_SPACE #else -#define RDF_SPACE __xdata -static __pdata uint16_t ao_telemetry_time; +#define RDF_SPACE +static uint16_t ao_telemetry_time; #endif #if HAS_RDF @@ -49,7 +49,7 @@ static RDF_SPACE uint16_t ao_rdf_time; #endif #if HAS_APRS -static __pdata uint16_t ao_aprs_time; +static uint16_t ao_aprs_time; #include #endif @@ -74,7 +74,7 @@ static __pdata uint16_t ao_aprs_time; #define AO_TELEMETRY_SENSOR AO_TELEMETRY_SENSOR_TELENANO #endif -static __xdata union ao_telemetry_all telemetry; +static union ao_telemetry_all telemetry; static void ao_telemetry_send(void) @@ -88,7 +88,7 @@ ao_telemetry_send(void) static void ao_send_sensor(void) { - __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; + struct ao_data *packet = (struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; telemetry.generic.tick = packet->tick; telemetry.generic.type = AO_TELEMETRY_SENSOR; @@ -136,7 +136,7 @@ ao_send_sensor(void) static void ao_send_mega_sensor(void) { - __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; + struct ao_data *packet = (struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; telemetry.generic.tick = packet->tick; telemetry.generic.type = AO_TELEMETRY_MEGA_SENSOR; @@ -181,15 +181,15 @@ ao_send_mega_sensor(void) ao_telemetry_send(); } -static __pdata int8_t ao_telemetry_mega_data_max; -static __pdata int8_t ao_telemetry_mega_data_cur; +static int8_t ao_telemetry_mega_data_max; +static int8_t ao_telemetry_mega_data_cur; /* Send mega data packet */ static void ao_send_mega_data(void) { if (--ao_telemetry_mega_data_cur <= 0) { - __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; + struct ao_data *packet = (struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; uint8_t i; telemetry.generic.tick = packet->tick; @@ -223,7 +223,7 @@ ao_send_mega_data(void) static void ao_send_metrum_sensor(void) { - __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; + struct ao_data *packet = (struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; telemetry.generic.tick = packet->tick; telemetry.generic.type = AO_TELEMETRY_METRUM_SENSOR; @@ -246,15 +246,15 @@ ao_send_metrum_sensor(void) ao_telemetry_send(); } -static __pdata int8_t ao_telemetry_metrum_data_max; -static __pdata int8_t ao_telemetry_metrum_data_cur; +static int8_t ao_telemetry_metrum_data_max; +static int8_t ao_telemetry_metrum_data_cur; /* Send telemetrum data packet */ static void ao_send_metrum_data(void) { if (--ao_telemetry_metrum_data_cur <= 0) { - __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; + struct ao_data *packet = (struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; telemetry.generic.tick = packet->tick; telemetry.generic.type = AO_TELEMETRY_METRUM_DATA; @@ -281,7 +281,7 @@ ao_send_metrum_data(void) static void ao_send_mini(void) { - __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; + struct ao_data *packet = (struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; telemetry.generic.tick = packet->tick; telemetry.generic.type = AO_SEND_MINI; @@ -306,9 +306,9 @@ ao_send_mini(void) #endif /* AO_SEND_MINI */ -static __pdata int8_t ao_telemetry_config_max; -static __pdata int8_t ao_telemetry_config_cur; -static __pdata uint16_t ao_telemetry_flight_number; +static int8_t ao_telemetry_config_max; +static int8_t ao_telemetry_config_cur; +static uint16_t ao_telemetry_flight_number; #ifndef ao_telemetry_battery_convert #define ao_telemetry_battery_convert(a) (a) @@ -346,9 +346,9 @@ ao_send_configuration(void) #if HAS_GPS -static __pdata int8_t ao_telemetry_gps_max; -static __pdata int8_t ao_telemetry_loc_cur; -static __pdata int8_t ao_telemetry_sat_cur; +static int8_t ao_telemetry_gps_max; +static int8_t ao_telemetry_loc_cur; +static int8_t ao_telemetry_sat_cur; static void ao_send_location(void) @@ -387,8 +387,8 @@ ao_send_satellite(void) #if HAS_COMPANION -static __pdata int8_t ao_telemetry_companion_max; -static __pdata int8_t ao_telemetry_companion_cur; +static int8_t ao_telemetry_companion_max; +static int8_t ao_telemetry_companion_cur; static void ao_send_companion(void) @@ -536,7 +536,7 @@ ao_telemetry_set_interval(uint16_t interval) #if HAS_RADIO_RATE /* Limit max telemetry rate based on available radio bandwidth. */ - static __xdata const uint16_t min_interval[] = { + static const uint16_t min_interval[] = { /* [AO_RADIO_RATE_38400] = */ AO_MS_TO_TICKS(100), /* [AO_RADIO_RATE_9600] = */ AO_MS_TO_TICKS(500), /* [AO_RADIO_RATE_2400] = */ AO_MS_TO_TICKS(1000) @@ -613,7 +613,7 @@ ao_rdf_set(uint8_t rdf) } #endif -__xdata struct ao_task ao_telemetry_task; +struct ao_task ao_telemetry_task; void ao_telemetry_init() diff --git a/src/kernel/ao_usb.h b/src/kernel/ao_usb.h index 40516de1..7992c806 100644 --- a/src/kernel/ao_usb.h +++ b/src/kernel/ao_usb.h @@ -69,7 +69,7 @@ ao_usb_disable(void); void ao_usb_init(void); -extern __code __at (0x00aa) uint8_t ao_usb_descriptors []; +extern const __at (0x00aa) uint8_t ao_usb_descriptors []; #define AO_USB_SETUP_DIR_MASK (0x01 << 7) #define AO_USB_SETUP_TYPE_MASK (0x03 << 5) @@ -176,8 +176,8 @@ struct ao_usb_line_coding { uint8_t data_bits; } ; -extern __xdata struct ao_usb_line_coding ao_usb_line_coding; +extern struct ao_usb_line_coding ao_usb_line_coding; -extern __pdata uint8_t ao_usb_running; +extern uint8_t ao_usb_running; #endif /* _AO_USB_H_ */ diff --git a/src/lpc/altos-loader.ld b/src/lpc/altos-loader.ld index 84d7610c..be4f115d 100644 --- a/src/lpc/altos-loader.ld +++ b/src/lpc/altos-loader.ld @@ -61,9 +61,9 @@ SECTIONS { /* Data -- relocated to RAM, but written to ROM */ .data : { - __data_start__ = .; + _start__ = .; *(.data*) /* initialized data */ - __data_end__ = .; + _end__ = .; } >ram AT>rom diff --git a/src/lpc/altos-standalone.ld b/src/lpc/altos-standalone.ld index db53dcaf..99d10149 100644 --- a/src/lpc/altos-standalone.ld +++ b/src/lpc/altos-standalone.ld @@ -65,9 +65,9 @@ SECTIONS { /* Data -- relocated to RAM, but written to ROM */ .data ORIGIN(ram) : AT (ADDR(.ARM.exidx) + SIZEOF (.ARM.exidx)) { - __data_start__ = .; + _start__ = .; *(.data) /* initialized data */ - __data_end__ = .; + _end__ = .; __bss_start__ = .; } >ram diff --git a/src/lpc/altos.ld b/src/lpc/altos.ld index e6a6a7ed..028ad775 100644 --- a/src/lpc/altos.ld +++ b/src/lpc/altos.ld @@ -69,9 +69,9 @@ SECTIONS { /* Data -- relocated to RAM, but written to ROM */ .data : AT (ADDR(.ARM.exidx) + SIZEOF (.ARM.exidx)) { - __data_start__ = .; + _start__ = .; *(.data) /* initialized data */ - __data_end__ = .; + _end__ = .; __bss_start__ = .; } >ram diff --git a/src/lpc/ao_adc_lpc.c b/src/lpc/ao_adc_lpc.c index 26a5ea08..6743c1f4 100644 --- a/src/lpc/ao_adc_lpc.c +++ b/src/lpc/ao_adc_lpc.c @@ -147,7 +147,7 @@ ao_adc_poll(void) } static void -ao_adc_dump(void) __reentrant +ao_adc_dump(void) { struct ao_data packet; #ifndef AO_ADC_DUMP @@ -167,7 +167,7 @@ ao_adc_dump(void) __reentrant #endif } -__code struct ao_cmds ao_adc_cmds[] = { +const struct ao_cmds ao_adc_cmds[] = { { ao_adc_dump, "a\0Display current ADC values" }, { 0, NULL }, }; diff --git a/src/lpc/ao_arch.h b/src/lpc/ao_arch.h index f1df14eb..889be53e 100644 --- a/src/lpc/ao_arch.h +++ b/src/lpc/ao_arch.h @@ -42,11 +42,6 @@ #define ao_arch_naked_declare __attribute__((naked)) #define ao_arch_naked_define -#define __pdata -#define __data -#define __xdata -#define __code const -#define __reentrant #define __interrupt(n) #define __at(n) diff --git a/src/lpc/ao_beep_lpc.c b/src/lpc/ao_beep_lpc.c index b1211752..eab86ee6 100644 --- a/src/lpc/ao_beep_lpc.c +++ b/src/lpc/ao_beep_lpc.c @@ -59,7 +59,7 @@ ao_beep(uint8_t beep) } void -ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant +ao_beep_for(uint8_t beep, uint16_t ticks) { ao_beep(beep); ao_delay(ticks); diff --git a/src/lpc/ao_interrupt.c b/src/lpc/ao_interrupt.c index 3e0119c6..8d71f43f 100644 --- a/src/lpc/ao_interrupt.c +++ b/src/lpc/ao_interrupt.c @@ -32,7 +32,7 @@ extern void main(void); extern char __stack__; extern char __text_start__, __text_end__; -extern char __data_start__, __data_end__; +extern char _start__, _end__; extern char __bss_start__, __bss_end__; #if RELOCATE_INTERRUPT extern char __interrupt_rom__, __interrupt_start__, __interrupt_end__; @@ -61,7 +61,7 @@ void start(void) { memcpy(&__interrupt_start__, &__interrupt_rom__, &__interrupt_end__ - &__interrupt_start__); lpc_scb.sysmemremap = LPC_SCB_SYSMEMREMAP_MAP_RAM << LPC_SCB_SYSMEMREMAP_MAP; #endif - memcpy(&__data_start__, &__text_end__, &__data_end__ - &__data_start__); + memcpy(&_start__, &__text_end__, &_end__ - &_start__); memset(&__bss_start__, '\0', &__bss_end__ - &__bss_start__); main(); } diff --git a/src/lpc/ao_led_lpc.c b/src/lpc/ao_led_lpc.c index 2d2c3972..5fc726c0 100644 --- a/src/lpc/ao_led_lpc.c +++ b/src/lpc/ao_led_lpc.c @@ -18,7 +18,7 @@ #include -__pdata AO_PORT_TYPE ao_led_enable; +AO_PORT_TYPE ao_led_enable; void ao_led_on(AO_PORT_TYPE colors) @@ -49,7 +49,7 @@ ao_led_toggle(AO_PORT_TYPE colors) } void -ao_led_for(AO_PORT_TYPE colors, uint16_t ticks) __reentrant +ao_led_for(AO_PORT_TYPE colors, uint16_t ticks) { ao_led_on(colors); ao_delay(ticks); diff --git a/src/lpc/ao_timer_lpc.c b/src/lpc/ao_timer_lpc.c index 166e2f15..8999c7ac 100644 --- a/src/lpc/ao_timer_lpc.c +++ b/src/lpc/ao_timer_lpc.c @@ -18,7 +18,7 @@ #include -volatile __data AO_TICK_TYPE ao_tick_count; +volatile AO_TICK_TYPE ao_tick_count; uint16_t ao_time(void) @@ -27,8 +27,8 @@ ao_time(void) } #if AO_DATA_ALL -volatile __data uint8_t ao_data_interval = 1; -volatile __data uint8_t ao_data_count; +volatile uint8_t ao_data_interval = 1; +volatile uint8_t ao_data_count; #endif void lpc_systick_isr(void) diff --git a/src/lpc/ao_usb_lpc.c b/src/lpc/ao_usb_lpc.c index d26a1437..5cd7aa59 100644 --- a/src/lpc/ao_usb_lpc.c +++ b/src/lpc/ao_usb_lpc.c @@ -1003,7 +1003,7 @@ ao_usb_irq(void) control_count, out_count, in_count, int_count, reset_count); } -__code struct ao_cmds ao_usb_cmds[] = { +const struct ao_cmds ao_usb_cmds[] = { { ao_usb_irq, "I\0Show USB interrupt counts" }, { 0, NULL } }; diff --git a/src/micropeak-v2.0/micropeak.ld b/src/micropeak-v2.0/micropeak.ld index baeae5b8..a73d4c1d 100644 --- a/src/micropeak-v2.0/micropeak.ld +++ b/src/micropeak-v2.0/micropeak.ld @@ -90,7 +90,7 @@ SECTIONS { */ .textram BLOCK(8): { - __data_start__ = .; + _start__ = .; *(.ramtext) } >ram AT>rom @@ -99,7 +99,7 @@ SECTIONS { */ .data BLOCK(8): { *(.data) /* initialized data */ - __data_end__ = .; + _end__ = .; } >ram AT>rom .bss : { diff --git a/src/nucleao-32/load.ld b/src/nucleao-32/load.ld index 02a23a95..945f7c60 100644 --- a/src/nucleao-32/load.ld +++ b/src/nucleao-32/load.ld @@ -82,10 +82,10 @@ SECTIONS { /* Data -- relocated to RAM, but written to ROM */ .data : { - __data_start__ = .; + _start__ = .; *(.data) /* initialized data */ . = ALIGN(4); - __data_end__ = .; + _end__ = .; } >ram AT>rom .bss : { diff --git a/src/pnpservo-v1/lambda.ld b/src/pnpservo-v1/lambda.ld index 5de65eb5..d3edbe9f 100644 --- a/src/pnpservo-v1/lambda.ld +++ b/src/pnpservo-v1/lambda.ld @@ -85,7 +85,7 @@ SECTIONS { */ .textram BLOCK(8): { - __data_start__ = .; + _start__ = .; __text_ram_start__ = .; *(.ramtext) __text_ram_end = .; @@ -96,7 +96,7 @@ SECTIONS { .data : { *(.data) /* initialized data */ . = ALIGN(4); - __data_end__ = .; + _end__ = .; } >ram AT>rom .bss : { diff --git a/src/product/ao_flash_task.c b/src/product/ao_flash_task.c index 1f0edb05..a680ca18 100644 --- a/src/product/ao_flash_task.c +++ b/src/product/ao_flash_task.c @@ -29,7 +29,7 @@ ao_panic(uint8_t reason) } void -ao_put_string(__code char *s) +ao_put_string(const char *s) { char c; while ((c = *s++)) { diff --git a/src/product/ao_terraui.c b/src/product/ao_terraui.c index f8f23a0f..3a989f5a 100644 --- a/src/product/ao_terraui.c +++ b/src/product/ao_terraui.c @@ -20,15 +20,15 @@ #include #include -static __xdata struct ao_telemetry_sensor ao_tel_sensor; -static __xdata struct ao_telemetry_location ao_tel_location; -static __xdata struct ao_telemetry_configuration ao_tel_config; -static __xdata int16_t ao_tel_max_speed; -static __xdata int16_t ao_tel_max_height; +static struct ao_telemetry_sensor ao_tel_sensor; +static struct ao_telemetry_location ao_tel_location; +static struct ao_telemetry_configuration ao_tel_config; +static int16_t ao_tel_max_speed; +static int16_t ao_tel_max_height; static int8_t ao_tel_rssi; -static __xdata char ao_lcd_line[17]; -static __xdata char ao_state_name[] = "SIPBFCDMLI"; +static char ao_lcd_line[17]; +static char ao_state_name[] = "SIPBFCDMLI"; static void ao_terraui_line(uint8_t addr) @@ -85,7 +85,7 @@ ao_terraui_logging(void) return '-'; } -static __code char ao_progress[4] = { '\011', '\012', '\014', '\013' }; +static const char ao_progress[4] = { '\011', '\012', '\014', '\013' }; static uint8_t ao_telem_progress; static uint8_t ao_gps_progress; @@ -165,7 +165,7 @@ static int16_t mag(int32_t d) static int32_t dist(int32_t d) { - __pdata uint32_t m; + uint32_t m; uint8_t neg = 0; if (d < 0) { @@ -184,7 +184,7 @@ dist(int32_t d) return d; } -static __code uint8_t cos_table[] = { +static const uint8_t cos_table[] = { 0, /* 0 */ 0, /* 1 */ 0, /* 2 */ @@ -242,7 +242,7 @@ static __code uint8_t cos_table[] = { 1, /* 54 */ }; -static __code uint8_t tan_table[] = { +static const uint8_t tan_table[] = { 0, /* 0 */ 4, /* 1 */ 9, /* 2 */ @@ -290,7 +290,7 @@ static __code uint8_t tan_table[] = { 247, /* 44 */ }; -int16_t ao_atan2(int32_t dy, int32_t dx) __reentrant +int16_t ao_atan2(int32_t dy, int32_t dx) { int8_t m = 1; int16_t a = 0; @@ -334,10 +334,10 @@ int16_t ao_atan2(int32_t dy, int32_t dx) __reentrant return t * m + a; } -static __pdata int32_t lon_dist, lat_dist; -static __pdata uint32_t ground_dist, range; -static __pdata uint8_t dist_in_km; -static __pdata int16_t bearing, elevation; +static int32_t lon_dist, lat_dist; +static uint32_t ground_dist, range; +static uint8_t dist_in_km; +static int16_t bearing, elevation; static void ao_terraui_lat_dist(void) @@ -346,7 +346,7 @@ ao_terraui_lat_dist(void) } static void -ao_terraui_lon_dist(void) __reentrant +ao_terraui_lon_dist(void) { uint8_t c = cos_table[ao_gps_data.latitude >> 24]; lon_dist = ao_tel_location.longitude; @@ -418,7 +418,7 @@ ao_terraui_recover(void) } static void -ao_terraui_coord(int32_t c, char plus, char minus, char extra) __reentrant +ao_terraui_coord(int32_t c, char plus, char minus, char extra) { uint16_t d; uint8_t m; @@ -448,7 +448,7 @@ ao_terraui_remote(void) } static void -ao_terraui_local(void) __reentrant +ao_terraui_local(void) { ao_terraui_coord(ao_gps_data.latitude, 'n', 's', ao_terraui_local_gps()); @@ -457,11 +457,11 @@ ao_terraui_local(void) __reentrant ao_terraui_line(AO_LCD_ADDR(1,0)); } -static __pdata uint8_t ao_set_freq; -static __pdata uint32_t ao_set_freq_orig; +static uint8_t ao_set_freq; +static uint32_t ao_set_freq_orig; static void -ao_terraui_freq(void) __reentrant +ao_terraui_freq(void) { uint16_t MHz; uint16_t frac; @@ -508,7 +508,7 @@ ao_terraui_freq_button(char b) { ao_radio_recv_abort(); } -static __code void (*__code ao_terraui_page[])(void) = { +static const void (*const ao_terraui_page[])(void) = { ao_terraui_startup, ao_terraui_info, ao_terraui_pad, @@ -521,8 +521,8 @@ static __code void (*__code ao_terraui_page[])(void) = { #define NUM_PAGE (sizeof (ao_terraui_page)/sizeof (ao_terraui_page[0])) -static __pdata uint8_t ao_current_page = 0; -static __pdata uint8_t ao_shown_about = 3; +static uint8_t ao_current_page = 0; +static uint8_t ao_shown_about = 3; static void ao_terraui(void) @@ -575,7 +575,7 @@ ao_terraui(void) } } -__xdata static struct ao_task ao_terraui_task; +static struct ao_task ao_terraui_task; static void ao_terramonitor(void) @@ -619,7 +619,7 @@ ao_terramonitor(void) } } -__xdata static struct ao_task ao_terramonitor_task; +static struct ao_task ao_terramonitor_task; static void ao_terragps(void) @@ -634,7 +634,7 @@ ao_terragps(void) } } -__xdata static struct ao_task ao_terragps_task; +static struct ao_task ao_terragps_task; void ao_terraui_init(void) diff --git a/src/product/ao_test.c b/src/product/ao_test.c index d1c60804..5db36293 100644 --- a/src/product/ao_test.c +++ b/src/product/ao_test.c @@ -18,13 +18,13 @@ #include "ao.h" -struct ao_task __xdata blink_0_task; -struct ao_task __xdata blink_1_task; -struct ao_task __xdata wakeup_task; -struct ao_task __xdata beep_task; -struct ao_task __xdata echo_task; +struct ao_task blink_0_task; +struct ao_task blink_1_task; +struct ao_task wakeup_task; +struct ao_task beep_task; +struct ao_task echo_task; -void delay(int n) __reentrant +void delay(int n) { uint8_t j = 0; while (--n) @@ -32,7 +32,7 @@ void delay(int n) __reentrant ao_yield(); } -static __xdata uint8_t blink_chan; +static uint8_t blink_chan; void blink_0(void) @@ -51,7 +51,7 @@ blink_0(void) void blink_1(void) { - static __xdata struct ao_adc adc; + static struct ao_adc adc; for (;;) { ao_sleep(&ao_adc_head); @@ -75,7 +75,7 @@ wakeup(void) void beep(void) { - static __xdata struct ao_adc adc; + static struct ao_adc adc; for (;;) { ao_delay(AO_SEC_TO_TICKS(1)); diff --git a/src/stm-bringup/bringup.ld b/src/stm-bringup/bringup.ld index dcdcf073..71039598 100644 --- a/src/stm-bringup/bringup.ld +++ b/src/stm-bringup/bringup.ld @@ -44,13 +44,13 @@ SECTIONS { } > rom . = ORIGIN(ram); - __data_start__ = .; + _start__ = .; /* Data -- relocated to RAM, but written to ROM */ .data : AT (ADDR(.ARM.exidx) + SIZEOF (.ARM.exidx)) { *(.data) /* initialized data */ - __data_end__ = .; + _end__ = .; __bss_start__ = .; } >ram diff --git a/src/stm-demo/ao_demo.c b/src/stm-demo/ao_demo.c index f6c8e3df..b0d03840 100644 --- a/src/stm-demo/ao_demo.c +++ b/src/stm-demo/ao_demo.c @@ -197,7 +197,7 @@ ao_blink_toggle(void) } -__code struct ao_cmds ao_demo_cmds[] = { +const struct ao_cmds ao_demo_cmds[] = { { ao_dma_test, "D\0DMA test" }, { ao_spi_write, "W\0SPI write" }, { ao_spi_read, "R\0SPI read" }, diff --git a/src/stm-scheme-newlib/ao_demo.c b/src/stm-scheme-newlib/ao_demo.c index 13a31288..cb8e10e8 100644 --- a/src/stm-scheme-newlib/ao_demo.c +++ b/src/stm-scheme-newlib/ao_demo.c @@ -26,7 +26,7 @@ static void scheme_cmd() { } -__code struct ao_cmds ao_demo_cmds[] = { +const struct ao_cmds ao_demo_cmds[] = { { scheme_cmd, "l\0Run scheme interpreter" }, { 0, NULL } }; diff --git a/src/stm-vga/ao_demo.c b/src/stm-vga/ao_demo.c index 1b443b1f..63740f8e 100644 --- a/src/stm-vga/ao_demo.c +++ b/src/stm-vga/ao_demo.c @@ -198,7 +198,7 @@ ao_console_send(void) } } -__code struct ao_cmds ao_demo_cmds[] = { +const struct ao_cmds ao_demo_cmds[] = { { ao_video_toggle, "V\0Toggle video" }, { ao_ball_toggle, "B\0Toggle ball" }, { ao_ps2_read_keys, "K\0Read keys from keyboard" }, diff --git a/src/stm/altos-512.ld b/src/stm/altos-512.ld index 78c41685..97a9c437 100644 --- a/src/stm/altos-512.ld +++ b/src/stm/altos-512.ld @@ -74,10 +74,10 @@ SECTIONS { /* Data -- relocated to RAM, but written to ROM */ .data : { - __data_start__ = .; + _start__ = .; *(.data) /* initialized data */ . = ALIGN(4); - __data_end__ = .; + _end__ = .; } >ram AT>rom .bss : { diff --git a/src/stm/altos-loader.ld b/src/stm/altos-loader.ld index 806b4842..1ebbc7a2 100644 --- a/src/stm/altos-loader.ld +++ b/src/stm/altos-loader.ld @@ -65,7 +65,7 @@ SECTIONS { */ .textram BLOCK(8): { - __data_start__ = .; + _start__ = .; __text_ram_start__ = .; *(.ramtext) __text_ram_end = .; @@ -76,7 +76,7 @@ SECTIONS { */ .data BLOCK(8): { *(.data) /* initialized data */ - __data_end__ = .; + _end__ = .; } >ram AT>rom diff --git a/src/stm/altos-ram.ld b/src/stm/altos-ram.ld index 098454e1..d8f072a7 100644 --- a/src/stm/altos-ram.ld +++ b/src/stm/altos-ram.ld @@ -42,13 +42,13 @@ SECTIONS { __text_end__ = .; } > ram - __data_start__ = .; + _start__ = .; /* Data -- relocated to RAM, but written to ROM */ .data : AT (ADDR(.ARM.exidx) + SIZEOF (.ARM.exidx)) { *(.data) /* initialized data */ - __data_end__ = .; + _end__ = .; __bss_start__ = .; } >ram diff --git a/src/stm/altos.ld b/src/stm/altos.ld index 6a8c7113..e352ed36 100644 --- a/src/stm/altos.ld +++ b/src/stm/altos.ld @@ -74,10 +74,10 @@ SECTIONS { /* Data -- relocated to RAM, but written to ROM */ .data : { - __data_start__ = .; + _start__ = .; *(.data) /* initialized data */ . = ALIGN(4); - __data_end__ = .; + _end__ = .; } >ram AT>rom .bss : { diff --git a/src/stm/ao_adc_single_stm.c b/src/stm/ao_adc_single_stm.c index 8a7fda4a..5737cd50 100644 --- a/src/stm/ao_adc_single_stm.c +++ b/src/stm/ao_adc_single_stm.c @@ -95,7 +95,7 @@ ao_adc_dump(void) AO_ADC_DUMP(&packet); } -__code struct ao_cmds ao_adc_cmds[] = { +const struct ao_cmds ao_adc_cmds[] = { { ao_adc_dump, "a\0Display current ADC values" }, { 0, NULL }, }; diff --git a/src/stm/ao_adc_stm.c b/src/stm/ao_adc_stm.c index 24912bb2..2399e6a2 100644 --- a/src/stm/ao_adc_stm.c +++ b/src/stm/ao_adc_stm.c @@ -100,7 +100,7 @@ ao_adc_poll(void) * Fetch a copy of the most recent ADC data */ void -ao_adc_get(__xdata struct ao_adc *packet) +ao_adc_get(struct ao_adc *packet) { #if HAS_FLIGHT uint8_t i = ao_data_ring_prev(ao_sample_data); @@ -177,7 +177,7 @@ static const char *ao_adc_name[AO_NUM_ADC] = { #endif static void -ao_adc_dump(void) __reentrant +ao_adc_dump(void) { struct ao_data packet; #ifndef AO_ADC_DUMP @@ -203,7 +203,7 @@ ao_adc_dump(void) __reentrant #endif } -__code struct ao_cmds ao_adc_cmds[] = { +const struct ao_cmds ao_adc_cmds[] = { { ao_adc_dump, "a\0Display current ADC values" }, { 0, NULL }, }; diff --git a/src/stm/ao_arch.h b/src/stm/ao_arch.h index 7b08b891..aee9df3c 100644 --- a/src/stm/ao_arch.h +++ b/src/stm/ao_arch.h @@ -41,11 +41,6 @@ #define ao_arch_naked_declare __attribute__((naked)) #define ao_arch_naked_define -#define __pdata -#define __data -#define __xdata -#define __code const -#define __reentrant #define __interrupt(n) #define __at(n) diff --git a/src/stm/ao_beep_stm.c b/src/stm/ao_beep_stm.c index 0b4e6012..f9fa14c2 100644 --- a/src/stm/ao_beep_stm.c +++ b/src/stm/ao_beep_stm.c @@ -132,7 +132,7 @@ ao_beep(uint8_t beep) } void -ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant +ao_beep_for(uint8_t beep, uint16_t ticks) { ao_beep(beep); ao_delay(ticks); diff --git a/src/stm/ao_eeprom_stm.c b/src/stm/ao_eeprom_stm.c index 4f477122..d3e3338d 100644 --- a/src/stm/ao_eeprom_stm.c +++ b/src/stm/ao_eeprom_stm.c @@ -117,10 +117,10 @@ ao_intflash_read(uint16_t pos) */ uint8_t -ao_eeprom_write(ao_pos_t pos32, __xdata void *v, uint16_t len) +ao_eeprom_write(ao_pos_t pos32, void *v, uint16_t len) { uint16_t pos = pos32; - __xdata uint8_t *d = v; + uint8_t *d = v; if (pos >= ao_eeprom_total || pos + len > ao_eeprom_total) return 0; @@ -151,7 +151,7 @@ ao_eeprom_write(ao_pos_t pos32, __xdata void *v, uint16_t len) * Read from eeprom */ uint8_t -ao_eeprom_read(ao_pos_t pos, __xdata void *v, uint16_t len) +ao_eeprom_read(ao_pos_t pos, void *v, uint16_t len) { uint8_t *d = v; diff --git a/src/stm/ao_interrupt.c b/src/stm/ao_interrupt.c index eb1ed0b5..d8be3667 100644 --- a/src/stm/ao_interrupt.c +++ b/src/stm/ao_interrupt.c @@ -24,7 +24,7 @@ extern void main(void); extern char __stack__; extern char __text_start__, __text_end__; -extern char __data_start__, __data_end__; +extern char _start__, _end__; extern char __bss_start__, __bss_end__; /* Interrupt functions */ @@ -83,7 +83,7 @@ void start(void) #endif /* Set interrupt vector table offset */ stm_nvic.vto = (uint32_t) &stm_interrupt_vector; - memcpy(&__data_start__, &__text_end__, &__data_end__ - &__data_start__); + memcpy(&_start__, &__text_end__, &_end__ - &_start__); memset(&__bss_start__, '\0', &__bss_end__ - &__bss_start__); main(); } diff --git a/src/stm/ao_led.c b/src/stm/ao_led.c index a7033dbb..bd83f4e4 100644 --- a/src/stm/ao_led.c +++ b/src/stm/ao_led.c @@ -153,7 +153,7 @@ ao_led_toggle(AO_LED_TYPE colors) } void -ao_led_for(AO_LED_TYPE colors, AO_LED_TYPE ticks) __reentrant +ao_led_for(AO_LED_TYPE colors, AO_LED_TYPE ticks) { ao_led_on(colors); ao_delay(ticks); diff --git a/src/stm/ao_timer.c b/src/stm/ao_timer.c index 9d118b72..9e9436cf 100644 --- a/src/stm/ao_timer.c +++ b/src/stm/ao_timer.c @@ -39,8 +39,8 @@ ao_time(void) #endif #if AO_DATA_ALL -volatile __data uint8_t ao_data_interval = 1; -volatile __data uint8_t ao_data_count; +volatile uint8_t ao_data_interval = 1; +volatile uint8_t ao_data_count; #endif void stm_systick_isr(void) diff --git a/src/stm/ao_usb_stm.c b/src/stm/ao_usb_stm.c index b06814d2..d7cbd5b7 100644 --- a/src/stm/ao_usb_stm.c +++ b/src/stm/ao_usb_stm.c @@ -1079,7 +1079,7 @@ ao_usb_irq(void) control_count, out_count, in_count, int_count, reset_count); } -__code struct ao_cmds ao_usb_cmds[] = { +const struct ao_cmds ao_usb_cmds[] = { { ao_usb_irq, "I\0Show USB interrupt counts" }, { 0, NULL } }; diff --git a/src/stmf0/altos-loader.ld b/src/stmf0/altos-loader.ld index 05887d0e..4d9b81ae 100644 --- a/src/stmf0/altos-loader.ld +++ b/src/stmf0/altos-loader.ld @@ -66,7 +66,7 @@ SECTIONS { */ .textram BLOCK(8): { - __data_start__ = .; + _start__ = .; __text_ram_start__ = .; *(.ramtext) __text_ram_end = .; @@ -77,7 +77,7 @@ SECTIONS { */ .data BLOCK(8): { *(.data) /* initialized data */ - __data_end__ = .; + _end__ = .; } >ram AT>rom diff --git a/src/stmf0/altos-raw.ld b/src/stmf0/altos-raw.ld index eb285e07..90c42ad2 100644 --- a/src/stmf0/altos-raw.ld +++ b/src/stmf0/altos-raw.ld @@ -61,10 +61,10 @@ SECTIONS { /* Data -- relocated to RAM, but written to ROM */ .data : { - __data_start__ = .; + _start__ = .; *(.data) /* initialized data */ . = ALIGN(4); - __data_end__ = .; + _end__ = .; } >ram AT>rom .bss : { diff --git a/src/stmf0/altos.ld b/src/stmf0/altos.ld index 74fdf3ea..64e1d00c 100644 --- a/src/stmf0/altos.ld +++ b/src/stmf0/altos.ld @@ -81,10 +81,10 @@ SECTIONS { /* Data -- relocated to RAM, but written to ROM */ .data : { - __data_start__ = .; + _start__ = .; *(.data) /* initialized data */ . = ALIGN(4); - __data_end__ = .; + _end__ = .; } >ram AT>rom .bss : { diff --git a/src/stmf0/ao_adc_stm.c b/src/stmf0/ao_adc_stm.c index 2b23dc50..571830bb 100644 --- a/src/stmf0/ao_adc_stm.c +++ b/src/stmf0/ao_adc_stm.c @@ -180,7 +180,7 @@ ao_adc_one(void) } #endif -__code struct ao_cmds ao_adc_cmds[] = { +const struct ao_cmds ao_adc_cmds[] = { { ao_adc_dump, "a\0Display current ADC values" }, #if AO_ADC_DEBUG { ao_adc_one, "A ch\0Display one ADC channel" }, diff --git a/src/stmf0/ao_arch.h b/src/stmf0/ao_arch.h index db6324cb..15642951 100644 --- a/src/stmf0/ao_arch.h +++ b/src/stmf0/ao_arch.h @@ -43,11 +43,6 @@ #define ao_arch_naked_declare __attribute__((naked)) #define ao_arch_naked_define -#define __pdata -#define __data -#define __xdata -#define __code const -#define __reentrant #define __interrupt(n) #define __at(n) diff --git a/src/stmf0/ao_beep_stm.c b/src/stmf0/ao_beep_stm.c index 15137230..abcc116c 100644 --- a/src/stmf0/ao_beep_stm.c +++ b/src/stmf0/ao_beep_stm.c @@ -376,7 +376,7 @@ ao_beep(uint8_t beep) } void -ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant +ao_beep_for(uint8_t beep, uint16_t ticks) { ao_beep(beep); ao_delay(ticks); diff --git a/src/stmf0/ao_interrupt.c b/src/stmf0/ao_interrupt.c index a67f6f1a..81878d89 100644 --- a/src/stmf0/ao_interrupt.c +++ b/src/stmf0/ao_interrupt.c @@ -35,7 +35,7 @@ extern void main(void); extern char __stack__; extern char __text_start__, __text_end__; -extern char __data_start__, __data_end__; +extern char _start__, _end__; extern char __bss_start__, __bss_end__; #if RELOCATE_INTERRUPT extern char __interrupt_rom__, __interrupt_start__, __interrupt_end__; @@ -88,7 +88,7 @@ void start(void) stm_syscfg.cfgr1 = (stm_syscfg.cfgr1 & ~(STM_SYSCFG_CFGR1_MEM_MODE_MASK << STM_SYSCFG_CFGR1_MEM_MODE)) | (STM_SYSCFG_CFGR1_MEM_MODE_MAIN_FLASH << STM_SYSCFG_CFGR1_MEM_MODE); #endif - memcpy(&__data_start__, &__text_end__, &__data_end__ - &__data_start__); + memcpy(&_start__, &__text_end__, &_end__ - &_start__); memset(&__bss_start__, '\0', &__bss_end__ - &__bss_start__); main(); } diff --git a/src/stmf0/ao_led.c b/src/stmf0/ao_led.c index 0f39befb..a162932a 100644 --- a/src/stmf0/ao_led.c +++ b/src/stmf0/ao_led.c @@ -18,7 +18,7 @@ #include "ao.h" -__pdata uint16_t ao_led_enable; +uint16_t ao_led_enable; void ao_led_on(uint16_t colors) @@ -76,7 +76,7 @@ ao_led_toggle(uint16_t colors) } void -ao_led_for(uint16_t colors, uint16_t ticks) __reentrant +ao_led_for(uint16_t colors, uint16_t ticks) { ao_led_on(colors); ao_delay(ticks); diff --git a/src/stmf0/ao_storage_stm.c b/src/stmf0/ao_storage_stm.c index 1a6198a7..17c934a5 100644 --- a/src/stmf0/ao_storage_stm.c +++ b/src/stmf0/ao_storage_stm.c @@ -157,7 +157,7 @@ ao_storage_device_write(uint32_t pos, void *v, uint16_t len) } uint8_t -ao_storage_device_read(uint32_t pos, __xdata void *d, uint16_t len) __reentrant +ao_storage_device_read(uint32_t pos, void *d, uint16_t len) { if (pos >= ao_storage_total || pos + len > ao_storage_total) return 0; @@ -166,7 +166,7 @@ ao_storage_device_read(uint32_t pos, __xdata void *d, uint16_t len) __reentrant } void -ao_storage_flush(void) __reentrant +ao_storage_flush(void) { } @@ -179,7 +179,7 @@ ao_storage_setup(void) } void -ao_storage_device_info(void) __reentrant +ao_storage_device_info(void) { printf ("Using internal flash, page %d bytes, total %d bytes\n", ao_storage_block, ao_storage_total); diff --git a/src/stmf0/ao_timer.c b/src/stmf0/ao_timer.c index 50fd67b8..1def5f69 100644 --- a/src/stmf0/ao_timer.c +++ b/src/stmf0/ao_timer.c @@ -36,8 +36,8 @@ ao_time(void) } #if AO_DATA_ALL -volatile __data uint8_t ao_data_interval = 1; -volatile __data uint8_t ao_data_count; +volatile uint8_t ao_data_interval = 1; +volatile uint8_t ao_data_count; #endif void stm_systick_isr(void) diff --git a/src/stmf0/ao_usb_stm.c b/src/stmf0/ao_usb_stm.c index c4860d8e..ff294849 100644 --- a/src/stmf0/ao_usb_stm.c +++ b/src/stmf0/ao_usb_stm.c @@ -1626,7 +1626,7 @@ ao_usb_irq(void) control_count, out_count, in_count, int_count, reset_count); } -__code struct ao_cmds ao_usb_cmds[] = { +const struct ao_cmds ao_usb_cmds[] = { { ao_usb_irq, "I\0Show USB interrupt counts" }, { 0, NULL } }; diff --git a/src/telefireone-v1.0/ao_telefireone.c b/src/telefireone-v1.0/ao_telefireone.c index 115b3e91..790d7a41 100644 --- a/src/telefireone-v1.0/ao_telefireone.c +++ b/src/telefireone-v1.0/ao_telefireone.c @@ -31,7 +31,7 @@ set_logging(void) ao_wakeup(&ao_log_running); } -__code struct ao_cmds ao_firetwo_cmds[] = { +const struct ao_cmds ao_firetwo_cmds[] = { { set_logging, "L <0 off, 1 on>\0Log sensors to flash" }, { 0, NULL }, }; diff --git a/src/telelco-v2.0/ao_lco_v2.c b/src/telelco-v2.0/ao_lco_v2.c index a9933d59..428b1a7c 100644 --- a/src/telelco-v2.0/ao_lco_v2.c +++ b/src/telelco-v2.0/ao_lco_v2.c @@ -287,7 +287,7 @@ ao_lco_set_debug(void) ao_lco_debug = ao_cmd_lex_i != 0; } -__code struct ao_cmds ao_lco_cmds[] = { +const struct ao_cmds ao_lco_cmds[] = { { ao_lco_set_debug, "D <0 off, 1 on>\0Debug" }, { ao_lco_search, "s\0Search for pad boxes" }, { 0, NULL } diff --git a/src/test/ao_aes_test.c b/src/test/ao_aes_test.c index 135c6f1a..e1ed5728 100644 --- a/src/test/ao_aes_test.c +++ b/src/test/ao_aes_test.c @@ -16,11 +16,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define __pdata -#define __data -#define __xdata -#define __code -#define __reentrant +#define const #include #include diff --git a/src/test/ao_eeprom_read.h b/src/test/ao_eeprom_read.h index 03c327ca..afaadb1e 100644 --- a/src/test/ao_eeprom_read.h +++ b/src/test/ao_eeprom_read.h @@ -15,11 +15,7 @@ #ifndef _AO_EEPROM_READ_H_ #define _AO_EEPROM_READ_H_ -#define __pdata -#define __data -#define __xdata -#define __code -#define __reentrant +#define const #include #include diff --git a/src/test/ao_flight_test.c b/src/test/ao_flight_test.c index 0913e7ba..a171930e 100644 --- a/src/test/ao_flight_test.c +++ b/src/test/ao_flight_test.c @@ -119,11 +119,7 @@ struct ao_adc { #endif -#define __pdata -#define __data -#define __xdata -#define __code -#define __reentrant +#define const #define HAS_FLIGHT 1 #define HAS_IGNITE 1 diff --git a/src/test/ao_gps_test_skytraq.c b/src/test/ao_gps_test_skytraq.c index 61e7905a..11c54601 100644 --- a/src/test/ao_gps_test_skytraq.c +++ b/src/test/ao_gps_test_skytraq.c @@ -83,8 +83,8 @@ struct ao_gps_tracking_orig { #define ao_telemetry_satellite ao_gps_tracking_orig #define ao_telemetry_satellite_info ao_gps_sat_orig -extern __xdata struct ao_telemetry_location ao_gps_data; -extern __xdata struct ao_telemetry_satellite ao_gps_tracking_data; +extern struct ao_telemetry_location ao_gps_data; +extern struct ao_telemetry_satellite ao_gps_tracking_data; uint8_t ao_gps_mutex; diff --git a/src/test/ao_gps_test_ublox.c b/src/test/ao_gps_test_ublox.c index 05334bbf..0833e4f6 100644 --- a/src/test/ao_gps_test_ublox.c +++ b/src/test/ao_gps_test_ublox.c @@ -89,8 +89,8 @@ struct ao_telemetry_satellite { #define ao_gps_tracking_orig ao_telemetry_satellite #define ao_gps_sat_orig ao_telemetry_satellite_info -extern __xdata struct ao_telemetry_location ao_gps_data; -extern __xdata struct ao_telemetry_satellite ao_gps_tracking_data; +extern struct ao_telemetry_location ao_gps_data; +extern struct ao_telemetry_satellite ao_gps_tracking_data; uint8_t ao_gps_mutex; diff --git a/src/test/ao_int64_test.c b/src/test/ao_int64_test.c index d329f67b..c7a4891f 100644 --- a/src/test/ao_int64_test.c +++ b/src/test/ao_int64_test.c @@ -16,10 +16,6 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define __data -#define __pdata -#define __xdata -#define __reentrant #include #include diff --git a/src/test/ao_ms5607_convert_test.c b/src/test/ao_ms5607_convert_test.c index 4876d21e..7708c331 100644 --- a/src/test/ao_ms5607_convert_test.c +++ b/src/test/ao_ms5607_convert_test.c @@ -16,10 +16,6 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define __xdata -#define __data -#define __pdata -#define __reentrant #include #include diff --git a/src/usbrelay-v0.1/ao_usbrelay.c b/src/usbrelay-v0.1/ao_usbrelay.c index d908f4db..0eacdf5a 100644 --- a/src/usbrelay-v0.1/ao_usbrelay.c +++ b/src/usbrelay-v0.1/ao_usbrelay.c @@ -45,7 +45,7 @@ ao_relay_control(uint8_t output) } static void -ao_relay_select(void) __reentrant +ao_relay_select(void) { uint8_t output; @@ -59,7 +59,7 @@ ao_relay_select(void) __reentrant ao_relay_control(output); } -static __code struct ao_cmds ao_relay_cmds[] = { +static const struct ao_cmds ao_relay_cmds[] = { { ao_relay_select, "R \0Select relay output" }, { 0, NULL } }; -- cgit v1.2.3 From c417ab1de2a083b5fcff2e081e4feb2a65887903 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 15 Aug 2018 19:13:45 -0700 Subject: altos: Make cmd number parsing functions return value Don't use a global variable to hold the result. Signed-off-by: Keith Packard --- src/cortexelf-v1/ao_cortexelf.c | 15 ++--- src/drivers/ao_btm.c | 19 +++--- src/drivers/ao_cc1120.c | 3 +- src/drivers/ao_cc115l.c | 6 +- src/drivers/ao_cc1200.c | 22 +++---- src/drivers/ao_gps_ublox.c | 4 +- src/drivers/ao_lco.c | 4 +- src/drivers/ao_lco_cmd.c | 12 ++-- src/drivers/ao_lco_two.c | 4 +- src/drivers/ao_mpu9250.c | 18 ++---- src/drivers/ao_pad.c | 18 +++--- src/drivers/ao_pca9922.c | 6 +- src/drivers/ao_quadrature.c | 3 +- src/drivers/ao_seven_segment.c | 6 +- src/drivers/ao_watchdog.c | 4 +- src/kernel/ao.h | 8 +-- src/kernel/ao_cmd.c | 56 ++++++++--------- src/kernel/ao_config.c | 111 +++++++++++++++++----------------- src/kernel/ao_fake_flight.c | 6 +- src/kernel/ao_log.c | 3 +- src/kernel/ao_log_single.c | 14 ++--- src/kernel/ao_monitor.c | 3 +- src/kernel/ao_pyro.c | 17 +++--- src/kernel/ao_radio_cmac_cmd.c | 10 +-- src/kernel/ao_send_packet.c | 3 +- src/kernel/ao_storage.c | 27 ++++----- src/kernel/ao_tracker.c | 4 +- src/stm-vga/ao_demo.c | 9 ++- src/stm/ao_lcd_stm.c | 9 +-- src/stm/ao_pwm_stm.c | 6 +- src/stmf0/ao_adc_stm.c | 3 +- src/telefireone-v1.0/ao_telefireone.c | 3 +- src/telelco-v2.0/ao_lco_v2.c | 4 +- src/usbrelay-v0.1/ao_usbrelay.c | 3 +- src/vidtime/ao_vidtime.c | 4 +- 35 files changed, 195 insertions(+), 252 deletions(-) diff --git a/src/cortexelf-v1/ao_cortexelf.c b/src/cortexelf-v1/ao_cortexelf.c index 6bc2624f..1c30cd85 100644 --- a/src/cortexelf-v1/ao_cortexelf.c +++ b/src/cortexelf-v1/ao_cortexelf.c @@ -149,17 +149,16 @@ ao_fb_init(void) static void ao_video_toggle(void) { - ao_cmd_decimal(); - if (ao_cmd_lex_i) + uint16_t r = ao_cmd_decimal(); + if (r) ao_fb_init(); - ao_vga_enable(ao_cmd_lex_i); + ao_vga_enable(r) } static void ao_ball_toggle(void) { - ao_cmd_decimal(); - ball_enable = ao_cmd_lex_i; + ball_enable = ao_cmd_decimal(); ao_wakeup(&ball_enable); } @@ -208,11 +207,9 @@ led_cmd(void) { uint8_t start; uint8_t value; - ao_cmd_decimal(); - start = ao_cmd_lex_i; - ao_cmd_hex(); - value = ao_cmd_lex_i; + start = ao_cmd_decimal(); + value = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; ao_as1107_write_8(start, value); diff --git a/src/drivers/ao_btm.c b/src/drivers/ao_btm.c index 3591f8f2..2930d00e 100644 --- a/src/drivers/ao_btm.c +++ b/src/drivers/ao_btm.c @@ -32,7 +32,7 @@ int8_t ao_btm_stdio; uint8_t ao_btm_connected; -#define BT_DEBUG 0 +#define BT_DEBUG 1 #if BT_DEBUG char ao_btm_buffer[256]; @@ -76,6 +76,7 @@ ao_btm_dump(void) { int i; char c; + uint16_t r; for (i = 0; i < ao_btm_ptr; i++) { c = ao_btm_buffer[i]; @@ -85,8 +86,8 @@ ao_btm_dump(void) putchar(ao_btm_buffer[i]); } putchar('\n'); - ao_cmd_decimal(); - if (ao_cmd_status == ao_cmd_success && ao_cmd_lex_i) + r = ao_cmd_decimal(); + if (ao_cmd_status == ao_cmd_success && r) ao_btm_ptr = 0; ao_cmd_status = ao_cmd_success; } @@ -94,13 +95,17 @@ ao_btm_dump(void) static void ao_btm_speed(void) { - ao_cmd_decimal(); - if (ao_cmd_lex_u32 == 57600) + switch (ao_cmd_decimal()) { + case 57600: ao_serial_btm_set_speed(AO_SERIAL_SPEED_57600); - else if (ao_cmd_lex_u32 == 19200) + break; + case 19200: ao_serial_btm_set_speed(AO_SERIAL_SPEED_19200); - else + break; + default: ao_cmd_status = ao_cmd_syntax_error; + break; + } } static uint8_t ao_btm_enable; diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c index d581c246..aea0a3fe 100644 --- a/src/drivers/ao_cc1120.c +++ b/src/drivers/ao_cc1120.c @@ -805,8 +805,7 @@ ao_radio_test_cmd(void) static uint8_t radio_on; ao_cmd_white(); if (ao_cmd_lex_c != '\n') { - ao_cmd_decimal(); - mode = (uint8_t) ao_cmd_lex_u32; + mode = ao_cmd_decimal(); } mode++; if ((mode & 2) && !radio_on) { diff --git a/src/drivers/ao_cc115l.c b/src/drivers/ao_cc115l.c index c1c21e0d..a8f2c4f5 100644 --- a/src/drivers/ao_cc115l.c +++ b/src/drivers/ao_cc115l.c @@ -700,10 +700,8 @@ ao_radio_test_cmd(void) uint8_t mode = 2; static uint8_t radio_on; ao_cmd_white(); - if (ao_cmd_lex_c != '\n') { - ao_cmd_decimal(); - mode = (uint8_t) ao_cmd_lex_u32; - } + if (ao_cmd_lex_c != '\n') + mode = ao_cmd_decimal(); mode++; if ((mode & 2) && !radio_on) { #if HAS_MONITOR diff --git a/src/drivers/ao_cc1200.c b/src/drivers/ao_cc1200.c index f2f9c372..45f5711e 100644 --- a/src/drivers/ao_cc1200.c +++ b/src/drivers/ao_cc1200.c @@ -858,10 +858,8 @@ ao_radio_test_cmd(void) { uint8_t mode = 2; ao_cmd_white(); - if (ao_cmd_lex_c != '\n') { - ao_cmd_decimal(); - mode = (uint8_t) ao_cmd_lex_u32; - } + if (ao_cmd_lex_c != '\n') + mode = ao_cmd_decimal(); mode++; if ((mode & 2)) ao_radio_test_on(); @@ -1362,14 +1360,15 @@ ao_radio_aprs(void) static void ao_radio_strobe_test(void) { + uint8_t addr; uint8_t r; - ao_cmd_hex(); + addr = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - r = ao_radio_strobe(ao_cmd_lex_i); + r = ao_radio_strobe(addr); printf ("Strobe %02x -> %02x (rdy %d state %d)\n", - ao_cmd_lex_i, + addr, r, r >> 7, (r >> 4) & 0x7); @@ -1381,14 +1380,12 @@ ao_radio_write_test(void) uint16_t addr; uint8_t data; - ao_cmd_hex(); + addr = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - addr = ao_cmd_lex_i; - ao_cmd_hex(); + data = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - data = ao_cmd_lex_i; printf ("Write %04x = %02x\n", addr, data); ao_radio_reg_write(addr, data); } @@ -1399,10 +1396,9 @@ ao_radio_read_test(void) uint16_t addr; uint8_t data; - ao_cmd_hex(); + addr = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - addr = ao_cmd_lex_i; data = ao_radio_reg_read(addr); printf ("Read %04x = %02x\n", addr, data); } diff --git a/src/drivers/ao_gps_ublox.c b/src/drivers/ao_gps_ublox.c index f5268aa7..a6d93083 100644 --- a/src/drivers/ao_gps_ublox.c +++ b/src/drivers/ao_gps_ublox.c @@ -783,12 +783,12 @@ ao_gps(void) #if AO_UBLOX_DEBUG static void ao_gps_option(void) { - ao_cmd_hex(); + uint16_t r = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) { ao_cmd_status = ao_cmd_success; ao_gps_show(); } else { - ao_gps_dbg_enable = ao_cmd_lex_i; + ao_gps_dbg_enable = r; printf ("gps debug set to %d\n", ao_gps_dbg_enable); } } diff --git a/src/drivers/ao_lco.c b/src/drivers/ao_lco.c index 86635200..5f5db572 100644 --- a/src/drivers/ao_lco.c +++ b/src/drivers/ao_lco.c @@ -319,9 +319,9 @@ ao_lco_main(void) void ao_lco_set_debug(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status == ao_cmd_success) - ao_lco_debug = ao_cmd_lex_i != 0; + ao_lco_debug = r != 0; } const struct ao_cmds ao_lco_cmds[] = { diff --git a/src/drivers/ao_lco_cmd.c b/src/drivers/ao_lco_cmd.c index 3fcdc859..6f195e55 100644 --- a/src/drivers/ao_lco_cmd.c +++ b/src/drivers/ao_lco_cmd.c @@ -33,10 +33,8 @@ static uint16_t tick_offset; static void lco_args(void) { - ao_cmd_decimal(); - lco_box = ao_cmd_lex_i; - ao_cmd_hex(); - lco_channels = ao_cmd_lex_i; + lco_box = ao_cmd_decimal(); + lco_channels = ao_cmd_hex(); } static struct ao_pad_query ao_pad_query; @@ -129,8 +127,7 @@ lco_fire_cmd(void) int8_t r; lco_args(); - ao_cmd_decimal(); - secs = ao_cmd_lex_i; + secs = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; r = lco_query(); @@ -163,8 +160,7 @@ lco_static_cmd(void) int8_t r; lco_args(); - ao_cmd_decimal(); - secs = ao_cmd_lex_i; + secs = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; r = lco_query(); diff --git a/src/drivers/ao_lco_two.c b/src/drivers/ao_lco_two.c index 12c02e88..49ea1236 100644 --- a/src/drivers/ao_lco_two.c +++ b/src/drivers/ao_lco_two.c @@ -124,9 +124,9 @@ ao_lco_main(void) void ao_lco_set_debug(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status == ao_cmd_success) - ao_lco_debug = ao_cmd_lex_i; + ao_lco_debug = r; } const struct ao_cmds ao_lco_cmds[] = { diff --git a/src/drivers/ao_mpu9250.c b/src/drivers/ao_mpu9250.c index ae8dacd0..9dce9f1a 100644 --- a/src/drivers/ao_mpu9250.c +++ b/src/drivers/ao_mpu9250.c @@ -472,10 +472,9 @@ ao_mpu9250_read(void) uint8_t addr; uint8_t val; - ao_cmd_hex(); + addr = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - addr = ao_cmd_lex_i; ao_mpu9250_spi_get(); val = _ao_mpu9250_reg_read(addr); ao_mpu9250_spi_put(); @@ -488,14 +487,12 @@ ao_mpu9250_write(void) uint8_t addr; uint8_t val; - ao_cmd_hex(); + addr = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - addr = ao_cmd_lex_i; - ao_cmd_hex(); + val = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - val = ao_cmd_lex_i; printf("Addr %02x val %02x\n", addr, val); ao_mpu9250_spi_get(); _ao_mpu9250_reg_write(addr, val); @@ -508,10 +505,9 @@ ao_mpu9250_mag_read(void) uint8_t addr; uint8_t val; - ao_cmd_hex(); + addr = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - addr = ao_cmd_lex_i; ao_mpu9250_spi_get(); val = _ao_mpu9250_mag_reg_read(addr); ao_mpu9250_spi_put(); @@ -524,14 +520,12 @@ ao_mpu9250_mag_write(void) uint8_t addr; uint8_t val; - ao_cmd_hex(); + addr = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - addr = ao_cmd_lex_i; - ao_cmd_hex(); + val = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - val = ao_cmd_lex_i; printf("Addr %02x val %02x\n", addr, val); ao_mpu9250_spi_get(); _ao_mpu9250_mag_reg_write(addr, val); diff --git a/src/drivers/ao_pad.c b/src/drivers/ao_pad.c index 7e139c78..c08798ac 100644 --- a/src/drivers/ao_pad.c +++ b/src/drivers/ao_pad.c @@ -509,16 +509,14 @@ ao_pad_manual(void) ao_cmd_white(); if (!ao_match_word("DoIt")) return; - ao_cmd_decimal(); + ignite = 1 << ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - ignite = 1 << ao_cmd_lex_i; - ao_cmd_decimal(); + repeat = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) { repeat = 1; ao_cmd_status = ao_cmd_success; - } else - repeat = ao_cmd_lex_i; + } while (repeat-- > 0) { ao_pad_ignite = ignite; ao_wakeup(&ao_pad_ignite); @@ -534,9 +532,9 @@ static struct ao_task ao_pad_monitor_task; void ao_pad_set_debug(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status == ao_cmd_success) - ao_pad_debug = ao_cmd_lex_i != 0; + ao_pad_debug = r != 0; } @@ -544,14 +542,12 @@ static void ao_pad_alarm_debug(void) { uint8_t which, value; - ao_cmd_decimal(); + which = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - which = ao_cmd_lex_i; - ao_cmd_decimal(); + value = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - value = ao_cmd_lex_i; printf ("Set %s to %d\n", which ? "siren" : "strobe", value); if (which) ao_siren(value); diff --git a/src/drivers/ao_pca9922.c b/src/drivers/ao_pca9922.c index 3516f03a..91d62026 100644 --- a/src/drivers/ao_pca9922.c +++ b/src/drivers/ao_pca9922.c @@ -72,11 +72,11 @@ ao_led_set_mask(uint8_t colors, uint8_t mask) static void ao_led_test(void) { - ao_cmd_hexbyte(); + AO_LED_TYPE r = ao_cmd_hexbyte(); if (ao_cmd_status != ao_cmd_success) return; - ao_led_set(ao_cmd_lex_i); - printf("LEDs set to %02x\n", ao_cmd_lex_i); + ao_led_set(r); + printf("LEDs set to %x\n", r); } static const struct ao_cmds ao_led_cmds[] = { diff --git a/src/drivers/ao_quadrature.c b/src/drivers/ao_quadrature.c index 20781c40..a5fbd1da 100644 --- a/src/drivers/ao_quadrature.c +++ b/src/drivers/ao_quadrature.c @@ -170,8 +170,7 @@ ao_quadrature_test(void) int8_t t = 0; #endif - ao_cmd_decimal(); - q = ao_cmd_lex_i; + q = ao_cmd_decimal(); if (q >= AO_QUADRATURE_COUNT) ao_cmd_status = ao_cmd_syntax_error; if (ao_cmd_status != ao_cmd_success) diff --git a/src/drivers/ao_seven_segment.c b/src/drivers/ao_seven_segment.c index d2e1248f..1be305e5 100644 --- a/src/drivers/ao_seven_segment.c +++ b/src/drivers/ao_seven_segment.c @@ -209,10 +209,8 @@ static void ao_seven_segment_show(void) { uint8_t digit, value; - ao_cmd_decimal(); - digit = ao_cmd_lex_i; - ao_cmd_decimal(); - value = ao_cmd_lex_i; + digit = ao_cmd_decimal(); + value = ao_cmd_decimal(); ao_seven_segment_set(digit, value); } diff --git a/src/drivers/ao_watchdog.c b/src/drivers/ao_watchdog.c index 01c3cd0e..c0582c12 100644 --- a/src/drivers/ao_watchdog.c +++ b/src/drivers/ao_watchdog.c @@ -38,9 +38,9 @@ ao_watchdog(void) static void ao_watchdog_set(void) { - ao_cmd_hex(); + uint32_t r = ao_cmd_hex(); if (ao_cmd_status == ao_cmd_success) { - ao_watchdog_enabled = ao_cmd_lex_i != 0; + ao_watchdog_enabled = r != 0; ao_wakeup(&ao_watchdog_enabled); } } diff --git a/src/kernel/ao.h b/src/kernel/ao.h index fd1d1276..3beeb880 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -160,8 +160,6 @@ enum ao_cmd_status { ao_cmd_syntax_error = 2, }; -extern uint16_t ao_cmd_lex_i; -extern uint32_t ao_cmd_lex_u32; extern char ao_cmd_lex_c; extern enum ao_cmd_status ao_cmd_status; @@ -189,13 +187,13 @@ ao_cmd_white(void); int8_t ao_cmd_hexchar(char c); -void +uint8_t ao_cmd_hexbyte(void); -void +uint32_t ao_cmd_hex(void); -void +uint32_t ao_cmd_decimal(void); /* Read a single hex nibble off stdin. */ diff --git a/src/kernel/ao_cmd.c b/src/kernel/ao_cmd.c index d28db5b7..a72192f4 100644 --- a/src/kernel/ao_cmd.c +++ b/src/kernel/ao_cmd.c @@ -19,8 +19,6 @@ #include "ao.h" #include "ao_task.h" -uint16_t ao_cmd_lex_i; -uint32_t ao_cmd_lex_u32; char ao_cmd_lex_c; enum ao_cmd_status ao_cmd_status; @@ -174,55 +172,49 @@ ao_cmd_hexchar(char c) return -1; } -void -ao_cmd_hexbyte(void) +static +uint32_t +_ao_cmd_hex(uint8_t lim) { + uint32_t result = 0; uint8_t i; - int8_t n; - ao_cmd_lex_i = 0; ao_cmd_white(); - for (i = 0; i < 2; i++) { - n = ao_cmd_hexchar(ao_cmd_lex_c); + for (i = 0; i < lim; i++) { + int8_t n = ao_cmd_hexchar(ao_cmd_lex_c); if (n < 0) { - ao_cmd_status = ao_cmd_syntax_error; + if (i == 0 || lim != 0xff) + ao_cmd_status = ao_cmd_lex_error; break; } - ao_cmd_lex_i = (ao_cmd_lex_i << 4) | n; + result = (result << 4) | n; ao_cmd_lex(); } + return result; } -void -ao_cmd_hex(void) +uint8_t +ao_cmd_hexbyte(void) { - uint8_t r = ao_cmd_lex_error; - int8_t n; + return _ao_cmd_hex(2); +} - ao_cmd_lex_i = 0; - ao_cmd_white(); - for(;;) { - n = ao_cmd_hexchar(ao_cmd_lex_c); - if (n < 0) - break; - ao_cmd_lex_i = (ao_cmd_lex_i << 4) | n; - r = ao_cmd_success; - ao_cmd_lex(); - } - if (r != ao_cmd_success) - ao_cmd_status = r; +uint32_t +ao_cmd_hex(void) +{ + return _ao_cmd_hex(0xff); } -void +uint32_t ao_cmd_decimal(void) { + uint32_t result = 0; uint8_t r = ao_cmd_lex_error; - ao_cmd_lex_u32 = 0; ao_cmd_white(); for(;;) { if ('0' <= ao_cmd_lex_c && ao_cmd_lex_c <= '9') - ao_cmd_lex_u32 = (ao_cmd_lex_u32 * 10) + (ao_cmd_lex_c - '0'); + result = result * 10 + (ao_cmd_lex_c - '0'); else break; r = ao_cmd_success; @@ -230,7 +222,7 @@ ao_cmd_decimal(void) } if (r != ao_cmd_success) ao_cmd_status = r; - ao_cmd_lex_i = (uint16_t) ao_cmd_lex_u32; + return result; } uint8_t @@ -250,9 +242,9 @@ ao_match_word(const char *word) static void echo(void) { - ao_cmd_hex(); + uint32_t v = ao_cmd_hex(); if (ao_cmd_status == ao_cmd_success) - ao_stdios[ao_cur_stdio].echo = ao_cmd_lex_i != 0; + ao_stdios[ao_cur_stdio].echo = v != 0; } static void diff --git a/src/kernel/ao_config.c b/src/kernel/ao_config.c index 277dddd9..596a0410 100644 --- a/src/kernel/ao_config.c +++ b/src/kernel/ao_config.c @@ -318,11 +318,11 @@ ao_config_frequency_show(void) void ao_config_frequency_set(void) { - ao_cmd_decimal(); + uint32_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.frequency = ao_cmd_lex_u32; + ao_config.frequency = r; ao_config_set_radio(); _ao_config_edit_finish(); #if HAS_RADIO_RECV @@ -369,11 +369,11 @@ ao_config_main_deploy_show(void) void ao_config_main_deploy_set(void) { - ao_cmd_decimal(); + uint32_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.main_deploy = ao_cmd_lex_i; + ao_config.main_deploy = r; _ao_config_edit_finish(); } @@ -445,16 +445,17 @@ void ao_config_accel_calibrate_set(void) { int16_t up, down; + uint16_t r; #if HAS_GYRO int16_t accel_along_up = 0, accel_along_down = 0; int16_t accel_across_up = 0, accel_across_down = 0; int16_t accel_through_up = 0, accel_through_down = 0; #endif - ao_cmd_decimal(); + r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - if (ao_cmd_lex_i == 0) { + if (r == 0) { up = ao_config_accel_calibrate_auto("up"); #if HAS_GYRO accel_along_up = accel_cal_along; @@ -468,11 +469,11 @@ ao_config_accel_calibrate_set(void) accel_through_down = accel_cal_through; #endif } else { - up = ao_cmd_lex_i; - ao_cmd_decimal(); + up = r; + r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - down = ao_cmd_lex_i; + down = r; } if (up >= down) { printf("Invalid accel: up (%d) down (%d)\n", @@ -483,7 +484,7 @@ ao_config_accel_calibrate_set(void) ao_config.accel_plus_g = up; ao_config.accel_minus_g = down; #if HAS_GYRO - if (ao_cmd_lex_i == 0) { + if (r == 0) { ao_config.accel_zero_along = (accel_along_up + accel_along_down) / 2; ao_config.accel_zero_across = (accel_across_up + accel_across_down) / 2; ao_config.accel_zero_through = (accel_through_up + accel_through_down) / 2; @@ -503,11 +504,11 @@ ao_config_apogee_delay_show(void) void ao_config_apogee_delay_set(void) { - ao_cmd_decimal(); + uint32_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.apogee_delay = ao_cmd_lex_i; + ao_config.apogee_delay = r; _ao_config_edit_finish(); } @@ -521,11 +522,11 @@ ao_config_apogee_lockout_show(void) void ao_config_apogee_lockout_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.apogee_lockout = ao_cmd_lex_i; + ao_config.apogee_lockout = r; _ao_config_edit_finish(); } @@ -541,11 +542,11 @@ ao_config_radio_cal_show(void) void ao_config_radio_cal_set(void) { - ao_cmd_decimal(); + uint32_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.radio_cal = ao_cmd_lex_u32; + ao_config.radio_cal = r; ao_config_set_radio(); _ao_config_edit_finish(); } @@ -566,15 +567,15 @@ ao_config_radio_rate_show(void) void ao_config_radio_rate_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - if (AO_RADIO_RATE_MAX < ao_cmd_lex_i) { + if (AO_RADIO_RATE_MAX < r) { ao_cmd_status = ao_cmd_lex_error; return; } _ao_config_edit_start(); - ao_config.radio_rate = ao_cmd_lex_i; + ao_config.radio_rate = r; _ao_config_edit_finish(); #if HAS_TELEMETRY ao_telemetry_reset_interval(); @@ -618,19 +619,20 @@ ao_config_log_set(void) #else uint16_t block = (uint16_t) (ao_storage_block >> 10); uint16_t log_max = (uint16_t) (ao_storage_log_max >> 10); + uint32_t r; - ao_cmd_decimal(); + r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; if (ao_log_present()) printf("Storage must be empty before changing log size\n"); - else if (block > 1024 && (ao_cmd_lex_i & (block - 1))) + else if (block > 1024 && (r & (block - 1))) printf("Flight log size must be multiple of %d kB\n", block); - else if (ao_cmd_lex_i > log_max) + else if (r > log_max) printf("Flight log max %d kB\n", log_max); else { _ao_config_edit_start(); - ao_config.flight_log_max = (uint32_t) ao_cmd_lex_i << 10; + ao_config.flight_log_max = r << 10; _ao_config_edit_finish(); } #endif @@ -647,11 +649,11 @@ ao_config_ignite_mode_show(void) void ao_config_ignite_mode_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.ignite_mode = ao_cmd_lex_i; + ao_config.ignite_mode = r; _ao_config_edit_finish(); } #endif @@ -670,18 +672,17 @@ ao_config_pad_orientation_show(void) void ao_config_pad_orientation_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal() & 1; if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_cmd_lex_i &= 1; - if (ao_config.pad_orientation != ao_cmd_lex_i) { + if (ao_config.pad_orientation != r) { int16_t t; t = ao_config.accel_plus_g; ao_config.accel_plus_g = AO_ACCEL_INVERT - ao_config.accel_minus_g; ao_config.accel_minus_g = AO_ACCEL_INVERT - t; } - ao_config.pad_orientation = ao_cmd_lex_i; + ao_config.pad_orientation = r; _ao_config_edit_finish(); } #endif @@ -696,11 +697,11 @@ ao_config_radio_enable_show(void) void ao_config_radio_enable_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.radio_enable = ao_cmd_lex_i; + ao_config.radio_enable = r; _ao_config_edit_finish(); #if HAS_TELEMETRY && HAS_RADIO_RATE ao_telemetry_reset_interval(); @@ -729,10 +730,10 @@ ao_config_key_set(void) _ao_config_edit_start(); for (i = 0; i < AO_AES_LEN; i++) { - ao_cmd_hexbyte(); + uint8_t b = ao_cmd_hexbyte(); if (ao_cmd_status != ao_cmd_success) break; - ao_config.aes_key[i] = ao_cmd_lex_i; + ao_config.aes_key[i] = b; } ++ao_config_aes_seq; _ao_config_edit_finish(); @@ -750,11 +751,11 @@ ao_config_aprs_show(void) void ao_config_aprs_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.aprs_interval = ao_cmd_lex_i; + ao_config.aprs_interval = r; _ao_config_edit_finish(); ao_telemetry_reset_interval(); } @@ -772,11 +773,11 @@ ao_config_radio_amp_show(void) void ao_config_radio_amp_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.radio_amp = ao_cmd_lex_i; + ao_config.radio_amp = r; _ao_config_edit_finish(); } @@ -793,11 +794,11 @@ ao_config_radio_power_show(void) void ao_config_radio_power_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.radio_power = ao_cmd_lex_i; + ao_config.radio_power = r; _ao_config_edit_finish(); } @@ -813,11 +814,11 @@ ao_config_beep_show(void) void ao_config_beep_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.mid_beep = ao_cmd_lex_i; + ao_config.mid_beep = r; _ao_config_edit_finish(); } #endif @@ -835,14 +836,12 @@ void ao_config_tracker_set(void) { uint16_t m, i; - ao_cmd_decimal(); + m = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - m = ao_cmd_lex_i; - ao_cmd_decimal(); + i = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - i = ao_cmd_lex_i; _ao_config_edit_start(); ao_config.tracker_motion = m; ao_config.tracker_interval = i; @@ -863,11 +862,11 @@ ao_config_pyro_time_show(void) void ao_config_pyro_time_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.pyro_time = ao_cmd_lex_i; + ao_config.pyro_time = r; _ao_config_edit_finish(); } #endif @@ -883,26 +882,26 @@ ao_config_aprs_ssid_show(void) void ao_config_aprs_ssid_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - if (15 < ao_cmd_lex_i) { + if (15 < r) { ao_cmd_status = ao_cmd_lex_error; return; } _ao_config_edit_start(); - ao_config.aprs_ssid = ao_cmd_lex_i; + ao_config.aprs_ssid = r; _ao_config_edit_finish(); } void ao_config_aprs_format_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.aprs_format = ao_cmd_lex_i != 0; + ao_config.aprs_format = r != 0; _ao_config_edit_finish(); } @@ -923,11 +922,11 @@ ao_config_pad_box_show(void) void ao_config_pad_box_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.pad_box = ao_cmd_lex_i; + ao_config.pad_box = r; _ao_config_edit_finish(); } @@ -940,11 +939,11 @@ ao_config_pad_idle_show(void) void ao_config_pad_idle_set(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; _ao_config_edit_start(); - ao_config.pad_idle = ao_cmd_lex_i; + ao_config.pad_idle = r; _ao_config_edit_finish(); } #endif diff --git a/src/kernel/ao_fake_flight.c b/src/kernel/ao_fake_flight.c index 5880cf2b..8da0141c 100644 --- a/src/kernel/ao_fake_flight.c +++ b/src/kernel/ao_fake_flight.c @@ -133,14 +133,12 @@ ao_fake_flight(void) enum ao_flight_state my_state = ao_flight_invalid; int i; - ao_cmd_hex(); + calib_size = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - calib_size = ao_cmd_lex_i; - ao_cmd_hex(); + data_size = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - data_size = ao_cmd_lex_i; if ((unsigned) calib_size != sizeof (struct ao_fake_calib)) { printf ("calib size %d larger than actual size %d\n", calib_size, sizeof (struct ao_fake_calib)); diff --git a/src/kernel/ao_log.c b/src/kernel/ao_log.c index 1119cce4..fac211cf 100644 --- a/src/kernel/ao_log.c +++ b/src/kernel/ao_log.c @@ -437,10 +437,9 @@ ao_log_delete(void) cmd_flight = -1; ao_cmd_lex(); } - ao_cmd_decimal(); + cmd_flight *= ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - cmd_flight *= (int16_t) ao_cmd_lex_i; slots = ao_log_slots(); /* Look for the flight log matching the requested flight */ diff --git a/src/kernel/ao_log_single.c b/src/kernel/ao_log_single.c index da627387..a2b63c8d 100644 --- a/src/kernel/ao_log_single.c +++ b/src/kernel/ao_log_single.c @@ -118,10 +118,11 @@ ao_log_single_restart(void) void ao_log_single_set(void) { + uint16_t r; printf("Logging currently %s\n", ao_log_running ? "on" : "off"); - ao_cmd_hex(); + r = ao_cmd_hex(); if (ao_cmd_status == ao_cmd_success) { - if (ao_cmd_lex_i) { + if (r) { printf("Logging from %ld to %ld\n", ao_log_current_pos, ao_log_end_pos); ao_log_single_start(); } else { @@ -136,13 +137,12 @@ void ao_log_single_delete(void) { uint32_t pos; - - ao_cmd_hex(); + uint16_t r = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - if (ao_cmd_lex_i != 1) { + if (r != 1) { ao_cmd_status = ao_cmd_syntax_error; - printf("No such flight: %d\n", ao_cmd_lex_i); + printf("No such flight: %d\n", r); return; } ao_log_single_stop(); @@ -153,7 +153,7 @@ ao_log_single_delete(void) } ao_log_current_pos = ao_log_start_pos = 0; if (pos == 0) - printf("No such flight: %d\n", ao_cmd_lex_i); + printf("No such flight: %d\n", r); else printf ("Erased\n"); } diff --git a/src/kernel/ao_monitor.c b/src/kernel/ao_monitor.c index b6b8d888..3f1ff217 100644 --- a/src/kernel/ao_monitor.c +++ b/src/kernel/ao_monitor.c @@ -296,8 +296,7 @@ ao_monitor_enable(void) static void set_monitor(void) { - ao_cmd_hex(); - ao_external_monitoring = ao_cmd_lex_i; + ao_external_monitoring = ao_cmd_hex(); ao_wakeup(&ao_external_monitoring); ao_wakeup(&ao_monitor_head); _ao_monitor_adjust(); diff --git a/src/kernel/ao_pyro.c b/src/kernel/ao_pyro.c index e24ab46b..173cf8a3 100644 --- a/src/kernel/ao_pyro.c +++ b/src/kernel/ao_pyro.c @@ -484,10 +484,9 @@ ao_pyro_set(void) } #endif - ao_cmd_decimal(); + p = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - p = ao_cmd_lex_i; if (AO_PYRO_NUM <= p) { printf ("invalid pyro channel %d\n", p); return; @@ -516,25 +515,23 @@ ao_pyro_set(void) } pyro_tmp.flags |= ao_pyro_values[v].flag; if (ao_pyro_values[v].offset != NO_VALUE) { - uint8_t negative = 0; + int16_t r = 1; ao_cmd_white(); if (ao_cmd_lex_c == '-') { - negative = 1; + r = -1; ao_cmd_lex(); } - ao_cmd_decimal(); + r *= ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; if (ao_pyro_values[v].flag & AO_PYRO_8_BIT_VALUE) { - if (negative) { + if (r < 0) { ao_cmd_status = ao_cmd_syntax_error; return; } - *((uint8_t *) ((char *) &pyro_tmp + ao_pyro_values[v].offset)) = ao_cmd_lex_i; + *((uint8_t *) ((char *) &pyro_tmp + ao_pyro_values[v].offset)) = r; } else { - if (negative) - ao_cmd_lex_i = -ao_cmd_lex_i; - *((int16_t *) (void *) ((char *) &pyro_tmp + ao_pyro_values[v].offset)) = ao_cmd_lex_i; + *((int16_t *) (void *) ((char *) &pyro_tmp + ao_pyro_values[v].offset)) = r; } } } diff --git a/src/kernel/ao_radio_cmac_cmd.c b/src/kernel/ao_radio_cmac_cmd.c index e5b4ffdf..1433e96d 100644 --- a/src/kernel/ao_radio_cmac_cmd.c +++ b/src/kernel/ao_radio_cmac_cmd.c @@ -50,16 +50,14 @@ radio_cmac_send_cmd(void) uint8_t i; uint8_t len; - ao_cmd_decimal(); + len = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - len = ao_cmd_lex_i; if (len > AO_CMAC_MAX_LEN) { ao_cmd_status = ao_cmd_syntax_error; return; } flush(); - len = ao_cmd_lex_i; for (i = 0; i < len; i++) { cmac_data[i] = getbyte(); if (ao_cmd_status != ao_cmd_success) @@ -74,14 +72,12 @@ radio_cmac_recv_cmd(void) uint8_t len, i; uint16_t timeout; - ao_cmd_decimal(); + len = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - len = ao_cmd_lex_i; - ao_cmd_decimal(); + timeout = AO_MS_TO_TICKS(ao_cmd_decimal()); if (ao_cmd_status != ao_cmd_success) return; - timeout = AO_MS_TO_TICKS(ao_cmd_lex_i); i = ao_radio_cmac_recv(cmac_data, len, timeout); if (i == AO_RADIO_CMAC_OK) { printf ("PACKET "); diff --git a/src/kernel/ao_send_packet.c b/src/kernel/ao_send_packet.c index 3206b2d6..cae25151 100644 --- a/src/kernel/ao_send_packet.c +++ b/src/kernel/ao_send_packet.c @@ -29,8 +29,7 @@ ao_send_packet(void) uint8_t b; uint8_t i; - ao_cmd_hex(); - count = ao_cmd_lex_i; + count = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; if (count > AO_MAX_SEND - 2) { diff --git a/src/kernel/ao_storage.c b/src/kernel/ao_storage.c index 5292e120..890bdcae 100644 --- a/src/kernel/ao_storage.c +++ b/src/kernel/ao_storage.c @@ -92,15 +92,16 @@ static uint8_t storage_data[128]; static void ao_storage_dump(void) { + uint32_t block; uint8_t i, j; - ao_cmd_hex(); + block = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; for (i = 0; ; i += 8) { - if (ao_storage_read(((uint32_t) (ao_cmd_lex_i) << 8) + i, - storage_data, - 8)) { + if (ao_storage_read((block << 8) + i, + storage_data, + 8)) { ao_cmd_put16((uint16_t) i); for (j = 0; j < 8; j++) { putchar(' '); @@ -123,23 +124,19 @@ ao_storage_store(void) uint16_t block; uint8_t i; uint16_t len; - static uint8_t b; + uint8_t b; uint32_t addr; - ao_cmd_hex(); - block = ao_cmd_lex_i; - ao_cmd_hex(); - i = ao_cmd_lex_i; + block = ao_cmd_hex(); + i = ao_cmd_hex(); addr = ((uint32_t) block << 8) | i; - ao_cmd_hex(); - len = ao_cmd_lex_i; + len = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; while (len--) { - ao_cmd_hex(); + b = ao_cmd_hexbyte(); if (ao_cmd_status != ao_cmd_success) return; - b = ao_cmd_lex_i; ao_storage_write(addr, &b, 1); addr++; } @@ -149,10 +146,10 @@ ao_storage_store(void) void ao_storage_zap(void) { - ao_cmd_hex(); + uint32_t v = ao_cmd_hex(); if (ao_cmd_status != ao_cmd_success) return; - ao_storage_erase((uint32_t) ao_cmd_lex_i << 8); + ao_storage_erase((uint32_t) v << 8); } void diff --git a/src/kernel/ao_tracker.c b/src/kernel/ao_tracker.c index 46278530..f79bd18a 100644 --- a/src/kernel/ao_tracker.c +++ b/src/kernel/ao_tracker.c @@ -211,9 +211,9 @@ static struct ao_task ao_tracker_task; static void ao_tracker_set_telem(void) { - ao_cmd_hex(); + uint16_t r = ao_cmd_hex(); if (ao_cmd_status == ao_cmd_success) - ao_tracker_force_telem = ao_cmd_lex_i; + ao_tracker_force_telem = r; ao_cmd_status = ao_cmd_success; printf ("flight: %d\n", ao_flight_number); printf ("force_telem: %d\n", ao_tracker_force_telem); diff --git a/src/stm-vga/ao_demo.c b/src/stm-vga/ao_demo.c index 63740f8e..593a8743 100644 --- a/src/stm-vga/ao_demo.c +++ b/src/stm-vga/ao_demo.c @@ -159,17 +159,16 @@ ao_fb_init(void) static void ao_video_toggle(void) { - ao_cmd_decimal(); - if (ao_cmd_lex_i) + uint16_t r = ao_cmd_decimal(); + if (r) ao_fb_init(); - ao_vga_enable(ao_cmd_lex_i); + ao_vga_enable(r); } static void ao_ball_toggle(void) { - ao_cmd_decimal(); - ball_enable = ao_cmd_lex_i; + ball_enable = ao_cmd_decimal(); ao_wakeup(&ball_enable); } diff --git a/src/stm/ao_lcd_stm.c b/src/stm/ao_lcd_stm.c index 10d5d620..1947012b 100644 --- a/src/stm/ao_lcd_stm.c +++ b/src/stm/ao_lcd_stm.c @@ -326,12 +326,9 @@ ao_lcd_stm_seg_set(void) { int com, seg, val; int n, bit; - ao_cmd_decimal(); - com = ao_cmd_lex_i; - ao_cmd_decimal(); - seg = ao_cmd_lex_u32; - ao_cmd_decimal(); - val = ao_cmd_lex_i; + com = ao_cmd_decimal(); + seg = ao_cmd_decimal(); + val = ao_cmd_decimal(); printf ("com: %d seg: %d val: %d\n", com, seg, val); ao_lcd_set(com, seg, val); ao_lcd_flush(); diff --git a/src/stm/ao_pwm_stm.c b/src/stm/ao_pwm_stm.c index 53000a17..341f8887 100644 --- a/src/stm/ao_pwm_stm.c +++ b/src/stm/ao_pwm_stm.c @@ -107,10 +107,8 @@ ao_pwm_cmd(void) uint8_t ch; uint16_t val; - ao_cmd_decimal(); - ch = ao_cmd_lex_u32; - ao_cmd_decimal(); - val = ao_cmd_lex_u32; + ch = ao_cmd_decimal(); + val = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; diff --git a/src/stmf0/ao_adc_stm.c b/src/stmf0/ao_adc_stm.c index 571830bb..e62bb16e 100644 --- a/src/stmf0/ao_adc_stm.c +++ b/src/stmf0/ao_adc_stm.c @@ -103,10 +103,9 @@ ao_adc_one(void) int ch; uint16_t value; - ao_cmd_decimal(); + ch = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - ch = ao_cmd_lex_i; if (ch < 0 || AO_NUM_ADC <= ch) { ao_cmd_status = ao_cmd_syntax_error; return; diff --git a/src/telefireone-v1.0/ao_telefireone.c b/src/telefireone-v1.0/ao_telefireone.c index 790d7a41..6506235a 100644 --- a/src/telefireone-v1.0/ao_telefireone.c +++ b/src/telefireone-v1.0/ao_telefireone.c @@ -26,8 +26,7 @@ static void set_logging(void) { - ao_cmd_hex(); - ao_log_running = ao_cmd_lex_i; + ao_log_running = ao_cmd_hex(); ao_wakeup(&ao_log_running); } diff --git a/src/telelco-v2.0/ao_lco_v2.c b/src/telelco-v2.0/ao_lco_v2.c index 428b1a7c..90324cc8 100644 --- a/src/telelco-v2.0/ao_lco_v2.c +++ b/src/telelco-v2.0/ao_lco_v2.c @@ -282,9 +282,9 @@ ao_lco_main(void) void ao_lco_set_debug(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status == ao_cmd_success) - ao_lco_debug = ao_cmd_lex_i != 0; + ao_lco_debug = r != 0; } const struct ao_cmds ao_lco_cmds[] = { diff --git a/src/usbrelay-v0.1/ao_usbrelay.c b/src/usbrelay-v0.1/ao_usbrelay.c index 0eacdf5a..946f4b12 100644 --- a/src/usbrelay-v0.1/ao_usbrelay.c +++ b/src/usbrelay-v0.1/ao_usbrelay.c @@ -49,10 +49,9 @@ ao_relay_select(void) { uint8_t output; - ao_cmd_decimal(); + output = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - output = ao_cmd_lex_i; if (output > 1) printf ("Invalid relay position %u\n", output); else diff --git a/src/vidtime/ao_vidtime.c b/src/vidtime/ao_vidtime.c index 1b9b9e1c..e9f8b218 100644 --- a/src/vidtime/ao_vidtime.c +++ b/src/vidtime/ao_vidtime.c @@ -63,9 +63,9 @@ ao_init_vidtime(void) static void ao_set_vidtime(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status == ao_cmd_success) { - vidtime_monitor = ao_cmd_lex_i != 0; + vidtime_monitor = r != 0; ao_wakeup(&vidtime_monitor); } } -- cgit v1.2.3 From 684741765117611b7d666efbdfafd87c6199752c Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 15 Aug 2018 19:17:19 -0700 Subject: altos: Use stdbool true/false instead of TRUE/FALSE Signed-off-by: Keith Packard --- src/draw/ao_line.c | 16 ++++++++-------- src/drivers/ao_fat.c | 2 +- src/drivers/ao_hmc5883.c | 8 ++++---- src/drivers/ao_lco.h | 2 +- src/drivers/ao_mpu6000.c | 10 +++++----- src/drivers/ao_mpu9250.c | 10 +++++----- src/drivers/ao_packet_slave.c | 2 +- src/drivers/ao_trng_send.c | 4 ++-- src/drivers/ao_watchdog.c | 2 +- src/kernel/ao.h | 4 +--- src/kernel/ao_fake_flight.c | 8 ++++---- src/kernel/ao_power.c | 4 ++-- src/kernel/ao_pyro.c | 4 ++-- src/kernel/ao_sample.c | 4 ++-- src/kernel/ao_sample.h | 2 +- src/product/ao_telemetrum.c | 2 +- src/product/ao_telemini.c | 2 +- src/product/ao_telenano.c | 2 +- src/product/ao_teleterra.c | 2 +- src/stm-demo/ao_demo.c | 2 +- src/stm/ao_i2c_stm.c | 6 +++--- src/teleballoon-v2.0/ao_teleballoon.c | 2 +- src/telemega-v0.1/ao_telemega.c | 2 +- src/telemega-v1.0/ao_telemega.c | 2 +- src/telemega-v2.0/ao_telemega.c | 2 +- src/telemega-v3.0/ao_telemega.c | 2 +- src/telemetrum-v2.0/ao_telemetrum.c | 2 +- src/telemetrum-v3.0/ao_telemetrum.c | 2 +- src/telemini-v3.0/ao_telemini.c | 2 +- src/test/ao_flight_test.c | 4 ++-- 30 files changed, 58 insertions(+), 60 deletions(-) diff --git a/src/draw/ao_line.c b/src/draw/ao_line.c index ed1fc21c..742b3aa3 100644 --- a/src/draw/ao_line.c +++ b/src/draw/ao_line.c @@ -159,28 +159,28 @@ ao_clip_line(struct ao_cc *c, struct ao_cbox *b) /* Clip major axis */ if (c->major < b->maj1) { if (c->sign_major <= 0) - return FALSE; + return false; adjust_major = b->maj1 - c->major; } else if (c->major >= b->maj2) { if (c->sign_major >= 0) - return FALSE; + return false; adjust_major = c->major - (b->maj2-1); } /* Clip minor axis */ if (c->minor < b->min1) { if (c->sign_minor <= 0) - return FALSE; + return false; adjust_minor = b->min1 - c->minor; } else if (c->minor >= b->min2) { if (c->sign_minor >= 0) - return FALSE; + return false; adjust_minor = c->minor - (b->min2-1); } /* If unclipped, we're done */ if (adjust_major == 0 && adjust_minor == 0) - return TRUE; + return true; /* See how much minor adjustment would happen during * a major clip. This is a bit tricky because line drawing @@ -208,7 +208,7 @@ ao_clip_line(struct ao_cc *c, struct ao_cbox *b) c->major += c->sign_major * adjust_major; c->minor += c->sign_minor * adjust_minor; - return TRUE; + return true; } void @@ -276,8 +276,8 @@ ao_line(const struct ao_bitmap *dst, e3 = e2 - e1; e = e - e1; - clip_1.first = TRUE; - clip_2.first = FALSE; + clip_1.first = true; + clip_2.first = false; clip_2.e = clip_1.e = e; clip_2.e1 = clip_1.e1 = e1; clip_2.e3 = clip_1.e3 = e3; diff --git a/src/drivers/ao_fat.c b/src/drivers/ao_fat.c index 43e7df23..e9ff2789 100644 --- a/src/drivers/ao_fat.c +++ b/src/drivers/ao_fat.c @@ -990,7 +990,7 @@ ao_fat_sync(void) /* * ao_fat_full * - * Returns TRUE if the filesystem cannot take + * Returns true if the filesystem cannot take * more data */ diff --git a/src/drivers/ao_hmc5883.c b/src/drivers/ao_hmc5883.c index c33aa536..f4705708 100644 --- a/src/drivers/ao_hmc5883.c +++ b/src/drivers/ao_hmc5883.c @@ -35,7 +35,7 @@ ao_hmc5883_reg_write(uint8_t addr, uint8_t data) d[1] = data; ao_i2c_get(AO_HMC5883_I2C_INDEX); ao_i2c_start(AO_HMC5883_I2C_INDEX, HMC5883_ADDR_WRITE); - ao_i2c_send(d, 2, AO_HMC5883_I2C_INDEX, TRUE); + ao_i2c_send(d, 2, AO_HMC5883_I2C_INDEX, true); ao_i2c_put(AO_HMC5883_I2C_INDEX); ao_hmc5883_addr = addr + 1; } @@ -46,10 +46,10 @@ ao_hmc5883_read(uint8_t addr, uint8_t *data, uint8_t len) ao_i2c_get(AO_HMC5883_I2C_INDEX); if (addr != ao_hmc5883_addr) { ao_i2c_start(AO_HMC5883_I2C_INDEX, HMC5883_ADDR_WRITE); - ao_i2c_send(&addr, 1, AO_HMC5883_I2C_INDEX, FALSE); + ao_i2c_send(&addr, 1, AO_HMC5883_I2C_INDEX, false); } ao_i2c_start(AO_HMC5883_I2C_INDEX, HMC5883_ADDR_READ); - ao_i2c_recv(data, len, AO_HMC5883_I2C_INDEX, TRUE); + ao_i2c_recv(data, len, AO_HMC5883_I2C_INDEX, true); ao_i2c_put(AO_HMC5883_I2C_INDEX); ao_hmc5883_addr = 0xff; } @@ -103,7 +103,7 @@ ao_hmc5883_setup(void) ao_i2c_get(AO_HMC5883_I2C_INDEX); present = ao_i2c_start(AO_HMC5883_I2C_INDEX, HMC5883_ADDR_READ); - ao_i2c_recv(&d, 1, AO_HMC5883_I2C_INDEX, TRUE); + ao_i2c_recv(&d, 1, AO_HMC5883_I2C_INDEX, true); ao_i2c_put(AO_HMC5883_I2C_INDEX); if (!present) diff --git a/src/drivers/ao_lco.h b/src/drivers/ao_lco.h index 2958fbcc..cdc19d3d 100644 --- a/src/drivers/ao_lco.h +++ b/src/drivers/ao_lco.h @@ -35,7 +35,7 @@ extern uint8_t ao_lco_debug; #endif #if AO_LCO_DRAG -extern uint8_t ao_lco_drag_race; /* TRUE when drag race mode enabled */ +extern uint8_t ao_lco_drag_race; /* true when drag race mode enabled */ #endif extern uint8_t ao_lco_pad; /* Currently selected pad */ diff --git a/src/drivers/ao_mpu6000.c b/src/drivers/ao_mpu6000.c index 81d3c16c..8c85ab01 100644 --- a/src/drivers/ao_mpu6000.c +++ b/src/drivers/ao_mpu6000.c @@ -55,7 +55,7 @@ _ao_mpu6000_reg_write(uint8_t addr, uint8_t value) #else ao_i2c_get(AO_MPU6000_I2C_INDEX); ao_i2c_start(AO_MPU6000_I2C_INDEX, MPU6000_ADDR_WRITE); - ao_i2c_send(d, 2, AO_MPU6000_I2C_INDEX, TRUE); + ao_i2c_send(d, 2, AO_MPU6000_I2C_INDEX, true); ao_i2c_put(AO_MPU6000_I2C_INDEX); #endif } @@ -72,9 +72,9 @@ _ao_mpu6000_read(uint8_t addr, void *data, uint8_t len) #else ao_i2c_get(AO_MPU6000_I2C_INDEX); ao_i2c_start(AO_MPU6000_I2C_INDEX, MPU6000_ADDR_WRITE); - ao_i2c_send(&addr, 1, AO_MPU6000_I2C_INDEX, FALSE); + ao_i2c_send(&addr, 1, AO_MPU6000_I2C_INDEX, false); ao_i2c_start(AO_MPU6000_I2C_INDEX, MPU6000_ADDR_READ); - ao_i2c_recv(data, len, AO_MPU6000_I2C_INDEX, TRUE); + ao_i2c_recv(data, len, AO_MPU6000_I2C_INDEX, true); ao_i2c_put(AO_MPU6000_I2C_INDEX); #endif } @@ -92,9 +92,9 @@ _ao_mpu6000_reg_read(uint8_t addr) #else ao_i2c_get(AO_MPU6000_I2C_INDEX); ao_i2c_start(AO_MPU6000_I2C_INDEX, MPU6000_ADDR_WRITE); - ao_i2c_send(&addr, 1, AO_MPU6000_I2C_INDEX, FALSE); + ao_i2c_send(&addr, 1, AO_MPU6000_I2C_INDEX, false); ao_i2c_start(AO_MPU6000_I2C_INDEX, MPU6000_ADDR_READ); - ao_i2c_recv(&value, 1, AO_MPU6000_I2C_INDEX, TRUE); + ao_i2c_recv(&value, 1, AO_MPU6000_I2C_INDEX, true); ao_i2c_put(AO_MPU6000_I2C_INDEX); #endif return value; diff --git a/src/drivers/ao_mpu9250.c b/src/drivers/ao_mpu9250.c index 9dce9f1a..74e444a9 100644 --- a/src/drivers/ao_mpu9250.c +++ b/src/drivers/ao_mpu9250.c @@ -63,7 +63,7 @@ _ao_mpu9250_reg_write(uint8_t addr, uint8_t value) #else ao_i2c_get(AO_MPU9250_I2C_INDEX); ao_i2c_start(AO_MPU9250_I2C_INDEX, MPU9250_ADDR_WRITE); - ao_i2c_send(d, 2, AO_MPU9250_I2C_INDEX, TRUE); + ao_i2c_send(d, 2, AO_MPU9250_I2C_INDEX, true); ao_i2c_put(AO_MPU9250_I2C_INDEX); #endif } @@ -80,9 +80,9 @@ _ao_mpu9250_read(uint8_t addr, void *data, uint8_t len) #else ao_i2c_get(AO_MPU9250_I2C_INDEX); ao_i2c_start(AO_MPU9250_I2C_INDEX, MPU9250_ADDR_WRITE); - ao_i2c_send(&addr, 1, AO_MPU9250_I2C_INDEX, FALSE); + ao_i2c_send(&addr, 1, AO_MPU9250_I2C_INDEX, false); ao_i2c_start(AO_MPU9250_I2C_INDEX, MPU9250_ADDR_READ); - ao_i2c_recv(data, len, AO_MPU9250_I2C_INDEX, TRUE); + ao_i2c_recv(data, len, AO_MPU9250_I2C_INDEX, true); ao_i2c_put(AO_MPU9250_I2C_INDEX); #endif } @@ -100,9 +100,9 @@ _ao_mpu9250_reg_read(uint8_t addr) #else ao_i2c_get(AO_MPU9250_I2C_INDEX); ao_i2c_start(AO_MPU9250_I2C_INDEX, MPU9250_ADDR_WRITE); - ao_i2c_send(&addr, 1, AO_MPU9250_I2C_INDEX, FALSE); + ao_i2c_send(&addr, 1, AO_MPU9250_I2C_INDEX, false); ao_i2c_start(AO_MPU9250_I2C_INDEX, MPU9250_ADDR_READ); - ao_i2c_recv(&value, 1, AO_MPU9250_I2C_INDEX, TRUE); + ao_i2c_recv(&value, 1, AO_MPU9250_I2C_INDEX, true); ao_i2c_put(AO_MPU9250_I2C_INDEX); #endif return value; diff --git a/src/drivers/ao_packet_slave.c b/src/drivers/ao_packet_slave.c index b877128a..3ae1138c 100644 --- a/src/drivers/ao_packet_slave.c +++ b/src/drivers/ao_packet_slave.c @@ -28,7 +28,7 @@ ao_packet_slave(void) if (ao_packet_recv(0)) { ao_xmemcpy(&ao_tx_packet.callsign, &ao_rx_packet.packet.callsign, AO_MAX_CALLSIGN); #if HAS_FLIGHT - ao_flight_force_idle = TRUE; + ao_flight_force_idle = true; #endif ao_packet_send(); } diff --git a/src/drivers/ao_trng_send.c b/src/drivers/ao_trng_send.c index 4e02c0ce..e8df4cea 100644 --- a/src/drivers/ao_trng_send.c +++ b/src/drivers/ao_trng_send.c @@ -48,7 +48,7 @@ ao_trng_start(void) * aren't of poor quality */ ao_delay(delay); - trng_running = TRUE; + trng_running = true; } ao_mutex_put(&random_mutex); } @@ -213,7 +213,7 @@ static void ao_trng_suspend(void *arg) #ifdef AO_TRNG_ENABLE_PORT ao_gpio_set(AO_TRNG_ENABLE_PORT, AO_TRNG_ENABLE_BIT, AO_TRNG_ENABLE_PIN, 0); #endif - trng_running = FALSE; + trng_running = false; } static void ao_trng_resume(void *arg) diff --git a/src/drivers/ao_watchdog.c b/src/drivers/ao_watchdog.c index c0582c12..4d774c3a 100644 --- a/src/drivers/ao_watchdog.c +++ b/src/drivers/ao_watchdog.c @@ -18,7 +18,7 @@ #include -static int ao_watchdog_enabled = TRUE; +static int ao_watchdog_enabled = true; static void ao_watchdog(void) diff --git a/src/kernel/ao.h b/src/kernel/ao.h index 3beeb880..cdcdadc3 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -35,9 +36,6 @@ extern int ao_putchar(char c); extern char ao_getchar(void); -#define TRUE 1 -#define FALSE 0 - #ifndef HAS_TASK #define HAS_TASK 1 #endif diff --git a/src/kernel/ao_fake_flight.c b/src/kernel/ao_fake_flight.c index 8da0141c..ec8691e9 100644 --- a/src/kernel/ao_fake_flight.c +++ b/src/kernel/ao_fake_flight.c @@ -54,7 +54,7 @@ ao_fake_data_read(void) uint8_t *d = (void *) &ao_fake_next; if (getchar() == 0) - return FALSE; + return false; for (i = 0; i < sizeof (struct ao_data); i++) *d++ = getchar(); if (!ao_fake_has_offset) { @@ -64,7 +64,7 @@ ao_fake_data_read(void) } else ao_fake_next.tick += ao_fake_tick_offset; ao_fake_has_next = 1; - return TRUE; + return true; } static void @@ -118,10 +118,10 @@ ao_fake_calib_read(void) ) { printf ("Calibration data major version mismatch %d.%d <= %d.%d\n", ao_calib.major, ao_calib.minor, AO_FAKE_CALIB_MAJOR, AO_FAKE_CALIB_MINOR); - return FALSE; + return false; } ao_fake_calib_set(&ao_calib); - return TRUE; + return true; } static void diff --git a/src/kernel/ao_power.c b/src/kernel/ao_power.c index bf59ab53..8c490604 100644 --- a/src/kernel/ao_power.c +++ b/src/kernel/ao_power.c @@ -26,7 +26,7 @@ ao_power_register(struct ao_power *power) { if (power->registered) return; - power->registered = TRUE; + power->registered = true; if (tail) { tail->next = power; power->prev = tail; @@ -44,7 +44,7 @@ ao_power_unregister(struct ao_power *power) { if (!power->registered) return; - power->registered = FALSE; + power->registered = false; if (power->prev) power->prev->next = power->next; else diff --git a/src/kernel/ao_pyro.c b/src/kernel/ao_pyro.c index 173cf8a3..c01c9512 100644 --- a/src/kernel/ao_pyro.c +++ b/src/kernel/ao_pyro.c @@ -205,9 +205,9 @@ ao_pyro_ready(struct ao_pyro *pyro) default: continue; } - return FALSE; + return false; } - return TRUE; + return true; } #ifndef AO_FLIGHT_TEST diff --git a/src/kernel/ao_sample.c b/src/kernel/ao_sample.c index 115eae80..9cba36c1 100644 --- a/src/kernel/ao_sample.c +++ b/src/kernel/ao_sample.c @@ -277,7 +277,7 @@ ao_sample_preflight(void) ao_accel_scale = to_fix_32(GRAVITY * 2 * 16) / ao_accel_2g; #endif ao_sample_preflight_set(); - ao_preflight = FALSE; + ao_preflight = false; } } @@ -398,5 +398,5 @@ ao_sample_init(void) ao_sample_set_all_orients(); #endif ao_sample_data = ao_data_head; - ao_preflight = TRUE; + ao_preflight = true; } diff --git a/src/kernel/ao_sample.h b/src/kernel/ao_sample.h index af6eca4e..4c51a58c 100644 --- a/src/kernel/ao_sample.h +++ b/src/kernel/ao_sample.h @@ -154,7 +154,7 @@ extern uint8_t ao_sample_orient_pos; void ao_sample_init(void); -/* returns FALSE in preflight mode, TRUE in flight mode */ +/* returns false in preflight mode, true in flight mode */ uint8_t ao_sample(void); /* diff --git a/src/product/ao_telemetrum.c b/src/product/ao_telemetrum.c index a10cb384..1266fee7 100644 --- a/src/product/ao_telemetrum.c +++ b/src/product/ao_telemetrum.c @@ -60,7 +60,7 @@ main(void) ao_gps_report_init(); ao_telemetry_init(); ao_radio_init(); - ao_packet_slave_init(FALSE); + ao_packet_slave_init(false); ao_igniter_init(); #if HAS_DBG ao_dbg_init(); diff --git a/src/product/ao_telemini.c b/src/product/ao_telemini.c index 14414a48..d9cb676b 100644 --- a/src/product/ao_telemini.c +++ b/src/product/ao_telemini.c @@ -56,7 +56,7 @@ main(void) ao_report_init(); ao_telemetry_init(); ao_radio_init(); - ao_packet_slave_init(TRUE); + ao_packet_slave_init(true); ao_igniter_init(); ao_config_init(); ao_start_scheduler(); diff --git a/src/product/ao_telenano.c b/src/product/ao_telenano.c index ac08979f..1b04edc5 100644 --- a/src/product/ao_telenano.c +++ b/src/product/ao_telenano.c @@ -40,7 +40,7 @@ main(void) ao_report_init(); ao_telemetry_init(); ao_radio_init(); - ao_packet_slave_init(TRUE); + ao_packet_slave_init(true); ao_config_init(); ao_start_scheduler(); } diff --git a/src/product/ao_teleterra.c b/src/product/ao_teleterra.c index 0142f9e3..ae129233 100644 --- a/src/product/ao_teleterra.c +++ b/src/product/ao_teleterra.c @@ -34,7 +34,7 @@ main(void) ao_cmd_init(); ao_usb_init(); ao_serial_init(); - ao_monitor_init(AO_LED_GREEN, TRUE); + ao_monitor_init(AO_LED_GREEN, true); ao_radio_init(); ao_config_init(); ao_start_scheduler(); diff --git a/src/stm-demo/ao_demo.c b/src/stm-demo/ao_demo.c index b0d03840..4b963e42 100644 --- a/src/stm-demo/ao_demo.c +++ b/src/stm-demo/ao_demo.c @@ -125,7 +125,7 @@ ao_i2c_write(void) { for (i = 0; i < 10; i++) { ao_i2c_get(0); if (ao_i2c_start(0, 0x55)) - ao_i2c_send(data, 4, 0, TRUE); + ao_i2c_send(data, 4, 0, true); else { printf ("i2c start failed\n"); ao_i2c_put(0); diff --git a/src/stm/ao_i2c_stm.c b/src/stm/ao_i2c_stm.c index 59cad495..23805aa8 100644 --- a/src/stm/ao_i2c_stm.c +++ b/src/stm/ao_i2c_stm.c @@ -275,7 +275,7 @@ ao_i2c_send(void *block, uint16_t len, uint8_t index, uint8_t stop) stm_i2c->cr1 = AO_STM_I2C_CR1 | (1 << STM_I2C_CR1_STOP); ao_i2c_wait_stop(index); } - return TRUE; + return true; } void @@ -300,10 +300,10 @@ uint8_t ao_i2c_recv(void *block, uint16_t len, uint8_t index, uint8_t stop) { struct stm_i2c *stm_i2c = ao_i2c_stm_info[index].stm_i2c; - uint8_t ret = TRUE; + uint8_t ret = true; if (len == 0) - return TRUE; + return true; if (len == 1) { ao_i2c_recv_data[index] = block; ao_i2c_recv_len[index] = 1; diff --git a/src/teleballoon-v2.0/ao_teleballoon.c b/src/teleballoon-v2.0/ao_teleballoon.c index 2432c272..acb11f44 100644 --- a/src/teleballoon-v2.0/ao_teleballoon.c +++ b/src/teleballoon-v2.0/ao_teleballoon.c @@ -77,7 +77,7 @@ main(void) ao_gps_report_metrum_init(); ao_telemetry_init(); ao_radio_init(); - ao_packet_slave_init(FALSE); + ao_packet_slave_init(false); ao_companion_init(); ao_config_init(); diff --git a/src/telemega-v0.1/ao_telemega.c b/src/telemega-v0.1/ao_telemega.c index 3cfc9b44..f8b7ecfa 100644 --- a/src/telemega-v0.1/ao_telemega.c +++ b/src/telemega-v0.1/ao_telemega.c @@ -85,7 +85,7 @@ main(void) ao_gps_report_mega_init(); ao_telemetry_init(); ao_radio_init(); - ao_packet_slave_init(FALSE); + ao_packet_slave_init(false); ao_igniter_init(); ao_companion_init(); ao_pyro_init(); diff --git a/src/telemega-v1.0/ao_telemega.c b/src/telemega-v1.0/ao_telemega.c index 2deb852e..50428b61 100644 --- a/src/telemega-v1.0/ao_telemega.c +++ b/src/telemega-v1.0/ao_telemega.c @@ -85,7 +85,7 @@ main(void) ao_gps_report_mega_init(); ao_telemetry_init(); ao_radio_init(); - ao_packet_slave_init(FALSE); + ao_packet_slave_init(false); ao_igniter_init(); ao_companion_init(); ao_pyro_init(); diff --git a/src/telemega-v2.0/ao_telemega.c b/src/telemega-v2.0/ao_telemega.c index 7a1c46ae..6a58547e 100644 --- a/src/telemega-v2.0/ao_telemega.c +++ b/src/telemega-v2.0/ao_telemega.c @@ -86,7 +86,7 @@ main(void) ao_gps_report_mega_init(); ao_telemetry_init(); ao_radio_init(); - ao_packet_slave_init(FALSE); + ao_packet_slave_init(false); ao_igniter_init(); ao_companion_init(); ao_pyro_init(); diff --git a/src/telemega-v3.0/ao_telemega.c b/src/telemega-v3.0/ao_telemega.c index 2259c751..2577f90c 100644 --- a/src/telemega-v3.0/ao_telemega.c +++ b/src/telemega-v3.0/ao_telemega.c @@ -82,7 +82,7 @@ main(void) ao_gps_report_mega_init(); ao_telemetry_init(); ao_radio_init(); - ao_packet_slave_init(FALSE); + ao_packet_slave_init(false); ao_igniter_init(); ao_companion_init(); ao_pyro_init(); diff --git a/src/telemetrum-v2.0/ao_telemetrum.c b/src/telemetrum-v2.0/ao_telemetrum.c index 5cf42a8d..65f9be2c 100644 --- a/src/telemetrum-v2.0/ao_telemetrum.c +++ b/src/telemetrum-v2.0/ao_telemetrum.c @@ -77,7 +77,7 @@ main(void) ao_gps_report_metrum_init(); ao_telemetry_init(); ao_radio_init(); - ao_packet_slave_init(FALSE); + ao_packet_slave_init(false); ao_igniter_init(); ao_companion_init(); diff --git a/src/telemetrum-v3.0/ao_telemetrum.c b/src/telemetrum-v3.0/ao_telemetrum.c index 6349d188..2bb5192a 100644 --- a/src/telemetrum-v3.0/ao_telemetrum.c +++ b/src/telemetrum-v3.0/ao_telemetrum.c @@ -77,7 +77,7 @@ main(void) ao_gps_report_metrum_init(); ao_telemetry_init(); ao_radio_init(); - ao_packet_slave_init(FALSE); + ao_packet_slave_init(false); ao_igniter_init(); ao_companion_init(); diff --git a/src/telemini-v3.0/ao_telemini.c b/src/telemini-v3.0/ao_telemini.c index a50268b9..a2c0a598 100644 --- a/src/telemini-v3.0/ao_telemini.c +++ b/src/telemini-v3.0/ao_telemini.c @@ -68,7 +68,7 @@ main(void) ao_report_init(); ao_telemetry_init(); ao_radio_init(); - ao_packet_slave_init(TRUE); + ao_packet_slave_init(true); ao_igniter_init(); ao_config_init(); diff --git a/src/test/ao_flight_test.c b/src/test/ao_flight_test.c index a171930e..6d007575 100644 --- a/src/test/ao_flight_test.c +++ b/src/test/ao_flight_test.c @@ -227,8 +227,8 @@ ao_gps_angle(void) extern enum ao_flight_state ao_flight_state; -#define FALSE 0 -#define TRUE 1 +#define false 0 +#define true 1 volatile struct ao_data ao_data_ring[AO_DATA_RING]; volatile uint8_t ao_data_head; -- cgit v1.2.3 From a76829a4a840261e33869c40b3366fff3b691069 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 15 Aug 2018 22:44:17 -0700 Subject: altos: Allow application-specific prompts for ao_cmd_readline Lets other readline users specify alternate prompts. Signed-off-by: Keith Packard --- src/kernel/ao.h | 2 +- src/kernel/ao_cmd.c | 27 +++++++++++---------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/kernel/ao.h b/src/kernel/ao.h index cdcdadc3..08e90839 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -165,7 +165,7 @@ void ao_put_string(const char *s); void -ao_cmd_readline(void); +ao_cmd_readline(const char *prompt); char ao_cmd_lex(void); diff --git a/src/kernel/ao_cmd.c b/src/kernel/ao_cmd.c index a72192f4..d1c049ac 100644 --- a/src/kernel/ao_cmd.c +++ b/src/kernel/ao_cmd.c @@ -34,6 +34,8 @@ static char cmd_line[AO_CMD_LEN]; static uint8_t cmd_len; static uint8_t cmd_i; +static const char backspace[] = "\010 \010"; + void ao_put_string(const char *s) { @@ -42,18 +44,12 @@ ao_put_string(const char *s) putchar(c); } -static void -backspace(void) -{ - ao_put_string ("\010 \010"); -} - void -ao_cmd_readline(void) +ao_cmd_readline(const char *prompt) { char c; if (ao_echo()) - ao_put_string("> "); + ao_put_string(prompt); cmd_len = 0; for (;;) { flush(); @@ -62,7 +58,7 @@ ao_cmd_readline(void) if (c == '\010' || c == '\177') { if (cmd_len != 0) { if (ao_echo()) - backspace(); + ao_put_string(backspace); --cmd_len; } continue; @@ -72,7 +68,7 @@ ao_cmd_readline(void) if (c == '\025') { while (cmd_len != 0) { if (ao_echo()) - backspace(); + ao_put_string(backspace); --cmd_len; } continue; @@ -172,9 +168,8 @@ ao_cmd_hexchar(char c) return -1; } -static -uint32_t -_ao_cmd_hex(uint8_t lim) +static uint32_t +get_hex(uint8_t lim) { uint32_t result = 0; uint8_t i; @@ -196,13 +191,13 @@ _ao_cmd_hex(uint8_t lim) uint8_t ao_cmd_hexbyte(void) { - return _ao_cmd_hex(2); + return get_hex(2); } uint32_t ao_cmd_hex(void) { - return _ao_cmd_hex(0xff); + return get_hex(0xff); } uint32_t @@ -371,7 +366,7 @@ ao_cmd(void) void (*func)(void); for (;;) { - ao_cmd_readline(); + ao_cmd_readline("> "); ao_cmd_lex(); ao_cmd_white(); c = ao_cmd_lex_c; -- cgit v1.2.3 From b8e607960f2f399fd6ba92a8c97ab72e19812d3f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 00:05:38 -0700 Subject: altos: Delete random 8051 ISR declarations Signed-off-by: Keith Packard --- src/kernel/ao.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/kernel/ao.h b/src/kernel/ao.h index 08e90839..9c0c8604 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -111,10 +111,6 @@ ao_delay(uint16_t ticks); void ao_timer_set_adc_interval(uint8_t interval); -/* Timer interrupt */ -void -ao_timer_isr(void) ao_arch_interrupt(9); - /* Initialize the timer */ void ao_timer_init(void); @@ -581,9 +577,6 @@ extern int8_t ao_radio_rssi; #define HAS_RADIO_RATE HAS_RADIO #endif -void -ao_radio_general_isr(void) ao_arch_interrupt(16); - #if HAS_RADIO_XMIT void ao_radio_send(const void *d, uint8_t size); @@ -944,9 +937,6 @@ ao_terraui_init(void); */ #ifdef BATTERY_PIN -void -ao_battery_isr(void) ao_arch_interrupt(1); - uint16_t ao_battery_get(void); -- cgit v1.2.3 From f037d0091a4b31c631d64e71441953eb9b3b21ce Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 2 Oct 2018 12:47:00 -0700 Subject: altos: Remove 8051-ism from ao_usb.h __at doesn't exist for non-8051 Signed-off-by: Keith Packard --- src/kernel/ao_usb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kernel/ao_usb.h b/src/kernel/ao_usb.h index 7992c806..6c74a042 100644 --- a/src/kernel/ao_usb.h +++ b/src/kernel/ao_usb.h @@ -69,7 +69,7 @@ ao_usb_disable(void); void ao_usb_init(void); -extern const __at (0x00aa) uint8_t ao_usb_descriptors []; +extern const uint8_t ao_usb_descriptors []; #define AO_USB_SETUP_DIR_MASK (0x01 << 7) #define AO_USB_SETUP_TYPE_MASK (0x03 << 5) -- cgit v1.2.3 From b7a21bf6a086748b4907c0577eaa114445995783 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 00:07:38 -0700 Subject: altos/stm32f4: Start adding support for STM32F413 Enough to get clocks lit up at least. Signed-off-by: Keith Packard --- src/stm32f4/Makefile-flash.defs | 68 ++++ src/stm32f4/Makefile-raw.defs | 13 + src/stm32f4/Makefile-stm32f4.defs | 52 +++ src/stm32f4/Makefile.defs | 13 + src/stm32f4/altos-loader.ld | 97 ++++++ src/stm32f4/altos-raw.ld | 70 ++++ src/stm32f4/altos.ld | 105 ++++++ src/stm32f4/ao_arch.h | 104 ++++++ src/stm32f4/ao_arch_funcs.h | 106 ++++++ src/stm32f4/ao_interrupt.c | 239 +++++++++++++ src/stm32f4/ao_timer.c | 280 +++++++++++++++ src/stm32f4/registers.ld | 47 +++ src/stm32f4/stm32f4.h | 694 ++++++++++++++++++++++++++++++++++++++ 13 files changed, 1888 insertions(+) create mode 100644 src/stm32f4/Makefile-flash.defs create mode 100644 src/stm32f4/Makefile-raw.defs create mode 100644 src/stm32f4/Makefile-stm32f4.defs create mode 100644 src/stm32f4/Makefile.defs create mode 100644 src/stm32f4/altos-loader.ld create mode 100644 src/stm32f4/altos-raw.ld create mode 100644 src/stm32f4/altos.ld create mode 100644 src/stm32f4/ao_arch.h create mode 100644 src/stm32f4/ao_arch_funcs.h create mode 100644 src/stm32f4/ao_interrupt.c create mode 100644 src/stm32f4/ao_timer.c create mode 100644 src/stm32f4/registers.ld create mode 100644 src/stm32f4/stm32f4.h diff --git a/src/stm32f4/Makefile-flash.defs b/src/stm32f4/Makefile-flash.defs new file mode 100644 index 00000000..1a2aa75c --- /dev/null +++ b/src/stm32f4/Makefile-flash.defs @@ -0,0 +1,68 @@ +include $(TOPDIR)/stm32f4/Makefile-stm32f4.defs + +INC = \ + ao.h \ + ao_arch.h \ + ao_arch_funcs.h \ + ao_flash_pins.h \ + ao_flash_stm_pins.h \ + ao_flash_task.h \ + ao_pins.h \ + ao_product.h \ + Makefile + +# +# Common AltOS sources +# +SRC = \ + ao_interrupt.c \ + ao_romconfig.c \ + ao_boot_chain.c \ + ao_boot_pin.c \ + ao_product.c \ + ao_notask.c \ + ao_timer.c \ + ao_usb_stm.c \ + ao_flash_stm.c \ + ao_flash_task.c \ + ao_flash_loader_stm.c + +OBJ=$(SRC:.c=.o) + +PRODUCT=AltosFlash +PRODUCT_DEF=-DALTOS_FLASH +IDPRODUCT=0x000a + +CFLAGS = $(PRODUCT_DEF) $(STM32F4_CFLAGS) -g -Os + +LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm32f4 -Wl,-Taltos-loader.ld + +PROGNAME=altos-flash +PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf +BIN=$(HARDWARE)-$(PROGNAME)-$(VERSION).bin + +MAKEBIN=$(TOPDIR)/../ao-tools/ao-makebin/ao-makebin +FLASH_ADDR=0x08000000 + +all: $(PROG) $(BIN) + +$(PROG): Makefile $(OBJ) altos-loader.ld + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) + +$(BIN): $(PROG) + $(MAKEBIN) --output=$@ --base=$(FLASH_ADDR) $(PROG) + +ao_product.h: ao-make-product.5c $(TOPDIR)/Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +$(OBJ): $(INC) + +distclean: clean + +clean: + rm -f *.o $(HARDWARE)-$(PROGNAME)-*.elf $(HARDWARE)-$(PROGNAME)-*.bin + rm -f ao_product.h + +install: + +uninstall: diff --git a/src/stm32f4/Makefile-raw.defs b/src/stm32f4/Makefile-raw.defs new file mode 100644 index 00000000..03d92e42 --- /dev/null +++ b/src/stm32f4/Makefile-raw.defs @@ -0,0 +1,13 @@ +ifndef TOPDIR +TOPDIR=.. +endif + +include $(TOPDIR)/stm32f4/Makefile-stm32f4.defs + +LOADER=flash-loader/$(PROGNAME)-altos-flash-$(VERSION).elf +MAKEBIN=$(TOPDIR)/../ao-tools/ao-makebin/ao-makebin +FLASH_ADDR=0x08000000 + +LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm32f4 -Wl,-Taltos-raw.ld -n + +.DEFAULT_GOAL=all diff --git a/src/stm32f4/Makefile-stm32f4.defs b/src/stm32f4/Makefile-stm32f4.defs new file mode 100644 index 00000000..4346b7d8 --- /dev/null +++ b/src/stm32f4/Makefile-stm32f4.defs @@ -0,0 +1,52 @@ +ifndef TOPDIR +TOPDIR=.. +endif + +include $(TOPDIR)/Makedefs + +vpath % $(TOPDIR)/stm32f4:$(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 +vpath kalman_filter.5c $(TOPDIR)/kalman +vpath load_csv.5c $(TOPDIR)/kalman +vpath matrix.5c $(TOPDIR)/kalman +vpath ao-make-product.5c $(TOPDIR)/util + +.SUFFIXES: .elf .ihx + +.elf.ihx: + $(ELFTOHEX) --output=$@ $*.elf + +ifndef VERSION +include $(TOPDIR)/Version +endif + +ELFTOHEX=$(TOPDIR)/../ao-tools/ao-elftohex/ao-elftohex +CC=$(ARM_CC) + +WARN_FLAGS=-Wall -Wextra -Werror -Wcast-align + +AO_CFLAGS=-I. -I$(TOPDIR)/stm32f4 -I$(TOPDIR)/kernel -I$(TOPDIR)/drivers \ + -DNEWLIB_INTEGER_PRINTF_SCANF -Os -g \ + -I$(TOPDIR)/product -I$(TOPDIR) -I$(TOPDIR)/math \ + -isystem $(NEWLIB_NANO)/arm-none-eabi/include + +STM32F4_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m4 -mthumb \ + -mfloat-abi=hard -mfpu=fpv4-sp-d16 \ + -ffreestanding -nostdlib $(AO_CFLAGS) $(WARN_FLAGS) + +NICKLE=nickle + +LIBS=-L$(NEWLIB_NANO)/arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/hard -lc -lm -lgcc + +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) + +.c.o: + $(call quiet,CC) -c $(CFLAGS) -o $@ $< diff --git a/src/stm32f4/Makefile.defs b/src/stm32f4/Makefile.defs new file mode 100644 index 00000000..be185a59 --- /dev/null +++ b/src/stm32f4/Makefile.defs @@ -0,0 +1,13 @@ +ifndef TOPDIR +TOPDIR=.. +endif + +include $(TOPDIR)/stm32f4/Makefile-stm32f4.defs + +LOADER=flash-loader/$(PROGNAME)-altos-flash-$(VERSION).elf +MAKEBIN=$(TOPDIR)/../ao-tools/ao-makebin/ao-makebin +FLASH_ADDR=0x08000000 + +LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm32f4 -Wl,-Taltos.ld -n + +.DEFAULT_GOAL=all diff --git a/src/stm32f4/altos-loader.ld b/src/stm32f4/altos-loader.ld new file mode 100644 index 00000000..5d6e1f4b --- /dev/null +++ b/src/stm32f4/altos-loader.ld @@ -0,0 +1,97 @@ +/* + * Copyright © 2012 Keith Packard + * + * 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. + */ + +MEMORY { + rom : ORIGIN = 0x08000000, LENGTH = 4K + ram : ORIGIN = 0x20000000, LENGTH = 256K +} + +INCLUDE registers.ld + +EXTERN (stm_interrupt_vector) + +SECTIONS { + /* + * Rom contents + */ + + .interrupt : { + __text_start__ = .; + *(.interrupt) /* Interrupt vectors */ + } > rom + + .text ORIGIN(rom) + 0x100 : { + ao_romconfig.o(.romconfig*) + ao_product.o(.romconfig*) + + *(.text*) /* Executable code */ + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + *(.rodata*) /* Constants */ + } > rom + __text_end__ = .; + + /* Boot data which must live at the start of ram so that + * the application and bootloader share the same addresses. + * This must be all uninitialized data + */ + .boot ORIGIN(ram) + SIZEOF(.interrupt) (NOLOAD) : { + __boot_start__ = .; + *(.boot) + __boot_end__ = .; + } >ram + + /* Functions placed in RAM (required for flashing) + * + * Align to 8 bytes as that's what the ARM likes text + * segment alignments to be, and if we don't, then + * we end up with a mismatch between the location in + * ROM and the desired location in RAM. I don't + * entirely understand this, but at least this appears + * to work... + */ + + .textram BLOCK(8): { + _start__ = .; + __text_ram_start__ = .; + *(.ramtext) + __text_ram_end = .; + } >ram AT>rom + + /* Data -- relocated to RAM, but written to ROM. + * also aligned to 8 bytes in case textram is empty + */ + .data BLOCK(8): { + *(.data) /* initialized data */ + _end__ = .; + } >ram AT>rom + + + .bss : { + __bss_start__ = .; + *(.bss) + *(COMMON) + __bss_end__ = .; + } >ram + + PROVIDE(__stack__ = ORIGIN(ram) + LENGTH(ram)); + PROVIDE(end = .); +} + +ENTRY(start); + + diff --git a/src/stm32f4/altos-raw.ld b/src/stm32f4/altos-raw.ld new file mode 100644 index 00000000..21da5af5 --- /dev/null +++ b/src/stm32f4/altos-raw.ld @@ -0,0 +1,70 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +MEMORY { + rom (rx) : ORIGIN = 0x08000000, LENGTH = 1M + ram (!w) : ORIGIN = 0x20000000, LENGTH = 256k - 256 + stack (!w) : ORIGIN = 0x20000000 + 256k - 256, LENGTH = 256 +} + +INCLUDE registers.ld + +EXTERN (stm_interrupt_vector) + +SECTIONS { + /* + * Rom contents + */ + + .interrupt : { + __text_start__ = .; + *(.interrupt) /* Interrupt vectors */ + } > rom + + .text : { + *(.text*) /* Executable code */ + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + *(.rodata*) /* Constants */ + } > rom + __text_end__ = .; + + /* Data -- relocated to RAM, but written to ROM + */ + .data : { + _start__ = .; + *(.data) /* initialized data */ + . = ALIGN(4); + _end__ = .; + } >ram AT>rom + + .bss : { + __bss_start__ = .; + *(.bss) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } >ram + + PROVIDE(end = .); + + PROVIDE(__stack__ = ORIGIN(stack) + LENGTH(stack)); +} + +ENTRY(start); + + diff --git a/src/stm32f4/altos.ld b/src/stm32f4/altos.ld new file mode 100644 index 00000000..2db0e387 --- /dev/null +++ b/src/stm32f4/altos.ld @@ -0,0 +1,105 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +MEMORY { + rom (rx) : ORIGIN = 0x08001000, LENGTH = 1M - 4k + ram (!w) : ORIGIN = 0x20000000, LENGTH = 256k - 256 + stack (!w) : ORIGIN = 0x20000000 + 256k - 256, LENGTH = 256 +} + +INCLUDE registers.ld + +EXTERN (stm_interrupt_vector) + +SECTIONS { + /* + * Rom contents + */ + + .interrupt ORIGIN(ram) : AT (ORIGIN(rom)) { + __interrupt_start__ = .; + __interrupt_rom__ = ORIGIN(rom); + *(.interrupt) /* Interrupt vectors */ + __interrupt_end__ = .; + } > ram + + .text ORIGIN(rom) + 0x100 : { + __text_start__ = .; + + /* Ick. What I want is to specify the + * addresses of some global constants so + * that I can find them across versions + * of the application. I can't figure out + * how to make gnu ld do that, so instead + * we just load the two files that include + * these defines in the right order here and + * expect things to 'just work'. Don't change + * the contents of those files, ok? + */ + ao_romconfig.o(.romconfig*) + ao_product.o(.romconfig*) + + *(.text*) /* Executable code */ + } > rom + + .ARM.exidx : { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + + .rodata : { + *(.rodata*) /* Constants */ + } > rom + + __text_end__ = .; + + /* Boot data which must live at the start of ram so that + * the application and bootloader share the same addresses. + * This must be all uninitialized data + */ + .boot (NOLOAD) : { + __boot_start__ = .; + *(.boot) + . = ALIGN(4); + __boot_end__ = .; + } >ram + + /* Data -- relocated to RAM, but written to ROM + */ + .data : { + _start__ = .; + *(.data) /* initialized data */ + . = ALIGN(4); + _end__ = .; + } >ram AT>rom + + .bss : { + __bss_start__ = .; + *(.bss) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } >ram + + PROVIDE(end = .); + + PROVIDE(__stack__ = ORIGIN(stack) + LENGTH(stack)); +} + +ENTRY(start); + + diff --git a/src/stm32f4/ao_arch.h b/src/stm32f4/ao_arch.h new file mode 100644 index 00000000..805d756d --- /dev/null +++ b/src/stm32f4/ao_arch.h @@ -0,0 +1,104 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#ifndef _AO_ARCH_H_ +#define _AO_ARCH_H_ + +#include +#include + +#ifndef AO_STACK_SIZE +#define AO_STACK_SIZE 512 +#endif + +#define AO_PORT_TYPE uint16_t + +#define ao_arch_nop() asm("nop") + +#define ao_arch_task_members\ + uint32_t *sp; /* saved stack pointer */ + +#define ao_arch_block_interrupts() asm("cpsid i") +#define ao_arch_release_interrupts() asm("cpsie i") + +#define ao_arch_naked_declare __attribute__((naked)) +#define ao_arch_naked_define + +/* + * ao_timer.c + * + * We'll generally use the HSE clock through the PLL + */ + +#define AO_STM_NVIC_CLOCK_PRIORITY 0xf0 /* low priority for clock */ + +#if AO_HSE +#define AO_PLLSRC AO_HSE +#endif + +#if AO_HSI +#define AO_PLLSRC STM_HSI_FREQ +#endif + +#if AO_PLL_M +#define AO_PLLIN (AO_PLLSRC / AO_PLL_M) +#endif + +#if AO_PLL1_N + +#define AO_PLL1_VCO (AO_PLLIN * AO_PLL1_N) +#define AO_PLL1_CLK_P (AO_PLL1_VCO / AO_PLL1_P) +#define AO_SYSCLK (AO_PLL1_CLK_P) + +# if AO_PLL1_Q +#define AO_PLL1_CLK_Q (AO_PLL1_VCO / AO_PLL1_Q) +# endif + +#else + +#define AO_SYSCLK AO_PLLSRC + +#endif + +#if AO_PLL2_N + +#define AO_PLL2_VCO (AO_PLLIN * AO_PLL2_N) + +# if AO_PLL2_Q +#define AO_PLL2_CLK_Q (AL_PLL2_VCO / AO_PLL2_Q) +# endif + +# if AO_PLL2_R +#define AO_PLL2_CLK_R (AL_PLL2_VCO / AO_PLL2_R) +# endif + +#endif + +#define AO_HCLK (AO_SYSCLK / AO_AHB_PRESCALER) +#define AO_P1CLK (AO_HCLK / AO_APB1_PRESCALER) +#if AO_ABP1_PRESCALER == 1 +#define AO_P1_TIMER_CLK AO_P1CLK +#else +#define AO_P1_TIMER_CLK (AO_P1CLK * 2) +#endif +#define AO_P2CLK (AO_HCLK / AO_APB2_PRESCALER) +#if AO_ABP2_PRESCALER == 1 +#define AO_P2_TIMER_CLK AO_P2CLK +#else +#define AO_P2_TIMER_CLK (AO_P2CLK * 2) +#endif +#define AO_SYSTICK (AO_HCLK) +#define AO_PANIC_DELAY_SCALE (AO_SYSCLK / 12000000) + +#endif /* _AO_ARCH_H_ */ diff --git a/src/stm32f4/ao_arch_funcs.h b/src/stm32f4/ao_arch_funcs.h new file mode 100644 index 00000000..252fe77a --- /dev/null +++ b/src/stm32f4/ao_arch_funcs.h @@ -0,0 +1,106 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#ifndef _AO_ARCH_FUNCS_H_ +#define _AO_ARCH_FUNCS_H_ + +/* GPIO functions */ + +#define ao_power_register(gpio) +#define ao_power_unregister(gpio) + +static inline void ao_enable_port(struct stm_gpio *port) +{ + if ((port) == &stm_gpioa) { + stm_rcc.ahb1enr |= (1 << STM_RCC_AHB1ENR_IOPAEN); + ao_power_register(&ao_power_gpioa); + } else if ((port) == &stm_gpiob) { + stm_rcc.ahb1enr |= (1 << STM_RCC_AHB1ENR_IOPBEN); + ao_power_register(&ao_power_gpiob); + } else if ((port) == &stm_gpioc) { + stm_rcc.ahb1enr |= (1 << STM_RCC_AHB1ENR_IOPCEN); + ao_power_register(&ao_power_gpioc); + } else if ((port) == &stm_gpiod) { + stm_rcc.ahb1enr |= (1 << STM_RCC_AHB1ENR_IOPDEN); + ao_power_register(&ao_power_gpiod); + } else if ((port) == &stm_gpioe) { + stm_rcc.ahb1enr |= (1 << STM_RCC_AHB1ENR_IOPEEN); + ao_power_register(&ao_power_gpioe); + } else if ((port) == &stm_gpiof) { + stm_rcc.ahb1enr |= (1 << STM_RCC_AHB1ENR_IOPFEN); + ao_power_register(&ao_power_gpiof); + } else if ((port) == &stm_gpiog) { + stm_rcc.ahb1enr |= (1 << STM_RCC_AHB1ENR_IOPGEN); + ao_power_register(&ao_power_gpiog); + } else if ((port) == &stm_gpioh) { + stm_rcc.ahb1enr |= (1 << STM_RCC_AHB1ENR_IOPHEN); + ao_power_register(&ao_power_gpioh); + } +} + +static inline void ao_disable_port(struct stm_gpio *port) +{ + if ((port) == &stm_gpioa) { + stm_rcc.ahb1enr &= ~(1 << STM_RCC_AHB1ENR_IOPAEN); + ao_power_unregister(&ao_power_gpioa); + } else if ((port) == &stm_gpiob) { + stm_rcc.ahb1enr &= ~(1 << STM_RCC_AHB1ENR_IOPBEN); + ao_power_unregister(&ao_power_gpiob); + } else if ((port) == &stm_gpioc) { + stm_rcc.ahb1enr &= ~(1 << STM_RCC_AHB1ENR_IOPCEN); + ao_power_unregister(&ao_power_gpioc); + } else if ((port) == &stm_gpiod) { + stm_rcc.ahb1enr &= ~(1 << STM_RCC_AHB1ENR_IOPDEN); + ao_power_unregister(&ao_power_gpiod); + } else if ((port) == &stm_gpioe) { + stm_rcc.ahb1enr &= ~(1 << STM_RCC_AHB1ENR_IOPEEN); + ao_power_unregister(&ao_power_gpioe); + } else if ((port) == &stm_gpiof) { + stm_rcc.ahb1enr &= ~(1 << STM_RCC_AHB1ENR_IOPFEN); + ao_power_unregister(&ao_power_gpiof); + } else if ((port) == &stm_gpiog) { + stm_rcc.ahb1enr &= ~(1 << STM_RCC_AHB1ENR_IOPGEN); + ao_power_unregister(&ao_power_gpiog); + } else if ((port) == &stm_gpioh) { + stm_rcc.ahb1enr &= ~(1 << STM_RCC_AHB1ENR_IOPHEN); + ao_power_unregister(&ao_power_gpioh); + } +} + +#define ao_gpio_set(port, bit, v) stm_gpio_set(port, bit, v) + +#define ao_gpio_get(port, bit) stm_gpio_get(port, bit) + +#define ao_enable_output(port,bit,v) do { \ + ao_enable_port(port); \ + ao_gpio_set(port, bit, v); \ + stm_moder_set(port, bit, STM_MODER_OUTPUT);\ + } while (0) + +#define ao_gpio_set_mode(port,bit,mode) do { \ + if (mode == AO_EXTI_MODE_PULL_UP) \ + stm_pupdr_set(port, bit, STM_PUPDR_PULL_UP); \ + else if (mode == AO_EXTI_MODE_PULL_DOWN) \ + stm_pupdr_set(port, bit, STM_PUPDR_PULL_DOWN); \ + else \ + stm_pupdr_set(port, bit, STM_PUPDR_NONE); \ + } while (0) + +#define ao_enable_input(port,bit,mode) do { \ + ao_enable_port(port); \ + stm_moder_set(port, bit, STM_MODER_INPUT); \ + ao_gpio_set_mode(port, bit, mode); \ + } while (0) + +#endif /* _AO_ARCH_FUNCS_H_ */ diff --git a/src/stm32f4/ao_interrupt.c b/src/stm32f4/ao_interrupt.c new file mode 100644 index 00000000..a00df54b --- /dev/null +++ b/src/stm32f4/ao_interrupt.c @@ -0,0 +1,239 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#include +#include "stm32f4.h" +#include +#include + +extern void main(void); +extern char __stack__; +extern char __text_start__, __text_end__; +extern char _start__, _end__; +extern char __bss_start__, __bss_end__; + +/* Interrupt functions */ + +void stm_halt_isr(void) +{ + ao_panic(AO_PANIC_CRASH); +} + +void stm_ignore_isr(void) +{ +} + +const void *stm_interrupt_vector[]; + +void start(void) +{ +#ifdef AO_BOOT_CHAIN + if (ao_boot_check_chain()) { +#ifdef AO_BOOT_PIN + ao_boot_check_pin(); +#endif + } +#endif + /* Enable FPU */ + stm_scb.cpacr |= ((STM_SCB_CPACR_FULL << STM_SCB_CPACR_FP0) | + (STM_SCB_CPACR_FULL << STM_SCB_CPACR_FP1)); + ao_arch_nop(); + /* Set interrupt vector table offset */ + stm_scb.vtor = (uint32_t) &stm_interrupt_vector; + memcpy(&_start__, &__text_end__, &_end__ - &_start__); + memset(&__bss_start__, '\0', &__bss_end__ - &__bss_start__); + main(); +} + +#define STRINGIFY(x) #x + +#define isr(name) \ + void __attribute__ ((weak)) stm_ ## name ## _isr(void); \ + _Pragma(STRINGIFY(weak stm_ ## name ## _isr = stm_ignore_isr)) + +#define isr_halt(name) \ + void __attribute__ ((weak)) stm_ ## name ## _isr(void); \ + _Pragma(STRINGIFY(weak stm_ ## name ## _isr = stm_halt_isr)) + +isr(nmi) +isr_halt(hardfault) +isr_halt(memmanage) +isr_halt(busfault) +isr_halt(usagefault) +isr(svc) +isr(debugmon) +isr(pendsv) +isr(systick) +isr(wwdg) +isr(pvd) +isr(tamper_stamp) +isr(rtc_wkup) +isr(flash) +isr(rcc) +isr(exti0) +isr(exti1) +isr(exti2) +isr(exti3) +isr(exti4) +isr(dma1_stream0) +isr(dma1_stream1) +isr(dma1_stream2) +isr(dma1_stream3) +isr(dma1_stream4) +isr(dma1_stream5) +isr(dma1_stream6) +isr(adc) +isr(can1_tx) +isr(can1_rx0) +isr(can1_rx1) +isr(can1_sce) +isr(exti9_5) +isr(tim1_brk_tim9) +isr(tim1_up_tim10) +isr(tim_trg_com_tim11) +isr(tim1_cc) +isr(tim2) +isr(tim3) +isr(tim4) +isr(i2c1_evt) +isr(i2c1_err) +isr(i2c2_evt) +isr(i2c2_err) +isr(spi1) +isr(spi2) +isr(usart1) +isr(usart2) +isr(usart3) +isr(exti5_10) +isr(rtc_alarm) +isr(otg_fs_wkup) +isr(tim8_brk_tim12) +isr(tim8_up_tim13) +isr(tim8_trg_com_tim14) +isr(tim8_cc) +isr(dma1_stream7) +isr(fsmc) +isr(sdio) +isr(tim5) +isr(spi3) +isr(uart4) +isr(uart5) +isr(tim6_glb_it) +isr(tim7) +isr(dma2_stream0) +isr(dma2_stream1) +isr(dma2_stream2) +isr(dma2_stream3) +isr(dma2_stream4) +isr(dfsdm1_flt0) +isr(dfsdm1_flt1) +isr(can2_tx) +isr(can2_rx0) +isr(can2_rx1) +isr(can2_sce) +isr(otg_fs) +isr(dma2_stream5) +isr(dma2_stream6) +isr(dma2_stream7) +isr(usart6) +isr(i2c3_ev) +isr(i2c3_er) +isr(can3_tx) +isr(can3_rx0) +isr(can3_rx1) +isr(can3_sce) +isr(crypto) +isr(rng) +isr(fpu) +isr(uart7) +isr(uart8) +isr(spi4) +isr(spi5) +isr(sai1) +isr(uart9) +isr(uart10) +isr(quad_spi) +isr(i2cfmp1_ev) +isr(i2cfmp1_er) +isr(exti23) +isr(dfsdm2_flt0) +isr(dfsdm2_flt1) +isr(dfsdm2_flt2) +isr(dfsdm2_flt3) + +#define i(addr,name) [(addr)/4] = stm_ ## name ## _isr + +__attribute__ ((section(".interrupt"))) +const void *stm_interrupt_vector[] = { + [0] = &__stack__, + [1] = start, + i(0x08, nmi), + i(0x0c, hardfault), + i(0x10, memmanage), + i(0x14, busfault), + i(0x18, usagefault), + i(0x2c, svc), + i(0x30, debugmon), + i(0x38, pendsv), + i(0x3c, systick), + i(0x40, wwdg), + i(0x44, pvd), + i(0x48, tamper_stamp), + i(0x4c, rtc_wkup), + i(0x50, flash), + i(0x54, rcc), + i(0x58, exti0), + i(0x5c, exti1), + i(0x60, exti2), + i(0x64, exti3), + i(0x68, exti4), + i(0x6c, dma1_stream0), + i(0x70, dma1_stream1), + i(0x74, dma1_stream2), + i(0x78, dma1_stream3), + i(0x7c, dma1_stream4), + i(0x80, dma1_stream5), + i(0x84, dma1_stream6), + i(0x88, adc), + i(0x8c, can1_tx), + i(0x90, can1_rx0), + i(0x94, can1_rx1), + i(0x98, can1_sce), + i(0x9c, exti9_5), + i(0xa0, tim1_brk_tim9), + i(0xa4, tim1_up_tim10), + i(0xa8, tim_trg_com_tim11), + i(0xac, tim1_cc), + i(0xb0, tim2), + i(0xb4, tim3), + i(0xb8, tim4), + i(0xbc, i2c1_evt), + i(0xc0, i2c1_err), + i(0xc4, i2c2_evt), + i(0xc8, i2c2_err), + i(0xcc, spi1), + i(0xd0, spi2), + i(0xd4, usart1), + i(0xd8, usart2), + i(0xdc, usart3), + i(0xe0, exti5_10), + i(0xe4, rtc_alarm), + i(0xe8, otg_fs_wkup), + i(0xec, tim8_brk_tim12), + i(0xf0, tim8_up_tim13), +}; diff --git a/src/stm32f4/ao_timer.c b/src/stm32f4/ao_timer.c new file mode 100644 index 00000000..e96559f4 --- /dev/null +++ b/src/stm32f4/ao_timer.c @@ -0,0 +1,280 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#include "ao.h" +#include + +#ifndef HAS_TICK +#define HAS_TICK 1 +#endif + +#if HAS_TICK || defined(AO_TIMER_HOOK) + +#if HAS_TICK +volatile AO_TICK_TYPE ao_tick_count; + +AO_TICK_TYPE +ao_time(void) +{ + return ao_tick_count; +} +#endif + +#if AO_DATA_ALL +volatile uint8_t ao_data_interval = 1; +volatile uint8_t ao_data_count; +#endif + +void stm_systick_isr(void) +{ + ao_validate_cur_stack(); + if (stm_systick.csr & (1 << STM_SYSTICK_CSR_COUNTFLAG)) { +#if HAS_TICK + ++ao_tick_count; +#endif +#if HAS_TASK_QUEUE + if (ao_task_alarm_tick && (int16_t) (ao_tick_count - ao_task_alarm_tick) >= 0) + ao_task_check_alarm((uint16_t) ao_tick_count); +#endif +#if AO_DATA_ALL + if (++ao_data_count == ao_data_interval) { + ao_data_count = 0; +#if HAS_FAKE_FLIGHT + if (ao_fake_flight_active) + ao_fake_flight_poll(); + else +#endif + ao_adc_poll(); +#if (AO_DATA_ALL & ~(AO_DATA_ADC)) + ao_wakeup((void *) &ao_data_count); +#endif + } +#endif +#ifdef AO_TIMER_HOOK + AO_TIMER_HOOK; +#endif + } +} + +#if HAS_ADC +void +ao_timer_set_adc_interval(uint8_t interval) +{ + ao_arch_critical( + ao_data_interval = interval; + ao_data_count = 0; + ); +} +#endif + +#define SYSTICK_RELOAD ((AO_SYSTICK / 8) / 100 - 1) + +void +ao_timer_init(void) +{ + stm_systick.rvr = SYSTICK_RELOAD; + stm_systick.cvr = 0; + stm_systick.csr = ((1 << STM_SYSTICK_CSR_ENABLE) | + (1 << STM_SYSTICK_CSR_TICKINT) | + (STM_SYSTICK_CSR_CLKSOURCE_AHB_8 << STM_SYSTICK_CSR_CLKSOURCE)); + stm_scb.shpr3 |= AO_STM_NVIC_CLOCK_PRIORITY << 24; +} + +#endif + +void +ao_clock_init(void) +{ + uint32_t cfgr; + uint32_t pllcfgr; + + /* Switch to HSI while messing about */ + stm_rcc.cr |= (1 << STM_RCC_CR_HSION); + while (!(stm_rcc.cr & (1 << STM_RCC_CR_HSIRDY))) + ao_arch_nop(); + + stm_rcc.cfgr = (stm_rcc.cfgr & ~(STM_RCC_CFGR_SW_MASK << STM_RCC_CFGR_SW)) | + (STM_RCC_CFGR_SW_HSI << STM_RCC_CFGR_SW); + + /* wait for system to switch to HSI */ + while ((stm_rcc.cfgr & (STM_RCC_CFGR_SWS_MASK << STM_RCC_CFGR_SWS)) != + (STM_RCC_CFGR_SWS_HSI << STM_RCC_CFGR_SWS)) + ao_arch_nop(); + + /* reset everything but the HSI selection and status */ + stm_rcc.cfgr &= (uint32_t)0x0000000f; + + /* reset everything but HSI */ + stm_rcc.cr &= 0x0000ffff; + + /* Disable and clear all interrupts */ + stm_rcc.cir = 0xffff0000; + +#if AO_HSE +#if AO_HSE_BYPASS + stm_rcc.cr |= (1 << STM_RCC_CR_HSEBYP); +#else + stm_rcc.cr &= ~(1 << STM_RCC_CR_HSEBYP); +#endif + /* Enable HSE clock */ + stm_rcc.cr |= (1 << STM_RCC_CR_HSEON); + while (!(stm_rcc.cr & (1 << STM_RCC_CR_HSERDY))) + asm("nop"); + +#define STM_RCC_CFGR_SWS_TARGET_CLOCK (STM_RCC_CFGR_SWS_HSE << STM_RCC_CFGR_SWS) +#define STM_RCC_CFGR_SW_TARGET_CLOCK (STM_RCC_CFGR_SW_HSE) +#define STM_PLLSRC AO_HSE +#define STM_RCC_CFGR_PLLSRC_TARGET_CLOCK (1 << STM_RCC_CFGR_PLLSRC) +#else +#define STM_RCC_CFGR_SWS_TARGET_CLOCK (STM_RCC_CFGR_SWS_HSI << STM_RCC_CFGR_SWS) +#define STM_RCC_CFGR_SW_TARGET_CLOCK (STM_RCC_CFGR_SW_HSI) +#define STM_PLLSRC STM_HSI +#define STM_RCC_CFGR_PLLSRC_TARGET_CLOCK (0 << STM_RCC_CFGR_PLLSRC) +#endif + +#if !AO_HSE || HAS_ADC || HAS_ADC_SINGLE + /* Enable HSI RC clock 16MHz */ + stm_rcc.cr |= (1 << STM_RCC_CR_HSION); + while (!(stm_rcc.cr & (1 << STM_RCC_CR_HSIRDY))) + asm("nop"); +#endif + + /* Set flash latency to tolerate SYSCLK */ + +#define FLASH_LATENCY ((AO_SYSCLK - 1) / 25000000) + + /* Enable icache, dcache and prefetch. Set latency */ + stm_flash.acr = ((1 << STM_FLASH_ACR_DCEN) | + (1 << STM_FLASH_ACR_ICEN) | + (1 << STM_FLASH_ACR_PRFTEN) | + (FLASH_LATENCY << STM_FLASH_ACR_LATENCY)); + + /* Enable power interface clock */ + stm_rcc.apb1enr |= (1 << STM_RCC_APB1ENR_PWREN); + +#if AO_SYSCLK <= 64000000 +#define VOS_SCALE_MODE STM_PWR_CR_VOS_SCALE_MODE_1 +#elif AO_SYSCLK <= 84000000 +#define VOS_SCALE_MODE STM_PWR_CR_VOS_SCALE_MODE_2 +#else +#define VOS_SCALE_MODE STM_PWR_CR_VOS_SCALE_MODE_1 +#endif + + /* Set voltage scale mode */ + stm_pwr.cr = ((stm_pwr.cr & ~(STM_PWR_CR_VOS_SCALE_MODE_MASK)) | + (VOS_SCALE_MODE << STM_PWR_CR_VOS)); + + /* HCLK */ + cfgr = stm_rcc.cfgr; + cfgr &= ~(STM_RCC_CFGR_HPRE_MASK << STM_RCC_CFGR_HPRE); + cfgr |= (AO_RCC_CFGR_HPRE_DIV << STM_RCC_CFGR_HPRE); + stm_rcc.cfgr = cfgr; + + /* APB1 Prescaler = AO_APB1_PRESCALER */ + cfgr = stm_rcc.cfgr; + cfgr &= ~(STM_RCC_CFGR_PPRE1_MASK << STM_RCC_CFGR_PPRE1); + cfgr |= (AO_RCC_CFGR_PPRE1_DIV << STM_RCC_CFGR_PPRE1); + stm_rcc.cfgr = cfgr; + + /* APB2 Prescaler = AO_APB2_PRESCALER */ + cfgr = stm_rcc.cfgr; + cfgr &= ~(STM_RCC_CFGR_PPRE2_MASK << STM_RCC_CFGR_PPRE2); + cfgr |= (AO_RCC_CFGR_PPRE2_DIV << STM_RCC_CFGR_PPRE2); + stm_rcc.cfgr = cfgr; + + /* Disable the PLL */ + stm_rcc.cr &= ~(1 << STM_RCC_CR_PLLON); + while (stm_rcc.cr & (1 << STM_RCC_CR_PLLRDY)) + asm("nop"); + + /* PLL1VCO */ + pllcfgr = stm_rcc.pllcfgr; + pllcfgr &= ~(STM_RCC_PLLCFGR_PLLM_MASK << STM_RCC_PLLCFGR_PLLM); + pllcfgr &= ~(STM_RCC_PLLCFGR_PLLN_MASK << STM_RCC_PLLCFGR_PLLN); + pllcfgr &= ~(STM_RCC_PLLCFGR_PLLP_MASK << STM_RCC_PLLCFGR_PLLP); + pllcfgr &= ~(STM_RCC_PLLCFGR_PLLQ_MASK << STM_RCC_PLLCFGR_PLLQ); + pllcfgr &= ~(STM_RCC_PLLCFGR_PLLR_MASK << STM_RCC_PLLCFGR_PLLR); + + pllcfgr |= (AO_PLL_M << STM_RCC_PLLCFGR_PLLM); + pllcfgr |= (AO_PLL1_N << STM_RCC_PLLCFGR_PLLN); +#if AO_PLL1_P + pllcfgr |= (AO_PLL1_P << STM_RCC_PLLCFGR_PLLP); +#endif +#if AO_PLL1_Q + pllcfgr |= (AO_PLL1_Q << STM_RCC_PLLCFGR_PLLQ); +#endif + /* PLL source */ + pllcfgr &= ~(1 << STM_RCC_PLLCFGR_PLLSRC); +#if AO_HSI + pllcfgr |= STM_RCC_PLLCFGR_PLLSRC_HSI; +#endif +#if AO_HSE + pllcfgr |= STM_RCC_PLLCFGR_PLLSRC_HSE; +#endif + stm_rcc.pllcfgr = pllcfgr; + + /* Enable the PLL and wait for it */ + stm_rcc.cr |= (1 << STM_RCC_CR_PLLON); + while (!(stm_rcc.cr & (1 << STM_RCC_CR_PLLRDY))) + asm("nop"); + + /* Switch to the PLL for the system clock */ + + cfgr = stm_rcc.cfgr; + cfgr &= ~(STM_RCC_CFGR_SW_MASK << STM_RCC_CFGR_SW); + cfgr |= (STM_RCC_CFGR_SW_PLL << STM_RCC_CFGR_SW); + stm_rcc.cfgr = cfgr; + for (;;) { + uint32_t c, part, mask, val; + + c = stm_rcc.cfgr; + mask = (STM_RCC_CFGR_SWS_MASK << STM_RCC_CFGR_SWS); + val = (STM_RCC_CFGR_SWS_PLL << STM_RCC_CFGR_SWS); + part = c & mask; + if (part == val) + break; + } + +#if 0 + stm_rcc.apb2rstr = 0xffff; + stm_rcc.apb1rstr = 0xffff; + stm_rcc.ahbrstr = 0x3f; + stm_rcc.ahbenr = (1 << STM_RCC_AHBENR_FLITFEN); + stm_rcc.apb2enr = 0; + stm_rcc.apb1enr = 0; + stm_rcc.ahbrstr = 0; + stm_rcc.apb1rstr = 0; + stm_rcc.apb2rstr = 0; +#endif + + /* Clear reset flags */ + stm_rcc.csr |= (1 << STM_RCC_CSR_RMVF); + +#if DEBUG_THE_CLOCK + /* Output SYSCLK on PA8 for measurments */ + + stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIOAEN); + + stm_afr_set(&stm_gpioa, 8, STM_AFR_AF0); + stm_moder_set(&stm_gpioa, 8, STM_MODER_ALTERNATE); + stm_ospeedr_set(&stm_gpioa, 8, STM_OSPEEDR_40MHz); + + stm_rcc.cfgr |= (STM_RCC_CFGR_MCOPRE_DIV_1 << STM_RCC_CFGR_MCOPRE); + stm_rcc.cfgr |= (STM_RCC_CFGR_MCOSEL_HSE << STM_RCC_CFGR_MCOSEL); +#endif +} diff --git a/src/stm32f4/registers.ld b/src/stm32f4/registers.ld new file mode 100644 index 00000000..b36b2098 --- /dev/null +++ b/src/stm32f4/registers.ld @@ -0,0 +1,47 @@ +stm_tim2 = 0x40000000; +stm_tim3 = 0x40000400; +stm_tim4 = 0x40000800; +stm_tim5 = 0x40000c00; +stm_tim6 = 0x40001000; +stm_tim7 = 0x40001400; +stm_tim12 = 0x40001800; +stm_tim13 = 0x40001c00; +stm_tim14 = 0x40002000; +stm_lptim1 = 0x40002400; +stm_rtc = 0x40002800; +stm_wwdg = 0x40002c00; +stm_iwdg = 0x40003000; +stm_can1 = 0x40006400; +stm_can2 = 0x40006800; +stm_can3 = 0x40006c00; +stm_pwr = 0x40007000; +stm_dac1 = 0x40007400; +stm_uart7 = 0x40007800; +stm_uart8 = 0x40007c00; + +stm_gpioa = 0x40020000; +stm_gpiob = 0x40020400; +stm_gpioc = 0x40020800; +stm_gpiod = 0x40020c00; +stm_gpioe = 0x40021000; +stm_gpiof = 0x40021400; +stm_gpiog = 0x40021800; +stm_gpioh = 0x40021c00; + +stm_crc = 0x40023000; +stm_rcc = 0x40023800; +stm_flash = 0x40023c00; +stm_dma1 = 0x40026000; +stm_dma2 = 0x40026400; + +stm_systick = 0xe000e010; + +stm_ictr = 0xe000e004; +stm_nvic = 0xe000e100; + +stm_scb = 0xe000ed00; + +stm_mpu = 0xe000ed90; + +stm_flash_size = 0x1fff7a22; +stm_device_id = 0x1fff7a10; diff --git a/src/stm32f4/stm32f4.h b/src/stm32f4/stm32f4.h new file mode 100644 index 00000000..a351f086 --- /dev/null +++ b/src/stm32f4/stm32f4.h @@ -0,0 +1,694 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#ifndef _STM32F4_H_ +#define _STM32F4_H_ + +#include + +typedef volatile uint32_t vuint32_t; +typedef volatile void * vvoid_t; +typedef volatile uint16_t vuint16_t; +typedef volatile uint8_t vuint8_t; + +struct stm_pwr { + vuint32_t cr; + vuint32_t csr; +}; + +extern struct stm_pwr stm_pwr; + +#define stm_pwr (*((struct stm_pwr *) 0x40007000)) + +#define STM_PWR_CR_FISSR 21 +#define STM_PWR_CR_FMSSR 20 +#define STM_PWR_CR_VOS 14 +#define STM_PWR_CR_VOS_SCALE_MODE_3 1 +#define STM_PWR_CR_VOS_SCALE_MODE_2 2 +#define STM_PWR_CR_VOS_SCALE_MODE_1 3 +#define STM_PWR_CR_VOS_SCALE_MODE_MASK 3 +#define STM_PWR_CR_ADCDC1 13 +#define STM_PWR_CR_MRLVDS 11 +#define STM_PWR_CR_LPLVDS 10 +#define STM_PWR_CR_FPDS 9 +#define STM_PWR_CR_DBP 8 +#define STM_PWR_CR_PLS 5 +#define STM_PWR_CR_PVDE 4 +#define STM_PWR_CR_CSBF 3 +#define STM_PWR_CR_CWUF 2 +#define STM_PWR_CR_PDDS 1 +#define STM_PWR_CR_LPDS 0 + +struct stm_rcc { + vuint32_t cr; + vuint32_t pllcfgr; + vuint32_t cfgr; + vuint32_t cir; + + vuint32_t ahb1rstr; + vuint32_t ahb2rstr; + vuint32_t ahb3rstr; + uint32_t pad_1c; + + vuint32_t apb1rstr; + vuint32_t apb2rstr; + vuint32_t pad_28; + vuint32_t pad_2c; + + vuint32_t ahb1enr; + vuint32_t ahb2enr; + vuint32_t ahbdnr; + vuint32_t pad_3c; + + vuint32_t apb1enr; + vuint32_t apb2enr; + vuint32_t pad_48; + vuint32_t pad_4c; + + vuint32_t ahb1lpenr; + vuint32_t ahb2lpenr; + vuint32_t ahb3lpenr; + vuint32_t pad_5c; + + vuint32_t apb1lpenr; + vuint32_t apb2lpenr; + vuint32_t pad_68; + vuint32_t pad_6c; + + vuint32_t bdcr; + vuint32_t csr; + vuint32_t pad_78; + vuint32_t pad_7c; + + vuint32_t sscgr; + vuint32_t plli2scfgr; + vuint32_t pad_88; + vuint32_t dckcfgr; + + vuint32_t ckgatenr; + vuint32_t dckcfgr2; +}; + +extern struct stm_rcc stm_rcc; + +#define stm_rcc (*((struct stm_rcc *) 0x40023800)) + +/* Internal HSI is 16MHz */ +#define STM_HSI_FREQ 16000000 + +#define STM_RCC_CR_PLLI2SRDY (27) +#define STM_RCC_CR_PLLI2SON (26) +#define STM_RCC_CR_PLLRDY (25) +#define STM_RCC_CR_PLLON (24) +#define STM_RCC_CR_CSSON (19) +#define STM_RCC_CR_HSEBYP (18) +#define STM_RCC_CR_HSERDY (17) +#define STM_RCC_CR_HSEON (16) +#define STM_RCC_CR_HSICAL (8) +#define STM_RCC_CR_HSITRIM (3) +#define STM_RCC_CR_HSIRDY (1) +#define STM_RCC_CR_HSION (0) + +#define STM_RCC_PLLCFGR_PLLM 0 +#define STM_RCC_PLLCFGR_PLLM_MASK 0x3f +#define STM_RCC_PLLCFGR_PLLN 6 +#define STM_RCC_PLLCFGR_PLLN_MASK 0x1ff +#define STM_RCC_PLLCFGR_PLLP 16 +#define STM_RCC_PLLCFGR_PLLP_MASK 0x3 +#define STM_RCC_PLLCFGR_PLLSRC 22 +#define STM_RCC_PLLCFGR_PLLSRC_HSI 0 +#define STM_RCC_PLLCFGR_PLLSRC_HSE 1 +#define STM_RCC_PLLCFGR_PLLQ 24 +#define STM_RCC_PLLCFGR_PLLQ_MASK 0xf +#define STM_RCC_PLLCFGR_PLLR 28 +#define STM_RCC_PLLCFGR_PLLR_MASK 0x7 + +#define STM_RCC_CFGR_MCO2 (30) +#define STM_RCC_CFGR_MCO2PRE (27) +#define STM_RCC_CFGR_MCO1PRE (24) +#define STM_RCC_CFGR_MCO1 (21) +#define STM_RCC_CFGR_RTCPRE (16) + +#define STM_RCC_CFGR_PPRE2 (13) +#define STM_RCC_CFGR_PPRE2_DIV_1 0 +#define STM_RCC_CFGR_PPRE2_DIV_2 4 +#define STM_RCC_CFGR_PPRE2_DIV_4 5 +#define STM_RCC_CFGR_PPRE2_DIV_8 6 +#define STM_RCC_CFGR_PPRE2_DIV_16 7 +#define STM_RCC_CFGR_PPRE2_MASK 7 + +#define STM_RCC_CFGR_PPRE1 (10) +#define STM_RCC_CFGR_PPRE1_DIV_1 0 +#define STM_RCC_CFGR_PPRE1_DIV_2 4 +#define STM_RCC_CFGR_PPRE1_DIV_4 5 +#define STM_RCC_CFGR_PPRE1_DIV_8 6 +#define STM_RCC_CFGR_PPRE1_DIV_16 7 +#define STM_RCC_CFGR_PPRE1_MASK 7 + +#define STM_RCC_CFGR_HPRE (4) +#define STM_RCC_CFGR_HPRE_DIV_1 0x0 +#define STM_RCC_CFGR_HPRE_DIV_2 0x8 +#define STM_RCC_CFGR_HPRE_DIV_4 0x9 +#define STM_RCC_CFGR_HPRE_DIV_8 0xa +#define STM_RCC_CFGR_HPRE_DIV_16 0xb +#define STM_RCC_CFGR_HPRE_DIV_64 0xc +#define STM_RCC_CFGR_HPRE_DIV_128 0xd +#define STM_RCC_CFGR_HPRE_DIV_256 0xe +#define STM_RCC_CFGR_HPRE_DIV_512 0xf +#define STM_RCC_CFGR_HPRE_MASK 0xf + +#define STM_RCC_CFGR_SWS (2) +#define STM_RCC_CFGR_SWS_HSI 0 +#define STM_RCC_CFGR_SWS_HSE 1 +#define STM_RCC_CFGR_SWS_PLL 2 +#define STM_RCC_CFGR_SWS_MASK 3 + +#define STM_RCC_CFGR_SW (0) +#define STM_RCC_CFGR_SW_HSI 0 +#define STM_RCC_CFGR_SW_HSE 1 +#define STM_RCC_CFGR_SW_PLL 2 +#define STM_RCC_CFGR_SW_MASK 3 + +#define STM_RCC_AHB1ENR_IOPAEN 0 +#define STM_RCC_AHB1ENR_IOPBEN 1 +#define STM_RCC_AHB1ENR_IOPCEN 2 +#define STM_RCC_AHB1ENR_IOPDEN 3 +#define STM_RCC_AHB1ENR_IOPEEN 4 +#define STM_RCC_AHB1ENR_IOPFEN 5 +#define STM_RCC_AHB1ENR_IOPGEN 6 +#define STM_RCC_AHB1ENR_IOPHEN 7 + +#define STM_RCC_APB1ENR_UART8EN 31 +#define STM_RCC_APB1ENR_UART7EN 30 +#define STM_RCC_APB1ENR_DACEN 29 +#define STM_RCC_APB1ENR_PWREN 28 +#define STM_RCC_APB1ENR_CAN3EN 27 +#define STM_RCC_APB1ENR_CAN2EN 26 +#define STM_RCC_APB1ENR_CAN1EN 25 +#define STM_RCC_APB1ENR_I2CFMP1EN 24 +#define STM_RCC_APB1ENR_I2C3EN 23 +#define STM_RCC_APB1ENR_I2C2EN 22 +#define STM_RCC_APB1ENR_I2C1EN 21 +#define STM_RCC_APB1ENR_UART5EN 20 +#define STM_RCC_APB1ENR_UART4EN 19 +#define STM_RCC_APB1ENR_USART3EN 18 +#define STM_RCC_APB1ENR_USART2EN 17 +#define STM_RCC_APB1ENR_SPI3EN 15 +#define STM_RCC_APB1ENR_SPI2EN 14 +#define STM_RCC_APB1ENR_WWDGEN 11 +#define STM_RCC_APB1ENR_RTCAPBEN 10 +#define STM_RCC_APB1ENR_LPTIMER1EN 9 +#define STM_RCC_APB1ENR_TIM14EN 8 +#define STM_RCC_APB1ENR_TIM13EN 7 +#define STM_RCC_APB1ENR_TIM12EN 6 +#define STM_RCC_APB1ENR_TIM7EN 5 +#define STM_RCC_APB1ENR_TIM6EN 4 +#define STM_RCC_APB1ENR_TIM5EN 3 +#define STM_RCC_APB1ENR_TIM4EN 2 +#define STM_RCC_APB1ENR_TIM3EN 1 +#define STM_RCC_APB1ENR_TIM2EN 0 + +#define STM_RCC_CSR_RMVF 24 + +struct stm_ictr { + vuint32_t ictr; +}; + +extern struct stm_ictr stm_ictr; + +#define stm_ictr (*((struct stm_ictr *) 0xe000e004)) + +#define STM_ICTR_ICTR_INTLINESNUM 0 +#define STM_ICTR_ICTR_INTLINESNUM_MASK 0xf + +struct stm_nvic { + vuint32_t iser[8]; /* 0x000 0xe000e100 Set Enable Register */ + + uint8_t _unused020[0x080 - 0x020]; + + vuint32_t icer[8]; /* 0x080 0xe000e180 Clear Enable Register */ + + uint8_t _unused0a0[0x100 - 0x0a0]; + + vuint32_t ispr[8]; /* 0x100 0xe000e200 Set Pending Register */ + + uint8_t _unused120[0x180 - 0x120]; + + vuint32_t icpr[8]; /* 0x180 0xe000e280 Clear Pending Register */ + + uint8_t _unused1a0[0x200 - 0x1a0]; + + vuint32_t iabr[8]; /* 0x200 0xe000e300 Active Bit Register */ + + uint8_t _unused220[0x300 - 0x220]; + + vuint32_t ipr[60]; /* 0x300 0xe000e400 Priority Register */ +}; + +extern struct stm_nvic stm_nvic; + +#define stm_nvic (*((struct stm_nvic *) 0xe000e100)) + +#define IRQ_REG(irq) ((irq) >> 5) +#define IRQ_BIT(irq) ((irq) & 0x1f) +#define IRQ_MASK(irq) (1 << IRQ_BIT(irq)) +#define IRQ_BOOL(v,irq) (((v) >> IRQ_BIT(irq)) & 1) + +static inline void +stm_nvic_set_enable(int irq) { + stm_nvic.iser[IRQ_REG(irq)] = IRQ_MASK(irq); +} + +static inline void +stm_nvic_clear_enable(int irq) { + stm_nvic.icer[IRQ_REG(irq)] = IRQ_MASK(irq); +} + +static inline int +stm_nvic_enabled(int irq) { + return IRQ_BOOL(stm_nvic.iser[IRQ_REG(irq)], irq); +} + +static inline void +stm_nvic_set_pending(int irq) { + stm_nvic.ispr[IRQ_REG(irq)] = IRQ_MASK(irq); +} + +static inline void +stm_nvic_clear_pending(int irq) { + stm_nvic.icpr[IRQ_REG(irq)] = IRQ_MASK(irq); +} + +static inline int +stm_nvic_pending(int irq) { + return IRQ_BOOL(stm_nvic.ispr[IRQ_REG(irq)], irq); +} + +static inline int +stm_nvic_active(int irq) { + return IRQ_BOOL(stm_nvic.iabr[IRQ_REG(irq)], irq); +} + +#define IRQ_PRIO_REG(irq) ((irq) >> 2) +#define IRQ_PRIO_BIT(irq) (((irq) & 3) << 3) +#define IRQ_PRIO_MASK(irq) (0xff << IRQ_PRIO_BIT(irq)) + +static inline void +stm_nvic_set_priority(int irq, uint8_t prio) { + int n = IRQ_PRIO_REG(irq); + uint32_t v; + + v = stm_nvic.ipr[n]; + v &= ~IRQ_PRIO_MASK(irq); + v |= (prio) << IRQ_PRIO_BIT(irq); + stm_nvic.ipr[n] = v; +} + +static inline uint8_t +stm_nvic_get_priority(int irq) { + return (stm_nvic.ipr[IRQ_PRIO_REG(irq)] >> IRQ_PRIO_BIT(irq)) & IRQ_PRIO_MASK(0); +} + +struct stm_flash { + vuint32_t acr; + vuint32_t keyr; + vuint32_t optkeyr; + vuint32_t sr; + + vuint32_t cr; + vuint32_t optcr; + vuint32_t wrpr; +}; + +extern struct stm_flash stm_flash; + +#define stm_flash (*((struct stm_flash *) 0x40023c00)) + +#define STM_FLASH_ACR_DCRST 12 +#define STM_FLASH_ACR_ICRST 11 +#define STM_FLASH_ACR_DCEN 10 +#define STM_FLASH_ACR_ICEN 9 +#define STM_FLASH_ACR_PRFTEN 8 +#define STM_FLASH_ACR_LATENCY 0 + +struct stm_flash_size { + vuint16_t f_size; +}; + +extern struct stm_flash_size stm_flash_size; + +#define stm_flash_size (*((struct stm_flash_size *) 0x1fff7a22)) + +struct stm_gpio { + vuint32_t moder; + vuint32_t otyper; + vuint32_t ospeedr; + vuint32_t pupdr; + + vuint32_t idr; + vuint32_t odr; + vuint32_t bsrr; + vuint32_t lckr; + + vuint32_t afrl; + vuint32_t afrh; +}; + +#define STM_MODER_SHIFT(pin) ((pin) << 1) +#define STM_MODER_MASK 3 +#define STM_MODER_INPUT 0 +#define STM_MODER_OUTPUT 1 +#define STM_MODER_ALTERNATE 2 +#define STM_MODER_ANALOG 3 + +static inline void +stm_moder_set(struct stm_gpio *gpio, int pin, vuint32_t value) { + gpio->moder = ((gpio->moder & + ~(STM_MODER_MASK << STM_MODER_SHIFT(pin))) | + value << STM_MODER_SHIFT(pin)); +} + +static inline uint32_t +stm_moder_get(struct stm_gpio *gpio, int pin) { + return (gpio->moder >> STM_MODER_SHIFT(pin)) & STM_MODER_MASK; +} + +#define STM_OTYPER_SHIFT(pin) (pin) +#define STM_OTYPER_MASK 1 +#define STM_OTYPER_PUSH_PULL 0 +#define STM_OTYPER_OPEN_DRAIN 1 + +static inline void +stm_otyper_set(struct stm_gpio *gpio, int pin, vuint32_t value) { + gpio->otyper = ((gpio->otyper & + ~(STM_OTYPER_MASK << STM_OTYPER_SHIFT(pin))) | + value << STM_OTYPER_SHIFT(pin)); +} + +static inline uint32_t +stm_otyper_get(struct stm_gpio *gpio, int pin) { + return (gpio->otyper >> STM_OTYPER_SHIFT(pin)) & STM_OTYPER_MASK; +} + +#define STM_OSPEEDR_SHIFT(pin) ((pin) << 1) +#define STM_OSPEEDR_MASK 3 +#define STM_OSPEEDR_LOW 0 /* 2-8MHz */ +#define STM_OSPEEDR_MEDIUM 1 /* 12.5-50MHz */ +#define STM_OSPEEDR_FAST 2 /* 25-100MHz */ +#define STM_OSPEEDR_HIGH 3 /* 50-100MHz */ + +static inline void +stm_ospeedr_set(struct stm_gpio *gpio, int pin, vuint32_t value) { + gpio->ospeedr = ((gpio->ospeedr & + ~(STM_OSPEEDR_MASK << STM_OSPEEDR_SHIFT(pin))) | + value << STM_OSPEEDR_SHIFT(pin)); +} + +static inline uint32_t +stm_ospeedr_get(struct stm_gpio *gpio, int pin) { + return (gpio->ospeedr >> STM_OSPEEDR_SHIFT(pin)) & STM_OSPEEDR_MASK; +} + +#define STM_PUPDR_SHIFT(pin) ((pin) << 1) +#define STM_PUPDR_MASK 3 +#define STM_PUPDR_NONE 0 +#define STM_PUPDR_PULL_UP 1 +#define STM_PUPDR_PULL_DOWN 2 +#define STM_PUPDR_RESERVED 3 + +static inline void +stm_pupdr_set(struct stm_gpio *gpio, int pin, uint32_t value) { + gpio->pupdr = ((gpio->pupdr & + ~(STM_PUPDR_MASK << STM_PUPDR_SHIFT(pin))) | + value << STM_PUPDR_SHIFT(pin)); +} + +static inline uint32_t +stm_pupdr_get(struct stm_gpio *gpio, int pin) { + return (gpio->pupdr >> STM_PUPDR_SHIFT(pin)) & STM_PUPDR_MASK; +} + +#define STM_AFR_SHIFT(pin) ((pin) << 2) +#define STM_AFR_MASK 0xf +#define STM_AFR_NONE 0 +#define STM_AFR_AF0 0x0 +#define STM_AFR_AF1 0x1 +#define STM_AFR_AF2 0x2 +#define STM_AFR_AF3 0x3 +#define STM_AFR_AF4 0x4 +#define STM_AFR_AF5 0x5 +#define STM_AFR_AF6 0x6 +#define STM_AFR_AF7 0x7 +#define STM_AFR_AF8 0x8 +#define STM_AFR_AF9 0x9 +#define STM_AFR_AF10 0xa +#define STM_AFR_AF11 0xb +#define STM_AFR_AF12 0xc +#define STM_AFR_AF13 0xd +#define STM_AFR_AF14 0xe +#define STM_AFR_AF15 0xf + +static inline void +stm_afr_set(struct stm_gpio *gpio, int pin, uint32_t value) { + /* + * Set alternate pin mode too + */ + stm_moder_set(gpio, pin, STM_MODER_ALTERNATE); + if (pin < 8) + gpio->afrl = ((gpio->afrl & + ~(STM_AFR_MASK << STM_AFR_SHIFT(pin))) | + value << STM_AFR_SHIFT(pin)); + else { + pin -= 8; + gpio->afrh = ((gpio->afrh & + ~(STM_AFR_MASK << STM_AFR_SHIFT(pin))) | + value << STM_AFR_SHIFT(pin)); + } +} + +static inline uint32_t +stm_afr_get(struct stm_gpio *gpio, int pin) { + if (pin < 8) + return (gpio->afrl >> STM_AFR_SHIFT(pin)) & STM_AFR_MASK; + else { + pin -= 8; + return (gpio->afrh >> STM_AFR_SHIFT(pin)) & STM_AFR_MASK; + } +} + +static inline void +stm_gpio_set(struct stm_gpio *gpio, int pin, uint8_t value) { + /* Use the bit set/reset register to do this atomically */ + gpio->bsrr = ((uint32_t) (value ^ 1) << (pin + 16)) | ((uint32_t) value << pin); +} + +static inline uint8_t +stm_gpio_get(struct stm_gpio *gpio, int pin) { + return (gpio->idr >> pin) & 1; +} + +static inline uint16_t +stm_gpio_get_all(struct stm_gpio *gpio) { + return gpio->idr; +} + +/* + * We can't define these in registers.ld or our fancy + * ao_enable_gpio macro will expand into a huge pile of code + * as the compiler won't do correct constant folding and + * dead-code elimination + */ + +extern struct stm_gpio stm_gpioa; +extern struct stm_gpio stm_gpiob; +extern struct stm_gpio stm_gpioc; +extern struct stm_gpio stm_gpiod; +extern struct stm_gpio stm_gpioe; +extern struct stm_gpio stm_gpiof; +extern struct stm_gpio stm_gpiog; +extern struct stm_gpio stm_gpioh; + +#define stm_gpioa (*((struct stm_gpio *) 0x40020000)) +#define stm_gpiob (*((struct stm_gpio *) 0x40020400)) +#define stm_gpioc (*((struct stm_gpio *) 0x40020800)) +#define stm_gpiod (*((struct stm_gpio *) 0x40020c00)) +#define stm_gpioe (*((struct stm_gpio *) 0x40021000)) +#define stm_gpiof (*((struct stm_gpio *) 0x40021400)) +#define stm_gpiog (*((struct stm_gpio *) 0x40021800)) +#define stm_gpioh (*((struct stm_gpio *) 0x40021c00)) + +struct stm_scb { + vuint32_t cpuid; + vuint32_t icsr; + vuint32_t vtor; + vuint32_t aircr; + + vuint32_t scr; + vuint32_t ccr; + vuint32_t shpr1; + vuint32_t shpr2; + + vuint32_t shpr3; + vuint32_t shcsr; + vuint32_t cfsr; + vuint32_t hfsr; + + vuint32_t dfsr; + vuint32_t mmcar; + vuint32_t bcar; + vuint32_t afsr; + + vuint32_t id_pfr0; + vuint32_t id_pfr1; + vuint32_t id_dfr0; + vuint32_t id_afr0; + + vuint32_t id_mmfr0; + vuint32_t id_mmfr1; + vuint32_t id_mmfr2; + vuint32_t id_mmfr3; + + vuint32_t id_isar0; + vuint32_t id_isar1; + vuint32_t id_isar2; + vuint32_t id_isar3; + + vuint32_t id_isar4; + vuint32_t pad_d74; + vuint32_t pad_d78; + vuint32_t pad_d7c; + + vuint32_t pad_d80; + vuint32_t pad_d84; + vuint32_t cpacr; + vuint32_t pad_d8c; + + vuint8_t pad_d90[0xf00 - 0xd90]; + + vuint32_t stir; +}; + +extern struct stm_scb stm_scb; + +#define stm_scb (*((struct stm_scb *) 0xe000ed00)) + +#define STM_SCB_CPACR_CP(n) ((n) <<1) +#define STM_SCB_CPACR_DENIED 0 +#define STM_SCB_CPACR_PRIVILEGED 1 +#define STM_SCB_CPACR_RESERVED 2 +#define STM_SCB_CPACR_FULL 3 +#define STM_SCB_CPACR_FP0 STM_SCB_CPACR_CP(10) +#define STM_SCB_CPACR_FP1 STM_SCB_CPACR_CP(11) + +/* The SYSTICK starts at 0xe000e010 */ + +struct stm_systick { + vuint32_t csr; + vuint32_t rvr; + vuint32_t cvr; + vuint32_t calib; +}; + +extern struct stm_systick stm_systick; + +#define stm_systick (*((struct stm_systick *) 0xe000e010)) + +#define STM_SYSTICK_CSR_ENABLE 0 +#define STM_SYSTICK_CSR_TICKINT 1 +#define STM_SYSTICK_CSR_CLKSOURCE 2 +#define STM_SYSTICK_CSR_CLKSOURCE_AHB_8 0 +#define STM_SYSTICK_CSR_CLKSOURCE_AHB 1 +#define STM_SYSTICK_CSR_COUNTFLAG 16 + +/* Errata 2.1.5 + + Delay after an RCC peripheral clock enabling + + Description + + A delay between an RCC peripheral clock enable and the effective + peripheral enabling should be taken into account in order to manage + the peripheral read/write to registers. + + This delay depends on the peripheral’s mapping: + + • If the peripheral is mapped on AHB: the delay should be equal to + 2 AHB cycles. + + • If the peripheral is mapped on APB: the delay should be equal to + 1 + (AHB/APB prescaler) cycles. + + Workarounds + + 1. Use the DSB instruction to stall the Cortex-M4 CPU pipeline + until the instruction is completed. + + 2. Insert “n” NOPs between the RCC enable bit write and the + peripheral register writes +*/ + +static inline void +stm32f4_set_rcc(uint32_t *rcc, uint32_t value) +{ + *rcc = value; + asm("dsb"); +} + +/* Errata 2.1.8 + + In some specific cases, DMA2 data corruption occurs when managing + AHB and APB2 peripherals in a concurrent way + + Description + + When the DMA2 is managing concurrent requests of AHB and APB2 + peripherals, the transfer on the AHB could be performed several + times. + + Impacted peripheral are: + + • Quad-SPI: indirect mode read and write transfers + + • FSMC: read and write operation with external device having FIFO + + • GPIO: DMA2 transfers to GPIO registers (in memory-to-peripheral + transfer mode).The transfers from GPIOs register are not + impacted. + + + The data corruption is due to multiple DMA2 accesses over AHB + peripheral port impacting peripherals embedding a FIFO. + + For transfer to the internal SRAM through the DMA2 AHB peripheral + port the accesses could be performed several times but without data + corruptions in cases of concurrent requests. + + Workaround + + • The DMA2 AHB memory port must be used when reading/writing + from/to Quad-SPI and FSMC instead of DMA2 AHB default peripheral + port. + + • The DMA2 AHB memory port must be used when writing to GPIOs + instead of DMA2 AHB default peripheral port. + + Refer to application note AN4031 section “Take benefits of DMA2 + controller and system architecture flexibility” for more details + about DMA controller feature. + +*/ + + + +#endif /* _STM32F4_H_ */ -- cgit v1.2.3 From 621d1529d6bc07a3f4bd27fb2d02d5b3161a3a6a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 00:08:17 -0700 Subject: altos/stm32f4: Add STM32F413 disco board support Discovery development board Signed-off-by: Keith Packard --- src/stm32f4-disco/Makefile | 30 ++++++++++++++++++++++++++++++ src/stm32f4-disco/ao_disco.c | 37 +++++++++++++++++++++++++++++++++++++ src/stm32f4-disco/ao_pins.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 src/stm32f4-disco/Makefile create mode 100644 src/stm32f4-disco/ao_disco.c create mode 100644 src/stm32f4-disco/ao_pins.h diff --git a/src/stm32f4-disco/Makefile b/src/stm32f4-disco/Makefile new file mode 100644 index 00000000..2d912b22 --- /dev/null +++ b/src/stm32f4-disco/Makefile @@ -0,0 +1,30 @@ +include ../stm32f4/Makefile-raw.defs + +ALTOS_SRC = \ + ao_interrupt.c \ + ao_panic.c \ + ao_timer.c + +CFLAGS = $(STM32F4_CFLAGS) + +PROG=stm32f4-disco-$(VERSION) +ELF=$(PROG).elf +IHX=$(PROG).ihx + +SRC=$(ALTOS_SRC) ao_disco.c +OBJ=$(SRC:.c=.o) +MAP=$(PROG).map + +all: $(ELF) $(IHX) + +$(ELF): Makefile $(OBJ) + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJ) -Wl,-M=$(MAP) $(LIBS) + +distclean: clean + +clean: + rm -f *.o *.elf *.ihx + +install: + +uninstall: diff --git a/src/stm32f4-disco/ao_disco.c b/src/stm32f4-disco/ao_disco.c new file mode 100644 index 00000000..efbed947 --- /dev/null +++ b/src/stm32f4-disco/ao_disco.c @@ -0,0 +1,37 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#include + +void main(void) +{ + float x; + int r = 1; + int g = 0; + + ao_clock_init(); + + ao_timer_init(); + + ao_enable_output(LED_GREEN_PORT, LED_GREEN_PIN, 0); + ao_enable_output(LED_RED_PORT, LED_RED_PIN, 1); + for (;;) { + ao_gpio_set(LED_GREEN_PORT, LED_GREEN_PIN, g); + ao_gpio_set(LED_RED_PORT, LED_RED_PIN, r); + g ^= 1; + r ^= 1; + for (x = 0.0f; x < 100000.0f; x = x + 0.1f) + ao_arch_nop(); + } +} diff --git a/src/stm32f4-disco/ao_pins.h b/src/stm32f4-disco/ao_pins.h new file mode 100644 index 00000000..3bbace1a --- /dev/null +++ b/src/stm32f4-disco/ao_pins.h @@ -0,0 +1,44 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ +#ifndef _AO_PINS_H_ +#define _AO_PINS_H_ + +#define HAS_BEEP 0 + +#define B_USER_PORT (&stm_gpioa) +#define B_USER_PIN 0 + +#define LED_GREEN_PORT (&stm_gpioc) +#define LED_GREEN_PIN 5 +#define LED_RED_PORT (&stm_gpioe) +#define LED_RED_PIN 3 + +#define AO_HSE 8000000 /* fed from st/link processor */ +#define AO_HSE_BYPASS 1 /* no xtal, directly fed */ + +#define AO_PLL_M 8 /* down to 1MHz */ + +#define AO_PLL1_N 192 /* up to 192MHz */ +#define AO_PLL1_P 2 /* down to 96MHz */ +#define AO_PLL1_Q 4 /* down to 48MHz for USB and SDIO */ + +#define AO_AHB_PRESCALER 1 +#define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1 + +#define AO_APB1_PRESCALER 1 +#define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE1_DIV_1 +#define AO_APB2_PRESCALER 1 +#define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_1 + +#endif /* _AO_PINS_H_ */ -- cgit v1.2.3 From f7ca88282466c271bad5e25e804729580fe83c47 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 01:28:03 -0700 Subject: altos/stm32f4: Fix clock configuration Was running the PLL input too slow (it wants 2MHz). Was configuring the PLL_P factor wrong (needs magic values, not P value) Set up clock debugging for PA8 and PC9 output. Enable on disco board for debugging. Signed-off-by: Keith Packard --- src/stm32f4-disco/ao_pins.h | 6 ++-- src/stm32f4/ao_timer.c | 72 +++++++++++++++++++++++---------------------- src/stm32f4/stm32f4.h | 4 +++ 3 files changed, 45 insertions(+), 37 deletions(-) diff --git a/src/stm32f4-disco/ao_pins.h b/src/stm32f4-disco/ao_pins.h index 3bbace1a..c4dc5b4b 100644 --- a/src/stm32f4-disco/ao_pins.h +++ b/src/stm32f4-disco/ao_pins.h @@ -27,9 +27,9 @@ #define AO_HSE 8000000 /* fed from st/link processor */ #define AO_HSE_BYPASS 1 /* no xtal, directly fed */ -#define AO_PLL_M 8 /* down to 1MHz */ +#define AO_PLL_M 4 /* down to 2MHz */ -#define AO_PLL1_N 192 /* up to 192MHz */ +#define AO_PLL1_N 96 /* up to 192MHz */ #define AO_PLL1_P 2 /* down to 96MHz */ #define AO_PLL1_Q 4 /* down to 48MHz for USB and SDIO */ @@ -41,4 +41,6 @@ #define AO_APB2_PRESCALER 1 #define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_1 +#define DEBUG_THE_CLOCK 1 + #endif /* _AO_PINS_H_ */ diff --git a/src/stm32f4/ao_timer.c b/src/stm32f4/ao_timer.c index e96559f4..e378ed07 100644 --- a/src/stm32f4/ao_timer.c +++ b/src/stm32f4/ao_timer.c @@ -136,22 +136,6 @@ ao_clock_init(void) while (!(stm_rcc.cr & (1 << STM_RCC_CR_HSERDY))) asm("nop"); -#define STM_RCC_CFGR_SWS_TARGET_CLOCK (STM_RCC_CFGR_SWS_HSE << STM_RCC_CFGR_SWS) -#define STM_RCC_CFGR_SW_TARGET_CLOCK (STM_RCC_CFGR_SW_HSE) -#define STM_PLLSRC AO_HSE -#define STM_RCC_CFGR_PLLSRC_TARGET_CLOCK (1 << STM_RCC_CFGR_PLLSRC) -#else -#define STM_RCC_CFGR_SWS_TARGET_CLOCK (STM_RCC_CFGR_SWS_HSI << STM_RCC_CFGR_SWS) -#define STM_RCC_CFGR_SW_TARGET_CLOCK (STM_RCC_CFGR_SW_HSI) -#define STM_PLLSRC STM_HSI -#define STM_RCC_CFGR_PLLSRC_TARGET_CLOCK (0 << STM_RCC_CFGR_PLLSRC) -#endif - -#if !AO_HSE || HAS_ADC || HAS_ADC_SINGLE - /* Enable HSI RC clock 16MHz */ - stm_rcc.cr |= (1 << STM_RCC_CR_HSION); - while (!(stm_rcc.cr & (1 << STM_RCC_CR_HSIRDY))) - asm("nop"); #endif /* Set flash latency to tolerate SYSCLK */ @@ -213,18 +197,33 @@ ao_clock_init(void) pllcfgr |= (AO_PLL_M << STM_RCC_PLLCFGR_PLLM); pllcfgr |= (AO_PLL1_N << STM_RCC_PLLCFGR_PLLN); #if AO_PLL1_P - pllcfgr |= (AO_PLL1_P << STM_RCC_PLLCFGR_PLLP); +#if AO_PLL1_P == 2 +#define AO_RCC_PLLCFGR_PLLP STM_RCC_PLLCFGR_PLLP_DIV_2 +#endif +#if AO_PLL1_P == 4 +#define AO_RCC_PLLCFGR_PLLP STM_RCC_PLLCFGR_PLLP_DIV_4 +#endif +#if AO_PLL1_P == 6 +#define AO_RCC_PLLCFGR_PLLP STM_RCC_PLLCFGR_PLLP_DIV_6 +#endif +#if AO_PLL1_P == 8 +#define AO_RCC_PLLCFGR_PLLP STM_RCC_PLLCFGR_PLLP_DIV_8 +#endif + pllcfgr |= (AO_RCC_PLLCFGR_PLLP << STM_RCC_PLLCFGR_PLLP); #endif #if AO_PLL1_Q pllcfgr |= (AO_PLL1_Q << STM_RCC_PLLCFGR_PLLQ); +#endif +#if AO_PLL1_R + pllcfgr |= (AO_PLL1_R << STM_RCC_PLLCFGR_PLLR); #endif /* PLL source */ pllcfgr &= ~(1 << STM_RCC_PLLCFGR_PLLSRC); #if AO_HSI - pllcfgr |= STM_RCC_PLLCFGR_PLLSRC_HSI; + pllcfgr |= (STM_RCC_PLLCFGR_PLLSRC_HSI << STM_RCC_PLLCFGR_PLLSRC); #endif #if AO_HSE - pllcfgr |= STM_RCC_PLLCFGR_PLLSRC_HSE; + pllcfgr |= (STM_RCC_PLLCFGR_PLLSRC_HSE << STM_RCC_PLLCFGR_PLLSRC); #endif stm_rcc.pllcfgr = pllcfgr; @@ -250,31 +249,34 @@ ao_clock_init(void) break; } -#if 0 - stm_rcc.apb2rstr = 0xffff; - stm_rcc.apb1rstr = 0xffff; - stm_rcc.ahbrstr = 0x3f; - stm_rcc.ahbenr = (1 << STM_RCC_AHBENR_FLITFEN); - stm_rcc.apb2enr = 0; - stm_rcc.apb1enr = 0; - stm_rcc.ahbrstr = 0; - stm_rcc.apb1rstr = 0; - stm_rcc.apb2rstr = 0; +#if AO_HSE + /* Disable HSI clock */ + stm_rcc.cr &= ~(1 << STM_RCC_CR_HSION); #endif /* Clear reset flags */ stm_rcc.csr |= (1 << STM_RCC_CSR_RMVF); #if DEBUG_THE_CLOCK - /* Output SYSCLK on PA8 for measurments */ + /* Output PLL clock on PA8 and SYCLK on PC9 for measurments */ + + stm_rcc.ahb1enr |= ((1 << STM_RCC_AHB1ENR_IOPAEN) | + (1 << STM_RCC_AHB1ENR_IOPCEN)); - stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIOAEN); - stm_afr_set(&stm_gpioa, 8, STM_AFR_AF0); stm_moder_set(&stm_gpioa, 8, STM_MODER_ALTERNATE); - stm_ospeedr_set(&stm_gpioa, 8, STM_OSPEEDR_40MHz); + stm_ospeedr_set(&stm_gpioa, 8, STM_OSPEEDR_HIGH); + + stm_afr_set(&stm_gpioc, 9, STM_AFR_AF0); + stm_moder_set(&stm_gpioc, 9, STM_MODER_ALTERNATE); + stm_ospeedr_set(&stm_gpioc, 9, STM_OSPEEDR_HIGH); - stm_rcc.cfgr |= (STM_RCC_CFGR_MCOPRE_DIV_1 << STM_RCC_CFGR_MCOPRE); - stm_rcc.cfgr |= (STM_RCC_CFGR_MCOSEL_HSE << STM_RCC_CFGR_MCOSEL); + cfgr = stm_rcc.cfgr; + cfgr &= 0x001fffff; + cfgr |= ((0 << STM_RCC_CFGR_MCO2) | + (6 << STM_RCC_CFGR_MCO2PRE) | + (6 << STM_RCC_CFGR_MCO1PRE) | + (2 << STM_RCC_CFGR_MCO1)); + stm_rcc.cfgr = cfgr; #endif } diff --git a/src/stm32f4/stm32f4.h b/src/stm32f4/stm32f4.h index a351f086..3429e458 100644 --- a/src/stm32f4/stm32f4.h +++ b/src/stm32f4/stm32f4.h @@ -125,6 +125,10 @@ extern struct stm_rcc stm_rcc; #define STM_RCC_PLLCFGR_PLLN 6 #define STM_RCC_PLLCFGR_PLLN_MASK 0x1ff #define STM_RCC_PLLCFGR_PLLP 16 +#define STM_RCC_PLLCFGR_PLLP_DIV_2 0 +#define STM_RCC_PLLCFGR_PLLP_DIV_4 1 +#define STM_RCC_PLLCFGR_PLLP_DIV_6 2 +#define STM_RCC_PLLCFGR_PLLP_DIV_8 3 #define STM_RCC_PLLCFGR_PLLP_MASK 0x3 #define STM_RCC_PLLCFGR_PLLSRC 22 #define STM_RCC_PLLCFGR_PLLSRC_HSI 0 -- cgit v1.2.3 From cdaa0d7b272505c49017f409b7c0b8e3240608f0 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 10:40:24 -0700 Subject: altos: Eliminate 'pin' field from GPIO functions This was used with the 8051 bit-addressing mode to provide single-instruction access to GPIO pins. Signed-off-by: Keith Packard --- src/attiny/ao_arch_funcs.h | 12 ++++++------ src/avr/ao_arch_funcs.h | 10 +++++----- src/drivers/ao_btm.c | 4 ++-- src/drivers/ao_button.c | 5 ++--- src/drivers/ao_cc1120.c | 2 +- src/drivers/ao_cc1200.c | 2 +- src/drivers/ao_companion.c | 4 +--- src/drivers/ao_mma655x.c | 6 ++---- src/drivers/ao_ms5607.c | 6 +++--- src/drivers/ao_pad.c | 24 ++++++++++++------------ src/drivers/ao_ps2.c | 8 ++++---- src/drivers/ao_rn4678.c | 28 ++++++++++++++-------------- src/drivers/ao_sdcard.c | 4 ++-- src/drivers/ao_trng_send.c | 8 ++++---- src/drivers/ao_watchdog.c | 6 +++--- src/easymega-v1.0/ao_pins.h | 3 --- src/easymini-v1.0/ao_pins.h | 2 -- src/easymini-v2.0/ao_pins.h | 2 -- src/kernel/ao_ignite.c | 10 ++++------ src/kernel/ao_pyro.c | 32 ++++++++++++++++---------------- src/kernel/ao_tracker.c | 2 +- src/lpc/ao_arch_funcs.h | 18 +++++++++--------- src/lpc/ao_boot_pin.c | 2 +- src/lpc/ao_usb_lpc.c | 6 +++--- src/stm/ao_arch_funcs.h | 18 +++++++++--------- src/stm/ao_led.c | 8 ++++---- src/stm/ao_serial_stm.c | 8 ++++---- src/stmf0/ao_arch_funcs.h | 14 +++++++------- src/stmf0/ao_beep_stm.c | 2 +- src/teleballoon-v2.0/ao_pins.h | 3 --- src/telemega-v0.1/ao_pins.h | 3 --- src/telemega-v1.0/ao_pins.h | 3 --- src/telemega-v2.0/ao_pins.h | 3 --- src/telemega-v3.0/ao_pins.h | 3 --- src/telemetrum-v2.0/ao_pins.h | 3 --- src/telemetrum-v3.0/ao_pins.h | 3 --- src/telemini-v3.0/ao_pins.h | 2 -- src/telemini-v3.0/ao_telemini.c | 2 +- 38 files changed, 122 insertions(+), 159 deletions(-) diff --git a/src/attiny/ao_arch_funcs.h b/src/attiny/ao_arch_funcs.h index 35901154..69b259d9 100644 --- a/src/attiny/ao_arch_funcs.h +++ b/src/attiny/ao_arch_funcs.h @@ -28,21 +28,21 @@ (reg) |= (mask); \ } while (0) -#define ao_spi_get_bit(reg,bit,pin,bus,speed) ao_spi_get_mask(reg,(1<<(bit)),bus,speed) +#define ao_spi_get_bit(reg,bit,bus,speed) ao_spi_get_mask(reg,(1<<(bit)),bus,speed) -#define ao_spi_put_bit(reg,bit,pin,bus) ao_spi_put_mask(reg,(1<<(bit)),bus) +#define ao_spi_put_bit(reg,bit,bus) ao_spi_put_mask(reg,(1<<(bit)),bus) #define ao_gpio_token_paster(x,y) x ## y #define ao_gpio_token_evaluator(x,y) ao_gpio_token_paster(x,y) -#define ao_gpio_set(port, bit, pin, v) do { \ +#define ao_gpio_set(port, bit, v) do { \ if (v) \ PORTB |= (1 << bit); \ else \ PORTB &= ~(1 << bit); \ } while (0) -#define ao_gpio_get(port, bit, pin) ((PORTB >> (bit)) & 1) +#define ao_gpio_get(port, bit) ((PORTB >> (bit)) & 1) /* * The SPI mutex must be held to call either of these @@ -50,8 +50,8 @@ * from chip select low to chip select high */ -#define ao_enable_output(port, bit, pin, v) do { \ - ao_gpio_set(port, bit, pin, v); \ +#define ao_enable_output(port, bit, v) do { \ + ao_gpio_set(port, bit, v); \ ao_gpio_token_evaluator(DDR,port) |= (1 << bit); \ } while (0) diff --git a/src/avr/ao_arch_funcs.h b/src/avr/ao_arch_funcs.h index dc248660..f2a58af0 100644 --- a/src/avr/ao_arch_funcs.h +++ b/src/avr/ao_arch_funcs.h @@ -32,12 +32,12 @@ extern uint8_t ao_spi_mutex; ao_mutex_put(&ao_spi_mutex); \ } while (0) -#define ao_spi_get_bit(reg,bit,pin,bus,speed) do { \ +#define ao_spi_get_bit(reg,bit,bus,speed) do { \ ao_mutex_get(&ao_spi_mutex); \ (pin) = 0; \ } while (0) -#define ao_spi_put_bit(reg,bit,pin,bus) do { \ +#define ao_spi_put_bit(reg,bit,bus) do { \ (pin) = 1; \ ao_mutex_put(&ao_spi_mutex); \ } while (0) @@ -46,7 +46,7 @@ extern uint8_t ao_spi_mutex; #define ao_gpio_token_paster(x,y) x ## y #define ao_gpio_token_evaluator(x,y) ao_gpio_token_paster(x,y) -#define ao_gpio_set(port, bit, pin, v) do { \ +#define ao_gpio_set(port, bit, v) do { \ if (v) \ (ao_gpio_token_evaluator(PORT,port)) |= (1 << bit); \ else \ @@ -59,8 +59,8 @@ extern uint8_t ao_spi_mutex; * from chip select low to chip select high */ -#define ao_enable_output(port, bit, pin, v) do { \ - ao_gpio_set(port, bit, pin, v); \ +#define ao_enable_output(port, bit, v) do { \ + ao_gpio_set(port, bit, v); \ ao_gpio_token_evaluator(DDR,port) |= (1 << bit); \ } while (0) diff --git a/src/drivers/ao_btm.c b/src/drivers/ao_btm.c index 2930d00e..04bf4138 100644 --- a/src/drivers/ao_btm.c +++ b/src/drivers/ao_btm.c @@ -347,7 +347,7 @@ ao_btm_check_link() ); #else ao_arch_block_interrupts(); - if (ao_gpio_get(AO_BTM_INT_PORT, AO_BTM_INT_PIN, AO_BTM_INT) == 0) { + if (ao_gpio_get(AO_BTM_INT_PORT, AO_BTM_INT_PIN) == 0) { ao_btm_connected = 1; } else { ao_btm_connected = 0; @@ -455,7 +455,7 @@ ao_btm_init (void) ao_serial_btm_set_speed(AO_SERIAL_SPEED_19200); #ifdef AO_BTM_RESET_PORT - ao_enable_output(AO_BTM_RESET_PORT,AO_BTM_RESET_PIN,AO_BTM_RESET,0); + ao_enable_output(AO_BTM_RESET_PORT,AO_BTM_RESET_PIN,0); #endif #ifdef AO_BTM_INT_PORT diff --git a/src/drivers/ao_button.c b/src/drivers/ao_button.c index f6a9676b..c8103e88 100644 --- a/src/drivers/ao_button.c +++ b/src/drivers/ao_button.c @@ -37,7 +37,6 @@ static struct ao_button_state ao_button_state[AO_BUTTON_COUNT]; #define port(q) AO_BUTTON_ ## q ## _PORT #define bit(q) AO_BUTTON_ ## q -#define pin(q) AO_BUTTON_ ## q ## _PIN #ifndef AO_BUTTON_INVERTED #define AO_BUTTON_INVERTED 1 @@ -45,9 +44,9 @@ static struct ao_button_state ao_button_state[AO_BUTTON_COUNT]; #if AO_BUTTON_INVERTED /* pins are inverted */ -#define ao_button_value(b) !ao_gpio_get(port(b), bit(b), pin(b)) +#define ao_button_value(b) !ao_gpio_get(port(b), bit(b)) #else -#define ao_button_value(b) ao_gpio_get(port(b), bit(b), pin(b)) +#define ao_button_value(b) ao_gpio_get(port(b), bit(b)) #endif static uint8_t diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c index aea0a3fe..b1a13778 100644 --- a/src/drivers/ao_cc1120.c +++ b/src/drivers/ao_cc1120.c @@ -208,7 +208,7 @@ ao_radio_fifo_write_fixed(uint8_t data, uint8_t len) static uint8_t ao_radio_int_pin(void) { - return ao_gpio_get(AO_CC1120_INT_PORT, AO_CC1120_INT_PIN, AO_CC1120_INT); + return ao_gpio_get(AO_CC1120_INT_PORT, AO_CC1120_INT_PIN); } #if CC1120_DEBUG diff --git a/src/drivers/ao_cc1200.c b/src/drivers/ao_cc1200.c index 45f5711e..105e0d50 100644 --- a/src/drivers/ao_cc1200.c +++ b/src/drivers/ao_cc1200.c @@ -192,7 +192,7 @@ ao_radio_fifo_write_fixed(uint8_t data, uint8_t len) static uint8_t ao_radio_int_pin(void) { - return ao_gpio_get(AO_CC1200_INT_PORT, AO_CC1200_INT_PIN, AO_CC1200_INT); + return ao_gpio_get(AO_CC1200_INT_PORT, AO_CC1200_INT_PIN); } static uint8_t diff --git a/src/drivers/ao_companion.c b/src/drivers/ao_companion.c index 3967090b..44868fb6 100644 --- a/src/drivers/ao_companion.c +++ b/src/drivers/ao_companion.c @@ -31,7 +31,6 @@ #define COMPANION_SELECT() do { \ ao_spi_get_bit(AO_COMPANION_CS_PORT, \ AO_COMPANION_CS_PIN, \ - AO_COMPANION_CS, \ AO_COMPANION_SPI_BUS, \ AO_SPI_SPEED_200kHz); \ } while (0) @@ -39,7 +38,6 @@ #define COMPANION_DESELECT() do { \ ao_spi_put_bit(AO_COMPANION_CS_PORT, \ AO_COMPANION_CS_PIN, \ - AO_COMPANION_CS, \ AO_COMPANION_SPI_BUS); \ } while (0) @@ -144,7 +142,7 @@ static struct ao_task ao_companion_task; void ao_companion_init(void) { - ao_enable_output(AO_COMPANION_CS_PORT, AO_COMPANION_CS_PIN, AO_COMPANION_CS, 1); + ao_enable_output(AO_COMPANION_CS_PORT, AO_COMPANION_CS_PIN, 1); ao_cmd_register(&ao_companion_cmds[0]); ao_add_task(&ao_companion_task, ao_companion, "companion"); } diff --git a/src/drivers/ao_mma655x.c b/src/drivers/ao_mma655x.c index a48c1db2..e8eeea6e 100644 --- a/src/drivers/ao_mma655x.c +++ b/src/drivers/ao_mma655x.c @@ -34,7 +34,6 @@ static void ao_mma655x_start(void) { ao_spi_get_bit(AO_MMA655X_CS_PORT, AO_MMA655X_CS_PIN, - AO_MMA655X_CS, AO_MMA655X_SPI_INDEX, AO_SPI_SPEED_FAST); } @@ -43,19 +42,18 @@ static void ao_mma655x_stop(void) { ao_spi_put_bit(AO_MMA655X_CS_PORT, AO_MMA655X_CS_PIN, - AO_MMA655X_CS, AO_MMA655X_SPI_INDEX); } static void ao_mma655x_restart(void) { uint8_t i; - ao_gpio_set(AO_MMA655X_CS_PORT, AO_MMA655X_CS_PIN, AO_MMA655X_CS, 1); + ao_gpio_set(AO_MMA655X_CS_PORT, AO_MMA655X_CS_PIN, 1); /* Emperical testing on STM32L151 at 32MHz for this delay amount */ for (i = 0; i < 10; i++) ao_arch_nop(); - ao_gpio_set(AO_MMA655X_CS_PORT, AO_MMA655X_CS_PIN, AO_MMA655X_CS, 0); + ao_gpio_set(AO_MMA655X_CS_PORT, AO_MMA655X_CS_PIN, 0); } static uint8_t diff --git a/src/drivers/ao_ms5607.c b/src/drivers/ao_ms5607.c index a468fee3..a00d54c8 100644 --- a/src/drivers/ao_ms5607.c +++ b/src/drivers/ao_ms5607.c @@ -31,12 +31,12 @@ static uint8_t ms5607_configured; static void ao_ms5607_start(void) { - ao_spi_get_bit(AO_MS5607_CS_PORT, AO_MS5607_CS_PIN, AO_MS5607_CS, AO_MS5607_SPI_INDEX, AO_MS5607_SPI_SPEED); + ao_spi_get_bit(AO_MS5607_CS_PORT, AO_MS5607_CS_PIN, AO_MS5607_SPI_INDEX, AO_MS5607_SPI_SPEED); } static void ao_ms5607_stop(void) { - ao_spi_put_bit(AO_MS5607_CS_PORT, AO_MS5607_CS_PIN, AO_MS5607_CS, AO_MS5607_SPI_INDEX); + ao_spi_put_bit(AO_MS5607_CS_PORT, AO_MS5607_CS_PIN, AO_MS5607_SPI_INDEX); } static void @@ -164,7 +164,7 @@ ao_ms5607_get_sample(uint8_t cmd) { ao_spi_put(AO_MS5607_SPI_INDEX); #endif ao_arch_block_interrupts(); - while (!ao_gpio_get(AO_MS5607_MISO_PORT, AO_MS5607_MISO_PIN, AO_MS5607_MISO) && + while (!ao_gpio_get(AO_MS5607_MISO_PORT, AO_MS5607_MISO_PIN) && !ao_ms5607_done) ao_sleep((void *) &ao_ms5607_done); ao_arch_release_interrupts(); diff --git a/src/drivers/ao_pad.c b/src/drivers/ao_pad.c index c08798ac..85691f5c 100644 --- a/src/drivers/ao_pad.c +++ b/src/drivers/ao_pad.c @@ -50,7 +50,7 @@ static void ao_siren(uint8_t v) { #ifdef AO_SIREN - ao_gpio_set(AO_SIREN_PORT, AO_SIREN_PIN, AO_SIREN, v); + ao_gpio_set(AO_SIREN_PORT, AO_SIREN_PIN, v); #else #if HAS_BEEP ao_beep(v ? AO_BEEP_MID : 0); @@ -64,7 +64,7 @@ static void ao_strobe(uint8_t v) { #ifdef AO_STROBE - ao_gpio_set(AO_STROBE_PORT, AO_STROBE_PIN, AO_STROBE, v); + ao_gpio_set(AO_STROBE_PORT, AO_STROBE_PIN, v); #else (void) v; #endif @@ -589,34 +589,34 @@ ao_pad_init(void) } #endif #if AO_PAD_NUM > 0 - ao_enable_output(AO_PAD_0_PORT, AO_PAD_PIN_0, AO_PAD_0, 0); + ao_enable_output(AO_PAD_0_PORT, AO_PAD_PIN_0, 0); #endif #if AO_PAD_NUM > 1 - ao_enable_output(AO_PAD_1_PORT, AO_PAD_PIN_1, AO_PAD_1, 0); + ao_enable_output(AO_PAD_1_PORT, AO_PAD_PIN_1, 0); #endif #if AO_PAD_NUM > 2 - ao_enable_output(AO_PAD_2_PORT, AO_PAD_PIN_2, AO_PAD_2, 0); + ao_enable_output(AO_PAD_2_PORT, AO_PAD_PIN_2, 0); #endif #if AO_PAD_NUM > 3 - ao_enable_output(AO_PAD_3_PORT, AO_PAD_PIN_3, AO_PAD_3, 0); + ao_enable_output(AO_PAD_3_PORT, AO_PAD_PIN_3, 0); #endif #if AO_PAD_NUM > 4 - ao_enable_output(AO_PAD_4_PORT, AO_PAD_PIN_4, AO_PAD_4, 0); + ao_enable_output(AO_PAD_4_PORT, AO_PAD_PIN_4, 0); #endif #if AO_PAD_NUM > 5 - ao_enable_output(AO_PAD_5_PORT, AO_PAD_PIN_5, AO_PAD_5, 0); + ao_enable_output(AO_PAD_5_PORT, AO_PAD_PIN_5, 0); #endif #if AO_PAD_NUM > 5 - ao_enable_output(AO_PAD_6_PORT, AO_PAD_PIN_6, AO_PAD_6, 0); + ao_enable_output(AO_PAD_6_PORT, AO_PAD_PIN_6, 0); #endif #if AO_PAD_NUM > 7 - ao_enable_output(AO_PAD_7_PORT, AO_PAD_PIN_7, AO_PAD_7, 0); + ao_enable_output(AO_PAD_7_PORT, AO_PAD_PIN_7, 0); #endif #ifdef AO_STROBE - ao_enable_output(AO_STROBE_PORT, AO_STROBE_PIN, AO_STROBE, 0); + ao_enable_output(AO_STROBE_PORT, AO_STROBE_PIN, 0); #endif #ifdef AO_SIREN - ao_enable_output(AO_SIREN_PORT, AO_SIREN_PIN, AO_SIREN, 0); + ao_enable_output(AO_SIREN_PORT, AO_SIREN_PIN, 0); #endif ao_cmd_register(&ao_pad_cmds[0]); ao_add_task(&ao_pad_task, ao_pad, "pad listener"); diff --git a/src/drivers/ao_ps2.c b/src/drivers/ao_ps2.c index 29eecea8..c7520b3a 100644 --- a/src/drivers/ao_ps2.c +++ b/src/drivers/ao_ps2.c @@ -91,11 +91,11 @@ ao_ps2_put(uint8_t c) ao_arch_release_interrupts(); /* pull the clock pin down */ - ao_enable_output(AO_PS2_CLOCK_PORT, AO_PS2_CLOCK_BIT, AO_PS2_CLOCK_PIN, 0); + ao_enable_output(AO_PS2_CLOCK_PORT, AO_PS2_CLOCK_BIT, 0); ao_delay(0); /* pull the data pin down for the start bit */ - ao_enable_output(AO_PS2_DATA_PORT, AO_PS2_DATA_BIT, AO_PS2_DATA_PIN, 0); + ao_enable_output(AO_PS2_DATA_PORT, AO_PS2_DATA_BIT, 0); ao_delay(0); /* switch back to input mode for the interrupt to work */ @@ -369,7 +369,7 @@ ao_ps2_isr(void) uint8_t bit; if (ao_ps2_tx_count) { - ao_gpio_set(AO_PS2_DATA_PORT, AO_PS2_DATA_BIT, AO_PS2_DATA_PIN, ao_ps2_tx&1); + ao_gpio_set(AO_PS2_DATA_PORT, AO_PS2_DATA_BIT, ao_ps2_tx&1); ao_ps2_tx >>= 1; ao_ps2_tx_count--; if (!ao_ps2_tx_count) { @@ -383,7 +383,7 @@ ao_ps2_isr(void) ao_ps2_count = 0; ao_ps2_tick = ao_tick_count; - bit = ao_gpio_get(AO_PS2_DATA_PORT, AO_PS2_DATA_BIT, AO_PS2_DATA_PIN); + bit = ao_gpio_get(AO_PS2_DATA_PORT, AO_PS2_DATA_BIT); if (ao_ps2_count == 0) { /* check for start bit, ignore if not zero */ if (bit) diff --git a/src/drivers/ao_rn4678.c b/src/drivers/ao_rn4678.c index 98dc35b5..4ace4b78 100644 --- a/src/drivers/ao_rn4678.c +++ b/src/drivers/ao_rn4678.c @@ -335,7 +335,7 @@ ao_rn_get_name(char *name, int len) static void ao_rn_check_link(void) { - ao_rn_connected = 1 - ao_gpio_get(AO_RN_CONNECTED_PORT, AO_RN_CONNECTED_PIN, foo); + ao_rn_connected = 1 - ao_gpio_get(AO_RN_CONNECTED_PORT, AO_RN_CONNECTED_PIN); } static void @@ -384,17 +384,17 @@ ao_rn(void) ao_rn_dbg("ao_rn top\n"); /* Select CMD mode after the device gets out of reset */ - ao_gpio_set(AO_RN_CMD_PORT, AO_RN_CMD_PIN, foo, AO_RN_CMD_CMD); + ao_gpio_set(AO_RN_CMD_PORT, AO_RN_CMD_PIN, AO_RN_CMD_CMD); for (i = 0; i < 3; i++) { ao_rn_dbg("reset device\n"); - ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, foo, 0); + ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, 0); ao_delay(AO_MS_TO_TICKS(100)); /* Reboot the RN4678 and wait for it to start talking */ ao_rn_drain(); - ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, foo, 1); + ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, 1); status = ao_rn_wait_for(AO_RN_REBOOT_TIMEOUT, AO_RN_REBOOT_MSG); if (status != AO_RN_OK) { ao_rn_dbg("reboot failed\n"); @@ -468,7 +468,7 @@ ao_rn(void) if (status != AO_RN_OK) ao_bt_panic(4); - ao_gpio_set(AO_RN_CMD_PORT, AO_RN_CMD_PIN, foo, AO_RN_CMD_DATA); + ao_gpio_set(AO_RN_CMD_PORT, AO_RN_CMD_PIN, AO_RN_CMD_DATA); /* Wait for the hardware to finish sending messages, then clear the queue */ ao_delay(AO_MS_TO_TICKS(200)); @@ -530,16 +530,16 @@ ao_rn_factory(void) */ /* Select our target output pin */ - ao_enable_output(AO_RN_P3_1_PORT, AO_RN_P3_1_PIN, foo, v); + ao_enable_output(AO_RN_P3_1_PORT, AO_RN_P3_1_PIN, v); /* Turn off the BT device using the SW_BTN pin */ printf("Power down BT\n"); flush(); - ao_gpio_set(AO_RN_SW_BTN_PORT, AO_RN_SW_BTN_PIN, foo, 0); + ao_gpio_set(AO_RN_SW_BTN_PORT, AO_RN_SW_BTN_PIN, 0); ao_delay(AO_MS_TO_TICKS(1000)); /* And turn it back on */ printf("Power up BT\n"); flush(); - ao_gpio_set(AO_RN_SW_BTN_PORT, AO_RN_SW_BTN_PIN, foo, 1); + ao_gpio_set(AO_RN_SW_BTN_PORT, AO_RN_SW_BTN_PIN, 1); /* Right after power on, poke P3_1 five times to force a * factory reset @@ -547,7 +547,7 @@ ao_rn_factory(void) for (i = 0; i < 20; i++) { v = 1-v; ao_delay(AO_MS_TO_TICKS(50)); - ao_gpio_set(AO_RN_P3_1_PORT, AO_RN_P3_1_PIN, foo, v); + ao_gpio_set(AO_RN_P3_1_PORT, AO_RN_P3_1_PIN, v); ao_led_toggle(AO_BT_LED); } @@ -556,9 +556,9 @@ ao_rn_factory(void) printf("Reboot BT\n"); flush(); ao_delay(AO_MS_TO_TICKS(100)); - ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, foo, 0); + ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, 0); ao_delay(AO_MS_TO_TICKS(100)); - ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, foo, 1); + ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, 1); } #if AO_RN_DEBUG @@ -588,13 +588,13 @@ ao_rn4678_init(void) ao_serial_rn_set_speed(AO_SERIAL_SPEED_115200); /* Reset line */ - ao_enable_output(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, foo, 0); + ao_enable_output(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, 0); /* SW_BTN */ - ao_enable_output(AO_RN_SW_BTN_PORT, AO_RN_SW_BTN_PIN, foo, 1); + ao_enable_output(AO_RN_SW_BTN_PORT, AO_RN_SW_BTN_PIN, 1); /* P3_7 command/data selector */ - ao_enable_output(AO_RN_CMD_PORT, AO_RN_CMD_PIN, foo, AO_RN_CMD_CMD); + ao_enable_output(AO_RN_CMD_PORT, AO_RN_CMD_PIN, AO_RN_CMD_CMD); ao_enable_input(AO_RN_CONNECTED_PORT, AO_RN_CONNECTED_PIN, AO_EXTI_MODE_PULL_NONE); ao_exti_setup(AO_RN_CONNECTED_PORT, AO_RN_CONNECTED_PIN, diff --git a/src/drivers/ao_sdcard.c b/src/drivers/ao_sdcard.c index 45454000..9d36c397 100644 --- a/src/drivers/ao_sdcard.c +++ b/src/drivers/ao_sdcard.c @@ -34,8 +34,8 @@ extern uint8_t ao_radio_mutex; #define ao_sdcard_send_fixed(d,l) ao_spi_send_fixed((d), (l), AO_SDCARD_SPI_BUS) #define ao_sdcard_send(d,l) ao_spi_send((d), (l), AO_SDCARD_SPI_BUS) #define ao_sdcard_recv(d,l) ao_spi_recv((d), (l), AO_SDCARD_SPI_BUS) -#define ao_sdcard_select() ao_gpio_set(AO_SDCARD_SPI_CS_PORT,AO_SDCARD_SPI_CS_PIN,AO_SDCARD_SPI_CS,0) -#define ao_sdcard_deselect() ao_gpio_set(AO_SDCARD_SPI_CS_PORT,AO_SDCARD_SPI_CS_PIN,AO_SDCARD_SPI_CS,1) +#define ao_sdcard_select() ao_gpio_set(AO_SDCARD_SPI_CS_PORT,AO_SDCARD_SPI_CS_PIN,0) +#define ao_sdcard_deselect() ao_gpio_set(AO_SDCARD_SPI_CS_PORT,AO_SDCARD_SPI_CS_PIN,1) /* Include SD card commands */ #ifndef SDCARD_DEBUG diff --git a/src/drivers/ao_trng_send.c b/src/drivers/ao_trng_send.c index e8df4cea..adeed590 100644 --- a/src/drivers/ao_trng_send.c +++ b/src/drivers/ao_trng_send.c @@ -140,7 +140,7 @@ ao_trng_send(void) usb_buf_id = ao_usb_alloc(buffer); #ifdef AO_TRNG_ENABLE_PORT - ao_gpio_set(AO_TRNG_ENABLE_PORT, AO_TRNG_ENABLE_BIT, AO_TRNG_ENABLE_PIN, 1); + ao_gpio_set(AO_TRNG_ENABLE_PORT, AO_TRNG_ENABLE_BIT, 1); #endif trng_power_time = ao_time(); @@ -211,7 +211,7 @@ static void ao_trng_suspend(void *arg) { (void) arg; #ifdef AO_TRNG_ENABLE_PORT - ao_gpio_set(AO_TRNG_ENABLE_PORT, AO_TRNG_ENABLE_BIT, AO_TRNG_ENABLE_PIN, 0); + ao_gpio_set(AO_TRNG_ENABLE_PORT, AO_TRNG_ENABLE_BIT, 0); #endif trng_running = false; } @@ -220,7 +220,7 @@ static void ao_trng_resume(void *arg) { (void) arg; #ifdef AO_TRNG_ENABLE_PORT - ao_gpio_set(AO_TRNG_ENABLE_PORT, AO_TRNG_ENABLE_BIT, AO_TRNG_ENABLE_PIN, 1); + ao_gpio_set(AO_TRNG_ENABLE_PORT, AO_TRNG_ENABLE_BIT, 1); #endif trng_power_time = ao_time(); } @@ -236,7 +236,7 @@ void ao_trng_send_init(void) { #ifdef AO_TRNG_ENABLE_PORT - ao_enable_output(AO_TRNG_ENABLE_PORT, AO_TRNG_ENABLE_BIT, AO_TRNG_ENABLE_PIN, 0); + ao_enable_output(AO_TRNG_ENABLE_PORT, AO_TRNG_ENABLE_BIT, 0); ao_power_register(&ao_trng_power); #endif ao_enable_input(AO_RAW_PORT, AO_RAW_BIT, AO_EXTI_MODE_PULL_UP); diff --git a/src/drivers/ao_watchdog.c b/src/drivers/ao_watchdog.c index 4d774c3a..612496bc 100644 --- a/src/drivers/ao_watchdog.c +++ b/src/drivers/ao_watchdog.c @@ -28,9 +28,9 @@ ao_watchdog(void) ao_sleep(&ao_watchdog_enabled); while (ao_watchdog_enabled) { ao_delay(AO_WATCHDOG_INTERVAL); - ao_gpio_set(AO_WATCHDOG_PORT, AO_WATCHDOG_BIT, AO_WATCHDOG_PIN, 1); + ao_gpio_set(AO_WATCHDOG_PORT, AO_WATCHDOG_BIT, 1); ao_delay(1); - ao_gpio_set(AO_WATCHDOG_PORT, AO_WATCHDOG_BIT, AO_WATCHDOG_PIN, 0); + ao_gpio_set(AO_WATCHDOG_PORT, AO_WATCHDOG_BIT, 0); } } } @@ -56,7 +56,7 @@ static struct ao_task watchdog_task; void ao_watchdog_init(void) { - ao_enable_output(AO_WATCHDOG_PORT, AO_WATCHDOG_BIT, AO_WATCHDOG, 0); + ao_enable_output(AO_WATCHDOG_PORT, AO_WATCHDOG_BIT, 0); ao_cmd_register(&ao_watchdog_cmds[0]); ao_add_task(&watchdog_task, ao_watchdog, "watchdog"); } diff --git a/src/easymega-v1.0/ao_pins.h b/src/easymega-v1.0/ao_pins.h index b8016478..e7382e4b 100644 --- a/src/easymega-v1.0/ao_pins.h +++ b/src/easymega-v1.0/ao_pins.h @@ -165,9 +165,6 @@ /* Number of general purpose pyro channels available */ #define AO_PYRO_NUM 4 -#define AO_IGNITER_SET_DROGUE(v) stm_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, v) -#define AO_IGNITER_SET_MAIN(v) stm_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, v) - /* * ADC */ diff --git a/src/easymini-v1.0/ao_pins.h b/src/easymini-v1.0/ao_pins.h index 45c6891d..201b913e 100644 --- a/src/easymini-v1.0/ao_pins.h +++ b/src/easymini-v1.0/ao_pins.h @@ -123,11 +123,9 @@ struct ao_adc { #define AO_IGNITER_DROGUE_PORT 0 #define AO_IGNITER_DROGUE_PIN 2 -#define AO_IGNITER_SET_DROGUE(v) ao_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, AO_IGNITER_DROGUE, v) #define AO_IGNITER_MAIN_PORT 0 #define AO_IGNITER_MAIN_PIN 3 -#define AO_IGNITER_SET_MAIN(v) ao_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, AO_IGNITER_MAIN, v) #define AO_SENSE_DROGUE(p) ((p)->adc.sense_a) #define AO_SENSE_MAIN(p) ((p)->adc.sense_m) diff --git a/src/easymini-v2.0/ao_pins.h b/src/easymini-v2.0/ao_pins.h index 47eb577e..38d46310 100644 --- a/src/easymini-v2.0/ao_pins.h +++ b/src/easymini-v2.0/ao_pins.h @@ -132,11 +132,9 @@ struct ao_adc { #define AO_IGNITER_DROGUE_PORT (&stm_gpioa) #define AO_IGNITER_DROGUE_PIN 3 -#define AO_IGNITER_SET_DROGUE(v) ao_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, AO_IGNITER_DROGUE, v) #define AO_IGNITER_MAIN_PORT (&stm_gpiob) #define AO_IGNITER_MAIN_PIN 7 -#define AO_IGNITER_SET_MAIN(v) ao_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, AO_IGNITER_MAIN, v) #define AO_SENSE_DROGUE(p) ((p)->adc.sense_a) #define AO_SENSE_MAIN(p) ((p)->adc.sense_m) diff --git a/src/kernel/ao_ignite.c b/src/kernel/ao_ignite.c index 5f41c552..a6ff9979 100644 --- a/src/kernel/ao_ignite.c +++ b/src/kernel/ao_ignite.c @@ -72,10 +72,8 @@ ao_igniter_status(enum ao_igniter igniter) return ao_igniter_unknown; } -#ifndef AO_IGNITER_SET_DROGUE -#define AO_IGNITER_SET_DROGUE(v) AO_IGNITER_DROGUE = (v) -#define AO_IGNITER_SET_MAIN(v) AO_IGNITER_MAIN = (v) -#endif +#define AO_IGNITER_SET_DROGUE(v) ao_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, v) +#define AO_IGNITER_SET_MAIN(v) ao_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, v) #ifndef AO_IGNITER_FIRE_TIME #define AO_IGNITER_FIRE_TIME AO_MS_TO_TICKS(50) @@ -226,8 +224,8 @@ struct ao_task ao_igniter_task; void ao_ignite_set_pins(void) { - ao_enable_output(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, AO_IGNITER_DROGUE, 0); - ao_enable_output(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, AO_IGNITER_MAIN, 0); + ao_enable_output(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, 0); + ao_enable_output(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, 0); } #endif diff --git a/src/kernel/ao_pyro.c b/src/kernel/ao_pyro.c index c01c9512..30d1518f 100644 --- a/src/kernel/ao_pyro.c +++ b/src/kernel/ao_pyro.c @@ -216,28 +216,28 @@ ao_pyro_pin_set(uint8_t p, uint8_t v) { switch (p) { #if AO_PYRO_NUM > 0 - case 0: ao_gpio_set(AO_PYRO_PORT_0, AO_PYRO_PIN_0, AO_PYRO_0, v); break; + case 0: ao_gpio_set(AO_PYRO_PORT_0, AO_PYRO_PIN_0, v); break; #endif #if AO_PYRO_NUM > 1 - case 1: ao_gpio_set(AO_PYRO_PORT_1, AO_PYRO_PIN_1, AO_PYRO_1, v); break; + case 1: ao_gpio_set(AO_PYRO_PORT_1, AO_PYRO_PIN_1, v); break; #endif #if AO_PYRO_NUM > 2 - case 2: ao_gpio_set(AO_PYRO_PORT_2, AO_PYRO_PIN_2, AO_PYRO_2, v); break; + case 2: ao_gpio_set(AO_PYRO_PORT_2, AO_PYRO_PIN_2, v); break; #endif #if AO_PYRO_NUM > 3 - case 3: ao_gpio_set(AO_PYRO_PORT_3, AO_PYRO_PIN_3, AO_PYRO_3, v); break; + case 3: ao_gpio_set(AO_PYRO_PORT_3, AO_PYRO_PIN_3, v); break; #endif #if AO_PYRO_NUM > 4 - case 4: ao_gpio_set(AO_PYRO_PORT_4, AO_PYRO_PIN_4, AO_PYRO_4, v); break; + case 4: ao_gpio_set(AO_PYRO_PORT_4, AO_PYRO_PIN_4, v); break; #endif #if AO_PYRO_NUM > 5 - case 5: ao_gpio_set(AO_PYRO_PORT_5, AO_PYRO_PIN_5, AO_PYRO_5, v); break; + case 5: ao_gpio_set(AO_PYRO_PORT_5, AO_PYRO_PIN_5, v); break; #endif #if AO_PYRO_NUM > 6 - case 6: ao_gpio_set(AO_PYRO_PORT_6, AO_PYRO_PIN_6, AO_PYRO_6, v); break; + case 6: ao_gpio_set(AO_PYRO_PORT_6, AO_PYRO_PIN_6, v); break; #endif #if AO_PYRO_NUM > 7 - case 7: ao_gpio_set(AO_PYRO_PORT_7, AO_PYRO_PIN_7, AO_PYRO_7, v); break; + case 7: ao_gpio_set(AO_PYRO_PORT_7, AO_PYRO_PIN_7, v); break; #endif default: break; } @@ -555,28 +555,28 @@ void ao_pyro_init(void) { #if AO_PYRO_NUM > 0 - ao_enable_output(AO_PYRO_PORT_0, AO_PYRO_PIN_0, AO_PYRO_0, 0); + ao_enable_output(AO_PYRO_PORT_0, AO_PYRO_PIN_0, 0); #endif #if AO_PYRO_NUM > 1 - ao_enable_output(AO_PYRO_PORT_1, AO_PYRO_PIN_1, AO_PYRO_1, 0); + ao_enable_output(AO_PYRO_PORT_1, AO_PYRO_PIN_1, 0); #endif #if AO_PYRO_NUM > 2 - ao_enable_output(AO_PYRO_PORT_2, AO_PYRO_PIN_2, AO_PYRO_2, 0); + ao_enable_output(AO_PYRO_PORT_2, AO_PYRO_PIN_2, 0); #endif #if AO_PYRO_NUM > 3 - ao_enable_output(AO_PYRO_PORT_3, AO_PYRO_PIN_3, AO_PYRO_3, 0); + ao_enable_output(AO_PYRO_PORT_3, AO_PYRO_PIN_3, 0); #endif #if AO_PYRO_NUM > 4 - ao_enable_output(AO_PYRO_PORT_4, AO_PYRO_PIN_4, AO_PYRO_4, 0); + ao_enable_output(AO_PYRO_PORT_4, AO_PYRO_PIN_4, 0); #endif #if AO_PYRO_NUM > 5 - ao_enable_output(AO_PYRO_PORT_5, AO_PYRO_PIN_5, AO_PYRO_5, 0); + ao_enable_output(AO_PYRO_PORT_5, AO_PYRO_PIN_5, 0); #endif #if AO_PYRO_NUM > 6 - ao_enable_output(AO_PYRO_PORT_6, AO_PYRO_PIN_6, AO_PYRO_6, 0); + ao_enable_output(AO_PYRO_PORT_6, AO_PYRO_PIN_6, 0); #endif #if AO_PYRO_NUM > 7 - ao_enable_output(AO_PYRO_PORT_7, AO_PYRO_PIN_7, AO_PYRO_7, 0); + ao_enable_output(AO_PYRO_PORT_7, AO_PYRO_PIN_7, 0); #endif ao_add_task(&ao_pyro_task, ao_pyro, "pyro"); } diff --git a/src/kernel/ao_tracker.c b/src/kernel/ao_tracker.c index f79bd18a..1454c17c 100644 --- a/src/kernel/ao_tracker.c +++ b/src/kernel/ao_tracker.c @@ -30,7 +30,7 @@ static uint8_t ao_tracker_force_telem; static inline uint8_t ao_usb_connected(void) { - return ao_gpio_get(AO_USB_CONNECT_PORT, AO_USB_CONNECT_PIN, AO_USB_CONNECT) != 0; + return ao_gpio_get(AO_USB_CONNECT_PORT, AO_USB_CONNECT_PIN) != 0; } #else #define ao_usb_connected() 1 diff --git a/src/lpc/ao_arch_funcs.h b/src/lpc/ao_arch_funcs.h index 15106dea..0454b38b 100644 --- a/src/lpc/ao_arch_funcs.h +++ b/src/lpc/ao_arch_funcs.h @@ -19,17 +19,17 @@ #ifndef _AO_ARCH_FUNCS_H_ #define _AO_ARCH_FUNCS_H_ -#define ao_spi_get_bit(reg,bit,pin,bus,speed) ao_spi_get_mask(reg,(1<bsrr = (colors & ao_led_enable); @@ -105,7 +105,7 @@ ao_led_off(AO_LED_TYPE colors) AO_LED_TYPE i; for (i = 0; i < N_LED; i++) if (colors & (1 << i)) - ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, foo, 0); + ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, 0); #else #ifdef LED_PORT LED_PORT->bsrr = (uint32_t) (colors & ao_led_enable) << 16; @@ -137,7 +137,7 @@ ao_led_toggle(AO_LED_TYPE colors) AO_LED_TYPE i; for (i = 0; i < N_LED; i++) if (colors & (1 << i)) - ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, foo, ~ao_gpio_get(ao_leds[i].port, ao_leds[i].pin, foo)); + ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, ~ao_gpio_get(ao_leds[i].port, ao_leds[i].pin)); #else #ifdef LED_PORT LED_PORT->odr ^= (colors & ao_led_enable); @@ -173,7 +173,7 @@ ao_led_init(AO_LED_TYPE enable) ao_led_enable = enable; #if LED_PER_LED for (bit = 0; bit < N_LED; bit++) - ao_enable_output(ao_leds[bit].port, ao_leds[bit].pin, foo, 0); + ao_enable_output(ao_leds[bit].port, ao_leds[bit].pin, 0); #else #ifdef LED_PORT stm_rcc.ahbenr |= (1 << LED_PORT_ENABLE); diff --git a/src/stm/ao_serial_stm.c b/src/stm/ao_serial_stm.c index 2afee5b5..c1a2f1bd 100644 --- a/src/stm/ao_serial_stm.c +++ b/src/stm/ao_serial_stm.c @@ -33,7 +33,7 @@ _ao_usart_tx_start(struct ao_stm_usart *usart) { if (!ao_fifo_empty(usart->tx_fifo)) { #if HAS_SERIAL_SW_FLOW - if (usart->gpio_cts && ao_gpio_get(usart->gpio_cts, usart->pin_cts, foo) == 1) { + if (usart->gpio_cts && ao_gpio_get(usart->gpio_cts, usart->pin_cts) == 1) { ao_exti_enable(usart->gpio_cts, usart->pin_cts); return 0; } @@ -73,7 +73,7 @@ _ao_usart_rx(struct ao_stm_usart *usart, int is_stdin) * for it to drain a bunch */ if (usart->gpio_rts && ao_fifo_mostly(usart->rx_fifo)) { - ao_gpio_set(usart->gpio_rts, usart->pin_rts, usart->pin_rts, 1); + ao_gpio_set(usart->gpio_rts, usart->pin_rts, 1); usart->rts = 0; } #endif @@ -118,7 +118,7 @@ _ao_usart_pollchar(struct ao_stm_usart *usart) #if HAS_SERIAL_SW_FLOW /* If we've cleared RTS, check if there's space now and turn it back on */ if (usart->gpio_rts && usart->rts == 0 && ao_fifo_barely(usart->rx_fifo)) { - ao_gpio_set(usart->gpio_rts, usart->pin_rts, foo, 0); + ao_gpio_set(usart->gpio_rts, usart->pin_rts, 0); usart->rts = 1; } #endif @@ -403,7 +403,7 @@ ao_serial_set_sw_rts_cts(struct ao_stm_usart *usart, { /* Pull RTS low to note that there's space in the FIFO */ - ao_enable_output(port_rts, pin_rts, foo, 0); + ao_enable_output(port_rts, pin_rts, 0); usart->gpio_rts = port_rts; usart->pin_rts = pin_rts; usart->rts = 1; diff --git a/src/stmf0/ao_arch_funcs.h b/src/stmf0/ao_arch_funcs.h index 96c033f9..70f273d3 100644 --- a/src/stmf0/ao_arch_funcs.h +++ b/src/stmf0/ao_arch_funcs.h @@ -168,8 +168,8 @@ ao_spi_try_get_mask(struct stm_gpio *reg, uint16_t mask, uint8_t bus, uint32_t s ao_spi_put(bus); \ } while (0) -#define ao_spi_get_bit(reg,bit,pin,bus,speed) ao_spi_get_mask(reg,(1<adc.sense_a) #define AO_SENSE_MAIN(p) ((p)->adc.sense_m) diff --git a/src/telemini-v3.0/ao_telemini.c b/src/telemini-v3.0/ao_telemini.c index a2c0a598..66f75f0a 100644 --- a/src/telemini-v3.0/ao_telemini.c +++ b/src/telemini-v3.0/ao_telemini.c @@ -26,7 +26,7 @@ ao_check_recovery(void) ao_enable_input(AO_RECOVERY_PORT, AO_RECOVERY_PIN, AO_RECOVERY_MODE); for (i = 0; i < 100; i++) ao_arch_nop(); - if (ao_gpio_get(AO_RECOVERY_PORT, AO_RECOVERY_PIN, AO_RECOVERY) == AO_RECOVERY_VALUE) { + if (ao_gpio_get(AO_RECOVERY_PORT, AO_RECOVERY_PIN) == AO_RECOVERY_VALUE) { ao_flight_force_idle = 1; ao_force_freq = 1; } -- cgit v1.2.3 From 2cdb1f30c49ba460b0850d23ba9c85e0336af290 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 11:57:50 -0700 Subject: altos: Add generic LED driver. This driver uses the generic GPIO functions and allows per-LED port and pin configuration. It supports up to 32 LEDs. Rename SoC-specific LED drivers. Remove enabled parameter to ao_led_init Signed-off-by: Keith Packard --- src/attiny/ao_arch.h | 2 + src/attiny/ao_led.c | 64 --------- src/attiny/ao_led_tiny.c | 61 ++++++++ src/avr-demo/Makefile | 2 +- src/avr/ao_led.c | 68 --------- src/avr/ao_led_avr.c | 68 +++++++++ src/chaoskey-v0.1/Makefile | 2 +- src/chaoskey-v1.0/Makefile | 2 +- src/chaoskey-v1.0/ao_chaoskey.c | 2 +- src/detherm/Makefile | 2 +- src/drivers/ao_led.c | 174 +++++++++++++++++++++++ src/easymega-v1.0/Makefile | 2 +- src/easymega-v1.0/ao_easymega.c | 2 +- src/fox1ihu/Makefile | 2 +- src/fox1ihu/ao_fox1ihu.c | 2 +- src/kernel/ao.h | 2 +- src/kernel/ao_led.h | 202 +++++++++++++++++++++++++- src/kernel/ao_task.c | 1 + src/kernel/ao_task.h | 2 +- src/lambdakey-v1.0/Makefile | 2 +- src/lpc/ao_led_lpc.c | 17 ++- src/megadongle-v0.1/Makefile | 2 +- src/microkite/Makefile | 2 +- src/micropeak-v2.0/Makefile | 2 +- src/micropeak-v2.0/ao_micropeak.c | 2 +- src/micropeak/Makefile | 2 +- src/microsplash/Makefile | 2 +- src/nanopeak-v0.1/Makefile | 2 +- src/nucleao-32/Makefile | 2 +- src/pnpservo-v1/Makefile | 2 +- src/product/ao_micropeak.c | 2 +- src/stm-demo/Makefile | 2 +- src/stm-scheme-newlib/Makefile | 2 +- src/stm-vga/Makefile | 2 +- src/stm/ao_led.c | 216 ---------------------------- src/stm/ao_led_stm.c | 144 +++++++++++++++++++ src/stm32f4-disco/Makefile | 5 +- src/stm32f4-disco/ao_disco.c | 41 ++++-- src/stm32f4-disco/ao_pins.h | 29 ++-- src/stm32f4/ao_arch.h | 3 - src/stm32f4/ao_arch_funcs.h | 228 ++++++++++++++++++++++++++++++ src/stmf0/ao_led.c | 126 ----------------- src/stmf0/ao_led_stmf0.c | 123 ++++++++++++++++ src/teleballoon-v2.0/Makefile | 2 +- src/teleballoon-v2.0/ao_teleballoon.c | 7 +- src/telebt-v3.0/Makefile | 2 +- src/telebt-v3.0/ao_telebt.c | 2 +- src/telebt-v4.0/Makefile | 2 +- src/telebt-v4.0/ao_telebt.c | 2 +- src/teledongle-v1.8/Makefile | 2 +- src/teledongle-v3.0/ao_teledongle.c | 2 +- src/telefireeight-v1.0/ao_pins.h | 29 +--- src/telefireeight-v1.0/ao_telefireeight.c | 5 +- src/telefireone-v1.0/Makefile | 2 +- src/telefiretwo-v0.1/Makefile | 2 +- src/telefiretwo-v0.1/ao_telefiretwo.c | 5 +- src/telefiretwo-v0.2/Makefile | 2 +- src/telegps-v0.1/Makefile | 2 +- src/telegps-v2.0/Makefile | 2 +- src/telegps-v2.0/ao_telegps.c | 7 +- src/telelco-v0.2-cc1200/Makefile | 2 +- src/telelco-v0.2-cc1200/ao_telelco.c | 7 +- src/telelco-v0.2/Makefile | 2 +- src/telelco-v0.2/ao_telelco.c | 14 +- src/telelco-v0.3/Makefile | 2 +- src/telelco-v0.3/ao_telelco.c | 6 +- src/telelco-v2.0/ao_lco_v2.c | 4 +- src/telelco-v2.0/ao_pins.h | 73 +++------- src/telelco-v2.0/ao_telelco.c | 6 +- src/telelcotwo-v0.1/Makefile | 2 +- src/telelcotwo-v0.1/ao_telelcotwo.c | 6 +- src/telemega-v0.1/Makefile | 2 +- src/telemega-v0.1/ao_telemega.c | 5 +- src/telemega-v1.0/Makefile | 2 +- src/telemega-v1.0/ao_telemega.c | 2 +- src/telemega-v2.0/Makefile | 2 +- src/telemega-v2.0/ao_telemega.c | 2 +- src/telemega-v3.0/Makefile | 2 +- src/telemega-v3.0/ao_telemega.c | 2 +- src/telemetrum-v2.0/Makefile | 2 +- src/telemetrum-v2.0/ao_telemetrum.c | 2 +- src/telemetrum-v3.0/Makefile | 2 +- src/telemetrum-v3.0/ao_telemetrum.c | 5 +- src/telepyro-v0.1/Makefile | 2 +- src/telescience-pwm/Makefile | 2 +- src/telescience-v0.1/Makefile | 2 +- src/telescience-v0.2/Makefile | 2 +- src/tmgps-v2.0/Makefile | 2 +- src/usbtrng-v2.0/Makefile | 2 +- 89 files changed, 1186 insertions(+), 679 deletions(-) delete mode 100644 src/attiny/ao_led.c create mode 100644 src/attiny/ao_led_tiny.c delete mode 100644 src/avr/ao_led.c create mode 100644 src/avr/ao_led_avr.c create mode 100644 src/drivers/ao_led.c delete mode 100644 src/stm/ao_led.c create mode 100644 src/stm/ao_led_stm.c delete mode 100644 src/stmf0/ao_led.c create mode 100644 src/stmf0/ao_led_stmf0.c diff --git a/src/attiny/ao_arch.h b/src/attiny/ao_arch.h index 84a94be7..a9c450fc 100644 --- a/src/attiny/ao_arch.h +++ b/src/attiny/ao_arch.h @@ -34,6 +34,8 @@ #define AO_PORT_TYPE uint8_t +#define AO_LED_TYPE uint8_t + /* Various definitions to make GCC look more like SDCC */ #define ao_arch_naked_declare __attribute__((naked)) diff --git a/src/attiny/ao_led.c b/src/attiny/ao_led.c deleted file mode 100644 index 88505490..00000000 --- a/src/attiny/ao_led.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * 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. - */ - -#include "ao.h" - -uint8_t ao_led_enable; - -#define LED_PORT PORTB -#define LED_DDR DDRB - -void -ao_led_on(uint8_t colors) -{ - LED_PORT |= (colors & ao_led_enable); -} - -void -ao_led_off(uint8_t colors) -{ - LED_PORT &= ~(colors & ao_led_enable); -} - -void -ao_led_set(uint8_t colors) -{ - LED_PORT = (LED_PORT & ~(ao_led_enable)) | (colors & ao_led_enable); -} - -void -ao_led_toggle(uint8_t colors) -{ - LED_PORT ^= (colors & ao_led_enable); -} - -void -ao_led_for(uint8_t colors, uint16_t ticks) -{ - ao_led_on(colors); - ao_delay(ticks); - ao_led_off(colors); -} - -void -ao_led_init(uint8_t enable) -{ - ao_led_enable = enable; - LED_PORT &= ~enable; - LED_DDR |= enable; -} diff --git a/src/attiny/ao_led_tiny.c b/src/attiny/ao_led_tiny.c new file mode 100644 index 00000000..cd620f46 --- /dev/null +++ b/src/attiny/ao_led_tiny.c @@ -0,0 +1,61 @@ +/* + * Copyright © 2009 Keith Packard + * + * 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. + */ + +#include "ao.h" + +#define LED_PORT PORTB +#define LED_DDR DDRB + +void +ao_led_on(uint8_t colors) +{ + LED_PORT |= colors; +} + +void +ao_led_off(uint8_t colors) +{ + LED_PORT &= ~colors; +} + +void +ao_led_set(uint8_t colors) +{ + LED_PORT = (LED_PORT & ~LEDS_AVAILABLE) | (colors & LEDS_AVAILABLE); +} + +void +ao_led_toggle(uint8_t colors) +{ + LED_PORT ^= (colors & LEDS_AVAILABLE); +} + +void +ao_led_for(uint8_t colors, AO_TICK_TYPE ticks) +{ + ao_led_on(colors); + ao_delay(ticks); + ao_led_off(colors); +} + +void +ao_led_init(void) +{ + LED_PORT &= ~LEDS_AVAILABLE; + LED_DDR |= LEDS_AVAILABLE; +} diff --git a/src/avr-demo/Makefile b/src/avr-demo/Makefile index e21ad047..0aca6f8a 100644 --- a/src/avr-demo/Makefile +++ b/src/avr-demo/Makefile @@ -38,7 +38,7 @@ ALTOS_SRC = \ ao_stdio.c \ ao_task.c \ ao_timer.c \ - ao_led.c \ + ao_led_avr.c \ ao_usb_avr.c \ ao_lcd.c diff --git a/src/avr/ao_led.c b/src/avr/ao_led.c deleted file mode 100644 index 165e95d3..00000000 --- a/src/avr/ao_led.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright © 2009 Keith Packard - * - * 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. - */ - -#include "ao.h" - -uint8_t ao_led_enable; - -#define LED_PORT PORTB -#define LED_DDR DDRB - -void -ao_led_on(uint8_t colors) -{ - LED_PORT |= (colors & ao_led_enable); -} - -void -ao_led_off(uint8_t colors) -{ - LED_PORT &= ~(colors & ao_led_enable); -} - -void -ao_led_set(uint8_t colors) -{ - LED_PORT = (LED_PORT & ~(ao_led_enable)) | (colors & ao_led_enable); -} - -void -ao_led_toggle(uint8_t colors) -{ - LED_PORT ^= (colors & ao_led_enable); -} - -void -ao_led_for(uint8_t colors, uint16_t ticks) -{ - ao_led_on(colors); - ao_delay(ticks); - ao_led_off(colors); -} - -void -ao_led_init(uint8_t enable) -{ - ao_led_enable = enable; - if ((LED_DDR & enable)) { - printf ("oops! restarted\n"); - ao_panic(AO_PANIC_REBOOT); - } - LED_PORT &= ~enable; - LED_DDR |= enable; -} diff --git a/src/avr/ao_led_avr.c b/src/avr/ao_led_avr.c new file mode 100644 index 00000000..165e95d3 --- /dev/null +++ b/src/avr/ao_led_avr.c @@ -0,0 +1,68 @@ +/* + * Copyright © 2009 Keith Packard + * + * 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. + */ + +#include "ao.h" + +uint8_t ao_led_enable; + +#define LED_PORT PORTB +#define LED_DDR DDRB + +void +ao_led_on(uint8_t colors) +{ + LED_PORT |= (colors & ao_led_enable); +} + +void +ao_led_off(uint8_t colors) +{ + LED_PORT &= ~(colors & ao_led_enable); +} + +void +ao_led_set(uint8_t colors) +{ + LED_PORT = (LED_PORT & ~(ao_led_enable)) | (colors & ao_led_enable); +} + +void +ao_led_toggle(uint8_t colors) +{ + LED_PORT ^= (colors & ao_led_enable); +} + +void +ao_led_for(uint8_t colors, uint16_t ticks) +{ + ao_led_on(colors); + ao_delay(ticks); + ao_led_off(colors); +} + +void +ao_led_init(uint8_t enable) +{ + ao_led_enable = enable; + if ((LED_DDR & enable)) { + printf ("oops! restarted\n"); + ao_panic(AO_PANIC_REBOOT); + } + LED_PORT &= ~enable; + LED_DDR |= enable; +} diff --git a/src/chaoskey-v0.1/Makefile b/src/chaoskey-v0.1/Makefile index 85392280..faa4a291 100644 --- a/src/chaoskey-v0.1/Makefile +++ b/src/chaoskey-v0.1/Makefile @@ -28,7 +28,7 @@ ALTOS_SRC = \ ao_adc_fast.c \ ao_crc_stm.c \ ao_stdio.c \ - ao_led.c \ + ao_led_stmf0.c \ ao_romconfig.c \ ao_boot_chain.c \ ao_usb_stm.c \ diff --git a/src/chaoskey-v1.0/Makefile b/src/chaoskey-v1.0/Makefile index c6cf45bd..329f603d 100644 --- a/src/chaoskey-v1.0/Makefile +++ b/src/chaoskey-v1.0/Makefile @@ -30,7 +30,7 @@ ALTOS_SRC = \ ao_adc_fast.c \ ao_crc_stm.c \ ao_stdio.c \ - ao_led.c \ + ao_led_stmf0.c \ ao_romconfig.c \ ao_boot_chain.c \ ao_usb_stm.c \ diff --git a/src/chaoskey-v1.0/ao_chaoskey.c b/src/chaoskey-v1.0/ao_chaoskey.c index 1165e454..80f5a4ba 100644 --- a/src/chaoskey-v1.0/ao_chaoskey.c +++ b/src/chaoskey-v1.0/ao_chaoskey.c @@ -24,7 +24,7 @@ void main(void) { - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); ao_clock_init(); ao_task_init(); ao_timer_init(); diff --git a/src/detherm/Makefile b/src/detherm/Makefile index 6b0e0bf8..7681a049 100644 --- a/src/detherm/Makefile +++ b/src/detherm/Makefile @@ -27,7 +27,7 @@ ALTOS_SRC = \ ao_spi_stm.c \ ao_exti_stm.c \ ao_stdio.c \ - ao_led.c \ + ao_led_stmf0.c \ ao_log.c \ ao_log_mini.c \ ao_sample.c \ diff --git a/src/drivers/ao_led.c b/src/drivers/ao_led.c new file mode 100644 index 00000000..0f7b7c27 --- /dev/null +++ b/src/drivers/ao_led.c @@ -0,0 +1,174 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#include "ao.h" + +static const struct { + struct stm_gpio *port; + uint16_t pin; +} ao_leds[] = { +#ifdef LED_0_PORT + [0] { LED_0_PORT, LED_0_PIN }, +#endif +#ifdef LED_1_PORT + [1] { LED_1_PORT, LED_1_PIN }, +#endif +#ifdef LED_2_PORT + [2] { LED_2_PORT, LED_2_PIN }, +#endif +#ifdef LED_3_PORT + [3] { LED_3_PORT, LED_3_PIN }, +#endif +#ifdef LED_4_PORT + [4] { LED_4_PORT, LED_4_PIN }, +#endif +#ifdef LED_5_PORT + [5] { LED_5_PORT, LED_5_PIN }, +#endif +#ifdef LED_6_PORT + [6] { LED_6_PORT, LED_6_PIN }, +#endif +#ifdef LED_7_PORT + [7] { LED_7_PORT, LED_7_PIN }, +#endif +#ifdef LED_8_PORT + [8] { LED_8_PORT, LED_8_PIN }, +#endif +#ifdef LED_9_PORT + [9] { LED_9_PORT, LED_9_PIN }, +#endif +#ifdef LED_10_PORT + [10] { LED_10_PORT, LED_10_PIN }, +#endif +#ifdef LED_11_PORT + [11] { LED_11_PORT, LED_11_PIN }, +#endif +#ifdef LED_12_PORT + [12] { LED_12_PORT, LED_12_PIN }, +#endif +#ifdef LED_13_PORT + [13] { LED_13_PORT, LED_13_PIN }, +#endif +#ifdef LED_14_PORT + [14] { LED_14_PORT, LED_14_PIN }, +#endif +#ifdef LED_15_PORT + [15] { LED_15_PORT, LED_15_PIN }, +#endif +#ifdef LED_16_PORT + [16] { LED_16_PORT, LED_16_PIN }, +#endif +#ifdef LED_17_PORT + [17] { LED_17_PORT, LED_17_PIN }, +#endif +#ifdef LED_18_PORT + [18] { LED_18_PORT, LED_18_PIN }, +#endif +#ifdef LED_19_PORT + [19] { LED_19_PORT, LED_19_PIN }, +#endif +#ifdef LED_20_PORT + [20] { LED_20_PORT, LED_20_PIN }, +#endif +#ifdef LED_21_PORT + [21] { LED_21_PORT, LED_21_PIN }, +#endif +#ifdef LED_22_PORT + [22] { LED_22_PORT, LED_22_PIN }, +#endif +#ifdef LED_23_PORT + [23] { LED_23_PORT, LED_23_PIN }, +#endif +#ifdef LED_24_PORT + [24] { LED_24_PORT, LED_24_PIN }, +#endif +#ifdef LED_25_PORT + [25] { LED_25_PORT, LED_25_PIN }, +#endif +#ifdef LED_26_PORT + [26] { LED_26_PORT, LED_26_PIN }, +#endif +#ifdef LED_27_PORT + [27] { LED_27_PORT, LED_27_PIN }, +#endif +#ifdef LED_28_PORT + [28] { LED_28_PORT, LED_28_PIN }, +#endif +#ifdef LED_29_PORT + [29] { LED_29_PORT, LED_29_PIN }, +#endif +#ifdef LED_30_PORT + [30] { LED_30_PORT, LED_30_PIN }, +#endif +#ifdef LED_31_PORT + [31] { LED_31_PORT, LED_31_PIN }, +#endif +}; +#define N_LED (sizeof (ao_leds)/sizeof(ao_leds[0])) + +void +ao_led_on(AO_LED_TYPE colors) +{ + AO_LED_TYPE i; + for (i = 0; i < N_LED; i++) + if (colors & (1 << i)) + ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, 1); +} + +void +ao_led_off(AO_LED_TYPE colors) +{ + AO_LED_TYPE i; + for (i = 0; i < N_LED; i++) + if (colors & (1 << i)) + ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, 0); +} + +void +ao_led_set(AO_LED_TYPE colors) +{ + AO_LED_TYPE i; + for (i = 0; i < N_LED; i++) + ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, (colors >> i) & 1); +} + +void +ao_led_toggle(AO_LED_TYPE colors) +{ + AO_LED_TYPE i; + for (i = 0; i < N_LED; i++) + if (colors & (1 << i)) + ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, ~ao_gpio_get(ao_leds[i].port, ao_leds[i].pin)); +} + +void +ao_led_for(AO_LED_TYPE colors, AO_TICK_TYPE ticks) +{ + ao_led_on(colors); + ao_delay(ticks); + ao_led_off(colors); +} + +void +ao_led_init(void) +{ + AO_LED_TYPE bit; + + for (bit = 0; bit < N_LED; bit++) + ao_enable_output(ao_leds[bit].port, ao_leds[bit].pin, 0); +} diff --git a/src/easymega-v1.0/Makefile b/src/easymega-v1.0/Makefile index 3344da06..76e7319e 100644 --- a/src/easymega-v1.0/Makefile +++ b/src/easymega-v1.0/Makefile @@ -53,7 +53,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/easymega-v1.0/ao_easymega.c b/src/easymega-v1.0/ao_easymega.c index 9848c367..d00585f9 100644 --- a/src/easymega-v1.0/ao_easymega.c +++ b/src/easymega-v1.0/ao_easymega.c @@ -43,7 +43,7 @@ main(void) #endif ao_task_init(); - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); ao_led_on(LEDS_AVAILABLE); ao_timer_init(); diff --git a/src/fox1ihu/Makefile b/src/fox1ihu/Makefile index e3226a24..61314db9 100644 --- a/src/fox1ihu/Makefile +++ b/src/fox1ihu/Makefile @@ -37,7 +37,7 @@ ALTOS_SRC = \ ao_romconfig.c \ ao_cmd.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/fox1ihu/ao_fox1ihu.c b/src/fox1ihu/ao_fox1ihu.c index 2e1a2fdf..5ebb4b54 100644 --- a/src/fox1ihu/ao_fox1ihu.c +++ b/src/fox1ihu/ao_fox1ihu.c @@ -31,7 +31,7 @@ main(void) #endif ao_task_init(); - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); ao_led_on(AO_LED_RED|AO_LED_GREEN|AO_LED_RED_2|AO_LED_GREEN_2); ao_timer_init(); diff --git a/src/kernel/ao.h b/src/kernel/ao.h index 9c0c8604..1b269d73 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -230,7 +230,7 @@ ao_cmd_filter(void); #include #endif -#if LEDS_AVAILABLE +#if LEDS_AVAILABLE || HAS_LED #include #endif diff --git a/src/kernel/ao_led.h b/src/kernel/ao_led.h index 803f85b3..5d982ca6 100644 --- a/src/kernel/ao_led.h +++ b/src/kernel/ao_led.h @@ -26,7 +26,7 @@ #define AO_LED_NONE 0 #ifndef AO_LED_TYPE -#define AO_LED_TYPE uint8_t +#define AO_LED_TYPE uint32_t #endif /* Turn on the specified LEDs */ @@ -55,6 +55,204 @@ ao_led_for(AO_LED_TYPE colors, uint16_t ticks); /* Initialize the LEDs */ void -ao_led_init(AO_LED_TYPE enable); +ao_led_init(void); + +#ifdef LED_0_PORT +#define AO_LED_0 (1 << 0) +#else +#define AO_LED_0 0 +#endif +#ifdef LED_1_PORT +#define AO_LED_1 (1 << 1) +#else +#define AO_LED_1 0 +#endif +#ifdef LED_2_PORT +#define AO_LED_2 (1 << 2) +#else +#define AO_LED_2 0 +#endif +#ifdef LED_3_PORT +#define AO_LED_3 (1 << 3) +#else +#define AO_LED_3 0 +#endif +#ifdef LED_4_PORT +#define AO_LED_4 (1 << 4) +#else +#define AO_LED_4 0 +#endif +#ifdef LED_5_PORT +#define AO_LED_5 (1 << 5) +#else +#define AO_LED_5 0 +#endif +#ifdef LED_6_PORT +#define AO_LED_6 (1 << 6) +#else +#define AO_LED_6 0 +#endif +#ifdef LED_7_PORT +#define AO_LED_7 (1 << 7) +#else +#define AO_LED_7 0 +#endif +#ifdef LED_8_PORT +#define AO_LED_8 (1 << 8) +#else +#define AO_LED_8 0 +#endif +#ifdef LED_9_PORT +#define AO_LED_9 (1 << 9) +#else +#define AO_LED_9 0 +#endif +#ifdef LED_10_PORT +#define AO_LED_10 (1 << 10) +#else +#define AO_LED_10 0 +#endif +#ifdef LED_11_PORT +#define AO_LED_11 (1 << 11) +#else +#define AO_LED_11 0 +#endif +#ifdef LED_12_PORT +#define AO_LED_12 (1 << 12) +#else +#define AO_LED_12 0 +#endif +#ifdef LED_13_PORT +#define AO_LED_13 (1 << 13) +#else +#define AO_LED_13 0 +#endif +#ifdef LED_14_PORT +#define AO_LED_14 (1 << 14) +#else +#define AO_LED_14 0 +#endif +#ifdef LED_15_PORT +#define AO_LED_15 (1 << 15) +#else +#define AO_LED_15 0 +#endif +#ifdef LED_16_PORT +#define AO_LED_16 (1 << 16) +#else +#define AO_LED_16 0 +#endif +#ifdef LED_17_PORT +#define AO_LED_17 (1 << 17) +#else +#define AO_LED_17 0 +#endif +#ifdef LED_18_PORT +#define AO_LED_18 (1 << 18) +#else +#define AO_LED_18 0 +#endif +#ifdef LED_19_PORT +#define AO_LED_19 (1 << 19) +#else +#define AO_LED_19 0 +#endif +#ifdef LED_20_PORT +#define AO_LED_20 (1 << 20) +#else +#define AO_LED_20 0 +#endif +#ifdef LED_21_PORT +#define AO_LED_21 (1 << 21) +#else +#define AO_LED_21 0 +#endif +#ifdef LED_22_PORT +#define AO_LED_22 (1 << 22) +#else +#define AO_LED_22 0 +#endif +#ifdef LED_23_PORT +#define AO_LED_23 (1 << 23) +#else +#define AO_LED_23 0 +#endif +#ifdef LED_24_PORT +#define AO_LED_24 (1 << 24) +#else +#define AO_LED_24 0 +#endif +#ifdef LED_25_PORT +#define AO_LED_25 (1 << 25) +#else +#define AO_LED_25 0 +#endif +#ifdef LED_26_PORT +#define AO_LED_26 (1 << 26) +#else +#define AO_LED_26 0 +#endif +#ifdef LED_27_PORT +#define AO_LED_27 (1 << 27) +#else +#define AO_LED_27 0 +#endif +#ifdef LED_28_PORT +#define AO_LED_28 (1 << 28) +#else +#define AO_LED_28 0 +#endif +#ifdef LED_29_PORT +#define AO_LED_29 (1 << 29) +#else +#define AO_LED_29 0 +#endif +#ifdef LED_30_PORT +#define AO_LED_30 (1 << 30) +#else +#define AO_LED_30 0 +#endif +#ifdef LED_31_PORT +#define AO_LED_31 (1 << 31) +#else +#define AO_LED_31 0 +#endif + +#define AO_LEDS_AVAILABLE (AO_LED_0 | \ + AO_LED_1 | \ + AO_LED_2 | \ + AO_LED_3 | \ + AO_LED_4 | \ + AO_LED_5 | \ + AO_LED_6 | \ + AO_LED_7 | \ + AO_LED_8 | \ + AO_LED_9 | \ + AO_LED_10 | \ + AO_LED_11 | \ + AO_LED_12 | \ + AO_LED_13 | \ + AO_LED_14 | \ + AO_LED_15 | \ + AO_LED_16 | \ + AO_LED_17 | \ + AO_LED_18 | \ + AO_LED_19 | \ + AO_LED_20 | \ + AO_LED_21 | \ + AO_LED_22 | \ + AO_LED_23 | \ + AO_LED_24 | \ + AO_LED_25 | \ + AO_LED_26 | \ + AO_LED_27 | \ + AO_LED_28 | \ + AO_LED_29 | \ + AO_LED_30 | \ + AO_LED_31) + +#ifndef LEDS_AVAILABLE +#define LEDS_AVAILABLE AO_LEDS_AVAILABLE +#endif #endif /* _AO_LED_H_ */ diff --git a/src/kernel/ao_task.c b/src/kernel/ao_task.c index 4f7072cb..dc5c1913 100644 --- a/src/kernel/ao_task.c +++ b/src/kernel/ao_task.c @@ -569,4 +569,5 @@ ao_start_scheduler(void) ao_arch_start_scheduler(); #endif ao_yield(); + __builtin_unreachable(); } diff --git a/src/kernel/ao_task.h b/src/kernel/ao_task.h index ffeb7313..f3789fa2 100644 --- a/src/kernel/ao_task.h +++ b/src/kernel/ao_task.h @@ -134,7 +134,7 @@ ao_task_info(void); /* Start the scheduler. This will not return */ void -ao_start_scheduler(void); +ao_start_scheduler(void) __attribute__((noreturn)); #if HAS_TASK_QUEUE void diff --git a/src/lambdakey-v1.0/Makefile b/src/lambdakey-v1.0/Makefile index b94c3873..f8b5c7f5 100644 --- a/src/lambdakey-v1.0/Makefile +++ b/src/lambdakey-v1.0/Makefile @@ -27,7 +27,7 @@ ALTOS_SRC = \ ao_interrupt.c \ ao_product.c \ ao_cmd.c \ - ao_led.c \ + ao_led_stmf0.c \ ao_notask.c \ ao_stdio.c \ ao_panic.c \ diff --git a/src/lpc/ao_led_lpc.c b/src/lpc/ao_led_lpc.c index 5fc726c0..3a2d4c98 100644 --- a/src/lpc/ao_led_lpc.c +++ b/src/lpc/ao_led_lpc.c @@ -35,8 +35,8 @@ ao_led_off(AO_PORT_TYPE colors) void ao_led_set(AO_PORT_TYPE colors) { - AO_PORT_TYPE on = colors & ao_led_enable; - AO_PORT_TYPE off = ~colors & ao_led_enable; + AO_PORT_TYPE on = colors & LEDS_AVAILABLE; + AO_PORT_TYPE off = ~colors & LEDS_AVAILABLE; ao_led_off(off); ao_led_on(on); @@ -57,18 +57,17 @@ ao_led_for(AO_PORT_TYPE colors, uint16_t ticks) } void -ao_led_init(AO_PORT_TYPE enable) +ao_led_init(void) { - ao_led_enable = enable; ao_enable_port(LED_PORT); if (LED_PORT == 0) { - if (enable & (1 << 11)) + if (LEDS_AVAILABLE & (1 << 11)) lpc_ioconf.pio0_11 = LPC_IOCONF_FUNC_PIO0_11 | (1 << LPC_IOCONF_ADMODE); - if (enable & (1 << 12)) + if (LEDS_AVAILABLE & (1 << 12)) lpc_ioconf.pio0_12 = LPC_IOCONF_FUNC_PIO0_12 | (1 << LPC_IOCONF_ADMODE); - if (enable & (1 << 14)) + if (LEDS_AVAILABLE & (1 << 14)) lpc_ioconf.pio0_14 = LPC_IOCONF_FUNC_PIO0_14 | (1 << LPC_IOCONF_ADMODE); } - lpc_gpio.dir[LED_PORT] |= enable; - ao_led_off(enable); + lpc_gpio.dir[LED_PORT] |= LEDS_AVAILABLE; + ao_led_off(LEDS_AVAILABLE); } diff --git a/src/megadongle-v0.1/Makefile b/src/megadongle-v0.1/Makefile index bbe2ea58..4290e088 100644 --- a/src/megadongle-v0.1/Makefile +++ b/src/megadongle-v0.1/Makefile @@ -36,7 +36,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/microkite/Makefile b/src/microkite/Makefile index b7523758..5eb97206 100644 --- a/src/microkite/Makefile +++ b/src/microkite/Makefile @@ -29,7 +29,7 @@ LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: ALTOS_SRC = \ ao_micropeak.c \ ao_spi_attiny.c \ - ao_led.c \ + ao_led_tiny.c \ ao_clock.c \ ao_ms5607.c \ ao_exti.c \ diff --git a/src/micropeak-v2.0/Makefile b/src/micropeak-v2.0/Makefile index 32154fa6..c7d1b22d 100644 --- a/src/micropeak-v2.0/Makefile +++ b/src/micropeak-v2.0/Makefile @@ -18,7 +18,7 @@ ALTOS_SRC = \ ao_micropeak.c \ ao_spi_stm.c \ ao_dma_stm.c \ - ao_led.c \ + ao_led_stmf0.c \ ao_timer.c \ ao_ms5607.c \ ao_exti_stm.c \ diff --git a/src/micropeak-v2.0/ao_micropeak.c b/src/micropeak-v2.0/ao_micropeak.c index 1cfa1209..df557e60 100644 --- a/src/micropeak-v2.0/ao_micropeak.c +++ b/src/micropeak-v2.0/ao_micropeak.c @@ -252,7 +252,7 @@ main(void) else ao_hsi_init(); - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); ao_task_init(); ao_timer_init(); ao_serial_init(); diff --git a/src/micropeak/Makefile b/src/micropeak/Makefile index 6e8cae14..f80d61b0 100644 --- a/src/micropeak/Makefile +++ b/src/micropeak/Makefile @@ -29,7 +29,7 @@ LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: ALTOS_SRC = \ ao_micropeak.c \ ao_spi_attiny.c \ - ao_led.c \ + ao_led_tiny.c \ ao_clock.c \ ao_ms5607.c \ ao_exti.c \ diff --git a/src/microsplash/Makefile b/src/microsplash/Makefile index 9bb636f1..0342838e 100644 --- a/src/microsplash/Makefile +++ b/src/microsplash/Makefile @@ -29,7 +29,7 @@ LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: ALTOS_SRC = \ ao_micropeak.c \ ao_spi_attiny.c \ - ao_led.c \ + ao_led_tiny.c \ ao_clock.c \ ao_ms5607.c \ ao_exti.c \ diff --git a/src/nanopeak-v0.1/Makefile b/src/nanopeak-v0.1/Makefile index d3779594..774d4adc 100644 --- a/src/nanopeak-v0.1/Makefile +++ b/src/nanopeak-v0.1/Makefile @@ -19,7 +19,7 @@ LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: ALTOS_SRC = \ ao_micropeak.c \ ao_spi_attiny.c \ - ao_led.c \ + ao_led_tiny.c \ ao_clock.c \ ao_ms5607.c \ ao_exti.c \ diff --git a/src/nucleao-32/Makefile b/src/nucleao-32/Makefile index 2b9fe14f..1ab2eea1 100644 --- a/src/nucleao-32/Makefile +++ b/src/nucleao-32/Makefile @@ -26,7 +26,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stmf0.c \ ao_beep_stm.c \ ao_dma_stm.c \ ao_stdio.c \ diff --git a/src/pnpservo-v1/Makefile b/src/pnpservo-v1/Makefile index 8606b1ae..443a6afb 100644 --- a/src/pnpservo-v1/Makefile +++ b/src/pnpservo-v1/Makefile @@ -24,7 +24,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stmf0.c \ ao_dma_stm.c \ ao_stdio.c \ ao_mutex.c \ diff --git a/src/product/ao_micropeak.c b/src/product/ao_micropeak.c index 8aac79cd..8fed3069 100644 --- a/src/product/ao_micropeak.c +++ b/src/product/ao_micropeak.c @@ -57,7 +57,7 @@ ao_pips(void) int main(void) { - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); ao_timer_init(); /* Init external hardware */ diff --git a/src/stm-demo/Makefile b/src/stm-demo/Makefile index d4569c1a..ccce37a5 100644 --- a/src/stm-demo/Makefile +++ b/src/stm-demo/Makefile @@ -23,7 +23,7 @@ ALTOS_SRC = \ ao_romconfig.c \ ao_cmd.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/stm-scheme-newlib/Makefile b/src/stm-scheme-newlib/Makefile index a4c249a3..1db58f10 100644 --- a/src/stm-scheme-newlib/Makefile +++ b/src/stm-scheme-newlib/Makefile @@ -30,7 +30,7 @@ ALTOS_SRC = \ ao_romconfig.c \ ao_cmd.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio_newlib.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/stm-vga/Makefile b/src/stm-vga/Makefile index 46a77272..fa0d008f 100644 --- a/src/stm-vga/Makefile +++ b/src/stm-vga/Makefile @@ -28,7 +28,7 @@ ALTOS_SRC = \ ao_romconfig.c \ ao_cmd.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/stm/ao_led.c b/src/stm/ao_led.c deleted file mode 100644 index 481a6e87..00000000 --- a/src/stm/ao_led.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#include "ao.h" - -#if LED_PER_LED -static const struct { - struct stm_gpio *port; - uint16_t pin; -} ao_leds[] = { -#ifdef LED_0_PORT - [0] { LED_0_PORT, LED_0_PIN }, -#endif -#ifdef LED_1_PORT - [1] { LED_1_PORT, LED_1_PIN }, -#endif -#ifdef LED_2_PORT - [2] { LED_2_PORT, LED_2_PIN }, -#endif -#ifdef LED_3_PORT - [3] { LED_3_PORT, LED_3_PIN }, -#endif -#ifdef LED_4_PORT - [4] { LED_4_PORT, LED_4_PIN }, -#endif -#ifdef LED_5_PORT - [5] { LED_5_PORT, LED_5_PIN }, -#endif -#ifdef LED_6_PORT - [6] { LED_6_PORT, LED_6_PIN }, -#endif -#ifdef LED_7_PORT - [7] { LED_7_PORT, LED_7_PIN }, -#endif -#ifdef LED_8_PORT - [8] { LED_8_PORT, LED_8_PIN }, -#endif -#ifdef LED_9_PORT - [9] { LED_9_PORT, LED_9_PIN }, -#endif -#ifdef LED_10_PORT - [10] { LED_10_PORT, LED_10_PIN }, -#endif -#ifdef LED_11_PORT - [11] { LED_11_PORT, LED_11_PIN }, -#endif -#ifdef LED_12_PORT - [12] { LED_12_PORT, LED_12_PIN }, -#endif -#ifdef LED_13_PORT - [13] { LED_13_PORT, LED_13_PIN }, -#endif -#ifdef LED_14_PORT - [14] { LED_14_PORT, LED_14_PIN }, -#endif -#ifdef LED_15_PORT - [15] { LED_15_PORT, LED_15_PIN }, -#endif -}; -#define N_LED (sizeof (ao_leds)/sizeof(ao_leds[0])) -#endif -static AO_LED_TYPE ao_led_enable; - -void -ao_led_on(AO_LED_TYPE colors) -{ -#ifdef LED_PER_LED - AO_LED_TYPE i; - for (i = 0; i < N_LED; i++) - if (colors & (1 << i)) - ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, 1); -#else -#ifdef LED_PORT - LED_PORT->bsrr = (colors & ao_led_enable); -#else -#ifdef LED_PORT_0 - LED_PORT_0->bsrr = ((colors & ao_led_enable) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT; -#endif -#ifdef LED_PORT_1 - LED_PORT_1->bsrr = ((colors & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT; -#endif -#endif -#endif -} - -void -ao_led_off(AO_LED_TYPE colors) -{ -#ifdef LED_PER_LED - AO_LED_TYPE i; - for (i = 0; i < N_LED; i++) - if (colors & (1 << i)) - ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, 0); -#else -#ifdef LED_PORT - LED_PORT->bsrr = (uint32_t) (colors & ao_led_enable) << 16; -#else -#ifdef LED_PORT_0 - LED_PORT_0->bsrr = ((uint32_t) (colors & ao_led_enable) & LED_PORT_0_MASK) << (LED_PORT_0_SHIFT + 16); -#endif -#ifdef LED_PORT_1 - LED_PORT_1->bsrr = ((uint32_t) (colors & ao_led_enable) & LED_PORT_1_MASK) << (LED_PORT_1_SHIFT + 16); -#endif -#endif -#endif -} - -void -ao_led_set(AO_LED_TYPE colors) -{ - AO_LED_TYPE on = colors & ao_led_enable; - AO_LED_TYPE off = ~colors & ao_led_enable; - - ao_led_off(off); - ao_led_on(on); -} - -void -ao_led_toggle(AO_LED_TYPE colors) -{ -#ifdef LED_PER_LED - AO_LED_TYPE i; - for (i = 0; i < N_LED; i++) - if (colors & (1 << i)) - ao_gpio_set(ao_leds[i].port, ao_leds[i].pin, ~ao_gpio_get(ao_leds[i].port, ao_leds[i].pin)); -#else -#ifdef LED_PORT - LED_PORT->odr ^= (colors & ao_led_enable); -#else -#ifdef LED_PORT_0 - LED_PORT_0->odr ^= ((colors & ao_led_enable) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT; -#endif -#ifdef LED_PORT_1 - LED_PORT_1->odr ^= ((colors & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT; -#endif -#endif -#endif -} - -void -ao_led_for(AO_LED_TYPE colors, AO_LED_TYPE ticks) -{ - ao_led_on(colors); - ao_delay(ticks); - ao_led_off(colors); -} - -#define init_led_pin(port, bit) do { \ - stm_moder_set(port, bit, STM_MODER_OUTPUT); \ - stm_otyper_set(port, bit, STM_OTYPER_PUSH_PULL); \ - } while (0) - -void -ao_led_init(AO_LED_TYPE enable) -{ - AO_LED_TYPE bit; - - ao_led_enable = enable; -#if LED_PER_LED - for (bit = 0; bit < N_LED; bit++) - ao_enable_output(ao_leds[bit].port, ao_leds[bit].pin, 0); -#else -#ifdef LED_PORT - stm_rcc.ahbenr |= (1 << LED_PORT_ENABLE); - LED_PORT->odr &= ~enable; -#else -#ifdef LED_PORT_0 - stm_rcc.ahbenr |= (1 << LED_PORT_0_ENABLE); - LED_PORT_0->odr &= ~((enable & ao_led_enable) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT; -#endif -#ifdef LED_PORT_1 - stm_rcc.ahbenr |= (1 << LED_PORT_1_ENABLE); - LED_PORT_1->odr &= ~((enable & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT; -#endif -#ifdef LED_PORT_2 - stm_rcc.ahbenr |= (1 << LED_PORT_1_ENABLE); - LED_PORT_1->odr &= ~((enable & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT; -#endif -#endif - for (bit = 0; bit < 16; bit++) { - if (enable & (1 << bit)) { -#ifdef LED_PORT - init_led_pin(LED_PORT, bit); -#else -#ifdef LED_PORT_0 - if (LED_PORT_0_MASK & (1 << bit)) - init_led_pin(LED_PORT_0, bit + LED_PORT_0_SHIFT); -#endif -#ifdef LED_PORT_1 - if (LED_PORT_1_MASK & (1 << bit)) - init_led_pin(LED_PORT_1, bit + LED_PORT_1_SHIFT); -#endif -#ifdef LED_PORT_2 - if (LED_PORT_2_MASK & (1 << bit)) - init_led_pin(LED_PORT_2, bit + LED_PORT_2_SHIFT); -#endif -#endif - } - } -#endif -} diff --git a/src/stm/ao_led_stm.c b/src/stm/ao_led_stm.c new file mode 100644 index 00000000..7dcbb661 --- /dev/null +++ b/src/stm/ao_led_stm.c @@ -0,0 +1,144 @@ +/* + * Copyright © 2012 Keith Packard + * + * 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. + */ + +#include "ao.h" + +#if LED_PER_LED +#error LED_PER_LED support is in ao_led.c now +#endif + +void +ao_led_on(AO_LED_TYPE colors) +{ +#ifdef LED_PORT + LED_PORT->bsrr = (colors & LEDS_AVAILABLE); +#else +#ifdef LED_PORT_0 + LED_PORT_0->bsrr = ((colors & LEDS_AVAILABLE) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT; +#endif +#ifdef LED_PORT_1 + LED_PORT_1->bsrr = ((colors & LEDS_AVAILABLE) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT; +#endif +#ifdef LED_PORT_2 + LED_PORT_2->bsrr = ((colors & LEDS_AVAILABLE) & LED_PORT_2_MASK) << LED_PORT_2_SHIFT; +#endif +#endif +} + +void +ao_led_off(AO_LED_TYPE colors) +{ +#ifdef LED_PORT + LED_PORT->bsrr = (uint32_t) (colors & LEDS_AVAILABLE) << 16; +#else +#ifdef LED_PORT_0 + LED_PORT_0->bsrr = ((uint32_t) (colors & LEDS_AVAILABLE) & LED_PORT_0_MASK) << (LED_PORT_0_SHIFT + 16); +#endif +#ifdef LED_PORT_1 + LED_PORT_1->bsrr = ((uint32_t) (colors & LEDS_AVAILABLE) & LED_PORT_1_MASK) << (LED_PORT_1_SHIFT + 16); +#endif +#ifdef LED_PORT_2 + LED_PORT_2->bsrr = ((uint32_t) (colors & LEDS_AVAILABLE) & LED_PORT_2_MASK) << (LED_PORT_2_SHIFT + 16); +#endif +#endif +} + +void +ao_led_set(AO_LED_TYPE colors) +{ + AO_LED_TYPE on = colors & LEDS_AVAILABLE; + AO_LED_TYPE off = ~colors & LEDS_AVAILABLE; + + ao_led_off(off); + ao_led_on(on); +} + +void +ao_led_toggle(AO_LED_TYPE colors) +{ +#ifdef LED_PORT + LED_PORT->odr ^= (colors & LEDS_AVAILABLE); +#else +#ifdef LED_PORT_0 + LED_PORT_0->odr ^= ((colors & LEDS_AVAILABLE) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT; +#endif +#ifdef LED_PORT_1 + LED_PORT_1->odr ^= ((colors & LEDS_AVAILABLE) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT; +#endif +#ifdef LED_PORT_2 + LED_PORT_2->odr ^= ((colors & LEDS_AVAILABLE) & LED_PORT_2_MASK) << LED_PORT_2_SHIFT; +#endif +#endif +} + +void +ao_led_for(AO_LED_TYPE colors, AO_LED_TYPE ticks) +{ + ao_led_on(colors); + ao_delay(ticks); + ao_led_off(colors); +} + +#define init_led_pin(port, bit) do { \ + stm_moder_set(port, bit, STM_MODER_OUTPUT); \ + stm_otyper_set(port, bit, STM_OTYPER_PUSH_PULL); \ + } while (0) + +void +ao_led_init(void) +{ + AO_LED_TYPE bit; + +#ifdef LED_PORT + stm_rcc.ahbenr |= (1 << LED_PORT_ENABLE); + LED_PORT->odr &= ~LEDS_AVAILABLE; +#else +#ifdef LED_PORT_0 + stm_rcc.ahbenr |= (1 << LED_PORT_0_ENABLE); + LED_PORT_0->odr &= (uint32_t) ~(LEDS_AVAILABLE & LED_PORT_0_MASK) << LED_PORT_0_SHIFT; +#endif +#ifdef LED_PORT_1 + stm_rcc.ahbenr |= (1 << LED_PORT_1_ENABLE); + LED_PORT_1->odr &= (uint32_t) ~(LEDS_AVAILABLE & LED_PORT_1_MASK) << LED_PORT_1_SHIFT; +#endif +#ifdef LED_PORT_2 + stm_rcc.ahbenr |= (1 << LED_PORT_2_ENABLE); + LED_PORT_2->odr &= (uint32_t) ~(LEDS_AVAILABLE & LED_PORT_2_MASK) << LED_PORT_2_SHIFT; +#endif +#endif + for (bit = 0; bit < sizeof (AO_LED_TYPE) * 8; bit++) { + if (LEDS_AVAILABLE & (1 << bit)) { +#ifdef LED_PORT + init_led_pin(LED_PORT, bit); +#else +#ifdef LED_PORT_0 + if (LED_PORT_0_MASK & (1 << bit)) + init_led_pin(LED_PORT_0, bit + LED_PORT_0_SHIFT); +#endif +#ifdef LED_PORT_1 + if (LED_PORT_1_MASK & (1 << bit)) + init_led_pin(LED_PORT_1, bit + LED_PORT_1_SHIFT); +#endif +#ifdef LED_PORT_2 + if (LED_PORT_2_MASK & (1 << bit)) + init_led_pin(LED_PORT_2, bit + LED_PORT_2_SHIFT); +#endif +#endif + } + } +} diff --git a/src/stm32f4-disco/Makefile b/src/stm32f4-disco/Makefile index 2d912b22..c970b879 100644 --- a/src/stm32f4-disco/Makefile +++ b/src/stm32f4-disco/Makefile @@ -3,7 +3,10 @@ include ../stm32f4/Makefile-raw.defs ALTOS_SRC = \ ao_interrupt.c \ ao_panic.c \ - ao_timer.c + ao_timer.c \ + ao_led.c \ + ao_task.c \ + ao_stdio.c CFLAGS = $(STM32F4_CFLAGS) diff --git a/src/stm32f4-disco/ao_disco.c b/src/stm32f4-disco/ao_disco.c index efbed947..c6cdbd23 100644 --- a/src/stm32f4-disco/ao_disco.c +++ b/src/stm32f4-disco/ao_disco.c @@ -14,24 +14,35 @@ #include -void main(void) +static struct ao_task red_task; +static struct ao_task green_task; + +static void +red(void) { - float x; - int r = 1; - int g = 0; + for (;;) { + ao_led_toggle(LED_RED); + ao_delay(AO_MS_TO_TICKS(500)); + } +} - ao_clock_init(); +static void +green(void) +{ + for (;;) { + ao_led_toggle(LED_GREEN); + ao_delay(AO_MS_TO_TICKS(450)); + } +} +void main(void) +{ + ao_clock_init(); ao_timer_init(); + ao_led_init(); + ao_task_init(); - ao_enable_output(LED_GREEN_PORT, LED_GREEN_PIN, 0); - ao_enable_output(LED_RED_PORT, LED_RED_PIN, 1); - for (;;) { - ao_gpio_set(LED_GREEN_PORT, LED_GREEN_PIN, g); - ao_gpio_set(LED_RED_PORT, LED_RED_PIN, r); - g ^= 1; - r ^= 1; - for (x = 0.0f; x < 100000.0f; x = x + 0.1f) - ao_arch_nop(); - } + ao_add_task(&red_task, red, "red"); + ao_add_task(&green_task, green, "green"); + ao_start_scheduler(); } diff --git a/src/stm32f4-disco/ao_pins.h b/src/stm32f4-disco/ao_pins.h index c4dc5b4b..bbbc306e 100644 --- a/src/stm32f4-disco/ao_pins.h +++ b/src/stm32f4-disco/ao_pins.h @@ -14,16 +14,7 @@ #ifndef _AO_PINS_H_ #define _AO_PINS_H_ -#define HAS_BEEP 0 - -#define B_USER_PORT (&stm_gpioa) -#define B_USER_PIN 0 - -#define LED_GREEN_PORT (&stm_gpioc) -#define LED_GREEN_PIN 5 -#define LED_RED_PORT (&stm_gpioe) -#define LED_RED_PIN 3 - +/* Clock tree configuration */ #define AO_HSE 8000000 /* fed from st/link processor */ #define AO_HSE_BYPASS 1 /* no xtal, directly fed */ @@ -43,4 +34,22 @@ #define DEBUG_THE_CLOCK 1 +#define HAS_USB 0 +#define HAS_BEEP 0 + +#define B_USER_PORT (&stm_gpioa) +#define B_USER_PIN 0 + +/* LEDs */ + +#define HAS_LED 1 + +#define LED_0_PORT (&stm_gpioc) +#define LED_0_PIN 5 +#define LED_GREEN (1 << 0) + +#define LED_1_PORT (&stm_gpioe) +#define LED_1_PIN 3 +#define LED_RED (1 << 1) + #endif /* _AO_PINS_H_ */ diff --git a/src/stm32f4/ao_arch.h b/src/stm32f4/ao_arch.h index 805d756d..73eb793f 100644 --- a/src/stm32f4/ao_arch.h +++ b/src/stm32f4/ao_arch.h @@ -29,9 +29,6 @@ #define ao_arch_task_members\ uint32_t *sp; /* saved stack pointer */ -#define ao_arch_block_interrupts() asm("cpsid i") -#define ao_arch_release_interrupts() asm("cpsie i") - #define ao_arch_naked_declare __attribute__((naked)) #define ao_arch_naked_define diff --git a/src/stm32f4/ao_arch_funcs.h b/src/stm32f4/ao_arch_funcs.h index 252fe77a..8c0da03b 100644 --- a/src/stm32f4/ao_arch_funcs.h +++ b/src/stm32f4/ao_arch_funcs.h @@ -15,6 +15,234 @@ #ifndef _AO_ARCH_FUNCS_H_ #define _AO_ARCH_FUNCS_H_ +/* task functions */ + +#define ARM_PUSH32(stack, val) (*(--(stack)) = (val)) + +typedef uint32_t ao_arch_irq_t; + +static inline void +ao_arch_block_interrupts(void) { +#ifdef AO_NONMASK_INTERRUPTS + asm("msr basepri,%0" : : "r" (AO_STM_NVIC_BASEPRI_MASK)); +#else + asm("cpsid i"); +#endif +} + +static inline void +ao_arch_release_interrupts(void) { +#ifdef AO_NONMASK_INTERRUPTS + asm("msr basepri,%0" : : "r" (0x0)); +#else + asm("cpsie i"); +#endif +} + +static inline uint32_t +ao_arch_irqsave(void) { + uint32_t val; +#ifdef AO_NONMASK_INTERRUPTS + asm("mrs %0,basepri" : "=r" (val)); +#else + asm("mrs %0,primask" : "=r" (val)); +#endif + ao_arch_block_interrupts(); + return val; +} + +static inline void +ao_arch_irqrestore(uint32_t basepri) { +#ifdef AO_NONMASK_INTERRUPTS + asm("msr basepri,%0" : : "r" (basepri)); +#else + asm("msr primask,%0" : : "r" (basepri)); +#endif +} + +static inline void +ao_arch_memory_barrier() { + asm volatile("" ::: "memory"); +} + +static inline void +ao_arch_irq_check(void) { +#ifdef AO_NONMASK_INTERRUPTS + uint32_t basepri; + asm("mrs %0,basepri" : "=r" (basepri)); + if (basepri == 0) + ao_panic(AO_PANIC_IRQ); +#else + uint32_t primask; + asm("mrs %0,primask" : "=r" (primask)); + if ((primask & 1) == 0) + ao_panic(AO_PANIC_IRQ); +#endif +} + +#if HAS_TASK +static inline void +ao_arch_init_stack(struct ao_task *task, void *start) +{ + uint32_t *sp = (uint32_t *) ((void*) task->stack + AO_STACK_SIZE); + uint32_t a = (uint32_t) start; + int i; + + /* Return address (goes into LR) */ + ARM_PUSH32(sp, a); + + /* Clear register values r0-r12 */ + i = 13; + while (i--) + ARM_PUSH32(sp, 0); + + /* APSR */ + ARM_PUSH32(sp, 0); + + /* Clear register values s0-s31 */ + i = 32; + while (i--) + ARM_PUSH32(sp, 0); + + /* FPSCR */ + ARM_PUSH32(sp, 0); + + /* BASEPRI with interrupts enabled */ + ARM_PUSH32(sp, 0); + + task->sp = sp; +} + +static inline void ao_arch_save_regs(void) { + /* Save general registers */ + asm("push {r0-r12,lr}"); + + /* Save APSR */ + asm("mrs r0,apsr"); + asm("push {r0}"); + + /* Save FPU registers */ + asm("vpush {s0-s15}"); + asm("vpush {s16-s31}"); + + /* Save FPSCR */ + asm("vmrs r0,fpscr"); + asm("push {r0}"); + +#ifdef AO_NONMASK_INTERRUPTS + /* Save BASEPRI */ + asm("mrs r0,basepri"); +#else + /* Save PRIMASK */ + asm("mrs r0,primask"); +#endif + asm("push {r0}"); +} + +static inline void ao_arch_save_stack(void) { + uint32_t *sp; + asm("mov %0,sp" : "=&r" (sp) ); + ao_cur_task->sp = (sp); +} + +static inline void ao_arch_restore_stack(void) { + /* Switch stacks */ + asm("mov sp, %0" : : "r" (ao_cur_task->sp) ); + +#ifdef AO_NONMASK_INTERRUPTS + /* Restore BASEPRI */ + asm("pop {r0}"); + asm("msr basepri,r0"); +#else + /* Restore PRIMASK */ + asm("pop {r0}"); + asm("msr primask,r0"); +#endif + + /* Restore FPSCR */ + asm("pop {r0}"); + asm("vmsr fpscr,r0"); + + /* Restore FPU registers */ + asm("vpop {s16-s31}"); + asm("vpop {s0-s15}"); + + /* Restore APSR */ + asm("pop {r0}"); + asm("msr apsr_nczvq,r0"); + + /* Restore general registers */ + asm("pop {r0-r12,lr}\n"); + + /* Return to calling function */ + asm("bx lr"); +} + +#ifndef HAS_SAMPLE_PROFILE +#define HAS_SAMPLE_PROFILE 0 +#endif + +#if DEBUG +#define HAS_ARCH_VALIDATE_CUR_STACK 1 + +static inline void +ao_validate_cur_stack(void) +{ + uint8_t *psp; + + asm("mrs %0,psp" : "=&r" (psp)); + if (ao_cur_task && + psp <= ao_cur_task->stack && + psp >= ao_cur_task->stack - 256) + ao_panic(AO_PANIC_STACK); +} +#endif + +#if !HAS_SAMPLE_PROFILE +#define HAS_ARCH_START_SCHEDULER 1 + +static inline void ao_arch_start_scheduler(void) { + uint32_t sp; + uint32_t control; + + asm("mrs %0,msp" : "=&r" (sp)); + asm("msr psp,%0" : : "r" (sp)); + asm("mrs %0,control" : "=r" (control)); + control |= (1 << 1); + asm("msr control,%0" : : "r" (control)); + asm("isb"); +} +#endif + +#define ao_arch_isr_stack() + +#endif + +static inline void +ao_arch_wait_interrupt(void) { +#ifdef AO_NONMASK_INTERRUPTS + asm( + "dsb\n" /* Serialize data */ + "isb\n" /* Serialize instructions */ + "cpsid i\n" /* Block all interrupts */ + "msr basepri,%0\n" /* Allow all interrupts through basepri */ + "wfi\n" /* Wait for an interrupt */ + "cpsie i\n" /* Allow all interrupts */ + "msr basepri,%1\n" /* Block interrupts through basepri */ + : : "r" (0), "r" (AO_STM_NVIC_BASEPRI_MASK)); +#else + asm("\twfi\n"); + ao_arch_release_interrupts(); + ao_arch_block_interrupts(); +#endif +} + +#define ao_arch_critical(b) do { \ + uint32_t __mask = ao_arch_irqsave(); \ + do { b } while (0); \ + ao_arch_irqrestore(__mask); \ + } while (0) + /* GPIO functions */ #define ao_power_register(gpio) diff --git a/src/stmf0/ao_led.c b/src/stmf0/ao_led.c deleted file mode 100644 index a162932a..00000000 --- a/src/stmf0/ao_led.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#include "ao.h" - -uint16_t ao_led_enable; - -void -ao_led_on(uint16_t colors) -{ -#ifdef LED_PORT - LED_PORT->bsrr = (colors & ao_led_enable); -#else -#ifdef LED_PORT_0 - LED_PORT_0->bsrr = ((colors & ao_led_enable) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT; -#endif -#ifdef LED_PORT_1 - LED_PORT_1->bsrr = ((colors & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT; -#endif -#endif -} - -void -ao_led_off(uint16_t colors) -{ -#ifdef LED_PORT - LED_PORT->bsrr = (uint32_t) (colors & ao_led_enable) << 16; -#else -#ifdef LED_PORT_0 - LED_PORT_0->bsrr = ((uint32_t) (colors & ao_led_enable) & LED_PORT_0_MASK) << (LED_PORT_0_SHIFT + 16); -#endif -#ifdef LED_PORT_1 - LED_PORT_1->bsrr = ((uint32_t) (colors & ao_led_enable) & LED_PORT_1_MASK) << (LED_PORT_1_SHIFT + 16); -#endif -#endif -} - -void -ao_led_set(uint16_t colors) -{ - uint16_t on = colors & ao_led_enable; - uint16_t off = ~colors & ao_led_enable; - - ao_led_off(off); - ao_led_on(on); -} - -void -ao_led_toggle(uint16_t colors) -{ -#ifdef LED_PORT - LED_PORT->odr ^= (colors & ao_led_enable); -#else -#ifdef LED_PORT_0 - LED_PORT_0->odr ^= ((colors & ao_led_enable) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT; -#endif -#ifdef LED_PORT_1 - LED_PORT_1->odr ^= ((colors & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT; -#endif -#endif -} - -void -ao_led_for(uint16_t colors, uint16_t ticks) -{ - ao_led_on(colors); - ao_delay(ticks); - ao_led_off(colors); -} - -#define init_led_pin(port, bit) do { \ - stm_moder_set(port, bit, STM_MODER_OUTPUT); \ - stm_otyper_set(port, bit, STM_OTYPER_PUSH_PULL); \ - } while (0) - -void -ao_led_init(uint16_t enable) -{ - int bit; - - ao_led_enable = enable; -#ifdef LED_PORT - stm_rcc.ahbenr |= (1 << LED_PORT_ENABLE); - LED_PORT->odr &= ~enable; -#else -#ifdef LED_PORT_0 - stm_rcc.ahbenr |= (1 << LED_PORT_0_ENABLE); - LED_PORT_0->odr &= ~((enable & ao_led_enable) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT; -#endif -#ifdef LED_PORT_1 - stm_rcc.ahbenr |= (1 << LED_PORT_1_ENABLE); - LED_PORT_1->odr &= ~((enable & ao_led_enable) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT; -#endif -#endif - for (bit = 0; bit < 16; bit++) { - if (enable & (1 << bit)) { -#ifdef LED_PORT - init_led_pin(LED_PORT, bit); -#else -#ifdef LED_PORT_0 - if (LED_PORT_0_MASK & (1 << bit)) - init_led_pin(LED_PORT_0, bit + LED_PORT_0_SHIFT); -#endif -#ifdef LED_PORT_1 - if (LED_PORT_1_MASK & (1 << bit)) - init_led_pin(LED_PORT_1, bit + LED_PORT_1_SHIFT); -#endif -#endif - } - } -} diff --git a/src/stmf0/ao_led_stmf0.c b/src/stmf0/ao_led_stmf0.c new file mode 100644 index 00000000..1564535e --- /dev/null +++ b/src/stmf0/ao_led_stmf0.c @@ -0,0 +1,123 @@ +/* + * Copyright © 2012 Keith Packard + * + * 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. + */ + +#include "ao.h" + +void +ao_led_on(AO_LED_TYPE colors) +{ +#ifdef LED_PORT + LED_PORT->bsrr = (colors & LEDS_AVAILABLE); +#else +#ifdef LED_PORT_0 + LED_PORT_0->bsrr = ((colors & LEDS_AVAILABLE) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT; +#endif +#ifdef LED_PORT_1 + LED_PORT_1->bsrr = ((colors & LEDS_AVAILABLE) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT; +#endif +#endif +} + +void +ao_led_off(AO_LED_TYPE colors) +{ +#ifdef LED_PORT + LED_PORT->bsrr = (uint32_t) (colors & LEDS_AVAILABLE) << 16; +#else +#ifdef LED_PORT_0 + LED_PORT_0->bsrr = ((uint32_t) (colors & LEDS_AVAILABLE) & LED_PORT_0_MASK) << (LED_PORT_0_SHIFT + 16); +#endif +#ifdef LED_PORT_1 + LED_PORT_1->bsrr = ((uint32_t) (colors & LEDS_AVAILABLE) & LED_PORT_1_MASK) << (LED_PORT_1_SHIFT + 16); +#endif +#endif +} + +void +ao_led_set(AO_LED_TYPE colors) +{ + AO_LED_TYPE on = colors & LEDS_AVAILABLE; + AO_LED_TYPE off = ~colors & LEDS_AVAILABLE; + + ao_led_off(off); + ao_led_on(on); +} + +void +ao_led_toggle(AO_LED_TYPE colors) +{ +#ifdef LED_PORT + LED_PORT->odr ^= (colors & LEDS_AVAILABLE); +#else +#ifdef LED_PORT_0 + LED_PORT_0->odr ^= ((colors & LEDS_AVAILABLE) & LED_PORT_0_MASK) << LED_PORT_0_SHIFT; +#endif +#ifdef LED_PORT_1 + LED_PORT_1->odr ^= ((colors & LEDS_AVAILABLE) & LED_PORT_1_MASK) << LED_PORT_1_SHIFT; +#endif +#endif +} + +void +ao_led_for(AO_LED_TYPE colors, AO_TICK_TYPE ticks) +{ + ao_led_on(colors); + ao_delay(ticks); + ao_led_off(colors); +} + +#define init_led_pin(port, bit) do { \ + stm_moder_set(port, bit, STM_MODER_OUTPUT); \ + stm_otyper_set(port, bit, STM_OTYPER_PUSH_PULL); \ + } while (0) + +void +ao_led_init(void) +{ + int bit; + +#ifdef LED_PORT + stm_rcc.ahbenr |= (1 << LED_PORT_ENABLE); + LED_PORT->odr &= ~LEDS_AVAILABLE; +#else +#ifdef LED_PORT_0 + stm_rcc.ahbenr |= (1 << LED_PORT_0_ENABLE); + LED_PORT_0->odr &= (uint32_t) ~(LEDS_AVAILABLE & LED_PORT_0_MASK) << LED_PORT_0_SHIFT; +#endif +#ifdef LED_PORT_1 + stm_rcc.ahbenr |= (1 << LED_PORT_1_ENABLE); + LED_PORT_1->odr &= (uint32_t) ~(LEDS_AVAILABLE & LED_PORT_1_MASK) << LED_PORT_1_SHIFT; +#endif +#endif + for (bit = 0; bit < 16; bit++) { + if (LEDS_AVAILABLE & (1 << bit)) { +#ifdef LED_PORT + init_led_pin(LED_PORT, bit); +#else +#ifdef LED_PORT_0 + if (LED_PORT_0_MASK & (1 << bit)) + init_led_pin(LED_PORT_0, bit + LED_PORT_0_SHIFT); +#endif +#ifdef LED_PORT_1 + if (LED_PORT_1_MASK & (1 << bit)) + init_led_pin(LED_PORT_1, bit + LED_PORT_1_SHIFT); +#endif +#endif + } + } +} diff --git a/src/teleballoon-v2.0/Makefile b/src/teleballoon-v2.0/Makefile index cb2ce253..ddbfaf5f 100644 --- a/src/teleballoon-v2.0/Makefile +++ b/src/teleballoon-v2.0/Makefile @@ -46,7 +46,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/teleballoon-v2.0/ao_teleballoon.c b/src/teleballoon-v2.0/ao_teleballoon.c index acb11f44..94393da0 100644 --- a/src/teleballoon-v2.0/ao_teleballoon.c +++ b/src/teleballoon-v2.0/ao_teleballoon.c @@ -43,8 +43,8 @@ main(void) ao_task_init(); ao_serial_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_RED); + ao_led_init(); + ao_led_on(LEDS_AVAILABLE); ao_timer_init(); ao_spi_init(); @@ -87,7 +87,8 @@ main(void) #if HAS_SAMPLE_PROFILE ao_sample_profile_init(); #endif - + ao_led_off(LEDS_AVAILABLE); + ao_start_scheduler(); return 0; } diff --git a/src/telebt-v3.0/Makefile b/src/telebt-v3.0/Makefile index 4636c046..9892ad5f 100644 --- a/src/telebt-v3.0/Makefile +++ b/src/telebt-v3.0/Makefile @@ -37,7 +37,7 @@ ALTOS_SRC = \ ao_config.c \ ao_data.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telebt-v3.0/ao_telebt.c b/src/telebt-v3.0/ao_telebt.c index 63633c90..3d48b6b9 100644 --- a/src/telebt-v3.0/ao_telebt.c +++ b/src/telebt-v3.0/ao_telebt.c @@ -34,7 +34,7 @@ main(void) ao_clock_init(); ao_task_init(); - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); ao_led_on(LEDS_AVAILABLE); ao_timer_init(); diff --git a/src/telebt-v4.0/Makefile b/src/telebt-v4.0/Makefile index 38ac7513..4ad3287d 100644 --- a/src/telebt-v4.0/Makefile +++ b/src/telebt-v4.0/Makefile @@ -27,7 +27,7 @@ ALTOS_SRC = \ ao_config.c \ ao_data.c \ ao_task.c \ - ao_led.c \ + ao_led_stmf0.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telebt-v4.0/ao_telebt.c b/src/telebt-v4.0/ao_telebt.c index 953ec4bc..7c3c6e2a 100644 --- a/src/telebt-v4.0/ao_telebt.c +++ b/src/telebt-v4.0/ao_telebt.c @@ -29,7 +29,7 @@ main(void) ao_clock_init(); ao_task_init(); - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); ao_led_on(LEDS_AVAILABLE); ao_timer_init(); diff --git a/src/teledongle-v1.8/Makefile b/src/teledongle-v1.8/Makefile index 6c05ce9f..461b5855 100644 --- a/src/teledongle-v1.8/Makefile +++ b/src/teledongle-v1.8/Makefile @@ -38,7 +38,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/teledongle-v3.0/ao_teledongle.c b/src/teledongle-v3.0/ao_teledongle.c index 32899af2..69abea6e 100644 --- a/src/teledongle-v3.0/ao_teledongle.c +++ b/src/teledongle-v3.0/ao_teledongle.c @@ -31,7 +31,7 @@ main(void) #endif ao_task_init(); - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); ao_led_on(LEDS_AVAILABLE); ao_timer_init(); diff --git a/src/telefireeight-v1.0/ao_pins.h b/src/telefireeight-v1.0/ao_pins.h index 15e1fa11..ef533b36 100644 --- a/src/telefireeight-v1.0/ao_pins.h +++ b/src/telefireeight-v1.0/ao_pins.h @@ -107,7 +107,7 @@ #define AO_CC1200_INT_GPIO 2 #define AO_CC1200_INT_GPIO_IOCFG CC1200_IOCFG2 -#define LED_PER_LED 1 +#define HAS_LED 1 #define LED_TYPE uint16_t /* Continuity leds 1-8 */ @@ -128,14 +128,8 @@ #define LED_7_PORT (&stm_gpioa) #define LED_7_PIN 10 -#define LED_PIN_CONTINUITY_0 0 -#define LED_PIN_CONTINUITY_1 1 -#define LED_PIN_CONTINUITY_2 2 -#define LED_PIN_CONTINUITY_3 3 -#define LED_PIN_CONTINUITY_4 4 -#define LED_PIN_CONTINUITY_5 5 -#define LED_PIN_CONTINUITY_6 6 -#define LED_PIN_CONTINUITY_7 7 +#define AO_LED_CONTINUITY(c) (1 << (c)) +#define AO_LED_CONTINUITY_MASK (0xff) /* ARM */ #define LED_8_PORT (&stm_gpioe) @@ -151,19 +145,10 @@ #define LED_11_PORT (&stm_gpioe) #define LED_11_PIN 6 -#define LED_PIN_GREEN 9 -#define LED_PIN_AMBER 10 -#define LED_PIN_RED 11 - -#define AO_LED_CONTINUITY(c) (1 << (c)) -#define AO_LED_CONTINUITY_MASK (0xff) - -#define AO_LED_ARMED (1 << LED_PIN_ARMED) -#define AO_LED_GREEN (1 << LED_PIN_GREEN) -#define AO_LED_AMBER (1 << LED_PIN_AMBER) -#define AO_LED_RED (1 << LED_PIN_RED) - -#define LEDS_AVAILABLE (0xfff) +#define AO_LED_ARMED AO_LED_8 +#define AO_LED_GREEN AO_LED_9 +#define AO_LED_AMBER AO_LED_10 +#define AO_LED_RED AO_LED_11 /* Alarm A */ #define AO_SIREN diff --git a/src/telefireeight-v1.0/ao_telefireeight.c b/src/telefireeight-v1.0/ao_telefireeight.c index bdcf3213..89541a02 100644 --- a/src/telefireeight-v1.0/ao_telefireeight.c +++ b/src/telefireeight-v1.0/ao_telefireeight.c @@ -26,7 +26,8 @@ main(void) { ao_clock_init(); - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); + ao_led_on(LEDS_AVAILABLE); ao_task_init(); @@ -51,5 +52,7 @@ main(void) // ao_radio_cmac_cmd_init(); + ao_led_off(LEDS_AVAILABLE); + ao_start_scheduler(); } diff --git a/src/telefireone-v1.0/Makefile b/src/telefireone-v1.0/Makefile index 53f088cb..773c8f69 100644 --- a/src/telefireone-v1.0/Makefile +++ b/src/telefireone-v1.0/Makefile @@ -34,7 +34,7 @@ ALTOS_SRC = \ ao_data.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telefiretwo-v0.1/Makefile b/src/telefiretwo-v0.1/Makefile index 6454d6fd..72171fac 100644 --- a/src/telefiretwo-v0.1/Makefile +++ b/src/telefiretwo-v0.1/Makefile @@ -33,7 +33,7 @@ ALTOS_SRC = \ ao_data.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telefiretwo-v0.1/ao_telefiretwo.c b/src/telefiretwo-v0.1/ao_telefiretwo.c index bdcf3213..89541a02 100644 --- a/src/telefiretwo-v0.1/ao_telefiretwo.c +++ b/src/telefiretwo-v0.1/ao_telefiretwo.c @@ -26,7 +26,8 @@ main(void) { ao_clock_init(); - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); + ao_led_on(LEDS_AVAILABLE); ao_task_init(); @@ -51,5 +52,7 @@ main(void) // ao_radio_cmac_cmd_init(); + ao_led_off(LEDS_AVAILABLE); + ao_start_scheduler(); } diff --git a/src/telefiretwo-v0.2/Makefile b/src/telefiretwo-v0.2/Makefile index 30985f9c..f43ece71 100644 --- a/src/telefiretwo-v0.2/Makefile +++ b/src/telefiretwo-v0.2/Makefile @@ -33,7 +33,7 @@ ALTOS_SRC = \ ao_data.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telegps-v0.1/Makefile b/src/telegps-v0.1/Makefile index 46eb0ac5..0365f91f 100644 --- a/src/telegps-v0.1/Makefile +++ b/src/telegps-v0.1/Makefile @@ -44,7 +44,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telegps-v2.0/Makefile b/src/telegps-v2.0/Makefile index 19d088d3..617efa65 100644 --- a/src/telegps-v2.0/Makefile +++ b/src/telegps-v2.0/Makefile @@ -21,7 +21,7 @@ INC = \ ALTOS_SRC = \ ao_adc_stm.c \ - ao_led.c \ + ao_led_stmf0.c \ ao_interrupt.c \ ao_boot_chain.c \ ao_product.c \ diff --git a/src/telegps-v2.0/ao_telegps.c b/src/telegps-v2.0/ao_telegps.c index 998c2008..1ba67f67 100644 --- a/src/telegps-v2.0/ao_telegps.c +++ b/src/telegps-v2.0/ao_telegps.c @@ -29,8 +29,8 @@ main(void) ao_cmd_init(); ao_config_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_GREEN); + ao_led_init(); + ao_led_on(LEDS_AVAILABLE); /* internal systems */ ao_timer_init(); @@ -53,8 +53,7 @@ main(void) ao_telemetry_init(); ao_tracker_init(); - ao_led_off(AO_LED_GREEN); + ao_led_off(LEDS_AVAILABLE); ao_start_scheduler(); - return 0; } diff --git a/src/telelco-v0.2-cc1200/Makefile b/src/telelco-v0.2-cc1200/Makefile index 4ccf494c..9307aa2d 100644 --- a/src/telelco-v0.2-cc1200/Makefile +++ b/src/telelco-v0.2-cc1200/Makefile @@ -40,7 +40,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telelco-v0.2-cc1200/ao_telelco.c b/src/telelco-v0.2-cc1200/ao_telelco.c index 3266da00..26f49d59 100644 --- a/src/telelco-v0.2-cc1200/ao_telelco.c +++ b/src/telelco-v0.2-cc1200/ao_telelco.c @@ -45,9 +45,8 @@ main(void) ao_timer_init(); ao_dma_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_GREEN); - + ao_led_init(); + ao_led_on(LEDS_AVAILABLE); ao_spi_init(); ao_exti_init(); @@ -74,6 +73,8 @@ main(void) ao_lco_cmd_init(); // ao_radio_cmac_cmd_init(); + ao_led_off(LEDS_AVAILABLE); + ao_start_scheduler(); return 0; } diff --git a/src/telelco-v0.2/Makefile b/src/telelco-v0.2/Makefile index 8279cac1..91ae67f0 100644 --- a/src/telelco-v0.2/Makefile +++ b/src/telelco-v0.2/Makefile @@ -39,7 +39,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telelco-v0.2/ao_telelco.c b/src/telelco-v0.2/ao_telelco.c index 7b04d386..4eba3597 100644 --- a/src/telelco-v0.2/ao_telelco.c +++ b/src/telelco-v0.2/ao_telelco.c @@ -35,9 +35,9 @@ int main(void) { ao_clock_init(); - - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_GREEN); + + ao_led_init(); + ao_led_on(LEDS_AVAILABLE); ao_task_init(); ao_timer_init(); @@ -55,17 +55,19 @@ main(void) ao_button_init(); ao_eeprom_init(); - + ao_radio_init(); ao_usb_init(); ao_config_init(); - + ao_lco_init(); ao_lco_cmd_init(); // ao_radio_cmac_cmd_init(); - + + ao_led_off(LEDS_AVAILABLE); + ao_start_scheduler(); return 0; } diff --git a/src/telelco-v0.3/Makefile b/src/telelco-v0.3/Makefile index c2592bf8..567ddf41 100644 --- a/src/telelco-v0.3/Makefile +++ b/src/telelco-v0.3/Makefile @@ -40,7 +40,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telelco-v0.3/ao_telelco.c b/src/telelco-v0.3/ao_telelco.c index 7b04d386..c2ca68aa 100644 --- a/src/telelco-v0.3/ao_telelco.c +++ b/src/telelco-v0.3/ao_telelco.c @@ -36,8 +36,8 @@ main(void) { ao_clock_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_GREEN); + ao_led_init(); + ao_led_on(LEDS_AVAILABLE); ao_task_init(); ao_timer_init(); @@ -66,6 +66,8 @@ main(void) ao_lco_cmd_init(); // ao_radio_cmac_cmd_init(); + ao_led_off(LEDS_AVAILABLE); + ao_start_scheduler(); return 0; } diff --git a/src/telelco-v2.0/ao_lco_v2.c b/src/telelco-v2.0/ao_lco_v2.c index 90324cc8..daecf380 100644 --- a/src/telelco-v2.0/ao_lco_v2.c +++ b/src/telelco-v2.0/ao_lco_v2.c @@ -243,9 +243,9 @@ ao_lco_display_test() ao_seven_segment_set(AO_LCO_BOX_DIGIT_1, 8 | 0x10); ao_seven_segment_set(AO_LCO_BOX_DIGIT_10, 8 | 0x10); ao_mutex_put(&ao_lco_display_mutex); - ao_led_on(LEDS_AVAILABLE); + ao_led_on(AO_LEDS_AVAILABLE); ao_delay(AO_MS_TO_TICKS(1000)); - ao_led_off(LEDS_AVAILABLE); + ao_led_off(AO_LEDS_AVAILABLE); } static void diff --git a/src/telelco-v2.0/ao_pins.h b/src/telelco-v2.0/ao_pins.h index 95998dc7..ea709c1d 100644 --- a/src/telelco-v2.0/ao_pins.h +++ b/src/telelco-v2.0/ao_pins.h @@ -99,13 +99,7 @@ #define LOW_LEVEL_DEBUG 0 -#define LED_PER_LED 1 -#define LED_TYPE uint16_t - -#define LED_ENABLE_BITS ((1 << STM_RCC_AHBENR_GPIOAEN) | \ - (1 << STM_RCC_AHBENR_GPIOCEN) | \ - (1 << STM_RCC_AHBENR_GPIODEN) | \ - (1 << STM_RCC_AHBENR_GPIOEEN)) +#define HAS_LED 1 /* PC7 - PC9, LED 0 - 2 */ #define LED_0_PORT (&stm_gpioc) @@ -147,56 +141,23 @@ #define LED_15_PORT (&stm_gpioa) #define LED_15_PIN 5 -#define LED_PIN_RED 0 -#define LED_PIN_AMBER 1 -#define LED_PIN_GREEN 2 -#define LED_PIN_BOX 3 -#define LED_PIN_PAD 4 -#define LED_PIN_DRAG 5 -#define LED_PIN_CONTINUITY_7 6 -#define LED_PIN_CONTINUITY_6 7 -#define LED_PIN_CONTINUITY_5 8 -#define LED_PIN_CONTINUITY_4 9 -#define LED_PIN_CONTINUITY_3 10 -#define LED_PIN_CONTINUITY_2 11 -#define LED_PIN_CONTINUITY_1 12 -#define LED_PIN_CONTINUITY_0 13 -#define LED_PIN_REMOTE_ARM 14 -#define LED_PIN_FIRE 15 -#define AO_LED_RED (1 << LED_PIN_RED) -#define AO_LED_AMBER (1 << LED_PIN_AMBER) -#define AO_LED_GREEN (1 << LED_PIN_GREEN) -#define AO_LED_BOX (1 << LED_PIN_BOX) -#define AO_LED_PAD (1 << LED_PIN_PAD) -#define AO_LED_DRAG (1 << LED_PIN_DRAG) -#define AO_LED_CONTINUITY_7 (1 << LED_PIN_CONTINUITY_7) -#define AO_LED_CONTINUITY_6 (1 << LED_PIN_CONTINUITY_6) -#define AO_LED_CONTINUITY_5 (1 << LED_PIN_CONTINUITY_5) -#define AO_LED_CONTINUITY_4 (1 << LED_PIN_CONTINUITY_4) -#define AO_LED_CONTINUITY_3 (1 << LED_PIN_CONTINUITY_3) -#define AO_LED_CONTINUITY_2 (1 << LED_PIN_CONTINUITY_2) -#define AO_LED_CONTINUITY_1 (1 << LED_PIN_CONTINUITY_1) -#define AO_LED_CONTINUITY_0 (1 << LED_PIN_CONTINUITY_0) +#define AO_LED_RED AO_LED_0 +#define AO_LED_AMBER AO_LED_1 +#define AO_LED_GREEN AO_LED_2 +#define AO_LED_BOX AO_LED_3 +#define AO_LED_PAD AO_LED_4 +#define AO_LED_DRAG AO_LED_5 +#define AO_LED_CONTINUITY_7 AO_LED_6 +#define AO_LED_CONTINUITY_6 AO_LED_7 +#define AO_LED_CONTINUITY_5 AO_LED_8 +#define AO_LED_CONTINUITY_4 AO_LED_9 +#define AO_LED_CONTINUITY_3 AO_LED_10 +#define AO_LED_CONTINUITY_2 AO_LED_11 +#define AO_LED_CONTINUITY_1 AO_LED_12 +#define AO_LED_CONTINUITY_0 AO_LED_13 #define AO_LED_CONTINUITY_NUM 8 -#define AO_LED_REMOTE_ARM (1 << LED_PIN_REMOTE_ARM) -#define AO_LED_FIRE (1 << LED_PIN_FIRE) - -#define LEDS_AVAILABLE (AO_LED_RED | \ - AO_LED_AMBER | \ - AO_LED_GREEN | \ - AO_LED_BOX | \ - AO_LED_PAD | \ - AO_LED_DRAG | \ - AO_LED_CONTINUITY_7 | \ - AO_LED_CONTINUITY_6 | \ - AO_LED_CONTINUITY_5 | \ - AO_LED_CONTINUITY_4 | \ - AO_LED_CONTINUITY_3 | \ - AO_LED_CONTINUITY_2 | \ - AO_LED_CONTINUITY_1 | \ - AO_LED_CONTINUITY_0 | \ - AO_LED_REMOTE_ARM | \ - AO_LED_FIRE) +#define AO_LED_REMOTE_ARM AO_LED_14 +#define AO_LED_FIRE AO_LED_15 /* LCD displays */ diff --git a/src/telelco-v2.0/ao_telelco.c b/src/telelco-v2.0/ao_telelco.c index 9693c657..59582569 100644 --- a/src/telelco-v2.0/ao_telelco.c +++ b/src/telelco-v2.0/ao_telelco.c @@ -37,8 +37,8 @@ main(void) { ao_clock_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_GREEN); + ao_led_init(); + ao_led_on(LEDS_AVAILABLE); ao_task_init(); ao_timer_init(); @@ -68,6 +68,8 @@ main(void) ao_lco_cmd_init(); // ao_radio_cmac_cmd_init(); + ao_led_off(LEDS_AVAILABLE); + ao_start_scheduler(); return 0; } diff --git a/src/telelcotwo-v0.1/Makefile b/src/telelcotwo-v0.1/Makefile index c68f3eb5..6a114aae 100644 --- a/src/telelcotwo-v0.1/Makefile +++ b/src/telelcotwo-v0.1/Makefile @@ -36,7 +36,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telelcotwo-v0.1/ao_telelcotwo.c b/src/telelcotwo-v0.1/ao_telelcotwo.c index b3fcd200..6ced1912 100644 --- a/src/telelcotwo-v0.1/ao_telelcotwo.c +++ b/src/telelcotwo-v0.1/ao_telelcotwo.c @@ -34,8 +34,8 @@ main(void) { ao_clock_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_GREEN); + ao_led_init(); + ao_led_on(LEDS_AVAILABLE); ao_beep_init(); ao_task_init(); @@ -61,6 +61,8 @@ main(void) ao_lco_cmd_init(); // ao_radio_cmac_cmd_init(); + ao_led_off(LEDS_AVAILABLE); + ao_start_scheduler(); return 0; } diff --git a/src/telemega-v0.1/Makefile b/src/telemega-v0.1/Makefile index 78cfdefd..fde35aae 100644 --- a/src/telemega-v0.1/Makefile +++ b/src/telemega-v0.1/Makefile @@ -53,7 +53,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telemega-v0.1/ao_telemega.c b/src/telemega-v0.1/ao_telemega.c index f8b7ecfa..d6ecbf31 100644 --- a/src/telemega-v0.1/ao_telemega.c +++ b/src/telemega-v0.1/ao_telemega.c @@ -45,8 +45,8 @@ main(void) ao_task_init(); ao_serial_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_GREEN); + ao_led_init(); + ao_led_on(LEDS_AVAILABLE); ao_timer_init(); ao_i2c_init(); @@ -98,6 +98,7 @@ main(void) ao_sample_profile_init(); #endif + ao_led_off(LEDS_AVAILABLE); ao_start_scheduler(); return 0; } diff --git a/src/telemega-v1.0/Makefile b/src/telemega-v1.0/Makefile index 372d53b8..62eda4ad 100644 --- a/src/telemega-v1.0/Makefile +++ b/src/telemega-v1.0/Makefile @@ -55,7 +55,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telemega-v1.0/ao_telemega.c b/src/telemega-v1.0/ao_telemega.c index 50428b61..328c17ff 100644 --- a/src/telemega-v1.0/ao_telemega.c +++ b/src/telemega-v1.0/ao_telemega.c @@ -45,7 +45,7 @@ main(void) ao_task_init(); ao_serial_init(); - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); ao_led_on(LEDS_AVAILABLE); ao_timer_init(); diff --git a/src/telemega-v2.0/Makefile b/src/telemega-v2.0/Makefile index 2592587a..78829fff 100644 --- a/src/telemega-v2.0/Makefile +++ b/src/telemega-v2.0/Makefile @@ -55,7 +55,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telemega-v2.0/ao_telemega.c b/src/telemega-v2.0/ao_telemega.c index 6a58547e..623e8d1e 100644 --- a/src/telemega-v2.0/ao_telemega.c +++ b/src/telemega-v2.0/ao_telemega.c @@ -46,7 +46,7 @@ main(void) ao_task_init(); ao_serial_init(); - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); ao_led_on(LEDS_AVAILABLE); ao_timer_init(); diff --git a/src/telemega-v3.0/Makefile b/src/telemega-v3.0/Makefile index df0f4dbb..b449b397 100644 --- a/src/telemega-v3.0/Makefile +++ b/src/telemega-v3.0/Makefile @@ -53,7 +53,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telemega-v3.0/ao_telemega.c b/src/telemega-v3.0/ao_telemega.c index 2577f90c..d987c1ec 100644 --- a/src/telemega-v3.0/ao_telemega.c +++ b/src/telemega-v3.0/ao_telemega.c @@ -45,7 +45,7 @@ main(void) ao_task_init(); ao_serial_init(); - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); ao_led_on(LEDS_AVAILABLE); ao_timer_init(); diff --git a/src/telemetrum-v2.0/Makefile b/src/telemetrum-v2.0/Makefile index 0196936b..e0192f61 100644 --- a/src/telemetrum-v2.0/Makefile +++ b/src/telemetrum-v2.0/Makefile @@ -46,7 +46,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telemetrum-v2.0/ao_telemetrum.c b/src/telemetrum-v2.0/ao_telemetrum.c index 65f9be2c..dbf6090c 100644 --- a/src/telemetrum-v2.0/ao_telemetrum.c +++ b/src/telemetrum-v2.0/ao_telemetrum.c @@ -43,7 +43,7 @@ main(void) ao_task_init(); ao_serial_init(); - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); ao_led_on(LEDS_AVAILABLE); ao_timer_init(); diff --git a/src/telemetrum-v3.0/Makefile b/src/telemetrum-v3.0/Makefile index c72e781a..071fd8dd 100644 --- a/src/telemetrum-v3.0/Makefile +++ b/src/telemetrum-v3.0/Makefile @@ -46,7 +46,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/telemetrum-v3.0/ao_telemetrum.c b/src/telemetrum-v3.0/ao_telemetrum.c index 2bb5192a..d75f339d 100644 --- a/src/telemetrum-v3.0/ao_telemetrum.c +++ b/src/telemetrum-v3.0/ao_telemetrum.c @@ -43,8 +43,8 @@ main(void) ao_task_init(); ao_serial_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_RED); + ao_led_init(); + ao_led_on(LEDS_AVAILABLE); ao_timer_init(); ao_spi_init(); @@ -88,6 +88,7 @@ main(void) #if HAS_SAMPLE_PROFILE ao_sample_profile_init(); #endif + ao_led_off(LEDS_AVAILABLE); ao_start_scheduler(); return 0; diff --git a/src/telepyro-v0.1/Makefile b/src/telepyro-v0.1/Makefile index dcac03dc..9b51d466 100644 --- a/src/telepyro-v0.1/Makefile +++ b/src/telepyro-v0.1/Makefile @@ -29,7 +29,7 @@ ALTOS_SRC = \ ao_stdio.c \ ao_task.c \ ao_timer.c \ - ao_led.c \ + ao_led_avr.c \ ao_avr_stdio.c \ ao_romconfig.c \ ao_usb_avr.c \ diff --git a/src/telescience-pwm/Makefile b/src/telescience-pwm/Makefile index 493bd480..10c63d49 100644 --- a/src/telescience-pwm/Makefile +++ b/src/telescience-pwm/Makefile @@ -42,7 +42,7 @@ ALTOS_SRC = \ ao_stdio.c \ ao_task.c \ ao_timer.c \ - ao_led.c \ + ao_led_avr.c \ ao_avr_stdio.c \ ao_romconfig.c \ ao_usb_avr.c \ diff --git a/src/telescience-v0.1/Makefile b/src/telescience-v0.1/Makefile index c55c48e2..8445c64d 100644 --- a/src/telescience-v0.1/Makefile +++ b/src/telescience-v0.1/Makefile @@ -42,7 +42,7 @@ ALTOS_SRC = \ ao_stdio.c \ ao_task.c \ ao_timer.c \ - ao_led.c \ + ao_led_avr.c \ ao_avr_stdio.c \ ao_romconfig.c \ ao_usb_avr.c \ diff --git a/src/telescience-v0.2/Makefile b/src/telescience-v0.2/Makefile index 6b7ea8c7..bc0a1986 100644 --- a/src/telescience-v0.2/Makefile +++ b/src/telescience-v0.2/Makefile @@ -35,7 +35,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/tmgps-v2.0/Makefile b/src/tmgps-v2.0/Makefile index 9e3965c6..8a1293d2 100644 --- a/src/tmgps-v2.0/Makefile +++ b/src/tmgps-v2.0/Makefile @@ -46,7 +46,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ diff --git a/src/usbtrng-v2.0/Makefile b/src/usbtrng-v2.0/Makefile index 49798f1c..678a24de 100644 --- a/src/usbtrng-v2.0/Makefile +++ b/src/usbtrng-v2.0/Makefile @@ -27,7 +27,7 @@ ALTOS_SRC = \ ao_adc_fast.c \ ao_crc_stm.c \ ao_stdio.c \ - ao_led.c \ + ao_led_stmf0.c \ ao_romconfig.c \ ao_boot_chain.c \ ao_cmd.c \ -- cgit v1.2.3 From 71248c899676e0c2f3a478c63dec0d005b2458e6 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 12:03:27 -0700 Subject: altos/stm32f4-disco: Add .gitignore Signed-off-by: Keith Packard --- src/stm32f4-disco/.gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/stm32f4-disco/.gitignore diff --git a/src/stm32f4-disco/.gitignore b/src/stm32f4-disco/.gitignore new file mode 100644 index 00000000..deb5083f --- /dev/null +++ b/src/stm32f4-disco/.gitignore @@ -0,0 +1,3 @@ +stm32f4-disco-*.elf +stm32f4-disco-*.ihx +stm32f4-disco-*.map -- cgit v1.2.3 From 23075d174d2bff8ff3f3deef3c3d90b83da6bd2e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 18:46:52 -0700 Subject: altos/stm32f4: Align stack to 8 bytes This makes sure that doubles are aligned properly when passed on the stack. Signed-off-by: Keith Packard --- src/kernel/ao_task.h | 6 ++---- src/stm32f4/ao_arch.h | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kernel/ao_task.h b/src/kernel/ao_task.h index f3789fa2..709e10c6 100644 --- a/src/kernel/ao_task.h +++ b/src/kernel/ao_task.h @@ -27,14 +27,12 @@ #endif /* arm stacks must be 32-bit aligned */ +#ifndef AO_STACK_ALIGNMENT #ifdef __arm__ #define AO_STACK_ALIGNMENT __attribute__ ((aligned(4))) -#endif -#ifdef SDCC +#else #define AO_STACK_ALIGNMENT #endif -#ifdef __AVR__ -#define AO_STACK_ALIGNMENT #endif /* An AltOS task */ diff --git a/src/stm32f4/ao_arch.h b/src/stm32f4/ao_arch.h index 73eb793f..d4c78f60 100644 --- a/src/stm32f4/ao_arch.h +++ b/src/stm32f4/ao_arch.h @@ -19,9 +19,11 @@ #include #ifndef AO_STACK_SIZE -#define AO_STACK_SIZE 512 +#define AO_STACK_SIZE 1024 #endif +#define AO_STACK_ALIGNMENT __attribute__ ((aligned(8))) + #define AO_PORT_TYPE uint16_t #define ao_arch_nop() asm("nop") -- cgit v1.2.3 From 0b5ac831d2e63a091833c702b07b0331fba32e72 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 18:49:22 -0700 Subject: altos/stm32f4: Add usart driver for usart6 This is what the disco board hooks up. Signed-off-by: Keith Packard --- src/stm32f4/ao_arch.h | 28 ++++ src/stm32f4/ao_arch_funcs.h | 6 + src/stm32f4/ao_interrupt.c | 5 +- src/stm32f4/ao_usart_stm32f4.c | 350 +++++++++++++++++++++++++++++++++++++++++ src/stm32f4/registers.ld | 20 +++ src/stm32f4/stm32f4.h | 317 ++++++++++++++++++++++++++++++++++++- 6 files changed, 723 insertions(+), 3 deletions(-) create mode 100644 src/stm32f4/ao_usart_stm32f4.c diff --git a/src/stm32f4/ao_arch.h b/src/stm32f4/ao_arch.h index d4c78f60..083a4e5b 100644 --- a/src/stm32f4/ao_arch.h +++ b/src/stm32f4/ao_arch.h @@ -100,4 +100,32 @@ #define AO_SYSTICK (AO_HCLK) #define AO_PANIC_DELAY_SCALE (AO_SYSCLK / 12000000) +/* The stm32f413 implements only 4 bits of the priority fields? */ + +#if AO_NONMASK_INTERRUPT +#define AO_STM_NVIC_NONMASK_PRIORITY 0x00 + +/* Set the basepri register to this value to mask all + * non-maskable priorities + */ +#define AO_STM_NVIC_BASEPRI_MASK 0x10 +#endif + +#define AO_STM_NVIC_HIGH_PRIORITY 0x40 +#define AO_STM_NVIC_MED_PRIORITY 0x80 +#define AO_STM_NVIC_LOW_PRIORITY 0xC0 +#define AO_STM_NVIC_CLOCK_PRIORITY 0xf0 + +#define AO_GPIO_MODE_PULL_NONE 0 +#define AO_GPIO_MODE_PULL_UP 4 +#define AO_GPIO_MODE_PULL_DOWN 8 + +/* usart stuff */ + +#define AO_SERIAL_SPEED_4800 4800 +#define AO_SERIAL_SPEED_9600 9600 +#define AO_SERIAL_SPEED_19200 19200 +#define AO_SERIAL_SPEED_57600 57600 +#define AO_SERIAL_SPEED_115200 115200 + #endif /* _AO_ARCH_H_ */ diff --git a/src/stm32f4/ao_arch_funcs.h b/src/stm32f4/ao_arch_funcs.h index 8c0da03b..b1ffb5b6 100644 --- a/src/stm32f4/ao_arch_funcs.h +++ b/src/stm32f4/ao_arch_funcs.h @@ -331,4 +331,10 @@ static inline void ao_disable_port(struct stm_gpio *port) ao_gpio_set_mode(port, bit, mode); \ } while (0) +/* usart */ + +void +ao_usart_init(void); + + #endif /* _AO_ARCH_FUNCS_H_ */ diff --git a/src/stm32f4/ao_interrupt.c b/src/stm32f4/ao_interrupt.c index a00df54b..f1cb8eee 100644 --- a/src/stm32f4/ao_interrupt.c +++ b/src/stm32f4/ao_interrupt.c @@ -119,7 +119,7 @@ isr(spi2) isr(usart1) isr(usart2) isr(usart3) -isr(exti5_10) +isr(exti15_10) isr(rtc_alarm) isr(otg_fs_wkup) isr(tim8_brk_tim12) @@ -231,9 +231,10 @@ const void *stm_interrupt_vector[] = { i(0xd4, usart1), i(0xd8, usart2), i(0xdc, usart3), - i(0xe0, exti5_10), + i(0xe0, exti15_10), i(0xe4, rtc_alarm), i(0xe8, otg_fs_wkup), i(0xec, tim8_brk_tim12), i(0xf0, tim8_up_tim13), + i(0x15c, usart6), }; diff --git a/src/stm32f4/ao_usart_stm32f4.c b/src/stm32f4/ao_usart_stm32f4.c new file mode 100644 index 00000000..28331b1e --- /dev/null +++ b/src/stm32f4/ao_usart_stm32f4.c @@ -0,0 +1,350 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#include +#include + +/* ao_serial_stm.c */ +struct ao_stm_usart { + struct ao_fifo rx_fifo; + struct ao_fifo tx_fifo; + struct stm_usart *reg; + uint32_t clk; + uint8_t tx_running; + uint8_t draining; +#if HAS_SERIAL_SW_FLOW + /* RTS - 0 if we have FIFO space, 1 if not + * CTS - 0 if we can send, 0 if not + */ + struct stm_gpio *gpio_rts; + struct stm_gpio *gpio_cts; + uint8_t pin_rts; + uint8_t pin_cts; + uint8_t rts; +#endif +}; + +static int +_ao_usart_tx_start(struct ao_stm_usart *usart) +{ + if (!ao_fifo_empty(usart->tx_fifo)) { +#if HAS_SERIAL_SW_FLOW + if (usart->gpio_cts && ao_gpio_get(usart->gpio_cts, usart->pin_cts) == 1) { + ao_exti_enable(usart->gpio_cts, usart->pin_cts); + return 0; + } +#endif + if (usart->reg->sr & (1 << STM_USART_SR_TXE)) + { + usart->tx_running = 1; + usart->reg->cr1 |= (1 << STM_USART_CR1_TXEIE) | (1 << STM_USART_CR1_TCIE); + ao_fifo_remove(usart->tx_fifo, usart->reg->dr); + ao_wakeup(&usart->tx_fifo); + return 1; + } + } + return 0; +} + +#if HAS_SERIAL_SW_FLOW +static void +_ao_usart_cts(struct ao_stm_usart *usart) +{ + if (_ao_usart_tx_start(usart)) + ao_exti_disable(usart->gpio_cts, usart->pin_cts); +} +#endif + +static void +_ao_usart_rx(struct ao_stm_usart *usart, int is_stdin) +{ + if (usart->reg->sr & (1 << STM_USART_SR_RXNE)) { + if (!ao_fifo_full(usart->rx_fifo)) { + ao_fifo_insert(usart->rx_fifo, usart->reg->dr); + ao_wakeup(&usart->rx_fifo); + if (is_stdin) + ao_wakeup(&ao_stdin_ready); +#if HAS_SERIAL_SW_FLOW + /* If the fifo is nearly full, turn off RTS and wait + * for it to drain a bunch + */ + if (usart->gpio_rts && ao_fifo_mostly(usart->rx_fifo)) { + ao_gpio_set(usart->gpio_rts, usart->pin_rts, 1); + usart->rts = 0; + } +#endif + } else { + usart->reg->cr1 &= ~(1 << STM_USART_CR1_RXNEIE); + } + } +} + +static void +ao_usart_isr(struct ao_stm_usart *usart, int is_stdin) +{ + _ao_usart_rx(usart, is_stdin); + + if (!_ao_usart_tx_start(usart)) + usart->reg->cr1 &= ~(1<< STM_USART_CR1_TXEIE); + + if (usart->reg->sr & (1 << STM_USART_SR_TC)) { + usart->tx_running = 0; + usart->reg->cr1 &= ~(1 << STM_USART_CR1_TCIE); + if (usart->draining) { + usart->draining = 0; + ao_wakeup(&usart->tx_fifo); + } + } +} + +static int +_ao_usart_pollchar(struct ao_stm_usart *usart) +{ + int c; + + if (ao_fifo_empty(usart->rx_fifo)) + c = AO_READ_AGAIN; + else { + uint8_t u; + ao_fifo_remove(usart->rx_fifo,u); + if ((usart->reg->cr1 & (1 << STM_USART_CR1_RXNEIE)) == 0) { + if (ao_fifo_barely(usart->rx_fifo)) + usart->reg->cr1 |= (1 << STM_USART_CR1_RXNEIE); + } +#if HAS_SERIAL_SW_FLOW + /* If we've cleared RTS, check if there's space now and turn it back on */ + if (usart->gpio_rts && usart->rts == 0 && ao_fifo_barely(usart->rx_fifo)) { + ao_gpio_set(usart->gpio_rts, usart->pin_rts, 0); + usart->rts = 1; + } +#endif + c = u; + } + return c; +} + +static char +ao_usart_getchar(struct ao_stm_usart *usart) +{ + int c; + ao_arch_block_interrupts(); + while ((c = _ao_usart_pollchar(usart)) == AO_READ_AGAIN) + ao_sleep(&usart->rx_fifo); + ao_arch_release_interrupts(); + return (char) c; +} + +static inline uint8_t +_ao_usart_sleep_for(struct ao_stm_usart *usart, uint16_t timeout) +{ + return ao_sleep_for(&usart->rx_fifo, timeout); +} + +static void +ao_usart_putchar(struct ao_stm_usart *usart, char c) +{ + ao_arch_block_interrupts(); + while (ao_fifo_full(usart->tx_fifo)) + ao_sleep(&usart->tx_fifo); + ao_fifo_insert(usart->tx_fifo, c); + _ao_usart_tx_start(usart); + ao_arch_release_interrupts(); +} + +static void +ao_usart_drain(struct ao_stm_usart *usart) +{ + ao_arch_block_interrupts(); + while (!ao_fifo_empty(usart->tx_fifo) || usart->tx_running) { + usart->draining = 1; + ao_sleep(&usart->tx_fifo); + } + ao_arch_release_interrupts(); +} + +static void +ao_usart_set_speed(struct ao_stm_usart *usart, uint32_t speed) +{ + if (speed > 115200) + return; + usart->reg->brr = usart->clk / speed; +} + +static void +_ao_usart_init(struct ao_stm_usart *usart, int hw_flow) +{ + usart->reg->cr1 = ((0 << STM_USART_CR1_OVER8) | + (1 << STM_USART_CR1_UE) | + (0 << STM_USART_CR1_M) | + (0 << STM_USART_CR1_WAKE) | + (0 << STM_USART_CR1_PCE) | + (0 << STM_USART_CR1_PS) | + (0 << STM_USART_CR1_PEIE) | + (0 << STM_USART_CR1_TXEIE) | + (0 << STM_USART_CR1_TCIE) | + (1 << STM_USART_CR1_RXNEIE) | + (0 << STM_USART_CR1_IDLEIE) | + (1 << STM_USART_CR1_TE) | + (1 << STM_USART_CR1_RE) | + (0 << STM_USART_CR1_RWU) | + (0 << STM_USART_CR1_SBK)); + + usart->reg->cr2 = ((0 << STM_USART_CR2_LINEN) | + (STM_USART_CR2_STOP_1 << STM_USART_CR2_STOP) | + (0 << STM_USART_CR2_CLKEN) | + (0 << STM_USART_CR2_CPOL) | + (0 << STM_USART_CR2_CPHA) | + (0 << STM_USART_CR2_LBCL) | + (0 << STM_USART_CR2_LBDIE) | + (0 << STM_USART_CR2_LBDL) | + (0 << STM_USART_CR2_ADD)); + + usart->reg->cr3 = ((0 << STM_USART_CR3_ONEBIT) | + (0 << STM_USART_CR3_CTSIE) | + (0 << STM_USART_CR3_CTSE) | + (0 << STM_USART_CR3_RTSE) | + (0 << STM_USART_CR3_DMAT) | + (0 << STM_USART_CR3_DMAR) | + (0 << STM_USART_CR3_SCEN) | + (0 << STM_USART_CR3_NACK) | + (0 << STM_USART_CR3_HDSEL) | + (0 << STM_USART_CR3_IRLP) | + (0 << STM_USART_CR3_IREN) | + (0 << STM_USART_CR3_EIE)); + + if (hw_flow) + usart->reg->cr3 |= ((1 << STM_USART_CR3_CTSE) | + (1 << STM_USART_CR3_RTSE)); + + /* Pick a 9600 baud rate */ + ao_usart_set_speed(usart, 9600); +} + +#if HAS_SERIAL_HW_FLOW +static void +ao_usart_set_flow(struct ao_stm_usart *usart) +{ +} +#endif + +#if HAS_SERIAL_6 + +struct ao_stm_usart ao_stm_usart6; + +void stm_usart6_isr(void) { ao_usart_isr(&ao_stm_usart6, USE_SERIAL_6_STDIN); } + +char +ao_serial6_getchar(void) +{ + return ao_usart_getchar(&ao_stm_usart6); +} + +void +ao_serial6_putchar(char c) +{ + ao_usart_putchar(&ao_stm_usart6, c); +} + +int +_ao_serial6_pollchar(void) +{ + return _ao_usart_pollchar(&ao_stm_usart6); +} + +uint8_t +_ao_serial6_sleep_for(uint16_t timeout) +{ + return _ao_usart_sleep_for(&ao_stm_usart6, timeout); +} + +void +ao_serial6_set_speed(uint32_t speed) +{ + ao_usart_drain(&ao_stm_usart6); + ao_usart_set_speed(&ao_stm_usart6, speed); +} + +void +ao_serial6_drain(void) +{ + ao_usart_drain(&ao_stm_usart6); +} +#endif /* HAS_SERIAL_6 */ + +#if HAS_SERIAL_SW_FLOW +static void +ao_serial_set_sw_rts_cts(struct ao_stm_usart *usart, + void (*isr)(void), + struct stm_gpio *port_rts, + int pin_rts, + struct stm_gpio *port_cts, + int pin_cts) +{ + /* Pull RTS low to note that there's space in the FIFO */ + ao_enable_output(port_rts, pin_rts, 0); + usart->gpio_rts = port_rts; + usart->pin_rts = pin_rts; + usart->rts = 1; + + ao_exti_setup(port_cts, pin_cts, AO_EXTI_MODE_FALLING|AO_EXTI_PRIORITY_MED, isr); + usart->gpio_cts = port_cts; + usart->pin_cts = pin_cts; +} +#endif + +void +ao_usart_init(void) +{ +#if HAS_SERIAL_6 + stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_USART6EN); + + ao_stm_usart6.reg = &stm_usart6; + ao_stm_usart6.clk = AO_P2CLK; + + ao_enable_port(SERIAL_6_RX_PORT); + ao_enable_port(SERIAL_6_TX_PORT); + + stm_afr_set(SERIAL_6_RX_PORT, SERIAL_6_RX_PIN, STM_AFR_AF8); + stm_afr_set(SERIAL_6_TX_PORT, SERIAL_6_TX_PIN, STM_AFR_AF8); + + stm_nvic_set_enable(STM_ISR_USART6_POS); + stm_nvic_set_priority(STM_ISR_USART6_POS, AO_STM_NVIC_MED_PRIORITY); + + _ao_usart_init(&ao_stm_usart6, USE_SERIAL_6_FLOW && !USE_SERIAL_6_SW_FLOW); + +# if USE_SERIAL_6_FLOW +# if USE_SERIAL_6_SW_FLOW + ao_serial_set_sw_rts_cts(&ao_stm_usart6, + ao_serial6_cts, + SERIAL_6_PORT_RTS, + SERIAL_6_PIN_RTS, + SERIAL_6_PORT_CTS, + SERIAL_6_PIN_CTS); +# else + stm_afr_set(SERIAL_6_PORT_RTS, SERIAL_6_PIN_RTS, STM_AFR_AF8); + stm_afr_set(SERIAL_6_PORT_CTS, SERIAL_6_PIN_CTS, STM_AFR_AF8); +# endif +#endif + +#if USE_SERIAL_6_STDIN && !DELAY_SERIAL_6_STDIN + ao_add_stdio(_ao_serial6_pollchar, + ao_serial6_putchar, + NULL); +#endif +#endif +} diff --git a/src/stm32f4/registers.ld b/src/stm32f4/registers.ld index b36b2098..20ffa0a0 100644 --- a/src/stm32f4/registers.ld +++ b/src/stm32f4/registers.ld @@ -19,6 +19,26 @@ stm_dac1 = 0x40007400; stm_uart7 = 0x40007800; stm_uart8 = 0x40007c00; +stm_tim1 = 0x40010000; +stm_tim8 = 0x40010400; +stm_usart1 = 0x40011000; +stm_usart6 = 0x40011400; +stm_uart9 = 0x40011800; +stm_uart10 = 0x40011c00; +stm_adc = 0x40012000; +stm_sdio = 0x40012c00; +stm_spi1 = 0x40013000; +stm_spi4 = 0x40013400; +stm_syscfg = 0x40013800; +stm_exti = 0x40013c00; +stm_tim9 = 0x40014000; +stm_tim10 = 0x40014400; +stm_tim11 = 0x40014800; +stm_spi5 = 0x40015000; +stm_sai1 = 0x40015800; +stm_dfsdm1 = 0x40016000; +stm_dfsdm2 = 0x40016400; + stm_gpioa = 0x40020000; stm_gpiob = 0x40020400; stm_gpioc = 0x40020800; diff --git a/src/stm32f4/stm32f4.h b/src/stm32f4/stm32f4.h index 3429e458..715a2c92 100644 --- a/src/stm32f4/stm32f4.h +++ b/src/stm32f4/stm32f4.h @@ -223,6 +223,26 @@ extern struct stm_rcc stm_rcc; #define STM_RCC_APB1ENR_TIM3EN 1 #define STM_RCC_APB1ENR_TIM2EN 0 +#define STM_RCC_APB2ENR_DFSDM2EN 25 +#define STM_RCC_APB2ENR_DFSDM1EN 24 +#define STM_RCC_APB2ENR_SAI1EN 22 +#define STM_RCC_APB2ENR_SPI5EN 20 +#define STM_RCC_APB2ENR_TIM11EN 18 +#define STM_RCC_APB2ENR_TIM10EN 17 +#define STM_RCC_APB2ENR_TIM9EN 16 +#define STM_RCC_APB2ENR_EXITEN 15 +#define STM_RCC_APB2ENR_SYSCFGEN 14 +#define STM_RCC_APB2ENR_SPI4EN 13 +#define STM_RCC_APB2ENR_SPI1EN 12 +#define STM_RCC_APB2ENR_SDIOEN 11 +#define STM_RCC_APB2ENR_ADC1EN 8 +#define STM_RCC_APB2ENR_UART10EN 7 +#define STM_RCC_APB2ENR_UART9EN 5 +#define STM_RCC_APB2ENR_USART6EN 5 +#define STM_RCC_APB2ENR_USART1EN 4 +#define STM_RCC_APB2ENR_TIM8EN 1 +#define STM_RCC_APB2ENR_TIM1EN 0 + #define STM_RCC_CSR_RMVF 24 struct stm_ictr { @@ -283,7 +303,7 @@ static inline int stm_nvic_enabled(int irq) { return IRQ_BOOL(stm_nvic.iser[IRQ_REG(irq)], irq); } - + static inline void stm_nvic_set_pending(int irq) { stm_nvic.ispr[IRQ_REG(irq)] = IRQ_MASK(irq); @@ -324,6 +344,152 @@ stm_nvic_get_priority(int irq) { return (stm_nvic.ipr[IRQ_PRIO_REG(irq)] >> IRQ_PRIO_BIT(irq)) & IRQ_PRIO_MASK(0); } +#define isr(name) void stm_ ## name ## _isr(void) + +isr(nmi); +isr(hardfault); +isr(memmanage); +isr(busfault); +isr(usagefault); +isr(svc); +isr(debugmon); +isr(pendsv); +isr(systick); +isr(wwdg); +isr(pvd); +isr(tamper_stamp); +isr(rtc_wkup); +isr(flash); +isr(rcc); +isr(exti0); +isr(exti1); +isr(exti2); +isr(exti3); +isr(exti4); +isr(dma1_stream0); +isr(dma1_stream1); +isr(dma1_stream2); +isr(dma1_stream3); +isr(dma1_stream4); +isr(dma1_stream5); +isr(dma1_stream6); +isr(adc); +isr(can1_tx); +isr(can1_rx0); +isr(can1_rx1); +isr(can1_sce); +isr(exti9_5); +isr(tim1_brk_tim9); +isr(tim1_up_tim10); +isr(tim_trg_com_tim11); +isr(tim1_cc); +isr(tim2); +isr(tim3); +isr(tim4); +isr(i2c1_evt); +isr(i2c1_err); +isr(i2c2_evt); +isr(i2c2_err); +isr(spi1); +isr(spi2); +isr(usart1); +isr(usart2); +isr(usart3); +isr(exti15_10); +isr(rtc_alarm); +isr(otg_fs_wkup); +isr(tim8_brk_tim12); +isr(tim8_up_tim13); +isr(tim8_trg_com_tim14); +isr(tim8_cc); +isr(dma1_stream7); +isr(fsmc); +isr(sdio); +isr(tim5); +isr(spi3); +isr(uart4); +isr(uart5); +isr(tim6_glb_it); +isr(tim7); +isr(dma2_stream0); +isr(dma2_stream1); +isr(dma2_stream2); +isr(dma2_stream3); +isr(dma2_stream4); +isr(dfsdm1_flt0); +isr(dfsdm1_flt1); +isr(can2_tx); +isr(can2_rx0); +isr(can2_rx1); +isr(can2_sce); +isr(otg_fs); +isr(dma2_stream5); +isr(dma2_stream6); +isr(dma2_stream7); +isr(usart6); +isr(i2c3_ev); +isr(i2c3_er); +isr(can3_tx); +isr(can3_rx0); +isr(can3_rx1); +isr(can3_sce); +isr(crypto); +isr(rng); +isr(fpu); +isr(uart7); +isr(uart8); +isr(spi4); +isr(spi5); +isr(sai1); +isr(uart9); +isr(uart10); +isr(quad_spi); +isr(i2cfmp1_ev); +isr(i2cfmp1_er); +isr(exti23); +isr(dfsdm2_flt0); +isr(dfsdm2_flt1); +isr(dfsdm2_flt2); +isr(dfsdm2_flt3); + +#undef isr + +#define STM_ISR_WWDG_POS 0 +#define STM_ISR_PVD_POS 1 +#define STM_ISR_TAMPER_STAMP_POS 2 +#define STM_ISR_RTC_WKUP_POS 3 +#define STM_ISR_FLASH_POS 4 +#define STM_ISR_RCC_POS 5 +#define STM_ISR_EXTI0_POS 6 +#define STM_ISR_EXTI1_POS 7 +#define STM_ISR_EXTI2_POS 8 +#define STM_ISR_EXTI3_POS 9 +#define STM_ISR_EXTI4_POS 10 +#define STM_ISR_DMA1_STREAM0_POS 11 +#define STM_ISR_DMA1_STREAM1_POS 12 +#define STM_ISR_DMA1_STREAM2_POS 13 +#define STM_ISR_DMA1_STREAM3_POS 14 +#define STM_ISR_DMA1_STREAM4_POS 15 +#define STM_ISR_DMA1_STREAM5_POS 16 +#define STM_ISR_DMA1_STREAM6_POS 17 +#define STM_ISR_ADC_POS 18 +#define STM_ISR_CAN1_TX_POS 19 +#define STM_ISR_CAN1_RX0_POS 20 +#define STM_ISR_CAN1_RX1_POS 21 +#define STM_ISR_CAN1_SCE_POS 22 +#define STM_ISR_EXTI9_5_POS 23 +#define STM_ISR_USART1_POS 37 +#define STM_ISR_USART2_POS 38 +#define STM_ISR_USART3_POS 39 +#define STM_ISR_UART4_POS 52 +#define STM_ISR_UART5_POS 53 +#define STM_ISR_USART6_POS 71 +#define STM_ISR_UART7_POS 82 +#define STM_ISR_UART9_POS 88 +#define STM_ISR_UART10_POS 89 + +#define STM_ISR_EXTI15_10_POS 40 + struct stm_flash { vuint32_t acr; vuint32_t keyr; @@ -595,6 +761,13 @@ extern struct stm_scb stm_scb; #define STM_SCB_CPACR_FP0 STM_SCB_CPACR_CP(10) #define STM_SCB_CPACR_FP1 STM_SCB_CPACR_CP(11) +#define STM_SCB_AIRCR_VECTKEY 16 +#define STM_SCB_AIRCR_VECTKEY_KEY 0x05fa +#define STM_SCB_AIRCR_PRIGROUP 8 +#define STM_SCB_AIRCR_SYSRESETREQ 2 +#define STM_SCB_AIRCR_VECTCLRACTIVE 1 +#define STM_SCB_AIRCR_VECTRESET 0 + /* The SYSTICK starts at 0xe000e010 */ struct stm_systick { @@ -615,6 +788,148 @@ extern struct stm_systick stm_systick; #define STM_SYSTICK_CSR_CLKSOURCE_AHB 1 #define STM_SYSTICK_CSR_COUNTFLAG 16 +#define STM_SYSCFG_EXTICR_PA 0 +#define STM_SYSCFG_EXTICR_PB 1 +#define STM_SYSCFG_EXTICR_PC 2 +#define STM_SYSCFG_EXTICR_PD 3 +#define STM_SYSCFG_EXTICR_PE 4 +#define STM_SYSCFG_EXTICR_PF 5 +#define STM_SYSCFG_EXTICR_PG 6 +#define STM_SYSCFG_EXTICR_PH 7 + +struct stm_syscfg { + vuint32_t memrmp; + vuint32_t pmc; + vuint32_t exticr[4]; +}; + +extern struct stm_syscfg stm_syscfg; + +#define stm_syscfg (*((struct stm_syscfg *) 0x40013800)) + +#define STM_SYSCFG_MEMRMP_MEM_MODE 0 +#define STM_SYSCFG_MEMRMP_MEM_MODE_MAIN_FLASH 0 +#define STM_SYSCFG_MEMRMP_MEM_MODE_SYSTEM_FLASH 1 +#define STM_SYSCFG_MEMRMP_MEM_MODE_SRAM 3 +#define STM_SYSCFG_MEMRMP_MEM_MODE_MASK 3 + +#define STM_SYSCFG_PMC_ADC1DC2 0 + +static inline void +stm_exticr_set(struct stm_gpio *gpio, int pin) { + uint8_t reg = pin >> 2; + uint8_t shift = (pin & 3) << 2; + uint8_t val = 0; + + /* Enable SYSCFG */ + stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_SYSCFGEN); + + if (gpio == &stm_gpioa) + val = STM_SYSCFG_EXTICR_PA; + else if (gpio == &stm_gpiob) + val = STM_SYSCFG_EXTICR_PB; + else if (gpio == &stm_gpioc) + val = STM_SYSCFG_EXTICR_PC; + else if (gpio == &stm_gpiod) + val = STM_SYSCFG_EXTICR_PD; + else if (gpio == &stm_gpioe) + val = STM_SYSCFG_EXTICR_PE; + else if (gpio == &stm_gpiof) + val = STM_SYSCFG_EXTICR_PF; + else if (gpio == &stm_gpiog) + val = STM_SYSCFG_EXTICR_PG; + else if (gpio == &stm_gpioh) + val = STM_SYSCFG_EXTICR_PH; + + stm_syscfg.exticr[reg] = (stm_syscfg.exticr[reg] & ~(0xf << shift)) | val << shift; +} + +struct stm_exti { + vuint32_t imr; + vuint32_t emr; + vuint32_t rtsr; + vuint32_t ftsr; + + vuint32_t swier; + vuint32_t pr; +}; + +extern struct stm_exti stm_exti; + +#define stm_exti (*((struct stm_exti *) 0x40013c00)) + +struct stm_usart { + vuint32_t sr; /* status register */ + vuint32_t dr; /* data register */ + vuint32_t brr; /* baud rate register */ + vuint32_t cr1; /* control register 1 */ + + vuint32_t cr2; /* control register 2 */ + vuint32_t cr3; /* control register 3 */ + vuint32_t gtpr; /* guard time and prescaler */ +}; + +extern struct stm_usart stm_usart6; + +#define stm_usart6 (*((struct stm_usart *) 0x40011400)) + +#define STM_USART_SR_CTS (9) /* CTS flag */ +#define STM_USART_SR_LBD (8) /* LIN break detection flag */ +#define STM_USART_SR_TXE (7) /* Transmit data register empty */ +#define STM_USART_SR_TC (6) /* Transmission complete */ +#define STM_USART_SR_RXNE (5) /* Read data register not empty */ +#define STM_USART_SR_IDLE (4) /* IDLE line detected */ +#define STM_USART_SR_ORE (3) /* Overrun error */ +#define STM_USART_SR_NF (2) /* Noise detected flag */ +#define STM_USART_SR_FE (1) /* Framing error */ +#define STM_USART_SR_PE (0) /* Parity error */ + +#define STM_USART_CR1_OVER8 (15) /* Oversampling mode */ +#define STM_USART_CR1_UE (13) /* USART enable */ +#define STM_USART_CR1_M (12) /* Word length */ +#define STM_USART_CR1_WAKE (11) /* Wakeup method */ +#define STM_USART_CR1_PCE (10) /* Parity control enable */ +#define STM_USART_CR1_PS (9) /* Parity selection */ +#define STM_USART_CR1_PEIE (8) /* PE interrupt enable */ +#define STM_USART_CR1_TXEIE (7) /* TXE interrupt enable */ +#define STM_USART_CR1_TCIE (6) /* Transmission complete interrupt enable */ +#define STM_USART_CR1_RXNEIE (5) /* RXNE interrupt enable */ +#define STM_USART_CR1_IDLEIE (4) /* IDLE interrupt enable */ +#define STM_USART_CR1_TE (3) /* Transmitter enable */ +#define STM_USART_CR1_RE (2) /* Receiver enable */ +#define STM_USART_CR1_RWU (1) /* Receiver wakeup */ +#define STM_USART_CR1_SBK (0) /* Send break */ + +#define STM_USART_CR2_LINEN (14) /* LIN mode enable */ +#define STM_USART_CR2_STOP (12) /* STOP bits */ +#define STM_USART_CR2_STOP_MASK 3 +#define STM_USART_CR2_STOP_1 0 +#define STM_USART_CR2_STOP_0_5 1 +#define STM_USART_CR2_STOP_2 2 +#define STM_USART_CR2_STOP_1_5 3 + +#define STM_USART_CR2_CLKEN (11) /* Clock enable */ +#define STM_USART_CR2_CPOL (10) /* Clock polarity */ +#define STM_USART_CR2_CPHA (9) /* Clock phase */ +#define STM_USART_CR2_LBCL (8) /* Last bit clock pulse */ +#define STM_USART_CR2_LBDIE (6) /* LIN break detection interrupt enable */ +#define STM_USART_CR2_LBDL (5) /* lin break detection length */ +#define STM_USART_CR2_ADD (0) +#define STM_USART_CR2_ADD_MASK 0xf + +#define STM_USART_CR3_ONEBIT (11) /* One sample bit method enable */ +#define STM_USART_CR3_CTSIE (10) /* CTS interrupt enable */ +#define STM_USART_CR3_CTSE (9) /* CTS enable */ +#define STM_USART_CR3_RTSE (8) /* RTS enable */ +#define STM_USART_CR3_DMAT (7) /* DMA enable transmitter */ +#define STM_USART_CR3_DMAR (6) /* DMA enable receiver */ +#define STM_USART_CR3_SCEN (5) /* Smartcard mode enable */ +#define STM_USART_CR3_NACK (4) /* Smartcard NACK enable */ +#define STM_USART_CR3_HDSEL (3) /* Half-duplex selection */ +#define STM_USART_CR3_IRLP (2) /* IrDA low-power */ +#define STM_USART_CR3_IREN (1) /* IrDA mode enable */ +#define STM_USART_CR3_EIE (0) /* Error interrupt enable */ + /* Errata 2.1.5 Delay after an RCC peripheral clock enabling -- cgit v1.2.3 From cd151a622537e1436362bd71229c6ce22a3957d0 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 18:50:15 -0700 Subject: altos/stm32f4: Use full printf/scanf (including floats) Signed-off-by: Keith Packard --- src/stm32f4/Makefile-stm32f4.defs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stm32f4/Makefile-stm32f4.defs b/src/stm32f4/Makefile-stm32f4.defs index 4346b7d8..c39633c7 100644 --- a/src/stm32f4/Makefile-stm32f4.defs +++ b/src/stm32f4/Makefile-stm32f4.defs @@ -28,7 +28,7 @@ CC=$(ARM_CC) WARN_FLAGS=-Wall -Wextra -Werror -Wcast-align AO_CFLAGS=-I. -I$(TOPDIR)/stm32f4 -I$(TOPDIR)/kernel -I$(TOPDIR)/drivers \ - -DNEWLIB_INTEGER_PRINTF_SCANF -Os -g \ + -Os -g \ -I$(TOPDIR)/product -I$(TOPDIR) -I$(TOPDIR)/math \ -isystem $(NEWLIB_NANO)/arm-none-eabi/include -- cgit v1.2.3 From bb9d3d3bb1ae6223a7b910bc49ea8af5544a64d7 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 18:50:45 -0700 Subject: altos/stm32f4: Place ARM.exidx sections after .text This makes the linker happy about not attempting to merge unordered and ordered stuff (whatever that means...) Signed-off-by: Keith Packard --- src/stm32f4/altos-raw.ld | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/stm32f4/altos-raw.ld b/src/stm32f4/altos-raw.ld index 21da5af5..82d33c09 100644 --- a/src/stm32f4/altos-raw.ld +++ b/src/stm32f4/altos-raw.ld @@ -38,9 +38,13 @@ SECTIONS { .text : { *(.text*) /* Executable code */ - *(.ARM.exidx* .gnu.linkonce.armexidx.*) *(.rodata*) /* Constants */ } > rom + + .exidx : { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + __text_end__ = .; /* Data -- relocated to RAM, but written to ROM -- cgit v1.2.3 From 32463323d888d2b36d4b993d82e2522e1b236299 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 18:51:59 -0700 Subject: altos/stm32f4-disco: Hook up serial console. Add scheme Signed-off-by: Keith Packard --- src/stm32f4-disco/Makefile | 52 +++++++++++++++++++++++++++-- src/stm32f4-disco/ao_disco.c | 41 ++++++++++++----------- src/stm32f4-disco/ao_pins.h | 20 ++++++++++-- src/stm32f4-disco/ao_scheme_os.h | 70 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 160 insertions(+), 23 deletions(-) create mode 100644 src/stm32f4-disco/ao_scheme_os.h diff --git a/src/stm32f4-disco/Makefile b/src/stm32f4-disco/Makefile index c970b879..c4aa8e0a 100644 --- a/src/stm32f4-disco/Makefile +++ b/src/stm32f4-disco/Makefile @@ -1,14 +1,43 @@ include ../stm32f4/Makefile-raw.defs +aoschemelib=$(shell pkg-config --variable=aoschemelib ao-scheme) + +include $(aoschemelib)/Makefile-scheme + +IDVENDOR=0xfffe +IDPRODUCT=0xfffa +PRODUCT=stm32f4-disco +SERIAL=1 + +INC = \ + ao.h \ + ao_arch.h \ + ao_arch_funcs.h \ + ao_boot.h \ + ao_pins.h \ + ao_task.h \ + ao_product.h \ + $(SCHEME_HDRS) \ + ao_scheme_const.h \ + stm32f4.h \ + Makefile + ALTOS_SRC = \ ao_interrupt.c \ + ao_romconfig.c \ ao_panic.c \ ao_timer.c \ - ao_led.c \ ao_task.c \ - ao_stdio.c + ao_stdio.c \ + ao_product.o \ + ao_cmd.c \ + ao_exti_stm32f4.c \ + ao_usart_stm32f4.c \ + ao_led.c \ + ao_impure.c \ + $(SCHEME_SRCS) -CFLAGS = $(STM32F4_CFLAGS) +CFLAGS = $(STM32F4_CFLAGS) -I$(aoschemelib) PROG=stm32f4-disco-$(VERSION) ELF=$(PROG).elf @@ -23,6 +52,23 @@ all: $(ELF) $(IHX) $(ELF): Makefile $(OBJ) $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJ) -Wl,-M=$(MAP) $(LIBS) +$(OBJ): $(INC) + +ao_product.h: ao-make-product.5c ../Version Makefile + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -V $(IDVENDOR) -s $(SERIAL) -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +SCHEME_SCHEME=\ + ao_scheme_basic_syntax.scheme \ + ao_scheme_list.scheme \ + ao_scheme_advanced_syntax.scheme \ + ao_scheme_vector.scheme \ + ao_scheme_string.scheme \ + ao_scheme_char.scheme \ + ao_scheme_number.scheme + +ao_scheme_const.h: ao-scheme-make-const-big $(SCHEME_SCHEME) + $^ -o $@ -d POSIX,PORT,SAVE + distclean: clean clean: diff --git a/src/stm32f4-disco/ao_disco.c b/src/stm32f4-disco/ao_disco.c index c6cdbd23..ede7c05f 100644 --- a/src/stm32f4-disco/ao_disco.c +++ b/src/stm32f4-disco/ao_disco.c @@ -13,26 +13,31 @@ */ #include +#include -static struct ao_task red_task; -static struct ao_task green_task; - -static void -red(void) -{ - for (;;) { - ao_led_toggle(LED_RED); - ao_delay(AO_MS_TO_TICKS(500)); - } +static void scheme_cmd() { + ao_scheme_read_eval_print(stdin, stdout, false); } -static void -green(void) +static const struct ao_cmds scheme_cmds[] = { + { scheme_cmd, "l\0Run scheme interpreter" }, + { 0, 0 } +}; + +int +_ao_scheme_getc(void) { - for (;;) { - ao_led_toggle(LED_GREEN); - ao_delay(AO_MS_TO_TICKS(450)); + static uint8_t at_eol; + int c; + + if (at_eol) { + ao_cmd_readline(ao_scheme_read_list ? "- " : "> "); + at_eol = 0; } + c = (unsigned char) ao_cmd_lex(); + if (c == '\n') + at_eol = 1; + return c; } void main(void) @@ -40,9 +45,9 @@ void main(void) ao_clock_init(); ao_timer_init(); ao_led_init(); + ao_usart_init(); ao_task_init(); - - ao_add_task(&red_task, red, "red"); - ao_add_task(&green_task, green, "green"); + ao_cmd_init(); + ao_cmd_register(scheme_cmds); ao_start_scheduler(); } diff --git a/src/stm32f4-disco/ao_pins.h b/src/stm32f4-disco/ao_pins.h index bbbc306e..e6dcea8e 100644 --- a/src/stm32f4-disco/ao_pins.h +++ b/src/stm32f4-disco/ao_pins.h @@ -46,10 +46,26 @@ #define LED_0_PORT (&stm_gpioc) #define LED_0_PIN 5 -#define LED_GREEN (1 << 0) +#define LED_GREEN AO_LED_0 #define LED_1_PORT (&stm_gpioe) #define LED_1_PIN 3 -#define LED_RED (1 << 1) +#define LED_RED AO_LED_0 + +#define AO_LED_PANIC LED_RED + +/* USART */ + +#define HAS_SERIAL_6 1 +#define SERIAL_6_RX_PORT (&stm_gpiog) +#define SERIAL_6_RX_PIN 9 + +#define SERIAL_6_TX_PORT (&stm_gpiog) +#define SERIAL_6_TX_PIN 14 + +#define USE_SERIAL_6_STDIN 1 +#define DELAY_SERIAL_6_STDIN 0 +#define USE_SERIAL_6_FLOW 0 +#define USE_SERIAL_6_SW_FLOW 0 #endif /* _AO_PINS_H_ */ diff --git a/src/stm32f4-disco/ao_scheme_os.h b/src/stm32f4-disco/ao_scheme_os.h new file mode 100644 index 00000000..b1eac30b --- /dev/null +++ b/src/stm32f4-disco/ao_scheme_os.h @@ -0,0 +1,70 @@ +/* + * Copyright © 2016 Keith Packard + * + * 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_SCHEME_OS_H_ +#define _AO_SCHEME_OS_H_ + +#include "ao.h" +#include "ao_scheme.h" + +#define AO_SCHEME_POOL 131072 +#define AO_SCHEME_TOKEN_MAX 64 + +#define AO_SCHEME_BIG + +#ifndef __BYTE_ORDER +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +extern int _ao_scheme_getc(void); + +#define ao_scheme_getc(f) ({ (void) (f); _ao_scheme_getc(); }) +#undef putc +#define putc(c, f) ({ (void) (f); ao_putchar(c); }) +#define fputs(s, f) ({ (void) (f); ao_put_string(s); }) +#define fiprintf(f, ...) ({ (void) (f); iprintf(__VA_ARGS__); }) + +static inline void +ao_scheme_abort(void) +{ + ao_panic(1); +} + +#ifdef LEDS_AVAILABLE +static inline void +ao_scheme_os_led(int led) +{ + ao_led_set(led); +} +#endif + +#define AO_SCHEME_JIFFIES_PER_SECOND AO_HERTZ + +static inline void +ao_scheme_os_delay(int delay) +{ + ao_delay(delay); +} + +static inline int +ao_scheme_os_jiffy(void) +{ + return ao_tick_count; +} +#endif -- cgit v1.2.3 From 44ae8b9317fa4aaccabbe9d07b5972f7dfd3baa2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 11 Sep 2018 18:53:15 -0700 Subject: altos: Clean up AO_ROMCONFIG bits Remove address parameter (doesn't work with gcc), create shared ao_romconfig in kernel. Signed-off-by: Keith Packard --- src/attiny/ao_arch.h | 2 ++ src/avr/ao_romconfig.c | 21 --------------------- src/kernel/ao.h | 13 +++++++++++++ src/kernel/ao_product.c | 2 +- src/kernel/ao_romconfig.c | 26 ++++++++++++++++++++++++++ src/lpc/ao_arch.h | 9 +-------- src/lpc/ao_romconfig.c | 26 -------------------------- src/stm/ao_arch.h | 9 +-------- src/stm/ao_romconfig.c | 29 ----------------------------- src/stm32f4/ao_arch.h | 6 ++++++ src/stmf0/ao_arch.h | 4 +--- src/stmf0/ao_romconfig.c | 28 ---------------------------- 12 files changed, 51 insertions(+), 124 deletions(-) delete mode 100644 src/avr/ao_romconfig.c create mode 100644 src/kernel/ao_romconfig.c delete mode 100644 src/lpc/ao_romconfig.c delete mode 100644 src/stm/ao_romconfig.c delete mode 100644 src/stmf0/ao_romconfig.c diff --git a/src/attiny/ao_arch.h b/src/attiny/ao_arch.h index a9c450fc..dfd41afe 100644 --- a/src/attiny/ao_arch.h +++ b/src/attiny/ao_arch.h @@ -49,6 +49,8 @@ #define ao_arch_interrupt(n) /* nothing */ +#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const + #undef putchar #undef getchar #define putchar(c) ao_putchar(c) diff --git a/src/avr/ao_romconfig.c b/src/avr/ao_romconfig.c deleted file mode 100644 index 4acfc1c8..00000000 --- a/src/avr/ao_romconfig.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" - -AO_ROMCONFIG_SYMBOL (0) uint16_t ao_serial_number = 0; diff --git a/src/kernel/ao.h b/src/kernel/ao.h index 1b269d73..9baae8b4 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -81,6 +81,19 @@ typedef AO_PORT_TYPE ao_port_t; void ao_panic(uint8_t reason); +/* + * ao_romconfig.c + */ + +#define AO_ROMCONFIG_VERSION 2 + +extern AO_ROMCONFIG_SYMBOL uint16_t ao_romconfig_version; +extern AO_ROMCONFIG_SYMBOL uint16_t ao_romconfig_check; +extern AO_ROMCONFIG_SYMBOL uint16_t ao_serial_number; +#if HAS_RADIO +extern AO_ROMCONFIG_SYMBOL uint32_t ao_radio_cal; +#endif + /* * ao_timer.c */ diff --git a/src/kernel/ao_product.c b/src/kernel/ao_product.c index 4c2d83ef..72488654 100644 --- a/src/kernel/ao_product.c +++ b/src/kernel/ao_product.c @@ -61,7 +61,7 @@ const char ao_product[] = AO_iProduct_STRING; #define NUM_INTERFACES (AO_USB_HAS_INT + 1) /* USB descriptors in one giant block of bytes */ -AO_ROMCONFIG_SYMBOL(0x00aa) uint8_t ao_usb_descriptors [] = +AO_ROMCONFIG_SYMBOL uint8_t ao_usb_descriptors [] = { /* Device descriptor */ 0x12, diff --git a/src/kernel/ao_romconfig.c b/src/kernel/ao_romconfig.c new file mode 100644 index 00000000..b75142f5 --- /dev/null +++ b/src/kernel/ao_romconfig.c @@ -0,0 +1,26 @@ +/* + * Copyright © 2011 Keith Packard + * + * 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. + */ + +#include "ao.h" + +AO_ROMCONFIG_SYMBOL uint16_t ao_romconfig_version = AO_ROMCONFIG_VERSION; +AO_ROMCONFIG_SYMBOL uint16_t ao_romconfig_check = ~AO_ROMCONFIG_VERSION; +AO_ROMCONFIG_SYMBOL uint16_t ao_serial_number = 0; +#if HAS_RADIO +AO_ROMCONFIG_SYMBOL uint32_t ao_radio_cal = AO_RADIO_CAL_DEFAULT; +#endif diff --git a/src/lpc/ao_arch.h b/src/lpc/ao_arch.h index 889be53e..35dcc9de 100644 --- a/src/lpc/ao_arch.h +++ b/src/lpc/ao_arch.h @@ -58,14 +58,7 @@ * ao_romconfig.c */ -#define AO_ROMCONFIG_VERSION 2 - -#define AO_ROMCONFIG_SYMBOL(a) __attribute__((section(".romconfig"))) const - -extern const uint16_t ao_romconfig_version; -extern const uint16_t ao_romconfig_check; -extern const uint16_t ao_serial_number; -extern const uint32_t ao_radio_cal; +#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const #define ao_arch_task_members\ uint32_t *sp; /* saved stack pointer */ diff --git a/src/lpc/ao_romconfig.c b/src/lpc/ao_romconfig.c deleted file mode 100644 index 4e7bab8d..00000000 --- a/src/lpc/ao_romconfig.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" - -AO_ROMCONFIG_SYMBOL (0) uint16_t ao_romconfig_version = AO_ROMCONFIG_VERSION; -AO_ROMCONFIG_SYMBOL (0) uint16_t ao_romconfig_check = ~AO_ROMCONFIG_VERSION; -AO_ROMCONFIG_SYMBOL (0) uint16_t ao_serial_number = 0; -#ifdef AO_RADIO_CAL_DEFAULT -AO_ROMCONFIG_SYMBOL (0) uint32_t ao_radio_cal = AO_RADIO_CAL_DEFAULT; -#endif diff --git a/src/stm/ao_arch.h b/src/stm/ao_arch.h index aee9df3c..e56375ca 100644 --- a/src/stm/ao_arch.h +++ b/src/stm/ao_arch.h @@ -56,14 +56,7 @@ * ao_romconfig.c */ -#define AO_ROMCONFIG_VERSION 2 - -#define AO_ROMCONFIG_SYMBOL(a) __attribute__((section(".romconfig"))) const - -extern const uint16_t ao_romconfig_version; -extern const uint16_t ao_romconfig_check; -extern const uint16_t ao_serial_number; -extern const uint32_t ao_radio_cal; +#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const #define ao_arch_task_members\ uint32_t *sp; /* saved stack pointer */ diff --git a/src/stm/ao_romconfig.c b/src/stm/ao_romconfig.c deleted file mode 100644 index 63a48bec..00000000 --- a/src/stm/ao_romconfig.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" - -AO_ROMCONFIG_SYMBOL (0) uint16_t ao_romconfig_version = AO_ROMCONFIG_VERSION; -AO_ROMCONFIG_SYMBOL (0) uint16_t ao_romconfig_check = ~AO_ROMCONFIG_VERSION; -AO_ROMCONFIG_SYMBOL (0) uint16_t ao_serial_number = 0; -#ifndef AO_RADIO_CAL_DEFAULT -#define AO_RADIO_CAL_DEFAULT 0x01020304 -#endif -#if HAS_RADIO -AO_ROMCONFIG_SYMBOL (0) uint32_t ao_radio_cal = AO_RADIO_CAL_DEFAULT; -#endif diff --git a/src/stm32f4/ao_arch.h b/src/stm32f4/ao_arch.h index 083a4e5b..4e9bdeb6 100644 --- a/src/stm32f4/ao_arch.h +++ b/src/stm32f4/ao_arch.h @@ -26,8 +26,14 @@ #define AO_PORT_TYPE uint16_t +#define ao_arch_reboot() \ + (stm_scb.aircr = ((STM_SCB_AIRCR_VECTKEY_KEY << STM_SCB_AIRCR_VECTKEY) | \ + (1 << STM_SCB_AIRCR_SYSRESETREQ))) + #define ao_arch_nop() asm("nop") +#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const + #define ao_arch_task_members\ uint32_t *sp; /* saved stack pointer */ diff --git a/src/stmf0/ao_arch.h b/src/stmf0/ao_arch.h index 15642951..22e706b2 100644 --- a/src/stmf0/ao_arch.h +++ b/src/stmf0/ao_arch.h @@ -58,9 +58,7 @@ * ao_romconfig.c */ -#define AO_ROMCONFIG_VERSION 2 - -#define AO_ROMCONFIG_SYMBOL(a) __attribute__((section(".romconfig"))) const +#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const extern const uint16_t ao_romconfig_version; extern const uint16_t ao_romconfig_check; diff --git a/src/stmf0/ao_romconfig.c b/src/stmf0/ao_romconfig.c deleted file mode 100644 index 9d5fd6fb..00000000 --- a/src/stmf0/ao_romconfig.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#include "ao.h" - -AO_ROMCONFIG_SYMBOL (0) uint16_t ao_romconfig_version = AO_ROMCONFIG_VERSION; -AO_ROMCONFIG_SYMBOL (0) uint16_t ao_romconfig_check = ~AO_ROMCONFIG_VERSION; -AO_ROMCONFIG_SYMBOL (0) uint16_t ao_serial_number = 0; -#ifndef AO_RADIO_CAL_DEFAULT -#define AO_RADIO_CAL_DEFAULT 0x01020304 -#endif -AO_ROMCONFIG_SYMBOL (0) uint32_t ao_radio_cal = AO_RADIO_CAL_DEFAULT; - -- cgit v1.2.3 From 015d3055a52532070e96469907683c3aa3eda44e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 2 Oct 2018 12:44:58 -0700 Subject: altos/stm32f4: Add more stm32f413 definitions and support code Signed-off-by: Keith Packard --- src/stm32f4/ao_arch.h | 6 +- src/stm32f4/ao_interrupt.c | 50 +++++ src/stm32f4/ao_timer.c | 14 +- src/stm32f4/registers.ld | 8 + src/stm32f4/stm32f4.h | 509 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 580 insertions(+), 7 deletions(-) diff --git a/src/stm32f4/ao_arch.h b/src/stm32f4/ao_arch.h index 4e9bdeb6..73dc3e93 100644 --- a/src/stm32f4/ao_arch.h +++ b/src/stm32f4/ao_arch.h @@ -19,7 +19,11 @@ #include #ifndef AO_STACK_SIZE -#define AO_STACK_SIZE 1024 +#define AO_STACK_SIZE 2048 +#endif + +#ifndef HAS_TASK_QUEUE +#define HAS_TASK_QUEUE 1 #endif #define AO_STACK_ALIGNMENT __attribute__ ((aligned(8))) diff --git a/src/stm32f4/ao_interrupt.c b/src/stm32f4/ao_interrupt.c index f1cb8eee..24f56abc 100644 --- a/src/stm32f4/ao_interrupt.c +++ b/src/stm32f4/ao_interrupt.c @@ -236,5 +236,55 @@ const void *stm_interrupt_vector[] = { i(0xe8, otg_fs_wkup), i(0xec, tim8_brk_tim12), i(0xf0, tim8_up_tim13), + i(0xf4, tim8_trg_com_tim14), + i(0xf8, tim8_cc), + i(0xfc, dma1_stream7), + i(0x100, fsmc), + i(0x104, sdio), + i(0x108, tim5), + i(0x10c, spi3), + i(0x110, uart4), + i(0x114, uart5), + i(0x118,tim6_glb_it), + i(0x11c, tim7), + i(0x120, dma2_stream0), + i(0x124, dma2_stream1), + i(0x128, dma2_stream2), + i(0x12c, dma2_stream3), + i(0x130, dma2_stream4), + i(0x134, dfsdm1_flt0), + i(0x138, dfsdm1_flt1), + i(0x13c, can2_tx), + i(0x140, can2_rx0), + i(0x144, can2_rx1), + i(0x148, can2_sce), + i(0x14c, otg_fs), + i(0x150, dma2_stream5), + i(0x154, dma2_stream6), + i(0x158, dma2_stream7), i(0x15c, usart6), + i(0x160, i2c3_ev), + i(0x164, i2c3_er), + i(0x168, can3_tx), + i(0x16c, can3_rx0), + i(0x170, can3_rx1), + i(0x174, can3_sce), + i(0x17c, crypto), + i(0x180, rng), + i(0x184, fpu), + i(0x188, uart7), + i(0x18c, uart8), + i(0x190, spi4), + i(0x194, spi5), + i(0x19c, sai1), + i(0x1a0, uart9), + i(0x1a4, uart10), + i(0x1b0, quad_spi), + i(0x1bc, i2cfmp1_ev), + i(0x1c0, i2cfmp1_er), + i(0x1c4, exti23), + i(0x1c8, dfsdm2_flt0), + i(0x1cc, dfsdm2_flt1), + i(0x1d0, dfsdm2_flt2), + i(0x1d4, dfsdm2_flt3), }; diff --git a/src/stm32f4/ao_timer.c b/src/stm32f4/ao_timer.c index e378ed07..d6ef9bc3 100644 --- a/src/stm32f4/ao_timer.c +++ b/src/stm32f4/ao_timer.c @@ -181,6 +181,14 @@ ao_clock_init(void) cfgr |= (AO_RCC_CFGR_PPRE2_DIV << STM_RCC_CFGR_PPRE2); stm_rcc.cfgr = cfgr; + /* Clock configuration register DCKCFGR2; mostly make sure USB + * gets clocked from PLL_Q + */ + stm_rcc.dckcfgr2 = ((STM_RCC_DCKCFGR2_LPTIMER1SEL_APB << STM_RCC_DCKCFGR2_LPTIMER1SEL) | + (STM_RCC_DCKCFGR2_SDIOSEL_CK_48MHZ << STM_RCC_DCKCFGR2_SDIOSEL) | + (STM_RCC_DCKCFGR2_CK48MSEL_PLL_Q << STM_RCC_DCKCFGR2_CK48MSEL) | + (STM_RCC_DCKCFGR2_I2CFMP1SEL_APB << STM_RCC_DCKCFGR2_I2CFMP1SEL)); + /* Disable the PLL */ stm_rcc.cr &= ~(1 << STM_RCC_CR_PLLON); while (stm_rcc.cr & (1 << STM_RCC_CR_PLLRDY)) @@ -196,7 +204,6 @@ ao_clock_init(void) pllcfgr |= (AO_PLL_M << STM_RCC_PLLCFGR_PLLM); pllcfgr |= (AO_PLL1_N << STM_RCC_PLLCFGR_PLLN); -#if AO_PLL1_P #if AO_PLL1_P == 2 #define AO_RCC_PLLCFGR_PLLP STM_RCC_PLLCFGR_PLLP_DIV_2 #endif @@ -210,13 +217,8 @@ ao_clock_init(void) #define AO_RCC_PLLCFGR_PLLP STM_RCC_PLLCFGR_PLLP_DIV_8 #endif pllcfgr |= (AO_RCC_PLLCFGR_PLLP << STM_RCC_PLLCFGR_PLLP); -#endif -#if AO_PLL1_Q pllcfgr |= (AO_PLL1_Q << STM_RCC_PLLCFGR_PLLQ); -#endif -#if AO_PLL1_R pllcfgr |= (AO_PLL1_R << STM_RCC_PLLCFGR_PLLR); -#endif /* PLL source */ pllcfgr &= ~(1 << STM_RCC_PLLCFGR_PLLSRC); #if AO_HSI diff --git a/src/stm32f4/registers.ld b/src/stm32f4/registers.ld index 20ffa0a0..bc924106 100644 --- a/src/stm32f4/registers.ld +++ b/src/stm32f4/registers.ld @@ -1,3 +1,4 @@ + stm_tim2 = 0x40000000; stm_tim3 = 0x40000400; stm_tim4 = 0x40000800; @@ -39,6 +40,8 @@ stm_sai1 = 0x40015800; stm_dfsdm1 = 0x40016000; stm_dfsdm2 = 0x40016400; +/* AHB1 */ + stm_gpioa = 0x40020000; stm_gpiob = 0x40020400; stm_gpioc = 0x40020800; @@ -54,6 +57,11 @@ stm_flash = 0x40023c00; stm_dma1 = 0x40026000; stm_dma2 = 0x40026400; +/* AHB2 */ + +stm_usb = 0x50000000; +stm_rng = 0x50060800; + stm_systick = 0xe000e010; stm_ictr = 0xe000e004; diff --git a/src/stm32f4/stm32f4.h b/src/stm32f4/stm32f4.h index 715a2c92..dcdce667 100644 --- a/src/stm32f4/stm32f4.h +++ b/src/stm32f4/stm32f4.h @@ -193,6 +193,10 @@ extern struct stm_rcc stm_rcc; #define STM_RCC_AHB1ENR_IOPGEN 6 #define STM_RCC_AHB1ENR_IOPHEN 7 +#define STM_RCC_AHB2ENR_OTGFSEN 7 +#define STM_RCC_AHB2ENR_RNGEN 6 +#define STM_RCC_AHB2ENR_CRYPEN 4 + #define STM_RCC_APB1ENR_UART8EN 31 #define STM_RCC_APB1ENR_UART7EN 30 #define STM_RCC_APB1ENR_DACEN 29 @@ -245,6 +249,34 @@ extern struct stm_rcc stm_rcc; #define STM_RCC_CSR_RMVF 24 +#define STM_RCC_DCKCFGR_CKDFSDMSEL 31 +#define STM_RCC_DCKCFGR_I2S2SRC 27 +#define STM_RCC_DCKCFGR_I2S1SRC 25 +#define STM_RCC_DCKCFGR_TIMPRE 24 +#define STM_RCC_DCKCFGR_SAII1BSRC 22 +#define STM_RCC_DCKCFGR_SAII1ASRC 20 +#define STM_RCC_DCKCFGR_CKDFSDM1ASEL 15 +#define STM_RCC_DCKCFGR_CKDFSDM2ASEL 14 +#define STM_RCC_DCKCFGR_PLLDIVR 8 +#define STM_RCC_DCKCFGR_PLLI2SDIVR 0 + +#define STM_RCC_DCKCFGR2_LPTIMER1SEL 30 +#define STM_RCC_DCKCFGR2_LPTIMER1SEL_APB 0 +#define STM_RCC_DCKCFGR2_LPTIMER1SEL_HSI 1 +#define STM_RCC_DCKCFGR2_LPTIMER1SEL_LSI 2 +#define STM_RCC_DCKCFGR2_LPTIMER1SEL_LSE 3 +#define STM_RCC_DCKCFGR2_SDIOSEL 28 +#define STM_RCC_DCKCFGR2_SDIOSEL_CK_48MHZ 0 +#define STM_RCC_DCKCFGR2_SDIOSEL_SYSTEM_CLOCK 1 +#define STM_RCC_DCKCFGR2_CK48MSEL 27 +#define STM_RCC_DCKCFGR2_CK48MSEL_PLL_Q 1 +#define STM_RCC_DCKCFGR2_CK48MSEL_PLLI2S_Q 1 +#define STM_RCC_DCKCFGR2_I2CFMP1SEL 22 +#define STM_RCC_DCKCFGR2_I2CFMP1SEL_APB 0 +#define STM_RCC_DCKCFGR2_I2CFMP1SEL_SYSTEM_CLOCK 1 +#define STM_RCC_DCKCFGR2_I2CFMP1SEL_HSI 2 +#define STM_RCC_DCKCFGR2_I2CFMP1SEL_APB_ALSO 3 + struct stm_ictr { vuint32_t ictr; }; @@ -478,11 +510,53 @@ isr(dfsdm2_flt3); #define STM_ISR_CAN1_RX1_POS 21 #define STM_ISR_CAN1_SCE_POS 22 #define STM_ISR_EXTI9_5_POS 23 +#define STM_ISR_TIM1_BRK_TIM9_POS 24 +#define STM_ISR_TIM1_UP_TIM10_POS 25 +#define STM_ISR_TIM_TRG_COM_TIM11_POS 26 +#define STM_ISR_TIM1_CC_POS 27 +#define STM_ISR_TIM2_POS 28 +#define STM_ISR_TIM3_POS 29 +#define STM_ISR_TIM4_POS 30 +#define STM_ISR_I2C1_EVT_POS 31 +#define STM_ISR_I2C1_ERR_POS 32 +#define STM_ISR_I2C2_EVT_POS 33 +#define STM_ISR_I2C2_ERR_POS 34 +#define STM_ISR_SPI1_POS 35 +#define STM_ISR_SPI2_POS 36 #define STM_ISR_USART1_POS 37 #define STM_ISR_USART2_POS 38 #define STM_ISR_USART3_POS 39 +#define STM_ISR_EXTI15_10_POS 40 +#define STM_ISR_EXTI17_RTC_ALARM_POS 41 +#define STM_ISR_EXTI18_OTG_FS_WKUP_POS 42 +#define STM_ISR_TIM2_BRK_TIM12_POS 43 +#define STM_ISR_TIM8_UP_TIM13_POS 44 +#define STM_ISR_TIM8_TRG_COM_TIM14_POS 45 +#define STM_ISR_TIM8_CC_POS 46 +#define STM_ISR_DMA1_STREAM7_POS 47 +#define STM_ISR_FSMC_POS 48 +#define STM_ISR_SDIO_POS 49 +#define STM_ISR_TIM5_POS 50 +#define STM_ISR_SPI3_POS 41 #define STM_ISR_UART4_POS 52 #define STM_ISR_UART5_POS 53 +#define STM_ISR_TIM6_GLB_IT_DAC1_DAC2_POS 54 +#define STM_ISR_TIM7_POS 55 +#define STM_ISR_DMA2_STREAM0_POS 56 +#define STM_ISR_DMA2_STREAM1_POS 57 +#define STM_ISR_DMA2_STREAM2_POS 58 +#define STM_ISR_DMA2_STREAM3_POS 59 +#define STM_ISR_DMA2_STREAM4_POS 60 +#define STM_ISR_DFSDM1_FLT0_POS 61 +#define STM_ISR_DFSDM1_FLT1_POS 62 +#define STM_ISR_CAN2_TX_POS 63 +#define STM_ISR_CAN2_RX0_POS 64 +#define STM_ISR_CAN2_RX1_POS 65 +#define STM_ISR_CAN2_SCE_POS 66 +#define STM_ISR_OTG_FS_POS 67 +#define STM_ISR_DMA2_STREAM5_POS 68 +#define STM_ISR_DMA2_STREAM6_POS 69 +#define STM_ISR_DMA2_STREAM7_POS 70 #define STM_ISR_USART6_POS 71 #define STM_ISR_UART7_POS 82 #define STM_ISR_UART9_POS 88 @@ -930,6 +1004,441 @@ extern struct stm_usart stm_usart6; #define STM_USART_CR3_IREN (1) /* IrDA mode enable */ #define STM_USART_CR3_EIE (0) /* Error interrupt enable */ +/* USB */ +struct stm_usb { + vuint32_t gotgctl; + vuint32_t gotgint; + vuint32_t gahbcfg; + vuint32_t gusbcfg; + + vuint32_t grstctl; + vuint32_t gintsts; + vuint32_t gintmsk; + vuint32_t grxstsr; + + vuint32_t grxstsp; + vuint32_t grxfsiz; + vuint32_t dieptxf0; + vuint32_t hnptxsts; + + vuint32_t pad_30; + vuint32_t pad_34; + vuint32_t gccfg; + vuint32_t cid; + + vuint32_t pad_40; + vuint32_t pad_44; + vuint32_t pad_48; + vuint32_t ghwcfg3; /* not in docs? */ + + vuint32_t pad_50; + vuint32_t glpmcfg; + vuint32_t pad_58; + vuint32_t gdfifocfg; /* not in docs? */ + + uint8_t pad_60[0x100 - 0x60]; + + vuint32_t hptxfsiz; /* 0x100 */ + vuint32_t dieptxf[0xf]; /* 0x104 5 in docs? */ + + uint8_t pad_140[0x400 - 0x140]; + + vuint32_t hcfg; + vuint32_t hfir; + vuint32_t hfnum; + vuint32_t pad_40c; + + vuint32_t hptxsts; + vuint32_t haint; + vuint32_t haintmsk; + vuint32_t pad_41c; + + uint8_t pad_420[0x440-0x420]; + + vuint32_t hprt; + + uint8_t pad_444[0x500 - 0x444]; + + vuint32_t hcchar0; + vuint32_t pad_504; + vuint32_t hcint0; + vuint32_t hcintmsk0; + + vuint32_t hctsiz0; + vuint32_t pad_514; + vuint32_t pad_518; + vuint32_t pad_51c; + + struct { + vuint32_t hcchar; + vuint32_t pad_4; + vuint32_t hcint; + vuint32_t hcintmsk; + + vuint32_t hctsiz; + vuint32_t pad_14; + vuint32_t pad_18; + vuint32_t pad_1c; + } h[11]; + + uint8_t pad_680[0x800 - 0x680]; + + vuint32_t dcfg; + vuint32_t dctl; + vuint32_t dsts; + vuint32_t pad_80c; + + vuint32_t diepmsk; + vuint32_t doepmsk; + vuint32_t daint; + vuint32_t daintmsk; + + vuint32_t pad_820; + vuint32_t pad_824; + vuint32_t dvbusdis; + vuint32_t dvbuspulse; + + vuint32_t pad_830; + vuint32_t diepempmsk; + + uint8_t pad_838[0x900 - 0x838]; + + struct { + vuint32_t diepctl; + vuint32_t pad_04; + vuint32_t diepint; + vuint32_t pad_0c; + + vuint32_t dieptsiz; + vuint32_t pad_14; + vuint32_t dtxfsts; + vuint32_t pad_1c; + } diep[6]; + + uint8_t pad_9c0[0xb00 - 0x9c0]; + + struct { + vuint32_t doepctl; + vuint32_t pad_04; + vuint32_t doepint; + vuint32_t pad_0c; + + vuint32_t doeptsiz; + vuint32_t pad_14; + vuint32_t pad_18; + vuint32_t pad_1c; + } doep[6]; + + uint8_t pad_bc0[0xe00 - 0xbc0]; + + vuint32_t pcgcctl; + + uint8_t pad_e04[0x1000 - 0xe04]; + + struct { + vuint32_t fifo; + uint8_t pad_004[0x1000 - 0x004]; + } dfifo[6]; +}; + +extern struct stm_usb stm_usb; + +#define stm_usb (*((struct stm_usb *) 0x50000000)) + +#define STM_USB_GOTGCTL_CURMOD 21 +#define STM_USB_GOTGCTL_OTGVER 20 +#define STM_USB_GOTGCTL_BSVLD 19 +#define STM_USB_GOTGCTL_ASVLD 18 +#define STM_USB_GOTGCTL_DBCT 17 +#define STM_USB_GOTGCTL_CIDSTS 16 +#define STM_USB_GOTGCTL_EHEN 12 +#define STM_USB_GOTGCTL_DHNPEN 11 +#define STM_USB_GOTGCTL_HSHNPEN 10 +#define STM_USB_GOTGCTL_HNPRQ 9 +#define STM_USB_GOTGCTL_HNGSCS 8 +#define STM_USB_GOTGCTL_BVALOVAL 7 +#define STM_USB_GOTGCTL_BVALOEN 6 +#define STM_USB_GOTGCTL_AVALOVAL 5 +#define STM_USB_GOTGCTL_AVALOEN 4 +#define STM_USB_GOTGCTL_VBVALOVAL 3 +#define STM_USB_GOTGCTL_VBVALOEN 2 +#define STM_USB_GOTGCTL_SRQ 1 +#define STM_USB_GOTGCTL_SRQSCS 0 + +#define STM_USB_GOTGINT_IDCHNG 20 +#define STM_USB_GOTGINT_DBCDNE 19 +#define STM_USB_GOTGINT_ADTOCHG 18 +#define STM_USB_GOTGINT_HNGDET 17 +#define STM_USB_GOTGINT_HNSSCHG 9 +#define STM_USB_GOTGINT_SRSSCHG 8 +#define STM_USB_GOTGINT_SEDET 2 + +#define STM_USB_GAHBCFG_PTXFELVL 8 +#define STM_USB_GAHBCFG_TXFELVL 7 +#define STM_USB_GAHBCFG_GINTMSK 0 + +#define STM_USB_GUSBCFG_FDMOD 30 +#define STM_USB_GUSBCFG_FHMOD 29 +#define STM_USB_GUSBCFG_TRDT 10 +#define STM_USB_GUSBCFG_TRDT_MASK 0xf +#define STM_USB_GUSBCFG_HNPCAP 9 +#define STM_USB_GUSBCFG_SRPCAP 8 +#define STM_USB_GUSBCFG_PHYSEL 6 +#define STM_USB_GUSBCFG_TOCAL 0 +#define STM_USB_GUSBCFG_TOCAL_MASK 0x7 + +#define STM_USB_GRSTCTL_AHBIDL 31 +#define STM_USB_GRSTCTL_TXFNUM 6 +#define STM_USB_GRSTCTL_TXFNUM_ALL 0x10 +#define STM_USB_GRSTCTL_TXFNUM_MASK 0x1f +#define STM_USB_GRSTCTL_TXFFLSH 5 +#define STM_USB_GRSTCTL_RXFFLSH 4 +#define STM_USB_GRSTCTL_FCRST 2 +#define STM_USB_GRSTCTL_PSRST 1 +#define STM_USB_GRSTCTL_CSRST 0 + +#define STM_USB_GINTSTS_WKUPINT 31 +#define STM_USB_GINTSTS_SRQINT 30 +#define STM_USB_GINTSTS_DISCINT 29 +#define STM_USB_GINTSTS_CIDSCHG 28 +#define STM_USB_GINTSTS_LPMINT 27 +#define STM_USB_GINTSTS_PTXFE 26 +#define STM_USB_GINTSTS_HCINT 25 +#define STM_USB_GINTSTS_HPRTINT 24 +#define STM_USB_GINTSTS_RSTDET 23 +#define STM_USB_GINTSTS_IPXFER 21 +#define STM_USB_GINTSTS_IISOIXFR 20 +#define STM_USB_GINTSTS_OEPINT 19 +#define STM_USB_GINTSTS_IEPINT 18 +#define STM_USB_GINTSTS_EOPF 15 +#define STM_USB_GINTSTS_ISOODRP 14 +#define STM_USB_GINTSTS_ENUMDNE 13 +#define STM_USB_GINTSTS_USBRST 12 +#define STM_USB_GINTSTS_USBSUSP 11 +#define STM_USB_GINTSTS_ESUSP 10 +#define STM_USB_GINTSTS_GONAKEFF 7 +#define STM_USB_GINTSTS_GINAKEFF 6 +#define STM_USB_GINTSTS_NPTXFE 5 +#define STM_USB_GINTSTS_RXFLVL 4 +#define STM_USB_GINTSTS_SOF 3 +#define STM_USB_GINTSTS_OTGINT 2 +#define STM_USB_GINTSTS_MMIS 1 +#define STM_USB_GINTSTS_CMOD 0 + +#define STM_USB_GINTMSK_WUIM 31 +#define STM_USB_GINTMSK_SRQIM 30 +#define STM_USB_GINTMSK_DISCINT 29 +#define STM_USB_GINTMSK_CIDSCHGM 28 +#define STM_USB_GINTMSK_LPMINTM 27 +#define STM_USB_GINTMSK_PTXFEM 26 +#define STM_USB_GINTMSK_HCIM 25 +#define STM_USB_GINTMSK_PRTIM 24 +#define STM_USB_GINTMSK_RSTDETM 23 +#define STM_USB_GINTMSK_IPXFERM 21 /* host mode */ +#define STM_USB_GINTMSK_IISOOXFRM 21 /* device mode */ +#define STM_USB_GINTMSK_IISOIXFRM 20 +#define STM_USB_GINTMSK_OEPINT 19 +#define STM_USB_GINTMSK_IEPINT 18 +#define STM_USB_GINTMSK_EOPFM 15 +#define STM_USB_GINTMSK_ISOODRPM 14 +#define STM_USB_GINTMSK_ENUMDNEM 13 +#define STM_USB_GINTMSK_USBRST 12 +#define STM_USB_GINTMSK_USBSUSPM 11 +#define STM_USB_GINTMSK_ESUSPM 10 +#define STM_USB_GINTMSK_GONAKEFFM 7 +#define STM_USB_GINTMSK_GINAKEFFM 6 +#define STM_USB_GINTMSK_NPTXFEM 5 +#define STM_USB_GINTMSK_RXFLVLM 4 +#define STM_USB_GINTMSK_SOFM 3 +#define STM_USB_GINTMSK_OTGINT 2 +#define STM_USB_GINTMSK_MMISM 1 + +#define STM_USB_GRXSTSP_STSPHST 27 +#define STM_USB_GRXSTSP_FRMNUM 21 +#define STM_USB_GRXSTSP_FRMNUM_MASK 0xf +#define STM_USB_GRXSTSP_PKTSTS 17 +#define STM_USB_GRXSTSP_PKTSTS_NAK 1 +#define STM_USB_GRXSTSP_PKTSTS_OUT_DATA 2 +#define STM_USB_GRXSTSP_PKTSTS_OUT_COMPLETE 3 +#define STM_USB_GRXSTSP_PKTSTS_SETUP_COMPLETE 4 +#define STM_USB_GRXSTSP_PKTSTS_SETUP_DATA 5 +#define STM_USB_GRXSTSP_PKTSTS_MASK 0xf +#define STM_USB_GRXSTSP_DPID 15 +#define STM_USB_GRXSTSP_DPID_MASK 3 +#define STM_USB_GRXSTSP_BCNT 4 +#define STM_USB_GRXSTSP_BCNT 4 +#define STM_USB_GRXSTSP_BCNT_MASK 0x3ff +#define STM_USB_GRXSTSP_EPNUM 0 +#define STM_USB_GRXSTSP_EPNUM_MASK 0xf + +#define STM_USB_GRXFSIZ_RXFD 0 +#define STM_USB_GRXFSIZ_RXFD_MASK 0xffff + +#define STM_USB_GCCFG_VBDEN 21 +#define STM_USB_GCCFG_SDEN 20 +#define STM_USB_GCCFG_PDEN 19 +#define STM_USB_GCCFG_DCDEN 18 +#define STM_USB_GCCFG_BCDEN 17 +#define STM_USB_GCCFG_PWRDWN 16 +#define STM_USB_GCCFG_PS2DET 3 +#define STM_USB_GCCFG_SDET 2 +#define STM_USB_GCCFG_PDET 1 +#define STM_USB_GCCFG_DCDET 0 + +#define STM_USB_DIEPTXF0_TX0FD 16 +#define STM_USB_DIEPTXF0_TX0FSA 0 + +#define STM_USB_DCFG_ERRATIM 15 +#define STM_USB_DCFG_PFIVL 11 +#define STM_USB_DCFG_PFIVL_80 0 +#define STM_USB_DCFG_PFIVL_85 1 +#define STM_USB_DCFG_PFIVL_90 2 +#define STM_USB_DCFG_PFIVL_95 3 +#define STM_USB_DCFG_PFIVL_MASK 3 +#define STM_USB_DCFG_DAD 4 +#define STM_USB_DCFG_DAD_MASK 0x7f +#define STM_USB_DCFG_NZLSOHSK 2 +#define STM_USB_DCFG_DSPD 0 +#define STM_USB_DCFG_DSPD_FULL_SPEED 3 +#define STM_USB_DCFG_DSPD_MASK 3 +#define STM_USB_DCFG_ +#define STM_USB_DCFG_ +#define STM_USB_DCFG_ +#define STM_USB_DCFG_ +#define STM_USB_DCFG_ +#define STM_USB_DCFG_ +#define STM_USB_DCFG_ + +#define STM_USB_DCTL_DSBESLRJCT 18 +#define STM_USB_DCTL_POPRGDNE 11 +#define STM_USB_DCTL_CGONAK 10 +#define STM_USB_DCTL_SGONAK 9 +#define STM_USB_DCTL_CGINAK 8 +#define STM_USB_DCTL_SGINAK 7 +#define STM_USB_DCTL_TCTL 4 +#define STM_USB_DCTL_GONSTS 3 +#define STM_USB_DCTL_GINSTS 2 +#define STM_USB_DCTL_SDIS 1 +#define STM_USB_DCTL_RWUSIG 0 + +#define STM_USB_DSTS_DEVLNSTS 22 +#define STM_USB_DSTS_DEVLNSTS_MASK 0x3 +#define STM_USB_DSTS_FNSOF 8 +#define STM_USB_DSTS_FNSOF_MASK 0x3fff +#define STM_USB_DSTS_EERR 3 +#define STM_USB_DSTS_ENUMSPD 1 +#define STM_USB_DSTS_ENUMSPD_MASK 3 +#define STM_USB_DSTS_SUSPSTS 0 + +#define STM_USB_DIEPMSK_NAKM 13 +#define STM_USB_DIEPMSK_TXFURM 8 +#define STM_USB_DIEPMSK_INEPNEM 6 +#define STM_USB_DIEPMSK_INEPNMM 5 +#define STM_USB_DIEPMSK_ITTXFEMSK 4 +#define STM_USB_DIEPMSK_TOM 3 +#define STM_USB_DIEPMSK_EPDM 1 +#define STM_USB_DIEPMSK_XFRCM 0 + +#define STM_USB_DOEPMSK_NYETMSK 14 +#define STM_USB_DOEPMSK_NAKMSK 13 +#define STM_USB_DOEPMSK_BERRM 12 +#define STM_USB_DOEPMSK_OUTPKTERRM 8 +#define STM_USB_DOEPMSK_STSPHSRXM 5 +#define STM_USB_DOEPMSK_OTEPDM 4 +#define STM_USB_DOEPMSK_STUPM 3 +#define STM_USB_DOEPMSK_EPDM 1 +#define STM_USB_DOEPMSK_XFRCM 0 + +#define STM_USB_DAINT_OEPINT 16 +#define STM_USB_DAINT_OEPINT_MASK 0xffff +#define STM_USB_DAINT_IEPINT 16 +#define STM_USB_DAINT_IEPINT_MASK 0xffff + +#define STM_USB_DAINTMSK_OEPM 16 +#define STM_USB_DAINTMSK_OEPM_MASK 0xffff +#define STM_USB_DAINTMSK_IEPM 0 +#define STM_USB_DAINTMSK_IEPM_MASK 0xffff + +#define STM_USB_DIEPCTL_EPENA 31 +#define STM_USB_DIEPCTL_EPDIS 30 +#define STM_USB_DIEPCTL_SNAK 27 +#define STM_USB_DIEPCTL_CNAK 26 +#define STM_USB_DIEPCTL_TXFNUM 22 +#define STM_USB_DIEPCTL_TXFNUM_MASK 0xf +#define STM_USB_DIEPCTL_STALL 21 +#define STM_USB_DIEPCTL_EPTYP 18 +#define STM_USB_DIEPCTL_EPTYP_CONTROL 0 +#define STM_USB_DIEPCTL_EPTYP_ISOCHRONOUS 1 +#define STM_USB_DIEPCTL_EPTYP_BULK 2 +#define STM_USB_DIEPCTL_EPTYP_INTERRUPT 3 +#define STM_USB_DIEPCTL_EPTYP_MASK 3 +#define STM_USB_DIEPCTL_NAKSTS 17 +#define STM_USB_DIEPCTL_EONUM 16 +#define STM_USB_DIEPCTL_USBAEP 15 +#define STM_USB_DIEPCTL_MPSIZ 0 +#define STM_USB_DIEPCTL_MPSIZ0_64 0 +#define STM_USB_DIEPCTL_MPSIZ0_32 1 +#define STM_USB_DIEPCTL_MPSIZ0_16 2 +#define STM_USB_DIEPCTL_MPSIZ0_8 3 +#define STM_USB_DIEPCTL_MPSIZ0_MASK 3 +#define STM_USB_DIEPCTL_MPSIZ_MASK 0x7f + +#define STM_USB_DIEPINT_NAK 13 +#define STM_USB_DIEPINT_PKTDRPSTS 11 +#define STM_USB_DIEPINT_TXFIFOUDRN 8 +#define STM_USB_DIEPINT_TXFE 7 +#define STM_USB_DIEPINT_INEPNE 6 +#define STM_USB_DIEPINT_INEPNM 5 +#define STM_USB_DIEPINT_ITTXFE 4 +#define STM_USB_DIEPINT_TOC 3 +#define STM_USB_DIEPINT_EPDISD 1 +#define STM_USB_DIEPINT_XFRC 0 + +#define STM_USB_DIEPTSIZ_MCNT 29 +#define STM_USB_DIEPTSIZ_MCNT_MASK 3 +#define STM_USB_DIEPTSIZ_PKTCNT 19 +#define STM_USB_DIEPTSIZ_PKTCNT0_MASK 3 +#define STM_USB_DIEPTSIZ_PKTCNT_MASK 0x3ff +#define STM_USB_DIEPTSIZ_XFRSIZ 0 +#define STM_USB_DIEPTSIZ_XFRSIZ0_MASK 0x7f +#define STM_USB_DIEPTSIZ_XFRSIZ_MASK 0x7ffff + +#define STM_USB_DOEPCTL_EPENA 31 +#define STM_USB_DOEPCTL_EPDIS 30 +#define STM_USB_DOEPCTL_SNAK 27 +#define STM_USB_DOEPCTL_CNAK 26 +#define STM_USB_DOEPCTL_STALL 21 +#define STM_USB_DOEPCTL_SNPM 20 +#define STM_USB_DOEPCTL_EPTYP 18 +#define STM_USB_DOEPCTL_EPTYP_CONTROL 0 +#define STM_USB_DOEPCTL_EPTYP_ISOCHRONOUS 1 +#define STM_USB_DOEPCTL_EPTYP_BULK 2 +#define STM_USB_DOEPCTL_EPTYP_INTERRUPT 3 +#define STM_USB_DOEPCTL_EPTYP_MASK 3 +#define STM_USB_DOEPCTL_NAKSTS 17 +#define STM_USB_DOEPCTL_USBAEP 15 +#define STM_USB_DOEPCTL_MPSIZ 0 +#define STM_USB_DOEPCTL_MPSIZ0_64 0 +#define STM_USB_DOEPCTL_MPSIZ0_32 1 +#define STM_USB_DOEPCTL_MPSIZ0_16 2 +#define STM_USB_DOEPCTL_MPSIZ0_8 3 +#define STM_USB_DOEPCTL_MPSIZ0_MASK 3 + +#define STM_USB_DOEPINT_NAK 13 +#define STM_USB_DOEPINT_BERR 12 +#define STM_USB_DOEPINT_OUTPKTERR 8 +#define STM_USB_DOEPINT_STSPHSRX 5 +#define STM_USB_DOEPINT_OTEPDIS 4 +#define STM_USB_DOEPINT_STUP 3 +#define STM_USB_DOEPINT_EPDISD 1 +#define STM_USB_DOEPINT_XFRC 0 + +#define STM_USB_DOEPTSIZ_STUPCNT 29 +#define STM_USB_DOEPTSIZ_STUPCNT_MASK 3 +#define STM_USB_DOEPTSIZ_PKTCNT 19 +#define STM_USB_DOEPTSIZ_XFRSIZ 0 +#define STM_USB_DOEPTSIZ_XFRSIZ_MASK 0x7f + /* Errata 2.1.5 Delay after an RCC peripheral clock enabling -- cgit v1.2.3 From 600689b39d9bc604b0a8b586c8a93a465a42fc3b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 2 Oct 2018 12:45:39 -0700 Subject: altos/stm32f4: Add external interrupt bits Signed-off-by: Keith Packard --- src/stm32f4/ao_exti.h | 50 +++++++++++++ src/stm32f4/ao_exti_stm32f4.c | 162 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 212 insertions(+) create mode 100644 src/stm32f4/ao_exti.h create mode 100644 src/stm32f4/ao_exti_stm32f4.c diff --git a/src/stm32f4/ao_exti.h b/src/stm32f4/ao_exti.h new file mode 100644 index 00000000..0216f352 --- /dev/null +++ b/src/stm32f4/ao_exti.h @@ -0,0 +1,50 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#ifndef _AO_EXTI_H_ +#define _AO_EXTI_H_ + +#define AO_EXTI_MODE_RISING 1 +#define AO_EXTI_MODE_FALLING 2 +#define AO_EXTI_MODE_PULL_NONE AO_GPIO_MODE_PULL_NONE +#define AO_EXTI_MODE_PULL_UP AO_GPIO_MODE_PULL_UP +#define AO_EXTI_MODE_PULL_DOWN AO_GPIO_MODE_PULL_DOWN +#define AO_EXTI_PRIORITY_LOW 16 +#define AO_EXTI_PRIORITY_MED 0 +#define AO_EXTI_PRIORITY_HIGH 32 +#define AO_EXTI_PIN_NOCONFIGURE 64 + +void +ao_exti_setup(struct stm_gpio *gpio, uint8_t pin, uint8_t mode, void (*callback)()); + +void +ao_exti_set_mode(struct stm_gpio *gpio, uint8_t pin, uint8_t mode); + +void +ao_exti_set_callback(struct stm_gpio *gpio, uint8_t pin, void (*callback)()); + +void +ao_exti_enable(struct stm_gpio *gpio, uint8_t pin); + +void +ao_exti_disable(struct stm_gpio *gpio, uint8_t pin); + +void +ao_exti_init(void); + +#endif /* _AO_EXTI_H_ */ diff --git a/src/stm32f4/ao_exti_stm32f4.c b/src/stm32f4/ao_exti_stm32f4.c new file mode 100644 index 00000000..1e288f9c --- /dev/null +++ b/src/stm32f4/ao_exti_stm32f4.c @@ -0,0 +1,162 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#include +#include + +static void (*ao_exti_callback[16])(void); + +uint32_t ao_last_exti; + +static void ao_exti_one_isr(uint8_t pin) { + uint32_t pending = (ao_last_exti = stm_exti.pr) & (1 << pin); + + stm_exti.pr = pending; + if (pending && ao_exti_callback[pin]) + (*ao_exti_callback[pin])(); +} + +static void ao_exti_range_isr(uint8_t first, uint8_t last, uint16_t mask) { + uint16_t pending = (ao_last_exti = stm_exti.pr) & mask; + uint8_t pin; + static uint16_t last_mask; + static uint8_t last_pin; + + if (pending == last_mask) { + stm_exti.pr = last_mask; + (*ao_exti_callback[last_pin])(); + return; + } + stm_exti.pr = pending; + for (pin = first; pin <= last; pin++) + if ((pending & ((uint32_t) 1 << pin)) && ao_exti_callback[pin]) { + last_mask = (1 << pin); + last_pin = pin; + (*ao_exti_callback[pin])(); + } +} + +void stm_exti0_isr(void) { ao_exti_one_isr(0); } +void stm_exti1_isr(void) { ao_exti_one_isr(1); } +void stm_exti2_isr(void) { ao_exti_one_isr(2); } +void stm_exti3_isr(void) { ao_exti_one_isr(3); } +void stm_exti4_isr(void) { ao_exti_one_isr(4); } +void stm_exti9_5_isr(void) { ao_exti_range_isr(5, 9, 0x3e0); } +void stm_exti15_10_isr(void) { ao_exti_range_isr(10, 15, 0xfc00); } + +void +ao_exti_setup (struct stm_gpio *gpio, uint8_t pin, uint8_t mode, void (*callback)(void)) { + uint32_t mask = 1 << pin; + uint32_t pupdr; + uint8_t irq; + uint8_t prio; + + ao_exti_callback[pin] = callback; + + /* configure gpio to interrupt routing */ + stm_exticr_set(gpio, pin); + + if (!(mode & AO_EXTI_PIN_NOCONFIGURE)) { + /* configure pin as input, setting selected pull-up/down mode */ + stm_moder_set(gpio, pin, STM_MODER_INPUT); + switch (mode & (AO_EXTI_MODE_PULL_UP|AO_EXTI_MODE_PULL_DOWN)) { + case 0: + default: + pupdr = STM_PUPDR_NONE; + break; + case AO_EXTI_MODE_PULL_UP: + pupdr = STM_PUPDR_PULL_UP; + break; + case AO_EXTI_MODE_PULL_DOWN: + pupdr = STM_PUPDR_PULL_DOWN; + break; + } + stm_pupdr_set(gpio, pin, pupdr); + } + + /* Set interrupt mask and rising/falling mode */ + stm_exti.imr &= ~mask; + if (mode & AO_EXTI_MODE_RISING) + stm_exti.rtsr |= mask; + else + stm_exti.rtsr &= ~mask; + if (mode & AO_EXTI_MODE_FALLING) + stm_exti.ftsr |= mask; + else + stm_exti.ftsr &= ~mask; + + if (pin <= 4) + irq = STM_ISR_EXTI0_POS + pin; + else if (pin <= 9) + irq = STM_ISR_EXTI9_5_POS; + else + irq = STM_ISR_EXTI15_10_POS; + + /* Set priority */ + prio = AO_STM_NVIC_MED_PRIORITY; + if (mode & AO_EXTI_PRIORITY_LOW) + prio = AO_STM_NVIC_LOW_PRIORITY; + else if (mode & AO_EXTI_PRIORITY_HIGH) + prio = AO_STM_NVIC_HIGH_PRIORITY; + + stm_nvic_set_priority(irq, prio); + stm_nvic_set_enable(irq); +} + +void +ao_exti_set_mode(struct stm_gpio *gpio, uint8_t pin, uint8_t mode) { + (void) gpio; + + uint32_t mask = 1 << pin; + + if (mode & AO_EXTI_MODE_RISING) + stm_exti.rtsr |= mask; + else + stm_exti.rtsr &= ~mask; + if (mode & AO_EXTI_MODE_FALLING) + stm_exti.ftsr |= mask; + else + stm_exti.ftsr &= ~mask; +} + +void +ao_exti_set_callback(struct stm_gpio *gpio, uint8_t pin, void (*callback)()) { + (void) gpio; + ao_exti_callback[pin] = callback; +} + +void +ao_exti_enable(struct stm_gpio *gpio, uint8_t pin) { + uint32_t mask = (1 << pin); + (void) gpio; + stm_exti.pr = mask; + stm_exti.imr |= mask; +} + +void +ao_exti_disable(struct stm_gpio *gpio, uint8_t pin) { + uint32_t mask = (1 << pin); + (void) gpio; + stm_exti.imr &= ~mask; + stm_exti.pr = mask; +} + +void +ao_exti_init(void) +{ +} -- cgit v1.2.3 From 4a246b4cb5ee8e8894ea3492187a08e1e4f719bb Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 2 Oct 2018 12:46:01 -0700 Subject: altos/stm32f4: Add stm32f413 USART support Signed-off-by: Keith Packard --- src/stm32f4/ao_serial_stm32f4.c | 544 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 544 insertions(+) create mode 100644 src/stm32f4/ao_serial_stm32f4.c diff --git a/src/stm32f4/ao_serial_stm32f4.c b/src/stm32f4/ao_serial_stm32f4.c new file mode 100644 index 00000000..bcecc791 --- /dev/null +++ b/src/stm32f4/ao_serial_stm32f4.c @@ -0,0 +1,544 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#include +#include + +static int +_ao_usart_tx_start(struct ao_stm_usart *usart) +{ + if (!ao_fifo_empty(usart->tx_fifo)) { +#if HAS_SERIAL_SW_FLOW + if (usart->gpio_cts && ao_gpio_get(usart->gpio_cts, usart->pin_cts) == 1) { + ao_exti_enable(usart->gpio_cts, usart->pin_cts); + return 0; + } +#endif + if (usart->reg->sr & (1 << STM_USART_SR_TXE)) + { + usart->tx_running = 1; + usart->reg->cr1 |= (1 << STM_USART_CR1_TXEIE) | (1 << STM_USART_CR1_TCIE); + ao_fifo_remove(usart->tx_fifo, usart->reg->dr); + ao_wakeup(&usart->tx_fifo); + return 1; + } + } + return 0; +} + +#if HAS_SERIAL_SW_FLOW +static void +_ao_usart_cts(struct ao_stm_usart *usart) +{ + if (_ao_usart_tx_start(usart)) + ao_exti_disable(usart->gpio_cts, usart->pin_cts); +} +#endif + +static void +_ao_usart_rx(struct ao_stm_usart *usart, int is_stdin) +{ + if (usart->reg->sr & (1 << STM_USART_SR_RXNE)) { + if (!ao_fifo_full(usart->rx_fifo)) { + ao_fifo_insert(usart->rx_fifo, usart->reg->dr); + ao_wakeup(&usart->rx_fifo); + if (is_stdin) + ao_wakeup(&ao_stdin_ready); +#if HAS_SERIAL_SW_FLOW + /* If the fifo is nearly full, turn off RTS and wait + * for it to drain a bunch + */ + if (usart->gpio_rts && ao_fifo_mostly(usart->rx_fifo)) { + ao_gpio_set(usart->gpio_rts, usart->pin_rts, 1); + usart->rts = 0; + } +#endif + } else { + usart->reg->cr1 &= ~(1 << STM_USART_CR1_RXNEIE); + } + } +} + +static void +ao_usart_isr(struct ao_stm_usart *usart, int is_stdin) +{ + _ao_usart_rx(usart, is_stdin); + + if (!_ao_usart_tx_start(usart)) + usart->reg->cr1 &= ~(1<< STM_USART_CR1_TXEIE); + + if (usart->reg->sr & (1 << STM_USART_SR_TC)) { + usart->tx_running = 0; + usart->reg->cr1 &= ~(1 << STM_USART_CR1_TCIE); + if (usart->draining) { + usart->draining = 0; + ao_wakeup(&usart->tx_fifo); + } + } +} + +static int +_ao_usart_pollchar(struct ao_stm_usart *usart) +{ + int c; + + if (ao_fifo_empty(usart->rx_fifo)) + c = AO_READ_AGAIN; + else { + uint8_t u; + ao_fifo_remove(usart->rx_fifo,u); + if ((usart->reg->cr1 & (1 << STM_USART_CR1_RXNEIE)) == 0) { + if (ao_fifo_barely(usart->rx_fifo)) + usart->reg->cr1 |= (1 << STM_USART_CR1_RXNEIE); + } +#if HAS_SERIAL_SW_FLOW + /* If we've cleared RTS, check if there's space now and turn it back on */ + if (usart->gpio_rts && usart->rts == 0 && ao_fifo_barely(usart->rx_fifo)) { + ao_gpio_set(usart->gpio_rts, usart->pin_rts, 0); + usart->rts = 1; + } +#endif + c = u; + } + return c; +} + +static char +ao_usart_getchar(struct ao_stm_usart *usart) +{ + int c; + ao_arch_block_interrupts(); + while ((c = _ao_usart_pollchar(usart)) == AO_READ_AGAIN) + ao_sleep(&usart->rx_fifo); + ao_arch_release_interrupts(); + return (char) c; +} + +static inline uint8_t +_ao_usart_sleep_for(struct ao_stm_usart *usart, uint16_t timeout) +{ + return ao_sleep_for(&usart->rx_fifo, timeout); +} + +static void +ao_usart_putchar(struct ao_stm_usart *usart, char c) +{ + ao_arch_block_interrupts(); + while (ao_fifo_full(usart->tx_fifo)) + ao_sleep(&usart->tx_fifo); + ao_fifo_insert(usart->tx_fifo, c); + _ao_usart_tx_start(usart); + ao_arch_release_interrupts(); +} + +static void +ao_usart_drain(struct ao_stm_usart *usart) +{ + ao_arch_block_interrupts(); + while (!ao_fifo_empty(usart->tx_fifo) || usart->tx_running) { + usart->draining = 1; + ao_sleep(&usart->tx_fifo); + } + ao_arch_release_interrupts(); +} + +static const struct { + uint32_t brr; +} ao_usart_speeds[] = { + [AO_SERIAL_SPEED_4800] = { + AO_PCLK1 / 4800 + }, + [AO_SERIAL_SPEED_9600] = { + AO_PCLK1 / 9600 + }, + [AO_SERIAL_SPEED_19200] = { + AO_PCLK1 / 19200 + }, + [AO_SERIAL_SPEED_57600] = { + AO_PCLK1 / 57600 + }, + [AO_SERIAL_SPEED_115200] = { + AO_PCLK1 / 115200 + }, +}; + +static void +ao_usart_set_speed(struct ao_stm_usart *usart, uint8_t speed) +{ + if (speed > AO_SERIAL_SPEED_115200) + return; + usart->reg->brr = ao_usart_speeds[speed].brr; +} + +static void +ao_usart_init(struct ao_stm_usart *usart, int hw_flow) +{ + usart->reg->cr1 = ((0 << STM_USART_CR1_OVER8) | + (1 << STM_USART_CR1_UE) | + (0 << STM_USART_CR1_M) | + (0 << STM_USART_CR1_WAKE) | + (0 << STM_USART_CR1_PCE) | + (0 << STM_USART_CR1_PS) | + (0 << STM_USART_CR1_PEIE) | + (0 << STM_USART_CR1_TXEIE) | + (0 << STM_USART_CR1_TCIE) | + (1 << STM_USART_CR1_RXNEIE) | + (0 << STM_USART_CR1_IDLEIE) | + (1 << STM_USART_CR1_TE) | + (1 << STM_USART_CR1_RE) | + (0 << STM_USART_CR1_RWU) | + (0 << STM_USART_CR1_SBK)); + + usart->reg->cr2 = ((0 << STM_USART_CR2_LINEN) | + (STM_USART_CR2_STOP_1 << STM_USART_CR2_STOP) | + (0 << STM_USART_CR2_CLKEN) | + (0 << STM_USART_CR2_CPOL) | + (0 << STM_USART_CR2_CPHA) | + (0 << STM_USART_CR2_LBCL) | + (0 << STM_USART_CR2_LBDIE) | + (0 << STM_USART_CR2_LBDL) | + (0 << STM_USART_CR2_ADD)); + + usart->reg->cr3 = ((0 << STM_USART_CR3_ONEBITE) | + (0 << STM_USART_CR3_CTSIE) | + (0 << STM_USART_CR3_CTSE) | + (0 << STM_USART_CR3_RTSE) | + (0 << STM_USART_CR3_DMAT) | + (0 << STM_USART_CR3_DMAR) | + (0 << STM_USART_CR3_SCEN) | + (0 << STM_USART_CR3_NACK) | + (0 << STM_USART_CR3_HDSEL) | + (0 << STM_USART_CR3_IRLP) | + (0 << STM_USART_CR3_IREN) | + (0 << STM_USART_CR3_EIE)); + + if (hw_flow) + usart->reg->cr3 |= ((1 << STM_USART_CR3_CTSE) | + (1 << STM_USART_CR3_RTSE)); + + /* Pick a 9600 baud rate */ + ao_usart_set_speed(usart, AO_SERIAL_SPEED_9600); +} + +#if HAS_SERIAL_HW_FLOW +static void +ao_usart_set_flow(struct ao_stm_usart *usart) +{ +} +#endif + +#if HAS_SERIAL_1 + +struct ao_stm_usart ao_stm_usart1; + +void stm_usart1_isr(void) { ao_usart_isr(&ao_stm_usart1, USE_SERIAL_1_STDIN); } + +char +ao_serial1_getchar(void) +{ + return ao_usart_getchar(&ao_stm_usart1); +} + +void +ao_serial1_putchar(char c) +{ + ao_usart_putchar(&ao_stm_usart1, c); +} + +int +_ao_serial1_pollchar(void) +{ + return _ao_usart_pollchar(&ao_stm_usart1); +} + +uint8_t +_ao_serial1_sleep_for(uint16_t timeout) +{ + return _ao_usart_sleep_for(&ao_stm_usart1, timeout); +} + +void +ao_serial1_drain(void) +{ + ao_usart_drain(&ao_stm_usart1); +} + +void +ao_serial1_set_speed(uint8_t speed) +{ + ao_usart_drain(&ao_stm_usart1); + ao_usart_set_speed(&ao_stm_usart1, speed); +} +#endif /* HAS_SERIAL_1 */ + +#if HAS_SERIAL_2 + +struct ao_stm_usart ao_stm_usart2; + +void stm_usart2_isr(void) { ao_usart_isr(&ao_stm_usart2, USE_SERIAL_2_STDIN); } + +char +ao_serial2_getchar(void) +{ + return ao_usart_getchar(&ao_stm_usart2); +} + +void +ao_serial2_putchar(char c) +{ + ao_usart_putchar(&ao_stm_usart2, c); +} + +int +_ao_serial2_pollchar(void) +{ + return _ao_usart_pollchar(&ao_stm_usart2); +} + +uint8_t +_ao_serial2_sleep_for(uint16_t timeout) +{ + return _ao_usart_sleep_for(&ao_stm_usart2, timeout); +} + +void +ao_serial2_drain(void) +{ + ao_usart_drain(&ao_stm_usart2); +} + +void +ao_serial2_set_speed(uint8_t speed) +{ + ao_usart_drain(&ao_stm_usart2); + ao_usart_set_speed(&ao_stm_usart2, speed); +} + +#if HAS_SERIAL_SW_FLOW +void +ao_serial2_cts(void) +{ + _ao_usart_cts(&ao_stm_usart2); +} +#endif + +#endif /* HAS_SERIAL_2 */ + +#if HAS_SERIAL_3 + +struct ao_stm_usart ao_stm_usart3; + +void stm_usart3_isr(void) { ao_usart_isr(&ao_stm_usart3, USE_SERIAL_3_STDIN); } + +char +ao_serial3_getchar(void) +{ + return ao_usart_getchar(&ao_stm_usart3); +} + +void +ao_serial3_putchar(char c) +{ + ao_usart_putchar(&ao_stm_usart3, c); +} + +int +_ao_serial3_pollchar(void) +{ + return _ao_usart_pollchar(&ao_stm_usart3); +} + +uint8_t +_ao_serial3_sleep_for(uint16_t timeout) +{ + return _ao_usart_sleep_for(&ao_stm_usart3, timeout); +} + +void +ao_serial3_set_speed(uint8_t speed) +{ + ao_usart_drain(&ao_stm_usart3); + ao_usart_set_speed(&ao_stm_usart3, speed); +} + +void +ao_serial3_drain(void) +{ + ao_usart_drain(&ao_stm_usart3); +} +#endif /* HAS_SERIAL_3 */ + +#if HAS_SERIAL_SW_FLOW +static void +ao_serial_set_sw_rts_cts(struct ao_stm_usart *usart, + void (*isr)(void), + struct stm_gpio *port_rts, + int pin_rts, + struct stm_gpio *port_cts, + int pin_cts) +{ + /* Pull RTS low to note that there's space in the FIFO + */ + ao_enable_output(port_rts, pin_rts, 0); + usart->gpio_rts = port_rts; + usart->pin_rts = pin_rts; + usart->rts = 1; + + ao_exti_setup(port_cts, pin_cts, AO_EXTI_MODE_FALLING|AO_EXTI_PRIORITY_MED, isr); + usart->gpio_cts = port_cts; + usart->pin_cts = pin_cts; +} +#endif + +void +ao_serial_init(void) +{ +#if HAS_SERIAL_1 + /* + * TX RX + * PA9 PA10 + * PB6 PB7 * + */ + +#if SERIAL_1_PA9_PA10 + stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIOAEN); + + stm_afr_set(&stm_gpioa, 9, STM_AFR_AF7); + stm_afr_set(&stm_gpioa, 10, STM_AFR_AF7); +#else +#if SERIAL_1_PB6_PB7 + stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIOBEN); + + stm_afr_set(&stm_gpiob, 6, STM_AFR_AF7); + stm_afr_set(&stm_gpiob, 7, STM_AFR_AF7); +#else +#error "No SERIAL_1 port configuration specified" +#endif +#endif + /* Enable USART */ + stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_USART1EN); + + ao_stm_usart1.reg = &stm_usart1; + ao_usart_init(&ao_stm_usart1, 0); + + stm_nvic_set_enable(STM_ISR_USART1_POS); + stm_nvic_set_priority(STM_ISR_USART1_POS, AO_STM_NVIC_MED_PRIORITY); +#if USE_SERIAL_1_STDIN && !DELAY_SERIAL_1_STDIN + ao_add_stdio(_ao_serial1_pollchar, + ao_serial1_putchar, + NULL); +#endif +#endif + +#if HAS_SERIAL_2 + /* + * TX RX + * PA2 PA3 + * PD5 PD6 + */ + +#if SERIAL_2_PA2_PA3 + stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIOAEN); + + stm_afr_set(&stm_gpioa, 2, STM_AFR_AF7); + stm_afr_set(&stm_gpioa, 3, STM_AFR_AF7); +# if USE_SERIAL_2_FLOW +# if USE_SERIAL_2_SW_FLOW + ao_serial_set_sw_rts_cts(&ao_stm_usart2, + ao_serial2_cts, + SERIAL_2_PORT_RTS, + SERIAL_2_PIN_RTS, + SERIAL_2_PORT_CTS, + SERIAL_2_PIN_CTS); +# else + stm_afr_set(&stm_gpioa, 0, STM_AFR_AF7); + stm_afr_set(&stm_gpioa, 1, STM_AFR_AF7); +# endif +# endif +#else +#if SERIAL_2_PD5_PD6 + stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIODEN); + + stm_afr_set(&stm_gpiod, 5, STM_AFR_AF7); + stm_afr_set(&stm_gpiod, 6, STM_AFR_AF7); +#if USE_SERIAL_2_FLOW +#error "Don't know how to set flowcontrol for serial 2 on PD" +#endif +#else +#error "No SERIAL_2 port configuration specified" +#endif +#endif + /* Enable USART */ + stm_rcc.apb1enr |= (1 << STM_RCC_APB1ENR_USART2EN); + + ao_stm_usart2.reg = &stm_usart2; + ao_usart_init(&ao_stm_usart2, USE_SERIAL_2_FLOW && !USE_SERIAL_2_SW_FLOW); + + stm_nvic_set_enable(STM_ISR_USART2_POS); + stm_nvic_set_priority(STM_ISR_USART2_POS, AO_STM_NVIC_MED_PRIORITY); +#if USE_SERIAL_2_STDIN && !DELAY_SERIAL_2_STDIN + ao_add_stdio(_ao_serial2_pollchar, + ao_serial2_putchar, + NULL); +#endif +#endif + +#if HAS_SERIAL_3 + /* + * TX RX + * PB10 PB11 + * PC10 PC11 + * PD8 PD9 + */ +#if SERIAL_3_PB10_PB11 + stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIOBEN); + + stm_afr_set(&stm_gpiob, 10, STM_AFR_AF7); + stm_afr_set(&stm_gpiob, 11, STM_AFR_AF7); +#else +#if SERIAL_3_PC10_PC11 + stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIOCEN); + + stm_afr_set(&stm_gpioc, 10, STM_AFR_AF7); + stm_afr_set(&stm_gpioc, 11, STM_AFR_AF7); +#else +#if SERIAL_3_PD8_PD9 + stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIODEN); + + stm_afr_set(&stm_gpiod, 8, STM_AFR_AF7); + stm_afr_set(&stm_gpiod, 9, STM_AFR_AF7); +#else +#error "No SERIAL_3 port configuration specified" +#endif +#endif +#endif + /* Enable USART */ + stm_rcc.apb1enr |= (1 << STM_RCC_APB1ENR_USART3EN); + + ao_stm_usart3.reg = &stm_usart3; + ao_usart_init(&ao_stm_usart3, 0); + + stm_nvic_set_enable(STM_ISR_USART3_POS); + stm_nvic_set_priority(STM_ISR_USART3_POS, AO_STM_NVIC_MED_PRIORITY); +#if USE_SERIAL_3_STDIN && !DELAY_SERIAL_3_STDIN + ao_add_stdio(_ao_serial3_pollchar, + ao_serial3_putchar, + NULL); +#endif +#endif +} -- cgit v1.2.3 From 805d218ff50e6c38345c0d4e46f568009132633e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 2 Oct 2018 12:46:19 -0700 Subject: altos/stm32f4: Add start of stm32f413 USB support This code doesn't work yet. Signed-off-by: Keith Packard --- src/stm32f4/ao_usb_gen.c | 712 ++++++++++++++++++++++++++ src/stm32f4/ao_usb_gen.h | 110 ++++ src/stm32f4/ao_usb_stm32f4.c | 1144 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1966 insertions(+) create mode 100644 src/stm32f4/ao_usb_gen.c create mode 100644 src/stm32f4/ao_usb_gen.h create mode 100644 src/stm32f4/ao_usb_stm32f4.c diff --git a/src/stm32f4/ao_usb_gen.c b/src/stm32f4/ao_usb_gen.c new file mode 100644 index 00000000..760afad9 --- /dev/null +++ b/src/stm32f4/ao_usb_gen.c @@ -0,0 +1,712 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#include "ao_usb_gen.h" + +static uint8_t ao_usb_ep0_state; + +/* Pending EP0 IN data */ +static const uint8_t *ao_usb_ep0_in_data; /* Remaining data */ +static uint8_t ao_usb_ep0_in_len; /* Remaining amount */ + +/* Temp buffer for smaller EP0 in data */ +static uint8_t ao_usb_ep0_in_buf[2]; + +/* Pending EP0 OUT data */ +static uint8_t *ao_usb_ep0_out_data; +static uint8_t ao_usb_ep0_out_len; + +/* System ram shadow of USB buffer; writing individual bytes is + * too much of a pain (sigh) */ +static uint8_t ao_usb_tx_buffer[AO_USB_IN_SIZE]; +static uint8_t ao_usb_tx_count; + +static uint8_t ao_usb_rx_buffer[AO_USB_OUT_SIZE]; +static uint8_t ao_usb_rx_count, ao_usb_rx_pos; + +/* + * End point register indices + */ + +#define AO_USB_CONTROL_EPR 0 +#define AO_USB_INT_EPR 1 +#define AO_USB_OUT_EPR 2 +#define AO_USB_IN_EPR 3 + +/* Marks when we don't need to send an IN packet. + * This happens only when the last IN packet is not full, + * otherwise the host will expect to keep seeing packets. + * Send a zero-length packet as required + */ +static uint8_t ao_usb_in_flushed; + +/* Marks when we have delivered an IN packet to the hardware + * and it has not been received yet. ao_sleep on this address + * to wait for it to be delivered. + */ +static uint8_t ao_usb_in_pending; + +/* Marks when an OUT packet has been received by the hardware + * but not pulled to the shadow buffer. + */ +static uint8_t ao_usb_out_avail; +uint8_t ao_usb_running; +static uint8_t ao_usb_configuration; + +static uint8_t ao_usb_address; +static uint8_t ao_usb_address_pending; + +/* + * Set current device address and mark the + * interface as active + */ +static void +ao_usb_set_address(uint8_t address) +{ + ao_usb_dev_set_address(address); + ao_usb_address_pending = 0; +} + +#define TX_DBG 0 +#define RX_DBG 0 + +#if TX_DBG +#define _tx_dbg0(msg) _dbg(__LINE__,msg,0) +#define _tx_dbg1(msg,value) _dbg(__LINE__,msg,value) +#else +#define _tx_dbg0(msg) +#define _tx_dbg1(msg,value) +#endif + +#if RX_DBG +#define _rx_dbg0(msg) _dbg(__LINE__,msg,0) +#define _rx_dbg1(msg,value) _dbg(__LINE__,msg,value) +#else +#define _rx_dbg0(msg) +#define _rx_dbg1(msg,value) +#endif + +#if TX_DBG || RX_DBG +static void _dbg(int line, char *msg, uint32_t value); +#endif + +/* + * Set just endpoint 0, for use during startup + */ + +static void +ao_usb_set_ep0(void) +{ + ao_usb_dev_ep0_init(); + + ao_usb_set_address(0); + + ao_usb_running = 0; + + /* Reset our internal state + */ + + ao_usb_ep0_state = AO_USB_EP0_IDLE; + + ao_usb_ep0_in_data = NULL; + ao_usb_ep0_in_len = 0; + + ao_usb_ep0_out_data = 0; + ao_usb_ep0_out_len = 0; +} + +static void +ao_usb_set_configuration(void) +{ +#if 0 + /* Set up the INT end point */ + ao_usb_bdt[AO_USB_INT_EPR].single.addr_tx = ao_usb_sram_addr; + ao_usb_bdt[AO_USB_INT_EPR].single.count_tx = 0; + ao_usb_in_tx_buffer = ao_usb_packet_buffer_addr(ao_usb_sram_addr); + ao_usb_sram_addr += AO_USB_INT_SIZE; + + ao_usb_init_ep(AO_USB_INT_EPR, + AO_USB_INT_EP); + + /* Set up the OUT end point */ + ao_usb_bdt[AO_USB_OUT_EPR].single.addr_rx = ao_usb_sram_addr; + ao_usb_bdt[AO_USB_OUT_EPR].single.count_rx = ((1 << STM_USB_BDT_COUNT_RX_BL_SIZE) | + (((AO_USB_OUT_SIZE / 32) - 1) << STM_USB_BDT_COUNT_RX_NUM_BLOCK)); + ao_usb_out_rx_buffer = ao_usb_packet_buffer_addr(ao_usb_sram_addr); + ao_usb_sram_addr += AO_USB_OUT_SIZE; + + ao_usb_init_ep(AO_USB_OUT_EPR, + AO_USB_OUT_EP, + STM_USB_EPR_EP_TYPE_BULK, + STM_USB_EPR_STAT_RX_VALID, + STM_USB_EPR_STAT_TX_DISABLED); + + /* Set up the IN end point */ + ao_usb_bdt[AO_USB_IN_EPR].single.addr_tx = ao_usb_sram_addr; + ao_usb_bdt[AO_USB_IN_EPR].single.count_tx = 0; + ao_usb_in_tx_buffer = ao_usb_packet_buffer_addr(ao_usb_sram_addr); + ao_usb_sram_addr += AO_USB_IN_SIZE; + + ao_usb_init_ep(AO_USB_IN_EPR, + AO_USB_IN_EP, + STM_USB_EPR_EP_TYPE_BULK, + STM_USB_EPR_STAT_RX_DISABLED, + STM_USB_EPR_STAT_TX_NAK); +#endif + + ao_usb_in_flushed = 0; + ao_usb_in_pending = 0; + ao_wakeup(&ao_usb_in_pending); + + ao_usb_out_avail = 0; + ao_usb_configuration = 0; + + ao_usb_running = 1; + ao_wakeup(&ao_usb_running); +} + +static uint16_t control_count; +static uint16_t in_count; +static uint16_t out_count; +#if USB_DEBUG +static uint16_t int_count; +static uint16_t reset_count; +#endif + +/* Send an IN data packet */ +static void +ao_usb_ep0_flush(void) +{ + uint8_t this_len; + + /* Check to see if the endpoint is still busy */ + if (ao_usb_dev_ep0_in_busy()) { + return; + } + + this_len = ao_usb_ep0_in_len; + if (this_len > AO_USB_CONTROL_SIZE) + this_len = AO_USB_CONTROL_SIZE; + + if (this_len < AO_USB_CONTROL_SIZE) + ao_usb_ep0_state = AO_USB_EP0_IDLE; + + ao_usb_ep0_in_len -= this_len; + + ao_usb_dev_ep0_in(ao_usb_ep0_in_data, this_len); + ao_usb_ep0_in_data += this_len; +} + +/* Read data from the ep0 OUT fifo */ +static void +ao_usb_ep0_fill(void) +{ + uint16_t len; + + len = ao_usb_dev_ep0_out(ao_usb_ep0_out_data, ao_usb_ep0_out_len); + ao_usb_ep0_out_len -= len; + ao_usb_ep0_out_data += len; +} + +static void +ao_usb_ep0_in_reset(void) +{ + ao_usb_ep0_in_data = ao_usb_ep0_in_buf; + ao_usb_ep0_in_len = 0; +} + +static void +ao_usb_ep0_in_queue_byte(uint8_t a) +{ + if (ao_usb_ep0_in_len < sizeof (ao_usb_ep0_in_buf)) + ao_usb_ep0_in_buf[ao_usb_ep0_in_len++] = a; +} + +static void +ao_usb_ep0_in_set(const uint8_t *data, uint8_t len) +{ + ao_usb_ep0_in_data = data; + ao_usb_ep0_in_len = len; +} + +static void +ao_usb_ep0_out_set(uint8_t *data, uint8_t len) +{ + ao_usb_ep0_out_data = data; + ao_usb_ep0_out_len = len; +} + +static void +ao_usb_ep0_in_start(uint16_t max) +{ + /* Don't send more than asked for */ + if (ao_usb_ep0_in_len > max) + ao_usb_ep0_in_len = max; + + ao_usb_dev_ep0_in(ao_usb_ep0_in_data, ao_usb_ep0_in_len); +} + +struct ao_usb_line_coding ao_usb_line_coding = {115200, 0, 0, 8}; + +/* Walk through the list of descriptors and find a match + */ +static void +ao_usb_get_descriptor(uint16_t value, uint16_t length) +{ + const uint8_t *descriptor; + uint8_t type = value >> 8; + uint8_t index = value; + + descriptor = ao_usb_descriptors; + while (descriptor[0] != 0) { + if (descriptor[1] == type && index-- == 0) { + uint8_t len; + if (type == AO_USB_DESC_CONFIGURATION) + len = descriptor[2]; + else + len = descriptor[0]; + if (len > length) + len = length; + ao_usb_ep0_in_set(descriptor, len); + break; + } + descriptor += descriptor[0]; + } +} + +static void +ao_usb_ep0_setup(void) +{ + uint16_t setup_len; + + /* Pull the setup packet out of the fifo */ + setup_len = ao_usb_dev_ep0_out(&ao_usb_setup, 8); + if (setup_len != 8) { + return; + } + + if ((ao_usb_setup.dir_type_recip & AO_USB_DIR_IN) || ao_usb_setup.length == 0) + ao_usb_ep0_state = AO_USB_EP0_DATA_IN; + else + ao_usb_ep0_state = AO_USB_EP0_DATA_OUT; + + ao_usb_ep0_in_reset(); + + switch(ao_usb_setup.dir_type_recip & AO_USB_SETUP_TYPE_MASK) { + case AO_USB_TYPE_STANDARD: + switch(ao_usb_setup.dir_type_recip & AO_USB_SETUP_RECIP_MASK) { + case AO_USB_RECIP_DEVICE: + switch(ao_usb_setup.request) { + case AO_USB_REQ_GET_STATUS: + ao_usb_ep0_in_queue_byte(0); + ao_usb_ep0_in_queue_byte(0); + break; + case AO_USB_REQ_SET_ADDRESS: + ao_usb_address = ao_usb_setup.value; + ao_usb_address_pending = 1; + break; + case AO_USB_REQ_GET_DESCRIPTOR: + ao_usb_get_descriptor(ao_usb_setup.value, ao_usb_setup.length); + break; + case AO_USB_REQ_GET_CONFIGURATION: + ao_usb_ep0_in_queue_byte(ao_usb_configuration); + break; + case AO_USB_REQ_SET_CONFIGURATION: + ao_usb_configuration = ao_usb_setup.value; + ao_usb_set_configuration(); + break; + } + break; + case AO_USB_RECIP_INTERFACE: + switch(ao_usb_setup.request) { + case AO_USB_REQ_GET_STATUS: + ao_usb_ep0_in_queue_byte(0); + ao_usb_ep0_in_queue_byte(0); + break; + case AO_USB_REQ_GET_INTERFACE: + ao_usb_ep0_in_queue_byte(0); + break; + case AO_USB_REQ_SET_INTERFACE: + break; + } + break; + case AO_USB_RECIP_ENDPOINT: + switch(ao_usb_setup.request) { + case AO_USB_REQ_GET_STATUS: + ao_usb_ep0_in_queue_byte(0); + ao_usb_ep0_in_queue_byte(0); + break; + } + break; + } + break; + case AO_USB_TYPE_CLASS: + switch (ao_usb_setup.request) { + case AO_USB_SET_LINE_CODING: + ao_usb_ep0_out_set((uint8_t *) &ao_usb_line_coding, 7); + break; + case AO_USB_GET_LINE_CODING: + ao_usb_ep0_in_set((const uint8_t *) &ao_usb_line_coding, 7); + break; + case AO_USB_SET_CONTROL_LINE_STATE: + break; + } + break; + } + + /* If we're not waiting to receive data from the host, + * queue an IN response + */ + if (ao_usb_ep0_state == AO_USB_EP0_DATA_IN) + ao_usb_ep0_in_start(ao_usb_setup.length); +} + +static void +ao_usb_ep0_handle(uint8_t receive) +{ + if (receive & AO_USB_EP0_GOT_RESET) { + ao_usb_set_ep0(); + return; + } + if (receive & AO_USB_EP0_GOT_SETUP) { + ao_usb_ep0_setup(); + } + if (receive & AO_USB_EP0_GOT_RX_DATA) { + if (ao_usb_ep0_state == AO_USB_EP0_DATA_OUT) { + ao_usb_ep0_fill(); + if (ao_usb_ep0_out_len == 0) { + ao_usb_ep0_state = AO_USB_EP0_DATA_IN; + ao_usb_ep0_in_start(0); + } + } + } + if (receive & AO_USB_EP0_GOT_TX_ACK) { +#if HAS_FLIGHT && AO_USB_FORCE_IDLE + ao_flight_force_idle = 1; +#endif + /* Wait until the IN packet is received from addr 0 + * before assigning our local address + */ + if (ao_usb_address_pending) + ao_usb_set_address(ao_usb_address); + if (ao_usb_ep0_state == AO_USB_EP0_DATA_IN) + ao_usb_ep0_flush(); + } +} + +void +ao_usb_ep0_interrupt(uint8_t mask) +{ + if (mask) { + ++control_count; + ao_usb_ep0_handle(mask); + } +} + +void +ao_usb_in_interrupt(uint32_t mask) +{ + if (mask & (1 << AO_USB_IN_EPR)) { + ++in_count; + _tx_dbg1("TX ISR", epr); + ao_usb_in_pending = 0; + ao_wakeup(&ao_usb_in_pending); + } +} + +void +ao_usb_out_interrupt(uint32_t mask) +{ + if (mask & (1 << AO_USB_OUT_EPR)) { + ++out_count; + _rx_dbg1("RX ISR", epr); + ao_usb_out_avail = 1; + _rx_dbg0("out avail set"); + ao_wakeup(AO_USB_OUT_SLEEP_ADDR); + _rx_dbg0("stdin awoken"); + } +} + +void +ao_usb_int_interrupt(uint32_t mask) +{ + (void) mask; +} + +void +stm_usb_fs_wkup(void) +{ + /* USB wakeup, just clear the bit for now */ +// stm_usb.istr &= ~(1 << STM_USB_ISTR_WKUP); +} + +/* Queue the current IN buffer for transmission */ +static void +_ao_usb_in_send(void) +{ + _tx_dbg0("in_send start"); + + while (ao_usb_in_pending) + ao_sleep(&ao_usb_in_pending); + + ao_usb_in_pending = 1; + if (ao_usb_tx_count != AO_USB_IN_SIZE) + ao_usb_in_flushed = 1; + + ao_usb_dev_ep_in(AO_USB_IN_EPR, ao_usb_tx_buffer, ao_usb_tx_count); + ao_usb_tx_count = 0; + + _tx_dbg0("in_send end"); +} + +/* Wait for a free IN buffer. Interrupts are blocked */ +static void +_ao_usb_in_wait(void) +{ + for (;;) { + /* Check if the current buffer is writable */ + if (ao_usb_tx_count < AO_USB_IN_SIZE) + break; + + _tx_dbg0("in_wait top"); + /* Wait for an IN buffer to be ready */ + while (ao_usb_in_pending) + ao_sleep(&ao_usb_in_pending); + _tx_dbg0("in_wait bottom"); + } +} + +void +ao_usb_flush(void) +{ + if (!ao_usb_running) + return; + + /* Anytime we've sent a character since + * the last time we flushed, we'll need + * to send a packet -- the only other time + * we would send a packet is when that + * packet was full, in which case we now + * want to send an empty packet + */ + ao_arch_block_interrupts(); + while (!ao_usb_in_flushed) { + _tx_dbg0("flush top"); + _ao_usb_in_send(); + _tx_dbg0("flush end"); + } + ao_arch_release_interrupts(); +} + +void +ao_usb_putchar(char c) +{ + if (!ao_usb_running) + return; + + ao_arch_block_interrupts(); + _ao_usb_in_wait(); + + ao_usb_in_flushed = 0; + ao_usb_tx_buffer[ao_usb_tx_count++] = (uint8_t) c; + + /* Send the packet when full */ + if (ao_usb_tx_count == AO_USB_IN_SIZE) { + _tx_dbg0("putchar full"); + _ao_usb_in_send(); + _tx_dbg0("putchar flushed"); + } + ao_arch_release_interrupts(); +} + +static void +_ao_usb_out_recv(void) +{ + _rx_dbg0("out_recv top"); + ao_usb_out_avail = 0; + + ao_usb_rx_count = ao_usb_dev_ep_out(AO_USB_OUT_EPR, ao_usb_rx_buffer, sizeof (ao_usb_rx_buffer)); + + _rx_dbg1("out_recv count", ao_usb_rx_count); + + ao_usb_rx_pos = 0; +} + +int +_ao_usb_pollchar(void) +{ + uint8_t c; + + if (!ao_usb_running) + return AO_READ_AGAIN; + + for (;;) { + if (ao_usb_rx_pos != ao_usb_rx_count) + break; + + _rx_dbg0("poll check"); + /* Check to see if a packet has arrived */ + if (!ao_usb_out_avail) { + _rx_dbg0("poll none"); + return AO_READ_AGAIN; + } + _ao_usb_out_recv(); + } + + /* Pull a character out of the fifo */ + c = ao_usb_rx_buffer[ao_usb_rx_pos++]; + return c; +} + +char +ao_usb_getchar(void) +{ + int c; + + ao_arch_block_interrupts(); + while ((c = _ao_usb_pollchar()) == AO_READ_AGAIN) + ao_sleep(AO_USB_OUT_SLEEP_ADDR); + ao_arch_release_interrupts(); + return c; +} + +#ifndef HAS_USB_DISABLE +#define HAS_USB_DISABLE 1 +#endif + +#if HAS_USB_DISABLE +void +ao_usb_disable(void) +{ + ao_usb_dev_disable(); +} +#endif + +void +ao_usb_enable(void) +{ + ao_usb_dev_enable(); + + ao_usb_configuration = 0; +} + +#if USB_ECHO +struct ao_task ao_usb_echo_task; + +static void +ao_usb_echo(void) +{ + char c; + + for (;;) { + c = ao_usb_getchar(); + ao_usb_putchar(c); + ao_usb_flush(); + } +} +#endif + +#if USB_DEBUG +static void +ao_usb_irq(void) +{ + printf ("control: %d out: %d in: %d int: %d reset: %d\n", + control_count, out_count, in_count, int_count, reset_count); +} + +const struct ao_cmds ao_usb_cmds[] = { + { ao_usb_irq, "I\0Show USB interrupt counts" }, + { 0, NULL } +}; +#endif + +void +ao_usb_init(void) +{ + ao_usb_enable(); + + ao_usb_ep0_state = AO_USB_EP0_IDLE; +#if USB_ECHO + ao_add_task(&ao_usb_echo_task, ao_usb_echo, "usb echo"); +#endif +#if USB_DEBUG + ao_cmd_register(&ao_usb_cmds[0]); +#endif +#if !USB_ECHO +#if USE_USB_STDIO + ao_add_stdio(_ao_usb_pollchar, ao_usb_putchar, ao_usb_flush); +#endif +#endif +} + +#if TX_DBG || RX_DBG + +struct ao_usb_dbg { + int line; + char *msg; + uint32_t value; + uint32_t prival; +#if TX_DBG + uint16_t in_count; + uint32_t in_epr; + uint32_t in_pending; + uint32_t tx_count; + uint32_t in_flushed; +#endif +#if RX_DBG + uint8_t rx_count; + uint8_t rx_pos; + uint8_t out_avail; + uint32_t out_epr; +#endif +}; + +#define NUM_USB_DBG 16 + +static struct ao_usb_dbg dbg[NUM_USB_DBG]; +static int dbg_i; + +static void _dbg(int line, char *msg, uint32_t value) +{ + uint32_t prival; + dbg[dbg_i].line = line; + dbg[dbg_i].msg = msg; + dbg[dbg_i].value = value; +#if AO_NONMASK_INTERRUPT + asm("mrs %0,basepri" : "=&r" (prival)); +#else + asm("mrs %0,primask" : "=&r" (prival)); +#endif + dbg[dbg_i].prival = prival; +#if TX_DBG + dbg[dbg_i].in_count = in_count; + dbg[dbg_i].in_epr = stm_usb.epr[AO_USB_IN_EPR]; + dbg[dbg_i].in_pending = ao_usb_in_pending; + dbg[dbg_i].tx_count = ao_usb_tx_count; + dbg[dbg_i].in_flushed = ao_usb_in_flushed; +#endif +#if RX_DBG + dbg[dbg_i].rx_count = ao_usb_rx_count; + dbg[dbg_i].rx_pos = ao_usb_rx_pos; + dbg[dbg_i].out_avail = ao_usb_out_avail; + dbg[dbg_i].out_epr = stm_usb.epr[AO_USB_OUT_EPR]; +#endif + if (++dbg_i == NUM_USB_DBG) + dbg_i = 0; +} +#endif diff --git a/src/stm32f4/ao_usb_gen.h b/src/stm32f4/ao_usb_gen.h new file mode 100644 index 00000000..b059ddb7 --- /dev/null +++ b/src/stm32f4/ao_usb_gen.h @@ -0,0 +1,110 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#ifndef _AO_USB_GEN_H_ +#define _AO_USB_GEN_H_ + +#include "ao.h" +#include "ao_usb.h" +#include "ao_product.h" +#include + +#define USB_ECHO 0 + +#ifndef USE_USB_STDIO +#define USE_USB_STDIO 1 +#endif + +#if USE_USB_STDIO +#define AO_USB_OUT_SLEEP_ADDR (&ao_stdin_ready) +#else +#define AO_USB_OUT_SLEEP_ADDR (&ao_usb_out_avail) +#endif + +struct ao_usb_setup { + uint8_t dir_type_recip; + uint8_t request; + uint16_t value; + uint16_t index; + uint16_t length; +} ao_usb_setup; + +#define AO_USB_EP0_GOT_RESET 1 +#define AO_USB_EP0_GOT_SETUP 2 +#define AO_USB_EP0_GOT_RX_DATA 4 +#define AO_USB_EP0_GOT_TX_ACK 8 + +/* + * End point register indices + */ + +#define AO_USB_CONTROL_EPR 0 +#define AO_USB_INT_EPR 1 +#define AO_USB_OUT_EPR 2 +#define AO_USB_IN_EPR 3 + +/* Device interfaces required */ + +/* Queue IN bytes to EP0 */ +void +ao_usb_dev_ep0_init(void); + +void +ao_usb_dev_ep0_in(const void *data, uint16_t len); + +bool +ao_usb_dev_ep0_in_busy(void); + +/* Receive OUT bytes from EP0 */ +uint16_t +ao_usb_dev_ep0_out(void *data, uint16_t len); + +/* Set device address */ +void +ao_usb_dev_set_address(uint8_t address); + +void +ao_usb_dev_enable(void); + +void +ao_usb_dev_disable(void); + +void +ao_usb_dev_init(void); + +/* Queue IN bytes to EPn */ +void +ao_usb_dev_ep_in(uint8_t ep, const void *data, uint16_t len); + +bool +ao_usb_dev_ep_in_busy(uint8_t ep); + +/* Receive OUT bytes from EPn */ +uint16_t +ao_usb_dev_ep_out(uint8_t ep, void *data, uint16_t len); + + +/* General interfaces provided */ + +void +ao_usb_ep0_interrupt(uint8_t mask); + +void +ao_usb_in_interrupt(uint32_t mask); + +void +ao_usb_out_interrupt(uint32_t mask); + +#endif /* _AO_USB_GEN_H_ */ + diff --git a/src/stm32f4/ao_usb_stm32f4.c b/src/stm32f4/ao_usb_stm32f4.c new file mode 100644 index 00000000..e65c3656 --- /dev/null +++ b/src/stm32f4/ao_usb_stm32f4.c @@ -0,0 +1,1144 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#include "ao_usb_gen.h" + +static uint32_t grxstsp; + +static inline uint8_t +grxstsp_enum(void) +{ + return (grxstsp >> STM_USB_GRXSTSP_EPNUM) & STM_USB_GRXSTSP_EPNUM_MASK; +} + +static inline uint8_t +grxstsp_pktsts(void) +{ + return (grxstsp >> STM_USB_GRXSTSP_PKTSTS) & STM_USB_GRXSTSP_PKTSTS_MASK; +} + +static inline uint16_t +grxstsp_bcnt(void) +{ + return (grxstsp >> STM_USB_GRXSTSP_BCNT) & STM_USB_GRXSTSP_BCNT_MASK; +} + +static void +ao_usb_dev_ep_out_start(uint8_t ep) +{ + stm_usb.doep[ep].doeptsiz = ((1 << STM_USB_DOEPTSIZ_PKTCNT) | + (3 << STM_USB_DOEPTSIZ_STUPCNT) | + (24 << STM_USB_DOEPTSIZ_XFRSIZ)); + +// stm_usb.doep[ep].doepctl |= (1 << STM_USB_DOEPCTL_EPENA); +} + +static void +ao_usb_mask_in_bits(vuint32_t *addr, uint32_t shift, uint32_t mask, uint32_t bits) +{ + uint32_t value; + + value = *addr; + value &= ~(mask << shift); + value |= (bits << shift); + *addr = value; +} + +static void +ao_usb_activate_ep0(void) +{ + stm_usb.diep[0].diepctl = ((0 << STM_USB_DIEPCTL_TXFNUM) | + (0 << STM_USB_DIEPCTL_STALL) | + (STM_USB_DIEPCTL_EPTYP_CONTROL << STM_USB_DIEPCTL_EPTYP) | + (1 << STM_USB_DIEPCTL_USBAEP) | + (STM_USB_DIEPCTL_MPSIZ0_64 << STM_USB_DIEPCTL_MPSIZ)); + stm_usb.doep[0].doepctl = ((0 << STM_USB_DOEPCTL_SNPM) | + (STM_USB_DOEPCTL_EPTYP_CONTROL << STM_USB_DOEPCTL_EPTYP) | + (1 << STM_USB_DOEPCTL_USBAEP) | + (STM_USB_DOEPCTL_MPSIZ0_64 << STM_USB_DOEPCTL_MPSIZ)); +} + +#if 0 +static void +ao_usb_activate_in(int epnum) +{ + stm_usb.daintmsk |= (1 << (epnum + STM_USB_DAINTMSK_IEPM)); + stm_usb.diep[epnum].diepctl = ((epnum << STM_USB_DIEPCTL_TXFNUM) | + (0 << STM_USB_DIEPCTL_STALL) | + (STM_USB_DIEPCTL_EPTYP_BULK << STM_USB_DIEPCTL_EPTYP) | + (1 << STM_USB_DIEPCTL_USBAEP) | + (64 << STM_USB_DIEPCTL_MPSIZ)); +} + +static void +ao_usb_activate_out(int epnum) +{ + stm_usb.daintmsk |= (1 << (epnum + STM_USB_DAINTMSK_OEPM)); + stm_usb.doep[epnum].doepctl = ((0 << STM_USB_DOEPCTL_SNPM) | + (STM_USB_DOEPCTL_EPTYP_BULK << STM_USB_DOEPCTL_EPTYP) | + (1 << STM_USB_DOEPCTL_USBAEP) | + (64 << STM_USB_DOEPCTL_MPSIZ)); +} +#endif + +static void +ao_usb_enum_done(void) +{ + /* Set turn-around delay. 6 is for high hclk (> 32MHz) */ + ao_usb_mask_in_bits(&stm_usb.gusbcfg, STM_USB_GUSBCFG_TRDT, STM_USB_GUSBCFG_TRDT_MASK, 6); + + ao_usb_activate_ep0(); +} + +static void +ao_usb_flush_tx_fifo(uint32_t fifo) +{ + stm_usb.grstctl = ((1 << STM_USB_GRSTCTL_TXFFLSH) | + (fifo << STM_USB_GRSTCTL_TXFNUM)); + while ((stm_usb.grstctl & (1 << STM_USB_GRSTCTL_TXFFLSH)) != 0) + ao_arch_nop(); +} + +static void +ao_usb_flush_rx_fifo(void) +{ + stm_usb.grstctl = (1 << STM_USB_GRSTCTL_RXFFLSH); + while ((stm_usb.grstctl & (1 << STM_USB_GRSTCTL_RXFFLSH)) != 0) + ao_arch_nop(); +} + +/* reset and enable EP0 */ +void +ao_usb_dev_ep0_init(void) +{ + uint32_t diepctl; + + /* Flush TX fifo */ + ao_usb_flush_tx_fifo(STM_USB_GRSTCTL_TXFNUM_ALL); + + /* Clear interrupts */ + for (int i = 0; i < 6; i++) { + stm_usb.diep[i].diepint = 0xfffffffful; + stm_usb.doep[i].doepint = 0xfffffffful; + } + stm_usb.daint = 0xfffffffful; + + /* Enable EP0 in/out interrupts */ + /* 2. Unmask interrupt bits */ + stm_usb.daintmsk |= ((1 << (STM_USB_DAINTMSK_IEPM + 0)) | + (1 << (STM_USB_DAINTMSK_OEPM + 0))); + + stm_usb.doepmsk |= ((1 << STM_USB_DOEPMSK_STUPM) | + (1 << STM_USB_DOEPMSK_EPDM) | + (1 << STM_USB_DOEPMSK_XFRCM)); + stm_usb.diepmsk |= ((1 << STM_USB_DIEPMSK_TOM) | + (1 << STM_USB_DIEPMSK_XFRCM) | + (1 << STM_USB_DIEPMSK_EPDM)); + + /* 1. Set NAK bit for all OUT endpoints */ + stm_usb.doep[0].doepctl |= (1 << STM_USB_DOEPCTL_CNAK); + for (int i = 1; i < 6; i++) + stm_usb.doep[i].doepctl |= (1 << STM_USB_DOEPCTL_SNAK); + + /* 3. Setup FIFO ram allocation */ + + /* XXX make principled decisions here */ + stm_usb.grxfsiz = 0x80; + + stm_usb.dieptxf0 = ((0x40 << STM_USB_DIEPTXF0_TX0FD) | /* size = 256 bytes */ + (0x80 << STM_USB_DIEPTXF0_TX0FSA)); /* start address = 0x80 */ + + /* 4. Program OUT endpoint 0 to receive a SETUP packet */ + + uint32_t doeptsiz; + + doeptsiz = ((1 << STM_USB_DOEPTSIZ_PKTCNT) | + (0x40 << STM_USB_DOEPTSIZ_XFRSIZ) | + (1 << STM_USB_DOEPTSIZ_STUPCNT)); + + stm_usb.doep[0].doeptsiz = doeptsiz; + + /* Program MPSIZ field to set maximum packet size */ + + diepctl = ((0 << STM_USB_DIEPCTL_EPENA ) | + (0 << STM_USB_DIEPCTL_EPDIS ) | + (0 << STM_USB_DIEPCTL_SNAK ) | + (0 << STM_USB_DIEPCTL_CNAK ) | + (0 << STM_USB_DIEPCTL_TXFNUM) | + (0 << STM_USB_DIEPCTL_STALL ) | + (STM_USB_DIEPCTL_EPTYP_CONTROL << STM_USB_DIEPCTL_EPTYP ) | + (0 << STM_USB_DIEPCTL_NAKSTS ) | + (0 << STM_USB_DIEPCTL_EONUM ) | + (1 << STM_USB_DIEPCTL_USBAEP ) | + (STM_USB_DIEPCTL_MPSIZ0_64 << STM_USB_DIEPCTL_MPSIZ)); + + stm_usb.diep[0].diepctl = diepctl; + + uint32_t doepctl; + + doepctl = ((0 << STM_USB_DOEPCTL_EPENA ) | + (0 << STM_USB_DOEPCTL_EPDIS ) | + (0 << STM_USB_DOEPCTL_SNAK ) | + (0 << STM_USB_DOEPCTL_CNAK ) | + (0 << STM_USB_DOEPCTL_STALL ) | + (0 << STM_USB_DOEPCTL_SNPM ) | + (STM_USB_DOEPCTL_EPTYP_CONTROL << STM_USB_DOEPCTL_EPTYP ) | + (0 << STM_USB_DOEPCTL_NAKSTS ) | + (1 << STM_USB_DOEPCTL_USBAEP ) | + (STM_USB_DOEPCTL_MPSIZ0_64 << STM_USB_DOEPCTL_MPSIZ)); + + stm_usb.doep[0].doepctl = doepctl; + + /* Clear interrupts */ + stm_usb.diep[0].diepint = 0xffffffff; + stm_usb.doep[0].doepint = 0xffffffff; + + ao_usb_dev_ep_out_start(0); +} + +void +ao_usb_dev_ep0_in(const void *data, uint16_t len) +{ + return ao_usb_dev_ep_in(0, data, len); +} + +bool +ao_usb_dev_ep0_in_busy(void) +{ + return false; +} + +uint16_t +ao_usb_dev_ep0_out(void *data, uint16_t len) +{ + return ao_usb_dev_ep_out(0, data, len); +} + +/* Queue IN bytes to EPn */ +void +ao_usb_dev_ep_in(uint8_t ep, const void *data, uint16_t len) +{ + int l = len; + + while (l > 0) { + stm_usb.dfifo[ep].fifo = *((__packed uint32_t *) data); + l -= 4; + data += 4; + } + + /* Set the IN data size */ + stm_usb.diep[ep].dieptsiz = ((1 << STM_USB_DIEPTSIZ_PKTCNT) | + (len << STM_USB_DIEPTSIZ_XFRSIZ)); + + /* Enable the TX empty interrupt */ + stm_usb.diepempmsk |= (1 << ep); + + /* Enable the endpoint to queue the packet for transmission */ + stm_usb.diep[ep].diepctl |= (1 << STM_USB_DIEPCTL_EPENA); +} + +bool +ao_usb_dev_ep_in_busy(uint8_t ep) +{ + (void) ep; + return false; +} + +/* Receive OUT bytes from EPn */ +uint16_t +ao_usb_dev_ep_out(uint8_t ep, void *data, uint16_t len) +{ + uint16_t received; + int l = len; + uint32_t t; + + if (grxstsp_enum() != ep) + return 0; + + received = grxstsp_bcnt(); + if (received > len) + received = len; + + while (l >= 4) { + *((__packed uint32_t *) data) = stm_usb.dfifo[0].fifo; + l -= 4; + data += 4; + } + + if (l != 0) { + t = stm_usb.dfifo[0].fifo; + memcpy(data, &t, l); + } + + ao_usb_dev_ep_out_start(ep); + return received; +} + +void +ao_usb_dev_set_address(uint8_t address) +{ + uint32_t dcfg; + + dcfg = stm_usb.dcfg; + + dcfg &= ~(STM_USB_DCFG_DAD_MASK << STM_USB_DCFG_DAD); + dcfg |= address & STM_USB_DCFG_DAD_MASK; + stm_usb.dcfg = dcfg; +} + +static void +ao_usb_core_reset(void) +{ + /* Wait for AHB master IDLE state. */ + while ((stm_usb.grstctl & (1 << STM_USB_GRSTCTL_AHBIDL)) == 0) + ao_arch_nop(); + + + /* Core soft reset */ + stm_usb.grstctl |= (1 << STM_USB_GRSTCTL_CSRST); + + /* Wait for reset to complete */ + + while ((stm_usb.grstctl & (1 << STM_USB_GRSTCTL_CSRST)) != 0) + ao_arch_nop(); +} + +static void +ao_usb_core_init(void) +{ + /* Enable embedded PHY */ + stm_usb.gusbcfg |= (1 << STM_USB_GUSBCFG_PHYSEL); + + /* Core reset */ + ao_usb_core_reset(); + + /* Deactivate power down */ + stm_usb.gccfg = (1 << STM_USB_GCCFG_PWRDWN); +} + +static void +ao_usb_delay(uint32_t ms) +{ + AO_TICK_TYPE now = ao_time(); + AO_TICK_TYPE then = now + AO_MS_TO_TICKS(ms); + + while ((int16_t) (then - ao_time()) > 0) + ao_arch_nop(); +} + +static void +ao_usb_set_device_mode(void) +{ + uint32_t gusbcfg; + + gusbcfg = stm_usb.gusbcfg; + gusbcfg &= ~((1 << STM_USB_GUSBCFG_FHMOD) | + (1 << STM_USB_GUSBCFG_FDMOD)); + gusbcfg |= (1 << STM_USB_GUSBCFG_FDMOD); + stm_usb.gusbcfg = gusbcfg; + ao_usb_delay(50); +} + +static void +ao_usb_device_init(void) +{ + /* deactivate vbus sensing */ + stm_usb.gccfg &= ~(1 << STM_USB_GCCFG_VBDEN); + + /* Force device mode */ + stm_usb.gotgctl |= ((1 << STM_USB_GOTGCTL_BVALOEN) | + (1 << STM_USB_GOTGCTL_BVALOVAL)); + + /* Restart the phy clock */ + stm_usb.pcgcctl = 0; + + /* Device mode configuration */ + stm_usb.dcfg |= (STM_USB_DCFG_PFIVL_80 << STM_USB_DCFG_PFIVL); + + /* Set full speed phy */ + stm_usb.dcfg |= (STM_USB_DCFG_DSPD_FULL_SPEED << STM_USB_DCFG_DSPD); + + /* Flush the fifos */ + ao_usb_flush_tx_fifo(STM_USB_GRSTCTL_TXFNUM_ALL); + ao_usb_flush_rx_fifo(); + + /* Clear all pending device interrupts */ + stm_usb.diepmsk = 0; + stm_usb.doepmsk = 0; + stm_usb.daint = 0xffffffffUL; + stm_usb.daintmsk = 0; + + /* Reset all endpoints */ + for (int i = 0; i < 6; i++) { + + /* Reset IN endpoint */ + if (stm_usb.diep[i].diepctl & (1 << STM_USB_DIEPCTL_EPENA)) + stm_usb.diep[i].diepctl = ((1 << STM_USB_DIEPCTL_EPDIS) | + (1 << STM_USB_DIEPCTL_SNAK)); + else + stm_usb.diep[i].diepctl = 0; + stm_usb.diep[i].dieptsiz = 0; + stm_usb.diep[i].diepint = 0xfffffffful; + + /* Reset OUT endpoint */ + if (stm_usb.doep[i].doepctl & (1 << STM_USB_DOEPCTL_EPENA)) + stm_usb.doep[i].doepctl = ((1 << STM_USB_DOEPCTL_EPDIS) | + (1 << STM_USB_DOEPCTL_SNAK)); + else + stm_usb.doep[i].doepctl = 0; + + stm_usb.doep[i].doeptsiz = 0; + stm_usb.doep[i].doepint = 0xfffffffful; + } + + /* Disable all interrupts */ + stm_usb.gintmsk = 0; + + /* Clear pending interrupts */ + stm_usb.gintsts = 0xfffffffful; + + /* Enable core interrupts */ + stm_usb.gintmsk = ((1 << STM_USB_GINTMSK_WUIM ) | + (0 << STM_USB_GINTMSK_SRQIM ) | + (0 << STM_USB_GINTMSK_DISCINT ) | + (0 << STM_USB_GINTMSK_CIDSCHGM ) | + (0 << STM_USB_GINTMSK_LPMINTM ) | + (0 << STM_USB_GINTMSK_PTXFEM ) | + (0 << STM_USB_GINTMSK_HCIM) | + (0 << STM_USB_GINTMSK_PRTIM ) | + (0 << STM_USB_GINTMSK_RSTDETM ) | + (1 << STM_USB_GINTMSK_IISOOXFRM ) | + (1 << STM_USB_GINTMSK_IISOIXFRM ) | + (1 << STM_USB_GINTMSK_OEPINT) | + (1 << STM_USB_GINTMSK_IEPINT) | + (0 << STM_USB_GINTMSK_EOPFM ) | + (0 << STM_USB_GINTMSK_ISOODRPM ) | + (1 << STM_USB_GINTMSK_ENUMDNEM) | + (1 << STM_USB_GINTMSK_USBRST) | + (1 << STM_USB_GINTMSK_USBSUSPM ) | + (0 << STM_USB_GINTMSK_ESUSPM ) | + (0 << STM_USB_GINTMSK_GONAKEFFM ) | + (0 << STM_USB_GINTMSK_GINAKEFFM ) | + (0 << STM_USB_GINTMSK_NPTXFEM ) | + (0 << STM_USB_GINTMSK_RXFLVLM) | + (0 << STM_USB_GINTMSK_SOFM ) | + (0 << STM_USB_GINTMSK_OTGINT ) | + (0 << STM_USB_GINTMSK_MMISM)); +} + +static void +ao_usb_device_connect(void) +{ + /* Enable pull-up/pull-down */ + stm_usb.dctl &= ~(1 << STM_USB_DCTL_SDIS); + ao_usb_delay(20); +} + +#if 0 +static void +ao_usb_device_disconnect(void) +{ + /* Disable pull-up/pull-down */ + stm_usb.dctl |= (1 << STM_USB_DCTL_SDIS); + ao_usb_delay(20); +} +#endif + +void +ao_usb_dev_enable(void) +{ + ao_arch_block_interrupts(); + + /* Configure GPIOs */ + ao_enable_port(&stm_gpioa); +#if 0 + stm_afr_set(&stm_gpioa, 8, STM_AFR_AF10); /* USB_FS_SOF */ + stm_afr_set(&stm_gpioa, 9, STM_AFR_AF10); /* USB_FS_VBUS */ + stm_afr_set(&stm_gpioa, 10, STM_AFR_AF10); /* USB_FS_ID */ +#endif + stm_afr_set(&stm_gpioa, 11, STM_AFR_AF10); + stm_ospeedr_set(&stm_gpioa, 11, STM_OSPEEDR_HIGH); + stm_pupdr_set(&stm_gpioa, 11, STM_PUPDR_NONE); + stm_afr_set(&stm_gpioa, 12, STM_AFR_AF10); + stm_ospeedr_set(&stm_gpioa, 12, STM_OSPEEDR_HIGH); + stm_pupdr_set(&stm_gpioa, 12, STM_PUPDR_NONE); + + /* Power on USB */ + stm_rcc.ahb2enr |= (1 << STM_RCC_AHB2ENR_OTGFSEN); + + /* Route interrupts */ + stm_nvic_set_priority(STM_ISR_OTG_FS_POS, AO_STM_NVIC_LOW_PRIORITY); + stm_nvic_set_enable(STM_ISR_OTG_FS_POS); + + /* Core init */ + ao_usb_core_init(); + + /* Set device mode */ + ao_usb_set_device_mode(); + + /* Reset FIFO allocations */ + for (int i = 1; i < 16; i++) + stm_usb.dieptxf[i-1] = 0x0; + + ao_usb_device_init(); + + /* Connect */ + ao_usb_device_connect(); +} + +void +ao_usb_dev_disable(void) +{ + stm_usb.gusbcfg = ((1 << STM_USB_GUSBCFG_FDMOD) | + (0 << STM_USB_GUSBCFG_FHMOD) | + (6 << STM_USB_GUSBCFG_TRDT) | + (0 << STM_USB_GUSBCFG_HNPCAP) | + (0 << STM_USB_GUSBCFG_SRPCAP) | + (1 << STM_USB_GUSBCFG_PHYSEL) | + (0 << STM_USB_GUSBCFG_TOCAL)); + + stm_usb.gahbcfg = ((0 << STM_USB_GAHBCFG_PTXFELVL) | + (1 << STM_USB_GAHBCFG_TXFELVL) | + (0 << STM_USB_GAHBCFG_GINTMSK)); + + stm_usb.dctl = ((0 << STM_USB_DCTL_POPRGDNE) | + (1 << STM_USB_DCTL_SDIS)); + + stm_rcc.ahb2enr &= ~(1 << STM_RCC_AHB2ENR_OTGFSEN); +} + +void +stm_otg_fs_isr(void) +{ + uint32_t gintsts = stm_usb.gintsts; + uint8_t ep0_receive = 0; + uint32_t out_interrupt = 0; + uint32_t in_interrupt = 0; + + /* Clear all received interrupts */ + stm_usb.gintsts = gintsts; + + if (gintsts & (1 << STM_USB_GINTSTS_USBRST)) { + ep0_receive |= AO_USB_EP0_GOT_RESET; + } + + if (gintsts & (1 << STM_USB_GINTSTS_ENUMDNE)) { + ao_usb_enum_done(); + } + + if (gintsts & ((1 << STM_USB_GINTSTS_OEPINT) | + (1 << STM_USB_GINTSTS_IEPINT))) + { + uint32_t daint = stm_usb.daint; + uint32_t oepint = (daint >> STM_USB_DAINT_OEPINT) & STM_USB_DAINT_OEPINT_MASK; + uint32_t iepint = (daint >> STM_USB_DAINT_IEPINT) & STM_USB_DAINT_IEPINT_MASK; + + for (int ep = 0; ep < 6; ep++) { + if (gintsts & (1 << STM_USB_GINTSTS_OEPINT)) { + if (oepint & (1 << ep)) { + uint32_t doepint = stm_usb.doep[ep].doepint; + + stm_usb.doep[ep].doepint = doepint; + if (doepint & (1 << STM_USB_DOEPINT_XFRC)) { + if (ep == 0) + ep0_receive |= AO_USB_EP0_GOT_SETUP; + else + out_interrupt |= (1 << ep); + } + grxstsp = stm_usb.grxstsp; + } + } + + if (gintsts & (1 << STM_USB_GINTSTS_IEPINT)) { + if (iepint & (1 << ep)) { + uint32_t diepint = stm_usb.diep[ep].diepint; + + stm_usb.diep[ep].diepint = diepint; + if (diepint & (1 << STM_USB_DIEPINT_XFRC)) { + if (ep == 0) + ep0_receive |= AO_USB_EP0_GOT_TX_ACK; + else + in_interrupt |= (1 << ep); + } + } + } + } + } else { + grxstsp = 0; + } + + if (ep0_receive) + ao_usb_ep0_interrupt(ep0_receive); + + if (out_interrupt) + ao_usb_out_interrupt(out_interrupt); + + if (in_interrupt) + ao_usb_in_interrupt(in_interrupt); +} + +/* + + running before plugging in at first packet + gotgctl = 0x04cd0000, 0x04c10000, 0x04cd0000 ************* + + CURMOD = 0 + OTGVER = 0 + BSVLD = 1 BSVLD = 0 + ASVLD = 1 ASVLD = 0 + DBCT = 0 + CIDSTS = 1 + + gotgint = 0x00100000, 0x00100000, 0x00100000 + + IDCHNG = 1 + + gahbcfg = 0x1, 0x1, 0x00000001 + + TXFELVL = 0 trigger half empty + GINTMSK = 1 interrupts enabled + + gusbcfg = 0x40001840, 0x40001440 0x40001840 ************* + + FDMOD = 1 force device mode + FHMOD = 0 + TRDT = 6 5 6 + HNPCAP = 0 + SRPCAP = 0 + PHYSEL = 1 + TOCAL = 0 + + grstctl = 0x80000040, 0x80000000 0x80000400 *********** + + AHBIDL = 1 + TXFNUM = 1 TXFNUM = 0 TXFNUM = 0x20 (flush all) + TXFFLSH = 0 + RXFFLSH = 0 + FCRST = 0 + PSRST = 0 + CSRST = 0 + + gintsts = 0x0480b43a, 0x04008022 0x04888438 *********** + + WKUPINT = 0 0 + SRQINT = 0 0 + DISCINT = 0 0 + CIDSCHG = 0 0 + LPMINT = 0 0 + PTXFE = 1 PTXFE = 1 PTXFE = 1 + HCINT = 0 + HPRTINT = 0 + RSTDET = 1 RSTDET = 0 RSTDET = 1 + IPXFER = 0 + IISOIXFR = 0 + OEPINT = 0 OEPINT = 1 + IEPINT = 0 + EOPF = 1 EOPF = 1 EOPF = 1 + ISOODRP = 0 + ENUMDNE = 1 + USBRST = 1 + USBSUSP = 0 + ESUSP = 1 ESUSP = 1 + GONAKEFF = 0 + GINAKEFF = 0 + NPTXFE = 1 NPTXFE = 1 NPTXFE = 1 + RXFLVL = 1 RXFLVL = 1 + SOF = 1 SOF = 1 + OTGINT = 0 + MMIS = 1 MMIS = 1 MMIS = 0 + CMOD = 0 + + gintmsk = 0xc03c3814, 0xc03c3814, + + WUIM = 1 + SRQIM = 1 + DISCINT = 0 + CIDSCHGM = 0 + LPMINTM = 0 + PTXFEM = 0 + HCIM = 0 + PRTIM = 0 + RSTDETM = 0 + IISOOXFRM = 1 + IISOIXFRM = 1 + OEPINT = 1 + IEPINT = 1 + EOPFM = 0 + ISOODRPM = 0 + ENUMDNEM = 1 + USBRST = 1 + USBSUSPM = 1 + ESUSPM =0 + GONAKEFFM = 0 + GINAKEFFM = 0 + NPTXFEM = 0 + RXFLVLM = 1 + SOFM = 0 + OTGINT = 1 + MMISM = 0 + + grxstsr = 0xac0080, 0x0 0x14c0080 *************** + + STSPHST = 0 STSPHST = 0 + FRMNUM = 5 FRMNUM = 10 + PKTSTS = 6 -- SETUP data packet PKTSTS = 6 -- SETUP data packet + DPID = 0 DPID = 0 + BCNT = 8 BCNT = 8 + EPNUM = 0 EPNUM = 0 + + grxstsp = 0xac0080, 0x0 0x14c0080 + + (same) + + grxfsiz = 0x80, 0x80 0x80 + + RXFD = 128 512 bytes + + dieptxf0 = 0x00400080, 0x00400080 0x00400080 + + TX0FD = 64 256 bytes + TX0FSA = 0x80 + + gccfg = 0x21fff0, 0x21fff0 0x21fff0 + + VBDEN = 1 + SDEN = 0 + PDEN = 0 + DCDEN = 0 + BCDEN = 0 + PWRDN = 1 + PS2DET = 0 + SDET = 0 + PDET = 0 + DCDET = 0 + + cid = 0x2000, 0x2000 0x2000 + + PRODUCT_ID = 0x2000 + + glpmcfg = 0x0, 0x0 0x0 + + ENBESL = 0 + LPMRCNTTST = 0 + SNDLPM = 0 + LPMRCNT = 0 + LPMCHIDX = 0 + L1RSMOK = 0 + SLPSTS = 0 + LPMRSP = 0 + L1DSEN = 0 + BESLTHRS = 0 + L1SSEN = 0 + REMWAKE = 0 + BESL = 0 + LPMACK = 0 + LPMEN = 0 + + dieptxf = {0x8000c0, 0x0, 0x0, 0x0, 0x0}, {0x8000c0, 0x0, 0x0, 0x0, 0x0}, {0x8000c0, 0x0, 0x0, 0x0, 0x0}, + + INEXPTXFD 0 = 0x80 512 bytes + INEXPTXSA 0 = 0xc0 + + dcfg = 0x82000b3, 0x8200003, 0x8200003 + + ERRATIM = 0 + PFIVL = 0 + DAD = 0xb DAD = 0x0 DAD = 0 + NZLSOHSK = 0 + DSPD = 3 Full speed USB 1.1 + + dctl = 0x0, 0x0 0x0 + + DSBESLRJCT = 0 + POPRGDNE = 0 + CGONAK = 0 + SGONAK = 0 + CGINAK = 0 + SGINAK = 0 + TCTL = 0 + GONSTS = 0 + GINSTS = 0 + SDIS = 0 + RWUSIG = 0 + + dsts = 0x0043ff06, 0x00000006 0x00400c06 + + DEVLNSTS = 1 (D+ low, D- high) + FNSOF = 0x3ff FNSOF = 0xc + EERR = 0 + ENUMSPD = 3 Full speed ENUMSPD = 3 + SUSPSTS = 0 SUSPSTS = 0 + + diepmsk = 0xb, 0x0 0xb + + NAKM = 0 + TXFURM = 0 + INEPNEM = 0 + INEPNMM = 0 + ITTXFEMSK = 0 + TOM = 1 + EPDM = 1 + XFRCM = 1 + + doepmsk = 0x2b, 0x0 0x2b + + NYETMSK = 0 + NAKMSK = 0 + BERRM =0 + OUTPKTERRM = 0 + STSPHSRXM = 1 + OTEPDM = 0 + STUPM = 1 + EPDM = 1 + XFRCM = 1 + + daint = 0x0, 0x0 0x10000 + + daintmsk = 0x30003, 0x0 0x10001 + + OEPM = 0x3 endpoints 0 and 1 OEPM = 0x1 endpoint 0 + IEPM = 0x3 endpoints 0 and 1 IEPM = 0x1 endpoint 0 + + dvbusdis = 0x17d7, 0x17d7 0x17d7 + + VBUSDT = 0x17d7 reset value + + dvbuspulse = 0x5b8, 0x5b8 0x5b8 + + DVBUSP = 0x5b8 reset value + + diepempmsk = 0x0, 0x0 0x0 + + INEPTXFEM = 0 no endpoints + + diep = {{ + diepctl = 0x28000, + + EPENA = 0 + EPDIS = 0 + SNAK = 0 + CNAK = 0 + TXFNUM = 0 + STALL = 0 + EPTYP = 0 + NAKSTS = 1 + USBAEP = 1 + MPSIZ = 0 64 bytes + + diepint = 0x20c0, + + NAK = 1 + PKTDRPSTS = 0 + TXFIFOUDRN = 0 + TXFE = 1 + INEPNE = 1 + ITTXFE = 0 + TOC = 0 + EPDISD = 0 + XFRC = 0 + + dieptsiz = 0x0, + + PKTCNT = 0 + XFRSIZ = 0 + + dtxfsts = 0x40, + + INEPTFSAV = 0x40 256 bytes available + + }, { + diepctl = 0x00490040, + + EPENA = 0 + EPDIS = 0 + SODDFRM = 0 + SD0PID = 0 + SNAK = 0 + CNAK = 0 + TXFNUM = 1 + STALL = 0 + EPTYP = 2 bulk + NAKSTS = 0 + EONUM = 1 + USBAEP = 0 + MPSIZ = 64 256 bytes + + diepint = 0x2090, + + NAK = 1 + PKTDRPSTS = 0 + TXFIFOUDRN = 0 + TXFE = 1 + INEPNE = 0 + INPENM = 0 + ITTXFE = 1 + TOC = 0 + EPDISD = 0 + XFRC = 0 + + dieptsiz = 0x0, + + MCNT = 0 + PKTCNT = 0 + XFRSIZ = 0 + + dtxfsts = 0x80, + + INEPTFSAV = 0x80 512 bytes available + + }, { + diepctl = 0x0, + pad_04 = 0x0, + diepint = 0x80, + pad_0c = 0x0, + dieptsiz = 0x0, + pad_14 = 0x43425355, + dtxfsts = 0x40, + pad_1c = 0x400000 + }, { + diepctl = 0x0, + pad_04 = 0x0, + diepint = 0x80, + pad_0c = 0x0, + dieptsiz = 0x0, + pad_14 = 0x43425355, + dtxfsts = 0x40, + pad_1c = 0x400000 + }, { + diepctl = 0x0, + pad_04 = 0x0, + diepint = 0x80, + pad_0c = 0x0, + dieptsiz = 0x0, + pad_14 = 0x43425355, + dtxfsts = 0x40, + pad_1c = 0x400000 + }, { + diepctl = 0x0, + pad_04 = 0x0, + diepint = 0x80, + pad_0c = 0x0, + dieptsiz = 0x0, + pad_14 = 0x43425355, + dtxfsts = 0x40, + pad_1c = 0x400000 + }}, + + doep = {{ + doepctl = 0x80028000, 0x00008000, 0x28000 + + EPENA = 1 EPENA = 0 EPENA = 0 + EPDIS = 0 + SNAK =0 + CNAK = 0 + STALL = 0 + SNPM = 0 + EPTYP = 0 + NAKSTS = 1 NAKSTS = 0 NAKSTS = 1 + USPAEP = 1 USPAEP = 1 + MPSIZ = 0 64 bytes MPSIZ = 0 + + doepint = 0x8010, 0x0 0x8008 + + NYET = 0 + NAK = 0 + BERR = 0 + OUTPKTERR = 0 + STSPHSRX = 0 + OTEPDIS = 1 + STUP = 0 STUP = 1 + EPDISD = 0 + XFRC = 0 + + doeptsiz = 0x38, 0x0 0x20080008 + + STPCNT = 0 1 packet STPCNT = 1 + PKTCNT = 0 PKTCNT = 1 + XFRSIZ = 0x38 56 bytes (64 - 8) XFRSIZ = 8 + + }, { + doepctl = 0x800b0040, + + EPENA = 1 + EPDIS = 0 + SD1PID = 0 + SD0PID = 0 + SNAK = 0 + CNAK = 0 + STALL = 0 + SNPM =0 + EPTYP = 2 Bulk + NAKSTS = 1 + EONUM = 1 + USBAEP = 0 + MPSIZ = 0x40 64 bytes + + doepint = 0x0, + doeptsiz = 0x21, + + RXDPID = 0 + PKTCNT = 0 + XFRSIZ = 0x21 33 bytes ? + + }, { + doepctl = 0x0, + pad_04 = 0x0, + doepint = 0x0, + pad_0c = 0x0, + doeptsiz = 0x0, + pad_14 = 0x43425355, + pad_18 = 0x40, + pad_1c = 0x400000 + }, { + doepctl = 0x0, + pad_04 = 0x0, + doepint = 0x0, + pad_0c = 0x0, + doeptsiz = 0x0, + pad_14 = 0x43425355, + pad_18 = 0x40, + pad_1c = 0x400000 + }, { + doepctl = 0x0, + pad_04 = 0x0, + doepint = 0x0, + pad_0c = 0x0, + doeptsiz = 0x0, + pad_14 = 0x43425355, + pad_18 = 0x40, + pad_1c = 0x400000 + }, { + doepctl = 0x0, + pad_04 = 0x0, + doepint = 0x0, + pad_0c = 0x0, + doeptsiz = 0x0, + pad_14 = 0x43425355, + pad_18 = 0x40, + pad_1c = 0x400000 + }}, + + pcgcctl = 0x0, 0x0, 0x0 + + SUSP = 0 + PHYSLEEP = 0 + ENL1GTG = 0 + PHYSUSP = 0 + GATEHCLK = 0 + STPPCLK = 0 + + dfifo = {{ + fifo = 0x1000680, + + + Clock configuration: + +$5 = { + cr = 0x0f077d83, + + PLLI2SRDY = 1 + PLLI2SON = 1 + PLLRDY = 1 + PLLON = 1 + CSSON = 0 + HSEBYP = 1 + HSERDY = 1 + HSEON = 1 + HSICAL = 0x7d + HSITRIM = 0x10 + HSIRDY = 1 + HSION = 1 + + pllcfgr = 0x27403208, + + PLLR = 2 + PLLQ = 7 + PLLSRC = 1 HSE + PLLP = 0 2 + PLLN = 0xc8 200 + PLLM = 8 + + clk_pllin = 8000000 / 8 = 1000000 + vco = 1000000 * 200 = 200000000 + clk_pll1p = 200000000 / 2 = 100000000 (100MHz) + clk_pll1q = 200000000 / 7 = ??? + clk_pll1r = 200000000 / 2 = 100000000 (100MHz) + + cfgr = 0x0000100a, + cir = 0x00000000, + ahb1rstr = 0x0, + ahb2rstr = 0x0, + ahb3rstr = 0x0, + pad_1c = 0x0, + apb1rstr = 0x0, + apb2rstr = 0x0, + pad_28 = 0x0, + pad_2c = 0x0, + ahb1enr = 0x40107f, + ahb2enr = 0x80, + ahbdnr = 0x3, + pad_3c = 0x0, + apb1enr = 0x11000410, + apb2enr = 0xc800, + pad_48 = 0x0, + pad_4c = 0x0, + ahb1lpenr = 0x6390ff, + ahb2lpenr = 0xd0, + ahb3lpenr = 0x3, + pad_5c = 0x0, + apb1lpenr = 0xfffecfff, + apb2lpenr = 0x357f9f3, + pad_68 = 0x0, + pad_6c = 0x0, + bdcr = 0x8200, + csr = 0x1e000003, + pad_78 = 0x0, + pad_7c = 0x0, + sscgr = 0x0, + plli2scfgr = 0x44003008, + + PLLI2SR = 4 + PLLI2SQ = 4 + PLLI2SSRC = 0 HSE (due to PLLSRC) + PLLI2SN = 0xc0 192 + PLLI2SM = 8 + + clk_plli2sin = 8000000 / 8 = 1000000 + vcoi2s = 1000000 * 192 = 192000000 + ck_pl2q = 192000000 / 4 = 48000000 + ck_pl2r = 192000000 / 4 = 48000000 + + pad_88 = 0x0, + dckcfgr = 0x0, + + + ckgatenr = 0x0, + + All clock gates enabled + + dckcfgr2 = 0x08000000 + + LPTIMER1SEL = 0 APB + CKSDIOSEL = 0 CK_48MHz + CK48MSEL = 1 PLLI2S_Q + I2CFMP1SEL = 0 APB +} + + + +*/ -- cgit v1.2.3 From 408badbef80d7a3412b5ad92b269be19d0faaa09 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 2 Oct 2018 12:48:25 -0700 Subject: altos/stm32f4-disco: Start hooking up stm32f413 USB for the disco board Non-working as yet. Signed-off-by: Keith Packard --- src/stm32f4-disco/Makefile | 6 ++++-- src/stm32f4-disco/ao_disco.c | 5 ++++- src/stm32f4-disco/ao_pins.h | 18 +++++++++++++----- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/stm32f4-disco/Makefile b/src/stm32f4-disco/Makefile index c4aa8e0a..de30316c 100644 --- a/src/stm32f4-disco/Makefile +++ b/src/stm32f4-disco/Makefile @@ -29,10 +29,12 @@ ALTOS_SRC = \ ao_timer.c \ ao_task.c \ ao_stdio.c \ - ao_product.o \ + ao_product.c \ ao_cmd.c \ ao_exti_stm32f4.c \ ao_usart_stm32f4.c \ + ao_usb_gen.c \ + ao_usb_stm32f4.c \ ao_led.c \ ao_impure.c \ $(SCHEME_SRCS) @@ -72,7 +74,7 @@ ao_scheme_const.h: ao-scheme-make-const-big $(SCHEME_SCHEME) distclean: clean clean: - rm -f *.o *.elf *.ihx + rm -f *.o *.elf *.ihx *.map install: diff --git a/src/stm32f4-disco/ao_disco.c b/src/stm32f4-disco/ao_disco.c index ede7c05f..ab3c0340 100644 --- a/src/stm32f4-disco/ao_disco.c +++ b/src/stm32f4-disco/ao_disco.c @@ -14,6 +14,7 @@ #include #include +#include static void scheme_cmd() { ao_scheme_read_eval_print(stdin, stdout, false); @@ -44,9 +45,11 @@ void main(void) { ao_clock_init(); ao_timer_init(); + ao_task_init(); + ao_led_init(); ao_usart_init(); - ao_task_init(); + ao_usb_init(); ao_cmd_init(); ao_cmd_register(scheme_cmds); ao_start_scheduler(); diff --git a/src/stm32f4-disco/ao_pins.h b/src/stm32f4-disco/ao_pins.h index e6dcea8e..6a18d59d 100644 --- a/src/stm32f4-disco/ao_pins.h +++ b/src/stm32f4-disco/ao_pins.h @@ -18,23 +18,24 @@ #define AO_HSE 8000000 /* fed from st/link processor */ #define AO_HSE_BYPASS 1 /* no xtal, directly fed */ -#define AO_PLL_M 4 /* down to 2MHz */ +#define AO_PLL_M 8 /* down to 1MHz */ -#define AO_PLL1_N 96 /* up to 192MHz */ +#define AO_PLL1_R 2 /* down to 96MHz */ +#define AO_PLL1_N 192 /* up to 192MHz */ #define AO_PLL1_P 2 /* down to 96MHz */ #define AO_PLL1_Q 4 /* down to 48MHz for USB and SDIO */ #define AO_AHB_PRESCALER 1 #define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1 -#define AO_APB1_PRESCALER 1 -#define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE1_DIV_1 +#define AO_APB1_PRESCALER 2 +#define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE1_DIV_2 + #define AO_APB2_PRESCALER 1 #define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_1 #define DEBUG_THE_CLOCK 1 -#define HAS_USB 0 #define HAS_BEEP 0 #define B_USER_PORT (&stm_gpioa) @@ -54,6 +55,8 @@ #define AO_LED_PANIC LED_RED +#define AO_CMD_LEN 128 + /* USART */ #define HAS_SERIAL_6 1 @@ -68,4 +71,9 @@ #define USE_SERIAL_6_FLOW 0 #define USE_SERIAL_6_SW_FLOW 0 +/* USB */ + +#define HAS_USB 1 +#define USE_USB_STDIO 0 + #endif /* _AO_PINS_H_ */ -- cgit v1.2.3 From 815d537e0fa6503b2a83d92d94c734eaee15987b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 13 Oct 2018 08:26:02 -0700 Subject: Bump version to 1.8.7.1 Tag development versions Signed-off-by: Keith Packard --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 517cdc25..e888aa99 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.57) -AC_INIT([altos], 1.8.7) +AC_INIT([altos], 1.8.7.1) ANDROID_VERSION=18 AC_CONFIG_SRCDIR([src/kernel/ao.h]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) -- cgit v1.2.3 From cf21c87f9f3e1a75dba39ab41dfffb629586935d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 13 Oct 2018 08:27:17 -0700 Subject: Remove .gitmodules We no longer use submodules (yay!) Signed-off-by: Keith Packard --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 719da199..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "pdclib"] - path = pdclib - url = git://git.gag.com/fw/pdclib -- cgit v1.2.3 From 346fdfb469f7f3c1f87a39dee5bfb4568631c28b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 13 Oct 2018 08:27:41 -0700 Subject: altos: Remove pdclib bits from Makefile Signed-off-by: Keith Packard --- src/Makefile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Makefile b/src/Makefile index 3e00d70c..4eb0d4c3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -116,11 +116,3 @@ ao_whiten.h: make-whiten clean-local: $(CLEAN_PDCLIB) rm -f altitude.h ao_kalman.h - -pdclib: - mkdir -p $(PDCLIB_ROOT)/include $(PDCLIB_ROOT)/lib - cd ../pdclib && make && make prefix=`pwd`/../pdclib-root install - -clean-pdclib: - rm -rf $(PDCLIB_ROOT) - cd ../pdclib && make clean -- cgit v1.2.3 From 983c36782527078ce667feb9eccd1ed0b97fbc29 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 13 Oct 2018 08:33:49 -0700 Subject: altos/drivers: Use stdbool in ao_ms5607.c We don't have TRUE and FALSE anymore (they were pdclib specific). Signed-off-by: Keith Packard --- src/drivers/ao_ms5607.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/drivers/ao_ms5607.c b/src/drivers/ao_ms5607.c index a00d54c8..e2327bf4 100644 --- a/src/drivers/ao_ms5607.c +++ b/src/drivers/ao_ms5607.c @@ -74,7 +74,7 @@ ao_ms5607_crc(uint8_t *prom) return n_rem; } -static int +static bool ao_ms5607_prom_valid(uint8_t *prom) { uint8_t crc; @@ -87,13 +87,13 @@ ao_ms5607_prom_valid(uint8_t *prom) if (*p++ + 1 > 1) break; if (i == 16) - return FALSE; + return false; crc = ao_ms5607_crc(prom); if (crc != (prom[15] & 0xf)) - return FALSE; + return false; - return TRUE; + return true; } static void -- cgit v1.2.3 From 41ebb27230de6385a01c111c299bb22b1cb0badf Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sat, 13 Oct 2018 09:55:03 -0600 Subject: altos: remove teleterra-v0.1, also an ancient cc1111 project --- src/teleterra-v0.1/.gitignore | 2 - src/teleterra-v0.1/ao_pins.h | 213 ------------------------------------------ 2 files changed, 215 deletions(-) delete mode 100644 src/teleterra-v0.1/.gitignore delete mode 100644 src/teleterra-v0.1/ao_pins.h diff --git a/src/teleterra-v0.1/.gitignore b/src/teleterra-v0.1/.gitignore deleted file mode 100644 index 447007ce..00000000 --- a/src/teleterra-v0.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -teleterra-v0.1* -ao_product.h diff --git a/src/teleterra-v0.1/ao_pins.h b/src/teleterra-v0.1/ao_pins.h deleted file mode 100644 index d25a77b7..00000000 --- a/src/teleterra-v0.1/ao_pins.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#ifdef TELETERRA_V_0_1 - #define HAS_FLIGHT 0 - #define HAS_USB 1 - #define HAS_BEEP 0 - #define HAS_GPS 0 - #define HAS_SERIAL_1 0 - #define HAS_ADC 0 - #define HAS_EEPROM 1 - #define HAS_LOG 1 - #define USE_INTERNAL_FLASH 0 - #define HAS_DBG 1 - #define DBG_ON_P1 1 - #define DBG_ON_P0 0 - #define IGNITE_ON_P2 0 - #define IGNITE_ON_P0 0 - #define PACKET_HAS_MASTER 1 - #define PACKET_HAS_SLAVE 0 - - #define HAS_COMPANION 1 - #define COMPANION_CS_ON_P1 1 - #define COMPANION_CS_MASK 0x4 /* CS1 is P1_2 */ - #define COMPANION_CS P1_2 - - #define AO_LED_RED 1 - #define LEDS_AVAILABLE (AO_LED_RED) - #define HAS_EXTERNAL_TEMP 0 - #define HAS_ACCEL_REF 0 - #define HAS_ACCEL 0 - #define HAS_IGNITE 0 - #define HAS_MONITOR 1 - #define HAS_RSSI 0 - #define HAS_AES 1 - - #define SPI_CS_ON_P1 0 - #define SPI_CS_ON_P0 1 - #define M25_CS_MASK 0xf - #define M25_MAX_CHIPS 4 -#endif - -#if DBG_ON_P1 - - #define DBG_CLOCK (1 << 4) /* mi0 */ - #define DBG_DATA (1 << 5) /* mo0 */ - #define DBG_RESET_N (1 << 3) /* c0 */ - - #define DBG_CLOCK_PIN (P1_4) - #define DBG_DATA_PIN (P1_5) - #define DBG_RESET_N_PIN (P1_3) - - #define DBG_PORT_NUM 1 - #define DBG_PORT P1 - #define DBG_PORT_SEL P1SEL - #define DBG_PORT_INP P1INP - #define DBG_PORT_DIR P1DIR - -#endif /* DBG_ON_P1 */ - -#if DBG_ON_P0 - - #define DBG_CLOCK (1 << 3) - #define DBG_DATA (1 << 4) - #define DBG_RESET_N (1 << 5) - - #define DBG_CLOCK_PIN (P0_3) - #define DBG_DATA_PIN (P0_4) - #define DBG_RESET_N_PIN (P0_5) - - #define DBG_PORT_NUM 0 - #define DBG_PORT P0 - #define DBG_PORT_SEL P0SEL - #define DBG_PORT_INP P0INP - #define DBG_PORT_DIR P0DIR - -#endif /* DBG_ON_P0 */ - -#if COMPANION_CS_ON_P1 - #define COMPANION_CS_PORT P1 - #define COMPANION_CS_SEL P1SEL - #define COMPANION_CS_DIR P1DIR -#endif - -#if SPI_CS_ON_P1 - #define SPI_CS_PORT P1 - #define SPI_CS_SEL P1SEL - #define SPI_CS_DIR P1DIR -#endif - -#if SPI_CS_ON_P0 - #define SPI_CS_PORT P0 - #define SPI_CS_SEL P0SEL - #define SPI_CS_DIR P0DIR -#endif - -#ifndef IGNITE_ON_P2 -#error Please define IGNITE_ON_P2 -#endif - -#ifndef IGNITE_ON_P0 -#error Please define IGNITE_ON_P0 -#endif - -#ifndef HAS_SERIAL_1 -#error Please define HAS_SERIAL_1 -#endif - -#ifndef HAS_ADC -#error Please define HAS_ADC -#endif - -#ifndef HAS_EEPROM -#error Please define HAS_EEPROM -#endif - -#ifndef HAS_LOG -#error Please define HAS_LOG -#endif - -#if HAS_EEPROM -#ifndef USE_INTERNAL_FLASH -#error Please define USE_INTERNAL_FLASH -#endif -#endif - -#ifndef HAS_DBG -#error Please define HAS_DBG -#endif - -#ifndef HAS_IGNITE -#error Please define HAS_IGNITE -#endif - -#if HAS_IGNITE -#define HAS_IGNITE_REPORT 1 -#endif - -#ifndef PACKET_HAS_MASTER -#error Please define PACKET_HAS_MASTER -#endif - -#ifndef PACKET_HAS_SLAVE -#error Please define PACKET_HAS_SLAVE -#endif - -#ifndef HAS_MONITOR -#error Please define HAS_MONITOR -#endif - -#if HAS_MONITOR -#ifndef HAS_RSSI -#error Please define HAS_RSSI -#endif -#endif - -#ifndef HAS_ADC -#error Please define HAS_ADC -#endif - -#if HAS_ADC - -#if HAS_ACCEL -#ifndef HAS_ACCEL_REF -#error Please define HAS_ACCEL_REF -#endif -#else -#define HAS_ACCEL_REF 0 -#endif - -#endif /* HAS_ADC */ - -#if IGNITE_ON_P2 -#define AO_IGNITER_DROGUE P2_3 -#define AO_IGNITER_MAIN P2_4 -#define AO_IGNITER_DIR P2DIR -#define AO_IGNITER_DROGUE_BIT (1 << 3) -#define AO_IGNITER_MAIN_BIT (1 << 4) -#endif - -#if IGNITE_ON_P0 -#define AO_IGNITER_DROGUE P0_5 -#define AO_IGNITER_MAIN P0_4 -#define AO_IGNITER_DIR P0DIR -#define AO_IGNITER_DROGUE_BIT (1 << 5) -#define AO_IGNITER_MAIN_BIT (1 << 4) -#endif - -/* test these values with real igniters */ -#define AO_IGNITER_OPEN 1000 -#define AO_IGNITER_CLOSED 7000 -#define AO_IGNITER_FIRE_TIME AO_MS_TO_TICKS(50) -#define AO_IGNITER_CHARGE_TIME AO_MS_TO_TICKS(2000) - -#endif /* _AO_PINS_H_ */ -- cgit v1.2.3 From 2da09b9f5649786f202aa0f295ead728939eddae Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sat, 13 Oct 2018 09:57:44 -0600 Subject: altos: remove telepyro-v0.1 support, which was never completed anyway --- src/telepyro-v0.1/.gitignore | 2 - src/telepyro-v0.1/Makefile | 100 ------------------------------------------- 2 files changed, 102 deletions(-) delete mode 100644 src/telepyro-v0.1/.gitignore delete mode 100644 src/telepyro-v0.1/Makefile diff --git a/src/telepyro-v0.1/.gitignore b/src/telepyro-v0.1/.gitignore deleted file mode 100644 index 5166481c..00000000 --- a/src/telepyro-v0.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telepyro-v0.1* -ao_product.h diff --git a/src/telepyro-v0.1/Makefile b/src/telepyro-v0.1/Makefile deleted file mode 100644 index 9b51d466..00000000 --- a/src/telepyro-v0.1/Makefile +++ /dev/null @@ -1,100 +0,0 @@ -# -# AltOS build -# -# -vpath % .:..:../kernel:../product:../drivers:../avr -vpath ao-make-product.5c ../util - -include ../avr/Makefile.defs - -MCU=atmega32u4 -DUDECPUTYPE=m32u4 -#PROGRAMMER=stk500v2 -P usb -LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: - -INC = \ - ao.h \ - ao_usb.h \ - ao_pins.h \ - ao_arch.h \ - ao_arch_funcs.h \ - ao_product.h - -ALTOS_SRC = \ - ao_clock.c \ - ao_cmd.c \ - ao_mutex.c \ - ao_panic.c \ - ao_product.c \ - ao_stdio.c \ - ao_task.c \ - ao_timer.c \ - ao_led_avr.c \ - ao_avr_stdio.c \ - ao_romconfig.c \ - ao_usb_avr.c \ - ao_adc_avr.c \ - ao_pyro_slave.c \ - ao_spi_slave.c \ - ao_eeprom_avr.c \ - ao_storage.c \ - ao_config.c \ - ao_pyro.c - -PRODUCT=TelePyro-v0.1 -MCU=atmega32u4 -PRODUCT_DEF=-DTELEPYRO -IDPRODUCT=0x0011 -CFLAGS = $(PRODUCT_DEF) -I. -I../avr -I../kernel -I.. -CFLAGS += -mmcu=$(MCU) -Wall -Wstrict-prototypes -O3 -mcall-prologues -DAVR - -NICKLE=nickle - -PROG=telepyro-v0.1 - -SRC=$(ALTOS_SRC) ao_telepyro.c -OBJ=$(SRC:.c=.o) - -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) - -CHECK=sh ../util/check-avr-mem - -$(PROG): Makefile $(OBJ) - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) - $(call quiet,CHECK) $(PROG) || ($(RM) -f $(PROG); exit 1) - -$(PROG).hex: $(PROG) - avr-size $(PROG) - $(OBJCOPY) -R .eeprom -O ihex $(PROG) $@ - - -load: $(PROG).hex - $(LOADCMD) $(LOADARG)$(PROG).hex - -ao_product.h: ao-make-product.5c ../Version - $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ - -ao_product.o: ao_product.c ao_product.h - -%.o : %.c - $(call quiet,CC) -c $(CFLAGS) $< - -distclean: clean - -clean: - rm -f $(OBJ) $(PROG) $(PROG).hex - rm -f ao_product.h - -install: - -uninstall: - -$(OBJ): $(INC) -- cgit v1.2.3 From 3620f09329ccae817fe3ec2f9c2c588ebbfa149b Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sat, 13 Oct 2018 09:59:22 -0600 Subject: altos: remove megadongle-v0.1 support, never went beyond prototype --- src/megadongle-v0.1/.gitignore | 2 - src/megadongle-v0.1/Makefile | 90 ----------------- src/megadongle-v0.1/ao_megadongle.c | 55 ----------- src/megadongle-v0.1/ao_pins.h | 153 ----------------------------- src/megadongle-v0.1/flash-loader/Makefile | 7 -- src/megadongle-v0.1/flash-loader/ao_pins.h | 35 ------- 6 files changed, 342 deletions(-) delete mode 100644 src/megadongle-v0.1/.gitignore delete mode 100644 src/megadongle-v0.1/Makefile delete mode 100644 src/megadongle-v0.1/ao_megadongle.c delete mode 100644 src/megadongle-v0.1/ao_pins.h delete mode 100644 src/megadongle-v0.1/flash-loader/Makefile delete mode 100644 src/megadongle-v0.1/flash-loader/ao_pins.h diff --git a/src/megadongle-v0.1/.gitignore b/src/megadongle-v0.1/.gitignore deleted file mode 100644 index f735e6ea..00000000 --- a/src/megadongle-v0.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -ao_product.h -megadongle-*.elf diff --git a/src/megadongle-v0.1/Makefile b/src/megadongle-v0.1/Makefile deleted file mode 100644 index 4290e088..00000000 --- a/src/megadongle-v0.1/Makefile +++ /dev/null @@ -1,90 +0,0 @@ -# -# AltOS build -# -# - -include ../stm/Makefile.defs - -INC = \ - ao.h \ - ao_arch.h \ - ao_arch_funcs.h \ - ao_boot.h \ - ao_pins.h \ - ao_product.h \ - ao_cc1120_CC1120.h \ - ao_task.h \ - ao_whiten.h \ - stm32l.h \ - Makefile - -#PROFILE=ao_profile.c -#PROFILE_DEF=-DAO_PROFILE=1 - -#SAMPLE_PROFILE=ao_sample_profile.c \ -# ao_sample_profile_timer.c -#SAMPLE_PROFILE_DEF=-DHAS_SAMPLE_PROFILE=1 - -#STACK_GUARD=ao_mpu_stm.c -#STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 - -ALTOS_SRC = \ - ao_boot_chain.c \ - ao_interrupt.c \ - ao_product.c \ - ao_romconfig.c \ - ao_cmd.c \ - ao_config.c \ - ao_task.c \ - ao_led_stm.c \ - ao_stdio.c \ - ao_panic.c \ - ao_timer.c \ - ao_mutex.c \ - ao_freq.c \ - ao_dma_stm.c \ - ao_spi_stm.c \ - ao_cc1120.c \ - ao_fec_tx.c \ - ao_fec_rx.c \ - ao_usb_stm.c \ - ao_exti_stm.c \ - ao_monitor.c \ - ao_rssi.c \ - ao_send_packet.c \ - ao_packet_master.c \ - ao_eeprom_stm.c \ - ao_packet.c - -PRODUCT=MegaDongle-v0.1 -PRODUCT_DEF=-DMEGADONGLE -IDPRODUCT=0x0024 - -CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) $(SAMPLE_PROFILE_DEF) $(STACK_GUARD_DEF) -Os -g - -PROGNAME=megadongle-v0.1 -PROG=$(PROGNAME)-$(VERSION).elf -HEX=$(PROGNAME)-$(VERSION).ihx - -SRC=$(ALTOS_SRC) ao_megadongle.c -OBJ=$(SRC:.c=.o) - -all: $(PROG) $(HEX) - -$(PROG): Makefile $(OBJ) altos.ld - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) - -$(OBJ): $(INC) - -ao_product.h: ao-make-product.5c ../Version - $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ - -distclean: clean - -clean: - rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx - rm -f ao_product.h - -install: - -uninstall: diff --git a/src/megadongle-v0.1/ao_megadongle.c b/src/megadongle-v0.1/ao_megadongle.c deleted file mode 100644 index e6821a3e..00000000 --- a/src/megadongle-v0.1/ao_megadongle.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#include -#include -#include -#include - -int -main(void) -{ - ao_clock_init(); - -#if HAS_STACK_GUARD - ao_mpu_init(); -#endif - - ao_task_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_RED); - ao_timer_init(); - - ao_spi_init(); - ao_dma_init(); - ao_exti_init(); - - ao_cmd_init(); - - ao_usb_init(); - ao_radio_init(); - ao_monitor_init(); - ao_rssi_init(AO_LED_RED); - ao_packet_master_init(); - ao_send_packet_init(); - - ao_config_init(); - - ao_start_scheduler(); - return 0; -} diff --git a/src/megadongle-v0.1/ao_pins.h b/src/megadongle-v0.1/ao_pins.h deleted file mode 100644 index 4d3ad4dd..00000000 --- a/src/megadongle-v0.1/ao_pins.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -/* Using TeleMetrum v1.9 board */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#define HAS_TASK_QUEUE 1 - -/* 8MHz High speed external crystal */ -#define AO_HSE 8000000 - -/* PLLVCO = 96MHz (so that USB will work) */ -#define AO_PLLMUL 12 -#define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_12) - -/* SYSCLK = 32MHz (no need to go faster than CPU) */ -#define AO_PLLDIV 3 -#define AO_RCC_CFGR_PLLDIV (STM_RCC_CFGR_PLLDIV_3) - -/* HCLK = 32MHz (CPU clock) */ -#define AO_AHB_PRESCALER 1 -#define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1 - -/* Run APB1 at 16MHz (HCLK/2) */ -#define AO_APB1_PRESCALER 2 -#define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE2_DIV_2 - -/* Run APB2 at 16MHz (HCLK/2) */ -#define AO_APB2_PRESCALER 2 -#define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_2 - -#define HAS_SERIAL_1 0 -#define USE_SERIAL_1_STDIN 0 -#define SERIAL_1_PB6_PB7 0 -#define SERIAL_1_PA9_PA10 0 - -#define HAS_SERIAL_2 0 -#define USE_SERIAL_2_STDIN 0 -#define SERIAL_2_PA2_PA3 0 -#define SERIAL_2_PD5_PD6 0 - -#define HAS_SERIAL_3 0 -#define USE_SERIAL_3_STDIN 0 -#define SERIAL_3_PB10_PB11 0 -#define SERIAL_3_PC10_PC11 0 -#define SERIAL_3_PD8_PD9 0 - -#define HAS_EEPROM 1 -#define USE_INTERNAL_FLASH 1 -#define USE_STORAGE_CONFIG 0 -#define USE_EEPROM_CONFIG 1 -#define HAS_USB 1 -#define HAS_BEEP 0 -#define HAS_RADIO 1 -#define HAS_TELEMETRY 0 -#define HAS_RSSI 1 - -#define HAS_SPI_1 0 -#define SPI_1_PA5_PA6_PA7 0 /* Barometer */ -#define SPI_1_PB3_PB4_PB5 0 -#define SPI_1_PE13_PE14_PE15 0 /* Accelerometer */ - -#define HAS_SPI_2 1 -#define SPI_2_PB13_PB14_PB15 1 /* Radio */ -#define SPI_2_PD1_PD3_PD4 0 -#define SPI_2_OSPEEDR STM_OSPEEDR_10MHz - -#define SPI_2_PORT (&stm_gpiob) -#define SPI_2_SCK_PIN 13 -#define SPI_2_MISO_PIN 14 -#define SPI_2_MOSI_PIN 15 - -#define PACKET_HAS_SLAVE 0 -#define PACKET_HAS_MASTER 1 - -#define LOW_LEVEL_DEBUG 0 - -#define LED_PORT_0_ENABLE STM_RCC_AHBENR_GPIOCEN -#define LED_PORT_0 (&stm_gpioc) -#define LED_PORT_0_MASK (0xffff) -#define LED_PORT_0_SHIFT 0 -#define LED_PIN_RED 14 -#define LED_PIN_GREEN 15 -#define AO_LED_RED (1 << LED_PIN_RED) -#define AO_LED_GREEN (1 << LED_PIN_GREEN) - -#define LEDS_AVAILABLE (AO_LED_RED | AO_LED_GREEN) - -#define HAS_GPS 0 -#define HAS_FLIGHT 0 -#define HAS_ADC 0 -#define HAS_LOG 0 - -/* - * Telemetry monitoring - */ -#define HAS_MONITOR 1 -#define LEGACY_MONITOR 0 -#define HAS_MONITOR_PUT 1 -#define AO_MONITOR_LED AO_LED_GREEN - -/* - * Radio (cc1120) - */ - -/* gets pretty close to 434.550 */ - -#define AO_RADIO_CAL_DEFAULT 0x6ca333 - -#define AO_FEC_DEBUG 0 -#define AO_CC1120_SPI_CS_PORT (&stm_gpioa) -#define AO_CC1120_SPI_CS_PIN 2 -#define AO_CC1120_SPI_BUS AO_SPI_2_PB13_PB14_PB15 -#define AO_CC1120_SPI stm_spi2 - -#define AO_CC1120_INT_PORT (&stm_gpioa) -#define AO_CC1120_INT_PIN 3 - -#define AO_CC1120_MCU_WAKEUP_PORT (&stm_gpioa) -#define AO_CC1120_MCU_WAKEUP_PIN (4) - -#define AO_CC1120_INT_GPIO 2 -#define AO_CC1120_INT_GPIO_IOCFG CC1120_IOCFG2 - -#define AO_CC1120_MARC_GPIO 3 -#define AO_CC1120_MARC_GPIO_IOCFG CC1120_IOCFG3 - -/* - * Profiling Viterbi decoding - */ - -#ifndef AO_PROFILE -#define AO_PROFILE 0 -#endif - -#endif /* _AO_PINS_H_ */ diff --git a/src/megadongle-v0.1/flash-loader/Makefile b/src/megadongle-v0.1/flash-loader/Makefile deleted file mode 100644 index adea5786..00000000 --- a/src/megadongle-v0.1/flash-loader/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# AltOS flash loader build -# - -TOPDIR=../.. -HARDWARE=megadongle-v0.1 -include $(TOPDIR)/stm/Makefile-flash.defs diff --git a/src/megadongle-v0.1/flash-loader/ao_pins.h b/src/megadongle-v0.1/flash-loader/ao_pins.h deleted file mode 100644 index 2b18f8e5..00000000 --- a/src/megadongle-v0.1/flash-loader/ao_pins.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright © 2013 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -/* External crystal at 8MHz */ -#define AO_HSE 8000000 - -#include - -/* Companion port cs_companion0 PD0 */ - -#define AO_BOOT_PIN 1 -#define AO_BOOT_APPLICATION_GPIO stm_gpiod -#define AO_BOOT_APPLICATION_PIN 0 -#define AO_BOOT_APPLICATION_VALUE 1 -#define AO_BOOT_APPLICATION_MODE AO_EXTI_MODE_PULL_UP - -#endif /* _AO_PINS_H_ */ -- cgit v1.2.3 From 758c8c27ba1819b5d90fda9e9ba6d15f5e8598e0 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sat, 13 Oct 2018 10:02:13 -0600 Subject: altos: remove teledongle-v1.8 support (what was that, anyway?!?) --- src/teledongle-v1.8/.gitignore | 2 - src/teledongle-v1.8/Makefile | 88 --------------------- src/teledongle-v1.8/ao_pins.h | 148 ------------------------------------ src/teledongle-v1.8/ao_teledongle.c | 55 -------------- 4 files changed, 293 deletions(-) delete mode 100644 src/teledongle-v1.8/.gitignore delete mode 100644 src/teledongle-v1.8/Makefile delete mode 100644 src/teledongle-v1.8/ao_pins.h delete mode 100644 src/teledongle-v1.8/ao_teledongle.c diff --git a/src/teledongle-v1.8/.gitignore b/src/teledongle-v1.8/.gitignore deleted file mode 100644 index 9a30cbb6..00000000 --- a/src/teledongle-v1.8/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -ao_product.h -teledongle-*.elf diff --git a/src/teledongle-v1.8/Makefile b/src/teledongle-v1.8/Makefile deleted file mode 100644 index 461b5855..00000000 --- a/src/teledongle-v1.8/Makefile +++ /dev/null @@ -1,88 +0,0 @@ -# -# AltOS build -# -# - -include ../stm/Makefile.defs - -INC = \ - ao.h \ - ao_arch.h \ - ao_arch_funcs.h \ - ao_boot.h \ - ao_pins.h \ - ao_product.h \ - ao_task.h \ - ao_whiten.h \ - stm32l.h \ - ao_cc1200.h \ - ao_cc1200_CC1200.h \ - Makefile - -#PROFILE=ao_profile.c -#PROFILE_DEF=-DAO_PROFILE=1 - -#SAMPLE_PROFILE=ao_sample_profile.c \ -# ao_sample_profile_timer.c -#SAMPLE_PROFILE_DEF=-DHAS_SAMPLE_PROFILE=1 - -#STACK_GUARD=ao_mpu_stm.c -#STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 - -ALTOS_SRC = \ - ao_boot_chain.c \ - ao_interrupt.c \ - ao_product.c \ - ao_romconfig.c \ - ao_cc1200.c \ - ao_cmd.c \ - ao_config.c \ - ao_task.c \ - ao_led_stm.c \ - ao_stdio.c \ - ao_panic.c \ - ao_timer.c \ - ao_mutex.c \ - ao_freq.c \ - ao_dma_stm.c \ - ao_spi_stm.c \ - ao_usb_stm.c \ - ao_exti_stm.c \ - ao_send_packet.c \ - ao_eeprom_stm.c \ - ao_monitor.c \ - ao_packet_master.c \ - ao_packet.c - -PRODUCT=TeleDongle-v1.8 -PRODUCT_DEF=-DTELEDONGLE -IDPRODUCT=0x000c - -CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) $(SAMPLE_PROFILE_DEF) $(STACK_GUARD_DEF) -Os -g - -PROGNAME=teledongle-v1.8 -PROG=$(PROGNAME)-$(VERSION).elf -HEX=$(PROGNAME)-$(VERSION).ihx - -SRC=$(ALTOS_SRC) ao_teledongle.c -OBJ=$(SRC:.c=.o) - -all: $(PROG) $(HEX) - -$(PROG): Makefile $(OBJ) altos.ld - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) - -$(OBJ): $(INC) - -ao_product.h: ao-make-product.5c ../Version - $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ - -distclean: clean - -clean: - rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx - rm -f ao_product.h - -install: - -uninstall: diff --git a/src/teledongle-v1.8/ao_pins.h b/src/teledongle-v1.8/ao_pins.h deleted file mode 100644 index 72bea368..00000000 --- a/src/teledongle-v1.8/ao_pins.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -/* Using TeleMetrum v1.9 board */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#define HAS_TASK_QUEUE 1 - -/* 8MHz High speed external crystal */ -#define AO_HSE 8000000 - -/* PLLVCO = 96MHz (so that USB will work) */ -#define AO_PLLMUL 12 -#define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_12) - -/* SYSCLK = 32MHz (no need to go faster than CPU) */ -#define AO_PLLDIV 3 -#define AO_RCC_CFGR_PLLDIV (STM_RCC_CFGR_PLLDIV_3) - -/* HCLK = 32MHz (CPU clock) */ -#define AO_AHB_PRESCALER 1 -#define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1 - -/* Run APB1 at 16MHz (HCLK/2) */ -#define AO_APB1_PRESCALER 2 -#define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE2_DIV_2 - -/* Run APB2 at 16MHz (HCLK/2) */ -#define AO_APB2_PRESCALER 2 -#define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_2 - -#define HAS_SERIAL_1 0 -#define USE_SERIAL_1_STDIN 0 -#define SERIAL_1_PB6_PB7 0 -#define SERIAL_1_PA9_PA10 0 - -#define HAS_SERIAL_2 0 -#define USE_SERIAL_2_STDIN 0 -#define SERIAL_2_PA2_PA3 0 -#define SERIAL_2_PD5_PD6 0 - -#define HAS_SERIAL_3 0 -#define USE_SERIAL_3_STDIN 0 -#define SERIAL_3_PB10_PB11 0 -#define SERIAL_3_PC10_PC11 0 -#define SERIAL_3_PD8_PD9 0 - -#define HAS_EEPROM 1 -#define USE_INTERNAL_FLASH 1 -#define USE_STORAGE_CONFIG 0 -#define USE_EEPROM_CONFIG 1 -#define HAS_USB 1 -#define HAS_BEEP 0 -#define HAS_RADIO 1 -#define HAS_TELEMETRY 0 -#define HAS_RSSI 0 - -#define HAS_SPI_1 0 -#define SPI_1_PA5_PA6_PA7 0 /* Barometer */ -#define SPI_1_PB3_PB4_PB5 0 -#define SPI_1_PE13_PE14_PE15 0 /* Accelerometer */ - -#define HAS_SPI_2 1 -#define SPI_2_PB13_PB14_PB15 1 /* Radio */ -#define SPI_2_PD1_PD3_PD4 0 -#define SPI_2_OSPEEDR STM_OSPEEDR_10MHz - -#define SPI_2_PORT (&stm_gpiob) -#define SPI_2_SCK_PIN 13 -#define SPI_2_MISO_PIN 14 -#define SPI_2_MOSI_PIN 15 - -#define PACKET_HAS_SLAVE 0 -#define PACKET_HAS_MASTER 1 - -#define LOW_LEVEL_DEBUG 0 - -#define LED_PORT_0_ENABLE STM_RCC_AHBENR_GPIOCEN -#define LED_PORT_0 (&stm_gpioc) -#define LED_PORT_0_MASK (0xffff) -#define LED_PORT_0_SHIFT 0 -#define LED_PIN_RED 8 -#define LED_PIN_GREEN 9 -#define AO_LED_RED (1 << LED_PIN_RED) -#define AO_LED_GREEN (1 << LED_PIN_GREEN) - -#define LEDS_AVAILABLE (AO_LED_RED | AO_LED_GREEN) - -#define HAS_GPS 0 -#define HAS_FLIGHT 0 -#define HAS_ADC 0 -#define HAS_LOG 0 - -/* - * Telemetry monitoring - */ -#define HAS_MONITOR 1 -#define LEGACY_MONITOR 0 -#define HAS_MONITOR_PUT 1 -#define AO_MONITOR_LED AO_LED_GREEN -#define AO_MONITOR_BAD AO_LED_RED - -/* - * Radio (cc1200) - */ - -/* gets pretty close to 434.550 */ - -#define AO_RADIO_CAL_DEFAULT 5695733 - -#define AO_FEC_DEBUG 0 -#define AO_CC1200_SPI_CS_PORT (&stm_gpioc) -#define AO_CC1200_SPI_CS_PIN 5 -#define AO_CC1200_SPI_BUS AO_SPI_2_PB13_PB14_PB15 -#define AO_CC1200_SPI stm_spi2 - -#define AO_CC1200_INT_PORT (&stm_gpioe) -#define AO_CC1200_INT_PIN 1 - -#define AO_CC1200_INT_GPIO 2 -#define AO_CC1200_INT_GPIO_IOCFG CC1200_IOCFG2 - -/* - * Profiling Viterbi decoding - */ - -#ifndef AO_PROFILE -#define AO_PROFILE 0 -#endif - -#endif /* _AO_PINS_H_ */ diff --git a/src/teledongle-v1.8/ao_teledongle.c b/src/teledongle-v1.8/ao_teledongle.c deleted file mode 100644 index 7fd6acdb..00000000 --- a/src/teledongle-v1.8/ao_teledongle.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#include -#include -#include -#include - -int -main(void) -{ - ao_clock_init(); - -#if HAS_STACK_GUARD - ao_mpu_init(); -#endif - - ao_task_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_RED); - ao_timer_init(); - - ao_spi_init(); - ao_dma_init(); - ao_exti_init(); - - ao_cmd_init(); - - ao_usb_init(); - ao_radio_init(); - ao_monitor_init(); - ao_packet_master_init(); - ao_send_packet_init(); - - ao_config_init(); - - ao_led_off(AO_LED_RED); - ao_start_scheduler(); - return 0; -} -- cgit v1.2.3 From 59f66e3264a48d8586dcbd12f6f0fa91e2e1ecdc Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sat, 13 Oct 2018 10:12:39 -0600 Subject: altos: remove telescience support --- src/telescience-pwm/.gitignore | 2 - src/telescience-pwm/Makefile | 112 --------------------- src/telescience-v0.1/.gitignore | 2 - src/telescience-v0.1/Makefile | 111 --------------------- src/telescience-v0.2/.gitignore | 2 - src/telescience-v0.2/Makefile | 87 ---------------- src/telescience-v0.2/ao_pins.h | 147 ---------------------------- src/telescience-v0.2/ao_telescience.c | 54 ---------- src/telescience-v0.2/flash-loader/Makefile | 8 -- src/telescience-v0.2/flash-loader/ao_pins.h | 35 ------- 10 files changed, 560 deletions(-) delete mode 100644 src/telescience-pwm/.gitignore delete mode 100644 src/telescience-pwm/Makefile delete mode 100644 src/telescience-v0.1/.gitignore delete mode 100644 src/telescience-v0.1/Makefile delete mode 100644 src/telescience-v0.2/.gitignore delete mode 100644 src/telescience-v0.2/Makefile delete mode 100644 src/telescience-v0.2/ao_pins.h delete mode 100644 src/telescience-v0.2/ao_telescience.c delete mode 100644 src/telescience-v0.2/flash-loader/Makefile delete mode 100644 src/telescience-v0.2/flash-loader/ao_pins.h diff --git a/src/telescience-pwm/.gitignore b/src/telescience-pwm/.gitignore deleted file mode 100644 index 5d9c0970..00000000 --- a/src/telescience-pwm/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telescience-pwm* -ao_product.h diff --git a/src/telescience-pwm/Makefile b/src/telescience-pwm/Makefile deleted file mode 100644 index 10c63d49..00000000 --- a/src/telescience-pwm/Makefile +++ /dev/null @@ -1,112 +0,0 @@ -# -# AltOS build -# -# -vpath % ..:../kernel:../product:../drivers:../avr -vpath ao-make-product.5c ../util - -include ../avr/Makefile.defs - -MCU=atmega32u4 -DUDECPUTYPE=m32u4 -#PROGRAMMER=stk500v2 -P usb -LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: - -#LDFLAGS=-L$(LDSCRIPTS) -Tavr5.x - -INC = \ - ao.h \ - ao_arch.h \ - ao_usb.h \ - ao_pins.h \ - ao_product.h - -# -# Common AltOS sources -# -TELESCIENCE_STORAGE= \ - ao_m25.c \ - ao_spi_usart.c \ - ao_storage.c - -TELESCIENCE_LOG= \ - ao_log_single.c \ - ao_log_telescience.c - -ALTOS_SRC = \ - ao_clock.c \ - ao_cmd.c \ - ao_mutex.c \ - ao_panic.c \ - ao_product.c \ - ao_stdio.c \ - ao_task.c \ - ao_timer.c \ - ao_led_avr.c \ - ao_avr_stdio.c \ - ao_romconfig.c \ - ao_usb_avr.c \ - ao_adc_avr.c \ - ao_science_slave.c \ - ao_spi_slave.c \ - ao_pwmin.c \ - $(TELESCIENCE_STORAGE)\ - $(TELESCIENCE_LOG) - -PRODUCT=TeleScience-PWM -MCU=atmega32u4 -PRODUCT_DEF=-DTELESCIENCE -DTELESCIENCE_PWM -IDPRODUCT=0x0011 -CFLAGS = $(PRODUCT_DEF) -I. -I../avr -I../kernel -I.. -CFLAGS += -g -mmcu=$(MCU) -Wall -Wstrict-prototypes -O3 -mcall-prologues -DAVR - -NICKLE=nickle - -PROG=telescience-pwm - -SRC=$(ALTOS_SRC) ao_telescience.c -OBJ=$(SRC:.c=.o) - -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) - -CHECK=sh ../util/check-avr-mem - -$(PROG): Makefile $(OBJ) - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) - $(call quiet,CHECK) $(PROG) || ($(RM) -f $(PROG); exit 1) - -$(PROG).hex: $(PROG) - avr-size $(PROG) - $(OBJCOPY) -R .eeprom -O ihex $(PROG) $@ - - -load: $(PROG).hex - $(LOADCMD) $(LOADARG)$(PROG).hex - -ao_product.h: ao-make-product.5c ../Version - $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ - -ao_product.o: ao_product.c ao_product.h - -%.o : %.c $(INC) - $(call quiet,CC) -c $(CFLAGS) $< - -distclean: clean - -clean: - rm -f *.o $(PROG) $(PROG).hex - rm -f ao_product.h - -install: - -uninstall: - -$(OBJ): ao_product.h $(INC) diff --git a/src/telescience-v0.1/.gitignore b/src/telescience-v0.1/.gitignore deleted file mode 100644 index dfccadf8..00000000 --- a/src/telescience-v0.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -telescience-v0.1* -ao_product.h diff --git a/src/telescience-v0.1/Makefile b/src/telescience-v0.1/Makefile deleted file mode 100644 index 8445c64d..00000000 --- a/src/telescience-v0.1/Makefile +++ /dev/null @@ -1,111 +0,0 @@ -# -# AltOS build -# -# -vpath % ..:../kernel:../product:../drivers:../avr -vpath ao-make-product.5c ../util - -include ../avr/Makefile.defs - -MCU=atmega32u4 -DUDECPUTYPE=m32u4 -#PROGRAMMER=stk500v2 -P usb -LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: - -#LDFLAGS=-L$(LDSCRIPTS) -Tavr5.x - -INC = \ - ao.h \ - ao_arch.h \ - ao_usb.h \ - ao_pins.h \ - ao_product.h - -# -# Common AltOS sources -# -TELESCIENCE_STORAGE= \ - ao_m25.c \ - ao_spi_usart.c \ - ao_storage.c - -TELESCIENCE_LOG= \ - ao_log_single.c \ - ao_log_telescience.c - -ALTOS_SRC = \ - ao_clock.c \ - ao_cmd.c \ - ao_mutex.c \ - ao_panic.c \ - ao_product.c \ - ao_stdio.c \ - ao_task.c \ - ao_timer.c \ - ao_led_avr.c \ - ao_avr_stdio.c \ - ao_romconfig.c \ - ao_usb_avr.c \ - ao_adc_avr.c \ - ao_science_slave.c \ - ao_spi_slave.c \ - $(TELESCIENCE_STORAGE)\ - $(TELESCIENCE_LOG) - -PRODUCT=TeleScience-v0.1 -MCU=atmega32u4 -PRODUCT_DEF=-DTELESCIENCE -IDPRODUCT=0x0011 -CFLAGS = $(PRODUCT_DEF) -I. -I../avr -I../kernel -I.. -CFLAGS += -g -mmcu=$(MCU) -Wall -Wstrict-prototypes -O3 -mcall-prologues -DAVR - -NICKLE=nickle - -PROG=telescience-v0.1 - -SRC=$(ALTOS_SRC) ao_telescience.c -OBJ=$(SRC:.c=.o) - -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) - -CHECK=sh ../util/check-avr-mem - -$(PROG): Makefile $(OBJ) - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) - $(call quiet,CHECK) $(PROG) || ($(RM) -f $(PROG); exit 1) - -$(PROG).hex: $(PROG) - avr-size $(PROG) - $(OBJCOPY) -R .eeprom -O ihex $(PROG) $@ - - -load: $(PROG).hex - $(LOADCMD) $(LOADARG)$(PROG).hex - -ao_product.h: ao-make-product.5c ../Version - $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ - -ao_product.o: ao_product.c ao_product.h - -%.o : %.c $(INC) - $(call quiet,CC) -c $(CFLAGS) $< - -distclean: clean - -clean: - rm -f *.o $(PROG) $(PROG).hex - rm -f ao_product.h - -install: - -uninstall: - -$(OBJ): ao_product.h $(INC) diff --git a/src/telescience-v0.2/.gitignore b/src/telescience-v0.2/.gitignore deleted file mode 100644 index cc1f8b73..00000000 --- a/src/telescience-v0.2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -ao_product.h -telescience-*.elf diff --git a/src/telescience-v0.2/Makefile b/src/telescience-v0.2/Makefile deleted file mode 100644 index bc0a1986..00000000 --- a/src/telescience-v0.2/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -# -# AltOS build -# -# - -include ../stm/Makefile.defs - -INC = \ - ao.h \ - ao_arch.h \ - ao_arch_funcs.h \ - ao_pins.h \ - ao_product.h \ - ao_cc1120_CC1120.h \ - ao_task.h \ - ao_whiten.h \ - stm32l.h \ - Makefile - -#PROFILE=ao_profile.c -#PROFILE_DEF=-DAO_PROFILE=1 - -#SAMPLE_PROFILE=ao_sample_profile.c \ -# ao_sample_profile_timer.c -#SAMPLE_PROFILE_DEF=-DHAS_SAMPLE_PROFILE=1 - -#STACK_GUARD=ao_mpu_stm.c -#STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 - -ALTOS_SRC = \ - ao_boot_chain.c \ - ao_interrupt.c \ - ao_product.c \ - ao_romconfig.c \ - ao_cmd.c \ - ao_config.c \ - ao_task.c \ - ao_led_stm.c \ - ao_stdio.c \ - ao_panic.c \ - ao_timer.c \ - ao_mutex.c \ - ao_dma_stm.c \ - ao_spi_stm.c \ - ao_usb_stm.c \ - ao_adc_stm.c \ - ao_data.c \ - ao_exti_stm.c \ - ao_storage.c \ - ao_m25.c \ - ao_science_slave.c \ - ao_spi_stm_slave.c \ - ao_log_telescience.c \ - ao_log_single.c - -PRODUCT=TeleScience-v0.2 -PRODUCT_DEF=-DTELESCIENCE -IDPRODUCT=0x0011 - -CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) $(SAMPLE_PROFILE_DEF) $(STACK_GUARD_DEF) -Os -g - -PROGNAME=telescience-v0.2 -PROG=$(PROGNAME)-$(VERSION).elf -HEX=$(PROGNAME)-$(VERSION).ihx - -SRC=$(ALTOS_SRC) ao_telescience.c -OBJ=$(SRC:.c=.o) - -all: $(PROG) $(HEX) - -$(PROG): Makefile $(OBJ) altos.ld - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) - -$(OBJ): $(INC) - -ao_product.h: ao-make-product.5c ../Version - $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ - -distclean: clean - -clean: - rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx - rm -f ao_product.h - -install: - -uninstall: diff --git a/src/telescience-v0.2/ao_pins.h b/src/telescience-v0.2/ao_pins.h deleted file mode 100644 index 29f16114..00000000 --- a/src/telescience-v0.2/ao_pins.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#define HAS_TASK_QUEUE 1 - -/* 8MHz High speed external crystal */ -#define AO_HSE 8000000 - -/* PLLVCO = 96MHz (so that USB will work) */ -#define AO_PLLMUL 12 -#define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_12) - -/* SYSCLK = 32MHz (no need to go faster than CPU) */ -#define AO_PLLDIV 3 -#define AO_RCC_CFGR_PLLDIV (STM_RCC_CFGR_PLLDIV_3) - -/* HCLK = 32MHz (CPU clock) */ -#define AO_AHB_PRESCALER 1 -#define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1 - -/* Run APB1 at 16MHz (HCLK/2) */ -#define AO_APB1_PRESCALER 2 -#define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE2_DIV_2 - -/* Run APB2 at 16MHz (HCLK/2) */ -#define AO_APB2_PRESCALER 2 -#define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_2 - -#define HAS_SERIAL_1 0 -#define USE_SERIAL_1_STDIN 0 -#define SERIAL_1_PB6_PB7 0 -#define SERIAL_1_PA9_PA10 1 - -#define HAS_SERIAL_2 0 -#define USE_SERIAL_2_STDIN 0 -#define SERIAL_2_PA2_PA3 0 -#define SERIAL_2_PD5_PD6 0 - -#define HAS_SERIAL_3 0 -#define USE_SERIAL_3_STDIN 0 -#define SERIAL_3_PB10_PB11 0 -#define SERIAL_3_PC10_PC11 1 -#define SERIAL_3_PD8_PD9 0 - -#define HAS_EEPROM 1 -#define USE_INTERNAL_FLASH 0 -#define HAS_USB 1 -#define HAS_BEEP 0 -#define HAS_RADIO 0 -#define HAS_TELEMETRY 0 -#define PACKET_HAS_SLAVE 0 - -#define HAS_SPI_1 0 -#define HAS_SPI_SLAVE_1 1 -#define SPI_1_PA5_PA6_PA7 1 -#define SPI_1_PB3_PB4_PB5 0 -#define SPI_1_PE13_PE14_PE15 0 -#define SPI_1_OSPEEDR STM_OSPEEDR_10MHz - -#define HAS_SPI_2 1 -#define SPI_2_PB13_PB14_PB15 1 -#define SPI_2_PD1_PD3_PD4 0 -#define SPI_2_OSPEEDR STM_OSPEEDR_10MHz - -#define SPI_2_PORT (&stm_gpiob) -#define SPI_2_SCK_PIN 13 -#define SPI_2_MISO_PIN 14 -#define SPI_2_MOSI_PIN 15 -#define SPI_SLAVE_INDEX 1 - -#define HAS_I2C_1 0 -#define I2C_1_PB8_PB9 0 - -#define HAS_I2C_2 0 -#define I2C_2_PB10_PB11 0 - -#define LOW_LEVEL_DEBUG 0 - -#define LED_PORT_0_ENABLE STM_RCC_AHBENR_GPIOAEN - -#define LED_PORT_0 (&stm_gpioa) -#define LED_PORT_0_MASK (0xff) -#define LED_PORT_0_SHIFT 0 -#define LED_PIN_RED 8 -#define LED_PIN_GREEN 9 -#define AO_LED_RED (1 << LED_PIN_RED) -#define AO_LED_GREEN (1 << LED_PIN_GREEN) - -#define LEDS_AVAILABLE (AO_LED_RED | AO_LED_GREEN) - -#define HAS_GPS 0 -#define HAS_FLIGHT 0 -#define HAS_ADC 1 -#define HAS_ADC_TEMP 1 -#define HAS_LOG 1 -#define AO_LOG_FORMAT AO_LOG_FORMAT_TELESCIENCE - -/* - * SPI Flash memory - */ - -#define M25_MAX_CHIPS 1 -#define AO_M25_SPI_CS_PORT (&stm_gpioa) -#define AO_M25_SPI_CS_MASK (1 << 3) -#define AO_M25_SPI_BUS AO_SPI_2_PB13_PB14_PB15 - -/* - * ADC - */ - -#define AO_DATA_RING 32 -#define AO_ADC_NUM 1 - -struct ao_adc { - int16_t adc[AO_ADC_NUM]; -}; - -#define AO_ADC_TEMP 16 - -#define AO_ADC_RCC_AHBENR 0 - -#define AO_NUM_ADC_PIN 0 - -#define AO_NUM_ADC 1 - -#define AO_ADC_SQ1 AO_ADC_TEMP - - -#endif /* _AO_PINS_H_ */ diff --git a/src/telescience-v0.2/ao_telescience.c b/src/telescience-v0.2/ao_telescience.c deleted file mode 100644 index 05bb8653..00000000 --- a/src/telescience-v0.2/ao_telescience.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright © 2012 Keith Packard - * - * 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. - */ - -#include -#include -#include -#include - -int -main(void) -{ - ao_clock_init(); - -#if HAS_STACK_GUARD - ao_mpu_init(); -#endif - - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_GREEN); - - ao_task_init(); - - ao_timer_init(); - - ao_spi_init(); - ao_spi_slave_init(); - ao_dma_init(); - ao_exti_init(); - - ao_cmd_init(); - - ao_usb_init(); - ao_config_init(); - - ao_storage_init(); - - ao_start_scheduler(); - return 0; -} diff --git a/src/telescience-v0.2/flash-loader/Makefile b/src/telescience-v0.2/flash-loader/Makefile deleted file mode 100644 index 7a2ceb77..00000000 --- a/src/telescience-v0.2/flash-loader/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# AltOS flash loader build -# -# - -TOPDIR=../.. -HARDWARE=telescience-v0.2 -include $(TOPDIR)/stm/Makefile-flash.defs diff --git a/src/telescience-v0.2/flash-loader/ao_pins.h b/src/telescience-v0.2/flash-loader/ao_pins.h deleted file mode 100644 index 8eaf9299..00000000 --- a/src/telescience-v0.2/flash-loader/ao_pins.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright © 2013 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -/* External crystal at 8MHz */ -#define AO_HSE 8000000 - -#include - -/* Companion port SS PA4 */ - -#define AO_BOOT_PIN 1 -#define AO_BOOT_APPLICATION_GPIO stm_gpioa -#define AO_BOOT_APPLICATION_PIN 4 -#define AO_BOOT_APPLICATION_VALUE 1 -#define AO_BOOT_APPLICATION_MODE AO_EXTI_MODE_PULL_UP - -#endif /* _AO_PINS_H_ */ -- cgit v1.2.3 From facf790f469df374257440ba9482321cbab7cecb Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sat, 13 Oct 2018 10:17:47 -0600 Subject: altos: remove usbtrng support (chaoskey prototypes) --- src/usbtrng-v2.0/.gitignore | 2 - src/usbtrng-v2.0/Makefile | 70 --------- src/usbtrng-v2.0/ao_pins.h | 68 --------- src/usbtrng-v2.0/ao_usbtrng.c | 44 ------ src/usbtrng-v2.0/flash-loader/.gitignore | 2 - src/usbtrng-v2.0/flash-loader/Makefile | 8 - src/usbtrng-v2.0/flash-loader/ao_pins.h | 32 ---- src/usbtrng/Makefile | 70 --------- src/usbtrng/ao_pins.h | 76 ---------- src/usbtrng/ao_usbtrng.c | 247 ------------------------------- src/usbtrng/flash-loader/Makefile | 8 - src/usbtrng/flash-loader/ao_pins.h | 34 ----- 12 files changed, 661 deletions(-) delete mode 100644 src/usbtrng-v2.0/.gitignore delete mode 100644 src/usbtrng-v2.0/Makefile delete mode 100644 src/usbtrng-v2.0/ao_pins.h delete mode 100644 src/usbtrng-v2.0/ao_usbtrng.c delete mode 100644 src/usbtrng-v2.0/flash-loader/.gitignore delete mode 100644 src/usbtrng-v2.0/flash-loader/Makefile delete mode 100644 src/usbtrng-v2.0/flash-loader/ao_pins.h delete mode 100644 src/usbtrng/Makefile delete mode 100644 src/usbtrng/ao_pins.h delete mode 100644 src/usbtrng/ao_usbtrng.c delete mode 100644 src/usbtrng/flash-loader/Makefile delete mode 100644 src/usbtrng/flash-loader/ao_pins.h diff --git a/src/usbtrng-v2.0/.gitignore b/src/usbtrng-v2.0/.gitignore deleted file mode 100644 index 93b38d11..00000000 --- a/src/usbtrng-v2.0/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -ao_product.h -usbtrng-* diff --git a/src/usbtrng-v2.0/Makefile b/src/usbtrng-v2.0/Makefile deleted file mode 100644 index 678a24de..00000000 --- a/src/usbtrng-v2.0/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# -# AltOS build -# -# - -include ../stmf0/Makefile.defs - -INC = \ - ao.h \ - ao_arch.h \ - ao_arch_funcs.h \ - ao_pins.h \ - ao_product.h \ - ao_task.h \ - ao_adc_fast.h \ - stm32f0.h - -# -# Common AltOS sources -# -ALTOS_SRC = \ - ao_interrupt.c \ - ao_timer.c \ - ao_panic.c \ - ao_mutex.c \ - ao_dma_stm.c \ - ao_adc_fast.c \ - ao_crc_stm.c \ - ao_stdio.c \ - ao_led_stmf0.c \ - ao_romconfig.c \ - ao_boot_chain.c \ - ao_cmd.c \ - ao_usb_stm.c \ - ao_trng.c \ - ao_task.c \ - ao_product.c - -PRODUCT=usbtrng-v2.0 -PRODUCT_DEF=-DUSBTRNG_V_2_0 -IDPRODUCT=0x0028 - -CFLAGS = $(PRODUCT_DEF) $(STMF0_CFLAGS) -g -Os - -PROGNAME=usbtrng-v2.0 -PROG=$(PROGNAME)-$(VERSION).elf -HEX=$(PROGNAME)-$(VERSION).ihx - -SRC=$(ALTOS_SRC) ao_usbtrng.c -OBJ=$(SRC:.c=.o) - -all: $(PROG) $(HEX) - -$(PROG): Makefile $(OBJ) altos.ld - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) - -ao_product.h: ao-make-product.5c ../Version - $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ - -$(OBJ): $(INC) - -distclean: clean - -clean: - rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx - rm -f ao_product.h - -install: - -uninstall: diff --git a/src/usbtrng-v2.0/ao_pins.h b/src/usbtrng-v2.0/ao_pins.h deleted file mode 100644 index 2b23f967..00000000 --- a/src/usbtrng-v2.0/ao_pins.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright © 2015 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#define LED_PORT_ENABLE STM_RCC_AHBENR_IOPAEN -#define LED_PORT (&stm_gpioa) -#define LED_PIN_RED 2 -#define LED_PIN_GREEN 3 -#define AO_LED_RED (1 << LED_PIN_RED) -#define AO_LED_GREEN (1 << LED_PIN_GREEN) - -#define LEDS_AVAILABLE (AO_LED_RED | AO_LED_GREEN) - -#define HAS_BEEP 0 - -/* 48MHz clock based on USB */ -#define AO_HSI48 1 - -/* HCLK = 48MHz */ -#define AO_AHB_PRESCALER 1 -#define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1 - -/* APB = 48MHz */ -#define AO_APB_PRESCALER 1 -#define AO_RCC_CFGR_PPRE_DIV STM_RCC_CFGR_PPRE_DIV_1 - -#define HAS_USB 1 -#define AO_USB_DIRECTIO 1 -#define AO_PA11_PA12_RMP 0 - -#define IS_FLASH_LOADER 0 - -/* ADC */ - -#define AO_ADC_PIN0_PORT (&stm_gpioa) -#define AO_ADC_PIN0_PIN 6 -#define AO_ADC_PIN0_CH 6 - -#define AO_ADC_RCC_AHBENR ((1 << STM_RCC_AHBENR_IOPAEN)) - -#define AO_NUM_ADC 1 - -/* CRC */ -#define AO_CRC_WIDTH 32 -#define AO_CRC_INIT 0xffffffff - -/* TRNG */ -#define AO_LED_TRNG_READ AO_LED_RED -#define AO_LED_TRNG_WRITE AO_LED_GREEN - -#endif /* _AO_PINS_H_ */ diff --git a/src/usbtrng-v2.0/ao_usbtrng.c b/src/usbtrng-v2.0/ao_usbtrng.c deleted file mode 100644 index e34babec..00000000 --- a/src/usbtrng-v2.0/ao_usbtrng.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright © 2014 Keith Packard - * - * 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. - */ - -#include -#include -#include -#include - -void main(void) -{ - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_RED); - ao_clock_init(); - ao_task_init(); - ao_timer_init(); - ao_dma_init(); - ao_adc_init(); - ao_crc_init(); - - ao_cmd_init(); - - ao_usb_init(); - - ao_trng_init(); - - ao_led_off(AO_LED_RED); - - ao_start_scheduler(); -} diff --git a/src/usbtrng-v2.0/flash-loader/.gitignore b/src/usbtrng-v2.0/flash-loader/.gitignore deleted file mode 100644 index 32dbbbcf..00000000 --- a/src/usbtrng-v2.0/flash-loader/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -ao_product.h -usbtrng* diff --git a/src/usbtrng-v2.0/flash-loader/Makefile b/src/usbtrng-v2.0/flash-loader/Makefile deleted file mode 100644 index a2bf199f..00000000 --- a/src/usbtrng-v2.0/flash-loader/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# AltOS flash loader build -# -# - -TOPDIR=../.. -HARDWARE=usbtrng-v2.0 -include $(TOPDIR)/stmf0/Makefile-flash.defs diff --git a/src/usbtrng-v2.0/flash-loader/ao_pins.h b/src/usbtrng-v2.0/flash-loader/ao_pins.h deleted file mode 100644 index 9e7c2c33..00000000 --- a/src/usbtrng-v2.0/flash-loader/ao_pins.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright © 2013 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#include - -/* Red LED */ - -#define AO_BOOT_PIN 1 -#define AO_BOOT_APPLICATION_GPIO stm_gpioa -#define AO_BOOT_APPLICATION_PIN 2 -#define AO_BOOT_APPLICATION_VALUE 0 -#define AO_BOOT_APPLICATION_MODE AO_EXTI_MODE_PULL_DOWN - -#endif /* _AO_PINS_H_ */ diff --git a/src/usbtrng/Makefile b/src/usbtrng/Makefile deleted file mode 100644 index 80e137e7..00000000 --- a/src/usbtrng/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# -# AltOS build -# -# - -include ../lpc/Makefile.defs - -INC = \ - ao.h \ - ao_arch.h \ - ao_arch_funcs.h \ - ao_pins.h \ - ao_product.h \ - lpc.h - -# -# Common AltOS sources -# -ALTOS_SRC = \ - ao_interrupt.c \ - ao_boot_chain.c \ - ao_romconfig.c \ - ao_product.c \ - ao_mutex.c \ - ao_panic.c \ - ao_stdio.c \ - ao_task.c \ - ao_cmd.c \ - ao_timer_lpc.c \ - ao_exti_lpc.c \ - ao_usb_lpc.c \ - ao_serial_lpc.c \ - ao_spi_lpc.c \ - ao_led_lpc.c - -PRODUCT=usbtrng-v0.1 -PRODUCT_DEF=-DUSBTRNG_V_0_1 -IDPRODUCT=0x0028 - -CFLAGS = $(PRODUCT_DEF) $(LPC_CFLAGS) -g -Os - -PROGNAME=usbtrng-v0.1 -PROG=$(PROGNAME)-$(VERSION).elf -HEX=$(PROGNAME)-$(VERSION).ihx - -SRC=$(ALTOS_SRC) ao_usbtrng.c -OBJ=$(SRC:.c=.o) - -all: $(PROG) $(HEX) - -$(PROG): Makefile $(OBJ) altos.ld - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) - -ao_product.h: ao-make-product.5c ../Version - $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ - -$(OBJ): $(INC) - -load: $(PROG) - lpc-load $(PROG) - -distclean: clean - -clean: - rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx - rm -f ao_product.h - -install: - -uninstall: diff --git a/src/usbtrng/ao_pins.h b/src/usbtrng/ao_pins.h deleted file mode 100644 index 2fd5df33..00000000 --- a/src/usbtrng/ao_pins.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright © 2013 Keith Packard - * - * 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. - */ - -#define HAS_BEEP 0 - -#define AO_STACK_SIZE 384 - -#define IS_FLASH_LOADER 0 - -/* Crystal on the board */ -#define AO_LPC_CLKIN 12000000 - -/* Main clock frequency. 48MHz for USB so we don't use the USB PLL */ -#define AO_LPC_CLKOUT 48000000 - -/* System clock frequency */ -#define AO_LPC_SYSCLK 24000000 - -#define HAS_USB 1 - -#define HAS_USB_CONNECT 0 -#define HAS_USB_VBUS 0 -#define HAS_USB_PULLUP 1 -#define AO_USB_PULLUP_PORT 0 -#define AO_USB_PULLUP_PIN 6 - -/* USART */ - -#define HAS_SERIAL 1 -#define USE_SERIAL_0_STDIN 0 -#define SERIAL_0_18_19 1 -#define SERIAL_0_14_15 0 -#define SERIAL_0_17_18 0 -#define SERIAL_0_26_27 0 - -/* SPI */ - -#define HAS_SPI_0 0 -#define SPI_SCK0_P0_6 0 -#define HAS_SPI_1 1 -#define SPI_SCK1_P1_15 0 -#define SPI_MISO1_P0_22 1 -#define SPI_MOSI1_P0_21 0 - -/* LED */ - -#define LED_PORT 0 -#define LED_PIN_RED 3 -#define LED_PIN_GREEN 21 -#define AO_LED_RED (1 << LED_PIN_RED) -#define AO_LED_GREEN (1 << LED_PIN_GREEN) - -#define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN) - -/* Kludge the SPI driver to not configure any - * pin for SCK or MOSI - */ -#define HAS_SCK1 0 -#define HAS_MOSI1 0 - -#define AO_ADC_6 1 diff --git a/src/usbtrng/ao_usbtrng.c b/src/usbtrng/ao_usbtrng.c deleted file mode 100644 index cb15a250..00000000 --- a/src/usbtrng/ao_usbtrng.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright © 2014 Keith Packard - * - * 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. - */ - -#include - -#define AO_TRNG_SPI_BUS 1 - -static uint32_t spi_speed = AO_SPI_SPEED_4MHz; - -#define AO_TRNG_SPI_BUF 1024 - -#if 0 - -static uint8_t *spi_buf; -static uint8_t *spi_head, *spi_tail; -static uint8_t spi_wakeup; - -static void -ao_trng_run(void) -{ - int this_time; - uint8_t *end; - - if (!spi_buf) - spi_buf = ao_usb_alloc(AO_TRNG_SPI_BUF); - flush(); - ao_spi_get(AO_TRNG_SPI_BUS, spi_speed); - spi_tail = spi_buf; - spi_head = spi_buf; - ao_spi_recv_ring_start(spi_buf, AO_TRNG_SPI_BUF, &spi_head, &spi_tail, &spi_wakeup, AO_TRNG_SPI_BUS); - while (!ao_usb_out_avail) { - ao_arch_block_interrupts(); - while (spi_head == spi_tail) { - spi_wakeup = 0; - ao_sleep(&spi_wakeup); - } - ao_arch_release_interrupts(); - if (spi_tail > spi_head) - end = spi_buf + AO_TRNG_SPI_BUF; - else - end = spi_head; - this_time = end - spi_tail; - if (this_time > 64) - this_time = 64; - ao_usb_write(spi_tail, this_time); - spi_tail += this_time; - if (spi_tail == spi_buf + AO_TRNG_SPI_BUF) - spi_tail = spi_buf; - } - ao_spi_put(AO_TRNG_SPI_BUS); - getchar(); -} - - -static void -ao_trng_test(void) -{ - static uint8_t random[32]; - uint8_t i; - - ao_spi_get(AO_TRNG_SPI_BUS, spi_speed); - ao_spi_recv(random, sizeof (random), AO_TRNG_SPI_BUS); - ao_spi_put(AO_TRNG_SPI_BUS); - for (i = 0; i < sizeof (random); i++) - printf (" %02x", random[i]); - printf ("\n"); -} -#endif - -#define ADC_RING_SIZE 512 - -static uint8_t *adc_ring; -static uint16_t adc_head, adc_tail; -static uint16_t adc_wake; - -void lpc_adc_isr(void) -{ - uint16_t avail; - uint16_t this, next; - - this = adc_head; - next = (this + 1) & (ADC_RING_SIZE - 1); - if (next == adc_tail) { - lpc_adc.inten = 0; - return; - } - adc_ring[this] = lpc_adc.dr[6] >> 8; - adc_head = next; - - /* If there are enough entries, wake up any waiters - */ - avail = (next - adc_tail) & (ADC_RING_SIZE - 1); - if (avail >= adc_wake) { - adc_wake = 0; - ao_wakeup(&adc_wake); - } -} - -#define AO_ADC_CLKDIV (AO_LPC_SYSCLK / 450000) - -static void -ao_trng_adc_init(void) -{ - adc_ring = ao_usb_alloc(ADC_RING_SIZE); - - lpc_scb.sysahbclkctrl |= (1 << LPC_SCB_SYSAHBCLKCTRL_ADC); - lpc_scb.pdruncfg &= ~(1 << LPC_SCB_PDRUNCFG_ADC_PD); - - /* Enable interrupt when AO_ADC_6 is complete */ - lpc_adc.inten = 0; - - lpc_nvic_set_enable(LPC_ISR_ADC_POS); - lpc_nvic_set_priority(LPC_ISR_ADC_POS, AO_LPC_NVIC_CLOCK_PRIORITY); - -#if AO_ADC_0 - ao_enable_analog(0, 11, 0); -#endif -#if AO_ADC_1 - ao_enable_analog(0, 12, 1); -#endif -#if AO_ADC_2 - ao_enable_analog(0, 13, 2); -#endif -#if AO_ADC_3 - ao_enable_analog(0, 14, 3); -#endif -#if AO_ADC_4 - ao_enable_analog(0, 15, 4); -#endif -#if AO_ADC_5 - ao_enable_analog(0, 16, 5); -#endif -#if AO_ADC_6 - ao_enable_analog(0, 22, 6); -#endif -#if AO_ADC_7 - ao_enable_analog(0, 23, 7); -#endif - - lpc_adc.cr = ((1 << (LPC_ADC_CR_SEL + 6)) | - (AO_ADC_CLKDIV << LPC_ADC_CR_CLKDIV) | - (1 << LPC_ADC_CR_BURST) | - (LPC_ADC_CR_CLKS_9 << LPC_ADC_CR_CLKS)); -} - -static void -ao_trng_adc_dump(void) -{ - int i; - - while (((adc_head - adc_tail) & (ADC_RING_SIZE - 1)) < 16) { - lpc_adc.inten = (1 << (LPC_ADC_INTEN_ADINTEN + 6)); - adc_wake = 16; - ao_sleep(&adc_wake); - } - printf("adc_head %d tail %d\n", adc_head, adc_tail); - - for (i = 0; i < 16; i++) { - printf(" %4d", adc_ring[adc_tail]); - adc_tail = (adc_tail + 1) & (ADC_RING_SIZE - 1); - } - printf("\n"); - lpc_adc.inten = 0; -} - -static void -ao_trng_run(void) -{ - uint16_t this_time; - flush(); - - while (!ao_usb_out_avail) { - ao_arch_block_interrupts(); - while (((adc_head - adc_tail) & (ADC_RING_SIZE - 1)) < 64) { - lpc_adc.inten = (1 << (LPC_ADC_INTEN_ADINTEN + 6)); - adc_wake = 64; - ao_sleep(&adc_wake); - } - ao_arch_release_interrupts(); - - this_time = ADC_RING_SIZE - adc_tail; - if (this_time > 64) - this_time = 64; - ao_usb_write(&adc_ring[adc_tail], this_time); - adc_tail = (adc_tail + this_time) & (ADC_RING_SIZE - 1); - } - lpc_adc.inten = 0; -} - -static void -ao_trng_speed(void) -{ - ao_cmd_decimal(); - - if (ao_cmd_lex_u32 == 0 || ao_cmd_status != ao_cmd_success) { - ao_cmd_status = ao_cmd_success; - printf ("Current spi speed %d\n", spi_speed); - } else { - spi_speed = ao_cmd_lex_u32; - } -} - -static const struct ao_cmds ao_trng_cmds[] = { -// { ao_trng_test, "R\0Dump some random numbers" }, - { ao_trng_run, "s\0Send random bits until char" }, - { ao_trng_speed, "S \0Set SPI speed (48MHz/speed)" }, - { ao_trng_adc_dump, "a\0Dump ADC data" }, - { 0, NULL } -}; - -void -main(void) -{ - ao_clock_init(); - ao_task_init(); - ao_timer_init(); - -// ao_spi_init(); - ao_usb_init(); - - ao_trng_adc_init(); - - ao_serial_init(); - - ao_led_init(LEDS_AVAILABLE); - - ao_cmd_init(); - - ao_cmd_register(ao_trng_cmds); - - ao_start_scheduler(); -} diff --git a/src/usbtrng/flash-loader/Makefile b/src/usbtrng/flash-loader/Makefile deleted file mode 100644 index e34f1089..00000000 --- a/src/usbtrng/flash-loader/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# AltOS flash loader build -# -# - -TOPDIR=../.. -HARDWARE=usbtrng-v0.1 -include $(TOPDIR)/lpc/Makefile-flash.defs diff --git a/src/usbtrng/flash-loader/ao_pins.h b/src/usbtrng/flash-loader/ao_pins.h deleted file mode 100644 index cb385600..00000000 --- a/src/usbtrng/flash-loader/ao_pins.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright © 2013 Keith Packard - * - * 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. - */ - -#ifndef _AO_PINS_H_ -#define _AO_PINS_H_ - -#include - -#define AO_BOOT_PIN 1 -#define AO_BOOT_APPLICATION_GPIO 0 -#define AO_BOOT_APPLICATION_PIN 19 -#define AO_BOOT_APPLICATION_VALUE 1 -#define AO_BOOT_APPLICATION_MODE AO_EXTI_MODE_PULL_UP - -#define HAS_USB_PULLUP 1 -#define AO_USB_PULLUP_PORT 0 -#define AO_USB_PULLUP_PIN 6 - -#endif /* _AO_PINS_H_ */ -- cgit v1.2.3 From 80affca535c5c43a5d9963dfafc74f9675c9b155 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 19 Oct 2018 08:12:22 -0700 Subject: altos: Create ao_data_fill shared function This fills a data ring entry with all of the current sensor values other than the ADC. It is used in all of the adc completion functions. Signed-off-by: Keith Packard --- src/kernel/ao_data.h | 28 ++++++++++++++++++++++++++++ src/lpc/ao_adc_lpc.c | 18 +----------------- src/stm/ao_adc_stm.c | 21 +-------------------- src/stmf0/ao_adc_stm.c | 18 +----------------- 4 files changed, 31 insertions(+), 54 deletions(-) diff --git a/src/kernel/ao_data.h b/src/kernel/ao_data.h index f88b30c9..97f7e06e 100644 --- a/src/kernel/ao_data.h +++ b/src/kernel/ao_data.h @@ -400,4 +400,32 @@ typedef int16_t ao_mag_t; /* in raw sample units */ #endif +#ifdef AO_DATA_RING + +static inline void +ao_data_fill(int head) { + if (ao_data_present == AO_DATA_ALL) { +#if HAS_MS5607 + ao_data_ring[head].ms5607_raw = ao_ms5607_current; +#endif +#if HAS_MMA655X + ao_data_ring[head].mma655x = ao_mma655x_current; +#endif +#if HAS_HMC5883 + ao_data_ring[head].hmc5883 = ao_hmc5883_current; +#endif +#if HAS_MPU6000 + ao_data_ring[head].mpu6000 = ao_mpu6000_current; +#endif +#if HAS_MPU9250 + ao_data_ring[head].mpu9250 = ao_mpu9250_current; +#endif + ao_data_ring[head].tick = ao_tick_count; + ao_data_head = ao_data_ring_next(head); + ao_wakeup((void *) &ao_data_head); + } +} + +#endif + #endif /* _AO_DATA_H_ */ diff --git a/src/lpc/ao_adc_lpc.c b/src/lpc/ao_adc_lpc.c index 6743c1f4..63241559 100644 --- a/src/lpc/ao_adc_lpc.c +++ b/src/lpc/ao_adc_lpc.c @@ -112,23 +112,7 @@ void lpc_adc_isr(void) } AO_DATA_PRESENT(AO_DATA_ADC); - if (ao_data_present == AO_DATA_ALL) { -#if HAS_MS5607 - ao_data_ring[ao_data_head].ms5607_raw = ao_ms5607_current; -#endif -#if HAS_MMA655X - ao_data_ring[ao_data_head].mma655x = ao_mma655x_current; -#endif -#if HAS_HMC5883 - ao_data_ring[ao_data_head].hmc5883 = ao_hmc5883_current; -#endif -#if HAS_MPU6000 - ao_data_ring[ao_data_head].mpu6000 = ao_mpu6000_current; -#endif - ao_data_ring[ao_data_head].tick = ao_tick_count; - ao_data_head = ao_data_ring_next(ao_data_head); - ao_wakeup((void *) &ao_data_head); - } + ao_data_fill(ao_data_head); ao_adc_ready = 1; } diff --git a/src/stm/ao_adc_stm.c b/src/stm/ao_adc_stm.c index 2399e6a2..ffdcccc0 100644 --- a/src/stm/ao_adc_stm.c +++ b/src/stm/ao_adc_stm.c @@ -45,26 +45,7 @@ static void ao_adc_done(int index) (void) index; AO_DATA_PRESENT(AO_DATA_ADC); ao_dma_done_transfer(STM_DMA_INDEX(STM_DMA_CHANNEL_ADC1)); - if (ao_data_present == AO_DATA_ALL) { -#if HAS_MS5607 - ao_data_ring[ao_data_head].ms5607_raw = ao_ms5607_current; -#endif -#if HAS_MMA655X - ao_data_ring[ao_data_head].mma655x = ao_mma655x_current; -#endif -#if HAS_HMC5883 - ao_data_ring[ao_data_head].hmc5883 = ao_hmc5883_current; -#endif -#if HAS_MPU6000 - ao_data_ring[ao_data_head].mpu6000 = ao_mpu6000_current; -#endif -#if HAS_MPU9250 - ao_data_ring[ao_data_head].mpu9250 = ao_mpu9250_current; -#endif - ao_data_ring[ao_data_head].tick = ao_tick_count; - ao_data_head = ao_data_ring_next(ao_data_head); - ao_wakeup((void *) &ao_data_head); - } + ao_data_fill(ao_data_head); ao_adc_ready = 1; } diff --git a/src/stmf0/ao_adc_stm.c b/src/stmf0/ao_adc_stm.c index e62bb16e..d48726a1 100644 --- a/src/stmf0/ao_adc_stm.c +++ b/src/stmf0/ao_adc_stm.c @@ -38,23 +38,7 @@ static void ao_adc_done(int index) AO_DATA_PRESENT(AO_DATA_ADC); ao_dma_done_transfer(STM_DMA_INDEX(STM_DMA_CHANNEL_ADC_1)); - if (ao_data_present == AO_DATA_ALL) { -#if HAS_MS5607 - ao_data_ring[ao_data_head].ms5607_raw = ao_ms5607_current; -#endif -#if HAS_MMA655X - ao_data_ring[ao_data_head].mma655x = ao_mma655x_current; -#endif -#if HAS_HMC5883 - ao_data_ring[ao_data_head].hmc5883 = ao_hmc5883_current; -#endif -#if HAS_MPU6000 - ao_data_ring[ao_data_head].mpu6000 = ao_mpu6000_current; -#endif - ao_data_ring[ao_data_head].tick = ao_tick_count; - ao_data_head = ao_data_ring_next(ao_data_head); - ao_wakeup((void *) &ao_data_head); - } + ao_data_fill(ao_data_head); ao_adc_ready = 1; } -- cgit v1.2.3 From dbc52686c6d9808275c35e0c9c987cbbd9f7859d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 13 Oct 2018 13:42:34 -0700 Subject: altos/stm: Make beeper driver support all possible tim234 configs And update all users to be explicit about the desired config. Signed-off-by: Keith Packard --- src/easymega-v1.0/ao_pins.h | 4 + src/easymega-v2.0/ao_pins.h | 4 + src/stm/ao_beep_stm.c | 166 +++++++++++++++++++------------------- src/stm/stm32l.h | 15 ++-- src/teleballoon-v2.0/ao_pins.h | 3 + src/telefireeight-v1.0/ao_pins.h | 4 + src/telefireone-v1.0/ao_pins.h | 1 + src/telefiretwo-v0.2/ao_pins.h | 1 + src/telelco-v0.2-cc1200/ao_pins.h | 4 + src/telelco-v0.2/ao_pins.h | 4 + src/telelco-v0.3/ao_pins.h | 4 + src/telelco-v2.0/ao_pins.h | 4 + src/telelcotwo-v0.1/ao_pins.h | 3 + src/telemega-v0.1/ao_pins.h | 4 + src/telemega-v1.0/ao_pins.h | 4 + src/telemega-v2.0/ao_pins.h | 4 + src/telemega-v3.0/ao_pins.h | 4 + src/telemetrum-v2.0/ao_pins.h | 3 + src/telemetrum-v3.0/ao_pins.h | 3 + src/telemini-v3.0/ao_pins.h | 4 +- 20 files changed, 150 insertions(+), 93 deletions(-) diff --git a/src/easymega-v1.0/ao_pins.h b/src/easymega-v1.0/ao_pins.h index e7382e4b..bfa777c6 100644 --- a/src/easymega-v1.0/ao_pins.h +++ b/src/easymega-v1.0/ao_pins.h @@ -77,6 +77,10 @@ #define USE_STORAGE_CONFIG 0 #define HAS_USB 1 #define HAS_BEEP 1 +#define BEEPER_TIMER 3 +#define BEEPER_CHANNEL 1 +#define BEEPER_PORT (&stm_gpioc) +#define BEEPER_PIN 6 #define HAS_BATTERY_REPORT 1 #define HAS_RADIO 0 #define HAS_TELEMETRY 0 diff --git a/src/easymega-v2.0/ao_pins.h b/src/easymega-v2.0/ao_pins.h index aff06cdd..508c043c 100644 --- a/src/easymega-v2.0/ao_pins.h +++ b/src/easymega-v2.0/ao_pins.h @@ -77,6 +77,10 @@ #define USE_STORAGE_CONFIG 0 #define HAS_USB 1 #define HAS_BEEP 1 +#define BEEPER_TIMER 2 +#define BEEPER_CHANNEL 3 +#define BEEPER_PORT (&stm_gpioa) +#define BEEPER_PIN 2 #define HAS_BATTERY_REPORT 1 #define HAS_RADIO 0 #define HAS_TELEMETRY 0 diff --git a/src/stm/ao_beep_stm.c b/src/stm/ao_beep_stm.c index f9fa14c2..2746d7f8 100644 --- a/src/stm/ao_beep_stm.c +++ b/src/stm/ao_beep_stm.c @@ -18,37 +18,59 @@ #include "ao.h" -#ifndef BEEPER_CHANNEL -#define BEEPER_CHANNEL 1 +#if BEEPER_TIMER == 2 +#define stm_beeper stm_tim2 +#define RCC_BEEPER STM_RCC_APB1ENR_TIM2EN +#define BEEPER_AFR STM_AFR_AF1 +#elif BEEPER_TIMER == 3 +#define stm_beeper stm_tim3 +#define RCC_BEEPER STM_RCC_APB1ENR_TIM3EN +#define BEEPER_AFR STM_AFR_AF2 +#elif BEEPER_TIMER == 4 +#define stm_beeper stm_tim4 +#define RCC_BEEPER STM_RCC_APB1ENR_TIM4EN +#define BEEPER_AFR STM_AFR_AF2 +#else +#error BEEPER_TIMER must be 2, 3 or 4 #endif void ao_beep(uint8_t beep) { if (beep == 0) { - stm_tim3.cr1 = 0; - stm_rcc.apb1enr &= ~(1 << STM_RCC_APB1ENR_TIM3EN); + stm_beeper.cr1 = 0; + stm_rcc.apb1enr &= ~(1 << RCC_BEEPER); } else { - stm_rcc.apb1enr |= (1 << STM_RCC_APB1ENR_TIM3EN); + stm_rcc.apb1enr |= (1 << RCC_BEEPER); - stm_tim3.cr2 = ((0 << STM_TIM234_CR2_TI1S) | + stm_beeper.cr2 = ((0 << STM_TIM234_CR2_TI1S) | (STM_TIM234_CR2_MMS_RESET << STM_TIM234_CR2_MMS) | (0 << STM_TIM234_CR2_CCDS)); /* Set prescaler to match cc1111 clocks */ - stm_tim3.psc = AO_TIM23467_CLK / 750000; + stm_beeper.psc = AO_TIM23467_CLK / 750000; /* 1. Select the counter clock (internal, external, prescaler). * * Setting SMCR to zero means use the internal clock */ - stm_tim3.smcr = 0; + stm_beeper.smcr = 0; /* 2. Write the desired data in the TIMx_ARR and TIMx_CCRx registers. */ - stm_tim3.arr = beep; - stm_tim3.ccr1 = beep; + stm_beeper.arr = beep; +#if BEEPER_CHANNEL == 1 + stm_beeper.ccr1 = beep; +#elif BEEPER_CHANNEL == 2 + stm_beeper.ccr2 = beep; +#elif BEEPER_CHANNEL == 3 + stm_beeper.ccr3 = beep; +#elif BEEPER_CHANNEL == 4 + stm_beeper.ccr4 = beep; +#else +#error invalid BEEPER_CHANNEL +#endif /* 3. Set the CCxIE and/or CCxDE bits if an interrupt and/or a * DMA request is to be generated. @@ -61,63 +83,56 @@ ao_beep(uint8_t beep) * is enabled and active high. */ -#if BEEPER_CHANNEL == 1 - stm_tim3.ccmr1 = ((0 << STM_TIM234_CCMR1_OC2CE) | - (STM_TIM234_CCMR1_OC2M_FROZEN << STM_TIM234_CCMR1_OC2M) | - (0 << STM_TIM234_CCMR1_OC2PE) | - (0 << STM_TIM234_CCMR1_OC2FE) | - (STM_TIM234_CCMR1_CC2S_OUTPUT << STM_TIM234_CCMR1_CC2S) | - - (0 << STM_TIM234_CCMR1_OC1CE) | - (STM_TIM234_CCMR1_OC1M_TOGGLE << STM_TIM234_CCMR1_OC1M) | - (0 << STM_TIM234_CCMR1_OC1PE) | - (0 << STM_TIM234_CCMR1_OC1FE) | - (STM_TIM234_CCMR1_CC1S_OUTPUT << STM_TIM234_CCMR1_CC1S)); - - stm_tim3.ccer = ((0 << STM_TIM234_CCER_CC4NP) | - (0 << STM_TIM234_CCER_CC4P) | - (0 << STM_TIM234_CCER_CC4E) | - (0 << STM_TIM234_CCER_CC3NP) | - (0 << STM_TIM234_CCER_CC3P) | - (0 << STM_TIM234_CCER_CC3E) | - (0 << STM_TIM234_CCER_CC2NP) | - (0 << STM_TIM234_CCER_CC2P) | - (0 << STM_TIM234_CCER_CC2E) | - (0 << STM_TIM234_CCER_CC1NP) | - (0 << STM_TIM234_CCER_CC1P) | - (1 << STM_TIM234_CCER_CC1E)); +#define OC1M (BEEPER_CHANNEL == 1 ? STM_TIM234_CCMR1_OC1M_TOGGLE : STM_TIM234_CCMR1_OC1M_FROZEN) +#define OC2M (BEEPER_CHANNEL == 2 ? STM_TIM234_CCMR1_OC2M_TOGGLE : STM_TIM234_CCMR1_OC2M_FROZEN) +#define OC3M (BEEPER_CHANNEL == 3 ? STM_TIM234_CCMR2_OC3M_TOGGLE : STM_TIM234_CCMR2_OC3M_FROZEN) +#define OC4M (BEEPER_CHANNEL == 4 ? STM_TIM234_CCMR2_OC4M_TOGGLE : STM_TIM234_CCMR2_OC4M_FROZEN) + +#define CCER(n) (BEEPER_CHANNEL == (n) ? 1 : 0) + +#if BEEPER_CHANNEL == 1 || BEEPER_CHANNEL == 2 + stm_beeper.ccmr1 = ((0 << STM_TIM234_CCMR1_OC2CE) | + (OC2M << STM_TIM234_CCMR1_OC2M) | + (0 << STM_TIM234_CCMR1_OC2PE) | + (0 << STM_TIM234_CCMR1_OC2FE) | + (STM_TIM234_CCMR1_CC2S_OUTPUT << STM_TIM234_CCMR1_CC2S) | + + (0 << STM_TIM234_CCMR1_OC1CE) | + (OC1M << STM_TIM234_CCMR1_OC1M) | + (0 << STM_TIM234_CCMR1_OC1PE) | + (0 << STM_TIM234_CCMR1_OC1FE) | + (STM_TIM234_CCMR1_CC1S_OUTPUT << STM_TIM234_CCMR1_CC1S)); +#elif BEEPER_CHANNEL == 3 || BEEPER_CHANNEL == 4 + stm_beeper.ccmr2 = ((0 << STM_TIM234_CCMR2_OC4CE) | + (OC4M << STM_TIM234_CCMR2_OC4M) | + (0 << STM_TIM234_CCMR2_OC4PE) | + (0 << STM_TIM234_CCMR2_OC4FE) | + (STM_TIM234_CCMR2_CC4S_OUTPUT << STM_TIM234_CCMR2_CC4S) | + + (0 << STM_TIM234_CCMR2_OC3CE) | + (OC3M << STM_TIM234_CCMR2_OC3M) | + (0 << STM_TIM234_CCMR2_OC3PE) | + (0 << STM_TIM234_CCMR2_OC3FE) | + (STM_TIM234_CCMR2_CC3S_OUTPUT << STM_TIM234_CCMR2_CC3S)); +#else +#error invalid BEEPER_CHANNEL #endif -#if BEEPER_CHANNEL == 4 - stm_tim3.ccmr2 = ((0 << STM_TIM234_CCMR2_OC4CE) | - (STM_TIM234_CCMR2_OC4M_TOGGLE << STM_TIM234_CCMR2_OC4M) | - (0 << STM_TIM234_CCMR2_OC4PE) | - (0 << STM_TIM234_CCMR2_OC4FE) | - (STM_TIM234_CCMR2_CC4S_OUTPUT << STM_TIM234_CCMR2_CC4S) | - - (0 << STM_TIM234_CCMR2_OC3CE) | - (STM_TIM234_CCMR2_OC3M_FROZEN << STM_TIM234_CCMR2_OC3M) | - (0 << STM_TIM234_CCMR2_OC3PE) | - (0 << STM_TIM234_CCMR2_OC3FE) | - (STM_TIM234_CCMR2_CC3S_OUTPUT << STM_TIM234_CCMR2_CC3S)); - - stm_tim3.ccer = ((0 << STM_TIM234_CCER_CC4NP) | - (0 << STM_TIM234_CCER_CC4P) | - (1 << STM_TIM234_CCER_CC4E) | - (0 << STM_TIM234_CCER_CC3NP) | - (0 << STM_TIM234_CCER_CC3P) | - (0 << STM_TIM234_CCER_CC3E) | - (0 << STM_TIM234_CCER_CC2NP) | - (0 << STM_TIM234_CCER_CC2P) | - (0 << STM_TIM234_CCER_CC2E) | - (0 << STM_TIM234_CCER_CC1NP) | - (0 << STM_TIM234_CCER_CC1P) | - (0 << STM_TIM234_CCER_CC1E)); -#endif - + stm_beeper.ccer = ((0 << STM_TIM234_CCER_CC4NP) | + (0 << STM_TIM234_CCER_CC4P) | + (CCER(4) << STM_TIM234_CCER_CC4E) | + (0 << STM_TIM234_CCER_CC3NP) | + (0 << STM_TIM234_CCER_CC3P) | + (CCER(3) << STM_TIM234_CCER_CC3E) | + (0 << STM_TIM234_CCER_CC2NP) | + (0 << STM_TIM234_CCER_CC2P) | + (CCER(2) << STM_TIM234_CCER_CC2E) | + (0 << STM_TIM234_CCER_CC1NP) | + (0 << STM_TIM234_CCER_CC1P) | + (CCER(1) << STM_TIM234_CCER_CC1E)); /* 5. Enable the counter by setting the CEN bit in the TIMx_CR1 register. */ - stm_tim3.cr1 = ((STM_TIM234_CR1_CKD_1 << STM_TIM234_CR1_CKD) | + stm_beeper.cr1 = ((STM_TIM234_CR1_CKD_1 << STM_TIM234_CR1_CKD) | (0 << STM_TIM234_CR1_ARPE) | (STM_TIM234_CR1_CMS_EDGE << STM_TIM234_CR1_CMS) | (0 << STM_TIM234_CR1_DIR) | @@ -127,12 +142,12 @@ ao_beep(uint8_t beep) (1 << STM_TIM234_CR1_CEN)); /* Update the values */ - stm_tim3.egr = (1 << STM_TIM234_EGR_UG); + stm_beeper.egr = (1 << STM_TIM234_EGR_UG); } } void -ao_beep_for(uint8_t beep, uint16_t ticks) +ao_beep_for(uint8_t beep, uint16_t ticks) { ao_beep(beep); ao_delay(ticks); @@ -142,24 +157,9 @@ ao_beep_for(uint8_t beep, uint16_t ticks) void ao_beep_init(void) { -#if BEEPER_CHANNEL == 1 - - /* Our beeper is on PC6, which is hooked to TIM3_CH1. - */ - stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIOCEN); - - stm_afr_set(&stm_gpioc, 6, STM_AFR_AF2); -#endif -#if BEEPER_CHANNEL == 4 - - /* Our beeper is on PB1, which is hooked to TIM3_CH4. - */ - stm_rcc.ahbenr |= (1 << STM_RCC_AHBENR_GPIOBEN); - - stm_afr_set(&stm_gpiob, 1, STM_AFR_AF2); -#endif + ao_enable_port(BEEPER_PORT); + stm_afr_set(BEEPER_PORT, BEEPER_PIN, BEEPER_AFR); /* Leave the timer off until requested */ - - stm_rcc.apb1enr &= ~(1 << STM_RCC_APB1ENR_TIM3EN); + stm_rcc.apb1enr &= ~(1 << RCC_BEEPER); } diff --git a/src/stm/stm32l.h b/src/stm/stm32l.h index 1da817e7..0109ec81 100644 --- a/src/stm/stm32l.h +++ b/src/stm/stm32l.h @@ -241,15 +241,14 @@ stm_gpio_get_all(struct stm_gpio *gpio) { * ao_enable_gpio macro will expand into a huge pile of code * as the compiler won't do correct constant folding and * dead-code elimination + */ - extern struct stm_gpio stm_gpioa; - extern struct stm_gpio stm_gpiob; - extern struct stm_gpio stm_gpioc; - extern struct stm_gpio stm_gpiod; - extern struct stm_gpio stm_gpioe; - extern struct stm_gpio stm_gpioh; - -*/ +extern struct stm_gpio stm_gpioa; +extern struct stm_gpio stm_gpiob; +extern struct stm_gpio stm_gpioc; +extern struct stm_gpio stm_gpiod; +extern struct stm_gpio stm_gpioe; +extern struct stm_gpio stm_gpioh; #define stm_gpioh (*((struct stm_gpio *) 0x40021400)) #define stm_gpioe (*((struct stm_gpio *) 0x40021000)) diff --git a/src/teleballoon-v2.0/ao_pins.h b/src/teleballoon-v2.0/ao_pins.h index 4f27bad6..cb0ec838 100644 --- a/src/teleballoon-v2.0/ao_pins.h +++ b/src/teleballoon-v2.0/ao_pins.h @@ -74,6 +74,9 @@ #define HAS_BEEP 1 #define HAS_BATTERY_REPORT 1 #define BEEPER_CHANNEL 4 +#define BEEPER_TIMER 3 +#define BEEPER_PORT (&stm_gpiob) +#define BEEPER_PIN 1 #define HAS_RADIO 1 #define HAS_TELEMETRY 1 #define HAS_APRS 1 diff --git a/src/telefireeight-v1.0/ao_pins.h b/src/telefireeight-v1.0/ao_pins.h index ef533b36..c15e06bf 100644 --- a/src/telefireeight-v1.0/ao_pins.h +++ b/src/telefireeight-v1.0/ao_pins.h @@ -25,6 +25,10 @@ #define HAS_FLIGHT 0 #define HAS_USB 1 #define HAS_BEEP 0 +#define BEEPER_TIMER 3 +#define BEEPER_CHANNEL 1 +#define BEEPER_PORT (&stm_gpioc) +#define BEEPER_PIN 6 #define HAS_GPS 0 #define HAS_SERIAL_1 0 #define HAS_ADC 1 diff --git a/src/telefireone-v1.0/ao_pins.h b/src/telefireone-v1.0/ao_pins.h index d36d9d82..15b158ef 100644 --- a/src/telefireone-v1.0/ao_pins.h +++ b/src/telefireone-v1.0/ao_pins.h @@ -27,6 +27,7 @@ #define HAS_USB 1 #define HAS_BEEP 1 #define BEEPER_CHANNEL 4 +#define BEEPER_TIMER 3 #define HAS_GPS 0 #define HAS_SERIAL_1 0 #define HAS_ADC 1 diff --git a/src/telefiretwo-v0.2/ao_pins.h b/src/telefiretwo-v0.2/ao_pins.h index 469e9937..01faace2 100644 --- a/src/telefiretwo-v0.2/ao_pins.h +++ b/src/telefiretwo-v0.2/ao_pins.h @@ -27,6 +27,7 @@ #define HAS_USB 1 #define HAS_BEEP 1 #define BEEPER_CHANNEL 4 +#define BEEPER_TIMER 3 #define HAS_GPS 0 #define HAS_SERIAL_1 0 #define HAS_ADC 1 diff --git a/src/telelco-v0.2-cc1200/ao_pins.h b/src/telelco-v0.2-cc1200/ao_pins.h index bc325e06..f3850ebd 100644 --- a/src/telelco-v0.2-cc1200/ao_pins.h +++ b/src/telelco-v0.2-cc1200/ao_pins.h @@ -50,6 +50,10 @@ #define USE_STORAGE_CONFIG 0 #define HAS_USB 1 #define HAS_BEEP 1 +#define BEEPER_TIMER 3 +#define BEEPER_CHANNEL 1 +#define BEEPER_PORT (&stm_gpioc) +#define BEEPER_PIN 6 #define HAS_RADIO 1 #define HAS_RADIO_RATE 1 #define HAS_TELEMETRY 0 diff --git a/src/telelco-v0.2/ao_pins.h b/src/telelco-v0.2/ao_pins.h index f0da4fe4..3d06a647 100644 --- a/src/telelco-v0.2/ao_pins.h +++ b/src/telelco-v0.2/ao_pins.h @@ -48,6 +48,10 @@ #define USE_STORAGE_CONFIG 0 #define HAS_USB 1 #define HAS_BEEP 1 +#define BEEPER_TIMER 3 +#define BEEPER_CHANNEL 1 +#define BEEPER_PORT (&stm_gpioc) +#define BEEPER_PIN 6 #define HAS_RADIO 1 #define HAS_RADIO_RATE 1 #define HAS_TELEMETRY 0 diff --git a/src/telelco-v0.3/ao_pins.h b/src/telelco-v0.3/ao_pins.h index 6023739c..c806268f 100644 --- a/src/telelco-v0.3/ao_pins.h +++ b/src/telelco-v0.3/ao_pins.h @@ -50,6 +50,10 @@ #define USE_STORAGE_CONFIG 0 #define HAS_USB 1 #define HAS_BEEP 1 +#define BEEPER_TIMER 3 +#define BEEPER_CHANNEL 1 +#define BEEPER_PORT (&stm_gpioc) +#define BEEPER_PIN 6 #define HAS_RADIO 1 #define HAS_RADIO_RATE 1 #define HAS_TELEMETRY 0 diff --git a/src/telelco-v2.0/ao_pins.h b/src/telelco-v2.0/ao_pins.h index ea709c1d..e0663314 100644 --- a/src/telelco-v2.0/ao_pins.h +++ b/src/telelco-v2.0/ao_pins.h @@ -50,6 +50,10 @@ #define USE_STORAGE_CONFIG 0 #define HAS_USB 1 #define HAS_BEEP 1 +#define BEEPER_TIMER 3 +#define BEEPER_CHANNEL 1 +#define BEEPER_PORT (&stm_gpioc) +#define BEEPER_PIN 6 #define HAS_RADIO 1 #define HAS_RADIO_RATE 1 #define HAS_TELEMETRY 0 diff --git a/src/telelcotwo-v0.1/ao_pins.h b/src/telelcotwo-v0.1/ao_pins.h index 1941e03d..3ef88c74 100644 --- a/src/telelcotwo-v0.1/ao_pins.h +++ b/src/telelcotwo-v0.1/ao_pins.h @@ -51,6 +51,9 @@ #define HAS_USB 1 #define HAS_BEEP 1 #define BEEPER_CHANNEL 4 +#define BEEPER_TIMER 3 +#define BEEPER_PORT (&stm_gpiob) +#define BEEPER_PIN 1 #define HAS_RADIO 1 #define HAS_RADIO_RATE 1 #define HAS_TELEMETRY 0 diff --git a/src/telemega-v0.1/ao_pins.h b/src/telemega-v0.1/ao_pins.h index 64535c30..0208fafa 100644 --- a/src/telemega-v0.1/ao_pins.h +++ b/src/telemega-v0.1/ao_pins.h @@ -77,6 +77,10 @@ #define USE_STORAGE_CONFIG 0 #define HAS_USB 1 #define HAS_BEEP 1 +#define BEEPER_TIMER 3 +#define BEEPER_CHANNEL 1 +#define BEEPER_PORT (&stm_gpioc) +#define BEEPER_PIN 6 #define HAS_BATTERY_REPORT 1 #define HAS_RADIO 1 #define HAS_TELEMETRY 1 diff --git a/src/telemega-v1.0/ao_pins.h b/src/telemega-v1.0/ao_pins.h index 354da6a4..a154225e 100644 --- a/src/telemega-v1.0/ao_pins.h +++ b/src/telemega-v1.0/ao_pins.h @@ -77,6 +77,10 @@ #define USE_STORAGE_CONFIG 0 #define HAS_USB 1 #define HAS_BEEP 1 +#define BEEPER_TIMER 3 +#define BEEPER_CHANNEL 1 +#define BEEPER_PORT (&stm_gpioc) +#define BEEPER_PIN 6 #define HAS_BATTERY_REPORT 1 #define HAS_RADIO 1 #define HAS_TELEMETRY 1 diff --git a/src/telemega-v2.0/ao_pins.h b/src/telemega-v2.0/ao_pins.h index 46207884..ba302c74 100644 --- a/src/telemega-v2.0/ao_pins.h +++ b/src/telemega-v2.0/ao_pins.h @@ -77,6 +77,10 @@ #define USE_STORAGE_CONFIG 0 #define HAS_USB 1 #define HAS_BEEP 1 +#define BEEPER_TIMER 3 +#define BEEPER_CHANNEL 1 +#define BEEPER_PORT (&stm_gpioc) +#define BEEPER_PIN 6 #define HAS_BATTERY_REPORT 1 #define HAS_RADIO 1 #define HAS_TELEMETRY 1 diff --git a/src/telemega-v3.0/ao_pins.h b/src/telemega-v3.0/ao_pins.h index ddcd0eb9..ce223907 100644 --- a/src/telemega-v3.0/ao_pins.h +++ b/src/telemega-v3.0/ao_pins.h @@ -77,6 +77,10 @@ #define USE_STORAGE_CONFIG 0 #define HAS_USB 1 #define HAS_BEEP 1 +#define BEEPER_TIMER 3 +#define BEEPER_CHANNEL 1 +#define BEEPER_PORT (&stm_gpioc) +#define BEEPER_PIN 6 #define HAS_BATTERY_REPORT 1 #define HAS_RADIO 1 #define HAS_TELEMETRY 1 diff --git a/src/telemetrum-v2.0/ao_pins.h b/src/telemetrum-v2.0/ao_pins.h index 47f6dd2a..e8c97ff4 100644 --- a/src/telemetrum-v2.0/ao_pins.h +++ b/src/telemetrum-v2.0/ao_pins.h @@ -74,6 +74,9 @@ #define HAS_BEEP 1 #define HAS_BATTERY_REPORT 1 #define BEEPER_CHANNEL 4 +#define BEEPER_TIMER 3 +#define BEEPER_PORT (&stm_gpiob) +#define BEEPER_PIN 1 #define HAS_RADIO 1 #define HAS_TELEMETRY 1 #define HAS_APRS 1 diff --git a/src/telemetrum-v3.0/ao_pins.h b/src/telemetrum-v3.0/ao_pins.h index a8043bba..f4ccc9f3 100644 --- a/src/telemetrum-v3.0/ao_pins.h +++ b/src/telemetrum-v3.0/ao_pins.h @@ -74,6 +74,9 @@ #define HAS_BEEP 1 #define HAS_BATTERY_REPORT 1 #define BEEPER_CHANNEL 4 +#define BEEPER_TIMER 3 +#define BEEPER_PORT (&stm_gpiob) +#define BEEPER_PIN 1 #define HAS_RADIO 1 #define HAS_TELEMETRY 1 #define HAS_APRS 1 diff --git a/src/telemini-v3.0/ao_pins.h b/src/telemini-v3.0/ao_pins.h index 546d91e0..d91b1d21 100644 --- a/src/telemini-v3.0/ao_pins.h +++ b/src/telemini-v3.0/ao_pins.h @@ -74,9 +74,9 @@ #define AO_RECOVERY_VALUE 0 #define AO_RECOVERY_MODE AO_EXTI_MODE_PULL_UP -/* Beeper is on Tim1 CH3 */ +/* Beeper is on Tim3 CH4 */ #define BEEPER_CHANNEL 4 -#define BEEPER_TIMER 2 +#define BEEPER_TIMER 3 #define BEEPER_PORT (&stm_gpioa) #define BEEPER_PIN 3 -- cgit v1.2.3 From 33bb97b9637bdabe4360269889e20fcc50ef9886 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 15 Oct 2018 11:15:31 -0700 Subject: altos/stm: Support SPI modes other than 0 ADXL375 requires SPI mode 3. Signed-off-by: Keith Packard --- src/stm/ao_arch_funcs.h | 12 ++++++++++++ src/stm/ao_spi_stm.c | 31 +++++++++++++++++-------------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/stm/ao_arch_funcs.h b/src/stm/ao_arch_funcs.h index 9bb598f6..7fe6a732 100644 --- a/src/stm/ao_arch_funcs.h +++ b/src/stm/ao_arch_funcs.h @@ -39,6 +39,9 @@ #define AO_SPI_SPEED_200kHz AO_SPI_SPEED_125kHz +#define AO_SPI_CPOL_BIT 4 +#define AO_SPI_CPHA_BIT 5 + #define AO_SPI_CONFIG_1 0x00 #define AO_SPI_1_CONFIG_PA5_PA6_PA7 AO_SPI_CONFIG_1 #define AO_SPI_2_CONFIG_PB13_PB14_PB15 AO_SPI_CONFIG_1 @@ -64,6 +67,15 @@ #define AO_SPI_INDEX(id) ((id) & AO_SPI_INDEX_MASK) #define AO_SPI_CONFIG(id) ((id) & AO_SPI_CONFIG_MASK) +#define AO_SPI_PIN_CONFIG(id) ((id) & (AO_SPI_INDEX_MASK | AO_SPI_CONFIG_MASK)) +#define AO_SPI_CPOL(id) ((uint32_t) (((id) >> AO_SPI_CPOL_BIT) & 1)) +#define AO_SPI_CPHA(id) ((uint32_t) (((id) >> AO_SPI_CPHA_BIT) & 1)) + +#define AO_SPI_MAKE_MODE(pol,pha) (((pol) << AO_SPI_CPOL_BIT) | ((pha) << AO_SPI_CPHA_BIT)) +#define AO_SPI_MODE_0 AO_SPI_MAKE_MODE(0,0) +#define AO_SPI_MODE_1 AO_SPI_MAKE_MODE(0,1) +#define AO_SPI_MODE_2 AO_SPI_MAKE_MODE(1,0) +#define AO_SPI_MODE_3 AO_SPI_MAKE_MODE(1,1) uint8_t ao_spi_try_get(uint8_t spi_index, uint32_t speed, uint8_t task_id); diff --git a/src/stm/ao_spi_stm.c b/src/stm/ao_spi_stm.c index 05078f3b..1a04a289 100644 --- a/src/stm/ao_spi_stm.c +++ b/src/stm/ao_spi_stm.c @@ -25,7 +25,7 @@ struct ao_spi_stm_info { }; static uint8_t ao_spi_mutex[STM_NUM_SPI]; -static uint8_t ao_spi_index[STM_NUM_SPI]; +static uint8_t ao_spi_pin_config[STM_NUM_SPI]; static const struct ao_spi_stm_info ao_spi_stm_info[STM_NUM_SPI] = { { @@ -285,11 +285,11 @@ ao_spi_duplex(const void *out, void *in, uint16_t len, uint8_t spi_index) } static void -ao_spi_disable_index(uint8_t spi_index) +ao_spi_disable_pin_config(uint8_t spi_pin_config) { /* Disable current config */ - switch (spi_index) { + switch (spi_pin_config) { case AO_SPI_1_PA5_PA6_PA7: stm_gpio_set(&stm_gpioa, 5, 1); stm_moder_set(&stm_gpioa, 5, STM_MODER_OUTPUT); @@ -324,11 +324,11 @@ ao_spi_disable_index(uint8_t spi_index) } static void -ao_spi_enable_index(uint8_t spi_index) +ao_spi_enable_pin_config(uint8_t spi_pin_config) { /* Enable new config */ - switch (spi_index) { + switch (spi_pin_config) { case AO_SPI_1_PA5_PA6_PA7: stm_afr_set(&stm_gpioa, 5, STM_AFR_AF5); stm_afr_set(&stm_gpioa, 6, STM_AFR_AF5); @@ -360,23 +360,26 @@ ao_spi_enable_index(uint8_t spi_index) static void ao_spi_config(uint8_t spi_index, uint32_t speed) { + uint8_t spi_pin_config = AO_SPI_PIN_CONFIG(spi_index); uint8_t id = AO_SPI_INDEX(spi_index); struct stm_spi *stm_spi = ao_spi_stm_info[id].stm_spi; - if (spi_index != ao_spi_index[id]) { + if (spi_pin_config != ao_spi_pin_config[id]) { /* Disable old config */ - ao_spi_disable_index(ao_spi_index[id]); + ao_spi_disable_pin_config(ao_spi_pin_config[id]); /* Enable new config */ - ao_spi_enable_index(spi_index); + ao_spi_enable_pin_config(spi_pin_config); /* Remember current config */ - ao_spi_index[id] = spi_index; + ao_spi_pin_config[id] = spi_pin_config; } + + /* Turn the SPI transceiver on and set the mode */ stm_spi->cr1 = ((0 << STM_SPI_CR1_BIDIMODE) | /* Three wire mode */ (0 << STM_SPI_CR1_BIDIOE) | (0 << STM_SPI_CR1_CRCEN) | /* CRC disabled */ @@ -389,8 +392,8 @@ ao_spi_config(uint8_t spi_index, uint32_t speed) (1 << STM_SPI_CR1_SPE) | /* Enable SPI unit */ (speed << STM_SPI_CR1_BR) | /* baud rate to pclk/4 */ (1 << STM_SPI_CR1_MSTR) | - (0 << STM_SPI_CR1_CPOL) | /* Format 0 */ - (0 << STM_SPI_CR1_CPHA)); + (AO_SPI_CPOL(spi_index) << STM_SPI_CR1_CPOL) | /* Format */ + (AO_SPI_CPHA(spi_index) << STM_SPI_CR1_CPHA)); validate_spi(stm_spi, 13, 0); } @@ -430,7 +433,7 @@ ao_spi_channel_init(uint8_t spi_index) uint8_t id = AO_SPI_INDEX(spi_index); struct stm_spi *stm_spi = ao_spi_stm_info[id].stm_spi; - ao_spi_disable_index(spi_index); + ao_spi_disable_pin_config(AO_SPI_PIN_CONFIG(spi_index)); stm_spi->cr1 = 0; stm_spi->cr2 = ((0 << STM_SPI_CR2_TXEIE) | @@ -512,7 +515,7 @@ ao_spi_init(void) stm_ospeedr_set(&stm_gpioe, 15, SPI_1_OSPEEDR); # endif stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_SPI1EN); - ao_spi_index[0] = AO_SPI_CONFIG_NONE; + ao_spi_pin_config[0] = AO_SPI_CONFIG_NONE; ao_spi_channel_init(0); #endif @@ -530,7 +533,7 @@ ao_spi_init(void) stm_ospeedr_set(&stm_gpiod, 4, SPI_2_OSPEEDR); # endif stm_rcc.apb1enr |= (1 << STM_RCC_APB1ENR_SPI2EN); - ao_spi_index[1] = AO_SPI_CONFIG_NONE; + ao_spi_pin_config[1] = AO_SPI_CONFIG_NONE; ao_spi_channel_init(1); #endif #if DEBUG -- cgit v1.2.3 From 30e4e286eec31e69ad1e69a44cf00d4549a09f88 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 13 Oct 2018 09:41:31 -0700 Subject: altos: Add ADXL375 driver [v2] Includes self-test code and multi-byte mode operation for reading sample registers. Signed-off-by: Keith Packard --- src/drivers/ao_adxl375.c | 263 +++++++++++++++++++++++++++++++++++++++++++++++ src/drivers/ao_adxl375.h | 107 +++++++++++++++++++ src/kernel/ao_data.h | 36 ++++++- 3 files changed, 405 insertions(+), 1 deletion(-) create mode 100644 src/drivers/ao_adxl375.c create mode 100644 src/drivers/ao_adxl375.h diff --git a/src/drivers/ao_adxl375.c b/src/drivers/ao_adxl375.c new file mode 100644 index 00000000..e0d094f2 --- /dev/null +++ b/src/drivers/ao_adxl375.c @@ -0,0 +1,263 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#include +#include "ao_adxl375.h" + +#define DEBUG_LOW 1 +#define DEBUG_HIGH 2 + +#define DEBUG 0 + +#if DEBUG +#define PRINTD(l, ...) do { if (DEBUG & (l)) { printf ("\r%5u %s: ", ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } } while(0) +#else +#define PRINTD(l,...) +#endif + +struct ao_adxl375_sample ao_adxl375_current; + +static void +ao_adxl375_start(void) { + ao_spi_get_bit(AO_ADXL375_CS_PORT, + AO_ADXL375_CS_PIN, + AO_ADXL375_SPI_INDEX, + AO_ADXL375_SPI_SPEED); +} + +static void +ao_adxl375_stop(void) { + ao_spi_put_bit(AO_ADXL375_CS_PORT, + AO_ADXL375_CS_PIN, + AO_ADXL375_SPI_INDEX); +} + +static uint8_t +ao_adxl375_reg_read(uint8_t addr) +{ + uint8_t d[2]; + + d[0] = addr | AO_ADXL375_READ; + ao_adxl375_start(); + ao_spi_duplex(d, d, 2, AO_ADXL375_SPI_INDEX); + ao_adxl375_stop(); + + PRINTD(DEBUG_LOW, "read %x = %x\n", addr, d); + + return d[1]; +} + +static void +ao_adxl375_reg_write(uint8_t addr, uint8_t value) +{ + uint8_t d[2]; + + PRINTD(DEBUG_LOW, "write %x %x\n", addr, value); + d[0] = addr; + d[1] = value; + ao_adxl375_start(); + ao_spi_send(d, 2, AO_ADXL375_SPI_INDEX); + ao_adxl375_stop(); + +#if DEBUG & DEBUG_LOW + d[0] = addr | AO_ADXL375_READ + d[1] = 0; + ao_adxl375_start(); + ao_spi_duplex(d, d, 2, AO_ADXL375_SPI_INDEX); + ao_adxl375_stop(); + PRINTD(DEBUG_LOW, "readback %x %x\n", d[0], d[1]); +#endif +} + +static void +ao_adxl375_value(struct ao_adxl375_sample *value) +{ + uint8_t d[7]; + + d[0] = AO_ADXL375_DATAX0 | AO_ADXL375_READ | AO_ADXL375_MULTI_BYTE; + ao_adxl375_start(); + ao_spi_duplex(d, d, 7, AO_ADXL375_SPI_INDEX); + ao_adxl375_stop(); + memcpy(value, &d[1], 6); +} + +struct ao_adxl375_total { + int32_t x; + int32_t y; + int32_t z; +}; + +#define AO_ADXL375_SELF_TEST_SAMPLES 16 +#define AO_ADXL375_SELF_TEST_SETTLE 6 + +#define MIN_LSB_G 18.4 +#define MAX_LSB_G 22.6 +#define SELF_TEST_MIN_G 6.0 +#define SELF_TEST_MAX_G 6.8 + +#define MIN_SELF_TEST ((int32_t) (MIN_LSB_G * SELF_TEST_MIN_G * AO_ADXL375_SELF_TEST_SAMPLES + 0.5)) +#define MAX_SELF_TEST ((int32_t) (MAX_LSB_G * SELF_TEST_MAX_G * AO_ADXL375_SELF_TEST_SAMPLES + 0.5)) + +static const int32_t min_self_test = MIN_SELF_TEST; +static const int32_t max_self_test = MAX_SELF_TEST; + +static void +ao_adxl375_total_value(struct ao_adxl375_total *total, int samples) +{ + struct ao_adxl375_sample value; + + *total = (struct ao_adxl375_total) { 0, 0, 0 }; + for (int i = 0; i < samples; i++) { + ao_adxl375_value(&value); + total->x += value.x; + total->y += value.y; + total->z += value.z; + ao_delay(AO_MS_TO_TICKS(10)); + } +} + +#define AO_ADXL375_DATA_FORMAT_SETTINGS(self_test) ( \ + AO_ADXL375_DATA_FORMAT_FIXED | \ + (self_test << AO_ADXL375_DATA_FORMAT_SELF_TEST) | \ + (AO_ADXL375_DATA_FORMAT_SPI_4_WIRE << AO_ADXL375_DATA_FORMAT_SPI_4_WIRE) | \ + (0 << AO_ADXL375_DATA_FORMAT_INT_INVERT) | \ + (0 << AO_ADXL375_DATA_FORMAT_JUSTIFY)) + +static int32_t self_test_value; + +static void +ao_adxl375_setup(void) +{ + /* Get the device into 4-wire SPI mode before proceeding */ + ao_adxl375_reg_write(AO_ADXL375_DATA_FORMAT, + AO_ADXL375_DATA_FORMAT_SETTINGS(0)); + + + uint8_t devid = ao_adxl375_reg_read(AO_ADXL375_DEVID); + if (devid != AO_ADXL375_DEVID_ID) + ao_sensor_errors = 1; + + /* Set the data rate */ + ao_adxl375_reg_write(AO_ADXL375_BW_RATE, + (0 << AO_ADXL375_BW_RATE_LOW_POWER) | + (AO_ADXL375_BW_RATE_RATE_200 << AO_ADXL375_BW_RATE_RATE)); + + /* Set the offsets all to zero */ + ao_adxl375_reg_write(AO_ADXL375_OFSX, 0); + ao_adxl375_reg_write(AO_ADXL375_OFSY, 0); + ao_adxl375_reg_write(AO_ADXL375_OFSZ, 0); + + /* Clear interrupts */ + ao_adxl375_reg_write(AO_ADXL375_INT_ENABLE, 0); + + /* Configure FIFO (disable) */ + ao_adxl375_reg_write(AO_ADXL375_FIFO_CTL, + (AO_ADXL375_FIFO_CTL_FIFO_MODE_BYPASS << AO_ADXL375_FIFO_CTL_FIFO_MODE) | + (0 << AO_ADXL375_FIFO_CTL_TRIGGER) | + (0 << AO_ADXL375_FIFO_CTL_SAMPLES)); + + /* Place part in measurement mode */ + ao_adxl375_reg_write(AO_ADXL375_POWER_CTL, + (0 << AO_ADXL375_POWER_CTL_LINK) | + (0 << AO_ADXL375_POWER_CTL_AUTO_SLEEP) | + (1 << AO_ADXL375_POWER_CTL_MEASURE) | + (0 << AO_ADXL375_POWER_CTL_SLEEP) | + (AO_ADXL375_POWER_CTL_WAKEUP_8 << AO_ADXL375_POWER_CTL_WAKEUP)); + + (void) ao_adxl375_total_value; + /* Perform self-test */ + +#define AO_ADXL375_SELF_TEST_SAMPLES 16 +#define AO_ADXL375_SELF_TEST_SETTLE 6 + + struct ao_adxl375_total self_test_off, self_test_on; + + /* Discard some samples to let it settle down */ + ao_adxl375_total_value(&self_test_off, AO_ADXL375_SELF_TEST_SETTLE); + + /* Get regular values */ + ao_adxl375_total_value(&self_test_off, AO_ADXL375_SELF_TEST_SAMPLES); + + /* Turn on self test */ + ao_adxl375_reg_write(AO_ADXL375_DATA_FORMAT, + AO_ADXL375_DATA_FORMAT_SETTINGS(1)); + + /* Discard at least 4 samples to let the device settle */ + ao_adxl375_total_value(&self_test_on, AO_ADXL375_SELF_TEST_SETTLE); + + /* Read self test samples */ + ao_adxl375_total_value(&self_test_on, AO_ADXL375_SELF_TEST_SAMPLES); + + /* Reset back to normal mode */ + + ao_adxl375_reg_write(AO_ADXL375_DATA_FORMAT, + AO_ADXL375_DATA_FORMAT_SETTINGS(0)); + + /* Verify Z axis value is in range */ + + int32_t z_change = self_test_on.z - self_test_off.z; + + self_test_value = z_change; + + if (z_change < min_self_test || max_self_test < z_change) + ao_sensor_errors = 1; + + /* Discard some samples to let it settle down */ + ao_adxl375_total_value(&self_test_off, AO_ADXL375_SELF_TEST_SETTLE); +} + +static int adxl375_count; + +static void +ao_adxl375(void) +{ + ao_adxl375_setup(); + for (;;) { + ao_adxl375_value(&ao_adxl375_current); + ++adxl375_count; + ao_arch_critical( + AO_DATA_PRESENT(AO_DATA_ADXL375); + AO_DATA_WAIT(); + ); + } +} + +static struct ao_task ao_adxl375_task; + +static void +ao_adxl375_dump(void) +{ + printf ("ADXL375 value %d %d %d count %d self test %d min %d max %d\n", + ao_adxl375_current.x, + ao_adxl375_current.y, + ao_adxl375_current.z, + adxl375_count, + self_test_value, + MIN_SELF_TEST, + MAX_SELF_TEST); +} + +const struct ao_cmds ao_adxl375_cmds[] = { + { ao_adxl375_dump, "A\0Display ADXL375 data" }, + { 0, NULL }, +}; + +void +ao_adxl375_init(void) +{ + ao_cmd_register(ao_adxl375_cmds); + ao_spi_init_cs(AO_ADXL375_CS_PORT, (1 << AO_ADXL375_CS_PIN)); + + ao_add_task(&ao_adxl375_task, ao_adxl375, "adxl375"); +} diff --git a/src/drivers/ao_adxl375.h b/src/drivers/ao_adxl375.h new file mode 100644 index 00000000..a1ed216d --- /dev/null +++ b/src/drivers/ao_adxl375.h @@ -0,0 +1,107 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +#ifndef _AO_ADXL375_H_ +#define _AO_ADXL375_H_ + +#define AO_ADXL375_READ 0x80 /* read mode */ +#define AO_ADXL375_MULTI_BYTE 0x40 /* multi-byte mode */ + +#define AO_ADXL375_DEVID 0x00 +#define AO_ADXL375_DEVID_ID 0xe5 +#define AO_ADXL375_THRESH_SHOCK 0x1d +#define AO_ADXL375_OFSX 0x1e +#define AO_ADXL375_OFSY 0x1f +#define AO_ADXL375_OFSZ 0x20 +#define AO_ADXL375_DUR 0x21 +#define AO_ADXL375_LATENT 0x22 +#define AO_ADXL375_WINDOW 0x23 +#define AO_ADXL375_THRESH_ACT 0x24 +#define AO_ADXL375_THRESH_INACT 0x25 +#define AO_ADXL375_TIME_INACT 0x26 +#define AO_ADXL375_ACT_INACT_CTL 0x27 +#define AO_ADXL375_SHOCK_AXES 0x2a +#define AO_ADXL375_ACT_SHOCK_STATUS 0x2b +#define AO_ADXL375_BW_RATE 0x2c + +#define AO_ADXL375_BW_RATE_LOW_POWER 4 +#define AO_ADXL375_BW_RATE_RATE 0 +#define AO_ADXL375_BW_RATE_RATE_3200 0xf +#define AO_ADXL375_BW_RATE_RATE_1600 0xe +#define AO_ADXL375_BW_RATE_RATE_800 0xd +#define AO_ADXL375_BW_RATE_RATE_400 0xc +#define AO_ADXL375_BW_RATE_RATE_200 0xb +#define AO_ADXL375_BW_RATE_RATE_100 0xa +#define AO_ADXL375_BW_RATE_RATE_50 0x9 +#define AO_ADXL375_BW_RATE_RATE_25 0x8 +#define AO_ADXL375_BW_RATE_RATE_12_5 0x7 +#define AO_ADXL375_BW_RATE_RATE_6_25 0x6 +#define AO_ADXL375_BW_RATE_RATE_3_13 0x5 +#define AO_ADXL375_BW_RATE_RATE_1_56 0x4 +#define AO_ADXL375_BW_RATE_RATE_0_78 0x3 +#define AO_ADXL375_BW_RATE_RATE_0_39 0x2 +#define AO_ADXL375_BW_RATE_RATE_0_20 0x1 +#define AO_ADXL375_BW_RATE_RATE_0_10 0x0 + +#define AO_ADXL375_POWER_CTL 0x2d +#define AO_ADXL375_POWER_CTL_LINK 5 +#define AO_ADXL375_POWER_CTL_AUTO_SLEEP 4 +#define AO_ADXL375_POWER_CTL_MEASURE 3 +#define AO_ADXL375_POWER_CTL_SLEEP 2 +#define AO_ADXL375_POWER_CTL_WAKEUP 0 +#define AO_ADXL375_POWER_CTL_WAKEUP_8 0 +#define AO_ADXL375_POWER_CTL_WAKEUP_4 1 +#define AO_ADXL375_POWER_CTL_WAKEUP_2 2 +#define AO_ADXL375_POWER_CTL_WAKEUP_1 3 + +#define AO_ADXL375_INT_ENABLE 0x2e +#define AO_ADXL375_INT_MAP 0x2f +#define AO_ADXL375_INT_SOURCE 0x30 +#define AO_ADXL375_DATA_FORMAT 0x31 +# define AO_ADXL375_DATA_FORMAT_FIXED 0x0b /* these bits must be set to 1 */ +# define AO_ADXL375_DATA_FORMAT_SELF_TEST 7 +# define AO_ADXL375_DATA_FORMAT_SPI 6 +# define AO_ADXL375_DATA_FORMAT_SPI_3_WIRE 0 +# define AO_ADXL375_DATA_FORMAT_SPI_4_WIRE 1 +# define AO_ADXL375_DATA_FORMAT_INT_INVERT 5 +# define AO_ADXL375_DATA_FORMAT_JUSTIFY 2 +#define AO_ADXL375_DATAX0 0x32 +#define AO_ADXL375_DATAX1 0x33 +#define AO_ADXL375_DATAY0 0x34 +#define AO_ADXL375_DATAY1 0x35 +#define AO_ADXL375_DATAZ0 0x36 +#define AO_ADXL375_DATAZ1 0x37 +#define AO_ADXL375_FIFO_CTL 0x38 +#define AO_ADXL375_FIFO_CTL_FIFO_MODE 6 +#define AO_ADXL375_FIFO_CTL_FIFO_MODE_BYPASS 0 +#define AO_ADXL375_FIFO_CTL_FIFO_MODE_FIFO 1 +#define AO_ADXL375_FIFO_CTL_FIFO_MODE_STREAM 2 +#define AO_ADXL375_FIFO_CTL_FIFO_MODE_TRIGGER 3 +#define AO_ADXL375_FIFO_CTL_TRIGGER 5 +#define AO_ADXL375_FIFO_CTL_SAMPLES 0 + +#define AO_ADXL375_FIFO_STATUS 0x39 + +struct ao_adxl375_sample { + int16_t x; + int16_t y; + int16_t z; +}; + +extern struct ao_adxl375_sample ao_adxl375_current; + +void +ao_adxl375_init(void); + +#endif /* _AO_ADXL375_H_ */ diff --git a/src/kernel/ao_data.h b/src/kernel/ao_data.h index 97f7e06e..3918f4e0 100644 --- a/src/kernel/ao_data.h +++ b/src/kernel/ao_data.h @@ -62,9 +62,16 @@ #define AO_DATA_MMA655X 0 #endif +#if HAS_ADXL375 +#include +#define AO_DATA_ADXL375 (1 << 4) +#else +#define AO_DATA_ADXL375 0 +#endif + #ifdef AO_DATA_RING -#define AO_DATA_ALL (AO_DATA_ADC|AO_DATA_MS5607|AO_DATA_MPU6000|AO_DATA_HMC5883|AO_DATA_MMA655X|AO_DATA_MPU9250) +#define AO_DATA_ALL (AO_DATA_ADC|AO_DATA_MS5607|AO_DATA_MPU6000|AO_DATA_HMC5883|AO_DATA_MMA655X|AO_DATA_MPU9250|AO_DATA_ADXL375) struct ao_data { uint16_t tick; @@ -90,6 +97,9 @@ struct ao_data { #if HAS_MMA655X uint16_t mma655x; #endif +#if HAS_ADXL375 + struct ao_adxl375_sample adxl375; +#endif }; #define ao_data_ring_next(n) (((n) + 1) & (AO_DATA_RING - 1)) @@ -293,6 +303,27 @@ typedef int16_t accel_t; #endif +#if !HAS_ACCEL && HAS_ADXL375 + +#define HAS_ACCEL 1 + +typedef int16_t accel_t; + +#ifndef AO_ADXL375_INVERT +#error AO_ADXL375_INVERT not defined +#endif + +#define ao_data_accel(packet) ((packet)->adxl375.AO_ADXL375_AXIS) +#if AO_ADXL375_INVERT +#define ao_data_accel_cook(packet) (-ao_data_accel(packet)) +#else +#define ao_data_accel_cook(packet) ao_data_accel(packet) +#endif +#define ao_data_set_accel(packet, accel) (ao_data_accel(packet) = (accel)) +#define ao_data_accel_invert(accel) (-(accel)) + +#endif /* HAS_ADXL375 */ + #if !HAS_ACCEL && HAS_MPU6000 #define HAS_ACCEL 1 @@ -419,6 +450,9 @@ ao_data_fill(int head) { #endif #if HAS_MPU9250 ao_data_ring[head].mpu9250 = ao_mpu9250_current; +#endif +#if HAS_ADXL375 + ao_data_ring[head].adxl375 = ao_adxl375_current; #endif ao_data_ring[head].tick = ao_tick_count; ao_data_head = ao_data_ring_next(head); -- cgit v1.2.3 From 6fdc392ef1b624c06e26e7a053c3579435c455d5 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 13 Oct 2018 09:46:01 -0700 Subject: altos/easymega-v2.0: Change binary to easymega-v2.0 instead of easymega-v1.0 Signed-off-by: Keith Packard --- src/easymega-v2.0/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/easymega-v2.0/Makefile b/src/easymega-v2.0/Makefile index 9d490d0f..ece4e9bb 100644 --- a/src/easymega-v2.0/Makefile +++ b/src/easymega-v2.0/Makefile @@ -108,7 +108,7 @@ IDPRODUCT=0x0028 CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) $(SAMPLE_PROFILE_DEF) $(STACK_GUARD_DEF) -Os -g -PROGNAME=easymega-v1.0 +PROGNAME=easymega-v2.0 PROG=$(PROGNAME)-$(VERSION).elf HEX=$(PROGNAME)-$(VERSION).ihx -- cgit v1.2.3 From f49763bf4a6cd8b2a47abfbec7ef3d8c8c029b8f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 13 Oct 2018 09:43:25 -0700 Subject: altos/easymega-v2.0: Add adxl375, replace mpu6000 with 9250 [v2] Should reflect current hardware design now. v2: Use SPI mode 3 for ADXL375 Invert ADXL375 values Signed-off-by: Keith Packard --- src/easymega-v2.0/Makefile | 22 +++--------------- src/easymega-v2.0/ao_easymega.c | 23 +++++-------------- src/easymega-v2.0/ao_pins.h | 49 ++++++++++++++++++++--------------------- 3 files changed, 33 insertions(+), 61 deletions(-) diff --git a/src/easymega-v2.0/Makefile b/src/easymega-v2.0/Makefile index ece4e9bb..bfe8a849 100644 --- a/src/easymega-v2.0/Makefile +++ b/src/easymega-v2.0/Makefile @@ -19,15 +19,14 @@ INC = \ ao_product.h \ ao_ms5607.h \ ao_mpu9250.h \ + ao_adxl375.h \ ao_profile.h \ ao_task.h \ ao_whiten.h \ ao_sample_profile.h \ ao_quaternion.h \ - math.h \ ao_mpu.h \ stm32l.h \ - math.h \ Makefile # @@ -44,21 +43,6 @@ INC = \ #STACK_GUARD=ao_mpu_stm.c #STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 -MATH_SRC=\ - ef_acos.c \ - ef_sqrt.c \ - ef_rem_pio2.c \ - kf_cos.c \ - kf_sin.c \ - kf_rem_pio2.c \ - sf_copysign.c \ - sf_cos.c \ - sf_fabs.c \ - sf_floor.c \ - sf_scalbn.c \ - sf_sin.c \ - ef_log.c - ALTOS_SRC = \ ao_boot_chain.c \ ao_interrupt.c \ @@ -67,7 +51,7 @@ ALTOS_SRC = \ ao_cmd.c \ ao_config.c \ ao_task.c \ - ao_led.c \ + ao_led_stm.c \ ao_stdio.c \ ao_panic.c \ ao_timer.c \ @@ -79,6 +63,7 @@ ALTOS_SRC = \ ao_data.c \ ao_ms5607.c \ ao_mpu9250.c \ + ao_adxl375.c \ ao_adc_stm.c \ ao_beep_stm.c \ ao_eeprom_stm.c \ @@ -97,7 +82,6 @@ ALTOS_SRC = \ ao_flight.c \ ao_companion.c \ ao_pyro.c \ - $(MATH_SRC) \ $(PROFILE) \ $(SAMPLE_PROFILE) \ $(STACK_GUARD) diff --git a/src/easymega-v2.0/ao_easymega.c b/src/easymega-v2.0/ao_easymega.c index 9848c367..bb2e7cfd 100644 --- a/src/easymega-v2.0/ao_easymega.c +++ b/src/easymega-v2.0/ao_easymega.c @@ -17,9 +17,9 @@ */ #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -43,7 +43,7 @@ main(void) #endif ao_task_init(); - ao_led_init(LEDS_AVAILABLE); + ao_led_init(); ao_led_on(LEDS_AVAILABLE); ao_timer_init(); @@ -53,23 +53,12 @@ main(void) ao_exti_init(); ao_adc_init(); -#if HAS_BEEP ao_beep_init(); -#endif ao_cmd_init(); -#if HAS_MS5607 ao_ms5607_init(); -#endif -#if HAS_HMC5883 - ao_hmc5883_init(); -#endif -#if HAS_MPU6000 - ao_mpu6000_init(); -#endif -#if HAS_MMA655X - ao_mma655x_init(); -#endif + ao_mpu9250_init(); + ao_adxl375_init(); ao_eeprom_init(); ao_storage_init(); diff --git a/src/easymega-v2.0/ao_pins.h b/src/easymega-v2.0/ao_pins.h index 508c043c..6217b5d2 100644 --- a/src/easymega-v2.0/ao_pins.h +++ b/src/easymega-v2.0/ao_pins.h @@ -25,8 +25,8 @@ #define AO_HSE 16000000 /* PLLVCO = 96MHz (so that USB will work) */ -#define AO_PLLMUL 12 -#define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_12) +#define AO_PLLMUL 6 +#define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_6) /* SYSCLK = 32MHz (no need to go faster than CPU) */ #define AO_PLLDIV 3 @@ -89,20 +89,15 @@ #define HAS_SPI_1 1 #define SPI_1_PA5_PA6_PA7 1 /* Barometer */ -#define SPI_1_PB3_PB4_PB5 1 /* Accelerometer, Gyro */ +#define SPI_1_PB3_PB4_PB5 1 /* Accelerometer */ #define SPI_1_PE13_PE14_PE15 0 #define SPI_1_OSPEEDR STM_OSPEEDR_10MHz #define HAS_SPI_2 1 -#define SPI_2_PB13_PB14_PB15 1 /* Flash, Companion */ +#define SPI_2_PB13_PB14_PB15 1 /* Flash, IMU, Companion */ #define SPI_2_PD1_PD3_PD4 0 #define SPI_2_OSPEEDR STM_OSPEEDR_10MHz -#define SPI_2_PORT (&stm_gpiob) -#define SPI_2_SCK_PIN 13 -#define SPI_2_MISO_PIN 14 -#define SPI_2_MOSI_PIN 15 - #define HAS_I2C_1 1 #define I2C_1_PB8_PB9 1 @@ -169,9 +164,6 @@ /* Number of general purpose pyro channels available */ #define AO_PYRO_NUM 4 -#define AO_IGNITER_SET_DROGUE(v) stm_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, v) -#define AO_IGNITER_SET_MAIN(v) stm_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, v) - /* * ADC */ @@ -307,22 +299,29 @@ struct ao_adc { */ #define HAS_MPU9250 1 -#define AO_MPU9250_INT_PORT (&stm_gpioe) -#define AO_MPU9250_INT_PIN 0 -#define AO_MPU9250_SPI_BUS AO_SPI_1_PE13_PE14_PE15 -#define AO_MPU9250_SPI_CS_PORT (&stm_gpiod) -#define AO_MPU9250_SPI_CS_PIN 2 +#define AO_MPU9250_INT_PORT (&stm_gpioc) +#define AO_MPU9250_INT_PIN 15 +#define AO_MPU9250_SPI_BUS (AO_SPI_2_PB13_PB14_PB15 | AO_SPI_MODE_0) +#define AO_MPU9250_SPI_CS_PORT (&stm_gpioc) +#define AO_MPU9250_SPI_CS_PIN 13 #define HAS_IMU 1 -/* - * mma655x - */ +/* ADXL375 */ + +#define HAS_ADXL375 1 +#define AO_ADXL375_SPI_INDEX (AO_SPI_1_PB3_PB4_PB5 | AO_SPI_MODE_3) +#define AO_ADXL375_CS_PORT (&stm_gpioc) +#define AO_ADXL375_CS_PIN 12 +#define AO_ADXL375_SPI_SPEED AO_SPI_SPEED_4MHz + +#define AO_ADXL375_INT1_PORT (&stm_gpiob) +#define AO_ADXL375_INT1_PIN 8 + +#define AO_ADXL375_INT2_PORT (&stm_gpiob) +#define AO_ADXL375_INT2_PIN 9 -#define HAS_MMA655X 0 -#define AO_MMA655X_INVERT 0 -#define AO_MMA655X_SPI_INDEX AO_SPI_1_PB3_PB4_PB5 -#define AO_MMA655X_CS_PORT (&stm_gpioc) -#define AO_MMA655X_CS_PIN 12 +#define AO_ADXL375_AXIS x +#define AO_ADXL375_INVERT 1 #define NUM_CMDS 16 -- cgit v1.2.3 From 3fd320ea38f2945f5611a09a0e48d16db467d105 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 19 Oct 2018 08:41:51 -0700 Subject: altos: Add EasyMega v2.0 to default build Signed-off-by: Keith Packard --- src/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Makefile b/src/Makefile index 4eb0d4c3..757641f7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -18,6 +18,7 @@ include Makedefs ARMM3DIRS=\ easymega-v1.0 easymega-v1.0/flash-loader \ + easymega-v2.0 easymega-v2.0/flash-loader \ telemega-v0.1 telemega-v0.1/flash-loader \ telemega-v1.0 telemega-v1.0/flash-loader \ telemega-v2.0 telemega-v2.0/flash-loader \ -- cgit v1.2.3 From 1e4b8674d874a190eca1a98a397aaf0a9d15bda1 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 19 Oct 2018 13:19:03 -0700 Subject: altoslib: Add ADXL375 support and EasyMega v2.0 support EasyMega v2.0 replaces the MMA655X with an ADXL375 part. Signed-off-by: Keith Packard --- altoslib/AltosAdxl375.java | 93 +++++++++++++++++++++++++++++++++++++++++++ altoslib/AltosCalData.java | 26 +++++++++++- altoslib/AltosConfigData.java | 16 ++++++++ altoslib/AltosIdleFetch.java | 12 +++++- altoslib/Makefile.am | 1 + 5 files changed, 145 insertions(+), 3 deletions(-) create mode 100644 altoslib/AltosAdxl375.java diff --git a/altoslib/AltosAdxl375.java b/altoslib/AltosAdxl375.java new file mode 100644 index 00000000..2129ed6e --- /dev/null +++ b/altoslib/AltosAdxl375.java @@ -0,0 +1,93 @@ +/* + * Copyright © 2012 Keith Packard + * + * 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. + */ + +package org.altusmetrum.altoslib_13; + +import java.util.concurrent.*; + +public class AltosAdxl375 implements Cloneable { + + private int accel; + private int axis; + + public static final int X_AXIS = 0; + public static final int Y_AXIS = 1; + public static final int Z_AXIS = 2; + + public boolean parse_line(String line) throws NumberFormatException { + if (line.startsWith("ADXL375 value")) { + System.out.printf("adxl parse line %s\n", line); + String[] items = line.split("\\s+"); + if (axis == AltosLib.MISSING) + throw new NumberFormatException("No ADXL375 axis specified"); + if (items.length >= 3) { + accel = Integer.parseInt(items[2 + axis]); + System.out.printf("accel %d\n", accel); + return true; + } + } + return false; + } + + public AltosAdxl375 clone() { + AltosAdxl375 n = new AltosAdxl375(axis); + + n.accel = accel; + return n; + } + + static public void provide_data(AltosDataListener listener, AltosLink link) throws InterruptedException, AltosUnknownProduct { + try { + AltosCalData cal_data = listener.cal_data(); + AltosAdxl375 adxl375 = new AltosAdxl375(link, cal_data.adxl375_axis); + + if (adxl375 != null) { + int accel = adxl375.accel; + if (cal_data.adxl375_inverted) + accel = -accel; + if (cal_data.pad_orientation == 1) + accel = -accel; + listener.set_acceleration(cal_data.acceleration(accel)); + } + } catch (TimeoutException te) { + } catch (NumberFormatException ne) { + } + } + + public AltosAdxl375() { + accel = AltosLib.MISSING; + axis = AltosLib.MISSING; + } + + public AltosAdxl375(int axis) { + this(); + this.axis = axis; + } + + public AltosAdxl375(AltosLink link, int axis) throws InterruptedException, TimeoutException, NumberFormatException { + this(axis); + link.printf("A\n"); + for (;;) { + String line = link.get_reply_no_dialog(5000); + if (line == null) + throw new TimeoutException(); + if (parse_line(line)) + break; + } + } +} diff --git a/altoslib/AltosCalData.java b/altoslib/AltosCalData.java index d448fdfe..c3d79250 100644 --- a/altoslib/AltosCalData.java +++ b/altoslib/AltosCalData.java @@ -133,6 +133,18 @@ public class AltosCalData { mma655x_inverted = inverted; } + public boolean adxl375_inverted = false; + + public void set_adxl375_inverted(boolean inverted) { + adxl375_inverted = inverted; + } + + public int adxl375_axis = AltosLib.MISSING; + + public void set_adxl375_axis(int axis) { + adxl375_axis = axis; + } + public int pad_orientation = AltosLib.MISSING; public void set_pad_orientation(int orientation) { @@ -142,7 +154,11 @@ public class AltosCalData { /* Compute acceleration */ public double acceleration(double sensor) { - return AltosConvert.acceleration_from_sensor(sensor, accel_plus_g, accel_minus_g, ground_accel); + double accel; + accel = AltosConvert.acceleration_from_sensor(sensor, accel_plus_g, accel_minus_g, ground_accel); + System.out.printf("acceleration %g (+ %g - %g g %g) -> %g\n", + sensor, accel_plus_g, accel_minus_g, ground_accel, accel); + return accel; } public AltosMs5607 ms5607 = null; @@ -404,6 +420,14 @@ public class AltosCalData { set_mma655x_inverted(config_data.mma655x_inverted()); } catch (AltosUnknownProduct up) { } + try { + set_adxl375_inverted(config_data.adxl375_inverted()); + } catch (AltosUnknownProduct up) { + } + try { + set_adxl375_axis(config_data.adxl375_axis()); + } catch (AltosUnknownProduct up) { + } set_pad_orientation(config_data.pad_orientation); } } diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index 48dab421..29ce033d 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -581,6 +581,22 @@ public class AltosConfigData { throw new AltosUnknownProduct(product); } + public boolean adxl375_inverted() throws AltosUnknownProduct { + if (product != null) { + if (product.startsWith("EasyMega-v2")) + return true; + } + throw new AltosUnknownProduct(product); + } + + public int adxl375_axis() throws AltosUnknownProduct { + if (product != null) { + if (product.startsWith("EasyMega-v2")) + return AltosAdxl375.X_AXIS; + } + throw new AltosUnknownProduct(product); + } + public void get_values(AltosConfigValues source) throws AltosConfigDataException { /* HAS_FLIGHT */ diff --git a/altoslib/AltosIdleFetch.java b/altoslib/AltosIdleFetch.java index 88a65e63..884d8761 100644 --- a/altoslib/AltosIdleFetch.java +++ b/altoslib/AltosIdleFetch.java @@ -32,7 +32,7 @@ class AltosIdler { static final int idle_mag = 2; static final int idle_mma655x = 4; static final int idle_ms5607 = 5; - + static final int idle_adxl375 = 6; static final int idle_sensor_tm = 10; static final int idle_sensor_metrum = 11; @@ -58,6 +58,9 @@ class AltosIdler { case idle_mma655x: AltosMma655x.provide_data(listener, link); break; + case idle_adxl375: + AltosAdxl375.provide_data(listener, link); + break; case idle_ms5607: AltosMs5607.provide_data(listener, link); break; @@ -157,11 +160,16 @@ public class AltosIdleFetch implements AltosDataProvider { AltosIdler.idle_ms5607, AltosIdler.idle_imu, AltosIdler.idle_sensor_mega), - new AltosIdler("EasyMega", + new AltosIdler("EasyMega-v1", AltosIdler.idle_mma655x, AltosIdler.idle_ms5607, AltosIdler.idle_imu, AltosIdler.idle_mag, AltosIdler.idle_sensor_mega), + new AltosIdler("EasyMega-v2", + AltosIdler.idle_adxl375, + AltosIdler.idle_ms5607, + AltosIdler.idle_imu, + AltosIdler.idle_sensor_mega), new AltosIdler("TeleGPS", AltosIdler.idle_gps, AltosIdler.idle_sensor_tgps), diff --git a/altoslib/Makefile.am b/altoslib/Makefile.am index 92976332..2f4e5959 100644 --- a/altoslib/Makefile.am +++ b/altoslib/Makefile.am @@ -28,6 +28,7 @@ altoslib_JAVA = \ AltosLib.java \ AltosAccelCal.java \ AltosAccelCalListener.java \ + AltosAdxl375.java \ AltosCalData.java \ AltosCompanion.java \ AltosConfigData.java \ -- cgit v1.2.3 From cc528f1ff0271ec6488a1a7b91c731183502101e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 19 Oct 2018 13:20:31 -0700 Subject: altosui: Add EasyMega v2.0 firmware to release Signed-off-by: Keith Packard --- Releasing | 2 ++ altosui/Makefile.am | 3 ++- altosui/altos-windows.nsi.in | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Releasing b/Releasing index 6540383b..d0db6ac1 100644 --- a/Releasing +++ b/Releasing @@ -103,6 +103,7 @@ These are Bdale's notes on how to do a release. cp src/chaoskey-v1.0/{*.elf,*.ihx,*.bin} \ src/easymega-v1.0/{*.elf,*.ihx} \ + src/easymega-v2.0/{*.elf,*.ihx} \ src/easymini-v1.0/{*.elf,*.ihx} \ src/easymini-v2.0/{*.elf,*.ihx} \ src/telebt-v3.0/{*.elf,*.ihx} \ @@ -120,6 +121,7 @@ These are Bdale's notes on how to do a release. ~/altusmetrumllc/Binaries/ cp src/chaoskey-v1.0/flash-loader/{*.elf,*.bin} \ src/easymega-v1.0/flash-loader/*.elf \ + src/easymega-v2.0/flash-loader/*.elf \ src/easymini-v1.0/flash-loader/*.elf \ src/easymini-v2.0/flash-loader/{*.elf,*.bin} \ src/telebt-v3.0/flash-loader/*.elf \ diff --git a/altosui/Makefile.am b/altosui/Makefile.am index cddc78d3..7cc1f4ea 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -140,7 +140,8 @@ FIRMWARE_EMINI_1_0=$(top_srcdir)/src/easymini-v1.0/easymini-v1.0-$(VERSION).ihx FIRMWARE_EMINI=$(FIRMWARE_EMINI_1_0) FIRMWARE_EMEGA_1_0=$(top_srcdir)/src/easymega-v1.0/easymega-v1.0-$(VERSION).ihx -FIRMWARE_EMEGA=$(FIRMWARE_EMEGA_1_0) +FIRMWARE_EMEGA_2_0=$(top_srcdir)/src/easymega-v2.0/easymega-v2.0-$(VERSION).ihx +FIRMWARE_EMEGA=$(FIRMWARE_EMEGA_1_0) $(FIRMWARE_EMEGA_2_0) FIRMWARE_TGPS_1_0=$(top_srcdir)/src/telegps-v1.0/telegps-v1.0-$(VERSION).ihx FIRMWARE_TGPS_2_0=$(top_srcdir)/src/telegps-v2.0/telegps-v2.0-$(VERSION).ihx diff --git a/altosui/altos-windows.nsi.in b/altosui/altos-windows.nsi.in index 7aca30e2..2666fc33 100644 --- a/altosui/altos-windows.nsi.in +++ b/altosui/altos-windows.nsi.in @@ -134,6 +134,7 @@ Section "Firmware" File "../src/easymini-v1.0/easymini-v1.0-${VERSION}.ihx" File "../src/easymini-v2.0/easymini-v2.0-${VERSION}.ihx" File "../src/easymega-v1.0/easymega-v1.0-${VERSION}.ihx" + File "../src/easymega-v2.0/easymega-v2.0-${VERSION}.ihx" SectionEnd -- cgit v1.2.3 From 6aa451ce81bfdfe679e3f9902043a5f0d235c745 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sat, 20 Oct 2018 01:17:39 -0600 Subject: altoslib: fix computation of TeleGPS battery voltage --- altoslib/AltosConvert.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/altoslib/AltosConvert.java b/altoslib/AltosConvert.java index d2460187..e1930430 100644 --- a/altoslib/AltosConvert.java +++ b/altoslib/AltosConvert.java @@ -261,7 +261,7 @@ public class AltosConvert { static double tele_gps_voltage(int sensor) { double supply = 3.3; - return sensor / 32767.0 * supply * (5.6 + 10.0) / 10.0; + return sensor / 4095.0 * supply * (5.6 + 10.0) / 10.0; } static double tele_bt_3_battery(int raw) { -- cgit v1.2.3 From c01514fa1e0a2cea3955c71a833b4a21b3d33f24 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 20 Oct 2018 07:34:57 -0700 Subject: altos/adxl375: Clean up initialization, shortening self test period Set the self test period to that suggested in the documentation. Eliminate some debug variables. Signed-off-by: Keith Packard --- src/drivers/ao_adxl375.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/drivers/ao_adxl375.c b/src/drivers/ao_adxl375.c index e0d094f2..778c214b 100644 --- a/src/drivers/ao_adxl375.c +++ b/src/drivers/ao_adxl375.c @@ -98,8 +98,8 @@ struct ao_adxl375_total { int32_t z; }; -#define AO_ADXL375_SELF_TEST_SAMPLES 16 -#define AO_ADXL375_SELF_TEST_SETTLE 6 +#define AO_ADXL375_SELF_TEST_SAMPLES 10 +#define AO_ADXL375_SELF_TEST_SETTLE 4 #define MIN_LSB_G 18.4 #define MAX_LSB_G 22.6 @@ -109,9 +109,6 @@ struct ao_adxl375_total { #define MIN_SELF_TEST ((int32_t) (MIN_LSB_G * SELF_TEST_MIN_G * AO_ADXL375_SELF_TEST_SAMPLES + 0.5)) #define MAX_SELF_TEST ((int32_t) (MAX_LSB_G * SELF_TEST_MAX_G * AO_ADXL375_SELF_TEST_SAMPLES + 0.5)) -static const int32_t min_self_test = MIN_SELF_TEST; -static const int32_t max_self_test = MAX_SELF_TEST; - static void ao_adxl375_total_value(struct ao_adxl375_total *total, int samples) { @@ -178,9 +175,6 @@ ao_adxl375_setup(void) (void) ao_adxl375_total_value; /* Perform self-test */ -#define AO_ADXL375_SELF_TEST_SAMPLES 16 -#define AO_ADXL375_SELF_TEST_SETTLE 6 - struct ao_adxl375_total self_test_off, self_test_on; /* Discard some samples to let it settle down */ @@ -210,22 +204,19 @@ ao_adxl375_setup(void) self_test_value = z_change; - if (z_change < min_self_test || max_self_test < z_change) + if (z_change < MIN_SELF_TEST || MAX_SELF_TEST < z_change) ao_sensor_errors = 1; /* Discard some samples to let it settle down */ ao_adxl375_total_value(&self_test_off, AO_ADXL375_SELF_TEST_SETTLE); } -static int adxl375_count; - static void ao_adxl375(void) { ao_adxl375_setup(); for (;;) { ao_adxl375_value(&ao_adxl375_current); - ++adxl375_count; ao_arch_critical( AO_DATA_PRESENT(AO_DATA_ADXL375); AO_DATA_WAIT(); @@ -238,11 +229,10 @@ static struct ao_task ao_adxl375_task; static void ao_adxl375_dump(void) { - printf ("ADXL375 value %d %d %d count %d self test %d min %d max %d\n", + printf ("ADXL375 value %d %d %d self test %d min %d max %d\n", ao_adxl375_current.x, ao_adxl375_current.y, ao_adxl375_current.z, - adxl375_count, self_test_value, MIN_SELF_TEST, MAX_SELF_TEST); -- cgit v1.2.3 From f13e294d4644096b0529383c1d60d5e4b7916d76 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 20 Oct 2018 17:22:59 -0700 Subject: altoslib: Add support for TeleGPS v2 The battery voltage ADC values are different from TeleGPS v1 (max 4095 instead of 32767). Signed-off-by: Keith Packard --- altoslib/AltosConvert.java | 8 ++++- altoslib/AltosIdleFetch.java | 19 +++++++---- altoslib/AltosSensorTGPS.java | 56 ------------------------------- altoslib/AltosSensorTGPS1.java | 56 +++++++++++++++++++++++++++++++ altoslib/AltosSensorTGPS2.java | 56 +++++++++++++++++++++++++++++++ altoslib/AltosTelemetryConfiguration.java | 12 +++++-- altoslib/Makefile.am | 3 +- 7 files changed, 143 insertions(+), 67 deletions(-) delete mode 100644 altoslib/AltosSensorTGPS.java create mode 100644 altoslib/AltosSensorTGPS1.java create mode 100644 altoslib/AltosSensorTGPS2.java diff --git a/altoslib/AltosConvert.java b/altoslib/AltosConvert.java index e1930430..ce1b8f7f 100644 --- a/altoslib/AltosConvert.java +++ b/altoslib/AltosConvert.java @@ -258,7 +258,13 @@ public class AltosConvert { return sensor / 32767.0 * supply * 127/27; } - static double tele_gps_voltage(int sensor) { + static double tele_gps_1_voltage(int sensor) { + double supply = 3.3; + + return sensor / 32767.0 * supply * (5.6 + 10.0) / 10.0; + } + + static double tele_gps_2_voltage(int sensor) { double supply = 3.3; return sensor / 4095.0 * supply * (5.6 + 10.0) / 10.0; diff --git a/altoslib/AltosIdleFetch.java b/altoslib/AltosIdleFetch.java index 884d8761..a68ccac7 100644 --- a/altoslib/AltosIdleFetch.java +++ b/altoslib/AltosIdleFetch.java @@ -40,8 +40,9 @@ class AltosIdler { static final int idle_sensor_emini1 = 13; static final int idle_sensor_emini2 = 14; static final int idle_sensor_tmini2 = 15; - static final int idle_sensor_tgps = 16; - static final int idle_sensor_tmini3 = 17; + static final int idle_sensor_tgps1 = 16; + static final int idle_sensor_tgps2 = 17; + static final int idle_sensor_tmini3 = 18; public void provide_data(AltosDataListener listener, AltosLink link) throws InterruptedException, TimeoutException, AltosUnknownProduct { for (int idler : idlers) { @@ -82,8 +83,11 @@ class AltosIdler { case idle_sensor_tmini2: AltosSensorTMini2.provide_data(listener, link); break; - case idle_sensor_tgps: - AltosSensorTGPS.provide_data(listener, link); + case idle_sensor_tgps1: + AltosSensorTGPS1.provide_data(listener, link); + break; + case idle_sensor_tgps2: + AltosSensorTGPS2.provide_data(listener, link); break; case idle_sensor_tmini3: AltosSensorTMini3.provide_data(listener, link); @@ -170,9 +174,12 @@ public class AltosIdleFetch implements AltosDataProvider { AltosIdler.idle_ms5607, AltosIdler.idle_imu, AltosIdler.idle_sensor_mega), - new AltosIdler("TeleGPS", + new AltosIdler("TeleGPS-v1", + AltosIdler.idle_gps, + AltosIdler.idle_sensor_tgps1), + new AltosIdler("TeleGPS-v2", AltosIdler.idle_gps, - AltosIdler.idle_sensor_tgps), + AltosIdler.idle_sensor_tgps2), }; AltosLink link; diff --git a/altoslib/AltosSensorTGPS.java b/altoslib/AltosSensorTGPS.java deleted file mode 100644 index 485e8b3c..00000000 --- a/altoslib/AltosSensorTGPS.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright © 2015 Keith Packard - * - * 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. - */ - -package org.altusmetrum.altoslib_13; - -import java.util.concurrent.TimeoutException; - -public class AltosSensorTGPS { - public int tick; - public int batt; - - static public void provide_data(AltosDataListener listener, AltosLink link) throws InterruptedException { - try { - AltosSensorTGPS sensor_tgps = new AltosSensorTGPS(link); - - if (sensor_tgps == null) - return; - listener.set_battery_voltage(AltosConvert.tele_gps_voltage(sensor_tgps.batt)); - - } catch (TimeoutException te) { - } - } - - public AltosSensorTGPS(AltosLink link) throws InterruptedException, TimeoutException { - String[] items = link.adc(); - for (int i = 0; i < items.length - 1;) { - if (items[i].equals("tick:")) { - tick = Integer.parseInt(items[i+1]); - i += 2; - continue; - } - if (items[i].equals("batt:")) { - batt = Integer.parseInt(items[i+1]); - i += 2; - continue; - } - i++; - } - } -} - diff --git a/altoslib/AltosSensorTGPS1.java b/altoslib/AltosSensorTGPS1.java new file mode 100644 index 00000000..cdd19217 --- /dev/null +++ b/altoslib/AltosSensorTGPS1.java @@ -0,0 +1,56 @@ +/* + * Copyright © 2015 Keith Packard + * + * 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. + */ + +package org.altusmetrum.altoslib_13; + +import java.util.concurrent.TimeoutException; + +public class AltosSensorTGPS1 { + public int tick; + public int batt; + + static public void provide_data(AltosDataListener listener, AltosLink link) throws InterruptedException { + try { + AltosSensorTGPS1 sensor_tgps = new AltosSensorTGPS1(link); + + if (sensor_tgps == null) + return; + listener.set_battery_voltage(AltosConvert.tele_gps_1_voltage(sensor_tgps.batt)); + + } catch (TimeoutException te) { + } + } + + public AltosSensorTGPS1(AltosLink link) throws InterruptedException, TimeoutException { + String[] items = link.adc(); + for (int i = 0; i < items.length - 1;) { + if (items[i].equals("tick:")) { + tick = Integer.parseInt(items[i+1]); + i += 2; + continue; + } + if (items[i].equals("batt:")) { + batt = Integer.parseInt(items[i+1]); + i += 2; + continue; + } + i++; + } + } +} + diff --git a/altoslib/AltosSensorTGPS2.java b/altoslib/AltosSensorTGPS2.java new file mode 100644 index 00000000..ceca977e --- /dev/null +++ b/altoslib/AltosSensorTGPS2.java @@ -0,0 +1,56 @@ +/* + * Copyright © 2015 Keith Packard + * + * 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. + */ + +package org.altusmetrum.altoslib_13; + +import java.util.concurrent.TimeoutException; + +public class AltosSensorTGPS2 { + public int tick; + public int batt; + + static public void provide_data(AltosDataListener listener, AltosLink link) throws InterruptedException { + try { + AltosSensorTGPS2 sensor_tgps = new AltosSensorTGPS2(link); + + if (sensor_tgps == null) + return; + listener.set_battery_voltage(AltosConvert.tele_gps_2_voltage(sensor_tgps.batt)); + + } catch (TimeoutException te) { + } + } + + public AltosSensorTGPS2(AltosLink link) throws InterruptedException, TimeoutException { + String[] items = link.adc(); + for (int i = 0; i < items.length - 1;) { + if (items[i].equals("tick:")) { + tick = Integer.parseInt(items[i+1]); + i += 2; + continue; + } + if (items[i].equals("batt:")) { + batt = Integer.parseInt(items[i+1]); + i += 2; + continue; + } + i++; + } + } +} + diff --git a/altoslib/AltosTelemetryConfiguration.java b/altoslib/AltosTelemetryConfiguration.java index 4411a77d..22fd8568 100644 --- a/altoslib/AltosTelemetryConfiguration.java +++ b/altoslib/AltosTelemetryConfiguration.java @@ -43,9 +43,15 @@ public class AltosTelemetryConfiguration extends AltosTelemetryStandard { listener.set_device_type(device_type()); cal_data.set_flight(flight()); cal_data.set_config(config_major(), config_minor(), flight_log_max()); - if (device_type() == AltosLib.product_telegps) - listener.set_battery_voltage(AltosConvert.tele_gps_voltage(v_batt())); - else + if (device_type() == AltosLib.product_telegps) { + int v_batt = v_batt(); + double batt; + if (v_batt > 4095) + batt = AltosConvert.tele_gps_1_voltage(v_batt); + else + batt = AltosConvert.tele_gps_2_voltage(v_batt); + listener.set_battery_voltage(batt); + } else cal_data.set_flight_params(apogee_delay() / 100.0, main_deploy()); cal_data.set_callsign(callsign()); diff --git a/altoslib/Makefile.am b/altoslib/Makefile.am index 2f4e5959..447830e5 100644 --- a/altoslib/Makefile.am +++ b/altoslib/Makefile.am @@ -108,7 +108,8 @@ altoslib_JAVA = \ AltosSensorTMini3.java \ AltosSensorMega.java \ AltosSensorMetrum.java \ - AltosSensorTGPS.java \ + AltosSensorTGPS1.java \ + AltosSensorTGPS2.java \ AltosState.java \ AltosStateName.java \ AltosStringInputStream.java \ -- cgit v1.2.3 From 8c92656576aff3ceab5bead3c835d96c36098fe7 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 20 Oct 2018 17:24:41 -0700 Subject: altoslib: Add support for EasyMega-v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit adxl375 instead of mma6555. mpu9250 rotated 90° compared with other megas. Signed-off-by: Keith Packard --- altoslib/AltosConfigData.java | 2 + altoslib/AltosEepromRecordMega.java | 113 +++++++++++++++++++++++++++++++++--- altoslib/AltosEepromRecordSet.java | 1 + altoslib/AltosLib.java | 1 + 4 files changed, 108 insertions(+), 9 deletions(-) diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index 29ce033d..d315f96a 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -201,6 +201,8 @@ public class AltosConfigData { case AltosLib.AO_LOG_FORMAT_TELEMEGA: case AltosLib.AO_LOG_FORMAT_TELEMEGA_3: return 4095 - value; + case AltosLib.AO_LOG_FORMAT_EASYMEGA_2: + return -value; default: return AltosLib.MISSING; } diff --git a/altoslib/AltosEepromRecordMega.java b/altoslib/AltosEepromRecordMega.java index 6b28c50a..c37dbfa2 100644 --- a/altoslib/AltosEepromRecordMega.java +++ b/altoslib/AltosEepromRecordMega.java @@ -32,6 +32,7 @@ public class AltosEepromRecordMega extends AltosEepromRecord { switch (log_format) { case AltosLib.AO_LOG_FORMAT_TELEMEGA: case AltosLib.AO_LOG_FORMAT_TELEMEGA_3: + case AltosLib.AO_LOG_FORMAT_EASYMEGA_2: return data32(16); case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD: return data16(14); @@ -43,6 +44,7 @@ public class AltosEepromRecordMega extends AltosEepromRecord { switch (log_format) { case AltosLib.AO_LOG_FORMAT_TELEMEGA: case AltosLib.AO_LOG_FORMAT_TELEMEGA_3: + case AltosLib.AO_LOG_FORMAT_EASYMEGA_2: return data32(20); case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD: return data16(16); @@ -54,6 +56,7 @@ public class AltosEepromRecordMega extends AltosEepromRecord { switch (log_format) { case AltosLib.AO_LOG_FORMAT_TELEMEGA: case AltosLib.AO_LOG_FORMAT_TELEMEGA_3: + case AltosLib.AO_LOG_FORMAT_EASYMEGA_2: return data32(24); case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD: return data16(18); @@ -78,6 +81,98 @@ public class AltosEepromRecordMega extends AltosEepromRecord { private int mag_x() { return data16(20); } private int mag_z() { return data16(22); } private int mag_y() { return data16(24); } + + private int accel_across() { + switch (log_format) { + case AltosLib.AO_LOG_FORMAT_TELEMEGA: + case AltosLib.AO_LOG_FORMAT_TELEMEGA_3: + case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD: + return accel_x(); + case AltosLib.AO_LOG_FORMAT_EASYMEGA_2: + return -accel_y(); + default: + return AltosLib.MISSING; + } + } + + private int accel_along(){ + switch (log_format) { + case AltosLib.AO_LOG_FORMAT_TELEMEGA: + case AltosLib.AO_LOG_FORMAT_TELEMEGA_3: + case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD: + return accel_y(); + case AltosLib.AO_LOG_FORMAT_EASYMEGA_2: + return accel_x(); + default: + return AltosLib.MISSING; + } + } + + private int accel_through() { + return accel_z(); + } + + private int gyro_pitch() { + switch (log_format) { + case AltosLib.AO_LOG_FORMAT_TELEMEGA: + case AltosLib.AO_LOG_FORMAT_TELEMEGA_3: + case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD: + return gyro_x(); + case AltosLib.AO_LOG_FORMAT_EASYMEGA_2: + return -gyro_y(); + default: + return AltosLib.MISSING; + } + } + + private int gyro_roll() { + switch (log_format) { + case AltosLib.AO_LOG_FORMAT_TELEMEGA: + case AltosLib.AO_LOG_FORMAT_TELEMEGA_3: + case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD: + return gyro_y(); + case AltosLib.AO_LOG_FORMAT_EASYMEGA_2: + return gyro_x(); + default: + return AltosLib.MISSING; + } + } + + private int gyro_yaw() { + return gyro_z(); + } + + private int mag_across() { + switch (log_format) { + case AltosLib.AO_LOG_FORMAT_TELEMEGA: + case AltosLib.AO_LOG_FORMAT_TELEMEGA_3: + case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD: + return mag_x(); + case AltosLib.AO_LOG_FORMAT_EASYMEGA_2: + return -mag_y(); + default: + return AltosLib.MISSING; + } + } + + private int mag_along() { + switch (log_format) { + case AltosLib.AO_LOG_FORMAT_TELEMEGA: + case AltosLib.AO_LOG_FORMAT_TELEMEGA_3: + case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD: + return mag_y(); + case AltosLib.AO_LOG_FORMAT_EASYMEGA_2: + return mag_y(); + default: + return AltosLib.MISSING; + } + } + + private int mag_through() { + return mag_z(); + } + + private int accel() { return data16(26); } /* AO_LOG_TEMP_VOLT elements */ @@ -138,16 +233,16 @@ public class AltosEepromRecordMega extends AltosEepromRecord { listener.set_pressure(pt.pres); listener.set_temperature(pt.temp); - int accel_along = accel_y(); - int accel_across = accel_x(); - int accel_through = accel_z(); - int gyro_roll = gyro_y(); - int gyro_pitch = gyro_x(); - int gyro_yaw = gyro_z(); + int accel_along = accel_along(); + int accel_across = accel_across(); + int accel_through = accel_through(); + int gyro_roll = gyro_roll(); + int gyro_pitch = gyro_pitch(); + int gyro_yaw = gyro_yaw(); - int mag_along = mag_y(); - int mag_across = mag_x(); - int mag_through = mag_z(); + int mag_along = mag_along(); + int mag_across = mag_across(); + int mag_through = mag_through(); if (log_format == AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD) cal_data.check_imu_wrap(gyro_roll, gyro_pitch, gyro_yaw); diff --git a/altoslib/AltosEepromRecordSet.java b/altoslib/AltosEepromRecordSet.java index 27f81df6..e26a1e00 100644 --- a/altoslib/AltosEepromRecordSet.java +++ b/altoslib/AltosEepromRecordSet.java @@ -71,6 +71,7 @@ public class AltosEepromRecordSet implements AltosRecordSet { case AltosLib.AO_LOG_FORMAT_TELEMEGA: case AltosLib.AO_LOG_FORMAT_TELEMEGA_3: case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD: + case AltosLib.AO_LOG_FORMAT_EASYMEGA_2: record = new AltosEepromRecordMega(eeprom); break; case AltosLib.AO_LOG_FORMAT_TELEMETRUM: diff --git a/altoslib/AltosLib.java b/altoslib/AltosLib.java index 8b0170ae..93567c06 100644 --- a/altoslib/AltosLib.java +++ b/altoslib/AltosLib.java @@ -374,6 +374,7 @@ public class AltosLib { public static final int AO_LOG_FORMAT_TELEFIRETWO = 13; public static final int AO_LOG_FORMAT_EASYMINI2 = 14; public static final int AO_LOG_FORMAT_TELEMEGA_3 = 15; + public static final int AO_LOG_FORMAT_EASYMEGA_2 = 16; public static final int AO_LOG_FORMAT_NONE = 127; public static boolean isspace(int c) { -- cgit v1.2.3 From 345e3c37a1cf619392b54589bb91b4caf7844810 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 20 Oct 2018 17:26:53 -0700 Subject: altos/easymega-v2.0: Handle different mpu9250 orientation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mpu9250 on EasyMega v2.0 is rotated 90° compared with EasyMega v1 and TeleMega IMU devices. Signed-off-by: Keith Packard --- src/easymega-v2.0/ao_pins.h | 14 +++++++++++++- src/kernel/ao_data.h | 4 ++++ src/kernel/ao_log.h | 3 ++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/easymega-v2.0/ao_pins.h b/src/easymega-v2.0/ao_pins.h index 6217b5d2..399654f0 100644 --- a/src/easymega-v2.0/ao_pins.h +++ b/src/easymega-v2.0/ao_pins.h @@ -69,7 +69,7 @@ #define AO_CONFIG_MAX_SIZE 1024 #define LOG_ERASE_MARK 0x55 #define LOG_MAX_ERASE 128 -#define AO_LOG_FORMAT AO_LOG_FORMAT_TELEMEGA +#define AO_LOG_FORMAT AO_LOG_FORMAT_EASYMEGA_2 #define HAS_EEPROM 1 #define USE_INTERNAL_FLASH 0 @@ -306,6 +306,18 @@ struct ao_adc { #define AO_MPU9250_SPI_CS_PIN 13 #define HAS_IMU 1 +#define ao_data_along(packet) ((packet)->mpu9250.accel_x) +#define ao_data_across(packet) (-(packet)->mpu9250.accel_y) +#define ao_data_through(packet) ((packet)->mpu9250.accel_z) + +#define ao_data_roll(packet) ((packet)->mpu9250.gyro_x) +#define ao_data_pitch(packet) (-(packet)->mpu9250.gyro_y) +#define ao_data_yaw(packet) ((packet)->mpu9250.gyro_z) + +#define ao_data_mag_along(packet) ((packet)->mpu9250.mag_y) +#define ao_data_mag_across(packet) (-(packet)->mpu9250.mag_x) +#define ao_data_mag_through(packet) ((packet)->mpu9250.mag_z) + /* ADXL375 */ #define HAS_ADXL375 1 diff --git a/src/kernel/ao_data.h b/src/kernel/ao_data.h index 3918f4e0..dda5de4c 100644 --- a/src/kernel/ao_data.h +++ b/src/kernel/ao_data.h @@ -382,6 +382,7 @@ typedef int16_t angle_t; /* in degrees */ /* X axis is aligned in the other board axis (across) */ /* Z axis is aligned perpendicular to the board (through) */ +#ifndef ao_data_along #define ao_data_along(packet) ((packet)->mpu9250.accel_y) #define ao_data_across(packet) ((packet)->mpu9250.accel_x) #define ao_data_through(packet) ((packet)->mpu9250.accel_z) @@ -389,6 +390,7 @@ typedef int16_t angle_t; /* in degrees */ #define ao_data_roll(packet) ((packet)->mpu9250.gyro_y) #define ao_data_pitch(packet) ((packet)->mpu9250.gyro_x) #define ao_data_yaw(packet) ((packet)->mpu9250.gyro_z) +#endif static inline float ao_convert_gyro(float sensor) { @@ -425,9 +427,11 @@ typedef int16_t ao_mag_t; /* in raw sample units */ * sensors. Also, the Z axis is flipped in sign. */ +#ifndef ao_data_mag_along #define ao_data_mag_along(packet) ((packet)->mpu9250.mag_x) #define ao_data_mag_across(packet) ((packet)->mpu9250.mag_y) #define ao_data_mag_through(packet) ((packet)->mpu9250.mag_z) +#endif #endif diff --git a/src/kernel/ao_log.h b/src/kernel/ao_log.h index a9715962..04f00d3e 100644 --- a/src/kernel/ao_log.h +++ b/src/kernel/ao_log.h @@ -55,6 +55,7 @@ extern enum ao_flight_state ao_log_state; #define AO_LOG_FORMAT_TELEFIRETWO 13 /* 32-byte test stand data */ #define AO_LOG_FORMAT_EASYMINI2 14 /* 16-byte MS5607 baro only, 3.3V supply, stm32f042 SoC */ #define AO_LOG_FORMAT_TELEMEGA_3 15 /* 32 byte typed telemega records with 32 bit gyro cal and mpu9250 */ +#define AO_LOG_FORMAT_EASYMEGA_2 16 /* 32 byte typed telemega records with 32 bit gyro cal, mpu9250 rotated 90° and adxl375 */ #define AO_LOG_FORMAT_NONE 127 /* No log at all */ /* Return the flight number from the given log slot, 0 if none, -slot on failure */ @@ -474,7 +475,7 @@ struct ao_log_gps { } u; }; -#if AO_LOG_FORMAT == AO_LOG_FOMAT_TELEMEGA_OLD || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA_3 +#if AO_LOG_FORMAT == AO_LOG_FOMAT_TELEMEGA_OLD || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA_3 || AO_LOG_FORMAT == AO_LOG_FORMAT_EASYMEGA_2 typedef struct ao_log_mega ao_log_type; #endif -- cgit v1.2.3 From 48e221cca00c9f925ff57588dd782842705f7a23 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 20 Oct 2018 17:29:36 -0700 Subject: altoslib: When flashing hardware, pull USB data from device if needed If we fail to extract USB vid/pid and product values from the device ROM, use the data discovered over USB when the device was originally discovered. Also, use the USB product to select appropriate .ihx files instead of only using the USB vid/pid. This will help people avoid using the wrong file when reflashing devices. Signed-off-by: Keith Packard --- altoslib/AltosFlash.java | 6 ++++- altoslib/AltosHexsym.java | 6 ++++- altoslib/AltosProgrammer.java | 2 +- altoslib/AltosRomconfig.java | 10 +++++++- altoslib/AltosSelfFlash.java | 6 ++++- altosuilib/AltosDeviceUIDialog.java | 51 +++++++++++++++++++++++++++---------- altosuilib/AltosFlashUI.java | 44 +++++++++++++++----------------- altosuilib/AltosUSBDevice.java | 9 +++++++ 8 files changed, 92 insertions(+), 42 deletions(-) diff --git a/altoslib/AltosFlash.java b/altoslib/AltosFlash.java index e6b05713..434a0265 100644 --- a/altoslib/AltosFlash.java +++ b/altoslib/AltosFlash.java @@ -331,9 +331,13 @@ public class AltosFlash extends AltosProgrammer { rom_config = romconfig; } - public AltosRomconfig target_romconfig() throws InterruptedException { + public AltosRomconfig target_romconfig(AltosUsbId usb_id, String usb_product) throws InterruptedException { if (!check_rom_config()) return null; + if (rom_config.usb_id == null) + rom_config.usb_id = usb_id; + if (rom_config.usb_product == null) + rom_config.usb_product = usb_product; return rom_config; } diff --git a/altoslib/AltosHexsym.java b/altoslib/AltosHexsym.java index b1323484..a2ba6935 100644 --- a/altoslib/AltosHexsym.java +++ b/altoslib/AltosHexsym.java @@ -24,8 +24,12 @@ public class AltosHexsym { final static long invalid_addr = 0xffffffff; + public String toString() { + return String.format("%s:0x%x", name, address); + } + public AltosHexsym(String name, long address) { this.name = name; this.address = address; } -} \ No newline at end of file +} diff --git a/altoslib/AltosProgrammer.java b/altoslib/AltosProgrammer.java index 1872392d..f87e334c 100644 --- a/altoslib/AltosProgrammer.java +++ b/altoslib/AltosProgrammer.java @@ -28,7 +28,7 @@ public abstract class AltosProgrammer { abstract public void abort(); - abstract public AltosRomconfig target_romconfig() throws InterruptedException; + abstract public AltosRomconfig target_romconfig(AltosUsbId usb_id, String usb_product) throws InterruptedException; abstract public AltosRomconfig image_romconfig(); diff --git a/altoslib/AltosRomconfig.java b/altoslib/AltosRomconfig.java index ebeb76f3..00811ce7 100644 --- a/altoslib/AltosRomconfig.java +++ b/altoslib/AltosRomconfig.java @@ -273,6 +273,14 @@ public class AltosRomconfig implements AltosUnitInfoListener { throw new IOException("writing new rom config failed\n"); } + public String toString() { + return String.format("valid %b version %d serial %d radio %d usb %04x:%04x %s", + valid, version, serial_number, radio_calibration, + usb_id == null ? 0 : usb_id.vid, + usb_id == null ? 0 : usb_id.pid, + usb_product == null ? "unknown" : usb_product); + } + public AltosRomconfig(int in_serial_number, int in_radio_calibration) { valid = true; version = 1; @@ -282,7 +290,7 @@ public class AltosRomconfig implements AltosUnitInfoListener { } public boolean valid() { - return valid && serial_number != 0; + return valid; } public AltosRomconfig() { diff --git a/altoslib/AltosSelfFlash.java b/altoslib/AltosSelfFlash.java index 0250cce7..70a5ced5 100644 --- a/altoslib/AltosSelfFlash.java +++ b/altoslib/AltosSelfFlash.java @@ -184,9 +184,13 @@ public class AltosSelfFlash extends AltosProgrammer { rom_config = romconfig; } - public AltosRomconfig target_romconfig() throws InterruptedException { + public AltosRomconfig target_romconfig(AltosUsbId usb_id, String usb_product) throws InterruptedException { if (!check_rom_config()) return null; + if (rom_config.usb_id == null) + rom_config.usb_id = usb_id; + if (rom_config.usb_product == null) + rom_config.usb_product = usb_product; return rom_config; } diff --git a/altosuilib/AltosDeviceUIDialog.java b/altosuilib/AltosDeviceUIDialog.java index 93ab178f..8ea9e233 100644 --- a/altosuilib/AltosDeviceUIDialog.java +++ b/altosuilib/AltosDeviceUIDialog.java @@ -24,27 +24,39 @@ import java.awt.event.*; public class AltosDeviceUIDialog extends AltosDeviceDialog { + boolean include_bluetooth; + public AltosDevice[] devices() { java.util.List usb_devices = AltosUSBDevice.list(product); int num_devices = usb_devices.size(); - java.util.List bt_devices = AltosBTKnown.bt_known().list(product); - num_devices += bt_devices.size(); + + java.util.List bt_devices = null; + + if (include_bluetooth) { + bt_devices = AltosBTKnown.bt_known().list(product); + num_devices += bt_devices.size(); + } + AltosDevice[] devices = new AltosDevice[num_devices]; for (int i = 0; i < usb_devices.size(); i++) devices[i] = usb_devices.get(i); - int off = usb_devices.size(); - for (int j = 0; j < bt_devices.size(); j++) - devices[off + j] = bt_devices.get(j); + if (include_bluetooth) { + int off = usb_devices.size(); + for (int j = 0; j < bt_devices.size(); j++) + devices[off + j] = bt_devices.get(j); + } return devices; } public void add_bluetooth() { - JButton manage_bluetooth_button = new JButton("Manage Bluetooth"); - manage_bluetooth_button.setActionCommand("manage"); - manage_bluetooth_button.addActionListener(this); - buttonPane.add(manage_bluetooth_button); - buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); + if (include_bluetooth) { + JButton manage_bluetooth_button = new JButton("Manage Bluetooth"); + manage_bluetooth_button.setActionCommand("manage"); + manage_bluetooth_button.addActionListener(this); + buttonPane.add(manage_bluetooth_button); + buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); + } } public void actionPerformed(ActionEvent e) { @@ -55,16 +67,29 @@ public class AltosDeviceUIDialog extends AltosDeviceDialog { } } - public AltosDeviceUIDialog (Frame in_frame, Component location, int in_product) { + public AltosDeviceUIDialog (Frame in_frame, Component location, int in_product, boolean include_bluetooth) { super(in_frame, location, in_product); + this.include_bluetooth = include_bluetooth; } - public static AltosDevice show (Component frameComp, int product) { + public AltosDeviceUIDialog (Frame in_frame, Component location, int in_product) { + this(in_frame, location, in_product, true); + } + + public static AltosDevice show (Component frameComp, int product, boolean include_bluetooth) { Frame frame = JOptionPane.getFrameForComponent(frameComp); AltosDeviceUIDialog dialog; - dialog = new AltosDeviceUIDialog(frame, frameComp, product); + dialog = new AltosDeviceUIDialog(frame, frameComp, product, include_bluetooth); dialog.setVisible(true); return dialog.getValue(); } + + public static AltosDevice show (Component frameComp, int product) { + return show(frameComp, product, true); + } + + public static AltosUSBDevice show_usb (Component frameComp, int product) { + return (AltosUSBDevice) show(frameComp, product, false); + } } diff --git a/altosuilib/AltosFlashUI.java b/altosuilib/AltosFlashUI.java index b91776aa..ffb39b8c 100644 --- a/altosuilib/AltosFlashUI.java +++ b/altosuilib/AltosFlashUI.java @@ -45,7 +45,7 @@ public class AltosFlashUI File file; // Debug connection - AltosDevice device; + AltosUSBDevice device; AltosLink link; @@ -205,14 +205,20 @@ public class AltosFlashUI } static class AltosHexfileFilter extends javax.swing.filechooser.FileFilter { - int product; String head; String description; - public AltosHexfileFilter(int product, String head, String description) { - this.product = product; - this.head = head; - this.description = description; + public AltosHexfileFilter(String usb_product) { + int l; + + /* Trim off any trailing variants (1.0a vs 1.0) */ + for (l = usb_product.length(); l > 0; l--) { + char c = usb_product.charAt(l-1); + if (c < 'a' || 'z' < c) + break; + } + head = usb_product.substring(0, l).toLowerCase(); + description = String.format("%s Image File", usb_product); } public boolean accept(File file) { @@ -224,14 +230,6 @@ public class AltosFlashUI } } - static AltosHexfileFilter[] filters = { - new AltosHexfileFilter(AltosLib.product_telemetrum, "telemetrum", "TeleMetrum Image"), - new AltosHexfileFilter(AltosLib.product_teledongle, "teledongle", "TeleDongle Image"), - new AltosHexfileFilter(AltosLib.product_telemega, "telemega", "TeleMega Image"), - new AltosHexfileFilter(AltosLib.product_easymini, "easymini", "EasyMini Image"), - new AltosHexfileFilter(AltosLib.product_easymega, "easymega", "EasyMega Image"), - }; - boolean select_source_file() { JFileChooser hexfile_chooser = new JFileChooser(); @@ -241,18 +239,14 @@ public class AltosFlashUI hexfile_chooser.setDialogTitle("Select Flash Image"); - for (int i = 0; i < filters.length; i++) { - hexfile_chooser.addChoosableFileFilter(filters[i]); - } javax.swing.filechooser.FileFilter ihx_filter = new FileNameExtensionFilter("Flash Image", "ihx"); hexfile_chooser.addChoosableFileFilter(ihx_filter); hexfile_chooser.setFileFilter(ihx_filter); if (!is_pair_programmed() && !device.matchProduct(AltosLib.product_altusmetrum)) { - for (int i = 0; i < filters.length; i++) { - if (device != null && device.matchProduct(filters[i].product)) - hexfile_chooser.setFileFilter(filters[i]); - } + AltosHexfileFilter filter = new AltosHexfileFilter(device.usb_product()); + hexfile_chooser.addChoosableFileFilter(filter); + hexfile_chooser.setFileFilter(filter); } int returnVal = hexfile_chooser.showOpenDialog(frame); @@ -270,7 +264,7 @@ public class AltosFlashUI boolean select_device() { int product = AltosLib.product_any; - device = AltosDeviceUIDialog.show(frame, AltosLib.product_any); + device = AltosDeviceUIDialog.show_usb(frame, AltosLib.product_any); if (device == null) return false; @@ -393,10 +387,12 @@ public class AltosFlashUI else programmer = new AltosSelfFlash(ui.file, link, this); - final AltosRomconfig current_config = programmer.target_romconfig(); + final AltosRomconfig current_config = programmer.target_romconfig(device.usb_id(), device.usb_product()); final AltosRomconfig image_config = programmer.image_romconfig(); + System.out.printf("product %s current %s image %s\n", device.usb_product(), current_config, image_config); + final Semaphore await_rom_config = new Semaphore(0); SwingUtilities.invokeLater(new Runnable() { public void run() { @@ -539,7 +535,7 @@ public class AltosFlashUI } if (!matched) { System.out.printf("Identified new device %s\n", d.toShortString()); - device = d; + device = (AltosUSBDevice) d; break; } } diff --git a/altosuilib/AltosUSBDevice.java b/altosuilib/AltosUSBDevice.java index f43d6bef..e4b94eea 100644 --- a/altosuilib/AltosUSBDevice.java +++ b/altosuilib/AltosUSBDevice.java @@ -20,6 +20,7 @@ package org.altusmetrum.altosuilib_13; import java.util.*; import libaltosJNI.*; +import org.altusmetrum.altoslib_13.*; public class AltosUSBDevice extends altos_device implements AltosDevice { @@ -98,6 +99,14 @@ public class AltosUSBDevice extends altos_device implements AltosDevice { return getVendor() ^ getProduct() ^ getSerial() ^ getPath().hashCode(); } + public AltosUsbId usb_id() { + return new AltosUsbId(getVendor(), getProduct()); + } + + public String usb_product() { + return getName(); + } + public boolean equals(Object o) { if (o == null) return false; -- cgit v1.2.3 From 1812adbd61400af19293bf775e544baf661ec224 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 22 Oct 2018 16:47:20 -0700 Subject: Add keywords to .desktop files Makes applications easier to find with search Signed-off-by: Keith Packard --- altosui/altusmetrum-altosui.desktop.in | 1 + micropeak/altusmetrum-micropeak.desktop.in | 1 + telegps/altusmetrum-telegps.desktop.in | 1 + 3 files changed, 3 insertions(+) diff --git a/altosui/altusmetrum-altosui.desktop.in b/altosui/altusmetrum-altosui.desktop.in index 00f58ec6..0c2213a2 100644 --- a/altosui/altusmetrum-altosui.desktop.in +++ b/altosui/altusmetrum-altosui.desktop.in @@ -9,3 +9,4 @@ Exec=%bindir%/altosui %F Terminal=false MimeType=application/vnd.altusmetrum.telemetry;application/vnd.altusmetrum.eeprom Categories=Education;Electronics;Science; +Keywords=Rocket;Telemetry;GPS diff --git a/micropeak/altusmetrum-micropeak.desktop.in b/micropeak/altusmetrum-micropeak.desktop.in index 38b07f0e..4d02dbd8 100644 --- a/micropeak/altusmetrum-micropeak.desktop.in +++ b/micropeak/altusmetrum-micropeak.desktop.in @@ -8,3 +8,4 @@ Exec=%bindir%/micropeak %F Terminal=false MimeType=application/vnd.altusmetrum.micropeak Categories=Education;Electronics;Science; +Keywords=Rocket;Altimeter diff --git a/telegps/altusmetrum-telegps.desktop.in b/telegps/altusmetrum-telegps.desktop.in index f24556c1..0055a22d 100644 --- a/telegps/altusmetrum-telegps.desktop.in +++ b/telegps/altusmetrum-telegps.desktop.in @@ -8,3 +8,4 @@ Exec=%bindir%/telegps %F Terminal=false MimeType=application/vnd.altusmetrum.telemetry;application/vnd.altusmetrum.eeprom Categories=Education;Electronics;Science; +Keywords=Telemetry;GPS -- cgit v1.2.3 From cf7b2e065d844d290ee43449ae37162839220158 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 22 Oct 2018 16:48:04 -0700 Subject: ao-tools: Spelling fixes in a couple of man pages ao-dbg.1 and ao-eeprom.1 Signed-off-by: Keith Packard --- ao-tools/ao-dbg/ao-dbg.1 | 4 ++-- ao-tools/ao-eeprom/ao-eeprom.1 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ao-tools/ao-dbg/ao-dbg.1 b/ao-tools/ao-dbg/ao-dbg.1 index 00d3ac86..53e76649 100644 --- a/ao-tools/ao-dbg/ao-dbg.1 +++ b/ao-tools/ao-dbg/ao-dbg.1 @@ -105,7 +105,7 @@ product, leaving out the serial number will cause the tool to match one of the available devices. .SH COMMANDS Once started, ao-dbg connects to the cc1111 and then reads and -executes commands, either from stdin, or the nework connection to +executes commands, either from stdin, or the network connection to sdcdb. .PP Unlike the command line, ao-dbg contains built-in help for each of these @@ -208,7 +208,7 @@ pins and then change the Port 1 data to set them high or low: > set sfr 0x90 0x00 # set P1_1 to low .IP "Reading the A/D converters" The six A/D converter inputs can each be connected to any of the P0 pins, -ground, the A/D voltage refernece, an internal temperature sensor or VDD/3. +ground, the A/D voltage reference, an internal temperature sensor or VDD/3. To read one of these values, select an A/D converter to use then start the conversion process. The cc1111 manual has the table for selecting the input on page 144. diff --git a/ao-tools/ao-eeprom/ao-eeprom.1 b/ao-tools/ao-eeprom/ao-eeprom.1 index ed498147..728f11ed 100644 --- a/ao-tools/ao-eeprom/ao-eeprom.1 +++ b/ao-tools/ao-eeprom/ao-eeprom.1 @@ -52,6 +52,6 @@ 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. +eeprom to stdout in hexadecimal bytes. .SH AUTHOR Keith Packard -- cgit v1.2.3 From e9915aad4fe97cd253b88805646085c64181baef Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 22 Oct 2018 16:48:56 -0700 Subject: Don't force CFLAGS from top level Let the system defaults control this value. Signed-off-by: Keith Packard --- configure.ac | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.ac b/configure.ac index e888aa99..dc0a36ce 100644 --- a/configure.ac +++ b/configure.ac @@ -198,7 +198,6 @@ AC_PROG_LN_S AC_PROG_LIBTOOL PKG_PROG_PKG_CONFIG -CFLAGS="-g" WARN_CFLAGS="" if test "x$GCC" = "xyes"; then WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \ -- cgit v1.2.3 From cf3e524e50a6fae2862efb404c9918b74438e9c9 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 23 Oct 2018 16:07:09 -0700 Subject: Generate LED icons on the fly. Include SVG versions. This builds the required LED images from source code. Signed-off-by: Keith Packard --- icon/Makefile.am | 17 ++++- icon/grayled.png | Bin 1528 -> 0 bytes icon/grayon.png | Bin 1873 -> 0 bytes icon/greenled.png | Bin 2281 -> 0 bytes icon/greenoff.png | Bin 1811 -> 0 bytes icon/led.5c | 189 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ icon/redled.png | Bin 2103 -> 0 bytes icon/redoff.png | Bin 1694 -> 0 bytes 8 files changed, 205 insertions(+), 1 deletion(-) delete mode 100644 icon/grayled.png delete mode 100644 icon/grayon.png delete mode 100644 icon/greenled.png delete mode 100644 icon/greenoff.png create mode 100644 icon/led.5c delete mode 100644 icon/redled.png delete mode 100644 icon/redoff.png diff --git a/icon/Makefile.am b/icon/Makefile.am index af238ac4..6efe3ecf 100644 --- a/icon/Makefile.am +++ b/icon/Makefile.am @@ -27,6 +27,17 @@ EEPROM_ICON = $(EEPROM_NAME).svg TELEM_ICON = $(TELEM_NAME).svg MPD_ICON = $(MPD_NAME).svg +LED_SVG = \ + redoff.svg \ + greenoff.svg \ + greenled.svg \ + grayon.svg \ + grayled.svg \ + redled.svg +LED_PNG = $(LED_SVG:.svg=.png) + +LED_ICONS = $(LED_SVG) $(LED_PNG) + # Files needed for Mac OSX icons MAC_AM_FILES = $(shell for i in $(MAC_RES); do echo $(AM_NAME)-$$i.png; done) @@ -109,7 +120,7 @@ java-telegps: fat: all $(ICO_FILES) $(ICNS_FILES) $(EXE_FILES) -all-local: $(JAVA_FILES) $(AM_XPM) +all-local: $(JAVA_FILES) $(AM_XPM) $(LED_ICONS) clean-local: $(RM) $(AM_NAME)-*.png $(TG_NAME)-*.png $(MP_NAME)-*.png @@ -117,6 +128,7 @@ clean-local: $(RM) $(EEPROM_NAME)-*.png $(TELEM_NAME)-*.png $(MPD_NAME)-*.png $(RM) *.build *.ico *.rc *.icns *.o *.exe $(MPD_ICON) $(RM) altusmetrum.xpm + $(RM) $(LED_ICONS) if INSTALL_SHARED_MIME_INFO install-data-hook: @@ -124,6 +136,9 @@ install-data-hook: update-icon-caches $(DESTDIR)$(ICON_THEME) endif +$(LED_ICONS): led.5c + nickle led.5c $@ + $(MPD_ICON): $(MP_ICON) $(LN_S) $(MP_ICON) $@ diff --git a/icon/grayled.png b/icon/grayled.png deleted file mode 100644 index bb6005c6..00000000 Binary files a/icon/grayled.png and /dev/null differ diff --git a/icon/grayon.png b/icon/grayon.png deleted file mode 100644 index c99b376e..00000000 Binary files a/icon/grayon.png and /dev/null differ diff --git a/icon/greenled.png b/icon/greenled.png deleted file mode 100644 index d7663961..00000000 Binary files a/icon/greenled.png and /dev/null differ diff --git a/icon/greenoff.png b/icon/greenoff.png deleted file mode 100644 index c3cf8491..00000000 Binary files a/icon/greenoff.png and /dev/null differ diff --git a/icon/led.5c b/icon/led.5c new file mode 100644 index 00000000..cdbcdc79 --- /dev/null +++ b/icon/led.5c @@ -0,0 +1,189 @@ +/* + * Copyright © 2018 Keith Packard + * + * 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. + */ + +/* + * Generate LED images for rocketview and launchcontrol + */ + +autoimport Cairo; + +void led (cairo_t cr, real red, real green, real blue, bool on) +{ + translate (cr, .5, .5); + + /* basic unilluminated LED */ + + if (true) + { + set_source_rgb (cr, red *.4, green *.4, blue *.4); + move_to (cr, 1, 1/2); + arc (cr, .5, .5, .5, 0, pi*2); + fill (cr); + } + + /* Bright spot of LED illumination */ + if (on) + { + pattern_t led = Pattern::create_radial (1/2, 1/2, 0, + 1/2, 1/2, .4); + Pattern::add_color_stop_rgba (led, 0, red, green, blue, 1); + Pattern::add_color_stop_rgba (led, .5, red, green, blue, .8); + Pattern::add_color_stop_rgba (led, 1, red, green, blue, 0); + set_source (cr, led); + move_to (cr, 1, 1/2); + arc (cr, .5, .5, .5, 0, pi*2); + fill (cr); + } + + /* Bezel */ + if (true) + { + pattern_t ring = Pattern::create_radial (.5, .5, .4, .5, .5, .5); + Pattern::add_color_stop_rgba (ring, 0, 0, 0, 0, 1); + Pattern::add_color_stop_rgba (ring, .5, 0, 0, 0, 1); + Pattern::add_color_stop_rgba (ring, 1, .5, .5, .5, 1); + set_source (cr, ring); + move_to (cr, 1, 1/2); + arc (cr, .5, .5, .5, 0, pi*2); + move_to (cr, 1, 1/2); + arc_negative (cr, .5, .5, .45, pi*2, 0); + fill (cr); + } + + /* Specular highlight from room illumination */ + if (true) + { + pattern_t room = Pattern::create_radial (1/3, 1/3, 0, 1/3, 1/3, 1/2); + Pattern::add_color_stop_rgba (room, 0, 1, 1, 1, .4); + Pattern::add_color_stop_rgba (room, 1, 1, 1, 1, 0); + set_source (cr, room); + move_to (cr, 1, 1/2); + arc (cr, .5, .5, .5, 0, pi*2); + fill (cr); + } + +} + +/* + * Desired LED image size in pixels + */ +int diameter = 12; + +void do_one_svg (string name, real red, real green, real blue, bool on) +{ + cairo_t cr = new_svg (name, diameter, diameter); + + translate (cr, -width(cr)/2, -height(cr)/2); + scale (cr, width(cr), height(cr)); + led (cr, red, green, blue, on); + destroy (cr); +} + +void do_one_png (string name, real red, real green, real blue, bool on) +{ + cairo_t cr = new_image (diameter, diameter); + + translate (cr, -width(cr)/2, -height(cr)/2); + scale (cr, width(cr), height(cr)); + led (cr, red, green, blue, on); + write_to_png (cr, name); + destroy (cr); +} + +void do_one(string name, real red, real green, real blue, bool on) +{ + do_one_png(name + ".png", red, green, blue, on); + do_one_svg(name + ".svg", red, green, blue, on); +} + +void doit () +{ + do_one ("redled", 1, 0, 0, true); + do_one ("redoff", 1, 0, 0, false); + do_one ("greenled", 0, 1, .4824, true); + do_one ("greenoff", 0, 1, .4824, false); + do_one ("grayled", .9, .9, .9, false); + do_one ("grayon", .9, .9, .9, true); +} + +typedef struct { + real red, green, blue; + bool on; +} stock_t; + +stock_t[string] stock_leds = { + "redled" => { + .red = 1, + .green = 0, + .blue = 0, + .on = true + }, + "redoff" => { + .red = 1, + .green = 0, + .blue = 0, + .on = false + }, + "greenled" => { + .red = 0, + .green = 1, + .blue = .4824, + .on = true + }, + "greenoff" => { + .red = 0, + .green = 1, + .blue = .4824, + .on = false + }, + "grayon" => { + .red = .9, + .green = .9, + .blue = .9, + .on = true + }, + "grayled" => { + .red = .9, + .green = .9, + .blue = .9, + .on = false + }, +}; + +void main () +{ + for (int i = 1; i < dim(argv); i++) { + string name = argv[i]; + string[] bits = String::split(name, "."); + + if (dim(bits) != 2) { + File::fprintf(stderr, "Filename is weird: \"%s\"\n", argv[i]); + exit (1); + } + + stock_t stock = stock_leds[bits[0]]; + switch (bits[1]) { + case "png": + do_one_png(argv[i], stock.red, stock.green, stock.blue, stock.on); + break; + case "svg": + do_one_svg(argv[i], stock.red, stock.green, stock.blue, stock.on); + break; + } + } +} + +if (dim(argv) > 0) { + main(); +} diff --git a/icon/redled.png b/icon/redled.png deleted file mode 100644 index 230afae0..00000000 Binary files a/icon/redled.png and /dev/null differ diff --git a/icon/redoff.png b/icon/redoff.png deleted file mode 100644 index a251402f..00000000 Binary files a/icon/redoff.png and /dev/null differ -- cgit v1.2.3 From 6d80b89c0bd82133dd5c93df8604f562ac49c19a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 25 Oct 2018 16:50:17 -0700 Subject: doc: Switch to asciidoctor to format docs asciidoc and a2x are no longer actively maintained and Debian policy encourages people to move away from them to asciidoctor. Signed-off-by: Keith Packard --- doc/.gitignore | 1 + doc/Makefile.am | 93 +++++------ doc/altos.txt | 8 + doc/altosui.inc | 50 +++--- doc/altusmetrum-theme.yml | 61 +++++++ doc/altusmetrum.txt | 54 ++++--- doc/am-notoc.css | 334 +++++++++++++++++++++++++++++++++++++++ doc/am.css | 237 +++++++++------------------ doc/companion.txt | 9 ++ doc/config-device.inc | 4 +- doc/easymega-outline.txt | 3 +- doc/easymega.inc | 2 +- doc/easymini-device.inc | 2 +- doc/easymini-outline.txt | 3 +- doc/easymini-release-notes.inc | 26 +-- doc/easymini.txt | 41 +++-- doc/header.inc | 13 ++ doc/load-maps.inc | 2 +- doc/map-loading.txt | 8 + doc/micropeak-oneline.svg | 190 ++++++++++++---------- doc/micropeak.txt | 38 +++-- doc/release-head.inc | 7 + doc/release-notes-0.7.1.inc | 2 +- doc/release-notes-0.8.inc | 2 +- doc/release-notes-0.9.2.inc | 2 +- doc/release-notes-0.9.inc | 2 +- doc/release-notes-1.0.1.inc | 2 +- doc/release-notes-1.1.1.inc | 2 +- doc/release-notes-1.1.inc | 2 +- doc/release-notes-1.2.1.inc | 2 +- doc/release-notes-1.2.inc | 2 +- doc/release-notes-1.3.1.inc | 2 +- doc/release-notes-1.3.2.inc | 2 +- doc/release-notes-1.3.inc | 2 +- doc/release-notes-1.4.1.inc | 2 +- doc/release-notes-1.4.2.inc | 2 +- doc/release-notes-1.4.inc | 2 +- doc/release-notes-1.5.inc | 2 +- doc/release-notes-1.6.1.inc | 2 +- doc/release-notes-1.6.2.inc | 2 +- doc/release-notes-1.6.3.inc | 2 +- doc/release-notes-1.6.4.inc | 2 +- doc/release-notes-1.6.5.inc | 2 +- doc/release-notes-1.6.8.inc | 2 +- doc/release-notes-1.6.inc | 2 +- doc/release-notes-1.7.inc | 2 +- doc/release-notes-1.8.1.inc | 2 +- doc/release-notes-1.8.2.inc | 2 +- doc/release-notes-1.8.3.inc | 3 +- doc/release-notes-1.8.4.inc | 2 +- doc/release-notes-1.8.5.inc | 2 +- doc/release-notes-1.8.6.inc | 2 +- doc/release-notes-1.8.7.inc | 2 +- doc/release-notes-1.8.inc | 2 +- doc/release-notes.inc | 64 ++++---- doc/specs.inc | 16 +- doc/system-operation.inc | 2 +- doc/telegps-application.inc | 30 ++-- doc/telegps-outline.txt | 3 +- doc/telegps-release-notes.inc | 38 ++--- doc/telegps-system-operation.inc | 2 +- doc/telegps.txt | 32 ++-- doc/telemega-outline.txt | 3 +- doc/telemega.inc | 2 +- doc/telemetrum-outline.txt | 3 +- doc/telemetrum.inc | 8 +- doc/telemetry.txt | 11 ++ doc/telemini-v1-outline.txt | 4 +- doc/telemini-v3-outline.txt | 3 +- doc/telemini.inc | 6 +- doc/updating-firmware.inc | 4 + doc/using-am-products.inc | 2 + 72 files changed, 960 insertions(+), 524 deletions(-) create mode 100644 doc/altusmetrum-theme.yml create mode 100644 doc/am-notoc.css create mode 100644 doc/header.inc create mode 100644 doc/release-head.inc diff --git a/doc/.gitignore b/doc/.gitignore index 06ad43eb..27a951c4 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -2,6 +2,7 @@ *.pdf *.fo *.raw +*.adoc titlepage.templates.xsl fop-cfg.xml map-loading.svg diff --git a/doc/Makefile.am b/doc/Makefile.am index 450053f1..b5839bea 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,5 +1,15 @@ # -# http://docbook.sourceforge.net/release/xsl/current/README +# Copyright © 2018 Keith Packard +# +# 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. # if FAKETIME @@ -115,9 +125,11 @@ COMMON_INC_FILES=\ config-ui.inc \ load-maps.inc \ aprs-operation.inc \ - handling.inc + handling.inc \ + release-head.inc INC_FILES=\ + header.inc \ dedication.inc \ intro.inc \ getting-started.inc \ @@ -140,7 +152,7 @@ INC_FILES=\ release-notes.inc \ $(RELNOTES_INC) -RAW_FILES=$(TXT_FILES:.txt=.raw) $(INC_FILES:.inc=.raw) +ADOC_FILES=$(TXT_FILES:.txt=.adoc) $(INC_FILES:.inc=.adoc) TELEGPS_INC_FILES=\ telegps-dedication.inc \ @@ -156,14 +168,14 @@ TELEGPS_INC_FILES=\ TELEGPS_TXT_FILES=\ telegps.txt -TELEGPS_RAW_FILES=$(TELEGPS_TXT_FILES:.txt=.raw) $(TELEGPS_INC_FILES:.inc=.raw) +TELEGPS_ADOC_FILES=$(TELEGPS_TXT_FILES:.txt=.adoc) $(TELEGPS_INC_FILES:.inc=.adoc) MICROPEAK_TXT_FILES=\ micropeak.txt MICROPEAK_INC_FILES= -MICROPEAK_RAW_FILES=$(MICROPEAK_TXT_FILES:.txt=.raw) $(MICROPEAK_INC_FILES:.inc=.raw) +MICROPEAK_ADOC_FILES=$(MICROPEAK_TXT_FILES:.txt=.adoc) $(MICROPEAK_INC_FILES:.inc=.adoc) EASYMINI_TXT_FILES=\ easymini.txt @@ -171,7 +183,7 @@ EASYMINI_TXT_FILES=\ EASYMINI_INC_FILES=$(INC_FILES) easymini-release-notes.inc -EASYMINI_RAW_FILES=$(EASYMINI_TXT_FILES:.txt=.raw) $(EASYMINI_INC_FILES:.inc=.raw) +EASYMINI_ADOC_FILES=$(EASYMINI_TXT_FILES:.txt=.adoc) $(EASYMINI_INC_FILES:.inc=.adoc) OUTLINE_TXT_FILES=\ easymega-outline.txt \ @@ -182,7 +194,7 @@ OUTLINE_TXT_FILES=\ telemini-v3-outline.txt \ telegps-outline.txt -OUTLINE_RAW_FILES=$(OUTLINE_TXT_FILES:.txt=.raw) +OUTLINE_ADOC_FILES=$(OUTLINE_TXT_FILES:.txt=.adoc) OUTLINE_PDF_FILES=$(OUTLINE_TXT_FILES:.txt=.pdf) @@ -202,7 +214,7 @@ ONEFILE_TXT_FILES=\ telemetry.txt \ map-loading.txt -ONEFILE_RAW_FILES=$(ONEFILE_TXT_FILES:.txt=.raw) +ONEFILE_ADOC_FILES=$(ONEFILE_TXT_FILES:.txt=.adoc) ONEFILE_PDF_FILES=$(ONEFILE_TXT_FILES:.txt=.pdf) ONEFILE_HTML_FILES=$(ONEFILE_TXT_FILES:.txt=.html) @@ -212,22 +224,12 @@ PUBLISH_HTML=altusmetrum.html micropeak.html telegps.html easymini.html $(ONEFIL HTML=$(PUBLISH_HTML) $(RELNOTES_HTML) -HTML_REVHISTORY=\ - altusmetrum-revhistory.html \ - micropeak-revhistory.html \ - telegps-revhistory.html \ - easymini-revhistory.html - PDF=altusmetrum.pdf micropeak.pdf telegps.pdf easymini.pdf $(ONEFILE_PDF_FILES) \ $(OUTLINE_PDF_FILES) MAP_DOT_FILES=map-loading.dot MAP_SVG_FILES=$(MAP_DOT_FILES:.dot=.svg) -FOP_STYLE=am-fo.xsl -HTML_STYLE=am-html.xsl -COMMON_STYLE=common.xsl -FOP_XCONF=fop.xconf -STYLESHEET=am.css +STYLESHEET=am.css am-notoc.css FONTS=\ fonts/DejaVuSansMono-BoldOblique.ttf \ @@ -241,56 +243,41 @@ FONTS=\ fonts/OpenSans-Semibold.ttf \ fonts/OpenSans-SemiboldItalic.ttf -TEMPLATES_TMPL=titlepage.templates.tmpl - -TEMPLATES_XSL=$(TEMPLATES_TMPL:.tmpl=.xsl) - -PDF_CONFIG_FILES=$(FOP_STYLE) $(COMMON_STYLE) $(FOP_XCONF) $(TEMPLATES_XSL) -HTML_CONFIG_FILES=$(HTML_STYLE) $(COMMON_STYLE) $(TEMPLATES_XSL) +PDF_CONFIG_FILES=altusmetrum-theme.yml +HTML_CONFIG_FILES= -PUBLISH_DOC=$(PUBLISH_HTML) $(HTML_REVHISTORY) $(PDF) $(IMAGES) $(STYLESHEET) +PUBLISH_DOC=$(PUBLISH_HTML) $(PDF) $(IMAGES) $(MAP_SVG_FILES) $(STYLESHEET) -DOC=$(HTML) $(HTML_REVHISTORY) $(PDF) $(IMAGES) $(STYLESHEET) +DOC=$(HTML) $(PDF) $(IMAGES) $(MAP_SVG_FILES) $(STYLESHEET) -SUFFIXES = .dot .svg .tmpl .xsl .inc .txt .raw .pdf .html +SUFFIXES = .dot .svg .inc .txt .adoc .pdf .html .dot.svg: dot -Tsvg -o$@ $*.dot -.txt.raw: +.txt.adoc: sed -e 's/^[ ]*//' -e 's/^\\//' $*.txt > $@ -.inc.raw: +.inc.adoc: sed -e 's/^[ ]*//' -e 's/^\\//' $*.inc > $@ -.raw.html: - a2x -a docinfo -f xhtml --xsltproc-opts "--stringparam toc.section.depth 2" --xsl-file $(HTML_STYLE) --stylesheet=$(STYLESHEET) $*.raw - case $* in release-notes*) ./fix-html $*.html ;; esac - $(FAKETIME) a2x -a docinfo -f pdf --xsltproc-opts "--stringparam toc.section.depth 2" --xsl-file $(FOP_STYLE) --fop --fop-opts="-c $(FOP_XCONF)" $*.raw +.adoc.html: + asciidoctor -b html5 $*.adoc -.html.pdf: - echo $@ - -.tmpl.xsl: - xsltproc --output $@ /usr/share/xml/docbook/stylesheet/docbook-xsl/template/titlepage.xsl $*.tmpl +.adoc.pdf: + asciidoctor-pdf $*.adoc all: $(HTML) $(PDF) -map-loading.raw: $(MAP_SVG_FILES) - -altusmetrum-revhistory.html: altusmetrum.html - -micropeak-revhistory.html: micropeak.html - -telegps-revhistory.html: telegps.html +map-loading.adoc: $(MAP_SVG_FILES) -altusmetrum.pdf altusmetrum.html: altusmetrum-docinfo.xml $(RAW_FILES) $(IMAGES) +altusmetrum.pdf altusmetrum.html: altusmetrum-docinfo.xml $(ADOC_FILES) $(IMAGES) -telegps.html telegps.pdf: telegps-docinfo.xml $(TELEGPS_RAW_FILES) $(IMAGES) +telegps.html telegps.pdf: telegps-docinfo.xml $(TELEGPS_ADOC_FILES) $(IMAGES) -micropeak.pdf micropeak.html: micropeak-docinfo.xml $(MICROPEAK_RAW_FILES) $(IMAGES) +micropeak.pdf micropeak.html: micropeak-docinfo.xml $(MICROPEAK_ADOC_FILES) $(IMAGES) -easymini.pdf easymini.html: easymini-docinfo.xml $(EASYMINI_RAW_FILES) $(IMAGES) +easymini.pdf easymini.html: easymini-docinfo.xml $(EASYMINI_ADOC_FILES) $(IMAGES) telemini-v1-outline.pdf: telemini-v1-outline.txt telemini-v1.svg @@ -311,12 +298,12 @@ publish: $(PUBLISH_DOC) $(FONTS) git commit -F - $(WEB_ROOT)/altusmetrum/AltOS/doc/* $(WEB_ROOT)/altusmetrum/AltOS/doc/fonts/* ; \ git push) -publish-keithp: am.html $(PUBLISH_DOC) $(FONTS) - scp -p am.html $(PUBLISH_DOC) keithp.com:~keithp/public_html/altos +publish-keithp: am.html $(DOC) $(FONTS) + scp -p am.html $(DOC) keithp.com:~keithp/public_html/altos scp -p $(FONTS) keithp.com:~keithp/public_html/altos/fonts clean: - rm -f am.html $(HTML) $(HTML_REVHISTORY) $(PDF) $(TEMPLATES_XSL) $(RAW_FILES) $(TELEGPS_RAW_FILES) $(MICROPEAK_RAW_FILES) + rm -f am.html $(HTML) $(PDF) $(ADOC_FILES) $(TELEGPS_ADOC_FILES) $(MICROPEAK_ADOC_FILES) distclean: clean rm -f $(HTML) $(PDF) diff --git a/doc/altos.txt b/doc/altos.txt index f2b1ee59..9d12f12b 100644 --- a/doc/altos.txt +++ b/doc/altos.txt @@ -1,7 +1,15 @@ = AltOS +Keith Packard :doctype: book :toc: +:stylesheet: am.css +:linkcss: :numbered: +:pdf-stylesdir: . +:pdf-style: altusmetrum +:pdf-fontsdir: fonts + + include::header.adoc[] == Overview diff --git a/doc/altosui.inc b/doc/altosui.inc index adce6f27..44f77aca 100644 --- a/doc/altosui.inc +++ b/doc/altosui.inc @@ -1,7 +1,7 @@ == AltosUI .AltosUI Main Window - image::altosui.png[width="4.6in"] + image::altosui.png[width=450] The AltosUI program provides a graphical user interface for interacting with the Altus Metrum product family. AltosUI can @@ -12,10 +12,8 @@ the tasks provided from the top-level toolbar. ifdef::radio[] + === Monitor Flight - //// - Receive, Record and Display Telemetry Data - //// Selecting this item brings up a dialog box listing all of the connected TeleDongle devices. When you choose @@ -24,7 +22,7 @@ device. .Device Selection Dialog - image::device-selection.png[width="3.1in"] + image::device-selection.png[width=300] All telemetry data received are automatically recorded in suitable log files. The name of the files includes @@ -84,7 +82,7 @@ ==== Launch Pad .Monitor Flight Launch Pad View - image::launch-pad.png[width="5.5in"] + image::launch-pad.png[width=400] The 'Launch Pad' tab shows information used to decide when the rocket is ready for flight. The first elements include red/green @@ -146,7 +144,7 @@ ==== Ascent .Monitor Flight Ascent View - image::ascent.png[width="5.5in"] + image::ascent.png[width=400] This tab is shown during Boost, Fast and Coast phases. The information displayed here helps monitor the @@ -170,7 +168,7 @@ ==== Descent .Monitor Flight Descent View - image::descent.png[width="5.5in"] + image::descent.png[width=400] Once the rocket has reached apogee and (we hope) activated the apogee charge, attention switches to @@ -209,7 +207,7 @@ ==== Landed .Monitor Flight Landed View - image::landed.png[width="5.5in"] + image::landed.png[width=400] Once the rocket is on the ground, attention switches to recovery. While the radio signal is often lost once @@ -246,7 +244,7 @@ ==== Table .Monitor Flight Table View - image::table.png[width="5.5in"] + image::table.png[width=400] The table view shows all of the data available from the flight computer. Probably the most useful data on @@ -257,7 +255,7 @@ ==== Site Map .Monitor Flight Site Map View - image::site-map.png[width="5.5in"] + image::site-map.png[width=400] When the TeleMetrum has a GPS fix, the Site Map tab will map the rocket's position to make it easier for @@ -291,7 +289,7 @@ ==== Igniter .Monitor Flight Additional Igniter View - image::ignitor.png[width="5.5in"] + image::ignitor.png[width=400] TeleMega includes four additional programmable pyro channels. The Ignitor tab shows whether each of them has @@ -299,6 +297,7 @@ voltage measured here will be close to the pyro battery voltage. A value greater than 3.2V is required for a 'GO' status. + endif::radio[] @@ -375,7 +374,7 @@ ==== Flight Graph .Flight Data Graph - image::graph.png[width="5.5in"] + image::graph.png[width=400] By default, the graph contains acceleration (blue), velocity (green) and altitude (red). @@ -392,7 +391,7 @@ ==== Configure Graph .Flight Graph Configuration - image::graph-configure.png[width="5.5in"] + image::graph-configure.png[width=400] This selects which graph elements to show, and, at the very bottom. It also lets you configure how @@ -420,7 +419,7 @@ ==== Flight Statistics .Flight Statistics - image::graph-stats.png[width="5.5in"] + image::graph-stats.png[width=400] Shows overall data computed from the flight. @@ -428,7 +427,7 @@ ==== Map .Flight Map - image::graph-map.png[width="5.5in"] + image::graph-map.png[width=400] Shows a satellite image of the flight area overlaid with the path of the flight. The red concentric @@ -481,7 +480,7 @@ === Configure Altimeter .Altimeter Configuration - image::configure-altimeter.png[width="3.6in"] + image::configure-altimeter.png[width=350] ifdef::radio[] Select this button and then select either an altimeter or @@ -523,24 +522,25 @@ The rest of the dialog contains the parameters to be configured. - include::config-device.raw[] + include::config-device.adoc[] === Configure AltosUI .Configure AltosUI Dialog - image::configure-altosui.png[width="2.4in"] + image::configure-altosui.png[width=230] This button presents a dialog so that you can configure the AltosUI global settings. - include::config-ui.raw[] + include::config-ui.adoc[] ifdef::radio[] + === Configure Groundstation .Configure Groundstation Dialog - image::configure-groundstation.png[width="3.1in"] + image::configure-groundstation.png[width=300] Select this button and then select a TeleDongle or TeleBT Device from the list provided. @@ -631,7 +631,7 @@ === Fire Igniter .Fire Igniter Window - image::fire-igniter.png[width="1.2in"] + image::fire-igniter.png[width=120] This activates the igniter circuits in the flight computer to help test recovery systems @@ -663,7 +663,7 @@ === Scan Channels .Scan Channels Window - image::scan-channels.png[width="3.2in"] + image::scan-channels.png[width=300] This listens for telemetry packets on all of the configured frequencies, displaying information about @@ -675,14 +675,14 @@ endif::radio[] ifdef::gps[] - include::load-maps.raw[] + include::load-maps.adoc[] endif::gps[] ifdef::radio[] === Monitor Idle .Monitor Idle Window - image::monitor-idle.png[width="5.2in"] + image::monitor-idle.png[width=500] This brings up a dialog similar to the Monitor Flight UI, except it works with the altimeter in “idle” mode diff --git a/doc/altusmetrum-theme.yml b/doc/altusmetrum-theme.yml new file mode 100644 index 00000000..f13fa597 --- /dev/null +++ b/doc/altusmetrum-theme.yml @@ -0,0 +1,61 @@ +base: + font_family: Open Sans Light +heading: + font_color: #78079a + font_size: 17 +font: + catalog: + Open Sans Light: + normal: OpenSans-Light.ttf + italic: OpenSans-LightItalic.ttf + bold: OpenSans-Semibold.ttf + bold_italic: OpenSans-SemiboldItalic.ttf + DejaVu Sans Mono: + normal: DejaVuSansMono.ttf + italic: DejaVuSansMono-Oblique.ttf + bold: DejaVuSansMono-Bold.ttf + bold_italic: DejaVuSansMono-BoldOblique.ttf +title_page: + align: right + logo: + top: 10% + title: + top: 75% + font_size: $heading_h1_font_size + font_color: #000000 + font_style: bold + line_height: 0.9 + subtitle: + font_size: $heading_h3_font_size + font_style: bold_italic + line_height: 1 + authors: + margin_top: $base_font_size * 1.25 + font_size: $base_font_size * 1.5 + font_color: #000000 + revision: + margin_top: $base_font_size * 1.25 +admonition_label: + font_color: #c70909 + font_style: bold + font_size: $heading_h2_font_size +page: + background_color: ffffff + layout: portrait + margin: [0.5in, 0.67in, 0.75in, 0.67in] + size: letter +footer: + height: 0.5in + border_color: #78079a + recto: + left: + content: '{page-number}' + right: + content: '© 2018 Bdale Garbee and Keith Packard. Creative Commons ShareAlike 3.0 License' + verso: + left: + content: $footer_recto_right_content + right: + content: '{page-number}' +literal: + font_family: DejaVu Sans Mono diff --git a/doc/altusmetrum.txt b/doc/altusmetrum.txt index 48211eb8..798301d2 100644 --- a/doc/altusmetrum.txt +++ b/doc/altusmetrum.txt @@ -1,6 +1,15 @@ -= The Altus Metrum System += The Altus Metrum System: An Owner's Manual for Altus Metrum Rocketry Electronics +Keith Packard ; Bdale Garbee ; Bob Finch; Anthony Towns +:title-logo-image: image:../themes/background.png[] +:revnumber: v1.8.7 +:revdate: 8 Oct 2018 +:revremark: Include TeleMega v3.0 firmware in release. Fix TeleBT v4.0 RF calibration to factory value when reflashing. Fix map images. Fix Mac OS X support. +:copyright: Bdale Garbee and Keith Packard 2018 :doctype: book :numbered: +:stylesheet: am.css +:linkcss: +:toc: :altusmetrum: 1 :radio: 1 :gps: 1 @@ -11,41 +20,46 @@ :easymega: 1 :telegps: 1 :application: AltosUI +:pdf-stylesdir: . +:pdf-style: altusmetrum +:pdf-fontsdir: fonts - include::dedication.raw[] + include::header.adoc[] - include::intro.raw[] + include::dedication.adoc[] - include::getting-started.raw[] + include::intro.adoc[] - include::usage.raw[] + include::getting-started.adoc[] - include::telemetrum.raw[] + include::usage.adoc[] - include::telemini.raw[] + include::telemetrum.adoc[] - include::easymini-device.raw[] + include::telemini.adoc[] - include::telemega.raw[] + include::easymini-device.adoc[] - include::easymega.raw[] + include::telemega.adoc[] - include::installation.raw[] + include::easymega.adoc[] - include::using-am-products.raw[] + include::installation.adoc[] - include::altosui.raw[] + include::using-am-products.adoc[] - include::altosdroid.raw[] + include::altosui.adoc[] - include::system-operation.raw[] + include::altosdroid.adoc[] - include::handling.raw[] + include::system-operation.adoc[] - include::updating-firmware.raw[] + include::handling.adoc[] - include::flight-data-recording.raw[] + include::updating-firmware.adoc[] - include::specs.raw[] + include::flight-data-recording.adoc[] - include::release-notes.raw[] + include::specs.adoc[] + + include::release-notes.adoc[] diff --git a/doc/am-notoc.css b/doc/am-notoc.css new file mode 100644 index 00000000..6999d478 --- /dev/null +++ b/doc/am-notoc.css @@ -0,0 +1,334 @@ +/* + CSS stylesheet for XHTML produced by DocBook XSL stylesheets. +*/ + +@font-face { + font-family: 'Open Sans'; + src: url('fonts/OpenSans-Regular.ttf'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'Open Sans'; + src: url('fonts/OpenSans-Italic.ttf'); + font-weight: normal; + font-style: italic; +} + +@font-face { + font-family: 'Open Sans'; + src: url('fonts/OpenSans-Semibold.ttf'); + font-weight: bold; + font-style: normal; +} + +@font-face { + font-family: 'Open Sans'; + src: url('fonts/OpenSans-SemiboldItalic.ttf'); + font-weight: bold; + font-style: italic; +} + +@font-face { + font-family: 'DejaVu Sans Mono'; + src: url('fonts/DejaVuSansMono.ttf'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'DejaVu Sans Mono'; + src: url('fonts/DejaVuSansMono-Oblique.ttf'); + font-weight: normal; + font-style: oblique; +} + +@font-face { + font-family: 'DejaVu Sans Mono'; + src: url('fonts/DejaVuSansMono-Bold.ttf'); + font-weight: bold; + font-style: normal; +} + +@font-face { + font-family: 'DejaVu Sans Mono'; + src: url('fonts/DejaVuSansMono-BoldOblique.ttf'); + font-weight: bold; + font-style: oblique; +} + +body { + font-family: "Open Sans",sans-serif; + font-size: 12pt; + margin: 2em 5em 2em 5em; +} + +code, pre { + font-family: "DejaVu Sans Mono", monospace; +} + +span.strong { + font-weight: bold; +} + +body blockquote { + margin-top: .75em; + line-height: 1.5; + margin-bottom: .75em; +} + +a:link { + color: #78079a; +} + +a:visited { + color: #78079a; +} + +h1, h2, h3, h4, h5, h6 +{ + color: #78079a; + font-family: "Open Sans",sans-serif; +} + +div.toc { + display:none; +} + +div.details { + padding-top: 1em; + padding-left: 3em; +} + +span.author { + font-weight: bold; + color: #78079a; +} + +span.email { + font-size: 10pt; +} + +span#revnumber { + font-size: 8pt; +} + +span#revdate { + font-size: 8pt; +} + +span#revremark { + font-size: 8pt; +} + +div#footer { + border-top: 2px solid #808080; +} + +body h1 { + margin: .0em 0 0 -4%; + line-height: 1.3; + border-bottom: 2px solid #808080; +} + +body h2 { + margin: 0.5em 0 0 -4%; + line-height: 1.3; + border-bottom: 2px solid #808080; +} + +body h3 { + margin: .8em 0 0 -3%; + line-height: 1.3; +} + +body h4 { + margin: .8em 0 0 -3%; + line-height: 1.3; +} + +body h5 { + margin: .8em 0 0 -2%; + line-height: 1.3; +} + +body h6 { + margin: .8em 0 0 -1%; + line-height: 1.3; +} + +body hr { + border: none; /* Broken on IE6 */ +} + +body td { + line-height: 1.2 +} + +body th { + line-height: 1.2; +} + +ol { + line-height: 1.2; +} + +ul, body dir, body menu { + line-height: 1.2; +} + +body h1, body h2, body h3, body h4, body h5, body h6 { + margin-left: 0 +} + +body pre { + margin: 0.5em 10% 0.5em 1em; + line-height: 1.0; +} + +tt.literal, code.literal { +} + +.programlisting, .screen { + border: 1px solid #808080; + background: #f4f4f4; + margin: 0.5em 10% 0.5em 0; + padding: 0.5em 1em; +} + +div.sidebar { + background: #ffffee; + margin: 1.0em 10% 0.5em 0; + padding: 0.5em 1em; + border: 1px solid #808080; +} +div.sidebar * { padding: 0; } +div.sidebar div { margin: 0; } +div.sidebar p.title { + margin-top: 0.5em; + margin-bottom: 0.2em; +} + +div.bibliomixed { + margin: 0.5em 5% 0.5em 1em; +} + +div.glossary dt { + font-weight: bold; +} +div.glossary dd p { + margin-top: 0.2em; +} + +dl { + margin: .8em 0; + line-height: 1.2; +} + +dt { + margin-top: 0.5em; +} + +dt span.term { + font-weight: bold; +} + +div.variablelist dd p { + margin-top: 0; +} + +div.itemizedlist li, div.orderedlist li { + margin-left: -0.8em; + margin-top: 0.5em; +} + +ul, ol { + list-style-position: outside; +} + +div.sidebar ul, div.sidebar ol { + margin-left: 2.8em; +} + +div.itemizedlist p.title, +div.orderedlist p.title, +div.variablelist p.title +{ + margin-bottom: -0.8em; +} + +div.revhistory { + border-style: none; +} + +div.revhistory table, div.revhistory th, div.revhistory td { + border-collapse: collapse; + border: 1px solid #808080; + padding: 0.25em; +} + +div.revhistory th { + color: black; +} + +/* Keep TOC and index lines close together. */ +div.toc dl, div.toc dt +{ + line-height: normal; + margin-top: 0; + margin-bottom: 0; +} + +div.admonitionblock { + margin-top: 2em; + margin-bottom: 2em; + margin-left: 2em; + margin-right: 2em; +} + +div.admonitionblock div { + margin-left: 0em; + margin-right: 1em; +} + +div.admonitionblock div.title { + color: #c70909; + font-style: bold; + font-size: 24pt; +} + +div#content table.tableblock { + border-style: solid; + border-width: 1px; + border-collapse: collapse; +} + +div#content table.tableblock td,th { + border-right-style: solid; + border-right-width: 1px; +} + +div#content table.tableblock tbody p { + margin-top: 0.25em; + margin-bottom: 0.25em; + margin-left: 0.25em; + margin-right: 0.25em; +} + +div#content table.tableblock tbody tr:nth-child(odd) { + background: #cccccc; +} + +div.imageblock{ + margin-top: 1em; + margin-bottom: 1em; +} + +div.imageblock img { + margin-bottom: 0.5em; +} + +@media print { + div.navheader, div.navfooter { display: none; } +} diff --git a/doc/am.css b/doc/am.css index 393ef81b..56daface 100644 --- a/doc/am.css +++ b/doc/am.css @@ -61,6 +61,7 @@ body { font-family: "Open Sans",sans-serif; font-size: 12pt; + margin: 0; } code, pre { @@ -77,15 +78,6 @@ body blockquote { margin-bottom: .75em; } -html body { - margin: 1em 5% 1em 5%; - line-height: 1.2; -} - -body div { - margin: 0; -} - a:link { color: #78079a; } @@ -100,33 +92,11 @@ h1, h2, h3, h4, h5, h6 font-family: "Open Sans",sans-serif; } -div.revhistory table { - width: 50%; - border-width: 1px; -} - -div titlepage { - margin-top: 100px; - border-top: 2px; -} - -div.warning h1, div.warning h2, div.warning h3, div.warning h4, div.warning h5, div.warning h6 { - color: #ff2020; -} - -div.warning p, div.note p, div.error p { - margin-left: 5%; - margin-left: 5%; -} - -h3.corpauthor img { - position: fixed; - left: 0px; - top: 0px; - width: 410px; - height: 90px; - border-right: 2px solid #808080; - border-bottom: 2px solid #808080; +div#content, div#header, div#footer { + margin-left: 440px; + margin-right: 2em; + margin-top: 2em; + margin-bottom: 2em; } div.toc { @@ -145,17 +115,16 @@ div.toc { overflow: auto; } -div.toc p, -div.list-of-figures p, -div.list-of-tables p, -div.list-of-examples p, -div.toc a -{ - color: black; -} - -div.toc p { - color: black; +div#logo img { + position: fixed; + left: 0px; + top: 0px; + width: 410px; + height: 92px; + margin-top: 0px; + margin-bottom: 0px; + border-right: 2px solid #808080; + border-bottom: 2px solid #808080; } div.toc a:link { @@ -174,42 +143,34 @@ div.toc a:active { text-decoration: underline; } -div.book { - margin-left: 25em; +div.details { + padding-top: 1em; + padding-left: 3em; } -div.list-of-figures { - display: none; +span.author { + font-weight: bold; + color: #78079a; } -div.list-of-tables { - display: none; +span.email { + font-size: 10pt; } -div.figure p { - text-align: center; -} -div.figure img { - display: block; - margin: auto; +span#revnumber { + font-size: 8pt; } -div.table p.title { - text-align: center; +span#revdate { + font-size: 8pt; } -div.table-contents table { - margin-left: auto; - margin-right: auto; +span#revremark { + font-size: 8pt; } -div.example p.title, -div.sidebar p.title -{ - font-weight: normal; - color: #78079a; - font-family: "Open Sans",sans-serif; - margin-bottom: 0.2em; +div#footer { + border-top: 2px solid #808080; } body h1 { @@ -232,7 +193,6 @@ body h3 { body h4 { margin: .8em 0 0 -3%; line-height: 1.3; - border-top: 2px solid #808080; } body h5 { @@ -248,25 +208,6 @@ body h6 { body hr { border: none; /* Broken on IE6 */ } -div.footnotes hr { - border: 1px solid #808080; -} - -div.navheader th, div.navheader td, div.navfooter td { - font-family: "Open Sans",sans-serif; - font-size: 12pt; - font-weight: normal; - color: #78079a; -} -div.navheader img, div.navfooter img { - border-style: none; -} -div.navheader a, div.navfooter a { - font-weight: normal; -} -div.navfooter hr { - border: 1px solid #808080; -} body td { line-height: 1.2 @@ -284,11 +225,6 @@ ul, body dir, body menu { line-height: 1.2; } -html { - margin: 0; - padding: 0; -} - body h1, body h2, body h3, body h4, body h5, body h6 { margin-left: 0 } @@ -384,93 +320,62 @@ div.revhistory th { } /* Keep TOC and index lines close together. */ -div.toc dl, div.toc dt, -div.list-of-figures dl, div.list-of-figures dt, -div.list-of-tables dl, div.list-of-tables dt, -div.indexdiv dl, div.indexdiv dt +div.toc dl, div.toc dt { line-height: normal; margin-top: 0; margin-bottom: 0; } -/* - Table styling does not work because of overriding attributes in - generated HTML. -*/ -div.table-contents p, -div.informaltable p -{ - margin: 0px; +div.admonitionblock { + margin-top: 2em; + margin-bottom: 2em; + margin-left: 2em; + margin-right: 2em; } -div.table thead, div.table tfoot, -div.informaltable thead, div.informaltable tfoot -{ - font-weight: bold; +div.admonitionblock div { + margin-left: 0em; + margin-right: 1em; +} + +div.admonitionblock div.title { + color: #c70909; + font-style: bold; + font-size: 24pt; +} + +div#content table.tableblock { + border-style: solid; + border-width: 1px; + border-collapse: collapse; } -div.mediaobject img { - margin-bottom: 0.8em; +div#content table.tableblock td,th { + border-right-style: solid; + border-right-width: 1px; } -div.figure p.title, -div.table p.title -{ - margin-top: 1em; - margin-bottom: 0.4em; + +div#content table.tableblock tbody p { + margin-top: 0.25em; + margin-bottom: 0.25em; + margin-left: 0.25em; + margin-right: 0.25em; } -div.calloutlist p -{ - margin-top: 0em; - margin-bottom: 0.4em; +div#content table.tableblock tbody tr:nth-child(odd) { + background: #cccccc; +} + +div.imageblock{ + margin-top: 1em; + margin-bottom: 1em; } -a img { - border-style: none; +div.imageblock img { + margin-bottom: 0.5em; } @media print { div.navheader, div.navfooter { display: none; } } - -span.aqua { color: aqua; } -span.black { color: black; } -span.blue { color: blue; } -span.fuchsia { color: fuchsia; } -span.gray { color: gray; } -span.green { color: green; } -span.lime { color: lime; } -span.maroon { color: maroon; } -span.navy { color: navy; } -span.olive { color: olive; } -span.purple { color: purple; } -span.red { color: red; } -span.silver { color: silver; } -span.teal { color: teal; } -span.white { color: white; } -span.yellow { color: yellow; } - -span.aqua-background { background: aqua; } -span.black-background { background: black; } -span.blue-background { background: blue; } -span.fuchsia-background { background: fuchsia; } -span.gray-background { background: gray; } -span.green-background { background: green; } -span.lime-background { background: lime; } -span.maroon-background { background: maroon; } -span.navy-background { background: navy; } -span.olive-background { background: olive; } -span.purple-background { background: purple; } -span.red-background { background: red; } -span.silver-background { background: silver; } -span.teal-background { background: teal; } -span.white-background { background: white; } -span.yellow-background { background: yellow; } - -span.big { font-size: 2em; } -span.small { font-size: 0.6em; } - -span.underline { text-decoration: underline; } -span.overline { text-decoration: overline; } -span.line-through { text-decoration: line-through; } diff --git a/doc/companion.txt b/doc/companion.txt index 75ffa228..256ffad7 100644 --- a/doc/companion.txt +++ b/doc/companion.txt @@ -1,7 +1,16 @@ = AltOS Companion Port +Keith Packard ; Bdale Garbee :doctype: article +:copyright: Bdale Garbee and Keith Packard 2018 +:stylesheet: am.css +:linkcss: +:pdf-stylesdir: . +:pdf-style: altusmetrum +:pdf-fontsdir: fonts :toc: + include::header.adoc[] + == Companion Port Many Altus Metrum products come with an eight pin Micro MaTch diff --git a/doc/config-device.inc b/doc/config-device.inc index 0ca6afff..144b1e8f 100644 --- a/doc/config-device.inc +++ b/doc/config-device.inc @@ -233,7 +233,7 @@ ifdef::telemega,easymega[] ==== Configure Pyro Channels .Additional Pyro Channel Configuration - image::configure-pyro.png[width="5.5in"] + image::configure-pyro.png[width=400] This opens a separate window to configure the additional pyro channels available on TeleMega @@ -262,6 +262,6 @@ ifdef::telemega,easymega[] configuration by pressing the 'Save' button in the main Configure Flight Computer window. - include::pyro-channels.raw[] + include::pyro-channels.adoc[] endif::telemega,easymega[] diff --git a/doc/easymega-outline.txt b/doc/easymega-outline.txt index f5ca982c..d6daf09c 100644 --- a/doc/easymega-outline.txt +++ b/doc/easymega-outline.txt @@ -1,6 +1,7 @@ -= EasyMega Outline and Hole Pattern +:notitle: :doctype: article +== EasyMega Outline and Hole Pattern This image, when printed, provides a precise template for the mounting holes in EasyMega. EasyMega has overall dimensions of 1.250 x 2.250 inches, and the mounting holes are sized for use diff --git a/doc/easymega.inc b/doc/easymega.inc index c126004b..a948aaae 100644 --- a/doc/easymega.inc +++ b/doc/easymega.inc @@ -1,7 +1,7 @@ == EasyMega .EasyMega Board - image::easymega-v1.0-top.jpg[width="4.5in"] + image::easymega-v1.0-top.jpg[width=430] EasyMega is a 1¼ inch by 2¼ inch circuit board. It was designed to easily fit in a 38mm coupler. Like TeleMetrum, diff --git a/doc/easymini-device.inc b/doc/easymini-device.inc index fb2b6098..82ea959c 100644 --- a/doc/easymini-device.inc +++ b/doc/easymini-device.inc @@ -1,7 +1,7 @@ == EasyMini .EasyMini Board - image::easymini-top.jpg[width="5.5in"] + image::easymini-top.jpg[width=400] EasyMini is built on a 0.8 inch by 1½ inch circuit board. It's designed to fit in a 24mm coupler tube. diff --git a/doc/easymini-outline.txt b/doc/easymini-outline.txt index e031b5ee..c4b1baa5 100644 --- a/doc/easymini-outline.txt +++ b/doc/easymini-outline.txt @@ -1,6 +1,7 @@ -= EasyMini Outline and Hole Pattern +:notitle: :doctype: article +== EasyMini Outline and Hole Pattern This image, when printed, provides a precise template for the mounting holes in EasyMini. EasyMini has overall dimensions of 0.800 x 1.500 inches, and the mounting holes are sized for diff --git a/doc/easymini-release-notes.inc b/doc/easymini-release-notes.inc index 425236ef..67ba0f4d 100644 --- a/doc/easymini-release-notes.inc +++ b/doc/easymini-release-notes.inc @@ -1,53 +1,53 @@ [appendix] == Release Notes :leveloffset: 2 - include::release-notes-1.8.6.raw[] + include::release-notes-1.8.6.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.5.raw[] + include::release-notes-1.8.5.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.4.raw[] + include::release-notes-1.8.4.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.3.raw[] + include::release-notes-1.8.3.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.2.raw[] + include::release-notes-1.8.2.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.1.raw[] + include::release-notes-1.8.1.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.raw[] + include::release-notes-1.8.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.7.raw[] + include::release-notes-1.7.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.8.raw[] + include::release-notes-1.6.8.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.5.raw[] + include::release-notes-1.6.5.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.4.raw[] + include::release-notes-1.6.4.adoc[] :leveloffset: 2 - include::release-notes-1.6.3.raw[] + include::release-notes-1.6.3.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.2.raw[] + include::release-notes-1.6.2.adoc[] :leveloffset: 0 diff --git a/doc/easymini.txt b/doc/easymini.txt index 1a75b929..e3d3fae8 100644 --- a/doc/easymini.txt +++ b/doc/easymini.txt @@ -1,34 +1,47 @@ = EasyMini Owner's Manual +Keith Packard ; Bdale Garbee +:title-logo-image: image:../themes/background.png[] +:revnumber: v1.8.7 +:revdate: 8 Oct 2018 +:copyright: Bdale Garbee and Keith Packard 2018 :doctype: book :numbered: +:toc: +:stylesheet: am.css +:linkcss: :altusmetrum: 1 :easymini: 1 :application: AltosUI +:pdf-stylesdir: . +:pdf-style: altusmetrum +:pdf-fontsdir: fonts - include::dedication.raw[] + include::header.adoc[] - include::intro.raw[] + include::dedication.adoc[] - include::getting-started.raw[] + include::intro.adoc[] - include::usage.raw[] + include::getting-started.adoc[] - include::easymini-device.raw[] + include::usage.adoc[] - include::installation.raw[] + include::easymini-device.adoc[] - include::using-am-products.raw[] + include::installation.adoc[] - include::altosui.raw[] + include::using-am-products.adoc[] - include::system-operation.raw[] + include::altosui.adoc[] - include::handling.raw[] + include::system-operation.adoc[] - include::updating-firmware.raw[] + include::handling.adoc[] - include::flight-data-recording.raw[] + include::updating-firmware.adoc[] - include::specs.raw[] + include::flight-data-recording.adoc[] - include::easymini-release-notes.raw[] + include::specs.adoc[] + + include::easymini-release-notes.adoc[] diff --git a/doc/header.inc b/doc/header.inc new file mode 100644 index 00000000..6bc616f5 --- /dev/null +++ b/doc/header.inc @@ -0,0 +1,13 @@ +ifndef::backend-pdf[] +[#logo] +[link=https://altusmetrum.org] +image::altusmetrum-oneline.svg[Altus Metrum] +endif::[] + +[license] +== License + +Copyright © 2018 Bdale Garbee and Keith Packard + +This document is released under the terms of the link:http://creativecommons.org/licenses/by-sa/3.0/[Creative Commons ShareAlike 3.0 License] + diff --git a/doc/load-maps.inc b/doc/load-maps.inc index ccab4795..520fb364 100644 --- a/doc/load-maps.inc +++ b/doc/load-maps.inc @@ -1,7 +1,7 @@ === Load Maps .Load Maps Window - image::load-maps.png[width="5.2in"] + image::load-maps.png[width=500] Before heading out to a new launch site, you can use this to load satellite images in case you don't have diff --git a/doc/map-loading.txt b/doc/map-loading.txt index 1b39dd6b..f8328176 100644 --- a/doc/map-loading.txt +++ b/doc/map-loading.txt @@ -1,5 +1,13 @@ = Loading Map Tiles from Google Maps +Keith Packard +:title-logo-image: image:load-maps.png[] +:copyright: Keith Packard 2018 :doctype: article +:stylesheet: am-notoc.css +:linkcss: +:pdf-stylesdir: . +:pdf-style: altusmetrum +:pdf-fontsdir: fonts == The Google Maps Problem diff --git a/doc/micropeak-oneline.svg b/doc/micropeak-oneline.svg index 4b695827..b892b24d 100644 --- a/doc/micropeak-oneline.svg +++ b/doc/micropeak-oneline.svg @@ -10,14 +10,44 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="444" - height="98" + width="320" + height="63" id="svg2" version="1.1" - inkscape:version="0.91 r13725" - sodipodi:docname="micropeak-oneline.svg"> + inkscape:version="0.48.3.1 r9886" + sodipodi:docname="micropeak-oneline-font.svg"> + + + + + + + + + + @@ -80,7 +110,7 @@ style="overflow:visible"> @@ -108,7 +138,17 @@ x2="280.61411" y2="275.90405" gradientUnits="userSpaceOnUse" - gradientTransform="matrix(1.9246394,0,0,1.9246394,-200.29778,-270.16721)" /> + gradientTransform="matrix(1.58566,0,0,1.58566,-141.69631,-171.10662)" /> + + transform="translate(-241.9891,-229.23188)"> + style="font-size:57.89221573px;font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#7200a4;fill-opacity:1;stroke:none;font-family:ITC Benguiat Gothic Std;-inkscape-font-specification:ITC Benguiat Gothic Std Medium" + id="text2985"> + + + d="m 282.7522,267.42614 -3.93403,-2.77705 -4.51792,1.66641 1.42544,-4.59964 -2.98096,-3.78185 4.815,-0.0657 2.67559,-4.00372 1.55039,4.55904 4.63457,1.30742 -3.85681,2.88333 z" + inkscape:transform-center-x="-0.46292579" + inkscape:transform-center-y="-0.64836539" + transform="matrix(1.58566,0,0,1.58566,-141.69632,-171.10662)" /> + style="font-size:54.73445892px;font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:url(#linearGradient4147);fill-opacity:1;stroke:none;font-family:ITC Benguiat Gothic Std;-inkscape-font-specification:ITC Benguiat Gothic Std Medium" + id="text5351"> + + + + + + + + - - - - - - - - - - - + d="m 538.94589,277.69509 c 0,1.64203 0.60208,2.84619 2.40832,2.84619 1.80623,0 2.40832,-1.20416 2.40832,-2.84619 l 0,-13.40995 c 9.14064,1.2589 12.09631,4.15983 13.40994,13.46468 0.21894,1.53256 0.43788,2.79146 2.35358,2.79146 1.5873,0 2.46305,-0.82102 2.46305,-2.57252 0,-6.23972 -3.22934,-13.40995 -9.57853,-15.32565 l 0,-0.10947 c 3.06513,-1.03995 7.49862,-4.5977 7.49862,-8.15543 0,-1.20416 -0.82102,-2.18938 -1.7515,-2.18938 -1.80624,0 -2.18938,1.25889 -3.94088,3.72194 -1.97044,2.90093 -5.69239,4.87137 -9.30486,4.87137 l -1.14942,0 0,-15.38038 c 0,-1.64204 -0.60209,-2.8462 -2.40832,-2.8462 -1.80624,0 -2.40832,1.20416 -2.40832,2.8462 l 0,32.29333" + style="" + id="path4181" /> diff --git a/doc/micropeak.txt b/doc/micropeak.txt index d5036a00..9569194e 100644 --- a/doc/micropeak.txt +++ b/doc/micropeak.txt @@ -1,6 +1,18 @@ = MicroPeak Owner's Manual +Keith Packard ; Bdale Garbee +:revnumber: v1.8.7 +:revdate: 8 Oct 2018 +:copyright: Bdale Garbee and Keith Packard 2018 +:stylesheet: am.css +:linkcss: +:toc: :doctype: book :numbered: +:pdf-stylesdir: . +:pdf-style: altusmetrum +:pdf-fontsdir: fonts + + include::header.adoc[] [dedication] == Acknowledgements @@ -32,7 +44,7 @@ positive (+) terminal facing away from the circuit board. .MicroPeak and Battery - image::micropeak-back.jpg[width="4.5in"] + image::micropeak-back.jpg[width=430] Install MicroPeak in your rocket:: @@ -87,7 +99,7 @@ == The MicroPeak USB adapter .MicroPeak USB Adapter - image::MicroPeakUSB-2.0.jpg[width="4.5in",align="center"] + image::MicroPeakUSB-2.0.jpg[width=430,align="center"] MicroPeak stores barometric pressure information for the first 48 seconds of the flight in on-board non-volatile memory. The @@ -112,25 +124,25 @@ * Start the MicroPeak application. - image::micropeak-nofont.svg[width="0.5in",align="center"] + image::micropeak-nofont.svg[width=50,align="center"] * Click on the Download button at the top of the window. .MicroPeak Application - image::micropeak-app.png[width="4.5in",align="center"] + image::micropeak-app.png[width=430,align="center"] * Select from the listed devices. There will probably be only one. .MicroPeak Device Dialog - image::micropeak-device-dialog.png[width="2.3in",align="center"] + image::micropeak-device-dialog.png[width=220,align="center"] * The application will now wait until it receives valid data from the MicroPeak USB adapter. .MicroPeak Download Dialog - image::micropeak-download.png[width="2in",align="center"] + image::micropeak-download.png[width=200,align="center"] * The MicroPeak USB adapter has a small phototransistor under the hole in the center of the @@ -142,7 +154,7 @@ MicroPeak board itself. .MicroPeak Downloading - image::MicroPeakUSB-2.0-inuse.jpg[width="4.5in",align="center"] + image::MicroPeakUSB-2.0-inuse.jpg[width=430,align="center"] * After the maximum flight height is reported, MicroPeak will pause for a few seconds, blink the @@ -154,7 +166,7 @@ MicroPeak board and try again. .MicroPeak Save Dialog - image::micropeak-save-dialog.png[width="2.3in",align="center"] + image::micropeak-save-dialog.png[width=220,align="center"] * Once the data are saved, a graph will be displayed with height, speed and acceleration values computed @@ -194,7 +206,7 @@ ==== MicroPeak Graphs .MicroPeak Graph - image::micropeak-graph.png[width="4.5in",align="center"] + image::micropeak-graph.png[width=430,align="center"] Under the Graph tab, the height, speed and acceleration values are displayed together. You can zoom in on the graph by @@ -205,7 +217,7 @@ ==== MicroPeak Flight Statistics .MicroPeak Flight Statistics - image::micropeak-statistics.png[width="4.5in",align="center"] + image::micropeak-statistics.png[width=430,align="center"] The Statistics tab presents overall data from the flight. Note that the Maximum height value @@ -220,7 +232,7 @@ ==== Raw Flight Data .MicroPeak Raw Flight Data - image::micropeak-raw-data.png[width="4.5in",align="center"] + image::micropeak-raw-data.png[width=430,align="center"] A table consisting of the both the raw barometric pressure data and values computed from that for each recorded time. @@ -228,7 +240,7 @@ ==== Configuring the Graph .MicroPeak Graph Configuration - image::micropeak-graph-configure.png[width="4.5in",align="center"] + image::micropeak-graph-configure.png[width=430,align="center"] This selects which graph elements to show, and lets you switch between metric and imperial units @@ -236,7 +248,7 @@ === Setting MicroPeak Preferences .MicroPeak Preferences - image::micropeak-preferences.png[width="1.8in",align="center"] + image::micropeak-preferences.png[width=170,align="center"] The MicroPeak application has a few user settings which are configured through the Preferences dialog, which can be diff --git a/doc/release-head.inc b/doc/release-head.inc new file mode 100644 index 00000000..0dbdfc2b --- /dev/null +++ b/doc/release-head.inc @@ -0,0 +1,7 @@ +:toc!: +:doctype: article +:stylesheet: am-notoc.css +:linkcss: +:pdf-stylesdir: . +:pdf-style: altusmetrum +:pdf-fontsdir: fonts diff --git a/doc/release-notes-0.7.1.inc b/doc/release-notes-0.7.1.inc index 8ce49f0a..c253e812 100644 --- a/doc/release-notes-0.7.1.inc +++ b/doc/release-notes-0.7.1.inc @@ -1,5 +1,5 @@ = Release Notes for Version 0.7.1 -:toc!: +include::release-head.adoc[] :doctype: article Version 0.7.1 is the first release containing our new diff --git a/doc/release-notes-0.8.inc b/doc/release-notes-0.8.inc index 38230593..3ff70c90 100644 --- a/doc/release-notes-0.8.inc +++ b/doc/release-notes-0.8.inc @@ -1,5 +1,5 @@ = Release Notes for Version 0.8 -:toc!: +include::release-head.adoc[] :doctype: article Version 0.8 offers a major upgrade in the AltosUI diff --git a/doc/release-notes-0.9.2.inc b/doc/release-notes-0.9.2.inc index b7c55bb2..9c373c2f 100644 --- a/doc/release-notes-0.9.2.inc +++ b/doc/release-notes-0.9.2.inc @@ -1,5 +1,5 @@ = Release Notes for Version 0.9.2 -:toc!: +include::release-head.adoc[] :doctype: article Version 0.9.2 is an AltosUI bug-fix release, with no firmware diff --git a/doc/release-notes-0.9.inc b/doc/release-notes-0.9.inc index 0ee7ea51..a42a18d8 100644 --- a/doc/release-notes-0.9.inc +++ b/doc/release-notes-0.9.inc @@ -1,5 +1,5 @@ = Release Notes for Version 0.9 -:toc!: +include::release-head.adoc[] :doctype: article Version 0.9 adds a few new firmware features and accompanying diff --git a/doc/release-notes-1.0.1.inc b/doc/release-notes-1.0.1.inc index 067727e9..fac31d7f 100644 --- a/doc/release-notes-1.0.1.inc +++ b/doc/release-notes-1.0.1.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.0.1 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.0.1 is a major release, adding support for the diff --git a/doc/release-notes-1.1.1.inc b/doc/release-notes-1.1.1.inc index 2e61bfec..2cc30aa8 100644 --- a/doc/release-notes-1.1.1.inc +++ b/doc/release-notes-1.1.1.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.1 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.1.1 is a bug-fix release. It fixes a couple of bugs diff --git a/doc/release-notes-1.1.inc b/doc/release-notes-1.1.inc index b3ea066d..f7283ce4 100644 --- a/doc/release-notes-1.1.inc +++ b/doc/release-notes-1.1.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.1 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.1 is a minor release. It provides a few new features diff --git a/doc/release-notes-1.2.1.inc b/doc/release-notes-1.2.1.inc index 18c5d7e2..f60b8e74 100644 --- a/doc/release-notes-1.2.1.inc +++ b/doc/release-notes-1.2.1.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.2.1 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.2.1 is a minor release. It adds support for TeleBT and diff --git a/doc/release-notes-1.2.inc b/doc/release-notes-1.2.inc index 42afad04..f0c2615a 100644 --- a/doc/release-notes-1.2.inc +++ b/doc/release-notes-1.2.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.2 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.2 is a major release. It adds support for MicroPeak diff --git a/doc/release-notes-1.3.1.inc b/doc/release-notes-1.3.1.inc index ff9c8e52..dc9eac87 100644 --- a/doc/release-notes-1.3.1.inc +++ b/doc/release-notes-1.3.1.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.3.1 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.3.1 is a minor release. It improves support for diff --git a/doc/release-notes-1.3.2.inc b/doc/release-notes-1.3.2.inc index dae5dd99..7e0f57d6 100644 --- a/doc/release-notes-1.3.2.inc +++ b/doc/release-notes-1.3.2.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.3.2 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.3.2 is a minor release. It includes small bug fixes for diff --git a/doc/release-notes-1.3.inc b/doc/release-notes-1.3.inc index ceb677a1..b53354ac 100644 --- a/doc/release-notes-1.3.inc +++ b/doc/release-notes-1.3.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.3 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.3 is a major release. It adds support for TeleMega, diff --git a/doc/release-notes-1.4.1.inc b/doc/release-notes-1.4.1.inc index 5e3e831e..0d9c5350 100644 --- a/doc/release-notes-1.4.1.inc +++ b/doc/release-notes-1.4.1.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.4.1 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.4.1 is a minor release. It fixes install issues on diff --git a/doc/release-notes-1.4.2.inc b/doc/release-notes-1.4.2.inc index ded6b408..059b8b95 100644 --- a/doc/release-notes-1.4.2.inc +++ b/doc/release-notes-1.4.2.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.4.2 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.4.2 is a minor release. It fixes Java-related install issues on diff --git a/doc/release-notes-1.4.inc b/doc/release-notes-1.4.inc index f4ab9ad2..163aee0c 100644 --- a/doc/release-notes-1.4.inc +++ b/doc/release-notes-1.4.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.4 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.4 is a major release. It includes support for our new diff --git a/doc/release-notes-1.5.inc b/doc/release-notes-1.5.inc index 8d72c0e0..67cf1721 100644 --- a/doc/release-notes-1.5.inc +++ b/doc/release-notes-1.5.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.5 -:toc!: +include::release-head.adoc[] Version 1.5 is a major release. It includes support for our new EasyMega product, new features and bug fixes in in the flight diff --git a/doc/release-notes-1.6.1.inc b/doc/release-notes-1.6.1.inc index 1e03ed4f..8fb90570 100644 --- a/doc/release-notes-1.6.1.inc +++ b/doc/release-notes-1.6.1.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.6.1 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.6.1 includes support for our updated TeleBT v3.0 diff --git a/doc/release-notes-1.6.2.inc b/doc/release-notes-1.6.2.inc index 990eb48f..95466bf7 100644 --- a/doc/release-notes-1.6.2.inc +++ b/doc/release-notes-1.6.2.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.6.2 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.6.2 includes support for our updated TeleMega v2.0 diff --git a/doc/release-notes-1.6.3.inc b/doc/release-notes-1.6.3.inc index 6aa77042..97946db7 100644 --- a/doc/release-notes-1.6.3.inc +++ b/doc/release-notes-1.6.3.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.6.3 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.6.3 adds idle mode to AltosDroid and has bug fixes diff --git a/doc/release-notes-1.6.4.inc b/doc/release-notes-1.6.4.inc index f976a69d..f0c7a59d 100644 --- a/doc/release-notes-1.6.4.inc +++ b/doc/release-notes-1.6.4.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.6.4 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.6.4 fixes a bluetooth communication problem with diff --git a/doc/release-notes-1.6.5.inc b/doc/release-notes-1.6.5.inc index 9f3ae281..538c4db3 100644 --- a/doc/release-notes-1.6.5.inc +++ b/doc/release-notes-1.6.5.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.6.5 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.6.5 fixes a TeleMega and TeleMetrum v2.0 bug where diff --git a/doc/release-notes-1.6.8.inc b/doc/release-notes-1.6.8.inc index 8e37fe69..7b122425 100644 --- a/doc/release-notes-1.6.8.inc +++ b/doc/release-notes-1.6.8.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.6.8 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.6.8 fixes a TeleMega and TeleMetrum v2.0 bug where diff --git a/doc/release-notes-1.6.inc b/doc/release-notes-1.6.inc index 0908dfaf..adbded52 100644 --- a/doc/release-notes-1.6.inc +++ b/doc/release-notes-1.6.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.6 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.6 includes support for our updated TeleDongle v3.0 diff --git a/doc/release-notes-1.7.inc b/doc/release-notes-1.7.inc index f2da71f3..b6ed7881 100644 --- a/doc/release-notes-1.7.inc +++ b/doc/release-notes-1.7.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.7 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.7 includes support for our new TeleMini v3.0 diff --git a/doc/release-notes-1.8.1.inc b/doc/release-notes-1.8.1.inc index d9e4a2d9..dc02b3a1 100644 --- a/doc/release-notes-1.8.1.inc +++ b/doc/release-notes-1.8.1.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.8.1 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.8.1 includes an important bug fix for Apogee Lockout diff --git a/doc/release-notes-1.8.2.inc b/doc/release-notes-1.8.2.inc index 2923ec11..cbc77bba 100644 --- a/doc/release-notes-1.8.2.inc +++ b/doc/release-notes-1.8.2.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.8.2 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.8.2 includes support for TeleGPS version 2.0 along diff --git a/doc/release-notes-1.8.3.inc b/doc/release-notes-1.8.3.inc index 4bc879ad..ef056f01 100644 --- a/doc/release-notes-1.8.3.inc +++ b/doc/release-notes-1.8.3.inc @@ -1,6 +1,5 @@ = Release Notes for Version 1.8.3 -:toc!: -:doctype: article +include::release-head.adoc[] Version 1.8.3 includes support for TeleMega version 3.0 along with two important flight computer fixes. This version also diff --git a/doc/release-notes-1.8.4.inc b/doc/release-notes-1.8.4.inc index f8cb4f11..9a8657b3 100644 --- a/doc/release-notes-1.8.4.inc +++ b/doc/release-notes-1.8.4.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.8.4 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.8.4 includes support for EasyMini version 2.0 diff --git a/doc/release-notes-1.8.5.inc b/doc/release-notes-1.8.5.inc index 5b940efd..07d911c1 100644 --- a/doc/release-notes-1.8.5.inc +++ b/doc/release-notes-1.8.5.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.8.5 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.8.5 includes fixes to the ground software support diff --git a/doc/release-notes-1.8.6.inc b/doc/release-notes-1.8.6.inc index 1467977c..5c066b80 100644 --- a/doc/release-notes-1.8.6.inc +++ b/doc/release-notes-1.8.6.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.8.6 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.8.6 diff --git a/doc/release-notes-1.8.7.inc b/doc/release-notes-1.8.7.inc index f8b7b103..2e387adb 100644 --- a/doc/release-notes-1.8.7.inc +++ b/doc/release-notes-1.8.7.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.8.7 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.8.7 diff --git a/doc/release-notes-1.8.inc b/doc/release-notes-1.8.inc index 0255c16b..0c97abb4 100644 --- a/doc/release-notes-1.8.inc +++ b/doc/release-notes-1.8.inc @@ -1,5 +1,5 @@ = Release Notes for Version 1.8 -:toc!: +include::release-head.adoc[] :doctype: article Version 1.8 includes support for our new TeleBT v4.0 ground diff --git a/doc/release-notes.inc b/doc/release-notes.inc index 1183fd12..a1dc6720 100644 --- a/doc/release-notes.inc +++ b/doc/release-notes.inc @@ -1,131 +1,131 @@ [appendix] == Release Notes :leveloffset: 2 - include::release-notes-1.8.7.raw[] + include::release-notes-1.8.7.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.6.raw[] + include::release-notes-1.8.6.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.5.raw[] + include::release-notes-1.8.5.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.4.raw[] + include::release-notes-1.8.4.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.3.raw[] + include::release-notes-1.8.3.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.2.raw[] + include::release-notes-1.8.2.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.1.raw[] + include::release-notes-1.8.1.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.raw[] + include::release-notes-1.8.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.7.raw[] + include::release-notes-1.7.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.8.raw[] + include::release-notes-1.6.8.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.5.raw[] + include::release-notes-1.6.5.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.4.raw[] + include::release-notes-1.6.4.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.3.raw[] + include::release-notes-1.6.3.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.2.raw[] + include::release-notes-1.6.2.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.1.raw[] + include::release-notes-1.6.1.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.raw[] + include::release-notes-1.6.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.5.raw[] + include::release-notes-1.5.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.4.2.raw[] + include::release-notes-1.4.2.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.4.1.raw[] + include::release-notes-1.4.1.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.4.raw[] + include::release-notes-1.4.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.3.2.raw[] + include::release-notes-1.3.2.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.3.1.raw[] + include::release-notes-1.3.1.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.3.raw[] + include::release-notes-1.3.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.2.1.raw[] + include::release-notes-1.2.1.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.2.raw[] + include::release-notes-1.2.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.1.1.raw[] + include::release-notes-1.1.1.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.1.raw[] + include::release-notes-1.1.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.0.1.raw[] + include::release-notes-1.0.1.adoc[] <<<< :leveloffset: 2 - include::release-notes-0.9.2.raw[] + include::release-notes-0.9.2.adoc[] <<<< :leveloffset: 2 - include::release-notes-0.9.raw[] + include::release-notes-0.9.adoc[] <<<< :leveloffset: 2 - include::release-notes-0.8.raw[] + include::release-notes-0.8.adoc[] <<<< :leveloffset: 2 - include::release-notes-0.7.1.raw[] + include::release-notes-0.7.1.adoc[] :leveloffset: 0 diff --git a/doc/specs.inc b/doc/specs.inc index 1b7ea74b..89c21307 100644 --- a/doc/specs.inc +++ b/doc/specs.inc @@ -6,7 +6,7 @@ .Altus Metrum Flight Computer Electronics [options="header"] - |================================ + |=== |Device | Barometer | Z-axis accel | GPS | 3D sensors | Storage | RF Output | Battery ifdef::telemetrum[] @@ -45,8 +45,8 @@ |8MB |40mW |3.7V - endif::telemetrum[] + endif::telemetrum[] ifdef::telemini[] |TeleMini v1.0 |MP3H6115 10km (33k') @@ -65,8 +65,8 @@ |512kB |40mW |3.7V - endif::telemini[] + endif::telemini[] ifdef::easymini[] |EasyMini v1.0 |MS5607 30km (100k') @@ -85,8 +85,8 @@ |1MB |- |3.7-12V - endif::easymini[] + endif::easymini[] ifdef::telemega[] |TeleMega v1.0 |MS5607 30km (100k') @@ -114,8 +114,8 @@ |8MB |40mW |3.7V - endif::telemega[] + endif::telemega[] ifdef::easymega[] |EasyMega v1.0 |MS5607 30km (100k') @@ -127,12 +127,12 @@ |3.7V endif::easymega[] - |============================== + |=== <<<< .Altus Metrum Flight Computer Mechanical Components [options="header",grid="all"] - |============================== + |=== |Device|Connectors|Screw Terminals|Width|Length|Tube Size ifdef::telemetrum[] @@ -187,4 +187,4 @@ |38mm coupler endif::easymega[] - |==================================== + |=== diff --git a/doc/system-operation.inc b/doc/system-operation.inc index 17dfdf89..1e130976 100644 --- a/doc/system-operation.inc +++ b/doc/system-operation.inc @@ -297,7 +297,7 @@ ifdef::gps+radio[] :aprsdevices: TeleMetrum v2.0 and TeleMega :configure_section: _configure_altimeter - include::aprs-operation.raw[] + include::aprs-operation.adoc[] endif::gps+radio[] === Configurable Parameters diff --git a/doc/telegps-application.inc b/doc/telegps-application.inc index 3e6b385e..668595be 100644 --- a/doc/telegps-application.inc +++ b/doc/telegps-application.inc @@ -65,7 +65,7 @@ the device. .TeleGPS Map View - image::telegps-map.png[width="5.5in"] + image::telegps-map.png[width=400] The map's default scale is approximately 3m (10ft) per pixel. The map can be dragged using @@ -99,7 +99,7 @@ received from TeleGPS. .TeleGPS Location View - image::telegps-location.png[width="5.5in"] + image::telegps-location.png[width=400] ==== Status @@ -108,7 +108,7 @@ received telemetry from it. .TeleGPS Status View - image::telegps-status.png[width="5.5in"] + image::telegps-status.png[width=400] ==== Table @@ -116,7 +116,7 @@ the GPS receiver .TeleGPS Information Table - image::telegps-table.png[width="5.5in"] + image::telegps-table.png[width=400] === TeleGPS Menus @@ -164,12 +164,12 @@ ==== Data Graph .TeleGPS Graph - image::telegps-graph-graph.png[width="5.5in"] + image::telegps-graph-graph.png[width=400] ==== Graph Configuration .TeleGPS Graph Configuration - image::telegps-graph-configure.png[width="5.5in"] + image::telegps-graph-configure.png[width=400] This selects which graph elements to show, and, at the bottom, lets you switch between metric and imperial @@ -178,14 +178,14 @@ ==== Statistics .TeleGPS Statistics - image::telegps-graph-stats.png[width="5.5in"] + image::telegps-graph-stats.png[width=400] Shows overall data computed from the flight. ==== Map .TeleGPS Map - image::telegps-graph-map.png[width="6in"] + image::telegps-graph-map.png[width=450] Shows a map of the area overlaid with the GPS track. As with the telemetry monitoring window, you can select the style @@ -233,14 +233,14 @@ within that application. With this, you can use Google Earth to see the whole path in 3D. - include::load-maps.raw[] + include::load-maps.adoc[] === Preferences .TeleGPS Preferences Window - image::telegps-preferences.png[width="2.4in"] + image::telegps-preferences.png[width=230] - include::config-ui.raw[] + include::config-ui.adoc[] === Close @@ -260,7 +260,7 @@ received by the selected TeleDongle device. .Device Selection Dialog - image::device-selection.png[width="3.1in"] + image::device-selection.png[width=300] === Disconnect @@ -270,7 +270,7 @@ === Scan Channels .Radio Scanning Dialog - image::telegps-scan.png[width="3.1in"] + image::telegps-scan.png[width=300] Scans the configured set of frequencies looking for telemetry signals. A list of all of the discovered @@ -306,7 +306,7 @@ === Configure Device .TeleGPS Configuration Dialog - image::telegps-configure.png[width="3.6in"] + image::telegps-configure.png[width=350] Select this button and then select any connected TeleGPS device from the list provided. @@ -342,7 +342,7 @@ The rest of the dialog contains the parameters to be configured. - include::config-device.raw[] + include::config-device.adoc[] === Flash Device diff --git a/doc/telegps-outline.txt b/doc/telegps-outline.txt index bd1495be..ca10d124 100644 --- a/doc/telegps-outline.txt +++ b/doc/telegps-outline.txt @@ -1,6 +1,7 @@ -= TeleGPS Outline and Hole Pattern +:notitle: :doctype: article +== TeleGPS Outline and Hole Pattern This image, when printed, provides a precise template for the mounting holes in TeleGPS. TeleGPS has overall dimensions of 1.000 x 1.500 inches, and the mounting holes are sized for diff --git a/doc/telegps-release-notes.inc b/doc/telegps-release-notes.inc index 9c1353f8..ec1135cb 100644 --- a/doc/telegps-release-notes.inc +++ b/doc/telegps-release-notes.inc @@ -2,75 +2,75 @@ == Release Notes :leveloffset: 2 - include::release-notes-1.8.6.raw[] + include::release-notes-1.8.6.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.5.raw[] + include::release-notes-1.8.5.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.4.raw[] + include::release-notes-1.8.4.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.3.raw[] + include::release-notes-1.8.3.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.2.raw[] + include::release-notes-1.8.2.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.1.raw[] + include::release-notes-1.8.1.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.8.raw[] + include::release-notes-1.8.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.7.raw[] + include::release-notes-1.7.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.8.raw[] + include::release-notes-1.6.8.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.5.raw[] + include::release-notes-1.6.5.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.4.raw[] + include::release-notes-1.6.4.adoc[] :leveloffset: 2 - include::release-notes-1.6.3.raw[] + include::release-notes-1.6.3.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.2.raw[] + include::release-notes-1.6.2.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.1.raw[] + include::release-notes-1.6.1.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.6.raw[] + include::release-notes-1.6.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.5.raw[] + include::release-notes-1.5.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.4.2.raw[] + include::release-notes-1.4.2.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.4.1.raw[] + include::release-notes-1.4.1.adoc[] <<<< :leveloffset: 2 - include::release-notes-1.4.raw[] + include::release-notes-1.4.adoc[] diff --git a/doc/telegps-system-operation.inc b/doc/telegps-system-operation.inc index c9fce7f0..e788bc7c 100644 --- a/doc/telegps-system-operation.inc +++ b/doc/telegps-system-operation.inc @@ -21,7 +21,7 @@ :aprsdevices: TeleGPS :configure_section: _configure_device - include::aprs-operation.raw[] + include::aprs-operation.adoc[] === Configurable Parameters diff --git a/doc/telegps.txt b/doc/telegps.txt index 47eafe37..8b558dbd 100644 --- a/doc/telegps.txt +++ b/doc/telegps.txt @@ -1,25 +1,39 @@ = TeleGPS Owner's Manual +Keith Packard ; Bdale Garbee +:title-logo-image: image:../themes/background.png[] +:revnumber: v1.8.7 +:revdate: 8 Oct 2018 +:revremark: Fix TeleBT v4.0 RF calibration to factory value when reflashing. Fix map images. Fix Mac OS X support. +:copyright: Bdale Garbee and Keith Packard 2018 +:stylesheet: am.css +:linkcss: +:toc: :doctype: book :numbered: :telegps: 1 :radio: 1 :gps: 1 :application: TeleGPS +:pdf-stylesdir: . +:pdf-style: altusmetrum +:pdf-fontsdir: fonts - include::telegps-dedication.raw[] + include::header.adoc[] - include::telegps-quick-start.raw[] + include::telegps-dedication.adoc[] - include::telegps-using.raw[] + include::telegps-quick-start.adoc[] - include::telegps-application.raw[] + include::telegps-using.adoc[] - include::telegps-system-operation.raw[] + include::telegps-application.adoc[] - include::handling.raw[] + include::telegps-system-operation.adoc[] - include::telegps-specs.raw[] + include::handling.adoc[] - include::telegps-updating-firmware.raw[] + include::telegps-specs.adoc[] - include::telegps-release-notes.raw[] + include::telegps-updating-firmware.adoc[] + + include::telegps-release-notes.adoc[] diff --git a/doc/telemega-outline.txt b/doc/telemega-outline.txt index 1af91894..7b1d9269 100644 --- a/doc/telemega-outline.txt +++ b/doc/telemega-outline.txt @@ -1,6 +1,7 @@ -= TeleMega Outline and Hole Pattern +:notitle: :doctype: article +== TeleMega Outline and Hole Pattern This image, when printed, provides a precise template for the mounting holes in TeleMega. TeleMega has overall dimensions of 1.250 x 3.250 inches, and the mounting holes are sized for use diff --git a/doc/telemega.inc b/doc/telemega.inc index 55f77bc4..0975172f 100644 --- a/doc/telemega.inc +++ b/doc/telemega.inc @@ -1,7 +1,7 @@ == TeleMega .TeleMega Board - image::telemega-v1.0-top.jpg[width="5.5in"] + image::telemega-v1.0-top.jpg[width=400] TeleMega is a 1¼ inch by 3¼ inch circuit board. It was designed to easily fit in a 38mm coupler. Like TeleMetrum, diff --git a/doc/telemetrum-outline.txt b/doc/telemetrum-outline.txt index ab6871f9..f37fed74 100644 --- a/doc/telemetrum-outline.txt +++ b/doc/telemetrum-outline.txt @@ -1,6 +1,7 @@ -= TeleMetrum Outline and Hole Pattern +:notitle: :doctype: article +== TeleMetrum Outline and Hole Pattern This image, when printed, provides a precise template for the mounting holes in TeleMetrum. TeleMetrum has overall dimensions of 1.000 x 2.750 inches, and the mounting holes are sized for use diff --git a/doc/telemetrum.inc b/doc/telemetrum.inc index 7c9dadb5..35aec6cc 100644 --- a/doc/telemetrum.inc +++ b/doc/telemetrum.inc @@ -1,10 +1,10 @@ == TeleMetrum .TeleMetrum v2 Board - image::telemetrum-v2.0-th.jpg[width="5.5in"] + image::telemetrum-v2.0-th.jpg[width=400] .TeleMetrum v1 Board - image::telemetrum-v1.1-thside.jpg[width="5.5in"] + image::telemetrum-v1.1-thside.jpg[width=400] TeleMetrum is a 1 inch by 2¾ inch circuit board. It was designed to fit inside coupler for 29mm air-frame tubing, but using it in a tube that @@ -39,7 +39,7 @@ .TeleMetrum Screw Terminals [options="header",grid="all",cols="2,3,10"] - |========================= + |=== |Terminal #|Terminal Name|Description |1 |Switch Output |Switch connection to flight computer |2 |Switch Input |Switch connection to positive battery terminal @@ -47,7 +47,7 @@ |4 |Main - |Main pyro channel connection to pyro circuit |5 |Apogee + |Apogee pyro channel common connection to battery + |6 |Apogee - |Apogee pyro channel connection to pyro circuit - |======================== + |=== === Using a Separate Pyro Battery with TeleMetrum diff --git a/doc/telemetry.txt b/doc/telemetry.txt index d7399b6a..ae9c7f9f 100644 --- a/doc/telemetry.txt +++ b/doc/telemetry.txt @@ -1,7 +1,18 @@ = AltOS Telemetry +Keith Packard ; Bdale Garbee +:revnumber: v1.8.7 +:revdate: 8 Oct 2018 +:copyright: Bdale Garbee and Keith Packard 2018 +:stylesheet: am.css +:linkcss: :doctype: article :toc: :numbered: +:pdf-stylesdir: . +:pdf-style: altusmetrum +:pdf-fontsdir: fonts + + include::header.adoc[] == Packet Format Design diff --git a/doc/telemini-v1-outline.txt b/doc/telemini-v1-outline.txt index bce3f651..e331cf8d 100644 --- a/doc/telemini-v1-outline.txt +++ b/doc/telemini-v1-outline.txt @@ -1,6 +1,8 @@ -= TeleMini v1 Outline and Hole Pattern +:notitle: :doctype: article +== TeleMini v1 Outline and Hole Pattern + This image, when printed, provides a precise template for the mounting holes in TeleMini. TeleMini v1 has overall dimensions of 0.500 x 1.500 inches, and the mounting holes are sized for use diff --git a/doc/telemini-v3-outline.txt b/doc/telemini-v3-outline.txt index bb26ed6e..57a738eb 100644 --- a/doc/telemini-v3-outline.txt +++ b/doc/telemini-v3-outline.txt @@ -1,6 +1,7 @@ -= TeleMini v3 Outline and Hole Pattern +:notitle: :doctype: article +== TeleMini v3 Outline and Hole Pattern This image, when printed, provides a precise template for the mounting holes in TeleMini v3. TeleMini v3 has overall dimensions of 0.500 x 1.670 inches, and the mounting holes are sized for use diff --git a/doc/telemini.inc b/doc/telemini.inc index 08893dfb..b7b26a8a 100644 --- a/doc/telemini.inc +++ b/doc/telemini.inc @@ -1,8 +1,8 @@ == TeleMini .TeleMini v3 Board - image::telemini-v3.0-top.jpg[width="5.5in"] - image::telemini-v3.0-bottom.jpg[width="5.5in"] + image::telemini-v3.0-top.jpg[width=400] + image::telemini-v3.0-bottom.jpg[width=400] TeleMini v3 is 0.5 inches by 1.67 inches. It was designed to fit inside an 18mm air-frame tube, but using it in @@ -152,5 +152,5 @@ power switch. .TeleMini v1 Board - image::telemini-v1-top.jpg[width="5.5in"] + image::telemini-v1-top.jpg[width=400] diff --git a/doc/updating-firmware.inc b/doc/updating-firmware.inc index d2883829..ee2f5e9a 100644 --- a/doc/updating-firmware.inc +++ b/doc/updating-firmware.inc @@ -27,10 +27,14 @@ http://www.altusmetrum.org/AltOS/ ifdef::telemega[] + === Updating TeleMega, TeleMetrum v2, EasyMega, EasyMini or TeleDongle v3 Firmware + endif::telemega[] ifndef::telemega[] + === Updating EasyMini Firmware + endif::telemega[] Self-programmable devices are reprogrammed by diff --git a/doc/using-am-products.inc b/doc/using-am-products.inc index 1969529f..1c1ff10e 100644 --- a/doc/using-am-products.inc +++ b/doc/using-am-products.inc @@ -1,12 +1,14 @@ == Using Altus Metrum Products ifdef::radio[] + === Being Legal In the US, you need an link:http://www.altusmetrum.org/Radio/[amateur radio license] or other authorization to legally operate the radio transmitters that are part of our products. + endif::radio[] -- cgit v1.2.3 From 41fed74c4cf139de6bf8f1879d370977785ad1f8 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 25 Oct 2018 16:56:24 -0700 Subject: Remove cc1111 products from 'fat_altos' list, which is used for keithp-fat Signed-off-by: Keith Packard --- Makefile.am | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 602226f5..8d948ecd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -52,20 +52,14 @@ fat_android = \ fat_altos = \ src/easymega-v1.0/easymega-v1.0-$(VERSION).ihx \ src/easymini-v1.0/easymini-v1.0-$(VERSION).ihx \ - src/telebt-v1.0/telebt-v1.0-$(VERSION).ihx \ src/telebt-v3.0/telebt-v3.0-$(VERSION).ihx \ src/telebt-v4.0/telebt-v4.0-$(VERSION).ihx \ - src/teledongle-v0.2/teledongle-v0.2-$(VERSION).ihx \ src/teledongle-v3.0/teledongle-v3.0-$(VERSION).ihx \ src/telegps-v1.0/telegps-v1.0-$(VERSION).ihx \ src/telegps-v2.0/telegps-v2.0-$(VERSION).ihx \ src/telemega-v1.0/telemega-v1.0-$(VERSION).ihx \ src/telemega-v2.0/telemega-v2.0-$(VERSION).ihx \ - src/telemetrum-v1.0/telemetrum-v1.0-$(VERSION).ihx \ - src/telemetrum-v1.1/telemetrum-v1.1-$(VERSION).ihx \ - src/telemetrum-v1.2/telemetrum-v1.2-$(VERSION).ihx \ - src/telemetrum-v2.0/telemetrum-v2.0-$(VERSION).ihx \ - src/telemini-v1.0/telemini-v1.0-$(VERSION).ihx + src/telemetrum-v2.0/telemetrum-v2.0-$(VERSION).ihx keithp-fat: fat ssh keithp.com mkdir -p public_html/altos-$(VERSION) -- cgit v1.2.3 From d859a7f65baf6c5c170f14fb2d9401b5c607a254 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 25 Oct 2018 17:01:38 -0700 Subject: doc: Remove asciidoc related files These all helped asciidoc generate documentation Signed-off-by: Keith Packard --- doc/.gitignore | 3 - doc/Makefile.am | 8 +- doc/altos-docinfo.xml | 33 - doc/altusmetrum-docinfo.xml | 289 -------- doc/am-fo.xsl | 231 ------ doc/am-html.xsl | 14 - doc/common.xsl | 124 ---- doc/companion-docinfo.xml | 28 - doc/easymini-docinfo.xml | 62 -- doc/footer.templates.xsl | 52 -- doc/fop.xconf | 88 --- doc/micropeak-docinfo.xml | 90 --- doc/telegps-docinfo.xml | 107 --- doc/telemetry-docinfo.xml | 28 - doc/titlepage.templates.tmpl | 1587 ------------------------------------------ 15 files changed, 4 insertions(+), 2740 deletions(-) delete mode 100644 doc/altos-docinfo.xml delete mode 100644 doc/altusmetrum-docinfo.xml delete mode 100644 doc/am-fo.xsl delete mode 100644 doc/am-html.xsl delete mode 100644 doc/common.xsl delete mode 100644 doc/companion-docinfo.xml delete mode 100644 doc/easymini-docinfo.xml delete mode 100644 doc/footer.templates.xsl delete mode 100644 doc/fop.xconf delete mode 100644 doc/micropeak-docinfo.xml delete mode 100644 doc/telegps-docinfo.xml delete mode 100644 doc/telemetry-docinfo.xml delete mode 100644 doc/titlepage.templates.tmpl diff --git a/doc/.gitignore b/doc/.gitignore index 27a951c4..89b762b3 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -1,8 +1,5 @@ *.html *.pdf -*.fo *.raw *.adoc -titlepage.templates.xsl -fop-cfg.xml map-loading.svg diff --git a/doc/Makefile.am b/doc/Makefile.am index b5839bea..f7ba9647 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -271,13 +271,13 @@ all: $(HTML) $(PDF) map-loading.adoc: $(MAP_SVG_FILES) -altusmetrum.pdf altusmetrum.html: altusmetrum-docinfo.xml $(ADOC_FILES) $(IMAGES) +altusmetrum.pdf altusmetrum.html: $(ADOC_FILES) $(IMAGES) -telegps.html telegps.pdf: telegps-docinfo.xml $(TELEGPS_ADOC_FILES) $(IMAGES) +telegps.html telegps.pdf: $(TELEGPS_ADOC_FILES) $(IMAGES) -micropeak.pdf micropeak.html: micropeak-docinfo.xml $(MICROPEAK_ADOC_FILES) $(IMAGES) +micropeak.pdf micropeak.html: $(MICROPEAK_ADOC_FILES) $(IMAGES) -easymini.pdf easymini.html: easymini-docinfo.xml $(EASYMINI_ADOC_FILES) $(IMAGES) +easymini.pdf easymini.html: $(EASYMINI_ADOC_FILES) $(IMAGES) telemini-v1-outline.pdf: telemini-v1-outline.txt telemini-v1.svg diff --git a/doc/altos-docinfo.xml b/doc/altos-docinfo.xml deleted file mode 100644 index b9193a8f..00000000 --- a/doc/altos-docinfo.xml +++ /dev/null @@ -1,33 +0,0 @@ -Altos Metrum Operating System - - Keith - Packard - keithp@keithp.com - -05 November 2012 - - 2012 - Keith Packard - - - - This document is released under the terms of the - - Creative Commons ShareAlike 3.0 - - license. - - - - - - 1.1 - 05 November 2012 - Portable version - - - 0.1 - 22 November 2010 - Initial content - - diff --git a/doc/altusmetrum-docinfo.xml b/doc/altusmetrum-docinfo.xml deleted file mode 100644 index 18bc644d..00000000 --- a/doc/altusmetrum-docinfo.xml +++ /dev/null @@ -1,289 +0,0 @@ -An Owner's Manual for Altus Metrum Rocketry Electronics - - Bdale - Garbee - bdale@gag.com - - - Keith - Packard - keithp@keithp.com - - - Bob - Finch - - - Anthony - Towns - - - 2018 - Bdale Garbee and Keith Packard - - - - - - - - - - - - - - - - - - This document is released under the terms of the - - Creative Commons ShareAlike 3.0 - - license. - - - - - - 1.8.7 - 8 Oct 2018 - - Include TeleMega v3.0 firmware in release. Fix TeleBT v4.0 RF - calibration to factory value when reflashing. Fix map images. - Fix Mac OS X support. - - - - 1.8.6 - 6 Aug 2018 - - Various pyro channel configuration updates. - - - - 1.8.5 - 18 Mar 2018 - - Minor ground station software updates. - - - - 1.8.4 - 20 Dec 2017 - - Support EasyMini v2.0 hardware. - - - - 1.8.3 - 11 Dec 2017 - - Support TeleMega v3.0 hardware. Fix one firmware bug affecting - all flight computers and another two affecting TeleMega and - EasyMega. Several new AltosUI graphing features. - - - - 1.8.2 - 18 Sep 2017 - - Support TeleGPS v2.0 hardware. Add accelerometer recalibration - UI. - - - - 1.8.1 - 27 Aug 2017 - - Fix Apogee Lockout time value wrapping bug. Change high-speed - Kalman filter function. - - - - 1.8 - 12 Aug 2017 - - Add support for TeleBT v4.0, updates in data analysis code - - - - 1.7 - 21 Apr 2017 - - Add support for TeleMini v3.0 in firmware, AltosUI and AltosDroid - - - - 1.6.8 - 4 Sep 2016 - - Minor release fixing another TeleMega and TeleMetrum v2.0 bug - which could result in loss of data logging and telemetry in - flight. Also fixed an AltosUI bug which would hide some pad - status values and never show them again. - - - - 1.6.5 - 8 Jul 2016 - - Minor release fixing TeleMega and TeleMetrum v2.0 bug which - would often result in loss of data logging and telemetry in - flight. Thanks to Chuck Haskin for help characterizing the bug - and testing this release. - - - - 1.6.4 - 10 May 2016 - - Minor release fixing TeleBT v1.0 flow control and a few minor - application bugs. - - - - 1.6.3 - 21 April 2016 - - Minor release adding idle mode to AltosDroid and fixing various - host software bugs. - - - - 1.6.2 - 10 January 2016 - - Minor release adding TeleMega v2.0 support. - - - - 1.6.1 - 15 July 2015 - - Minor release adding TeleBT v3.0 support. - - - - 1.6 - 8 January 2015 - - Major release adding TeleDongle v3.0 support. - - - - 1.5 - 6 September 2014 - - Major release adding EasyMega support. - - - - 1.4.2 - 17 August 2014 - - Minor release fixing some Windows installation bugs. - - - - 1.4.1 - 20 June 2014 - - Minor release fixing some installation bugs. - - - - 1.4 - 15 June 2014 - - Major release adding TeleGPS support. - - - - 1.3.2 - 24 January 2014 - - Bug fixes for TeleMega and AltosUI. - - - - 1.3.1 - 21 January 2014 - - Bug fixes for TeleMega and TeleMetrum v2.0 along with a few - small UI improvements. - - - - 1.3 - 12 November 2013 - - Updated for software version 1.3. Version 1.3 adds support - for TeleMega, TeleMetrum v2.0 and EasyMini - and fixes bugs in AltosUI and the AltOS firmware. - - - - 1.2.1 - 21 May 2013 - - Updated for software version 1.2. Version 1.2 adds support - for TeleBT and AltosDroid. It also adds a few minor features - and fixes bugs in AltosUI and the AltOS firmware. - - - - 1.2 - 18 April 2013 - - Updated for software version 1.2. Version 1.2 adds support - for MicroPeak and the MicroPeak USB interface. - - - - 1.1.1 - 16 September 2012 - - Updated for software version 1.1.1 Version 1.1.1 fixes a few - bugs found in version 1.1. - - - - 1.1 - 13 September 2012 - - Updated for software version 1.1. Version 1.1 has new - features but is otherwise compatible with version 1.0. - - - - 1.0 - 24 August 2011 - - Updated for software version 1.0. Note that 1.0 represents a - telemetry format change, meaning both ends of a link - (TeleMetrum/TeleMini and TeleDongle) must be updated or - communications will fail. - - - - 0.9 - 18 January 2011 - - Updated for software version 0.9. Note that 0.9 represents a - telemetry format change, meaning both ends of a link (TeleMetrum and - TeleDongle) must be updated or communications will fail. - - - - 0.8 - 24 November 2010 - Updated for software version 0.8 - - - 0.7.1 - 29 September 2010 - Added AltosUI - - diff --git a/doc/am-fo.xsl b/doc/am-fo.xsl deleted file mode 100644 index 605339d4..00000000 --- a/doc/am-fo.xsl +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - - - - - - - - - -false - -left - - - - -11 - - pt - - - - - -10 1 1 - - - - - - - - - - - - - - - - - - - - - - - - - 0pt - 0pt - 1pc - - - - - -1pc - 0pt - 0pt - - - - - - 0.75in - 0.75in - - - - - 0.5in - 0.5in - - - - - - - - - - - - - - - - -0.5pt -#78079a -0.5pt -0.5pt -#78079a - - - - - - pt - - - - - - - pt - - - - - - - pt - - - - - - - pt - - - - - - - pt - - - - - 11pt - bold - center - - - - 11pt - bold - center - - - - 0.5pt solid #78079a - 50% - - - - 0.5pt solid #78079a - 11pt - 2pt - - - - 11pt - - - - normal - #78079a - - - - normal - #78079a - - - - normal - #ff4040 - - - - normal - #78079a - - - - solid - 1pt - silver - #ffffee - 12pt - 12pt - 6pt - 6pt - 0pt - 12pt - 6pt - 6pt - - - - - - - - #ffffff - inherit - - - - - - - auto - - - diff --git a/doc/am-html.xsl b/doc/am-html.xsl deleted file mode 100644 index cdfe27f8..00000000 --- a/doc/am-html.xsl +++ /dev/null @@ -1,14 +0,0 @@ - - - - - diff --git a/doc/common.xsl b/doc/common.xsl deleted file mode 100644 index 94b120af..00000000 --- a/doc/common.xsl +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - 1 - 0 - - - - - - -images/icons/ -0 - - - - 0 - #E0E0E0 - - - -images/icons/ - - - margin-left: 0; margin-right: 10%; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12pt - bold - center - - - - 0.5pt solid #78079a - 50% - - - - 0.5pt solid #78079a - 12pt - 2pt - - - - - - - - - - - - -article toc,title -book toc,title,figure,table,example,equation - - -chapter toc,title -part toc,title -preface toc,title -qandadiv toc -qandaset toc -reference toc,title -sect1 toc -sect2 toc -sect3 toc -sect4 toc -sect5 toc -section toc -set toc,title - - - -article nop -book nop - - - - - diff --git a/doc/companion-docinfo.xml b/doc/companion-docinfo.xml deleted file mode 100644 index 243bded0..00000000 --- a/doc/companion-docinfo.xml +++ /dev/null @@ -1,28 +0,0 @@ -Protocol Definitions - - Keith - Packard - keithp@keithp.com - -13 January 2012 - - 2012 - Keith Packard - - - - This document is released under the terms of the - - Creative Commons ShareAlike 3.0 - - license. - - - - - - 0.1 - 13 January 2012 - Initial content - - diff --git a/doc/easymini-docinfo.xml b/doc/easymini-docinfo.xml deleted file mode 100644 index 85baba1e..00000000 --- a/doc/easymini-docinfo.xml +++ /dev/null @@ -1,62 +0,0 @@ -A Dual-Deploy Rocketry Flight Computer - - Bdale - Garbee - bdale@gag.com - - - Keith - Packard - keithp@keithp.com - - - 2016 - Bdale Garbee and Keith Packard - - - - - - - - - - - - - - - - - - This document is released under the terms of the - - Creative Commons ShareAlike 3.0 - - license. - - - - - - 1.8.4 - 20 Dec 2017 - - Support EasyMini v2.0 hardware. - - - - 1.6.3 - 21 April 2016 - - Minor release fixing various host software bugs. - - - - 1.6.2 - 10 January 2016 - - First release of separate EasyMini doc - - - diff --git a/doc/footer.templates.xsl b/doc/footer.templates.xsl deleted file mode 100644 index 3484c0eb..00000000 --- a/doc/footer.templates.xsl +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/fop.xconf b/doc/fop.xconf deleted file mode 100644 index 9ac42820..00000000 --- a/doc/fop.xconf +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - . - - - 72 - - 72 - - - - - - - - - - - flate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/micropeak-docinfo.xml b/doc/micropeak-docinfo.xml deleted file mode 100644 index 6fab12b8..00000000 --- a/doc/micropeak-docinfo.xml +++ /dev/null @@ -1,90 +0,0 @@ -A recording altimeter for hobby rocketry - - Keith - Packard - keithp@keithp.com - - - 2018 - Keith Packard - - - - - - - - - - - - - - - - This document is released under the terms of the - - Creative Commons ShareAlike 3.0 - - license. - - - - - - 1.8.7 - 8 October 2018 - - Poll for MicroPeak USB while the device dialog is open. Fix Mac OS X support. - - - - 1.8.6 - 6 August 2018 - - Report altimeter-recorded maximum height value - - - - 1.3.2 - 12 February 2014 - - Add a "Download" button to the main window, which makes it - quicker to access the download function. Update the data - download documentation to reflect the new MicroPeak USB - adapter design. Monitor data during download to let you see - if the USB connection is working at all by showing the - characters received from the MicroPeak USB adapter. - - - - 1.2 - 20 January 2013 - - Add documentation for the MicroPeak USB adapter board. Note - the switch to a Kalman filter for peak altitude - determination. - - - - 1.1 - 12 December 2012 - - Add comments about EEPROM storage format and programming jig. - - - - 1.0 - 18 November 2012 - - Updates for version 1.0 release. - - - - 0.1 - 29 October 2012 - - Initial release with preliminary hardware. - - - diff --git a/doc/telegps-docinfo.xml b/doc/telegps-docinfo.xml deleted file mode 100644 index 4d3533de..00000000 --- a/doc/telegps-docinfo.xml +++ /dev/null @@ -1,107 +0,0 @@ -An Owner's Manual for the TeleGPS recording GPS tracker - - Bdale - Garbee - bdale@gag.com - - - Keith - Packard - keithp@keithp.com - - - 2018 - Bdale Garbee and Keith Packard - - - - - - - - - - - - - - - - - This document is released under the terms of the - - Creative Commons ShareAlike 3.0 - - license. - - - - - - 1.8.7 - 08 Oct 2018 - - Fix TeleBT v4.0 RF calibration to factory value when - reflashing. Fix map images. Fix Mac OS X support. - - - - 1.8.3 - 11 Dec 2017 - - New graphing features. Improve reliability of data - download. Update KML export to satisfy Tripoli Records board - requirements. - - - - 1.6.4 - 10 May 2016 - - Minor release fixing TeleBT v1.0 flow control and a few minor - application bugs. - - - - 1.6.1 - 15 July 2015 - - Minor release adding TeleBT v3.0 support. - - - - 1.6 - 8 January 2015 - - Major release adding TeleDongle v3.0 support. - - - - 1.5 - 6 September 2014 - - Major release adding EasyMega support. - - - - 1.4.2 - 17 August 2014 - - Minor release fixing some Windows installation bugs. - - - - 1.4.1 - 20 June 2014 - - Minor release fixing some installation bugs. - - - - 1.4 - 15 June 2014 - - Initial version - - - diff --git a/doc/telemetry-docinfo.xml b/doc/telemetry-docinfo.xml deleted file mode 100644 index 19f90ca4..00000000 --- a/doc/telemetry-docinfo.xml +++ /dev/null @@ -1,28 +0,0 @@ -Packet Definitions - - Keith - Packard - keithp@keithp.com - -1 July 2011 - - 2011 - Keith Packard - - - - This document is released under the terms of the - - Creative Commons ShareAlike 3.0 - - license. - - - - - - 0.1 - 1 July 2011 - Initial content - - diff --git a/doc/titlepage.templates.tmpl b/doc/titlepage.templates.tmpl deleted file mode 100644 index f437fb76..00000000 --- a/doc/titlepage.templates.tmpl +++ /dev/null @@ -1,1587 +0,0 @@ - - - - - - - - - - - - -]> - - - - - - - - - - - - - - - <subtitle/> - - <date/> - - <corpauthor space-before="0.5em" - font-size="&hsize2;"/> - <authorgroup space-before="0.5em" - font-size="&hsize2;"/> - <author space-before="0.5em" - font-size="&hsize2;"/> - - <!-- If you add editor, include this t:predicate attribute - because only the first editor generates the list of editors. - <editor t:predicate="[position() = 1]"/> - --> - <othercredit space-before="0.15in"/> - <releaseinfo space-before="0.15in"/> - <copyright space-before="0.15in"/> - <legalnotice text-align="start" - margin-left="0.5in" - margin-right="0.5in" - font-family="{$body.fontset}"/> - <pubdate space-before="0.15in"/> - <revision space-before="0.15in"/> - <revhistory space-before="0.15in"/> - <abstract space-before="0.15in" - text-align="start" - margin-left="0.5in" - margin-right="0.5in" - font-family="{$body.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - -<t:titlepage t:element="set" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:named-template="division.title" - param:node="ancestor-or-self::set[1]" - text-align="center" - font-size="&hsize5;" - space-before="&hsize5space;" - font-weight="bold" - font-family="{$title.fontset}"/> - <subtitle - font-family="{$title.fontset}" - text-align="center"/> - <corpauthor space-before="0.25in"/> - <authorgroup/> - <author/> - <othercredit/> - <releaseinfo/> - <copyright/> - <legalnotice/> - <pubdate/> - <revision/> - <revhistory/> - <abstract/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - -<t:titlepage t:element="book" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:named-template="division.title" - param:node="ancestor-or-self::book[1]" - text-align="center" - font-size="&hsize5;" - space-before="&hsize5space;" - font-weight="bold" - font-family="{$title.fontset}"/> - <subtitle - text-align="center" - font-size="&hsize4;" - space-before="&hsize4space;" - font-family="{$title.fontset}"/> -<!-- - <corpauthor font-size="&hsize3;" - keep-with-next.within-column="always" - space-before="2in"/> - --> - <authorgroup space-before="2in"/> - <author font-size="&hsize3;" - space-before="&hsize2space;" - keep-with-next.within-column="always"/> - <!-- If you add editor, include this t:predicate attribute - because only the first editor generates the list of editors. - <editor t:predicate="[position() = 1]"/> - --> - <mediaobject space-before="1.5in"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - <title - t:named-template="book.verso.title" - font-size="&hsize2;" - font-weight="bold" - font-family="{$title.fontset}"/> - <authorgroup t:named-template="verso.authorgroup"/> - <author/> - <!-- If you add editor, include this t:predicate attribute - because only the first editor generates the list of editors. - <editor t:predicate="[position() = 1]"/> - --> - <othercredit/> - <releaseinfo space-before="0.15in"/> - <pubdate space-before="1em"/> - <copyright/> - <abstract/> - <legalnotice font-size="8pt"/> - <corpauthor text-align="center" space-before="0.5in"/> - <revhistory space-before="0.5in"/> - </t:titlepage-content> - - <t:titlepage-separator> - <fo:block break-after="page"/> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - <fo:block break-after="page"/> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - -<t:titlepage t:element="part" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:named-template="division.title" - param:node="ancestor-or-self::part[1]" - text-align="center" - font-size="&hsize5;" - space-before="&hsize5space;" - font-weight="bold" - font-family="{$title.fontset}"/> - <subtitle - text-align="center" - font-size="&hsize4;" - space-before="&hsize4space;" - font-weight='bold' - font-style='italic' - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<t:titlepage t:element="partintro" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - text-align="center" - font-size="&hsize5;" - font-weight="bold" - space-before="1em" - font-family="{$title.fontset}"/> - <subtitle - text-align="center" - font-size="&hsize2;" - font-weight="bold" - font-style="italic" - font-family="{$title.fontset}"/> - <corpauthor/> - <authorgroup/> - <author/> - <othercredit/> - <releaseinfo/> - <copyright/> - <legalnotice/> - <pubdate/> - <revision/> - <revhistory/> - <abstract/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - -<t:titlepage t:element="reference" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:named-template="division.title" - param:node="ancestor-or-self::reference[1]" - text-align="center" - font-size="&hsize5;" - space-before="&hsize5space;" - font-weight="bold" - font-family="{$title.fontset}"/> - <subtitle - font-family="{$title.fontset}" - text-align="center"/> - <corpauthor/> - <authorgroup/> - <author/> - <othercredit/> - <releaseinfo/> - <copyright/> - <legalnotice/> - <pubdate/> - <revision/> - <revhistory/> - <abstract/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - -<t:titlepage t:element="refsynopsisdiv" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - -<t:titlepage t:element="refsection" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - -<t:titlepage t:element="refsect1" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - -<t:titlepage t:element="refsect2" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - -<t:titlepage t:element="refsect3" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - - <t:titlepage t:element="dedication" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="component.title" - param:node="ancestor-or-self::dedication[1]" - margin-left="{$title.margin.left}" - font-size="&hsize5;" - font-family="{$title.fontset}" - font-weight="bold"/> - <subtitle - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - -<!-- Same formatting as dedication --> - <t:titlepage t:element="acknowledgements" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="component.title" - param:node="ancestor-or-self::acknowledgements[1]" - margin-left="{$title.margin.left}" - font-size="&hsize5;" - font-family="{$title.fontset}" - font-weight="bold"/> - <subtitle - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - - -<!-- ==================================================================== --> - - <t:titlepage t:element="preface" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="component.title" - param:node="ancestor-or-self::preface[1]" - margin-left="{$title.margin.left}" - font-size="&hsize5;" - font-family="{$title.fontset}" - font-weight="bold"/> - <subtitle - font-family="{$title.fontset}"/> - <corpauthor/> - <authorgroup/> - <author/> - <othercredit/> - <releaseinfo/> - <copyright/> - <legalnotice/> - <pubdate/> - <revision/> - <revhistory/> - <abstract/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - - <t:titlepage t:element="chapter" t:wrapper="fo:block" - font-family="{$title.fontset}"> - <t:titlepage-content t:side="recto" margin-left="{$title.margin.left}"> - <title t:named-template="component.title" - param:node="ancestor-or-self::chapter[1]" - font-size="&hsize5;" - font-weight="bold"/> - - <subtitle space-before="0.5em" - font-style="italic" - font-size="&hsize2;" - font-weight="bold"/> - - <corpauthor space-before="0.5em" - space-after="0.5em" - font-size="&hsize2;"/> - - <authorgroup space-before="0.5em" - space-after="0.5em" - font-size="&hsize2;"/> - - <author space-before="0.5em" - space-after="0.5em" - font-size="&hsize2;"/> - - <othercredit/> - <releaseinfo/> - <copyright/> - <legalnotice/> - <pubdate/> - <revision/> - <revhistory/> - <abstract/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - - <t:titlepage t:element="appendix" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:named-template="component.title" - param:node="ancestor-or-self::appendix[1]" - margin-left="{$title.margin.left}" - font-size="&hsize5;" - font-weight="bold" - font-family="{$title.fontset}"/> - <subtitle - font-family="{$title.fontset}"/> - <corpauthor/> - <authorgroup/> - <author/> - <othercredit/> - <releaseinfo/> - <copyright/> - <legalnotice/> - <pubdate/> - <revision/> - <revhistory/> - <abstract/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - -<t:titlepage t:element="section" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - margin-left="{$title.margin.left}" - font-family="{$title.fontset}"/> - <subtitle - font-family="{$title.fontset}"/> - <corpauthor/> - <authorgroup/> - <author/> - <othercredit/> - <releaseinfo/> - <copyright/> - <legalnotice/> - <pubdate/> - <revision/> - <revhistory/> - <abstract/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<t:titlepage t:element="sect1" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - margin-left="{$title.margin.left}" - font-family="{$title.fontset}"/> - <subtitle - font-family="{$title.fontset}"/> - <corpauthor/> - <authorgroup/> - <author/> - <othercredit/> - <releaseinfo/> - <copyright/> - <legalnotice/> - <pubdate/> - <revision/> - <revhistory/> - <abstract/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<t:titlepage t:element="sect2" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - margin-left="{$title.margin.left}" - font-family="{$title.fontset}"/> - <subtitle - font-family="{$title.fontset}"/> - <corpauthor/> - <authorgroup/> - <author/> - <othercredit/> - <releaseinfo/> - <copyright/> - <legalnotice/> - <pubdate/> - <revision/> - <revhistory/> - <abstract/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<t:titlepage t:element="sect3" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - margin-left="{$title.margin.left}" - font-family="{$title.fontset}"/> - <subtitle - font-family="{$title.fontset}"/> - <corpauthor/> - <authorgroup/> - <author/> - <othercredit/> - <releaseinfo/> - <copyright/> - <legalnotice/> - <pubdate/> - <revision/> - <revhistory/> - <abstract/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<t:titlepage t:element="sect4" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - margin-left="{$title.margin.left}" - font-family="{$title.fontset}"/> - <subtitle - font-family="{$title.fontset}"/> - <corpauthor/> - <authorgroup/> - <author/> - <othercredit/> - <releaseinfo/> - <copyright/> - <legalnotice/> - <pubdate/> - <revision/> - <revhistory/> - <abstract/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<t:titlepage t:element="sect5" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - margin-left="{$title.margin.left}" - font-family="{$title.fontset}"/> - <subtitle - font-family="{$title.fontset}"/> - <corpauthor/> - <authorgroup/> - <author/> - <othercredit/> - <releaseinfo/> - <copyright/> - <legalnotice/> - <pubdate/> - <revision/> - <revhistory/> - <abstract/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<t:titlepage t:element="simplesect" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - margin-left="{$title.margin.left}" - font-family="{$title.fontset}"/> - <subtitle - font-family="{$title.fontset}"/> - <corpauthor/> - <authorgroup/> - <author/> - <othercredit/> - <releaseinfo/> - <copyright/> - <legalnotice/> - <pubdate/> - <revision/> - <revhistory/> - <abstract/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<t:titlepage t:element="topic" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - font-weight="bold" - font-size="&hsize3;" - space-before="1em" - space-after="1em" - font-family="{$title.fontset}"/> - <subtitle - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - - <t:titlepage t:element="bibliography" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="component.title" - param:node="ancestor-or-self::bibliography[1]" - margin-left="{$title.margin.left}" - font-size="&hsize5;" - font-family="{$title.fontset}" - font-weight="bold"/> - <subtitle - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - -<!-- ==================================================================== --> - - <t:titlepage t:element="bibliodiv" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title t:named-template="component.title" - param:node="ancestor-or-self::bibliodiv[1]" - margin-left="{$title.margin.left}" - font-size="&hsize4;" - font-family="{$title.fontset}" - font-weight="bold"/> - <subtitle - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - -<!-- ==================================================================== --> - - <t:titlepage t:element="glossary" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="component.title" - param:node="ancestor-or-self::glossary[1]" - margin-left="{$title.margin.left}" - font-size="&hsize5;" - font-family="{$title.fontset}" - font-weight="bold"/> - <subtitle - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - -<!-- ==================================================================== --> - - <t:titlepage t:element="glossdiv" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title t:named-template="component.title" - param:node="ancestor-or-self::glossdiv[1]" - margin-left="{$title.margin.left}" - font-size="&hsize4;" - font-family="{$title.fontset}" - font-weight="bold"/> - <subtitle - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - -<!-- ==================================================================== --> - - <t:titlepage t:element="index" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="component.title" - param:node="ancestor-or-self::index[1]" - param:pagewide="1" - margin-left="0pt" - font-size="&hsize5;" - font-family="{$title.fontset}" - font-weight="bold"/> - <subtitle - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - -<!-- ==================================================================== --> - - <!-- The indexdiv.title template is used so that manual and --> - <!-- automatically generated indexdiv titles get the same --> - <!-- formatting. --> - - <t:titlepage t:element="indexdiv" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title t:force="1" - t:named-template="indexdiv.title" - param:title="title"/> - <subtitle - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - -<!-- ==================================================================== --> - - <t:titlepage t:element="setindex" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="component.title" - param:node="ancestor-or-self::setindex[1]" - param:pagewide="1" - margin-left="0pt" - font-size="&hsize5;" - font-family="{$title.fontset}" - font-weight="bold"/> - <subtitle - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - -<!-- ==================================================================== --> - - <t:titlepage t:element="colophon" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="component.title" - param:node="ancestor-or-self::colophon[1]" - margin-left="{$title.margin.left}" - font-size="&hsize5;" - font-family="{$title.fontset}" - font-weight="bold"/> - <subtitle - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - - <t:titlepage t:element="sidebar" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - font-family="{$title.fontset}" - font-weight="bold"/> - <subtitle - font-family="{$title.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - -<!-- ==================================================================== --> -<t:titlepage t:element="qandaset" t:wrapper="fo:block" - font-family="{$title.fontset}"> - - <t:titlepage-content t:side="recto" - start-indent="0pt" - text-align="center"> - - <title t:named-template="component.title" - param:node="ancestor-or-self::qandaset[1]" - keep-with-next.within-column="always" - font-size="&hsize5;" - font-weight="bold"/> - - <subtitle/> - - <corpauthor space-before="0.5em" - font-size="&hsize2;"/> - <authorgroup space-before="0.5em" - font-size="&hsize2;"/> - <author space-before="0.5em" - font-size="&hsize2;"/> - - <othercredit space-before="0.5em"/> - <releaseinfo space-before="0.5em"/> - <copyright space-before="0.5em"/> - <legalnotice text-align="start" - margin-left="0.5in" - margin-right="0.5in" - font-family="{$body.fontset}"/> - <pubdate space-before="0.5em"/> - <revision space-before="0.5em"/> - <revhistory space-before="0.5em"/> - <abstract space-before="0.5em" - text-align="start" - margin-left="0.5in" - margin-right="0.5in" - font-family="{$body.fontset}"/> - <itermset/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> -</t:titlepage> - -<!-- ==================================================================== --> - - <t:titlepage t:element="table.of.contents" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="gentext" - param:key="'TableofContents'" - space-before.minimum="1em" - space-before.optimum="1.5em" - space-before.maximum="2em" - space-after="0.5em" - start-indent="0pt" - font-size="&hsize3;" - font-weight="bold" - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - - <t:titlepage t:element="list.of.tables" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="gentext" - param:key="'ListofTables'" - space-before.minimum="1em" - space-before.optimum="1.5em" - space-before.maximum="2em" - space-after="0.5em" - start-indent="0pt" - font-size="&hsize3;" - font-weight="bold" - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - - <t:titlepage t:element="list.of.figures" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="gentext" - param:key="'ListofFigures'" - space-before.minimum="1em" - space-before.optimum="1.5em" - space-before.maximum="2em" - space-after="0.5em" - start-indent="0pt" - font-size="&hsize3;" - font-weight="bold" - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - - <t:titlepage t:element="list.of.examples" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="gentext" - param:key="'ListofExamples'" - space-before.minimum="1em" - space-before.optimum="1.5em" - space-before.maximum="2em" - space-after="0.5em" - start-indent="0pt" - font-size="&hsize3;" - font-weight="bold" - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - - <t:titlepage t:element="list.of.equations" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="gentext" - param:key="'ListofEquations'" - space-before.minimum="1em" - space-before.optimum="1.5em" - space-before.maximum="2em" - space-after="0.5em" - start-indent="0pt" - font-size="&hsize3;" - font-weight="bold" - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - - <t:titlepage t:element="list.of.procedures" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="gentext" - param:key="'ListofProcedures'" - space-before.minimum="1em" - space-before.optimum="1.5em" - space-before.maximum="2em" - space-after="0.5em" - start-indent="0pt" - font-size="&hsize3;" - font-weight="bold" - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - - <t:titlepage t:element="list.of.unknowns" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="gentext" - param:key="'ListofUnknown'" - space-before.minimum="1em" - space-before.optimum="1.5em" - space-before.maximum="2em" - space-after="0.5em" - start-indent="0pt" - font-size="&hsize3;" - font-weight="bold" - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - - <t:titlepage t:element="component.list.of.tables" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="gentext" - param:key="'ListofTables'" - space-before.minimum="1em" - space-before.optimum="1em" - space-before.maximum="1em" - space-after="0.5em" - margin-left="{$title.margin.left}" - font-size="&hsize1;" - font-weight="bold" - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - - <t:titlepage t:element="component.list.of.figures" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="gentext" - param:key="'ListofFigures'" - space-before.minimum="1em" - space-before.optimum="1em" - space-before.maximum="1em" - space-after="0.5em" - margin-left="{$title.margin.left}" - font-size="&hsize1;" - font-weight="bold" - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - - <t:titlepage t:element="component.list.of.examples" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="gentext" - param:key="'ListofExamples'" - space-before.minimum="1em" - space-before.optimum="1em" - space-before.maximum="1em" - space-after="0.5em" - margin-left="{$title.margin.left}" - font-size="&hsize1;" - font-weight="bold" - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - - <t:titlepage t:element="component.list.of.equations" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="gentext" - param:key="'ListofEquations'" - space-before.minimum="1em" - space-before.optimum="1em" - space-before.maximum="1em" - space-after="0.5em" - margin-left="{$title.margin.left}" - font-size="&hsize1;" - font-weight="bold" - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - - <t:titlepage t:element="component.list.of.procedures" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="gentext" - param:key="'ListofProcedures'" - space-before.minimum="1em" - space-before.optimum="1em" - space-before.maximum="1em" - space-after="0.5em" - margin-left="{$title.margin.left}" - font-size="&hsize1;" - font-weight="bold" - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - - <t:titlepage t:element="component.list.of.unknowns" t:wrapper="fo:block"> - <t:titlepage-content t:side="recto"> - <title - t:force="1" - t:named-template="gentext" - param:key="'ListofUnknown'" - space-before.minimum="1em" - space-before.optimum="1em" - space-before.maximum="1em" - space-after="0.5em" - margin-left="{$title.margin.left}" - font-size="&hsize1;" - font-weight="bold" - font-family="{$title.fontset}"/> - </t:titlepage-content> - - <t:titlepage-content t:side="verso"> - </t:titlepage-content> - - <t:titlepage-separator> - </t:titlepage-separator> - - <t:titlepage-before t:side="recto"> - </t:titlepage-before> - - <t:titlepage-before t:side="verso"> - </t:titlepage-before> - </t:titlepage> - -<!-- ==================================================================== --> - -</t:templates> -- cgit v1.2.3 From e9a3268285e97b7316c3321892e77814703ff71d Mon Sep 17 00:00:00 2001 From: Keith Packard <keithp@keithp.com> Date: Thu, 1 Nov 2018 19:40:31 -0700 Subject: doc: Use icons for admonitions This replaces the text 'WARNING' or 'NOTE' with a suitable icon instead. Signed-off-by: Keith Packard <keithp@keithp.com> --- doc/Makefile.am | 18 ++++++++++-- doc/altusmetrum.txt | 3 ++ doc/am-notoc.css | 10 +++++++ doc/am.css | 10 +++++++ doc/images/icons/caution.svg | 58 +++++++++++++++++++++++++++++++++++++ doc/images/icons/important.svg | 57 ++++++++++++++++++++++++++++++++++++ doc/images/icons/note.svg | 57 ++++++++++++++++++++++++++++++++++++ doc/images/icons/tip.svg | 57 ++++++++++++++++++++++++++++++++++++ doc/images/icons/warning.svg | 65 ++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 332 insertions(+), 3 deletions(-) create mode 100644 doc/images/icons/caution.svg create mode 100644 doc/images/icons/important.svg create mode 100644 doc/images/icons/note.svg create mode 100644 doc/images/icons/tip.svg create mode 100644 doc/images/icons/warning.svg diff --git a/doc/Makefile.am b/doc/Makefile.am index f7ba9647..404feab3 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -243,6 +243,13 @@ FONTS=\ fonts/OpenSans-Semibold.ttf \ fonts/OpenSans-SemiboldItalic.ttf +ICONS=\ + images/icons/caution.svg \ + images/icons/important.svg \ + images/icons/note.svg \ + images/icons/tip.svg \ + images/icons/warning.svg + PDF_CONFIG_FILES=altusmetrum-theme.yml HTML_CONFIG_FILES= @@ -287,20 +294,25 @@ install: all WEB_ROOT=/home/bdale/web/ -publish: $(PUBLISH_DOC) $(FONTS) - cp $(PUBLISH_DOC) $(WEB_ROOT)/altusmetrum/AltOS/doc/ +publish: $(PUBLISH_DOC) $(FONTS) $(ICONS) + cp -a $(PUBLISH_DOC) $(WEB_ROOT)/altusmetrum/AltOS/doc/ mkdir -p $(WEB_ROOT)/altusmetrum/AltOS/doc/fonts/ cp $(FONTS) $(WEB_ROOT)/altusmetrum/AltOS/doc/fonts/ + mkdir -p $(WEB_ROOT)/altusmetrum/AltOS/doc/images/icons/ + cp $(ICONS) $(WEB_ROOT)/altusmetrum/AltOS/doc/images/icons/ (cd $(WEB_ROOT)/altusmetrum ; \ git add $(WEB_ROOT)/altusmetrum/AltOS/doc/* ; \ git add $(WEB_ROOT)/altusmetrum/AltOS/doc/fonts/* ; \ + git add $(WEB_ROOT)/altusmetrum/AltOS/doc/images/icons/* ;\ echo "update docs" | \ - git commit -F - $(WEB_ROOT)/altusmetrum/AltOS/doc/* $(WEB_ROOT)/altusmetrum/AltOS/doc/fonts/* ; \ + git commit -F - $(WEB_ROOT)/altusmetrum/AltOS/doc/* $(WEB_ROOT)/altusmetrum/AltOS/doc/fonts/* $(WEB_ROOT)/altusmetrum/AltOS/doc/images/icons ; \ git push) publish-keithp: am.html $(DOC) $(FONTS) + ssh keithp.com 'mkdir -p ~keithp/public_html/altos/fonts ~keithp/public_html/altos/images/icons' scp -p am.html $(DOC) keithp.com:~keithp/public_html/altos scp -p $(FONTS) keithp.com:~keithp/public_html/altos/fonts + scp -p $(ICONS) keithp.com:~keithp/public_html/altos/images/icons clean: rm -f am.html $(HTML) $(PDF) $(ADOC_FILES) $(TELEGPS_ADOC_FILES) $(MICROPEAK_ADOC_FILES) diff --git a/doc/altusmetrum.txt b/doc/altusmetrum.txt index 798301d2..85391e79 100644 --- a/doc/altusmetrum.txt +++ b/doc/altusmetrum.txt @@ -3,6 +3,8 @@ Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>; Bob Finch; Anth :title-logo-image: image:../themes/background.png[] :revnumber: v1.8.7 :revdate: 8 Oct 2018 +:icons: +:icontype: svg :revremark: Include TeleMega v3.0 firmware in release. Fix TeleBT v4.0 RF calibration to factory value when reflashing. Fix map images. Fix Mac OS X support. :copyright: Bdale Garbee and Keith Packard 2018 :doctype: book @@ -63,3 +65,4 @@ Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>; Bob Finch; Anth include::specs.adoc[] include::release-notes.adoc[] + diff --git a/doc/am-notoc.css b/doc/am-notoc.css index 6999d478..829e8b72 100644 --- a/doc/am-notoc.css +++ b/doc/am-notoc.css @@ -92,6 +92,16 @@ h1, h2, h3, h4, h5, h6 font-family: "Open Sans",sans-serif; } +td.icon { + width: 4em; + height: 3em; +} + +td.icon img { + height: 100%; + width: 100% +} + div.toc { display:none; } diff --git a/doc/am.css b/doc/am.css index 56daface..ccb50ffe 100644 --- a/doc/am.css +++ b/doc/am.css @@ -127,6 +127,16 @@ div#logo img { border-bottom: 2px solid #808080; } +td.icon { + width: 4em; + height: 3em; +} + +td.icon img { + height: 100%; + width: 100% +} + div.toc a:link { text-decoration: none; } diff --git a/doc/images/icons/caution.svg b/doc/images/icons/caution.svg new file mode 100644 index 00000000..28babba2 --- /dev/null +++ b/doc/images/icons/caution.svg @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + viewBox="0 0 384 512" + version="1.1" + id="svg4" + sodipodi:docname="caution.svg" + inkscape:version="0.92.3 (2405546, 2018-03-11)"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1574" + inkscape:window-height="1186" + id="namedview6" + showgrid="false" + inkscape:zoom="1.592106" + inkscape:cx="193.80909" + inkscape:cy="256" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg4" /> + <path + d="M216 23.858c0-23.802-30.653-32.765-44.149-13.038C48 191.851 224 200 224 288c0 35.629-29.114 64.458-64.85 63.994C123.98 351.538 96 322.22 96 287.046v-85.51c0-21.703-26.471-32.225-41.432-16.504C27.801 213.158 0 261.332 0 320c0 105.869 86.131 192 192 192s192-86.131 192-192c0-170.29-168-193.003-168-296.142z" + id="path2" + style="fill:#bf3400;fill-opacity:1" /> +</svg> +<!-- +Font Awesome Free 5.4.2 by @fontawesome - https://fontawesome.com +License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) +--> + diff --git a/doc/images/icons/important.svg b/doc/images/icons/important.svg new file mode 100644 index 00000000..4c5baae0 --- /dev/null +++ b/doc/images/icons/important.svg @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + viewBox="0 0 512 512" + version="1.1" + id="svg4" + sodipodi:docname="important.svg" + inkscape:version="0.92.3 (2405546, 2018-03-11)"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="944" + inkscape:window-height="866" + id="namedview6" + showgrid="false" + inkscape:zoom="0.4609375" + inkscape:cx="378.57627" + inkscape:cy="256" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg4" /> + <path + d="M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z" + id="path2" + style="fill:#bf0000;fill-opacity:1" /> +</svg> +<!-- +Font Awesome Free 5.4.2 by @fontawesome - https://fontawesome.com +License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) +--> + diff --git a/doc/images/icons/note.svg b/doc/images/icons/note.svg new file mode 100644 index 00000000..92f636cf --- /dev/null +++ b/doc/images/icons/note.svg @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + viewBox="0 0 512 512" + version="1.1" + id="svg4" + sodipodi:docname="note.svg" + inkscape:version="0.92.3 (2405546, 2018-03-11)"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1737" + inkscape:window-height="1219" + id="namedview6" + showgrid="false" + inkscape:zoom="1.8527527" + inkscape:cx="257.55137" + inkscape:cy="256" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg4" /> + <path + d="M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z" + id="path2" + style="fill:#19407c;fill-opacity:1" /> +</svg> +<!-- +Font Awesome Free 5.4.2 by @fontawesome - https://fontawesome.com +License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) +--> + diff --git a/doc/images/icons/tip.svg b/doc/images/icons/tip.svg new file mode 100644 index 00000000..f645f63b --- /dev/null +++ b/doc/images/icons/tip.svg @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + viewBox="0 0 352 512" + version="1.1" + id="svg4" + sodipodi:docname="tip.svg" + inkscape:version="0.92.3 (2405546, 2018-03-11)"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1737" + inkscape:window-height="1304" + id="namedview6" + showgrid="false" + inkscape:zoom="2.0057983" + inkscape:cx="175.98644" + inkscape:cy="256" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg4" /> + <path + d="M96.06 454.35c.01 6.29 1.87 12.45 5.36 17.69l17.09 25.69a31.99 31.99 0 0 0 26.64 14.28h61.71a31.99 31.99 0 0 0 26.64-14.28l17.09-25.69a31.989 31.989 0 0 0 5.36-17.69l.04-38.35H96.01l.05 38.35zM0 176c0 44.37 16.45 84.85 43.56 115.78 16.52 18.85 42.36 58.23 52.21 91.45.04.26.07.52.11.78h160.24c.04-.26.07-.51.11-.78 9.85-33.22 35.69-72.6 52.21-91.45C335.55 260.85 352 220.37 352 176 352 78.61 272.91-.3 175.45 0 73.44.31 0 82.97 0 176zm176-80c-44.11 0-80 35.89-80 80 0 8.84-7.16 16-16 16s-16-7.16-16-16c0-61.76 50.24-112 112-112 8.84 0 16 7.16 16 16s-7.16 16-16 16z" + id="path2" + style="fill:#dfd000;fill-opacity:1" /> +</svg> +<!-- +Font Awesome Free 5.4.2 by @fontawesome - https://fontawesome.com +License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) +--> + diff --git a/doc/images/icons/warning.svg b/doc/images/icons/warning.svg new file mode 100644 index 00000000..938d7b31 --- /dev/null +++ b/doc/images/icons/warning.svg @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + viewBox="0 0 576.00019 512" + version="1.1" + id="svg4" + sodipodi:docname="warning.svg" + width="576.00018" + height="512" + inkscape:version="0.92.3 (2405546, 2018-03-11)"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="2557" + inkscape:window-height="1544" + id="namedview6" + showgrid="false" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:zoom="2.4379272" + inkscape:cx="170.99331" + inkscape:cy="256" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg4" /> + <path + d="m 569.51729,440.013 c 18.458,31.994 -4.711,71.987 -41.577,71.987 H 48.054283 C 11.117287,512 -11.944713,471.945 6.4772867,440.013 L 246.42329,23.985005 c 18.467,-32.0090001 64.72,-31.9510001 83.154,0 z M 288.00029,354 c -25.405,0 -46,20.595 -46,46 0,25.405 20.595,46 46,46 25.405,0 46,-20.595 46,-46 0,-25.405 -20.595,-46 -46,-46 z m -43.673,-165.346 7.418,136 c 0.347,6.364 5.609,11.346 11.982,11.346 h 48.546 c 6.373,0 11.635,-4.982 11.982,-11.346 l 7.418,-136 c 0.375,-6.874 -5.098,-12.654 -11.982,-12.654 h -63.383 c -6.884,0 -12.356,5.78 -11.981,12.654 z" + id="path2" + style="fill:#bf6900;fill-opacity:1" + inkscape:connector-curvature="0" /> +</svg> +<!-- +Font Awesome Free 5.4.2 by @fontawesome - https://fontawesome.com +License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) +--> + -- cgit v1.2.3 From 84c04a114898d97a13f61e1006949dc3926eeba1 Mon Sep 17 00:00:00 2001 From: Bdale Garbee <bdale@gag.com> Date: Sun, 30 Dec 2018 15:16:29 -0700 Subject: update easymega turn-on script for v2.0 --- ao-bringup/turnon_easymega | 7 ++-- ao-bringup/turnon_easymega_v1.0 | 76 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 4 deletions(-) create mode 100755 ao-bringup/turnon_easymega_v1.0 diff --git a/ao-bringup/turnon_easymega b/ao-bringup/turnon_easymega index b14ed2ab..9de8d985 100755 --- a/ao-bringup/turnon_easymega +++ b/ao-bringup/turnon_easymega @@ -1,6 +1,8 @@ #!/bin/sh PRODUCT=EasyMega +VERSION=2.0 +REPO=~/altusmetrumllc/Binaries if [ -x ../ao-tools/ao-flash/ao-flash-stm ]; then STMLOAD=../ao-tools/ao-flash/ao-flash-stm @@ -16,11 +18,8 @@ else exit 1 fi -VERSION=1.0 -REPO=~/altusmetrumllc/Binaries - echo "$PRODUCT v$VERSION Turn-On and Calibration Program" -echo "Copyright 2014 by Bdale Garbee. Released under GPL v2" +echo "Copyright 2018 by Bdale Garbee. Released under GPL v2" echo echo "Expectations:" echo "\t$PRODUCT v$VERSION" diff --git a/ao-bringup/turnon_easymega_v1.0 b/ao-bringup/turnon_easymega_v1.0 new file mode 100755 index 00000000..b14ed2ab --- /dev/null +++ b/ao-bringup/turnon_easymega_v1.0 @@ -0,0 +1,76 @@ +#!/bin/sh + +PRODUCT=EasyMega + +if [ -x ../ao-tools/ao-flash/ao-flash-stm ]; then + STMLOAD=../ao-tools/ao-flash/ao-flash-stm +else + echo "Can't find ao-flash-stm! Aborting." + exit 1 +fi + +if [ -x ../ao-tools/ao-usbload/ao-usbload ]; then + USBLOAD=../ao-tools/ao-usbload/ao-usbload +else + echo "Can't find ao-usbload! Aborting." + exit 1 +fi + +VERSION=1.0 +REPO=~/altusmetrumllc/Binaries + +echo "$PRODUCT v$VERSION Turn-On and Calibration Program" +echo "Copyright 2014 by Bdale Garbee. Released under GPL v2" +echo +echo "Expectations:" +echo "\t$PRODUCT v$VERSION" +echo "\t\twith USB cable attached" +echo "\t\twith ST-Link-V2 cabled to debug header" +echo + +case $# in + 1) + SERIAL="$1" + echo "$PRODUCT-$VERSION serial number: $SERIAL" + ;; + 0) + echo -n "$PRODUCT-$VERSION serial number: " + read SERIAL + ;; + *) + echo "Usage: $0 <serial-number>" 1>&2 + exit 1; + ;; +esac + +echo $STMLOAD + +$STMLOAD $REPO/loaders/easymega-v$VERSION*.elf || exit 1 + +sleep 2 + +$USBLOAD --serial=$SERIAL $REPO/easymega-v$VERSION*.elf || exit 1 + +sleep 2 + +dev=`../ao-tools/ao-list/ao-list | awk '/'"$PRODUCT"'-v'"$VERSION"'/ { print $3; exit(0); }'` + +case "$dev" in +/dev/tty*) + echo "$PRODUCT found on $dev" + ;; +*) + echo 'No '"$PRODUCT"'-v'"$VERSION"' found' + exit 1 + ;; +esac + +echo 'E 0' > $dev + +../ao-tools/ao-cal-accel/ao-cal-accel $dev || exit 1 + +echo 'E 1' > $dev + +./test-easymega + +exit $? -- cgit v1.2.3 From 4fb00afc9018c6179c4aff897fcbb330588d02a2 Mon Sep 17 00:00:00 2001 From: Keith Packard <keithp@keithp.com> Date: Sun, 30 Dec 2018 13:42:50 -0800 Subject: altos: Make HAS_ACCEL_DEBUG build again Need to not use ao_error_h_sq_avg without HAS_ACCEL Signed-off-by: Keith Packard <keithp@keithp.com> --- src/kernel/ao_flight.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/kernel/ao_flight.c b/src/kernel/ao_flight.c index f72efa06..5a5d5b72 100644 --- a/src/kernel/ao_flight.c +++ b/src/kernel/ao_flight.c @@ -444,7 +444,9 @@ ao_flight_dump(void) printf (" max_height %d\n", ao_max_height); printf (" avg_height %d\n", ao_avg_height); printf (" error_h %d\n", ao_error_h); +#if !HAS_ACCEL printf (" error_avg %d\n", ao_error_h_sq_avg); +#endif } static void -- cgit v1.2.3 From 0d472ab07224a21abfa83da8336439d7844f9aa8 Mon Sep 17 00:00:00 2001 From: Keith Packard <keithp@keithp.com> Date: Sun, 30 Dec 2018 14:11:03 -0800 Subject: altos: Don't validate ADXL375 self test for maximum value The data sheet says this is unreliable, and that we should be using an FFT anyways. Signed-off-by: Keith Packard <keithp@keithp.com> --- src/drivers/ao_adxl375.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/drivers/ao_adxl375.c b/src/drivers/ao_adxl375.c index 778c214b..66d39ff9 100644 --- a/src/drivers/ao_adxl375.c +++ b/src/drivers/ao_adxl375.c @@ -172,7 +172,6 @@ ao_adxl375_setup(void) (0 << AO_ADXL375_POWER_CTL_SLEEP) | (AO_ADXL375_POWER_CTL_WAKEUP_8 << AO_ADXL375_POWER_CTL_WAKEUP)); - (void) ao_adxl375_total_value; /* Perform self-test */ struct ao_adxl375_total self_test_off, self_test_on; @@ -204,9 +203,16 @@ ao_adxl375_setup(void) self_test_value = z_change; - if (z_change < MIN_SELF_TEST || MAX_SELF_TEST < z_change) + if (z_change < MIN_SELF_TEST) ao_sensor_errors = 1; + /* This check is commented out as maximum self test is unreliable + + if (z_change > MAX_SELF_TEST) + ao_sensor_errors = 1; + + */ + /* Discard some samples to let it settle down */ ao_adxl375_total_value(&self_test_off, AO_ADXL375_SELF_TEST_SETTLE); } -- cgit v1.2.3 From 9791ebb256c2892663c072f7989e4b9bd34818a1 Mon Sep 17 00:00:00 2001 From: Keith Packard <keithp@keithp.com> Date: Sun, 30 Dec 2018 14:15:51 -0800 Subject: altoslib: Remove spurious debug printf in AltosCalData Signed-off-by: Keith Packard <keithp@keithp.com> --- altoslib/AltosCalData.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/altoslib/AltosCalData.java b/altoslib/AltosCalData.java index c3d79250..22d19def 100644 --- a/altoslib/AltosCalData.java +++ b/altoslib/AltosCalData.java @@ -156,8 +156,6 @@ public class AltosCalData { public double acceleration(double sensor) { double accel; accel = AltosConvert.acceleration_from_sensor(sensor, accel_plus_g, accel_minus_g, ground_accel); - System.out.printf("acceleration %g (+ %g - %g g %g) -> %g\n", - sensor, accel_plus_g, accel_minus_g, ground_accel, accel); return accel; } -- cgit v1.2.3 From 60b46436f9f642d43be4e00df08eccadb57214e8 Mon Sep 17 00:00:00 2001 From: Bdale Garbee <bdale@gag.com> Date: Mon, 31 Dec 2018 12:37:45 -0700 Subject: ao-bringup: get turnon_easymega working for v2.0 --- ao-bringup/test-easymega | 8 +++---- ao-bringup/test-easymega-v1.0 | 55 +++++++++++++++++++++++++++++++++++++++++++ ao-bringup/turnon_easymega | 24 +++++++++++-------- 3 files changed, 73 insertions(+), 14 deletions(-) create mode 100755 ao-bringup/test-easymega-v1.0 diff --git a/ao-bringup/test-easymega b/ao-bringup/test-easymega index 2f0a7822..1e419b44 100755 --- a/ao-bringup/test-easymega +++ b/ao-bringup/test-easymega @@ -1,25 +1,25 @@ #!/bin/sh -VERSION=1.0 +VERSION=2.0 PRODUCT=EasyMega BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'` echo "$PRODUCT-v$VERSION Test Program" -echo "Copyright 2014 by Keith Packard. Released under GPL v2" +echo "Copyright 2018 by Bdale Garbee. Released under GPL v2" echo echo "Expectations:" echo "\t$PRODUCT v$VERSION powered from USB" echo ret=1 -../ao-tools/ao-list/ao-list | while read product serial dev; do +ao-list | while read product serial dev; do case "$product" in "$PRODUCT-v$VERSION") echo "Testing $product $serial $dev" echo "" - ./test-igniters $dev drogue main 0 1 2 3 + ./test-igniters $dev main drogue 3 0 1 2 echo"" echo "Testing baro sensor" diff --git a/ao-bringup/test-easymega-v1.0 b/ao-bringup/test-easymega-v1.0 new file mode 100755 index 00000000..2f0a7822 --- /dev/null +++ b/ao-bringup/test-easymega-v1.0 @@ -0,0 +1,55 @@ +#!/bin/sh + +VERSION=1.0 +PRODUCT=EasyMega +BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'` + +echo "$PRODUCT-v$VERSION Test Program" +echo "Copyright 2014 by Keith Packard. Released under GPL v2" +echo +echo "Expectations:" +echo "\t$PRODUCT v$VERSION powered from USB" +echo + +ret=1 +../ao-tools/ao-list/ao-list | while read product serial dev; do + case "$product" in + "$PRODUCT-v$VERSION") + + echo "Testing $product $serial $dev" + echo "" + + ./test-igniters $dev drogue main 0 1 2 3 + echo"" + + echo "Testing baro sensor" + ../ao-tools/ao-test-baro/ao-test-baro --tty="$dev" + + case $? in + 0) + ;; + *) + echo "failed" + exit 1 + esac + echo"" + + FLASHSIZE=8388608 + + echo "Testing flash" + ../ao-tools/ao-test-flash/ao-test-flash --tty="$dev" "$FLASHSIZE" + + case $? in + 0) + ;; + *) + echo "failed" + exit 1 + esac + echo"" + + echo "$PRODUCT-v$VERSION" serial "$serial" is ready to ship + ret=0 + ;; + esac +done diff --git a/ao-bringup/turnon_easymega b/ao-bringup/turnon_easymega index 9de8d985..64180bd3 100755 --- a/ao-bringup/turnon_easymega +++ b/ao-bringup/turnon_easymega @@ -4,15 +4,15 @@ PRODUCT=EasyMega VERSION=2.0 REPO=~/altusmetrumllc/Binaries -if [ -x ../ao-tools/ao-flash/ao-flash-stm ]; then - STMLOAD=../ao-tools/ao-flash/ao-flash-stm +if [ -x /usr/bin/ao-flash-stm ]; then + FLASH_STM=/usr/bin/ao-flash-stm else echo "Can't find ao-flash-stm! Aborting." exit 1 fi -if [ -x ../ao-tools/ao-usbload/ao-usbload ]; then - USBLOAD=../ao-tools/ao-usbload/ao-usbload +if [ -x /usr/bin/ao-usbload ]; then + USBLOAD=/usr/bin/ao-usbload else echo "Can't find ao-usbload! Aborting." exit 1 @@ -42,17 +42,17 @@ case $# in ;; esac -echo $STMLOAD +echo $FLASH_STM -$STMLOAD $REPO/loaders/easymega-v$VERSION*.elf || exit 1 +$FLASH_STM $REPO/loaders/easymega-v$VERSION*.elf -sleep 2 +sleep 3 $USBLOAD --serial=$SERIAL $REPO/easymega-v$VERSION*.elf || exit 1 -sleep 2 +sleep 5 -dev=`../ao-tools/ao-list/ao-list | awk '/'"$PRODUCT"'-v'"$VERSION"'/ { print $3; exit(0); }'` +dev=`ao-list | awk '/'"$PRODUCT"'-v'"$VERSION"'/ { print $3; exit(0); }'` case "$dev" in /dev/tty*) @@ -66,7 +66,11 @@ esac echo 'E 0' > $dev -../ao-tools/ao-cal-accel/ao-cal-accel $dev || exit 1 +failed=1 +while [ $failed = 1 ]; do + ../ao-tools/ao-cal-accel/ao-cal-accel $dev + failed=$? +done echo 'E 1' > $dev -- cgit v1.2.3 From bb3f961022032390bfac6104ea4136354df67689 Mon Sep 17 00:00:00 2001 From: Keith Packard <keithp@keithp.com> Date: Sun, 30 Dec 2018 14:28:07 -0800 Subject: Add shipping products to fat_altos target, note that in Releasing These bits are used to build alpha/beta releases, so they should support all existing products. Signed-off-by: Keith Packard <keithp@keithp.com> --- Makefile.am | 2 ++ Releasing | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Makefile.am b/Makefile.am index 8d948ecd..fc6bbdaf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,6 +51,7 @@ fat_android = \ fat_altos = \ src/easymega-v1.0/easymega-v1.0-$(VERSION).ihx \ + src/easymega-v2.0/easymega-v2.0-$(VERSION).ihx \ src/easymini-v1.0/easymini-v1.0-$(VERSION).ihx \ src/telebt-v3.0/telebt-v3.0-$(VERSION).ihx \ src/telebt-v4.0/telebt-v4.0-$(VERSION).ihx \ @@ -59,6 +60,7 @@ fat_altos = \ src/telegps-v2.0/telegps-v2.0-$(VERSION).ihx \ src/telemega-v1.0/telemega-v1.0-$(VERSION).ihx \ src/telemega-v2.0/telemega-v2.0-$(VERSION).ihx \ + src/telemega-v3.0/telemega-v3.0-$(VERSION).ihx \ src/telemetrum-v2.0/telemetrum-v2.0-$(VERSION).ihx keithp-fat: fat diff --git a/Releasing b/Releasing index d0db6ac1..af8e9a0c 100644 --- a/Releasing +++ b/Releasing @@ -3,6 +3,8 @@ Adding a product to the release Make sure the firmware and loader get built by default in src/Makefile + Add firmware targets to fat_altos target in Makefile.am + Add the firmware to altosui/Makefile.am Add the firmware to altosui/altos-windows.nsi.in -- cgit v1.2.3 From 58fb7e53989f67fe8d793d7b3ddad8e41682cfbe Mon Sep 17 00:00:00 2001 From: Keith Packard <keithp@keithp.com> Date: Mon, 31 Dec 2018 15:18:08 -0800 Subject: doc: Update doc/RELNOTES to adapt to asciidoctor change Moving to asciidoctor means changing our doc release process Signed-off-by: Keith Packard <keithp@keithp.com> --- doc/RELNOTES | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/doc/RELNOTES b/doc/RELNOTES index 678ac17e..db81297c 100644 --- a/doc/RELNOTES +++ b/doc/RELNOTES @@ -3,9 +3,8 @@ Creating documentation for a new release of AltOS * Write release notes in release-notes-${version}.inc. Add to Makefile -* Make sure that doc/altusmetrum-docinfo.xml has the right copyright - year, and add release to the revision history at the front (release - notes will be pulled in by release-notes.inc) +* Make sure that doc/altusmetrum.txt has the right copyright + year * Add references to that as appropriate from each of the documents: @@ -14,25 +13,6 @@ Creating documentation for a new release of AltOS easymini-release-notes.inc telegps-release-notes.inc -* Update date and add docinfo short release info for each document as - appropriate - - altusmetrum-docinfo.xml - companion-docinfo.xml - easymini-docinfo.xml - micropeak-docinfo.xml - telegps-docinfo.xml - telemetry-docinfo.xml - -* Update copyright year as appropriate - - altusmetrum-docinfo.xml - companion-docinfo.xml - easymini-docinfo.xml - micropeak-docinfo.xml - telegps-docinfo.xml - telemetry-docinfo.xml - * Add release-notes-${version}.inc to git * Make sure new hardware specs are documented in specs.inc -- cgit v1.2.3 From ec8df548e3f6fd5d809238e2e60a0844775f551a Mon Sep 17 00:00:00 2001 From: Keith Packard <keithp@keithp.com> Date: Mon, 31 Dec 2018 15:17:20 -0800 Subject: doc: Add EasyMega v2.0 specs Signed-off-by: Keith Packard <keithp@keithp.com> --- doc/specs.inc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/specs.inc b/doc/specs.inc index 89c21307..48d73f96 100644 --- a/doc/specs.inc +++ b/doc/specs.inc @@ -125,6 +125,15 @@ |8MB |- |3.7V + + |EasyMega v2.0 + |MS5607 30km (100k') + |ADXL375 200g + |- + |MPU9250 + |8MB + |- + |3.7V endif::easymega[] |=== -- cgit v1.2.3 From f9fdbfade5e2d203d2ca5378e4f2a65beae4a19f Mon Sep 17 00:00:00 2001 From: Keith Packard <keithp@keithp.com> Date: Mon, 31 Dec 2018 15:17:42 -0800 Subject: doc: Set doc version to 1.9 Signed-off-by: Keith Packard <keithp@keithp.com> --- doc/altusmetrum.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/altusmetrum.txt b/doc/altusmetrum.txt index 85391e79..17b2a53f 100644 --- a/doc/altusmetrum.txt +++ b/doc/altusmetrum.txt @@ -1,11 +1,11 @@ = The Altus Metrum System: An Owner's Manual for Altus Metrum Rocketry Electronics Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>; Bob Finch; Anthony Towns :title-logo-image: image:../themes/background.png[] -:revnumber: v1.8.7 -:revdate: 8 Oct 2018 +:revnumber: v1.9 +:revdate: 31 Dec 2018 :icons: :icontype: svg -:revremark: Include TeleMega v3.0 firmware in release. Fix TeleBT v4.0 RF calibration to factory value when reflashing. Fix map images. Fix Mac OS X support. +:revremark: Add EasyMega v2.0 support :copyright: Bdale Garbee and Keith Packard 2018 :doctype: book :numbered: -- cgit v1.2.3 From bed019b64d9e37f276ad5aa2dabb7681aae122ec Mon Sep 17 00:00:00 2001 From: Keith Packard <keithp@keithp.com> Date: Mon, 31 Dec 2018 15:17:01 -0800 Subject: doc: Add 1.9 release notes Signed-off-by: Keith Packard <keithp@keithp.com> --- doc/Makefile.am | 1 + doc/release-notes-1.9.inc | 20 ++++++++++++++++++++ doc/release-notes.inc | 4 ++++ 3 files changed, 25 insertions(+) create mode 100644 doc/release-notes-1.9.inc diff --git a/doc/Makefile.am b/doc/Makefile.am index 404feab3..67033e8b 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -17,6 +17,7 @@ FAKETIME=TZ=UTC faketime -f '$(RELEASE_DATE) 00:00:00 i0' endif RELNOTES_INC=\ + release-notes-1.9.inc \ release-notes-1.8.7.inc \ release-notes-1.8.6.inc \ release-notes-1.8.5.inc \ diff --git a/doc/release-notes-1.9.inc b/doc/release-notes-1.9.inc new file mode 100644 index 00000000..db538536 --- /dev/null +++ b/doc/release-notes-1.9.inc @@ -0,0 +1,20 @@ += Release Notes for Version 1.9 +include::release-head.adoc[] +:doctype: article + + Version 1.9 + + == AltOS + + * Add support for EasyMega v2.0 + + * Replace C library for ARM devices + + * Remove support for 8051-based devices and SDCC compiler + + == AltosUI, TeleGPS, MicroPeak + + * Select ROM images based on product name when reflashing + + * Fix TeleGPS v2 battery voltage display + diff --git a/doc/release-notes.inc b/doc/release-notes.inc index a1dc6720..3ff1942b 100644 --- a/doc/release-notes.inc +++ b/doc/release-notes.inc @@ -1,5 +1,9 @@ [appendix] == Release Notes + :leveloffset: 2 + include::release-notes-1.9.adoc[] + + <<<< :leveloffset: 2 include::release-notes-1.8.7.adoc[] -- cgit v1.2.3 From f62ac01979a403f6a05f119201a62a8ffc217c73 Mon Sep 17 00:00:00 2001 From: Keith Packard <keithp@keithp.com> Date: Mon, 31 Dec 2018 15:20:23 -0800 Subject: Change Releasing to reflect asciidoctor switch Don't need to hack .xml files anymore (yay!) Signed-off-by: Keith Packard <keithp@keithp.com> --- Releasing | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Releasing b/Releasing index af8e9a0c..9fe3a7a6 100644 --- a/Releasing +++ b/Releasing @@ -27,10 +27,6 @@ These are Keith's notes on how to do a release - make sure doc/Makefile points at that too - - make sure that doc/altusmetrum-docinfo.xml has the right copyright - year, and add release to the revision history at the front (release - notes will be pulled in by release-notes.inc) - These are Bdale's notes on how to do a release. - make sure build environment is up to date -- cgit v1.2.3 From 4e9e0bf99d6b71086110038fa1e3231d00bb2496 Mon Sep 17 00:00:00 2001 From: Keith Packard <keithp@keithp.com> Date: Mon, 31 Dec 2018 15:20:57 -0800 Subject: Update to version 1.9 Signed-off-by: Keith Packard <keithp@keithp.com> --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index dc0a36ce..ee175dbe 100644 --- a/configure.ac +++ b/configure.ac @@ -18,13 +18,13 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.57) -AC_INIT([altos], 1.8.7.1) +AC_INIT([altos], 1.9) ANDROID_VERSION=18 AC_CONFIG_SRCDIR([src/kernel/ao.h]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE -RELEASE_DATE=2018-10-08 +RELEASE_DATE=2018-12-31 AC_SUBST(RELEASE_DATE) VERSION_DASH=`echo $VERSION | sed 's/\./-/g'` -- cgit v1.2.3 From 95ffec073b0758801df04a77eca0bd2bc6e57e35 Mon Sep 17 00:00:00 2001 From: Bdale Garbee <bdale@gag.com> Date: Wed, 2 Jan 2019 22:19:36 -0700 Subject: changelog for 1.9 release --- ChangeLog | 5172 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 5172 insertions(+) diff --git a/ChangeLog b/ChangeLog index c76ca125..130dd199 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5175 @@ +commit 4e9e0bf99d6b71086110038fa1e3231d00bb2496 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 31 15:20:57 2018 -0800 + + Update to version 1.9 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f62ac01979a403f6a05f119201a62a8ffc217c73 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 31 15:20:23 2018 -0800 + + Change Releasing to reflect asciidoctor switch + + Don't need to hack .xml files anymore (yay!) + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bed019b64d9e37f276ad5aa2dabb7681aae122ec +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 31 15:17:01 2018 -0800 + + doc: Add 1.9 release notes + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f9fdbfade5e2d203d2ca5378e4f2a65beae4a19f +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 31 15:17:42 2018 -0800 + + doc: Set doc version to 1.9 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ec8df548e3f6fd5d809238e2e60a0844775f551a +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 31 15:17:20 2018 -0800 + + doc: Add EasyMega v2.0 specs + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 58fb7e53989f67fe8d793d7b3ddad8e41682cfbe +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 31 15:18:08 2018 -0800 + + doc: Update doc/RELNOTES to adapt to asciidoctor change + + Moving to asciidoctor means changing our doc release process + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bb3f961022032390bfac6104ea4136354df67689 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 30 14:28:07 2018 -0800 + + Add shipping products to fat_altos target, note that in Releasing + + These bits are used to build alpha/beta releases, so they should + support all existing products. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 60b46436f9f642d43be4e00df08eccadb57214e8 +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Dec 31 12:37:45 2018 -0700 + + ao-bringup: get turnon_easymega working for v2.0 + +commit 9791ebb256c2892663c072f7989e4b9bd34818a1 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 30 14:15:51 2018 -0800 + + altoslib: Remove spurious debug printf in AltosCalData + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 0d472ab07224a21abfa83da8336439d7844f9aa8 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 30 14:11:03 2018 -0800 + + altos: Don't validate ADXL375 self test for maximum value + + The data sheet says this is unreliable, and that we should be using an + FFT anyways. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 4fb00afc9018c6179c4aff897fcbb330588d02a2 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 30 13:42:50 2018 -0800 + + altos: Make HAS_ACCEL_DEBUG build again + + Need to not use ao_error_h_sq_avg without HAS_ACCEL + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 84c04a114898d97a13f61e1006949dc3926eeba1 +Author: Bdale Garbee <bdale@gag.com> +Date: Sun Dec 30 15:16:29 2018 -0700 + + update easymega turn-on script for v2.0 + +commit e9a3268285e97b7316c3321892e77814703ff71d +Author: Keith Packard <keithp@keithp.com> +Date: Thu Nov 1 19:40:31 2018 -0700 + + doc: Use icons for admonitions + + This replaces the text 'WARNING' or 'NOTE' with a suitable icon instead. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit d859a7f65baf6c5c170f14fb2d9401b5c607a254 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Oct 25 17:01:38 2018 -0700 + + doc: Remove asciidoc related files + + These all helped asciidoc generate documentation + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 41fed74c4cf139de6bf8f1879d370977785ad1f8 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Oct 25 16:56:24 2018 -0700 + + Remove cc1111 products from 'fat_altos' list, which is used for keithp-fat + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6d80b89c0bd82133dd5c93df8604f562ac49c19a +Author: Keith Packard <keithp@keithp.com> +Date: Thu Oct 25 16:50:17 2018 -0700 + + doc: Switch to asciidoctor to format docs + + asciidoc and a2x are no longer actively maintained and Debian policy + encourages people to move away from them to asciidoctor. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cf3e524e50a6fae2862efb404c9918b74438e9c9 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Oct 23 16:07:09 2018 -0700 + + Generate LED icons on the fly. Include SVG versions. + + This builds the required LED images from source code. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e9915aad4fe97cd253b88805646085c64181baef +Author: Keith Packard <keithp@keithp.com> +Date: Mon Oct 22 16:48:56 2018 -0700 + + Don't force CFLAGS from top level + + Let the system defaults control this value. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cf7b2e065d844d290ee43449ae37162839220158 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Oct 22 16:48:04 2018 -0700 + + ao-tools: Spelling fixes in a couple of man pages + + ao-dbg.1 and ao-eeprom.1 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 1812adbd61400af19293bf775e544baf661ec224 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Oct 22 16:47:20 2018 -0700 + + Add keywords to .desktop files + + Makes applications easier to find with search + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 48e221cca00c9f925ff57588dd782842705f7a23 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 20 17:29:36 2018 -0700 + + altoslib: When flashing hardware, pull USB data from device if needed + + If we fail to extract USB vid/pid and product values from the device + ROM, use the data discovered over USB when the device was originally + discovered. + + Also, use the USB product to select appropriate .ihx files instead of + only using the USB vid/pid. This will help people avoid using the + wrong file when reflashing devices. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 345e3c37a1cf619392b54589bb91b4caf7844810 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 20 17:26:53 2018 -0700 + + altos/easymega-v2.0: Handle different mpu9250 orientation + + The mpu9250 on EasyMega v2.0 is rotated 90° compared with EasyMega v1 + and TeleMega IMU devices. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8c92656576aff3ceab5bead3c835d96c36098fe7 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 20 17:24:41 2018 -0700 + + altoslib: Add support for EasyMega-v2 + + adxl375 instead of mma6555. + mpu9250 rotated 90° compared with other megas. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f13e294d4644096b0529383c1d60d5e4b7916d76 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 20 17:22:59 2018 -0700 + + altoslib: Add support for TeleGPS v2 + + The battery voltage ADC values are different from TeleGPS v1 (max 4095 + instead of 32767). + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c01514fa1e0a2cea3955c71a833b4a21b3d33f24 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 20 07:34:57 2018 -0700 + + altos/adxl375: Clean up initialization, shortening self test period + + Set the self test period to that suggested in the documentation. + Eliminate some debug variables. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 0686a7b8aec524d81bda4c572549a3a068ce0eed +Merge: 6aa451ce cc528f1f +Author: Bdale Garbee <bdale@gag.com> +Date: Sat Oct 20 01:18:12 2018 -0600 + + Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos + +commit 6aa451ce81bfdfe679e3f9902043a5f0d235c745 +Author: Bdale Garbee <bdale@gag.com> +Date: Sat Oct 20 01:17:39 2018 -0600 + + altoslib: fix computation of TeleGPS battery voltage + +commit cc528f1ff0271ec6488a1a7b91c731183502101e +Author: Keith Packard <keithp@keithp.com> +Date: Fri Oct 19 13:20:31 2018 -0700 + + altosui: Add EasyMega v2.0 firmware to release + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 1e4b8674d874a190eca1a98a397aaf0a9d15bda1 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Oct 19 13:19:03 2018 -0700 + + altoslib: Add ADXL375 support and EasyMega v2.0 support + + EasyMega v2.0 replaces the MMA655X with an ADXL375 part. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 3fd320ea38f2945f5611a09a0e48d16db467d105 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Oct 19 08:41:51 2018 -0700 + + altos: Add EasyMega v2.0 to default build + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f49763bf4a6cd8b2a47abfbec7ef3d8c8c029b8f +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 13 09:43:25 2018 -0700 + + altos/easymega-v2.0: Add adxl375, replace mpu6000 with 9250 [v2] + + Should reflect current hardware design now. + + v2: + Use SPI mode 3 for ADXL375 + Invert ADXL375 values + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6fdc392ef1b624c06e26e7a053c3579435c455d5 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 13 09:46:01 2018 -0700 + + altos/easymega-v2.0: Change binary to easymega-v2.0 instead of easymega-v1.0 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 30e4e286eec31e69ad1e69a44cf00d4549a09f88 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 13 09:41:31 2018 -0700 + + altos: Add ADXL375 driver [v2] + + Includes self-test code and multi-byte mode operation for reading + sample registers. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 33bb97b9637bdabe4360269889e20fcc50ef9886 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Oct 15 11:15:31 2018 -0700 + + altos/stm: Support SPI modes other than 0 + + ADXL375 requires SPI mode 3. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit dbc52686c6d9808275c35e0c9c987cbbd9f7859d +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 13 13:42:34 2018 -0700 + + altos/stm: Make beeper driver support all possible tim234 configs + + And update all users to be explicit about the desired config. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 80affca535c5c43a5d9963dfafc74f9675c9b155 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Oct 19 08:12:22 2018 -0700 + + altos: Create ao_data_fill shared function + + This fills a data ring entry with all of the current sensor values + other than the ADC. It is used in all of the adc completion functions. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit facf790f469df374257440ba9482321cbab7cecb +Author: Bdale Garbee <bdale@gag.com> +Date: Sat Oct 13 10:17:47 2018 -0600 + + altos: remove usbtrng support (chaoskey prototypes) + +commit 59f66e3264a48d8586dcbd12f6f0fa91e2e1ecdc +Author: Bdale Garbee <bdale@gag.com> +Date: Sat Oct 13 10:12:39 2018 -0600 + + altos: remove telescience support + +commit 758c8c27ba1819b5d90fda9e9ba6d15f5e8598e0 +Author: Bdale Garbee <bdale@gag.com> +Date: Sat Oct 13 10:02:13 2018 -0600 + + altos: remove teledongle-v1.8 support (what was that, anyway?!?) + +commit 3620f09329ccae817fe3ec2f9c2c588ebbfa149b +Author: Bdale Garbee <bdale@gag.com> +Date: Sat Oct 13 09:59:22 2018 -0600 + + altos: remove megadongle-v0.1 support, never went beyond prototype + +commit 2da09b9f5649786f202aa0f295ead728939eddae +Author: Bdale Garbee <bdale@gag.com> +Date: Sat Oct 13 09:57:44 2018 -0600 + + altos: remove telepyro-v0.1 support, which was never completed anyway + +commit 41ebb27230de6385a01c111c299bb22b1cb0badf +Author: Bdale Garbee <bdale@gag.com> +Date: Sat Oct 13 09:55:03 2018 -0600 + + altos: remove teleterra-v0.1, also an ancient cc1111 project + +commit 983c36782527078ce667feb9eccd1ed0b97fbc29 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 13 08:33:49 2018 -0700 + + altos/drivers: Use stdbool in ao_ms5607.c + + We don't have TRUE and FALSE anymore (they were pdclib specific). + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 346fdfb469f7f3c1f87a39dee5bfb4568631c28b +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 13 08:27:41 2018 -0700 + + altos: Remove pdclib bits from Makefile + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cf21c87f9f3e1a75dba39ab41dfffb629586935d +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 13 08:27:17 2018 -0700 + + Remove .gitmodules + + We no longer use submodules (yay!) + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 815d537e0fa6503b2a83d92d94c734eaee15987b +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 13 08:26:02 2018 -0700 + + Bump version to 1.8.7.1 + + Tag development versions + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 408badbef80d7a3412b5ad92b269be19d0faaa09 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Oct 2 12:48:25 2018 -0700 + + altos/stm32f4-disco: Start hooking up stm32f413 USB for the disco board + + Non-working as yet. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 805d218ff50e6c38345c0d4e46f568009132633e +Author: Keith Packard <keithp@keithp.com> +Date: Tue Oct 2 12:46:19 2018 -0700 + + altos/stm32f4: Add start of stm32f413 USB support + + This code doesn't work yet. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 4a246b4cb5ee8e8894ea3492187a08e1e4f719bb +Author: Keith Packard <keithp@keithp.com> +Date: Tue Oct 2 12:46:01 2018 -0700 + + altos/stm32f4: Add stm32f413 USART support + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 600689b39d9bc604b0a8b586c8a93a465a42fc3b +Author: Keith Packard <keithp@keithp.com> +Date: Tue Oct 2 12:45:39 2018 -0700 + + altos/stm32f4: Add external interrupt bits + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 015d3055a52532070e96469907683c3aa3eda44e +Author: Keith Packard <keithp@keithp.com> +Date: Tue Oct 2 12:44:58 2018 -0700 + + altos/stm32f4: Add more stm32f413 definitions and support code + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 44ae8b9317fa4aaccabbe9d07b5972f7dfd3baa2 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 18:53:15 2018 -0700 + + altos: Clean up AO_ROMCONFIG bits + + Remove address parameter (doesn't work with gcc), create shared + ao_romconfig in kernel. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 32463323d888d2b36d4b993d82e2522e1b236299 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 18:51:59 2018 -0700 + + altos/stm32f4-disco: Hook up serial console. Add scheme + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bb9d3d3bb1ae6223a7b910bc49ea8af5544a64d7 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 18:50:45 2018 -0700 + + altos/stm32f4: Place ARM.exidx sections after .text + + This makes the linker happy about not attempting to merge unordered + and ordered stuff (whatever that means...) + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cd151a622537e1436362bd71229c6ce22a3957d0 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 18:50:15 2018 -0700 + + altos/stm32f4: Use full printf/scanf (including floats) + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 0b5ac831d2e63a091833c702b07b0331fba32e72 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 18:49:22 2018 -0700 + + altos/stm32f4: Add usart driver for usart6 + + This is what the disco board hooks up. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 23075d174d2bff8ff3f3deef3c3d90b83da6bd2e +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 18:46:52 2018 -0700 + + altos/stm32f4: Align stack to 8 bytes + + This makes sure that doubles are aligned properly when passed on the stack. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 71248c899676e0c2f3a478c63dec0d005b2458e6 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 12:03:27 2018 -0700 + + altos/stm32f4-disco: Add .gitignore + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 2cdb1f30c49ba460b0850d23ba9c85e0336af290 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 11:57:50 2018 -0700 + + altos: Add generic LED driver. + + This driver uses the generic GPIO functions and allows per-LED port + and pin configuration. It supports up to 32 LEDs. + + Rename SoC-specific LED drivers. + + Remove enabled parameter to ao_led_init + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cdaa0d7b272505c49017f409b7c0b8e3240608f0 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 10:40:24 2018 -0700 + + altos: Eliminate 'pin' field from GPIO functions + + This was used with the 8051 bit-addressing mode to provide + single-instruction access to GPIO pins. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f7ca88282466c271bad5e25e804729580fe83c47 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 01:28:03 2018 -0700 + + altos/stm32f4: Fix clock configuration + + Was running the PLL input too slow (it wants 2MHz). + Was configuring the PLL_P factor wrong (needs magic values, not P + value) + + Set up clock debugging for PA8 and PC9 output. Enable on disco board + for debugging. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 621d1529d6bc07a3f4bd27fb2d02d5b3161a3a6a +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 00:08:17 2018 -0700 + + altos/stm32f4: Add STM32F413 disco board support + + Discovery development board + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b7a21bf6a086748b4907c0577eaa114445995783 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 00:07:38 2018 -0700 + + altos/stm32f4: Start adding support for STM32F413 + + Enough to get clocks lit up at least. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f037d0091a4b31c631d64e71441953eb9b3b21ce +Author: Keith Packard <keithp@keithp.com> +Date: Tue Oct 2 12:47:00 2018 -0700 + + altos: Remove 8051-ism from ao_usb.h + + __at doesn't exist for non-8051 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b8e607960f2f399fd6ba92a8c97ab72e19812d3f +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 00:05:38 2018 -0700 + + altos: Delete random 8051 ISR declarations + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a76829a4a840261e33869c40b3366fff3b691069 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 15 22:44:17 2018 -0700 + + altos: Allow application-specific prompts for ao_cmd_readline + + Lets other readline users specify alternate prompts. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 684741765117611b7d666efbdfafd87c6199752c +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 15 19:17:19 2018 -0700 + + altos: Use stdbool true/false instead of TRUE/FALSE + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c417ab1de2a083b5fcff2e081e4feb2a65887903 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 15 19:13:45 2018 -0700 + + altos: Make cmd number parsing functions return value + + Don't use a global variable to hold the result. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c6e57291d91f1f6c4de5c54a5cfd3eef66d9f830 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 15 17:47:37 2018 -0700 + + altos: Remove 8051 address space specifiers + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6023ff81f1bbd240169b9548209133d3b02d475f +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 15 17:34:20 2018 -0700 + + altos: Remove *_TO_DATA macros + + Now that we don't support 8051, we don't need these + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e2e2182a6ae6c8a7290fb5f7bbb7f8e0a863ba99 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 15 15:39:34 2018 -0700 + + Remove pdclib + +commit 7c04888cf9809e0c73f0813c74e8dd972facde3a +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 5 12:23:22 2018 +0800 + + altos: Switch to newlib-nano for libc on arm + + Stop using pdclib + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 56629222711ba3ef7853405c9b07ad614fb29b95 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 5 12:17:19 2018 +0800 + + altos: Remove cc1111 products + + We're not testing these anyways; building new firmware for them is not helpful. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 382b3ef62a09e580834b07faf9ed2d00e5ce1621 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 00:06:44 2018 -0700 + + altos: use %lu for APRS altitude in sprintf + + It's a long. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 803c68d7933d03aaebda19786b63055d4a6d3d22 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 13 07:50:59 2018 -0700 + + altos/stm: Make flash loader work with either 8MHz or 16MHz xtal + + Provide PLL definitions for both values. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e830d803d3e289f0f1a6d92ce208682af28d3f52 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 13 07:44:10 2018 -0700 + + altosdroid: Bump version to 18 for 1.8.7 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 393a5e929b530d9ee4f78cd01faa4dd90c95fe3a +Author: Bdale Garbee <bdale@gag.com> +Date: Fri Oct 12 23:32:57 2018 -0600 + + altos: first cut at easymega v2.0 support .. nothing working yet + +commit fe3ff829d4c2fde8d4e80f721204b18e7831bb97 +Author: Bdale Garbee <bdale@gag.com> +Date: Wed Oct 10 20:41:40 2018 -0600 + + doc: add bootloader force instructions for TeleBT v4.0 + +commit 34b5144dbfd565ee2b9fb1e0dff388a49253f93b +Author: Bdale Garbee <bdale@gag.com> +Date: Tue Oct 9 11:46:09 2018 -0600 + + update turnon_telebt to use new approach for saving cal value on TeleBT + +commit ba37db43741fde8a08080fa65f5bcf76b1f745ee +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Oct 8 21:41:30 2018 -0600 + + capture changes to Releasing discovered during 1.8.7 release + +commit e7136c6b413c8464d32cdc4afc28c93ba1f17a3b +Author: Keith Packard <keithp@keithp.com> +Date: Mon Oct 8 19:42:09 2018 -0700 + + altos/lpc: Make sure USB pull-up is held low at boot for 'a while' + + Add a delay loop to make sure the host sees the pull-up low for long + enough. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6e785eea7b7a14ec8c1e69cad2c88836a9b1943e +Author: Keith Packard <keithp@keithp.com> +Date: Mon Oct 8 19:40:32 2018 -0700 + + ao-bringup: Use new ao-cal-freq options when flashing teledongle v3.0 + + Use --nosave and --output to get the value needed to reflash the device. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 88ae4c5ebd64215f05f5efc18f9660560b409ace +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Oct 8 16:27:33 2018 -0600 + + doc: correct specs for TeleMega v3.0, which still uses the MMA6555 + +commit 24db798925e26a4c411afe88f7e4844d6554fe0c +Merge: 6f25d235 03680c55 +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Oct 8 16:07:32 2018 -0600 + + Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos + +commit 6f25d2359151fb114e22bf8e3b15c007cfb464b5 +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Oct 8 16:06:29 2018 -0600 + + add new script that uses openocd to reset an LPC target + +commit 03680c55ae8394056ed27839e64356d8df375537 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 23:31:53 2018 -0700 + + Set version to 1.8.7 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 625981b96e99a5dbec8180016d5e2c291378a21f +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 23:31:04 2018 -0700 + + doc: Note fixes for Mac OS X + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cd75ca767b616900d7df4596907f4f5b00517ad4 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 23:25:25 2018 -0700 + + Switch to universal JavaApplicationStub for Mac OS X + + The binary JavaApplicationStub only supports Mac JRE 6, even if you + install a later JRE from Oracle it will still run our apps with the + Mac version. + + This replacement JavaApplicationStub is a shell script which comes + from here: + + https://github.com/tofi86/universalJavaApplicationStub + + I've tested it with Oracle JRE 10 installed and AltosUI came up fine, + and has access to our devices and networking. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 746ad2c385046c77831b43291ef4335a11e5bfab +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 16:28:32 2018 -0600 + + altos-mapd: Add --max-zoom to limit tile loading. Set default to 15. + + This ensures that we won't end up serving huge numbers of high + resolution images. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7f5cdd0aeb68104f474ad1736360df39dd174006 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 14:26:27 2018 -0700 + + doc: Note that 1.8.7 fixes map images + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 2bcbd39a37cf1fa0002345d5c401869a387dc84f +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 14:11:03 2018 -0700 + + altosuilib: Leave some map debug code around for the future + + Displays lat/lon on each map tile. Commented out for production use. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 444fdd96515cc7163c49942ac2435ace8e7bb5bf +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 14:06:51 2018 -0700 + + altoslib: Be less chatty about map loading + + Only mention when a new tile is being fetched from the server. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 173e72429fb494ea3832e3e38ee90f165fbff4cf +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 14:49:48 2018 -0600 + + altoslib: NumberFormat can't be shared between parsers + + AltosJson uses NumberFormat to ensure locale-independent parsing of + values. However, NumberFormat appears to have some internal state + which means that each thread needs to have an independent NumberFormat + object. Create one for each parser as needed. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 1b53a54b032c21b6e8ffb085aa56b9ffdff53d7e +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 13:12:56 2018 -0700 + + altosui/altosdroid: Change message in forbidden map tiles + + These are outside of *known* launch areas. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e7e1e805f1358052b33103a2ffdd4e9c435c8650 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 14:08:30 2018 -0600 + + altos-mapd: Check nearest portion of tile to launch site + + We limit tile queries to those within 17km of a known launch + site. Change the check to look at the portion of the tile nearest each + launch site, instead of only checking the center location of the tile. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 581f700e08ec8a1c3bfc5a09e7186676c54a5460 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 10:32:48 2018 -0700 + + altos-map: Switch from json FD ops to json FILE ops + + Older versions (in Debian stable) do not have the fd-based operations. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6f911b92652de890ebff67b3b28f21a36f300ebf +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 10:03:31 2018 -0700 + + altos-mapd: Handle clients failing to send valid JSON + + Just bail if the data we receive doesn't generate a json value. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b631f88b0bf19c6740eb21b65bd4be7c25049773 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 10:02:26 2018 -0700 + + altosuilib: InputEvent.getModifiers is deprecated, use getModifiersEx + + Some java change; seems like it's a no-op for us. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5c957107ee5917d865eb866319f86cf8c109f212 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 10:01:30 2018 -0700 + + altosui/altosdroid: Disable offline map type selections + + Our server only supports hybrid maps for now. If that changes, we can + re-add this support easily enough. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e4f4183ce206d4cb7bbc89e1065eb34b05cf11c4 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 09:39:27 2018 -0700 + + altosuilib: Remove GrabNDrag.java + + This isn't used anymore. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit af678be97e419a1167a0630f28bcaba82d67929b +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 7 09:22:44 2018 -0700 + + map-server: Implement altos-map in C + + This app is all about startup time, and java starts + slowly. Re-implement in C to improve server performance. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7b248524d4bd2c3ab64899b133230d131258396c +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 23:32:24 2018 -0700 + + altosdroid: Restore google maps key setting + + Only for altosdroid, and use a key restricted to our app + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7eb475a9694327809b7ab5a9f419d00e0819a47d +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 23:25:50 2018 -0700 + + altosdroid: Set offline map scale to 1 + + Offline maps only supports scale 1 now. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 417ec9c2a42bbe74f3aba4d00b42eb14dd6eb079 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 23:22:26 2018 -0600 + + altos-mapd: Install systemd service file and defaults file + + This lets the map service 'just work' if enabled. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 64d6689f97dfbed13533350dcb75a0a6a3d11c78 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 21:32:12 2018 -0700 + + altos-map: Support version query from application + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7c39a4509b0d4a428fcb83602a8dae1c158faf37 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 21:30:03 2018 -0700 + + altosuilib: Fix offline map messages to match new meanings + + forbidden means outside of launch area. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a8f4af38d7abbb1da922b5e4d84af218475f1752 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 21:30:58 2018 -0700 + + altoslib: Retry map connections 10 times on network failure + + This covers a host of problems between the application and google maps. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit fab890328d4e1151932621a317226bc291b853da +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 21:30:03 2018 -0700 + + altosdroid: Fix offline map messages to match new meanings + + forbidden means outside of launch area. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ff5faf1cc710b7e9299dcaec719bc2421f4ca5b4 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 20:21:07 2018 -0700 + + altoslib: Change map loading to lat=&lon= from center= + + This is easier to parse. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 21c630af7181a03b44cfcfa1cc787212501785ec +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 20:20:33 2018 -0700 + + altoslib: Use https for launch-sites.txt + + http causes a redirect, which Java doesn't handle + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a203aa6e3ed67337b752f939da956856e208c28b +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 22:28:36 2018 -0600 + + altos-mapd: Install altosmapd.jar file + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 1b841e14d11b3a9e7a754730b1d87b30d22f3dd4 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 22:27:58 2018 -0600 + + altos-mapd: Make cache service listen queue longer + + Just in case the service gets busy, make the listen queue longer. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 02adfb13297f7dffcd8edcdd3b8747cf52b2a70b +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 22:27:20 2018 -0600 + + altos-mapd: Clean up log messages + + Generate a single log message per request with remote address, + parameters and result code. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 839e3a413a60c6a61851a94cc299de701ab5c277 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 22:26:46 2018 -0600 + + altos-mapd: remove debug printf + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 026c735393f6029d09011dba1d5c780322921921 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 22:25:48 2018 -0600 + + altos-map: Retry connection to cache service + + Just in case the cache service gets busy, retry the connection instead + of immediately failing. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e7c0bcd945f8365e86e99b9d450f3a3389fa0e66 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 19:33:51 2018 -0700 + + altos-mapd: Add geo-fencing for map requests. Add port and key arguments + + Map requests are now limited to a region within 17km of any registered + launch site. + + The --port argument allows the listen port to be changed. + + The --key argument provides the name of a file containing the Google + maps API key. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c7b1f3c6722ae59d09a888084075664446ff2768 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 19:29:01 2018 -0700 + + altoslib: Switch to maps.altusmetrum.org when no google map key is available + + The map key is only usable from maps.altusmetrum.org at this point, + and that service will be proxying for everyone in the near future. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit fe761eb413430c061b12f6ca8003665e56e20262 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 19:27:43 2018 -0700 + + altoslib: Allow launch site URL to be overridden at runtime + + Expose a public variable, AltosLaunchSites.launch_sites_url, that will + be used in place of the environment variable or pre-defined value. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 073ebc77bbd813eb97c515ecf3c2d104d6157843 +Merge: fb167d9f 9e29ac8e +Author: Bdale Garbee <bdale@gag.com> +Date: Sat Oct 6 18:55:05 2018 -0600 + + Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos + +commit fb167d9f589d3e42e0f99b9f454a51a31e09050a +Author: Bdale Garbee <bdale@gag.com> +Date: Sat Oct 6 18:54:35 2018 -0600 + + altoslib: update launch-sites.txt location to new home at maps.altusmetrum.org + +commit 9e29ac8ed9a48fc4ac8e769eeb131dd7c58fedc4 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 17:17:20 2018 -0700 + + doc: Make use of 'faketime' configurable with configure.ac. Default to 'no' + + This ensures that older a2x versions don't simply wedge while building + the docs. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cabfcb078950238cdaee4e6ec4702195feaabc7b +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 18:11:48 2018 -0600 + + altos-mapd: Use command line to pass map directory in + + Don't bother with a default value, just require a command line param. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e405ec771b812f0ff78abbe813c3a793ae129487 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 18:11:13 2018 -0600 + + altos-map: Install .jar file for altos-map + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a372152654613fd8479ed4687b987ae2a513adf6 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 18:10:57 2018 -0600 + + altos-map: Fix altos-map HTTP syntax + + Add blank line between header and content. + Make error pages have actual HTML content. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 3b817a2b854065af23c9ec8e849150e6930f51e9 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 16:04:39 2018 -0700 + + map-server: Add maps proxy server + + This creates a map proxy server to handle the new Google Maps API requirements + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5a95ed9c9419c15352b8dc1d895c9adce30f99f5 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 6 12:00:45 2018 -0700 + + Add map-loading documentation + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cc70746e8efa6cadb23cbfcb11ddb51574c512a9 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Oct 5 21:40:13 2018 -0700 + + doc: Use RELEASE_DATE to set PDF timestamps using faketime + + This ensures that the generated PDF files do not depend on the time of + the build and only on the date of the release. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8e87b2626cdd81c128ac0cb5db03350aff67feac +Author: Keith Packard <keithp@keithp.com> +Date: Fri Oct 5 19:36:20 2018 -0700 + + macosx: Ship install-macosx script with all apps. + + This script copies all files to ~/Applications/AltOS, then it deletes + all xattrs on all files so that OS X will run the java programs. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a477dcbafe942af8f53e57802e228d94b526e13e +Author: Keith Packard <keithp@keithp.com> +Date: Fri Oct 5 18:22:59 2018 -0700 + + doc: Add check for new hardware in specs.inc + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bb740c830b58273ee72255320bcedb3b849c0e2c +Author: Keith Packard <keithp@keithp.com> +Date: Fri Oct 5 18:22:11 2018 -0700 + + doc: Update for 1.8.7 + + Release notes + Add HW specs for EasyMini v2.0 and TeleMega v3.0 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit aeb07f2b94b0121d4e5a6ce175ce4e013d6557cf +Author: Keith Packard <keithp@keithp.com> +Date: Thu Oct 4 23:10:59 2018 -0700 + + altos: Force telemetry rate to 38400 when ao_force_freq is set + + ao_force_freq is used by TeleMini to set the radio to known + values. As TeleMini v3.0 also has configurable telemetry rates, this + value also needs to be set back to a known value. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 77c3878df78ae356c442999a99f1e1752e2cd06b +Author: Keith Packard <keithp@keithp.com> +Date: Thu Oct 4 23:03:12 2018 -0700 + + doc: Describe Packet Link mode in the initial usage section + + It's not described in any detail elsewhere... + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 0f05859d9fdef5867df888d9a8b41602e3bff7f7 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Oct 4 22:58:38 2018 -0700 + + doc: Describe Packet Link usage and selecting RF param defaults for TeleMini + + Packet Link mode is the only communication method available for + TeleMini and deserves some special mention in the docs. + + TeleMini allows forcing of RF parameters back to known defaults by + hooking SWCLK to ground at power on (hole 7 to hole 3 on the debug + connector). Describe this process so that users will be able to get + TeleMini back to known values and recover. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 1b43a0d4a76910c4b512b2299e17ee0d3b661990 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Oct 4 12:12:56 2018 -0700 + + altoslib: Add missing AltosUnitInfo files + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 06b1fc72c8a694b3295262f1e0b50e8c88c53585 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 11 00:06:05 2018 -0700 + + altoslib: Fix gyro headings in CSV files + + Use yaw/pitch/roll instead of x/y/z + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 3094d1f0ebd734f62d35e5e989d9a2368b713d29 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Oct 2 17:27:31 2018 -0700 + + ao-bringup: Add 'fix-telebt' to reflash TeleBT v4.0 with correct rf cal + + Fetches RF calibration value from the net and applies that when reflashing. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c2c7873695ee2dc1b6fd153b67accad9693937aa +Author: Keith Packard <keithp@keithp.com> +Date: Tue Oct 2 17:03:28 2018 -0700 + + altosui: Fetch RF calibration value for TBT v4.0 units from web + + We shipped a pile of TBT v4.0 units without programming the RF + calibration value into flash. This change checks to see if the target + is in the right serial number range and has the default RF calibration + value, in which case it fetches the RF calibration value from our web + site. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit d5b9fd5b3dd8c8b3bfb478d366ba07501085c1b3 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Oct 2 13:57:58 2018 -0700 + + altos: sdcc doesn't have 'false' and 'true'. + + Use FALSE and TRUE in ms5607.c driver instead. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit d2ea6454ebdf8ac7c3a24a738672c57d3f3f885c +Author: Keith Packard <keithp@keithp.com> +Date: Tue Oct 2 12:57:06 2018 -0700 + + ao-tools/ao-cal-freq: Add --nosave and --output options. Check save results. + + --nosave means don't attempt to update the on-device configuration + data in eeprom. + + --output means write the calibration value to a file. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 523e51d2cd2dfc5c0c4ca5a893b005916c46d46a +Author: Keith Packard <keithp@keithp.com> +Date: Tue Oct 2 12:49:12 2018 -0700 + + micropeak: Add MicroUSB 'equals' method + + This lets the code which polls for devices work with MicroUSB devices + too. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8dd942b59edbe6909128b88bfbb8d1e15c3857c6 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 22 00:59:59 2018 -0700 + + doc: Don't accidentally create zero-length PDF files + + The PDF files are generated at the same time the HTML files are, so + the PDF versions depend on the HTML ones. However, touching the PDF + files is a bad idea. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 56dcfd4acf830fcb69c8b994e4b989c9aa7ddef3 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 22 00:59:12 2018 -0700 + + altos/drivers: Shrink ao_ms5607.c code to fit on micropeak still + + Use some code constructs that make the little AVR processor happier + and save about 16 bytes of memory. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 3c48b0fd504ae97dfaca91d2064b5822ca6e1344 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 22 00:52:21 2018 -0700 + + altoslib: Reduce debug printf spamming during flashing operation + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ac8a9bc2ef301f1f18772af7d871c257a56ae70c +Author: Bdale Garbee <bdale@gag.com> +Date: Thu Aug 30 21:36:18 2018 -0600 + + altos: don't build fox1ihu by default + +commit 87ae17f888b745de71790d071846b96ab96e1529 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 22 17:44:02 2018 -0700 + + altosuilib: Provide dialog while waiting for flash target to re-appear + + On windows, switching to the boot loader can take a long time. Instead + of timing out after a second, show a dialog and let the user cancel + the operation if they get bored of waiting. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ba285ecf51e317917858740504a7d691b9839588 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 22 17:43:17 2018 -0700 + + altosuilib: Include device path in equals test of AltosUSBDevice + + Ensure that multiple AltosFlash devices don't appear the same; they + all use serial number 1. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 378ebab2e70917b4182cbd840a3fa66e4e42fd92 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 22 17:42:13 2018 -0700 + + altoslib: Use common constants for flash action messages + + Place messages in AltosFlashListener instead of using the same strings + in three different places. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 22005da598921ef6fe1a7f1bb5e56e41f44fe12f +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 22 00:58:14 2018 -0700 + + altosuilib: Don't show radio parameter when reflashing radioless devices + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 75420fecbc76ab718661718ada249673e139a29d +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 22 00:56:25 2018 -0700 + + altosuilib: Show a more useful message when the flash target device is unknown + + The flashing code uses the new symbol table to find information in the + existing device; if they don't match at all, there won't be anything + about the target device known. Tell the user this, rather than + displaying mystic information (or crashing). + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit d8017f921649d2176d90239e02275dc5ef793815 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 22 00:54:55 2018 -0700 + + altosuilib: Poll for devices while Select Device dialog is displayed + + Lets the user plug/unplug devices and have the dialog box show the + current set of available devices. Particularly useful on Windows where + it takes a long time after connecting a device for the OS to actually + make it usable. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 91bb344a74a413f7dcee379c4d760c34599749bc +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 22 00:53:46 2018 -0700 + + altosuilib: Add 'equals' method to AltosDevice + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 2f61ef9a5046c39f4eeaaf741031bb6a9607b8a6 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Aug 15 15:31:57 2018 -0700 + + altos: Switch global 'log' to 'ao_log_data' + + Avoid conflicts with 'log' math function. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cbe9cfd5eb5d19b7b9bf4bb75424e7592d708929 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 5 12:20:56 2018 +0800 + + altos/stmf0: Stop using 'stdin' name as local variable + + stdio kinda wants to own this name + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 1bbef0879ad86dfc21610a255e6cbca1b94b5d1a +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 5 12:19:59 2018 +0800 + + altos/lpc: Fix stdio wakeup on serial IRQ + + Should just use USE_SERIAL_0_STDIN directly + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f16d1e3a2f074b96aae6b9053e8e9e03bd282741 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Aug 13 17:43:13 2018 -0700 + + altos: Allow timer interrupt without needing tick count + + This saves a bit of space in the fox1ihu loader which uses the timer + interrupt to poke the watchdog. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bb9d071d328969fc3c544897f1fc96e55a842198 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Aug 13 17:43:57 2018 -0700 + + altos: Remove spurious 'const' from ao_state_names + + Current gcc complains about this. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 171d12cb7bb0ea185e9b8b6d90e1c0fb94b19008 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 5 12:19:19 2018 +0800 + + altos: Remove spurious ao_mma655x_spi_index variable + + This isn't used; was probably included for debugging at some point. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 297eb795b24ec31f6599f48bc8c3769557a7ec6f +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 5 12:32:42 2018 +0800 + + Bump java lib versions to 13 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 54838e3d523953e3ce4cea2319b2820c21d2c576 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Aug 6 13:15:21 2018 +0800 + + Include TeleMega v3.0 firmware with releases + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 55302673a3bff29ac8cd4c7656a410ba3c182845 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 5 12:28:25 2018 +0800 + + Bump version to 1.8.6.1 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 029259feafd63f17fc34b95cc7b1fe55e3f611c3 +Author: Bdale Garbee <bdale@gag.com> +Date: Sun Aug 5 14:11:01 2018 +0800 + + capture updates to Releasing from 1.8.6 release process + +commit 8830fbc99565f753c0ae1f3d9f4b079860c2634a +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 5 11:13:23 2018 +0800 + + Update docs for 1.8.6 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 0d57c78dde3c6e61576a4769b0e0fae7e88c107d +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 5 11:09:34 2018 +0800 + + altos: Add separate 'ao_launch_tick'. Use in pyro and lockout. + + Prior to this, there was only ao_boost_tick, which got reset at each + motor burn start. That meant there wasn't any way to measure total + flight time for pyro channels and 'apogee lockout' was based on time + since most recent motor start instead of total flight time. + + Now pyro channels and apogee lockout both use total flight time, while + motor burn length still uses time since most recent motor burn start + (as it should). + + Docs and UI updated to use 'launch' instead of 'boost' to try and make + the change clear. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 9dfbf0103a649816e98d5511b1d6bbbfc93f6632 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 5 09:03:35 2018 +0800 + + altos/plottest: Make linewidth bigger + + 1-pixel lines are harsh in 2018 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 50c6d796e0dbb69289f95c826e6b542e538fc5de +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 5 08:45:30 2018 +0800 + + altos/stm-demo: Set up for dumping eeprom + + This is used to dump an eeprom wired to the stm demo board. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 327b765962d397efd4c45b6209c9225a4d23ba1d +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 5 08:44:04 2018 +0800 + + altos: Change 'after motor' pyro check to be >= instead of == + + This makes after motor stay valid even if further motors burn. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a90d205d41cb4f9f8e669473247786a23a678368 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 5 08:43:06 2018 +0800 + + ao-tools/ao-dumplog: Dump entire eeprom contents + + This gets the eeprom size from the device and uses that to dump the + whole thing. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 08e7fdb9f2db4b54279c0c5b18735aa1d5abc19e +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jul 4 20:25:58 2018 -0700 + + altoslib: Make stop_remote delay depend on the data rate + + It takes longer to flush commands at 2400 baud, so wait longer when + disabling remote mode. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 323a79e6ed3dfdd2afadfc2a464bb0610380b03b +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jul 4 16:08:31 2018 -0700 + + altos: Fetch current quadrature status at startup time + + This avoids having the state appear to change the first time we look + at the device. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ad9d6677231ccbfa09a528387f306f5364f9d608 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jul 4 12:34:38 2018 -0700 + + altos: Make fewer LCO variables public + + The lco common code doesn't need to share its internal values with the + world; make most of them static. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 38fb80e5e6af87f8c734448e4aa69b2c39854903 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jul 4 11:58:40 2018 -0700 + + altos: Make LCO search directly drive pad/box displays + + Don't use ao_lco_show as that has other logic too. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 2214ad7c0f268be76c0b027eef9d1dc406f23b28 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jul 4 11:27:31 2018 -0700 + + altos: Fix LCO display while searching + + Use lower level functions to control the display more directly + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 3b53a69e47816ee987a409b05a6b0b47891ca816 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jul 4 11:18:12 2018 -0700 + + altos: Fix telelcotwo build for new ao_lco_bits.c file + + Lots of code motion; shouldn't have any functional changes. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 71a51b4857f5bd49c0cba2578fb54b1d5b2c738b +Author: Bdale Garbee <bdale@gag.com> +Date: Wed Jul 4 12:13:38 2018 -0600 + + add telefireeight-v1.0 to products built by default in src/Makefile + +commit 81355cd08a22502d47637f2505b6089d226d0889 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Jul 3 01:06:09 2018 -0700 + + altos: A bit more LCO code sharing + + Missed drag race pad toggling in ao_lco_v2.c + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 55f817d6ff1a524434fe41ba83e42b8008989cac +Author: Keith Packard <keithp@keithp.com> +Date: Tue Jul 3 01:01:05 2018 -0700 + + altos: Build telelco-v2.0 by default + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c48d4b60da8b23bf358e6c14d7332d3a360c2d2f +Author: Keith Packard <keithp@keithp.com> +Date: Tue Jul 3 01:00:15 2018 -0700 + + altos: Share common LCO functions in ao_lco_bits.c + + Move common code out of ao_lco.c and ao_lco_v2.c into a shared file, + ao_lco_bits.c. Update ao_lco.h to include shared functions. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e56e1dc20b3bf18073766da4e26e97d9e1d419fc +Author: Keith Packard <keithp@keithp.com> +Date: Mon Jul 2 14:21:48 2018 -0700 + + altos/test: Compute and show height error tracker in ao_flight_test + + Enable the computation of ao_error_h_sq_avg in ao_flight_test even + when an accelerometer is present to allow review of that data. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c263fde769da380d55d223cebe3c9b6e8f19cb29 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Jul 2 14:20:39 2018 -0700 + + altosuilib: Split cc1111 vs arm telefire/telemini for flashing + + Only older telefire and telemini boards had cc1111 processors and need + pair-programming. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8794920328c8311372f83e4e5656ce14c7f8336b +Author: Bdale Garbee <bdale@gag.com> +Date: Sun Jul 1 14:50:26 2018 -0600 + + add a turnon script for TeleLCO v2.0 + +commit 655fd8e1490b70061cd81edf1d019e0469843688 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Jun 18 10:53:35 2018 -0700 + + altos/telelco-v2.0: Do all drag race beeping from the beeping thread + + Instead of starting the beep from the calling thread, just update some + state and poke the beeping thread. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 9ece56e3ad76af6ae623ad7a6782c0c933839be8 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jun 17 12:35:23 2018 -0700 + + altos/ao_pad: Move LED test to the monitor task + + It sets the LEDs, so it's best to not start doing that until we've + tested them. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cef5a5725e3bf2c17965599bd76eb93cb05a0f80 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jun 17 12:30:09 2018 -0700 + + altos/ao_pad: Turn on all LEDs for a moment at power up + + Allow validation of all LED connections. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 731ba39a22719a8c431eb63895cd8ba553975114 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jun 17 12:29:36 2018 -0700 + + altos/ao_pad: Use AO_LED_TYPE for computing active LEDs. + + instead of uint8_t + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 42ee832368f6ff796444823d53935d824acd329a +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jun 17 12:28:51 2018 -0700 + + altos/stm: Let products override AO_LED_TYPE for stm processors + + No need requiring it to be uint16_t + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c2d9f13a97d45b7dbe2cb47b563aea59ec725bb1 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jun 17 01:36:00 2018 -0700 + + Bump version to 1.8.6 + + Prepare for release. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 290506129fb6cb664da3a5e3ca450a0dcdff0398 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jun 17 01:20:01 2018 -0700 + + altos/telelco-v2.0: Fix AO_ADC_DUMP + + Was printing p.v_batt instead of (p)->v_batt. I don't know why the + former even worked. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 291bcd751991960ae3dad8c6523323fdcbafa16d +Author: Keith Packard <keithp@keithp.com> +Date: Sat Jun 16 23:50:11 2018 -0700 + + altos/telelco-v0.2-cc1200: Add build for NAR hacked TeleLCO v0.2 board + + This has the CC1120 replaced with a CC1200, but with 32MHz xtals + instead of 40MHz on the radio chip. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 16482bf5d63eafc5256f14a218d3a374f6584e0a +Author: Keith Packard <keithp@keithp.com> +Date: Sat Jun 16 23:51:26 2018 -0700 + + altos/driver: Improve quadrature debouncing for mechanical encoders + + Track state of encoder better and only bump values when the full + motion is detected (all four states). + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit abac6c59d6b004d52a7b782865d2d987732cd61e +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jun 17 00:17:29 2018 -0700 + + altos/telelco-v0: Test display, show batt voltage at boot + + Just like telelco v2 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 96835cc841ff7afad0b4d2fe4b63f26b951da122 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jun 17 00:19:37 2018 -0700 + + ao-bringup: Find dfu-util in $PATH for chaoskey + + In case it's not in /usr/bin + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7821e341a7cf55e32b926eb4474220dabb6eeb81 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Jun 16 23:47:42 2018 -0700 + + altos/stm: Define ADC channels for TEMP and V_REF + + These are fixed at 16 and 17. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5c465b0049659246908b15be68806b1390e8ebe5 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Jun 16 23:47:15 2018 -0700 + + altos/stm: Remove unused ADC names from ao_adc_single_stm.c + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5d9881547706b49cc22b98cc5c94e01e8a7f5181 +Author: Keith Packard <keithp@keithp.com> +Date: Thu May 31 22:45:49 2018 -0700 + + altos/telelco: Remove STATIC_TEST code from stand-alone LCO boxes + + This command conflicts with the 'debug' command in these devices and + so wasn't usable anyways. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f755181fd3ec82d7644591e2ed4b99a244acfd6e +Author: Keith Packard <keithp@keithp.com> +Date: Thu May 31 22:42:13 2018 -0700 + + altos/telelco-v2.0: Test displays at power on + + At boot, light up all LEDS and LCD segments for a second to let the + user verify that things are working correctly. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 99642f9c4f89aa5577376a9cd118e7cff26e2762 +Author: Keith Packard <keithp@keithp.com> +Date: Thu May 31 22:39:45 2018 -0700 + + altos/telefire*: Do voltage tests in decivolts instead of ADC units + + This requires that each pad device specify the ADC reference voltage + and all relevant voltage divider resistor values explicitly so that + the ADC values can be converted to decivolts and compared with one + another. This should be easier to understand in the future when + reading the code. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ab22c56ca02db87a84b6950c024a90b086f5ce28 +Author: Keith Packard <keithp@keithp.com> +Date: Thu May 31 16:24:33 2018 -0700 + + altos/telefireeight-v1.0: Fix ADC definitions + + Was missing all of the GPIO configuration bits, which probably meant + the ADCs were returning garbage values. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 82ed4f5c45b1a9f114577a59fac546c81d69f810 +Author: Keith Packard <keithp@keithp.com> +Date: Wed May 30 11:38:24 2018 -0700 + + altoslib: Revert field name changes for accel cal values + + These names get written in the JSON part of all .eeprom files, so we + can't change the names or the values won't be read and written correctly. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 484ffebc54048bbe276e0e2c0e2ab52c6a1761c1 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 19:19:43 2018 -0700 + + altos/telelco-v2.0: Set HAS_ADC_SINGLE to enable HSI timer + + The ADC unit requires the HSI timer to run, so make sure it's enabled + for this device. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 16971e550d1018fb6acf3fee3c56098f5ba9921e +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 19:18:48 2018 -0700 + + altos/stm: Enable HSI timer when HAS_ADC_SINGLE is set + + The ADC unit always uses the HSI timer. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 42a261a56606be69b5fb90fd6017c70a1e5d72dd +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 16:10:51 2018 -0700 + + altos/telelco-v2.0: Display local batt voltage at startup + + Show the battery voltage for a second at startup. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 3fb27f0ab7163c96945a60fd406e5423552206a2 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 16:09:19 2018 -0700 + + altos/stm: Add polling ADC sampler API + + This just fetches ADC values on demand instead of loading them + periodically into a ring buffer from the timer interrupt. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit dbeb9b91a48418c5bc9f6edccaef20c3ef77d45d +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 15:12:26 2018 -0700 + + altos/telelco-v2.0: Change drag race selected/no-continutity pattern + + Make it turn on at the same time as the pads with continuity, but turn + off sooner + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit eb31a40b3499287e0a52324a9adc3728883ed957 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 15:07:06 2018 -0700 + + altos/telelco-v2.0: Add debug output for pad voltage display + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 29f9880f7b09bc135d34bf0dcb221bdede7726b3 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 14:54:47 2018 -0700 + + altos/telelco-v2.0: A bit fancier with the drag-mode LED show + + Continutity leds now show whether the pad is included in the drag race + *and* the continutity using four different patterns: + + Drag select & igniter present: long on, short off + Drag select & igniter missing: short on, long off + Not select & igniter present: solid on + Not select & igniter missing: solid off + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 98ea690cc7514f43254f3a6c72668c11820f657c +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 14:41:51 2018 -0700 + + altos/telelco-v2.0: Fix button names and pin mappings. Add drag LED. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b1f1a4513391aa595eb64552f2aa4cfedd0cc0ff +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 14:35:18 2018 -0700 + + altos/telelco-v2.0: Mixed up the select_button pin (is E0, was set to E13) + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 2c94ba66d5b4c99b43ab965331bf1faa270a9768 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 14:26:47 2018 -0700 + + altos/telelco-v2.0: Only look at drag select presses, not releases + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a26cf26e3416b1982abec249678a32a420bf8809 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 14:26:12 2018 -0700 + + altos/telelco-v2.0: Use single-step quadrature code + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ccad6e970c5c7416561443f1e6e2fa8f80698957 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 14:15:34 2018 -0700 + + altos/driver: Add support for one-step-per-click quadrature encoder + + The mechanical encoders go through all four steps per click while the + optical ones have a single step per click. Support both kinds. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f172b139ddc3fcc17cf89b57e5126264c0faa45e +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 13:08:33 2018 -0700 + + altos/telelco-v2.0: Reduce quadrature debounce time + + The optical encoders shouldn't bounce at all; let's try a minimal value. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a4dbc940cc6c8ff5565e8af21f2dcb4ae090380c +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 13:07:06 2018 -0700 + + altos/drivers: Make quadrature debounce longer by default. Fix state tracking + + This increases the default debounce time for quadrature encoders to + 30ms, which cleans up the mechanical encoders on TeleLCO v0.2. Also + change state tracking to explicitly check for expected state values to + avoid mis-triggering. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7e2a2849f58e98adc1114bb8f3a6319408d93691 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 12:06:41 2018 -0700 + + altos/telelco-v2.0: Only switch encoder mode on push, not release + + Was not checking event value. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 863a9d523b26a8a5f8fbd5b516bd7dd914ee079e +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 11:23:03 2018 -0700 + + altos/ao_button.c: Support up to 16 buttons + + TeleLCO v2.0 has more than 4 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit eb70e334ffc77e737bb21ab3fe777a982d80ee3b +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 28 11:12:36 2018 -0700 + + altos/telelco-v2: Change select button to alternate box/pad mode + + Instead of a three-way, just make the select button two-way and have + the arming switch disable it. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 14fa6cee857918966740d05c4ed13b1a79db3caa +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 21 22:36:35 2018 -0700 + + altos: Add TeleFireEight v1.0 product + + Eight pyro channel version of the TeleFire boards. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e272f6a66881b6904037ee7b1afeb9a8a3ec5b2a +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 21 22:32:38 2018 -0700 + + altos/drivers: Pads with multi-port firing and pad selector DIP switch + + TeleFire 8 scrambles GPIOs to make layout cleaner, placing the 8 + firing outputs across two GPIO ports. + + We're also adding an 8-unit selector for box number so that boards can + be re-configured in the field. These override any ROM-configuration + value; you can select the rom value by setting all switches to 'off'. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 85a8846a423ce2d15815466564fb589bb553c742 +Author: Keith Packard <keithp@keithp.com> +Date: Wed May 16 22:03:25 2018 -0700 + + altos/stm: Add per-LED port/pin mode in LED code + + If you've got a complicated LED pin arrangement, you can ask for each + one to be configured separately, instead of using groups in a couple + of GPIO registers. The code isn't as efficient this way, but at least + it's easy to read. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 96ee5257068a988db10097af8df72b0008bce978 +Author: Keith Packard <keithp@keithp.com> +Date: Wed May 16 22:02:11 2018 -0700 + + altos: Add TeleLCO v2.0 product + + New LCO design with a single rotary knob and lots more buttons. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5a26df7db9453bf0596f729a23efb90e5e8a63c7 +Author: Keith Packard <keithp@keithp.com> +Date: Wed May 16 22:05:26 2018 -0700 + + altos/vidtime: Check for value change in normal code, not irq + + This makes sure each value change is reported to the user. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 06dac6551418ba817798c187f198b9b00c1dda74 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 7 11:26:42 2018 -0700 + + altos: add 'vidtime', a simple brightness monitor + + This is a testing tool for video refresh tracking. It uses the mpusb + v3.0 hardware and monitors the phototransistor value, sending 0 or 1 + to the USB port when the value changes. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 1f56dc30a31e3d5c833f73ec9cd31f548a80e154 +Merge: feb881a2 71acc79f +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 7 09:53:52 2018 -0700 + + Merge branch 'mpusb' + +commit 71acc79f8e828d56296db282c72cf4492a8aa4f4 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 7 09:43:27 2018 -0700 + + altos/mpusb-v3.0: Make it compile again + + A few things have changed since this code was written. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bc70f92966221f941b96177b401744a7aca24814 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 7 09:42:28 2018 -0700 + + altos/stmf0: leave ao_power_gpio names undefined without power management + + Should make it more obvious at compile time that you've done something wrong. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5ddd4e10bd8ddb4a00a0ccd8982db3311ec5a9e7 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jan 20 00:00:07 2016 -0800 + + altos: Add µPusb v3.0 project + + This replaces the ft230 with a stm32f04, saving a bit of BOM + and giving us control over the firmware. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit feb881a24250bd7e71ec8ccef0099d4b4a0df519 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 7 08:58:21 2018 -0700 + + doc: Update pyro channel info to reflect UI changes + + Use the new naming in the UI. Add lots more comments about how things work. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7b11a34bb031035883bac97952e5ca6db0684e33 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 7 08:56:32 2018 -0700 + + altos/test: Replace state name with 10* state value in test log. Fix raw speed + + Using a state value means we can plot state changes along with the + rest of the graph. Raw speed (simple integrated acceleration) was + busted; mostly needing to skip the first accel sample. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cc83d57454ed07e4828b4413e5af6ae2ecfe2e5a +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 7 08:51:36 2018 -0700 + + altos: Eliminate height requirement for coast detect + + We had required a minimum altitude of 100m to transition from boost to + coast. With small motors in a heavy multi-staged rocket, this can fail + to detect coast in time to light the second motor. + + Also, this would fail to deploy recovery systems if the flight failed + before reaching 100m. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 49aafcbb6c0f3ecda4b668776be74a04a5654377 +Author: Keith Packard <keithp@keithp.com> +Date: Mon May 7 08:50:33 2018 -0700 + + Update version to 1.8.5.2 + + Shipped some bits to Fred Taverni to test eliminating the altitude + requirement for boost detect as he stages so low. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ab65e9f257493da5282d8933d8f0dcb716c1f41f +Author: Keith Packard <keithp@keithp.com> +Date: Sun May 6 21:16:25 2018 -0700 + + ao-chaosread: Add support for the new flash endpoint in chaoskey + + This adds support for endpoint 0x87, which streams the contents of the + onboard flash to the host for firmware verification. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bea42e45952df85d61428662caefbb100465a585 +Author: Keith Packard <keithp@keithp.com> +Date: Sun May 6 21:13:02 2018 -0700 + + altos/chaoskey-v1.0: Add endpoint for reading flash contents + + This creates another IN endpoint which provides the contents of flash + for validation of the firmware load on the host. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 4451f7b6bade66775a197b93c6e70ba15f1826ce +Author: Keith Packard <keithp@keithp.com> +Date: Sun May 6 21:11:48 2018 -0700 + + altos/stmf0: Fix up USB debug code + + At least make it compile. In this configuration, it's dumping out IN3 + endpoint register values. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a06c283c358455008cd1e5376ccc0b6f72c7ac87 +Author: Keith Packard <keithp@keithp.com> +Date: Sun May 6 21:11:02 2018 -0700 + + altos/stmf0: Add IN3 alternate endpoint support + + This adds the code necessary to drive another IN endpoint. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b15549d8c5277ba3aa425e232473a17dc136e5a4 +Author: Keith Packard <keithp@keithp.com> +Date: Sun May 6 21:09:22 2018 -0700 + + altos/stmf0: Toggle IN2 SW_BUF bit when sending data + + This tells the hardware we're done writing data to the second input + buffer and allows it to be switched from NAK to VALID. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8efe0d40deded973f08f63eb650a036f9e24d2fb +Author: Keith Packard <keithp@keithp.com> +Date: Sun May 6 21:17:32 2018 -0700 + + altos/kernel: Add USB descriptors for IN3 + + This adds the necessary descriptor information to support another IN + endpoint for applications. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f282b802d2f5a0da56bb8245169c46a16b2eed71 +Author: Keith Packard <keithp@keithp.com> +Date: Sun May 6 21:06:31 2018 -0700 + + altos/kernel: Define usb IN2/IN3 functions + + These are putchar and flush functions that are used when sending data + to the additional IN2 and IN3 endpoints. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 257350e1a3e4ba2048e80d30a4a0454eb65d4a26 +Author: Keith Packard <keithp@keithp.com> +Date: Tue May 1 23:47:27 2018 -0700 + + ao-bringup/turnon_telemini: Skip DFU if no DFU device is present + + This skips running dfu-util to load the bootloader if there isn't a + suitable DFU device listed in the system, which allows an + already-flashed device to be run through the same script. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 08e543cd8b761e4cbbfa97404fcd5394f65a0e9e +Author: Keith Packard <keithp@keithp.com> +Date: Tue May 1 23:44:00 2018 -0700 + + altos/stmf0: Set 0x0 mapping to Main Flash for boot loader + + When DFU finishes loading firmware and jumps to the application, it + leaves the mapping of addresses starting at 0x0 set to System flash, + which prevents the boot loader from receiving interrupts and requires + a power cycle during flash & cal. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 980e3dc43ac4712680a370756e5112e9f330aa9a +Author: Keith Packard <keithp@keithp.com> +Date: Tue May 1 23:36:57 2018 -0700 + + altos/stmf0: whitespace fix + + Trailing whitespace. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 772b5f1cb625fba1396a57b47498ef805ae1a9a8 +Author: Keith Packard <keithp@keithp.com> +Date: Tue May 1 23:36:16 2018 -0700 + + altos/stmf0: Change tests for AO_BOOT_CHAIN and AO_BOOT_PIN to #if + + Were #ifdef, which meant that #define AO_BOOT_PIN 0 didn't work right. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 312f303be7f2a641020903ed2daccb8a4d67ec42 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Apr 28 12:03:10 2018 -0700 + + altoslib: Fix Idle Monitor on TeleMega v3 + + The new IMU includes a mag sensor, and there's no separate mag sensor. + + Add support for reading the mag sensor values from the IMU, separate + out v3 from previous TeleMega versions so that the code can stop + trying to read the mag sensor. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 0dfaecc25a12da57248541a66dd5118161616cce +Author: Keith Packard <keithp@keithp.com> +Date: Sat Apr 21 16:16:18 2018 -0700 + + altos/fox1ihu: Pull down radio control pin in flash loader + + Ensures that the radio is powered down while in the flash loader. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8025b98420f16730e5e6e45114cbdbbf88f7a748 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Aug 7 20:16:41 2015 -0700 + + Remove ao_radio_cal from stm products without radios + + Products without a radio don't need this value. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c408c773793b5a5685d95c11ba6f710200505c25 +Author: Bdale Garbee <bdale@gag.com> +Date: Tue May 6 00:38:33 2014 -0600 + + had the sense backwards .. presence of 'attached' should put us in the loader + +commit 9003147a89074f8d991d1707f307fd4e41435aa3 +Author: Bdale Garbee <bdale@gag.com> +Date: Mon May 5 17:32:22 2014 -0600 + + move signal that forces flash-loader on to PB8, active high + +commit ddf70e806f894707613830fd64e21b5bb8f19972 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Apr 27 00:36:36 2013 -0700 + + altos: Build fox1ihu by default + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6247e0c81084b59365ceca0ced33d2db92a72444 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Feb 1 00:06:30 2014 -0800 + + altos/fox: Enable system timer in flash loader and prod watchdog with it + + This makes it possible to reflash the board without needing to disable + the watchdog. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 04aa1dfa7918dcf4eea9ec4cef5a31ac2a61a00d +Author: Keith Packard <keithp@keithp.com> +Date: Fri Jan 31 22:39:58 2014 -0800 + + altos/fox: Update ADC to fox-1 IHU Revision 2 + + Change ADC pin definitions to match new hardware. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 54da028c492464802b048cb949d392cd83994e75 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Jan 31 17:44:45 2014 -0800 + + altos/fox: Transition to current altos build environment + + Fix the library usage, use $(LIBS) instead of $(SAT_CLIB) -lgcc + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ca58096665fc1a11ca5683f0e6aafaf3e153af37 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Apr 28 00:42:31 2013 -0700 + + altos/fox: update product name to show v2, enable watchdog by default + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e79202f95f0e5b4a01da31d3742a775bea62cc92 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Apr 28 00:05:39 2013 -0700 + + altos/fox: Run app when PD6 is low + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 36cf713ead58a52539c87de764b022ba0dcde27d +Author: Keith Packard <keithp@keithp.com> +Date: Sat Apr 27 16:06:48 2013 -0700 + + altos/fox: Add fox1ihu flash loader + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 4c37ccc63d37ff0a4382f6812060d3c5fd4b6cfb +Author: Keith Packard <keithp@keithp.com> +Date: Thu Apr 25 21:25:12 2013 -0700 + + altos/fox: Add MRAM and SD card drivers + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f517aa5e042af8dd7fd36be47e4b196f212e79b0 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Mar 21 10:16:35 2013 -0700 + + altos/fox: Enable M25 driver for MRAM. + + The M25 driver can also talk to the MRAM chip, with a few adjustments + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e0c969910a516c018e64eaa73cdbe4bc2f979835 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Mar 21 09:49:15 2013 -0700 + + altos/fox: Add watchdog timer + + Runs at 25Hz, can be enabled and disabled via the command line + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6adf9d2a17d701ed0ceb742f322fa72723149980 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jan 23 21:37:24 2013 -0800 + + altos/fox: Turn on all of the fox lights + + Fox has two red and two green LEDs + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 524afb040aa34d93abae7d04afa1df7a626f9877 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jan 23 21:36:18 2013 -0800 + + altos/fox: Provide names for fox ADC channels + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8b783887d7f136d3a389316545b74f4755e43eb4 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jan 23 21:05:26 2013 -0800 + + altos/fox: Fix up Fox ADC bits + + Update to current schematic + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ff2330a7fedfa7f6be3502ad0d591ab9e5ddddc6 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jan 23 20:48:04 2013 -0800 + + altos/fox: Initialize FOX adc + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit fbf01178e560d8a36916e295d7bdb0b0e98d2b02 +Author: Bdale Garbee <bdale@gag.com> +Date: Wed Jan 23 21:45:28 2013 -0700 + + altos/fox: rename fox product + + It's Fox1IHU-v1 now + +commit 23ba75c3c2ddde65dc543b52cd87b8a1433c5024 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jan 23 19:03:26 2013 -0800 + + altos/fox: Add fox1ihu bringup firmware + + Firmware capable of testing fox1ihu hardware + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8612c1287a1c458a17f33af1d679d30a13dea772 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Apr 26 17:24:51 2018 -0700 + + altoslib: Fix data fetching during flashing of cc1111-based devices + + We want to get enough information about the target device to verify + that the new firmware matches, so fetch 512 bytes instead of just + barely enough to cover the romconfig data. + + Also catch out-of-bounds accesses and handle them, in case even this + large array isn't enough. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit eee9f6128da146b0e9c711d49b2a3eb49a95aaf3 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Apr 26 16:30:54 2018 -0700 + + altoslib: Keep config data accel cal in antenna up form. + + Instead of letting the accel cal data live in whatever form it was + fetched in, keep it in antenna up form and provide it in whatever + orientation is necessary. + + This fixes bugs in changing pad configuration where the accel cal values + from the old orientation would get used in the new orientation and + wreck them. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b3474fb33a58e78b3b8f36958dd44768e49f3edc +Author: Keith Packard <keithp@keithp.com> +Date: Wed Apr 25 23:07:46 2018 -0700 + + altoslib: Flush settings restoration commands after accel cal + + To avoid mangling settings when the user doesn't 'save' things, + restore the original accel cal values and orientation after finishing + accelerometer calibration. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 0d691170a96545a9e57aad454de87541cea8c292 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Apr 22 20:02:04 2018 -0700 + + altoslib: Remove ascending/descending from pyro config + + Ascending and descending don't add any functionality and can confuse + people. Clears pyro configuration value when ascending or descending were + selected in the configuration so that the user knows to reset the + channel from scratch. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 57218127ee39724e985fefcf203991401f01cc84 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Apr 22 20:01:01 2018 -0700 + + altoslib: Clarify terms in Mega pyro config + + Suggestions from Bob Brown et al + + Speed -> ascent rate + Height -> height above ground + Acceleration -> Vertical acceleration + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 06ca18ee67f80a9d1e25799930aca59e99e32d7f +Author: Keith Packard <keithp@keithp.com> +Date: Sat Apr 21 16:22:16 2018 -0700 + + Set version to 1.8.5.1 + + Firmware has changed + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b47796991cb6c2edb85f9201a53515b4dd28b946 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Jul 15 22:52:35 2014 -0700 + + altos/flash-loader: On STM, don't include ao_usb_disable + + This saves a bit of space, keeping the flash loader under 4k on fox + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b478d3c3569d2f9df50b0030197468d14af67688 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Apr 21 16:17:26 2018 -0700 + + altos: Use max of 64 previous orient values when checking pyro limits + + Instead of checking just a single measurement to see if the + orientation is outside of the desired limits, use the maximum of 64 + previous values to that rapidly changing orientation won't + accidentally enable a pyro channel if sampled at the 'wrong time'. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a414a32f86c9d8a2c5f576898c0f0dc75263ff85 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Apr 21 16:14:39 2018 -0700 + + altos/stm: Simplify ao_usb_write a bit + + Remove unnecessary 'offset' param (was always passed zero). This also + makes some code conditional on that value no longer necessary. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 1569b23b2f139e3840ec145f4eef45f36fc4939a +Author: Keith Packard <keithp@keithp.com> +Date: Mon Apr 16 09:46:22 2018 -0700 + + doc: add release check for altusmetrum-docinfo.xml copyright + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit d5c038473d56ebbe61b8a71b5eb28d03385f8c48 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Apr 16 09:45:35 2018 -0700 + + altosdroid: Attempt to avoid some reported altosdroid crashes + + Just looking at stack traces, maybe these changes will avoid some problems? + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 110e4818b85781c33d683b7b7e7f2864a1223c5c +Author: Keith Packard <keithp@keithp.com> +Date: Thu Apr 5 16:41:20 2018 -0700 + + micropeak: Make reported 'max height' value show filtered max height + + MicroPeak tries to filter out bogus pressure data so that the value + reported on the LED is reasonable. We want to report that same value + in the UI, which means replacing the normal mechanism for computing + max height from the time series of height data with the value computed + from the saved minimum pressure value recorded in the device. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 20dc0e6c8e365c1f4188189d506163d589c3bade +Author: Bdale Garbee <bdale@gag.com> +Date: Sun Apr 22 19:00:03 2018 -0600 + + add a warning about Google limiting per-day access until/unless we pay + +commit 0b58d3067d994319b73c2bd15817f6922257ece2 +Author: Bdale Garbee <bdale@gag.com> +Date: Sat Mar 31 17:44:18 2018 -0600 + + another second seems to help on the very slow Acer laptop + +commit 865364d2738ae0b79a390eab62a5ddac1e890c71 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Mar 23 17:35:47 2018 -0600 + + altos: Hack up code for TeleMetrum to make it just a tracker + + Support for a failed TeleMetrum device that uses just the GPS receiver + and radio to create a TeleGPS-compatible device called 'tmgps'. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 58eda1736d8cffa6e3b5afce6f5faabbb179045e +Author: Keith Packard <keithp@keithp.com> +Date: Fri Mar 23 17:34:23 2018 -0600 + + altos/ao_cc1120: Only call ao_packet_slave_stop when HAS_SLAVE + + Don't try to disable packet slave mode when the product doesn't + support packet slave mode. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 49fd1fe435b116665b41722c7d14878a62bb3311 +Author: Bdale Garbee <bdale@gag.com> +Date: Tue Mar 20 18:25:43 2018 -0600 + + add a paragraph to the intro pointing to the altusmetrum email list + +commit 39023ed6e29103a85bfad505506fa0dbf4dc1112 +Author: Bdale Garbee <bdale@gag.com> +Date: Sun Mar 18 15:42:48 2018 -0600 + + doc: update copyright year in doc/altusmetrum-docinfo.xml + +commit 84146083da782c335ba7f040b238c3f51ba2f484 +Merge: ee79a205 78e5ae58 +Author: Bdale Garbee <bdale@gag.com> +Date: Sun Mar 18 15:33:44 2018 -0600 + + Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos + +commit 78e5ae58c2ad5ba7246a649c0bd15ff68b5d0e74 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Mar 17 11:26:29 2018 -0700 + + Bump version to 1.8.5 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 529c04026dec55d9d0922689e56f1d23b0ff6095 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Mar 17 11:25:00 2018 -0700 + + doc: Add release notes for 1.8.5 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bd0021d431165a6c896a6022691a447e27fd555e +Author: Keith Packard <keithp@keithp.com> +Date: Fri Mar 16 14:54:04 2018 -0700 + + altos/stmf0: Add some common definitions for flash loaders + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 4894d965d73231b5c74810d826c7c97fa1bd7803 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Mar 16 14:53:14 2018 -0700 + + altos: Make panic beeps use fixed frequencies + + This ensures that the beeps will work even before the configuration + has been loaded. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 1ea6188a9c78ab0642001110cac6c3b35e8ccc88 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Mar 16 14:52:09 2018 -0700 + + ao-usbload: Flip product names in loader error message + + I was reversing the 'target' vs 'image' names in the error message, + leading to a bit of confusion. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 788d02a3caf0f14f3c84ff6ae7e2a2fff302e91b +Author: Keith Packard <keithp@keithp.com> +Date: Fri Mar 16 14:51:22 2018 -0700 + + ao-bringup: Check for Loader USB id before attempting dfu-util + + This lets me restart the turnon process after the boot loader has been + flashed. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7068149704e6de67ece670227445e987421cd600 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Mar 16 14:50:29 2018 -0700 + + chaoskey: Create unified ROM image with both loader and app + + Flash the whole thing all at once to reduce the number of steps during + turnon. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 46d8197bb80ce3fe4cdc7b36c3be211366093bd5 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Mar 16 14:49:04 2018 -0700 + + ao-bringup: Don't wait for user when testing EasyMini igniters + + I always have the LEDs ready to go before starting the turnon process. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ee79a205e118ea8730a02cc327d8fb79cc5f74ff +Merge: 365eee3e 78a90fc7 +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Feb 12 16:38:57 2018 -0700 + + Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos + +commit 78a90fc760b88ab66c5c238289afc38356e29d8a +Author: Keith Packard <keithp@keithp.com> +Date: Mon Feb 12 15:36:12 2018 -0800 + + Add TeleGPS v2.0 binaries to distribution + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 54e8e033ccf47526e5ff08f93c105ef75334924e +Author: Keith Packard <keithp@keithp.com> +Date: Sat Jan 13 21:29:08 2018 -0800 + + libaltos: Use case-insensitive compare when matching BT MACs + + We use the BT MAC vendor portion to figure out which port to connect + to as that is simpler and takes less network traffic than actually + doing discovery. However, on Windows, we were generating the address + in lower case and comparing against upper case vendors, which didn't + work out too well. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b95db5819885da89504d5e11decfda98cfac37aa +Author: Keith Packard <keithp@keithp.com> +Date: Fri Jan 12 22:27:41 2018 -0800 + + altoslib/altosuilib: Validate rom image is for target device + + This should avoid mis-programming devices with incorrect firmware. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f26cc1a677f577da533425a15485fcaa24626b23 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jan 10 23:11:40 2018 -0800 + + altos/scheme: Move ao-scheme to a separate repository + + This way it can be incorporated into multiple operating systems more easily. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 4b52fc6eea9a478cb3dd42dcd32c92838df39734 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Jan 8 13:46:17 2018 -0800 + + altos/scheme: Allow unicode in lexer + + This just passes any bytes with the high bit set through the system so + programs can include UTF-8 in strings and symbols. What the heck. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f8a967959b2f5ca3486ab3422f30fe4ad4ba17a8 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jan 7 23:06:51 2018 -0800 + + altos/lambdakey-v1.0: Add LED function back in + + We've made things smaller, so there's (barely) space for this now. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6ae22601bbf018193ac093fb0f745ebe213bfb64 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jan 7 23:06:22 2018 -0800 + + altos/scheme: remove debug code from vector write + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bf37c22c6cdd4a90117bdc809e5c063a079082ad +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jan 7 23:05:02 2018 -0800 + + altos/scheme: Allow individual lisp keywords to be feature-conditional + + This lets us build a smaller lisp that is just missing some aliases + for existing functionality to save rom space. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 283553f0f118cef1dbcfbf5e86a43575a610d27f +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jan 7 23:04:22 2018 -0800 + + altos/scheme: Split tests out from build sources + + Run tests on both tiny and full scheme test programs. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 48d164e3d4b2ef27fae20fae63b8014803a7b178 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jan 7 21:44:39 2018 -0800 + + altos/stmf0: Use double buffering for ChaosKey + + This improves the USB performance of ChaosKey so that it doesn't NAK + during data transfers at all. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit db7f7c6c7f956058250b8057c6c27284f6f22e53 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jan 7 21:43:22 2018 -0800 + + ao-chaosread: add --raw and --cooked flags + + Allow reading from the cooked endpoint as well as the raw one. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8545ed42bd29152f4937fb6457aba5fbd57e7691 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jan 7 17:43:42 2018 -0800 + + altos/stmf0: use double buffering for USB rx data + + This also allows us to stop shadowing USB rx buffers in system ram + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 42072f591690b8258d957ab7a9b2f5d911676b39 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jan 7 12:43:13 2018 -0800 + + altos/stmf0: Use double buffering for USB tx data + + This shouldn't have much of an effect, but shows how double buffering + works. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit eead259673c6594d41cfab796c8674c8bf1863cc +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jan 7 11:51:07 2018 -0800 + + altos/stmf0: Stop shadowing USB tx buffers in system RAM + + Use the 16-bit USB memory directly, avoiding the buffer space and the copy + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ee62272bec67b5784a4ee4e12d8a59677bf9d112 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jan 7 11:49:09 2018 -0800 + + altos/stmf0: Remove packet counters from non-debug build + + These counters are only useful for helping debug the USB driver. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 043c5b56ffc2d8171769f6e988eaad6e457bad89 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Jan 7 11:47:57 2018 -0800 + + altos/kernel: Use ao_put_string for syntax error message + + Avoid using puts, which can be a large library function. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b446d9657cad0ff45f6f65c774d82cb9f2f65088 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Jan 6 18:11:19 2018 -0800 + + altos/lambdakey-v1.0: Switch back to command buffered input + + Instead of just reading from stdin with no echo or editing. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 16061947d4376b41e596d87f97ec53ec29d17644 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Jan 6 17:29:10 2018 -0800 + + altos/scheme: Add ports. Split scheme code up. + + And lots of other changes, including freeing unreferenced atoms. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 39df849f0717d92a7d5bdf8aa5904bd4db1b467f +Author: Keith Packard <keithp@keithp.com> +Date: Sat Jan 6 17:21:45 2018 -0800 + + altos/scheme: add 'install' target to install both test and tiny test + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 0d9a3e0378f84ffc8447747150066eae33cd3229 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Jan 4 02:28:13 2018 -0800 + + altos/scheme: Add vector and string funcs. Test everybody. + + Add a bunch of string and vector functions from r7rs. I think most + everything is here now. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit d34f01110d8770ac99556901143a54c3d492cde0 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Jan 4 02:27:11 2018 -0800 + + altos/scheme: Accept more escaped character constants + + Allow all those specified in r7rs + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 243baa14a62e3efe5ae792c73db75f9c2cb86abb +Author: Keith Packard <keithp@keithp.com> +Date: Thu Jan 4 02:26:21 2018 -0800 + + altos/scheme: Allow make-vector value param to be optional + + It can default to #f + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a6e01e7aafb1d1fdb15d633ec23d8fe51afd15df +Author: Keith Packard <keithp@keithp.com> +Date: Thu Jan 4 02:25:45 2018 -0800 + + altos/scheme: Add builtin list-tail + + This is used enough to warrant a builtin, rather than lisp implementation + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e030fba5ab556c88af918d08e1b62e63d6605638 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Jan 4 02:24:15 2018 -0800 + + altos/scheme: Fix macro-detection debugging + + Just update to use ao_scheme_printf + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 036a5311cbc86dbc5a8f859778d52d588915e4e2 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Jan 4 02:23:40 2018 -0800 + + altos/scheme: add make-string builtin + + Allocate a blank string. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 0a0327330dcbf5531cd0f8ca8b912fa51ef44f13 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Jan 4 02:22:02 2018 -0800 + + altos/scheme: Make constant built pool as large as possible + + This allows building with as much constant data as will fit. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 637795fcf8ca52af431acec183cc961dae121e57 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jan 3 14:58:57 2018 -0800 + + altos/scheme: Make for-each tail recursive + + Provides a native version of for-each that is tail recursive, rather + than having it just use map and discard the return value. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7bfc1eda398e8767e352cd6396ac61c7ea021079 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jan 3 14:57:39 2018 -0800 + + altos/scheme: Add start/end args to vector->list + + This is an r7rs extension which allows you to extract a subset of the + vector. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 2bcc178f3cbfd346b134bb3fe700b0512f340fea +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jan 3 14:56:15 2018 -0800 + + altos/scheme: fix parsing of vector followed by list + + The 'parsing a vector' state value wasn't getting cleared at the end + of the vector, so that (#(1 2) (3 4) returned (#(1 2) #(3 4) + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b7c34a2e5ecff19d61d337b8c84976cc46005ec4 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jan 3 14:55:24 2018 -0800 + + altos/scheme: support %x format for scheme printf + + read debugging uses this format. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit fccb5105b79d5b9e2ed052ce5459028015c01741 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Jan 3 14:53:48 2018 -0800 + + altos/scheme: Add support for hex, octal and binary constants + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 365eee3ebfe73204033089b363687228f97e5d98 +Author: Bdale Garbee <bdale@gag.com> +Date: Wed Jan 3 14:43:29 2018 -0600 + + need to push telegps-v2.0 loader .bin file to corporate repo, too + +commit fc63968f90e3fab12e63d973a4ee7f16d80d765f +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 24 14:29:09 2017 -0800 + + altos/scheme: Pull out per-frame vals while printing list of frames + + Was using the same vals for all frames, which just doesn't work well. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7b5892f75a75363a656ede8befb419245aa218b5 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 24 14:28:29 2017 -0800 + + altos/scheme: Add separate floor-quotient builtin + + Does what 'quotient' did before, now quotient rounds towards zero + while floor-quotient rounds down. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit d95486be96fe989f6984b3452c5c5d92897c5606 +Author: Bdale Garbee <bdale@gag.com> +Date: Thu Dec 21 20:40:28 2017 -0700 + + update Releasing with wisdom from 1.8.4 release process + +commit 87aab99521dc44d1d29fbb0b7f227f868f074836 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Dec 21 17:37:10 2017 -0800 + + Bump for version 1.8.4 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 4bcdc106df2c5e8572570e57b4d97121df94799a +Author: Keith Packard <keithp@keithp.com> +Date: Thu Dec 21 17:36:24 2017 -0800 + + Doc updates for version 1.8.4 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 46304aa257635d14afc4d8567eedba0f93a5742f +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 16:57:33 2017 -0800 + + altos/micropeak: Remove all compiler results + + Not just the current version. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 99299986e194337b05ee81cfb7c4aa1cb9e9a74e +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 16:56:33 2017 -0800 + + altos/attiny: Add ADC implementation + + It's primitive, but might serve to read ADC values. Untested. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 342132a8869d530b6893bb84becf03cb30490600 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 16:21:23 2017 -0800 + + ao-bringup: turnon_easymini was left with dfu_util disabled + + This was presumably changed for some test and left in the wrong + state. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6d05747941b8e31afb1f8522ac0b8c1ad12aa90f +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 16:19:40 2017 -0800 + + altos/easymini-v2.0: Adapt to final hardware pin assignment changes + + Beeper moved from PB0 to PB1 (Tim3 CH4) + Drogue fire moved from PB6 to PB3 + Bootloader moved from PB1 to PB6 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 9826845f952abe898f029e31cc0f7080708e2eae +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 13:09:24 2017 -0800 + + altos/lambdakey-v1.0: Add back and/or macros + + With scheme shrinking a bit, there's now space for these useful macros. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ed1f7b79abc7400a54b35fbf62c9db6855f9129a +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 12:39:20 2017 -0800 + + altos/scheme: Replace per-type indexed stash with poly stash heap + + Instead of having a random set of stash arrays with explicit indices + used by callers, just have a general heap. Less error prone, and less code. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 71fb79492cb955af4bd52e79f1fa69d17e084dbc +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 12:16:24 2017 -0800 + + altos/scheme: Replace memory pool macros with inlines + + AO_SCHEME_IS_CONST -> ao_scheme_is_const_addr + AO_SCHEME_IS_POOL -> ao_scheme_is_pool_addr + + Provides better typechecking and avoids confusion with + ao_scheme_is_const inline (which takes an ao_poly instead of a void *) + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 34f998d147d08e966daad1ab76c40906018d3d8d +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 11:51:33 2017 -0800 + + altos/scheme: AO_SCHEME_IS_CONS -> ao_scheme_is_cons + + This inline was already defined; just use it. Also, switch some places + to use ao_scheme_is_pair instead as appropriate. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit fa6f4b331db9d37da6767005fd375b696485b46b +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 11:43:23 2017 -0800 + + altos/scheme: ao_scheme__cons -> ao_scheme_cons + + Fix the double underscore in this name. Ick. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 00390fb09f47654905824af671b966ffca0a38b3 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 11:40:08 2017 -0800 + + altos/scheme: Don't optimize ao_scheme_make_const + + Performance isn't interesting, and it's nice to have a bare system + ready for debugging. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ba472dda57e134fe0f0e4a571a6d0c1e5a1ea6eb +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 11:39:39 2017 -0800 + + altos/scheme: Clean up test CFLAGS + + make it easy to switch between debug and optimized builds. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 53b99e0419cb44c7983e41026bf0430deae58940 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 11:37:33 2017 -0800 + + altos/scheme: (define (foo . bar)) has a pair, not list as card + + When defining a lambda with varargs, the args are not a list as the + final element is not a pair or nil. Use pair? instead of list? to + detect this form correctly. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit fbe5dc9f215e7014aa8f9d325c1fba939816be03 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 11:35:09 2017 -0800 + + altos/scheme: apply also needs to not free value list on lambdas + + When apply is invoked on any function, the cons in the argument list + cannot be immediately freed as they have been passed to the + function. That applies to both built-ins as well as lambdas; this + patch removes the special ao_scheme_skip_cons_free global and just + marks the stack in both cases. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 431165e5fa72ba6dffd477de32960745cdec332c +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 19 11:33:36 2017 -0800 + + altos/scheme: Rework display/write code + + Unify output functions and add bool to switch between write and + display mode. Make that only affect strings (as per r⁷rs). + + Use print recursion detection in frame and stack code, eliminating + PRINT flags in type field. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5628b983497d9d03e10cccee157419210a49cfa9 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 18 02:14:57 2017 -0800 + + altos/scheme: Compile scheme test with -O3 + + This level of optimization caused trouble, so use it all of the time. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6593570418e087b9f83ed7f90303d4e1e7d20e83 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 18 02:12:04 2017 -0800 + + altos/scheme: Work around gcc 7.2.0 optimization bug in memory manager + + After marking a set of memory chunks, it's possible that all of them + will be packed tight against 'top', in which case none of them will be + moving. In that case, gcc 7.2.0 appears to generate incorrect code + causing the loop to be abandoned, meaning that we don't actually + collect anything at all. + + Add a quick short-circuit test just after the mark phase that skips + the code which wouldn't do anything in this case. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 9f1849e548e35498f88a0b8adbbc4a57c7a39222 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 18 02:11:07 2017 -0800 + + altos/scheme: rearrange debugging defines + + Allow applications to redefine these as desired, add more flexibility + in what the various memory debugging flags can do. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 2def6abebb3d14a29fe0e03bac09b9d74d2d1578 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 18 02:08:23 2017 -0800 + + altos/scheme: abort when we try to print an invalid value + + This can catch a host of interpreter bugs; best to abandon the program + when it happens. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e1a6b3bf458f311d832aea7eec34935d42f8efed +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 17 22:22:50 2017 -0800 + + altos/scheme: Use memory manager mark code to note recursive print + + This flags any object being printed and checks before recursing to + avoid infinite loops. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 9d1131da911f7220ac8b6cb7ba5a0afd3deef657 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 17 22:19:38 2017 -0800 + + altos/scheme: Use AO_SCHEME_IS_CONS in cons memory funcs + + More efficient than ao_scheme_poly_type as it doesn't care about + non-prim types. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b866b3ca249dce61f8ff16c8d28514d1b80386d7 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Dec 14 23:10:43 2017 -0800 + + ao-bringup/test-chaoskey: Make finding most recent device more reliable + + Use dmesg -t to strip off the timestamp, which avoids having a + variable number of fields for awk to look at. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a4c9233aa8a2f1b1dca6580d6d6275b48c40f01f +Author: Keith Packard <keithp@keithp.com> +Date: Thu Dec 14 23:09:02 2017 -0800 + + altos/lambdakey-v1.0: shrink scheme code to fit the ROM + + scheme has grown a bit; adapt + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 32f6877288ea6b7eb1cae9a42fbe8e2c5dbb2f08 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Dec 14 23:04:39 2017 -0800 + + altos/scheme: swap BIGINT and STRING types + + This lets BIGINT be a primitive type, allowing it to use all 32 bits + for storage. This does make strings another byte longer, and also + slightly harder to deal with. It's a trade off. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 2e11cae044cd2c053049effd76df9c5adecb84d7 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 12 18:07:06 2017 -0800 + + altos/scheme: integer? is builtin on all versions + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 0614c653a8ca8c4ccbf59d34296ca4b3e7d9f3a0 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 12 18:02:17 2017 -0800 + + altos/lambdakey-v1.0: Make stack larger + + scheme doesn't like to run with less than a 1kB stack. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 839a7454686415a52f532d0e4f379061a68d5f1b +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 12 18:01:21 2017 -0800 + + altos/scheme: inline some mem calls to reduce stack usage. + + Also includes some code to display stack usage during collect calls. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c490efdf90befdf048ff7d9cbbe26bcc6f942820 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 12 18:00:12 2017 -0800 + + altos/scheme: Use direct calls from frame to frame_vals mem functions + + Avoids the extra stack depth of the poly versions. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ca27d467198c556be483961a6ca3b8f97bbe96a6 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 12 17:59:26 2017 -0800 + + altos/scheme: More compiler warning cleanups + + Make local funcs static. Don't mix decls and code.x + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 4bfce37e7567d9c2a09ea4da8113e7639516ed6e +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 12 17:54:03 2017 -0800 + + altos/scheme: apply const to places taking const strings. + + Mostly printf and friends. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 28dbe9a04b16f79db255baecbf0cd486c510ef58 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 12 15:31:27 2017 -0800 + + altos/stm: Align 'data' to 8 bytes, just like textram + + The textram section must be aligned to 8 bytes to keep the linker + happy. However, if that section contains no data, the declaration will + set the __data_start__ value to that alignment, but the data section + itself would start on a 4-byte alignment, potentially 4 bytes lower + than the value indicated by __data_start__. This completely scrambles + initialized memory as the startup code will copy the data segment to + __data_start__, 4 bytes off of the actual data segment start. + + Fix this by forcing the data segment to also be aligned to 8 bytes. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit db352bd0723e8d640bb034bc14e5ad193f0afe1d +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 12 15:30:45 2017 -0800 + + altos/kernel: Allow ao_cmd to be built without tasking + + Useful for single-threaded applications, like lambdakey + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 09ea349f5b37e257e8ca23ead493ba1694395530 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 12 15:27:26 2017 -0800 + + altos/lambdakey-v1.0: Get this building again + + The lambdakey can't hold a full implementation of the scheme + interpreter, so use only a subset, removing floats, bigints and + vectors. Also reduce the pre-loaded lisp code as well. + + It's pretty spare at this point; but it does fill the ROM. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit d8c9024f3829dc3f241b16869f165f3ee01764f3 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 12 15:25:51 2017 -0800 + + altos/scheme: Support scheme subsetting via feature settings + + This provides for the creation of smaller versions of the interpreter, + leaving out options like floating point numbers and vectors. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a15166c435f65cb36f487ec8e5a4ff558a7e0502 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 12 15:15:41 2017 -0800 + + altos/scheme: Add ao_scheme_vector.c + + Useful to include the code for implementing vectors + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5cf77306257517a3d1ec8cea85fca34f576a8f22 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 11 22:36:00 2017 -0800 + + doc: Don't 'publish' release notes, don't build pdf release notes + + All we use the release notes for is to include into the main AltOS + page. Also remove the docinfo for these files so that information + isn't duplicated for each set of release notes. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 40236913922e0395780cd7d90354546ecaf279f9 +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Dec 11 22:15:46 2017 -0700 + + update Releasing with changes discovered in 1.8.3 release process + +commit 9adf8b23aac8256f230b10adcab9dd323266caaa +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Dec 11 21:33:21 2017 -0700 + + TeleMega default is now v3.0 + +commit b4d78ad85e8f5b1bee78746d63bb4b069e087e5a +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 11 16:30:46 2017 -0800 + + doc: Update release notes and docinfo for 1.8.3 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 2efb997865ee46bf0e8d5145c95d051a7656222a +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 11 14:42:45 2017 -0800 + + altoslib: Keep old GPS values when updating data + + This way, updating satellite information doesn't drop all of the + regular GPS data on the floor. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit fa3ff3a089e4af88dd0cc9a9e92511a0ba4a8e0f +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 11 14:08:32 2017 -0800 + + altos: Actually store current MPU9250 data in data ring + + The ring is updated when the ADC finishes; all of the other sensor + data needs to be copied in at that point. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 962df1f8c7f7ffbebe9b32d6ac363b333af606b3 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 11 13:47:54 2017 -0800 + + altos: Remove more software for hardware prototypes + + These never saw the light of day. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 05efe58cb13b58292527668ca51639eaebe1112b +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Dec 11 14:44:15 2017 -0700 + + take telescience out of the routine builds + +commit 713e8ca6b6cfb29555d8d847e0bb2652cfe011ae +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 11 12:23:29 2017 -0800 + + Bump to version 1.8.3 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 992797db2158b23d46c496e5e223deeca28bf4c9 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Dec 11 12:23:00 2017 -0800 + + doc: Note TeleMega v3.0 support in 1.8.3 relnotes + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8d65e7b367712075a42d26c6d4bbff474dc1ae14 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 5 12:22:34 2017 -0800 + + altos/drivers: Hook up mag sensor for MPU9250 + + Set mag sensor to provide data at 100Hz. + Set i2c master to pull mag data at sample rate (200Hz). + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ec638405045d33d48476ab85edf09a2e1756e3e3 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 18:35:53 2017 -0800 + + altos/scheme: Allow ao_scheme_read_eval_print to be restarted + + Reset exceptions at the top so that we can call it more than once. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8ebecd364fd328e9c649c11729bddf58731aaafb +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 18:34:49 2017 -0800 + + altos: Allow building with newlib + avr stdio on ARM + + Redefines some stdio bits so that we can build with either pdclib or + newlib + avr stdio. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b0de72d942eb87c5acd190878dd57ca4f812e8a1 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 18:32:18 2017 -0800 + + altos: Add scheme for stm discovery board demo + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 655576011e9cc648c7c4bbf51179744a427ff237 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 18:21:01 2017 -0800 + + altos/lambdakey-v1.0: Switch to newlib, get things compiling again + + scheme is now way too large to fit on this device; some subsetting is + clearly indicated. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7d77071f5b45632937f262600ca95c7b71f4d3da +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 16:55:57 2017 -0800 + + altos/scheme: Add Makefile for scheme test app + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit dd2ed58fcdffaff7b5a9ef898affa3e1ec01ef44 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 16:54:50 2017 -0800 + + altos/scheme: Make test scheme app heap maximum size + + It's only 32kB. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 3e7a703bb2e70a0568b44159b993386f7ec46e04 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 16:53:25 2017 -0800 + + altos/scheme: Make eqv? work for numbers and strings + + Large numbers, floats and strings need a value check, not just a + comparison between ao_polys + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bdafb4dfad89d92efec37ed826d5f22e9167e717 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 16:52:26 2017 -0800 + + altos/scheme: Stash cons across value allocation in compare + + Large ints, strings and floats can cause allocation, requiring that + the 'cons' pointer be stashed and retrieved in case it moved. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b72638e60b6636b479b79bbf0047cf7409f58820 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 16:51:25 2017 -0800 + + altos/scheme: add list-copy + + A lot easier as a built-in; the obvious scheme version is recursive. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7517da1646fc30faaa9ee1c969cfa35ae1a17423 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 16:50:06 2017 -0800 + + altos/scheme: Use 64-bit ints to track memory allocation stats + + These are only collected for debug purposes, but can get quite large + if the interpreter runs for a while. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7e14e243565e814ddd524c8d09454719dc89c6d8 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 13:13:27 2017 -0800 + + altos/scheme: Add a bunch of string and vector builtins + + Just make the language closer to r7rs + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6d14f809b54b99725447a934047167c2e7febe82 +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Dec 11 10:17:40 2017 -0700 + + TeleMega v3.0 turnon scripts + +commit d1d98e408311c5ba18138a18f4c88448e4254626 +Merge: 2f8fce1c abb856cd +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Dec 11 10:16:24 2017 -0700 + + Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos + +commit abb856cd66e00d739e4efb1930b5c168eaf48029 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 00:02:34 2017 -0800 + + altos/scheme: Avoid crashing with non-list in length + + Use ao_scheme_cons_cdr to fetch the next list element as that returns + NULL for non-cons elements. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 17fe6de833cccb6d43d0ac0ed84a4faaa3463a09 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 00:02:00 2017 -0800 + + altos/scheme: Add vectors + + Constant time and smaller can be a feature. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 0d3365e2c04793cd8432c30a66881f53385a2e60 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 10 00:00:23 2017 -0800 + + altos/scheme: Fix name of constant scheme file + + .lisp -> .scheme + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 111622dbcd56c225a9d5ace9f0ef745e62f8a94c +Author: Keith Packard <keithp@keithp.com> +Date: Sat Dec 9 16:57:35 2017 -0800 + + altoslib: Fix 8 to 12 bit conversion for Mega pyro voltage data + + The conversion was losing the replicated top four bits by shifting by + the wrong amount. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 1133130986a78628ea297ce1f6a023baf4382d8f +Author: Keith Packard <keithp@keithp.com> +Date: Sat Dec 9 16:56:20 2017 -0800 + + altos/scheme: Let readline know if there's a list in progress + + This lets the interactive prompt change based on what state the lexer + is in + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 2f8fce1cf6ce4bd12a836cc8ee15f4edbc95c95e +Merge: d314a565 185b1136 +Author: Bdale Garbee <bdale@gag.com> +Date: Tue Dec 5 13:23:09 2017 -0700 + + Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos + +commit 185b11367cd85948885fceafb5d46303b6f1356d +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 5 12:22:34 2017 -0800 + + altos/drivers: Start adding defines to get mag data out of MPU9250 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit d314a5654fafa5eac86d8293f1197a2f2c2eac72 +Author: Bdale Garbee <bdale@gag.com> +Date: Tue Dec 5 13:18:45 2017 -0700 + + moving to TeleMega v3.0 by default + +commit 1bf219209c8d9e31a9c3726dad169ff5d17ed4b2 +Author: Bdale Garbee <bdale@gag.com> +Date: Tue Dec 5 13:17:18 2017 -0700 + + handle repeated invocations without failing as often + +commit 2aa02234b1ac2b1701b44fcec9e9bd82bea526b7 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 5 10:48:04 2017 -0800 + + altos/cortexelf-v1: Adapt to lisp->scheme name change + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 038581bd212e66bcf017c7ace28c80a3ae0d0f50 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 5 10:42:02 2017 -0800 + + altos/scheme: Add explicit dependency on ao_scheme_builtin.h for ao_scheme_make_const + + This ensures that a parallel build will wait for ao_scheme_builtin.h + to be complete before attempting to compile ao_scheme_make_const + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bd7a19a86f6d4fe19c7e72904e9b8ac0f2081ff7 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 5 10:38:14 2017 -0800 + + altos/scheme: Move scheme test program to scheme sub-directory + + Keeps it away from the usual test setup + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 195cbeec19a6a44f309a9040d727d37fe4e2ec97 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Dec 5 10:29:13 2017 -0800 + + altos/scheme: Rename to 'scheme', clean up build + + Constant block is now built in a subdir to avoid messing up source + directory. + + Renamed to ao_scheme to reflect language target. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 9dbc686ad7d3289dc0f9bcf4a973f71100e02ded +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 3 19:54:18 2017 -0800 + + altos/lisp: Switch to scheme formal syntax for varargs + + Scheme uses bare symbols to indicate a varargs parameter; any bare + (i.e., not wrapped in a cons cell) parameter will get the 'rest' of + the parameter list. This works for lambdas, nlambdas and macros. As a + result, the 'lexpr' form has been removed as it is equivalent to a + lambda with a varargs formal. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a1d013ab8cc508d4e17ae8876bc5465d1a2dfc1e +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 3 19:52:11 2017 -0800 + + altos/lisp: Fix stash usage across frame allocation + + Must un-stash before allocation failure check. + Use frame_stash instead of poly_stash for frames. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 32ab76c3049b913283caafbaef873754d76dc9d4 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 3 19:49:20 2017 -0800 + + altos/lisp: Check only cdr base type when moving cons cells + + The cdr may have moved, so we can't look at the target object + type. Fortunately, the base type encoded in the reference itself is + sufficient to check for a non-cons cdr. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ed6967cef5d82baacafe1c23229f44d58c838326 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Dec 3 19:47:03 2017 -0800 + + altos/lisp: Split out read debug, add memory validation + + Split read debug into a separate #define to reduce debug noise + Add some memory validation -- validate stash API, and validate + cons_free calls. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b9009b3916956db00b7b78bd06fb0df704690eb1 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Dec 2 23:21:55 2017 -0600 + + altos/lisp: use strtof instead of atof + + atof returns double, strtof returns float. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 880c35363a2596202c8a3d980bf4ac41eceead66 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Dec 2 23:21:01 2017 -0600 + + altos/lisp: Convert more builtin lisp code to scheme format + + Use defines where possible, use (define (name args ...)) form for lambdas + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 577911241db454bc3129fc47566c6a55752c4182 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Dec 2 23:19:44 2017 -0600 + + altos/lisp: Overflow int computations to float + + When an int computation overflows, switch to float. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b986a12b478a6d4ff550786d24aa8628dc0abe32 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Dec 2 15:59:17 2017 -0600 + + altoslib: Add support for TeleMega v3.0 log files + + These look much like TeleMega v2.0 log files, except that the mag + sensor data now comes from the mpu9250 instead of an external + hmc5883. The gyro and 3-axis accel data from the mpu9250 are the same + as the mpu6000. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8c19778d8b56aafa048ddf9654c40b32bd8c64b0 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Dec 2 15:53:05 2017 -0600 + + altos: Build TeleMega v3.0 by default + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ecc075596d6cd2b9c0a3107036d5368ebc3a77bd +Author: Keith Packard <keithp@keithp.com> +Date: Sat Dec 2 15:31:06 2017 -0600 + + altos: Add TeleMega v3.0 + + Adds files to build telemega v3.0 flash loader and firmware + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f0068719b17019c5cd7ed318364a0581caf64e1a +Author: Keith Packard <keithp@keithp.com> +Date: Sat Dec 2 15:32:38 2017 -0600 + + altos/kernel: MPU9250 support + + Use MPU9250 for accel, gyro and mag data in logging, telemetry and + flight status computations. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c31744299e5a4342bbe26d3735ee2d8f09192ae9 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Dec 1 15:40:23 2017 -0600 + + altos/lisp: split set/def. Add def support to lambdas + + In scheme, set can only re-define existing variables while def cannot + redefine existing variables in lambda context. Def within lambda + creates a new variable at the nearest enclosing scope. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 98923ae1189f062b8b94120d47a56892db25493f +Author: Keith Packard <keithp@keithp.com> +Date: Fri Dec 1 18:28:16 2017 +0100 + + altos/lisp: Split out frame vals from frame struct + + This lets the frame be resized without moving the base structure. The + plan is to allow all frames to be resized, not just the global frame. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 835bf4131f9e20575bfdf2179462ebdf54a14761 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Dec 1 12:06:04 2017 +0100 + + altos/lisp: Make let distinct from let* + + let is supposed to define the values all at once, evaluating the + initializers in the enclosing context. let* defines the new names and + then initializes them one at a time. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5d0b85f25fa1e5cc816a8256afb38cf9552f6d9d +Author: Keith Packard <keithp@keithp.com> +Date: Fri Dec 1 11:32:27 2017 +0100 + + altos/lisp: return from unmatched cond is #f, not nil + + Fix the return value when we fall off the end of a cond expression to + be #f + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 796017262cd433af5d143cc7168c944e1e05f4e2 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Dec 1 11:31:29 2017 +0100 + + altos/lisp: Fix pairp builtin + + Pairs are non-nil cons values; add an explicit check for nil here + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cd0bd9791a77868c226d285bf4d57e8c321755d5 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Dec 1 10:12:38 2017 +0100 + + altos/lisp: Add quasiquote + + This adds read support for quasiquote syntax, and then adds a + quasiquote implementation in lisp + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 00bf2ca86b60e6501880011897cea073865c5a03 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Nov 25 17:29:10 2017 -0800 + + altos/lisp: Rename progn to begin + + Match scheme name. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5f9f97cc2d43936d1941da3a9a130c279bc70b99 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Nov 19 21:07:23 2017 -0800 + + altos/test: Update to build altos lisp test app + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6d2f271a45759bd792d299f04a424d3382ef4798 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Nov 19 21:07:00 2017 -0800 + + altos/lisp: Add floats + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 12a1f6ad48f2b924f71239effeb90afca75a090f +Author: Keith Packard <keithp@keithp.com> +Date: Sat Nov 18 22:00:44 2017 -0800 + + altos/lisp: Fix some scheme compat issues + + flush -> flush-output + nth -> list-ref (oh, and add list-tail) + add let* (same as let for now) + write control chars in octal + make hanoi example work + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5f8f0ed5cd5d4b4f793c602ed09f9b4bdb98f7e8 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Nov 18 20:38:15 2017 -0800 + + altos/lisp: Add 'big' ints -- 24 bits wide + + With the default ints being only 14 bits, having a larger type with + more precision seems useful. This is not exposed to the application. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e745229311366a792110d78d8480a2bf83eef9a0 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Nov 17 23:28:08 2017 -0800 + + altos/cortexelf-v1: Make lisp compile again + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 65fb0ad8693407cc9bd114424c1f51b6aa6befc3 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Nov 17 23:27:36 2017 -0800 + + altos/test: Add jiffy funcs to lisp test + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cf5729a0bae51172f12fc9ec4339d4e975a45fcc +Author: Keith Packard <keithp@keithp.com> +Date: Fri Nov 17 23:23:50 2017 -0800 + + altos/lisp: Finish first pass through r7rs + + * print -> write, patom -> display + * Add read-char, write-char + * Add exit, current-jiffy, current-second, jiffies-per-second + * Add for-each and string-for-each + * Avoid duplicate builtins with different atoms + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e1acf5eb12aceda7aa838df031c1da1129d0fa5d +Author: Keith Packard <keithp@keithp.com> +Date: Fri Nov 17 22:14:19 2017 -0800 + + altos/lisp: Add apply + + And all of the library routines that use it, map, string-map and friends. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a4e18a13029cc7b16b2ed9da84d6e606bc725ac3 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Nov 17 08:50:50 2017 -0800 + + altos/lisp: Character consts. String and assoc builtins. + + Also add back escaped characters in strings. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5b6f4b5de89a2bb0d63442e2651cf8d2ee0f4b10 +Author: Keith Packard <keithp@keithp.com> +Date: Fri Nov 17 08:04:28 2017 -0800 + + altos/lisp: Generate built-in lambda atoms for const creation + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cd9152973f29f4e775569f5acbbe8fab2d93d170 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Nov 16 22:15:06 2017 -0800 + + altos/test: More lisp test Makefile fixes + + Depend on ao_lisp_const.h + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 435a91ae3889cd361b543f4555a78488905e0bbb +Author: Keith Packard <keithp@keithp.com> +Date: Thu Nov 16 22:13:46 2017 -0800 + + altos/lisp: Lots more scheme bits + + * Arithmetic functions and tests + * append, reverse and list-tail + * set-car! and set-cdr! + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cc76030d669600051fbb42a8cf85701aaaf5f5b7 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Nov 16 18:47:34 2017 -0800 + + altos/test: Get lisp test building using Makefile-inc + + Instead of re-defining all of the lisp sources and headers + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 2e58b6c380bc6440490c47650fbf11d45b3f2e72 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Nov 16 18:46:03 2017 -0800 + + altos/lisp: More schemisms + + Add 'if'. + setq -> set!, but doesn't define new variables + def -> define + Add pair? and list? + Add eq? and eqv? as aliases for = + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 0ced351c8f4449f7086b04e42c822d649f040d1f +Author: Keith Packard <keithp@keithp.com> +Date: Thu Nov 16 18:41:18 2017 -0800 + + altos/lisp: Add 'else' sematics to cond + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b3b4731fcb89cb404433f37a7704a503567c43bd +Author: Keith Packard <keithp@keithp.com> +Date: Thu Nov 16 17:49:47 2017 -0800 + + altos/lisp: Add scheme-style bools (#t and #f) + + Cond and while compare against #f, just like scheme says to. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bd881a5b85d7cd4fb82127f92f32e089499b50cb +Author: Keith Packard <keithp@keithp.com> +Date: Thu Nov 16 13:02:07 2017 -0800 + + altos/lisp: Add non-cons cdr support + + The cdr of a cons can be any value; add support for lexing and + printing them. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 50a095fbe828b6ec3159d27930712df6b1b519b4 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Nov 11 21:29:11 2017 -0800 + + doc: Update for 1.8.3 + + Also added a pile of docinfo files for older release notes files. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 23cf8fb4d5745ad76d9517c9702d03d10c58144a +Author: Keith Packard <keithp@keithp.com> +Date: Sat Nov 11 20:52:01 2017 -0800 + + altos: Fix new GCC warnings + + * Duplicate 'const' in test code. + * Mis-formatted loop in kf_rem_pio2 + * Unused 'one' in sf_cos + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f3b279141cd30ad6a212ce75f5a7c2b8e3d33870 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Nov 11 20:50:45 2017 -0800 + + altos: Fix inverted test for corrupt flight log + + Was reporting correct flight log as corrupted. Oops. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 9a7b4f02ad32ca43a45ed9fe446b8db96e60b5e5 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Nov 11 20:49:20 2017 -0800 + + altoslib: Improve EEprom download + + * Catch and report CRC errors + * Deal with corrupted flight records + * Add ability to immediately graph new data + * Check before overwriting existing files + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 10834eb60f7a44fee159d9e9ad5ffb2e013fe9cf +Author: Keith Packard <keithp@keithp.com> +Date: Sat Nov 11 20:46:45 2017 -0800 + + altoslib: Remove spurious semicolon in AltosReplayReader.java + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e80005ea63bb9b1eee33a8876ad74ed5d50478ed +Author: Keith Packard <keithp@keithp.com> +Date: Sat Nov 11 20:44:27 2017 -0800 + + altoslib: Don't write KML record when height data is missing + + This avoids a crash dealing with corrupted flight data + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a2097545dec62cd0970725bf690128dad6baf22e +Author: Keith Packard <keithp@keithp.com> +Date: Sat Nov 11 16:38:40 2017 -0800 + + altos/test: Adapt flight test to int16_t flight number type + + Flight numbers are now limited to 32767 to allow for negative values + for corrupted slots. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5b6805d1a6a91a26a1892f414a99f0184871ac1a +Author: Keith Packard <keithp@keithp.com> +Date: Sat Nov 11 16:08:32 2017 -0800 + + altosuilib: New line styles and colors for graphs. Selectable line width + + Improve the readability of graphs by offering a better selection of + colors and adding line styles. Let the user configure the line width + as desired. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 82e552d194216b41d27d805bee2947127c2d555b +Author: Keith Packard <keithp@keithp.com> +Date: Thu Nov 2 09:12:18 2017 -0700 + + altos/stm: Add AO_EXTI_MODE_PULL_NONE + + This is clearer than using '0'. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5460d7ff46116901bceacd43282b406c446dded5 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Nov 2 09:11:39 2017 -0700 + + altos: whitespace cleanup in ao_adc_stm.c + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 83929cd290279963b01b2ccd52c70d61bdeff6b0 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 22 15:44:32 2017 -0500 + + altos: Share common logging code. Deal with corrupt initial flight records + + Move common logging APIs from per-format files into ao_log.c. Then, + change that code to check the first log record in a slot (containing + the flight number) to see if it's invalid and deal with it. That + involves not re-using that slot, and allowing it to be erased. + + Corrupted log blocks are reported with a negative flight number. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 256ddea8c430b4b5dcb8bb95c19ad26032129e1b +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 22 15:43:07 2017 -0500 + + altos: Define AO_LOG_FORMAT in */ao_pins.h. Use in ao_cmd.c + + Instead of having a global variable define the log format, use a macro + instead to save data space. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 15af16ad21f67019065763a93d52cea6097a69d1 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 22 15:39:25 2017 -0500 + + altos: Remove cross-block storage I/O on cc1111 + + We don't ever need to be able to do storage read/write across chunks + of flash on the old cc1111 products, so remove the loops that support + it to save space. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 749400fd244eba38806c623d2a35722642230698 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 22 14:04:09 2017 -0500 + + altoslib: Move temp GPS API from cal_data to data_listener + + This makes the API more consistent, and means that the listener is + responsible for mangaing the temp gps state. In particular, the + AltosDataListener set_gps API now calls the cal_data function. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e98235e314ac764509af26c93da9e6d1de8184ea +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 14 12:18:26 2017 -0700 + + altoslib: Save separate config for local and remote. Use in idle + + When using the remote link, there are two separate configuration data + blocks, that for the local device and for remote. Make the link report + both versions, depending on whether it is in remote mode or not. + + Request config data in remote mode when running idle monitoring so + that the presented data is for the remote device, not the local one. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 964a14568b73296194f84c728cc7e01d6f0e2f64 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Oct 14 12:05:07 2017 -0700 + + altoslib: Report un-adjusted ground accel in idle IMU monitor + + The ground accel is the basis of the accel adjustment, so it needs to + be delivered in un-adjusted form. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 4431f70044f4e1120d606f0ded1845349295d68e +Author: Keith Packard <keithp@keithp.com> +Date: Thu Oct 12 00:31:26 2017 -0700 + + altos: Add MPU9250 support to self test and data + + The remaining hooks to make the MPU9250 work in flight. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 77d1aee917306ad59492c4c8352fe2125b430d0c +Author: Keith Packard <keithp@keithp.com> +Date: Thu Oct 12 00:30:23 2017 -0700 + + altoslib: Fix time series filter window computation + + Small floating point rounding errors could lead to NaNs. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit e04679ba52761d5531037117a21ab1f1896358b0 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Oct 12 00:29:07 2017 -0700 + + altoslib: Don't crash if there's no GPS coord to write KML + + Just check for null before writing as a precaution. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a69d5773a63dbe5d6d758cea8eca2bf724e9d672 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Oct 12 00:26:31 2017 -0700 + + altoslib: Allow gps time later than requested if it's first + + When generating a KML file, we want to position markers near the start + of the flight section. This is done by looking for a GPS coordinate + 'before' the starting point of the flight, which doesn't work well + when the first GPS coordinate is later than that. Pick the first point + after the chosen time if there isn't an earlier one. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 9d7bb706918fd7d6db77eab21931b4fc74cb9105 +Author: Keith Packard <keithp@keithp.com> +Date: Thu Oct 12 00:14:30 2017 -0700 + + altos: Add MPU9250 driver (accel/gyro only for now) + + This is almost an exact copy of the MPU6000 driver, just a few minor + register changes. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c8dbfff65dd61e42d0a02158dcb520e7710ef87e +Author: Keith Packard <keithp@keithp.com> +Date: Sun Oct 8 18:50:59 2017 -0700 + + altos: Stop storing pyro fired status in config block + + We already have the fired status saved in the ao_pyro_fired variable, + so just use that to detect whether a channel has already been fired. + + Fixes possible cases where the pyro config data gets written back to + eeprom with the fired bit set, which then inhibits the channel during + flight. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 5d82209122e3b797a7345f6ad5b6710832fcdd4a +Author: Keith Packard <keithp@keithp.com> +Date: Thu Oct 5 16:46:08 2017 -0700 + + Set version to 1.8.2.1 + + Testing KML export changes at TRA + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7e971b45f22aa77421061ff2925e0458835014b2 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Oct 4 13:44:31 2017 -0700 + + altoslib: Missing file for filter additions. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 2f779d318753b73463f7166977453ab5533e5921 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Oct 4 13:43:45 2017 -0700 + + altosuilib: Add 'show marker' button to graphs + + Provides a marker at each actual data point which can be useful for + sparse data sets like telemetry with poor reception. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 730ee7bf91f607ece42c010a10c53d0013492b96 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Oct 4 13:42:16 2017 -0700 + + altoslib: Adapt KML output to make TRA record people happier + + Provide two paths, one using GPS data the other baro. Replace separate + path segments for each state with markers so that the path is a single + unit, able to be displayed in the elevation profile widget. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 98dc29a7a964f8d653b73989c6751695d168844c +Author: Keith Packard <keithp@keithp.com> +Date: Mon Oct 2 19:33:37 2017 -0700 + + altoslib: Add user-selectable filter width for data smoothing + + Also switch smoothing window to Kaiser and change default accel filter + width to 1 second instead of 4 seconds. + + Now users can play with the filter and see what it does. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit d75e8b9046295051c91696461e8d5f59c8260ccc +Author: Keith Packard <keithp@keithp.com> +Date: Mon Oct 2 17:02:18 2017 -0700 + + altosuilib: Show raw tick values in graph and info table + + Not terribly useful, but did help validate firmware handling of tick + wrapping, so we'll keep it. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c6be13e8ef80e5afc836e04cbfe4cb17631540e4 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Oct 2 16:58:53 2017 -0700 + + altoslib: Allow early bail-out on bad telemetry CRC + + Check the CRC status in the packet before creating a new telemetry + object. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 770998be2c15dd41a63520d0c8747d7cf32ec447 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Oct 2 16:57:15 2017 -0700 + + altos: Allow pyro config name to end with newline, not just space/tab + + A pyro config like 'Descending' has no value associated. When it is at + the end of the line, allow a newline to terminate the name instead of + just a space. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit de2b6ec1cdfd48c948bff7edbfe2540440429b1b +Author: Keith Packard <keithp@keithp.com> +Date: Mon Oct 2 16:55:18 2017 -0700 + + altoslib,altosuilib,altosui: log_format/device_type TeleGPS selects stateless + + When the device being analyzed has no flight state, we want to use the + 'stateless' state so that the UI can display reasonable + information. This bit was lost in the recent AltosState shuffle and + this patch brings it back. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 322c1abead39cb398380dff384cd274c19dd81dd +Author: Keith Packard <keithp@keithp.com> +Date: Mon Oct 2 13:55:57 2017 -0700 + + altosuilib: Don't drain voice when terminating display + + If the voice thread is wedged (as with PulseAudio and un-patched + freetts 1.2.2), we'll get stuck here and the UI will freeze up. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cfc09e8f1f263595972cbb6af23f22e2d749c744 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 26 18:00:36 2017 -0700 + + altoslib: Add tilt and pyro data to CSV export + + It's now version 6. Also removed duplicate time values and made radio + values conditional on having radio data. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit df39a30c762d57c7d04110e054f74d50fa8d85de +Author: Bdale Garbee <bdale@gag.com> +Date: Tue Sep 19 11:56:52 2017 -0600 + + don't exit on dfu-util errors, it's not reliable about reporting success + +commit 8124109e0b455c9d8d583f4d985b93d23d7b1350 +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Sep 18 21:24:52 2017 -0600 + + tweak Releasing based on 1.8.2 release experience + +commit 60666630789b6925d7e16160ebdc88ccd23f51de +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Sep 18 20:43:14 2017 -0600 + + be more aggressive about removing and ignoring .mdwn files + +commit e87d56b665ca30a3e5920c23cd60c99b84341aa2 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Sep 18 18:51:51 2017 -0700 + + Update release version and date + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a54b3330574dd130540e482a06a3f8d7ca652b6c +Author: Keith Packard <keithp@keithp.com> +Date: Mon Sep 18 18:43:00 2017 -0700 + + Update docs for 1.8.2 release + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit d0c1ebc43a9c5bb0a3503d33978a5e7bc87057fe +Author: Keith Packard <keithp@keithp.com> +Date: Mon Sep 18 18:51:18 2017 -0700 + + Add short section on accelerometer calibration + +commit 60cadbc85949adf464be16a5cf8ce2c24d67bedf +Author: Keith Packard <keithp@keithp.com> +Date: Mon Sep 18 14:40:37 2017 -0700 + + altos/telegps-v2.0: Enable USB connect monitoring + + Disable radios when plugged in to USB to save power and avoid being + noisy. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6e4c104c28952f2010c7b1cbc9ce59e148ab2d8f +Merge: 63eeaada 4f2cbe0c +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Sep 18 16:01:43 2017 -0600 + + Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos + +commit 63eeaada85cb9ddccb0fa9b2d751cc8f46399d9c +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Sep 18 16:01:21 2017 -0600 + + production TeleGPS v2.0 use a 16Mhz crystal for the SOC + +commit 4f2cbe0c537c9f417aae310cc3b89f84e0915103 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Sep 18 09:57:41 2017 -0700 + + altoslib: Avoid crashing when computing stats for empty flight logs + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b9a00856aa4cf55ae4a143288058094ef8061134 +Author: Keith Packard <keithp@keithp.com> +Date: Mon Sep 18 09:57:06 2017 -0700 + + telegps: Fix up TeleGPS UI bits after accel cal changes + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 95952059bbb50b5f22460418df003a87c8bd3271 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 12 15:47:43 2017 -0700 + + test/ao_flight_test: Show recorded pyro firing + + Can compare with computed values. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 28a2db68e4806383cfaa7075d454c35cade9633a +Author: Bdale Garbee <bdale@gag.com> +Date: Sun Sep 17 12:41:50 2017 -0600 + + publish support for TeleGPS v2.0 + +commit ad61e277069217d98400e884d3c173357d2343ed +Author: Bdale Garbee <bdale@gag.com> +Date: Thu Sep 14 10:51:18 2017 -0600 + + deal with cheap BT dongle that shows multiple copies of unit in lescan output + +commit 5666a3c9427324ad8f92e21c5f9017436b36a82a +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 12 14:02:11 2017 -0700 + + altosuilib: Make steps in accel cal default button + + This way you can just hit return through the process. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 441056b01abcf9287f61f425cf29fc4b1603c619 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 12 13:43:06 2017 -0700 + + altos/test: Handle new eeprom file format. Give up on telem files. + + Parse eeprom config using libjson-c, then read the hex values into a + giant blob. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit be44d33f5e94b8c4180adb275ec83cc70852db48 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 12 13:41:11 2017 -0700 + + altos: Fix debug printf in ao_pyro for state >= + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 10d14146ef84fbe4670454bc0996854a4066cfea +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 12 13:40:06 2017 -0700 + + chaoskey: Wait for input data to stabilize before using it + + The ADC data takes a while to start working after power on; wait for + the range of input values to look reasonable before using the data. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8284ba8bf78aade8f9d8f711cfefe2010ce81066 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 12 13:38:36 2017 -0700 + + doc: Add forward reference from 'idle' description to idle entry steps. + + This provides a reminder that entering idle mode takes specific steps + which differ between models. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 8960cb525ef43c2262c7854b9a6f08237b3ea05b +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 12 13:37:24 2017 -0700 + + altosui: Handle missing GPS when graphing mega/metrum data + + These have GPS, but if we never get a valid packet, then there won't + be any final position to display. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit a4dfaf25954134dbdc7229e2de39d4a4c049f285 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 12 13:37:06 2017 -0700 + + altosui: Remove debug printfs in FC config UI + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bc1cc0db1251e351d862dffbf618d0ce926c389d +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 12 13:36:24 2017 -0700 + + altosdroid: Display serial, call, freq in tracker list + + This makes the list a lot easier to find entries in when it gets long. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 4151c30e1294c0dda3aa02e7ac23b9616f25a4d0 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 12 13:35:25 2017 -0700 + + altoslib: Make receive frequency available in telem data + + This lets AltosDroid record which frequency each station was heard on. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit d84f5e576e83a2b965d0e9752a9bbef100954815 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 12 13:34:23 2017 -0700 + + altoslib: Remove debug stack dump from AltosState + + An empty AltosState is allocated when parsing JSON data; it's not a + mistake. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit b48966c3121e1b5d4a659bebcad595d6f1ec5ee5 +Author: Keith Packard <keithp@keithp.com> +Date: Tue Sep 12 13:33:13 2017 -0700 + + altoslib: Correctly parse IMU cal data + + Was trying to match 'IMU call along' instead of 'IMU cal along', + causing the line to not match and losing the IMU accel cal values. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f607a882a50aa6cd9e8e3e74cbaa5bcc1b5fa4a4 +Author: Keith Packard <keithp@keithp.com> +Date: Wed Sep 6 08:37:12 2017 -0600 + + ao-tools/ao-chaosread: Add -Wall -Wextra, clean up results + +commit 558a143315f0345b79cc4f22aa4b643fedcded9c +Author: Keith Packard <keithp@keithp.com> +Date: Fri Aug 11 23:42:53 2017 -0400 + + altosui: Accel calibration UI + + Provides a GUI for re-calibrating accelerometers + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit c9a742db2497d07079f3d4bf383c6246cf80507c +Author: Keith Packard <keithp@keithp.com> +Date: Thu Aug 31 20:32:05 2017 -0700 + + Bump to version 1.8.1.1/android 16 for altosdroid + + AltosDroid 1.8.1 got released before the latest fix for not storing + frequency preferences was made. Make a 1.8.1.1 with a new android + release number for that. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6e85a8244389bffab0744be8dfa90b706f829083 +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Aug 28 15:09:14 2017 -0600 + + need to capture .bin file for telebt-v4.0 loader + +commit ccf7ad5a31604e98b34bf16e3da6afb264ad1291 +Author: Bdale Garbee <bdale@gag.com> +Date: Mon Aug 28 14:01:54 2017 -0600 + + a few tweaks to the Releasing document based on experience with 1.8.1 + +commit b68c0482d4fae8eb54cde1df0e4bcf4c5d272bad +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 27 22:49:09 2017 -0700 + + Version 1.8.1 + + Android version 15 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit abe100385cedf2b0734191611d97e794805d0ef4 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 27 22:48:46 2017 -0700 + + doc: Update for 1.8.1 + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 4775b1d9b50a8732d66a0ad3b73ff74901a8cb7f +Author: Keith Packard <keithp@keithp.com> +Date: Mon Aug 28 00:15:43 2017 -0700 + + altos: Don't compute filtered average of height error when HAS_ACCEL + + We only use this for baro-only devices to avoid firing drogue charges + at mach transitions; we trust the combination of accel+baro to do the + right thing when available. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit dacd4c70700041a018b1f8ba47f22071b9600eaf +Author: Keith Packard <keithp@keithp.com> +Date: Mon Aug 28 00:10:04 2017 -0700 + + altoslib: Fix freq preference loading + + Allocate throw-away freq array to get the class pointer. + Add null-ary AltosFrequency constructor for JSON code. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 7f5f37ac7fb71d3059f639b39315712f90e9bfd6 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 27 17:37:10 2017 -0700 + + altosui: Make --oneline show drogue deploy speed + + Also remove some commented out values. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit dd72c9144b207b12150eb6a7ffb012f217f37374 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 27 17:35:49 2017 -0700 + + altoslib: Compute speed at entry to each state + + Useful to have drogue/main deployment speeds + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 9537a21b6ddb73b9f086858dad9a7b9d05279741 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 27 17:34:49 2017 -0700 + + altoslib: Fix parsing of old TM log GPS sat data + + Attempting to fetch sat data from wrong byte led to array bounds + exception. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 92b689bfd78a96ba56f0e1022ba68b7384a9b9b6 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 27 17:34:07 2017 -0700 + + altoslib: Allow for missing product when checking for mma655x inverted + + If there's no product, assume we've got some ancient log file. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 6e244a73d8c2a475416480f83328b7d363693402 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 27 17:33:38 2017 -0700 + + altoslib: Remove debug printf for gyro adjust + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f5642db4e03856b1f2ffeae6570fcf35fb7d93fb +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 27 17:32:27 2017 -0700 + + altos/test: Fake baro data for flight 12 serial 2093 + + This flight had a baro spike due to an accidental drogue charge firing + but is otherwise quite useful when testing for various mach delay + effects, so fake out the data during that spike. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit bef7c37d1c986cd477367c0c015be61368a788d2 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 27 17:30:15 2017 -0700 + + altos/test: Integrate raw accel to provide speed for comparison + + This can provide a useful visualization of the 'true' vs 'kalman' + speed value, as the kalman is necessarily delayed due to the model + assuming constant acceleration. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 2dce02efd54ad4051f1ddb94048696e8677dd225 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 27 17:04:27 2017 -0700 + + altos/test: telemetrum baro data is inverted before being written to eeprom + + No need for the test code to invert it during replay + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit ea6fe21d78744d7e6225a56c369d54f7cd956767 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Aug 26 19:16:47 2017 -0700 + + altos: Don't eliminate baro above mach speed, just trust it less + + Instead of completely eliminating the baro sensor above mach speed, + just derate it a bit so that the accel will dominate for speed + computation and keep the device from false-triggering across mach + transitions. + + When we completely ignored the baro sensor above mach, and the flight + spent considerable time in that speed range, then the estimated height + could be far from the real value. When the estimated speed dropped + back down and the baro values were brought back into the computation, + then the resulting rapid shift in estimated speed could trigger + accidental apogee detection. + + By mixing in a bit of baro data even above mach, we keep the estimated + height closer to the baro value and prevent this error, at least in + flights measured so far. + + The flight known to have this problem is: + + 2015-09-26-serial-2093-flight-0012.eeprom + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 12ef994a24eb996458092dc35c671d6b824b1576 +Author: Keith Packard <keithp@keithp.com> +Date: Sun Aug 27 16:57:13 2017 -0700 + + altos: Eliminate separate height error filter for accelerometer devices + + We don't use the error value in flight for those models anyways; it's + only useful on baro-only hardware. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit f972000642f9c9835a0b7d14155d4c5695455d94 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Aug 26 19:15:59 2017 -0700 + + altosui: Add --oneline mode to briefly summarize flights + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 465bb7242f39f6f8489e5fd52ce88031106c1c76 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Aug 26 19:15:07 2017 -0700 + + altosuilib: Add "Huge" font size + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 3dde7f4d05414ac4907c91c68c88cc1d06233605 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Aug 26 19:14:10 2017 -0700 + + micropeak: Track font changes in raw data display + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit cf20e213f39fb24f15e0ac94307c2d138fcadecb +Author: Keith Packard <keithp@keithp.com> +Date: Thu Aug 24 16:45:54 2017 -0700 + + altos: Perform time comparisons using 16-bit arithmetic to handle wrap + + Subtracting two 16-bit unsigned values to perform time comparisons + yields mystic results unless we carefully cast that to int16_t. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit 43e2275250d9c91560a770942f3c06a8f74ed501 +Author: Keith Packard <keithp@keithp.com> +Date: Sat Aug 12 01:37:07 2017 -0400 + + install: Add 'fat-install' target + + This uses the existing --with-fat-dir option and instead of installing + everything to that directory, creates a normal ikiwiki hierarchy of + files including .mdwn files, whacked release notes html files and all + of the appropriate packages. + + One stop shopping for adding the release to the web site. + + Attempted to update Releasing file to match. + + Signed-off-by: Keith Packard <keithp@keithp.com> + +commit fccfa54bb3b746cecfcdc1fd497cf736bbfe3ef3 +Author: Bdale Garbee <bdale@gag.com> +Date: Sat Aug 12 00:23:27 2017 -0400 + + releasing 1.8 + commit dbcb68f684a96d13efeb9993685f61b27b45e7dc Author: Bdale Garbee <bdale@gag.com> Date: Sat Aug 12 00:21:43 2017 -0400 -- cgit v1.2.3