[4f609eec] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @ingroup lpc24xx |
---|
| 5 | * |
---|
| 6 | * @brief BSP start configuration. |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | /* |
---|
[14ee5a1e] | 10 | * Copyright (c) 2011-2012 embedded brains GmbH. All rights reserved. |
---|
[4f609eec] | 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 |
---|
[c499856] | 20 | * http://www.rtems.org/license/LICENSE. |
---|
[4f609eec] | 21 | */ |
---|
| 22 | |
---|
| 23 | #ifndef LIBBSP_ARM_LPC24XX_START_CONFIG_H |
---|
| 24 | #define LIBBSP_ARM_LPC24XX_START_CONFIG_H |
---|
| 25 | |
---|
[14ee5a1e] | 26 | #include <rtems/score/armv7m.h> |
---|
| 27 | |
---|
[4f609eec] | 28 | #include <bsp.h> |
---|
[4a6cc2a] | 29 | #include <bsp/io.h> |
---|
[4f609eec] | 30 | #include <bsp/start.h> |
---|
| 31 | #include <bsp/lpc-emc.h> |
---|
| 32 | |
---|
| 33 | #ifdef __cplusplus |
---|
| 34 | extern "C" { |
---|
| 35 | #endif /* __cplusplus */ |
---|
| 36 | |
---|
[f7deb58] | 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 | |
---|
[4f609eec] | 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; |
---|
[4a6cc2a] | 65 | uint32_t emcdlyctl; |
---|
[4f609eec] | 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 | |
---|
[4a6cc2a] | 89 | extern BSP_START_DATA_SECTION const lpc24xx_pin_range |
---|
| 90 | lpc24xx_start_config_pinsel []; |
---|
[4f609eec] | 91 | |
---|
[4a6cc2a] | 92 | extern BSP_START_DATA_SECTION const lpc24xx_emc_dynamic_config |
---|
[4f609eec] | 93 | lpc24xx_start_config_emc_dynamic []; |
---|
| 94 | |
---|
[4a6cc2a] | 95 | extern BSP_START_DATA_SECTION const lpc24xx_emc_dynamic_chip_config |
---|
[4f609eec] | 96 | lpc24xx_start_config_emc_dynamic_chip []; |
---|
| 97 | |
---|
[4a6cc2a] | 98 | extern BSP_START_DATA_SECTION const size_t |
---|
[4f609eec] | 99 | lpc24xx_start_config_emc_dynamic_chip_count; |
---|
| 100 | |
---|
[4a6cc2a] | 101 | extern BSP_START_DATA_SECTION const lpc24xx_emc_static_chip_config |
---|
[4f609eec] | 102 | lpc24xx_start_config_emc_static_chip []; |
---|
| 103 | |
---|
[4a6cc2a] | 104 | extern BSP_START_DATA_SECTION const size_t |
---|
[4f609eec] | 105 | lpc24xx_start_config_emc_static_chip_count; |
---|
| 106 | |
---|
[40340b2] | 107 | #ifdef ARM_MULTILIB_ARCH_V7M |
---|
| 108 | |
---|
[14ee5a1e] | 109 | extern BSP_START_DATA_SECTION const ARMV7M_MPU_Region |
---|
[a94bcc5a] | 110 | lpc24xx_start_config_mpu_region []; |
---|
| 111 | |
---|
| 112 | extern BSP_START_DATA_SECTION const size_t |
---|
| 113 | lpc24xx_start_config_mpu_region_count; |
---|
[14ee5a1e] | 114 | |
---|
[40340b2] | 115 | #endif /* ARM_MULTILIB_ARCH_V7M */ |
---|
| 116 | |
---|
[4f609eec] | 117 | #ifdef __cplusplus |
---|
| 118 | } |
---|
| 119 | #endif /* __cplusplus */ |
---|
| 120 | |
---|
| 121 | #endif /* LIBBSP_ARM_LPC24XX_START_CONFIG_H */ |
---|