Changeset bd0fb473 in rtems


Ignore:
Timestamp:
Mar 24, 2012, 9:53:07 PM (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
a73884e
Parents:
0f31fddc
git-author:
Sebastian Huber <sebastian.huber@…> (03/24/12 21:53:07)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/24/12 22:00:08)
Message:

bsps: Shared ARMv7-M interrupt support

Location:
c/src/lib/libbsp/arm
Files:
3 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/lm3s69xx/Makefile.am

    r0f31fddc rbd0fb473  
    4343include_bsp_HEADERS += ../../shared/tod.h
    4444include_bsp_HEADERS += ../shared/include/start.h
     45include_bsp_HEADERS += ../shared/armv7m/include/armv7m-irq.h
    4546include_bsp_HEADERS += include/irq.h
    4647include_bsp_HEADERS += include/uart.h
     
    8384libbsp_a_SOURCES += ../../shared/src/irq-server.c
    8485libbsp_a_SOURCES += ../../shared/src/irq-shell.c
    85 libbsp_a_SOURCES += irq/irq.c
     86libbsp_a_SOURCES += ../shared/armv7m/irq/armv7m-irq.c
     87libbsp_a_SOURCES += ../shared/armv7m/irq/armv7m-irq-dispatch.c
    8688
    8789# Console
  • c/src/lib/libbsp/arm/lm3s69xx/preinstall.am

    r0f31fddc rbd0fb473  
    9090PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/start.h
    9191
     92$(PROJECT_INCLUDE)/bsp/armv7m-irq.h: ../shared/armv7m/include/armv7m-irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     93        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/armv7m-irq.h
     94PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/armv7m-irq.h
     95
    9296$(PROJECT_INCLUDE)/bsp/irq.h: include/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
    9397        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
  • c/src/lib/libbsp/arm/lpc24xx/Makefile.am

    r0f31fddc rbd0fb473  
    4040include_bsp_HEADERS += ../shared/lpc/include/lpc-dma.h
    4141include_bsp_HEADERS += ../shared/lpc/include/lpc-lcd.h
     42include_bsp_HEADERS += ../shared/armv7m/include/armv7m-irq.h
    4243include_bsp_HEADERS += include/dma.h
    4344include_bsp_HEADERS += include/i2c.h
     
    113114libbsp_a_SOURCES += ../../shared/src/irq-server.c
    114115libbsp_a_SOURCES += ../../shared/src/irq-shell.c
     116libbsp_a_SOURCES += ../shared/armv7m/irq/armv7m-irq.c
     117libbsp_a_SOURCES += ../shared/armv7m/irq/armv7m-irq-dispatch.c
    115118libbsp_a_SOURCES += irq/irq.c
    116119libbsp_a_SOURCES += irq/irq-dispatch.c
  • c/src/lib/libbsp/arm/lpc24xx/include/irq.h

    r0f31fddc rbd0fb473  
    134134unsigned lpc24xx_irq_get_priority(rtems_vector_number vector);
    135135
    136 void bsp_interrupt_dispatch(void);
    137 
    138136#endif /* ASM */
    139137
  • c/src/lib/libbsp/arm/lpc24xx/irq/irq-dispatch.c

    r0f31fddc rbd0fb473  
    2121 */
    2222
    23 #include <rtems/score/armv7m.h>
    24 
    2523#include <bsp.h>
    2624#include <bsp/irq.h>
     
    2826#include <bsp/lpc24xx.h>
    2927
     28#ifdef ARM_MULTILIB_ARCH_V4
     29
    3030void bsp_interrupt_dispatch(void)
    3131{
    32   #ifdef ARM_MULTILIB_ARCH_V4
    33     /* Read current vector number */
    34     rtems_vector_number vector = VICVectAddr;
     32  /* Read current vector number */
     33  rtems_vector_number vector = VICVectAddr;
    3534
    36     /* Enable interrupts in program status register */
    37     uint32_t psr = arm_status_irq_enable();
     35  /* Enable interrupts in program status register */
     36  uint32_t psr = arm_status_irq_enable();
    3837
    39     /* Dispatch interrupt handlers */
    40     bsp_interrupt_handler_dispatch(vector);
     38  /* Dispatch interrupt handlers */
     39  bsp_interrupt_handler_dispatch(vector);
    4140
    42     /* Restore program status register */
    43     arm_status_restore(psr);
     41  /* Restore program status register */
     42  arm_status_restore(psr);
    4443
    45     /* Acknowledge interrupt */
    46     VICVectAddr = 0;
    47   #else
    48     rtems_vector_number vector =
    49       ARMV7M_SCB_ICSR_VECTACTIVE_GET(_ARMV7M_SCB->icsr);
     44  /* Acknowledge interrupt */
     45  VICVectAddr = 0;
     46}
    5047
    51     _ARMV7M_Interrupt_service_enter();
    52     bsp_interrupt_handler_dispatch(ARMV7M_IRQ_OF_VECTOR(vector));
    53     _ARMV7M_Interrupt_service_leave();
    54   #endif
    55 }
     48#endif /* ARM_MULTILIB_ARCH_V4 */
  • c/src/lib/libbsp/arm/lpc24xx/irq/irq.c

    r0f31fddc rbd0fb473  
    6262}
    6363
     64#ifdef ARM_MULTILIB_ARCH_V4
     65
    6466rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
    6567{
    66   #ifdef ARM_MULTILIB_ARCH_V4
    67     VICIntEnable = 1U << vector;
    68   #else
    69     _ARMV7M_NVIC_Set_enable((int) vector);
    70   #endif
     68  VICIntEnable = 1U << vector;
    7169
    7270  return RTEMS_SUCCESSFUL;
     
    7573rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
    7674{
    77   #ifdef ARM_MULTILIB_ARCH_V4
    78     VICIntEnClear = 1U << vector;
    79   #else
    80     _ARMV7M_NVIC_Clear_enable((int) vector);
    81   #endif
     75  VICIntEnClear = 1U << vector;
    8276
    8377  return RTEMS_SUCCESSFUL;
     
    8680rtems_status_code bsp_interrupt_facility_initialize(void)
    8781{
    88   #ifdef ARM_MULTILIB_ARCH_V4
    89     volatile uint32_t *addr = VICVectAddrBase;
    90     volatile uint32_t *prio = VICVectPriorityBase;
    91     rtems_vector_number i = 0;
     82  volatile uint32_t *addr = VICVectAddrBase;
     83  volatile uint32_t *prio = VICVectPriorityBase;
     84  rtems_vector_number i = 0;
    9285
    93     /* Disable all interrupts */
    94     VICIntEnClear = 0xffffffff;
     86  /* Disable all interrupts */
     87  VICIntEnClear = 0xffffffff;
    9588
    96     /* Clear all software interrupts */
    97     VICSoftIntClear = 0xffffffff;
     89  /* Clear all software interrupts */
     90  VICSoftIntClear = 0xffffffff;
    9891
    99     /* Use IRQ category */
    100     VICIntSelect = 0;
     92  /* Use IRQ category */
     93  VICIntSelect = 0;
    10194
    102     for (i = BSP_INTERRUPT_VECTOR_MIN; i <= BSP_INTERRUPT_VECTOR_MAX; ++i) {
    103       /* Use the vector address register to store the vector number */
    104       addr [i] = i;
     95  for (i = BSP_INTERRUPT_VECTOR_MIN; i <= BSP_INTERRUPT_VECTOR_MAX; ++i) {
     96    /* Use the vector address register to store the vector number */
     97    addr [i] = i;
    10598
    106       /* Give vector lowest priority */
    107       prio [i] = 15;
    108     }
     99    /* Give vector lowest priority */
     100    prio [i] = 15;
     101  }
    109102
    110     /* Reset priority mask register */
    111     VICSWPrioMask = 0xffff;
     103  /* Reset priority mask register */
     104  VICSWPrioMask = 0xffff;
    112105
    113     /* Acknowledge interrupts for all priorities */
    114     for (
    115       i = LPC24XX_IRQ_PRIORITY_VALUE_MIN;
    116       i <= LPC24XX_IRQ_PRIORITY_VALUE_MAX;
    117       ++i
    118     ) {
    119       VICVectAddr = 0;
    120     }
     106  /* Acknowledge interrupts for all priorities */
     107  for (
     108    i = LPC24XX_IRQ_PRIORITY_VALUE_MIN;
     109    i <= LPC24XX_IRQ_PRIORITY_VALUE_MAX;
     110    ++i
     111  ) {
     112    VICVectAddr = 0;
     113  }
    121114
    122     /* Install the IRQ exception handler */
    123     _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
    124   #else
    125     rtems_vector_number i = 0;
    126     ARMV7M_Exception_handler *vector_table =
    127       (ARMV7M_Exception_handler *) bsp_vector_table_begin;
    128 
    129     memcpy(
    130       vector_table,
    131       bsp_start_vector_table_begin,
    132       (size_t) bsp_vector_table_size
    133     );
    134 
    135     for (i = BSP_INTERRUPT_VECTOR_MIN; i <= BSP_INTERRUPT_VECTOR_MAX; ++i) {
    136       vector_table [ARMV7M_VECTOR_IRQ(i)] = bsp_interrupt_dispatch;
    137       _ARMV7M_NVIC_Clear_enable(i);
    138       _ARMV7M_NVIC_Clear_pending(i);
    139       lpc24xx_irq_set_priority(i, LPC24XX_IRQ_PRIORITY_VALUE_MAX - 1);
    140     }
    141 
    142     _ARMV7M_SCB->vtor = vector_table;
    143   #endif
     115  /* Install the IRQ exception handler */
     116  _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, arm_exc_interrupt, NULL);
    144117
    145118  return RTEMS_SUCCESSFUL;
    146119}
     120
     121#endif /* ARM_MULTILIB_ARCH_V4 */
  • c/src/lib/libbsp/arm/lpc24xx/preinstall.am

    r0f31fddc rbd0fb473  
    102102PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/lpc-lcd.h
    103103
     104$(PROJECT_INCLUDE)/bsp/armv7m-irq.h: ../shared/armv7m/include/armv7m-irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     105        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/armv7m-irq.h
     106PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/armv7m-irq.h
     107
    104108$(PROJECT_INCLUDE)/bsp/dma.h: include/dma.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
    105109        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/dma.h
Note: See TracChangeset for help on using the changeset viewer.