OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [c/] [src/] [lib/] [libbsp/] [arm/] [arm_bare_bsp/] [irq/] [irq.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/* 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.OARcorp.com/rtems/license.html.
11
 *
12
 *  irq.c,v 1.2 2000/07/27 06:17:44 joel Exp
13
 */
14
 
15
 
16
#include <bsp.h>
17
#include <irq.h>
18
#include <registers.h>
19
#include <rtems/score/thread.h>
20
#include <rtems/score/apiext.h>
21
 
22
 
23
/*
24
 * This function check that the value given for the irq line
25
 * is valid.
26
 */
27
 
28
static int isValidInterrupt(int irq)
29
{
30
  if ( (irq < 0) || (irq > BSP_MAX_INT))
31
    return 0;
32
  return 1;
33
}
34
 
35
/*
36
 * ------------------------ RTEMS Single Irq Handler Mngt Routines ----------------
37
 */
38
 
39
int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
40
{
41
    rtems_irq_hdl *HdlTable;
42
    rtems_interrupt_level level;
43
 
44
    if (!isValidInterrupt(irq->name)) {
45
      return 0;
46
    }
47
    /*
48
     * Check if default handler is actually connected. If not issue an error.
49
     */
50
    HdlTable = VECTOR_TABLE;
51
    if (*(HdlTable + irq->name) != default_int_handler) {
52
      return 0;
53
    }
54
 
55
    _CPU_ISR_Disable(level);
56
 
57
    /*
58
     * store the new handler
59
     */
60
    *(HdlTable + irq->name) = irq->hdl;
61
 
62
    /*
63
     * Here is the code to install an interrupt vector
64
     * for the BSP : unmask INT, ....
65
     * ........................
66
     */
67
 
68
    _CPU_ISR_Enable(level);
69
 
70
    return 1;
71
}
72
 
73
int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
74
{
75
    rtems_irq_hdl *HdlTable;
76
    rtems_interrupt_level level;
77
 
78
    if (!isValidInterrupt(irq->name)) {
79
      return 0;
80
    }
81
    /*
82
     * Check if the handler is actually connected. If not issue an error.
83
     */
84
    HdlTable = VECTOR_TABLE;
85
    if (*(HdlTable + irq->name) != irq->hdl) {
86
      return 0;
87
    }
88
    _CPU_ISR_Disable(level);
89
 
90
    /*
91
     * Here is the code to uninstall an interrupt vector
92
     * for the BSP : mask INT, ....
93
     * ........................
94
     */
95
 
96
    /*
97
     * restore the default irq value
98
     */
99
    *(HdlTable + irq->name) = default_int_handler;
100
 
101
    _CPU_ISR_Enable(level);
102
 
103
    return 1;
104
}
105
 
106
 
107
 
108
void _ThreadProcessSignalsFromIrq (CPU_Exception_frame* ctx)
109
{
110
  /*
111
   * Process pending signals that have not already been
112
   * processed by _Thread_Displatch. This happens quite
113
   * unfrequently : the ISR must have posted an action
114
   * to the current running thread.
115
   */
116
  if ( _Thread_Do_post_task_switch_extension ||
117
       _Thread_Executing->do_post_task_switch_extension ) {
118
    _Thread_Executing->do_post_task_switch_extension = FALSE;
119
    _API_extensions_Run_postswitch();
120
  }
121
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.