The Input/Output (I/O) Manager provides a well-defined mechanism for accessing device drivers and a structured methodology for organizing device drivers.
More...
|
file | io.h |
| This header file defines the IO Manager API.
|
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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.
Device driver entries return an rtems_status_code status code. This type definition helps to document device driver entries in the source code.
Definition at line 109 of file io.h.
◆ rtems_device_major_number
◆ rtems_device_minor_number
This integer type represents the minor number of devices.
The minor number of devices is managed by the device driver.
Definition at line 84 of file io.h.
◆ rtems_io_close()
Closes the device specified by the device major and minor numbers.
This directive calls the device driver close entry registered in the Device Driver Table for the specified device major number.
The close entry point is commonly used by device drivers to relinquish exclusive access to a device.
- 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. |
- Return values
-
- Returns
- Other status codes may be returned by the device driver close entry.
◆ rtems_io_control()
Controls the device specified by the device major and minor numbers.
This directive calls the device driver I/O control entry registered in the Device Driver Table for the specified device major number.
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.
- 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. |
- Return values
-
- Returns
- Other status codes may be returned by the device driver I/O control entry.
◆ rtems_io_initialize()
Initializes the device specified by the device major and minor numbers.
This directive calls the device driver initialization entry registered in the Device Driver Table for the specified device major number.
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.
- 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. |
- Return values
-
- Returns
- Other status codes may be returned by the device driver initialization entry.
◆ rtems_io_open()
Opens the device specified by the device major and minor numbers.
This directive calls the device driver open entry registered in the Device Driver Table for the specified device major number.
The open entry point is commonly used by device drivers to provide exclusive access to a device.
- 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. |
- Return values
-
- Returns
- Other status codes may be returned by the device driver open entry.
◆ rtems_io_read()
Reads from the device specified by the device major and minor numbers.
This directive calls the device driver read entry registered in the Device Driver Table for the specified device major number.
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.
- 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. |
- Return values
-
- Returns
- Other status codes may be returned by the device driver read entry.
◆ 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.
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.
- 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 a device major number variable. The device major number of the registered device will be stored in this variable, in case of a successful operation. |
- Return values
-
- Returns
- Other status codes may be returned by rtems_io_initialize().
◆ rtems_io_register_name()
Registers the device specified by the device major and minor numbers in the file system under the specified name.
The device is registered as a character device.
- 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
-
◆ rtems_io_unregister_driver()
Removes a device driver specified by the device major number from the Device Driver Table.
Currently no specific checks are made and the driver is not closed.
- Parameters
-
major | is the major number of the device. |
- Return values
-
◆ rtems_io_write()
Writes to the device specified by the device major and minor numbers.
This directive calls the device driver write entry registered in the Device Driver Table for the specified device major number.
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.
- 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. |
- Return values
-
- Returns
- Other status codes may be returned by the device driver write entry.