阅读:2089回复:8
2440的camera驱动中断问题.牛人,帮帮忙!
在camera驱动中创建IST的代码如下:
BOOL InitInterruptThread() { DWORD threadID; // thread ID BOOL bSuccess; CameraEvent = CreateEvent(NULL, FALSE, FALSE, NULL); if (!CameraEvent) { return FALSE; } bSuccess = InterruptInitialize(g_CamSysIntr, CameraEvent, NULL, 0); if (!bSuccess) { RETAILMSG(1,(TEXT("Fail to initialize camera interrupt event\r\n"))); return FALSE; } CameraThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CameraCaptureThread, 0, 0, &threadID); if (NULL == CameraThread ) { RETAILMSG(1,(TEXT("Create Camera Thread Fail\r\n"))); } RETAILMSG(1,(_T("CAMERA.DLL::InterruptThread Initialized.\r\n"))); return TRUE; } DWORD CameraCaptureThread(void) { unsigned char tmp=0; static unsigned int time,old_time; static unsigned int cam_intr; DWORD dwCause; // LJY PWR040613 //dwDisplayTimeout = INFINITE; SetProcPermissions((DWORD)-1); while(TRUE) { RETAILMSG(1,(TEXT("[CAM_HW] InterruptThread : Waiting For a Single Object\n\r"))); dwCause = WaitForSingleObject(CameraEvent, dwDisplayTimeout); RETAILMSG(MSG_EN_1,(_T("CameraCaptureThread(%d)++\r\n"), frame_count)); #if 0 if (frame_count <= 2) { //frame_count++; // Enable camera interrupt s2440INT->INTSUBMSK &= ~(( 1 << IRQ_SUB_CAM_P )|( 1 << IRQ_SUB_CAM_C )); s2440INT->INTMSK &= ~( 1 << IRQ_CAM ); continue; } #endif if (dwCause == WAIT_OBJECT_0) // LJY PWR { Lock(); __try { if (s2440INT->INTSUBMSK & ( 1 << IRQ_SUB_CAM_C )) { frame_count++; cam_intr |= ( 1 << IRQ_SUB_CAM_C ); s2440INT->SUBSRCPND = (1<<IRQ_SUB_CAM_C); s2440INT->INTSUBMSK &= ~(1<<IRQ_SUB_CAM_C); //RETAILMSG(1,(_T("CAM_C, ts %d\r\n"), GetTickCount())); } if (s2440INT->INTSUBMSK & ( 1 << IRQ_SUB_CAM_P )) { cam_intr |= ( 1 << IRQ_SUB_CAM_P ); s2440INT->SUBSRCPND = (1<<IRQ_SUB_CAM_P); s2440INT->INTSUBMSK &= ~(1<<IRQ_SUB_CAM_P); //RETAILMSG(1,(_T("CAM_P, ts %d\r\n"), GetTickCount())); } if (((s2440INT->INTSUBMSK & ( 1 << IRQ_SUB_CAM_C )) == 0) && ((s2440INT->INTSUBMSK & ( 1 << IRQ_SUB_CAM_P )) == 0)) { RETAILMSG(MSG_EN_1,(_T("[CAM]NOP\r\n"))); } InterruptDone(g_CamSysIntr); //time = GetTickCount(); RETAILMSG(1,(TEXT("+time:%d\r\n"),(time - old_time))); // Handle any interrupts on the input source if (cam_intr & ( 1 << IRQ_SUB_CAM_P )) { // display the image if (DRIVER_PREVIEW_ENABLE == 1) Display_Cam_Image(0,54,PREVIEW_X, PREVIEW_Y, PORT_A); Buffer_preview_info_update(); cam_intr &= ~( 1 << IRQ_SUB_CAM_P ); } if (cam_intr & ( 1 << IRQ_SUB_CAM_C )) { Buffer_codec_info_update(); cam_intr &= ~( 1 << IRQ_SUB_CAM_C ); } // Enable camera interrupt s2440INT->INTSUBMSK &= ~(( 1 << IRQ_SUB_CAM_P )|( 1 << IRQ_SUB_CAM_C )); s2440INT->INTMSK &= ~( 1 << IRQ_CAM ); //old_time = GetTickCount(); //RETAILMSG(1,(TEXT("-time:%d\r\n"),(old_time-time))); } __except(EXCEPTION_EXECUTE_HANDLER) { RETAILMSG(PM_MSG, (TEXT("Camera.DLL:InterruptThread() - EXCEPTION: %d"), GetExceptionCode())); } Unlock(); } else if (dwCause == WAIT_TIMEOUT) { Lock(); RETAILMSG(PM_MSG,(_T("[CAM_HW] InterruptThread Timeout : %d msec\r\n"), dwDisplayTimeout)); dwDisplayTimeout = INFINITE; // reset timeout until Camera Interrupt occurs bIdlePwrDown = TRUE; // Codec is off CamInterface_PowerDown(); RETAILMSG(PM_MSG, (TEXT("[CAM_HW] InterruptThread : bIdlePwrDown = TRUE\r\n"))); Unlock(); } else { RETAILMSG(PM_MSG, (TEXT("[CAM_HW] InterruptThread : Exit %d, Cause %d\r\n"), GetLastError(), dwCause)); } } return 0; } 当驱动程序第一次加载的时候,它会WaitForSingleObject,但超时时间是3000ms,之后会设为infinite,然后就一直WaitForSingleObject,在OEMInterruptHandler中始终不进如下的分支: else if(irq == IRQ_CAM) { RETAILMSG(1,(TEXT("HHHHHHHHHHHHHHJJJJJJJJJJJJJJJJJJJJJJ\r\n"))); if(INREG32(&g_pIntrRegs->SUBSRCPND) & (1<<IRQ_SUB_CAM_C)) { SETREG32(&g_pIntrRegs->INTSUBMSK, (1<<IRQ_SUB_CAM_C)); SETREG32(&g_pIntrRegs->INTMSK, (1<<IRQ_CAM)); OUTREG32(&g_pIntrRegs->SUBSRCPND, (1<<IRQ_SUB_CAM_C)); OUTREG32(&g_pIntrRegs->SRCPND, (1<<IRQ_CAM)); OUTREG32(&g_pIntrRegs->INTPND,(1<<IRQ_CAM)); RETAILMSG(1,(TEXT("IRQ_CAM Codec\r\n"))); } else if(INREG32(&g_pIntrRegs->SUBSRCPND) & (1<<IRQ_SUB_CAM_P)) { SETREG32(&g_pIntrRegs->INTSUBMSK, (1<<IRQ_SUB_CAM_P)); SETREG32(&g_pIntrRegs->INTMSK, (1<<IRQ_CAM)); OUTREG32(&g_pIntrRegs->SUBSRCPND, (1<<IRQ_SUB_CAM_P)); OUTREG32(&g_pIntrRegs->SRCPND, (1<<IRQ_CAM)); OUTREG32(&g_pIntrRegs->INTPND,(1<<IRQ_CAM)); RETAILMSG(1,(TEXT("PreView\r\n"))); } else { SETREG32(&g_pIntrRegs->INTSUBMSK, (1<<IRQ_SUB_CAM_C)|(1<<IRQ_SUB_CAM_P)); SETREG32(&g_pIntrRegs->INTMSK, (1<<IRQ_CAM)); SETREG32(&g_pIntrRegs->SUBSRCPND, (1<<IRQ_SUB_CAM_C)|(1<<IRQ_SUB_CAM_P)); OUTREG32(&g_pIntrRegs->SRCPND, (1<<IRQ_CAM)); OUTREG32(&g_pIntrRegs->INTPND,(1<<IRQ_CAM)); RETAILMSG(1,(TEXT("nop\r\n"))); return SYSINTR_NOP; } } 请问这是什么问题啊? 谢谢各位了啊! |
|
沙发#
发布于:2007-08-15 09:22
IRQ_CAM一直没有被触发,检查一下你的中断设置。
|
|
板凳#
发布于:2007-08-15 10:12
你应该确认一下中断是否使能了
|
|
地板#
发布于:2007-08-15 16:13
To 楼主:
我的那个程序是跟我的驱动配合的 给你了也没用 你直接把cambuf里的数据放到显存buf就可以了 我的驱动里面 目前还没有用中断 这也是个问题 我会在后面几天把他加上 |
|
|
地下室#
发布于:2007-08-15 17:41
兄弟,多谢你的回答!
你还没用中断吗?那你用什么实现的确啊?是查询方式吗? 我发现在OEMInterruptenable中有将INTMASK中的INT_CAM位打开啊,只是没有将SUBINTMASK中的12位打开. 请问是这个原因吗? 谢谢! |
|
5楼#
发布于:2007-08-16 10:00
没有用中断 也没有用查询
我根本没有去管那个preview和codec的中断标志 所以目前我这个还相当不成熟 只能我自己用 呵呵 |
|
|
6楼#
发布于:2007-08-16 14:19
我现在中断能产生了.
请问你用过三星的那个测试程序没有啊 |
|
7楼#
发布于:2007-08-16 15:03
呵呵 恭喜楼主 那你之前不产生中断是什么原因引起的呀
我没用三星的测试程序 我的驱动接口跟三星原来的完全不一样 也没法用 一直都用的自己的测试程序 |
|
|
8楼#
发布于:2007-08-16 19:52
我的VSYNC信号线接错了,触发不了中断
|
|