summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/tqm8xx/clock/p_clock.c
blob: c3154fd9677c6f953654f4a79f5054f120aba8fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 *  Clock Tick interrupt conexion code.
 *
 *  COPYRIGHT (c) 1989-1997.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may in
 *  the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 *
 *  Modified to support the MPC750.
 *  Modifications Copyright (c) 1999 Eric Valette valette@crf.canon.fr
 */

#include <bsp.h>
#include <bsp/irq-generic.h>
#include <rtems/bspIo.h>
extern void clockOn(void*);
extern void clockOff (void*);
extern int clockIsOn(void*);
extern void Clock_isr(void*);

void BSP_clock_hdl(void * arg)
{
  Clock_isr(arg);
}

int BSP_get_clock_irq_level(void)
{
  /*
   * Caution : if you change this, you must change the
   * definition of BSP_PERIODIC_TIMER accordingly
   */
  return 6;
}

int BSP_disconnect_clock_handler (void)
{
  rtems_status_code sc;

  clockOff(NULL);
  /*
   * remove interrupt handler
   */
  sc = rtems_interrupt_handler_remove(BSP_PERIODIC_TIMER,
				      BSP_clock_hdl,NULL);

  return sc == RTEMS_SUCCESSFUL;
}

int BSP_connect_clock_handler (rtems_irq_hdl hdl)
{
  rtems_status_code sc;
  /*
   * install interrupt handler
   */
  sc = rtems_interrupt_handler_install(BSP_PERIODIC_TIMER,
				       "PIT clock",0,
				       BSP_clock_hdl,NULL);
  if (sc == RTEMS_SUCCESSFUL) {
    clockOn(NULL);
  }
  return sc == RTEMS_SUCCESSFUL;
}