source: rtems/c/src/lib/libcpu/arm/s3c2400/irq/irq.c @ 754ca4b1

4.104.114.84.95
Last change on this file since 754ca4b1 was d409705, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/05 at 22:24:46

2005-05-03 Joel Sherrill <joel@…>

  • mc9328mxl/irq/irq.c, s3c2400/irq/irq.c: Remove warnings.
  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[479ac2d8]1/* irq.c
2 *
3 *  This file contains the implementation of the function described in irq.h
4 *
5 *  CopyRight (C) 2000 Canon Research France SA.
6 *  Emmanuel Raguet,  mailto:raguet@crf.canon.fr
7 *
8 *  The license and distribution terms for this file may be
9 *  found in found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15
16#include <bsp.h>
17#include <irq.h>
18#include <rtems/score/thread.h>
19#include <rtems/score/apiext.h>
20#include <s3c2400.h>
21
22/*
23 * This function check that the value given for the irq line
24 * is valid.
25 */
26
27static int isValidInterrupt(int irq)
28{
29    if ( (irq < 0) || (irq > BSP_MAX_INT)) {
30        return 0;
31    }
32
33    return 1;
34}
35
36/*
37 * ------------------- RTEMS Single Irq Handler Mngt Routines ----------------
38 */
39
40int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
41{
42    rtems_irq_hdl *HdlTable;
43    rtems_interrupt_level level;
44   
45    if (!isValidInterrupt(irq->name)) {
46        return 0;
47    }
48
49    /*
50     * Check if default handler is actually connected. If not issue an error.
51     */
[d409705]52    HdlTable = (rtems_irq_hdl *)VECTOR_TABLE;
[479ac2d8]53    if (*(HdlTable + irq->name) != default_int_handler) {
54        return 0;
55    }
56   
57    _CPU_ISR_Disable(level);
58
59    /*
60     * store the new handler
61     */
62    *(HdlTable + irq->name) = irq->hdl;
63
64    /*
65     * Enable interrupt on device
66     */
67    if(irq->on)
68    {
69        irq->on(irq);
70    }
71
72    _CPU_ISR_Enable(level);
73
74    return 1;
75}
76
77int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
78{
79    rtems_irq_hdl *HdlTable;
80    rtems_interrupt_level level;
81 
82    if (!isValidInterrupt(irq->name)) {
83        return 0;
84    }
85
86    /*
87     * Check if the handler is actually connected. If not issue an error.
88     */
[d409705]89    HdlTable = (rtems_irq_hdl *)VECTOR_TABLE;
[479ac2d8]90    if (*(HdlTable + irq->name) != irq->hdl) {
91        return 0;
92    }
93    _CPU_ISR_Disable(level);
94
95    /*
96     * Disable interrupt on device
97     */
98    if(irq->off) {
99        irq->off(irq);
100    }
101
102    /*
103     * restore the default irq value
104     */
105    *(HdlTable + irq->name) = default_int_handler;
106         
107    _CPU_ISR_Enable(level);
108
109    return 1;
110}
Note: See TracBrowser for help on using the repository browser.