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

4.104.115
Last change on this file since 7a6f8d0 was 8eb28306, checked in by Joel Sherrill <joel.sherrill@…>, on 08/06/09 at 22:24:36

2009-08-06 Joel Sherrill <joel.sherrill@…>

  • clock/clockdrv.c: Tinker with clock on Skyeye.
  • Property mode set to 100644
File size: 2.7 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                                         clock_isr_on,
31                                         clock_isr_off,
32                                         clock_isr_is_on,
33                                         3,
34                                         0 };
35
36#define CLOCK_VECTOR 0
37
38#define Clock_driver_support_at_tick()                \
39  do {                                                \
40    *EP7312_TC1EOI = 0xffffffff;                      \
41  } while(0)
42
43#define Clock_driver_support_install_isr( _new, _old ) \
44  do {                                                 \
45      (_old) = NULL; /* avoid warning */;              \
46      BSP_install_rtems_irq_handler(&clock_isr_data);  \
47  } while(0)
48
49/*
50 * Set up the clock hardware
51 */
52#if ON_SKYEYE
53  #define TCD_VALUE \
54    (rtems_configuration_get_microseconds_per_tick() * 2000)/25000
55#else
56  #define TCD_VALUE \
57    (rtems_configuration_get_microseconds_per_tick() * 2000)/1000000
58#endif
59
60#define Clock_driver_support_initialize_hardware()  \
61  do {                                              \
62    *EP7312_SYSCON1 |= EP7312_SYSCON1_TC1_PRESCALE; \
63    *EP7312_TC1D = TCD_VALUE;                       \
64    *EP7312_TC1EOI = 0xFFFFFFFF;                    \
65  } while (0)
66
67#define Clock_driver_support_shutdown_hardware()                        \
68  do {                                                                  \
69    BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
70  } while (0)
71
72/**
73 *  Return the nanoseconds since last tick
74 */
75uint32_t clock_driver_get_nanoseconds_since_last_tick(void)
76{
77  return 0;
78}
79
80#define Clock_driver_nanoseconds_since_last_tick \
81  clock_driver_get_nanoseconds_since_last_tick
82
83static void clock_isr_on(const rtems_irq_connect_data *unused)
84{
85    return;
86}
87
88static void clock_isr_off(const rtems_irq_connect_data *unused)
89{
90    return;
91}
92
93static int clock_isr_is_on(const rtems_irq_connect_data *irq)
94{
95    return 1;
96}
97
98#include "../../../shared/clockdrv_shell.h"
Note: See TracBrowser for help on using the repository browser.