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

4.115
Last change on this file since 7b46d7a was 7b46d7a, checked in by Sebastian Huber <sebastian.huber@…>, on Aug 15, 2011 at 8:12:49 AM

2011-08-15 Julien Delange <julien.delange@…>

  • irq/irq.c: Removed printk() before the interrupt initialization because it somehow destroys the interrupt context.
  • make/custom/nds.cfg: Enable Thumb interwork.
  • startup/bspstart.c: Set default exception handler.
  • 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  irqInit ();
38
39  REG_IME = IME_ENABLE;
40}
41
42/*
43 * install a irq handler.
44 */
45
46int
47BSP_install_rtems_irq_handler (const rtems_irq_connect_data * irq)
48{
49  rtems_interrupt_level level;
50
51  if (!isValidInterrupt (irq->name))
52    return 0;
53
54  rtems_interrupt_disable (level);
55
56  /*
57   * FIXME: irq_hdl will probably not be called with its parameter
58   */
59  irqSet (irq->name, (VoidFunctionPointer)irq->hdl);
60
61  if (irq->on != NULL)
62    irq->on (irq);
63
64  rtems_interrupt_enable (level);
65
66  return 1;
67}
68
69/*
70 * return the handler hooked to the given irq.
71 */
72
73int
74BSP_get_current_rtems_irq_handler (rtems_irq_connect_data * irq)
75{
76  return 0;                     /* FIXME */
77}
78
79/*
80 * remove & disable given irq.
81 */
82
83int
84BSP_remove_rtems_irq_handler (const rtems_irq_connect_data * irq)
85{
86  rtems_interrupt_level level;
87
88  if (!isValidInterrupt (irq->name))
89    return 0;
90
91  rtems_interrupt_disable (level);
92
93  if (irq->off != NULL)
94    irq->off (irq);
95
96  irqClear (irq->name);
97
98  rtems_interrupt_enable (level);
99
100  return 1;
101}
Note: See TracBrowser for help on using the repository browser.