source: rtems/c/src/lib/libcpu/arm/s3c2400/irq/irq.c @ 479ac2d8

4.104.114.84.95
Last change on this file since 479ac2d8 was 479ac2d8, checked in by Jay Monkman <jtm@…>, on Mar 11, 2005 at 7:26:45 AM

2005-03-11 Philippe Simons <loki_666@…>

  • Makefile.am, configure.ac: Added gp32 BSP.
  • s3c2400/.cvsignore, s3c2400/Makefile.am, s3c2400/clock/clockdrv.c, s3c2400/include/s3c2400.h, s3c2400/irq/bsp_irq_asm.S, s3c2400/irq/bsp_irq_init.c, s3c2400/irq/irq.c, s3c2400/irq/irq.h, s3c2400/timer/timer.c: New files.
  • Property mode set to 100644
File size: 2.1 KB
Line 
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     */
52    HdlTable = VECTOR_TABLE;
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     */
89    HdlTable = VECTOR_TABLE;
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.