231 Commits

Author SHA1 Message Date
Guillaume Revaillot
e7c8f18f7c stm32: adc: group adc_registers 2019-12-25 20:34:11 +00:00
Brian Viele
aabefeac92 stm32h7: usart: support new fifo features
Supported by H7 and G4 varieties at present.
2019-12-25 20:29:24 +00:00
Karl Palsson
af384dbc7c doc: fix some broken groups uncovered while reviewing h7 code 2019-11-28 22:16:54 +00:00
Guillaume Revaillot
a34da53c30 stm32g0: add dmamux
DMAMUX peripheral is a dma request router/trigger, present on g0, wb, h7 and l4+.

Basically it allows to easily map peripheral requests to whatever dma channel we
want to use (similarily to the DMA_CSELR register, but without limitation) but,
it also also adds some clever dma request synchronization and even some dma request
generation logic via internal request generator "channels", allowing some requests
chaining, or triggering reqs from non dma capable peripherals.

nb: g0 only features 1 dmamux bloc, supports 7 irq and 4 generators, l4+ supports 13
dma channels and 3 generators and h7 has two dmamuxes, with support for the 15 dma
channels and 7 generators - so as much CxCR and RGxCR register - but they are bit
to bit compatible - excluding of course the sync/sig and dma requests id mappings.
btw, currently, request generator channels are defined in common header, but maybe
we should define them in device header ? or we dont care (like for dma channels,
only defined in dma_f24 but not for other devices ?).

See ST AN5224 for more information
2019-11-08 13:47:41 +01:00
Karl Palsson
7a27397b9e stm32: rtcv2: don't shift the "month tens" bit
None of the other masks are shifted, don't shift this field either.

Fixes: https://github.com/libopencm3/libopencm3/issues/1123
2019-11-06 19:45:20 +00:00
Guillaume Revaillot
3eff201a4b doc: stm32: adc: upgrade common_v2 documentation
add register grouping, fixup comment have them pickedup by doxygen, align style and masks.
2019-07-06 15:38:49 +00:00
Guillaume Revaillot
2035d84e55 stm32: lptim: add base support
Add basically what's needed to have some minimal but usefull subset of
function for a timer: irqs, compare, period, out polarity, enable/disable
and start.
2019-07-05 11:43:11 +02:00
Guillaume Revaillot
2975c3151a stm32: extract l0 lptimer stuff from timer.h to common lptimer.h
lptimer peripheral is present on f4,f7,l0,l4,g0,g4 and prob others. Extract
content from stm32l0 timer.h and make it usable by other chips.
2019-07-05 10:48:26 +02:00
Guillaume Revaillot
7d344b187d stm32: dma: add dma_set_channel_request to ease dma cselr usage. 2019-06-17 11:44:44 +00:00
Guillaume Revaillot
e06898d9a4 stm32: dma: cselr: factorize register definition.
F09x and L4 share the same cselr register, as well as some L0s, factorize
definitions in a new shared header and add helpers.

fyi, that register allows to redefine dma channel peripheral mapping - see
device datasheet for mapping tables.
2019-06-17 11:44:44 +00:00
Karl Palsson
19f1160ad1 doc: stm32: timer: remove redundant groupings and consistent names 2019-06-16 18:17:06 +00:00
Karl Palsson
9f58ad4393 doc: fix trivial missing trailers or typos 2019-06-12 23:16:58 +00:00
Karl Palsson
502593ca6f doc: stm32: exti-v1: fix conditionals, add registers
Fixes some missing definitions.  cond/endcond is hard to get right
sometimes!
2019-06-12 23:06:22 +00:00
Karl Palsson
867bd164eb doc:stm32: usart: fix grouping and heirarchy of base addrs
They were always landing on the top level, or not even present.
2019-06-12 23:06:22 +00:00
Karl Palsson
121d854841 doc: stm32: crc-v2 fix up markup for doxygen
Eliminates errors, fixes groupings, adds missing groupings.
2019-06-12 23:06:22 +00:00
Oliver Meier
82d2ff9d1a stm32f4-7: dma2d: fixed wrong color definition and added missing one 2019-05-19 21:33:07 +00:00
Oliver Meier
07868ad8b6 stm32f7: enable existing dma2d headers 2019-05-19 21:33:07 +00:00
Oliver Meier
82498bb49f stm32f7: fixed typos in dsi header definitions 2019-05-19 21:33:07 +00:00
Oliver Meier
92a2340551 stm32f7: enable existing dsi support 2019-05-19 21:33:07 +00:00
Oliver Meier
5a03cfe54e stm32f7: enable existing ltdc
This uses the existing f4 code as a new shared common base code.
2019-05-19 21:33:02 +00:00
Oliver Meier
16cfc6d848 stm32f7: enable fsmc
This uses the existing f4 code as a new shared common base code.
2019-05-19 21:30:48 +00:00
Karl Palsson
c858a1e5f5 stm32: adc-v1m: extract some portions back to f4/f7.
While this appears to be a backward change, this moves the _register_
definitions (their addresses) and the actually specific to f4/f7
numbering back into the explicit headers.  Potentially this could be
pulled out again, but it's not much code.

This then allows the stm32l1 to use all the rest of this code, with the
differences really being just the addresses of the registers.
2019-05-10 22:30:31 +00:00
Karl Palsson
7076619dd7 stm32: adc-v1m: drop lots of noisy useless defines.
Never seen any reason for these noisy verbose defines.  They're not
helpful, and we've never needed them for doing sequence setting code
anyway.  Just drop them.
2019-05-10 22:27:20 +00:00
Karl Palsson
53c6e617b5 stm32: adc-v1m: tightenup definitions
Use the masks and shifts defined. common style.
2019-05-10 22:20:29 +00:00
Karl Palsson
45e14a7bd3 stm32: adc: fix f4/f7 temperature sensor channel defines.
Lots of common stuff, but the F7 fixed the temperature sensor randomness
that the f4 had.  Separate the definitions properly.
2019-05-10 22:18:08 +00:00
Karl Palsson
cc364d1ac2 stm32: adc-v1m: fix include guard 2019-05-10 22:16:33 +00:00
Matthew Lai
0a3e1cc0e6 Renamed adc_common_v3 to adc_common_v1_multi 2019-05-09 11:54:19 +00:00
Matthew Lai
6703abf5e3 Added F7 ADC support (almost the same as F4) 2019-05-09 11:54:19 +00:00
Karl Palsson
ca43a73ea3 stm32: dac: move DAC_SR to common.
It's available on f0, f2, f3, f4, f7, l0, l1 and l4.
Just note that it's not available on f1.
2019-05-09 11:49:25 +00:00
Ross Schlaikjer
4db40e0839 stm32f7: Include i2c_common_v2
With the addition of a define for I2C4, the existing common i2c
functions seem to work out of the box on the F7 (tested on an
STM32F750).
2019-04-04 22:11:20 +00:00
Guillaume Revaillot
553c876fa5 stm32: exti: define AFIO/SYSCFG_EXTICR_FIELDSIZE for all chip.
While on all current chips, exticr gpio port mux selection is coded on 4 bits,
stm32g0 EXTI_EXTICR register uses 8 bits.  Align all exti header to reference
that value (was previously defined for f0 as SYCFG_EXTICR_SKIP)
2019-01-31 09:57:43 +00:00
Guillaume Revaillot
7afd86db30 stm32l[01]: flash common: add flash_unlock_acr, allowing to unlock FLASH_ACR RUN_PD bit.
flash_unlock_acr allows to unlock RUN_PD bit from FLASH_ACR register. Relock is done automatically
when writing 0 to RUN_PD, so no flash_lock_acr method.
2019-01-31 09:35:55 +00:00
Guillaume Revaillot
ff9664389b stm32: exti: move register definition of all current stm32 devices to common_v1
Preparation for stm32g0 support, as this chip's exti register map evolved and is
no longer common ...
2019-01-18 18:33:55 +01:00
Harold Tay
9cadd60b3c stm32: rtc: Fixed typo in macro def (RTC_DR_MT_MASK) 2019-01-18 10:32:43 +00:00
Alfred Klomp
b7a9968e4f fixup! stm32f09: add register definitions for DMA2 2018-11-06 18:48:18 +01:00
Alfred Klomp
a9c0008290 stm32f09: add register definitions for DMA2 2018-11-06 12:58:36 +01:00
Karl Palsson
076cd67530 stm32: spi-v2: Frame format is available for all.
All spi v2 peripherals include the Motorola/TI Frame formatting options
introduced with F2.
2018-10-23 21:21:36 +00:00
mfm
f6517f7816 stm32: adc common v2: add circular dma mode
Tested only on the F3 so far.
2018-10-20 11:46:47 +00:00
Guillaume Revaillot
18eadcfda5 stm32: timer_common: add timer21-22, found on stm32l0 chips.
stm32l0 devices have tim21 and tim22.
2018-10-06 09:53:54 +00:00
Karl Palsson
0d7f1f7708 stm32: f24: dma: clarify stream/channel
It's always stream on the "new" dma controller (unless it's channel....)

Fix a couple of inconsistent prototypes that had carried over from f1
originally.  Reported by vampi on irc.
2018-09-15 09:27:31 +00:00
Clara Casas
889b7de0d7 stm32: adc: Add functions to get and clear flags
This includes adding documentation to the status flags.

Originally tracked at: https://github.com/libopencm3/libopencm3/pull/833

Modified to drop whitespace changes, and simply boolean return.
2018-08-28 22:00:07 +00:00
Daniel Gröber
743513a4b1 stm32: add dma_get_number_of_data
Original discussion at: https://github.com/libopencm3/libopencm3/pull/702
2018-08-28 22:00:01 +00:00
Karl Palsson
0e58ee2f65 stm32: support i2c3 properly
I2C3 is on many parts, but wasn't properly supported with the register
definitions.  Declare them centrally, just depending on the memorymap
defining them. On some parts, the rcc bits were defined, but not the
base registers.

Fixes: https://github.com/libopencm3/libopencm3/issues/820
2018-08-17 00:15:01 +00:00
Karl Palsson
231f21296f stm32: f247: flash: use common code.
This shows what is _actually_ different for f7.  A couple of option
bits, and a renaming of bit 7 of the status register, from Program
Sequence Error to Erase Sequence Error.

We keep the separate implementation of wait_for_last_operation, to meet
the "suggestions" of the reference manual to insert a DSB instruction.

Keeping the renamed bit/functions also requires us to keep separate
implementations of the flag clearing functions
2018-07-29 20:31:17 +00:00
Karl Palsson
76d392ee47 stm32: flash: drop common_f234
Move the last few register defines back to their relevant headers, add
doxygen and groups.  While these registers _were_ "common" they were the
_only_ common things, so it's simpler for future work (merging f7 with
f2/4) to move them back separately.
2018-07-29 20:31:17 +00:00
Karl Palsson
eafc46ff24 stm32: flash: extract wait_for_last_operation to top level
This then eliminates the misguided attempts at merging f2/4 and f3 flash
support.  Some headers remain.
2018-07-29 20:31:17 +00:00
Karl Palsson
c272ea410e stm32: flash: move clear all status flags to single common header
We've got a "f" flash file for common apis now, use it.
2018-07-29 20:31:17 +00:00
Karl Palsson
a949b223c3 stm32f3: flash: pgerr is not the same as pgperr
F3's flash interface is actually quite different, don't try and force
sharing code that isn't really related.  The "PGERR" is a very different
bit than the parallelism error that f2/4/7 have.
2018-07-29 20:31:17 +00:00
Karl Palsson
850931dbcd stm32: flash_unlock_option_bytes is common code.
The keys differ between some familes, but the documentation and
implementation are standard.
2018-07-29 20:31:17 +00:00
Karl Palsson
c5a3350a7d stm32l: flash: rename option unlock keys or consistency
Paves the way for using common code.
2018-07-29 20:31:17 +00:00