diff options
Diffstat (limited to 'c/src/lib/libbsp/arm/lpc24xx/include/system-clocks.h')
-rw-r--r-- | c/src/lib/libbsp/arm/lpc24xx/include/system-clocks.h | 69 |
1 files changed, 59 insertions, 10 deletions
diff --git a/c/src/lib/libbsp/arm/lpc24xx/include/system-clocks.h b/c/src/lib/libbsp/arm/lpc24xx/include/system-clocks.h index 8205b54dec..57f8dd9fa3 100644 --- a/c/src/lib/libbsp/arm/lpc24xx/include/system-clocks.h +++ b/c/src/lib/libbsp/arm/lpc24xx/include/system-clocks.h @@ -1,37 +1,86 @@ /** * @file * - * @ingroup lpc24xx + * @ingroup lpc24xx_clocks * * @brief System clocks. */ /* - * Copyright (c) 2008 - * Embedded Brains GmbH + * Copyright (c) 2008, 2009 + * embedded brains GmbH * Obere Lagerstr. 30 * D-82178 Puchheim * Germany - * rtems@embedded-brains.de + * <rtems@embedded-brains.de> * - * The license and distribution terms for this file may be found in the file - * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE. + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. */ #ifndef LIBBSP_ARM_LPC24XX_SYSTEM_CLOCKS_H #define LIBBSP_ARM_LPC24XX_SYSTEM_CLOCKS_H +#include <bsp/lpc24xx.h> + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -void lpc24xx_micro_seconds_delay( unsigned us); +/** + * @defgroup lpc24xx_clock System Clocks + * + * @ingroup lpc24xx + * + * @brief System clocks. + * + * @{ + */ -unsigned lpc24xx_pllclk( void); +/** + * @brief Initializes the standard timer. + * + * This function uses Timer 1. + */ +void lpc24xx_timer_initialize(void); -unsigned lpc24xx_cclk( void); +/** + * @brief Returns current standard timer value in CPU clocks. + * + * This function uses Timer 1. + */ +static inline unsigned lpc24xx_timer(void) +{ + return T1TC; +} + +/** + * @brief Delay for @a us micro seconds. + * + * This function uses the standard timer and assumes that the CPU frequency is + * in whole MHz numbers. The delay value @a us will be converted to CPU ticks + * and there is no protection against integer overflows. + * + * This function uses Timer 1. + */ +void lpc24xx_micro_seconds_delay(unsigned us); + +/** + * @brief Returns the PLL output clock frequency in [Hz]. + * + * Returns zero in case of an unexpected PLL input frequency. + */ +unsigned lpc24xx_pllclk(void); + +/** + * @brief Returns the CPU clock frequency in [Hz]. + * + * Returns zero in case of an unexpected PLL input frequency. + */ +unsigned lpc24xx_cclk(void); -void lpc24xx_set_pll( unsigned clksrc, unsigned nsel, unsigned msel, unsigned cclksel); +/** @} */ #ifdef __cplusplus } |