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
Previous article:uboot environment variables (set bootargs to pass the correct parameters to the linux kernel)
Next article:Analysis of uboot.lds of uboot
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- FPGA Implementation of Digital Down-Conversion
- Wireless bridge dedicated to video transmission
- Implementation Method of Software Serial Interface (SCI) Based on C2000
- Ultra-wideband positioning applications
- Share a book: Crazy STM32 practical lectures
- Design and implementation of Ethernet MII interface expansion based on FPGA
- [RISC-V MCU CH32V103 Review] Board Unboxing and Schematic Analysis
- Efficiency Programming of Single Chip Microcomputer Active Buzzer Driver
- The speed measurement scheme of motor compressor based on Labview
- ADI’s Big Benefit丨Collection of Uncommon Questions (Issue 141-170) is officially online!