source: rtems/bsps/lm32/shared/clock/ckinit.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: 1.7 KB
Line 
1/*
2 *  Clock device driver for Lattice Mico32 (lm32).
3 */
4
5/*
6 *  COPYRIGHT (c) 1989-2009.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.org/license/LICENSE.
12 *
13 *  Jukka Pietarinen <jukka.pietarinen@mrf.fi>, 2008,
14 *  Micro-Research Finland Oy
15 */
16
17#include <bsp.h>
18#include "../include/system_conf.h"
19#include "clock.h"
20#include "bspopts.h"
21
22#if LM32_ON_SIMULATOR
23#define CLOCK_DRIVER_USE_FAST_IDLE 1
24#endif
25
26static inline int clockread(unsigned int reg)
27{
28  return *((int*)(TIMER0_BASE_ADDRESS + reg));
29}
30
31static inline void clockwrite(unsigned int reg, int value)
32{
33  *((int*)(TIMER0_BASE_ADDRESS + reg)) = value;
34}
35
36/*
37 *  The interrupt vector number associated with the clock tick device
38 *  driver.
39 */
40#define CLOCK_VECTOR    ( TIMER0_IRQ )
41#define CLOCK_IRQMASK   ( 1 << CLOCK_VECTOR )
42
43#define Clock_driver_support_at_tick() \
44  do { \
45    /* Clear overflow flag */ \
46    clockwrite(LM32_CLOCK_SR, 0); \
47    lm32_interrupt_ack(CLOCK_IRQMASK); \
48  } while (0)
49
50#define Clock_driver_support_install_isr(_new ) \
51  set_vector( _new, CLOCK_VECTOR, 1 )
52
53static void Clock_driver_support_initialize_hardware(void)
54{
55  /* Set clock period */
56  clockwrite(LM32_CLOCK_PERIOD,
57             (CPU_FREQUENCY /
58              (1000000 / rtems_configuration_get_microseconds_per_tick())));
59
60  /* Enable clock interrupts and start in continuous mode */
61  clockwrite(LM32_CLOCK_CR, LM32_CLOCK_CR_ITO |
62             LM32_CLOCK_CR_CONT |
63             LM32_CLOCK_CR_START);
64
65  lm32_interrupt_unmask(CLOCK_IRQMASK);
66}
67
68#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
69
70#include "../../../shared/dev/clock/clockimpl.h"
71
Note: See TracBrowser for help on using the repository browser.