Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:13

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  * 
0006  * @brief Console Driver for all Boards
0007  *
0008  * This file describes the Console Device Driver for all boards.
0009  * This driver provides support for the standard C Library.
0010  */
0011 
0012 /*
0013  *  COPYRIGHT (c) 1989-2011.
0014  *  On-Line Applications Research Corporation (OAR).
0015  *
0016  * Redistribution and use in source and binary forms, with or without
0017  * modification, are permitted provided that the following conditions
0018  * are met:
0019  * 1. Redistributions of source code must retain the above copyright
0020  *    notice, this list of conditions and the following disclaimer.
0021  * 2. Redistributions in binary form must reproduce the above copyright
0022  *    notice, this list of conditions and the following disclaimer in the
0023  *    documentation and/or other materials provided with the distribution.
0024  *
0025  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0026  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0027  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0028  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0029  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0030  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0031  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0032  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0033  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0034  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0035  * POSSIBILITY OF SUCH DAMAGE.
0036  */
0037 
0038 #ifndef _RTEMS_CONSOLE_H
0039 #define _RTEMS_CONSOLE_H
0040 
0041 #include <rtems/io.h> /* rtems_device_driver */
0042 
0043 #ifdef __cplusplus
0044 extern "C" {
0045 #endif
0046 
0047 /**
0048  * This macro defines the standard name for the console device
0049  * that is available to applications.
0050  */
0051 #define CONSOLE_DEVICE_NAME "/dev/console"
0052 
0053 /**
0054  * This macro defines the standard device driver table entry for
0055  * a console device driver.
0056  */
0057 #define CONSOLE_DRIVER_TABLE_ENTRY \
0058   { console_initialize, console_open, console_close, \
0059     console_read, console_write, console_control }
0060 
0061 /**
0062  * @brief Console initialization entry point.
0063  *
0064  * This method initializes the console device driver.
0065  *
0066  * @param[in] major is the device driver major number.
0067  * @param[in] minor is the device driver minor number.
0068  * @param[in] arg is the parameters to this call.
0069  *
0070  * @retval RTEMS_SUCCESSFUL The device driver is successfully initialized.
0071  */
0072 rtems_device_driver console_initialize(
0073   rtems_device_major_number  major,
0074   rtems_device_minor_number  minor,
0075   void                      *arg
0076 );
0077 
0078 /**
0079  * @brief Console open entry point.
0080  *
0081  * This method opens a specific device supported by the
0082  * console device driver.
0083  *
0084  * @param[in] major is the device driver major number
0085  * @param[in] minor is the device driver minor number
0086  * @param[in] arg is the parameters to this call
0087  *
0088  * @retval RTEMS_SUCCESSFUL The device driver is successfully opened.
0089  */
0090 rtems_device_driver console_open(
0091   rtems_device_major_number  major,
0092   rtems_device_minor_number  minor,
0093   void                      *arg
0094 );
0095 
0096 /**
0097  * @brief Console close entry point.
0098  *
0099  * This method closes a specific device supported by the
0100  * console device driver.
0101  *
0102  * @param[in] major is the device driver major number
0103  * @param[in] minor is the device driver minor number
0104  * @param[in] arg is the parameters to this call
0105  *
0106  * @retval RTEMS_SUCCESSFUL The device driver is successfully closed.
0107  */
0108 rtems_device_driver console_close(
0109   rtems_device_major_number  major,
0110   rtems_device_minor_number  minor,
0111   void                      *arg
0112 );
0113 
0114 /**
0115  * @brief Console read entry point.
0116  *
0117  * This method reads from a specific device supported by the
0118  * console device driver.
0119  *
0120  * @param[in] major is the device driver major number
0121  * @param[in] minor is the device driver minor number
0122  * @param[in] arg is the parameters to this call
0123  *
0124  * @retval RTEMS_SUCCESSFUL The device is successfully read from.
0125  */
0126 rtems_device_driver console_read(
0127   rtems_device_major_number  major,
0128   rtems_device_minor_number  minor,
0129   void                      *arg
0130 );
0131 
0132 /**
0133  * @brief Console write entry point.
0134  *
0135  * This method writes to a specific device supported by the
0136  * console device driver.
0137  *
0138  * @param[in] major is the device driver major number
0139  * @param[in] minor is the device driver minor number
0140  * @param[in] arg is the parameters to this call
0141  *
0142  * @retval RTEMS_SUCCESSFUL The device is successfully written.
0143  */
0144 rtems_device_driver console_write(
0145   rtems_device_major_number  major,
0146   rtems_device_minor_number  minor,
0147   void                      *arg
0148 );
0149 
0150 /**
0151  * @brief Console IO control entry point.
0152  *
0153  * This method performs an IO Control operation on a
0154  * specific device supported by the console device driver.
0155  *
0156  * @param[in] major is the device driver major number
0157  * @param[in] minor is the device driver minor number
0158  * @param[in] arg is the parameters to this call
0159  * 
0160  * @retval RTEMS_SUCCESSFUL the device driver IO control operation is
0161  *         successfully performed.
0162  */
0163 rtems_device_driver console_control(
0164   rtems_device_major_number  major,
0165   rtems_device_minor_number  minor,
0166   void                      *arg
0167 );
0168 
0169 /**
0170  * @brief Initializes a simple console device.
0171  *
0172  * See CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER documentation in the
0173  * "RTEMS Classic API Guide".
0174  */
0175 void _Console_simple_Initialize( void );
0176 
0177 /**
0178  * @brief Initializes a simple task console device.
0179  *
0180  * See CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER documentation in
0181  * the "RTEMS Classic API Guide".
0182  */
0183 void _Console_simple_task_Initialize( void );
0184 
0185 #ifdef __cplusplus
0186 }
0187 #endif
0188 
0189 #endif
0190 /* end of include file */