source: rtems/c/src/lib/libbsp/arm/nds/irq/irq.c @ c193baad

4.104.115
Last change on this file since c193baad was c193baad, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on Apr 9, 2010 at 8:24:57 PM

unify irq data types and code, merge s3c2400/s3c2410 support

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 * RTEMS for Nintendo DS interrupt manager.
3 *
4 * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com>
5 *
6 * The license and distribution terms for this file may be
7 * found in the file LICENSE in this distribution or at
8 *
9 * http://www.rtems.com/license/LICENSE
10 *
11 * $Id$
12 */
13
14#include <bsp.h>
15#include <rtems/irq.h>
16#include <nds.h>
17
18/*
19 * this function check that the value given for the irq line is valid.
20 */
21
22static int
23isValidInterrupt (int irq)
24{
25  if (irq < 0 || irq >= MAX_INTERRUPTS)
26    return 0;
27  return 1;
28}
29
30/*
31 * initialize the irq management.
32 */
33
34void
35BSP_rtems_irq_mngt_init (void)
36{
37  printk ("[+] irq manager started\n");
38
39  irqInit ();
40
41  REG_IME = IME_ENABLE;
42}
43
44/*
45 * install a irq handler.
46 */
47
48int
49BSP_install_rtems_irq_handler (const rtems_irq_connect_data * irq)
50{
51  rtems_interrupt_level level;
52
53  if (!isValidInterrupt (irq->name))
54    return 0;
55
56  rtems_interrupt_disable (level);
57
58  /*
59   * FIXME: irq_hdl will probably not be called with its parameter
60   */
61  irqSet (irq->name, (VoidFunctionPointer)irq->hdl);
62
63  if (irq->on != NULL)
64    irq->on (irq);
65
66  rtems_interrupt_enable (level);
67
68  return 1;
69}
70
71/*
72 * return the handler hooked to the given irq.
73 */
74
75int
76BSP_get_current_rtems_irq_handler (rtems_irq_connect_data * irq)
77{
78  return 0;                     /* FIXME */
79}
80
81/*
82 * remove & disable given irq.
83 */
84
85int
86BSP_remove_rtems_irq_handler (const rtems_irq_connect_data * irq)
87{
88  rtems_interrupt_level level;
89
90  if (!isValidInterrupt (irq->name))
91    return 0;
92
93  rtems_interrupt_disable (level);
94
95  if (irq->off != NULL)
96    irq->off (irq);
97
98  irqClear (irq->name);
99
100  rtems_interrupt_enable (level);
101
102  return 1;
103}
Note: See TracBrowser for help on using the repository browser.