Melis4.0[D1s]:4.测试笔记 - 内嵌的显示命令
文章目录
melis内嵌了很多测试示例,今天测试了一下显示部分的命令,开发板是mango-MQ-r-F133。
1.配置将显示测试源码包含进工程(默认是包含了)
2.不要启动melis桌面系统
修改《startup.sh》(位于目录 D1s-Melis/projects/d1s-mq/data/UDISK/startup.sh):
经过上面的修改,再编译,烧录,运行,就只能通过串口命令行和Melis的uart0进行交互。
在控制台输入 help,出现可用的全部命令:
msh />help
RT-Thread shell commands:
drvavs - rtthread avs test code
test_dms_uart - test dms uart
power_info - power_info
sdmmctest - SdmmcTestCommand
aplay - Play music
arecord - Record voice
aduplex - Playback and Record
amixer - amixer utils
soundcard - soundcard info
disp - disp cmd
hal_gpio - gpio hal APIs tests
hal_twi - twi hal APIs tests
hal_spi - spi hal APIs tests
hal_gpadc - gpadc hal APIs tests
hal_rtc - rtc hal APIs tests
hal_udc - udc hal APIs tests
hal_udc_dl_adjust - udc hal driverlevel adjust
hal_udc_ed_test - udc hal ed tests
hal_hci_rm - hci hal APIs tests
hal_hci - hci hal APIs tests
hci_dl_adjust - hci driver level adjust
hci_ed_test - hci hal ed tests
disp_mem - disp mem
disp_layer_cfg - disp set layer
disp_layer_alpha_test - disp_layer_alpha_test
disp_layer_scal_test - disp_layer_scal_test
disp_layer_format_test - disp_layer_format_test
disp_lbc_test - disp lbc test
ths_gt - thermal get temp
cmd_hal_twi - hal twi test code
cmd_drv_twi - rtthread twi test code
willow_close - willow_close
willow_test - willow_test
cedar_close - cedar_close
cedar_test - cedar_test
audio_close_test - audio_close_test
audio_test - audio_play_test
record_close - record_close_test
wav_rec_test - wav_rec_test
mp3_rec_test - mp3_rec_test
wintest - wintest
save_layer_fb - mod_save_layer_fb
display_switch - display_switch
mod_display_testcmd - mod_display_testcmd
lcdbl_num - lcdbl_num
lcdbl_off - lcdbl_off
lcdbl_on - lcdbl_on
layer_open - mod_layer_open
layer_close - mod_layer_close
install_mod_display - install_mod_display
layer_request - mod_layer_request
layer_release - mod_layer_release
get_lcd_size - get_lcd_size
lcdget_backcolor - lcdget_backcolor
lcdset_backcolor - lcdset_backcolor
mod_display_scaler_test - mod_display_scaler_test
mod_display_alpha_test - mod_display_alpha_test
lbc_show_test - lbc_show_test
yuv_show_test - yuv_show_test
argb_show_test2 - argb_show_test2
argb_show_test - argb_show_test
list_device - list device in system
list_timer - list timer in system
list_memheap - list memory heap in system
list_msgqueue - list message queue in system
list_mailbox - list mail box in system
list_mutex - list mutex in system
list_event - list event in system
list_sem - list semaphore in system
query_thread - query thread
list_thread - list thread
version - show RT-Thread version information
helloworld - say hello to RT-Thread
free - Show the memory usage in the system.
ps - List threads in the system.
help - RT-Thread shell help.
hello - say hello shell
echo - echo string to file
df - disk free
mkfs - format disk with file system
mkdir - Create the DIRECTORY.
pwd - Print the name of the current working directory.
cd - Change the shell working directory.
cat - Concatenate FILE(s)
mv - Rename SOURCE to DEST.
cp - Copy SOURCE to DEST.
adbd - adbd service
fork - create a thread to run a command
chip_name - chip name information.
uname - cat system.
slabinfo - slab information.
listirq - list irq handler.
m - modify memory or register value
p - print memory or register value
$ - enter panic mode
reboot - reboot or jump to efex
top - top task
mmlk - memory leak check command
backtrace - backtrace command
getprop - getprop service
date - See now date
exit - Exit current console
send_key - send a to keyboar of input system
uninsmod - uninstall a mod
insmod - install a mod
update - update system
mtop - test bus width
ths_set_s - thermal set strategy
tail - read file from tail
touch - create empty file
grep - search string from file
hd - the same as 'hexdump -C'
hexdump - dump binary data in decimal
ll - the same as 'ls -kl'
ls - list file or directory
rm - Remove(unlink) the FILE(s).
rwcheck - do read / write check
umount - umount filesystem
mount - mount filesystem
list_fd - list file descriptor
mount_table - show mount table
其中和显示相关的有几个命令:
3.开始测试
3.1 disp 命令
disp命令的相关源码位于 《D1s-Melis/ekernel/drivers/hal/source/disp2/disp/disp_debug.c》 文件里面:
命令 参数 | 含义 |
---|---|
disp 不带参数 | 打印显示信息 |
disp -c | colorbar 颜色测试 |
disp -r | 打印显示相关的寄存器数内容 |
disp -s | switch display ,切换显示接口 |
disp -d | dump de data |
disp -e | enhance,设置 enhance相关参数 |
disp -b | backlight,背光设置 |
3.1.1 disp不带参数时,打印显示信息:
msh />disp
screen 0:
de_rate 300000000 hz, ref_fps: 59
mgr0: 800x480 fmt[rgb] cs[0x204] range[full] eotf[0x4] bits[8bits] err[0] force_sync[0] unblank direct_show[false]
dmabuf: cache[0] cache max[0] umap skip[0] overflow[0]
lcd output backlight(192) fps:58.4 800x 480
err:0 skip:4 irq:54192 vsync:0 vsync_skip:0
BUF enable ch[0] lyr[0] z[0] prem[N] a[pixel 255] fmt[ 0] fb[ 640, 480; 640, 480; 640, 480] crop[ 0, 0, 640, 480] frame[ 80, 0, 640, 480] addr[0x40f5f000,0x00000000,0x00000000] flags[0x 0] trd[0,0]
3.1.2 disp -c 0 8 测试4种颜色
# disp -c 表示颜色测试,下面的 0表示screen0,8 表示显示内嵌的4种颜色
disp -c 0 8
测试效果:
源码中对最后面一个参数的注释:
/*val:*/
/*0:DE-->tcon-->other interface*/
/*1-7:tcon or edp or other device's builtin patten*/
/*for tcon:*/
/*1:color bar*/
/*2:grayscale check*/
/*3:black and white check*/
/*4:all 0*/
/*5:all 1*/
/*6:reserve*/
/*7:Gridding*/
/*for edp:*/
/*1:colorbar*/
/*2:mosaic*/
测试下面的命令:
disp -c 0 1
效果:
继续测试:
disp -c 0 2
效果,有些灰阶:
继续测试:
disp -c 0 3
效果和 disp -c 0 2 接近,纯灰,没有阶梯感。
disp -c 0 4 是全部黑色, disp -c 0 5 是全部白色。
disp -c 0 6 和disp -c 0 8 一样。
继续测试:
disp -c 0 7
网格效果:
3.2 disp_layer_cfg 命令
这个命令的源文件是 《D1s-Melis/ekernel/drivers/hal/test/disp2/disp_layer_cfg.c》 。
本命令用于对下面结构体赋值:
struct test_layer_cfg
{
int screen_id;
int layer_id;
int mem_id;
struct disp_layer_config layer_cfg;
int addr_map;
int width,height;//screen size
rt_device_t dispfh;//device node handle
FILE *fh;//picture resource file handle
void* mem;
int clear;//is clear layer
int fullscreen;//is full screen
char filename[32];
};
struct disp_layer_config {
struct disp_layer_info info;
bool enable;
unsigned int channel;
unsigned int layer_id;
};
struct disp_layer_info {
enum disp_layer_mode mode;/* 0- LAYER_MODE_BUFFER;1-LAYER_MODE_COLOR */
unsigned char zorder;
/* 0: pixel alpha; 1: global alpha; 2: global pixel alpha */
unsigned char alpha_mode;
unsigned char alpha_value; /* global alpha value */
struct disp_rect screen_win; /* display window on the screen */
bool b_trd_out; /* 3d display */
enum disp_3d_out_mode out_trd_mode; /* 3d display mode */
union {
unsigned int color; /* valid when LAYER_MODE_COLOR */
struct disp_fb_info fb; /* valid when LAYER_MODE_BUFFER */
};
unsigned int id; /* frame id, the id of frame display currently */
};
struct disp_fb_info {
/* address of frame buffer,
* single addr for interleaved fomart,
* double addr for semi-planar fomart
* triple addr for planar format
*/
unsigned long long addr[3];
struct disp_rectsz size[3];
/* align for 3 comonent,unit: bytes */
unsigned int align[3];
enum disp_pixel_format format;
enum disp_color_space color_space; /* color space */
unsigned int trd_right_addr[3]; /* right address of 3d fb */
bool pre_multiply; /* true: pre-multiply fb */
struct disp_rect64 crop; /* crop rectangle boundaries */
enum disp_buffer_flags flags;
enum disp_scan_flags scan;
unsigned int lbc_en;
struct disp_lbc_info lbc_info;
};
struct disp_rect64 {
long long x; /* */
long long y;
long long width;
long long height;
};
命令 参数 | 设置变量 |
---|---|
disp_layer_cfg -ch | test_layer_cfg.screen_id |
disp_layer_cfg -mem_id | test_layer_cfg. mem_id |
disp_layer_cfg -channel_id | test_layer_cfg. layer_cfg.channel |
disp_layer_cfg -in_fb | test_layer_cfg. layer_cfg.info.fb.format |
disp_layer_cfg -layer_mode | test_layer_cfg.layer_cfg.info.mode |
disp_layer_cfg -alpha | test_layer_cfg.layer_cfg.info.alpha_value |
disp_layer_cfg -screen_win | test_layer_cfg. layer_cfg.info.screen_win |
disp_layer_cfg -layer_id | layer_cfg.layer_id |
这个命令用到下面的实例:
disp_layer_cfg -in_fb 0 800 480 0 0 800 480 4
对应源码:
if ( ! strcmp(argv[i], "-in_fb")) {
if (argc > i+8) {
i++;
p->layer_cfg.info.fb.format = atoi(argv[i]);
i++;
p->layer_cfg.info.fb.size[0].width = atoi(argv[i]);
i++;
p->layer_cfg.info.fb.size[0].height = atoi(argv[i]);
i++;
p->layer_cfg.info.fb.crop.x = atoi(argv[i]);
i++;
p->layer_cfg.info.fb.crop.y = atoi(argv[i]);
i++;
p->layer_cfg.info.fb.crop.width = atoi(argv[i]);
i++;
p->layer_cfg.info.fb.crop.height = atoi(argv[i]);
i++;
p->layer_cfg.info.fb.align[0] = atoi(argv[i]);
} else {
printf("-in_fb para err!\n\n");
err ++;
}
}
3.3 disp_mem 对显示内存写入内容
命令 参数 | 设置变量 |
---|---|
disp_mem -mem_id | 显示内存索引 |
disp_mem -size | 显示范围的宽和高 |
disp_mem -file | 将文件中的数据写入显示内存,如果文件名以rbg三个字母中的一个开头,就全部显示单一颜色,r=红,g=绿,b=蓝 |
本命令要配合上一节的disp_layer_cfg 命令,依次输入:
# 1.对显示内存全部填充红色
disp_mem -mem_id 0 -size 800 480 -file r
# 2.配置显示图层
disp_layer_cfg -in_fb 0 800 480 0 0 800 480 4
显示效果:
3.3.1 disp_mem 测试源码有错误,更正
源码文件路径 《D1s-Melis/ekernel/drivers/hal/test/disp2/disp_mem.c》 。
修改为:
while(count--) {
*(tmp + 3) = 0xff;//A
*(tmp + 2) = filename[0]=='r'?0xff:0;//R
*(tmp + 1) = filename[0]=='g'?0xff:0;//G
*(tmp + 0) = filename[0]=='b'?0xff:0;//B
tmp+=4;
}