From f7deb58df032f5796769b066a2d796348b04dd55 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 11 Jun 2012 08:51:32 +0200 Subject: bsp/lpc24xx: Simplify EMC configuration --- c/src/lib/libbsp/arm/lpc24xx/include/start-config.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'c/src/lib/libbsp/arm/lpc24xx/include/start-config.h') diff --git a/c/src/lib/libbsp/arm/lpc24xx/include/start-config.h b/c/src/lib/libbsp/arm/lpc24xx/include/start-config.h index 29b234f62b..648fa13a31 100644 --- a/c/src/lib/libbsp/arm/lpc24xx/include/start-config.h +++ b/c/src/lib/libbsp/arm/lpc24xx/include/start-config.h @@ -34,6 +34,20 @@ extern "C" { #endif /* __cplusplus */ +/** + * @brief Pico seconds @a ps to clock ticks for clock frequency @a f. + */ +#define LPC24XX_PS_TO_CLK(ps, f) \ + (((((uint64_t) (ps)) * ((uint64_t) (f))) + 1000000000000ULL - 1ULL) \ + / 1000000000000ULL) + +/** + * @brief Pico seconds @a ps to EMCCLK clock ticks adjusted by @a m. + */ +#define LPC24XX_PS_TO_EMCCLK(ps, m) \ + (LPC24XX_PS_TO_CLK(ps, LPC24XX_EMCCLK) > (m) ? \ + LPC24XX_PS_TO_CLK(ps, LPC24XX_EMCCLK) - (m) : 0) + typedef struct { uint32_t refresh; uint32_t readconfig; -- cgit v1.2.3