1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup lpc24xx_clocks |
---|
5 | * |
---|
6 | * @brief System clocks. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2008, 2009 |
---|
11 | * embedded brains GmbH |
---|
12 | * Obere Lagerstr. 30 |
---|
13 | * D-82178 Puchheim |
---|
14 | * Germany |
---|
15 | * <rtems@embedded-brains.de> |
---|
16 | * |
---|
17 | * The license and distribution terms for this file may be |
---|
18 | * found in the file LICENSE in this distribution or at |
---|
19 | * http://www.rtems.com/license/LICENSE. |
---|
20 | */ |
---|
21 | |
---|
22 | #ifndef LIBBSP_ARM_LPC24XX_SYSTEM_CLOCKS_H |
---|
23 | #define LIBBSP_ARM_LPC24XX_SYSTEM_CLOCKS_H |
---|
24 | |
---|
25 | #include <bsp/lpc24xx.h> |
---|
26 | |
---|
27 | #ifdef __cplusplus |
---|
28 | extern "C" { |
---|
29 | #endif /* __cplusplus */ |
---|
30 | |
---|
31 | /** |
---|
32 | * @defgroup lpc24xx_clock System Clocks |
---|
33 | * |
---|
34 | * @ingroup lpc24xx |
---|
35 | * |
---|
36 | * @brief System clocks. |
---|
37 | * |
---|
38 | * @{ |
---|
39 | */ |
---|
40 | |
---|
41 | /** |
---|
42 | * @brief Initializes the standard timer. |
---|
43 | * |
---|
44 | * This function uses Timer 1. |
---|
45 | */ |
---|
46 | void lpc24xx_timer_initialize(void); |
---|
47 | |
---|
48 | /** |
---|
49 | * @brief Returns current standard timer value in CPU clocks. |
---|
50 | * |
---|
51 | * This function uses Timer 1. |
---|
52 | */ |
---|
53 | static inline unsigned lpc24xx_timer(void) |
---|
54 | { |
---|
55 | return T1TC; |
---|
56 | } |
---|
57 | |
---|
58 | /** |
---|
59 | * @brief Delay for @a us micro seconds. |
---|
60 | * |
---|
61 | * This function uses the standard timer and assumes that the CPU frequency is |
---|
62 | * in whole MHz numbers. The delay value @a us will be converted to CPU ticks |
---|
63 | * and there is no protection against integer overflows. |
---|
64 | * |
---|
65 | * This function uses Timer 1. |
---|
66 | */ |
---|
67 | void lpc24xx_micro_seconds_delay(unsigned us); |
---|
68 | |
---|
69 | /** |
---|
70 | * @brief Returns the PLL output clock frequency in [Hz]. |
---|
71 | * |
---|
72 | * Returns zero in case of an unexpected PLL input frequency. |
---|
73 | */ |
---|
74 | unsigned lpc24xx_pllclk(void); |
---|
75 | |
---|
76 | /** |
---|
77 | * @brief Returns the CPU clock frequency in [Hz]. |
---|
78 | * |
---|
79 | * Returns zero in case of an unexpected PLL input frequency. |
---|
80 | */ |
---|
81 | unsigned lpc24xx_cclk(void); |
---|
82 | |
---|
83 | /** @} */ |
---|
84 | |
---|
85 | #ifdef __cplusplus |
---|
86 | } |
---|
87 | #endif /* __cplusplus */ |
---|
88 | |
---|
89 | #endif /* LIBBSP_ARM_LPC24XX_SYSTEM_CLOCKS_H */ |
---|