linux LCD调试

      开机LOGO在UI层 ; UI层在顶层;UI层使用图片自带的ALPHA;开机LOGO的ALPHA为不透明; 开机LOGO一直存在。基于以上原因,若未清framebuffer,其它图层的画面会被开机LOGO一直盖住,做类似sensor画面出图像DEMO时,可能会造成“图像不显示”的假象。不运行应用程序的情况下,可以执行下面这条命令清除framebuffer(置透明度为全透),以让自己需要的画面出现。

1.1. LCD时序参数说明

1.1.1. lcd_x

显示屏的水平像素点

1.1.2. lcd_y

显示屏的垂直像素点

1.1.3. lcd_ht

Horizontal Total time

指一行总的dclkcycle个数

1.1.1. lcd_hbp

Horizontal Back Porch

指有效行间,行同步信号(hsync)开始,到有效数据开始之间的dclkcycle个数, 包括同步信号区。见图1

linux LCD调试_第1张图片

1.1.2. lcd_hspw 

Horizontal Sync Pulse Width

指行同步信号的宽度。单位为1dclk的时间(即是1data cycle的时间)。见图1

1.1.3. lcd_vt

Vertical Total time

指一场的总行数。见图2

 

1.1.1. lcd_vbp

Vertical Back Porch

指场同步信号(vsync)开始,到有效数据行开始之间的行数,包括场同步信号区。见图2

1.1.2. lcd_vspw

Vertical Sync Pulse Width

指场同步信号的宽度。单位为行。见图2

1.1.3. lcd_dclk_freq

Data Clock Frequency

PIN总线上数据的传送频率。单位为MHz         ,即pixel_clock

屏幕刷新帧数 = (lcd_dclk_freq×1000×1000) / (ht×vt)

 

1.1.1. lcd_pwm_freq

Lcd backlight PWM Frequency

这个参数配置PWM信号的频率,单位为Hz

1.1.2. lcd_pwm_pol

Lcd backlight PWM Polarity

这个参数配置PWM信号的占空比的极性。设置相应值对应含义为:

0active high

1active low

1.1.3. lcd_frm

Lcd Frame Rate Modulator

FRM是解决由于PIN减少导致的色深问题。

这个参数设置相应值对应含义为:

0RGB888 → RGB888 direct

1RGB888 → RGB666 dither

2RGB888 → RGB565 dither

有些LCD屏的像素格式是18bit色深(RGB666)或16bit色深(RGB565),建议打开FRM功能,通过dither的方式弥补色深,使显示达到24bit色深(RGB888)的效果。如图2-4和图2-5,上图是色深为RGB66LCD屏显示,下图是打开dither后的显示,打开dither后色彩渐变的地方过度平滑。

1-2 LCD接口参数配置说明

Interface

Parameter

RGB接口
(lcd_if=0)

Parallel RGB
(lcd_hv_if=0)

lcd_hv_clk_phase
lcd_hv_sync_polarity

Serial RGB
(lcd_hv_if=8)

lcd_hv_clk_phase
lcd_hv_sync_polarity

lcd_hv_srgb_seq

Dummy RGB
(lcd_hv_if=10)

RGB Dummy
(lcd_hv_if=11)

Serial YUV/CCIR656
(lcd_hv_if=12)

lcd_hv_syuv_seq
lcd_hv_syuv_fdly

CPU/8080接口
(lcd_if=1)

Parallel 18bit
(lcd_cpu_if=0)

lcd_cpu_te

Parallel 16bit
(lcd_cpu_if=4)

LVDS接口
(lcd_if=3)

Single channal
(lcd_lvds_if=0)

lcd_lvds_bitwidth
lcd_lvds_mode

Dual channal
(lcd_lvds_if=1)

DSI接口
(lcd_if=4)

A20+SSD2828

lcd_hv_clk_phase
lcd_hv_sync_polarity

 

#include <stdio.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#if 0
#define FB_WIDTH    320
#define FB_HEIGHT   240
#else
#define FB_WIDTH    480
#define FB_HEIGHT   272
#endif

#define BIT_PER_PIX 32
#define PIX_LENGTH (BIT_PER_PIX / 8)
#define LINE_LENGTH (FB_WIDTH * PIX_LENGTH)
#define LENGTH (LINE_LENGTH * FB_HEIGHT)

unsigned long *buf;

int main(int argc, char *argv[])
{
  int fd;
  unsigned long color;
 char *pos;

  if (argc != 2)
  {
   fprintf(stderr, "demo color: 0x10ff0000\n");
   usage();
   return -1;
 }
 system("echo 0 >/sys/class/disp/disp/attr/lcd");
 system("echo 1 >/sys/class/disp/disp/attr/lcd");
  system("dd if=/dev/zero of=/dev/graphics/fb0");
 
  if ((fd = open("/dev/graphics/fb0", O_RDWR)) < 0)
  {
   printf("open /dev/fb0 failed\n");
   return -1;
 }
 buf = (unsigned long *)mmap(NULL, LENGTH, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
  color = strtol(argv[1],&pos,16);
/ / color = 0x10ff0000;
  fprintf(stderr, "color:0x%x\n", color);

  unsigned long  *ctt = mmap(NULL, LENGTH, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
  /* set the display content */
  int cnt = 0;
  printf("%x\n", color);
  while(cnt < LENGTH)
 {
   memcpy(ctt+(cnt/4), &color, 4);
   cnt += 4;
  
  }
  munmap(ctt, LENGTH);
 close(fd);
 return 0;
}

int usage(void)
{
 fprintf(stderr, "memset fb0 color\n");
 fprintf(stderr, "usage: fb_color <color>\n");
  return 1;
}

 

 


root@camdroid:/ #
root@camdroid:/ #
root@camdroid:/ # cd /sys/class/sunxi_dump
root@camdroid:/sys/class/sunxi_dump # echo 01c0c040 800001f4 > write
root@camdroid:/sys/class/sunxi_dump # echo 01c0c040 800001f5 > write          
root@camdroid:/sys/class/sunxi_dump # echo 01c0c000,01c0c220 > dump;cat dump
[  148.270551] __sunxi_dump_regs_ex, start 0x01c0c000, end 0x01c0c220, return 1995
0x01c0c000: 0x80000000 0x80000000 0x00000000 0x00000000
0x01c0c010: 0x80000000 0x00000001 0x00000003 0x00000005
0x01c0c020: 0x00000007 0x0000000b 0x0000000d 0x01010000
0x01c0c030: 0x15151111 0x57575555 0x7f7f7777 0x00000000
0x01c0c040: 0x800001f5 0xf000000a 0x01df0355 0x01f30009
0x01c0c050: 0x06b80003 0x00010001 0x00000000 0x00000000
0x01c0c060: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c070: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c080: 0x00000000 0x00000000 0x00000000 0xe0000000
0x01c0c090: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c0a0: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c0b0: 0x00010001 0x00000000 0x00000000 0x00000000
0x01c0c0c0: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c0d0: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c0e0: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c0f0: 0x00000000 0xffffffff 0x40840000 0xa0e24000
0x01c0c100: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c110: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c120: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c130: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c140: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c150: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c160: 0x00000000 0x00000000 0x00200000 0x00000000
0x01c0c170: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c180: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c190: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c1a0: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c1b0: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c1c0: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c1d0: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c1e0: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c1f0: 0x01860003 0x00000000 0x00000000 0x00000000
0x01c0c200: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c210: 0x00000000 0x00000000 0x00000000 0x00000000
0x01c0c220: 0x00000000                                 
root@camdroid:/sys/class/sunxi_dump # echo 01c0c040 800001f5 > write          
root@camdroid:/sys/class/sunxi_dump # echo 01c0c040 800001f4 > write          
root@camdroid:/sys/class/sunxi_dump #
root@camdroid:/sys/class/sunxi_dump #
root@camdroid:/sys/class/sunxi_dump # echo 01c0c040 800001f0 > write     

你可能感兴趣的:(linux LCD调试)