source: rtems/c/src/lib/libcpu/arm/s3c24xx/clock/support.c @ c193baad

4.104.115
Last change on this file since c193baad was dbdb0255, checked in by Joel Sherrill <joel.sherrill@…>, on 05/06/08 at 20:58:05

2008-05-06 Ray Xu <rayx.cn@…>

  • Makefile.am, configure.ac, preinstall.am, s3c2400/include/s3c2400.h: Add CPU type s3c2410. Add a new s3c24xx common file shared between s3c2400 and s3c2410. Most content is moved from s3c2400 now. Some were changed to include <s3c24xx.h> instead of <s3c2400.h>.
  • s3c2410/include/s3c2410.h, s3c2410/irq/bsp_irq_asm.S, s3c2410/irq/irq.h, s3c24xx/clock/clockdrv.c, s3c24xx/clock/support.c, s3c24xx/include/s3c24xx.h, s3c24xx/irq/bsp_irq_init.c, s3c24xx/irq/irq.c, s3c24xx/irq/irq.h, s3c24xx/timer/timer.c: New files.
  • Property mode set to 100644
File size: 1.1 KB
Line 
1#include <rtems.h>
2#include <bsp.h>
3#include <s3c24xx.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.