source: rtems/c/src/lib/libbsp/m68k/genmcf548x/clock/clock.c @ 8d292011

4.115
Last change on this file since 8d292011 was 8d292011, checked in by Sebastian Huber <sebastian.huber@…>, on 12/05/13 at 16:26:41

bsp/genmcf548x: Add initial values for INTC_ICRn

According to the manual the application must use unique and
non-overlapping level and priority definitions for enabled interrupts.

  • Property mode set to 100644
File size: 4.6 KB
Line 
1/*===============================================================*\
2| Project: RTEMS generic mcf548x BSP                              |
3+-----------------------------------------------------------------+
4| File: clock.c                                                   |
5+-----------------------------------------------------------------+
6| The file contains the clock driver code of generic MCF548x BSP. |
7+-----------------------------------------------------------------+
8|                    Copyright (c) 2007                           |
9|                    Embedded Brains GmbH                         |
10|                    Obere Lagerstr. 30                           |
11|                    D-82178 Puchheim                             |
12|                    Germany                                      |
13|                    rtems@embedded-brains.de                     |
14+-----------------------------------------------------------------+
15|                                                                 |
16| Parts of the code has been derived from the "dBUG source code"  |
17| package Freescale is providing for M548X EVBs. The usage of     |
18| the modified or unmodified code and it's integration into the   |
19| generic mcf548x BSP has been done according to the Freescale    |
20| license terms.                                                  |
21|                                                                 |
22| The Freescale license terms can be reviewed in the file         |
23|                                                                 |
24|    Freescale_license.txt                                        |
25|                                                                 |
26+-----------------------------------------------------------------+
27|                                                                 |
28| The generic mcf548x BSP has been developed on the basic         |
29| structures and modules of the av5282 BSP.                       |
30|                                                                 |
31+-----------------------------------------------------------------+
32|                                                                 |
33| The license and distribution terms for this file may be         |
34| found in the file LICENSE in this distribution or at            |
35|                                                                 |
36| http://www.rtems.com/license/LICENSE.                           |
37|                                                                 |
38+-----------------------------------------------------------------+
39|                                                                 |
40|   date                      history                        ID   |
41| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
42| 12.11.07                    1.0                            ras  |
43|                                                                 |
44\*===============================================================*/
45
46/*
47 * Use first slice timer (SLT0) as the system clock.
48 *
49 */
50
51#include <rtems.h>
52#include <bsp.h>
53#include <mcf548x/mcf548x.h>
54
55/*
56 * Use SLT 0
57 */
58#define CLOCK_VECTOR (64+54)
59
60/*
61 * Periodic interval timer interrupt handler
62 */
63#define Clock_driver_support_at_tick()             \
64    do {                                           \
65        MCF548X_SLT_SSR0 = MCF548X_SLT_SSR_ST;     \
66    } while (0)                                    \
67
68/*
69 * Attach clock interrupt handler
70 */
71#define Clock_driver_support_install_isr( _new, _old )                   \
72    do {                                                                 \
73        _old = (rtems_isr_entry)set_vector(_new, CLOCK_VECTOR, 1);       \
74    } while(0)
75
76/*
77 * Turn off the clock
78 */
79#define Clock_driver_support_shutdown_hardware()                         \
80    do {                                                                 \
81        MCF548X_SLT_SCR0 &= ~(MCF548X_SLT_SCR_TEN | MCF548X_SLT_SCR_RUN | MCF548X_SLT_SCR_IEN); \
82    } while(0)
83
84/*
85 * Set up the clock hardware
86 *
87 * We need to have 1 interrupt every 10,000 microseconds
88 * XLB clock 100 MHz / MCF548X_SLT_SLTCNT0 = XLB clock/100
89 */
90#define Clock_driver_support_initialize_hardware()                      \
91  do {                                                                  \
92    int level;                                                          \
93    rtems_interrupt_disable( level );                                   \
94    MCF548X_INTC_IMRH &= ~(MCF548X_INTC_IMRH_INT_MASK54);               \
95    rtems_interrupt_enable( level );                                    \
96    MCF548X_SLT_SLTCNT0 = get_CPU_clock_speed()                         \
97      / 1000                                                            \
98      * rtems_configuration_get_microseconds_per_tick()                 \
99      / 1000;                                                           \
100    MCF548X_SLT_SCR0 |= (MCF548X_SLT_SCR_TEN | MCF548X_SLT_SCR_RUN | MCF548X_SLT_SCR_IEN); \
101  } while (0)
102
103#include "../../../shared/clockdrv_shell.h"
104
Note: See TracBrowser for help on using the repository browser.