1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup lpc24xx |
---|
5 | * |
---|
6 | * @brief BSP start configuration. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2011-2012 embedded brains GmbH. All rights reserved. |
---|
11 | * |
---|
12 | * embedded brains GmbH |
---|
13 | * Obere Lagerstr. 30 |
---|
14 | * 82178 Puchheim |
---|
15 | * Germany |
---|
16 | * <rtems@embedded-brains.de> |
---|
17 | * |
---|
18 | * The license and distribution terms for this file may be |
---|
19 | * found in the file LICENSE in this distribution or at |
---|
20 | * http://www.rtems.org/license/LICENSE. |
---|
21 | */ |
---|
22 | |
---|
23 | #ifndef LIBBSP_ARM_LPC24XX_START_CONFIG_H |
---|
24 | #define LIBBSP_ARM_LPC24XX_START_CONFIG_H |
---|
25 | |
---|
26 | #include <rtems/score/armv7m.h> |
---|
27 | |
---|
28 | #include <bsp.h> |
---|
29 | #include <bsp/io.h> |
---|
30 | #include <bsp/start.h> |
---|
31 | #include <bsp/lpc-emc.h> |
---|
32 | |
---|
33 | #ifdef __cplusplus |
---|
34 | extern "C" { |
---|
35 | #endif /* __cplusplus */ |
---|
36 | |
---|
37 | /** |
---|
38 | * @brief Pico seconds @a ps to clock ticks for clock frequency @a f. |
---|
39 | */ |
---|
40 | #define LPC24XX_PS_TO_CLK(ps, f) \ |
---|
41 | (((((uint64_t) (ps)) * ((uint64_t) (f))) + 1000000000000ULL - 1ULL) \ |
---|
42 | / 1000000000000ULL) |
---|
43 | |
---|
44 | /** |
---|
45 | * @brief Pico seconds @a ps to EMCCLK clock ticks adjusted by @a m. |
---|
46 | */ |
---|
47 | #define LPC24XX_PS_TO_EMCCLK(ps, m) \ |
---|
48 | (LPC24XX_PS_TO_CLK(ps, LPC24XX_EMCCLK) > (m) ? \ |
---|
49 | LPC24XX_PS_TO_CLK(ps, LPC24XX_EMCCLK) - (m) : 0) |
---|
50 | |
---|
51 | typedef struct { |
---|
52 | uint32_t refresh; |
---|
53 | uint32_t readconfig; |
---|
54 | uint32_t trp; |
---|
55 | uint32_t tras; |
---|
56 | uint32_t tsrex; |
---|
57 | uint32_t tapr; |
---|
58 | uint32_t tdal; |
---|
59 | uint32_t twr; |
---|
60 | uint32_t trc; |
---|
61 | uint32_t trfc; |
---|
62 | uint32_t txsr; |
---|
63 | uint32_t trrd; |
---|
64 | uint32_t tmrd; |
---|
65 | uint32_t emcdlyctl; |
---|
66 | } lpc24xx_emc_dynamic_config; |
---|
67 | |
---|
68 | typedef struct { |
---|
69 | volatile lpc_emc_dynamic *chip_select; |
---|
70 | uint32_t address; |
---|
71 | uint32_t config; |
---|
72 | uint32_t rascas; |
---|
73 | uint32_t mode; |
---|
74 | } lpc24xx_emc_dynamic_chip_config; |
---|
75 | |
---|
76 | typedef struct { |
---|
77 | volatile lpc_emc_static *chip_select; |
---|
78 | struct { |
---|
79 | uint32_t config; |
---|
80 | uint32_t waitwen; |
---|
81 | uint32_t waitoen; |
---|
82 | uint32_t waitrd; |
---|
83 | uint32_t waitpage; |
---|
84 | uint32_t waitwr; |
---|
85 | uint32_t waitrun; |
---|
86 | } config; |
---|
87 | } lpc24xx_emc_static_chip_config; |
---|
88 | |
---|
89 | extern BSP_START_DATA_SECTION const lpc24xx_pin_range |
---|
90 | lpc24xx_start_config_pinsel []; |
---|
91 | |
---|
92 | extern BSP_START_DATA_SECTION const lpc24xx_emc_dynamic_config |
---|
93 | lpc24xx_start_config_emc_dynamic []; |
---|
94 | |
---|
95 | extern BSP_START_DATA_SECTION const lpc24xx_emc_dynamic_chip_config |
---|
96 | lpc24xx_start_config_emc_dynamic_chip []; |
---|
97 | |
---|
98 | extern BSP_START_DATA_SECTION const size_t |
---|
99 | lpc24xx_start_config_emc_dynamic_chip_count; |
---|
100 | |
---|
101 | extern BSP_START_DATA_SECTION const lpc24xx_emc_static_chip_config |
---|
102 | lpc24xx_start_config_emc_static_chip []; |
---|
103 | |
---|
104 | extern BSP_START_DATA_SECTION const size_t |
---|
105 | lpc24xx_start_config_emc_static_chip_count; |
---|
106 | |
---|
107 | #ifdef ARM_MULTILIB_ARCH_V7M |
---|
108 | |
---|
109 | extern BSP_START_DATA_SECTION const ARMV7M_MPU_Region |
---|
110 | lpc24xx_start_config_mpu_region []; |
---|
111 | |
---|
112 | extern BSP_START_DATA_SECTION const size_t |
---|
113 | lpc24xx_start_config_mpu_region_count; |
---|
114 | |
---|
115 | #endif /* ARM_MULTILIB_ARCH_V7M */ |
---|
116 | |
---|
117 | #ifdef __cplusplus |
---|
118 | } |
---|
119 | #endif /* __cplusplus */ |
---|
120 | |
---|
121 | #endif /* LIBBSP_ARM_LPC24XX_START_CONFIG_H */ |
---|