RTEMS Logo

RTEMS 4.10.2 On-Line Library


Frame Buffer Driver Writing to the Frame Buffer Device

PREV UP NEXT Bookshelf BSP and Device Driver Development Guide

17.2.5: Writing to the Frame Buffer Device

The frame_buffer_write() is invoked from a write() operation on the frame buffer device. The frame buffer write function is similar to the read function, and should handle similar cases involving partial writes.

This method returns RTEMS_SUCCESSFUL when the device is successfully written to:

rtems_device_driver frame_buffer_write(
  rtems_device_major_number  major,
  rtems_device_minor_number  minor,
  void                      *arg
)
{
  rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *)arg;
  rw_args->bytes_moved = ((rw_args->offset + rw_args->count) > fb_fix.smem_len ) ? (fb_fix.smem_len - rw_args->offset) : rw_args->count;
  memcpy( (void *) (fb_fix.smem_start + rw_args->offset), rw_args->buffer, rw_args->bytes_moved);
  return RTEMS_SUCCESSFUL;
}


PREV UP NEXT Bookshelf BSP and Device Driver Development Guide

Copyright © 1988-2008 OAR Corporation