aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-06-22<libmaple/i2c.h>: Cosmetics.Marti Bolivar
Put CCR definitions after SR2, to keep them in register map order. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-22<libmaple/i2c.h>: Cosmetics.Marti Bolivar
Reorder register bit definitions by descending bit number, for consistency with the rest of the library. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-22<libmaple/i2c.h>: Add missing register bit defns.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-22libmaple/i2c.h: Assert LeafLabs copyright.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-22Fix I2C_CR2_FREQ bit definition.Marti Bolivar
The existing value clobbers the entire register. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-22libmaple/i2c.h: Cosmetics.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-22libmaple/i2c.h: Don't use BIT().Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-21<libmaple/dma.h>: Assert LeafLabs copyright.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-15Port test-usart-dma.cpp for STM32F2.Marti Bolivar
Too ugly? Meh. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-15Implement DMA tube API on STM32F2.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-15Port test-usart-dma.cpp to use tube API.Marti Bolivar
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>
2012-06-15Implement DMA tube API on STM32F1.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-15DMA: prep for F2 with new "tube" API.Marti Bolivar
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>
2012-06-15Makefile: cosmetics.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-15Xlinker + Xassembler flags to MakefileGaute Hope
These flags were needed to have the Makefile working with arm-none-eabi-g++ (Sourcery CodeBench Lite 2011.09-69) 4.6.1. Signed-off-by: Gaute Hope <eg@gaute.vetsj.com> Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-14Tweak build system to allow out-of-tree projects.Marti Bolivar
It's very annoying to have to build libmaple projects in-tree. Users are just copying the repository everywhere. That's stupid. So I made this: https://github.com/mbolivar/example-libmaple-project It needs these patches to work. Add a header and footer for rules.mk files, so we can change them around and things will continue to work for the users, who just include them. In Makefile, add USER_MODULES to LIBMAPLE_MODULES if it's nonempty. This is the hook you use to get your code compiled and linked correctly. Hack build-targets.mk for stupid reasons I hope to fix later. For now, you'll need an empty main.cpp in BOTH the libmaple directory and your directory if you want things to work the way you'd expect. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-13test-usart-dma.cpp: tweaks.Marti Bolivar
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>
2012-06-13examples/test-usart-dma.cpp: Use HardwareSerial::c_dev().Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-13examples/test-usart-dma.cpp: Cleanups and comments.Marti Bolivar
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>
2012-06-13HardwareTimer: add a c_dev().Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-13HardwareSPI: add a c_dev().Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-13HardwareSerial: Add c_dev() accessor for instance's usart_dev*.Marti Bolivar
This is analagous to std::string::c_str(). Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-12Add stm32_private.h.Marti Bolivar
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>
2012-06-12Typo fix.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-12Build libmaple/dma.c on STM32F1.Marti Bolivar
F2 doesn't work yet. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-12Add .gdbinit to .gitignore.Marti Bolivar
Everyone wants their own .gdbinit; it's stupid to put one into the repository top-level. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-12Remove .gdbinit.Marti Bolivar
This has gone unmaintained for long enough. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-08maple: board.cpp: More comments.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-08Bring back <wirish/wirish_debug.h>.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-08maple: board.h: More comments, remove SYSTICK_RELOAD_VAL.Marti Bolivar
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>
2012-06-07enum spi_mode: Add more descriptive enumerators, documentation.Marti Bolivar
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>
2012-06-07Bring back <libmaple/spi.h>.Marti Bolivar
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>
2012-06-07wirish/syscalls.c: Assert LeafLabs copyright.Marti Bolivar
_sbrk() is new in 2011, and there've been changes in 2012. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07wirish/syscalls.c: Weaken I/O related function defs.Marti Bolivar
For overriding. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07Move syscalls.c into Wirish.Marti Bolivar
libmaple takes orders, it doesn't give them. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07libmaple/timer.h: Capitalization fixMarti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07libmaple/timer.h: Lose BIT().Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07libmaple/timer.h: Move deprecated bits to bottom.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07struct timer_dev: Don't touch ->handlers!Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07libmaple/timer.h: Nuke useless comment.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07libmaple/timer.h: Doxygen beautification and fixupsMarti Bolivar
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>
2012-06-07Makefile: fix cscope target.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07Move timer_dev definitions into libmaple/timer.c.Marti Bolivar
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>
2012-06-07Tweak some timer_private APIs.Marti Bolivar
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>
2012-06-07series/timer.h: Remove silly duplicate declarations.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07Makefile: help target pointers for multiple source files.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07README: remove mention of support/openocd/.Marti Bolivar
This is now in contrib/. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07Rework linker scripts.Marti Bolivar
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>
2012-06-07Move OpenOCD stuff into contrib/.Marti Bolivar
This has gone unmaintained for long enough. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-07Makefile: make help target more helpful.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>