source: rtems/bsps/m68k/av5282/clock/clock.c

Last change on this file was 7ee59313, checked in by Sebastian Huber <sebastian.huber@…>, on Jun 1, 2018 at 5:11:12 AM

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.9 KB
Line 
1/*
2 * Use the last periodic interval timer (PIT3) as the system clock.
3 */
4
5#include <rtems.h>
6#include <bsp.h>
7#include <mcf5282/mcf5282.h>
8
9/*
10 * Use INTC0 base
11 */
12#define CLOCK_VECTOR (64+58)
13
14/*
15 * Periodic interval timer interrupt handler
16 */
17#define Clock_driver_support_at_tick()             \
18    do {                                           \
19        MCF5282_PIT3_PCSR |= MCF5282_PIT_PCSR_PIF; \
20    } while (0)                                    \
21
22/*
23 * Attach clock interrupt handler
24 */
25#define Clock_driver_support_install_isr( _new ) \
26    set_vector(_new, CLOCK_VECTOR, 1)
27
28/*
29 * Set up the clock hardware
30 *
31 * We need to have 1 interrupt every 10,000 microseconds
32 * so we need to set prescaler to 64 and the PMR register to 0x23FE
33 */
34#define Clock_driver_support_initialize_hardware()                       \
35    do {                                                                 \
36        int level;                                                       \
37        int preScaleCode = 5;                                             \
38        MCF5282_INTC0_ICR58 = MCF5282_INTC_ICR_IL(PIT3_IRQ_LEVEL) |      \
39                              MCF5282_INTC_ICR_IP(PIT3_IRQ_PRIORITY);    \
40        rtems_interrupt_disable( level );                                \
41        MCF5282_INTC0_IMRH &= ~MCF5282_INTC_IMRH_INT58;                  \
42                MCF5282_PIT3_PCSR &= ~MCF5282_PIT_PCSR_EN;                       \
43        rtems_interrupt_enable( level );                                 \
44                MCF5282_PIT3_PMR = 0x23FE;  \
45                MCF5282_PIT3_PCSR = MCF5282_PIT_PCSR_PRE(preScaleCode) |         \
46                            MCF5282_PIT_PCSR_PIE |                       \
47                            MCF5282_PIT_PCSR_RLD |                       \
48                            MCF5282_PIT_PCSR_EN;                         \
49    } while (0)
50
51#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
52
53#include "../../../shared/dev/clock/clockimpl.h"
Note: See TracBrowser for help on using the repository browser.