ARM framebuffer

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
bazhenovc
Posts: 7
Joined: Sun Feb 27, 2011 9:16 am

ARM framebuffer

Post by bazhenovc »

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 :(
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: ARM framebuffer

Post by jnc100 »

I believe its an ARM PL-110: http://infocenter.arm.com/help/index.js ... 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.
User avatar
diodesign
Posts: 14
Joined: Sat Sep 11, 2010 10:14 am
Location: England
Contact:

Re: ARM framebuffer

Post by diodesign »

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.
bazhenovc
Posts: 7
Joined: Sun Feb 27, 2011 9:16 am

Re: ARM framebuffer

Post by bazhenovc »

jnc100, thank you, this is it.

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