![]() |
|
|||
File indexing completed on 2025-05-11 08:24:32
0001 /* SPDX-License-Identifier: BSD-2-Clause */ 0002 0003 /* test_driver 0004 * 0005 * COPYRIGHT (c) 1989-2010. 0006 * On-Line Applications Research Corporation (OAR). 0007 * 0008 * Redistribution and use in source and binary forms, with or without 0009 * modification, are permitted provided that the following conditions 0010 * are met: 0011 * 1. Redistributions of source code must retain the above copyright 0012 * notice, this list of conditions and the following disclaimer. 0013 * 2. Redistributions in binary form must reproduce the above copyright 0014 * notice, this list of conditions and the following disclaimer in the 0015 * documentation and/or other materials provided with the distribution. 0016 * 0017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 0018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 0019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 0020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 0021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 0022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 0023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 0024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 0025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 0026 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 0027 * POSSIBILITY OF SUCH DAMAGE. 0028 */ 0029 0030 #ifdef HAVE_CONFIG_H 0031 #include "config.h" 0032 #endif 0033 0034 #include <rtems.h> 0035 #include "test_driver.h" 0036 #include <rtems/libio.h> 0037 #include <rtems/devnull.h> 0038 /* 0039 * The test driver routines are mostly derived from the null driver routines. 0040 */ 0041 uint32_t TEST_major; 0042 static char initialized; 0043 0044 /* testDriver_initialize 0045 * 0046 * This routine is the test device driver init routine. 0047 * 0048 * Input parameters: 0049 * major - device major number 0050 * minor - device minor number 0051 * pargp - pointer to parameter block 0052 * 0053 * Output parameters: 0054 * rval - RTEMS_SUCCESSFUL 0055 */ 0056 rtems_device_driver testDriver_initialize( 0057 rtems_device_major_number major, 0058 rtems_device_minor_number minor RTEMS_UNUSED, 0059 void *pargp RTEMS_UNUSED 0060 ) 0061 { 0062 rtems_device_driver status; 0063 0064 if ( !initialized ) { 0065 initialized = 1; 0066 0067 status = rtems_io_register_name( 0068 "/dev/test", 0069 major, 0070 (rtems_device_minor_number) 0 0071 ); 0072 0073 if (status != RTEMS_SUCCESSFUL) 0074 rtems_fatal_error_occurred(status); 0075 0076 TEST_major = major; 0077 } 0078 0079 return RTEMS_SUCCESSFUL; 0080 } 0081 0082 /* testDriver_open 0083 * 0084 * This routine is the test device driver open routine. 0085 * 0086 * Input parameters: 0087 * major - device major number 0088 * minor - device minor number 0089 * pargb - pointer to open parameter block 0090 * 0091 * Output parameters: 0092 * rval - RTEMS_SUCCESSFUL 0093 */ 0094 rtems_device_driver testDriver_open( 0095 rtems_device_major_number major RTEMS_UNUSED, 0096 rtems_device_minor_number minor RTEMS_UNUSED, 0097 void *pargp RTEMS_UNUSED 0098 ) 0099 { 0100 return RTEMS_SUCCESSFUL; 0101 } 0102 0103 /* testDriver_close 0104 * 0105 * This routine is the test device driver close routine. 0106 * 0107 * Input parameters: 0108 * major - device major number 0109 * minor - device minor number 0110 * pargb - pointer to close parameter block 0111 * 0112 * Output parameters: 0113 * rval - RTEMS_SUCCESSFUL 0114 */ 0115 rtems_device_driver testDriver_close( 0116 rtems_device_major_number major RTEMS_UNUSED, 0117 rtems_device_minor_number minor RTEMS_UNUSED, 0118 void *pargp RTEMS_UNUSED 0119 ) 0120 { 0121 return RTEMS_SUCCESSFUL; 0122 } 0123 0124 /* testDriver_read 0125 * 0126 * This routine is the test device driver read routine. 0127 * 0128 * Input parameters: 0129 * major - device major number 0130 * minor - device minor number 0131 * pargp - pointer to read parameter block 0132 * 0133 * Output parameters: 0134 * rval - RTEMS_SUCCESSFUL 0135 */ 0136 rtems_device_driver testDriver_read( 0137 rtems_device_major_number major RTEMS_UNUSED, 0138 rtems_device_minor_number minor RTEMS_UNUSED, 0139 void *pargp 0140 ) 0141 { 0142 rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp; 0143 0144 if ( rw_args ) { 0145 if( rw_args->count == 5 ) 0146 rw_args->bytes_moved = 0; 0147 else { 0148 rw_args->bytes_moved = 0; 0149 return RTEMS_NOT_IMPLEMENTED; 0150 } 0151 } 0152 0153 return RTEMS_SUCCESSFUL; 0154 } 0155 0156 /* testDriver_write 0157 * 0158 * This routine is the test device driver write routine. 0159 * 0160 * Input parameters: 0161 * major - device major number 0162 * minor - device minor number 0163 * pargp - pointer to write parameter block 0164 * 0165 * Output parameters: 0166 * rval - RTEMS_SUCCESSFUL 0167 */ 0168 rtems_device_driver testDriver_write( 0169 rtems_device_major_number major RTEMS_UNUSED, 0170 rtems_device_minor_number minor RTEMS_UNUSED, 0171 void *pargp 0172 ) 0173 { 0174 rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp; 0175 0176 if ( rw_args ) { 0177 if( rw_args->count == 5 ) 0178 return null_write( 0, 0, pargp ); 0179 else { 0180 rw_args->bytes_moved = 0; 0181 return RTEMS_NOT_IMPLEMENTED; 0182 } 0183 } 0184 0185 return RTEMS_SUCCESSFUL; 0186 } 0187 0188 /* testDriver_control 0189 * 0190 * This routine is the test device driver control routine. 0191 * 0192 * Input parameters: 0193 * major - device major number 0194 * minor - device minor number 0195 * pargp - pointer to cntrl parameter block 0196 * 0197 * Output parameters: 0198 * rval - RTEMS_SUCCESSFUL 0199 */ 0200 0201 rtems_device_driver testDriver_control( 0202 rtems_device_major_number major RTEMS_UNUSED, 0203 rtems_device_minor_number minor RTEMS_UNUSED, 0204 void *pargp RTEMS_UNUSED 0205 ) 0206 { 0207 return RTEMS_NOT_IMPLEMENTED; 0208 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |