Changeset f4dc319a in rtems for c/src/lib/libcpu/arm


Ignore:
Timestamp:
Apr 30, 2010, 1:15:49 PM (10 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.10, 4.11, master
Children:
439d00ca
Parents:
2a2469b
Message:

2010-04-30 Sebastian Huber <sebastian.huber@…>

  • at91rm9200/irq/irq.c, at91rm9200/irq/irq.h, lpc22xx/irq/irq.c, lpc22xx/irq/irq.h, mc9328mxl/irq/irq.c, mc9328mxl/irq/irq.h, pxa255/irq/irq.c, pxa255/irq/irq.h, s3c24xx/irq/irq.c, s3c24xx/irq/irq.h: The previous interrupt warning fix changed the interrupt handler API. To fix this problem the generic interrupt support framework will be used now. This eliminates a lot of copy and paste code. The interrupt header file is now <bsp/irq.h>.
  • at91rm9200/clock/clock.c, lpc22xx/clock/clockdrv.c, mc9328mxl/clock/clockdrv.c, pxa255/clock/clock.c, s3c24xx/clock/clockdrv.c: Include <bsp/irq.h> instead of <irq.h>.
  • at91rm9200/irq/bsp_irq_asm.S, at91rm9200/irq/bsp_irq_init.c, mc9328mxl/irq/bsp_irq_asm.S, mc9328mxl/irq/bsp_irq_init.c, s3c24xx/irq/bsp_irq_asm.S, s3c24xx/irq/bsp_irq_init.c: Removed files.
  • Makefile.am, preinstall.am: Reflect changes above.
Location:
c/src/lib/libcpu/arm
Files:
6 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/arm/ChangeLog

    r2a2469b rf4dc319a  
     12010-04-30      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * at91rm9200/irq/irq.c, at91rm9200/irq/irq.h, lpc22xx/irq/irq.c,
     4        lpc22xx/irq/irq.h, mc9328mxl/irq/irq.c, mc9328mxl/irq/irq.h,
     5        pxa255/irq/irq.c, pxa255/irq/irq.h, s3c24xx/irq/irq.c,
     6        s3c24xx/irq/irq.h: The previous interrupt warning fix changed the
     7        interrupt handler API.  To fix this problem the generic interrupt
     8        support framework will be used now.  This eliminates a lot of copy and
     9        paste code.  The interrupt header file is now <bsp/irq.h>.
     10        * at91rm9200/clock/clock.c, lpc22xx/clock/clockdrv.c,
     11        mc9328mxl/clock/clockdrv.c, pxa255/clock/clock.c,
     12        s3c24xx/clock/clockdrv.c: Include <bsp/irq.h> instead of <irq.h>.
     13        * at91rm9200/irq/bsp_irq_asm.S, at91rm9200/irq/bsp_irq_init.c,
     14        mc9328mxl/irq/bsp_irq_asm.S, mc9328mxl/irq/bsp_irq_init.c,
     15        s3c24xx/irq/bsp_irq_asm.S, s3c24xx/irq/bsp_irq_init.c: Removed files.
     16        * Makefile.am, preinstall.am: Reflect changes above.
     17
    1182010-04-09      Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
    219
  • c/src/lib/libcpu/arm/Makefile.am

    r2a2469b rf4dc319a  
    1111noinst_PROGRAMS =
    1212
     13include_bspdir = $(includedir)/bsp
     14include_libcpudir = $(includedir)/libcpu
     15
     16include_bsp_HEADERS =
     17include_libcpu_HEADERS =
     18
    1319## shared/include
    1420if shared
    15 include_libcpudir = $(includedir)/libcpu
    1621
    17 include_libcpu_HEADERS = shared/include/mmu.h
     22include_libcpu_HEADERS += shared/include/mmu.h
    1823include_libcpu_HEADERS += shared/include/arm-cp15.h
    1924
     
    5358
    5459## pxa255/interrupt
    55 include_HEADERS += pxa255/irq/irq.h
     60include_bsp_HEADERS += pxa255/irq/irq.h
    5661noinst_PROGRAMS += pxa255/irq.rel
    57 pxa255_irq_rel_SOURCES = pxa255/irq/irq.c pxa255/irq/bsp_irq_init.c \
    58     ../../libbsp/arm/shared/irq/irq_init.c pxa255/irq/bsp_irq_asm.S \
     62pxa255_irq_rel_SOURCES = pxa255/irq/irq.c \
    5963    pxa255/irq/irq.h
    6064pxa255_irq_rel_CPPFLAGS = $(AM_CPPFLAGS)
     
    99103
    100104## at91rm9200/interrupt
    101 include_HEADERS += at91rm9200/irq/irq.h
     105include_bsp_HEADERS += at91rm9200/irq/irq.h
    102106
    103107noinst_PROGRAMS += at91rm9200/irq.rel
    104 at91rm9200_irq_rel_SOURCES = at91rm9200/irq/irq.c at91rm9200/irq/bsp_irq_init.c \
    105     ../../libbsp/arm/shared/irq/irq_init.c at91rm9200/irq/bsp_irq_asm.S \
     108at91rm9200_irq_rel_SOURCES = at91rm9200/irq/irq.c \
    106109    at91rm9200/irq/irq.h
    107110at91rm9200_irq_rel_CPPFLAGS = $(AM_CPPFLAGS)
     
    125128
    126129## mc9328mxl/interrupt
    127 include_HEADERS += mc9328mxl/irq/irq.h
     130include_bsp_HEADERS += mc9328mxl/irq/irq.h
    128131
    129132noinst_PROGRAMS += mc9328mxl/irq.rel
    130 mc9328mxl_irq_rel_SOURCES = mc9328mxl/irq/irq.c mc9328mxl/irq/bsp_irq_init.c \
    131     ../../libbsp/arm/shared/irq/irq_init.c mc9328mxl/irq/bsp_irq_asm.S \
     133mc9328mxl_irq_rel_SOURCES = mc9328mxl/irq/irq.c \
    132134    mc9328mxl/irq/irq.h
    133135mc9328mxl_irq_rel_CPPFLAGS = $(AM_CPPFLAGS)
     
    151153
    152154## s3c24xx/interrupt
    153 include_HEADERS += s3c24xx/irq/irq.h
     155include_bsp_HEADERS += s3c24xx/irq/irq.h
    154156
    155157noinst_PROGRAMS += s3c24xx/irq.rel
    156 s3c24xx_irq_rel_SOURCES = s3c24xx/irq/irq.c s3c24xx/irq/bsp_irq_init.c \
    157     ../../libbsp/arm/shared/irq/irq_init.c s3c24xx/irq/bsp_irq_asm.S \
     158s3c24xx_irq_rel_SOURCES = s3c24xx/irq/irq.c \
    158159    s3c24xx/irq/irq.h
    159160s3c24xx_irq_rel_CPPFLAGS = $(AM_CPPFLAGS)
     
    177178
    178179## lpc22xx/interrupt
    179 include_HEADERS += lpc22xx/irq/irq.h
     180include_bsp_HEADERS += lpc22xx/irq/irq.h
    180181
    181182noinst_PROGRAMS += lpc22xx/irq.rel
    182 lpc22xx_irq_rel_SOURCES = lpc22xx/irq/irq.c lpc22xx/irq/bsp_irq_init.c \
    183     ../../libbsp/arm/shared/irq/irq_init.c lpc22xx/irq/bsp_irq_asm.S \
     183lpc22xx_irq_rel_SOURCES = lpc22xx/irq/irq.c \
    184184    lpc22xx/irq/irq.h
    185185lpc22xx_irq_rel_CPPFLAGS = $(AM_CPPFLAGS)
  • c/src/lib/libcpu/arm/at91rm9200/clock/clock.c

    r2a2469b rf4dc319a  
    2020#include <stdlib.h>
    2121#include <bsp.h>
    22 #include <irq.h>
     22#include <bsp/irq.h>
    2323#include <at91rm9200.h>
    2424#include <at91rm9200_pmc.h>
  • c/src/lib/libcpu/arm/at91rm9200/irq/irq.c

    r2a2469b rf4dc319a  
    11/*
    22 * Atmel AT91RM9200 Interrupt handler
     3 *
     4 * Copyright (c) 2010 embedded brains GmbH.
    35 *
    46 * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
     
    1113 *  $Id$
    1214 */
     15
    1316#include <bsp.h>
    14 #include <irq.h>
    15 #include <rtems/score/thread.h>
    16 #include <rtems/score/apiext.h>
     17#include <bsp/irq.h>
     18#include <bsp/irq-generic.h>
     19
    1720#include <at91rm9200.h>
    1821
    19 /*
    20  * This function check that the value given for the irq line
    21  * is valid.
    22  */
    23 static int isValidInterrupt(int irq)
     22void bsp_interrupt_dispatch(void)
    2423{
    25     if ( (irq < 0) || (irq >= AT91RM9200_MAX_INT)) {
    26         return 0;
    27     }
    28     return 1;
     24  rtems_vector_number vector = AIC_CTL_REG(AIC_ISR);
     25
     26  bsp_interrupt_handler_dispatch(vector);
     27
     28  AIC_CTL_REG(AIC_EOICR) = 0;
    2929}
    3030
    31 /*
    32  * Installs the interrupt handler.
    33  */
    34 int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
     31rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
    3532{
    36     rtems_interrupt_level level;
     33  AIC_CTL_REG(AIC_IECR) = 1 << vector;
    3734
    38     if (!isValidInterrupt(irq->name)) {
    39         return 0;
    40     }
    41 
    42     /*
    43      * Check if default handler is actually connected. If not, issue
    44      * an error. Note: irq->name is a number corresponding to the
    45      * sources PID (see the at91rm9200_pid for this mapping).  We
    46      * convert it to a long word offset to get source's vector register
    47      */
    48     if (AIC_SVR_REG(irq->name * 4) != (uint32_t) default_int_handler) {
    49         return 0;
    50     }
    51 
    52     rtems_interrupt_disable(level);
    53 
    54     /*
    55      * store the new handler
    56      */
    57     AIC_SVR_REG(irq->name * 4) = (uint32_t) irq->hdl;
    58 
    59     /*
    60      * unmask interrupt
    61      */
    62     AIC_CTL_REG(AIC_IECR) = 1 << irq->name;
    63 
    64     /*
    65      * Enable interrupt on device
    66      */
    67     if(irq->on) {
    68         irq->on(irq);
    69     }
    70 
    71     rtems_interrupt_enable(level);
    72 
    73     return 1;
     35  return RTEMS_SUCCESSFUL;
    7436}
    7537
    76 /*
    77  * Remove and interrupt handler
    78  */
    79 int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
     38rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
    8039{
    81     rtems_interrupt_level level;
     40  AIC_CTL_REG(AIC_IDCR) = 1 << vector;
    8241
    83     if (!isValidInterrupt(irq->name)) {
    84         return 0;
    85     }
     42  return RTEMS_SUCCESSFUL;
     43}
    8644
    87     /*
    88      * Check if the handler is actually connected. If not, issue an error.
    89      */
    90     if (AIC_SVR_REG(irq->name * 4) != (uint32_t) irq->hdl) {
    91       return 0;
    92     }
    93     rtems_interrupt_disable(level);
     45rtems_status_code bsp_interrupt_facility_initialize(void)
     46{
     47  /* disable all interrupts */
     48  AIC_CTL_REG(AIC_IDCR) = 0xffffffff;
    9449
    95     /*
    96      * mask interrupt
    97      */
    98     AIC_CTL_REG(AIC_IDCR) = 1 << irq->name;
     50  _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
    9951
    100     /*
    101      * Disable interrupt on device
    102      */
    103     if(irq->off) {
    104         irq->off(irq);
    105     }
     52  return RTEMS_SUCCESSFUL;
     53}
    10654
    107     /*
    108      * restore the default irq value
    109      */
    110     AIC_SVR_REG(irq->name * 4) = (uint32_t) default_int_handler;
    111 
    112     rtems_interrupt_enable(level);
    113 
    114     return 1;
     55void bsp_interrupt_handler_default(rtems_vector_number vector)
     56{
     57  printk("spurious interrupt: %u\n", vector);
    11558}
  • c/src/lib/libcpu/arm/at91rm9200/irq/irq.h

    r2a2469b rf4dc319a  
    11/*
    22 * Interrupt handler Header file
     3 *
     4 * Copyright (c) 2010 embedded brains GmbH.
    35 *
    46 * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
     
    1618#define __IRQ_H__
    1719
    18 #ifdef __cplusplus
    19 extern "C" {
    20 #endif
    21 
    2220#ifndef __asm__
    2321
    24 /*
    25  * Include some preprocessor value also used by assember code
    26  */
     22#include <rtems.h>
     23#include <rtems/irq.h>
     24#include <rtems/irq-extension.h>
    2725
    28 #include <rtems/irq.h>
    29 #include <rtems.h>
    30 #include <at91rm9200.h>
     26#endif /* __asm__ */
    3127
    32 extern void default_int_handler(rtems_irq_hdl_param unused);
    33 /***********************************************************************
    34  * Constants
    35  **********************************************************************/
    3628/* possible interrupt sources on the AT91RM9200 */
    3729#define AT91RM9200_INT_FIQ        0
     
    6961#define AT91RM9200_MAX_INT       32
    7062
    71 /* vector table used by shared/irq_init.c */
    72 /* we can treat the AT91RM9200 AIC_SVR_BASE as */
    73 /* a vector table */
    74 #define VECTOR_TABLE AIC_SVR_BASE
     63#define BSP_INTERRUPT_VECTOR_MIN 0
    7564
    76 /*
    77  * function to initialize the interrupt for a specific BSP
    78  */
    79 void BSP_rtems_irq_mngt_init();
    80 
    81 #endif /* __asm__ */
    82 
    83 #ifdef __cplusplus
    84 }
    85 #endif
     65#define BSP_INTERRUPT_VECTOR_MAX (AT91RM9200_MAX_INT - 1)
    8666
    8767#endif /* __IRQ_H__ */
  • c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c

    r2a2469b rf4dc319a  
    1717#include <rtems.h>
    1818#include <bsp.h>
    19 #include <irq.h>
     19#include <bsp/irq.h>
    2020#include <lpc22xx.h>
    2121#include <rtems/bspIo.h>  /* for printk */
  • c/src/lib/libcpu/arm/lpc22xx/irq/irq.c

    r2a2469b rf4dc319a  
    11/*
    22 * Philps LPC22XX Interrupt handler
     3 *
     4 * Copyright (c) 2010 embedded brains GmbH.
    35 *
    46 * Copyright (c)  2006 by Ray<rayx.cn@gmail.com>  to support LPC ARM
     
    1012 *  $Id$
    1113 */
     14
    1215#include <bsp.h>
    13 #include <irq.h>
    14 #include <rtems/score/thread.h>
    15 #include <rtems/score/apiext.h>
     16#include <bsp/irq.h>
     17#include <bsp/irq-generic.h>
     18
    1619#include <lpc22xx.h>
    1720
    18 /*
    19  * This function check that the value given for the irq line
    20  * is valid.
    21  */
    22 static int isValidInterrupt(int irq)
     21void bsp_interrupt_dispatch(void)
    2322{
    24   if ( (irq < 0) || (irq >= BSP_MAX_INT))
    25     return 0;
    26   return 1;
     23  rtems_vector_number vector = 31 - __builtin_clz(VICIRQStatus);
     24
     25  bsp_interrupt_handler_dispatch(vector);
     26
     27  VICVectAddr = 0;
    2728}
    2829
    29 /*
    30  * Installs the interrupt handler.
    31  *
    32  * You should only have to add the code to unmask the interrupt.
    33  *
    34  */
    35 int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
     30rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
    3631{
    37     rtems_interrupt_level level;
    38     rtems_irq_hdl        *bsp_tbl;
    39     int                  *vic_cntl;
     32  VICIntEnable |= 1 << vector;
    4033
    41     bsp_tbl = (rtems_irq_hdl *)VICVectAddrBase;
    42 
    43     vic_cntl=(int *)VICVectCntlBase;
    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 
    53     if (bsp_tbl[irq->name] != default_int_handler) {
    54       return 0;
    55     }
    56 
    57     rtems_interrupt_disable(level);
    58 
    59     /*
    60      * store the new handler
    61      */
    62     bsp_tbl[irq->name] = irq->hdl;
    63     /* *(volatile unsigned long*)(VICVectAddr0+(irq->name * 4)&0x7c )= (uint32_t) irq->hdl;*/
    64     /*
    65      * Enable interrupt on device
    66      */
    67     vic_cntl[irq->name] = 0x20 | irq->name;
    68 
    69     VICIntEnable |= 1 << irq->name;
    70 
    71     if(irq->on)
    72     {
    73         irq->on(irq);
    74     }
    75 
    76 
    77     rtems_interrupt_enable(level);
    78 
    79     return 1;
     34  return RTEMS_SUCCESSFUL;
    8035}
    8136
    82 /*
    83  * Remove and interrupt handler
    84  *
    85  * You should only have to add the code to mask the interrupt.
    86  *
    87  */
    88 int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
     37rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
    8938{
    90     rtems_interrupt_level level;
    91     rtems_irq_hdl        *bsp_tbl;
     39  VICIntEnClr = 1 << vector;
    9240
    93     bsp_tbl = (rtems_irq_hdl *)&VICVectAddr0;
    94 
    95     if (!isValidInterrupt(irq->name)) {
    96       return 0;
    97     }
    98     /*
    99      * Check if the handler is actually connected. If not issue an error.
    100      */
    101     if (bsp_tbl[irq->name] != irq->hdl) {
    102       return 0;
    103     }
    104 
    105     rtems_interrupt_disable(level);
    106 
    107     VICIntEnClr = 1 << irq->name;
    108 
    109     /*
    110      * Disable interrupt on device
    111      */
    112     if(irq->off) {
    113         irq->off(irq);
    114     }
    115     /*
    116      * restore the default irq value
    117      */
    118     bsp_tbl[irq->name] = default_int_handler;
    119 
    120     rtems_interrupt_enable(level);
    121 
    122     return 1;
     41  return RTEMS_SUCCESSFUL;
    12342}
    12443
     44rtems_status_code bsp_interrupt_facility_initialize(void)
     45{
     46  volatile uint32_t *ctrl = (volatile uint32_t *) VICVectCntlBase;
     47  size_t i = 0;
    12548
     49  /* Disable all interrupts */
     50  VICIntEnClr = 0xffffffff;
     51
     52  /* Use IRQ category */
     53  VICIntSelect = 0;
     54
     55  /* Enable access in USER mode */
     56  VICProtection = 0;
     57
     58  for (i = 0; i < 16; ++i) {
     59    /* Disable vector mode */
     60    ctrl [i] = 0;
     61
     62    /* Acknowledge interrupts for all priorities */
     63    VICVectAddr = 0;
     64  }
     65
     66  /* Acknowledge interrupts for all priorities */
     67  VICVectAddr = 0;
     68
     69  /* Install the IRQ exception handler */
     70  _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
     71
     72  return RTEMS_SUCCESSFUL;
     73}
     74
     75void bsp_interrupt_handler_default(rtems_vector_number vector)
     76{
     77  printk("spurious interrupt: %u\n", vector);
     78}
  • c/src/lib/libcpu/arm/lpc22xx/irq/irq.h

    r2a2469b rf4dc319a  
    11/*
    22 * Interrupt handler Header file
     3 *
     4 * Copyright (c) 2010 embedded brains GmbH.
    35 *
    46 * Copyright (c) 2006 by Ray <rayx.cn@gmail.com> to support LPC ARM
     
    1618#define __IRQ_H__
    1719
    18 #ifdef __cplusplus
    19 extern "C" {
    20 #endif
    21 
    22   /* define that can be useful (the values are just examples) */
    2320#ifndef __asm__
    2421
    25 /*
    26  * Include some preprocessor value also used by assember code
    27  */
     22#include <rtems.h>
    2823#include <rtems/irq.h>
    29 #include <rtems.h>
    30 #include <lpc22xx.h>
     24#include <rtems/irq-extension.h>
    3125
    32 extern void default_int_handler(rtems_irq_hdl_param unused);
    33 
    34 /***********************************************************************
    35  * Constants
    36  **********************************************************************/
     26#endif /* __asm__ */
    3727
    3828/* possible interrupt sources on the LPC22xx */
     
    6858#define BSP_MAX_INT              28
    6959
     60#define BSP_INTERRUPT_VECTOR_MIN 0
     61
     62#define BSP_INTERRUPT_VECTOR_MAX (BSP_MAX_INT - 1)
     63
    7064#define UNDEFINED_INSTRUCTION_VECTOR_ADDR   (*(u_long *)0x00000004L)
    7165#define SOFTWARE_INTERRUPT_VECTOR_ADDR      (*(u_long *)0x00000008L)
     
    7973#define FIQ_ISR_ADDR                        (*(u_long *)0x0000003CL)
    8074
    81 
    82 //extern rtems_irq_hdl bsp_vector_table[BSP_MAX_INT];
    83 #define VECTOR_TABLE VICVectAddrBase
    84 
    85 
    86 /*
    87  * function to initialize the interrupt for a specific BSP
    88  */
    89 void BSP_rtems_irq_mngt_init(void);
    90 
    91 #endif /* __asm__ */
    92 
    93 #ifdef __cplusplus
    94 }
    95 #endif
    96 
    9775#endif /* __IRQ_H__ */
  • c/src/lib/libcpu/arm/mc9328mxl/clock/clockdrv.c

    r2a2469b rf4dc319a  
    1818#include <rtems.h>
    1919#include <bsp.h>
    20 #include <irq.h>
     20#include <bsp/irq.h>
    2121#include <mc9328mxl.h>
    2222#include <rtems/bspIo.h>  /* for printk */
  • c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c

    r2a2469b rf4dc319a  
    11/*
    22 * Motorola MC9328MXL Interrupt handler
     3 *
     4 * Copyright (c) 2010 embedded brains GmbH.
    35 *
    46 * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
     
    1113 *  $Id$
    1214 */
     15
    1316#include <bsp.h>
    14 #include <irq.h>
    15 #include <rtems/score/thread.h>
    16 #include <rtems/score/apiext.h>
     17#include <bsp/irq.h>
     18#include <bsp/irq-generic.h>
     19
    1720#include <mc9328mxl.h>
    1821
    19 mc9328mxl_irq_info_t bsp_vector_table[BSP_MAX_INT];
     22void bsp_interrupt_dispatch(void)
     23{
     24  rtems_vector_number vector = *((uint32_t *) 0x00223040) >> 16;
    2025
    21 /*
    22  * This function check that the value given for the irq line
    23  * is valid.
    24  */
    25 static int isValidInterrupt(int irq)
    26 {
    27   if ( (irq < 0) || (irq >= BSP_MAX_INT))
    28     return 0;
    29   return 1;
     26  bsp_interrupt_handler_dispatch(vector);
    3027}
    3128
    32 /*
    33  * Installs the interrupt handler.
    34  *
    35  * You should only have to add the code to unmask the interrupt.
    36  *
    37  */
    38 int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
     29rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
    3930{
    40     rtems_interrupt_level level;
    41 
    42     if (!isValidInterrupt(irq->name)) {
    43       return 0;
    44     }
    45 
    46     /*
    47      * Check if default handler is actually connected. If not issue an error.
    48      */
    49     if (bsp_vector_table[irq->name].vector != default_int_handler) {
    50         return 0;
    51     }
    52 
    53     rtems_interrupt_disable(level);
    54 
    55     /*
    56      * store the new handler
    57      */
    58     bsp_vector_table[irq->name].vector = irq->hdl;
    59     bsp_vector_table[irq->name].data = irq->handle;
    60 
    61     /*
    62      * Enable interrupt on device
    63      */
    64     if(irq->on)
    65     {
    66         irq->on(irq);
    67     }
    68 
    69     rtems_interrupt_enable(level);
    70 
    71     return 1;
     31  return RTEMS_SUCCESSFUL;
    7232}
    7333
    74 /*
    75  * Remove and interrupt handler
    76  *
    77  * You should only have to add the code to mask the interrupt.
    78  *
    79  */
    80 int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
     34rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
    8135{
    82     rtems_interrupt_level level;
    83 
    84     if (!isValidInterrupt(irq->name)) {
    85       return 0;
    86     }
    87     /*
    88      * Check if the handler is actually connected. If not issue an error.
    89      */
    90     if (bsp_vector_table[irq->name].vector != irq->hdl) {
    91         return 0;
    92     }
    93 
    94     rtems_interrupt_disable(level);
    95 
    96 
    97     /*
    98      * Disable interrupt on device
    99      */
    100     if(irq->off) {
    101         irq->off(irq);
    102     }
    103     /*
    104      * restore the default irq value
    105      */
    106     bsp_vector_table[irq->name].vector = default_int_handler;
    107     bsp_vector_table[irq->name].data = NULL;
    108 
    109     rtems_interrupt_enable(level);
    110 
    111     return 1;
     36  return RTEMS_SUCCESSFUL;
    11237}
    11338
     39rtems_status_code bsp_interrupt_facility_initialize(void)
     40{
    11441
     42  _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
     43
     44  return RTEMS_SUCCESSFUL;
     45}
     46
     47void bsp_interrupt_handler_default(rtems_vector_number vector)
     48{
     49  printk("spurious interrupt: %u\n", vector);
     50}
  • c/src/lib/libcpu/arm/mc9328mxl/irq/irq.h

    r2a2469b rf4dc319a  
    11/*
    22 * Interrupt handler Header file
     3 *
     4 * Copyright (c) 2010 embedded brains GmbH.
    35 *
    46 * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
     
    1618#define __IRQ_H__
    1719
    18 #include <rtems/irq.h>
    19 
    20 #ifdef __cplusplus
    21 extern "C" {
    22 #endif
    23 
    24   /* define that can be useful (the values are just examples) */
    2520#ifndef __asm__
    2621
    27 /*
    28  * Include some preprocessor value also used by assember code
    29  */
     22#include <rtems.h>
     23#include <rtems/irq.h>
     24#include <rtems/irq-extension.h>
    3025
    31 #include <rtems.h>
    32 #include <mc9328mxl.h>
    33 
    34 extern void default_int_handler(rtems_irq_hdl_param);
    35 /***********************************************************************
    36  * Constants
    37  **********************************************************************/
     26#endif /* __asm__ */
    3827
    3928/* possible interrupt sources on the MC9328MXL */
     
    10493#define BSP_MAX_INT              64
    10594
    106 typedef struct {
    107     rtems_irq_hdl       vector;
    108     rtems_irq_hdl_param data;
    109 } mc9328mxl_irq_info_t;
     95#define BSP_INTERRUPT_VECTOR_MIN 0
    11096
    111 
    112 
    113 extern mc9328mxl_irq_info_t bsp_vector_table[BSP_MAX_INT];
    114 
    115 /*
    116  * function to initialize the interrupt for a specific BSP
    117  */
    118 void BSP_rtems_irq_mngt_init(void);
    119 
    120 #endif /* __asm__ */
    121 
    122 #ifdef __cplusplus
    123 }
    124 #endif
     97#define BSP_INTERRUPT_VECTOR_MAX (BSP_MAX_INT - 1)
    12598
    12699#endif /* __IRQ_H__ */
  • c/src/lib/libcpu/arm/preinstall.am

    r2a2469b rf4dc319a  
    1919PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
    2020
    21 if shared
     21$(PROJECT_INCLUDE)/bsp/$(dirstamp):
     22        @$(MKDIR_P) $(PROJECT_INCLUDE)/bsp
     23        @: > $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     24PREINSTALL_DIRS += $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     25
    2226$(PROJECT_INCLUDE)/libcpu/$(dirstamp):
    2327        @$(MKDIR_P) $(PROJECT_INCLUDE)/libcpu
     
    2529PREINSTALL_DIRS += $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
    2630
     31if shared
    2732$(PROJECT_INCLUDE)/libcpu/mmu.h: shared/include/mmu.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
    2833        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/mmu.h
     
    4247PREINSTALL_FILES += $(PROJECT_INCLUDE)/ffuart.h
    4348
    44 $(PROJECT_INCLUDE)/irq.h: pxa255/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp)
    45         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h
    46 PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h
     49$(PROJECT_INCLUDE)/bsp/irq.h: pxa255/irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     50        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
     51PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
    4752endif
    4853if at91rm9200
     
    7984PREINSTALL_FILES += $(PROJECT_INCLUDE)/at91rm9200_usart.h
    8085
    81 $(PROJECT_INCLUDE)/irq.h: at91rm9200/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp)
    82         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h
    83 PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h
     86$(PROJECT_INCLUDE)/bsp/irq.h: at91rm9200/irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     87        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
     88PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
    8489endif
    8590if mc9328mxl
     
    8893PREINSTALL_FILES += $(PROJECT_INCLUDE)/mc9328mxl.h
    8994
    90 $(PROJECT_INCLUDE)/irq.h: mc9328mxl/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp)
    91         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h
    92 PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h
     95$(PROJECT_INCLUDE)/bsp/irq.h: mc9328mxl/irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     96        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
     97PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
    9398endif
    9499if s3c24xx
     
    105110PREINSTALL_FILES += $(PROJECT_INCLUDE)/s3c2410.h
    106111
    107 $(PROJECT_INCLUDE)/irq.h: s3c24xx/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp)
    108         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h
    109 PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h
     112$(PROJECT_INCLUDE)/bsp/irq.h: s3c24xx/irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     113        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
     114PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
    110115endif
    111116if lpc22xx
     
    114119PREINSTALL_FILES += $(PROJECT_INCLUDE)/lpc22xx.h
    115120
    116 $(PROJECT_INCLUDE)/irq.h: lpc22xx/irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp)
    117         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h
    118 PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h
     121$(PROJECT_INCLUDE)/bsp/irq.h: lpc22xx/irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     122        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
     123PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
    119124endif
  • c/src/lib/libcpu/arm/pxa255/clock/clock.c

    r2a2469b rf4dc319a  
    1919#include <bsp.h>
    2020#include <bspopts.h>
    21 #include <irq.h>
     21#include <bsp/irq.h>
    2222#include <pxa255.h>
    2323
  • c/src/lib/libcpu/arm/pxa255/irq/irq.c

    r2a2469b rf4dc319a  
    11/*
     2 * Copyright (c) 2010 embedded brains GmbH.
     3 *
    24 * PXA255 Interrupt handler by Yang Xi <hiyangxi@gmail.com>
    35 * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
     
    911 *  $Id$
    1012 */
     13
    1114#include <bsp.h>
    12 #include <irq.h>
    13 #include <rtems/score/thread.h>
    14 #include <rtems/score/apiext.h>
     15#include <bsp/irq.h>
     16#include <bsp/irq-generic.h>
     17
    1518#include <pxa255.h>
    1619
    17 /*
    18  * This function check that the value given for the irq line
    19  * is valid.
    20  */
    21 static int isValidInterrupt(int irq)
     20void bsp_interrupt_dispatch(void)
    2221{
    23     if ( (irq < 0) || (irq >= PRIMARY_IRQS)) {
    24         return 0;
    25     }
    26     return 1;
     22  rtems_vector_number vector = 31 - __builtin_clz(XSCALE_INT_ICIP);
     23
     24  bsp_interrupt_handler_dispatch(vector);
    2725}
    2826
    29 /*
    30  * Installs the interrupt handler.
    31  */
    32 int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
     27rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
    3328{
    34     rtems_interrupt_level level;
     29  XSCALE_INT_ICMR |= 1 << vector;
    3530
    36     if (!isValidInterrupt(irq->name)) {
    37         return 0;
    38     }
    39 
    40     /*
    41      * Check if default handler is actually connected. If not, issue
    42      * an error. Note: irq->name is a number corresponding to the
    43      * interrupt number .  We
    44      * convert it to a long word offset to get source's vector register
    45      */
    46         if (IRQ_table[irq->name] != dummy_handler) {
    47         return 0;
    48         }
    49 
    50     _CPU_ISR_Disable(level);
    51 
    52     /*
    53      * store the new handler
    54      */
    55     IRQ_table[irq->name] = irq->hdl;
    56 
    57     /*
    58      * unmask interrupt
    59      */
    60     XSCALE_INT_ICMR = XSCALE_INT_ICMR | 1 << irq->name;
    61 
    62 
    63 
    64     /*
    65      * Enable interrupt on device
    66      */
    67     if(irq->on) {
    68         irq->on(irq);
    69     }
    70 
    71     _CPU_ISR_Enable(level);
    72 
    73     return 1;
     31  return RTEMS_SUCCESSFUL;
    7432}
    7533
    76 /*
    77  * Remove and interrupt handler
    78  */
    79 int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
     34rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
    8035{
    81     rtems_interrupt_level level;
     36  XSCALE_INT_ICMR  &= ~(1 << vector);
    8237
    83     if (!isValidInterrupt(irq->name)) {
    84         return 0;
    85     }
     38  return RTEMS_SUCCESSFUL;
     39}
    8640
    87     /*
    88      * Check if the handler is actually connected. If not, issue an error.
    89      */
    90     if (IRQ_table[irq->name] != irq->hdl) {
    91       return 0;
    92     }
    93     _CPU_ISR_Disable(level);
     41rtems_status_code bsp_interrupt_facility_initialize(void)
     42{
     43  /* disable all interrupts */
     44  XSCALE_INT_ICMR = 0x0;
    9445
    95     /*
    96      * mask interrupt
    97      */
    98     XSCALE_INT_ICMR  =  XSCALE_INT_ICMR  & (~(1 << irq->name));
     46  /* Direct the interrupt to IRQ*/
     47  XSCALE_INT_ICLR = 0x0;
    9948
    100     /*
    101      * Disable interrupt on device
    102      */
    103     if(irq->off) {
    104         irq->off(irq);
    105     }
     49  /* Install the IRQ exception handler */
     50  _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
    10651
    107     /*
    108      * restore the default irq value
    109      */
    110     IRQ_table[irq->name] = dummy_handler;
     52  return RTEMS_SUCCESSFUL;
     53}
    11154
    112     _CPU_ISR_Enable(level);
    113 
    114     return 1;
     55void bsp_interrupt_handler_default(rtems_vector_number vector)
     56{
     57  printk("spurious interrupt: %u\n", vector);
    11558}
  • c/src/lib/libcpu/arm/pxa255/irq/irq.h

    r2a2469b rf4dc319a  
    11/*
     2 * Copyright (c) 2010 embedded brains GmbH.
     3 *
    24 * Interrupt handler Header file for PXA By Yang Xi <hiyangxi@gmail.com>
    35 * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com>
     
    1315#define __IRQ_H__
    1416
    15 #ifdef __cplusplus
    16 extern "C" {
    17 #endif
    18 
    1917#ifndef __asm__
    2018
    21 /*
    22  * Include some preprocessor value also used by assember code
    23  */
     19#include <rtems.h>
     20#include <rtems/irq.h>
     21#include <rtems/irq-extension.h>
    2422
    25 #include <rtems/irq.h>
    26 #include <rtems.h>
    2723#include <pxa255.h>
    2824
    29 extern void default_int_handler(rtems_irq_hdl_param unused);
    30 extern void (*IRQ_table[PRIMARY_IRQS])(rtems_irq_hdl_param param);
    31 extern void dummy_handler(rtems_irq_hdl_param unused);
     25#define BSP_INTERRUPT_VECTOR_MIN 0
    3226
    33 extern void BSP_rtems_irq_mngt_init(void);
     27#define BSP_INTERRUPT_VECTOR_MAX (PRIMARY_IRQS - 1)
    3428
    3529#endif /* __asm__ */
    3630
    37 #ifdef __cplusplus
    38 }
    39 #endif
    40 
    4131#endif /* __IRQ_H__ */
  • c/src/lib/libcpu/arm/s3c24xx/clock/clockdrv.c

    r2a2469b rf4dc319a  
    1414*/
    1515#include <rtems.h>
    16 #include <irq.h>
     16#include <bsp/irq.h>
    1717#include <bsp.h>
    1818#include <s3c24xx.h>
  • c/src/lib/libcpu/arm/s3c24xx/irq/irq.c

    r2a2469b rf4dc319a  
    22 *
    33 *  This file contains the implementation of the function described in irq.h
     4 *
     5 *  Copyright (c) 2010 embedded brains GmbH.
    46 *
    57 *  CopyRight (C) 2000 Canon Research France SA.
     
    1315 */
    1416
     17#include <bsp.h>
     18#include <bsp/irq.h>
     19#include <bsp/irq-generic.h>
    1520
    16 #include <bsp.h>
    17 #include <irq.h>
    18 #include <rtems/score/thread.h>
    19 #include <rtems/score/apiext.h>
    2021#include <s3c24xx.h>
    2122
    22 /*
    23  * This function check that the value given for the irq line
    24  * is valid.
    25  */
     23void bsp_interrupt_dispatch(void)
     24{
     25  rtems_vector_number vector = *((uint32_t *) rINTOFFSET_ADDR);
    2626
    27 static int isValidInterrupt(int irq)
    28 {
    29     if ( (irq < 0) || (irq > BSP_MAX_INT)) {
    30         return 0;
    31     }
    32 
    33     return 1;
     27  bsp_interrupt_handler_dispatch(vector);
    3428}
    3529
    36 /*
    37  * ------------------- RTEMS Single Irq Handler Mngt Routines ----------------
    38  */
    39 
    40 int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
     30rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
    4131{
    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 = (rtems_irq_hdl *)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;
     32  return RTEMS_SUCCESSFUL;
    7533}
    7634
    77 int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
     35rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
    7836{
    79     rtems_irq_hdl *HdlTable;
    80     rtems_interrupt_level level;
     37  return RTEMS_SUCCESSFUL;
     38}
    8139
    82     if (!isValidInterrupt(irq->name)) {
    83         return 0;
    84     }
     40rtems_status_code bsp_interrupt_facility_initialize(void)
     41{
     42  _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
    8543
    86     /*
    87      * Check if the handler is actually connected. If not issue an error.
    88      */
    89     HdlTable = (rtems_irq_hdl *)VECTOR_TABLE;
    90     if (*(HdlTable + irq->name) != irq->hdl) {
    91         return 0;
    92     }
    93     _CPU_ISR_Disable(level);
     44  return RTEMS_SUCCESSFUL;
     45}
    9446
    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;
     47void bsp_interrupt_handler_default(rtems_vector_number vector)
     48{
     49  printk("spurious interrupt: %u\n", vector);
    11050}
  • c/src/lib/libcpu/arm/s3c24xx/irq/irq.h

    r2a2469b rf4dc319a  
    11/* irq.h
     2 *
     3 *  Copyright (c) 2010 embedded brains GmbH.
     4 *
     5 *  CopyRight (C) 2000 Canon Research France SA.
     6 *  Emmanuel Raguet,  mailto:raguet@crf.canon.fr
    27 *
    38 *  Common file, merged from s3c2400/irq/irq.h and s3c2410/irq/irq.h
     
    611#ifndef _IRQ_H_
    712#define _IRQ_H_
    8 #ifdef __cplusplus
    9 extern "C" {
    10 #endif
    1113
    12 /*
    13  * Include some preprocessor value also used by assember code
    14  */
     14#include <rtems.h>
     15#include <rtems/irq.h>
     16#include <rtems/irq-extension.h>
    1517
    16 #include <rtems/irq.h>
    17 #include <rtems.h>
    1818#include <s3c24xx.h>
    19 
    20 extern void default_int_handler(rtems_irq_hdl_param unused);
    21 /*-------------------------------------------------------------------------+
    22 | Constants
    23 +--------------------------------------------------------------------------*/
    2419
    2520#ifdef CPU_S3C2400
     
    9489#endif
    9590
    96 extern void *bsp_vector_table;
    97 #define VECTOR_TABLE &bsp_vector_table
     91#define BSP_INTERRUPT_VECTOR_MIN 0
    9892
    99 /*-------------------------------------------------------------------------+
    100 | Function Prototypes.
    101 +--------------------------------------------------------------------------*/
    102 /*
    103  * ------------------ RTEMS Single Irq Handler Mngt Routines ----------------
    104  */
    105 
    106 /*
    107  * function to initialize the interrupt for a specific BSP
    108  */
    109 void BSP_rtems_irq_mngt_init();
    110 
    111 
    112 #ifdef __cplusplus
    113 }
    114 #endif
     93#define BSP_INTERRUPT_VECTOR_MAX (BSP_MAX_INT - 1)
    11594
    11695#endif /* _IRQ_H_ */
Note: See TracChangeset for help on using the changeset viewer.