本帖最后由 righthek 于 2012-3-8 09:44 编辑
DSP:DM642
视频解码芯片:SAA7113
视频编码芯片:SAA7121
做静态采集图像实验(DM642_D1)时,能够采集到图像,在CCS3.3里的view->graph->image里能显示出来。
但是做视频采集显示的实验(DM642_LOOP1)时,却采集不到图像了,程序在while(capNewFrame == 0){}语句处停下来,似乎无法进入视频中断,因为在视频采集中断时会把capNewFrame赋值为1。程序才能执行下去。
interrupt void VPCapChaAIsr(void)
{
......
if(vpis & _VP_VPIS_CCMPA_MASK) /* capture complete */
{
/* Clear frame complete bit in VCX_CTL to continue capture in non-continuous mode*/
VP_FSETH(vpCaptureHandle, VCASTAT, FRMC,VP_VCASTAT_FRMC_CLEAR);
/* Clear CCMPA to enable next frame complete interrupts*/
VP_FSETH(vpCaptureHandle, VPIS, CCMPA,VP_VPIS_CCMPA_CLEAR);
capChaAFrameCount++; /* increment captured frame count */
capNewFrame = 1;
}
......
}
主函数代码:
void main()
{
Uint16 i;
Uint8 addrI2C;
/*-------------------------------------------------------*/
/* perform all initializations */
/*-------------------------------------------------------*/
DM642_init();
// CHIP_config(&DM642percfg);
/*----------------------------------------------------------*/
/*中断向量表的初始化*/
//Point to the IRQ vector table
IRQ_setVecs(vectors);
IRQ_nmiEnable();
IRQ_globalEnable();
IRQ_map(IRQ_EVT_VINT0, 11);
IRQ_map(IRQ_EVT_VINT1, 12);
IRQ_reset(IRQ_EVT_VINT0);
IRQ_reset(IRQ_EVT_VINT1);
/*打开一个数据拷贝的数据通路*/
DAT_open(DAT_CHAANY, DAT_PRI_LOW, DAT_OPEN_2D);
portNumber = 1;
vpHchannel1 = bt656_8bit_ncfd(portNumber);
/*----------------------------------------------------------*/
/*进行IIC的初始化*/
hdm642i2c = I2C_open(I2C_PORT0,I2C_OPEN_RESET);
I2C_config(hdm642i2c,&DM642IIC_Config);
/*----------------------------------------------------------*/
GPIO_RSET(GPGC,0x0);/*将GPIO0不做为GPINT使用*/
GPIO_RSET(GPDIR,0x1);/*将GPIO0做为输出*/
GPIO_RSET(GPVAL,0x1);/*GPIO0输出为高,选择IIC1总线,配置*/
NTSCorPAL = 0;
addrI2C = 0x88 >>1;
for(i =0; i<43; i++)
{
if(NTSCorPAL == 1)
{
_IIC_write(hdm642i2c,
addrI2C,
(sa7121hNTSC.regsubaddr),
(sa7121hNTSC.regvule));
}
else
{
_IIC_write(hdm642i2c,
addrI2C,
(sa7121hPAL.regsubaddr),
(sa7121hPAL.regvule));
}
}
GPIO_RSET(GPVAL,0x0);
// SAA7113 初始化
addrI2C = 0x4A >>1;
for(i = 0;i<28 ;i++)
{
_IIC_write(hdm642i2c,
addrI2C,
(sa7113hPAL.regsubaddr),
(sa7113hPAL.regvule));
}
portNumber = 0;
vpHchannel0 = bt656_8bit_ncfc(portNumber);
bt656_capture_start(vpHchannel0);
/*等待第一帧数据采集完成*/
while(capNewFrame == 0){}
/*将数据存入显示缓冲区,并清采集完成的标志*/
capNewFrame =0;
for(i=0;i<numLines;i++)
{
/*传送Y缓冲区*/
DAT_copy((void *)(capYbuffer + i * numPixels),
(void *)(disYbuffer + i * numPixels),
numPixels);
/*传送Cb缓冲区*/
DAT_copy((void *)(capCbbuffer + i * (numPixels >> 1)),
(void *)(disCbbuffer + i * (numPixels >> 1)),
numPixels>>1);
/*传送Cr缓冲区*/
DAT_copy((void *)(capCrbuffer + i * (numPixels >> 1)),
(void *)(disCrbuffer + i * (numPixels >> 1)),
numPixels>>1);
}
/*启动显示模块*/
bt656_display_start(vpHchannel1);
/*建立显示的实时循环*/
for(;;)
{
/*当采集区的数据已经采集好,而显示缓冲区的数据已空*/
if((capNewFrame == 1)&&(disNewFrame == 1))
{
/*将数据装入显示缓冲区,并清采集完成的标志*/
capNewFrame =0;
disNewFrame =0;
for(i=0;i<numLines;i++)
{
/*传送Y缓冲区*/
DAT_copy((void *)(capYbuffer + i * numPixels),
(void *)(disYbuffer + i * numPixels),
numPixels);
/*传送Cb缓冲区*/
DAT_copy((void *)(capCbbuffer + i * (numPixels >> 1)),
(void *)(disCbbuffer + i * (numPixels >> 1)),
numPixels>>1);
/*传送Cr缓冲区*/
DAT_copy((void *)(capCrbuffer + i * (numPixels >> 1)),
(void *)(disCrbuffer + i * (numPixels >> 1)),
numPixels>>1);
}
}
}
} |