Writing Device Drivers

Console Visual I/O Interfaces

The kernel terminal emulator interacts with the console frame buffer driver through two interfaces. During normal system activity (after a successful boot of the system), communication between the kernel terminal emulator and the console frame buffer driver is through ioctl interfaces. During standalone mode (before system boot or during debugging), communication between the kernel terminal emulator and the console frame buffer driver is through polled I/O interfaces. All activity between the kernel terminal emulator and the console frame buffer driver is initiated by the kernel terminal emulator, with the exception of a callback function used by the console frame buffer driver to notify the kernel terminal emulator of changes in the video mode.

The console visual I/O interfaces are documented in detail in the visual_io(7I) man page. For more information on the video mode change callback function, see Video Mode Change Callback Interface.

I/O Control Interfaces

During normal system activity, the kernel terminal emulator communicates with the console frame buffer driver through the ioctl interfaces listed in the following table:

ioctl Name

Corresponding Data Structure 

Description 

VIS_DEVINIT

vis_devinit

Initializes the session between the terminal emulator module and the frame buffer. See VIS_DEVINIT.

VIS_DEVFINI

Not Applicable 

Terminates the session between the terminal emulator module and the frame buffer. See VIS_DEFINI.

VIS_CONSDISPLAY

vis_consdisplay

Displays pixels as a rectangle. See VIS_CONSDISPLAY.

VIS_CONSCOPY

vis_conscopy

Copies a rectangle of pixels (scroll). See VIS_CONSCOPY.

VIS_CONSCURSOR

vis_conscursor

Displays or hides a text cursor. See VIS_CONSCURSOR.

VIS_PUTCMAP

vis_cmap

Sends the terminal emulator module color map to the frame buffer driver. See VIS_PUTCMAP.

VIS_GETCMAP

vis_cmap

Reads the terminal emulator module color map from the frame buffer. See VIS_GETCMAP.

Polled I/O Interfaces

The polled I/O interfaces provide the same functionality as the VIS_CONSDISPLAY, VIS_CONSCOPY, and VIS_CONSCURSOR ioctl interfaces. The polled I/O interfaces are called only when the operating system is quiesced and in standalone mode. See Implementing Polled I/O in Console Frame Buffer Drivers for more information.

While in standalone mode, the kernel terminal emulator communicates with the console frame buffer driver through the polled I/O interfaces listed in the following table:

Polled I/O Function 

Corresponding Data Structure 

Description 

(*display)()

vis_consdisplay

Displays pixels as a rectangle. 

(*copy)()

vis_conscopy

Copies a rectangle of pixels (scroll). 

(*cursor)()

vis_conscursor

Displays or hides a text cursor. 

Video Mode Change Callback Interface

The console frame buffer driver and the kernel terminal emulator must be in agreement about the video mode at all times. Video mode includes the console screen height, width, and depth in pixels. Video mode also includes whether communication between the kernel terminal emulator and the console frame buffer is in VGA text mode or pixel mode.

In order for the console frame buffer driver to notify the kernel terminal emulator of changes in the video mode, the console frame buffer driver is initialized with the address of the (*modechg_cb)() kernel terminal emulator callback function described in the following table:

Callback Function 

Corresponding Data Structures 

Description 

(*modechg_cb)()

vis_modechg_arg

vis_devinit

Keep the terminal emulator module synchronized with the driver video mode (screen height, width, and pixel depth).