BSP and Device Driver Development Guide
The frame_buffer_open()
function is called whenever a frame buffer device is opened.
If the frame buffer is registered as "/dev/fb0", the frame_buffer_open
entry point
will be called as the result of an open("/dev/fb0", mode)
in the application.
Thread safety of the frame buffer driver is implementation-dependent. The VGA driver shown below uses a mutex to prevent multiple open() operations of the frame buffer device.
The frame_buffer_open()
function returns RTEMS_SUCCESSFUL when the device driver
is successfully opened, and RTEMS_UNSATISFIED if the device is already open:
rtems_device_driver frame_buffer_close( rtems_device_major_number major, rtems_device_minor_number minor, void *arg ) { if (pthread_mutex_unlock(&mutex) == 0){ /* restore previous state. for VGA this means return to text mode. * leave out if graphics hardware has been initialized in * frame_buffer_initialize() */ ega_hwterm(); printk( "FBVGA close called.\n" ); return RTEMS_SUCCESSFUL; } return RTEMS_UNSATISFIED; }
In the previous example, the function ega_hwinit()
takes care of
hardware-specific initialization.
BSP and Device Driver Development Guide
Copyright © 1988-2008 OAR Corporation