Changeset 536f2d2b in rtems


Ignore:
Timestamp:
Apr 30, 2010, 2:55:55 PM (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.10, 4.11, master
Children:
ae3c037
Parents:
6e6886d5
Message:

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

  • irq/irq_asm.S, irq/irq_init.c, irq/bsp_irq_asm.S, irq/bsp_irq_init.c: Removed files.
  • Makefile.am, preinstall.am: Reflect changes above. Added generic interrupt support modules.
  • irq/irq.h, irq/irq.c: 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>.
  • include/bsp.h: Define BSP_FEATURE_IRQ_EXTENSION.
  • start/start.S, startup/bspstart.c, clock/clockdrv.c, console/console.c, timer/timer.c: Interrupt support changes.
Location:
c/src/lib/libbsp/arm/gba
Files:
4 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/gba/ChangeLog

    r6e6886d5 r536f2d2b  
     12010-04-30      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * irq/irq_asm.S, irq/irq_init.c, irq/bsp_irq_asm.S,
     4        irq/bsp_irq_init.c: Removed files.
     5        * Makefile.am, preinstall.am: Reflect changes above.  Added generic
     6        interrupt support modules.
     7        * irq/irq.h, irq/irq.c: The previous interrupt warning fix changed the
     8        interrupt handler API.  To fix this problem the generic interrupt
     9        support framework will be used now.  This eliminates a lot of copy and
     10        paste code.  The interrupt header file is now <bsp/irq.h>.
     11        * include/bsp.h: Define BSP_FEATURE_IRQ_EXTENSION.
     12        * start/start.S, startup/bspstart.c, clock/clockdrv.c,
     13        console/console.c, timer/timer.c: Interrupt support changes.
     14
    1152010-04-30      Sebastian Huber <sebastian.huber@embedded-brains.de>
    216
  • c/src/lib/libbsp/arm/gba/Makefile.am

    r6e6886d5 r536f2d2b  
    1818include_HEADERS += ../../shared/include/tm27.h
    1919include_HEADERS += include/gba.h
     20
     21include_bsp_HEADERS =
    2022
    2123nodist_include_HEADERS = include/bspopts.h
     
    4951libbsp_a_SOURCES += timer/timer.c
    5052
    51 include_HEADERS += irq/irq.h
    5253# irq
    53 libbsp_a_SOURCES += irq/irq.c irq/bsp_irq_init.c irq/irq_init.c \
    54     irq/bsp_irq_asm.S irq/irq_asm.S
     54include_bsp_HEADERS += ../../shared/include/irq-generic.h \
     55        ../../shared/include/irq-info.h \
     56        irq/irq.h
     57libbsp_a_SOURCES += ../../shared/src/irq-generic.c \
     58        ../../shared/src/irq-legacy.c \
     59        ../../shared/src/irq-info.c \
     60        ../../shared/src/irq-shell.c \
     61        ../../shared/src/irq-server.c \
     62        irq/irq.c
    5563
    5664include $(srcdir)/preinstall.am
  • c/src/lib/libbsp/arm/gba/clock/clockdrv.c

    r6e6886d5 r536f2d2b  
    1818#include <rtems.h>
    1919#include <bsp.h>
    20 #include <irq.h>
     20#include <bsp/irq.h>
    2121#include <gba.h>
    2222
  • c/src/lib/libbsp/arm/gba/console/console.c

    r6e6886d5 r536f2d2b  
    2525#include <rtems/termiostypes.h>
    2626#include <termios.h>
    27 #include <irq.h>
     27#include <bsp/irq.h>
    2828#include <gba.h>
    2929#include <conio.h>
  • c/src/lib/libbsp/arm/gba/include/bsp.h

    r6e6886d5 r536f2d2b  
    3131#include <rtems/clockdrv.h>
    3232
     33#define BSP_FEATURE_IRQ_EXTENSION
     34
    3335/** Define operation count for Tests */
    3436#define OPERATION_COUNT 10
  • c/src/lib/libbsp/arm/gba/irq/irq.c

    r6e6886d5 r536f2d2b  
    66/*
    77 *  RTEMS GBA BSP
     8 *
     9 *  Copyright (c) 2010 embedded brains GmbH.
    810 *
    911 *  Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
     
    2123
    2224#include <bsp.h>
    23 #include <irq.h>
     25#include <bsp/irq.h>
     26#include <bsp/irq-generic.h>
     27
    2428#include <gba_registers.h>
    25 #include <rtems/score/thread.h>
    26 #include <rtems/score/apiext.h>
    2729
     30void bsp_interrupt_dispatch(void)
     31{
     32  unsigned reg_ie = GBA_REG_IE;
     33  unsigned reg_if = GBA_REG_IF & reg_ie;
     34  rtems_vector_number vector = 31 - __builtin_clz(reg_if);
    2835
    29 /**
    30  *  @brief isValidInterrupt function check that the value given for the irq line is valid.
    31  *
    32  *  @param  irq irq number
    33  *  @return status code TRUE/FALSE (0/1)
    34  */
    35 static int isValidInterrupt(int irq)
    36 {
    37   if ( (irq < 0) || (irq > BSP_MAX_INT)) {
    38      return 0;
    39   }
    40   return 1;
     36  bsp_interrupt_handler_dispatch(vector);
     37
     38  GBA_REG_IF = 1 << vector;
    4139}
    4240
    43 /*
    44  * ------------------------ RTEMS Single Irq Handler Mngt Routines ----------------
    45  */
     41rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
     42{
     43  GBA_REG_IE |= 1 << vector;
    4644
    47 
    48 /**
    49  *  @brief BSP_install_rtems_irq_handler function install rtems irq handler.
    50  *
    51  *  @param  irq irq connect data
    52  *  @return status code TRUE/FALSE (0/1)
    53  */
    54 int BSP_install_rtems_irq_handler  (const rtems_irq_connect_data* irq)
    55 {
    56     rtems_irq_hdl *HdlTable;
    57     rtems_interrupt_level level;
    58 
    59     if (!isValidInterrupt(irq->name)) {
    60        return 0;
    61     }
    62     /*
    63      * Check if default handler is actually connected. If not issue an error.
    64      */
    65     HdlTable = (rtems_irq_hdl *) (uint32_t)VECTOR_TABLE;
    66     if (*(HdlTable + irq->name) != default_int_handler) {
    67        return 0;
    68     }
    69 
    70     rtems_interrupt_disable(level);
    71 
    72     /*
    73      * store the new handler
    74      */
    75     *(HdlTable + irq->name) = irq->hdl;
    76 
    77     /*
    78      * ack pending interrupt
    79      */
    80     GBA_REG_IF |= (1 << (irq->name));
    81 
    82     /*
    83      * initialize the control register for the concerned interrupt
    84      */
    85     GBA_REG_IE |= (1 << (irq->name));
    86 
    87     /*
    88      * Enable interrupt on device
    89      */
    90         if (irq->on)
    91         irq->on(irq);
    92 
    93     rtems_interrupt_enable(level);
    94 
    95     return 1;
     45  return RTEMS_SUCCESSFUL;
    9646}
    9747
    98 /**
    99  *  @brief BSP_remove_rtems_irq_handler function removes rtems irq handler.
    100  *
    101  *  @param  irq irq connect data
    102  *  @return status code TRUE/FALSE (0/1)
    103  */
    104 int BSP_remove_rtems_irq_handler  (const rtems_irq_connect_data* irq)
     48rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
    10549{
    106     rtems_irq_hdl *HdlTable;
    107     rtems_interrupt_level level;
     50  GBA_REG_IE &= ~(1 << vector);
    10851
    109     if (!isValidInterrupt(irq->name)) {
    110        return 0;
    111     }
    112     /*
    113      * Check if the handler is actually connected. If not issue an error.
    114      */
    115     HdlTable = (rtems_irq_hdl *) (uint32_t)VECTOR_TABLE;
    116     if (*(HdlTable + irq->name) != irq->hdl) {
    117        return 0;
    118     }
    119     rtems_interrupt_disable(level);
    120 
    121     /*
    122      * mask at INT controller level
    123      */
    124     GBA_REG_IE &= ~(1 << irq->name);
    125 
    126     /*
    127      * Disable interrupt on device
    128      */
    129         if (irq->off)
    130         irq->off(irq);
    131 
    132     /*
    133      * restore the default irq value
    134      */
    135     *(HdlTable + irq->name) = default_int_handler;
    136 
    137     rtems_interrupt_enable(level);
    138 
    139     return 1;
     52  return RTEMS_SUCCESSFUL;
    14053}
    14154
     55rtems_status_code bsp_interrupt_facility_initialize(void)
     56{
     57  /* clear all interrupt status flags */
     58  GBA_REG_IF = 0xffff;
     59  /* disable all interrupts */
     60  GBA_REG_IE = 0;
     61  /* set master interrupt enable */
     62  GBA_REG_IME = 1;
    14263
    143 /**
    144  *  @brief _ThreadProcessSignalsFromIrq function check that the value given for the irq line is valid.
    145  *
    146  *  @param  cxt exeption frame
    147  *  @return None
    148  */
    149 void _ThreadProcessSignalsFromIrq (CPU_Exception_frame* ctx)
     64  /* Exception handler is already present in the ROM BIOS */
     65
     66  return RTEMS_SUCCESSFUL;
     67}
     68
     69void bsp_interrupt_handler_default(rtems_vector_number vector)
    15070{
    151   /*
    152    * Process pending signals that have not already been
    153    * processed by _Thread_Dispatch. This happens quite
    154    * unfrequently : the ISR must have posted an action
    155    * to the current running thread.
    156    */
    157   if ( _Thread_Do_post_task_switch_extension ||
    158        _Thread_Executing->do_post_task_switch_extension )
    159   {
    160      _Thread_Executing->do_post_task_switch_extension = false;
    161      _API_extensions_Run_postswitch();
    162   }
     71  printk("spurious interrupt: %u\n", vector);
    16372}
  • c/src/lib/libbsp/arm/gba/irq/irq.h

    r6e6886d5 r536f2d2b  
    77/*
    88 *  RTEMS GBA BSP
     9 *
     10 *  Copyright (c) 2010 embedded brains GmbH.
    911 *
    1012 *  Copyright (c) 2004  Markku Puro <markku.puro@kopteri.net>
     
    1719 */
    1820
     21#ifndef __asm__
     22
     23#include <rtems.h>
     24#include <rtems/irq.h>
     25#include <rtems/irq-extension.h>
     26
     27#endif /* __asm__ */
     28
    1929#ifndef _IRQ_H_
    2030#define _IRQ_H_
    21 
    22 
    23 #ifdef __cplusplus
    24 extern "C" {
    25 #endif
    26 
    27 /*
    28  * Include some preprocessor value also used by assember code
    29  */
    30 
    31 #define VECTOR_TABLE  (&irq_vector_table[0])
    32 
    33 #include <stdint.h>
    34 #include <rtems/irq.h>
    35 #include <rtems.h>
    36 
    37 extern void default_int_handler(rtems_irq_hdl_param unused);
    3831
    3932/*---------------------------------------------------------------------------*
     
    4942+--------------------------------------------------------------------------*/
    5043
    51 typedef enum {
    52   BSP_IRQ_VBLANK    = 0,
    53   BSP_IRQ_HBLANK    = 1,
    54   BSP_IRQ_VCOUNTER  = 2,
    55   BSP_IRQ_TIMER0    = 3,
    56   BSP_IRQ_TIMER1    = 4,
    57   BSP_IRQ_TIMER2    = 5,
    58   BSP_IRQ_TIMER3    = 6,
    59   BSP_IRQ_SERIAL    = 7,
    60   BSP_IRQ_DMA0      = 8,
    61   BSP_IRQ_DMA1      = 9,
    62   BSP_IRQ_DMA2      = 10,
    63   BSP_IRQ_DMA3      = 11,
    64   BSP_IRQ_KEY       = 12,
    65   BSP_IRQ_CART      = 13,
    66   BSP_IRQ_NA14      = 14,
    67   BSP_IRQ_NA15      = 15,
    68   BSP_MAX_INT       = 16  /**< BSP_MAX_INT <= _irq_max_vector in linkcmds */
    69 } rtems_irq_symbolic_name;
     44#define BSP_IRQ_VBLANK   0
     45#define BSP_IRQ_HBLANK   1
     46#define BSP_IRQ_VCOUNTER 2
     47#define BSP_IRQ_TIMER0   3
     48#define BSP_IRQ_TIMER1   4
     49#define BSP_IRQ_TIMER2   5
     50#define BSP_IRQ_TIMER3   6
     51#define BSP_IRQ_SERIAL   7
     52#define BSP_IRQ_DMA0     8
     53#define BSP_IRQ_DMA1     9
     54#define BSP_IRQ_DMA2     10
     55#define BSP_IRQ_DMA3     11
     56#define BSP_IRQ_KEY      12
     57#define BSP_IRQ_CART     13
     58#define BSP_IRQ_NA14     14
     59#define BSP_IRQ_NA15     15
     60#define BSP_MAX_INT      16
    7061
     62#define BSP_INTERRUPT_VECTOR_MIN 0
    7163
    72 extern void        _irq_max_vector;               /**< defined in lincmds    */
    73 extern uint32_t    irq_vector_table[BSP_MAX_INT]; /**< allocated in linkcmds */
    74 
    75 /*-------------------------------------------------------------------------+
    76 | Function Prototypes.
    77 +--------------------------------------------------------------------------*/
    78 /*
    79  * ------------------------ RTEMS Single Irq Handler Mngt Routines ----------------
    80  */
    81 
    82 /**
    83  * @brief function to initialize the interrupt for a specific BSP
    84  */
    85 void BSP_rtems_irq_mngt_init();
    86 
    87 #ifdef __cplusplus
    88 }
    89 #endif
     64#define BSP_INTERRUPT_VECTOR_MAX (BSP_MAX_INT - 1)
    9065
    9166#endif /* _IRQ_H_ */
  • c/src/lib/libbsp/arm/gba/preinstall.am

    r6e6886d5 r536f2d2b  
    8686PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
    8787
    88 $(PROJECT_INCLUDE)/irq.h: irq/irq.h $(PROJECT_INCLUDE)/$(dirstamp)
    89         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/irq.h
    90 PREINSTALL_FILES += $(PROJECT_INCLUDE)/irq.h
     88$(PROJECT_INCLUDE)/bsp/irq-generic.h: ../../shared/include/irq-generic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     89        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-generic.h
     90PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-generic.h
    9191
     92$(PROJECT_INCLUDE)/bsp/irq-info.h: ../../shared/include/irq-info.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     93        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-info.h
     94PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-info.h
     95
     96$(PROJECT_INCLUDE)/bsp/irq.h: irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     97        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
     98PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
     99
  • c/src/lib/libbsp/arm/gba/start/start.S

    r6e6886d5 r536f2d2b  
    166166    PUBLIC_ARM_FUNCTION(_gba_ISR_handler)
    167167        ldmfd  r13!,{r0-r3,r12,r14}
    168         b      _ISR_Handler
     168        b      arm_exc_interrupt
    169169    LABEL_END(_gba_ISR_handler)
    170170
  • c/src/lib/libbsp/arm/gba/startup/bspstart.c

    r6e6886d5 r536f2d2b  
    2121#include <stdio.h>
    2222#include <bsp.h>
     23#include <bsp/irq-generic.h>
    2324#include <rtems/bspIo.h>
    2425#include <gba.h>
    2526#include <conio.h>
    26 
    27 /* External Prototypes */
    28 extern void rtems_irq_mngt_init(void);
    2927
    3028/** Chip registers */
     
    5149
    5250  /* Init rtems interrupt management */
    53   rtems_irq_mngt_init();
     51  if (bsp_interrupt_initialize() != RTEMS_SUCCESSFUL) {
     52    _CPU_Fatal_halt(0xe);
     53  }
    5454}
    5555
  • c/src/lib/libbsp/arm/gba/timer/timer.c

    r6e6886d5 r536f2d2b  
    3030#include <rtems.h>
    3131#include <bsp.h>
    32 #include <irq.h>
     32#include <bsp/irq.h>
    3333#include <gba.h>
    3434
Note: See TracChangeset for help on using the changeset viewer.