RTEMS 6.1-rc4
Loading...
Searching...
No Matches
Modules | Files | Data Structures | Typedefs | Functions
I/O Manager

The Input/Output (I/O) Manager provides a well-defined mechanism for accessing device drivers and a structured methodology for organizing device drivers. More...

Modules

 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.
 

Files

file  io.h
 This header file defines the IO Manager API.
 

Data Structures

struct  rtems_driver_address_table
 This structure contains the device driver entries. More...
 

Typedefs

typedef rtems_status_code rtems_device_driver
 This type shall be used in device driver entry declarations and definitions.
 
typedef uint32_t rtems_device_major_number
 This integer type represents the major number of devices.
 
typedef uint32_t rtems_device_minor_number
 This integer type represents the minor number of devices.
 
typedef rtems_device_driver(* rtems_device_driver_entry) (rtems_device_major_number, rtems_device_minor_number, void *)
 Device driver entries shall have this type.
 

Functions

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.
 

Detailed Description

The Input/Output (I/O) Manager provides a well-defined mechanism for accessing device drivers and a structured methodology for organizing device drivers.

Typedef Documentation

◆ 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

typedef uint32_t rtems_device_major_number

This integer type represents the major number of devices.

Notes
The major number of a device is determined by rtems_io_register_driver() and the application configuration (see CONFIGURE_MAXIMUM_DRIVERS) .

◆ rtems_device_minor_number

typedef uint32_t 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.

Function Documentation

◆ rtems_io_close()

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.

Parameters
majoris the major number of the device.
minoris the minor number of the device.
argumentis 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
RTEMS_SUCCESSFULThe requested operation was successful.
RTEMS_INVALID_NUMBERThe device major number was invalid.
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()

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.

Parameters
majoris the major number of the device.
minoris the minor number of the device.
argumentis 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
RTEMS_SUCCESSFULThe requested operation was successful.
RTEMS_INVALID_NUMBERThe device major number was invalid.
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()

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.

Parameters
majoris the major number of the device.
minoris the minor number of the device.
argumentis 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
RTEMS_SUCCESSFULThe requested operation was successful.
RTEMS_INVALID_NUMBERThe device major number was invalid.
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()

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.

Parameters
majoris the major number of the device.
minoris the minor number of the device.
argumentis 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
RTEMS_SUCCESSFULThe requested operation was successful.
RTEMS_INVALID_NUMBERThe device major number was invalid.
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()

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.

Parameters
majoris the major number of the device.
minoris the minor number of the device.
argumentis 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
RTEMS_SUCCESSFULThe requested operation was successful.
RTEMS_INVALID_NUMBERThe device major number was invalid.
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()

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.

Parameters
majoris the device major number. Use a value of zero to let the system obtain a device major number automatically.
driver_tableis the device driver address table.
[out]registered_majoris 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
RTEMS_SUCCESSFULThe requested operation was successful.
RTEMS_INVALID_ADDRESSThe device major number of the device was NULL.
RTEMS_INVALID_ADDRESSThe device driver address table was empty.
RTEMS_INVALID_NUMBERThe device major number of the device was out of range, see CONFIGURE_MAXIMUM_DRIVERS.
RTEMS_TOO_MANYThe system was unable to obtain a device major number.
RTEMS_RESOURCE_IN_USEThe device major number was already in use.
RTEMS_CALLED_FROM_ISRThe directive was called from interrupt context.
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()

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.

Parameters
device_nameis the device name in the file system.
majoris the device major number.
minoris the device minor number.
Return values
RTEMS_SUCCESSFULThe requested operation was successful.
RTEMS_TOO_MANYThe name was already in use or other errors occurred.
Notes
The device is registered as a character device.

◆ rtems_io_unregister_driver()

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.

Parameters
majoris the major number of the device.
Return values
RTEMS_SUCCESSFULThe requested operation was successful.
RTEMS_UNSATISFIEDThe device major number was invalid.
RTEMS_CALLED_FROM_ISRThe directive was called from interrupt context.
Notes
Currently no specific checks are made and the driver is not closed.

◆ rtems_io_write()

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.

Parameters
majoris the major number of the device.
minoris the minor number of the device.
argumentis 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
RTEMS_SUCCESSFULThe requested operation was successful.
RTEMS_INVALID_NUMBERThe device major number was invalid.
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.