Changeset d21f75f in rtems


Ignore:
Timestamp:
Sep 16, 2009, 8:43:40 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
e0b66438
Parents:
18e835a
Message:

2009-09-16 Roxana Leontie <roxana.leontie@…>

  • configure.ac, fb/fb.c, include/bsp.h: updates made for porting to Nano-X and make testing easyer
Location:
c/src/lib/libbsp/arm/gumstix
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/gumstix/ChangeLog

    r18e835a rd21f75f  
     12009-09-16      Roxana Leontie <roxana.leontie@gmail.com>
     2
     3        * configure.ac, fb/fb.c, include/bsp.h: updates made for porting to
     4        Nano-X and make testing easyer
     5
    162009-09-15      Ralf Corsépius <ralf.corsepius@rtems.org>
    27
  • c/src/lib/libbsp/arm/gumstix/configure.ac

    r18e835a rd21f75f  
    2727AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
    2828
    29 RTEMS_BSP_CLEANUP_OPTIONS(0, 1)
     29RTEMS_BSP_BOOTCARD_OPTIONS
     30RTEMS_BSP_CLEANUP_OPTIONS(1, 1)
    3031
    3132# Explicitly list all Makefiles here
  • c/src/lib/libbsp/arm/gumstix/fb/fb.c

    r18e835a rd21f75f  
    1313#include <errno.h>
    1414#include <sys/types.h>
     15#include <pthread.h>
    1516
    1617#include <pxa255.h>
     
    2223#include <rtems.h>
    2324
    24 #define SCREEN_WIDTH 480
    25 #define SCREEN_HEIGHT 272
     25#define SCREEN_WIDTH 640
     26#define SCREEN_HEIGHT 480
    2627#define BPP 16
    2728#define LCD_DMA_POINTER (0xa0000000 + 62*(1<<20) + 0x1000)
    2829#define LCD_BUFFER_SIZE (SCREEN_WIDTH*SCREEN_HEIGHT*2)
    2930
     31/* mutex attribure */
     32pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
    3033
    3134static struct fb_var_screeninfo fb_var =
     
    4245    .type = FB_TYPE_PACKED_PIXELS,
    4346    .visual = FB_VISUAL_TRUECOLOR,
    44     .line_length = 80
     47    .line_length = SCREEN_WIDTH * (BPP/8)
    4548  };
     49
     50static uint16_t red16[] = {
     51   0x0000, 0x0000, 0x0000, 0x0000, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa,
     52   0x5555, 0x5555, 0x5555, 0x5555, 0xffff, 0xffff, 0xffff, 0xffff
     53};
     54static uint16_t green16[] = {
     55   0x0000, 0x0000, 0xaaaa, 0xaaaa, 0x0000, 0x0000, 0x5555, 0xaaaa,
     56   0x5555, 0x5555, 0xffff, 0xffff, 0x5555, 0x5555, 0xffff, 0xffff
     57};
     58static uint16_t blue16[] = {
     59   0x0000, 0xaaaa, 0x0000, 0xaaaa, 0x0000, 0xaaaa, 0x0000, 0xaaaa,
     60   0x5555, 0xffff, 0x5555, 0xffff, 0x5555, 0xffff, 0x5555, 0xffff
     61};
    4662
    4763static void enable_fbskyeye(void)
     
    101117               void                      *arg)
    102118{
    103   /*  rtems_status_code status; */
    104   printk( "FBSKYEYE open called.\n" );
    105   enable_fbskyeye();
    106   return RTEMS_SUCCESSFUL;
     119  if (pthread_mutex_trylock(&mutex)== 0){
     120      /* restore previous state.  for VGA this means return to text mode.
     121       * leave out if graphics hardware has been initialized in
     122       * frame_buffer_initialize()
     123       */
     124     printk( "FBSKYEYE open called.\n" );
     125     enable_fbskyeye();
     126     return RTEMS_SUCCESSFUL;
     127  }
     128
     129  return RTEMS_UNSATISFIED;
    107130}
    108131
     
    113136               void                      *arg)
    114137{
    115   printk( "fbskyeye close called.\n" );
    116   disable_fbskyeye();
    117   return RTEMS_SUCCESSFUL;
     138  if (pthread_mutex_unlock(&mutex) == 0){
     139    /* restore previous state.  for VGA this means return to text mode.
     140     * leave out if graphics hardware has been initialized in
     141     * frame_buffer_initialize() */
     142    printk( "fbskyeye close called.\n" );
     143    disable_fbskyeye();
     144    return RTEMS_SUCCESSFUL;
     145  }
     146
     147  return RTEMS_UNSATISFIED;
    118148}
    119149
     
    124154{
    125155  rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *)arg;
    126   printk( "FBSKYEYE read called.\n" );
    127   rw_args->bytes_moved = 0;
     156  rw_args->bytes_moved = ((rw_args->offset + rw_args->count) > fb_fix.smem_len ) ? (fb_fix.smem_len - rw_args->offset) : rw_args->count;
     157  memcpy(rw_args->buffer, (const void *) (fb_fix.smem_start + rw_args->offset), rw_args->bytes_moved);
    128158  return RTEMS_SUCCESSFUL;
    129159}
     
    135165{
    136166  rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *)arg;
    137   printk( "FBSKYEY write called.\n" );
    138   rw_args->bytes_moved = 0;
    139   return RTEMS_SUCCESSFUL;
     167  rw_args->bytes_moved = ((rw_args->offset + rw_args->count) > fb_fix.smem_len ) ? (fb_fix.smem_len - rw_args->offset) : rw_args->count;
     168  memcpy( (void *) (fb_fix.smem_start + rw_args->offset), rw_args->buffer, rw_args->bytes_moved);
     169  return RTEMS_SUCCESSFUL;
     170}
     171
     172static int get_palette( struct fb_cmap *cmap )
     173{
     174  uint32_t i;
     175
     176  if ( cmap->start + cmap->len >= 16 )
     177    return 1;
     178
     179  for( i = 0; i < cmap->len; i++ ) {
     180    cmap->red[ cmap->start + i ]   = red16[ cmap->start + i ];
     181    cmap->green[ cmap->start + i ] = green16[ cmap->start + i ];
     182    cmap->blue[ cmap->start + i ]  = blue16[ cmap->start + i ];
     183  }
     184  return 0;
     185}
     186
     187static int set_palette( struct fb_cmap *cmap )
     188{
     189  uint32_t i;
     190
     191  if ( cmap->start + cmap->len >= 16 )
     192    return 1;
     193
     194  for( i = 0; i < cmap->len; i++ ) {
     195    red16[ cmap->start + i ] = cmap->red[ cmap->start + i ];
     196    green16[ cmap->start + i ] = cmap->green[ cmap->start + i ];
     197    blue16[ cmap->start + i ] = cmap->blue[ cmap->start + i ];
     198  }
     199  return 0;
    140200}
    141201
     
    152212    {
    153213    case FBIOGET_FSCREENINFO:
    154       args->ioctl_return =  get_fix_screen_info( args->buffer );
     214      args->ioctl_return =  get_fix_screen_info( ( struct fb_fix_screeninfo * ) args->buffer );
    155215      break;
    156216    case FBIOGET_VSCREENINFO:
    157       args->ioctl_return =  get_var_screen_info( args->buffer );
     217      args->ioctl_return =  get_var_screen_info( ( struct fb_var_screeninfo * ) args->buffer );
    158218      break;
    159219    case FBIOPUT_VSCREENINFO:
    160220      /* not implemented yet*/
    161       break;
     221      args->ioctl_return = -1;
     222      return RTEMS_UNSATISFIED;
    162223    case FBIOGETCMAP:
    163       args->ioctl_return =  0;
     224      args->ioctl_return =  get_palette( ( struct fb_cmap * ) args->buffer );
    164225      break;
    165226    case FBIOPUTCMAP:
    166       args->ioctl_return =  0;
     227      args->ioctl_return =  set_palette( ( struct fb_cmap * ) args->buffer );
    167228      break;
    168229    default:
  • c/src/lib/libbsp/arm/gumstix/include/bsp.h

    r18e835a rd21f75f  
    2323#include <libchip/serial.h>
    2424
     25#define BSP_HAS_FRAME_BUFFER 1
    2526
    2627/* What is the input clock freq in hertz */
Note: See TracChangeset for help on using the changeset viewer.