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

4.104.115
Last change on this file since c193baad was c193baad, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on 04/09/10 at 20:24:57

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

  • Property mode set to 100644
File size: 2.6 KB
RevLine 
[3d6669cc]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 *
[f2f11abe]9 *  http://www.rtems.com/license/LICENSE.
[3d6669cc]10 *
11 *
12 *  $Id$
13*/
14#include <rtems.h>
15#include <ep7312.h>
16#include <bsp.h>
17#include <irq.h>
18
[f14a21df]19#if ON_SKYEYE==1
20  #define CLOCK_DRIVER_USE_FAST_IDLE
21#endif
22
[3d6669cc]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,
[c193baad]30                                         NULL,
[3d6669cc]31                                         clock_isr_on,
32                                         clock_isr_off,
[c193baad]33                                         clock_isr_is_on};
[3d6669cc]34
35#define CLOCK_VECTOR 0
36
37#define Clock_driver_support_at_tick()                \
38  do {                                                \
39    *EP7312_TC1EOI = 0xffffffff;                      \
40  } while(0)
41
[6d2c4aa4]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)
[3d6669cc]47
[6128a4a]48/*
[3d6669cc]49 * Set up the clock hardware
[627e7930]50 */
51#if ON_SKYEYE
52  #define TCD_VALUE \
[8eb28306]53    (rtems_configuration_get_microseconds_per_tick() * 2000)/25000
[627e7930]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;                    \
[0fe59ec]64  } while (0)
[3d6669cc]65
66#define Clock_driver_support_shutdown_hardware()                        \
67  do {                                                                  \
[0fe59ec]68    BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
69  } while (0)
[3d6669cc]70
[8eb28306]71/**
72 *  Return the nanoseconds since last tick
73 */
[f14a21df]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
[3d6669cc]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
[81d86a0]97#include "../../../shared/clockdrv_shell.h"
Note: See TracBrowser for help on using the repository browser.