source: rtems/bsps/arm/smdk2410/clock/clockdrv.c @ 7ee59313

5
Last change on this file since 7ee59313 was 7ee59313, checked in by Sebastian Huber <sebastian.huber@…>, on 06/01/18 at 05:11:12

Remove Clock_driver_support_shutdown_hardware()

The aim of this clock driver hook was to stop clock tick interrupts at
some late point in the exit() procedure.

The use of atexit() pulls in malloc() which pulls in errno. It is
incompatible with the intention of the
CONFIGURE_DISABLE_NEWLIB_REENTRANCY configuration option.

The exit() function must be called from thread context, so accompanied
clock tick interrupts should cause no harm. On the contrary, someone
may assume a normal operating system operation, e.g. working timeouts.

Remove the Clock_driver_support_shutdown_hardware() clock driver hook.

Close #3436.

  • Property mode set to 100644
File size: 2.8 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 ) \
45  BSP_install_rtems_irq_handler(&clock_isr_data)
46
47
48/**
49 * Initialize the hardware for the clock
50 *   - Set the frequency
51 *   - enable it
52 *   - clear any pending interrupts
53 *
54 * Since you may want the clock always running, you can
55 * enable interrupts here. If you do so, the clock_isr_on(),
56 * clock_isr_off(), and clock_isr_is_on() functions can be
57 * NOPs.
58 */
59#define Clock_driver_support_initialize_hardware() \
60  do { \
61        uint32_t cr; \
62        uint32_t freq; \
63        /* set MUX for Timer4 to 1/16 */ \
64        cr=rTCFG1 & 0xFFF0FFFF; \
65        rTCFG1=(cr | (3<<16)); \
66        freq = get_PCLK(); \
67        /* set TIMER4 counter, input freq=PLCK/16/16Mhz*/ \
68        freq = (freq /16)/16; \
69        rTCNTB4 = ((freq / 1000) * rtems_configuration_get_microseconds_per_tick()) / 1000; \
70        /*unmask TIMER4 irq*/ \
71        rINTMSK&=~BIT_TIMER4; \
72        /* start TIMER4 with autoreload */ \
73        cr=rTCON & 0xFF8FFFFF; \
74        rTCON=(cr|(0x6<<20)); \
75        rTCON=(cr|(0x5<<20)); \
76    } while (0)
77
78/**
79 * Enables clock interrupt.
80 *
81 * If the interrupt is always on, this can be a NOP.
82 */
83static void clock_isr_on(const rtems_irq_connect_data *unused)
84{
85}
86
87/**
88 * Disables clock interrupts
89 *
90 * If the interrupt is always on, this can be a NOP.
91 */
92static void clock_isr_off(const rtems_irq_connect_data *unused)
93{
94    return;
95}
96
97/**
98 * Tests to see if clock interrupt is enabled, and returns 1 if so.
99 * If interrupt is not enabled, returns 0.
100 *
101 * If the interrupt is always on, this always returns 1.
102 */
103static int clock_isr_is_on(const rtems_irq_connect_data *irq)
104{
105  return 1;
106}
107
108#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
109
110/* Make sure to include this, and only at the end of the file */
111#include "../../../shared/dev/clock/clockimpl.h"
Note: See TracBrowser for help on using the repository browser.