source: rtems/bsps/m68k/genmcf548x/clock/clock.c @ 9a9442e8

Last change on this file since 9a9442e8 was 9a9442e8, checked in by Joel Sherrill <joel@…>, on 03/01/22 at 21:24:27

m68k/genmcf548x/: Manual file header clean up

Updates #4625.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 * RTEMS generic mcf548x BSP
3 *
4 * The file contains the clock driver code of generic MCF548x BSP. |
5 *
6 * Parts of the code has been derived from the "dBUG source code"
7 * package Freescale is providing for M548X EVBs. The usage of
8 * the modified or unmodified code and it's integration into the
9 * generic mcf548x BSP has been done according to the Freescale
10 * license terms.
11 *
12 * The Freescale license terms can be reviewed in the file
13 *
14 *    Freescale_license.txt
15 *
16 * The generic mcf548x BSP has been developed on the basic
17 * structures and modules of the av5282 BSP.
18 */
19
20/*
21 * Copyright (c) 2008 embedded brains GmbH. All rights reserved.
22 *
23 * The license and distribution terms for this file may be
24 * found in the file LICENSE in this distribution or at
25 * http://www.rtems.org/license/LICENSE.
26 */
27
28/*
29 * Use first slice timer (SLT0) as the system clock.
30 *
31 */
32
33#include <rtems.h>
34#include <bsp.h>
35#include <bsp/irq-generic.h>
36#include <mcf548x/mcf548x.h>
37
38/*
39 * Use SLT 0
40 */
41#define CLOCK_IRQ MCF548X_IRQ_SLT0
42
43/*
44 * Periodic interval timer interrupt handler
45 */
46#define Clock_driver_support_at_tick()             \
47    do {                                           \
48        MCF548X_SLT_SSR0 = MCF548X_SLT_SSR_ST;     \
49    } while (0)                                    \
50
51/*
52 * Attach clock interrupt handler
53 */
54#define Clock_driver_support_install_isr( _new ) \
55    set_vector(_new, CLOCK_IRQ + 64, 1)
56
57/*
58 * Set up the clock hardware
59 *
60 * We need to have 1 interrupt every 10,000 microseconds
61 * XLB clock 100 MHz / MCF548X_SLT_SLTCNT0 = XLB clock/100
62 */
63#define Clock_driver_support_initialize_hardware()                      \
64  do {                                                                  \
65    bsp_interrupt_vector_enable(CLOCK_IRQ);                             \
66    MCF548X_SLT_SLTCNT0 = get_CPU_clock_speed()                         \
67      / 1000                                                            \
68      * rtems_configuration_get_microseconds_per_tick()                 \
69      / 1000;                                                           \
70    MCF548X_SLT_SCR0 |= (MCF548X_SLT_SCR_TEN | MCF548X_SLT_SCR_RUN | MCF548X_SLT_SCR_IEN); \
71  } while (0)
72
73#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
74
75#include "../../../shared/dev/clock/clockimpl.h"
76
Note: See TracBrowser for help on using the repository browser.