S3C6410 LCD Overlay Test Program

Publisher:MusicLover123Latest update time:2024-07-26 Source: cnblogsKeywords:S3C6410  LCD  Overlay  Test  Program Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

I tested the overlay function provided by the S3C6410 LCD controller and wrote a simple test to implement the overlay operation between FB0 and FB1.
The kernel option Windows must be at least 2.

The following operations are supported:
1 Enable OSD
2 Disable OSD
3 Increase OSD Alpha value
4 Reduce OSD Alpha value
5 Manually set Alpha value (0-15)
6 Move OSD layer up
7 Move OSD layer down
8 Move OSD layer left
9 Move OSD layer
right 10 Set OSD layer

Among them, setting the OSD layer is the most important, you can reset the window size and starting position. The main thing is that you need to refill the window data after setting, the old data will be messed up.
//////////////////////////////////////////////////////////////////////
s3cfb.h
///////////////////////////////////////////////////////////////////
#include
#include

typedef struct {
int bpp;
int left_x;
int top_y;
int width;
int height;
} s3c_win_info_t;

typedef struct{
__u32 phy_start_addr;
__u32 xres;
__u32 yres;
__u32 xres_virtual;
__u32 yres_virtual;
__u32 xoffset;
__u32 yoffset;
__u32 lcd_offset_x;
__u32 lcd_offset_y;
} s3c_fb_next_info_t;

#define FBIO_WAITFORVSYNC       _IOW ('F', 32, unsigned int)
#define S3C_FB_OSD_START        _IO ('F', 201)
#define S3C_FB_OSD_STOP    _IO('F', 202)
#define S3C_FB_OSD_SET_INFO     _IOW ('F', 209, s3c_win_info_t)
#define S3C_FB_CHANGE_REQ       _IOW ('F', 308, int)
#define S3C_FB_GET_CURR_FB_INFO _IOR ('F', 321, s3c_fb_next_info_t)

#define S3C_FB_OSD_ALPHA_UP   _IO ('F', 203)
#define S3C_FB_OSD_ALPHA_DOWN   _IO ('F', 204)
#define S3C_FB_OSD_MOVE_LEFT   _IO ('F', 205)
#define S3C_FB_OSD_MOVE_RIGHT   _IO ('F', 206)
#define S3C_FB_OSD_MOVE_UP   _IO ('F', 207)
#define S3C_FB_OSD_MOVE_DOWN   _IO ('F', 208)
#define S3C_FB_OSD_ALPHA_SET   _IOW ('F', 210, unsigned int)
#define S3C_FB_OSD_ALPHA0_SET   _IOW ('F', 211, unsigned int)
#define S3C_FB_OSD_ALPHA_MODE   _IOW ('F', 212, unsigned int)

////////////////////////////////////////////////////////////////
osd.c
////////////////////////////////////////////////////////////////
#include
#include
#include
#include

#include "fb.h"
#include "s3cfb.h"

#define DEV_FB0 "/dev/fb0"
#define DEV_FB1 "/dev/fb1"

#define FILE1 "/overlay/1.bin"
#define FILE2 "/overlay/2.bin"

int stat,err;
int fb0,fb1;
s3c_win_info_t osd_info;

void set_osd_info(){
int input;
osd_info.bpp = 16;
printf("please input left x coordinaten");
scanf("%d",&input);
osd_info.left_x = input;
printf("please input top y coordinaten");
scanf("%d",&input);
osd_info.top_y = input;
printf("please input ods widthn");
scanf("%d",&input);
osd_info.width = input;
printf("please input osd heightn");
scanf("%d",&input);
osd_info.height = input;
}

int main(int argc, char *argv[])
{
printf("Begin the OSD test!n");
if(argc < 2){
printf("Usage: ./osd 1n"); //reserved
return -1;
}

fb0 = open("/dev/fb0",O_RDWR);
if(fb0 < 0) {
printf("open err! fb0 is %dn",fb0);
return -1;
}
fb1 = open("/dev/fb1",O_RDWR);
if(fb1 < 0) {
printf("open err! fb1 is %dn",fb1);
return -1;
}

stat = atoi(argv[1]);
printf("stat is %dn",stat);
switch(stat){
case 1:
sleep(1);
ioctl(fb1,S3C_FB_OSD_START);
break;
default:
printf("err argv!n");
}

while(1){
printf("Please choose one option:n");
printf("1. enable the OSDn");
printf("2. disable the OSDn");
printf("3. + OSD alphan");
printf("4. - OSD alphan");
printf("5. set OSD alphan");
printf("6. move up OSDn");
printf("7. move down OSDn");
printf("8. move left OSDn");
printf("9. move right OSDn");
printf("10. SET OSD INFOn");
printf("0. exitn");

scanf("%d",&stat);
switch(stat){
case 1:
err = ioctl(fb1,S3C_FB_OSD_START);
if(err < 0) printf("ioctl err =%d",err);
break;
case 2:
err = ioctl(fb1,S3C_FB_OSD_STOP);
if(err < 0) printf("ioctl err =%d",err);
break;
case 3:
err = ioctl(fb1,S3C_FB_OSD_ALPHA_UP);
if(err < 0) printf("ioctl err =%d",err);
break;
case 4:
err = ioctl(fb1,S3C_FB_OSD_ALPHA_DOWN);
if(err < 0) printf("ioctl err =%d",err);
break;
case 5:
printf("please input your alpha level[0~15]n");
scanf("%d",&stat);
err = ioctl(fb1,S3C_FB_OSD_ALPHA_SET,stat);
if(err < 0) printf("ioctl err =%d",err);
break;
case 6:
err = ioctl(fb1,S3C_FB_OSD_MOVE_UP);
if(err < 0) printf("ioctl err =%d",err);
break;
case 7:
err = ioctl(fb1,S3C_FB_OSD_MOVE_DOWN);
if(err < 0) printf("ioctl err =%d",err);
break;
case 8:
ioctl(fb1,S3C_FB_OSD_MOVE_LEFT);
break;
case 9:
err = ioctl(fb1,S3C_FB_OSD_MOVE_RIGHT);
if(err < 0) printf("ioctl err =%d",err);
break;
case 10:
set_osd_info();
err = ioctl(fb1,S3C_FB_OSD_SET_INFO,&osd_info);
if(err < 0) printf("ioctl err =%d",err);
break;
case 0:
goto exit;
default:
printf("please input number 0~10n");
}
} //end of while(1)


exit:
sleep(1);
err = ioctl(fb1,S3C_FB_OSD_STOP);
if(err < 0) printf("ioctl err =%d",err);

return 0;
}

/// ...

#!/bin/sh
cat ./1.bin > /dev/fb0
cat ./22.bin > /dev/fb1
#cat ./3.bin > /dev/fb2
#cat ./4.bin > /dev/fb3
#cat ./5.bin > /dev/fb4
./osd 1


Keywords:S3C6410  LCD  Overlay  Test  Program Reference address:S3C6410 LCD Overlay Test Program

Previous article:uboot environment variables (set bootargs to pass the correct parameters to the linux kernel)
Next article:Analysis of uboot.lds of uboot

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号