source: rtems/cpukit/sapi/src/iounregisterdriver.c @ 599d71f

Last change on this file since 599d71f was c499856, checked in by Chris Johns <chrisj@…>, on Mar 20, 2014 at 9:10:47 PM

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 959 bytes
RevLine 
[4c98a3e]1/**
2 * @file
3 *
4 * @brief Unregister a Driver from the Device Driver Table.
[9c556023]5 *
[4c98a3e]6 * @ingroup ClassicIO
7 */
8
9/*
[9c556023]10 *  COPYRIGHT (c) 1989-2007.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
[c499856]15 *  http://www.rtems.org/license/LICENSE.
[9c556023]16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/io.h>
[031b57c]23#include <rtems/rtems/intr.h>
[0c3edbf]24#include <rtems/score/threaddispatch.h>
25
[9c556023]26#include <string.h>
27
28rtems_status_code rtems_io_unregister_driver(
29  rtems_device_major_number major
30)
31{
[031b57c]32  if ( rtems_interrupt_is_in_progress() )
33    return RTEMS_CALLED_FROM_ISR;
34
[9c556023]35  if ( major < _IO_Number_of_drivers ) {
[031b57c]36    _Thread_Disable_dispatch();
[9c556023]37    memset(
38      &_IO_Driver_address_table[major],
39      0,
40      sizeof( rtems_driver_address_table )
41    );
[031b57c]42    _Thread_Enable_dispatch();
43
[9c556023]44    return RTEMS_SUCCESSFUL;
45  }
[031b57c]46
[9c556023]47  return RTEMS_UNSATISFIED;
48}
Note: See TracBrowser for help on using the repository browser.