Changeset 2b86087 in rtems


Ignore:
Timestamp:
08/23/09 15:00:29 (13 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 5, master
Children:
da42259
Parents:
b8dfc88
Message:

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

  • bsp_howto/framebuffer.t: documented the improvements made to read/write
Location:
doc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/ChangeLog

    rb8dfc88 r2b86087  
     12009-08-22      Roxana Leontie <roxana.leontie@gmail.com>
     2
     3        * bsp_howto/framebuffer.t: documented the improvements made to
     4        read/write
     5
    162009-08-21      Roxana Leontie <roxana.leontie@gmail.com>
    27
  • doc/bsp_howto/framebuffer.t

    rb8dfc88 r2b86087  
    151151The @code{frame_buffer_read()} is invoked from a @code{read()} operation
    152152on the frame buffer device.
    153 Read functions should allow normal and partial reading at the end of frame buffer memory,
    154 returning RTEMS_UNSATISFIED if trying to read beyond the frame buffer
    155 memory or a negative number of bytes. 
     153Read functions should allow normal and partial reading at the end of frame buffer memory. 
    156154This method returns RTEMS_SUCCESSFUL when the device is successfully read from:
    157155
     
    164162)
    165163@{
    166   /*printk( "FBVGA read called.\n" );*/
    167164  rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *)arg;
    168   if ( (rw_args->offset >= fb_fix.smem_len) || (rw_args->count < 0) )@{
    169      return RTEMS_UNSATISFIED;
    170   @}
    171   else
    172   @{
    173         /*partial reading*/
    174         if ( (rw_args->offset + rw_args->count) > fb_fix.smem_len )@{
    175            rw_args->count = fb_fix.smem_len - rw_args->offset;
    176            memcpy(rw_args->buffer, (const void *) (rw_args->offset + fb_fix.smem_start), rw_args->count);
    177            rw_args->bytes_moved = rw_args->count;
    178            return RTEMS_SUCCESSFUL;
    179         @}
    180         /*best reading case*/
    181         else@{
    182            memcpy(rw_args->buffer, (const void *) (rw_args->offset + fb_fix.smem_start), rw_args->count);
    183            rw_args->bytes_moved = rw_args->count;
    184            return RTEMS_SUCCESSFUL;
    185         @}
    186    @}     
     165  rw_args->bytes_moved = ((rw_args->offset + rw_args->count) > fb_fix.smem_len ) ? (fb_fix.smem_len - rw_args->offset) : rw_args->count;
     166  memcpy(rw_args->buffer, (const void *) (fb_fix.smem_start + rw_args->offset), rw_args->bytes_moved);
     167  return RTEMS_SUCCESSFUL;   
    187168@}
    188169@end group
     
    207188)
    208189@{
    209   /*printk( "FBVGA write called.\n" );*/
    210190  rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *)arg;
    211   if ( (rw_args->offset >= fb_fix.smem_len) || (rw_args->count < 0) )@{
    212      return RTEMS_UNSATISFIED;
    213   @}
    214   else
    215   @{
    216         /*partial writing*/
    217         if ( (rw_args->offset + rw_args->count) > fb_fix.smem_len )@{
    218            rw_args->count = fb_fix.smem_len - rw_args->offset;
    219            memcpy( (void *) (rw_args->offset + fb_fix.smem_start), rw_args->buffer, rw_args->count);
    220            rw_args->bytes_moved = rw_args->count;
    221            return RTEMS_SUCCESSFUL;
    222         @}
    223         /* best writing case*/
    224         else@{
    225            memcpy( (void *) (rw_args->offset + fb_fix.smem_start), rw_args->buffer, rw_args->count);
    226            rw_args->bytes_moved = rw_args->count;
    227            return RTEMS_SUCCESSFUL;
    228         @}
    229    @}         
     191  rw_args->bytes_moved = ((rw_args->offset + rw_args->count) > fb_fix.smem_len ) ? (fb_fix.smem_len - rw_args->offset) : rw_args->count;
     192  memcpy( (void *) (fb_fix.smem_start + rw_args->offset), rw_args->buffer, rw_args->bytes_moved);
     193  return RTEMS_SUCCESSFUL;         
    230194@}
    231195@end group
Note: See TracChangeset for help on using the changeset viewer.