打印

DM648捕获视频口信号量问题

[复制链接]
850|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
pujun2001|  楼主 | 2014-7-16 09:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
创建捕获视频口通道的过程,函数调用大致为:FVID_create -> mdCreateChan -> TVP5154_open-> TVP5154_ctrl -> TVP5154_powerdown -> regSetTVP5154 ->i2c_writeReg -> PSP_i2cTransfer -> DDC_i2cTransfer

走到DDC_i2cTransfer里面的函数如下:
/* Take completion semaphore */  
            if (i2cObj->currBufferLen > NULL)         
            {
                retCode = PAL_osSemTake(i2cObj->completionSem, timeout);       走到这个函数里面就出不来了。
                if (retCode != PAL_SOK)        
                {
                 ...............                  
                }
}

/* To take a semaphore */      
/*This function takes a semaphore token if available. If a semaphore is unavailable, it blocks currently running thread in wait (for specified duration) for a free semaphore*/
PAL_Result PAL_osSemTake(PAL_OsSemHandle hSem, Int32 mSecTimeout)
{
    PAL_Result  semTakeResult = PAL_SOK;
    Bool        semPendResult;

    if( NULL != hSem )
    {

        /* Only allow semTake, if it is not called from main */
        if (TSK_self() != (TSK_Handle)&KNL_dummy)                                                                                1
        {

#ifdef PAL_OSSEM_ENABLE_STATIC_MEM
            semPendResult = SEM_pend(&((PAL_OsSemObj *) hSem)->biosSemObj, mSecTimeout);        2
#else
            semPendResult = SEM_pend(hSem, mSecTimeout);
#endif
            if ( semPendResult == FALSE )
            {
                semTakeResult = PSP_E_RESOURCES;
            }
            else
            {
                semTakeResult = PAL_SOK;
            }
        }

    }
    else
    {
        semTakeResult = PSP_E_INVAL_PARAM;
    }

    return semTakeResult;
}

上面是pal_osSem.c库函数,我的代码在走到return semTakeResult之后,又重新回到1处,接着往下执行到return semTakeResult,然后又回到1,大约反复两次次后,程序走到2后该函数内外的断点都端不住了,程序就飞了,请问什么原因啊?



相关帖子

沙发
zhangmangui| | 2014-7-16 22:39 | 只看该作者
帮顶   

使用特权

评论回复
板凳
pujun2001|  楼主 | 2014-7-17 11:24 | 只看该作者
已经解决。SEM_pend()函数阻塞当前任务的运行,同时等待对同一旗语SEM_post()继续运行。而代码中没有对发送数据ready好发起硬件中断,从而调用SEM_post()释放信号量。在DSP/BIOS配置文件中添加硬件中断。

使用特权

评论回复
地板
vivilzb1985| | 2014-7-23 20:56 | 只看该作者
恭喜楼上啊,很不错的。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

14

主题

32

帖子

0

粉丝