source: rtems/c/src/lib/libbsp/arm/edb7312/clock/clockdrv.c @ c193baad

4.104.11
Last change on this file since c193baad was c193baad, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on Apr 9, 2010 at 8:24:57 PM

unify irq data types and code, merge s3c2400/s3c2410 support

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
2 * Cirrus EP7312 Clock driver
3 *
4 * Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *
12 *  $Id$
13*/
14#include <rtems.h>
15#include <ep7312.h>
16#include <bsp.h>
17#include <irq.h>
18
19#if ON_SKYEYE==1
20  #define CLOCK_DRIVER_USE_FAST_IDLE
21#endif
22
23rtems_isr Clock_isr(rtems_vector_number vector);
24static void clock_isr_on(const rtems_irq_connect_data *unused);
25static void clock_isr_off(const rtems_irq_connect_data *unused);
26static int clock_isr_is_on(const rtems_irq_connect_data *irq);
27
28rtems_irq_connect_data clock_isr_data = {BSP_TC1OI,
29                                         (rtems_irq_hdl)Clock_isr,
30                                         NULL,
31                                         clock_isr_on,
32                                         clock_isr_off,
33                                         clock_isr_is_on};
34
35#define CLOCK_VECTOR 0
36
37#define Clock_driver_support_at_tick()                \
38  do {                                                \
39    *EP7312_TC1EOI = 0xffffffff;                      \
40  } while(0)
41
42#define Clock_driver_support_install_isr( _new, _old ) \
43  do {                                                 \
44      (_old) = NULL; /* avoid warning */;              \
45      BSP_install_rtems_irq_handler(&clock_isr_data);  \
46  } while(0)
47
48/*
49 * Set up the clock hardware
50 */
51#if ON_SKYEYE
52  #define TCD_VALUE \
53    (rtems_configuration_get_microseconds_per_tick() * 2000)/25000
54#else
55  #define TCD_VALUE \
56    (rtems_configuration_get_microseconds_per_tick() * 2000)/1000000
57#endif
58
59#define Clock_driver_support_initialize_hardware()  \
60  do {                                              \
61    *EP7312_SYSCON1 |= EP7312_SYSCON1_TC1_PRESCALE; \
62    *EP7312_TC1D = TCD_VALUE;                       \
63    *EP7312_TC1EOI = 0xFFFFFFFF;                    \
64  } while (0)
65
66#define Clock_driver_support_shutdown_hardware()                        \
67  do {                                                                  \
68    BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
69  } while (0)
70
71/**
72 *  Return the nanoseconds since last tick
73 */
74uint32_t clock_driver_get_nanoseconds_since_last_tick(void)
75{
76  return 0;
77}
78
79#define Clock_driver_nanoseconds_since_last_tick \
80  clock_driver_get_nanoseconds_since_last_tick
81
82static void clock_isr_on(const rtems_irq_connect_data *unused)
83{
84    return;
85}
86
87static void clock_isr_off(const rtems_irq_connect_data *unused)
88{
89    return;
90}
91
92static int clock_isr_is_on(const rtems_irq_connect_data *irq)
93{
94    return 1;
95}
96
97#include "../../../shared/clockdrv_shell.h"
Note: See TracBrowser for help on using the repository browser.