Registers are handled by means of IOCTL(2). Header files of the target architecture are required to compile a code involving ioctl.
# cp -R linux/include/asm-sh /usr/local/sh4-linux/include/asm
First, open dev/fb0:
fd = open("/dev/fb/0", O_RDWR);
Then, set MMIO address as follows:
ioctl(fd, 0, address)
Read a register value as follows:
int reg32; ioctl(fd, 1, ®32)
Finally, write a value to the register as follows:
ioctl(fd, 2, reg32)
SM501 is accessed through seven frame buffers, which are initialized on boot. They contain one video plane, two graphics planes, two alpha planes, and two hardware cursor planes. See SM501_MMCC_Databook pp.(1-12)-(1-13) for details of the video layers. Primary devices with display resolutions of VGA, SVGA, and XGA are considered in this document.
Each node is treated as a character device. See Documentation/fb/framebuffer.txt for details of the frame buffer. Just like MEM(4) device, a frame buffer is opened by OPEN(2):
fd = open("/dev/fb0", O_RDWR);
and mapped into memory by MMAP(2) to access:
char *p = (char *) mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
See SM501_MMCC_Databook pp.(1-26)-(1-28) for details of the memory map and register space.
Panel Plane | a40c0000 |
Video Plane 0 | a4340000 |
Video Plane 1 | a45c0000 |
Video Alpha Plane | a4840000 |
Alpha Plane | a4ac0000 |
Panel Cursor Plane | a4d40000 |
CRT Plane | a4d50000 |
CRT Cursor Plane | a4fd0000 |
MMIO Base | a7e00000 |
offset | value | description |
00008 | 00ff0000 | GPIO 31:0 Control |
0000c | 00000000 | GPIO 63:32 Control |
00010 | 2ed547c0 | |
00014 | 05126734 | |
00038 | 00021877 | Current Gate |
00040 | 00021877 | Power Mode 0 Gate |
00048 | 00021877 | Power Mode 1 Gate |
8001c | 00000000 | Panel Plane TL Location |
80050 | 00000000 | Video Plane TL Location |
80090 | 00000000 | Video Alpha TL Location |
8010c | 00000000 | Alpha Plane TL Location |
80040 | 00016207 | Video Display Control |
80080 | 00010001 | Video Alpha Display Control |
80100 | 00010001 | Alpha Display Control |
80200 | 00010000 | CRT Display Control |
90000 | 000022d1 | Capture Control |
90004 | 001000b4 | Capture Clipping |
90008 | 01e00280 | Chapture Size |
90018 | 00000004 | Capture FIFO Control |
9000c | 00340000 | Capture Buffer 0 Address |
90010 | 005c0000 | Capture Buffer 1 Address |
offset | value | description |
00044 | 10090101 | Power Mode 0 Clock |
0004C | 10090101 | Power Mode 1 Clock |
80000 | 07013100 | Panel Display Control |
80014 | 02800000 | Panel FB Width |
80018 | 01e00000 | Panel FB Height |
80024 | 033f027f | Panel Horizontal Total |
80028 | 004a028b | Panel Horizontal Sync |
8002c | 020c01df | Panel Vertical Total |
80030 | 000201e9 | Panel Vertical Sync |
80058 | 00000000 | Video Scale |
80048 | 05000500 | Video FB Width |
80010 | 05000500 | Panel FB Offset/Window Width |
80088 | 05000500 | Video Alpha FB Offset/Window Width |
80108 | 05000500 | Alpha FB Offset/Window Width |
90014 | 00000500 | Capture Buffer Offset |
80020 | 01df027f | Panel Plane BR Location |
80054 | 01df027f | Video Plane BR Locatoin |
80094 | 01df027f | Video Alpha BR Location |
80110 | 01df027f | Alpha Plane BR Location |
Bob
80058 | 08000000 | Video Scale |
90000 | 000022b1 | Capture Control |
offset | value | description |
00044 | 08090101 | Power Mode 0 Clock |
0004C | 08090101 | Power Mode 1 Clock |
80000 | 07010100 | Panel Display Control |
80014 | 03200000 | Panel FB Width |
80018 | 02580000 | Panel FB Height |
80024 | 040f031f | Panel Horizontal Total |
80028 | 00770357 | Panel Horizontal Sync |
8002c | 02990257 | Panel Vertical Total |
80030 | 0005027c | Panel Vertical Sync |
80058 | 0ccc0ccc | Video Scale |
80048 | 06400640 | Video FB Width |
80010 | 06400640 | Panel FB Offset/Window Width |
80088 | 06400640 | Video Alpha FB Offset/Window Width |
80108 | 06400640 | Alpha FB Offset/Window Width |
90014 | 00000640 | Capture Buffer Offset |
80020 | 0257031f | Panel Plane BR Location |
80054 | 0257031f | Video Plane BR Locatoin |
80094 | 0257031f | Video Alpha BR Location |
80110 | 0257031f | Alpha Plane BR Locatoin |
Bob
80058 | 06670ccc | Video Scale |
90000 | 000022b1 | Capture Control |
offset | value | description |
00044 | 01090101 | Power Mode 0 Clock |
0004C | 01090101 | Power Mode 1 Clock |
80000 | 07013100 | Panel Display Control |
80014 | 04000000 | Panel FB Width |
80018 | 03000000 | Panel FB Height |
80024 | 052f03ff | Panel Horizontal Total |
80028 | 00870417 | Panel Horizontal Sync |
8002c | 032502ff | Panel Vertical Total |
80030 | 00050302 | Panel Vertical Sync |
80058 | 0a000a00 | Video Scale |
80048 | 08000800 | Video FB Width |
80010 | 08000800 | Panel FB Offset/Window Width |
80088 | 08000800 | Video Alpha FB Offset/Window Width |
80108 | 08000800 | Alpha FB Offset/Window Width |
90014 | 00000800 | Capture Buffer Offset |
80020 | 02ff03ff | Panel Plane BR Location |
80054 | 02ff03ff | Video Plane BR Locatoin |
80094 | 02ff03ff | Video Alpha BR Location |
80110 | 02ff03ff | Alpha Plane BR Location |
Bob
80058 | 05000a00 | Video Scale |
90000 | 000022b1 | Capture Control |
offset | value | description |
00044 | 00090101 | Power Mode 0 Clock |
0004C | 00090101 | Power Mode 1 Clock |
80000 | 07013100 | Panel Display Control |
80014 | 05000000 | Panel FB Width |
80018 | 04000000 | Panel FB Height |
80024 | 06a704ff | Panel Horizontal Total |
80028 | 01600514 | Panel Horizontal Sync |
8002c | 043403ff | Panel Vertical Total |
80030 | 001a0400 | Panel Vertical Sync |
80058 | 07800780 | Video Scale |
80048 | 0a000a00 | Video FB Width |
80010 | 0a000a00 | Panel FB Offset/Window Width |
80088 | 0a000a00 | Video Alpha FB Offset/Window Width |
80108 | 0a000a00 | Alpha FB Offset/Window Width |
90014 | 00000800 | Capture Buffer Offset |
80020 | 03ff04ff | Panel Plane BR Location |
80054 | 03ff04ff | Video Plane BR Locatoin |
80094 | 03ff04ff | Video Alpha BR Location |
80110 | 03ff04ff | Alpha Plane BR Location |
Bob
80058 | 03c00800 | Video Scale |
90000 | 000022b1 | Capture Control |
/dev/fb0 | Primary Graphics | not used |
/dev/fb1 | Video | videos from a ZV port |
/dev/fb2 | Video Alpha | bitmap character display |
/dev/fb3 | Alpha | bitmap character display |
/dev/fb4 | Primary Cursor | not used |
/dev/fb5 | Secondary Graphics | not used |
/dev/fb6 | Secondary Cursor | not used |