Hi,
I was modifying the CE example (video_copy) to test some functions to get cpu/dsp load.
1. What I have done is firstly inserting the dsp load functions
for (n = 0 ;; n++) {
printf("App-> Processing frame %d...\n", n);
if (fread(inBuf, INFRAMESIZE, 1, inFile) == 0) { /* until EOF */
break;
}
status = ceapp_encodeBuf(inBuf, INFRAMESIZE,
encodedBuf, ENCODEDFRAMESIZE);
...
/* test code */
printf("%d%%\n", ceapp_getDspLoad());
status = ceapp_decodeBuf(encodedBuf, ENCODEDFRAMESIZE,
outBuf, OUTFRAMESIZE);
...
/* write to file */
fwrite(outBuf, OUTFRAMESIZE, 1, outFile);
}
where ceapp_getDspLoad() uses dspLoad = Engine_getCpuLoad(ceHandle); to get the dsp load. The app runs w/o errors with the following output:
[root@OMAP3EVM sheng_test]# ./app.out
App-> Application started.
[DSP] @0x00000168:[T:0x00000000] servers.video_copy.evm3530 - main> Welcome to DSP server's main().
CEapp-> Allocating contiguous buffer for 'input data' of size 1024...
CEapp-> Allocating contiguous buffer for 'encoded data' of size 1024...
CEapp-> Allocating contiguous buffer for 'output data' of size 1024...
App-> Processing frame 0...
100%
App-> Processing frame 1...
100%
App-> Processing frame 2...
100%
App-> Processing frame 3...
100%
App-> Processing frame 4...
App-> Finished encoding and decoding 4 frames
App-> Application finished successfully.
2. Then I inserted a function call directly after the printf I inserted in (1). (I did Dmai_init(); after CERuntime_init(); in ceapp_init())
int ceapp_getArmLoad()
{
Cpu_Handle hCpu = NULL;
Cpu_Attrs cpuAttrs = Cpu_Attrs_DEFAULT;
int armLoad;
hCpu = Cpu_create(&cpuAttrs);
if (hCpu == NULL) {
printf("CEapp-> ERROR: Failed to create Cpu Object\n");
}
if (Cpu_getLoad(hCpu, &armLoad) < 0) {
armLoad = 0;
printf("CEapp->ERROR: Failed to get ARM CPU load\n");
}
printf("Arm cpu is loaded %d%%\n", armLoad);
if (hCpu) {
Cpu_delete(hCpu);
}
return armLoad;
}
I got a crash when running the app.
[root@OMAP3EVM sheng_test]# ./app.out
App-> Application started.
[DSP] @0x0000016e:[T:0x00000000] servers.video_copy.evm3530 - main> Welcome to DSP server's main().
CEapp-> Allocating contiguous buffer for 'input data' of size 1024...
CEapp-> Allocating contiguous buffer for 'encoded data' of size 1024...
CEapp-> Allocating contiguous buffer for 'output data' of size 1024...
App-> Processing frame 0...
100%
Unable to handle kernel paging request at virtual address c6120010
pgd = c360c000
[c6120010] *pgd=804eb011, *pte=00000000, *ppte=00000000
Internal error: Oops: 7 [#1]
Modules linked in: lpm_omap3530(F) dsplinkk(PF) cmemk
CPU: 0 Tainted: PF (2.6.22.18-omap3 #1)
PC is at __down_interruptible+0x6c/0x140
LR is at __init_begin+0x3fff8000/0x30
pc : [<c02cc28c>] lr : [<00000000>] psr: 40000093
sp : c32c7e78 ip : 00000000 fp : c32c7eac
r10: ffffffff r9 : 00000000 r8 : 00000000
r7 : c06b5d60 r6 : c32c6000 r5 : c612000c r4 : 00000001
r3 : c06b5d60 r2 : c32c6000 r1 : 00000002 r0 : 00000000
Flags: nZcv IRQs off FIQs on Mode SVC_32 Segment user
Control: 00c5387f Table: 8360c018 DAC: 00000015
Process app.out (pid: 381, stack limit = 0xc32c62d8)
Stack: (0xc32c7e78 to 0xc32c8000)
7e60: c00a909c 00000001
7e80: c06b5d60 c005f0ec c6120014 c6120014 00000001 c6120000 00000000 00008000
7ea0: c32c7f0c c32c7eb0 c02cc06c c02cc22c c6120000 ffffffff 00000000 c612000c
7ec0: 00000001 bf00c744 c32c7ef4 c32c7ed8 c00a4c74 c00a4a04 00000000 c0021000
7ee0: c32c6000 bf020434 41163e08 bf020434 0000001c 41163e08 c32c6000 00000000
7f00: c32c7f34 c32c7f10 bf00b004 bf00c5f0 00000032 00000000 00000001 c0685ca0
7f20: 41163e08 c32c7f70 c32c7f44 c32c7f38 bf008860 bf00af8c c32c7f6c c32c7f48
7f40: c00a6eb8 bf008858 00000020 c31fc2c8 00000000 00000000 c0685ca0 0000001c
7f60: c32c7fa4 c32c7f70 c00a72cc c00a6e0c 00000000 00000000 41164490 00000001
7f80: 00000005 411644d8 41164490 40041000 00000003 c002afe8 00000000 c32c7fa8
7fa0: c002ae40 c00a7294 411644d8 41164490 00000009 41163e08 0000001c 41163e08
7fc0: 411644d8 41164490 40041000 00000003 40041000 003d0f00 40029830 41163e34
7fe0: 00000000 41163d78 40033618 40033c94 80000010 00000009 00010006 4c244324
Backtrace:
[<c02cc220>] (__down_interruptible+0x0/0x140) from [<c02cc06c>] (__down_interruptible_failed+0xc/0x20)
r7:00008000 r6:00000000 r5:c6120000 r4:00000001
[<bf00c5e4>] (SYNC_WaitSEM+0x0/0x294 [dsplinkk]) from [<bf00b004>] (UEVENT_GetBuf+0x84/0x124 [dsplinkk])
[<bf00af80>] (UEVENT_GetBuf+0x0/0x124 [dsplinkk]) from [<bf008860>] (DRV_Read+0x14/0x18 [dsplinkk])
r6:c32c7f70 r5:41163e08 r4:c0685ca0
[<bf00884c>] (DRV_Read+0x0/0x18 [dsplinkk]) from [<c00a6eb8>] (vfs_read+0xb8/0x148)
[<c00a6e00>] (vfs_read+0x0/0x148) from [<c00a72cc>] (sys_read+0x44/0x70)
r7:0000001c r6:c0685ca0 r5:00000000 r4:00000000
[<c00a7288>] (sys_read+0x0/0x70) from [<c002ae40>] (ret_fast_syscall+0x0/0x2c)
r8:c002afe8 r7:00000003 r6:40041000 r5:41164490 r4:411644d8
Code: e5953004 e2833001 e5853004 e596300c (e5951004)
3. I was debugging via gdbserver trying to figure out why. But in gdb session, there's no crash seen though armload is always 0.
My questions are: firslty, is the output from (1) correct? why always 100% (I did put bios.PWRM.ENABLE = false; in the video_copy.tcf)
Any hints on the crash of getting arm load? In order to use dmai, besides dmai_init(), anything else is needed?
Thanks!