1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * |
---|
6 | * @ingroup RTEMSBSPsARMLPC24XX |
---|
7 | * |
---|
8 | * @brief BSP start configuration. |
---|
9 | */ |
---|
10 | |
---|
11 | /* |
---|
12 | * Copyright (c) 2011-2012 embedded brains GmbH. All rights reserved. |
---|
13 | * |
---|
14 | * Redistribution and use in source and binary forms, with or without |
---|
15 | * modification, are permitted provided that the following conditions |
---|
16 | * are met: |
---|
17 | * 1. Redistributions of source code must retain the above copyright |
---|
18 | * notice, this list of conditions and the following disclaimer. |
---|
19 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
20 | * notice, this list of conditions and the following disclaimer in the |
---|
21 | * documentation and/or other materials provided with the distribution. |
---|
22 | * |
---|
23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
24 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
27 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
32 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
33 | * POSSIBILITY OF SUCH DAMAGE. |
---|
34 | */ |
---|
35 | |
---|
36 | #ifndef LIBBSP_ARM_LPC24XX_START_CONFIG_H |
---|
37 | #define LIBBSP_ARM_LPC24XX_START_CONFIG_H |
---|
38 | |
---|
39 | #include <rtems/score/armv7m.h> |
---|
40 | |
---|
41 | #include <bsp.h> |
---|
42 | #include <bsp/io.h> |
---|
43 | #include <bsp/start.h> |
---|
44 | #include <bsp/lpc-emc.h> |
---|
45 | |
---|
46 | #ifdef __cplusplus |
---|
47 | extern "C" { |
---|
48 | #endif /* __cplusplus */ |
---|
49 | |
---|
50 | /** |
---|
51 | * @brief Pico seconds @a ps to clock ticks for clock frequency @a f. |
---|
52 | */ |
---|
53 | #define LPC24XX_PS_TO_CLK(ps, f) \ |
---|
54 | (((((uint64_t) (ps)) * ((uint64_t) (f))) + 1000000000000ULL - 1ULL) \ |
---|
55 | / 1000000000000ULL) |
---|
56 | |
---|
57 | /** |
---|
58 | * @brief Pico seconds @a ps to EMCCLK clock ticks adjusted by @a m. |
---|
59 | */ |
---|
60 | #define LPC24XX_PS_TO_EMCCLK(ps, m) \ |
---|
61 | (LPC24XX_PS_TO_CLK(ps, LPC24XX_EMCCLK) > (m) ? \ |
---|
62 | LPC24XX_PS_TO_CLK(ps, LPC24XX_EMCCLK) - (m) : 0) |
---|
63 | |
---|
64 | typedef struct { |
---|
65 | uint32_t refresh; |
---|
66 | uint32_t readconfig; |
---|
67 | uint32_t trp; |
---|
68 | uint32_t tras; |
---|
69 | uint32_t tsrex; |
---|
70 | uint32_t tapr; |
---|
71 | uint32_t tdal; |
---|
72 | uint32_t twr; |
---|
73 | uint32_t trc; |
---|
74 | uint32_t trfc; |
---|
75 | uint32_t txsr; |
---|
76 | uint32_t trrd; |
---|
77 | uint32_t tmrd; |
---|
78 | uint32_t emcdlyctl; |
---|
79 | } lpc24xx_emc_dynamic_config; |
---|
80 | |
---|
81 | typedef struct { |
---|
82 | volatile lpc_emc_dynamic *chip_select; |
---|
83 | uint32_t address; |
---|
84 | uint32_t config; |
---|
85 | uint32_t rascas; |
---|
86 | uint32_t mode; |
---|
87 | } lpc24xx_emc_dynamic_chip_config; |
---|
88 | |
---|
89 | typedef struct { |
---|
90 | volatile lpc_emc_static *chip_select; |
---|
91 | struct { |
---|
92 | uint32_t config; |
---|
93 | uint32_t waitwen; |
---|
94 | uint32_t waitoen; |
---|
95 | uint32_t waitrd; |
---|
96 | uint32_t waitpage; |
---|
97 | uint32_t waitwr; |
---|
98 | uint32_t waitrun; |
---|
99 | } config; |
---|
100 | } lpc24xx_emc_static_chip_config; |
---|
101 | |
---|
102 | extern BSP_START_DATA_SECTION const lpc24xx_pin_range |
---|
103 | lpc24xx_start_config_pinsel []; |
---|
104 | |
---|
105 | extern BSP_START_DATA_SECTION const lpc24xx_emc_dynamic_config |
---|
106 | lpc24xx_start_config_emc_dynamic []; |
---|
107 | |
---|
108 | extern BSP_START_DATA_SECTION const lpc24xx_emc_dynamic_chip_config |
---|
109 | lpc24xx_start_config_emc_dynamic_chip []; |
---|
110 | |
---|
111 | extern BSP_START_DATA_SECTION const size_t |
---|
112 | lpc24xx_start_config_emc_dynamic_chip_count; |
---|
113 | |
---|
114 | extern BSP_START_DATA_SECTION const lpc24xx_emc_static_chip_config |
---|
115 | lpc24xx_start_config_emc_static_chip []; |
---|
116 | |
---|
117 | extern BSP_START_DATA_SECTION const size_t |
---|
118 | lpc24xx_start_config_emc_static_chip_count; |
---|
119 | |
---|
120 | #ifdef ARM_MULTILIB_ARCH_V7M |
---|
121 | |
---|
122 | extern BSP_START_DATA_SECTION const ARMV7M_MPU_Region |
---|
123 | lpc24xx_start_config_mpu_region []; |
---|
124 | |
---|
125 | extern BSP_START_DATA_SECTION const size_t |
---|
126 | lpc24xx_start_config_mpu_region_count; |
---|
127 | |
---|
128 | #endif /* ARM_MULTILIB_ARCH_V7M */ |
---|
129 | |
---|
130 | #ifdef __cplusplus |
---|
131 | } |
---|
132 | #endif /* __cplusplus */ |
---|
133 | |
---|
134 | #endif /* LIBBSP_ARM_LPC24XX_START_CONFIG_H */ |
---|