summaryrefslogtreecommitdiffstats
path: root/bsps/arm/atsam/include/bsp/atsam-clock-config.h
blob: 2e9309631d8bcb6891d25d7f28ee1c5c9295ec9d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Copyright (c) 2017 embedded brains GmbH.  All rights reserved.
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rtems.org/license/LICENSE.
 */

#ifndef ATSAM_CLOCK_CONFIG_H
#define ATSAM_CLOCK_CONFIG_H

#include <rtems.h>
#include <bsp/linker-symbols.h>
#include <bspopts.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#if ATSAM_CHANGE_CLOCK_FROM_SRAM != 0
/* Note: fast_text is the simplest section to put this code into. Other
 * possibilities would include creating a new section. */
#define ATSAM_START_SRAM_SECTION BSP_FAST_TEXT_SECTION
#else
#define ATSAM_START_SRAM_SECTION
#endif

struct atsam_clock_config {
  /* Initialization value for the PMC_PLLAR. */
  uint32_t pllar_init;
  /* Initialization value for the PMC_MCKR. */
  uint32_t mckr_init;
  /* Resulting frequency in Hz. */
  uint32_t mck_freq;
};

ATSAM_START_SRAM_SECTION
extern const struct atsam_clock_config atsam_clock_config;

#define BOARD_MCK (atsam_clock_config.mck_freq)

typedef struct BOARD_Sdram_Config {
  uint32_t sdramc_tr;
  uint32_t sdramc_cr;
  uint32_t sdramc_mdr;
  uint32_t sdramc_cfr1;
  uint32_t sdramc_lpr;
} atsam_sdram_config;

ATSAM_START_SRAM_SECTION
extern const atsam_sdram_config BOARD_Sdram_Config;

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* ATSAM_CLOCK_CONFIG_H */