source: rtems/c/src/lib/libbsp/arm/stm32f4/include/stm32f4xxxx_flash.h @ 7db6953

4.11
Last change on this file since 7db6953 was 7db6953, checked in by Tomasz Gregorek <tomasz.gregorek@…>, on Sep 21, 2014 at 6:07:41 PM

bsp/stm32f4XXXX: System clock configuration

Added simple math to caclulate register values for the PLL
and for the prescalers. It will try to keep 48MHz for the USB OTG FS.
Also it will set latency on the Flash memory for the high speeds.

Limitations:
It is assumed that 1MHz resolution is enough.
Best fits for the clocks are achieved with multiplies of 42MHz.
Even though APB1, APB2 and AHB are calculated user is still required
to provide correct values for the bsp configuration for the:
STM32F4_PCLK1
STM32F4_PCLK2
STM32F4_HCLK (= system clock)
as those are used for the peripheral clocking calculations.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup stm32f4_flash
5 *
6 * @brief STM32F4XXXX FLASH support.
7 *
8 * Contains structure desribing registers responsible for the flash memory
9 * configuration.
10 */
11
12/*
13 * Copyright (c) 2014 Tomasz Gregorek.  All rights reserved.
14 *
15 *  <tomasz.gregorek@gmail.com>
16 *
17 * The license and distribution terms for this file may be
18 * found in the file LICENSE in this distribution or at
19 * http://www.rtems.org/license/LICENSE.
20 */
21
22#ifndef LIBBSP_ARM_STM32F4_STM32F4XXXX_FLASH_H
23#define LIBBSP_ARM_STM32F4_STM32F4XXXX_FLASH_H
24
25#include <bsp/utility.h>
26
27/**
28 * @defgroup stm32f10xxx_flash STM32F4XXXX FLASH Support
29 * @ingroup stm32f4_flash
30 * @brief STM32F4FXXX FLASH Support
31 * @{
32 */
33
34typedef struct {
35  uint32_t acr;
36  uint32_t keyr;
37  uint32_t optkeyr;
38  uint32_t sr;
39  uint32_t cr;
40  uint32_t optcr;
41  uint32_t optcr1;
42} stm32f4_flash;
43
44/** @} */
45
46#define FLASH_ACR_LATENCY( val ) BSP_FLD32( val, 0, 3 )
47#define FLASH_ACR_LATENCY_MSK BSP_MSK32( 0, 3 )
48#define FLASH_ACR_PRFTEN BSP_BIT32( 8 )
49#define FLASH_ACR_ICEN BSP_BIT32( 9 )
50#define FLASH_ACR_DCEN BSP_BIT32( 10 )
51#define FLASH_ACR_ICRST BSP_BIT32( 11 )
52#define FLASH_ACR_DCRST BSP_BIT32( 12 )
53
54#endif /* LIBBSP_ARM_STM32F4_STM32F4XXXX_FLASH_H */
Note: See TracBrowser for help on using the repository browser.