OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [c/] [src/] [libmisc/] [devnull/] [devnull.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*  /dev/null
2
 *
3
 *  Derived from rtems' stub driver.
4
 *
5
 *  Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
6
 *
7
 *  COPYRIGHT (c) 1989-2000.
8
 *  On-Line Applications Research Corporation (OAR).
9
 *
10
 *  The license and distribution terms for this file may be
11
 *  found in the file LICENSE in this distribution or at
12
 *  http://www.OARcorp.com/rtems/license.html.
13
 *
14
 *  devnull.c,v 1.3 2001/09/13 21:04:49 joel Exp
15
 */
16
 
17
#include <rtems.h>
18
#include <rtems/devnull.h>
19
#include <rtems/libio.h>
20
 
21
/*  null_initialize
22
 *
23
 *  This routine is the null device driver init routine.
24
 *
25
 *  Input parameters:
26
 *    major - device major number
27
 *    minor - device minor number
28
 *    pargp - pointer to parameter block
29
 *
30
 *  Output parameters:
31
 *    rval       - NULL_SUCCESSFUL
32
 */
33
 
34
rtems_unsigned32 NULL_major;
35
static char initialized;
36
 
37
rtems_device_driver null_initialize(
38
  rtems_device_major_number major,
39
  rtems_device_minor_number minor,
40
  void *pargp
41
)
42
{
43
  rtems_device_driver status;
44
 
45
  if ( !initialized ) {
46
    initialized = 1;
47
 
48
    status = rtems_io_register_name(
49
      "/dev/null",
50
      major,
51
      (rtems_device_minor_number) 0
52
    );
53
 
54
    if (status != RTEMS_SUCCESSFUL)
55
      rtems_fatal_error_occurred(status);
56
 
57
    NULL_major = major;
58
  }
59
 
60
  return RTEMS_SUCCESSFUL;
61
}
62
 
63
/*  null_open
64
 *
65
 *  This routine is the null device driver open routine.
66
 *
67
 *  Input parameters:
68
 *    major - device major number
69
 *    minor - device minor number
70
 *    pargb - pointer to open parameter block
71
 *
72
 *  Output parameters:
73
 *    rval       - NULL_SUCCESSFUL
74
 */
75
 
76
rtems_device_driver null_open(
77
  rtems_device_major_number major,
78
  rtems_device_minor_number minor,
79
  void *pargp
80
)
81
{
82
  return NULL_SUCCESSFUL;
83
}
84
 
85
 
86
/*  null_close
87
 *
88
 *  This routine is the null device driver close routine.
89
 *
90
 *  Input parameters:
91
 *    major - device major number
92
 *    minor - device minor number
93
 *    pargb - pointer to close parameter block
94
 *
95
 *  Output parameters:
96
 *    rval       - NULL_SUCCESSFUL
97
 */
98
 
99
rtems_device_driver null_close(
100
  rtems_device_major_number major,
101
  rtems_device_minor_number minor,
102
  void *pargp
103
)
104
{
105
  return NULL_SUCCESSFUL;
106
}
107
 
108
 
109
/*  null_read
110
 *
111
 *  This routine is the null device driver read routine.
112
 *
113
 *  Input parameters:
114
 *    major - device major number
115
 *    minor - device minor number
116
 *    pargp - pointer to read parameter block
117
 *
118
 *  Output parameters:
119
 *    rval       - NULL_SUCCESSFUL
120
 */
121
 
122
rtems_device_driver null_read(
123
  rtems_device_major_number major,
124
  rtems_device_minor_number minor,
125
  void *pargp
126
)
127
{
128
  return NULL_SUCCESSFUL;
129
}
130
 
131
 
132
/*  null_write
133
 *
134
 *  This routine is the null device driver write routine.
135
 *
136
 *  Input parameters:
137
 *    major - device major number
138
 *    minor - device minor number
139
 *    pargp - pointer to write parameter block
140
 *
141
 *  Output parameters:
142
 *    rval       - NULL_SUCCESSFUL
143
 */
144
 
145
rtems_device_driver null_write(
146
  rtems_device_major_number major,
147
  rtems_device_minor_number minor,
148
  void *pargp
149
)
150
{
151
  rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp;
152
 
153
  if ( rw_args )
154
    rw_args->bytes_moved = rw_args->count;
155
 
156
  return NULL_SUCCESSFUL;
157
}
158
 
159
 
160
/*  null_control
161
 *
162
 *  This routine is the null device driver control routine.
163
 *
164
 *  Input parameters:
165
 *    major - device major number
166
 *    minor - device minor number
167
 *    pargp - pointer to cntrl parameter block
168
 *
169
 *  Output parameters:
170
 *    rval       - NULL_SUCCESSFUL
171
 */
172
 
173
rtems_device_driver null_control(
174
  rtems_device_major_number major,
175
  rtems_device_minor_number minor,
176
  void *pargp
177
)
178
{
179
  return NULL_SUCCESSFUL;
180
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.