|
- DWORD CameraHal::ThreadRun()
- {
- CAMIF_MSG((_T("[CAMIF] ++%s()=0x%x\r\n"), _T(__FUNCTION__), &CameraHal::ThreadRun));
- while ( m_hCaptureEvent != NULL && !IsTerminated() )
- {
- DWORD dwCause;
- RETAILMSG(CAMERA_HAL_DBG,(_T("%s() Waitfor Event: 0x%x\r\n"), _T(__FUNCTION__), m_hCaptureEvent));
- dwCause = WaitForSingleObject( m_hCaptureEvent, m_dwISTTimeout);
- if ( dwCause == WAIT_OBJECT_0 )
- {
- RETAILMSG(CAMERA_HAL_DBG,(_T("Event Catched from:0x%x(%d)\r\n"), m_hCaptureEvent, m_CamOperationMode));
- if(m_CamOperationMode == VIDEO_CAPTURE)
- {
- if(m_dwSkipFrameCnt >= 1)
- {
- m_dwSkipFrameCnt = 2;
- pfnCallbacks.pfnCameraHandleVideoFrame(pfnCallbacks.dwCameraDriverContext);
- }
- else
- {
- m_dwSkipFrameCnt++;
- }
- }
- else if(m_CamOperationMode == STILL_CAPTURE)
- {
- // This will be taken on LAST IRQ
- if(m_dwSkipFrameCnt >= 1)
- {
- m_dwSkipFrameCnt = 2;
- // Stop Capture
- if(m_oCSI_S)
- {
- RETAILMSG(CAMERA_HAL_MSG, (TEXT("MIPI Status ECC:%d, CRC:%d\r\n"),
- m_oCSI_S->CheckPacketHeaderECC(),
- m_oCSI_S->CheckPacketDataCRC()));
- }
- m_dwSkipFrameCnt = 0;
- SetEvent(m_hCaptureFinishEvent);
- RETAILMSG(1,(TEXT("C%d\r\n"), m_dwSkipFrameCnt));
- }
- else
- {
- #if USE_LASTIRQ_STILLCAPTURE
- m_regCAM->CIOCTRL |= (1<
- // In this case, Camera Capture is disabled, so Preview also will be stopped even when use different camera IP.
- m_regCAM->CIIMGCPT &= ~(CAM_GLOBAL_CAPTURE_ENABLE_BIT); // This will book stopping camera capture
- m_regCAM->CIOCTRL &= ~(1<
- #endif
- m_dwSkipFrameCnt++;
- RETAILMSG(1,(TEXT("L%d\r\n"), m_dwSkipFrameCnt));
- }
- }
- else if(m_CamOperationMode == PREVIEW_CAPTURE)
- {
- if(m_dwSkipFrameCnt >= 1)
- {
- m_dwSkipFrameCnt = 2;
- pfnCallbacks.pfnCameraHandlePreviewFrame(pfnCallbacks.dwCameraDriverContext);
- }
- else
- {
- m_dwSkipFrameCnt ++;
- }
- }
- if(m_CamOperationMode == POST_PROCESSOR)
- {
- SetEvent(m_hPostCmdDoneEvent);
- }
- // Clear Interrupt Pending
- SET_BIT(m_regCAM->CIGCTRL, BP_CAM_IRQ_CLR);
- SET_BIT(m_regCAM->CIOCTRL, BP_CAM_FRAME_END);
- if(m_oCSI_S)
- m_oCSI_S->ClearInterrupt(ALLINT);
- InterruptDone(m_CamSysIntr);
- RETAILMSG(TRUE,(_T("%s(): PREVIEW INTR DOWN \r\n"), _T(__FUNCTION__)));
- }
- else
- {
- CAMIF_ERR((_T("[CAMIF:ERR] ++%s() : Exit %d, Cause %d\r\n"), _T(__FUNCTION__), GetLastError(), dwCause));
- }
- }
- RETAILMSG(TRUE,(_T("%s(): Thread Finished"), _T(__FUNCTION__)));
- return 1;
- }
复制代码 |
|