Merge branch 'branch-1.9' into debian
authorBdale Garbee <bdale@gag.com>
Thu, 3 Jan 2019 05:23:04 +0000 (22:23 -0700)
committerBdale Garbee <bdale@gag.com>
Thu, 3 Jan 2019 05:23:04 +0000 (22:23 -0700)
642 files changed:
.gitmodules [deleted file]
ChangeLog
Makefile.am
Releasing
altoslib/AltosAdxl375.java [new file with mode: 0644]
altoslib/AltosCalData.java
altoslib/AltosConfigData.java
altoslib/AltosConvert.java
altoslib/AltosEepromRecordMega.java
altoslib/AltosEepromRecordSet.java
altoslib/AltosFlash.java
altoslib/AltosHexsym.java
altoslib/AltosIdleFetch.java
altoslib/AltosLib.java
altoslib/AltosProgrammer.java
altoslib/AltosRomconfig.java
altoslib/AltosSelfFlash.java
altoslib/AltosSensorTGPS.java [deleted file]
altoslib/AltosSensorTGPS1.java [new file with mode: 0644]
altoslib/AltosSensorTGPS2.java [new file with mode: 0644]
altoslib/AltosTelemetryConfiguration.java
altoslib/Makefile.am
altosui/Makefile.am
altosui/altos-windows.nsi.in
altosui/altusmetrum-altosui.desktop.in
altosuilib/AltosDeviceUIDialog.java
altosuilib/AltosFlashUI.java
altosuilib/AltosUSBDevice.java
ao-bringup/test-easymega
ao-bringup/test-easymega-v1.0 [new file with mode: 0755]
ao-bringup/turnon_easymega
ao-bringup/turnon_easymega_v1.0 [new file with mode: 0755]
ao-bringup/turnon_telebt
ao-tools/ao-dbg/ao-dbg.1
ao-tools/ao-eeprom/ao-eeprom.1
configure.ac
doc/.gitignore
doc/Makefile.am
doc/RELNOTES
doc/altos-docinfo.xml [deleted file]
doc/altos.txt
doc/altosui.inc
doc/altusmetrum-docinfo.xml [deleted file]
doc/altusmetrum-theme.yml [new file with mode: 0644]
doc/altusmetrum.txt
doc/am-fo.xsl [deleted file]
doc/am-html.xsl [deleted file]
doc/am-notoc.css [new file with mode: 0644]
doc/am.css
doc/common.xsl [deleted file]
doc/companion-docinfo.xml [deleted file]
doc/companion.txt
doc/config-device.inc
doc/easymega-outline.txt
doc/easymega.inc
doc/easymini-device.inc
doc/easymini-docinfo.xml [deleted file]
doc/easymini-outline.txt
doc/easymini-release-notes.inc
doc/easymini.txt
doc/footer.templates.xsl [deleted file]
doc/fop.xconf [deleted file]
doc/header.inc [new file with mode: 0644]
doc/images/icons/caution.svg [new file with mode: 0644]
doc/images/icons/important.svg [new file with mode: 0644]
doc/images/icons/note.svg [new file with mode: 0644]
doc/images/icons/tip.svg [new file with mode: 0644]
doc/images/icons/warning.svg [new file with mode: 0644]
doc/load-maps.inc
doc/map-loading.txt
doc/micropeak-docinfo.xml [deleted file]
doc/micropeak-oneline.svg
doc/micropeak.txt
doc/release-head.inc [new file with mode: 0644]
doc/release-notes-0.7.1.inc
doc/release-notes-0.8.inc
doc/release-notes-0.9.2.inc
doc/release-notes-0.9.inc
doc/release-notes-1.0.1.inc
doc/release-notes-1.1.1.inc
doc/release-notes-1.1.inc
doc/release-notes-1.2.1.inc
doc/release-notes-1.2.inc
doc/release-notes-1.3.1.inc
doc/release-notes-1.3.2.inc
doc/release-notes-1.3.inc
doc/release-notes-1.4.1.inc
doc/release-notes-1.4.2.inc
doc/release-notes-1.4.inc
doc/release-notes-1.5.inc
doc/release-notes-1.6.1.inc
doc/release-notes-1.6.2.inc
doc/release-notes-1.6.3.inc
doc/release-notes-1.6.4.inc
doc/release-notes-1.6.5.inc
doc/release-notes-1.6.8.inc
doc/release-notes-1.6.inc
doc/release-notes-1.7.inc
doc/release-notes-1.8.1.inc
doc/release-notes-1.8.2.inc
doc/release-notes-1.8.3.inc
doc/release-notes-1.8.4.inc
doc/release-notes-1.8.5.inc
doc/release-notes-1.8.6.inc
doc/release-notes-1.8.7.inc
doc/release-notes-1.8.inc
doc/release-notes-1.9.inc [new file with mode: 0644]
doc/release-notes.inc
doc/specs.inc
doc/system-operation.inc
doc/telegps-application.inc
doc/telegps-docinfo.xml [deleted file]
doc/telegps-outline.txt
doc/telegps-release-notes.inc
doc/telegps-system-operation.inc
doc/telegps.txt
doc/telemega-outline.txt
doc/telemega.inc
doc/telemetrum-outline.txt
doc/telemetrum.inc
doc/telemetry-docinfo.xml [deleted file]
doc/telemetry.txt
doc/telemini-v1-outline.txt
doc/telemini-v3-outline.txt
doc/telemini.inc
doc/titlepage.templates.tmpl [deleted file]
doc/updating-firmware.inc
doc/using-am-products.inc
icon/Makefile.am
icon/grayled.png [deleted file]
icon/grayon.png [deleted file]
icon/greenled.png [deleted file]
icon/greenoff.png [deleted file]
icon/led.5c [new file with mode: 0644]
icon/redled.png [deleted file]
icon/redoff.png [deleted file]
micropeak/altusmetrum-micropeak.desktop.in
pdclib [deleted submodule]
src/Makedefs.in
src/Makefile
src/aes/ao_aes.c
src/attiny/ao_arch.h
src/attiny/ao_arch_funcs.h
src/attiny/ao_i2c_attiny.c
src/attiny/ao_led.c [deleted file]
src/attiny/ao_led_tiny.c [new file with mode: 0644]
src/attiny/ao_spi_attiny.c
src/avr-demo/Makefile
src/avr/ao_adc_avr.c
src/avr/ao_arch.h
src/avr/ao_arch_funcs.h
src/avr/ao_eeprom_avr.c
src/avr/ao_i2c_usart.c
src/avr/ao_led.c [deleted file]
src/avr/ao_led_avr.c [new file with mode: 0644]
src/avr/ao_pwmin.c
src/avr/ao_pwmin.h
src/avr/ao_romconfig.c [deleted file]
src/avr/ao_serial_avr.c
src/avr/ao_spi_usart.c
src/avr/ao_timer.c
src/avr/ao_usb_avr.c
src/cc1111/Makefile.cc1111 [deleted file]
src/cc1111/_bp.c [deleted file]
src/cc1111/ao_adc.c [deleted file]
src/cc1111/ao_aes.c [deleted file]
src/cc1111/ao_arch.h [deleted file]
src/cc1111/ao_arch_funcs.h [deleted file]
src/cc1111/ao_battery.c [deleted file]
src/cc1111/ao_beep.c [deleted file]
src/cc1111/ao_button.c [deleted file]
src/cc1111/ao_dbg.c [deleted file]
src/cc1111/ao_dma.c [deleted file]
src/cc1111/ao_exti.c [deleted file]
src/cc1111/ao_exti.h [deleted file]
src/cc1111/ao_intflash.c [deleted file]
src/cc1111/ao_launch.c [deleted file]
src/cc1111/ao_launch.h [deleted file]
src/cc1111/ao_lcd_port.c [deleted file]
src/cc1111/ao_led.c [deleted file]
src/cc1111/ao_pins.h [deleted file]
src/cc1111/ao_radio.c [deleted file]
src/cc1111/ao_reboot.c [deleted file]
src/cc1111/ao_romconfig.c [deleted file]
src/cc1111/ao_serial.c [deleted file]
src/cc1111/ao_spi.c [deleted file]
src/cc1111/ao_string.c [deleted file]
src/cc1111/ao_timer.c [deleted file]
src/cc1111/ao_usb.c [deleted file]
src/cc1111/cc1111.h [deleted file]
src/chaoskey-v0.1/Makefile
src/chaoskey-v1.0/Makefile
src/chaoskey-v1.0/ao_chaoskey.c
src/cortexelf-v1/ao_cortexelf.c
src/cortexelf-v1/cortexelf.ld
src/detherm/Makefile
src/draw/ao_line.c
src/drivers/ao_25lc1024.c
src/drivers/ao_74hc165.c
src/drivers/ao_74hc497.c
src/drivers/ao_adxl375.c [new file with mode: 0644]
src/drivers/ao_adxl375.h [new file with mode: 0644]
src/drivers/ao_aprs.c
src/drivers/ao_at24c.c
src/drivers/ao_at45db161d.c
src/drivers/ao_btm.c
src/drivers/ao_button.c
src/drivers/ao_cc1120.c
src/drivers/ao_cc115l.c
src/drivers/ao_cc1200.c
src/drivers/ao_companion.c
src/drivers/ao_fat.c
src/drivers/ao_gps_sirf.c
src/drivers/ao_gps_skytraq.c
src/drivers/ao_gps_ublox.c
src/drivers/ao_hmc5883.c
src/drivers/ao_lcd.c
src/drivers/ao_lco.c
src/drivers/ao_lco.h
src/drivers/ao_lco_cmd.c
src/drivers/ao_lco_func.c
src/drivers/ao_lco_two.c
src/drivers/ao_led.c [new file with mode: 0644]
src/drivers/ao_m25.c
src/drivers/ao_mma655x.c
src/drivers/ao_mpu6000.c
src/drivers/ao_mpu9250.c
src/drivers/ao_mr25.c
src/drivers/ao_ms5607.c
src/drivers/ao_ms5607.h
src/drivers/ao_ms5607_convert_8051.c
src/drivers/ao_packet.c
src/drivers/ao_packet_master.c
src/drivers/ao_packet_slave.c
src/drivers/ao_pad.c
src/drivers/ao_pca9922.c
src/drivers/ao_ps2.c
src/drivers/ao_pyro_slave.c
src/drivers/ao_quadrature.c
src/drivers/ao_quadrature.h
src/drivers/ao_radio_master.c
src/drivers/ao_radio_slave.c
src/drivers/ao_rn4678.c
src/drivers/ao_sdcard.c
src/drivers/ao_seven_segment.c
src/drivers/ao_trng_send.c
src/drivers/ao_watchdog.c
src/easymega-v1.0/Makefile
src/easymega-v1.0/ao_easymega.c
src/easymega-v1.0/ao_pins.h
src/easymega-v2.0/Makefile [new file with mode: 0644]
src/easymega-v2.0/ao_easymega.c [new file with mode: 0644]
src/easymega-v2.0/ao_pins.h [new file with mode: 0644]
src/easymega-v2.0/flash-loader/Makefile [new file with mode: 0644]
src/easymega-v2.0/flash-loader/ao_pins.h [new file with mode: 0644]
src/easymini-v1.0/ao_pins.h
src/easymini-v2.0/ao_pins.h
src/fox1ihu/Makefile
src/fox1ihu/ao_fox1ihu.c
src/kernel/ao.h
src/kernel/ao_aes.h
src/kernel/ao_balloon.c
src/kernel/ao_beep.h
src/kernel/ao_cmd.c
src/kernel/ao_companion.h
src/kernel/ao_config.c
src/kernel/ao_config.h
src/kernel/ao_convert.c
src/kernel/ao_data.c
src/kernel/ao_data.h
src/kernel/ao_ee_fake.c
src/kernel/ao_eeprom.h
src/kernel/ao_fake_flight.c
src/kernel/ao_flight.c
src/kernel/ao_flight.h
src/kernel/ao_flight_nano.c
src/kernel/ao_forward.c
src/kernel/ao_forward.h
src/kernel/ao_freq.c
src/kernel/ao_gps_print.c
src/kernel/ao_gps_report.c
src/kernel/ao_gps_report_mega.c
src/kernel/ao_gps_report_metrum.c
src/kernel/ao_gps_show.c
src/kernel/ao_host.h
src/kernel/ao_ignite.c
src/kernel/ao_int64.c
src/kernel/ao_int64.h
src/kernel/ao_kalman.c
src/kernel/ao_led.h
src/kernel/ao_log.c
src/kernel/ao_log.h
src/kernel/ao_log_big.c
src/kernel/ao_log_fireone.c
src/kernel/ao_log_mega.c
src/kernel/ao_log_metrum.c
src/kernel/ao_log_mini.c
src/kernel/ao_log_single.c
src/kernel/ao_log_telem.c
src/kernel/ao_log_telescience.c
src/kernel/ao_log_tiny.c
src/kernel/ao_monitor.c
src/kernel/ao_mutex.c
src/kernel/ao_notask.c
src/kernel/ao_notask.h
src/kernel/ao_packet.h
src/kernel/ao_power.c
src/kernel/ao_product.c
src/kernel/ao_pyro.c
src/kernel/ao_radio_cmac.c
src/kernel/ao_radio_cmac.h
src/kernel/ao_radio_cmac_cmd.c
src/kernel/ao_report.c
src/kernel/ao_report_micro.c
src/kernel/ao_romconfig.c [new file with mode: 0644]
src/kernel/ao_rssi.c
src/kernel/ao_sample.c
src/kernel/ao_sample.h
src/kernel/ao_sample_profile.c
src/kernel/ao_send_packet.c
src/kernel/ao_serial.h
src/kernel/ao_stdio.c
src/kernel/ao_storage.c
src/kernel/ao_storage.h
src/kernel/ao_task.c
src/kernel/ao_task.h
src/kernel/ao_telemetry.c
src/kernel/ao_tracker.c
src/kernel/ao_usb.h
src/lambdakey-v1.0/Makefile
src/lambdakey-v1.0/ao_lambdakey.c
src/lambdakey-v1.0/ao_pins.h
src/lambdakey-v1.0/ao_scheme_os.h
src/lambdakey-v1.0/lambda.ld [deleted file]
src/lpc/Makefile-lpc.defs
src/lpc/altos-loader.ld
src/lpc/altos-standalone.ld
src/lpc/altos.ld
src/lpc/ao_adc_lpc.c
src/lpc/ao_arch.h
src/lpc/ao_arch_funcs.h
src/lpc/ao_beep_lpc.c
src/lpc/ao_boot_pin.c
src/lpc/ao_interrupt.c
src/lpc/ao_led_lpc.c
src/lpc/ao_romconfig.c [deleted file]
src/lpc/ao_timer_lpc.c
src/lpc/ao_usb_lpc.c
src/math/ef_acos.c [deleted file]
src/math/ef_log.c [deleted file]
src/math/ef_rem_pio2.c [deleted file]
src/math/ef_sqrt.c [deleted file]
src/math/fdlibm.h [deleted file]
src/math/ieeefp.h [deleted file]
src/math/kf_cos.c [deleted file]
src/math/kf_rem_pio2.c [deleted file]
src/math/kf_sin.c [deleted file]
src/math/machine/ieeefp.h [deleted file]
src/math/math.h [deleted file]
src/math/sf_copysign.c [deleted file]
src/math/sf_cos.c [deleted file]
src/math/sf_fabs.c [deleted file]
src/math/sf_floor.c [deleted file]
src/math/sf_scalbn.c [deleted file]
src/math/sf_sin.c [deleted file]
src/megadongle-v0.1/.gitignore [deleted file]
src/megadongle-v0.1/Makefile [deleted file]
src/megadongle-v0.1/ao_megadongle.c [deleted file]
src/megadongle-v0.1/ao_pins.h [deleted file]
src/megadongle-v0.1/flash-loader/Makefile [deleted file]
src/megadongle-v0.1/flash-loader/ao_pins.h [deleted file]
src/microkite/Makefile
src/micropeak-v2.0/Makefile
src/micropeak-v2.0/ao_micropeak.c
src/micropeak-v2.0/micropeak.ld
src/micropeak/Makefile
src/microsplash/Makefile
src/nanopeak-v0.1/Makefile
src/nucleao-32/Makefile
src/nucleao-32/load.ld
src/pnpservo-v1/Makefile
src/pnpservo-v1/lambda.ld
src/product/Makefile.teledongle [deleted file]
src/product/Makefile.telelaunch [deleted file]
src/product/Makefile.telemetrum [deleted file]
src/product/Makefile.telemini [deleted file]
src/product/Makefile.telenano [deleted file]
src/product/ao_flash_task.c
src/product/ao_micropeak.c
src/product/ao_telemetrum.c
src/product/ao_telemini.c
src/product/ao_telenano.c
src/product/ao_teleterra.c
src/product/ao_terraui.c
src/product/ao_test.c
src/spiradio-v0.1/.gitignore [deleted file]
src/spiradio-v0.1/.sdcdbrc [deleted file]
src/spiradio-v0.1/Makefile [deleted file]
src/spiradio-v0.1/ao_pins.h [deleted file]
src/spiradio-v0.1/ao_spiradio.c [deleted file]
src/stm-bringup/bringup.ld
src/stm-demo/Makefile
src/stm-demo/ao_demo.c
src/stm-scheme-newlib/Makefile
src/stm-scheme-newlib/ao_demo.c
src/stm-vga/Makefile
src/stm-vga/ao_demo.c
src/stm/Makefile-flash.defs
src/stm/Makefile.defs
src/stm/altos-512.ld
src/stm/altos-loader.ld
src/stm/altos-ram.ld
src/stm/altos.ld
src/stm/ao_adc_single_stm.c
src/stm/ao_adc_stm.c
src/stm/ao_arch.h
src/stm/ao_arch_funcs.h
src/stm/ao_beep_stm.c
src/stm/ao_eeprom_stm.c
src/stm/ao_flash_stm_pins.h
src/stm/ao_i2c_stm.c
src/stm/ao_interrupt.c
src/stm/ao_lcd_stm.c
src/stm/ao_led.c [deleted file]
src/stm/ao_led_stm.c [new file with mode: 0644]
src/stm/ao_pwm_stm.c
src/stm/ao_romconfig.c [deleted file]
src/stm/ao_serial_stm.c
src/stm/ao_spi_stm.c
src/stm/ao_timer.c
src/stm/ao_usb_stm.c
src/stm/stm32l.h
src/stm32f4-disco/.gitignore [new file with mode: 0644]
src/stm32f4-disco/Makefile [new file with mode: 0644]
src/stm32f4-disco/ao_disco.c [new file with mode: 0644]
src/stm32f4-disco/ao_pins.h [new file with mode: 0644]
src/stm32f4-disco/ao_scheme_os.h [new file with mode: 0644]
src/stm32f4/Makefile-flash.defs [new file with mode: 0644]
src/stm32f4/Makefile-raw.defs [new file with mode: 0644]
src/stm32f4/Makefile-stm32f4.defs [new file with mode: 0644]
src/stm32f4/Makefile.defs [new file with mode: 0644]
src/stm32f4/altos-loader.ld [new file with mode: 0644]
src/stm32f4/altos-raw.ld [new file with mode: 0644]
src/stm32f4/altos.ld [new file with mode: 0644]
src/stm32f4/ao_arch.h [new file with mode: 0644]
src/stm32f4/ao_arch_funcs.h [new file with mode: 0644]
src/stm32f4/ao_exti.h [new file with mode: 0644]
src/stm32f4/ao_exti_stm32f4.c [new file with mode: 0644]
src/stm32f4/ao_interrupt.c [new file with mode: 0644]
src/stm32f4/ao_serial_stm32f4.c [new file with mode: 0644]
src/stm32f4/ao_timer.c [new file with mode: 0644]
src/stm32f4/ao_usart_stm32f4.c [new file with mode: 0644]
src/stm32f4/ao_usb_gen.c [new file with mode: 0644]
src/stm32f4/ao_usb_gen.h [new file with mode: 0644]
src/stm32f4/ao_usb_stm32f4.c [new file with mode: 0644]
src/stm32f4/registers.ld [new file with mode: 0644]
src/stm32f4/stm32f4.h [new file with mode: 0644]
src/stmf0/Makefile-stmf0.defs
src/stmf0/altos-loader.ld
src/stmf0/altos-raw.ld
src/stmf0/altos.ld
src/stmf0/ao_adc_stm.c
src/stmf0/ao_arch.h
src/stmf0/ao_arch_funcs.h
src/stmf0/ao_beep_stm.c
src/stmf0/ao_interrupt.c
src/stmf0/ao_led.c [deleted file]
src/stmf0/ao_led_stmf0.c [new file with mode: 0644]
src/stmf0/ao_romconfig.c [deleted file]
src/stmf0/ao_storage_stm.c
src/stmf0/ao_timer.c
src/stmf0/ao_usb_stm.c
src/teleballoon-v1.1/.gitignore [deleted file]
src/teleballoon-v1.1/Makefile [deleted file]
src/teleballoon-v1.1/ao_pins.h [deleted file]
src/teleballoon-v1.1/ao_teleballoon.c [deleted file]
src/teleballoon-v2.0/Makefile
src/teleballoon-v2.0/ao_pins.h
src/teleballoon-v2.0/ao_teleballoon.c
src/telebt-v1.0/.gitignore [deleted file]
src/telebt-v1.0/.sdcdbrc [deleted file]
src/telebt-v1.0/Makefile [deleted file]
src/telebt-v1.0/ao_pins.h [deleted file]
src/telebt-v1.0/ao_telebt.c [deleted file]
src/telebt-v3.0/Makefile
src/telebt-v3.0/ao_telebt.c
src/telebt-v4.0/Makefile
src/telebt-v4.0/ao_telebt.c
src/teledongle-v0.1/.gitignore [deleted file]
src/teledongle-v0.1/.sdcdbrc [deleted file]
src/teledongle-v0.1/Makefile [deleted file]
src/teledongle-v0.2/.gitignore [deleted file]
src/teledongle-v0.2/.sdcdbrc [deleted file]
src/teledongle-v0.2/Makefile [deleted file]
src/teledongle-v1.8/.gitignore [deleted file]
src/teledongle-v1.8/Makefile [deleted file]
src/teledongle-v1.8/ao_pins.h [deleted file]
src/teledongle-v1.8/ao_teledongle.c [deleted file]
src/teledongle-v3.0/ao_teledongle.c
src/telefire-v0.1/.gitignore [deleted file]
src/telefire-v0.1/.sdcdbrc [deleted file]
src/telefire-v0.1/Makefile [deleted file]
src/telefire-v0.1/ao_pins.h [deleted file]
src/telefire-v0.1/ao_telefire.c [deleted file]
src/telefire-v0.2/.gitignore [deleted file]
src/telefire-v0.2/.sdcdbrc [deleted file]
src/telefire-v0.2/Makefile [deleted file]
src/telefire-v0.2/ao_pins.h [deleted file]
src/telefire-v0.2/ao_telefire.c [deleted file]
src/telefireeight-v1.0/ao_pins.h
src/telefireeight-v1.0/ao_telefireeight.c
src/telefireone-v1.0/Makefile
src/telefireone-v1.0/ao_pins.h
src/telefireone-v1.0/ao_telefireone.c
src/telefiretwo-v0.1/Makefile
src/telefiretwo-v0.1/ao_telefiretwo.c
src/telefiretwo-v0.2/Makefile
src/telefiretwo-v0.2/ao_pins.h
src/telegps-v0.1/Makefile
src/telegps-v2.0/Makefile
src/telegps-v2.0/ao_telegps.c
src/telelco-v0.1/.gitignore [deleted file]
src/telelco-v0.1/Makefile [deleted file]
src/telelco-v0.1/ao_lco.c [deleted file]
src/telelco-v0.1/ao_lco.h [deleted file]
src/telelco-v0.1/ao_pins.h [deleted file]
src/telelco-v0.1/ao_telelco.c [deleted file]
src/telelco-v0.2-cc1200/Makefile
src/telelco-v0.2-cc1200/ao_pins.h
src/telelco-v0.2-cc1200/ao_telelco.c
src/telelco-v0.2/Makefile
src/telelco-v0.2/ao_pins.h
src/telelco-v0.2/ao_telelco.c
src/telelco-v0.3/Makefile
src/telelco-v0.3/ao_pins.h
src/telelco-v0.3/ao_telelco.c
src/telelco-v2.0/ao_lco_v2.c
src/telelco-v2.0/ao_pins.h
src/telelco-v2.0/ao_telelco.c
src/telelcotwo-v0.1/Makefile
src/telelcotwo-v0.1/ao_pins.h
src/telelcotwo-v0.1/ao_telelcotwo.c
src/telemega-v0.1/Makefile
src/telemega-v0.1/ao_pins.h
src/telemega-v0.1/ao_telemega.c
src/telemega-v1.0/Makefile
src/telemega-v1.0/ao_pins.h
src/telemega-v1.0/ao_telemega.c
src/telemega-v2.0/Makefile
src/telemega-v2.0/ao_pins.h
src/telemega-v2.0/ao_telemega.c
src/telemega-v3.0/Makefile
src/telemega-v3.0/ao_pins.h
src/telemega-v3.0/ao_telemega.c
src/telemetrum-v0.1-sirf/.gitignore [deleted file]
src/telemetrum-v0.1-sirf/Makefile [deleted file]
src/telemetrum-v0.1-sky/.gitignore [deleted file]
src/telemetrum-v0.1-sky/.sdcdbrc [deleted file]
src/telemetrum-v0.1-sky/Makefile [deleted file]
src/telemetrum-v1.0/.gitignore [deleted file]
src/telemetrum-v1.0/.sdcdbrc [deleted file]
src/telemetrum-v1.0/Makefile [deleted file]
src/telemetrum-v1.1/.gitignore [deleted file]
src/telemetrum-v1.1/.sdcdbrc [deleted file]
src/telemetrum-v1.1/Makefile [deleted file]
src/telemetrum-v1.2/.gitignore [deleted file]
src/telemetrum-v1.2/.sdcdbrc [deleted file]
src/telemetrum-v1.2/Makefile [deleted file]
src/telemetrum-v2.0/Makefile
src/telemetrum-v2.0/ao_pins.h
src/telemetrum-v2.0/ao_telemetrum.c
src/telemetrum-v3.0/Makefile
src/telemetrum-v3.0/ao_pins.h
src/telemetrum-v3.0/ao_telemetrum.c
src/telemini-v1.0/.gitignore [deleted file]
src/telemini-v1.0/.sdcdbrc [deleted file]
src/telemini-v1.0/Makefile [deleted file]
src/telemini-v2.0/.gitignore [deleted file]
src/telemini-v2.0/.sdcdbrc [deleted file]
src/telemini-v2.0/Makefile [deleted file]
src/telemini-v2.0/ao_pins.h [deleted file]
src/telemini-v2.0/ao_telemini.c [deleted file]
src/telemini-v3.0/ao_pins.h
src/telemini-v3.0/ao_telemini.c
src/telenano-v0.1/.gitignore [deleted file]
src/telenano-v0.1/.sdcdbrc [deleted file]
src/telenano-v0.1/Makefile [deleted file]
src/telepyro-v0.1/.gitignore [deleted file]
src/telepyro-v0.1/Makefile [deleted file]
src/telerepeat-v1.0/.gitignore [deleted file]
src/telerepeat-v1.0/.sdcdbrc [deleted file]
src/telerepeat-v1.0/Makefile [deleted file]
src/telerepeat-v1.0/ao_pins.h [deleted file]
src/telerepeat-v1.0/ao_telerepeat.c [deleted file]
src/telescience-pwm/.gitignore [deleted file]
src/telescience-pwm/Makefile [deleted file]
src/telescience-v0.1/.gitignore [deleted file]
src/telescience-v0.1/Makefile [deleted file]
src/telescience-v0.2/.gitignore [deleted file]
src/telescience-v0.2/Makefile [deleted file]
src/telescience-v0.2/ao_pins.h [deleted file]
src/telescience-v0.2/ao_telescience.c [deleted file]
src/telescience-v0.2/flash-loader/Makefile [deleted file]
src/telescience-v0.2/flash-loader/ao_pins.h [deleted file]
src/teleshield-v0.1/.gitignore [deleted file]
src/teleshield-v0.1/Makefile [deleted file]
src/teleshield-v0.1/ao_ardu_serial.c [deleted file]
src/teleshield-v0.1/ao_pins.h [deleted file]
src/teleshield-v0.1/ao_teleshield.c [deleted file]
src/teleterra-v0.1/.gitignore [deleted file]
src/teleterra-v0.1/ao_pins.h [deleted file]
src/teleterra-v0.2/.gitignore [deleted file]
src/teleterra-v0.2/.sdcdbrc [deleted file]
src/teleterra-v0.2/Makefile [deleted file]
src/teleterra-v0.2/ao_pins.h [deleted file]
src/test/ao_aes_test.c
src/test/ao_eeprom_read.h
src/test/ao_flight_test.c
src/test/ao_gps_test_skytraq.c
src/test/ao_gps_test_ublox.c
src/test/ao_int64_test.c
src/test/ao_ms5607_convert_test.c
src/tidongle/.gitignore [deleted file]
src/tidongle/Makefile [deleted file]
src/tmgps-v2.0/Makefile
src/usbrelay-v0.1/ao_usbrelay.c
src/usbtrng-v2.0/.gitignore [deleted file]
src/usbtrng-v2.0/Makefile [deleted file]
src/usbtrng-v2.0/ao_pins.h [deleted file]
src/usbtrng-v2.0/ao_usbtrng.c [deleted file]
src/usbtrng-v2.0/flash-loader/.gitignore [deleted file]
src/usbtrng-v2.0/flash-loader/Makefile [deleted file]
src/usbtrng-v2.0/flash-loader/ao_pins.h [deleted file]
src/usbtrng/Makefile [deleted file]
src/usbtrng/ao_pins.h [deleted file]
src/usbtrng/ao_usbtrng.c [deleted file]
src/usbtrng/flash-loader/Makefile [deleted file]
src/usbtrng/flash-loader/ao_pins.h [deleted file]
src/vidtime/ao_vidtime.c
telegps/Makefile.am
telegps/altusmetrum-telegps.desktop.in
telegps/telegps-windows.nsi.in

diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644 (file)
index 719da19..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "pdclib"]
-       path = pdclib
-       url = git://git.gag.com/fw/pdclib
index d79a2febfc6358b475618d08cef5017ca57a46b4..e05b9586d9001755911853ae0a22140601e9822b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,735 @@
-commit f3330f019216ee2632f47be1fb06e158fb09d758
-Merge: 5a86ff43 e7136c6b
+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 Oct 8 20:58:43 2018 -0600
+Date:   Mon Dec 31 12:37:45 2018 -0700
 
-    Merge branch 'master' into branch-1.8
+    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>
@@ -26,6 +752,7 @@ Date:   Mon Oct 8 19:40:32 2018 -0700
     
     Signed-off-by: Keith Packard <keithp@keithp.com>
 
+<<<<<<< HEAD
 commit 5a86ff43a2b4a90dbddc1bba48019626e1b83e10
 Author: Bdale Garbee <bdale@gag.com>
 Date:   Mon Oct 8 17:51:33 2018 -0600
@@ -39,6 +766,8 @@ Date:   Mon Oct 8 17:49:47 2018 -0600
 
     Merge branch 'master' into branch-1.8
 
+=======
+>>>>>>> branch-1.9
 commit 88ae4c5ebd64215f05f5efc18f9660560b409ace
 Author: Bdale Garbee <bdale@gag.com>
 Date:   Mon Oct 8 16:27:33 2018 -0600
@@ -834,6 +1563,7 @@ Date:   Sun Aug 5 14:11:01 2018 +0800
 
     capture updates to Releasing from 1.8.6 release process
 
+<<<<<<< HEAD
 commit 3a2a5a05bb6372d9003905cee7afdfcd6d38ae7e
 Author: Bdale Garbee <bdale@gag.com>
 Date:   Sun Aug 5 11:23:31 2018 +0800
@@ -847,6 +1577,8 @@ Date:   Sun Aug 5 11:21:37 2018 +0800
 
     Merge branch 'master' into branch-1.8
 
+=======
+>>>>>>> branch-1.9
 commit 8830fbc99565f753c0ae1f3d9f4b079860c2634a
 Author: Keith Packard <keithp@keithp.com>
 Date:   Sun Aug 5 11:13:23 2018 +0800
@@ -2061,6 +2793,7 @@ Date:   Tue Mar 20 18:25:43 2018 -0600
 
     add a paragraph to the intro pointing to the altusmetrum email list
 
+<<<<<<< HEAD
 commit 59e23c27c2a85d7d748223e444b24d19937afe47
 Author: Bdale Garbee <bdale@gag.com>
 Date:   Sun Mar 18 15:49:07 2018 -0600
@@ -2074,6 +2807,8 @@ Date:   Sun Mar 18 15:47:31 2018 -0600
 
     Merge branch 'master' into branch-1.8
 
+=======
+>>>>>>> branch-1.9
 commit 39023ed6e29103a85bfad505506fa0dbf4dc1112
 Author: Bdale Garbee <bdale@gag.com>
 Date:   Sun Mar 18 15:42:48 2018 -0600
@@ -2519,6 +3254,7 @@ Date:   Thu Dec 21 20:40:28 2017 -0700
 
     update Releasing with wisdom from 1.8.4 release process
 
+<<<<<<< HEAD
 commit 16a9d8617b2d2092d166a85ada4349601afb0dce
 Author: Bdale Garbee <bdale@gag.com>
 Date:   Thu Dec 21 19:06:22 2017 -0700
@@ -2532,6 +3268,8 @@ Date:   Thu Dec 21 19:05:46 2017 -0700
 
     Merge branch 'master' into branch-1.8
 
+=======
+>>>>>>> branch-1.9
 commit 87aab99521dc44d1d29fbb0b7f227f868f074836
 Author: Keith Packard <keithp@keithp.com>
 Date:   Thu Dec 21 17:37:10 2017 -0800
@@ -2951,6 +3689,7 @@ Date:   Mon Dec 11 22:15:46 2017 -0700
 
     update Releasing with changes discovered in 1.8.3 release process
 
+<<<<<<< HEAD
 commit fe38c22595b050435dbacd35f1baae064fb7de75
 Author: Bdale Garbee <bdale@gag.com>
 Date:   Mon Dec 11 21:38:59 2017 -0700
@@ -2964,6 +3703,8 @@ Date:   Mon Dec 11 21:37:48 2017 -0700
 
     Merge branch 'master' into branch-1.8
 
+=======
+>>>>>>> branch-1.9
 commit 9adf8b23aac8256f230b10adcab9dd323266caaa
 Author: Bdale Garbee <bdale@gag.com>
 Date:   Mon Dec 11 21:33:21 2017 -0700
@@ -4046,18 +4787,22 @@ Date:   Mon Sep 18 21:24:52 2017 -0600
 
     tweak Releasing based on 1.8.2 release experience
 
+<<<<<<< HEAD
 commit 216ea6388a75c46891dc4687a2eb0c97dc63b136
 Author: Bdale Garbee <bdale@gag.com>
 Date:   Mon Sep 18 20:46:04 2017 -0600
 
     releasing 1.8.2
 
+=======
+>>>>>>> branch-1.9
 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
 
+<<<<<<< HEAD
 commit 1ece6e6fd3faaae3f6c6d434497eb04235939dc3
 Author: Bdale Garbee <bdale@gag.com>
 Date:   Mon Sep 18 20:43:14 2017 -0600
@@ -4071,6 +4816,8 @@ Date:   Mon Sep 18 20:35:00 2017 -0600
 
     Merge branch 'master' into branch-1.8
 
+=======
+>>>>>>> branch-1.9
 commit e87d56b665ca30a3e5920c23cd60c99b84341aa2
 Author: Keith Packard <keithp@keithp.com>
 Date:   Mon Sep 18 18:51:51 2017 -0700
@@ -4307,12 +5054,15 @@ Date:   Mon Aug 28 14:01:54 2017 -0600
 
     a few tweaks to the Releasing document based on experience with 1.8.1
 
+<<<<<<< HEAD
 commit b1cf0dab1e28433e06ab02cec033951ea0149ea3
 Author: Bdale Garbee <bdale@gag.com>
 Date:   Mon Aug 28 12:05:17 2017 -0600
 
     releasing 1.8.1
 
+=======
+>>>>>>> branch-1.9
 commit b68c0482d4fae8eb54cde1df0e4bcf4c5d272bad
 Author: Keith Packard <keithp@keithp.com>
 Date:   Sun Aug 27 22:49:09 2017 -0700
index 89fdd6c9ce8e9290aa320cd489971877a5610427..fc6bbdaf4256ce669aa6fb9dd12f9e825948f7ea 100644 (file)
@@ -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)
@@ -57,21 +51,17 @@ 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-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/telemega-v3.0/telemega-v3.0-$(VERSION).ihx \
+       src/telemetrum-v2.0/telemetrum-v2.0-$(VERSION).ihx
 
 keithp-fat: fat
        ssh keithp.com mkdir -p public_html/altos-$(VERSION)
index a20b6dc084e0d461eafb68422e0917ca6bdc48ac..9fe3a7a6d546026b8275d16098b12ed85cbae0b3 100644 (file)
--- 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
@@ -25,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
@@ -48,14 +46,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-<version>
 
@@ -111,6 +101,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} \
@@ -128,6 +119,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/altoslib/AltosAdxl375.java b/altoslib/AltosAdxl375.java
new file mode 100644 (file)
index 0000000..2129ed6
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright © 2012 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+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;
+               }
+       }
+}
index d448fdfe5d468edc586d8d61c23dcd0a9f71cae7..22d19def1ba9397fbdec3ab510131407afe8bdf8 100644 (file)
@@ -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,9 @@ 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);
+               return accel;
        }
 
        public AltosMs5607      ms5607 = null;
@@ -404,6 +418,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);
        }
 }
index 48dab421b148c391e74fb03ed2240e7f0140cc18..d315f96ac7fdae2769f59b7f58516a420d9ceb9c 100644 (file)
@@ -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;
                }
@@ -581,6 +583,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 */
index d246018700bfd1d0746330f6724e27ab86f208c9..ce1b8f7f14f7733a29722e6eedd62090733ed63f 100644 (file)
@@ -258,12 +258,18 @@ 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;
+       }
+
        static double tele_bt_3_battery(int raw) {
                if (raw == AltosLib.MISSING)
                        return AltosLib.MISSING;
index 6b28c50a42e67a935ad7ab723153bb8c996c3a80..c37dbfa2ee2ed409f7ae72a408a8f97a5bc3c2b9 100644 (file)
@@ -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);
index 27f81df6d31f86bfdf094d0cc97898ff861810e6..e26a1e00205d2c8980f38f08b1bf00948f045169 100644 (file)
@@ -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:
index e6b0571342212f93d763a746ab1d17753b672640..434a02653a2eec993b55e794222f416e6a554404 100644 (file)
@@ -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;
        }
 
index b1323484d96339646bb4a3690746c02a7c7d4625..a2ba6935f0ee58ac895ef6ed477bffc99449566a 100644 (file)
@@ -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
+}
index 88a65e63bb7001fcdf5f4e3fb087d641284e6945..a68ccac70357f3fa8e607826ca33a977b84878d9 100644 (file)
@@ -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;
@@ -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) {
@@ -58,6 +59,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;
@@ -79,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);
@@ -157,14 +164,22 @@ 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("TeleGPS",
+               new AltosIdler("EasyMega-v2",
+                              AltosIdler.idle_adxl375,
+                              AltosIdler.idle_ms5607,
+                              AltosIdler.idle_imu,
+                              AltosIdler.idle_sensor_mega),
+               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;
index 8b0170aed140c2b3e85acf718a4def736a6d84b6..93567c06b96467a7d016088f8f30561a4febd359 100644 (file)
@@ -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) {
index 1872392d805c26136c22973938d54916d4c98dca..f87e334c26a79e7576b1d718fbbd33de64efe713 100644 (file)
@@ -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();
 
index ebeb76f32b54375db7ed9b1be2469f3658f0f949..00811ce7e4702d89a69da7289bb060096844642d 100644 (file)
@@ -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() {
index 0250cce741a6d1f3c64713418f5a953b12f04412..70a5ced5e8db0ffc551946e0740813fc4824cc2d 100644 (file)
@@ -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/altoslib/AltosSensorTGPS.java b/altoslib/AltosSensorTGPS.java
deleted file mode 100644 (file)
index 485e8b3..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright © 2015 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-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 (file)
index 0000000..cdd1921
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2015 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+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 (file)
index 0000000..ceca977
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2015 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+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++;
+               }
+       }
+}
+
index 4411a77d44c635d601582b17cf3805f09b5a50d3..22fd8568cab896f9cf42bfa1268901ba68bf6fe6 100644 (file)
@@ -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());
index 929763324a3788f5aacb5875e7f4d4646ae6f09e..447830e547f242175702bd16c7612e5d0202431c 100644 (file)
@@ -28,6 +28,7 @@ altoslib_JAVA = \
        AltosLib.java \
        AltosAccelCal.java \
        AltosAccelCalListener.java \
+       AltosAdxl375.java \
        AltosCalData.java \
        AltosCompanion.java \
        AltosConfigData.java \
@@ -107,7 +108,8 @@ altoslib_JAVA = \
        AltosSensorTMini3.java \
        AltosSensorMega.java \
        AltosSensorMetrum.java \
-       AltosSensorTGPS.java \
+       AltosSensorTGPS1.java \
+       AltosSensorTGPS2.java \
        AltosState.java \
        AltosStateName.java \
        AltosStringInputStream.java \
index 144d21d73cd9bb3131d31d5f52658a8db481a914..7cc1f4ea0dc462e9124b53fc9726b5ef4be66fbf 100644 (file)
@@ -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
@@ -148,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
index be9fb4338437378903cc31cada689e20a0e69253..2666fc332704ec8f3298880bb9a498a0658872e1 100644 (file)
@@ -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"
@@ -140,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
 
index 00f58ec6bb05ba514687722bc388caeaa532093f..0c2213a2dd7bf625a759b874f9bb887dd6621e93 100644 (file)
@@ -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
index 93ab178f579150b38201a3c231ac26fbce823fec..8ea9e233e330a71c53bb984edac349896a2e4161 100644 (file)
@@ -24,27 +24,39 @@ import java.awt.event.*;
 
 public class AltosDeviceUIDialog extends AltosDeviceDialog {
 
+       boolean include_bluetooth;
+
        public AltosDevice[] devices() {
                java.util.List<AltosDevice>     usb_devices = AltosUSBDevice.list(product);
                int                             num_devices = usb_devices.size();
-               java.util.List<AltosDevice>     bt_devices = AltosBTKnown.bt_known().list(product);
-               num_devices += bt_devices.size();
+
+               java.util.List<AltosDevice>     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);
+       }
 }
index b91776aa198ebb120c4b0a633c3a4d21ff1830cf..ffb39b8c2aae4e4e7b2035a9e780355114808bf8 100644 (file)
@@ -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;
                                                        }
                                                }
index f43d6befda46e57ec9ee26f0d105452308afe9b9..e4b94eeaed77efd12645dc208f57452f31fee2af 100644 (file)
@@ -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;
index 2f0a7822335e8ea46fb2babdfb6bc568da593e39..1e419b4418813ca75f393e6dd73ae5050fa30087 100755 (executable)
@@ -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 (executable)
index 0000000..2f0a782
--- /dev/null
@@ -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
index b14ed2ab9895c835d20f3de84bdb2775753db31b..64180bd3b9a3976fd41649c294f02a5063fb2bd9 100755 (executable)
@@ -1,26 +1,25 @@
 #!/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
+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
 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"
@@ -43,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*)
@@ -67,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
 
diff --git a/ao-bringup/turnon_easymega_v1.0 b/ao-bringup/turnon_easymega_v1.0
new file mode 100755 (executable)
index 0000000..b14ed2a
--- /dev/null
@@ -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 $?
index 8bf9bcb56bb5429aa13e1849d258f2b1347bbe7e..3e9fddaa4da8203bf26350cf266b9730ccb02a14 100755 (executable)
@@ -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 }'`
index 00d3ac86318e24c83c21fc76e0a5c691cfab9dc6..53e766490aeb2c8ef0585d712b7b098dbe058843 100644 (file)
@@ -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.
index ed498147fed27a007dadf0f23842539449db85e3..728f11ed2ffbb1bff79c956bd9ae195e81efa592 100644 (file)
@@ -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
index 7f7eec931dc36c684f99ab11abbe7757673c96cd..ee175dbe38b3c846081d1e6dea395314855a8f6a 100644 (file)
@@ -18,13 +18,13 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([altos], 1.8.7)
-ANDROID_VERSION=17
+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'`
@@ -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 \
@@ -209,36 +208,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
 #
@@ -268,27 +237,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"
@@ -311,16 +259,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"
@@ -340,6 +278,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
 #
@@ -587,14 +556,12 @@ 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}"
 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 ""
index 06ad43eb20dbf6b9233c8e9294127d99ddd5e87f..89b762b3ff6041e540f5620bcb3aa9d34c0ad74a 100644 (file)
@@ -1,7 +1,5 @@
 *.html
 *.pdf
-*.fo
 *.raw
-titlepage.templates.xsl
-fop-cfg.xml
+*.adoc
 map-loading.svg
index 450053f1a04fd556ee80d3b562439f2410091a34..67033e8be30633ce85c5989ce6a461d9b959ad50 100644 (file)
@@ -1,5 +1,15 @@
 #
-#      http://docbook.sourceforge.net/release/xsl/current/README
+# Copyright © 2018 Keith Packard <keithp@keithp.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
 #
 
 if FAKETIME
@@ -7,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 \
@@ -115,9 +126,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 +153,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 +169,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 +184,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 +195,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 +215,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 +225,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 +244,48 @@ FONTS=\
        fonts/OpenSans-Semibold.ttf \
        fonts/OpenSans-SemiboldItalic.ttf
 
-TEMPLATES_TMPL=titlepage.templates.tmpl
-
-TEMPLATES_XSL=$(TEMPLATES_TMPL:.tmpl=.xsl)
+ICONS=\
+       images/icons/caution.svg \
+       images/icons/important.svg \
+       images/icons/note.svg \
+       images/icons/tip.svg \
+       images/icons/warning.svg
 
-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: $(ADOC_FILES) $(IMAGES)
 
-telegps.html telegps.pdf: telegps-docinfo.xml $(TELEGPS_RAW_FILES) $(IMAGES)
+telegps.html telegps.pdf: $(TELEGPS_ADOC_FILES) $(IMAGES)
 
-micropeak.pdf micropeak.html: micropeak-docinfo.xml $(MICROPEAK_RAW_FILES) $(IMAGES)
+micropeak.pdf micropeak.html: $(MICROPEAK_ADOC_FILES) $(IMAGES)
 
-easymini.pdf easymini.html: easymini-docinfo.xml $(EASYMINI_RAW_FILES) $(IMAGES)
+easymini.pdf easymini.html: $(EASYMINI_ADOC_FILES) $(IMAGES)
 
 telemini-v1-outline.pdf: telemini-v1-outline.txt telemini-v1.svg
 
@@ -300,23 +295,28 @@ 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 $(PUBLISH_DOC) $(FONTS)
-       scp -p am.html $(PUBLISH_DOC) keithp.com:~keithp/public_html/altos
+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) $(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)
index 678ac17ef8eb63605ff01b10740223319d9b5354..db81297c5392135f2554560ee095f38e5d407724 100644 (file)
@@ -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
diff --git a/doc/altos-docinfo.xml b/doc/altos-docinfo.xml
deleted file mode 100644 (file)
index b9193a8..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<subtitle>Altos Metrum Operating System</subtitle>
-<author>
-  <firstname>Keith</firstname>
-  <surname>Packard</surname>
-  <email>keithp@keithp.com</email>
-</author>
-<date>05 November 2012</date>
-<copyright>
-  <year>2012</year>
-  <holder>Keith Packard</holder>
-</copyright>
-<legalnotice>
-  <para>
-    This document is released under the terms of the
-    <ulink url="http://creativecommons.org/licenses/by-sa/3.0/">
-      Creative Commons ShareAlike 3.0
-    </ulink>
-    license.
-  </para>
-</legalnotice>
-<revhistory>
-  <?dbhtml filename="altos-revhistory.html"?>
-  <revision>
-    <revnumber>1.1</revnumber>
-    <date>05 November 2012</date>
-    <revremark>Portable version</revremark>
-  </revision>
-  <revision>
-    <revnumber>0.1</revnumber>
-    <date>22 November 2010</date>
-    <revremark>Initial content</revremark>
-  </revision>
-</revhistory>
index f2b1ee5945ffc15b11ee18c9dfcf35bf1bcece70..9d12f12b324e2d0b02fe86457976dddc49b9f790 100644 (file)
@@ -1,7 +1,15 @@
 = AltOS
+Keith Packard <keithp@keithp.com>
 :doctype: book
 :toc:
+:stylesheet: am.css
+:linkcss:
 :numbered:
+:pdf-stylesdir: .
+:pdf-style: altusmetrum
+:pdf-fontsdir: fonts
+
+       include::header.adoc[]
 
 == Overview
 
index adce6f27df10e027ce26b6fb9260689a635d3936..44f77acad47384b667557fc529790ab78cfc4df0 100644 (file)
@@ -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
        the tasks provided from the top-level toolbar.
 
        ifdef::radio[]
+
        === Monitor Flight
-       ////
-             <subtitle>Receive, Record and Display Telemetry Data</subtitle>
-       ////
 
                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
                ==== 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
                ==== 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
                ==== 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
                ==== 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
                ==== 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
                ==== 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
                        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[]
 
 
                ==== 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).
                ==== 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
                ==== Flight Statistics
 
                        .Flight Statistics
-                       image::graph-stats.png[width="5.5in"]
+                       image::graph-stats.png[width=400]
 
                        Shows overall data computed from the flight.
 
                ==== 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
        === 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
 
                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.
        === 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
        === 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
        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-docinfo.xml b/doc/altusmetrum-docinfo.xml
deleted file mode 100644 (file)
index 18bc644..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-<subtitle>An Owner's Manual for Altus Metrum Rocketry Electronics</subtitle>
-<author>
-  <firstname>Bdale</firstname>
-  <surname>Garbee</surname>
-  <email>bdale@gag.com</email>
-</author>
-<author>
-  <firstname>Keith</firstname>
-  <surname>Packard</surname>
-  <email>keithp@keithp.com</email>
-</author>
-<author>
-  <firstname>Bob</firstname>
-  <surname>Finch</surname>
-</author>
-<author>
-  <firstname>Anthony</firstname>
-  <surname>Towns</surname>
-</author>
-<copyright>
-  <year>2018</year>
-  <holder>Bdale Garbee and Keith Packard</holder>
-</copyright>
-<mediaobject>
-  <imageobject>
-    <imagedata fileref="../themes/background.png" width="6.0in"/>
-  </imageobject>
-</mediaobject>
-
-<corpauthor>
-  <inlinemediaobject>
-    <imageobject>
-      <imagedata fileref="altusmetrum-oneline.svg" width="4in"/>
-    </imageobject>
-  </inlinemediaobject>
-</corpauthor>
-
-<legalnotice>
-  <para>
-    This document is released under the terms of the
-    <ulink url="http://creativecommons.org/licenses/by-sa/3.0/">
-      Creative Commons ShareAlike 3.0
-    </ulink>
-    license.
-  </para>
-</legalnotice>
-<revhistory>
-  <?dbhtml filename="altusmetrum-revhistory.html"?>
-  <revision>
-    <revnumber>1.8.7</revnumber>
-    <date>8 Oct  2018</date>
-    <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>
-  </revision>
-  <revision>
-    <revnumber>1.8.6</revnumber>
-    <date>6 Aug 2018</date>
-    <revremark>
-      Various pyro channel configuration updates.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.8.5</revnumber>
-    <date>18 Mar 2018</date>
-    <revremark>
-      Minor ground station software updates.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.8.4</revnumber>
-    <date>20 Dec 2017</date>
-    <revremark>
-      Support EasyMini v2.0 hardware.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.8.3</revnumber>
-    <date>11 Dec 2017</date>
-    <revremark>
-      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.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.8.2</revnumber>
-    <date>18 Sep 2017</date>
-    <revremark>
-      Support TeleGPS v2.0 hardware. Add accelerometer recalibration
-      UI.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.8.1</revnumber>
-    <date>27 Aug 2017</date>
-    <revremark>
-      Fix Apogee Lockout time value wrapping bug. Change high-speed
-      Kalman filter function.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.8</revnumber>
-    <date>12 Aug 2017</date>
-    <revremark>
-      Add support for TeleBT v4.0, updates in data analysis code
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.7</revnumber>
-    <date>21 Apr 2017</date>
-    <revremark>
-      Add support for TeleMini v3.0 in firmware, AltosUI and AltosDroid
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.6.8</revnumber>
-    <date>4 Sep 2016</date>
-    <revremark>
-      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.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.6.5</revnumber>
-    <date>8 Jul 2016</date>
-    <revremark>
-      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.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.6.4</revnumber>
-    <date>10 May 2016</date>
-    <revremark>
-      Minor release fixing TeleBT v1.0 flow control and a few minor
-      application bugs.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.6.3</revnumber>
-    <date>21 April 2016</date>
-    <revremark>
-      Minor release adding idle mode to AltosDroid and fixing various
-      host software bugs.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.6.2</revnumber>
-    <date>10 January 2016</date>
-    <revremark>
-      Minor release adding TeleMega v2.0 support.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.6.1</revnumber>
-    <date>15 July 2015</date>
-    <revremark>
-      Minor release adding TeleBT v3.0 support.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.6</revnumber>
-    <date>8 January 2015</date>
-    <revremark>
-      Major release adding TeleDongle v3.0 support.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.5</revnumber>
-    <date>6 September 2014</date>
-    <revremark>
-      Major release adding EasyMega support.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.4.2</revnumber>
-    <date>17 August 2014</date>
-    <revremark>
-      Minor release fixing some Windows installation bugs.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.4.1</revnumber>
-    <date>20 June 2014</date>
-    <revremark>
-      Minor release fixing some installation bugs.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.4</revnumber>
-    <date>15 June 2014</date>
-    <revremark>
-      Major release adding TeleGPS support.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.3.2</revnumber>
-    <date>24 January 2014</date>
-    <revremark>
-      Bug fixes for TeleMega and AltosUI.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.3.1</revnumber>
-    <date>21 January 2014</date>
-    <revremark>
-      Bug fixes for TeleMega and TeleMetrum v2.0 along with a few
-      small UI improvements.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.3</revnumber>
-    <date>12 November 2013</date>
-    <revremark>
-      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.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.2.1</revnumber>
-    <date>21 May 2013</date>
-    <revremark>
-      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.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.2</revnumber>
-    <date>18 April 2013</date>
-    <revremark>
-      Updated for software version 1.2. Version 1.2 adds support
-      for MicroPeak and the MicroPeak USB interface.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.1.1</revnumber>
-    <date>16 September 2012</date>
-    <revremark>
-      Updated for software version 1.1.1 Version 1.1.1 fixes a few
-      bugs found in version 1.1.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.1</revnumber>
-    <date>13 September 2012</date>
-    <revremark>
-      Updated for software version 1.1. Version 1.1 has new
-      features but is otherwise compatible with version 1.0.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.0</revnumber>
-    <date>24 August 2011</date>
-    <revremark>
-      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.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>0.9</revnumber>
-    <date>18 January 2011</date>
-    <revremark>
-      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.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>0.8</revnumber>
-    <date>24 November 2010</date>
-    <revremark>Updated for software version 0.8 </revremark>
-  </revision>
-  <revision>
-    <revnumber>0.7.1</revnumber>
-    <date>29 September 2010</date>
-    <revremark>Added AltosUI</revremark>
-  </revision>
-</revhistory>
diff --git a/doc/altusmetrum-theme.yml b/doc/altusmetrum-theme.yml
new file mode 100644 (file)
index 0000000..f13fa59
--- /dev/null
@@ -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
index 48211eb81b0aa5d6c5bad08532fa99969a61d4b1..17b2a53fabf3659ac6e86ba5f2f7bb06b335caae 100644 (file)
@@ -1,6 +1,17 @@
-= The Altus Metrum System
+= 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.9
+:revdate: 31 Dec 2018
+:icons:
+:icontype: svg
+:revremark: Add EasyMega v2.0 support
+:copyright: Bdale Garbee and Keith Packard 2018
 :doctype: book
 :numbered:
+:stylesheet: am.css
+:linkcss:
+:toc:
 :altusmetrum: 1
 :radio: 1
 :gps: 1
 :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::specs.adoc[]
+
+       include::release-notes.adoc[]
 
-       include::release-notes.raw[]
diff --git a/doc/am-fo.xsl b/doc/am-fo.xsl
deleted file mode 100644 (file)
index 605339d..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-<!--
-  Generates single FO document from DocBook XML source using DocBook XSL
-  stylesheets.
-
-  See xsl-stylesheets/fo/param.xsl for all parameters.
-
-  NOTE: The URL reference to the current DocBook XSL stylesheets is
-  rewritten to point to the copy on the local disk drive by the XML catalog
-  rewrite directives so it doesn't need to go out to the Internet for the
-  stylesheets. This means you don't need to edit the <xsl:import> elements on
-  a machine by machine basis.
--->
-<xsl:stylesheet version="1.0"
-                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:fo="http://www.w3.org/1999/XSL/Format">
-<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
-<xsl:import href="common.xsl"/>
-<xsl:include href="titlepage.templates.xsl"/>
-<xsl:include href="footer.templates.xsl"/>
-
-<xsl:param name="ulink.show" select="0" />
-<xsl:param name="ulink.footnotes" select="1"/>
-
-<xsl:param name="fop1.extensions" select="1" />
-<xsl:param name="variablelist.as.blocks" select="1" />
-
-<xsl:param name="paper.type" select="'USletter'"/>
-
-<xsl:param name="hyphenate">false</xsl:param>
-<!-- justify, left or right -->
-<xsl:param name="alignment">left</xsl:param>
-
-<xsl:param name="body.font.family" select="'Open Sans Light,sans-serif'"/>
-<xsl:param name="title.font.family" select="'Open Sans Light,sans-serif'"/>
-<xsl:param name="monospace.font.family" select="'DejaVu Sans Mono,monospace'"/>
-<xsl:param name="body.font.master">11</xsl:param>
-<xsl:param name="body.font.size">
- <xsl:value-of select="$body.font.master"/><xsl:text>pt</xsl:text>
-</xsl:param>
-
-<xsl:param name="body.margin.bottom" select="'0.5in'"/>
-<xsl:param name="body.margin.top" select="'0.5in'"/>
-<xsl:param name="bridgehead.in.toc" select="0"/>
-<xsl:param name="footer.column.widths">10 1 1</xsl:param>
-
-<!-- Default fetches image from Internet (long timeouts) -->
-<xsl:param name="draft.watermark.image" select="''"/>
-
-<!-- Line break -->
-<xsl:template match="processing-instruction('asciidoc-br')">
-  <fo:block/>
-</xsl:template>
-
-<!-- Horizontal ruler -->
-<xsl:template match="processing-instruction('asciidoc-hr')">
-  <fo:block space-after="1em">
-    <fo:leader leader-pattern="rule" rule-thickness="0.5pt"  rule-style="solid" leader-length.minimum="100%"/>
-  </fo:block>
-</xsl:template>
-
-<!-- Hard page break -->
-<xsl:template match="processing-instruction('asciidoc-pagebreak')">
-   <fo:block break-after='page'/>
-</xsl:template>
-
-<!-- Sets title to body text indent -->
-<xsl:param name="body.start.indent">
-  <xsl:choose>
-    <xsl:when test="$fop.extensions != 0">0pt</xsl:when>
-    <xsl:when test="$passivetex.extensions != 0">0pt</xsl:when>
-    <xsl:otherwise>1pc</xsl:otherwise>
-  </xsl:choose>
-</xsl:param>
-<xsl:param name="title.margin.left">
-  <xsl:choose>
-    <xsl:when test="$fop.extensions != 0">-1pc</xsl:when>
-    <xsl:when test="$passivetex.extensions != 0">0pt</xsl:when>
-    <xsl:otherwise>0pt</xsl:otherwise>
-  </xsl:choose>
-</xsl:param>
-<xsl:param name="page.margin.bottom" select="'0.25in'"/>
-<xsl:param name="page.margin.inner">
-  <xsl:choose>
-    <xsl:when test="$double.sided != 0">0.75in</xsl:when>
-    <xsl:otherwise>0.75in</xsl:otherwise>
-  </xsl:choose>
-</xsl:param>
-<xsl:param name="page.margin.outer">
-  <xsl:choose>
-    <xsl:when test="$double.sided != 0">0.5in</xsl:when>
-    <xsl:otherwise>0.5in</xsl:otherwise>
-  </xsl:choose>
-</xsl:param>
-
-<xsl:param name="page.margin.top" select="'0.5in'"/>
-<xsl:param name="page.orientation" select="'portrait'"/>
-<xsl:param name="page.width">
-  <xsl:choose>
-    <xsl:when test="$page.orientation = 'portrait'">
-      <xsl:value-of select="$page.width.portrait"/>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:value-of select="$page.height.portrait"/>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:param>
-
-<xsl:param name="table.frame.border.thickness">0.5pt</xsl:param>
-<xsl:param name="table.frame.border.color">#78079a</xsl:param>
-<xsl:param name="table.frame.border.thickness">0.5pt</xsl:param>
-<xsl:param name="table.cell.border.thickness">0.5pt</xsl:param>
-<xsl:param name="table.cell.border.color">#78079a</xsl:param>
-<xsl:param name="table.cell.border.with.css" select="1"/>
-
-<xsl:attribute-set name="component.title.properties">
-  <xsl:attribute name="font-size">
-    <xsl:value-of select="$body.font.master * 1.61051"/>
-    <xsl:text>pt</xsl:text>
-  </xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="section.title.level1.properties">
-  <xsl:attribute name="font-size">
-    <xsl:value-of select="$body.font.master * 1.4641"/>
-    <xsl:text>pt</xsl:text>
-  </xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="section.title.level2.properties">
-  <xsl:attribute name="font-size">
-    <xsl:value-of select="$body.font.master * 1.331"/>
-    <xsl:text>pt</xsl:text>
-  </xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="section.title.level3.properties">
-  <xsl:attribute name="font-size">
-    <xsl:value-of select="$body.font.master * 1.21"/>
-    <xsl:text>pt</xsl:text>
-  </xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="section.title.level4.properties">
-  <xsl:attribute name="font-size">
-    <xsl:value-of select="$body.font.master * 1.1"/>
-    <xsl:text>pt</xsl:text>
-  </xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="copyright.title.properties">
-  <xsl:attribute name="font-size">11pt</xsl:attribute>
-  <xsl:attribute name="font-weight">bold</xsl:attribute>
-  <xsl:attribute name="text-align">center</xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="revhistory.title.properties">
-  <xsl:attribute name="font-size">11pt</xsl:attribute>
-  <xsl:attribute name="font-weight">bold</xsl:attribute>
-  <xsl:attribute name="text-align">center</xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="revhistory.table.properties">
-  <xsl:attribute name="border">0.5pt solid #78079a</xsl:attribute>
-  <xsl:attribute name="width">50%</xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="revhistory.table.cell.properties">
-  <xsl:attribute name="border">0.5pt solid #78079a</xsl:attribute>
-  <xsl:attribute name="font-size">11pt</xsl:attribute>
-  <xsl:attribute name="padding">2pt</xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="monospace.properties">
-  <xsl:attribute name="font-size">11pt</xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="component.title.properties">
-  <xsl:attribute name="font-weight">normal</xsl:attribute>
-  <xsl:attribute name="color">#78079a</xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="section.title.properties">
-  <xsl:attribute name="font-weight">normal</xsl:attribute>
-  <xsl:attribute name="color">#78079a</xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="admonition.title.properties">
-  <xsl:attribute name="font-weight">normal</xsl:attribute>
-  <xsl:attribute name="color">#ff4040</xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="formal.title.properties">
-  <xsl:attribute name="font-weight">normal</xsl:attribute>
-  <xsl:attribute name="color">#78079a</xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="sidebar.properties" use-attribute-sets="formal.object.properties">
-  <xsl:attribute name="border-style">solid</xsl:attribute>
-  <xsl:attribute name="border-width">1pt</xsl:attribute>
-  <xsl:attribute name="border-color">silver</xsl:attribute>
-  <xsl:attribute name="background-color">#ffffee</xsl:attribute>
-  <xsl:attribute name="padding-left">12pt</xsl:attribute>
-  <xsl:attribute name="padding-right">12pt</xsl:attribute>
-  <xsl:attribute name="padding-top">6pt</xsl:attribute>
-  <xsl:attribute name="padding-bottom">6pt</xsl:attribute>
-  <xsl:attribute name="margin-left">0pt</xsl:attribute>
-  <xsl:attribute name="margin-right">12pt</xsl:attribute>
-  <xsl:attribute name="margin-top">6pt</xsl:attribute>
-  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
-</xsl:attribute-set>
-
-<!-- Only shade programlisting and screen verbatim elements -->
-<xsl:param name="shade.verbatim" select="1"/>
-<xsl:attribute-set name="shade.verbatim.style">
-  <xsl:attribute name="background-color">
-    <xsl:choose>
-      <xsl:when test="self::programlisting|self::screen">#ffffff</xsl:when>
-      <xsl:otherwise>inherit</xsl:otherwise>
-    </xsl:choose>
-  </xsl:attribute>
-</xsl:attribute-set>
-
-<!--
-  Force XSL Stylesheets 1.72 default table breaks to be the same as the current
-  version (1.74) default which (for tables) is keep-together="auto".
--->
-<xsl:attribute-set name="table.properties">
-  <xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
-</xsl:attribute-set>
-
-</xsl:stylesheet>
diff --git a/doc/am-html.xsl b/doc/am-html.xsl
deleted file mode 100644 (file)
index cdfe27f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<!--
-  Generates single XHTML document from DocBook XML source using DocBook XSL
-  stylesheets.
-
-  NOTE: The URL reference to the current DocBook XSL stylesheets is
-  rewritten to point to the copy on the local disk drive by the XML catalog
-  rewrite directives so it doesn't need to go out to the Internet for the
-  stylesheets. This means you don't need to edit the <xsl:import> elements on
-  a machine by machine basis.
--->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
-<xsl:import href="common.xsl"/>
-</xsl:stylesheet>
diff --git a/doc/am-notoc.css b/doc/am-notoc.css
new file mode 100644 (file)
index 0000000..829e8b7
--- /dev/null
@@ -0,0 +1,344 @@
+/*
+  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;
+}
+
+td.icon {
+    width: 4em;
+    height: 3em;
+}
+
+td.icon img {
+    height: 100%;
+    width: 100%
+}
+
+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; }
+}
index 393ef81b5f961c93c28e458a5a679aa67ecb5824..ccb50ffede7ed92126c5fda6362f3db641af2831 100644 (file)
@@ -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,26 @@ 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#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 p {
-    color: black;
+td.icon {
+    width: 4em;
+    height: 3em;
+}
+
+td.icon img {
+    height: 100%;
+    width: 100%
 }
 
 div.toc a:link {
@@ -174,42 +153,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 +203,6 @@ body h3 {
 body h4 {
   margin: .8em 0 0 -3%;
   line-height: 1.3;
-  border-top: 2px solid #808080;
 }
 
 body h5 {
@@ -248,25 +218,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 +235,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 +330,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/common.xsl b/doc/common.xsl
deleted file mode 100644 (file)
index 94b120a..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-<!--
-  Inlcuded in xhtml.xsl, xhtml.chunked.xsl, htmlhelp.xsl.
-  Contains common XSL stylesheets parameters.
-  Output documents styled by docbook.css.
--->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-<xsl:param name="html.stylesheet" select="'docbook-xsl.css'"/>
-
-<xsl:param name="htmlhelp.chm" select="'htmlhelp.chm'"/>
-<xsl:param name="htmlhelp.hhc.section.depth" select="5"/>
-
-<xsl:param name="section.autolabel">
-  <xsl:choose>
-    <xsl:when test="/processing-instruction('asciidoc-numbered')">1</xsl:when>
-    <xsl:otherwise>0</xsl:otherwise>
-  </xsl:choose>
-</xsl:param>
-
-<xsl:param name="suppress.navigation" select="0"/>
-<xsl:param name="navig.graphics.extension" select="'.png'"/>
-<xsl:param name="navig.graphics" select="0"/>
-<xsl:param name="navig.graphics.path">images/icons/</xsl:param>
-<xsl:param name="navig.showtitles">0</xsl:param>
-
-<xsl:param name="shade.verbatim" select="0"/>
-<xsl:attribute-set name="shade.verbatim.style">
-  <xsl:attribute name="border">0</xsl:attribute>
-  <xsl:attribute name="background-color">#E0E0E0</xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:param name="admon.graphics" select="1"/>
-<xsl:param name="admon.graphics.path">images/icons/</xsl:param>
-<xsl:param name="admon.graphics.extension" select="'.png'"/>
-<xsl:param name="admon.style">
-  <xsl:text>margin-left: 0; margin-right: 10%;</xsl:text>
-</xsl:param>
-<xsl:param name="admon.textlabel" select="1"/>
-
-<xsl:param name="callout.defaultcolumn" select="'60'"/>
-<xsl:param name="callout.graphics.extension" select="'.png'"/>
-<xsl:param name="callout.graphics" select="'1'"/>
-<xsl:param name="callout.graphics.number.limit" select="'10'"/>
-<xsl:param name="callout.graphics.path" select="'images/icons/callouts/'"/>
-<xsl:param name="callout.list.table" select="'1'"/>
-
-<!-- This does not seem to work. -->
-<xsl:param name="section.autolabel.max.depth" select="2"/>
-
-<xsl:param name="chunk.first.sections" select="1"/>
-<xsl:param name="chunk.section.depth" select="1"/>
-<xsl:param name="chunk.quietly" select="0"/>
-<xsl:param name="chunk.toc" select="''"/>
-<xsl:param name="chunk.tocs.and.lots" select="0"/>
-
-<xsl:param name="html.cellpadding" select="'4px'"/>
-<xsl:param name="html.cellspacing" select="''"/>
-
-<xsl:param name="table.borders.with.css" select="1"/>
-<xsl:param name="table.cell.border.color" select="'#78079a'"/>
-<xsl:param name="table.cell.border.style" select="'solid'"/>
-<xsl:param name="table.cell.border.thickness" select="'1px'"/>
-<xsl:param name="table.footnote.number.format" select="'a'"/>
-<xsl:param name="table.footnote.number.symbols" select="''"/>
-<xsl:param name="table.frame.border.color" select="'#78079a'"/>
-<xsl:param name="table.frame.border.style" select="'solid'"/>
-<xsl:param name="table.frame.border.thickness" select="'1px'"/>
-<xsl:param name="tablecolumns.extension" select="'1'"/>
-
-<xsl:attribute-set name="revhistory.title.properties">
-  <xsl:attribute name="font-size">12pt</xsl:attribute>
-  <xsl:attribute name="font-weight">bold</xsl:attribute>
-  <xsl:attribute name="text-align">center</xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="revhistory.table.properties">
-  <xsl:attribute name="border">0.5pt solid #78079a</xsl:attribute>
-  <xsl:attribute name="width">50%</xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:attribute-set name="revhistory.table.cell.properties">
-  <xsl:attribute name="border">0.5pt solid #78079a</xsl:attribute>
-  <xsl:attribute name="font-size">12pt</xsl:attribute>
-  <xsl:attribute name="padding">2pt</xsl:attribute>
-</xsl:attribute-set>
-
-<xsl:param name="generate.revhistory.link" select="1"/>
-
-<xsl:param name="highlight.source" select="1"/>
-
-<xsl:param name="section.label.includes.component.label" select="1"/>
-
-<!--
-  Table of contents inserted by <?asciidoc-toc?> processing instruction.
--->
-<xsl:param name="generate.toc">
-  <xsl:choose>
-    <xsl:when test="/processing-instruction('asciidoc-toc')">
-article toc,title
-book    toc,title,figure,table,example,equation
-      <!-- The only way I could find that suppressed book chapter TOCs -->
-      <xsl:if test="$generate.section.toc.level != 0">
-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
-      </xsl:if>
-    </xsl:when>
-    <xsl:otherwise>
-article nop
-book    nop
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:param>
-
-</xsl:stylesheet>
diff --git a/doc/companion-docinfo.xml b/doc/companion-docinfo.xml
deleted file mode 100644 (file)
index 243bded..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<subtitle>Protocol Definitions</subtitle>
-<author>
-  <firstname>Keith</firstname>
-  <surname>Packard</surname>
-  <email>keithp@keithp.com</email>
-</author>
-<date>13 January 2012</date>
-<copyright>
-  <year>2012</year>
-  <holder>Keith Packard</holder>
-</copyright>
-<legalnotice>
-  <para>
-    This document is released under the terms of the
-    <ulink url="http://creativecommons.org/licenses/by-sa/3.0/">
-      Creative Commons ShareAlike 3.0
-    </ulink>
-    license.
-  </para>
-</legalnotice>
-<revhistory>
-  <?dbhtml filename="companion-revhistory.html"?>
-  <revision>
-    <revnumber>0.1</revnumber>
-    <date>13 January 2012</date>
-    <revremark>Initial content</revremark>
-  </revision>
-</revhistory>
index 75ffa228ecf00e9f06ac921e28154355cf9935c0..256ffad77cae3c4a11dd142030a67f17ae4bb9f9 100644 (file)
@@ -1,7 +1,16 @@
 = AltOS Companion Port
+Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>
 :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
index 0ca6afff10e296d89e035402e67baf41e3d9ac18..144b1e8fc9fd2704cefc91136e3ecea62361d1c8 100644 (file)
@@ -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[]
index f5ca982c32228f51a80dba66b1617f35948af8ad..d6daf09cab0f91e30fbeef44d68cd375488b15d6 100644 (file)
@@ -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
index c126004bdf511ff3f96c35cce9ea24a320391542..a948aaae36cf8dee123ead07e44321319d78ef62 100644 (file)
@@ -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,
index fb2b6098879f9b95f66f14ca94dbcae4e32bd827..82ea959c3be825282aa17cdc1f01ef8850853155 100644 (file)
@@ -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-docinfo.xml b/doc/easymini-docinfo.xml
deleted file mode 100644 (file)
index 85baba1..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<subtitle>A Dual-Deploy Rocketry Flight Computer</subtitle>
-<author>
-  <firstname>Bdale</firstname>
-  <surname>Garbee</surname>
-  <email>bdale@gag.com</email>
-</author>
-<author>
-  <firstname>Keith</firstname>
-  <surname>Packard</surname>
-  <email>keithp@keithp.com</email>
-</author>
-<copyright>
-  <year>2016</year>
-  <holder>Bdale Garbee and Keith Packard</holder>
-</copyright>
-<mediaobject>
-  <imageobject>
-    <imagedata fileref="easymini-top.jpg" width="3.0in"/>
-  </imageobject>
-</mediaobject>
-
-<corpauthor>
-  <inlinemediaobject>
-    <imageobject>
-      <imagedata fileref="altusmetrum-oneline.svg" width="3in"/>
-    </imageobject>
-  </inlinemediaobject>
-</corpauthor>
-
-<legalnotice>
-  <para>
-    This document is released under the terms of the
-    <ulink url="http://creativecommons.org/licenses/by-sa/3.0/">
-      Creative Commons ShareAlike 3.0
-    </ulink>
-    license.
-  </para>
-</legalnotice>
-<revhistory>
-  <?dbhtml filename="easymini-revhistory.html"?>
-  <revision>
-    <revnumber>1.8.4</revnumber>
-    <date>20 Dec 2017</date>
-    <revremark>
-      Support EasyMini v2.0 hardware.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.6.3</revnumber>
-    <date>21 April 2016</date>
-    <revremark>
-      Minor release fixing various host software bugs.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.6.2</revnumber>
-    <date>10 January 2016</date>
-    <revremark>
-      First release of separate EasyMini doc
-    </revremark>
-  </revision>
-</revhistory>
index e031b5eee20c67f8c2c1c6970f5271fe192b0f49..c4b1baa597f9b7621493300fa4a259f4b9af522f 100644 (file)
@@ -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
index 425236efb2a1362c532218df179a05205a48aea4..67ba0f4dc07e422720e9608164eb53571c157c14 100644 (file)
@@ -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
index 1a75b92905bfb7da4d0b381123af301e47d011f2..e3d3fae843cd770dcfbaa3cea47d8f4ff4fec82f 100644 (file)
@@ -1,34 +1,47 @@
 = EasyMini Owner's Manual
+Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>
+: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/footer.templates.xsl b/doc/footer.templates.xsl
deleted file mode 100644 (file)
index 3484c0e..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns:fo="http://www.w3.org/1999/XSL/Format"
-               xmlns:d="http://docbook.org/ns/docbook"
-                version="1.0">
-
-<xsl:template name="footer.content">
-  <xsl:param name="pageclass" select="''"/>
-  <xsl:param name="sequence" select="''"/>
-  <xsl:param name="position" select="''"/>
-  <xsl:param name="gentext-key" select="''"/>
-
-<!--
-  <fo:block>
-    <xsl:value-of select="$pageclass"/>
-    <xsl:text>, </xsl:text>
-    <xsl:value-of select="$sequence"/>
-    <xsl:text>, </xsl:text>
-    <xsl:value-of select="$position"/>
-    <xsl:text>, </xsl:text>
-    <xsl:value-of select="$gentext-key"/>
-  </fo:block>
--->
-
-  <fo:block>
-    <!-- pageclass can be front, body, back -->
-    <!-- sequence can be odd, even, first, blank -->
-    <!-- position can be left, center, right -->
-    <xsl:choose>
-      <xsl:when test="$pageclass = 'titlepage'">
-        <!-- nop; no footer on title pages -->
-      </xsl:when>
-
-      <xsl:when test="$position='right'">
-        <fo:page-number/>
-      </xsl:when>
-
-      <xsl:when test="$position='left'">
-       <fo:block font-size="10">
-         <xsl:value-of select="//legalnotice"/>
-       </fo:block>
-      </xsl:when>
-
-      <xsl:otherwise>
-        <!-- nop -->
-      </xsl:otherwise>
-    </xsl:choose>
-  </fo:block>
-</xsl:template>
-
-</xsl:stylesheet>
-
diff --git a/doc/fop.xconf b/doc/fop.xconf
deleted file mode 100644 (file)
index 9ac4282..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0"?>
-<!-- $Id: fop.xconf 1339442 2012-05-17 01:42:56Z gadams $ -->
-
-<!--
-
-This is an example configuration file for FOP.
-This file contains the same settings as the default values
-and will have no effect if used unchanged.
-
-Relative config url's will be resolved relative to
-the location of this file.
-
--->
-
-<!-- NOTE: This is the version of the configuration -->
-<fop version="1.0">
-
-  <!-- Base URL for resolving relative URLs -->
-  <base>.</base>
-  
-  <!-- Source resolution in dpi (dots/pixels per inch) for determining the size of pixels in SVG and bitmap images, default: 72dpi -->
-  <source-resolution>72</source-resolution>
-  <!-- Target resolution in dpi (dots/pixels per inch) for specifying the target resolution for generated bitmaps, default: 72dpi -->
-  <target-resolution>72</target-resolution>
-  
-  <!-- Default page-height and page-width, in case
-       value is specified as auto -->
-  <default-page-settings height="11in" width="8.26in"/>
-  
-  <!-- Information for specific renderers -->
-  <!-- Uses renderer mime type for renderers -->
-  <renderers>
-    <renderer mime="application/pdf">
-      <filterList>
-        <!-- provides compression using zlib flate (default is on) -->
-        <value>flate</value>
-      </filterList>
-
-      <fonts>
-        <!-- embedded fonts -->
-       <font embed-url="fonts/OpenSans-Light.ttf">
-         <font-triplet name="Open Sans Light" style="normal"
-                       weight="normal"/>
-       </font>
-       <font embed-url="fonts/OpenSans-LightItalic.ttf">
-         <font-triplet name="Open Sans Light" style="italic"
-                       weight="normal"/>
-       </font>
-       <font embed-url="fonts/OpenSans-Semibold.ttf">
-         <font-triplet name="Open Sans Light" style="normal"
-                       weight="bold"/>
-       </font>
-       <font embed-url="fonts/OpenSans-SemiboldItalic.ttf">
-         <font-triplet name="Open Sans Light" style="italic"
-                       weight="bold"/>
-       </font>
-
-       <font embed-url="fonts/DejaVuSansMono.ttf">
-         <font-triplet name="DejaVu Sans Mono" style="normal"
-                       weight="normal"/>
-       </font>
-       <font embed-url="fonts/DejaVuSansMono-Oblique.ttf">
-         <font-triplet name="DejaVu Sans Mono" style="italic"
-                       weight="normal"/>
-       </font>
-       <font embed-url="fonts/DejaVuSansMono-Bold.ttf">
-         <font-triplet name="DejaVu Sans Mono" style="normal"
-                       weight="bold"/>
-       </font>
-       <font embed-url="fonts/DejaVuSansMono-BoldOblique.ttf">
-         <font-triplet name="DejaVu Sans Mono" style="italic"
-                       weight="bold"/>
-       </font>
-      </fonts>
-    </renderer>
-
-    <renderer mime="image/svg+xml">
-      <format type="paginated"/>
-      <link value="true"/>
-      <strokeText value="false"/>
-    </renderer>
-
-    <renderer mime="text/xml">
-    </renderer>
-
-  </renderers>
-</fop>
-
diff --git a/doc/header.inc b/doc/header.inc
new file mode 100644 (file)
index 0000000..6bc616f
--- /dev/null
@@ -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/images/icons/caution.svg b/doc/images/icons/caution.svg
new file mode 100644 (file)
index 0000000..28babba
--- /dev/null
@@ -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 (file)
index 0000000..4c5baae
--- /dev/null
@@ -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 (file)
index 0000000..92f636c
--- /dev/null
@@ -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 (file)
index 0000000..f645f63
--- /dev/null
@@ -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 (file)
index 0000000..938d7b3
--- /dev/null
@@ -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)
+-->
+
index ccab47954df196807fe3e8fac848cd301d877131..520fb364423faed83c5ef4fb6ed49bc587aa115e 100644 (file)
@@ -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
index 1b39dd6bf7e4cbfc6a794222917cde6b9e093308..f83281769a949ff0dd7884308527b18f40bbfca0 100644 (file)
@@ -1,5 +1,13 @@
 = Loading Map Tiles from Google Maps
+Keith Packard <keithp@keithp.com>
+: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-docinfo.xml b/doc/micropeak-docinfo.xml
deleted file mode 100644 (file)
index 6fab12b..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<subtitle>A recording altimeter for hobby rocketry</subtitle>
-<author>
-  <firstname>Keith</firstname>
-  <surname>Packard</surname>
-  <email>keithp@keithp.com</email>
-</author>
-<copyright>
-  <year>2018</year>
-  <holder>Keith Packard</holder>
-</copyright>
-<mediaobject>
-  <imageobject>
-    <imagedata fileref="micropeak-dime.jpg" width="6in"/>
-  </imageobject>
-</mediaobject>
-<corpauthor>
-  <inlinemediaobject>
-    <imageobject>
-      <imagedata fileref="micropeak-oneline.svg" width="3in"/>
-    </imageobject>
-  </inlinemediaobject>
-</corpauthor>
-<legalnotice>
-  <para>
-    This document is released under the terms of the
-    <ulink url="http://creativecommons.org/licenses/by-sa/3.0/">
-      Creative Commons ShareAlike 3.0
-    </ulink>
-    license.
-  </para>
-</legalnotice>
-<revhistory>
-  <?dbhtml filename="micropeak-revhistory.html"?>
-  <revision>
-    <revnumber>1.8.7</revnumber>
-    <date>8 October 2018</date>
-    <revremark>
-      Poll for MicroPeak USB while the device dialog is open. Fix Mac OS X support.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.8.6</revnumber>
-    <date>6 August 2018</date>
-    <revremark>
-      Report altimeter-recorded maximum height value
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.3.2</revnumber>
-    <date>12 February 2014</date>
-    <revremark>
-      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.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.2</revnumber>
-    <date>20 January 2013</date>
-    <revremark>
-      Add documentation for the MicroPeak USB adapter board. Note
-      the switch to a Kalman filter for peak altitude
-      determination.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.1</revnumber>
-    <date>12 December 2012</date>
-    <revremark>
-      Add comments about EEPROM storage format and programming jig.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.0</revnumber>
-    <date>18 November 2012</date>
-    <revremark>
-      Updates for version 1.0 release.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>0.1</revnumber>
-    <date>29 October 2012</date>
-    <revremark>
-      Initial release with preliminary hardware.
-    </revremark>
-  </revision>
-</revhistory>
index 4b69582708d00a556ee9431f07cec983a8a132cf..b892b24dcf1f1c4a50ea1ea47d77d7776c3d8627 100644 (file)
    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">
   <defs
      id="defs4">
+    <linearGradient
+       id="linearGradient4151">
+      <stop
+         id="stop4153"
+         offset="0"
+         style="stop-color:#da7000;stop-opacity:1;" />
+      <stop
+         style="stop-color:#a63852;stop-opacity:1;"
+         offset="0.15000001"
+         id="stop4159" />
+      <stop
+         style="stop-color:#7200a4;stop-opacity:1;"
+         offset="1"
+         id="stop4157" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient4141">
+      <stop
+         style="stop-color:#7200a4;stop-opacity:1;"
+         offset="0"
+         id="stop4143" />
+      <stop
+         id="stop4149"
+         offset="0.5"
+         style="stop-color:#7200a4;stop-opacity:0.49803922;" />
+      <stop
+         style="stop-color:#7200a4;stop-opacity:0;"
+         offset="1"
+         id="stop4145" />
+    </linearGradient>
     <linearGradient
        id="linearGradient5343">
       <stop
@@ -52,7 +82,7 @@
        style="overflow:visible">
       <path
          id="path3780"
-         d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
          style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
          transform="matrix(-0.2,0,0,-0.2,-1.2,0)"
          inkscape:connector-curvature="0" />
        style="overflow:visible">
       <path
          id="path3768"
-         d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
          style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
          transform="matrix(-0.8,0,0,-0.8,-10,0)"
          inkscape:connector-curvature="0" />
        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)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4151"
+       id="linearGradient4147"
+       x1="320.71625"
+       y1="261.24799"
+       x2="561.98907"
+       y2="261.24799"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.98765434,0,0,0.98765434,6.9381316,3.6077944)" />
   </defs>
   <sodipodi:namedview
      id="base"
      borderopacity="1.0"
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
-     inkscape:zoom="2.8852983"
-     inkscape:cx="243.9235"
-     inkscape:cy="27.872251"
+     inkscape:zoom="2.040214"
+     inkscape:cx="63.523011"
+     inkscape:cy="51.339868"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      showgrid="false"
      inkscape:window-width="1871"
      inkscape:window-height="1383"
-     inkscape:window-x="119"
-     inkscape:window-y="125"
+     inkscape:window-x="0"
+     inkscape:window-y="160"
      inkscape:window-maximized="0"
      fit-margin-top="0"
      fit-margin-left="0"
      inkscape:label="Layer 1"
      inkscape:groupmode="layer"
      id="layer1"
-     transform="translate(-241.93841,-205.0196)">
+     transform="translate(-241.9891,-229.23188)">
     <g
-       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:30.79423141px;line-height:125%;font-family:'Minion Pro';-inkscape-font-specification:'Minion Pro';letter-spacing:0px;word-spacing:0px;fill:#7200a4;fill-opacity:1;stroke:none"
-       id="text2985"
-       transform="translate(23.408014,-22.546654)" />
+       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">
+      <path
+         d="m 266.5354,253.96513 c 0,-1.73676 -0.63682,-3.01039 -2.54726,-3.01039 -1.91044,0 -2.54726,1.27363 -2.54726,3.01039 l 0,13.95203 c 0,4.63137 -3.29986,8.22069 -7.75755,8.22069 -4.92084,0 -6.59972,-3.0104 -6.59972,-8.1628 l 0,-14.00992 c 0,-1.73676 -0.63681,-3.01039 -2.54725,-3.01039 -1.91044,0 -2.54726,1.27363 -2.54726,3.01039 l 0,35.25636 c 0,1.73677 0.63682,3.0104 2.54726,3.0104 1.91044,0 2.54725,-1.27363 2.54725,-3.0104 l 0,-9.89957 c 1.27363,0.98417 3.35775,1.56309 5.73133,1.56309 3.7051,0 7.12075,-1.27363 9.08908,-4.80505 l 0.11579,0.11578 0,2.02623 c 0,1.38941 0.86838,2.31569 2.25779,2.31569 1.38941,0 2.2578,-0.92628 2.2578,-2.31569 l 0,-24.25684"
+         style="line-height:125%;fill:#7200a4;font-family:ITC Benguiat Gothic Std;-inkscape-font-specification:ITC Benguiat Gothic Std Medium"
+         id="path4162" />
+    </g>
     <path
-       style="fill:none;stroke:url(#linearGradient5349);stroke-width:5.58145428;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:none"
-       d="m 294.21061,289.33175 c 5.85134,-0.46986 8.28205,-5.13748 10.35972,-10.71262 3.23453,-8.67942 7.06755,-30.54218 16.59477,-39.56149 7.82712,-7.40985 15.82735,-6.67187 15.82735,-6.67187"
+       style="fill:none;stroke:url(#linearGradient5349);stroke-width:4.59841394;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:none"
+       d="m 265.7162,289.84993 c 4.82076,-0.38711 6.82338,-4.23263 8.53511,-8.82584 2.66483,-7.15075 5.82277,-25.16291 13.67197,-32.59367 6.44857,-6.10479 13.03975,-5.49679 13.03975,-5.49679"
        id="path2991"
        inkscape:connector-curvature="0"
        sodipodi:nodetypes="cssc" />
     <path
        sodipodi:type="star"
-       style="fill:none;stroke:#da7000;stroke-width:2.11710358;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       style="fill:none;stroke:#da7000;stroke-width:1.10000002;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
        id="path5341"
        sodipodi:sides="5"
-       sodipodi:cx="337.23586"
-       sodipodi:cy="232.26813"
-       sodipodi:r1="13.956471"
-       sodipodi:r2="6.9782352"
+       sodipodi:cx="279.29056"
+       sodipodi:cy="261.05426"
+       sodipodi:r1="7.2514729"
+       sodipodi:r2="3.6257365"
        sodipodi:arg1="1.0731354"
        sodipodi:arg2="1.7014539"
        inkscape:flatsided="false"
        inkscape:rounded="0"
        inkscape:randomized="0"
-       d="m 343.89829,244.5317 -7.57159,-5.34482 -8.69538,3.20724 2.74347,-8.85265 -5.73728,-7.27871 9.26715,-0.12642 5.14955,-7.70573 2.98393,8.77452 8.91988,2.51631 -7.42297,5.54937 z"
-       inkscape:transform-center-x="-0.56191834"
-       inkscape:transform-center-y="-0.78695059" />
+       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)" />
     <g
-       id="g4212"
-       style="fill:#78079a;fill-opacity:1">
+       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">
+      <path
+         d="m 339.95106,263.95674 c 3.3388,0 8.26491,-10.67322 9.46907,-13.30048 l 0.10947,0 c 1.64203,8.97645 1.86097,18.06238 1.86097,26.54622 0,2.13464 0.60208,3.3388 2.40831,3.3388 1.64203,0 2.40832,-1.31363 2.40832,-3.3388 0,-7.44388 -1.4231,-23.6453 -2.90093,-30.37763 -0.38314,-1.86097 -1.36836,-4.26929 -3.1746,-4.26929 -3.06512,0 -4.32402,7.17023 -10.18061,15.38039 -5.85658,-8.21016 -7.11548,-15.38039 -10.1806,-15.38039 -1.80624,0 -2.79146,2.40832 -3.1746,4.26929 -1.47783,6.73233 -2.90093,22.93375 -2.90093,30.37763 0,2.02517 0.76628,3.3388 2.40832,3.3388 1.80623,0 2.40831,-1.20416 2.40831,-3.3388 0,-8.48384 0.21894,-17.56977 1.80624,-26.54622 l 0.10947,0 c 1.25889,2.62726 6.185,13.30048 9.52379,13.30048"
+         style=""
+         id="path4165" />
+      <path
+         d="m 368.22997,255.25396 c 0,-1.64203 -0.60209,-2.84619 -2.40832,-2.84619 -1.80624,0 -2.40832,1.20416 -2.40832,2.84619 l 0,22.44113 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,-22.44113 m -2.40832,-12.20579 c -1.7515,0 -2.57252,1.53257 -2.57252,3.1746 0,1.64203 0.82102,3.1746 2.57252,3.1746 1.7515,0 2.57252,-1.53257 2.57252,-3.1746 0,-1.64203 -0.82102,-3.1746 -2.57252,-3.1746"
+         style=""
+         id="path4167" />
+      <path
+         d="m 391.19962,275.88885 c -6.67759,0 -11.98684,-4.15983 -11.98684,-11.49424 0,-5.0903 2.79146,-7.66282 9.57853,-7.66282 l 6.23973,0 c 1.47782,0 2.46305,-0.65682 2.46305,-2.07991 0,-1.4231 -0.98523,-2.07991 -2.46305,-2.07991 l -9.30486,0 c -7.17021,0 -11.65844,5.03558 -11.65844,11.65844 0,9.96166 8.26491,16.14667 15.70879,16.14667 l 6.5134,0 c 1.53256,0 2.62725,-0.71155 2.62725,-2.24412 0,-1.53256 -1.09469,-2.24411 -2.62725,-2.24411 l -5.09031,0"
+         style=""
+         id="path4169" />
+      <path
+         d="m 403.02227,277.69509 c 0,1.64203 0.60208,2.84619 2.40831,2.84619 1.80624,0 2.40832,-1.20416 2.40832,-2.84619 l 0,-14.50463 c 0,-4.26929 3.39354,-6.45867 7.38915,-6.45867 1.7515,0 2.46305,-0.82102 2.46305,-2.35358 0,-1.5873 -1.03995,-2.13465 -2.84619,-2.13465 -3.503,0 -5.85659,1.31363 -6.89654,4.7619 l -0.10947,0 0,-1.5873 c 0,-1.64203 -0.60208,-2.84619 -2.40832,-2.84619 -1.80623,0 -2.40831,1.20416 -2.40831,2.84619 l 0,22.27693"
+         style=""
+         id="path4171" />
+      <path
+         d="m 431.7801,276.54566 c -4.98083,0 -8.31964,-4.7619 -8.31964,-10.07114 0,-5.30923 3.33881,-10.07114 8.31964,-10.07114 5.03556,0 8.37437,4.76191 8.37437,10.07114 0,5.30924 -3.33881,10.07114 -8.37437,10.07114 m 0,4.15982 c 7.44388,0 13.191,-6.185 13.191,-14.28569 0,-7.55335 -5.74712,-14.17623 -13.191,-14.17623 -7.44388,0 -13.13627,6.62288 -13.13627,14.17623 0,8.10069 5.69239,14.28569 13.13627,14.28569"
+         style=""
+         id="path4173" />
+      <path
+         d="m 456.22673,263.84727 c 6.73233,-2.40832 21.18224,-5.03558 21.18224,-14.6141 0,-4.37875 -3.50301,-6.5134 -7.82703,-6.5134 l -15.92773,0 c -1.69677,0 -2.24411,1.09469 -2.24411,2.62725 l 0,32.34807 c 0,1.69676 0.76628,2.84619 2.40831,2.84619 1.64204,0 2.40832,-1.14943 2.40832,-2.84619 l 0,-13.84782 m 12.47946,-16.63928 c 1.9157,0 3.3388,0.65682 3.3388,2.79146 0,4.9261 -10.29009,6.62287 -15.81826,8.92172 l 0,-11.71318 12.47946,0"
+         style=""
+         id="path4175" />
+      <path
+         d="m 485.16159,263.08099 c 0.71154,-3.50301 3.22934,-6.67761 8.48384,-6.67761 4.43348,0 7.22495,2.8462 7.44388,6.67761 l -15.92772,0 m 18.06237,3.72194 c 2.62725,0 2.68199,-0.60208 2.68199,-2.90093 0,-6.89653 -5.41872,-11.65844 -12.20579,-11.65844 -8.15542,0 -13.90255,5.58293 -13.90255,13.79309 0,9.63325 6.07553,14.34043 13.30047,14.34043 l 10.50902,0 c 1.47783,0 2.46305,-0.65682 2.46305,-2.07991 0,-1.4231 -0.98522,-2.07991 -2.46305,-2.07991 l -10.39955,0 c -4.48822,0 -8.64804,-3.06514 -8.2649,-9.41433 l 18.28131,0"
+         style=""
+         id="path4177" />
+      <path
+         d="m 527.28745,270.52487 c 0,4.7619 -2.68199,6.45867 -7.22495,6.45867 -4.10508,0 -6.45867,-1.47783 -6.45867,-4.7619 0,-5.14503 7.38916,-6.6776 13.68362,-6.6776 l 0,4.98083 m -4.43349,-13.46467 c 3.3388,0 4.43349,0.76628 4.43349,3.11986 l 0,1.64203 c -7.06074,0.43788 -18.50025,1.0947 -18.50025,10.61849 0,5.19977 4.4335,8.2649 10.50902,8.2649 3.72194,0 5.47345,-0.98522 8.31964,-3.11986 0,1.7515 0.71155,2.79146 2.24411,2.79146 1.53256,0 2.24411,-1.03996 2.24411,-2.79146 l 0,-15.16145 c 0,-4.87136 -1.31363,-9.8522 -8.53857,-9.8522 l -10.12588,0 c -1.5873,0 -2.62725,0.71155 -2.62725,2.24411 0,1.53257 1.03995,2.24412 2.62725,2.24412 l 9.41433,0"
+         style=""
+         id="path4179" />
       <path
-         inkscape:connector-curvature="0"
-         id="path4233"
-         style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:69.28701782px;line-height:125%;font-family:'ITC Benguiat Gothic Std';-inkscape-font-specification:'ITC Benguiat Gothic Std Medium';letter-spacing:0px;word-spacing:0px;fill:#78079a;fill-opacity:1;stroke:none;text-align:start;writing-mode:lr-tb;text-anchor:start"
-         d="m 271.3161,268.77261 c 0,-2.07861 -0.76216,-3.60293 -3.04863,-3.60293 -2.28647,0 -3.04863,1.52432 -3.04863,3.60293 l 0,16.69817 c 0,5.54296 -3.94936,9.83875 -9.28446,9.83875 -5.88939,0 -7.89872,-3.60292 -7.89872,-9.76946 l 0,-16.76746 c 0,-2.07861 -0.76215,-3.60293 -3.04862,-3.60293 -2.28648,0 -3.04863,1.52432 -3.04863,3.60293 l 0,42.19579 c 0,2.07861 0.76215,3.60293 3.04863,3.60293 2.28647,0 3.04862,-1.52432 3.04862,-3.60293 l 0,-11.84808 c 1.52432,1.17788 4.01865,1.87075 6.85942,1.87075 4.43437,0 8.5223,-1.52431 10.87806,-5.75082 l 0.13857,0.13857 0,2.42505 c 0,1.66289 1.03931,2.77148 2.7022,2.77148 1.66289,0 2.70219,-1.10859 2.70219,-2.77148 l 0,-29.03126 z"
-         transform="translate(23.40801,-22.54665)" />
-      <g
-         style="fill:#78079a;fill-opacity:1"
-         id="g4200">
-        <path
-           style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:medium;line-height:125%;font-family:'ITC Benguiat Gothic Std';-inkscape-font-specification:'ITC Benguiat Gothic Std Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#78079a;fill-opacity:1;stroke:none"
-           inkscape:connector-curvature="0"
-           id="path4236"
-           d="m 380.37736,256.92285 c 4.28006,0 10.5949,-13.68217 12.13853,-17.05008 l 0.14033,0 c 2.10495,11.50705 2.38561,23.15443 2.38561,34.02999 0,2.73644 0.77182,4.28007 3.08726,4.28007 2.10495,0 3.08726,-1.68396 3.08726,-4.28007 0,-9.54243 -1.82429,-30.31125 -3.71875,-38.94154 -0.49115,-2.38561 -1.75412,-5.47287 -4.06956,-5.47287 -3.92924,0 -5.54303,9.19161 -13.05068,19.71635 -7.50765,-10.52474 -9.12145,-19.71635 -13.05068,-19.71635 -2.31545,0 -3.57842,3.08726 -4.06957,5.47287 -1.89445,8.63029 -3.71874,29.39911 -3.71874,38.94154 0,2.59611 0.98231,4.28007 3.08726,4.28007 2.31544,0 3.08725,-1.54363 3.08725,-4.28007 0,-10.87556 0.28066,-22.52294 2.31545,-34.02999 l 0.14033,0 c 1.61379,3.36791 7.92864,17.05008 12.2087,17.05008 z" />
-        <path
-           style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:medium;line-height:125%;font-family:'ITC Benguiat Gothic Std';-inkscape-font-specification:'ITC Benguiat Gothic Std Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#78079a;fill-opacity:1;stroke:none"
-           inkscape:connector-curvature="0"
-           id="path4238"
-           d="m 416.62852,245.76662 c 0,-2.10495 -0.77182,-3.64858 -3.08726,-3.64858 -2.31544,0 -3.08726,1.54363 -3.08726,3.64858 l 0,28.76763 c 0,2.10495 0.77182,3.64858 3.08726,3.64858 2.31544,0 3.08726,-1.54363 3.08726,-3.64858 l 0,-28.76763 z m -3.08726,-15.64678 c -2.24528,0 -3.29775,1.96462 -3.29775,4.06956 0,2.10495 1.05247,4.06957 3.29775,4.06957 2.24528,0 3.29775,-1.96462 3.29775,-4.06957 0,-2.10494 -1.05247,-4.06956 -3.29775,-4.06956 z" />
-        <path
-           style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:medium;line-height:125%;font-family:'ITC Benguiat Gothic Std';-inkscape-font-specification:'ITC Benguiat Gothic Std Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#78079a;fill-opacity:1;stroke:none"
-           inkscape:connector-curvature="0"
-           id="path4240"
-           d="m 446.07368,272.21881 c -8.56013,0 -15.36613,-5.33254 -15.36613,-14.73464 0,-6.52534 3.57842,-9.8231 12.27887,-9.8231 l 7.9988,0 c 1.89446,0 3.15743,-0.84197 3.15743,-2.66626 0,-1.82429 -1.26297,-2.66627 -3.15743,-2.66627 l -11.92804,0 c -9.19161,0 -14.94513,6.45517 -14.94513,14.94513 0,12.77002 10.59491,20.69866 20.13734,20.69866 l 8.34963,0 c 1.96462,0 3.36791,-0.91214 3.36791,-2.87676 0,-1.96462 -1.40329,-2.87676 -3.36791,-2.87676 l -6.52534,0 z" />
-        <path
-           style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:medium;line-height:125%;font-family:'ITC Benguiat Gothic Std';-inkscape-font-specification:'ITC Benguiat Gothic Std Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#78079a;fill-opacity:1;stroke:none"
-           inkscape:connector-curvature="0"
-           id="path4242"
-           d="m 461.22931,274.53425 c 0,2.10495 0.77181,3.64858 3.08725,3.64858 2.31545,0 3.08726,-1.54363 3.08726,-3.64858 l 0,-18.59371 c 0,-5.47287 4.35023,-8.27947 9.47227,-8.27947 2.24528,0 3.15742,-1.05247 3.15742,-3.01709 0,-2.03478 -1.33313,-2.73643 -3.64858,-2.73643 -4.49055,0 -7.50764,1.68396 -8.84078,6.10435 l -0.14033,0 0,-2.03478 c 0,-2.10495 -0.77181,-3.64858 -3.08726,-3.64858 -2.31544,0 -3.08725,1.54363 -3.08725,3.64858 l 0,28.55713 z" />
-        <path
-           style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:medium;line-height:125%;font-family:'ITC Benguiat Gothic Std';-inkscape-font-specification:'ITC Benguiat Gothic Std Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#78079a;fill-opacity:1;stroke:none"
-           inkscape:connector-curvature="0"
-           id="path4244"
-           d="m 498.09441,273.06079 c -6.38501,0 -10.66507,-6.10435 -10.66507,-12.91035 0,-6.806 4.28006,-12.91036 10.66507,-12.91036 6.45518,0 10.73524,6.10436 10.73524,12.91036 0,6.806 -4.28006,12.91035 -10.73524,12.91035 z m 0,5.33253 c 9.54243,0 16.90975,-7.92864 16.90975,-18.31305 0,-9.68276 -7.36732,-18.17272 -16.90975,-18.17272 -9.54243,0 -16.83959,8.48996 -16.83959,18.17272 0,10.38441 7.29716,18.31305 16.83959,18.31305 z" />
-        <path
-           style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:medium;line-height:125%;font-family:'ITC Benguiat Gothic Std';-inkscape-font-specification:'ITC Benguiat Gothic Std Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#78079a;fill-opacity:1;stroke:none"
-           inkscape:connector-curvature="0"
-           id="path4246"
-           d="m 529.43293,256.78252 c 8.63029,-3.08726 27.15383,-6.45518 27.15383,-18.73404 0,-5.6132 -4.49055,-8.34963 -10.03358,-8.34963 l -20.418,0 c -2.17512,0 -2.87677,1.4033 -2.87677,3.36792 l 0,41.46748 c 0,2.17511 0.98231,3.64858 3.08726,3.64858 2.10495,0 3.08726,-1.47347 3.08726,-3.64858 l 0,-17.75173 z m 15.99761,-21.33015 c 2.45577,0 4.28006,0.84198 4.28006,3.57842 0,6.31484 -13.19101,8.48995 -20.27767,11.43688 l 0,-15.0153 15.99761,0 z" />
-        <path
-           style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:medium;line-height:125%;font-family:'ITC Benguiat Gothic Std';-inkscape-font-specification:'ITC Benguiat Gothic Std Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#78079a;fill-opacity:1;stroke:none"
-           inkscape:connector-curvature="0"
-           id="path4248"
-           d="m 566.52497,255.80021 c 0.91214,-4.49056 4.13973,-8.56013 10.87556,-8.56013 5.68336,0 9.26178,3.64858 9.54244,8.56013 l -20.418,0 z m 23.15443,4.77121 c 3.36792,0 3.43808,-0.77181 3.43808,-3.71874 0,-8.84078 -6.94633,-14.94513 -15.64678,-14.94513 -10.45458,0 -17.8219,7.15682 -17.8219,17.68157 0,12.34903 7.78831,18.38321 17.05008,18.38321 l 13.47167,0 c 1.89446,0 3.15743,-0.84198 3.15743,-2.66627 0,-1.82428 -1.26297,-2.66626 -3.15743,-2.66626 l -13.33134,0 c -5.75352,0 -11.08606,-3.92924 -10.5949,-12.06838 l 23.43509,0 z" />
-        <path
-           style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:medium;line-height:125%;font-family:'ITC Benguiat Gothic Std';-inkscape-font-specification:'ITC Benguiat Gothic Std Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#78079a;fill-opacity:1;stroke:none"
-           inkscape:connector-curvature="0"
-           id="path4250"
-           d="m 620.52676,265.34264 c 0,6.10435 -3.43809,8.27947 -9.26178,8.27947 -5.26237,0 -8.27946,-1.89446 -8.27946,-6.10436 0,-6.5955 9.47227,-8.56012 17.54124,-8.56012 l 0,6.38501 z m -5.68336,-17.26058 c 4.28006,0 5.68336,0.98231 5.68336,3.99941 l 0,2.10494 c -9.05128,0.56132 -23.71576,1.4033 -23.71576,13.612 0,6.66567 5.68336,10.59491 13.47167,10.59491 4.77122,0 7.0165,-1.26297 10.66508,-3.9994 0,2.24528 0.91214,3.57841 2.87676,3.57841 1.96462,0 2.87676,-1.33313 2.87676,-3.57841 l 0,-19.43569 c 0,-6.24468 -1.68396,-12.62969 -10.94573,-12.62969 l -12.98052,0 c -2.03478,0 -3.36791,0.91214 -3.36791,2.87676 0,1.96462 1.33313,2.87676 3.36791,2.87676 l 12.06838,0 z" />
-        <path
-           style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:medium;line-height:125%;font-family:'ITC Benguiat Gothic Std';-inkscape-font-specification:'ITC Benguiat Gothic Std Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#78079a;fill-opacity:1;stroke:none"
-           inkscape:connector-curvature="0"
-           id="path4252"
-           d="m 635.47191,274.53425 c 0,2.10495 0.77181,3.64858 3.08725,3.64858 2.31545,0 3.08726,-1.54363 3.08726,-3.64858 l 0,-17.19041 c 11.71755,1.61379 15.50645,5.33253 17.19041,17.26057 0.28066,1.96462 0.56132,3.57842 3.0171,3.57842 2.03478,0 3.15742,-1.05248 3.15742,-3.29776 0,-7.9988 -4.13973,-17.19041 -12.27887,-19.64618 l 0,-0.14033 c 3.92924,-1.33313 9.6126,-5.89386 9.6126,-10.45458 0,-1.54363 -1.05247,-2.8066 -2.24528,-2.8066 -2.31544,0 -2.8066,1.6138 -5.05187,4.77122 -2.52594,3.71874 -7.29716,6.24468 -11.92805,6.24468 l -1.47346,0 0,-19.71635 c 0,-2.10495 -0.77181,-3.64858 -3.08726,-3.64858 -2.31544,0 -3.08725,1.54363 -3.08725,3.64858 l 0,41.39732 z" />
-      </g>
+         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" />
     </g>
   </g>
 </svg>
index d5036a00674708648e459d98a5540972e4c3195d..9569194ee8b25312f20a8cf48c891061f78d31d3 100644 (file)
@@ -1,6 +1,18 @@
 = MicroPeak Owner's Manual
+Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>
+: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
 
                * 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
                  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
                  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
                ==== 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
                ==== 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
                ==== 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.
                ==== 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
        === 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 (file)
index 0000000..0dbdfc2
--- /dev/null
@@ -0,0 +1,7 @@
+:toc!:
+:doctype: article
+:stylesheet: am-notoc.css
+:linkcss:
+:pdf-stylesdir: .
+:pdf-style: altusmetrum
+:pdf-fontsdir: fonts
index 8ce49f0aa67bd328304cd62f4fa223e446a57577..c253e8121672edf60afd789f5290df0f6d1408e8 100644 (file)
@@ -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
index 38230593b9549b0bed94f3b27bc985fceacdcbee..3ff70c90b053b6f90cc0cade1a2049eff3e9b616 100644 (file)
@@ -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
index b7c55bb291473553cc421eb929d91705c595cbae..9c373c2f03b0b65091c866ad6f95cb103a2a1c76 100644 (file)
@@ -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
index 0ee7ea51e94dcc09c77f2cb6fa16076ad1db5e1c..a42a18d8098d0ff5f6fa98e306ac0c8883585924 100644 (file)
@@ -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
index 067727e9ee737bdbbaf97cd27d8be1832b4f0a00..fac31d7f2d4cbac2c8c15fd962c88e5c4fd1a561 100644 (file)
@@ -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
index 2e61bfec740f7cf464a8c23d1c2b748024ae421d..2cc30aa87af889d05b6be451802e27e18aafe9cb 100644 (file)
@@ -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
index b3ea066d3975507bc32ab61dd98ce6fa2b416ecb..f7283ce4872f912744cdd9eefd4793cc29f0b9ac 100644 (file)
@@ -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
index 18c5d7e2d9874120bccdc872e972caa7007c16be..f60b8e74089177f6777a64244eb076af96b0a51b 100644 (file)
@@ -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
index 42afad040c187983c00f1147c1fbe495263d09b1..f0c2615a9439d00828e8bb2bb162944b83a32e2e 100644 (file)
@@ -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
index ff9c8e52f193e89663db7238f163fd63a1447e50..dc9eac87e35ed30e014200077984c76dbd08809e 100644 (file)
@@ -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
index dae5dd99c944f08464e7629e2d54c9c613ae31e1..7e0f57d60b2c75341b7ee0f2e4fe9faddcf6161e 100644 (file)
@@ -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
index ceb677a10896ea21083bc2fbbc332037e808feb2..b53354acc69b1662a2dc412be2728578c986f030 100644 (file)
@@ -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,
index 5e3e831eef92d622d4c7304d28854a351823cb9e..0d9c5350767b1cb1c00193c70154ac8538db98b6 100644 (file)
@@ -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
index ded6b4088db63576d16b59a00f284f8f031a6d68..059b8b958b581388c5cf45cee2ecca0cef545d0a 100644 (file)
@@ -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
index f4ab9ad21bee02f0d42211a92604cb7e8fd5bf05..163aee0c860d57da316aceac55f042a4c48cfe9f 100644 (file)
@@ -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
index 8d72c0e0c31934fe1b4145591a379f7a546e0310..67cf1721d8b2f22238b0fa38b91b592901ed8e85 100644 (file)
@@ -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
index 1e03ed4fc9c3c8ad34ecc9e94bd9188d143614b4..8fb905704a9d22eb1691d87f28667441026ebdf8 100644 (file)
@@ -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
index 990eb48f229e5ec96a2c58acdc5ae20d34cd9ed3..95466bf73f0f602ef557868ea754625a8914019f 100644 (file)
@@ -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
index 6aa7704228adc59380a491fcd4300523789ca47e..97946db76ef14c8043731862da19b7dc53c41981 100644 (file)
@@ -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
index f976a69dbd83282c5489a82ef093c5d3be198852..f0c7a59d650220048cd770dfaacc6b61abe08111 100644 (file)
@@ -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
index 9f3ae28177c9cce8e28fba8b6cac72647873eaf9..538c4db37311cdf493e8e1e151847564a2b3dc81 100644 (file)
@@ -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
index 8e37fe6933443bfd66976f0a5f9c23c3cb4038e4..7b122425853539fa4db10ee15f9201db952efd22 100644 (file)
@@ -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
index 0908dfaf542fc422b2f7953cbe19a115368391c4..adbded5218ca483ca8f2588a3a3860be14d95bde 100644 (file)
@@ -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
index f2da71f37e7aba73cc1e354bda4451771bf9bfeb..b6ed7881337b359670e8af71b9895ea8f415df04 100644 (file)
@@ -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
index d9e4a2d928a96fbd06237c26553149ea857e7521..dc02b3a111be04fdb346d1e73d75ea555f3f01cf 100644 (file)
@@ -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
index 2923ec11f6629e6820f285cc8a0913a23947ef51..cbc77bbab080cc5af1fe58acf565f7f7f0cfe04f 100644 (file)
@@ -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
index 4bc879ad6a9ae9ec33e73d56807d8dbc69c7bfe1..ef056f011d77a287acd27bea95ebeafeafccfccf 100644 (file)
@@ -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
index f8cb4f11849d5aec6052fd490fc3317dffa722c9..9a8657b3a05cace7915781a38578ebf93315fa29 100644 (file)
@@ -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
index 5b940efd73be3c075b60830d9a6d459d723576c6..07d911c129034e6ccfc7299e8af4f8c99c0c4bb3 100644 (file)
@@ -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
index 1467977ca5f82451fa09f3bec513f00bca009967..5c066b80bd64d9d877e9f547562cf20bcfb1c048 100644 (file)
@@ -1,5 +1,5 @@
 = Release Notes for Version 1.8.6
-:toc!:
+include::release-head.adoc[]
 :doctype: article
 
        Version 1.8.6
index f8b7b1032991677d38c5f268568ae6886d14897e..2e387adba1317dbfc92d4358220c7cde82175dc1 100644 (file)
@@ -1,5 +1,5 @@
 = Release Notes for Version 1.8.7
-:toc!:
+include::release-head.adoc[]
 :doctype: article
 
        Version 1.8.7
index 0255c16b5e9b6ec85c6f53ea91f99a3af479fca0..0c97abb4850e6382b6286f24a2086dc8e24de22d 100644 (file)
@@ -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-1.9.inc b/doc/release-notes-1.9.inc
new file mode 100644 (file)
index 0000000..db53853
--- /dev/null
@@ -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
+       
index 1183fd122a172abf753e1065c32344d6c32c8734..3ff1942b4a9ccd8279a9d957dddbbbe2ee40da8c 100644 (file)
 [appendix]
 == Release Notes
        :leveloffset: 2
-       include::release-notes-1.8.7.raw[]
+       include::release-notes-1.9.adoc[]
 
        <<<<
        :leveloffset: 2
-       include::release-notes-1.8.6.raw[]
+       include::release-notes-1.8.7.adoc[]
 
        <<<<
        :leveloffset: 2
-       include::release-notes-1.8.5.raw[]
+       include::release-notes-1.8.6.adoc[]
 
        <<<<
        :leveloffset: 2
-       include::release-notes-1.8.4.raw[]
+       include::release-notes-1.8.5.adoc[]
+
+       <<<<
+       :leveloffset: 2
+       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
index 1b7ea74b3ef3f160849c1294173123076dd95b06..48d73f96475c63cba38d61a45f45d1bf01ba3a81 100644 (file)
@@ -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')
        |8MB
        |40mW
        |3.7V
-       endif::telemega[]
 
+       endif::telemega[]
        ifdef::easymega[]
        |EasyMega v1.0
        |MS5607 30km (100k')
        |8MB
        |-
        |3.7V
+
+       |EasyMega v2.0
+       |MS5607 30km (100k')
+       |ADXL375 200g
+       |-
+       |MPU9250
+       |8MB
+       |-
+       |3.7V
        endif::easymega[]
 
-       |==============================
+       |===
 
        <<<<
        .Altus Metrum Flight Computer Mechanical Components
        [options="header",grid="all"]
-       |==============================
+       |===
        |Device|Connectors|Screw Terminals|Width|Length|Tube Size
 
        ifdef::telemetrum[]
        |38mm coupler
        endif::easymega[]
 
-       |====================================
+       |===
index 17dfdf89106f43d33edb1391b05fdf8951c9d4d1..1e130976bcfc38ce33d88b1dd1e3ba529fd34744 100644 (file)
        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
index 3e6b385ed64509ce6d636b49ae4ddc885813204b..668595be039cf6987142970e105b1472281f3330 100644 (file)
@@ -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
 
                        received telemetry from it.
        
                        .TeleGPS Status View
-                       image::telegps-status.png[width="5.5in"]
+                       image::telegps-status.png[width=400]
 
                ==== Table
 
                        the GPS receiver
        
                        .TeleGPS Information Table
-                       image::telegps-table.png[width="5.5in"]
+                       image::telegps-table.png[width=400]
 
        === TeleGPS Menus
 
                ==== 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
                ==== 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
                        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
 
                received by the selected TeleDongle device.
        
                .Device Selection Dialog
-               image::device-selection.png[width="3.1in"]
+               image::device-selection.png[width=300]
 
        === Disconnect
 
        === 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
        === 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.
 
                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-docinfo.xml b/doc/telegps-docinfo.xml
deleted file mode 100644 (file)
index 4d3533d..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-<subtitle>An Owner's Manual for the TeleGPS recording GPS tracker</subtitle>
-<author>
-  <firstname>Bdale</firstname>
-  <surname>Garbee</surname>
-  <email>bdale@gag.com</email>
-</author>
-<author>
-  <firstname>Keith</firstname>
-  <surname>Packard</surname>
-  <email>keithp@keithp.com</email>
-</author>
-<copyright>
-  <year>2018</year>
-  <holder>Bdale Garbee and Keith Packard</holder>
-</copyright>
-<mediaobject>
-  <imageobject>
-    <imagedata fileref="telegps-v1.0-top.jpg" width="4.0in"/>
-  </imageobject>
-</mediaobject>
-<corpauthor>
-  <inlinemediaobject>
-    <imageobject>
-      <imagedata fileref="telegps-oneline.svg" width="3in"/>
-    </imageobject>
-  </inlinemediaobject>
-</corpauthor>
-
-<legalnotice>
-  <para>
-    This document is released under the terms of the
-    <ulink url="http://creativecommons.org/licenses/by-sa/3.0/">
-      Creative Commons ShareAlike 3.0
-    </ulink>
-    license.
-  </para>
-</legalnotice>
-<revhistory>
-  <?dbhtml filename="telegps-revhistory.html"?>
-  <revision>
-    <revnumber>1.8.7</revnumber>
-    <date>08 Oct 2018</date>
-    <revremark>
-      Fix TeleBT v4.0 RF calibration to factory value when
-      reflashing. Fix map images. Fix Mac OS X support.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.8.3</revnumber>
-    <date>11 Dec 2017</date>
-    <revremark>
-      New graphing features. Improve reliability of data
-      download. Update KML export to satisfy Tripoli Records board
-      requirements.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.6.4</revnumber>
-    <date>10 May 2016</date>
-    <revremark>
-      Minor release fixing TeleBT v1.0 flow control and a few minor
-      application bugs.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.6.1</revnumber>
-    <date>15 July 2015</date>
-    <revremark>
-      Minor release adding TeleBT v3.0 support.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.6</revnumber>
-    <date>8 January 2015</date>
-    <revremark>
-      Major release adding TeleDongle v3.0 support.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.5</revnumber>
-    <date>6 September 2014</date>
-    <revremark>
-      Major release adding EasyMega support.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.4.2</revnumber>
-    <date>17 August 2014</date>
-    <revremark>
-      Minor release fixing some Windows installation bugs.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.4.1</revnumber>
-    <date>20 June 2014</date>
-    <revremark>
-      Minor release fixing some installation bugs.
-    </revremark>
-  </revision>
-  <revision>
-    <revnumber>1.4</revnumber>
-    <date>15 June 2014</date>
-    <revremark>
-      Initial version
-    </revremark>
-  </revision>
-</revhistory>
index bd1495beaeb643e5ba9096c978042f33eec17fca..ca10d124e8c75b1432384d56c0c9f4df4587ad0c 100644 (file)
@@ -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
index 9c1353f8413287fe724052175bfc163ee5961bbd..ec1135cbd0d83bcc7a174ed603f1281eca0f4c99 100644 (file)
@@ -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[]
index c9fce7f0d4f1857d6a94704b784cb290ef111473..e788bc7cc009556dc3f814d995ebdd849279e49f 100644 (file)
@@ -21,7 +21,7 @@
       
        :aprsdevices: TeleGPS
        :configure_section: _configure_device
-       include::aprs-operation.raw[]
+       include::aprs-operation.adoc[]
 
        === Configurable Parameters
 
index 47eafe37216a6ac01a1b94863116be332ca53264..8b558dbd27a7a3606b93da731f9f21e48f4efd46 100644 (file)
@@ -1,25 +1,39 @@
 = TeleGPS Owner's Manual
+Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>
+: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[]
index 1af918942124920dfd4f0461d5b80784ea698707..7b1d926996428f7b0ce24d39eca828d5f474c56a 100644 (file)
@@ -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
index 55f77bc48771d6db476df1adb85c4325cdd0378e..0975172f6c6f189dd5ba55f72b3079938eb382a7 100644 (file)
@@ -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,
index ab6871f93c2562b5b8763bd4d4120a21757cb9d5..f37fed7498dae6d2b922f39797527e73a5b8e1bc 100644 (file)
@@ -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
index 7c9dadb58e9c2a4488b1a0881b373b1704795f57..35aec6cc9fd0a3d99d1bb840392eecadbfb9892e 100644 (file)
@@ -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-docinfo.xml b/doc/telemetry-docinfo.xml
deleted file mode 100644 (file)
index 19f90ca..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<subtitle>Packet Definitions</subtitle>
-<author>
-  <firstname>Keith</firstname>
-  <surname>Packard</surname>
-  <email>keithp@keithp.com</email>
-</author>
-<date>1 July 2011</date>
-<copyright>
-  <year>2011</year>
-  <holder>Keith Packard</holder>
-</copyright>
-<legalnotice>
-  <para>
-    This document is released under the terms of the
-    <ulink url="http://creativecommons.org/licenses/by-sa/3.0/">
-      Creative Commons ShareAlike 3.0
-    </ulink>
-    license.
-  </para>
-</legalnotice>
-<revhistory>
-  <?dbhtml filename="telemetry-revhistory.html"?>
-  <revision>
-    <revnumber>0.1</revnumber>
-    <date>1 July 2011</date>
-    <revremark>Initial content</revremark>
-  </revision>
-</revhistory>
index d7399b6a5fbd99a8e8b8bd5bb6ae8418846fac63..ae9c7f9f191d8cfe02e095b24cd24017d602fbd1 100644 (file)
@@ -1,7 +1,18 @@
 = AltOS Telemetry
+Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>
+: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
 
index bce3f651817b49f6ae910b62823836879f895a1f..e331cf8dd5f47276f1953480a07a728b26105579 100644 (file)
@@ -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
index bb26ed6e42330226bd5fd17e6d227499e1b32d0e..57a738ebb6d51d714530b06cc7066f335bf19820 100644 (file)
@@ -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
index 08893dfba63da04f11c3362f6e3684968846502b..b7b26a8a261999726fa8c976bd9f4a1b05fc2a87 100644 (file)
@@ -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
                power switch.
 
                .TeleMini v1 Board
-               image::telemini-v1-top.jpg[width="5.5in"]
+               image::telemini-v1-top.jpg[width=400]
 
diff --git a/doc/titlepage.templates.tmpl b/doc/titlepage.templates.tmpl
deleted file mode 100644 (file)
index f437fb7..0000000
+++ /dev/null
@@ -1,1587 +0,0 @@
-<!DOCTYPE t:templates [
-<!ENTITY hsize0 "10pt">
-<!ENTITY hsize1 "12pt">
-<!ENTITY hsize2 "14.4pt">
-<!ENTITY hsize3 "17.28pt">
-<!ENTITY hsize4 "20.736pt">
-<!ENTITY hsize5 "24.8832pt">
-<!ENTITY hsize0space "7.5pt"> <!-- 0.75 * hsize0 -->
-<!ENTITY hsize1space "9pt"> <!-- 0.75 * hsize1 -->
-<!ENTITY hsize2space "10.8pt"> <!-- 0.75 * hsize2 -->
-<!ENTITY hsize3space "12.96pt"> <!-- 0.75 * hsize3 -->
-<!ENTITY hsize4space "15.552pt"> <!-- 0.75 * hsize4 -->
-<!ENTITY hsize5space "18.6624pt"> <!-- 0.75 * hsize5 -->
-]>
-<t:templates xmlns:t="http://nwalsh.com/docbook/xsl/template/1.0"
-            xmlns:param="http://nwalsh.com/docbook/xsl/template/1.0/param"
-             xmlns:fo="http://www.w3.org/1999/XSL/Format"
-             xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
-<!-- ********************************************************************
-     $Id: titlepage.templates.xml 9722 2013-02-01 19:44:13Z bobstayton $
-     ********************************************************************
-
-     This file is part of the DocBook XSL Stylesheet distribution.
-     See ../README or http://docbook.sf.net/ for copyright
-     copyright and other information.
-
-     ******************************************************************** -->
-
-<!-- ==================================================================== -->
-
-<t:titlepage t:element="article" t:wrapper="fo:block"
-             font-family="{$title.fontset}">
-
-  <t:titlepage-content t:side="recto"
-            start-indent="0pt"
-             text-align="center">
-
-    <mediaobject space-before="1em"/>
-
-    <title t:named-template="component.title"
-          param:node="ancestor-or-self::article[1]"
-          keep-with-next.within-column="always"
-          font-size="&hsize5;"
-          font-weight="bold"/>
-
-    <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>
index 91aa58f2b3309c87cc00edc79da6362f61c211e3..ee2f5e9a340b8fb83ed5876bd4141eb19470fdb3 100644 (file)
        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
                        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:
index 1969529f4e59f4c80afeb72706baa2f5d402a503..1c1ff10eccbbd08a7f76a3026af01c12343d5830 100644 (file)
@@ -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[]
 
 
index af238ac42527da025ff403481c046ba58146b0b7..6efe3ecf4f688bfdf3d76de4586c5936a0dd78c6 100644 (file)
@@ -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 (file)
index bb6005c..0000000
Binary files a/icon/grayled.png and /dev/null differ
diff --git a/icon/grayon.png b/icon/grayon.png
deleted file mode 100644 (file)
index c99b376..0000000
Binary files a/icon/grayon.png and /dev/null differ
diff --git a/icon/greenled.png b/icon/greenled.png
deleted file mode 100644 (file)
index d766396..0000000
Binary files a/icon/greenled.png and /dev/null differ
diff --git a/icon/greenoff.png b/icon/greenoff.png
deleted file mode 100644 (file)
index c3cf849..0000000
Binary files a/icon/greenoff.png and /dev/null differ
diff --git a/icon/led.5c b/icon/led.5c
new file mode 100644 (file)
index 0000000..cdbcdc7
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+/*
+ * 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 (file)
index 230afae..0000000
Binary files a/icon/redled.png and /dev/null differ
diff --git a/icon/redoff.png b/icon/redoff.png
deleted file mode 100644 (file)
index a251402..0000000
Binary files a/icon/redoff.png and /dev/null differ
index 38b07f0e27eab6d463a9b62e97346e8f7d5c96da..4d02dbd867f18c6e6b4c96e4ec37ed4eb56601b8 100644 (file)
@@ -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/pdclib b/pdclib
deleted file mode 160000 (submodule)
index 20f71c3..0000000
--- a/pdclib
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 20f71c3a97eb4c7ecfa9754a0ca42855db935999
index a52f96fa5d25898977f597aec057d75d69bf54f1..b87e88465a3b5f137fcad54f76daa49219e20daf 100644 (file)
@@ -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@
index a1ff84c29cd6cffc00b07e5068354bfee46e3ead..757641f7ec32c609321930e3ba520d4e32f4c713 100644 (file)
@@ -16,16 +16,9 @@ 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 \
+       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 \
@@ -59,15 +52,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 +66,7 @@ ifeq ($(strip $(HAVE_AVR_CC)),yes)
 SUBDIRS += $(AVRDIRS)
 endif
 
-ALLDIRS=$(SDCCDIRS) $(ARMM3DIRS) $(ARMM0DIRS) $(AVRDIRS)
+ALLDIRS=$(ARMM3DIRS) $(ARMM0DIRS) $(AVRDIRS)
 
 all: all-local all-recursive
 
@@ -133,11 +117,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
index fd90c5bf3ee03fa0c3435db43e5a4d3fea043b31..0bc8188e3d2ae68c7eca2b78a214b473ce34b712 100644 (file)
@@ -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;
index 68f5702d78e104293bf0b853b91dcf383f768035..dfd41afe2ec90dba9d5decdc51f7f340101fc714 100644 (file)
 
 #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))
 #define ao_arch_naked_define
-#define __pdata
-#define __data
-#define __xdata
-#define __code const
-#define __reentrant
-#define __critical
 #define __interrupt(n)
 #define __at(n)
 
@@ -53,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)
index 0b67a407afecd7da2a261d3f602b406e645a5983..69b259d9419c34b6c8c24951605f03a8a82dc070 100644 (file)
                (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
  * 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)
 
 
 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;
 
index f29ed6a9c7e33c727f0ce5e196ee3b21d7ac502c..34185b5a28c2cba72a6e17776eb535ece8db523d 100644 (file)
@@ -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
deleted file mode 100644 (file)
index 5f53129..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include "ao.h"
-
-__pdata 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) __reentrant
-{
-       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 (file)
index 0000000..cd620f4
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2009 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#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;
+}
index f63eb651286cbafb6b7f6d7694ee5d7d9bcbe9f3..1c90ad56082326a9981aef4f538f1584159ab6fc 100644 (file)
@@ -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;
 
index e21ad0471ea85465d89838c267830ab70fc6d0f8..0aca6f8af6252447d07224cd660646fbfd432650 100644 (file)
@@ -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
 
index 2732c4dbe9635bd38b55fd12154ecd27d21b9a46..2aae95ace70054fb14a14ac83868fad43f9569f6 100644 (file)
@@ -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 },
 };
index 2b1da642ad5de023bcaf0cdff19c9f4b6fc88c4e..6166c50e67f489fddae53c10b1182349adad1e71 100644 (file)
 
 #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)
 
index 891ad9b18c374e9b615ac549bdf32a8aaf668e7e..f2a58af017282534b2071ed37e914a4fb106e2a7 100644 (file)
@@ -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);    \
@@ -32,12 +32,12 @@ extern __xdata 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 __xdata 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,17 +59,17 @@ extern __xdata 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)
 
 
 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)
index 2fdf177b6350451f72e0d1175217018c22995daa..84942cd78f6c1ab2fe57d246bf8fe85dd31ac491 100644 (file)
 #include <ao_storage.h>
 
 /* 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");
 }
index c95548d4a9853aecea9a94ee286c5da5e82e4193..67bee339d28732adc8523fc3101dc98ec3f45b07 100644 (file)
@@ -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
deleted file mode 100644 (file)
index 8eba489..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include "ao.h"
-
-__pdata 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) __reentrant
-{
-       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 (file)
index 0000000..165e95d
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright © 2009 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#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;
+}
index 5eb392a4d950df287b35b2ce8d41a3d6aecdd72d..2d83380f2d43aa64e0a5b938066883ec9ac2d554 100644 (file)
@@ -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 },
 };
index 43c12f5396341079221c5eb2d2d3cb47e1b552a8..fcb5e267a063b7aeea154b8d5ab0d5895dbc92ff 100644 (file)
@@ -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_romconfig.c b/src/avr/ao_romconfig.c
deleted file mode 100644 (file)
index 4acfc1c..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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;
index ab82b7b1d67bdcb8708dc188bd08d24078fecd71..cfdd7dfe2883431c74610ed6e4b98fcb3cf7a164 100644 (file)
@@ -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))
index 0d509cb77660dc23bd5894d6c88b8df1ffa0c1d5..6c30b025f5935c5b69ac633aceb4f888f5c76998 100644 (file)
@@ -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;
 
index 2eaa8b63fc65a4a4472802721d3936438c62bcb4..ff6a829afde0fca9887b8f3e6facfcc98a6769dd 100644 (file)
@@ -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;
index 41d3c1becbf44fbb3f47480d172ae770a528c869..df800994d80a2f8b2c882a48f524457aa78f1745 100644 (file)
@@ -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/cc1111/Makefile.cc1111 b/src/cc1111/Makefile.cc1111
deleted file mode 100644 (file)
index cb2d3db..0000000
+++ /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 (file)
index 6bf135b..0000000
+++ /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 (file)
index 94af5cd..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index e845a92..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 (file)
index 937e6d0..0000000
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 (file)
index d849655..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-/*
- * 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 (file)
index 9fb4c26..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 (file)
index 04d1048..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 0496a32..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 (file)
index ca751b8..0000000
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 <count>\0Get data" },
-       { debug_input,  "I <count> <addr>\0Input <count> at <addr>" },
-       { debug_output, "O <count> <addr>\0Output <count> at <addr>" },
-       { debug_put,    "P <byte> ...\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 (file)
index 1826651..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index e21e417..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include <ao.h>
-#include <ao_exti.h>
-
-#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 (file)
index 927a4f0..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 154b3c2..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright © 2011  Anthony Towns <aj@erisian.com.au>
- *
- * 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 (file)
index 76d6d13..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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_launch.h>
-#include <ao_radio_cmac.h>
-
-__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 <key>\0Fire igniter. <key> 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 (file)
index 966b5ce..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright © 2017 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- */
-
-#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 (file)
index 9b58809..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 (file)
index 5fae46c..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 9d6e1c1..0000000
+++ /dev/null
@@ -1,655 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 166d14d..0000000
+++ /dev/null
@@ -1,689 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include "ao.h"
-#if HAS_PAD
-#include <ao_pad.h>
-#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 <offset> <value>\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 (file)
index 6e1de7a..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index abd51b2..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 70293b4..0000000
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 124e09c..0000000
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index dd62ca3..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 (file)
index a3d454d..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 259f651..0000000
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 7d7c3a2..0000000
+++ /dev/null
@@ -1,1390 +0,0 @@
-/*-------------------------------------------------------------------------
-   Register Declarations for the ChipCon CC1111 Processor Range
-
-   Copyright © 2008 Keith Packard <keithp@keithp.com>
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation, Inc.,
-   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-
-   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 <cc1110.h>
-#include <stdint.h>
-
-__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
index 853922804b839fa31b967b238057f8cc23c130bc..faa4a291b0d7e6c81df64bfd89f173f6a9ddb49e 100644 (file)
@@ -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 \
index c6cf45bd348e2203dc778cbaec325c5c17879afa..329f603d1107a58cc83b5d8d0767735a25a30c47 100644 (file)
@@ -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 \
index 1165e4540fbe5e445a1e7aa32ef54681d76ae262..80f5a4ba613152fff72d8f3c36891dc5c76b5d75 100644 (file)
@@ -24,7 +24,7 @@
 
 void main(void)
 {
-       ao_led_init(LEDS_AVAILABLE);
+       ao_led_init();
        ao_clock_init();
        ao_task_init();
        ao_timer_init();
index 5ed78bf09c65865041ef80a530403efd9e331d5e..1c30cd85dda20a768642261c9a2d826c186ba07f 100644 (file)
@@ -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,17 +207,15 @@ 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);
 }
 
-__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" },
index 6ad2a679b2a298ed70cfaedd5c8d9a5004f9cb44..069fe5bd46719ff77c867c9d3ac9c717e107e088 100644 (file)
@@ -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 : {
index 6b0e0bf8767b749d0f2f2d15023a5d18e2df278e..7681a0495411a3ca868908de08c9c492177e859d 100644 (file)
@@ -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 \
index ed1fc21c89b38c592f841543316816a6a34823e9..742b3aa3ec1cc46eca23f0aa634383c768acd74e 100644 (file)
@@ -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;
index a9c897b3154f8d26f97e5bfec2deee746d637306..c73f54df8edaa15c7febe6e1eab4a1df4b244d42 100644 (file)
 #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) 
 {
 }
 
index 8842801d122c2b862808c9c98a168d15195c4b48..b62e0134ce671e79b3b7c0ea214830834787c4d9 100644 (file)
@@ -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;
index b3fd3c912c855f8fa62e9c31edd8ac89bcabf15e..e8c3943033c69a194f70fb7c67dacba6cf8d22b8 100644 (file)
@@ -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_adxl375.c b/src/drivers/ao_adxl375.c
new file mode 100644 (file)
index 0000000..66d39ff
--- /dev/null
@@ -0,0 +1,259 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include <ao.h>
+#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   10
+#define AO_ADXL375_SELF_TEST_SETTLE    4
+
+#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 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));
+
+       /* Perform self-test */
+
+       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)
+               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);
+}
+
+static void
+ao_adxl375(void)
+{
+       ao_adxl375_setup();
+       for (;;) {
+               ao_adxl375_value(&ao_adxl375_current);
+               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 self test %d min %d max %d\n",
+               ao_adxl375_current.x,
+               ao_adxl375_current.y,
+               ao_adxl375_current.z,
+               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 (file)
index 0000000..a1ed216
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#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_ */
index a8016673a0fde1b4450a3ed2431fb91c05d0ca60..2f17d04401eade3379e538874870991c3ba1bd04 100644 (file)
@@ -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;
     }
     }
index 8f91e3ca9533f600bf8eb1e9b748b279595dba62..16141c735d9b026eef1d6684461f530f6c0cf289 100644 (file)
 #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) 
 {
 }
 
index abba3f1fe64170e83cd0b82c1a70d77c82506c09..516811b86b1eb7925c896c71890b8216a64e3776 100644 (file)
 #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;
 
index c65a8548b0c9cccf927cffa287f4e8d22876f742..04bf413890e349014f0448b12bbedfef892d1841 100644 (file)
 #endif
 
 int8_t                 ao_btm_stdio;
-__xdata uint8_t                ao_btm_connected;
+uint8_t                ao_btm_connected;
 
-#define BT_DEBUG 0
+#define BT_DEBUG 1
 
 #if BT_DEBUG
-__xdata char           ao_btm_buffer[256];
+char           ao_btm_buffer[256];
 uint16_t               ao_btm_ptr;
 char                   ao_btm_dir;
 
@@ -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;
@@ -137,7 +142,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 +158,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 +257,7 @@ ao_btm_wait_reply(void)
 }
 
 void
-ao_btm_string(__code char *cmd)
+ao_btm_string(const char *cmd)
 {
        char    c;
 
@@ -261,7 +266,7 @@ ao_btm_string(__code char *cmd)
 }
 
 uint8_t
-ao_btm_cmd(__code char *cmd)
+ao_btm_cmd(const char *cmd)
 {
        ao_btm_drain();
 
@@ -342,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;
@@ -351,7 +356,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
@@ -450,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
index f6a9676bc481ad934b6d794625092a84f531f5d0..c8103e884d3cd47bfacb5909a0034acafa41a325 100644 (file)
@@ -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
index 2f091485a24721e09f80cd972f8dd32c3d8fcc9b..b1a1377875c0d17be8c9c65185e89bbdd8b35fbc 100644 (file)
@@ -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
@@ -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) {
@@ -1066,7 +1065,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;
index c1c21e0d404e2a0259dd3b20ae23e5a0ad464c77..a8f2c4f5102e2acf0bc7ca8d269d5de243508613 100644 (file)
@@ -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
index de282000ad95eeefd5a48d93ba3f5b717092ba61..105e0d50a80aa072a2147248d1cf57edd4a0e8e2 100644 (file)
@@ -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
@@ -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();
@@ -988,7 +986,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;
 
@@ -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);
 }
index f82558a3343e6e3890bf71d49a45a11fa84ae5cd..44868fb646e48faa232ff9192c162c6d3deb06ce 100644 (file)
@@ -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)
 #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)
 
-__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)
@@ -107,7 +105,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();
@@ -116,7 +114,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,17 +132,17 @@ 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)
 {
-       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");
 }
index 43e7df238c800eedf2face8c68ddb043273a1fd8..e9ff2789f2310a00b7bde2c772f82930493e5047 100644 (file)
@@ -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
  */
 
index 8bebd61012a123b8c1ec017966770868877a2636..bdd9410e41d43d0ba83143e06478efaaebe05b17 100644 (file)
 #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)
index c483382e03539405814b6178d04bfa29848cf655..193f20dc4eb4a6af61651534d1816857a7e8355c 100644 (file)
 #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);
@@ -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);
        }
@@ -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 },
index c720f802acd2e9a73476d6a95dce6dca0bf0dde9..a6d930835baed49a70d619073b84349242b0a806 100644 (file)
 
 #include <stdarg.h>
 
-__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;
@@ -783,12 +783,12 @@ ao_gps(void) __reentrant
 #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);
        }
 }
@@ -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)
index c33aa536fde6578d8aaed0bac73454b181fcf93b..f470570829e82eebd6ae34a978acf9eee3a8a683 100644 (file)
@@ -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)
index c35093bced0fa909c1d1b3d690a778cc61358145..294361eb3b7e2ccad09a1172dba1df36da1f8fbe 100644 (file)
@@ -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)
index e892c8c045d3ad584edfc87c5149750f4935f7bf..5f5db572c31eb29aa1596d00f34f502e5c8039fd 100644 (file)
@@ -319,12 +319,12 @@ 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;
 }
 
-__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 }
index 2958fbccc33cae7ec874b1edfaa66dc63e5f4aaf..cdc19d3d76837a7d7627d5dd250eb431005733cf 100644 (file)
@@ -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 */
index dba9a76aedcc344bc0b819f38405d86259690b34..6f195e550cfc909063984a0115a9163807038da5 100644 (file)
 #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;
-       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;
@@ -71,7 +69,7 @@ lco_ignite(uint8_t cmd)
 }
 
 static void
-lco_report_cmd(void) __reentrant
+lco_report_cmd(void) 
 {
        int8_t          r;
        uint8_t         c;
@@ -122,15 +120,14 @@ lco_report_cmd(void) __reentrant
 }
 
 static void
-lco_fire_cmd(void) __reentrant
+lco_fire_cmd(void) 
 {
        uint8_t         secs;
        uint8_t         i;
        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();
@@ -156,15 +153,14 @@ 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;
        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();
@@ -190,7 +186,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 +201,7 @@ lco_arm_cmd(void) __reentrant
 }
 
 static void
-lco_ignite_cmd(void) __reentrant
+lco_ignite_cmd(void) 
 {
        uint8_t i;
        lco_args();
@@ -216,13 +212,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 <box> <channel>\0Get remote status" },
        { lco_fire_cmd,         "F <box> <channel> <secs>\0Fire remote igniters" },
 #if HAS_STATIC_TEST
index 92b344ed66c8d3a8b367c51f285f6bf75968823f..06350694145d4bda978ac894eb2a011160543ada 100644 (file)
@@ -21,8 +21,8 @@
 #include <ao_radio_cmac.h>
 #include <ao_lco_func.h>
 
-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)
index 6f2d81ffbfbbef2233a0642dc4c597644056e453..49ea123678714f65d46841cc581bcdfb96817867 100644 (file)
@@ -124,12 +124,12 @@ 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;
 }
 
-__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_led.c b/src/drivers/ao_led.c
new file mode 100644 (file)
index 0000000..0f7b7c2
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#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);
+}
index b506b0a7c9394ee5bac8fd36ace6a8ea065dfe4f..72617cc4504f24f18966e1a80f1be4699d2a1fc9 100644 (file)
 #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;
index 5d44bffdae8982bead6f95152be2d4ddd0acf111..e8eeea6e4b6dc8d424a9bf242ab60b706fbe399e 100644 (file)
@@ -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
@@ -259,7 +257,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 +275,7 @@ ao_mma655x(void)
        }
 }
 
-static __xdata struct ao_task ao_mma655x_task;
+static struct ao_task ao_mma655x_task;
 
 void
 ao_mma655x_init(void)
index 81d3c16cc76479f3eb2298fb23292d0d3191714a..8c85ab01fd82c00041128a9147e3f6a26f2caa39 100644 (file)
@@ -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;
index ae8dacd0a2eee8544e6de5e8061c316ffaacf17b..74e444a9d0950ba21a4439d19a5adcc5999a0f3c 100644 (file)
@@ -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;
@@ -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);
index 2d355c9fd0449018bbadc13837822e23d6b49e97..86dda22a9b9937fa5a54925e74e98715fcec8de8 100644 (file)
 #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);
 }
index 53ed992afcece518c6a3a4b015c2d6aae9411cf9..e2327bf4113bbe985ba2e49180171088e16ead3c 100644 (file)
@@ -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
@@ -31,12 +31,12 @@ static __xdata 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
@@ -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();
 }
@@ -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,26 +87,26 @@ 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
-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();
-               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++;
@@ -138,25 +138,25 @@ 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;
 
        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);
 
@@ -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();
@@ -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 },
 };
index 18f99bf8928867c0d7802667fa3ba4fa1c0cfd1a..322cc4684a292ddba5bf9e9cc667b1a38237f06a 100644 (file)
@@ -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_ */
index b7081107e6407766c61d8201919ec11ff5e95855..e9052b413dd8a14a855754ee49e8398f8d309617 100644 (file)
@@ -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;
index 008af5db000ca164135f1ed37c17a59896d14215..b5a0a4b7e15bbdfd2925d8b3974d26d686cdc0ad 100644 (file)
 
 #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
@@ -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 */
@@ -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
index e63771e55dd406569be34d44a858787a7e6856c5..68a5efef366c4747b2e6a54529035c1ec4b359c4 100644 (file)
@@ -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 },
index b877128ab0ed78f1ed4da64702e87645b4ccd50c..3ae1138ce0df5cffeb2dffc6c6b65891100bdcee 100644 (file)
@@ -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();
                }
index c6efc311fd9e8ea2cd29828206f28218dbc0305a..85691f5c933474efa5fd73958b242a875d685f70 100644 (file)
 #include <ao_74hc165.h>
 #include <ao_radio_cmac.h>
 
-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
@@ -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
@@ -189,21 +189,21 @@ 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)
-                               ao_sleep((void *) DATA_TO_XDATA(&ao_data_head));
+                               ao_sleep((void *) &ao_data_head);
                        );
 
 
@@ -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);
@@ -526,17 +524,17 @@ 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
 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);
@@ -560,7 +556,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 <key> <n>\0Fire igniter. <key> is doit with D&I" },
 #if DEBUG
@@ -593,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");
index 09f52a0e4968ccf362d01b17164a69cd9c0792f3..91d62026712deb1f7f7b6a8e3866ea52e2c9c106 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <ao.h>
 
-static __xdata uint8_t ao_led_state;
+static uint8_t ao_led_state;
 
 static void
 ao_led_apply(void)
@@ -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[] = {
@@ -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);
index 29eecea871b3f2a50ad56a1a5958304ce29c13bb..c7520b3a95938935ca87e60188d9b5a9d191de1c 100644 (file)
@@ -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)
index a293d929c39d88bc2d0e6e919d508a0adfda1ac4..8ea6d858a76939336854d668cca69be6b785ff7f 100644 (file)
@@ -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)
index 250e035fc3171f167c438da9ef92ba35e8668cd5..a5fbd1daaa43e30340a066373a8221cdb6d19b34 100644 (file)
@@ -22,7 +22,7 @@
 #include <ao_fast_timer.h>
 #include <ao_event.h>
 
-__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
@@ -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)
index a99e4cc597598a5e023572f88711c15c15bb5ccc..ee551f651e5d56ebfa07fbbe97d5e47df79509b6 100644 (file)
@@ -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);
index 79e4b22b4b672d4f75abe1f4579a367cd7c0fc6e..8b62a4de0e5df9884e62d7b7202d6f2b63634cb4 100644 (file)
 #include <ao_exti.h>
 #include <ao_radio_cmac.h>
 
-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 },
 };
index 2f1dab29fc0e51c14a8f1a4d30f00dbc73402e60..7859d6b65a102bf53c2daaf5e87fc5f16fe299af 100644 (file)
 #include <ao_radio_spi.h>
 #include <ao_radio_cmac.h>
 
-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)
index 98dc35b55eee33c8b7cd8ba069912423eaf23674..4ace4b78595c1a4a00743675fbe459cf670b6aa9 100644 (file)
@@ -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,
index 45454000f663c6c662af747fa71cfab83d465835..9d36c397552277a2baab9f0fbdd0b00d8824a997 100644 (file)
@@ -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
index d2e1248f70f61e12f9fc3dee48005700ca5f8f8c..1be305e57e16ac5955bedca84ad634edeb731f4d 100644 (file)
@@ -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);
 }
 
index 4e02c0ce75d8c1bd04f68b3527c9e9e6dee42624..adeed59028f5991e1d08e62c319affbc6e790ffc 100644 (file)
@@ -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);
        }
@@ -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,16 +211,16 @@ 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;
+       trng_running = false;
 }
 
 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);
index 1a877fcb4266e680db17580343309842dbfc7013..612496bcd6a1a371b00cde5abfdfb65b567f1d9e 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <ao.h>
 
-static int     ao_watchdog_enabled = TRUE;
+static int     ao_watchdog_enabled = true;
 
 static void
 ao_watchdog(void)
@@ -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);
                }
        }
 }
@@ -38,15 +38,15 @@ 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);
        }
 }
        
 
-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 },
 };
@@ -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");
 }
index c3b360b4afb7d4d2fe6af73e3dd34fdec2088fd5..76e7319e43b85c419d65527cb9824d592f73ae43 100644 (file)
@@ -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 \
@@ -70,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 \
@@ -102,7 +85,6 @@ ALTOS_SRC = \
        ao_flight.c \
        ao_companion.c \
        ao_pyro.c \
-       $(MATH_SRC) \
        $(PROFILE) \
        $(SAMPLE_PROFILE) \
        $(STACK_GUARD)
index 9848c36779c4dfd352f71e3c0f7ef17a7b3d6b0f..d00585f9b234998da202006a5ed5b9f91e4a209c 100644 (file)
@@ -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();
 
index b80164786ba1f88b61f8d6df17b1f2e7da03bde6..bfa777c66401466a9348abd6f7a2c1da4687bc84 100644 (file)
 #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
 /* 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/easymega-v2.0/Makefile b/src/easymega-v2.0/Makefile
new file mode 100644 (file)
index 0000000..bfe8a84
--- /dev/null
@@ -0,0 +1,123 @@
+#
+# 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_adxl375.h \
+       ao_profile.h \
+       ao_task.h \
+       ao_whiten.h \
+       ao_sample_profile.h \
+       ao_quaternion.h \
+       ao_mpu.h \
+       stm32l.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
+
+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_ignite.c \
+       ao_freq.c \
+       ao_dma_stm.c \
+       ao_spi_stm.c \
+       ao_data.c \
+       ao_ms5607.c \
+       ao_mpu9250.c \
+       ao_adxl375.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 \
+       $(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-v2.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 (file)
index 0000000..bb2e7cf
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright © 2014 Bdale Garbee <bdale@gag.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include <ao.h>
+#include <ao_ms5607.h>
+#include <ao_mpu9250.h>
+#include <ao_adxl375.h>
+#include <ao_log.h>
+#include <ao_exti.h>
+#include <ao_companion.h>
+#include <ao_profile.h>
+#include <ao_eeprom.h>
+#if HAS_SAMPLE_PROFILE
+#include <ao_sample_profile.h>
+#endif
+#include <ao_pyro.h>
+#if HAS_STACK_GUARD
+#include <ao_mpu.h>
+#endif
+
+int
+main(void)
+{
+       ao_clock_init();
+
+#if HAS_STACK_GUARD
+       ao_mpu_init();
+#endif
+
+       ao_task_init();
+       ao_led_init();
+       ao_led_on(LEDS_AVAILABLE);
+       ao_timer_init();
+
+       ao_i2c_init();
+       ao_spi_init();
+       ao_dma_init();
+       ao_exti_init();
+
+       ao_adc_init();
+       ao_beep_init();
+       ao_cmd_init();
+
+       ao_ms5607_init();
+       ao_mpu9250_init();
+       ao_adxl375_init();
+
+       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 (file)
index 0000000..399654f
--- /dev/null
@@ -0,0 +1,366 @@
+/*
+ * Copyright © 2014 Bdale Garbee <bdale@gag.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#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              6
+#define AO_RCC_CFGR_PLLMUL     (STM_RCC_CFGR_PLLMUL_6)
+
+/* 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_EASYMEGA_2
+
+#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 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
+#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 */
+#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, IMU, Companion */
+#define SPI_2_PD1_PD3_PD4      0
+#define SPI_2_OSPEEDR          STM_OSPEEDR_10MHz
+
+#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
+
+/*
+ * 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_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
+
+#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
+#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 AO_ADXL375_AXIS                x
+#define AO_ADXL375_INVERT      1
+
+#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 (file)
index 0000000..a559400
--- /dev/null
@@ -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 (file)
index 0000000..324b0eb
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2018 Bdale Garbee <bdale@gag.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#ifndef _AO_PINS_H_
+#define _AO_PINS_H_
+
+/* External crystal at 16MHz */
+#define AO_HSE         16000000
+
+#include <ao_flash_stm_pins.h>
+
+/* 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_ */
index 45c6891d8ad790c8b8b3c32090f89cf38db0033f..201b913edd1e981532b7513d0f8eb72ec24e26c8 100644 (file)
@@ -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)
index 47eb577e1be8f58e892937dfc0827ae16aff507b..38d463100d3fd14d767bd7caf81bce52be7e31f7 100644 (file)
@@ -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)
index e3226a24fade2100cbdeaf297807ece4d0269a53..61314db93cb7f2687e83469f4854f5b36544508a 100644 (file)
@@ -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 \
index 2e1a2fdfe6a81d092fb5751c37f8caad380de5e5..5ebb4b549bae1b5e729b1d2a14f05a64ab39bde9 100644 (file)
@@ -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();
 
index 0a3981d743b323c229ef75323867e42a2fca0369..9baae8b437d310b071618b57795b11575c650637 100644 (file)
 #include <stdio.h>
 #include <string.h>
 #include <stddef.h>
+#include <stdbool.h>
 #include <ao_pins.h>
 #include <ao_arch.h>
 
-#define TRUE 1
-#define FALSE 0
+/* replace stdio macros with direct calls to our functions */
+#undef putchar
+#undef getchar
+#define putchar(c)     ao_putchar(c)
+#define getchar                ao_getchar
 
-/* 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
+extern int ao_putchar(char c);
+extern char ao_getchar(void);
 
 #ifndef HAS_TASK
 #define HAS_TASK       1
@@ -85,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
  */
@@ -94,7 +103,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
@@ -115,10 +124,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);
@@ -143,13 +148,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
 
 /*
@@ -162,16 +167,14 @@ 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 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);
+ao_cmd_readline(const char *prompt);
 
 char
 ao_cmd_lex(void);
@@ -191,29 +194,29 @@ 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
-ao_cmd_decimal(void) __reentrant;
+uint32_t
+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);
@@ -240,7 +243,7 @@ ao_cmd_filter(void);
 #include <ao_beep.h>
 #endif
 
-#if LEDS_AVAILABLE
+#if LEDS_AVAILABLE || HAS_LED
 #include <ao_led.h>
 #endif
 
@@ -297,13 +300,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
 
 /*
@@ -379,11 +382,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;
@@ -423,13 +426,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);
@@ -560,9 +563,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
@@ -587,17 +590,14 @@ extern __xdata 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 __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);
@@ -675,14 +675,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);
@@ -700,7 +700,7 @@ void
 ao_monitor_enable(void);
 
 void
-ao_monitor_init(void) __reentrant;
+ao_monitor_init(void);
 
 #endif
 
@@ -712,27 +712,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
@@ -759,14 +759,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);
@@ -787,7 +787,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
 
 /*
@@ -887,8 +887,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);
@@ -950,9 +950,6 @@ ao_terraui_init(void);
  */
 
 #ifdef BATTERY_PIN
-void
-ao_battery_isr(void) ao_arch_interrupt(1);
-
 uint16_t
 ao_battery_get(void);
 
@@ -971,7 +968,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
index 5ae984249bc4748cc7b27877ab23d44bc16ec66c..f41b2e877708cf5fcc2843c903edd4763b5bc8c2 100644 (file)
@@ -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);
index 47b69e25bb747d1b81981194fd29ee2f983034d7..a5be8c1632870d925b6afb9e98a9c52426d3dc1b 100644 (file)
 
 #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)
@@ -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:
@@ -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)
index 1306af627e5a630e8ef286eb20ad5af289a8bf09..fdc150f1bbb56148b2d126520105913bb134e344 100644 (file)
@@ -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
index 7bb4654e775e472d486fbf4985989b2c8d05614d..d1c049ac78aaf5b03905dc13542905f74cb01d71 100644 (file)
 #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;
+char   ao_cmd_lex_c;
+enum ao_cmd_status ao_cmd_status;
 
 #ifndef AO_CMD_LEN
 #if AO_PYRO_NUM
@@ -32,30 +30,26 @@ __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;
+
+static const char backspace[] = "\010 \010";
 
 void
-ao_put_string(__code char *s)
+ao_put_string(const char *s)
 {
        char    c;
        while ((c = *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();
@@ -64,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;
@@ -74,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;
@@ -174,55 +168,48 @@ ao_cmd_hexchar(char c)
        return -1;
 }
 
-void
-ao_cmd_hexbyte(void)
+static uint32_t
+get_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)
 {
-       __pdata uint8_t r = ao_cmd_lex_error;
-       int8_t  n;
+       return get_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 get_hex(0xff);
 }
 
-void
-ao_cmd_decimal(void) __reentrant
+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,11 +217,11 @@ ao_cmd_decimal(void) __reentrant
        }
        if (r != ao_cmd_success)
                ao_cmd_status = r;
-       ao_cmd_lex_i = (uint16_t) ao_cmd_lex_u32;
+       return result;
 }
 
 uint8_t
-ao_match_word(__code char *word)
+ao_match_word(const char *word)
 {
        while (*word) {
                if (ao_cmd_lex_c != *word) {
@@ -250,9 +237,9 @@ ao_match_word(__code 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
@@ -321,16 +308,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 +350,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,13 +360,13 @@ 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();
+               ao_cmd_readline("> ");
                ao_cmd_lex();
                ao_cmd_white();
                c = ao_cmd_lex_c;
@@ -424,10 +411,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" },
index 4c16145564fb7a86e30691e224c6a643929fa5ec..bd702fe3664065d0c6e0b1e40788c6a89634a49a 100644 (file)
@@ -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);
index 86d4838fbe8d6630a458c0904bf459e9aeb29ee8..596a0410623774f68f68e1c3bf3a239c369141d8 100644 (file)
 #include <ao_tracker.h>
 #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
@@ -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
@@ -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,20 +309,20 @@ 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();
+       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
@@ -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,26 +360,26 @@ 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();
+       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();
 }
 
 #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;
@@ -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
@@ -442,19 +442,20 @@ 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;
+       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) __reentrant
                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) __reentrant
        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;
@@ -494,38 +495,38 @@ 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();
+       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();
 }
 
 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();
+       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();
 }
 
@@ -533,19 +534,19 @@ 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();
+       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();
 }
@@ -558,23 +559,23 @@ 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();
+       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();
@@ -588,7 +589,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,26 +612,27 @@ 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);
 #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
@@ -639,26 +641,26 @@ 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();
+       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
 
 #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,39 +670,38 @@ 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();
+       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
 
 #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();
+       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();
@@ -710,10 +711,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,16 +724,16 @@ ao_config_key_show(void) __reentrant
 }
 
 void
-ao_config_key_set(void) __reentrant
+ao_config_key_set(void) 
 {
        uint8_t i;
 
        _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,33 +939,33 @@ 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
 
 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 <meters>\0Main deploy (m)",
          ao_config_main_deploy_set,    ao_config_main_deploy_show, },
@@ -1078,7 +1077,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 +1088,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 +1104,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 +1121,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 <var> <value>\0Set config (? for help, s to show)" },
        { 0, NULL },
 };
index f730c73c99df9764a4991bf0940e136a216117ce..41aafcca8cb5ae4151920bf7aeec34f6b514de0e 100644 (file)
@@ -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);
index 1cd623459ca860512799b57e0ec3626de048a669..f3e523ecefe02ed430b6332b5497fe7a075212eb 100644 (file)
@@ -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;
 
index 35d42b8f02fa10aff483622df37df828815f61fc..536ffa2bb295556686a64fc534dccdc9bda27fc3 100644 (file)
 #include <ao.h>
 #include <ao_data.h>
 
-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);
index 88d0e91675a4c7cf61eec8ab454f4fd161e9fe72..dda5de4c6638bc62161619c677f4a877c345c5b9 100644 (file)
 #define AO_DATA_MMA655X 0
 #endif
 
+#if HAS_ADXL375
+#include <ao_adxl375.h>
+#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))
@@ -97,12 +107,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
@@ -113,9 +123,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 */
 
@@ -295,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
@@ -353,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)
@@ -360,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)
 {
@@ -396,9 +427,42 @@ 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
+
+#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
+#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);
+               ao_wakeup((void *) &ao_data_head);
+       }
+}
 
 #endif
 
index 84c1300091f2c91c3f0dcc0cd352b3064548b5d7..cef0a4381e7e685f0df98a8f9726781c44c44683 100644 (file)
@@ -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;
index bd8b67251d951851df6673d72d77cf92f80c2fd4..f258c48c0fa4fc20b48885c5cb5b77c30657a52e 100644 (file)
@@ -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
index 5880cf2b607eeb335edb19ed7b467cc230770dd1..ec8691e9ad13425f014a13473442284561e28b94 100644 (file)
@@ -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
@@ -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));
index c2700d20bddb41801bacb0d560291a50aaad4bb0..5a5d5b72b0adfb887f238d6512c5b91b68b8a016 100644 (file)
 
 /* 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
@@ -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;
@@ -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
@@ -463,7 +465,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 +473,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)
index 005c7e8459ad0be8a6bf2f909ce64aa7f7cac03b..af6b0c55bedd465ed209b8284d503808c35911f5 100644 (file)
@@ -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
index d849dc6483c0c28376d9d6f7d78e0b92f549bc11..96d47fac6b33fd5dc29f9d9a17961cab2d229812 100644 (file)
 
 /* 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)
@@ -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;
@@ -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)
index 721b52d08d8b3ad5c119a1d49b811587024aa6b7..6f664b60578add2e8c579f0ce198ddf571e67c0a 100644 (file)
@@ -23,11 +23,11 @@ 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)
-                       ao_sleep(DATA_TO_XDATA(&ao_monitoring));
+                       ao_sleep(&ao_monitoring);
 
                if (!ao_radio_recv(&packet, sizeof(packet), 0))
                        continue;
@@ -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");
 }
index 2fe28f6656279ac2d6c7cf0cb393cca277613910..5b21bf3cc27322c9d08b3bb4aaff4068be527604 100644 (file)
@@ -20,6 +20,6 @@
 #define _AO_FORWARD_H_
 
 void
-ao_monitor_forward_init(void) __reentrant;
+ao_monitor_forward_init(void);
 
 #endif /* _AO_FORWARD_H_ */
index 6478dae29934576923c314252084c0a458296430..81640ce8af72a8678c51158678c063e94f9562c8 100644 (file)
  * 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;
index b1183badade6440ccb61538df4d1dd40d83184a3..6dfd1bdd9164d4271b39111525c32189b89a402c 100644 (file)
@@ -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)
index 75c2f367ec390a7b2a2311da9909793b0fa52d98..0ef9a725fc8481e1103c59fcdc0453e7bba56d71 100644 (file)
@@ -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)
index 85614b85bd3eea31ec2c773e85c146620adaa4a0..37f1beaa9b1d5d1314c87a7fe2f8b8926bd60d56 100644 (file)
@@ -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)
index 523fb17fe8529615ce4932d45e3c35012e11d86a..06863fe4844a05d08ccc98618b7d1efa141a22bb 100644 (file)
@@ -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)
index ec19776946aad3cf17a026ea70347443f1a8a52e..ab29e5e507daa74828f5a3d898347460f44f9f9c 100644 (file)
@@ -23,7 +23,7 @@
 #include <ao_data.h>
 
 void
-ao_gps_show(void) __reentrant
+ao_gps_show(void) 
 {
        uint8_t i;
        ao_mutex_get(&ao_gps_mutex);
index 50583f52929722d14575fd185bdc3fd95389d236..592de54ce348b6dc96f1fdcb64e4eba8eb3fd9b3 100644 (file)
@@ -41,15 +41,11 @@ struct ao_adc {
        int16_t         sense_m;        /* main continuity sense */
 };
 
-#define __pdata
-#define __data
-#define __xdata
-#define __code
-#define __reentrant
-
-#define DATA_TO_XDATA(a)       (a)
-#define PDATA_TO_XDATA(a)      (a)
-#define CODE_TO_XDATA(a)       (a)
+#define const
+
+#define a      (a)
+#define a      (a)
+#define a      (a)
 
 enum ao_flight_state {
        ao_flight_startup = 0,
index 52d9d77e25e76fb996111dd2a879326a7180a8ab..a6ff997984e7e6cc20617ac753ef42c431eb7eba 100644 (file)
@@ -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);
@@ -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)
@@ -141,7 +139,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 +185,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,20 +212,20 @@ ao_ignite_test(void)
 #endif
 }
 
-__code struct ao_cmds ao_ignite_cmds[] = {
+const struct ao_cmds ao_ignite_cmds[] = {
        { ao_ignite_manual,     "i <key> {main|drogue}\0Fire igniter. <key> 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)
 {
-       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
 
index fdea61c031f726b0c692b379cb8d8263fd994a6c..dffb855648a212189654bc5707aae0b1f01f599c 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <ao_int64.h>
 
-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;
index 11c164042cd2a5fb46a470f3b6c52deb98c36dbd..3014182af16c2d91f91e417e74071b0b48cd8e80 100644 (file)
@@ -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;
index e4cc6d4b9f73676fbc93b750ececfad91b2ed332..4f4ffe8f1b6a813b532cd4fe751ed6d684f34b6b 100644 (file)
@@ -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
index 7de092373e9e943fda8a5ed9805bd71ae65743a0..5d982ca6d1f0e7101467d072ce215678e8ae8793 100644 (file)
@@ -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 */
@@ -51,10 +51,208 @@ 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
-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_ */
index 5fb086cee816712d4347ceb99c37fa37a794ec62..fac211cf32549362b8380f55739c2b2e29a07565 100644 (file)
 #include <ao_tracker.h>
 #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;
@@ -437,10 +437,9 @@ ao_log_delete(void) __reentrant
                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 */
@@ -462,7 +461,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 <flight-number>\0Delete flight" },
        { 0,    NULL },
index e2f1e0e4c9eb284335130ed084d9740648e70621..04f00d3ec3bd211545e948896994ebff3777736b 100644 (file)
  * 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 */
 
@@ -55,6 +55,7 @@ extern __pdata 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 */
@@ -90,7 +91,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
@@ -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
 
@@ -507,14 +508,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
index 7d7332e9d1fe0a917d1ad8b4eed4a519859bd8eb..2a8cd63d45d6348673053823e54e44ef9796cae3 100644 (file)
@@ -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();
 
index 1a82673d4344e387e505148dcd58815409056ea0..3dd52a1651d8580de39ded647f35d6501b8a7d6a 100644 (file)
 #include <ao_data.h>
 #include <ao_flight.h>
 
-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))] ;
index 0ae4e53616c9f57a16478cc161a8cdee7c56ce48..341ff715b790426146362c147113141665f09da6 100644 (file)
@@ -22,7 +22,7 @@
 #include <ao_flight.h>
 
 #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();
index 347290706db23d6e962b934449a9fac305901c3b..18fb9ffbd1e569c3f41bb15095d60aedbf424923 100644 (file)
@@ -22,7 +22,7 @@
 #include <ao_flight.h>
 
 #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();
 
index 12c5d6bb61cb3523dccbb286a3f029de639ef559..03bf2265e9b15b0ed160047b559273913a606f40 100644 (file)
@@ -21,7 +21,7 @@
 #include <ao_data.h>
 #include <ao_flight.h>
 
-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();
 
index 63768e1aa4724b008b22bebd717a23acdfd9e769..a2b63c8d68084d6ac286ede8e92131fd4ebe51be 100644 (file)
 #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)
@@ -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");
 }
index 1305a84d13137bfc0375a7e5a48efe7621fb61df..8c0b88e47441e0a30cd1264f429bf51be7a84d5f 100644 (file)
 #include <ao_flight.h>
 #include <ao_sample.h>
 
-__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() {
@@ -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);
                }
        }
 }
index 3f514f18fe100fa205fee7de2f330c43382713e4..a21af71d093f1f55a8b3aa8501dc7b09d4bd1c40 100644 (file)
 
 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;
 
index 0b8e39d6aa4d74dc9cad9d6861ac1a8972b062e3..530031113842fada7915070db8429e00ca394b7c 100644 (file)
@@ -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
@@ -41,13 +41,13 @@ 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;
        }
 }
 
-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))
 
@@ -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++;
@@ -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);
index 7cbee28815b611775beb4ec1e1785f7040995a46..3f1ff217b18d2b4336eb2baba1befc1033d216f8 100644 (file)
 #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)
@@ -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,12 +86,12 @@ 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);
        }
 }
 
 #if AO_MONITOR_LED
-__xdata struct ao_task ao_monitor_blink_task;
+struct ao_task ao_monitor_blink_task;
 
 void
 ao_monitor_blink(void)
@@ -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))
@@ -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))
@@ -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];
@@ -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)
@@ -296,21 +296,20 @@ ao_monitor_enable(void)
 static void
 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_external_monitoring = ao_cmd_hex();
+       ao_wakeup(&ao_external_monitoring);
+       ao_wakeup(&ao_monitor_head);
        _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]);
index ff73e3bc6998410e29bafbdcc459ba305e0fd7a3..4ef1a9bae860fded34574cdf190c34f0c13c2b88 100644 (file)
@@ -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);
index 7207353af5444891b7982207c24d72fe5c3ddabc..a5bdc8a7c65e5d81dbc6e0ad8b7bcf9ff54261d8 100644 (file)
@@ -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;
index a4446726c4540c3aa2c93fdd194f4978cdb2e30b..ce622b630e7d92f834fa78883749f178faa2992a 100644 (file)
@@ -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_ */
index 9d99b0e6f1c8c34a53e24aaba8595be926502514..24cd7b132445aa73c182e01d43cb94a3a57ae3b2 100644 (file)
@@ -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);
index bf59ab5396503fbe5db1fc1b408db767c26921d6..8c490604decffcc9ed30cca213c841aeda9b0ca5 100644 (file)
@@ -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
index 4c2d83efcaba5ebb3bc224c5bae5261c28f17460..7248865427b725a60d6544f3e4fbec90bca59511 100644 (file)
@@ -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,
index 527112acfbfcbc1332464966f95ed5c47cbfac54..30d1518f051701146b8e96a95a74d7715a685ee5 100644 (file)
@@ -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);
@@ -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
@@ -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;
        }
@@ -404,7 +404,7 @@ ao_pyro(void)
        ao_exit();
 }
 
-__xdata struct ao_task ao_pyro_task;
+struct ao_task ao_pyro_task;
 
 
 static void
@@ -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;
                        }
                }
        }
@@ -558,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");
 }
index 92b365a28569020825d4fdc201183813d24d21b6..155fce350b69f77c464d5fefe747ede3c6478b14 100644 (file)
@@ -19,9 +19,9 @@
 #include <ao.h>
 #include <ao_radio_cmac.h>
 
-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)
index 74fe8c600886c15e388c438f4af8968b99bdf7e8..5fd6e10539deb8edceb240466b4b81567e285200 100644 (file)
 #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);
index 6d29f3925b186a5478fb4802bd11fe052e413f29..1433e96d84523ceb9e5bcbadc491482305a27c4d 100644 (file)
@@ -20,7 +20,7 @@
 #include <ao_radio_cmac_cmd.h>
 #include <ao_radio_cmac.h>
 
-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,21 +45,19 @@ getbyte(void)
 }
        
 static void
-radio_cmac_send_cmd(void) __reentrant
+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)
@@ -69,19 +67,17 @@ 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;
 
-       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 ");
@@ -92,7 +88,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 <length>\0Send AES-CMAC packet. Bytes to send follow on next line" },
        { radio_cmac_recv_cmd,  "S <length> <timeout>\0Receive AES-CMAC packet. Timeout in ms" },
        { 0, NULL },
index af48b390daae0c0095c074dd6818aabc27e86d76..08967af8450f3f2701b82e3c3df146e801dfa5e1 100644 (file)
@@ -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,12 +178,12 @@ 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)
                        break;
-               ao_sleep(DATA_TO_XDATA(&ao_sample_data));
+               ao_sleep(&ao_sample_data);
        }
        ao_report_number(ao_battery_decivolt(packet.adc.v_batt));
 }
@@ -204,7 +204,7 @@ ao_report_igniter(void)
 }
 
 static void
-ao_report_continuity(void) __reentrant
+ao_report_continuity(void) 
 {
        uint8_t c;
 
@@ -281,11 +281,11 @@ ao_report(void)
                }
 #endif
                while (ao_report_state == ao_flight_state)
-                       ao_sleep(DATA_TO_XDATA(&ao_flight_state));
+                       ao_sleep(&ao_flight_state);
        }
 }
 
-static __xdata struct ao_task ao_report_task;
+static struct ao_task ao_report_task;
 
 void
 ao_report_init(void)
index 9c7afdc56d2a850d28bc2f9a2920b44bfba9c94d..efada54b516be302d477c891e05947292e9640f8 100644 (file)
@@ -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_romconfig.c b/src/kernel/ao_romconfig.c
new file mode 100644 (file)
index 0000000..b75142f
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright © 2011 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; 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
index 66fb8b57c9f3a036049bf1b565e80240b610915c..aacc38b271345e0e9db963ff5c5466eee3b4f4de 100644 (file)
@@ -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)
index f8012e3455c48f8bf0b81888f2621366cd0e32ac..9cba36c1004b37ec31717e7c4431e08ede4bf615 100644 (file)
 #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
 
@@ -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;
        }
 }
 
@@ -321,10 +321,10 @@ 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;
+               struct ao_data *ao_data;
 
                /* Capture a sample */
                ao_data = (struct ao_data *) &ao_data_ring[ao_sample_data];
@@ -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;
 }
index 5ae389bec7c636e4356b1d0c4042fd7fee5e25b0..4c51a58c3f0a0089f893f3004a239b3e37d7b3cf 100644 (file)
@@ -115,46 +115,46 @@ 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);
 
-/* returns FALSE in preflight mode, TRUE in flight mode */
+/* returns false in preflight mode, true in flight mode */
 uint8_t ao_sample(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
 
index 4819a16144eab837cd2bc93dcad81f246788e477..b9d0e07fd9a7d71ea8801cc00224dfe4d5a213c5 100644 (file)
@@ -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 }
 };
index c8a1d46e7d4523a68286914fc84e81dfefb4dd24..cae25151f4db99077a061123f2bb69792bba3c3a 100644 (file)
 
 #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;
+       count = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
        if (count > AO_MAX_SEND - 2) {
@@ -47,7 +46,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 <len>\0Send packet. Data on next line" },
        { 0, NULL }
 };
index ef3e93d78ba8a323ff45af2267481e6a15f50508..440b562b0b26e5c00ad3bf2ca8b22093b51e5d54 100644 (file)
@@ -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);
index dc09b5c772cb37fab569824f25dbe9e602cce8bb..c3b51d123ef1407702200798feaf17c6711c3e02 100644 (file)
 
 #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
 
-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
@@ -107,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;
@@ -144,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);
@@ -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 };
index 400751de03ca5d8a95debcac49403fa32b681b61..890bdcae9af991b457d018b69b179d5d72828de4 100644 (file)
@@ -20,7 +20,7 @@
 #include <ao_storage.h>
 
 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,20 +87,21 @@ 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) 
 {
+       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(' ');
@@ -118,28 +119,24 @@ 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;
+       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++;
        }
@@ -147,16 +144,16 @@ ao_storage_store(void) __reentrant
 #endif
 
 void
-ao_storage_zap(void) __reentrant
+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
-ao_storage_zapall(void) __reentrant
+ao_storage_zapall(void) 
 {
        uint32_t        pos;
 
@@ -272,7 +269,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 +296,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 +313,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 +321,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 <block>\0Dump flash" },
 #if HAS_STORAGE_DEBUG
index 59b137ad8e792a7976cc5875c3bf1bbc12331102..cf37a824db0a1c986603fd0b267d9cce59bcaaf4 100644 (file)
 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_ */
index de23ea02421013e4186801b85664abb81630d99a..dc5c19132caeb121a21b5bbe0698da713a68c9d8 100644 (file)
 
 #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++) {
@@ -569,4 +569,5 @@ ao_start_scheduler(void)
        ao_arch_start_scheduler();
 #endif
        ao_yield();
+       __builtin_unreachable();
 }
index 7549b59838d6abbc4c85a22e5b42ae4ce7e9449e..709e10c60ce6f602a832a5b2396ee07390eeaaf1 100644 (file)
 #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 */
 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 +64,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 +83,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 +91,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 +113,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 */
@@ -134,7 +132,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
index 9ed612ceeb263ce8dc10e91e6028522072aaa492..9e1304f73feec119c0f85ab814088c948a93179a 100644 (file)
 #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 <ao_aprs.h>
 #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)
@@ -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();
@@ -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()
index 46278530843cf36d527297acc0b93e1be1004bdd..1454c17c31815aadd08c9d060f10a81cacf78711 100644 (file)
@@ -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
@@ -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);
index 40516de10340ffa439f606a2292e776c25ca0d55..6c74a04265e3ecf282093c33e981de4ad79f2fce 100644 (file)
@@ -69,7 +69,7 @@ ao_usb_disable(void);
 void
 ao_usb_init(void);
 
-extern __code __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)
@@ -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_ */
index 33c68cf5d977148160bdf56f18df8f30e807d28b..f8b5c7f5d43d9e4e41861da10df0d3a680c88c59 100644 (file)
@@ -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 \
@@ -31,10 +27,9 @@ 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_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)
index f1a2aa38ed2cb9d73ce600c259838d7649239daa..a608d8e49c3b90ec58ee0f10adadda3ba7a523b6 100644 (file)
@@ -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)
 {
index 58a750803092bda746eb3aea8fde2c7da98b5205..92ed24ee9b388bb9da800de9102dd610d484ff24 100644 (file)
 #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
 
index 8af199c2042d0ec0bd923d4d70791de906523cea..4135755252ba4258e07806168a24153a030d6de8 100644 (file)
@@ -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
 #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 (file)
index b09fdb4..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-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);
index c4521620b6b81b4e130837f8a54a5209f831e0c8..edeedaf0a15f03c53435f3eee05754e0f7a3d54d 100644 (file)
@@ -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.
index 84d7610c21036a65b5c21e2448d61ed24cf5c2e0..be4f115d50e76b666307c7efa15baf139138f7c3 100644 (file)
@@ -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
 
 
index db53dcaf15880d956c9d376549b22c8c4c262eff..99d10149ab303035433735de75bfb9f973d24ed4 100644 (file)
@@ -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
 
index e6a6a7edad6ddcdcf6b658bab31e016f495db146..028ad775d28ef579a3f44e99c9d25422f4874001 100644 (file)
@@ -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
 
index 26a5ea08c73df808bd01420eb9b3588d3978b67c..6324155977a7a4a538bf3cdbd051e274fae42a33 100644 (file)
@@ -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;
 }
 
@@ -147,7 +131,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 +151,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 },
 };
index da21dc9d1779ff7d3b67fc30c0a6d145e07ba4c9..35dcc9de57e2ad58286beab8d3f7cb5cfe67d45d 100644 (file)
 
 #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)
 
 
 #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
  */
 
-#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 */
index 15106dea42d620b1bbc452c9e56b6eaea2c6bc36..0454b38b012e71f80d1dae78928dbe549579229e 100644 (file)
 #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<<bit),bus,speed)
-#define ao_spi_put_bit(reg,bit,pin,bus) ao_spi_put_mask(reg,(1<<bit),bus)
+#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,bus) ao_spi_put_mask(reg,(1<<bit),bus)
 
 #define ao_enable_port(port) (lpc_scb.sysahbclkctrl |= (1 << LPC_SCB_SYSAHBCLKCTRL_GPIO))
 #define ao_disable_port(port) (lpc_scb.sysahbclkctrl &= ~(1 << LPC_SCB_SYSAHBCLKCTRL_GPIO))
 
 #define lpc_all_bit(port,bit)  (((port) << 5) | (bit))
 
-#define ao_gpio_set(port, bit, pin, v) (lpc_gpio.byte[lpc_all_bit(port,bit)] = (v))
+#define ao_gpio_set(port, bit, v)      (lpc_gpio.byte[lpc_all_bit(port,bit)] = (v))
 
-#define ao_gpio_get(port, bit, pin)    (lpc_gpio.byte[lpc_all_bit(port,bit)])
+#define ao_gpio_get(port, bit)         (lpc_gpio.byte[lpc_all_bit(port,bit)])
 
 #define PORT0_JTAG_REGS        ((1 << 11) | (1 << 12) | (1 << 14))
 
@@ -41,10 +41,10 @@ static inline void lpc_set_gpio(int port, int bit) {
        }
 }
 
-#define ao_enable_output(port,bit,pin,v) do {                  \
+#define ao_enable_output(port,bit,v) do {                      \
                ao_enable_port(port);                           \
                lpc_set_gpio(port,bit);                         \
-               ao_gpio_set(port, bit, pin, v);                 \
+               ao_gpio_set(port, bit, v);                      \
                lpc_gpio.dir[port] |= (1 << bit);               \
        } while (0)
 
@@ -204,8 +204,8 @@ static inline void ao_arch_restore_stack(void) {
                ao_spi_put(bus);                \
        } while (0)
 
-#define ao_spi_get_bit(reg,bit,pin,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_get_bit(reg,bit,bus,speed) ao_spi_get_mask(reg,(1<<bit),bus,speed)
+#define ao_spi_put_bit(reg,bit,bus) ao_spi_put_mask(reg,(1<<bit),bus)
 
 void
 ao_spi_get(uint8_t spi_index, uint32_t speed);
@@ -254,7 +254,7 @@ static inline void ao_spi_send_byte(uint8_t byte, uint8_t spi_index)
                uint8_t __bit__;                                        \
                for (__bit__ = 0; __bit__ < 32; __bit__++) {            \
                        if (mask & (1 << __bit__))                      \
-                               ao_enable_output(port, __bit__, PIN, 1); \
+                               ao_enable_output(port, __bit__, 1); \
                }                                                       \
        } while (0)
 
index b1211752ae1719060650adc87239a8f130afe935..eab86ee644ebe44b92e6deee77828dc5809bc661 100644 (file)
@@ -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);
index e3c7d0c16d3d19e292fe8c1386f8af22c534e5d9..a51c7f8d45414d59eb9a47b47adeb54714ebefdd 100644 (file)
@@ -36,7 +36,7 @@ ao_boot_check_pin(void)
                ao_arch_nop();
 
        /* Read the value */
-       v = ao_gpio_get(AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN, AO_BOOT_APPLICATION);
+       v = ao_gpio_get(AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN);
 
        /* Reset the chip to turn off the port and the power interface clock */
        ao_gpio_set_mode(AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN, 0);
index 3e0119c6e6639b674925acb08b291718b939501d..8d71f43f2de38c1f0216d17d18d14b02e82e9559 100644 (file)
@@ -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();
 }
index 2d2c3972defaaeacbf6fd286173c5c6fc0f55d99..3a2d4c9886986b72889c50a07c0d13a0ba937cde 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <ao.h>
 
-__pdata AO_PORT_TYPE ao_led_enable;
+AO_PORT_TYPE ao_led_enable;
 
 void
 ao_led_on(AO_PORT_TYPE colors)
@@ -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);
@@ -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);
@@ -57,18 +57,17 @@ ao_led_for(AO_PORT_TYPE colors, uint16_t ticks) __reentrant
 }
 
 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/lpc/ao_romconfig.c b/src/lpc/ao_romconfig.c
deleted file mode 100644 (file)
index 4e7bab8..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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
index 166e2f154aa135feab827b5bb3fde19a9ed14f31..8999c7acf1af925e67d17125320644f503811eae 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <ao.h>
 
-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)
index d26a1437f9b34c94e8d8c93ca1ea051c8fe0906d..594114b62ed856a8b4babc8f9ccf47f3597d9624 100644 (file)
@@ -857,7 +857,7 @@ ao_usb_disable(void)
        ao_arch_block_interrupts();
 
 #if HAS_USB_PULLUP
-       ao_gpio_set(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, AO_USB_PULLUP, 0);
+       ao_gpio_set(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, 0);
 #endif
        /* Disable interrupts */
        lpc_usb.inten = 0;
@@ -975,7 +975,7 @@ ao_usb_enable(void)
        ao_usb_set_ep0();
 
 #if HAS_USB_PULLUP
-       ao_gpio_set(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, AO_USB_PULLUP, 1);
+       ao_gpio_set(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, 1);
 #endif
 }
 
@@ -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 }
 };
@@ -1014,7 +1014,7 @@ ao_usb_init(void)
 {
 #if HAS_USB_PULLUP
        int     i;
-       ao_enable_output(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, AO_USB_PULLUP, 0);
+       ao_enable_output(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, 0);
 
        for (i = 0; i < 40000; i++)
                ao_arch_nop();
diff --git a/src/math/ef_acos.c b/src/math/ef_acos.c
deleted file mode 100644 (file)
index f73f97d..0000000
+++ /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 (file)
index 619fe90..0000000
+++ /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 (file)
index 3e58f80..0000000
+++ /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 (file)
index 80e7f36..0000000
+++ /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 (file)
index ee9fcb2..0000000
+++ /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 <math.h>
-#include <stdint.h>
-#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 <math.h>
-/* #include <sys/types.h> */
-#include <machine/ieeefp.h>
-
-/* 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 <values.h>
- * (one may replace the following line by "#include <values.h>")
- */
-
-#define X_TLOSS                1.41484755040568800000e+16 
-
-/* Functions that are not documented, and are not in <math.h>.  */
-
-#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 (file)
index 0b06fb7..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-#ifndef _IEEE_FP_H_
-#define _IEEE_FP_H_
-
-#include "_ansi.h"
-
-#include <machine/ieeefp.h>
-
-_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 (file)
index 4f71af2..0000000
+++ /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 (file)
index 1573ca9..0000000
+++ /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;i<jz ;i++) {        /* compute 1-q */
-               j = iq[i];
-               if(carry==0) {
-                   if(j!=0) {
-                       carry = 1; iq[i] = 0x100- j;
-                   }
-               } else  iq[i] = 0xff - j;
-           }
-           if(q0>0) {          /* 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 (file)
index e81fa0b..0000000
+++ /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 (file)
index fffa380..0000000
+++ /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 (file)
index 3a27966..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright © 2013 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 (file)
index f547c82..0000000
+++ /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 (file)
index 2f46ec3..0000000
+++ /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 (file)
index 2aaed32..0000000
+++ /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 (file)
index 9264d81..0000000
+++ /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 (file)
index 7000600..0000000
+++ /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 <limits.h>
-#include <float.h>
-
-#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 (file)
index da81845..0000000
+++ /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/megadongle-v0.1/.gitignore b/src/megadongle-v0.1/.gitignore
deleted file mode 100644 (file)
index f735e6e..0000000
+++ /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 (file)
index bbe2ea5..0000000
+++ /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.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 (file)
index e6821a3..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include <ao.h>
-#include <ao_exti.h>
-#include <ao_packet.h>
-#include <ao_send_packet.h>
-
-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 (file)
index 4d3ad4d..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-/* 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 (file)
index adea578..0000000
+++ /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 (file)
index 2b18f8e..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright © 2013 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 <ao_flash_stm_pins.h>
-
-/* 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_ */
index b7523758ce8396c931c3e0c71c3b32b8c2ea2e4b..5eb97206d0004b286cf3920117f8b25e749cdefc 100644 (file)
@@ -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 \
index 32154fa69e0bd5792ffd809add1b92b1177025a4..c7d1b22d374a28caddfc698e19b81f8b39ba1af8 100644 (file)
@@ -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 \
index 1cfa1209df781ffe788dd00511a4c9a67e7cb110..df557e60f1b9168e42e9afe2cb247e25fbe25f23 100644 (file)
@@ -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();
index baeae5b81ac8c9f0be54a9cab7e205d888c94089..a73d4c1d3dbff1b1607550e964c985908583fa0c 100644 (file)
@@ -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 : {
index 6e8cae1499aa6665e0450f5ac83ca70c32450be1..f80d61b0743ef297e6eb41dd69503b6fef0414f7 100644 (file)
@@ -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 \
index 9bb636f17622c516461d868b59fe7f972b10976d..0342838e3c3f2d632ee3765159c14204e1f8b02c 100644 (file)
@@ -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 \
index d377959490d09b632271ba88964a34f75540538b..774d4adc742e56ba23e7b8cbb0603c14d35f3185 100644 (file)
@@ -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 \
index 2b9fe14fd638ecfade0724eba42d4101004e4122..1ab2eea188a56453f43f3d8c1386fddef456ad8d 100644 (file)
@@ -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 \
index 02a23a9582f18aa6bb0e24c1c643903f8b43b3c9..945f7c60e19f9f9095478054c8dcf7972fc69ee5 100644 (file)
@@ -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 : {
index 8606b1aed8e00fe7d6731e2bd3c14997cce438a3..443a6afbdb5dc1297f3297d11f6e05ee43475446 100644 (file)
@@ -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 \
index 5de65eb5441d044f56b1f161cf1c34d9f10597ba..d3edbe9fb2168ed9eefd93ace5795bdd439382b6 100644 (file)
@@ -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/Makefile.teledongle b/src/product/Makefile.teledongle
deleted file mode 100644 (file)
index b7c2898..0000000
+++ /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 (file)
index 7311c21..0000000
+++ /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 (file)
index e9b144c..0000000
+++ /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 (file)
index ff8b9d5..0000000
+++ /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 (file)
index e1e350a..0000000
+++ /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:
index 1f0edb0596a089490929ef494af6dde59b33880f..a680ca181e7afd2771bc35f3d71ddab91fe3cbe8 100644 (file)
@@ -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++)) {
index 8aac79cd141d4b6ed209836f80007116be5e6fa2..8fed3069a3eef7eefe3081a13c4dae1908a7be14 100644 (file)
@@ -57,7 +57,7 @@ ao_pips(void)
 int
 main(void)
 {
-       ao_led_init(LEDS_AVAILABLE);
+       ao_led_init();
        ao_timer_init();
 
        /* Init external hardware */
index a10cb384332f9f570f4f03f7e7ff0424303de238..1266fee74f2f59706120b0541b9fecb23738f375 100644 (file)
@@ -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();
index 14414a48d44d562f46dfb1c7bc2dab3e416c2dce..d9cb676b780db09447cfad71c07e476bbbb874e5 100644 (file)
@@ -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();
index ac08979f9d976ba872eca6510b99d5e1f3cf6b53..1b04edc5d4a163a1e86c94e7a54b5491a6f91a89 100644 (file)
@@ -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();
 }
index 0142f9e329004ab713504c3a351490c3f0de49ed..ae129233d5e2a1c209679d834981b119e1825645 100644 (file)
@@ -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();
index c2bbc30e12114e14d93408858de3df02e513fe52..3a989f5a667f0a544fa9f6745cd822256fce65d6 100644 (file)
 #include <ao_flight.h>
 #include <math.h>
 
-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)
@@ -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))
@@ -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)
index d1c60804b6620da6d42ec3bd14311f088531ab03..5db362937717d43427a78a35577574a5cdf815a4 100644 (file)
 
 #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/spiradio-v0.1/.gitignore b/src/spiradio-v0.1/.gitignore
deleted file mode 100644 (file)
index 8e39138..0000000
+++ /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 (file)
index 2c77e32..0000000
+++ /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 (file)
index cd7a9cd..0000000
+++ /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 (file)
index 472da16..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 07d33aa..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include <ao.h>
-#include <ao_radio_spi.h>
-
-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();
-}
index dcdcf07394d22ad4bcb6b9a358114066d385a56b..71039598634181bce1f9e0eca1eb0ec3355599df 100644 (file)
@@ -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
 
index d4569c1a9b80539074976472e451096a4320a919..ccce37a5a9b2cdbd175fe25b1bc01c4db2bfb4c8 100644 (file)
@@ -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 \
index f6c8e3df83f0dafa48b40ed03be9b528ac9e6bc9..4b963e4281fa3e5ebb3e5478d3deae5e9395284f 100644 (file)
@@ -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);
@@ -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" },
index a4c249a304ca6451af1899db79c1120f69119bc3..1db58f10b131e2767ff5f6c5ca1b01c1cf1d60db 100644 (file)
@@ -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 \
index 13a31288a3877546e585fa3696e32a12ffae0db6..cb8e10e80eefa56d36ed72f0854bcbb558645980 100644 (file)
@@ -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 }
 };
index 46a77272f9bfeb37825f808ba1f75569919048c6..fa0d008f36bff178aa6d6f4db2460a1ce9958566 100644 (file)
@@ -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 \
index 1b443b1fc387df62ad135b809741268e12d0f97f..593a87439a93ba75b79e813114df72032763de99 100644 (file)
@@ -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);
 }
 
@@ -198,7 +197,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" },
index dde51a684cc85308645e2bb0587ec2dad77b47b8..66ad163716407d1cb1e21b1e904ba43caa4b0a5c 100644 (file)
@@ -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
 
index 4d0d27c7af385f037b330b90c22868a1f322b82d..8173b349c33446f6ba14e7bc644e400746c7c001 100644 (file)
@@ -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
index 78c41685f7f94d852ee14f5554eb643009a2fe26..97a9c4373e2282a500af4db31a40d4a8f353ec7c 100644 (file)
@@ -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 : {
index 806b4842306d4281aee9c742e70910fcd29e78be..1ebbc7a2afcb15b30d2c24fe692547edec4e1073 100644 (file)
@@ -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
 
 
index 098454e15f20fab2cde1da52e52adb6cdadac62e..d8f072a7684cd39cc86302fde907bf35e7613c5f 100644 (file)
@@ -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
 
index 6a8c7113e9c6a433f2208b12995b04ab777dafd4..e352ed36601d85409801dc8c605a8a49a07536e7 100644 (file)
@@ -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 : {
index 8a7fda4a9305a3b658bf1eb7af48162e5207dc9a..5737cd50cf02acdc972a05f012d331406d3f19dd 100644 (file)
@@ -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 },
 };
index 24912bb28b34849d7b2297ff8c11e6e6cd63a4fb..ffdcccc05adaf48bc1b885935238eec6d7c35517 100644 (file)
@@ -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;
 }
 
@@ -100,7 +81,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 +158,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 +184,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 },
 };
index 679dba4499623d33f57671830287a7073b0180f2..e56375ca35a9524314e601cd84fb776ce58ebc07 100644 (file)
 
 #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)
 
 
 #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
  */
 
-#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 */
index 522059bc3d2193510e54d431d0bd9fd6e9bd45d5..7fe6a732478b442f1b9ce445f7cb253d01cadd88 100644 (file)
@@ -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
 
 #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);
@@ -166,8 +178,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<<bit),bus,speed)
-#define ao_spi_put_bit(reg,bit,pin,bus) ao_spi_put_mask(reg,(1<<bit),bus)
+#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,bus) ao_spi_put_mask(reg,(1<<bit),bus)
 
 #define ao_enable_port(port) do {                                      \
                if ((port) == &stm_gpioa)                               \
@@ -196,9 +208,9 @@ ao_spi_try_get_mask(struct stm_gpio *reg, uint16_t mask, uint8_t bus, uint32_t s
        } while (0)
 
 
-#define ao_gpio_set(port, bit, pin, v) stm_gpio_set(port, bit, v)
+#define ao_gpio_set(port, bit, v) stm_gpio_set(port, bit, v)
 
-#define ao_gpio_get(port, bit, pin) stm_gpio_get(port, bit)
+#define ao_gpio_get(port, bit) stm_gpio_get(port, bit)
 
 #define ao_gpio_set_bits(port, bits) stm_gpio_set_bits(port, bits)
 
@@ -208,9 +220,9 @@ ao_spi_try_get_mask(struct stm_gpio *reg, uint16_t mask, uint8_t bus, uint32_t s
 
 #define ao_gpio_get_all(port) stm_gpio_get_all(port)
 
-#define ao_enable_output(port,bit,pin,v) do {                  \
+#define ao_enable_output(port,bit,v) do {                      \
                ao_enable_port(port);                           \
-               ao_gpio_set(port, bit, pin, v);                 \
+               ao_gpio_set(port, bit, v);                      \
                stm_moder_set(port, bit, STM_MODER_OUTPUT);\
        } while (0)
 
@@ -223,7 +235,7 @@ ao_spi_try_get_mask(struct stm_gpio *reg, uint16_t mask, uint8_t bus, uint32_t s
 #define AO_OUTPUT_PUSH_PULL    STM_OTYPER_PUSH_PULL
 #define AO_OUTPUT_OPEN_DRAIN   STM_OTYPER_OPEN_DRAIN
 
-#define ao_gpio_set_output_mode(port,bit,pin,mode) \
+#define ao_gpio_set_output_mode(port,bit,mode) \
        stm_otyper_set(port, pin, mode)
 
 #define ao_gpio_set_mode(port,bit,mode) do {                           \
@@ -248,8 +260,8 @@ ao_spi_try_get_mask(struct stm_gpio *reg, uint16_t mask, uint8_t bus, uint32_t s
                stm_moder_set(port, bit, STM_MODER_INPUT);      \
        } while (0)
 
-#define ao_set_output(port, bit, pin, v) do {                  \
-               ao_gpio_set(port, bit, pin, v);                 \
+#define ao_set_output(port, bit, v) do {                       \
+               ao_gpio_set(port, bit, v);                      \
                stm_moder_set(port, bit, STM_MODER_OUTPUT);     \
        } while (0)
 
index 0b4e6012ef584c29471a63cebdb34881a6ef9f8f..2746d7f8e60b558e48056f2b3653daf237a6be2b 100644 (file)
 
 #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) __reentrant
+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) __reentrant
 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);
 }
index 4f477122784975f78db3eda27e2ac021c342ccda..d3e3338d9c94d7e1e961b29d7606b64193659a79 100644 (file)
@@ -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;
        
index d5893c80a4cc96db463c0891087a6d883e92bf69..b82046d7fca221ec200ddb00e84aad75ea3c7ccb 100644 (file)
 
 #include <ao_flash_pins.h>
 
+#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)
 #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
index 59cad4951058fce99d360da9ce91cbc47f58720c..23805aa8929a1bbc957ba3c20dadff8643ad3ee0 100644 (file)
@@ -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;
index eb1ed0b52ba1caa8698da8418709c64c96923a15..d8be36670baf608726adfa910b9aa70e4b31d5ed 100644 (file)
@@ -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();
 }
index 10d5d620731497c599610fca601d9f5348d664b1..1947012b86000357445af1ce739a7616cbb03fbf 100644 (file)
@@ -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_led.c b/src/stm/ao_led.c
deleted file mode 100644 (file)
index a7033db..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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, foo, 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, foo, 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, foo, ~ao_gpio_get(ao_leds[i].port, ao_leds[i].pin, foo));
-#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) __reentrant
-{
-       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, foo, 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 (file)
index 0000000..7dcbb66
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * Copyright © 2012 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#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
+               }
+       }
+}
index 53000a170f19564ab1d5689559c40ad981099852..341f8887a6ab753237d50f7a6c8eeb0673ff4820 100644 (file)
@@ -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/stm/ao_romconfig.c b/src/stm/ao_romconfig.c
deleted file mode 100644 (file)
index 63a48be..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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
index 2afee5b5da3bd9cc2b9b957e3056cdd1cbc2f9b7..c1a2f1bdda0c1a509db01993f0a7fa6f71b6b98e 100644 (file)
@@ -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;
index 05078f3b841b203b9b550040bc191b6aeaeda193..1a04a2899a825afa758726d5625d3c11a7536c34 100644 (file)
@@ -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
index 9d118b721349d2198f69e37f7e32dd73ee593734..9e9436cfa685dae451ae27ff59b8c9af6b32be1c 100644 (file)
@@ -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)
index b06814d23184fcf992b7df4fc880fd598986c31c..d7cbd5b7616902ba6fb2ad504c010d14b3ef1bdf 100644 (file)
@@ -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 }
 };
index 1da817e7a0db36267524bbf2b6dbf33cf80c4bb3..0109ec815525b2acdf3c6abe36cf5c86822794e6 100644 (file)
@@ -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/stm32f4-disco/.gitignore b/src/stm32f4-disco/.gitignore
new file mode 100644 (file)
index 0000000..deb5083
--- /dev/null
@@ -0,0 +1,3 @@
+stm32f4-disco-*.elf
+stm32f4-disco-*.ihx
+stm32f4-disco-*.map
diff --git a/src/stm32f4-disco/Makefile b/src/stm32f4-disco/Makefile
new file mode 100644 (file)
index 0000000..de30316
--- /dev/null
@@ -0,0 +1,81 @@
+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_task.c \
+       ao_stdio.c \
+       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)
+
+CFLAGS = $(STM32F4_CFLAGS) -I$(aoschemelib)
+
+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)
+
+$(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:
+       rm -f *.o *.elf *.ihx *.map
+
+install:
+
+uninstall:
diff --git a/src/stm32f4-disco/ao_disco.c b/src/stm32f4-disco/ao_disco.c
new file mode 100644 (file)
index 0000000..ab3c034
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include <ao.h>
+#include <ao_scheme.h>
+#include <ao_usb.h>
+
+static void scheme_cmd() {
+       ao_scheme_read_eval_print(stdin, stdout, false);
+}
+
+static const struct ao_cmds scheme_cmds[] = {
+       { scheme_cmd,   "l\0Run scheme interpreter" },
+       { 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)
+{
+       ao_clock_init();
+       ao_timer_init();
+       ao_task_init();
+
+       ao_led_init();
+       ao_usart_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
new file mode 100644 (file)
index 0000000..6a18d59
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+#ifndef _AO_PINS_H_
+#define _AO_PINS_H_
+
+/* Clock tree configuration */
+#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_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      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_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      AO_LED_0
+
+#define LED_1_PORT     (&stm_gpioe)
+#define LED_1_PIN      3
+#define LED_RED                AO_LED_0
+
+#define AO_LED_PANIC   LED_RED
+
+#define AO_CMD_LEN     128
+
+/* 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
+
+/* USB */
+
+#define HAS_USB                        1
+#define USE_USB_STDIO          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 (file)
index 0000000..b1eac30
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright © 2016 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#ifndef _AO_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
diff --git a/src/stm32f4/Makefile-flash.defs b/src/stm32f4/Makefile-flash.defs
new file mode 100644 (file)
index 0000000..1a2aa75
--- /dev/null
@@ -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 (file)
index 0000000..03d92e4
--- /dev/null
@@ -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 (file)
index 0000000..c39633c
--- /dev/null
@@ -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 \
+       -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 (file)
index 0000000..be185a5
--- /dev/null
@@ -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 (file)
index 0000000..5d6e1f4
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright © 2012 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+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 (file)
index 0000000..82d33c0
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+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 */
+               *(.rodata*)     /* Constants */
+       } > rom
+
+       .exidx : {
+               *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+       } > 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 (file)
index 0000000..2db0e38
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+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 (file)
index 0000000..73dc3e9
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#ifndef _AO_ARCH_H_
+#define _AO_ARCH_H_
+
+#include <stdio.h>
+#include <stm32f4.h>
+
+#ifndef AO_STACK_SIZE
+#define AO_STACK_SIZE  2048
+#endif
+
+#ifndef HAS_TASK_QUEUE
+#define HAS_TASK_QUEUE 1
+#endif
+
+#define AO_STACK_ALIGNMENT __attribute__ ((aligned(8)))
+
+#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 */
+
+#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)
+
+/* 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
new file mode 100644 (file)
index 0000000..b1ffb5b
--- /dev/null
@@ -0,0 +1,340 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#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)
+#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)
+
+/* usart */
+
+void
+ao_usart_init(void);
+
+
+#endif /* _AO_ARCH_FUNCS_H_ */
diff --git a/src/stm32f4/ao_exti.h b/src/stm32f4/ao_exti.h
new file mode 100644 (file)
index 0000000..0216f35
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#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 (file)
index 0000000..1e288f9
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include <ao.h>
+#include <ao_exti.h>
+
+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)
+{
+}
diff --git a/src/stm32f4/ao_interrupt.c b/src/stm32f4/ao_interrupt.c
new file mode 100644 (file)
index 0000000..24f56ab
--- /dev/null
@@ -0,0 +1,290 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include <ao.h>
+#include "stm32f4.h"
+#include <string.h>
+#include <ao_boot.h>
+
+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(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)
+
+#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, exti15_10),
+       i(0xe4, rtc_alarm),
+       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_serial_stm32f4.c b/src/stm32f4/ao_serial_stm32f4.c
new file mode 100644 (file)
index 0000000..bcecc79
--- /dev/null
@@ -0,0 +1,544 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include <ao.h>
+#include <ao_exti.h>
+
+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
+}
diff --git a/src/stm32f4/ao_timer.c b/src/stm32f4/ao_timer.c
new file mode 100644 (file)
index 0000000..d6ef9bc
--- /dev/null
@@ -0,0 +1,284 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include "ao.h"
+#include <ao_task.h>
+
+#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");
+
+#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;
+
+       /* 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))
+               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 == 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);
+       pllcfgr |= (AO_PLL1_Q << STM_RCC_PLLCFGR_PLLQ);
+       pllcfgr |= (AO_PLL1_R << STM_RCC_PLLCFGR_PLLR);
+       /* PLL source */
+       pllcfgr &= ~(1 << STM_RCC_PLLCFGR_PLLSRC);
+#if AO_HSI
+       pllcfgr |= (STM_RCC_PLLCFGR_PLLSRC_HSI << STM_RCC_PLLCFGR_PLLSRC);
+#endif
+#if AO_HSE
+       pllcfgr |= (STM_RCC_PLLCFGR_PLLSRC_HSE << STM_RCC_PLLCFGR_PLLSRC);
+#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 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 PLL clock on PA8 and SYCLK on PC9 for measurments */
+
+       stm_rcc.ahb1enr |= ((1 << STM_RCC_AHB1ENR_IOPAEN) |
+                           (1 << STM_RCC_AHB1ENR_IOPCEN));
+
+       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_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);
+
+       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/ao_usart_stm32f4.c b/src/stm32f4/ao_usart_stm32f4.c
new file mode 100644 (file)
index 0000000..28331b1
--- /dev/null
@@ -0,0 +1,350 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include <ao.h>
+#include <ao_exti.h>
+
+/* 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/ao_usb_gen.c b/src/stm32f4/ao_usb_gen.c
new file mode 100644 (file)
index 0000000..760afad
--- /dev/null
@@ -0,0 +1,712 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#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 (file)
index 0000000..b059ddb
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#ifndef _AO_USB_GEN_H_
+#define _AO_USB_GEN_H_
+
+#include "ao.h"
+#include "ao_usb.h"
+#include "ao_product.h"
+#include <stdint.h>
+
+#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 (file)
index 0000000..e65c365
--- /dev/null
@@ -0,0 +1,1144 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#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
+}
+      
+
+
+*/
diff --git a/src/stm32f4/registers.ld b/src/stm32f4/registers.ld
new file mode 100644 (file)
index 0000000..bc92410
--- /dev/null
@@ -0,0 +1,75 @@
+
+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_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;
+
+/* AHB1 */
+
+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;
+
+/* AHB2 */
+
+stm_usb    = 0x50000000;
+stm_rng    = 0x50060800;
+
+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 (file)
index 0000000..dcdce66
--- /dev/null
@@ -0,0 +1,1522 @@
+/*
+ * Copyright © 2018 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#ifndef _STM32F4_H_
+#define _STM32F4_H_
+
+#include <stdint.h>
+
+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_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
+#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_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
+#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_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
+
+#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;
+};
+
+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);
+}
+
+#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_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
+#define STM_ISR_UART10_POS             89
+
+#define STM_ISR_EXTI15_10_POS          40
+
+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)
+
+#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 {
+       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
+
+#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 */
+
+/* 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
+
+   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_ */
index 4e9fa55153f2873b076c5b9a23c043bbf9b18d2b..447ddf131b4a3b223413328252a175db2728a0c0 100644 (file)
@@ -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.
index 05887d0ef92bf26f1ba65cc4d125887f40164ad0..4d9b81ae0ad16d0121b8d79ee75638c994b6b618 100644 (file)
@@ -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
 
 
index eb285e07d297b03975a587a7a47cadbf918a22a3..90c42ad221d82e493f2888a0b564997dcaf4cbab 100644 (file)
@@ -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 : {
index 74fdf3eaeb3b595268938a0965219e157e131954..64e1d00cf0ab5b1aadebebdd389914a1d8d63c5e 100644 (file)
@@ -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 : {
index 2b23dc501dbd4898d8258165687d2dca3d7cbbb2..d48726a1c66ad13761ce8b32ff8f1fadbb87f7a0 100644 (file)
@@ -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;
 }
 
@@ -103,10 +87,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;
@@ -180,7 +163,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" },
index 5c5085d9685b17bbcc74b4e4d89c3006655c0a3b..22e706b2a975bca6cdb24b210dfbfc56ac52bf32 100644 (file)
 
 #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)
 
 
 #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
  */
 
-#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;
index 96c033f9712ce379f481c43d4fe621e52f663e2d..70f273d3ba46ce081ca8326113c16582668ca627 100644 (file)
@@ -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<<bit),bus,speed)
-#define ao_spi_put_bit(reg,bit,pin,bus) ao_spi_put_mask(reg,(1<<bit),bus)
+#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,bus) ao_spi_put_mask(reg,(1<<bit),bus)
 
 #if AO_POWER_MANAGEMENT
 extern struct ao_power ao_power_gpioa;
@@ -212,13 +212,13 @@ static inline void ao_disable_port(struct stm_gpio *port)
        }
 }
 
-#define ao_gpio_set(port, bit, pin, v) stm_gpio_set(port, bit, v)
+#define ao_gpio_set(port, bit, v) stm_gpio_set(port, bit, v)
 
-#define ao_gpio_get(port, bit, pin) stm_gpio_get(port, bit)
+#define ao_gpio_get(port, bit) stm_gpio_get(port, bit)
 
-#define ao_enable_output(port,bit,pin,v) do {                  \
+#define ao_enable_output(port,bit,v) do {                      \
                ao_enable_port(port);                           \
-               ao_gpio_set(port, bit, pin, v);                 \
+               ao_gpio_set(port, bit, v);                      \
                stm_moder_set(port, bit, STM_MODER_OUTPUT);\
        } while (0)
 
@@ -238,7 +238,7 @@ static inline void ao_disable_port(struct stm_gpio *port)
        } while (0)
 
 #define ao_enable_cs(port,bit) do {                            \
-               ao_enable_output(port, bit, pin, 1);            \
+               ao_enable_output(port, bit, 1);         \
        } while (0)
 
 #define ao_spi_init_cs(port, mask) do {                                \
index 15137230a9b84d2bbba7cec8d24817b308beaafc..31af7f4a00ab74d19fc2fa2a54808ba286630b87 100644 (file)
@@ -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);
@@ -386,7 +386,7 @@ ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant
 void
 ao_beep_init(void)
 {
-       ao_enable_output(BEEPER_PORT, BEEPER_PIN, BEEPER, 0);
+       ao_enable_output(BEEPER_PORT, BEEPER_PIN, 0);
 
        /* Leave the timer off until requested */
        stm_rcc_enr &= ~(1 << STM_RCC_TIMER);
index a67f6f1a26e2f4fb4dcef390d9bc6db7d6d99ded..81878d895ffaebbf9f19422cdc60abf6b7d03a8c 100644 (file)
@@ -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
deleted file mode 100644 (file)
index 0f39bef..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include "ao.h"
-
-__pdata 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) __reentrant
-{
-       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 (file)
index 0000000..1564535
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * Copyright © 2012 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#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/stmf0/ao_romconfig.c b/src/stmf0/ao_romconfig.c
deleted file mode 100644 (file)
index 9d5fd6f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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;
-
index 1a6198a79308cd66808629ec999521113ed3c2b6..17c934a53e5b4a06f3ec9b45c523a55c5bf5191c 100644 (file)
@@ -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);
index 50fd67b8517e6fc7119ad9225c140605e5d30f2a..1def5f69f8e1c1d77d7a6a9d7344e4adcc1001fc 100644 (file)
@@ -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)
index c4860d8e063a02ca6c85366acc29ac9eb0393799..ff294849d73534c6c9037f2da842bdbf6b0eb090 100644 (file)
@@ -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/teleballoon-v1.1/.gitignore b/src/teleballoon-v1.1/.gitignore
deleted file mode 100644 (file)
index 21b236c..0000000
+++ /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 (file)
index c6f6345..0000000
+++ /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 (file)
index 2bf4d59..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index bdbf91d..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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();
-}
index 285887783b3fee72078a0c21753eccf1fa35052a..ddbfaf5f7e2fa52a33456b97897ff04e9a3d8e35 100644 (file)
@@ -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 \
@@ -49,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 \
@@ -88,7 +85,6 @@ ALTOS_SRC = \
        ao_packet.c \
        ao_companion.c \
        ao_aprs.c \
-       $(MATH_SRC) \
        $(PROFILE) \
        $(SAMPLE_PROFILE) \
        $(STACK_GUARD)
index d98e85d782521039d4b3576c40d48ac51d7f1d66..cb0ec838e3bb90c9244297bd0d0e5b559a523967 100644 (file)
@@ -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
 #define AO_IGNITER_MAIN_PORT   (&stm_gpioa)
 #define AO_IGNITER_MAIN_PIN    9
 
-#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
  */
index 2432c2729e9d45559d02a4c075c4e549d33b116f..94393da099fad6f6248a25a302f462399a8522a1 100644 (file)
@@ -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();
@@ -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();
@@ -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-v1.0/.gitignore b/src/telebt-v1.0/.gitignore
deleted file mode 100644 (file)
index 1acfbfc..0000000
+++ /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 (file)
index 2c77e32..0000000
+++ /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 (file)
index a779749..0000000
+++ /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 (file)
index ca751be..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index a56adc9..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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();
-}
index 4636c046fd2f4813af436ac268b195fe5303430b..9892ad5fcc7cef849d5a1a3779f04dc82bf9dc4c 100644 (file)
@@ -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 \
index 63633c90ceea197c44bef6d1bf078f1d67f28319..3d48b6b928563c7bb1ed93bddc4af283a9ce2f98 100644 (file)
@@ -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();
 
index 38ac7513d055e94530d7982adbda21503389991c..4ad3287dd86d27b0c0a1bb4b49d125d947ba6598 100644 (file)
@@ -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 \
index 953ec4bc98c124a1e55f1e26b0f28b7e8543c6e3..7c3c6e2a7c625cac14715383a9311c672efceb9a 100644 (file)
@@ -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-v0.1/.gitignore b/src/teledongle-v0.1/.gitignore
deleted file mode 100644 (file)
index 9826814..0000000
+++ /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 (file)
index 710b4a2..0000000
+++ /dev/null
@@ -1 +0,0 @@
---directory=..
diff --git a/src/teledongle-v0.1/Makefile b/src/teledongle-v0.1/Makefile
deleted file mode 100644 (file)
index 4842510..0000000
+++ /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 (file)
index f6ea8c6..0000000
+++ /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 (file)
index 710b4a2..0000000
+++ /dev/null
@@ -1 +0,0 @@
---directory=..
diff --git a/src/teledongle-v0.2/Makefile b/src/teledongle-v0.2/Makefile
deleted file mode 100644 (file)
index ce4ab43..0000000
+++ /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/teledongle-v1.8/.gitignore b/src/teledongle-v1.8/.gitignore
deleted file mode 100644 (file)
index 9a30cbb..0000000
+++ /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 (file)
index 6c05ce9..0000000
+++ /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.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 (file)
index 72bea36..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-/* 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 (file)
index 7fd6acd..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include <ao.h>
-#include <ao_exti.h>
-#include <ao_packet.h>
-#include <ao_send_packet.h>
-
-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;
-}
index 32899af239f0bf272c947d65fddc4bfdf5eb7ae4..69abea6edef1eb50d0aba8755c9c830e75c05ac6 100644 (file)
@@ -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/telefire-v0.1/.gitignore b/src/telefire-v0.1/.gitignore
deleted file mode 100644 (file)
index 4d4f420..0000000
+++ /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 (file)
index 2c77e32..0000000
+++ /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 (file)
index 99d2982..0000000
+++ /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 (file)
index 8266589..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 706a23a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include <ao.h>
-#include <ao_pad.h>
-#include <ao_74hc497.h>
-#include <ao_radio_cmac_cmd.h>
-
-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 (file)
index 4d4f420..0000000
+++ /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 (file)
index 2c77e32..0000000
+++ /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 (file)
index 944543c..0000000
+++ /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 (file)
index 65f5bdc..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 5187d5b..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include <ao.h>
-#include <ao_pad.h>
-#include <ao_74hc165.h>
-#include <ao_radio_cmac_cmd.h>
-
-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();
-}
index 15e1fa111c96f0623b0f75d3c9ba62bfe666a5a4..c15e06bf1e4adf70167cf06315b09443f443d1c9 100644 (file)
 #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
 #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 */
 #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)
 #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
index bdcf3213ddac77c861ef844ce7b9303158784947..89541a024636504284ab0e12e220e2b51bdded75 100644 (file)
@@ -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();
 }
index 53f088cb2eabfdb05580300ae21a29843203c9d4..773c8f69c685066b5d8248557354000a96b47d43 100644 (file)
@@ -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 \
index d36d9d824d3c54589bc9eff801be7a9c237c04fd..15b158effc9ce12f21aac2d2a357a78f39b2a712 100644 (file)
@@ -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
index 115b3e914e46d52184a9417b1ec9643096555073..6506235a975be2c596c401cd254498a5f783c76e 100644 (file)
 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);
 }
 
-__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 },
 };
index 6454d6fd71a0c062ddc6359bc269244ddcd91db6..72171fac51429baf365d2c4a9514dbbc3f50c197 100644 (file)
@@ -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 \
index bdcf3213ddac77c861ef844ce7b9303158784947..89541a024636504284ab0e12e220e2b51bdded75 100644 (file)
@@ -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();
 }
index 30985f9ce0dfa033991333663558881f312ba120..f43ece71eb647e72f9bc2bd613fa54bb0b263556 100644 (file)
@@ -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 \
index 469e9937b89d9214631e5393abde407b6bf734b1..01faace2dfad944deff3825f8a5a9fc546c9ad69 100644 (file)
@@ -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
index 46eb0ac5edc6278e7175d527a40d364eb3916d5f..0365f91f354e64f5b9c808d35adcc282dbaf2021 100644 (file)
@@ -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 \
index 19d088d381853e67590d340c5c5dec06473eba4e..617efa65a346e482b55ef13721f7dc39b669180a 100644 (file)
@@ -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 \
index 998c20086ccccbfeea4270df7aecdce0572429e2..1ba67f675cc0c50d6f5f972771765bc2b168492f 100644 (file)
@@ -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.1/.gitignore b/src/telelco-v0.1/.gitignore
deleted file mode 100644 (file)
index 54267ec..0000000
+++ /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 (file)
index f7628c3..0000000
+++ /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 (file)
index 649bf58..0000000
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include <ao.h>
-#include <ao_lco.h>
-#include <ao_event.h>
-#include <ao_seven_segment.h>
-#include <ao_quadrature.h>
-#include <ao_lco_func.h>
-#include <ao_radio_cmac.h>
-
-#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 (file)
index 5721eed..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 2311599..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 608f093..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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_exti.h>
-#include <ao_packet.h>
-#include <ao_companion.h>
-#include <ao_profile.h>
-#include <ao_pyro.h>
-#include <ao_aes.h>
-#include <ao_seven_segment.h>
-#include <ao_quadrature.h>
-#include <ao_button.h>
-#include <ao_lco.h>
-#include <ao_lco_cmd.h>
-#include <ao_radio_cmac_cmd.h>
-
-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;
-}
index 4ccf494c73bf22e3f7be1d613f12f44494a920ed..9307aa2daa7861a20ada6a52f3f414d9b782e268 100644 (file)
@@ -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 \
index bc325e069523db073319a677d41b6fa7c9349f53..f3850ebd199c231d3b375988dd706ac0ab0955e1 100644 (file)
 #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
index 3266da008caeb50a1f68e93c114ce9e5430d5769..26f49d5942f467c351301de80671e25bdbe4fd9f 100644 (file)
@@ -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;
 }
index 8279cac1fd81ec7090e4e187eb4938ae794bf1a7..91ae67f092aa851677d69d65e864ee3cf6c27723 100644 (file)
@@ -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 \
index f0da4fe448a9625d79d37ed54dfbef585630eea3..3d06a647246d4f6523195d94c447fadeede5687a 100644 (file)
 #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
index 7b04d386f8985d6521f9251610322bc66a1a3e9c..4eba3597950879078ae5969ad1079fe675fc7748 100644 (file)
@@ -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;
 }
index c2592bf86e3c1b7a3781c3a9537982227f6a8b56..567ddf419ad167f32ec760ed24b562679c54a9e3 100644 (file)
@@ -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 \
index 6023739cb182f7d5e38ad5b5e726cb1e967bd5d9..c806268f7964991429d72f8204dc691f66c4e1a5 100644 (file)
 #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
index 7b04d386f8985d6521f9251610322bc66a1a3e9c..c2ca68aa58cf4b29c18bd95d98bbf55885ae6c61 100644 (file)
@@ -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;
 }
index a9933d599a8e6517ef4bb450ad2783e7913a7d07..daecf380260a2e82e277e6091a267921c5d06c5f 100644 (file)
@@ -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
@@ -282,12 +282,12 @@ 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;
 }
 
-__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 }
index 95998dc781775ec7b5ea0641822bd956a9c55e64..e06633145fe7a1dc097c5d4e4d13a3bc6d2749c5 100644 (file)
 #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
 
 #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)
 #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 */
 
index 9693c6576cf712ace1791a50f50be69f89ebadf5..59582569ffd1a1e78905be186f81aa916c062701 100644 (file)
@@ -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;
 }
index c68f3eb5dd1dae776b262b0458e12c9b861573b0..6a114aae2658085a308a642312cecfd3c9bc54b8 100644 (file)
@@ -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 \
index 1941e03d7468c2aa9ea5f032be97ea2ba3c9f5b9..3ef88c7476a93ae742e790fc137a855a4ed2cebf 100644 (file)
@@ -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
index b3fcd200745c2c160bc08fbf38ab3951f22ff4b2..6ced1912dbb667fdb85f2a14a24d5f7cb164fd9d 100644 (file)
@@ -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;
 }
index 28ed7c98e93194b5b804995a68da732a906aac37..fde35aae52b6a45574375d1e2ecc8e0f52a828d5 100644 (file)
@@ -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 \
@@ -69,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 \
@@ -112,7 +96,6 @@ ALTOS_SRC = \
        ao_companion.c \
        ao_pyro.c \
        ao_aprs.c \
-       $(MATH_SRC) \
        $(PROFILE) \
        $(SAMPLE_PROFILE) \
        $(STACK_GUARD)
index 94e77f9864bce76cbd64887d0593a6e1bba907da..0208fafa37cae69916683e5326bff7ad0c14f0e7 100644 (file)
 #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
 /* 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
  */
index 3cfc9b4479aa8a5a9d7e6573a6ad8c4fea96a291..d6ecbf318ae430b1d495257e04bb2009c46b6517 100644 (file)
@@ -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();
@@ -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();
@@ -98,6 +98,7 @@ main(void)
        ao_sample_profile_init();
 #endif
        
+       ao_led_off(LEDS_AVAILABLE);
        ao_start_scheduler();
        return 0;
 }
index 4a1b3908ab3cbcf2dea2b8a7942b3c10e93e99d1..62eda4ad2192a3efb49e676cc417c62c3c4b499d 100644 (file)
@@ -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 \
@@ -72,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 \
@@ -115,7 +98,6 @@ ALTOS_SRC = \
        ao_companion.c \
        ao_pyro.c \
        ao_aprs.c \
-       $(MATH_SRC) \
        $(PROFILE) \
        $(SAMPLE_PROFILE) \
        $(STACK_GUARD)
index d44394f0aad381a684046ece8280b2de745321b4..a154225ec77d68bb907a96fef8fd456c3e5d46d8 100644 (file)
 #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
 /* 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
  */
index 2deb852e1c90e2c5ae2790ba81c2ba4475495730..328c17ff0516e5cf4ca40b523f6d26f3faa6fbed 100644 (file)
@@ -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();
 
@@ -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();
index 6a1c05b0b5d84d26de175a63ab6b4744fa427a04..78829fff4452aa120f084eaa03e6f9bb6f091b9a 100644 (file)
@@ -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 \
@@ -72,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 \
@@ -114,7 +97,6 @@ ALTOS_SRC = \
        ao_pyro.c \
        ao_aprs.c \
        ao_pwm_stm.c \
-       $(MATH_SRC) \
        $(PROFILE) \
        $(SAMPLE_PROFILE) \
        $(STACK_GUARD)
index 42c00c947924b53e354c29ee4331e4ead015c1ea..ba302c7409a2683c27bee0db87ce4ec36b1e2ebb 100644 (file)
 #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
 /* 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
  */
index 7a1c46ae5682556c07901aeee2a60c1b7f0a343f..623e8d1ea5803e6d1edb713091a93fae77edb9d6 100644 (file)
@@ -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();
 
@@ -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();
index ae22bf01951c408c8f25bf8b5b3d884b8abb40d2..b449b397accb99b2c620e8bc4169ae7a2d264670 100644 (file)
@@ -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 \
@@ -70,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 \
@@ -111,7 +94,6 @@ ALTOS_SRC = \
        ao_pyro.c \
        ao_aprs.c \
        ao_pwm_stm.c \
-       $(MATH_SRC) \
        $(PROFILE) \
        $(SAMPLE_PROFILE) \
        $(STACK_GUARD)
index 73278600cee6074e2090d06a6b24c1dbe30fc2b0..ce22390785a1c03a8097de26a422cc3e252cfa67 100644 (file)
 #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
 /* 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
  */
index 2259c751e8875964bc7f7281c0d67a24c7039b1f..d987c1ec5cb8d4c1a01c8e28a6744feec42ed465 100644 (file)
@@ -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();
 
@@ -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-v0.1-sirf/.gitignore b/src/telemetrum-v0.1-sirf/.gitignore
deleted file mode 100644 (file)
index 7698f5a..0000000
+++ /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 (file)
index d138b5e..0000000
+++ /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 (file)
index d25d7ad..0000000
+++ /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 (file)
index 710b4a2..0000000
+++ /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 (file)
index a6634c2..0000000
+++ /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 (file)
index c221215..0000000
+++ /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 (file)
index e9a51ea..0000000
+++ /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 (file)
index 476a3b0..0000000
+++ /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 (file)
index c221215..0000000
+++ /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 (file)
index e9a51ea..0000000
+++ /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 (file)
index 61e9273..0000000
+++ /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 (file)
index c221215..0000000
+++ /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 (file)
index 710b4a2..0000000
+++ /dev/null
@@ -1 +0,0 @@
---directory=..
diff --git a/src/telemetrum-v1.2/Makefile b/src/telemetrum-v1.2/Makefile
deleted file mode 100644 (file)
index 38ba6d4..0000000
+++ /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
index d77e95852e825236075cca0b913374a4c55fb188..e0192f610721fc5221422d7ad634e55cbb1ca412 100644 (file)
@@ -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 \
@@ -49,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 \
@@ -88,7 +85,6 @@ ALTOS_SRC = \
        ao_packet.c \
        ao_companion.c \
        ao_aprs.c \
-       $(MATH_SRC) \
        $(PROFILE) \
        $(SAMPLE_PROFILE) \
        $(STACK_GUARD)
index d26a5193950d50e5015cb3e02c3650a595e5249a..e8c97ff4270461a4c3a7299202b47663250828a0 100644 (file)
@@ -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
 #define AO_IGNITER_MAIN_PORT   (&stm_gpioa)
 #define AO_IGNITER_MAIN_PIN    9
 
-#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
  */
index 5cf42a8d861775946e7ab31b29391593aab27eb6..dbf6090cc9a5e2aff1173e4fd4cf7f4fcbc6234a 100644 (file)
@@ -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();
 
@@ -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();
 
index 002cc3f6d0de0df844efd0eab2232cf35e42ccbe..071fd8dd17f889031634365980ebcc7bff064729 100644 (file)
@@ -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 \
@@ -49,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 \
@@ -88,7 +85,6 @@ ALTOS_SRC = \
        ao_packet.c \
        ao_companion.c \
        ao_aprs.c \
-       $(MATH_SRC) \
        $(PROFILE) \
        $(SAMPLE_PROFILE) \
        $(STACK_GUARD)
index 6d4369c92f1056b21b249c793b908f1d594f7a1a..f4ccc9f3a93b7abf342586eefa2a3c79fe30219f 100644 (file)
@@ -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
 #define AO_IGNITER_MAIN_PORT   (&stm_gpioa)
 #define AO_IGNITER_MAIN_PIN    9
 
-#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
  */
index 6349d18831f3f2bad5be8ddcb50c29a1c8c245d4..d75f339df3886f2edbe3fa30dfbebbbb7b7ee7c6 100644 (file)
@@ -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();
@@ -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();
 
@@ -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/telemini-v1.0/.gitignore b/src/telemini-v1.0/.gitignore
deleted file mode 100644 (file)
index 82868aa..0000000
+++ /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 (file)
index 2c77e32..0000000
+++ /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 (file)
index 4f1c8b5..0000000
+++ /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 (file)
index 568925a..0000000
+++ /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 (file)
index 2c77e32..0000000
+++ /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 (file)
index 8657e9a..0000000
+++ /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 (file)
index d2aa4c2..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index a9ee423..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 <ao_exti.h>
-
-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();
-}
index 17cff2aeb0e53497316fcc34e718888f9484d791..d91b1d21fcf8d04374fc4efe3029b3a72f134c20 100644 (file)
@@ -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
 
@@ -165,11 +165,9 @@ struct ao_adc {
 
 #define AO_IGNITER_DROGUE_PORT (&stm_gpiob)
 #define AO_IGNITER_DROGUE_PIN  7
-#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    6
-#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)
index a50268b9001ffd0247495460f469554d99343794..66f75f0ab0dc182fb523e0199aa4d0520dd374d8 100644 (file)
@@ -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;
        }
@@ -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/telenano-v0.1/.gitignore b/src/telenano-v0.1/.gitignore
deleted file mode 100644 (file)
index 0412f7d..0000000
+++ /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 (file)
index 710b4a2..0000000
+++ /dev/null
@@ -1 +0,0 @@
---directory=..
diff --git a/src/telenano-v0.1/Makefile b/src/telenano-v0.1/Makefile
deleted file mode 100644 (file)
index 2714c1e..0000000
+++ /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/telepyro-v0.1/.gitignore b/src/telepyro-v0.1/.gitignore
deleted file mode 100644 (file)
index 5166481..0000000
+++ /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 (file)
index dcac03d..0000000
+++ /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.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)
diff --git a/src/telerepeat-v1.0/.gitignore b/src/telerepeat-v1.0/.gitignore
deleted file mode 100644 (file)
index 4bb125b..0000000
+++ /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 (file)
index 2c77e32..0000000
+++ /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 (file)
index 17f6837..0000000
+++ /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 (file)
index e47d368..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 43a5ed4..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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/telescience-pwm/.gitignore b/src/telescience-pwm/.gitignore
deleted file mode 100644 (file)
index 5d9c097..0000000
+++ /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 (file)
index 493bd48..0000000
+++ /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.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 (file)
index dfccadf..0000000
+++ /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 (file)
index c55c48e..0000000
+++ /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.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 (file)
index cc1f8b7..0000000
+++ /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 (file)
index 6b7ea8c..0000000
+++ /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.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 (file)
index 29f1611..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 05bb865..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright © 2012 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include <ao.h>
-#include <ao_exti.h>
-#include <ao_packet.h>
-#include <ao_send_packet.h>
-
-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 (file)
index 7a2ceb7..0000000
+++ /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 (file)
index 8eaf929..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright © 2013 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 <ao_flash_stm_pins.h>
-
-/* 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_ */
diff --git a/src/teleshield-v0.1/.gitignore b/src/teleshield-v0.1/.gitignore
deleted file mode 100644 (file)
index 3ae78d3..0000000
+++ /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 (file)
index f54488a..0000000
+++ /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 (file)
index 535cc62..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 (file)
index 6baa88c..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index 713c49f..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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.1/.gitignore b/src/teleterra-v0.1/.gitignore
deleted file mode 100644 (file)
index 447007c..0000000
+++ /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 (file)
index d25a77b..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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_ */
diff --git a/src/teleterra-v0.2/.gitignore b/src/teleterra-v0.2/.gitignore
deleted file mode 100644 (file)
index 9daebc3..0000000
+++ /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 (file)
index e9a51ea..0000000
+++ /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 (file)
index 826c52e..0000000
+++ /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 (file)
index 5bcf2c8..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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_ */
index 135c6f1a4c6ce0a86d09c5bcfdacadeeeb251294..e1ed5728d803137cc2d7a7516b01f53933eb417c 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-#define __pdata
-#define __data
-#define __xdata
-#define __code
-#define __reentrant
+#define const
 
 #include <string.h>
 #include <stdio.h>
index 03c327ca4ecf8a776e82cb797cdcf4d17f3c4f35..afaadb1e4daddb039856c9c872288b8a49d3bcf8 100644 (file)
 #ifndef _AO_EEPROM_READ_H_
 #define _AO_EEPROM_READ_H_
 
-#define __pdata
-#define __data
-#define __xdata
-#define __code
-#define __reentrant
+#define const
 
 #include <stdint.h>
 #include <stdio.h>
index 746a681463ab4d2238f3f457c3470b9e15fcc07b..6d007575c7f91d2871ce0a223f15ada7261890c9 100644 (file)
@@ -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
@@ -231,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;
@@ -362,7 +358,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;
index 61e7905a864fbbba533ccfcc0d821fca158fb92e..11c54601b9cee77d5a784848afb3a7f44033114b 100644 (file)
@@ -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;
 
index 05334bbf158e96f53d2861c416d0a43034ddf6a2..0833e4f60a3c158b5dabb61768991b60893bed80 100644 (file)
@@ -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;
 
index d329f67b5ff407498b0992fa5e5bb8d85639ba77..c7a4891f90bbd57aa6e306f37858c9e247385c4d 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-#define __data
-#define __pdata
-#define __xdata
-#define __reentrant
 
 #include <ao_int64.h>
 #include <ao_int64.c>
index 4876d21e685a9863e3d16c5c19434bac329df57b..7708c3319fd029b00f307c8cf29a4df4bfb212cb 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-#define __xdata
-#define __data
-#define __pdata
-#define __reentrant
 
 #include <stdint.h>
 #include <ao_ms5607.h>
diff --git a/src/tidongle/.gitignore b/src/tidongle/.gitignore
deleted file mode 100644 (file)
index 3888a0f..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-tidongle*
-ao_product.h
diff --git a/src/tidongle/Makefile b/src/tidongle/Makefile
deleted file mode 100644 (file)
index 0e90d74..0000000
+++ /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:
-
index 9e3965c629bad22e5eb4e55cbd60b7c41723a7b1..8a1293d2f0627e0b93f210f6bbfa7f41c598a71a 100644 (file)
@@ -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 \
index d908f4dbeebdee342ff9d17751e8599a5ab47950..946f4b12985b66cc8567ea84e8c39859c3063074 100644 (file)
@@ -45,21 +45,20 @@ ao_relay_control(uint8_t output)
 }
 
 static void
-ao_relay_select(void) __reentrant
+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
                ao_relay_control(output);
 }
 
-static __code struct ao_cmds ao_relay_cmds[] = {
+static const struct ao_cmds ao_relay_cmds[] = {
        { ao_relay_select, "R <output>\0Select relay output" },
        { 0, NULL }
 };
diff --git a/src/usbtrng-v2.0/.gitignore b/src/usbtrng-v2.0/.gitignore
deleted file mode 100644 (file)
index 93b38d1..0000000
+++ /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 (file)
index 49798f1..0000000
+++ /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.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 (file)
index 2b23f96..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright © 2015 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#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 (file)
index e34babe..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright © 2014 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include <ao.h>
-#include <ao_adc_fast.h>
-#include <ao_crc.h>
-#include <ao_trng.h>
-
-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 (file)
index 32dbbbc..0000000
+++ /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 (file)
index a2bf199..0000000
+++ /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 (file)
index 9e7c2c3..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright © 2013 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 <ao_flash_stm_pins.h>
-
-/* 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 (file)
index 80e137e..0000000
+++ /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 (file)
index 2fd5df3..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright © 2013 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 (file)
index cb15a25..0000000
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Copyright © 2014 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#include <ao.h>
-
-#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 <speed>\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 (file)
index e34f108..0000000
+++ /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 (file)
index cb38560..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright © 2013 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; 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 <ao_flash_lpc_pins.h>
-
-#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_ */
index 1b9b9e1c71e432a8c4b6b2a203e9a79b520d5425..e9f8b218ced6f1a6aa9f6bc429f1a9538ee485f1 100644 (file)
@@ -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);
        }
 }
index 106ce55ac12f28f4ad9467ae81c63caa240cb9ad..3443b288142d9b28ee407a94440aaee2e8fae301 100644 (file)
@@ -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
index f24556c189d682e78efacb5069ab59fcfb9d74eb..0055a22df28a22d5b25a9ae5049f552a4dc4a72b 100644 (file)
@@ -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
index e6ce9f840ed1293aae8349e05fd7081b9b2cb2bc..c83b21c5a17f2b371c3091c80bf32cc941264049 100644 (file)
@@ -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"