aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple
Commit message (Collapse)AuthorAgeFilesLines
* Add timer_has_cc_channel().Marti Bolivar2012-06-022-0/+29
| | | | | | | | | This is a convenience function for deciding whether a timer supports a particular capture/compare channel. It's necessary because of those nuisance "general purpose" timers that only have a subset of the channels. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Sort the rcc_clk_id enumerators semi-alphabetically.Marti Bolivar2012-06-022-77/+77
| | | | | | | | | | | | | | | | Only semi-alphabetically because peripherals are kept together (so the UARTs sort as if they were USARTs). Advantages: - It lets us play numeric comparison and lookup-table hacks, as we now have the property that the rcc_clk_ids for a given peripheral are a contiguous range of integers. - It will hopefully let the compiler emit faster/smaller code for switches over a dev->clk_id. - It's better intuitively. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Oops; don't break the build on F1.Marti Bolivar2012-06-021-1/+0
| | | | | | That was dumb. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/adc.h: Fixup for Doxygen.Marti Bolivar2012-06-011-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/stm32.h: Add STM32_TIMER_MASK, STM32_HAVE_TIMER.Marti Bolivar2012-06-013-4/+48
| | | | | | | | | | | | | | | | | | Feature-test macros for dealing with the fact that timer support has holes. STM32_TIMER_MASK is a bitmask where bit n is set when TIMERn is present. STM32_HAVE_TIMER(n) just tests whether bit n is set in STM32_TIMER_MASK. This is necessary because e.g. the STM32F100RB has timers 1-4, 6, 7, and 15-17. Because of this, the usual STM32_NR_whatever won't work, and we use a bitmask instead. For F1 performance line (F103s), STM32_TIMER_MASK can be derived from the density. For F1 value line, I'm not as sure, so just add it for the single MCU we support (the STM32F100RB). Same story for F2: add it for the STM32F207IC. We can fix this up later if necessary. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f2/usart.c: Change some FIXMEs to TODOs.Marti Bolivar2012-06-011-6/+7
| | | | | | I think these are probably unchanged, but we need to make sure. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Bring back HardwareSerial.Marti Bolivar2012-06-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | To make this happen, we need to have <board/board.h> tell us whether or not it's got each of the USARTs. Do that with BOARD_HAVE_USARTn, for n = 1,...,6. This lets us define HardwareSerial instances only when appropriate, and gets rid of some board-specific hacks we'd accumulated. The new <libmaple/usart.h> now has a convenience function for determining the bus rate by using the appropriate STM32_PCLKx macro, so we can shave a uint32 per instance, which is nice given that they're all going to be in memory. This changes the constructor arguments, but the API only specifies the semantics of the predefined instances, so this is still backwards-compatible. (We should look into storing the instances in Flash -- they don't change, after all.) We don't actually need struct usart_dev's definition in HardwareSerial.h, so replace it with a forward declaration and include <libmaple/usart.h> it in HardwareSerial.cpp instead. Assert some copyrights. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f2/gpio.c: Fix some bugs.Marti Bolivar2012-05-311-3/+3
| | | | | | | Make gpioh.regs actually point to GPIOH_BASE. Properly AND out flag bits in gpio_set_modef(). Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* <libmaple/gpio.h>: Fix gpio_write_bit().Marti Bolivar2012-05-311-1/+1
| | | | | | | It's exactly wrong -- val=0 makes the pin high, and val=1 makes it low. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/usart_private.c: Add missing include.Marti Bolivar2012-05-311-0/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F1: Fix nvic_irq_disable_all() on some MCUs.Marti Bolivar2012-05-311-8/+6
| | | | | | | | | | The current implementation only disables the first 64 IRQ lines. This covers all the chips we currently support, but it'll be a nasty surprise if anyone decides to add e.g. connectivity line MCUs (which have more IRQs) in the future. We already have the infrastructure to fix it in a clean way, so we might as well do it now. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* nvic.h: Doxygen: nvic_irq_num is target dependent.Marti Bolivar2012-05-312-2/+2
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/nvic.h: Doxygen tweak.sMarti Bolivar2012-05-311-6/+18
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/nvic.h: Fix typo.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f1/rcc.c: Move Doyxgen.Marti Bolivar2012-05-311-10/+1
| | | | | | This is a workaround for Breathe. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* series/rcc.h: Lose BIT().Marti Bolivar2012-05-312-360/+370
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/rcc.c: Fix typo.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/rcc.h: Doxygen.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f2/rcc.h: Remove a TODO.Marti Bolivar2012-05-311-7/+0
| | | | | | That never worked out. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f2/rcc.h: Add FIXME for rcc_rtc_divider.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f2/rcc.h: Fix typo.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f1/rcc.h: Add a FIXME.Marti Bolivar2012-05-311-0/+2
| | | | | | Having a separate struct is stupid. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* RCC: DoxygenMarti Bolivar2012-05-315-138/+105
| | | | | | | Various changes to Doxygen structure, to help leaflabs-docs make sense of everything. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* rcc.c: Fix typo.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/rcc.h: Doxygen workarounds.Marti Bolivar2012-05-311-3/+3
| | | | | | | We need the arguments to be the same name everywhere, or Breathe/Doxygen get confused. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/fsmc.h: Better Doxygen for memory bank bases.Marti Bolivar2012-05-311-9/+29
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/fsmc.h: Don't use BIT().Marti Bolivar2012-05-311-23/+23
| | | | | | | As fsmc.h doesn't include util.h or libmaple.h, these usages are actually in error. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f2/fsmc.c: Cosmetics.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/iwdg.h: Remove BIT() usages.Marti Bolivar2012-05-311-3/+2
| | | | | | This cleans up another unnecessary <libmaple/util.h> dependency. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Don't try to build some libmaple files.Marti Bolivar2012-05-311-2/+2
| | | | | | We can't do these on F2 right now. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Lose <libmaple/util.h> dependency in series/flash.h headers.Marti Bolivar2012-05-092-48/+48
| | | | | | Switch from BIT(...) to (1U << ...). Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* flash.h: Doxygen.Marti Bolivar2012-05-093-2/+5
| | | | | | | Document FLASH_BASE once. This is due to restrictions in the documentation build system. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Change __DOXYGEN_PREDEFINED_HACK to __DOXYGEN__.Marti Bolivar2012-05-092-6/+5
| | | | | | avr-gcc does it this way. Seems ok to me. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Make usart_irq() __always_inline.Marti Bolivar2012-05-081-1/+1
| | | | | | | Compiling with -Os can prevent this from inlining, and it's an IRQ handler, so the space is worth spending. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Mark Doxygen for Flash register maps as series-specific.Marti Bolivar2012-05-082-2/+2
| | | | | | | This will let help us verify that we got the right thing when we pull it out of of Doxygen XML for the official HTML documentation. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/util.h: Doxygen cosmetics.Marti Bolivar2012-05-081-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/flash.h: Doxygen for flash_enable_features().Marti Bolivar2012-05-081-4/+14
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/flash.h: Deprecate flash_enable_prefetch().Marti Bolivar2012-05-081-0/+3
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/flash.c: Update Doxygen for flash_set_latency().Marti Bolivar2012-05-081-3/+5
| | | | | | Update for STM32F2 support. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Fix a bunch of Doxygen file-level comments.Marti Bolivar2012-05-0865-85/+92
| | | | | | | | | | | | | Fix @file in many places. Also fix up the descriptions where it's appropriate. This standardizes the @file formatting across the library to explicitly include any parent directories up to the repository root. Besides being nice, this will hopefully let us manage Doxygen's XML output so as to make extracting series-specific pieces via Breathe in the leaflabs-docs repo possible. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/flash.h: Fix Doxygen @fileMarti Bolivar2012-05-081-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/util.h: Doxygen fixups.Marti Bolivar2012-05-081-3/+3
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* ring_buffer.h: Fix Doxygen @file.Marti Bolivar2012-05-081-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f1: stm32.h: Tweak STM32_F1_LINE_xxx for mnemonic value.Marti Bolivar2012-05-081-6/+6
| | | | | | | | | | Change the values of the STM32_F1_LINE_xxx macros to match the part number better (so performance line, or F103s, now have STM32_F1_LINE_PERFORMANCE==3, F100s have STM32_F1_LINE_VALUE==0, etc.). This will hopefully make debugging or error checking easier for someone at some point. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f1: stm32.h: Doxygen.Marti Bolivar2012-05-081-5/+5
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/stm32.h: Doxygen.Marti Bolivar2012-05-081-0/+17
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f1: stm32.h: Cosmetics.Marti Bolivar2012-05-081-4/+10
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f1: stm32.h: Add Doxygen comments.Marti Bolivar2012-05-081-0/+22
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f1: stm32.h: Add hooks for USB access line.Marti Bolivar2012-05-081-1/+3
| | | | | | | There are five F1 lines in total. The necessary infrastructure for USB access line (STM32F102 MCUs) support is missing, so add it. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f1: stm32.h: Fix wrong comment.Marti Bolivar2012-05-081-3/+0
| | | | | | We've got some value line values now. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>