Changeset ccc87c8b in rtems


Ignore:
Timestamp:
Jul 11, 2017, 9:20:06 AM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
af207fa9
Parents:
d184140
git-author:
Sebastian Huber <sebastian.huber@…> (07/11/17 09:20:06)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/12/17 05:46:55)
Message:

Add interrupt server move

Update #3071.

Files:
2 edited

Legend:

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

    rd184140 rccc87c8b  
    695695}
    696696
     697static void bsp_interrupt_server_handler_move_helper(void *arg)
     698{
     699  bsp_interrupt_server_helper_data *hd = arg;
     700  bsp_interrupt_server_handler_iterate_helper_data *hihd = hd->arg;
     701  rtems_interrupt_server_entry *e;
     702  rtems_option trigger_options;
     703
     704  bsp_interrupt_lock();
     705
     706  e = bsp_interrupt_server_query_entry(hd->vector, &trigger_options);
     707  if (e != NULL) {
     708    rtems_interrupt_lock_context lock_context;
     709    bsp_interrupt_server_context *src = e->server;
     710    bsp_interrupt_server_context *dst = hihd->arg;
     711    bool pending;
     712
     713    rtems_interrupt_lock_acquire(&src->lock, &lock_context);
     714
     715    pending = !rtems_chain_is_node_off_chain(&e->node);
     716    if (pending) {
     717      rtems_chain_extract_unprotected(&e->node);
     718      rtems_chain_set_off_chain(&e->node);
     719    }
     720
     721    rtems_interrupt_lock_release(&src->lock, &lock_context);
     722
     723    e->server = dst;
     724
     725    if (pending) {
     726      bsp_interrupt_server_trigger(e);
     727    }
     728  }
     729
     730  bsp_interrupt_unlock();
     731
     732  rtems_event_transient_send(hd->task);
     733}
     734
     735rtems_status_code rtems_interrupt_server_move(
     736  uint32_t source_server_index,
     737  rtems_vector_number vector,
     738  uint32_t destination_server_index
     739)
     740{
     741  rtems_status_code sc;
     742  bsp_interrupt_server_context *src;
     743  bsp_interrupt_server_context *dst;
     744  bsp_interrupt_server_handler_iterate_helper_data hihd;
     745
     746  src = bsp_interrupt_server_get_context(source_server_index, &sc);
     747  if (src == NULL) {
     748    return sc;
     749  }
     750
     751  dst = bsp_interrupt_server_get_context(destination_server_index, &sc);
     752  if (dst == NULL) {
     753    return sc;
     754  }
     755
     756  if (!bsp_interrupt_is_valid_vector(vector)) {
     757    return RTEMS_INVALID_ID;
     758  }
     759
     760  hihd.arg = dst;
     761  bsp_interrupt_server_call_helper(
     762    src,
     763    vector,
     764    0,
     765    NULL,
     766    &hihd,
     767    bsp_interrupt_server_handler_move_helper
     768  );
     769  return RTEMS_SUCCESSFUL;
     770}
     771
    697772static void bsp_interrupt_server_entry_suspend_helper(void *arg)
    698773{
  • cpukit/include/rtems/irq-extension.h

    rd184140 rccc87c8b  
    363363
    364364/**
     365 * @brief Moves the interrupt handlers installed on the specified source
     366 * interrupt server to the destination interrupt server.
     367 *
     368 * This function must be called from thread context.  It may block.  Calling
     369 * this function within the context of an interrupt server is undefined
     370 * behaviour.
     371 *
     372 * @param[in] source_server_index The source interrupt server index.  Use
     373 *   @c RTEMS_INTERRUPT_SERVER_DEFAULT to specify the default server.
     374 * @param[in] vector The interrupt vector number.
     375 * @param[in] destination_server_index The destination interrupt server index.
     376 *   Use @c RTEMS_INTERRUPT_SERVER_DEFAULT to specify the default server.
     377 *
     378 * @retval RTEMS_SUCCESSFUL Successful operation
     379 * @retval RTEMS_INCORRECT_STATE The interrupt servers are not initialized.
     380 * @retval RTEMS_INVALID_ID The destination interrupt server index is invalid.
     381 * @retval RTEMS_INVALID_ID The vector number is invalid.
     382 * @retval RTEMS_INVALID_ID The destination interrupt server index is invalid.
     383 */
     384rtems_status_code rtems_interrupt_server_move(
     385  uint32_t            source_server_index,
     386  rtems_vector_number vector,
     387  uint32_t            destination_server_index
     388);
     389
     390/**
    365391 * @brief Suspends the specified interrupt server.
    366392 *
Note: See TracChangeset for help on using the changeset viewer.