RTEMS Logo

RTEMS 4.10.2 On-Line Library


Frame Buffer Driver Reading from the Frame Buffer Device

PREV UP NEXT Bookshelf BSP and Device Driver Development Guide

17.2.4: Reading from the Frame Buffer Device

The frame_buffer_read() is invoked from a read() operation on the frame buffer device. Read functions should allow normal and partial reading at the end of frame buffer memory. This method returns RTEMS_SUCCESSFUL when the device is successfully read from:

rtems_device_driver frame_buffer_read(
  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(rw_args->buffer, (const void *) (fb_fix.smem_start + rw_args->offset), rw_args->bytes_moved);
  return RTEMS_SUCCESSFUL;
}


PREV UP NEXT Bookshelf BSP and Device Driver Development Guide

Copyright © 1988-2008 OAR Corporation