最近打算用Am5728开发,需要实现arm和dsp间数据交互,打算用dsp缓存L2 ram的部分空间作为交互(空间和实时性无法用IPC)。现在用linux下模块开辟一片空间,用ioremap的方式进行读写。设备树调整如下:
dsp1: dsp@40800000 {
compatible = "ti,dra7-dsp";
reg = <0x40800000 0x40000>,
增加:
compatible = "DEMO,MemoryShare";
reg = <0x40840000 0x4000
0x40844000 0x4000>;
};
linux启动后出现如下错误:
[ 24.058388] omap_hwmod: mmu0_dsp2: _wait_target_disable failed
[ 24.085411] omap_hwmod: mmu1_dsp1: _wait_target_disable failed
[ 24.099194] omap_hwmod: mmu0_dsp1: _wait_target_disable failed
驱动代码:
of_property_read_u32_array(np, "reg", regdata, DATA_LEN);
gpWMPoint = ioremap(regdata[0] , regdata[1]);
gpRMPoint = ioremap(regdata[2] , regdata[3]);
for(i = 0 ; i < 100; i++)
{
*(gpWMPoint + i) = i;
//writel(i, gpWMPoint + i);
}
for( i = 0; i < 10; i++)
{
nBuffer[i] = readl(gpRMPoint + i); //*(gpRMPoint + i);
printk("read adress is: %x ,data is: %x \n",gpRMPoint+i, nBuffer[i]);
}
调用:
fd = open("/dev/MShare",O_RDWR);
read(fd, unReadBuffer, BUFFER_SIZE);
write(fd,unWriteBuffer, BUFFER_SIZE );
会打印其他信息出来,感觉是操作引起异常,有时候linux会死掉。
[ 282.783395] ————[ cut here ]————
[ 282.783408] WARNING: CPU: 1 PID: 28 at drivers/bus/omap_l3_noc.c:147 l3_inte)
[ 282.783414] 44000000.ocp:L3 Standard Error: MASTER MPU TARGET DSP1_SDMA (Reas
[ 282.783521] Modules linked in: ShareMemory(O) bc_example(O) rpmsg_pru rpmsg_)
[ 282.783529] CPU: 1 PID: 28 Comm: irq/23-l3-app-i Tainted: G O 41
[ 282.783532] Hardware name: Generic DRA74X (Flattened Device Tree)
[ 282.783535] Backtrace:
[ 282.783551] [<c0013100>] (dump_backtrace) from [<c00132fc>] (show_stack+0x18)
[ 282.783561] r7:c02e7a0c r6:200e0013 r5:00000000 r4:c09442b4
[ 282.783571] [<c00132e4>] (show_stack) from [<c02bb384>] (dump_stack+0x8c/0xa)
[ 282.783581] [<c02bb2f8>] (dump_stack) from [<c0034794>] (warn_slowpath_commo)
[ 282.783589] r7:c02e7a0c r6:00000093 r5:00000009 r4:ee651e28
[ 282.783598] [<c003470c>] (warn_slowpath_common) from [<c00347fc>] (warn_slow)
[ 282.783609] r8:ee60c610 r7:c082de2c r6:00000002 r5:c082dee0 r4:c082df90
[ 282.783617] [<c00347c8>] (warn_slowpath_fmt) from [<c02e7a0c>] (l3_interrupt)
[ 282.783621] r3:ee60c480 r2:c082df90
[ 282.783624] r4:80080001
[ 282.783633] [<c02e77b0>] (l3_interrupt_handler) from [<c00839d4>] (irq_force)
[ 282.783642] r10:c00839ac r9:ee60c9c0 r8:ee5ff900 r7:00000001 r6:00000000 r50
[ 282.783645] r4:ee60c9c0
[ 282.783653] [<c00839ac>] (irq_forced_thread_fn) from [<c0083d3c>] (irq_threa)
[ 282.783660] r7:00000001 r6:00000000 r5:ee650000 r4:ee60c9e4
[ 282.783668] [<c0083c18>] (irq_thread) from [<c00507cc>] (kthread+0xe4/0xfc)
[ 282.783677] r10:00000000 r9:00000000 r8:00000000 r7:c0083c18 r6:ee60c9c0 r50
[ 282.783679] r4:00000000
[ 282.783687] [<c00506e8>] (kthread) from [<c000fb10>] (ret_from_fork+0x14/0x2)
[ 282.783697] r7:00000000 r6:00000000 r5:c00506e8 r4:ee60ca00
[ 282.783699] —[ end trace 0000000000000002 ]—
感觉向是通过L3访问存储器冲突了。但对整个代码不熟。请问是什么原因?或代码那些地方需要调整?谢谢!
sfloat s:
我想用DSP的L2缓存开辟一片空间用于linux的ARM与DSP数据交互(工作场景不适合用IPC),分配成功后访问出错,感觉是L2的缓存保护了。 请问哪里可以调整ARM和DSP存储器的分配?让L2空出一片空间,让DSP和ARM都可以访问到,谢谢!
yongqing wang:
需要修改DSP程序的resource table来改变共享内存的大小
sfloat s:
回复 yongqing wang:
我没有用TI的RTOS,DSP是直接裸跑,应该不用改resource table吧。 还是因为linux编译的时候包含了DSP的resource table? 如果是那应该在哪里改呢? 谢谢!
yongqing wang:
回复 sfloat s:
我用dsp都是实用它的OpenCL实现
Denny%20Yang99373:
是不是DSP没有打开还在RESET状态?
你这边先跑个OPENCL DEMO同时读写L2就可以了。