source: rtems/c/src/lib/libbsp/m68k/sim68000/clock/clockdrv.c @ 75acd9e

4.115
Last change on this file since 75acd9e was 75acd9e, checked in by Alexander Krutwig <alexander.krutwig@…>, on Apr 1, 2015 at 1:33:25 PM

bsps: Convert clock drivers to use a timecounter

Update #2271.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  Instantiate the clock driver shell.
3 */
4
5#include <bsp.h>
6
7#define CLOCK_VECTOR 84
8
9#define Clock_driver_support_install_isr( _new, _old )  \
10  do { _old = (rtems_isr_entry) set_vector( _new, CLOCK_VECTOR, 1 ); } while(0)
11
12typedef struct {
13  volatile uint8_t    cr;       /*  0 -  0 : Timer Control Register */
14  volatile uint8_t    pad0;     /*  1 -  1 : pad */
15  volatile uint8_t    ivr;      /*  2 -  2 : Timer Interrupt Vector Register */
16  volatile uint8_t    pad1;     /*  3 -  3 : pad */
17  volatile uint32_t   cpr;      /*  4 -  7 : Timer Counter Preload Register */
18  volatile uint8_t    pad2[12]; /*  8 - 19 : pad */
19  volatile uint32_t   sr;       /* 20 - 23 : Timer Status Register */
20} timer_hw_t;
21
22#define TIMER_BASE (timer_hw_t *)0x72001
23
24/* 8 microseconds per click, 125,000 per second */
25
26/* XXX should check that microseconds_per_tick is >= 8 */
27static void Clock_driver_support_initialize_hardware(void)
28{
29  timer_hw_t *t = TIMER_BASE;
30
31  t->ivr = CLOCK_VECTOR;
32  t->cpr = rtems_configuration_get_microseconds_per_tick() / 8;
33  t->cr  = 0xA0;  /* initialize with timer disabled */
34  t->cr  = 0xA1;  /* enable timer */
35}
36
37static void Clock_driver_support_at_tick(void)
38{
39  timer_hw_t *t = TIMER_BASE;
40
41  t->sr  = 0xA0;  /* Negate timer interrupt request */
42}
43
44static void Clock_driver_support_shutdown_hardware(void)
45{
46  timer_hw_t *t = TIMER_BASE;
47
48  t->cr  = 0xA0;  /* initialize with timer disabled */
49}
50
51#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
52
53#include "../../../shared/clockdrv_shell.h"
Note: See TracBrowser for help on using the repository browser.