source: rtems/c/src/lib/libbsp/arm/gba/irq/irq.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.4 KB
Line 
1/**
2 *  @file irq.c
3 *
4 *  This file contains the implementation of the function described in irq.h.
5 */
6/*
7 *  RTEMS GBA BSP
8 *
9 *  Copyright (c) 2010 embedded brains GmbH.
10 *
11 *  Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
12 *
13 *  Copyright (c) 2002 by Charlie Steader <charlies@poliac.com>
14 *
15 *  Copyright (c) 2004 by Markku Puro <markku.puro@kopteri.net>
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.org/license/LICENSE.
20 */
21
22#include <bsp.h>
23#include <bsp/irq.h>
24#include <bsp/irq-generic.h>
25
26#include <gba_registers.h>
27
28void bsp_interrupt_dispatch(void)
29{
30  unsigned reg_ie = GBA_REG_IE;
31  unsigned reg_if = GBA_REG_IF & reg_ie;
32  rtems_vector_number vector = 31 - __builtin_clz(reg_if);
33
34  bsp_interrupt_handler_dispatch(vector);
35
36  GBA_REG_IF = 1 << vector;
37}
38
39rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
40{
41  GBA_REG_IE |= 1 << vector;
42
43  return RTEMS_SUCCESSFUL;
44}
45
46rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
47{
48  GBA_REG_IE &= ~(1 << vector);
49
50  return RTEMS_SUCCESSFUL;
51}
52
53rtems_status_code bsp_interrupt_facility_initialize(void)
54{
55  /* clear all interrupt status flags */
56  GBA_REG_IF = 0xffff;
57  /* disable all interrupts */
58  GBA_REG_IE = 0;
59  /* set master interrupt enable */
60  GBA_REG_IME = 1;
61
62  /* Exception handler is already present in the ROM BIOS */
63
64  return RTEMS_SUCCESSFUL;
65}
Note: See TracBrowser for help on using the repository browser.