OSDev.org
https://forum.osdev.org/

ARM framebuffer
https://forum.osdev.org/viewtopic.php?f=1&t=23990
Page 1 of 1

Author:  bazhenovc [ Sun Aug 14, 2011 12:24 pm ]
Post subject:  ARM framebuffer

Hello.

Consider we have a VersatilePB board (QEMU emulated) with a screen.

The question is: how to put a pixel(or something more interesting) to the screen, using C or ARM assembly?

I`ve searched for a long time, but didn`t find anything useful :(

Author:  jnc100 [ Sun Aug 14, 2011 1:55 pm ]
Post subject:  Re: ARM framebuffer

I believe its an ARM PL-110: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0161e/index.html although it has been changed to be modelled as a PL-111 in the latest qemu repository as of the end of July.

Regards,
John.

Author:  diodesign [ Sun Aug 14, 2011 2:04 pm ]
Post subject:  Re: ARM framebuffer

bazhenovc wrote:
Hello.

Consider we have a VersatilePB board (QEMU emulated) with a screen. The question is: how to put a pixel(or something more interesting) to the screen, using C or ARM assembly? I`ve searched for a long time, but didn`t find anything useful :(


Read up on VersatilePB and ARM CLCDC PL110 documentation from ARM, it's all in there and just a google search away. The CLCD controller's registers start from 0x10120000. You need to program the following registers (one of which is a SoC clock control register)...

SYS_OSCCLK4 at 0x1000001C
CLCD_TIM0 at 0x10120000
CLCD_TIM1 at 0x10120004
CLCD_TIM2 at 0x10120008
CLCD frame buffer physical base address at 0x10120010
CLCD control bits at 0x10120018

This table has some useful numbers for you:
http://infocenter.arm.com/help/index.js ... hedgd.html

Let's say you want a SVGA (800x600) display. Look up the resolution you want in the table above and the magic numbers needed for the hardware, and check the manuals. This is the C code you'll end up with:

*(volatile unsigned int *)(0x1000001C) = 0x2CAC; /* timing magic for SVGA 800x600 */
*(volatile unsigned int *)(0x10120000) = 0x1313A4C4;
*(volatile unsigned int *)(0x10120004) = 0x0505F657;
*(volatile unsigned int *)(0x10120008) = 0x071F1800;
*(volatile unsigned int *)(0x10120010) = (1 * 1024 * 1024); /* base addr of frame buffer */
*(volatile unsigned int *)(0x10120018) = 0x82b; /* control bits */

From the LCD controller datasheet, you'll discover exactly how to control the hardware - I just lifted the above code from some really old crappy test I wrote to make sure the LCD controller was working on QEmu's VersatilePB support. It's horrible. After that, it's a case of writing pixel data to the frame buffer (I believe the default format is 0x00BBGGRR)

CLCD controller information: http://infocenter.arm.com/help/index.js ... 13915.html

VersatilePB programmer's guide:
http://infocenter.arm.com/help/index.js ... haagj.html

Hope this points you in the right direction.

Author:  bazhenovc [ Sun Aug 14, 2011 2:36 pm ]
Post subject:  Re: ARM framebuffer

jnc100, thank you, this is it.

diodesign, thank you so much! You saved my day :)

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/