Commit Graph

28 Commits

Author SHA1 Message Date
Karl Palsson da3466057b doc: stm32f2: rcc: add groupings for periph resets
We use a parent grouping to make the generic "AHB" groups work, even
though F2 and many later families have AHB1, AHB2 and AHB3
2019-06-12 22:56:34 +00:00
Karl Palsson 0965e691a9 stm32f2/f4: rcc: deprecate old IO definitions
instead of hard breaking, provide them as macros pointing to the new
values, and document them as deprecated.
2018-02-13 23:57:41 +00:00
Yonghua Zheng eeef996cb0 [BREAKING] rcc: change gpio bit defines to be consistent with reference manual
This _breaks_ your gpio code for F2 and F4.  It makes them consistent
with the reference manual, and more consistent with all other families
and general expectations.

OLD code -> NEW code
RCC_AHB1RSTR_IOPxRST 	->	RCC_AHB1RSTR_GPIOxRST
RCC_AHB1ENR_IOPIxEN	->	RCC_AHB1ENR_GPIOxEN
RCC_AHB1LPENR_IOPxLPEN	->	RCC_AHB1LPENR_GPIOxLPEN

[We're not actually breaking it, see the next commit for deprecated
aliases]
2018-02-13 23:57:21 +00:00
Karl Palsson 29c712326f stm32: rcc: extract osc_bypass functions
rcc_osc_bypass_enable and rcc_osc_bypass_disable have been copy/pasted
around for the last time!  There's a compile bit to check for L0/L1, but
otherwise this is just code duplication for no gain.
2017-06-08 23:01:45 +00:00
Karl Palsson d1d511c6f4 stm32: rcc: add reset reason group flags.
Originally suggested in https://github.com/libopencm3/libopencm3/pull/399

At least provide macros for each family that allows easy masking of the
full set of reset reason flags.  Trying to provide a function that
provides these in random upper bits seems unclear at best.
2017-03-30 21:48:08 +00:00
Karl Palsson 4eb51ecaea stm32: rcc: rcc_wait_for_osc_ready is always available
Move the prototype to the common_all header and include documentation.
2016-08-18 23:41:04 +00:00
Karl Palsson 29277adbe3 [BREAKING] stm32f2: rcc: use correct namespace prefixes for osc
Most other families were fully converted earlier, f2 missed a few.

Fixes: 3a7cbec7
2016-08-18 23:40:52 +00:00
Karl Palsson cf7d0a08ca stm32: rcc_wait_for_sysclk_status should actually wait
Original implementation only checked whether the user had _selected_ the
clock, not whether it had actually switched to the clock or not.  For
almost all cases, this made this function either a no-op, if you _had_
selected the clock, or a blocking loop if you hadn't selected it ahead
of time.

Fixes github issue #687
2016-08-15 16:09:58 +00:00
Karl Palsson 3a7cbec776 stm32l/stm32f: name space standardization [BREAKING]
As done by esden for the F4, remove typedefs and add prefixes to clock enums
This extends this to all stm32 families.

    Let's not hide the fact that these variables are structs/enums.

    We are filling up the namespace badly enough, we should be prefixing as
    much as we can with the module names at least. As users we already run
    often enough in namespace colisions we don't have to make it worse.

    * CLOCK_3V3_xxx enums renamed to RCC_CLOCK_3V3_xxx
    * clock enums (PLL, HSI, HSE ...) prefixed with RCC_
    * scale enum of pwr module prefixed with PWR_
2015-12-14 23:26:42 +01:00
Karl Palsson 5746fd4d25 stm32: common: Extract MCO source setting
This adds MCO source selection to some targets, and removes and standardizes
the mask/shift usage for all targets.  For devices that support MCO2, this
supports only MCO1.  No attempt has been made to extract MCO prescaler, which
is not available on all F1 and F3.
2015-04-29 01:22:27 +00:00
Chuck McManis 14ad92015e Audit RTCPRE Shift and Mask Values
L0 - RTC Prescaler appears in RCC_CR, bit 20, 2 bits wide (RM0367 Rev 2)
L1 - RTC Prescaler appears in RCC_CR, bit 29, 2 bits wide (RM0038 Rev 10)
F0 - no prescaler setting (RM0091 Rev 7)
F1 - no prescaler setting (RM0041 Rev 4)
F2 - RTC Prescaler appears at RCC_CFGR, bit 16, 4 bits wide (RM0033 Rev 6)
F3 - no prescaler setting (RM0316 Rev 3)
F4 - RTC Prescaler appears at RCC_CFGR, bit 16, 4 bits wide (RM0090 Rev 8)
2014-12-14 16:29:03 -08:00
Chuck McManis 9ddfcb0e53 Rename rcc_ppre1_frequency and rcc_ppre2_frequency
Rename rcc_ppre1_frequency and rcc_ppre2_frequency to rcc_apb1_frequency and rcc_apb2_frequency
Also add rcc_ahb_frequency (although it is not set correctly in all cases) which will be fixed by
the rcc commits later. Also fixup the only use in the library of these variables, the USART code.

And fix the typos that resulted
Make l1 generic too
2014-12-13 19:49:04 -08:00
Ken Sarkies 7816501dbc Changes to the header includes for all STM32 peripherals
to remove variations, redundancies, add missing, fix errors. All c files
refer only to the dispatch style headers in /include/stm32. Those headers
#include memorymap.h and cm3/common.h. All references to
these are removed from the family specific headers. Ethernet untouched as
it appears incomplete.

Added dummy spi.c for F0/F3. Fix some doxygen anomalies.
2014-03-11 16:40:31 +00:00
Ken Sarkies 3c6e9fd56d Fix a number of top level doxygen issues.
So that the navigation pane works correctly in browsers.
Some additional doc fixes put in where found (but many more still to go).
Added some dummy .c and .h files to bring the associated docs into line.
makefile changed to allow 'make html' as well as 'make doc' (the latter only does html anyway).
2014-01-15 22:19:52 +01:00
BuFran 723e1a69bd Better method of reset and clock handling with RCC, support L1, F1, F2, F3, F4 2014-01-02 22:00:11 +01:00
Piotr Esden-Tempski 39fa9e4c58 Stile fixes run, 80 char boundry. 2013-06-12 21:07:35 -07:00
Piotr Esden-Tempski 34de1e776e Changed to use stdint types. 2013-06-12 19:11:22 -07:00
Piotr Esden-Tempski 7df63fcae0 First coarse run to fix coding style in locm3.
Added --terse and --mailback options to the make stylecheck target. It
also does continue even if it enounters a possible error.

We decided on two exceptions from the linux kernel coding standard:
- Empty wait while loops may end with ; on the same line.
- All blocks after while, if, for have to be in brackets even if they
  only contain one statement. Otherwise it is easy to introduce an
  error.

Checkpatch needs to be adapted to reflect those changes.
2013-06-12 18:22:56 -07:00
Piotr Esden-Tempski 7cd9b43529 Fix all warnings for stm32f2 lib. 2013-02-26 17:17:43 -08:00
Piotr Esden-Tempski 9193d3d273 Fixes #93 copypasta error in RCC_CSR_BORRSTF definition. 2013-02-15 16:14:30 -08:00
Nicolas Schodet 3aab6220d8 Add C linkage declaration for C++ usage 2012-09-02 17:12:58 +02:00
Piotr Esden-Tempski 43561de329 License change of the library to LGPL, version 3 or later.
Agreed to by all the significant contributors to the library.
2012-03-02 14:44:49 -08:00
Piotr Esden-Tempski c6f30043fd Added UART4 and UART5 gpio definitions for stm32f1. Also corrected the naming everywhere. Both peripherals are UARTS not U_S_ARTS. 2011-11-16 18:17:56 -08:00
Stephen Caudle 1fea1df39a Fix more STM32 whitespace issues 2011-10-31 11:11:03 -04:00
Stephen Caudle 05bc9d10f1 Add generic STM32F2 RCC clock function 2011-10-31 00:17:53 -04:00
Stephen Caudle e2ed7824cf Clean up whitespace in stm32f2 RCC
Also make RCC IO defines consistent with stm32f1.
2011-10-30 17:49:41 -04:00
Stephen Caudle 36cff03af1 Add RCC and FLASH support for STM32F2 2011-10-27 23:34:52 -04:00
Fergus Noble 0565cb8378 RCC header file for F2 implemented, no convenience functions so far. 2011-10-12 22:17:17 -04:00