Fpga端使用pcie接口往arm cpu主动发起写DMA数据传输。
写数据的时候,ARM Linux报内存控制器错误。该错误最后定位的原因是iova地址不对,和arm linux实际申请的dma内存地址不匹配。
Fpga dma的目的地址是由dma_alloc_coherent函数申请获得的物理地址,
该物理地址和错误log中的iova=0xc001000不相等,并且存在一个偏移量。
尝试修改fpga dma地址,可以拼凑出和iova相等的情况,这个时候fpga发送的数据能正常写入到ARM的内存中。
下面两种内存申请方式,均会存在上述错误。
pd->readBuffer = dma_alloc_coherent(&pdev->dev, BUF_SIZE, &pd->readHWAddr, GFP_KERNEL );
pd->readHWAddr = pci_map_single(pdev, pd->readBuffer, BUF_SIZE, PCI_DMA_FROMDEVICE);
1. 使用dma_alloc_coherent返回的物理地址能否作为pcie传输地址?
2. 如果dma_alloc_coherent返回的地址不能作为pcie地址,那么内存的iova地址如何获得?
又尝试了一下QSPI Flash的编译,又遇到了一些问题,不过最后还是解决了。
根据PetaLinux工具文档,QSPI Flash的编译需要修改以下配置(还是运行petalinux-config进行修改):
Subsystem AUTO Hardware Settings - Advanced Bootable Images Storage Settings,选择JFFS2,并且进行相关配置(主要是把各种device都改成primary flash)。
Subsystem AUTO Hardware Settings - Flash Settings,修改分区表信息,需要在boot、bootenv、kernel之后再建立一个jffs2分区,并分配合适的空间。
Image Packaging Configuration,确保Root filesystem type为JFFS2,并且调整jffs2 erase block size(本例为64 KiB)。
在修改并重新编译后,将BOOT.bin、image.ub和rootfs.jffs2文件按照分区表拼接在一起,并且通过SD卡写入到QSPI Flash中。
但是,重启之后发现,在Linux启动的时候,将会弹出大量的jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at ...的错误。
搜索了一下,发现是因为内核默认使用了4K大小的erase sector,但当前的QSPI Flash不支持,因此出现此错误。
知道了问题,解决方法就简单了。运行petalinux-config -c kernel进行内核配置,进入到Device Driver - Memory Technology Device (MTD) support - SPI-NOR device support,关闭Use small 4096 B erase sectors即可。最后同样上传一下编译好的flash镜像:flash.zip
我也遇到这个问题了,我的qspi flash为MX25L25635F,部署jffs2出现jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0078ff58: 0x00bf instead 错误。
按照你的方法,修改了下内核spi擦除大小,错误依旧。 网上有人说是内核版本问题,目前没有尝试,感觉这么基础的问题,不应该发生
edgeboard lite 用的是什么qspi? 一般的qspi都是支持4k扇区擦除才对呀
看来这个方式只能尽量避免了。
昨天查了下hotplug相关资料,发现基本上针对usb host挂载wifi、u盘之类的应用。不知道针对usb slave是怎么实现hotplug的?
我尝试使用网上提到的NETlink方式截获内核消息,在虚拟机上试验,能截获到U盘插拔动作。在arm linux端试验,无法截获usb slave的插拔。不知道是不是内核配置问题?
int main(void)
{
struct sockaddr_nl clt;
struct timeval t1;
fd_set fd;
int buf_size = 2048, len, ret, usb_test;
//创建套接字
usb_test = socket(AF_NETLINK, SOCK_RAW, NETLINK_KOBJECT_UEVENT);
memset(&clt, 0, sizeof(clt));
clt.nl_pid = getpid();
clt.nl_family = AF_NETLINK;
clt.nl_groups = 1;
setsockopt(usb_test, SOL_SOCKET, SO_RCVBUF, &buf_size, sizeof(buf_size));
//绑定套接字
bind(usb_test, (struct sockaddr*)&clt, sizeof(clt));
while (1)
{
char buf[2048];
memset(&buf,0,sizeof(buf));
FD_ZERO(&fd);
FD_SET(usb_test, &fd);
//监测频率周期
t1.tv_sec = 0;
t1.tv_usec = 50 * 1000;
//监测
ret = select(usb_test + 1, &fd, NULL, NULL, &t1);
if(ret < 0)
continue;
if(!(ret > 0 && FD_ISSET(usb_test, &fd)))
continue;
len = recv(usb_test, &buf, sizeof(buf), 0);
if (len > 0)
{
printf("%s\n", buf);//打印收到的数据
}
}
close(usb_test);
return 0;
}
搜索网络,根据这篇比较有代表的帖子: https://blog.csdn.net/zjujoe/article/details/4887936/
其中提到修改 CONSISTENT_DMA_SIZE 常量,我尝试将该常量由8改为16MB,依然出错。
怀疑系统内存不够,尝试将编解码功能去掉,节约了12MB内存后,依然出错。
该问题可能原因是?
如题,在linux下,将fb尺寸改为1024*768后,驱动在申请内存的时候出错,系统崩溃。改为1024*600,申请正常。
0.860000] ---w55fa92fb_init ----w55fa92 frame buffer init
[ 0.860000] ###########w55fa92 frame buffer probe############
[ 0.890000] 1*** fbi->fb->fix.smem_len = 0x438000
[ 0.890000] ------------[ cut here ]------------
[ 0.890000] WARNING: at mm/page_alloc.c:1968 __alloc_pages_nodemask+0x148/0x568()
[ 0.900000] Modules linked in:
[ 0.900000] Backtrace:
[ 0.910000] [<c030b7f4>] (dump_backtrace+0x0/0x110) from [<c030bd54>] (dump_stack+0x18/0x1c)
[ 0.910000] r6:c03515a0 r5:c05dba40 r4:000007b0
[ 0.920000] [<c030bd3c>] (dump_stack+0x0/0x1c) from [<c031b68c>] (warn_slowpath_common+0x58/0x70)
[ 0.930000] [<c031b634>] (warn_slowpath_common+0x0/0x70) from [<c031b6c8>] (warn_slowpath_null+0x24/0x2c)
[ 0.940000] r8:c3c1a000 r7:00000000 r6:0000000b r5:000000d0 r4:c064d511
[ 0.940000] [<c031b6a4>] (warn_slowpath_null+0x0/0x2c) from [<c03515a0>] (__alloc_pages_nodemask+0x148/0x568)
[ 0.950000] [<c0351458>] (__alloc_pages_nodemask+0x0/0x568) from [<c030d978>] (__dma_alloc+0x100/0x2b0)
[ 0.960000] [<c030d878>] (__dma_alloc+0x0/0x2b0) from [<c030db50>] (dma_alloc_writecombine+0x28/0x34)
[ 0.970000] [<c030db28>] (dma_alloc_writecombine+0x0/0x34) from [<c056b1e0>] (w55fa92fb_probe+0x400/0x9fc)
[ 0.980000] [<c056ade0>] (w55fa92fb_probe+0x0/0x9fc) from [<c044c62c>] (platform_drv_probe+0x20/0x24)
[ 0.990000] [<c044c60c>] (platform_drv_probe+0x0/0x24) from [<c044b41c>] (driver_probe_device+0xb8/0x174)
[ 1.000000] [<c044b364>] (driver_probe_device+0x0/0x174) from [<c044b6cc>] (__driver_attach+0x6c/0x90)
[ 1.010000] r7:c062ae30 r6:c062ae30 r5:c06226f4 r4:c06226c0
[ 1.020000] [<c044b660>] (__driver_attach+0x0/0x90) from [<c044a660>] (bus_for_each_dev+0x58/0x8c)
[ 1.020000] r6:c044b660 r5:c3c1bef0 r4:00000000
[ 1.030000] [<c044a608>] (bus_for_each_dev+0x0/0x8c) from [<c044b270>] (driver_attach+0x20/0x28)
[ 1.040000] r7:00000013 r6:c3416e40 r5:c062ae30 r4:c001d3b8
[ 1.040000] [<c044b250>] (driver_attach+0x0/0x28) from [<c044adfc>] (bus_add_driver+0xa8/0x238)
[ 1.050000] [<c044ad54>] (bus_add_driver+0x0/0x238) from [<c044b974>] (driver_register+0xb0/0x13c)
[ 1.060000] [<c044b8c4>] (driver_register+0x0/0x13c) from [<c044c86c>] (platform_driver_register+0x4c/0x60)
[ 1.070000] [<c044c820>] (platform_driver_register+0x0/0x60) from [<c0015728>] (w55fa92fb_init+0x24/0x34)
[ 1.080000] [<c0015704>] (w55fa92fb_init+0x0/0x34) from [<c03073a8>] (do_one_initcall+0x60/0x1ac)
[ 1.090000] [<c0307348>] (do_one_initcall+0x0/0x1ac) from [<c00087a4>] (kernel_init+0xb0/0x168)
[ 1.100000] [<c00086f4>] (kernel_init+0x0/0x168) from [<c031ece8>] (do_exit+0x0/0x658)
[ 1.110000] r5:c00086f4 r4:00000000
[ 1.110000] ---[ end trace dec6997083161631 ]---
[ 1.110000] 1*** _bg_mem_v 0x0
[ 1.120000] 1*** _bg_mem_p 0xffffffff
[ 1.120000] Failed to register framebuffer device: ENOMEM
[ 1.130000] REG_LCM_LCDCPrm=0x43848805
[ 1.130000] REG_LCM_TCON1=0xa0028058
[ 1.130000] REG_LCM_TCON2=0x91512
[ 1.140000] REG_LCM_TCON3=0x3ff02cf
[ 1.140000] REG_LCM_TCON4=0x3200103
[ 1.140000] REG_LCM_LCDCCtl=0x410013
[ 1.150000] check_var(var=c3c9f020, info=c3c9f000)
完整的启动logo如下:
[ 0.000000] Linux version 2.6.35.4 (root@nuvoton) (gcc version 4.2.1) #358 PREEMPT Sat Oct 27 14:51:47 CST 2018
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] Machine: W55FA92
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] Decoder Instance-0, width = 1280, height = 720
[ 0.000000] Decoder Instance-0, offset = 0x0, total buf size = 0x77b000
[ 0.000000] Encoder Instance-0, width = 1280, height = 720
[ 0.000000] Encoder Instance-0, offset = 0x0, total buf size = 0x42f000
[ 0.000000] TOTAL_VDE_BUF_SIZE = 0xbaa000, dec_total=0x77b000, enc_total=0x42f000
[ 0.000000] AVC Buffer Size: 0xbaa000
[ 0.000000] VIN_DEV1 Buffer Size: 0x906000
[ 0.000000] CPU type 0x00fad007 is W55FA92
[ 0.000000] w55fa92_external_clock = 12.0 MHz
[ 0.000000] w55fa92_apll_clock = 432000 KHz
[ 0.000000] w55fa92_upll_clock = 240000 KHz
[ 0.000000] w55fa92_mpll_clock = 360000 KHz
[ 0.000000] w55fa92_system_clock = 240000 KHz
[ 0.000000] w55fa92_cpu_clock = 240000 KHz
[ 0.000000] w55fa92_ahb_clock = 120000 KHz
[ 0.000000] w55fa92_apb_clock = 60000 KHz
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: root=/dev/ram0 console=ttyS1,115200n8 rdinit=/sbin/init mem=64M vt.global_cursor_default=0
[ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Memory: 64MB = 64MB total
[ 0.000000] Memory: 37232k/37232k available, 28304k reserved, 0K highmem
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] DMA : 0xfee00000 - 0xffe00000 ( 16 MB)
[ 0.000000] vmalloc : 0xc4800000 - 0xe0000000 ( 440 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
[ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[ 0.000000] .init : 0xc0008000 - 0xc0307000 (3068 kB)
[ 0.000000] .text : 0xc0307000 - 0xc061d000 (3160 kB)
[ 0.000000] .data : 0xc061e000 - 0xc063ac20 ( 116 kB)
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU-based detection of stalled CPUs is disabled.
[ 0.000000] Verbose stalled-CPUs detection is disabled.
[ 0.000000] NR_IRQS:47
[ 0.000000] Console: colour dummy device 80x30
[ 0.000000] w55fa92_serial_initconsole, w55fa92-uart
[ 0.000000] w55fa92_serial_init_ports: initialising ports...
[ 0.000000] w55fa92_serial_init_port: port=c062e6ac, platdev=c0623708
[ 0.000000] w55fa92_serial_init_port: c062e6ac (hw 0)...
[ 0.000000] resource c0623698 (b8008000..b80080ff)
[ 0.000000] port: map=b8008000, mem=f8008000, irq=14, clock=12000000
[ 0.000000] w55fa92_serial_resetport: port=c062e6ac (b8008000), cfg=c0624118
[ 0.000000] w55fa92_serial_init_port: port=c062e750, platdev=c06237c0
[ 0.000000] w55fa92_serial_init_port: c062e750 (hw 1)...
[ 0.000000] resource c06236d0 (b8008100..b80081ff)
[ 0.000000] port: map=b8008100, mem=f8008100, irq=30, clock=12000000
[ 0.000000] w55fa92_serial_resetport: port=c062e750 (b8008100), cfg=c0624134
[ 0.000000] w55fa92_serial_console_setup: port=c062e750 (1)
[ 0.000000] w55fa92_serial_console_setup: baud 115200
[ 0.000000] baud=115200, quot=102
[ 0.000000] w-config: 8bits/char
[ 0.000000] console [ttyS1] enabled
[ 0.000000] w55fa92_avc_alloc_mem : Kernel allocate phy buf addr =0x665000, vir_addr = 0xc0665000
[ 0.000000] ENCODER_TOTAL_SIZE = 0x42f000, DECODER_TOTAL_SIZE = 0x77b000
[ 0.000000] w55fa92_avc_alloc_mem,_ENCODER_BUF_START = 0x665000, _DECODER_BUF_START = 0xa94000,
[ 0.030000] Calibrating delay loop... 119.60 BogoMIPS (lpj=598016)
[ 0.270000] pid_max: default: 32768 minimum: 301
[ 0.270000] Mount-cache hash table entries: 512
[ 0.280000] CPU: Testing write buffer coherency: ok
[ 0.280000] devtmpfs: initialized
[ 0.290000] NET: Registered protocol family 16
[ 0.440000] bio: create slab <bio-0> at 0
[ 0.450000] SCSI subsystem initialized
[ 0.450000] usbcore: registered new interface driver usbfs
[ 0.460000] usbcore: registered new interface driver hub
[ 0.470000] usbcore: registered new device driver usb
[ 0.480000] cfg80211: Calling CRDA to update world regulatory domain
[ 0.490000] Switching to clocksource w55fa92-timer1
[ 0.600000] NET: Registered protocol family 2
[ 0.610000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.620000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.620000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.630000] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.630000] TCP reno registered
[ 0.640000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.640000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.650000] NET: Registered protocol family 1
[ 0.660000] RPC: Registered udp transport module.
[ 0.660000] RPC: Registered tcp transport module.
[ 0.660000] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.830000] register clock device
[ 0.830000] w55fa92_edma_init
[ 0.840000] ROMFS MTD (C) 2007 Red Hat, Inc.
[ 0.850000] msgmni has been set to 72
[ 0.850000] io scheduler noop registered (default)
[ 0.860000] ---w55fa92fb_init ----w55fa92 frame buffer init
[ 0.860000] ###########w55fa92 frame buffer probe############
[ 0.890000] 1*** fbi->fb->fix.smem_len = 0x438000
[ 0.890000] ------------[ cut here ]------------
[ 0.890000] WARNING: at mm/page_alloc.c:1968 __alloc_pages_nodemask+0x148/0x568()
[ 0.900000] Modules linked in:
[ 0.900000] Backtrace:
[ 0.910000] [<c030b7f4>] (dump_backtrace+0x0/0x110) from [<c030bd54>] (dump_stack+0x18/0x1c)
[ 0.910000] r6:c03515a0 r5:c05dba40 r4:000007b0
[ 0.920000] [<c030bd3c>] (dump_stack+0x0/0x1c) from [<c031b68c>] (warn_slowpath_common+0x58/0x70)
[ 0.930000] [<c031b634>] (warn_slowpath_common+0x0/0x70) from [<c031b6c8>] (warn_slowpath_null+0x24/0x2c)
[ 0.940000] r8:c3c1a000 r7:00000000 r6:0000000b r5:000000d0 r4:c064d511
[ 0.940000] [<c031b6a4>] (warn_slowpath_null+0x0/0x2c) from [<c03515a0>] (__alloc_pages_nodemask+0x148/0x568)
[ 0.950000] [<c0351458>] (__alloc_pages_nodemask+0x0/0x568) from [<c030d978>] (__dma_alloc+0x100/0x2b0)
[ 0.960000] [<c030d878>] (__dma_alloc+0x0/0x2b0) from [<c030db50>] (dma_alloc_writecombine+0x28/0x34)
[ 0.970000] [<c030db28>] (dma_alloc_writecombine+0x0/0x34) from [<c056b1e0>] (w55fa92fb_probe+0x400/0x9fc)
[ 0.980000] [<c056ade0>] (w55fa92fb_probe+0x0/0x9fc) from [<c044c62c>] (platform_drv_probe+0x20/0x24)
[ 0.990000] [<c044c60c>] (platform_drv_probe+0x0/0x24) from [<c044b41c>] (driver_probe_device+0xb8/0x174)
[ 1.000000] [<c044b364>] (driver_probe_device+0x0/0x174) from [<c044b6cc>] (__driver_attach+0x6c/0x90)
[ 1.010000] r7:c062ae30 r6:c062ae30 r5:c06226f4 r4:c06226c0
[ 1.020000] [<c044b660>] (__driver_attach+0x0/0x90) from [<c044a660>] (bus_for_each_dev+0x58/0x8c)
[ 1.020000] r6:c044b660 r5:c3c1bef0 r4:00000000
[ 1.030000] [<c044a608>] (bus_for_each_dev+0x0/0x8c) from [<c044b270>] (driver_attach+0x20/0x28)
[ 1.040000] r7:00000013 r6:c3416e40 r5:c062ae30 r4:c001d3b8
[ 1.040000] [<c044b250>] (driver_attach+0x0/0x28) from [<c044adfc>] (bus_add_driver+0xa8/0x238)
[ 1.050000] [<c044ad54>] (bus_add_driver+0x0/0x238) from [<c044b974>] (driver_register+0xb0/0x13c)
[ 1.060000] [<c044b8c4>] (driver_register+0x0/0x13c) from [<c044c86c>] (platform_driver_register+0x4c/0x60)
[ 1.070000] [<c044c820>] (platform_driver_register+0x0/0x60) from [<c0015728>] (w55fa92fb_init+0x24/0x34)
[ 1.080000] [<c0015704>] (w55fa92fb_init+0x0/0x34) from [<c03073a8>] (do_one_initcall+0x60/0x1ac)
[ 1.090000] [<c0307348>] (do_one_initcall+0x0/0x1ac) from [<c00087a4>] (kernel_init+0xb0/0x168)
[ 1.100000] [<c00086f4>] (kernel_init+0x0/0x168) from [<c031ece8>] (do_exit+0x0/0x658)
[ 1.110000] r5:c00086f4 r4:00000000
[ 1.110000] ---[ end trace dec6997083161631 ]---
[ 1.110000] 1*** _bg_mem_v 0x0
[ 1.120000] 1*** _bg_mem_p 0xffffffff
[ 1.120000] Failed to register framebuffer device: ENOMEM
[ 1.130000] REG_LCM_LCDCPrm=0x43848805
[ 1.130000] REG_LCM_TCON1=0xa0028058
[ 1.130000] REG_LCM_TCON2=0x91512
[ 1.140000] REG_LCM_TCON3=0x3ff02cf
[ 1.140000] REG_LCM_TCON4=0x3200103
[ 1.140000] REG_LCM_LCDCCtl=0x410013
[ 1.150000] check_var(var=c3c9f020, info=c3c9f000)
[ 1.150000] w55fa92fb_set_par !!! =================
[ 1.160000] var->width = 0x400 !!!
[ 1.160000] var->bits_per_pixel = 0x10 !!!
找代理商借了一块高云的开发板,从零开始跑马灯了...
我借的是DK-DEV-GW2AR18 V2.1这一款,含20K LUT4,128Mbit DDR【芯片内置】
1.下载安装开发软件。 http://olg5hhdkc.bkt.clouddn.com/GoWinYunYuan_V1.8.0Beta1_win.rar
目前是1.8版本,官网直接下载,差不多200多MB的样子。
安装没什么特点,注意杀毒软件要退出,我没有退出导致安装中间失败。
许可可以自己申请,也可以找代理商帮忙申请。安装完毕后,需要设置lic的环境变量,具体可以参考用户指南
http://www.gowinsemi.com.cn/faq.aspx 【手册这里都有,无需注册】
2.打开软件,打开一个例子工程,另存到你的工作目录(我用的8bit_counter工程)。
3.简单修改下顶层设计文件。
// Eight bit counter example 1
module counter1(
led,
clk // 50MHz
);
output [3:0] led;
input clk;
reg [23:0] out;
always @(posedge clk)
begin
out <= out + 1;
end
assign led = out[23:20];
endmodule
4.根据开发板LED的管脚,修改管脚位置(cst文件,文本文件,直接修改)。
IO_LOC "clk" 32;
IO_LOC "led[0]" 159;
IO_LOC "led[1]" 160;
IO_LOC "led[2]" 161;
IO_LOC "led[3]" 162;
5.综合,生成烧录文件(.fs文件),很快,我的台式机就十几秒。
6.连接电源,usb,就可以直接下载fs文件了。fs文件可以在线调试,也可以烧录到外部SPI Flash。
跑马灯闪起来了~~~
我已经初步解决了这个问题,没有找到更简单的思路,还是采用上面提到的,自己实现一个简易的shell。
简易的shell,可以参考csdn的这篇帖子。
https://blog.csdn.net/qq_37964547/article/details/79703953
不过,要做到真正实用,要考虑很多方面的问题,比如 字符删除、 快捷键、自动补全、历史命令、甚至环境变量等问题,
如果这样,那就超出本帖要讨论的范畴了。
tom 说:根据晕哥的提示,直接在Ubuntu中mount了一下lib_romfs.bin,lib_roofs主要是minigui的一些运行库、C库等,并没有一起打包busybox等。因此,conprog.bin还是必须包含内核和文件系统。
搞清楚了nuvoton提供的是啥东西,很容易就可以跑demo了,
运行了nuvoton提供的minigui demo,可以正常跑了;
运行了下nuvoton提供的qt4.8.5,也可以正常跑,就是例子给的太简单了(QT版本是窗口中显示一个label, mg版本为打印了一些字符串,做了个按键检测),看不出啥效果~
请问下,nuvoton提供了qt4.8.5吗?在哪里可以下载?运行流畅不?
官方的ftp中有提供一个例子,可以下载看看。我自己没有编译lib,使用的是编译好的文件,测试下而已。
不到300MHz的cpu,运行速度可以想象~
n32926的vpost 显示接口模块提供了两个层,一个是视频输出层,一个是OSD层。
我在官方vin_demo程序的基础上,调试实验了一下该功能,发现有几个问题:
1) 摄像头为YUV格式,在图像预览输出的时候,需要将Framebuffer(第一层)设置为YUV格式,此时OSD也需要设置为YUV,否则不能正常工作。不知道结论是否准确,大家有没有碰到该问题? 非视频预览状态,FB一般是设置为RGB模式的,一般GUI均支持RGB格式,不支持YUV格式,如果OSD必须用YUV,就给UI的实现带来了很多了限制。
2)OSD和视频的Alpha混合貌似只能全局的,这样的话,局部的半透明怎么实现呢?
看了下N32926 Linux SDK的一些相关源码,有一些问题想咨询下
1. 目前这个片子主要使用什么GUI? QT/Minigui/UCGUI ? 我看官方ftp里面资料,貌似倾向于使用Minigui,我现在还没有搭环境测试,以前没用过。QT这种重量级GUI,占资源多,运行效率也是个问题,虽然我没在这个片子上测试 :)
2.GUI的实现,大家是在OSD层,还是视频输出层? 看了下手册,OSD层可以提供和视频输出通道一样分辨率的Framebuffer
3.手册中提到的OSD Bar是个什么概念? 写的有点模糊,没看明白
另外,哪位朋友有编译好的QT lib和Minigui lib吗? 能否分享下,我在板子上运行的试试看
采集端口分为packet和Planar两个通道进入内存,目前Planar通道正常了,Packet通道通过VPOST预览不对。
VPSOT的分辨率设置为720*576(TV分辨率),采集分辨率为640*480,这种情况下,应用程序调用ioctl(VIDIOCSWIN)设置预览窗口,该ioctl对应的设置函数为static unsigned int vin_ioctl_set_overlay_window(struct file *file,unsigned int cmd,void *arg),
该函数主要操作就是设置Packet基地址和output frame pixel stride寄存器。
为了让图像通过Framebuffer直接显示。我的理解是,由于行方向分辨率不同,为了让图像正常显示,Packet数据包的DMA硬件,应当是每行跳跃720个像素,然后存储到内存, SetStride函数应该就是完成这个功能,这样的话,图像在内存中就不是连续的了,不止理解是否有误?
N32926芯片,使用SPI FLASH启动。
上电启动后,内部loader出现该错误提示:
Initial RTC .Enable Access Fail - Timeout
DRAM Init..1f1f1f1f1f
内核启动后,卡死在RTC初始化中的一个死循环。该死循环是不断检测RTC寄存器是否可以进行读写。
printk("RTC Access Enable Check\n");
while(1)
{
rtc_time_out = 0;
// enable long time press power disable
if ((readl(REG_RTC_AER) & 0x10000) == 0x0) {
// set RTC register access enable password
writel(0xA965, REG_RTC_AER);
// make sure RTC register read/write enable
while ((readl(REG_RTC_AER) & 0x10000) == 0x0)
{
rtc_time_out++;
if(rtc_time_out > 0xFFFFFF)
{
printk("RTC Access Eanble Fail. AER:0x%X.\n", readl(REG_RTC_AER));
break;
}
}
rtc_wait_ready();
if ((readl(REG_RTC_AER) & 0x10000) == 0x10000)
break;
}
else
break;
}
完整的启动信息如下:
Initial RTC .Enable Access Fail - Timeout
DRAM Init..1f1f1f1f1f
SD Port 0 Booting - EMMC Fail - No Boot Code Header
NAND CS0 Booting Fail - No Boot Code Header
NAND CS1 Booting Fail - No Boot Code Header
SPI Booting
Write - 0xB0000204 = 0xFFFFFFFF
Write - 0xB0000208 = 0xFFFFFFFF
Write - 0xB0003008 = 0x0000805A
Write - 0xB0003028 = 0x2AFF3B4A
Write - 0xB0003004 = 0x00000021
Delay 256 us
Write - 0xB0003004 = 0x00000023
Write - 0xB0003004 = 0x00000027
Delay 256 us
Write - 0xB000301C = 0x00002402
Delay 256 us
Write - 0xB0003018 = 0x00000532
Delay 256 us
Write - 0xB0003004 = 0x00000027
Delay 256 us
Write - 0xB0003004 = 0x0000002B
Delay 256 us
Write - 0xB0003004 = 0x0000002B
Delay 256 us
Write - 0xB0003018 = 0x00000432
Delay 256 us
Write - 0xB000301C = 0x00002782
Delay 256 us
Write - 0xB000301C = 0x00002402
Delay 256 us
Write - 0xB0003004 = 0x00000020
Delay 256 us
Write - 0xB0003054 = 0x00000013
Delay 4096 us
Write - 0xB0003054 = 0x0000001E
Delay 20480 us
DRAM CMD0
Delay 4096 us
DRAM CMD2
DRAM CMD2
Write - 0xB0003054 = 0x0000001A
Delay 8192 us
Write - 0xB0000208 = 0x00008354
Write - 0xB0000204 = 0x00E5011F
Success
Execute Address 0x00900000
SPI Loader start (20140710).
Want to set DRAM DIV REG = 0x8
11111.13.Ap3:MPLL REG = 0x1178
DRAM DIV REG = 0x8
Enable HW Power Off
Load Image Load file length 0x400, execute address 0x80905C40
Load file length 0x4A38A0, execute address 0x0
Jump to kernelLinux version 2.6.35.4 (root@nuvoton) (gcc version 4.2.1) #195 PREEMPT Wed Mar 14 19:18:59 CST 2018
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: W55FA92
Memory policy: ECC disabled, Data cache writeback
Decoder Instance-0, width = 1280, height = 720
Decoder Instance-0, offset = 0x0, total buf size = 0x77b000
Encoder Instance-0, width = 1280, height = 720
Encoder Instance-0, offset = 0x0, total buf size = 0x42f000
TOTAL_VDE_BUF_SIZE = 0xbaa000, dec_total=0x77b000, enc_total=0x42f000
AVC Buffer Size: 0xbaa000
VIN_DEV1 Buffer Size: 0x238800
CPU type 0x00fad007 is W55FA92
w55fa92_external_clock = 12.0 MHz
w55fa92_apll_clock = 432000 KHz
w55fa92_upll_clock = 240000 KHz
w55fa92_mpll_clock = 360000 KHz
w55fa92_system_clock = 240000 KHz
w55fa92_cpu_clock = 240000 KHz
w55fa92_ahb_clock = 120000 KHz
w55fa92_apb_clock = 60000 KHz
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: root=/dev/ram0 console=ttyS1,115200n8 rdinit=/sbin/init mem=64M vt.global_cursor_default=0
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 45856k/45856k available, 19680k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xff600000 - 0xffe00000 ( 8 MB)
vmalloc : 0xc4800000 - 0xe0000000 ( 440 MB)
lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.init : 0xc0008000 - 0xc0142000 (1256 kB)
.text : 0xc0142000 - 0xc0486000 (3344 kB)
.data : 0xc0486000 - 0xc04a3820 ( 119 kB)
Hierarchical RCU implementation.
RCU-based detection of stalled CPUs is disabled.
Verbose stalled-CPUs detection is disabled.
NR_IRQS:47
Console: colour dummy device 80x30
w55fa92_serial_initconsole, w55fa92-uart
w55fa92_serial_init_ports: initialising ports...
w55fa92_serial_init_port: port=c0496654, platdev=c048b748
w55fa92_serial_init_port: c0496654 (hw 0)...
resource c048b6d8 (b8008000..b80080ff)
port: map=b8008000, mem=f8008000, irq=14, clock=12000000
w55fa92_serial_resetport: port=c0496654 (b8008000), cfg=c048c158
w55fa92_serial_init_port: port=c04966f8, platdev=c048b800
w55fa92_serial_init_port: c04966f8 (hw 1)...
resource c048b710 (b8008100..b80081ff)
port: map=b8008100, mem=f8008100, irq=30, clock=12000000
w55fa92_serial_resetport: port=c04966f8 (b8008100), cfg=c048c174
w55fa92_serial_console_setup: port=c04966f8 (1)
w55fa92_serial_console_setup: baud 115200
baud=115200, quot=102
w-config: 8bits/char
console [ttyS1] enabled
w55fa92_avc_alloc_mem : Kernel allocate phy buf addr =0x4c7000, vir_addr = 0xc04c7000
ENCODER_TOTAL_SIZE = 0x42f000, DECODER_TOTAL_SIZE = 0x77b000
w55fa92_avc_alloc_mem,_ENCODER_BUF_START = 0x4c7000, _DECODER_BUF_START = 0x8f6000,
Calibrating delay loop... 119.19 BogoMIPS (lpj=595968)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
devtmpfs: initialized
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Advanced Linux Sound Architecture Driver Version 1.0.23.
cfg80211: Calling CRDA to update world regulatory domain
Switching to clocksource w55fa92-timer1
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
register clock device
w55fa92_edma_init
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 89
io scheduler noop registered (default)
---w55fa92fb_init ----w55fa92 frame buffer init
###########w55fa92 frame buffer probe############
1*** fbi->fb->fix.smem_len = 0x70800
check_var(var=c3c9b020, info=c3c9b000)
w55fa92fb_set_par !!! =================
var->width = 0x140 !!!
var->bits_per_pixel = 0x10 !!!
w55fa92fb_set_par !!! =================
var->width = 0x140 !!!
var->bits_per_pixel = 0x10 !!!
Console: switching to colour frame buffer device 40x30
w55fa92 LCD driver has been installed successfully
paq 1=0x33cc55aa
w55fa92_gpio_configure()-1,13
w55fa92_gpio_configure()-1,14
paq 2:0xffffffff
w55fa92 paq5406_module initialized successfully!
w55fa92 SysMgr driver has been initialized successfully!
fa92 vpe register char device Successful!
w55fa92 VPE driver has been initialized successfully!
W55FA92 uart driver has been initialized successfully!
w55fa92_serial_init(c04965e4,c0496630)
w55fa92_serial_probe(c048b748, c0496630) 0
w55fa92_serial_probe: initialising port c0496640...
w55fa92_serial_init_port: port=c0496654, platdev=c048b748
w55fa92_serial_probe: adding port
w55fa92-uart0: ttyS0 at MMIO 0xb8008000 (irq = 14) is a W55FA92
w55fa92_serial_probe(c048b800, c0496630) 1
w55fa92_serial_probe: initialising port c04966e4...
w55fa92_serial_init_port: port=c04966f8, platdev=c048b800
w55fa92_serial_probe: adding port
w55fa92-uart1: ttyS1 at MMIO 0xb8008100 (irq = 30) is a W55FA92
brd: module loaded
loop: module loaded
w55fa92_avc_init
fa92 AVC Decoder Supported
FAVC Decoder IRQ mode(33)v1.0
fa92 AVC Encoder Supported
FAVC Encoder IRQ mode(34)v1.0
H264 Driver Version v1.0
### W55FA92 ether driver v0.1 has been initialized successfully!
rtl8150: v0.6.2 (2004/08/27):rtl8150 based usb-ethernet driver
usbcore: registered new interface driver rtl8150
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
USBH2.0 Clock source is UPLL, divider is 5
Over-current is Disabled - REG_OpModEn = 0x00000000
w55fa92-ehci w55fa92-ehci: Nuvoton w55fa92 EHCI Host Controller
w55fa92-ehci w55fa92-ehci: new USB bus registered, assigned bus number 1
w55fa92-ehci w55fa92-ehci: irq 21, io mem 0xb100b000
w55fa92-ehci w55fa92-ehci: USB 2.0 started, EHCI 0.95
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
USB device plug in
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci_hcd_w55fa92_drv_probe
usb_hcd_w55fa92_probe
w55fa92-ohci w55fa92-ohci: Nuvoton W55FA92 OHCI Host Controller
w55fa92-ohci w55fa92-ohci: new USB bus registered, assigned bus number 2
w55fa92-ohci w55fa92-ohci: irq 22, io mem 0xb1005000
ohci_w55fa92_start
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
USB device plug in
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
w55fa92_udc_probe 20140401
w55fa92-rtc w55fa92-rtc: rtc core: registered w55fa92-rtc as rtc0
<USBD - USBD plug>
Check RTC Level Shift Status
-> Level Shift is enabled!
RTC Access Enable Check
RTC Access Eanble Fail. AER:0xA965.
RTC Access Eanble Fail. AER:0xA965.
RTC Access Eanble Fail. AER:0xA965.
RTC Access Eanble Fail. AER:0xA965.
有碰到该问题的吗?帮忙分析下原因。