source: rtems/c/src/lib/libbsp/arm/arm_bare_bsp/irq/irq.c @ f1c62bb

4.104.114.84.95
Last change on this file since f1c62bb was 2d354ea6, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 27, 2000 at 6:17:44 AM

Minor problems addressed with the merger and with the arm_bare_bsp.
That BSP now has a stub clock driver so the tests can link even
if they won't execute. A handful of Makefiles had to be updated
and we had to account for printk.c being a shared file now.

  • Property mode set to 100644
File size: 2.6 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.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
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
28static 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
39int 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
73int 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
108void _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}
Note: See TracBrowser for help on using the repository browser.