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