The Input/Output (I/O) Manager provides a well-defined mechanism for accessing device drivers and a structured methodology for organizing device drivers.
More...
|
| Kernel Character I/O Support |
| The kernel character input/output support is an extension of the I/O Manager to output characters to the kernel character output device and receive characters from the kernel character input device using a polled and non-blocking implementation.
|
|
|
file | io.h |
| This header file defines the IO Manager API.
|
|
|
rtems_status_code | rtems_io_register_driver (rtems_device_major_number major, const rtems_driver_address_table *driver_table, rtems_device_major_number *registered_major) |
| Registers and initializes the device with the specified device driver address table and device major number in the Device Driver Table.
|
|
rtems_status_code | rtems_io_unregister_driver (rtems_device_major_number major) |
| Removes a device driver specified by the device major number from the Device Driver Table.
|
|
rtems_status_code | rtems_io_initialize (rtems_device_major_number major, rtems_device_minor_number minor, void *argument) |
| Initializes the device specified by the device major and minor numbers.
|
|
rtems_status_code | rtems_io_register_name (const char *device_name, rtems_device_major_number major, rtems_device_minor_number minor) |
| Registers the device specified by the device major and minor numbers in the file system under the specified name.
|
|
rtems_status_code | rtems_io_open (rtems_device_major_number major, rtems_device_minor_number minor, void *argument) |
| Opens the device specified by the device major and minor numbers.
|
|
rtems_status_code | rtems_io_close (rtems_device_major_number major, rtems_device_minor_number minor, void *argument) |
| Closes the device specified by the device major and minor numbers.
|
|
rtems_status_code | rtems_io_read (rtems_device_major_number major, rtems_device_minor_number minor, void *argument) |
| Reads from the device specified by the device major and minor numbers.
|
|
rtems_status_code | rtems_io_write (rtems_device_major_number major, rtems_device_minor_number minor, void *argument) |
| Writes to the device specified by the device major and minor numbers.
|
|
rtems_status_code | rtems_io_control (rtems_device_major_number major, rtems_device_minor_number minor, void *argument) |
| Controls the device specified by the device major and minor numbers.
|
|
The Input/Output (I/O) Manager provides a well-defined mechanism for accessing device drivers and a structured methodology for organizing device drivers.
◆ rtems_device_driver
This type shall be used in device driver entry declarations and definitions.
- Notes
- Device driver entries return an rtems_status_code status code. This type definition helps to document device driver entries in the source code.
◆ rtems_device_major_number
◆ rtems_device_minor_number
This integer type represents the minor number of devices.
- Notes
- The minor number of devices is managed by the device driver.
◆ rtems_io_close()
Closes the device specified by the device major and minor numbers.
- Parameters
-
major | is the major number of the device. |
minor | is the minor number of the device. |
argument | is the argument passed to the device driver close entry. |
This directive calls the device driver close entry registered in the Device Driver Table for the specified device major number.
- Return values
-
- Returns
- Other status codes may be returned by the device driver close entry.
- Notes
- The close entry point is commonly used by device drivers to relinquish exclusive access to a device.
◆ rtems_io_control()
Controls the device specified by the device major and minor numbers.
- Parameters
-
major | is the major number of the device. |
minor | is the minor number of the device. |
argument | is the argument passed to the device driver I/O control entry. |
This directive calls the device driver I/O control entry registered in the Device Driver Table for the specified device major number.
- Return values
-
- Returns
- Other status codes may be returned by the device driver I/O control entry.
- Notes
- The exact functionality of the driver entry called by this directive is driver dependent. It should not be assumed that the control entries of two device drivers are compatible. For example, an RS-232 driver I/O control operation may change the baud of a serial line, while an I/O control operation for a floppy disk driver may cause a seek operation.
◆ rtems_io_initialize()
Initializes the device specified by the device major and minor numbers.
- Parameters
-
major | is the major number of the device. |
minor | is the minor number of the device. |
argument | is the argument passed to the device driver initialization entry. |
This directive calls the device driver initialization entry registered in the Device Driver Table for the specified device major number.
- Return values
-
- Returns
- Other status codes may be returned by the device driver initialization entry.
- Notes
This directive is automatically invoked for each device driver defined by the application configuration during the system initialization and via the rtems_io_register_driver() directive.
A device driver initialization entry is responsible for initializing all hardware and data structures associated with a device. If necessary, it can allocate memory to be used during other operations.
◆ rtems_io_open()
Opens the device specified by the device major and minor numbers.
- Parameters
-
major | is the major number of the device. |
minor | is the minor number of the device. |
argument | is the argument passed to the device driver close entry. |
This directive calls the device driver open entry registered in the Device Driver Table for the specified device major number.
- Return values
-
- Returns
- Other status codes may be returned by the device driver open entry.
- Notes
- The open entry point is commonly used by device drivers to provide exclusive access to a device.
◆ rtems_io_read()
Reads from the device specified by the device major and minor numbers.
- Parameters
-
major | is the major number of the device. |
minor | is the minor number of the device. |
argument | is the argument passed to the device driver read entry. |
This directive calls the device driver read entry registered in the Device Driver Table for the specified device major number.
- Return values
-
- Returns
- Other status codes may be returned by the device driver read entry.
- Notes
- Read operations typically require a buffer address as part of the argument parameter block. The contents of this buffer will be replaced with data from the device.
◆ rtems_io_register_driver()
Registers and initializes the device with the specified device driver address table and device major number in the Device Driver Table.
- Parameters
-
| major | is the device major number. Use a value of zero to let the system obtain a device major number automatically. |
| driver_table | is the device driver address table. |
[out] | registered_major | is the pointer to an rtems_device_major_number object. When the directive call is successful, the device major number of the registered device will be stored in this object. |
- Return values
-
- Returns
- Other status codes may be returned by rtems_io_initialize().
- Notes
If the device major number equals zero a device major number will be obtained. The device major number of the registered driver will be returned.
After a successful registration, the rtems_io_initialize() directive will be called to initialize the device.
◆ rtems_io_register_name()
Registers the device specified by the device major and minor numbers in the file system under the specified name.
- Parameters
-
device_name | is the device name in the file system. |
major | is the device major number. |
minor | is the device minor number. |
- Return values
-
- Notes
- The device is registered as a character device.
◆ rtems_io_unregister_driver()
Removes a device driver specified by the device major number from the Device Driver Table.
- Parameters
-
major | is the major number of the device. |
- Return values
-
- Notes
- Currently no specific checks are made and the driver is not closed.
◆ rtems_io_write()
Writes to the device specified by the device major and minor numbers.
- Parameters
-
major | is the major number of the device. |
minor | is the minor number of the device. |
argument | is the argument passed to the device driver write entry. |
This directive calls the device driver write entry registered in the Device Driver Table for the specified device major number.
- Return values
-
- Returns
- Other status codes may be returned by the device driver write entry.
- Notes
- Write operations typically require a buffer address as part of the argument parameter block. The contents of this buffer will be sent to the device.