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

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 2.4 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 *  http://www.rtems.org/license/LICENSE.
9 */
10
11#include <rtems.h>
12#include <ep7312.h>
13#include <bsp.h>
14#include <bsp/irq.h>
15#include <assert.h>
16
17#if ON_SKYEYE==1
18  #define CLOCK_DRIVER_USE_FAST_IDLE 1
19#endif
20
21void Clock_isr(void * arg);
22
23#define Clock_driver_support_at_tick()                \
24  do {                                                \
25    *EP7312_TC1EOI = 0xffffffff;                      \
26  } while(0)
27
28#define Clock_driver_support_install_isr( _new, _old ) \
29  do {                                                 \
30    rtems_status_code status = RTEMS_SUCCESSFUL;       \
31    (_old) = NULL; /* avoid warning */;                \
32    status = rtems_interrupt_handler_install(          \
33        BSP_TC1OI,                                     \
34        "Clock",                                       \
35        RTEMS_INTERRUPT_UNIQUE,                        \
36        Clock_isr,                                     \
37        NULL                                           \
38    );                                                 \
39    assert(status == RTEMS_SUCCESSFUL);                \
40  } while(0)
41
42/*
43 * Set up the clock hardware
44 */
45#if ON_SKYEYE
46  #define TCD_VALUE \
47    (rtems_configuration_get_microseconds_per_tick() * 2000)/25000
48#else
49  #define TCD_VALUE \
50    (rtems_configuration_get_microseconds_per_tick() * 2000)/1000000
51#endif
52
53#define Clock_driver_support_initialize_hardware()  \
54  do {                                              \
55    *EP7312_SYSCON1 |= EP7312_SYSCON1_TC1_PRESCALE; \
56    *EP7312_TC1D = TCD_VALUE;                       \
57    *EP7312_TC1EOI = 0xFFFFFFFF;                    \
58  } while (0)
59
60#define Clock_driver_support_shutdown_hardware()    \
61  do {                                              \
62    rtems_status_code status = RTEMS_SUCCESSFUL;    \
63    status = rtems_interrupt_handler_remove(        \
64        BSP_TC1OI,                                  \
65        Clock_isr,                                  \
66        NULL                                        \
67    );                                              \
68    assert(status == RTEMS_SUCCESSFUL);             \
69  } while (0)
70
71#include "../../../shared/clockdrv_shell.h"
Note: See TracBrowser for help on using the repository browser.