source: rtems/c/src/lib/libbsp/m68k/mcf5235/clock/clock.c @ 1612af0

4.104.114.84.95
Last change on this file since 1612af0 was 1612af0, checked in by Joel Sherrill <joel.sherrill@…>, on 06/17/05 at 14:06:05

2005-06-17 Mike Bertosh <mbertosh@…>

  • .cvsignore, ChangeLog?, Makefile.am, README, bsp_specs, configure.ac, clock/clock.c, console/console.c, include/bsp.h, include/coverhd.h, include/tm27.h, network/network.c, start/start.S, startup/bspclean.c, startup/bspstart.c, startup/init5235.c, startup/linkcmds, startup/linkcmdsflash, startup/linkcmdsram, timer/timer.c: New files.
  • Property mode set to 100644
File size: 2.2 KB
RevLine 
[1612af0]1/*
2 * Use the last periodic interval timer (PIT3) as the system clock.
3 *
4 *  $Id$
5 */
6
7#include <rtems.h>
8#include <bsp.h>
9#include <mcf5235/mcf5235.h>
10
11/*
12 * Use INTC0 base
13 */
14#define CLOCK_VECTOR (64+39)
15
16/*
17 * Periodic interval timer interrupt handler
18 */
19#define Clock_driver_support_at_tick()             \
20    do {                                           \
21        MCF5235_PIT_PCSR3 |= MCF5235_PIT_PCSR_PIF; \
22    } while (0)                                    \
23
24/*
25 * Attach clock interrupt handler
26 */
27#define Clock_driver_support_install_isr( _new, _old )             \
28    do {                                                           \
29        _old = (rtems_isr_entry)set_vector(_new, CLOCK_VECTOR, 1);  \
30    } while(0)
31
32/*
33 * Turn off the clock
34 */
35#define Clock_driver_support_shutdown_hardware()   \
36    do {                                           \
37        MCF5235_PIT_PCSR3 &= ~MCF5235_PIT_PCSR_EN; \
38    } while(0)
39
40/*
41 * Set up the clock hardware
42 *
43 * We need to have 1 interrupt every 10,000 microseconds
44 * so we need to set prescaler to 64 and the PMR register to 0x2DC6
45 */
46#define Clock_driver_support_initialize_hardware()                       \
47    do {                                                                 \
48        int level;                                                       \
49        int preScaleCode = 6;                                            \
50        MCF5235_INTC0_ICR39 = MCF5235_INTC_ICR_IL(PIT3_IRQ_LEVEL) |      \
51                              MCF5235_INTC_ICR_IP(PIT3_IRQ_PRIORITY);    \
52        rtems_interrupt_disable( level );                                \
53        MCF5235_INTC0_IMRH &= ~MCF5235_INTC0_IMRH_INT39;                  \
54        MCF5235_PIT_PCSR3 &= ~MCF5235_PIT_PCSR_EN;               \
55        rtems_interrupt_enable( level );                                 \
56                MCF5235_PIT_PMR3 = 0x2DC6;                               \
57                MCF5235_PIT_PCSR3 = MCF5235_PIT_PCSR_PRE(preScaleCode) | \
58                            MCF5235_PIT_PCSR_PIE |                       \
59                            MCF5235_PIT_PCSR_RLD |                       \
60                            MCF5235_PIT_PCSR_EN;                         \
61    } while (0)
62
63#include "../../../shared/clockdrv_shell.c"
Note: See TracBrowser for help on using the repository browser.