source: rtems/c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c @ c030edd

5
Last change on this file since c030edd was 60e4c00, checked in by Joel Sherrill <joel.sherrill@…>, on 05/21/15 at 12:54:57

arm/s3c24xx/clock/clockdrv.c: Remove unused variable warning

  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2 *  S3C2400 clock specific using the System Timer
3 */
4
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 <bsp/irq.h>
13#include <bsp.h>
14#include <s3c24xx.h>
15
16void Clock_isr(rtems_irq_hdl_param arg);
17static void clock_isr_on(const rtems_irq_connect_data *unused);
18static void clock_isr_off(const rtems_irq_connect_data *unused);
19static int clock_isr_is_on(const rtems_irq_connect_data *irq);
20
21rtems_irq_connect_data clock_isr_data = {
22  .name   = BSP_INT_TIMER4,
23  .hdl    = Clock_isr,
24  .handle = NULL,
25  .on     = clock_isr_on,
26  .off    = clock_isr_off,
27  .isOn   = clock_isr_is_on,
28};
29
30/**
31 * When we get the clock interrupt
32 *    - clear the interrupt bit?
33 *    - restart the timer?
34 */
35#define Clock_driver_support_at_tick()                \
36  do {                                                \
37        ClearPending(BIT_TIMER4);                     \
38  } while(0)
39
40
41/**
42 * Installs the clock ISR. You shouldn't need to change this.
43 */
44#define Clock_driver_support_install_isr( _new, _old ) \
45  do {                                                 \
46    _old = NULL;                                       \
47    BSP_install_rtems_irq_handler(&clock_isr_data);    \
48  } while(0)
49
50
51/**
52 * Initialize the hardware for the clock
53 *   - Set the frequency
54 *   - enable it
55 *   - clear any pending interrupts
56 *
57 * Since you may want the clock always running, you can
58 * enable interrupts here. If you do so, the clock_isr_on(),
59 * clock_isr_off(), and clock_isr_is_on() functions can be
60 * NOPs.
61 */
62#define Clock_driver_support_initialize_hardware() \
63  do { \
64        uint32_t cr; \
65        uint32_t freq; \
66        /* set MUX for Timer4 to 1/16 */ \
67        cr=rTCFG1 & 0xFFF0FFFF; \
68        rTCFG1=(cr | (3<<16)); \
69        freq = get_PCLK(); \
70        /* set TIMER4 counter, input freq=PLCK/16/16Mhz*/ \
71        freq = (freq /16)/16; \
72        rTCNTB4 = ((freq / 1000) * rtems_configuration_get_microseconds_per_tick()) / 1000; \
73        /*unmask TIMER4 irq*/ \
74        rINTMSK&=~BIT_TIMER4; \
75        /* start TIMER4 with autoreload */ \
76        cr=rTCON & 0xFF8FFFFF; \
77        rTCON=(cr|(0x6<<20)); \
78        rTCON=(cr|(0x5<<20)); \
79    } while (0)
80
81/**
82 * Do whatever you need to shut the clock down and remove the
83 * interrupt handler. Since this normally only gets called on
84 * RTEMS shutdown, you may not need to do anything other than
85 * remove the ISR.
86 */
87#define Clock_driver_support_shutdown_hardware()                        \
88  do {                                                                  \
89        /* Disable timer */ \
90        BSP_remove_rtems_irq_handler(&clock_isr_data);                  \
91     } while (0)
92
93/**
94 * Enables clock interrupt.
95 *
96 * If the interrupt is always on, this can be a NOP.
97 */
98static void clock_isr_on(const rtems_irq_connect_data *unused)
99{
100}
101
102/**
103 * Disables clock interrupts
104 *
105 * If the interrupt is always on, this can be a NOP.
106 */
107static void clock_isr_off(const rtems_irq_connect_data *unused)
108{
109    return;
110}
111
112/**
113 * Tests to see if clock interrupt is enabled, and returns 1 if so.
114 * If interrupt is not enabled, returns 0.
115 *
116 * If the interrupt is always on, this always returns 1.
117 */
118static int clock_isr_is_on(const rtems_irq_connect_data *irq)
119{
120  return 1;
121}
122
123#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
124
125/* Make sure to include this, and only at the end of the file */
126#include "../../../../libbsp/shared/clockdrv_shell.h"
Note: See TracBrowser for help on using the repository browser.