source: rtems/cpukit/sapi/src/iounregisterdriver.c @ 031b57c

4.104.11
Last change on this file since 031b57c was 031b57c, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 9, 2009 at 1:46:39 PM

2009-10-09 Sebastian Huber <Sebastian.Huber@…>

  • cpukit/sapi/include/rtems/io.h: Documentation.
  • cpukit/sapi/src/ioregisterdriver.c: Call from interrupt context is an error.
  • cpukit/sapi/src/iounregisterdriver.c: Disable preemption during critical section.
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  Input/Output Manager - Dynamically Unregister Device Driver
3 *
4 *  COPYRIGHT (c) 1989-2007.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/system.h>
19#include <rtems/io.h>
20#include <rtems/rtems/intr.h>
21#include <rtems/score/thread.h>
22#include <string.h>
23
24/*
25 *  rtems_io_unregister_driver
26 *
27 *  Unregister a driver from the device driver table.
28 *
29 *  Input Paramters:
30 *    major            - device major number
31 *
32 *  Output Parameters:
33 *    RTEMS_SUCCESSFUL - if successful
34 *    error code       - if unsuccessful
35 */
36
37rtems_status_code rtems_io_unregister_driver(
38  rtems_device_major_number major
39)
40{
41  if ( rtems_interrupt_is_in_progress() )
42    return RTEMS_CALLED_FROM_ISR;
43
44  if ( major < _IO_Number_of_drivers ) {
45    _Thread_Disable_dispatch();
46    memset(
47      &_IO_Driver_address_table[major],
48      0,
49      sizeof( rtems_driver_address_table )
50    );
51    _Thread_Enable_dispatch();
52
53    return RTEMS_SUCCESSFUL;
54  }
55
56  return RTEMS_UNSATISFIED;
57}
Note: See TracBrowser for help on using the repository browser.