source: rtems/c/src/lib/libbsp/sparc/leon2/startup/setvec.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 * @file
3 * @ingroup sparc_leon2
4 * @brief Installs an interrupt vector on the SPARC simulator
5 */
6
7/*  set_vector
8 *
9 *  This routine installs an interrupt vector on the SPARC simulator.
10 *
11 *  INPUT PARAMETERS:
12 *    handler - interrupt handler entry point
13 *    vector  - vector number
14 *    type    - 0 indicates raw hardware connect
15 *              1 indicates RTEMS interrupt connect
16 *
17 *  OUTPUT PARAMETERS:  NONE
18 *
19 *  RETURNS:
20 *    address of previous interrupt handler
21 *
22 *  COPYRIGHT (c) 1989-1998.
23 *  On-Line Applications Research Corporation (OAR).
24 *
25 *  The license and distribution terms for this file may be
26 *  found in the file LICENSE in this distribution or at
27 *  http://www.rtems.org/license/LICENSE.
28 *
29 *  Ported to LEON implementation of the SPARC by On-Line Applications
30 *  Research Corporation (OAR) under contract to the European Space
31 *  Agency (ESA).
32 *
33 *  LEON modifications of respective RTEMS file: COPYRIGHT (c) 1995.
34 *  European Space Agency.
35 */
36
37#include <bsp.h>
38
39rtems_isr_entry set_vector(                   /* returns old vector */
40  rtems_isr_entry     handler,                /* isr routine        */
41  rtems_vector_number vector,                 /* vector number      */
42  int                 type                    /* RTEMS or RAW intr  */
43)
44{
45  rtems_isr_entry previous_isr;
46  uint32_t      real_trap;
47  uint32_t      source;
48
49  if ( type )
50    rtems_interrupt_catch( handler, vector, &previous_isr );
51  else
52    _CPU_ISR_install_raw_handler( vector, handler, (void *)&previous_isr );
53
54  real_trap = SPARC_REAL_TRAP_NUMBER( vector );
55
56  if ( LEON_INT_TRAP( real_trap ) ) {
57
58    source = LEON_TRAP_SOURCE( real_trap );
59
60    LEON_Clear_interrupt( source );
61    LEON_Unmask_interrupt( source );
62  }
63
64  return previous_isr;
65}
Note: See TracBrowser for help on using the repository browser.