source: rtems/c/src/lib/libbsp/m68k/mcf5235/clock/clock.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 2.2 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 <mcf5235/mcf5235.h>
8
9/*
10 * Use INTC0 base
11 */
12#define CLOCK_VECTOR (64+39)
13
14/*
15 * Periodic interval timer interrupt handler
16 */
17#define Clock_driver_support_at_tick()             \
18    do {                                           \
19        MCF5235_PIT_PCSR3 |= MCF5235_PIT_PCSR_PIF; \
20    } while (0)                                    \
21
22/*
23 * Attach clock interrupt handler
24 */
25#define Clock_driver_support_install_isr( _new, _old )             \
26    do {                                                           \
27        _old = (rtems_isr_entry)set_vector(_new, CLOCK_VECTOR, 1);  \
28    } while(0)
29
30/*
31 * Turn off the clock
32 */
33#define Clock_driver_support_shutdown_hardware()   \
34    do {                                           \
35        MCF5235_PIT_PCSR3 &= ~MCF5235_PIT_PCSR_EN; \
36    } while(0)
37
38/*
39 * Set up the clock hardware
40 *
41 * We need to have 1 interrupt every 10,000 microseconds
42 * so we need to set prescaler to 64 and the PMR register to 0x2DC6
43 */
44#define Clock_driver_support_initialize_hardware()                       \
45    do {                                                                 \
46        int level;                                                       \
47        int preScaleCode = 6;                                            \
48        MCF5235_INTC0_ICR39 = MCF5235_INTC_ICR_IL(PIT3_IRQ_LEVEL) |      \
49                              MCF5235_INTC_ICR_IP(PIT3_IRQ_PRIORITY);    \
50        rtems_interrupt_disable( level );                                \
51        MCF5235_INTC0_IMRH &= ~MCF5235_INTC0_IMRH_INT39;                  \
52        MCF5235_PIT_PCSR3 &= ~MCF5235_PIT_PCSR_EN;               \
53        rtems_interrupt_enable( level );                                 \
54                MCF5235_PIT_PMR3 = 0x2DC6;                               \
55                MCF5235_PIT_PCSR3 = MCF5235_PIT_PCSR_PRE(preScaleCode) | \
56                            MCF5235_PIT_PCSR_PIE |                       \
57                            MCF5235_PIT_PCSR_RLD |                       \
58                            MCF5235_PIT_PCSR_EN;                         \
59    } while (0)
60
61#include "../../../shared/clockdrv_shell.h"
Note: See TracBrowser for help on using the repository browser.