Changeset 88a8702d in rtems


Ignore:
Timestamp:
Aug 3, 2009, 3:12:14 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
389afd9
Parents:
740d0aca
Message:

2009-08-03 Roxana Leontie <roxana.leontie@…>

  • bsp_howto/framebuffer.t: added documentation
Location:
doc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/ChangeLog

    r740d0aca r88a8702d  
     12009-08-03      Roxana Leontie <roxana.leontie@gmail.com>
     2
     3        * bsp_howto/framebuffer.t: added documentation
     4
    152009-07-28      Joel Sherrill <joel.sherrill@oarcorp.com>
    26
  • doc/bsp_howto/framebuffer.t

    r740d0aca r88a8702d  
    1111@section Introduction
    1212
    13 The purpose of the frame buffer driver is to provide a ...
     13The purpose of the frame buffer driver is to provide an abstraction for the
     14graphics hardware.
     15By using the frame buffer interface the application can access the graphics
     16without knowing anything about the low-level communication.
    1417
    15 The clock driver is usually located in the @code{XXX} directory of the BSP.
     18The frame buffer driver is usually located in the @code{console} directory
     19of the BSP and registered by the name @b{/dev/fb}
    1620
    17 @section Initialization
     21@section Driver Functioning Overview
    1822
    19 The initialization routine is responsible for programming the hardware ....
     23@subsection Initialization
    2024
    21 @section IO Control
     25The driver initialization is called once during the RTEMS initialization
     26process and returns RTEMS_SUCCESSFUL when the device driver is successfully
     27initialized
    2228
    23 TBD
     29The @code{frame_buffer_initialize} function may look like this:
    2430
     31@example
     32@group
     33rtems_device_driver frame_buffer_initialize(
     34  rtems_device_major_number  major,
     35  rtems_device_minor_number  minor,
     36  void                      *arg
     37)
     38@{
     39  rtems_status_code status;
     40
     41  printk( "frame buffer driver initializing..\n" );
     42
     43  /*
     44   * Register the device
     45   */
     46  status = rtems_io_register_name ("/dev/fb", major, 0);
     47  if (status != RTEMS_SUCCESSFUL)
     48 @{
     49    printk("Error registering frame buffer device!\n");
     50    rtems_fatal_error_occurred( status );
     51 @}
     52
     53    return RTEMS_SUCCESSFUL;
     54@}
     55@end group
     56@end example
     57
     58@subsection Opening the Frame Buffer Device
     59
     60The @code{frame_buffer_open} function is called whenever a frame buffer device is opened.
     61The device registered as @code{"/dev/fb"} (@code{FRAMEBUFFER_DEVICE_NAME}) is
     62opened automatically during RTEMS initialization.  For instance, if the frame buffer is
     63registered as "/dev/fb", the @code{frame_buffer_open} entry point will be called as the
     64result of an  @code{open("/dev/fb", mode)} in the application.
     65
     66The @code{frame_buffer_open} function returns RTEMS_SUCCESSFUL when the device driver
     67is successfully opened:
     68
     69@example
     70@group
     71rtems_device_driver frame_buffer_open(
     72  rtems_device_major_number  major,
     73  rtems_device_minor_number  minor,
     74  void                      *arg
     75)
     76@{
     77  ega_hwinit();
     78  printk( "frame buffer open called.\n" );
     79
     80  return RTEMS_SUCCESSFUL;
     81@}
     82@end group
     83@end example
     84
     85The @code{ega_hwinit()} which takes care of the hardware initialization.
     86
     87@subsection Closing the Frame Buffer Device
     88
     89The @code{frame_buffer_close} is invoked when the serial device is to be closed.
     90This entry point corresponds to the device driver close entry point.
     91
     92The @code{frame_buffer_close} function freeing up the hardware resources.
     93Returns RTEMS_SUCCESSFUL when the device driver is successfully closed:
     94
     95@example
     96@group
     97rtems_device_driver frame_buffer_close(
     98  rtems_device_major_number  major,
     99  rtems_device_minor_number  minor,
     100  void                      *arg
     101)
     102@{
     103  ega_hwterm();
     104  printk( "frame buffer close called.\n" );
     105
     106  return RTEMS_SUCCESSFUL;
     107@}
     108
     109@end group
     110@end example
     111
     112
     113@subsection Reading from the Frame Buffer Device
     114
     115The @code{frame_buffer_read} is invoked when the serial device is to be read from.
     116This method returns RTEMS_SUCCESSFUL when the device is successfully read from:
     117
     118@example
     119@group
     120rtems_device_driver frame_buffer_read(
     121  rtems_device_major_number  major,
     122  rtems_device_minor_number  minor,
     123  void                      *arg
     124)
     125@{
     126  /*TBD*/
     127  return RTEMS_SUCCESSFUL;
     128@}
     129@end group
     130@end example
     131
     132@subsection Writing to the Frame Buffer Device
     133
     134The @code{frame_buffer_write} is invoked when the serial device is to be written to.
     135This entry point corresponds to the device driver write entry point.
     136
     137
     138@example
     139@group
     140rtems_device_driver frame_buffer_write(
     141  rtems_device_major_number  major,
     142  rtems_device_minor_number  minor,
     143  void                      *arg
     144)
     145@{
     146  /*TBD*/
     147  return RTEMS_SUCCESSFUL;
     148@}
     149@end group
     150@end example
     151
     152
     153@section Frame Buffer IO Control
     154
     155The frame buffer driver allows several ioctls partial compatible with the linux ones
     156to obtain information about the hardware.
     157Basically `ioctl' commands call `console_control' with the
     158serial line configuration wich handeles all the services on the interface.
     159
     160@example
     161@group
     162rtems_device_driver frame_buffer_control(
     163  rtems_device_major_number  major,
     164  rtems_device_minor_number  minor,
     165  void                      *arg
     166)
     167@{
     168  rtems_libio_ioctl_args_t *args = arg;
     169
     170  printk( "FBVGA ioctl called, cmd=%x\n", args->command  );
     171
     172  switch( args->command ) @{
     173    case FBIOGET_FSCREENINFO:
     174      args->ioctl_return =  get_fix_screen_info( args->buffer );
     175      break;
     176    case FBIOGET_VSCREENINFO:
     177      args->ioctl_return =  get_var_screen_info( args->buffer );
     178      break;
     179    case FBIOPUT_VSCREENINFO:
     180      /* not implemented yet*/
     181      break;
     182    case FBIOGETCMAP:
     183      args->ioctl_return =  get_palette( args->buffer );
     184      break;
     185    case FBIOPUTCMAP:
     186      args->ioctl_return =  set_palette( args->buffer );
     187      break;
     188
     189    default:
     190     args->ioctl_return = 0;
     191     break;
     192  @}
     193  return RTEMS_SUCCESSFUL;
     194@}
     195@end group
     196@end example
     197
     198Look into @code{rtems/fb.h} for more information on what ioctls exist and on
     199which data structures they work.
Note: See TracChangeset for help on using the changeset viewer.