2009-07-22 14:59:18     mmap of bfin_adv7393fb returns errno=19 "No such device"

Document created by Aaronwu Employee on Aug 16, 2013
Version 1Show Document
  • View in full screen mode

2009-07-22 14:59:18     mmap of bfin_adv7393fb returns errno=19 "No such device"

Marshall Seaborn (UNITED STATES)

Message: 77887   

 

I can successfully open the framebuffer driver "bfin_adv7393fb" and execute ioctl calls, but when I

 

try to mmap() the framebuffer it returns errno = 19 (i.e., No such device).  Why would this happen?

 

How can I debug this?  I tried using kernel print message but I don't see any output on the

 

console indicating the  bfin_adv7393_fb_mmap(...) is ever called.  Any help would be appreciated.

 

Thanks,

 

Marshall

 

P.S.,  See my code below.

 

// Open the framebuffer device driver.

  fbname="/dev/fb0";

  framebuffer_fd = open(fbname, O_RDWR);

  if (fbname < 0) {

     printf("Failed to open %s.\n", fbname);

  }

 

  // Get the fixed screen info.

  if (ioctl(framebuffer_fd, FBIOGET_FSCREENINFO, &fixinfo) < 0) {

     printf("failed getting fixed screen info: %s. \n", strerror(errno));

     close(framebuffer_fd);

     return -1;

  }

 

 

  // Get the variable screen info.

  if (ioctl(framebuffer_fd, FBIOGET_VSCREENINFO, &varinfo) < 0) {

     printf("failed getting variable screen info: %s. \n", strerror(errno));

     close(framebuffer_fd);

     return -1;

  }

 

  // Print some screen info currently available

  printf("Screen resolution: (%dx%d)\n", varinfo.xres,varinfo.yres);

  printf("Line width in bytes %d\n", fixinfo.line_length);

  printf("bits per pixel : %d\n", varinfo.bits_per_pixel);

  printf("Red: length %d bits, offset %d\n", varinfo.red.length, varinfo.red.offset);

  printf("Green: length %d bits, offset %d\n", varinfo.red.length, varinfo.green.offset);

  printf("Blue: length %d bits, offset %d\n", varinfo.red.length, varinfo.blue.offset);

 

  // Calculate the size to mmap

  size=fixinfo.line_length * varinfo.yres;

 

#if 1

  // Now mmap the framebuffer.

  pFramebuffer = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, framebuffer_fd,0);

 

  if (((int)pFramebuffer) == -1) {

     printf("mmap failed: %s\n", strerror(errno));

    close(framebuffer_fd);

    return -1;

  }

  printf("framebuffer mmap address=%p\n", pFramebuffer);

  printf("framebuffer size=%d bytes\n", size);

#endif

QuoteReplyEditDelete

 

 

2009-07-22 15:23:51     Re: mmap of bfin_adv7393fb returns errno=19 "No such device"

Mike Frysinger (UNITED STATES)

Message: 77888   

 

dont use MAP_SHARED

QuoteReplyEditDelete

 

 

2009-07-22 16:31:41     Re: mmap of bfin_adv7393fb returns errno=19 "No such device"

Marshall Seaborn (UNITED STATES)

Message: 77890   

 

Mike,

 

Instead of MAP_SHARED, I've tried both MAP_FIXED and 0.  Both return "Invalid" argument.  What should this argument be?  Are the system calls documented?

 

 

 

Also,

 

I attached with my JTAG debugger and set a breakpoint in fbmem.c fb_open and fb_mmap.  I hit fb_open

 

but not fb_mmap.  Is some other function call before fb_mmap?

 

 

 

Thanks,

 

Marshall

QuoteReplyEditDelete

 

 

2009-07-22 16:49:06     Re: mmap of bfin_adv7393fb returns errno=19 "No such device"

Marshall Seaborn (UNITED STATES)

Message: 77891   

 

I used MAP_PRIVATE and that did the trick.  Also, after doing so I hit my breakpoint in fb_mmap(...).  Apparenty, the system call for mmap(...) filters invalid arguments?

 

 

 

Thanks,

 

Marshall

 

 

 

Mike,

 

Instead of MAP_SHARED, I've tried both MAP_FIXED and 0.  Both return "Invalid" argument.  What should this argument be?  Are the system calls documented?

 

 

 

Also,

 

I attached with my JTAG debugger and set a breakpoint in fbmem.c fb_open and fb_mmap.  I hit fb_open

 

but not fb_mmap.  Is some other function call before fb_mmap?

 

 

 

Thanks,

 

Marshall

 

---

QuoteReplyEditDelete

Attachments

    Outcomes