This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SysLink & Hwi & OMAPL138

Other Parts Discussed in Thread: SYSBIOS

Dear experts,

I developed and tested my DSP- side code with CCS and it is OK. When I started to implement together with SysLink/IPC I faced quite fatal problems - Hwis did not work. I took one of those SysLink examples and pushed my code there, did changes to *.cfg, increased stack, heap etc sizes but Hwi_create still hangs; i debugged situation with CCS- emulator and Hwi_creare does not return properly - reminds me good old stackoverflow!!??

I took very basic SysLink 2.21.03.11 example ex01_helloworld, put hwi there, did necessary changes to *.cfg etc. etc. and result was the same - whichever function/thread I put Hwi instance creation, the same happens. All SysLink examples and syslink.ko  are oprational and tested - so is my code without Hwi. 

So my question today is that does there excist an example with SysLink (IPC) and Hwi in same application code, is there some principal things to take into account when SysLink is used? 

Next step to me is to pass SYS/BIOS/Hwi and use traditional way to handle hwi - off course that is brute and I would not like to do that.

Regards,

Risto

  • Solved,

    Just a stupid sw bug.

    risto

  • Dear Risto,
    We were glad that you solved your problem.
    Could you please share with us the solution which could help other community members as well.
  • Dear Titus,

    For some reason, I did not find explanation to, dynamic cration of the Hwi did not work, static did?

    risto

  • dear Risto Hedman

    i have the same problem with you. could show me you code to me, thanks ! my code and .cfg as follow:

    /*
    * ======== Dsp.cfg ========
    *
    */

    /* root of the configuration object model */
    var Program = xdc.useModule('xdc.cfg.Program');

    /* application uses the following modules and packages */
    xdc.useModule('xdc.runtime.Assert');
    xdc.useModule('xdc.runtime.Diags');
    xdc.useModule('xdc.runtime.Error');
    xdc.useModule('xdc.runtime.Log');
    xdc.useModule('xdc.runtime.Registry');

    xdc.useModule('ti.sysbios.gates.GateHwi');
    xdc.useModule('ti.sysbios.knl.Semaphore');
    xdc.useModule('ti.sysbios.knl.Task');

    var ti_sysbios_family_c64p_Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');

    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    BIOS.libType = BIOS.LibType_NonInstrumented;


    /*
    * ======== IPC Configuration ========
    */

    /* required because SysLink is running on the host processor */
    xdc.useModule('ti.syslink.ipc.rtos.Syslink');

    /* configure processor names */
    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
    var procNameAry = MultiProc.getDeviceProcNames();
    MultiProc.setConfig("DSP", procNameAry);

    /* ipc configuration */
    var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');

    /* ipc setup for SR0 Memory (host processor not running Sys/Bios) */
    Ipc.sr0MemorySetup = false;

    /* set ipc sync to pair, requiring Ipc_attach() call on all processors */
    Ipc.procSync = Ipc.ProcSync_PAIR;

    /* define host processor */
    Ipc.hostProcId = MultiProc.getIdMeta("HOST");

    /* shared region configuration */
    var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');

    /* configure SharedRegion #0 (IPC) */
    var SR0Mem = Program.cpu.memoryMap["SR_0"];

    SharedRegion.setEntryMeta(0,
    new SharedRegion.Entry({
    name: "SR0",
    base: SR0Mem.base,
    len: SR0Mem.len,
    ownerProcId: MultiProc.getIdMeta("HOST"),
    cacheEnable: false,
    isValid: true
    })
    );

    if (0) {
    /* configure SharedRegion #1 (MessageQ Buffers) */
    var SR1Mem = Program.cpu.memoryMap["SR_1"];

    SharedRegion.setEntryMeta(1,
    new SharedRegion.Entry({
    name: "Data Buffers",
    base: SR1Mem.base,
    len: SR1Mem.len,
    ownerProcId: MultiProc.getIdMeta("HOST"),
    cacheEnable: false,
    isValid: true,
    createHeap: false
    })
    );
    }

    /* configure external memory cache property
    *
    * C000_0000 - C7FF_FFFF 800_0000 ( 128 MB) Cache.MAR192_223
    * ----------------------------------------------------------------------------
    * C000_0000 - C1FF_FFFF 200_0000 ( 32 MB) -------- don't care
    * C200_0000 - C202_FFFF 3_0000 ( 192 KB) SR_0, SR-1 no-cache MAR194
    * C203_0000 - C2FF_FFFF FD_0000 ( ~15 MB) -------- no-cache MAR194
    * C300_0000 - C37F_FFFF 80_0000 ( 8 MB) DSP_PROG cache enable MAR195
    * C380_0000 - C3FF_FFFF 80_0000 ( 8 MB) -------- cache enable MAR195
    * C400_0000 - C7FF_FFFF 400_0000 ( 64 MB) -------- don't care
    */

    Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');
    Cache.MAR192_223 = 0x00000008; /* xxxx xxxx xxxx xxxx xxxx xxxx xxxx 10xx */


    /*
    * ======== Operating System Configuration ========
    */

    /* no rts heap */
    Program.heap = 0;
    Program.argSize = 100; /* minimum size */
    Program.stack = 0x1000;

    /* create a default heap */
    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    var heapMemParams = new HeapMem.Params();
    heapMemParams.size = 0x4000;

    var Memory = xdc.useModule('xdc.runtime.Memory');
    Memory.defaultHeapInstance = HeapMem.create(heapMemParams);

    /* configure System module */
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    SysMin.bufSize = 0x1000;
    SysMin.flushAtExit = false;

    var System = xdc.useModule('xdc.runtime.System');
    System.SupportProxy = SysMin;

    /* configure SysBios to use the lower half of Timer 1 */
    var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    Timer.timerSettings[1].master = true;
    Timer.defaultHalf = Timer.Half_LOWER;
    Clock.timerId = 1;

    /*
    * ======== Miscellaneous Configuration ========
    */

    /* set default diags mask */
    var Diags = xdc.useModule('xdc.runtime.Diags');
    var Defaults = xdc.useModule('xdc.runtime.Defaults');

    Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
    Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
    Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
    Defaults.common$.diags_INTERNAL = Diags.ALWAYS_OFF; /* needed for asserts */
    Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF; /* development only */
    Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
    Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
    Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
    Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
    Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
    Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
    Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
    Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
    Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;

    /* 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;

    /* create a logger instance */
    var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
    var loggerBufP = new LoggerBuf.Params();
    loggerBufP.numEntries = 128; /* 128 entries = 4 KB of memory */
    loggerBufP.bufType = LoggerBuf.BufType_FIXED;

    var appLogger = LoggerBuf.create(loggerBufP);
    appLogger.instance.name = "AppLog_Core1";
    Defaults.common$.logger = appLogger;

    var ti_sysbios_family_c64p_Hwi1Params = new ti_sysbios_family_c64p_Hwi.Params();
    ti_sysbios_family_c64p_Hwi1Params.instance.name = "VPIFCapture";
    ti_sysbios_family_c64p_Hwi1Params.eventId = 95;
    Program.global.VPIFCapture= ti_sysbios_family_c64p_Hwi.create(5, "&VPIFHWIIsr", ti_sysbios_family_c64p_Hwi1Params);

    And my main.c code on dsp:

    /****************************************************************************/
    /* */
    /* 硬件抽象层 硬件中断 */
    /* */
    /* 2014年08月01日 */
    /* */
    /****************************************************************************/
    #include <xdc/std.h>

    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/System.h>

    #include <ti/sysbios/BIOS.h>
    //#include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/hal/Hwi.h>

    // 库
    #include "TL6748.h" // 创龙 DSP6748 开发板相关声明

    #include "hw_types.h" // 宏命令
    #include "hw_syscfg0_C6748.h" // 系统配置模块寄存器
    #include "soc_C6748.h" // DSP C6748 外设寄存器


    #include "psc.h" // 电源与睡眠控制宏及设备抽象层函数声明
    #include "gpio.h" // 通用输入输出口宏及设备抽象层函数声明
    #include "vpif.h"
    #include "sccb.h"
    #include "dcmi_OV2640.h"

    #include "interrupt.h" // DSP C6748 中断相关应用程序接口函数声明及系统事件号定义

    /****************************************************************************/
    /* */
    /* 宏定义 */
    /* */
    /****************************************************************************/

    /****************************************************************************/
    /* */
    /* 全局变量 */
    /* */
    /****************************************************************************/
    #pragma DATA_ALIGN(image, 4);
    unsigned char image[800*600*2];
    /****************************************************************************/
    /* */
    /* 函数声明 */
    /* */
    /****************************************************************************/
    void SetUpVPIFRx(void);
    void PSCInit(void);
    void VPIFHWIIsr(UArg arg);
    void Delay(unsigned int n);
    extern void VPIFPinMuxSetUp(void);
    /****************************************************************************/
    /* */
    /* PSC初始化 */
    /* */
    /****************************************************************************/
    void PSCInit(void)
    {
    /* Power on VPIF */
    PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_VPIF, PSC_POWERDOMAIN_ALWAYS_ON, PSC_MDCTL_NEXT_ENABLE);
    }
    /****************************************************************************/
    /* */
    /* 初始化VPIF捕获 */
    /* */
    /****************************************************************************/
    void SetUpVPIFRx(void)
    {
    /* Disable interrupts */
    VPIFInterruptDisable(SOC_VPIF_0_REGS, VPIF_FRAMEINT_CH1);
    VPIFInterruptDisable(SOC_VPIF_0_REGS, VPIF_FRAMEINT_CH0);

    /* Disable capture ports */
    VPIFCaptureChanenDisable(SOC_VPIF_0_REGS, VPIF_CHANNEL_1);
    VPIFCaptureChanenDisable(SOC_VPIF_0_REGS, VPIF_CHANNEL_0);

    /*数据位宽8位*/
    VPIFCaptureRawDatawidthConfig(SOC_VPIF_0_REGS,
    VPIF_C0CTRL_DATAWIDTH_EIGHT_BPS<<VPIF_C0CTRL_DATAWIDTH_SHIFT);

    /*产生600个line*/
    VPIFCaptureRawIntlineConfig(SOC_VPIF_0_REGS, 600);

    /*设置存储模式为Frame-based storage*/
    VPIFCaptureFieldframeModeSelect(SOC_VPIF_0_REGS, VPIF_C0CTRL_FIELDFRAME);

    /*设置progressive模式接收数据*/
    VPIFCaptureIntrprogModeSelect(SOC_VPIF_0_REGS, VPIF_CHANNEL_0,
    VPIF_C0CTRL_INTRPROG);

    /*使能垂直消隐捕获*/
    VPIFCaptureVancEnable(SOC_VPIF_0_REGS, VPIF_CHANNEL_0);

    /*使能行消隐捕获*/
    VPIFCaptureVancDisable(SOC_VPIF_0_REGS, VPIF_CHANNEL_0);

    /*设置中断产生方式,只是用top field接收数据*/
    VPIFCaptureIntframeConfig(SOC_VPIF_0_REGS, VPIF_CHANNEL_0,
    VPIF_FRAME_INTERRUPT_TOP);

    /*设置捕获方式为raw capture*/
    VPIFCaptureCapmodeModeSelect(SOC_VPIF_0_REGS, VPIF_CHANNEL_0,
    VPIF_CAPTURE_RAW);
    }

    /****************************************************************************/
    /* */
    /* VPIF硬件中断 */
    /* */
    /****************************************************************************/
    void VPIFHWIIsr(UArg arg)
    {
    unsigned int temp=0;
    static int i =0;
    //#ifdef _TMS320C6X
    IntEventClear(95);
    //#else
    // IntSystemStatusClear(SYS_INT_VPIF);
    //#endif

    temp = VPIFInterruptStatus(SOC_VPIF_0_REGS, VPIF_ERROR_INT | \
    VPIF_FRAMEINT_CH3 | \
    VPIF_FRAMEINT_CH2 | \
    VPIF_FRAMEINT_CH1 | \
    VPIF_FRAMEINT_CH0);


    if(i>=2)
    {
    VPIFCaptureChanenDisable(SOC_VPIF_0_REGS, VPIF_CHANNEL_1);
    VPIFCaptureChanenDisable(SOC_VPIF_0_REGS, VPIF_CHANNEL_0);

    // CacheWB((unsigned int)ov2640image, sizeof(ov2640image));
    // Qdma3();

    Reinitov2640();
    i=0;

    /* Enable capture */
    VPIFCaptureChanenEnable(SOC_VPIF_0_REGS, VPIF_CHANNEL_0);
    VPIFCaptureChanenEnable(SOC_VPIF_0_REGS, VPIF_CHANNEL_1);
    }
    i++;

    /* if (error_flag)
    {
    UARTprintf("Unexpected error occured during VPIF loopback\n");
    error_flag = 0;
    }*/

    /* if error interrupt occurs, report error */
    if ((temp & VPIF_ERROR_INT))
    {
    // error_flag = 1;
    }
    }

    /****************************************************************************/
    /* */
    /* 延时 */
    /* */
    /****************************************************************************/
    void Delay(unsigned int n)
    {
    unsigned int i;

    for(i=n;i>0;i--);
    }


    /****************************************************************************/
    /* */
    /* 主函数 */
    /* */
    /****************************************************************************/
    Int main()
    {

    PSCInit();
    /*初始化SCCB*/
    SCCB_Init();
    /* 初始化ov2640 */
    OV2640_Reset();
    Delay(0xffff);

    OV2640_Reset();
    Delay(0xffff);
    /*初始化OV2640为SVGA 800*600*/
    Initov2640();

    /* 设置VPIF pinmux*/
    VPIFPinMuxSetUp();
    /*初始化VPIF*/
    SetUpVPIFRx();
    /*256字节DMA*/
    VPIFDMARequestSizeConfig(SOC_VPIF_0_REGS, VPIF_REQSIZE_TWO_FIFTY_SIX);

    /* 初始化VPIF buffer地址*/
    VPIFCaptureFBConfig(SOC_VPIF_0_REGS, VPIF_CHANNEL_0,
    VPIF_TOP_FIELD, VPIF_LUMA,(unsigned int)&image[0], 800*2);

    /*使能错误中断和frame0中断*/
    VPIFInterruptEnable(SOC_VPIF_0_REGS, VPIF_FRAMEINT_CH0 | VPIF_ERROR_INT);
    VPIFInterruptEnableSet(SOC_VPIF_0_REGS, VPIF_FRAMEINT_CH0);

    /* Enable capture */
    VPIFCaptureChanenEnable(SOC_VPIF_0_REGS, VPIF_CHANNEL_0);
    VPIFCaptureChanenEnable(SOC_VPIF_0_REGS, VPIF_CHANNEL_1);

    // 启动 SYS/BIOS 系统
    BIOS_start();

    return(0);
    }

    and my e-mail 17092503713l@gmail.com

    Thanks

    best wishes!

    robin luo

  • Please refer to the following TI wiki page for creating the HWI using static mode (registering HWI by code)

    processors.wiki.ti.com/.../BIOS_for_the_28x