aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* libmaple/timer.h: Nuke useless comment.Marti Bolivar2012-06-071-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/timer.h: Doxygen beautification and fixupsMarti Bolivar2012-06-071-98/+109
| | | | | | | Make the Doxygen comments nicer to look at. Some of the docstrings are out-of-date since F2 support was added, so update them. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Makefile: fix cscope target.Marti Bolivar2012-06-071-2/+2
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Move timer_dev definitions into libmaple/timer.c.Marti Bolivar2012-06-074-192/+184
| | | | | | | | | The addition of STM32_HAVE_TIMER() allows us to avoid some repetition. There's still an issue with names on F1 preventing us from moving the IRQ handlers to libmaple/timer.c, but once that's resolved, we'll be able to remove even more. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Tweak some timer_private APIs.Marti Bolivar2012-06-073-41/+36
| | | | | | | The current versions of DELARE_*_TIMER() don't play well with cscope, which is a bad sign. Fix that. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* series/timer.h: Remove silly duplicate declarations.Marti Bolivar2012-06-072-2/+0
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Makefile: help target pointers for multiple source files.Marti Bolivar2012-06-071-0/+3
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* README: remove mention of support/openocd/.Marti Bolivar2012-06-071-1/+0
| | | | | | This is now in contrib/. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Rework linker scripts.Marti Bolivar2012-06-0744-370/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having separate linker scripts for all the boards is a bad idea. Most boards really only need to specify MEMORY and the appropriate REGION_ALIASES() so that support/ld/common.inc can do its work. Not having infrastructure for this leads to duplication -- viz. the Maple Mini linker scripts are identical to the Maple's, and the olimex_stm32_h103 linker directory is just a symlink to Maple's. Clearly, the current structure is wrong. To fix it, instead of having per-board subdirectories of support/ld/, add per-MEMORY subdirectories of (new) support/ld/stm32/mem/. The per-board .mk files under support/mk/board-includes/ now reference these directly, and target-config.mk and the Makefile handle this appropriately. We move some other stuff around in target-config.mk to make this all more convenient, and even allow more overriding of the libmaple defaults on a per-board basis. Custom board hacks will be easier now. Unfortunately, lots of duplication under support/ld/stm32/mem/ is necessary, as the LENGTH attribute in a MEMORY region specification doesn't support arithmetic expressions, and ld doesn't seem to have any way to specify MEMORY at the command line (why?!). If we find a better way than this, we should do it. If a board (e.g. Maple Native) _does_ really need special memory-related configuration, you can always put a per-board subdirectory of support/ld/stm32/mem. We do this here to configure the heap. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Move OpenOCD stuff into contrib/.Marti Bolivar2012-06-077-7/+1
| | | | | | This has gone unmaintained for long enough. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Makefile: make help target more helpful.Marti Bolivar2012-06-071-26/+26
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Makefile: add list-boards target.Marti Bolivar2012-06-072-2/+7
| | | | | | | | | As the number of boards increases, it's less practical to keep a list of them in the help target output (notice also that some have been forgotten). This target can't get out of date unless we change how the board-includes/ directory works. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* maple/board.cpp: Demo weakness of boardInit().Marti Bolivar2012-06-071-0/+5
| | | | | | | This shows people what to do to write boardInit(), but also how to save work if they don't need it. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* maple/board.cpp: Use PMAP_ROW().Marti Bolivar2012-06-071-45/+55
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* board_private.h: Add PMAP_ROW() convenience macro.Marti Bolivar2012-06-071-0/+4
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* maple/board.cpp: Add more explanatory comments.Marti Bolivar2012-06-071-0/+16
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* isButtonPressed(): Take a pin and pressedLevel argument.Marti Bolivar2012-06-072-4/+5
| | | | | | | This allows dealing with push-buttons on pins other than BOARD_BUTTON_PIN. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* <wirish/boards.h>: Add BOARD_BUTTON_PRESSED_LEVEL.Marti Bolivar2012-06-072-3/+11
| | | | | | | | | | This allows boards to override the logic level of a pressed button. All Maple boards have a pressed button read HIGH, but if the opposite convention is used, isButtonPressed() will infinite loop. Make isButtonPressed() respect this setting. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish/boards.h: Optionally derive SYSTICK_RELOAD_VAL.Marti Bolivar2012-06-071-0/+3
| | | | | | It's stupid to make everyone keep this around. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F2: Allow boards to override PLL configuration.Marti Bolivar2012-06-071-6/+20
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Makefile: move the fake VID/PID, to hide our shame.Marti Bolivar2012-06-071-6/+5
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32.h: Soften "missing MCU" errors into warnings.Marti Bolivar2012-06-072-3/+2
| | | | | | | | | | | | | | It's not important whether the MCU is specified. What's important is that <libmaple/stm32.h> gets everything it needs -- which it now ensures that it does. Requiring people to do things on a per-MCU basis hurts hackability and is just asking for trouble. On the other hand, it's nice to provide a clue as to why <libmaple/stm32.h> might be giving #errors, so do leave the warnings. People can always hack the header to shut them up if they want. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* HardwareSerial.cpp: Fix "#warn" -> "#warning".Marti Bolivar2012-06-071-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish: Weaken boards_private.h definitions.Marti Bolivar2012-06-072-28/+36
| | | | | | | This lets users override them conveniently if our decisions don't suit. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Provide wirish::priv::series_init() on F1.Marti Bolivar2012-06-072-10/+7
| | | | | | This lets us remove the weak definition in boards.cpp. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Remove a completed FIXME comment.Marti Bolivar2012-06-071-3/+0
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Bring back libmaple/dac.h.Marti Bolivar2012-06-045-82/+228
| | | | | | | Minor variations on F2: DMA underrun interrupts, and a status register to hold the notification bits. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32.h: Add STM32_HAVE_DAC feature-test.Marti Bolivar2012-06-043-0/+12
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F1: gpio.h: Add hack mode macro, for F2 compatibility.Marti Bolivar2012-06-041-0/+3
| | | | | | | | I'm sure we can work the compatible subset of F1/F2 GPIO functionality into the F1 gpio.h interface in a clean way. This is not that clean way, but I'm short on time. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F2: Add EXTI support.Marti Bolivar2012-06-037-9/+128
| | | | | | | | Add series headers to keep the base pointers, and (on F2) use SYSCFG to tell exti_do_select() where the EXTI control registers are. No surprises. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F2: Turn on SYSCFG I/O compensation during init().Marti Bolivar2012-06-031-0/+3
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F2: Add SYSCFG support.Marti Bolivar2012-06-036-1/+246
| | | | | | Turn it on at init() time on F2. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F1: gpio.h: Cosmetics.Marti Bolivar2012-06-031-100/+85
| | | | | | | Those ugly Doxygen comments have been bothering me since forever. Fix them up and throw some M-x align around. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Bring back EXTI on F1, with deprecations for gpio.h on F1.Marti Bolivar2012-06-0313-191/+375
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tested on Maple Mini with examples/mini-exti-test. Changes to Wirish are minor: use the new EXTI types exti_num and exti_cfg (see below) in place of now-deprecated variants in ext_interrupts.cpp. The way I originally did libmaple/exti.h was stupid, and fixing it turned out to be a little disruptive. libmaple/exti.h depends on libmaple/gpio.h (for AFIO), but that's a classic case of exposed implementation detail. So invert the dependency: make gpio.h depend on exti.h. Do this by adding exti_num and exti_cfg to exti.h; these respectively replace afio_exti_num and afio_exti_port. The afio_* variants are now deprecated. (Throw in a typedef and some macros at the bottom of the F1 series/gpio.h for backwards compatibility). Make exti_attach_interrupt() and exti_detach_interrupt() take exti_num/exti_cfg arguments instead of the afio_* variants. Make the EXTI dispatch routines __always_inline to defeat GCC -Os. Many renames throughout libmaple/stm32f1/ to stop using the deprecated names. Also move the previously F1-only gpio_exti_port() function into the public libmaple header. Reimplementing it in terms of rcc_clk_ids lets us deprecate the gpio_dev->exti_port field, which will save space in the future. While we're there, I notice that struct gpio_dev is defined once per series. That's dumb, as it misses the entire point of having device structs: they contain what's portable. So put the F1 version (which has the extra EXTI port field) into libmaple/gpio.h, and add the necessary exti_ports to libmaple/stm32f2/gpio.c. Sigh. We'll get rid of it eventually, at least. Clean up some other mistakes in gpio.h files as well (mostly removing util.h dependency). Sorry for the messy commit. For portability, add a new series-specific exti function, exti_select(). The F1 version in (new) libmaple/stm32f1/exti.c uses AFIO and some new private functionality in libmaple/exti.c and (new) libmaple/exti_private.h to make this convenient. We'll be able to do the SYSCFG equivalent on F2 without any trouble. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* <libmaple/bitband.h>: DoxygenMarti Bolivar2012-06-031-2/+2
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/dac.c: Copyright.Marti Bolivar2012-06-031-0/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/dac.c: Generalize comment about PA4/PA5.Marti Bolivar2012-06-031-2/+2
| | | | | | Seems like this is true on F2 as well! Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish/ext_interrupts.cpp: Doxygen, copyright.Marti Bolivar2012-06-031-1/+2
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Add ISRs and vector table for F1 value line.Marti Bolivar2012-06-035-4/+393
| | | | | | | | | | | | | | | | | Now libmaple/stm32f1/rules.mk tries to pull in ISRs and a vector table on a per-line basis. Move isrs_performance.S and vector_table_performance.S to (new) libmaple/stm32f1/performance, and rename them. Add corresponding files for value line under (new) libmaple/stm32f1/value. This helps clean up some performance-line-isms, and allows implementing e.g. the CEC interrupt, which is used by something else on performance line. Untested (I don't have access to a value line MCU); hopefully this works. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Slightly improve and generify the USB infrastructure.Marti Bolivar2012-06-0322-61/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The good news is that <libmaple/usb.h> and <libmaple/usb_cdcacm.h> did turn out generic enough in what they specify to go on unchanged. However, we can't just go on assuming that there's USB just because we're on an F1. Now that there's value line in the tree, we need to be more careful (value line F1s don't have USB peripherals). To that end, make all the F1 board-includes/*.mk files specify what line their MCU is with an MCU_F1_LINE variable. Use that to hack libmaple/usb/rules.mk so we only try to build the USB module under appropriate circumstances. While we're at it, add a vector_symbols.inc for value line MCUs under support/ld/. We need this to get the target-config.mk modifications implied by the addition of MCU_F1_LINE. We'll fix up some other performance-line-isms under libmaple/stm32f1 in a separate commit. Also in libmaple/usb/: - Move everything into a new stm32f1 directory. Due to aforementioned rules.mk hacks, there is no immediate need for an stm32f2 directory (USB support doesn't exist there). - Update the README for style and content. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Add BOARD_HAVE_SERIALUSB.Marti Bolivar2012-06-031-0/+6
| | | | | | Feature-test for SerialUSB support. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* <wirish/boards.h>: Add feature test macros for SPI.Marti Bolivar2012-06-031-2/+20
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple_types.h: Add __unused.Marti Bolivar2012-06-031-0/+1
| | | | | | We'll need this soon. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* F2: Add usart_get_af().Marti Bolivar2012-06-032-17/+30
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Typo fix.Marti Bolivar2012-06-031-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Globally switch style for GPIO config routines.Marti Bolivar2012-06-0312-42/+85
| | | | | | | | | | | | | | | | | | | | Stupidly, spi_gpio_cfg() didn't take a spi_dev* argument on F1, because it doesn't matter there. On F2, where we need to set an alternate function when configuring GPIOs for SPI, we need to know the dev. We can't add break backwards compatibility, so we need a new function. However, we've since added a bunch of foo_gpio_cfg() routines, and we don't want confusing asymmetry in the names. So a global style change is needed. (Fortunately, the new functions weren't part of a release, so it's no problem to change their names). Change all foo_gpio_cfg() routines to foo_config_gpios() (or foo_config_gpio(), if there's only one GPIO to configure). For backwards compatibility, make spi_gpio_cfg() on F1 an __always_inline call to spi_config_gpios(). Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F2: Add timer_get_af().Marti Bolivar2012-06-033-31/+53
| | | | | | | | Pull some code out of the F2 pinMode() into a utility function. This feels generally useful enough to be exposed to the users (it will, for example, make it easier to implement input capture in a clean way). Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F2: fix pinMode() for PWM, PWM_OPEN_DRAIN.Marti Bolivar2012-06-031-2/+1
| | | | | | Make it so the call to gpio_set_modef() actually happens. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* HardwareTimer.cpp: cosmetics.Marti Bolivar2012-06-031-2/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* HardwareTimer::setPeriod(): Don't use floating point.Marti Bolivar2012-06-031-3/+3
| | | | | | I can't believe we've been shipping this for so long. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>