29 Commits

Author SHA1 Message Date
Guillaume Revaillot
38b45c8786 stm32g0: add adc.
v2 "single" peripheral with a couple of tweaks :
 - added registers to configure two additionnal advanced analog watchdog.
 - different adc sampling time time based on channel groups.
 - 8 steps adc sequence injection, using chselr/chselrmode.

And a note on the rm explaining that after every configuration change to ADC_CFGR1's
SCANDIR or CHSELRMOD or CHSELR register, user need to check that configuration
is applied before any other modification / adc conversion start.. making adc_set_reqular
a bit painfull to read..
2019-11-08 14:19:17 +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
Guillaume Revaillot
b9f183bf1e stm32g0: add dma.
same same, bit for bit, except not ;) - Channel request mapping now
depends on a new DMAMUX peripheral, and there's no default preset.
So, before enabling dma channel after its configuration, request
must be configured by :

dmamux_set_dma_channel_request(DMAMUX1, DMA_CHANNELx, request_number_from_datasheet);
2019-11-08 13:47:41 +01: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
615918ffde stm32g0: compile spi_common_v1.c
fix #1067
2019-06-17 22:34:51 +00:00
Karl Palsson
6c1f54dcb7 stm32g0: sort makefiles
easier to merge, easier to find things you're looking for.
2019-06-13 21:30:06 +00:00
Guillaume Revaillot
ab1b0c1a5e stm32g0: exti doc fixup 2019-06-13 12:04:58 +02:00
Guillaume Revaillot
8173fb7249 stm32g0: add timer.
Only tim2/3/7/14 have been really tested yet - but the others should
work as well.
2019-06-13 12:04:58 +02:00
Guillaume Revaillot
74526f00cc stm32g0: add crc.
Regular crc-v2 peripheral, except that CRC_IDR is now 32bit wide - but
not used.
2019-06-13 12:04:58 +02:00
Guillaume Revaillot
38006c3c82 stm32g0: add rng.
Regular rng peripheral, with one additional bit : clock error detection
apparently available on l4 chips).  Curiously, Clock error detection is
_disabled_ when bit is set, but bit is cleared by default, so peripheral
/ clock error detection behaves like all other chips..

NB: RNG need proper rcc_ccicr_rngsel bits set to work, no clock is set by
default. Note also that on that chip fRNGCLK must be higher than fHCLK/32
2019-06-13 12:04:58 +02:00
Guillaume Revaillot
5a349d3ab6 stm32g0: add i2c.
Regular i2c peripheral.
Partially tested as i had no i2c slave on hand, but i can see i2c on my scope..
2019-06-13 12:04:58 +02:00
Guillaume Revaillot
ba3b50a4ad stm32g0: add spi.
classic "common" spi + frf bit spi peripheral.
As for i2c, i could only check signals on scope, no spi slave to check, but looks ok.
2019-06-13 11:56:20 +02:00
Guillaume Revaillot
a51ecb4719 stm32g0: add usart. 2019-06-13 11:56:20 +02:00
Guillaume Revaillot
bb98d0755c stm32g0: add iwdg.
regular v2 iwdg.
2019-06-13 11:07:53 +02:00
Karl Palsson
209dea96e7 doc: stm32g0: rcc: fix missing/typod param names 2019-06-12 23:20:59 +00:00
Karl Palsson
9904f9803e doc: stm32: unify "peripheral API" titles
doxygen really wants the @defgroup _and_ the @addtogroup to both have
the full name, matching identically, to avoid all warnings.

Standardize on the "CAPS_PERIPH peripheral API" style.
2019-06-12 23:06:22 +00:00
Karl Palsson
7be50a5e75 make: use $(PREFIX)gcc instead of $(PREFIX)-gcc
The leading - makes it rather inconsistent with the majority of other
projects around the world.  Use the form everyone else uses.
To solve this, properly pass prefix to inner makes as was always
intended.

Fixes: https://github.com/libopencm3/libopencm3/issues/1058
2019-06-07 21:25:46 +00:00
Karl Palsson
0aef9c2ec6 stm32: doc: pwr: move to peripheral_api
Some families had partially moved to peripheral api, and others were
only documenting common code, but not specific code.  Delete dummy .c
files, and check that all specific apis are also being documented, not
just common apis.
2019-05-22 00:10:39 +00:00
Karl Palsson
da76279bc6 stm32: flash: move to peripheral_apis
Change the groupings and headings to make them all consistent.
2019-05-21 23:41:21 +00:00
Karl Palsson
1af3acdba4 stm32: doc: exti: fix missing/wrong groups and move to peripheral_api
Almost all families were missing all docs for the exti apis.
2019-05-21 23:16:59 +00:00
Karl Palsson
d559b5a4db stm32g0: doc: move flash/pwr/rcc to "peripheral_apis"
Where we've been collecting things that have common/specific parts as
the new style of docs.
2019-05-21 21:47:43 +00:00
Karl Palsson
4aa9e484f6 stm32g0: flash: drop redundant docs
Functions that are already documented in the top level common api.h file
won't add any more documentation from later .c files.  Keep docs for
part specifics, in the .h files where they're accessible to IDEs and
also the documentation generation, and drop all (including the redundant
ones) from the .c file.
2019-05-21 21:46:02 +00:00
Karl Palsson
709d98e0a8 doc: stm32g0: drop redundant @ingroup and close groups
the group defaults to the implicit container based on location, so drop
all the explicit @ingroups, less to maintain.  Properly use /**@}*/ to
close all groups too, even though it mostly seems to have worked anyway.
Properly close all groups opened for files.
2019-05-21 21:44:05 +00:00
Guillaume Revaillot
55121126c3 stm32g0: add exti.
Regular exti, with enhanced EXTI_[FR]PR regs instead of EXTIR_PR.
2019-05-21 00:05:22 +00:00
Guillaume Revaillot
afd2db3097 stm32g0: add rcc. 2019-05-21 00:05:22 +00:00
Guillaume Revaillot
cbe5425090 stm32g0: add flash.
here, it's a bit of a mess.. G0 flash controller does not really
match exsting feature split. IE it has instruction cache only ..
so, no flash_idcache.c as it. flash_common_f could be used, but
flash_unlock would not take care of option byte ?

prefetch, icache and lock is ok. I had no look at flash programming
or erase yet..
2019-05-21 00:05:22 +00:00
Guillaume Revaillot
f13a9eee5b stm32g0: add power.
neither v1 nor v2...
2019-05-20 23:59:42 +00:00
Guillaume Revaillot
c49937a09c stm32g0: add gpio.
regular peripheral.
2019-05-20 23:43:46 +00:00
Guillaume Revaillot
b8d4b03722 stm32g0: add base, irqs, memorymap and current devices. 2019-05-20 23:43:41 +00:00