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

Last change on this file was 1eed6f8, checked in by Sebastian Huber <sebastian.huber@…>, on 03/23/23 at 15:53:30

bsps: Avoid unused argument in clock interrupt

Pass the parameter of the clock interrupt handler to
Clock_driver_support_at_tick() and Clock_driver_timecounter_tick(). This makes
it possible to use the interrupt handler argument in clock drivers.

Use the interrupt handler provided by Clock_driver_support_install_isr() to
avoid local delarations of Clock_isr().

Update #4862.

  • 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(arg)          \
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.