source: rtems/c/src/lib/libcpu/arm/s3c2400/clock/support.c @ 1f18710

4.104.114.84.95
Last change on this file since 1f18710 was 1f18710, checked in by Philippe Simons <loki_666@…>, on Jul 7, 2005 at 9:20:38 PM

2005-07-07 Philippe Simons <loki_666@…>

  • Makefile.am: Remove s3c2400/lcd/lcd.c
  • s3c2400/lcd/lcd.c: Remove.
  • s3c2400/clock/support.c: file "rewrote" to avoid GPL.
  • Property mode set to 100644
File size: 1.2 KB
Line 
1#include <rtems.h>
2#include <bsp.h>
3#include <s3c2400.h>
4
5/* ------------------------------------------------------------------------- */
6/* NOTE: This describes the proper use of this file.
7 *
8 * BSP_OSC_FREQ should be defined as the input frequency of the PLL.
9 *
10 * get_FCLK(), get_HCLK(), get_PCLK() and get_UCLK() return the clock of
11 * the specified bus in HZ.
12 */
13/* ------------------------------------------------------------------------- */
14
15/* return FCLK frequency */
16uint32_t get_FCLK(void)
17{
18    uint32_t r, m, p, s;
19
20    r = rMPLLCON;
21    m = ((r & 0xFF000) >> 12) + 8;
22    p = ((r & 0x003F0) >> 4) + 2;
23    s = r & 0x3;
24
25    return((BSP_OSC_FREQ * m) / (p << s));
26}
27
28/* return UCLK frequency */
29uint32_t get_UCLK(void)
30{
31    uint32_t r, m, p, s;
32
33    r = rUPLLCON;
34    m = ((r & 0xFF000) >> 12) + 8;
35    p = ((r & 0x003F0) >> 4) + 2;
36    s = r & 0x3;
37
38    return((BSP_OSC_FREQ * m) / (p << s));
39}
40
41/* return HCLK frequency */
42uint32_t get_HCLK(void)
43{
44    if (rCLKDIVN & 0x2) 
45        return get_FCLK()/2;
46    else
47        return get_FCLK();   
48}
49
50/* return PCLK frequency */
51uint32_t get_PCLK(void)
52{
53    if (rCLKDIVN & 0x1)
54        return get_HCLK()/2;
55    else
56        return get_HCLK();
57}
Note: See TracBrowser for help on using the repository browser.