TI中文支持网
TI专业的中文技术问题搜集分享网站

基于rtos,ipu1访问dmtimer

你好,AM5728基于rtos,我想利用IPU1使用定时器来做一个简单的定时打印,编译成功后运行时好像在c文件中调用Timer_create就出现异常了,请问这个问题应该怎么解决呢?以下是代码片段:

MainIpu.c:

/* xdctools header files */
#include <xdc/std.h>
#include <xdc/runtime/Diags.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Log.h>
#include <xdc/runtime/System.h>

/* package header files */
#include <ti/ipc/Ipc.h>
#include <ti/ipc/MultiProc.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/ipc/remoteproc/Resource.h>
#include <ti/sysbios/timers/dmtimer/Timer.h>

/* local header files */
#include "Server.h"
#include "rsc_table_ipu1.h"

Void myIsr(UArg arg)
{
System_printf("myIsr arg = %d\n", (Int)arg);
System_exit(0);
}

/* private functions */
static Void smain(UArg arg0, UArg arg1);

/*
* ======== main ========
*/
Int main(Int argc, Char* argv[])
{
Timer_Params timerParams;
Timer_Handle myTimer;
Error_Block eb;
Error_init(&eb);
Timer_Params_init(&timerParams);
//timerParams.period = 10; timerParams.periodType = Timer_PeriodType_MICROSECS;
//timerParams.extFreq.lo = 27000000; /* 27 MHz */
//timerParams.extFreq.hi = 0;
//timerParams.arg = 1;
myTimer = Timer_create(Timer_ANY, myIsr, &timerParams, &eb);
if (myTimer == NULL) {
Log_print0(Diags_INFO,"Timer create failed"); System_abort("Timer create failed");
}
else
{
Log_print0(Diags_INFO,"Timer create success");
Timer_delete(myTimer);
}

/* start scheduler, this never returns */
BIOS_start();

/* should never get here */
Log_print0(Diags_EXIT, "<– main:");
return (0);
}

ipu1.cfg:

Idle.addCoreFunc('&VirtQueue_cacheWb', 1);

/* power management idle functions for each core */
/*Idle.addCoreFunc('&IpcPower_idle', 0);
Idle.addCoreFunc('&IpcPower_idle', 1);*/

/*
* ======== Instrumentation Configuration ========
*/

/* system logger */
var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
var LoggerSysParams = new LoggerSys.Params();
var Defaults = xdc.useModule('xdc.runtime.Defaults');
Defaults.common$.logger = LoggerSys.create(LoggerSysParams);

/* enable runtime Diags_setMask() for non-XDC spec'd modules */
var Diags = xdc.useModule('xdc.runtime.Diags');
Diags.setMaskEnabled = true;

/* override diags mask for selected modules */
xdc.useModule('xdc.runtime.Main');
Diags.setMaskMeta("xdc.runtime.Main",
Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON);

var Registry = xdc.useModule('xdc.runtime.Registry');
Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
Registry.common$.diags_LIFECYCLE = Diags.RUNTIME_OFF;
Registry.common$.diags_STATUS = Diags.RUNTIME_OFF;

var Main = xdc.useModule('xdc.runtime.Main');
Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;

var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
Hwi.nvicCCR.DIV_0_TRP = 1;

以下是运行后通过cat /sys/kernel/debug/remoteproc/remoteproc0/trace0打印结果查看ipu1的运行状态:

root@AM57xx-Tronlong:~# cat /sys/kernel/debug/remoteproc/remoteproc0/trace0
[0][ 0.000] 19 Resource entries at 0x3000
[0][ 0.000] [t=0x000ef279] ti.sysbios.family.arm.m3.Hwi: ERROR: line 1121: E_hardFault: FORCED
[0][ 0.000] ti.sysbios.family.arm.m3.Hwi: line 1121: E_hardFault: FORCED
[0][ 0.000] [t=0x001183ed] ti.sysbios.family.arm.m3.Hwi: ERROR: line 1198: E_busFault: PRECISERR: Immediate Bus Fault, exact addr known, address: 68034048
[0][ 0.000] ti.sysbios.family.arm.m3.Hwi: line 1198: E_busFault: PRECISERR: Immediate Bus Fault, exact addr known, address: 68034048
[0][ 0.000] Exception occurred in background thread at PC = 0x0001bad2.
[0][ 0.000] Core 0: Exception occurred in ThreadType_Main.
[0][ 0.000] Main name: main(), handle: 0x0.
[0][ 0.000] Main stack base: 0x8006e624.
[0][ 0.000] Main stack size: 0x1000.
[0][ 0.000] R0 = 0x68034000 R8 = 0x00000020
[0][ 0.000] R1 = 0x00000000 R9 = 0x00027984
[0][ 0.000] R2 = 0x00000002 R10 = 0x00000000
[0][ 0.000] R3 = 0x00000001 R11 = 0x8006f5a4
[0][ 0.000] R4 = 0x00000002 R12 = 0x8006f4d4
[0][ 0.000] R5 = 0x00000048 SP(R13) = 0x8006f470
[0][ 0.000] R6 = 0x8006f5ec LR(R14) = 0x00017f5d
[0][ 0.000] R7 = 0x00000000 PC(R15) = 0x0001bad2
[0][ 0.000] PSR = 0x61000200
[0][ 0.000] ICSR = 0x00400803
[0][ 0.000] MMFSR = 0x00
[0][ 0.000] BFSR = 0x82
[0][ 0.000] UFSR = 0x0000
[0][ 0.000] HFSR = 0x40000000
[0][ 0.000] DFSR = 0x00000000
[0][ 0.000] MMAR = 0x68034048
[0][ 0.000] BFAR = 0x68034048
[0][ 0.000] AFSR = 0x00000000
[0][ 0.000] Terminating execution…

yongqing wang:

rtos里面应该有定时器的列程

赞(0)
未经允许不得转载:TI中文支持网 » 基于rtos,ipu1访问dmtimer
分享到: 更多 (0)