aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Implement DMA tube API on STM32F2.Marti Bolivar2012-06-154-2/+1315
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Port test-usart-dma.cpp to use tube API.Marti Bolivar2012-06-151-13/+61
| | | | | | | | This is straightforward. Do it in a verbose style with lots of comments, so we can use this patch as an example for how to port existing DMA code. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Implement DMA tube API on STM32F1.Marti Bolivar2012-06-152-4/+60
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* DMA: prep for F2 with new "tube" API.Marti Bolivar2012-06-156-366/+1038
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To prepare for STM32F2/F4 DMA support, introduce a new libmaple DMA API, and move some code around to make priority level and interrupt handling more generic. The new API is based on a new set of types (dma_tube, struct dma_tube_reg_map, enum dma_request_src, enum dma_cfg_flags, and struct dma_tube_config). The central abstraction is the dma_tube type. STM32F2/F4 use DMA streams to control dataflow, and STM32F1 uses channels. dma_tube stands for whichever is appropriate for the current target. Dealing with tubes allows for configuring and using DMA with opaque tube values in the same source, instead of (as with ST's firmware) requiring two separate codebases. The new API is also more user-friendly, as it doesn't require knowing which DMA address registers to set and which configuration register flags go along with them. It now suffices to specify the source and destination for the DMA transfer, along with their sizes. This avoids confusion (e.g. for memory-to-memory transfers, data flows from the peripheral address register to the memory register, which might be surprising on F2, which has two memory address registers). The old API (based on enum dma_mode_flags and dma_setup_transfer()) is still available on F1, but deprecate it. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* test-usart-dma.cpp: tweaks.Marti Bolivar2012-06-131-16/+17
| | | | | | | Touch up comments, change some function names, and don't set something to zero which already is. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* examples/test-usart-dma.cpp: Use HardwareSerial::c_dev().Marti Bolivar2012-06-131-18/+19
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* examples/test-usart-dma.cpp: Cleanups and comments.Marti Bolivar2012-06-131-49/+78
| | | | | | | | Someone pointed to this example on the DMA page in the wiki, so it's probably worth making it more clear what's going on. Remove unused code, add comments, and move things around for better exposition. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* HardwareTimer: add a c_dev().Marti Bolivar2012-06-131-0/+8
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* HardwareSPI: add a c_dev().Marti Bolivar2012-06-131-0/+8
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* HardwareSerial: Add c_dev() accessor for instance's usart_dev*.Marti Bolivar2012-06-131-0/+4
| | | | | | This is analagous to std::string::c_str(). Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Add stm32_private.h.Marti Bolivar2012-06-121-0/+45
| | | | | | | | | This will hold STM32-related things that I'm not sure are well-thought out enough to go into <libmaple/stm32.h>. Currently, it contains an accessor routine that tells you the purpose of the memory block containing an address. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Typo fix.Marti Bolivar2012-06-121-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Build libmaple/dma.c on STM32F1.Marti Bolivar2012-06-121-1/+3
| | | | | | F2 doesn't work yet. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* maple: board.cpp: More comments.Marti Bolivar2012-06-081-5/+5
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Bring back <wirish/wirish_debug.h>.Marti Bolivar2012-06-085-7/+105
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* maple: board.h: More comments, remove SYSTICK_RELOAD_VAL.Marti Bolivar2012-06-081-9/+14
| | | | | | | We derive SYSTICK_RELOAD_VAL from CYCLES_PER_MICROSECOND now, so let's hide it for expert use. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* enum spi_mode: Add more descriptive enumerators, documentation.Marti Bolivar2012-06-071-11/+16
| | | | | | | | | Instead of requiring everyone to figure it out for themselves, add enumerators specifying the idle logic level and what clock edge triggers data capture. Yes, it's easy enough to figure it out. It's also convenient to have these. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Bring back <libmaple/spi.h>.Marti Bolivar2012-06-078-25/+221
| | | | | | | | | | | Add a spi_private.h with a SPI_DEV(), for convenience. Use it in the F1 and F2 implementations. We could probably unify these with an STM32_HAVE_SPI(n) macro, but we'll leave that for the future. Most everything from F1 is portable; F2 has some additional bit definitions and a spi_get_af() routine, but that's about it. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish/syscalls.c: Assert LeafLabs copyright.Marti Bolivar2012-06-071-0/+1
| | | | | | _sbrk() is new in 2011, and there've been changes in 2012. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish/syscalls.c: Weaken I/O related function defs.Marti Bolivar2012-06-071-12/+12
| | | | | | For overriding. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Move syscalls.c into Wirish.Marti Bolivar2012-06-073-4/+4
| | | | | | libmaple takes orders, it doesn't give them. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/timer.h: Capitalization fixMarti Bolivar2012-06-071-2/+2
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/timer.h: Lose BIT().Marti Bolivar2012-06-071-90/+90
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/timer.h: Move deprecated bits to bottom.Marti Bolivar2012-06-071-66/+67
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* struct timer_dev: Don't touch ->handlers!Marti Bolivar2012-06-071-3/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* 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>