Changeset 5fca9ef in rtems


Ignore:
Timestamp:
Mar 5, 2015, 1:54:09 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
da06fe9
Parents:
f3a57820
Message:

bsps: Use interrupt lock for interrupt server

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/shared/src/irq-server.c

    rf3a57820 r5fca9ef  
    88
    99/*
    10  * Copyright (c) 2009, 2010
    11  * embedded brains GmbH
    12  * Obere Lagerstr. 30
    13  * D-82178 Puchheim
    14  * Germany
    15  * <rtems@embedded-brains.de>
     10 * Copyright (c) 2009, 2015 embedded brains GmbH.  All rights reserved.
     11 *
     12 *  embedded brains GmbH
     13 *  Dornierstr. 4
     14 *  82178 Puchheim
     15 *  Germany
     16 *  <rtems@embedded-brains.de>
    1617 *
    1718 * The license and distribution terms for this file may be
     
    2829
    2930#define BSP_INTERRUPT_EVENT RTEMS_EVENT_13
     31
     32RTEMS_INTERRUPT_LOCK_DEFINE(
     33  static,
     34  bsp_interrupt_server_lock,
     35  "Interrupt Server"
     36)
    3037
    3138typedef struct bsp_interrupt_server_entry {
     
    5865
    5966  if (e->node.next == NULL) {
    60     rtems_chain_append(&bsp_interrupt_server_chain, &e->node);
     67    rtems_interrupt_lock_context lock_context;
     68
     69    rtems_interrupt_lock_acquire(&bsp_interrupt_server_lock, &lock_context);
     70    rtems_chain_append_unprotected(&bsp_interrupt_server_chain, &e->node);
     71    rtems_interrupt_lock_release(&bsp_interrupt_server_lock, &lock_context);
    6172  } else {
    6273    ++bsp_interrupt_server_errors;
     
    6879static bsp_interrupt_server_entry *bsp_interrupt_server_get_entry(void)
    6980{
    70   rtems_interrupt_level level;
     81  rtems_interrupt_lock_context lock_context;
    7182  bsp_interrupt_server_entry *e;
    7283
    73   rtems_interrupt_disable(level);
     84  rtems_interrupt_lock_acquire(&bsp_interrupt_server_lock, &lock_context);
     85
    7486  e = (bsp_interrupt_server_entry *)
    7587    rtems_chain_get_unprotected(&bsp_interrupt_server_chain);
     
    7789    e->node.next = NULL;
    7890  }
    79   rtems_interrupt_enable(level);
     91
     92  rtems_interrupt_lock_release(&bsp_interrupt_server_lock, &lock_context);
    8093
    8194  return e;
Note: See TracChangeset for help on using the changeset viewer.