/* * This function sets the sharpening damper */ t_damper_error_code CSharpeningDamperLR::SetDamper( const t_sharpening_damper_lr_id aDamperId, const float* pValues, const int aNumRows, const int aNumCols) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CSharpeningDamperLR::SetDamper", (mTraceObject)); t_damper_error_code err = DAMPER_OK; if(aDamperId<0 || aDamperId>=SHARPENING_DAMPERS_LR_NUM) { DBGT_ERROR("Invalid damper Id: %d\n", aDamperId); OstTraceFiltStatic1(TRACE_ERROR, "Invalid damper Id: %d", (mTraceObject), aDamperId); OUTR(" ",DAMPER_INVALID_ARGUMENT); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSharpeningDamperLR::SetDamper (%d)", (mTraceObject), DAMPER_INVALID_ARGUMENT); return DAMPER_INVALID_ARGUMENT; } MSG3("[%s] NumRows=%d, NumCols=%d\n", SHARPENING_DAMPER_LR_NAME(aDamperId), aNumRows, aNumCols); OstTraceFiltStatic3(TRACE_DEBUG, "SHARPENING_DAMPER_LR_NAME(%d) NumRows=%d, NumCols=%d", (mTraceObject), aDamperId, aNumRows, aNumCols); err = DoSetDamper( aDamperId, pValues, aNumRows, aNumCols); if(err!=DAMPER_OK) { DBGT_ERROR("[%s] failed to set damper: err=%d\n", SHARPENING_DAMPER_LR_NAME(aDamperId), err); OstTraceFiltStatic2(TRACE_ERROR, "SHARPENING_DAMPER_LR_NAME(%d) failed to set damper: err=%d", (mTraceObject), aDamperId, err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSharpeningDamperLR::SetDamper (%d)", (mTraceObject), err); return err; } OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSharpeningDamperLR::SetDamper (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
/* * This function sets the DefCor dampers */ t_damper_error_code CDefCorDamper::SetDamper( const t_defcor_damper_id aDamperId, const float* pValues, const int aNumRows, const int aNumCols) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CDefCorDamper::SetDamper", (mTraceObject)); t_damper_error_code err = DAMPER_OK; if(aDamperId<0 || aDamperId>=DEFCOR_DAMPERS_NUM) { DBGT_ERROR("Invalid damper Id: %d\n", aDamperId); OstTraceFiltStatic1(TRACE_ERROR, "Invalid damper Id: %d", (mTraceObject), aDamperId); OUTR(" ",DAMPER_INVALID_ARGUMENT); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::SetDamper (%d)", (mTraceObject), DAMPER_INVALID_ARGUMENT); return DAMPER_INVALID_ARGUMENT; } MSG3("[%s] NumRows=%d, NumCols=%d\n", KDefCorDamperInfo[aDamperId].name, aNumRows, aNumCols); OstTraceFiltStatic3(TRACE_DEBUG, "[KDefCorDamperInfo[%d].name] NumRows=%d, NumCols=%d", (mTraceObject), aDamperId, aNumRows, aNumCols); err = DoSetDamper( aDamperId, pValues, aNumRows, aNumCols); if(err!=DAMPER_OK) { DBGT_ERROR("[%s] failed to set damper: err=%d\n", KDefCorDamperInfo[aDamperId].name, err); OstTraceFiltStatic2(TRACE_ERROR, "[KDefCorDamperInfo[%d].name] failed to set damper: err=%d", (mTraceObject), aDamperId, err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::SetDamper (%d)", (mTraceObject), err); return err; } OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::SetDamper (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
/* * This function computes the dampers and queues the Page Elements */ t_damper_error_code CScorpioDamper::ComputeAndQueuePEs( CIspctlCom* pIspctlCom, const t_damper_base_values* pBaseValues) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CScorpioDamper::ComputeAndQueuePEs", (mTraceObject)); float pDampedValues[1] = { 0.0 }; float fCoringLevel = 0.0; t_damper_error_code err = DAMPER_OK; // Evaluate Scorpio dampers err = DoEvaluate( pBaseValues, pDampedValues); if(err!=DAMPER_OK) { DBGT_ERROR("Evaluation failed: err=%d\n", err); OstTraceFiltStatic1(TRACE_ERROR, "Evaluation failed: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CScorpioDamper::ComputeAndQueuePEs (%d)", (mTraceObject), err); return err; } // Queue the Page Elements list fCoringLevel = pDampedValues[0]; MSG2("%s = %f\n", CIspctlCom::pIspctlSensor->GetPeName(Scorpio_Ctrl_u8_CoringLevel_Ctrl_Byte0), fCoringLevel); OstTraceFiltStatic1(TRACE_DEBUG, "Scorpio_Ctrl_u8_CoringLevel_Ctrl = %f", (mTraceObject), fCoringLevel); pIspctlCom->queuePE( Scorpio_Ctrl_u8_CoringLevel_Ctrl_Byte0, (t_uint32)fCoringLevel); // Done OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CScorpioDamper::ComputeAndQueuePEs (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
/* * This function computes the dampers and queues the Page Elements */ t_damper_error_code CDefCorDamper::ComputeAndQueuePEs( CIspctlCom* pIspctlCom, const t_damper_base_values* pBaseValues) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CDefCorDamper::ComputeAndQueuePEs", (mTraceObject)); float pDamperValues[DEFCOR_DAMPERS_NUM] = {0.0, 0.0}; t_damper_error_code err = DAMPER_OK; // Evaluate DefCor dampers err = DoEvaluate( pBaseValues, pDamperValues); if(err!=DAMPER_OK) { DBGT_ERROR("Evaluation failed: err=%d\n", err); OstTraceFiltStatic1(TRACE_ERROR, "Evaluation failed: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::ComputeAndQueuePEs (%d)", (mTraceObject), err); return err; } // Queue the Page Elements for(int i=0; i<DEFCOR_DAMPERS_NUM; i++) { MSG2("%s = %f\n", CIspctlCom::pIspctlSensor->GetPeName(KDefCorDamperInfo[i].addr), pDamperValues[i]); //OstTraceFiltStatic2(TRACE_DEBUG, "%s = %f", (mTraceObject), CXp70::GetPeName(KDefCorDamperInfo[i].addr), pDamperValues[i]); pIspctlCom->queuePE( KDefCorDamperInfo[i].addr, (t_uint32)pDamperValues[i]); } // Done OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::ComputeAndQueuePEs (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
void CFlashSequencer::sigTimer() { IN0("\n"); cam_flashSeq_atom_t const *pSeq = NULL; if (i32_remSteps > 0) { // Some flash action still to be done switch (curSeq) { default: case NONE_SEQ: DBGT_ERROR("CFlashSequencer::sigTimer - Error: NONE_SEQ cannot be ticked.\n"); OstTraceFiltStatic0(TRACE_ERROR, "CFlashSequencer::sigTimer - Error: NONE_SEQ cannot be ticked.", (mTraceObject)); break; case RED_EYE_REMOVAL_SEQ: pSeq = &a_RER_sequence[sizeof(a_RER_sequence) / sizeof(cam_flashSeq_atom_t) - i32_remSteps]; break; case PRIVACY_SEQ: pSeq = &a_PI_sequence[sizeof(a_PI_sequence) / sizeof(cam_flashSeq_atom_t) - i32_remSteps]; break; } if (NULL != pSeq) { doAtom(pSeq); } i32_remSteps--; } else { // End of sequence: call the user back if requested, and clean the request. MSG1("CFlashSequencer::sigTimer - Sequence %d completed.\n", curSeq); curSeq = NONE_SEQ; if (mpClbk != NULL) { mpClbk(mctxtHnd); mpClbk = NULL; mctxtHnd = NULL; } } OUT0("\n"); }
/* * This function computes the dampers and queues the Page Elements */ t_damper_error_code CNoiseFilterDamper::ComputeAndQueuePEs( CIspctlCom* pIspctlCom, const t_damper_base_values* pBaseValues) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CNoiseFilterDamper::ComputeAndQueuePEs", (mTraceObject)); float pDampedValues[1] = { 0.0 }; t_damper_error_code err = DAMPER_OK; // Evaluate Noise Filter dampers err = DoEvaluate( pBaseValues, pDampedValues); if(err!=DAMPER_OK) { DBGT_ERROR("Failed to evaluate damper: err=%d\n", err); OstTraceFiltStatic1(TRACE_ERROR, "Failed to evaluate damper: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CNoiseFilterDamper::ComputeAndQueuePEs (%d)", (mTraceObject), err); return err; } // Queue the Page Elements float fGaussianWeightDamped = pDampedValues[0]; MSG2("%s = %f\n", CIspctlCom::pIspctlSensor->GetPeName(DusterControl_u8_GaussianWeight_Byte0), fGaussianWeightDamped); OstTraceFiltStatic1(TRACE_DEBUG, "DusterControl_u8_GaussianWeight = %f", (mTraceObject), fGaussianWeightDamped); pIspctlCom->queuePE( DusterControl_u8_GaussianWeight_Byte0, (t_uint32)fGaussianWeightDamped); // Done OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CNoiseFilterDamper::ComputeAndQueuePEs (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
cam_flash_err_e CFlashController::unConfigure() { IN0("\n"); if (mFlashDriver == NULL) { DBGT_ERROR("unConfigure: No valid flash driver.\n"); OstTraceFiltStatic0(TRACE_ERROR, "unConfigure: No valid flash driver.", (mTraceObject)); DBC_ASSERT(0); OUT0("\n"); return CAM_FLASH_ERR_BAD_PRECONDITION; } if (mDriverSupportedFlashModes == 0) { OUT0("\n"); return CAM_FLASH_ERR_NONE; } TFlashReturnCode driver_err = FLASH_RET_NONE; // User-controlled modes: switch off if ((FLASH_MODE_INDICATOR == mFlashDriverMode) || (FLASH_MODE_AF_ASSISTANT == mFlashDriverMode) || (FLASH_MODE_VIDEO_LED == mFlashDriverMode)) { driver_err = mFlashDriver->Strobe(mFlashDriverMode, false, mFlashDriverCamId); if (driver_err != FLASH_RET_NONE) { DBGT_ERROR("unConfigure: Strobe error;\n"); OstTraceFiltStatic0(TRACE_ERROR, "unConfigure: Strobe error;", (mTraceObject)); OUT0("\n"); return CAM_FLASH_ERR_DRIVER; } } // Any mode: un-configure if (FLASH_MODE_NONE != mFlashDriver) { driver_err = mFlashDriver->EnableFlashMode(FLASH_MODE_NONE, NULL, NULL, mFlashDriverCamId); if (driver_err != FLASH_RET_NONE) { DBGT_ERROR("unConfigure: EnableFlashMode error;\n"); OstTraceFiltStatic0(TRACE_ERROR, "unConfigure: EnableFlashMode error;", (mTraceObject)); OUT0("\n"); return CAM_FLASH_ERR_DRIVER; } mFlashDriverMode = FLASH_MODE_NONE; } OUT0("\n"); return CAM_FLASH_ERR_NONE; }
/* * This function computes the dampers and queues the Page Elements */ t_damper_error_code CSharpeningDamperLR::ComputeAndQueuePEs( CIspctlCom* pIspctlCom, const t_damper_base_values* pBaseValues) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CSharpeningDamperLR::ComputeAndQueuePEs", (mTraceObject)); float pDamperValues[SHARPENING_DAMPERS_LR_NUM] = { 0.0, 0.0}; t_damper_error_code err = DAMPER_OK; float fAdsocGain = 0.0; float fAdsocCoring = 0.0; float fScaleFactor = 0.0; // Evaluate Sharpening dampers err = DoEvaluate( pBaseValues, pDamperValues); if(err!=DAMPER_OK) { DBGT_ERROR("Evaluation failed: err=%d\n", err); OstTraceFiltStatic1(TRACE_ERROR, "Evaluation failed: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSharpeningDamperLR::ComputeAndQueuePEs (%d)", (mTraceObject), err); return err; } // Compute and queue Adsoc Gain PE (scale against omx config and clip value) fAdsocGain = pDamperValues[SHARPENING_ADSOC_GAIN_LR]; fScaleFactor = (float)iOmxSharpness * iScaleFactorGain + iScaleFactorOffset; MSG1("Scale Factor = %f\n", fScaleFactor); OstTraceFiltStatic1(TRACE_DEBUG, "Scale Factor = %f", (mTraceObject), fScaleFactor); fAdsocGain *= fScaleFactor; if( fAdsocGain < 0.0) { fAdsocGain = 0.0; } else if ( fAdsocGain > 255.0 ) { fAdsocGain = 255.0; } MSG2("%s = %f\n", CIspctlCom::pIspctlSensor->GetPeName(Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Gain_Byte0), fAdsocGain); OstTraceFiltStatic1(TRACE_DEBUG, "Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Gain = %f", (mTraceObject), fAdsocGain); pIspctlCom->queuePE( Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Gain_Byte0, (t_uint32)fAdsocGain); // Compute and queue Adsoc Coring PE fAdsocCoring = pDamperValues[SHARPENING_ADSOC_CORING_LR]; if( fAdsocCoring < 0.0) { fAdsocCoring = 0.0; } else if ( fAdsocCoring > 31.0 ) { fAdsocCoring = 31.0; } MSG2("%s = %f\n", CIspctlCom::pIspctlSensor->GetPeName(Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Coring_Level_Byte0), fAdsocCoring); OstTraceFiltStatic1(TRACE_DEBUG, "Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Coring_Level = %f", (mTraceObject), fAdsocCoring); pIspctlCom->queuePE( Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Coring_Level_Byte0, (t_uint32)fAdsocCoring); // Done OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSharpeningDamperLR::ComputeAndQueuePEs (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
void CFlashSequencer::doAtom(cam_flashSeq_atom_t const *pAtom) { IN0("\n"); t_sw3A_FlashDirective flashDirective; flashDirective.flashState = pAtom->flashState; flashDirective.flashDurationUs = 0; // Manually strobed, so there is no pre-defined duration. flashDirective.flashPower = pAtom->flashPower_per; flashDirective.bNeedPreCaptureFlash = false; flashDirective.bNeedPostCaptureFlash = false; if (mController != NULL) { cam_flash_err_e err = mController->configure(&flashDirective); if (CAM_FLASH_ERR_NONE != err) { DBGT_ERROR("Error: Flash configuration failed.\n"); OstTraceFiltStatic0(TRACE_ERROR, "Error: Flash configuration failed.", (mTraceObject)); DBC_ASSERT(0); } } else { DBGT_ERROR("Error: Cannot run a flash sequence atom without a valid flash controller.\n"); OstTraceFiltStatic0(TRACE_ERROR, "Error: Cannot run a flash sequence atom without a valid flash controller.", (mTraceObject)); DBC_ASSERT(0); } mpTimerStartClbk(pAtom->flashDuration_ms, mTimerctxtHnd); OUT0("\n"); }
void CFlashController::updateSupportedFlashModes(enumCameraSlot camSlot) { IN0("\n"); if (mFlashDriver != NULL) { mFlashDriverCamId = (camSlot == ePrimaryCamera) ? EPrimary : ESecondary; mFlashDriver->GetSupportedFlashModes(mDriverSupportedFlashModes, mFlashDriverCamId); } else { DBGT_ERROR("updateSupportedFlashModes: No valid flash driver.\n"); OstTraceFiltStatic0(TRACE_ERROR, "updateSupportedFlashModes: No valid flash driver.", (mTraceObject)); DBC_ASSERT(0); mDriverSupportedFlashModes = FLASH_MODE_NONE; } mFlashModesSet = translateFlashModes(mDriverSupportedFlashModes); MSG1("Flash Driver : Supported Flash modes = %d\n", (int)mFlashModesSet); OUT0("\n"); };
SCF_STATE CAM_SM::ExecutingToIdle(s_scf_event const *e) { switch (e->sig) { case SCF_STATE_ENTRY_SIG: ENTRY; return 0; case SCF_STATE_EXIT_SIG: EXIT; return 0; case SCF_STATE_INIT_SIG: { MSG0("ExecutingToIdle-SCF_STATE_INIT\n"); OstTraceFiltStatic0(TRACE_DEBUG, "ExecutingToIdle-SCF_STATE_INIT", (&mENSComponent)); cam_flash_err_e cam_err = p3AComponentManager->mFlashController.unConfigure(); if (cam_err != CAM_FLASH_ERR_NONE) { DBGT_ERROR("Error: Could not un-configure the flash driver.\n"); OstTraceFiltStatic0(TRACE_ERROR, "Error: Could not un-configure the flash driver.", (&mENSComponent)); DBC_ASSERT(0); } if (bLowPower){ ControlingISP_ControlType = ControlingISP_SendWakeUp_WaitIspWorkenUp_SendIdle; bLowPower = FALSE; SM_PUSH_STATE_STATIC(&CAM_SM::ExecutingToIdle_3); } else { ControlingISP_ControlType = ControlingISP_SendStop_WaitIspSensorStopStreaming_SendIdle_Stop3A; SM_PUSH_STATE_STATIC(&CAM_SM::RendezvousState); DBC_ASSERT(p3AComponentManager->whatNextAfterRendezvous== NULL); p3AComponentManager->whatNextAfterRendezvous= SCF_STATE_PTR(&CAM_SM::ExecutingToIdle_3); } SCF_TRANSIT_TO(&CAM_SM::SHARED_ControlingISPState); return 0; } case Q_DEFERRED_EVENT_SIG: { MSG0("ExecutingToIdle-Q_DEFERRED_EVENT\n"); OstTraceFiltStatic0(TRACE_DEBUG, "ExecutingToIdle-Q_DEFERRED_EVENT", (&mENSComponent)); return 0; } default: break; } return SCF_STATE_PTR(&CAM_SM::EnteringOpMode); }
/* * This function sets the Gaussian Weight damper */ t_damper_error_code CNoiseFilterDamper::SetDusterGaussianWeightDamper( const float* pValues, const int aNumRows, const int aNumCols) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CNoiseFilterDamper::SetDusterGaussianWeightDamper", (mTraceObject)); t_damper_error_code err = DAMPER_OK; MSG2("[Gaussian Weight] NumRows=%d, NumCols=%d\n", aNumRows, aNumCols); OstTraceFiltStatic2(TRACE_DEBUG, "[Gaussian Weight] NumRows=%d, NumCols=%d", (mTraceObject), aNumRows, aNumCols); err = DoSetDamper( pValues, aNumRows, aNumCols); if(err!=DAMPER_OK) { DBGT_ERROR("[Gaussian Weight] failed to set damper: err=%d\n", err); OstTraceFiltStatic1(TRACE_ERROR, "[Gaussian Weight] failed to set damper: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::SetDamper (%d)", (mTraceObject), err); return err; } OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::SetDamper (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
/* * This function sets the Coring Level damper */ t_damper_error_code CScorpioDamper::SetCoringLevelDamper( const float* pValues, const int aNumRows, const int aNumCols) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CScorpioDamper::SetCoringLevelDamper", (mTraceObject)); t_damper_error_code err = DAMPER_OK; MSG2("[Coring Level] NumRows=%d, NumCols=%d\n", aNumRows, aNumCols); OstTraceFiltStatic2(TRACE_DEBUG, "[Coring Level] NumRows=%d, NumCols=%d", (mTraceObject), aNumRows, aNumCols); err = DoSetDamper( pValues, aNumRows, aNumCols); if(err!=DAMPER_OK) { DBGT_ERROR("[Coring Level] failed to set damper: err=%d\n", err); OstTraceFiltStatic1(TRACE_ERROR, "[Coring Level] failed to set damper: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CScorpioDamper::SetCoringLevelDamper (%d)", (mTraceObject), err); return err; } OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CScorpioDamper::SetCoringLevelDamper (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
//************************************************************************* OMX_ERRORTYPE CSiaPlatformManager::deinit(enumCameraSlot slot) { OMX_ERRORTYPE error = OMX_ErrorNone; #ifndef MMIO_ENABLE_NEW_IF //Deactivate I2C2 error = activate_i2c2(MMIO_DEACTIVATE_I2C); if (error) { DBGT_ERROR("ERROR in activate_i2c2(MMIO_DEACTIVATE_I2C) !\n"); OstTraceFiltStatic0(TRACE_ERROR, "ERROR in activate_i2c2(MMIO_DEACTIVATE_I2C) !", (mTraceObject)); return error; } //Delay after deactivating i2c usleep(DEACTIVATE_EXT_CLK_DELAY); #endif //#ifndef MMIO_ENABLE_NEW_IF // Switch OFF extClk error = MMIO_Camera::setExtClk(OMX_FALSE); if (error) { DBGT_ERROR("ERROR in MMIO_Camera::setExtClk(OFF) !\n"); OstTraceFiltStatic0(TRACE_ERROR, "ERROR in MMIO_Camera::setExtClk(OFF) !", (mTraceObject)); return error; } //Delay after stopping external clock usleep(DEACTIVATE_XSHUTDOWN_DELAY); #ifndef MMIO_ENABLE_NEW_IF //Toggle xshutdown pin if(slot == ePrimaryCamera){ error = enable_xshutdown_from_host(OMX_TRUE, OMX_TRUE); if (error) { MSG0( "ERROR in enable_xshutdown_from_host(ON) !\n"); return error; } } //Delay after toggling xshutdown pin usleep(DEACTIVATE_POWER_DELAY); #endif // PowerOff the sensor error = MMIO_Camera::powerSensor(OMX_FALSE); if (error) { DBGT_ERROR("ERROR in MMIO_Camera::powerSensor(OFF) !\n"); OstTraceFiltStatic0(TRACE_ERROR, "ERROR in MMIO_Camera::powerSensor(OFF) !", (mTraceObject)); return error; } error = MMIO_Camera::desinitBoard(); if (error) { DBGT_ERROR("ERROR in MMIO_Camera::desinitBoard !\n"); OstTraceFiltStatic0(TRACE_ERROR, "ERROR in MMIO_Camera::desinitBoard !", (mTraceObject)); } //release camera #ifdef MMIO_ENABLE_NEW_IF error = MMIO_Camera::releaseDriver(); if (error) { DBGT_ERROR("ERROR in MMIO_Camera::releaseDriver!\n"); OstTraceFiltStatic0(TRACE_ERROR, "MMIO_Camera::releaseDriver!", (mTraceObject)); } #else if(slot ==ePrimaryCamera) error = MMIO_Camera::releasePrimaryCameraHWInterface(); else error = MMIO_Camera::releaseSecondaryCameraHWInterface(); if (error) { DBGT_ERROR("ERROR in MMIO_Camera::releasePrimary/SecondaryCameraHWInterface !\n"); OstTraceFiltStatic0(TRACE_ERROR, "ERROR in MMIO_Camera::releasePrimary/SecondaryCameraHWInterface !", (mTraceObject)); } #endif // MMIO_ENABLE_NEW_IF return error; }
SCF_STATE CAM_SM::PowerUp_STC_SendDataToFirmware(s_scf_event const *e) { switch (e->sig) { case SCF_STATE_ENTRY_SIG: { ENTRY; MSG0("PowerUp_STC_SendDataToFirmware-SCF_STATE_ENTRY_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_SendDataToFirmware-SCF_STATE_ENTRY_SIG", (&mENSComponent)); CTuningBinData* pFwTuningObj = NULL; // Get the firmware tuning object pFwTuningObj = pTuningDataBase->getObject(TUNING_OBJ_FIRMWARE_DATA); // Check that the firmware tuning data fit into the shared memory chunk if( (csm_uint32_t)pFwTuningObj->getSize() > pFwShmChunk->size) { MSG0("PowerUp_STC_SendDataToFirmware: Tuning data shared chunk too small:\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_SendDataToFirmware: Tuning data shared chunk too small:", (&mENSComponent)); MSG1("PowerUp_STC_SendDataToFirmware: Shared mem size = %ld\n", pFwShmChunk->size); OstTraceFiltStatic1(TRACE_DEBUG, "PowerUp_STC_SendDataToFirmware: Shared mem size = %ld", (&mENSComponent), pFwShmChunk->size); MSG1("PowerUp_STC_SendDataToFirmware: Actual data size = %d\n", pFwTuningObj->getSize()); OstTraceFiltStatic1(TRACE_DEBUG, "PowerUp_STC_SendDataToFirmware: Actual data size = %d", (&mENSComponent), pFwTuningObj->getSize()); DBC_ASSERT(0); return 0; } // Copy the tuning data into the firmware address space MSG3("PowerUp_STC_SendDataToFirmware: Copying data %p, size %d, into firwmare address space %p\n", pFwTuningObj->getAddr(), pFwTuningObj->getSize(), pFwShmChunk->ispLogicalAddress); OstTraceFiltStatic3(TRACE_DEBUG, "PowerUp_STC_SendDataToFirmware: Copying data 0x%x, size %d, into firwmare address space 0x%x", (&mENSComponent), (t_uint32)pFwTuningObj->getAddr(), pFwTuningObj->getSize(), (t_uint32)pFwShmChunk->ispLogicalAddress); if (NULL != pFwTuningObj->getAddr()) { memcpy(pFwShmChunk->armLogicalAddress, pFwTuningObj->getAddr(), pFwTuningObj->getSize()); } else { DBC_ASSERT(0); return 0; } // Flush the memory cache (so that consistent data are read by firmware) camSharedMemError_t shmErr = CAM_SHARED_MEM_ERR_NONE; shmErr = pSharedMemory->cacheClean(CAM_SHARED_MEM_CHUNK_FW_CONFIG); if (shmErr != CAM_SHARED_MEM_ERR_NONE) { DBGT_ERROR("PowerUp_STC_SendDataToFirmware: Failed to flush shared memory chunk, err=%d\n", shmErr); OstTraceFiltStatic1(TRACE_ERROR, "PowerUp_STC_SendDataToFirmware: Failed to flush shared memory chunk, err=%d", (&mENSComponent), shmErr); DBC_ASSERT(0); return 0; } // Send the address (firmware address space) to XP70 pIspctlCom->queuePE(Sensor_Tuning_Control_u32_SubBlock_Data_Address_Byte0, (t_uint32)pFwShmChunk->ispLogicalAddress ); pIspctlCom->processQueue(); return 0; } case SCF_STATE_EXIT_SIG: { EXIT; return 0; } case EVT_ISPCTL_LIST_INFO_SIG: { MSG0("PowerUp_STC_SendDataToFirmware-EVT_ISPCTL_LIST_INFO_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_SendDataToFirmware-EVT_ISPCTL_LIST_INFO_SIG", (&mENSComponent)); if (e->type.ispctlInfo.info_id != ISP_WRITELIST_DONE) break; SCF_TRANSIT_TO(&CAM_SM::PowerUp_STC_Done); return 0; } default: break; } return SCF_STATE_PTR(&COM_SM::SHARED_ControlingISPState_Boot); }
SCF_STATE CAM_SM::PowerUp_STC_LoadData(s_scf_event const *e) { switch (e->sig) { case SCF_STATE_ENTRY_SIG: { MSG0("PowerUp_STC_LoadData-SCF_STATE_ENTRY_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_LoadData-SCF_STATE_ENTRY_SIG", (&mENSComponent)); TuningLoaderMgrError_t tlmErr = TUNING_LOADER_MGR_OK; t_camera_info camInfo; // Initialisation to remove Coverity Warning camInfo.manufId = 0; camInfo.modelId = 0; camInfo.revNum = 0; camInfo.Fuse_Id[0] = 0; camInfo.Fuse_Id[1] = 0; camInfo.Fuse_Id[2] = 0; camInfo.Fuse_Id4 = 0; camInfo.manufId = pSensor->GetSensorManufacturer(); camInfo.modelId = pSensor->GetSensorModel(); camInfo.revNum = pSensor->GetSensorRevNumber(); t_fw_blocks_info fwBlocks; fwBlocks.subBlockCount = iFwSubBlockIdsCount; fwBlocks.pSubBlockId = pFwSubBlockId; MSG0("PowerUp_STC_LoadData: loading firmware tuning data\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_LoadData: loading firmware tuning data", (&mENSComponent)); tlmErr = pTuningLoaderManager->loadFirmwareTuningData(&camInfo, &fwBlocks); if(tlmErr != TUNING_LOADER_MGR_OK) { DBGT_ERROR("PowerUp_STC_LoadData: firmware tuning data loading failed err=%d (%s)\n", tlmErr, CTuningLoaderManager::errorCode2String(tlmErr)); OstTraceFiltStatic1(TRACE_ERROR, "PowerUp_STC_LoadData: firmware tuning data loading failed err=%d", (&mENSComponent), tlmErr); DBC_ASSERT(0); return 0; } return 0; } case TUNING_LOADER_OPERATION_DONE_SIG: { MSG0("PowerUp_STC_LoadData-TUNING_LOADER_OPERATION_DONE_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_LoadData-TUNING_LOADER_OPERATION_DONE_SIG", (&mENSComponent)); MSG2("Deleting pFwSubBlockId=%p (%d entries)\n", pFwSubBlockId, iFwSubBlockIdsCount); OstTraceFiltStatic2(TRACE_DEBUG, "Deleting pFwSubBlockId=%0x%x (%d entries)", (&mENSComponent), (t_uint32)pFwSubBlockId, iFwSubBlockIdsCount); delete [] pFwSubBlockId; pFwSubBlockId = NULL; SCF_TRANSIT_TO(&CAM_SM::PowerUp_STC_SendDataToFirmware); return 0; } case TUNING_LOADER_OPERATION_FAILED_SIG: { MSG0("PowerUp_STC_LoadData-TUNING_LOADER_OPERATION_FAILED_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_LoadData-TUNING_LOADER_OPERATION_FAILED_SIG", (&mENSComponent)); DBGT_ERROR("PowerUp_STC_LoadData: failed to load firmware tuning data err=%ld (%s)\n", e->type.tuningLoaderEvent.error, pTuningLoaderManager->loaderErrorCode2String(e->type.tuningLoaderEvent.error)); OstTraceFiltStatic1(TRACE_ERROR, "PowerUp_STC_LoadData: failed to load firmware tuning data err=%ld", (&mENSComponent), e->type.tuningLoaderEvent.error); DBC_ASSERT(0); return 0; } case SCF_STATE_EXIT_SIG: { EXIT; return 0; } default: break; } return SCF_STATE_PTR(&COM_SM::SHARED_ControlingISPState_Boot); }
SCF_STATE CAM_SM::PowerUp_STC_GetNbBlockIds(s_scf_event const *e) { switch (e->sig) { case SCF_STATE_ENTRY_SIG: { ENTRY; MSG0("PowerUp_STC_GetNbBlockIds-SCF_STATE_ENTRY_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_GetNbBlockIds-SCF_STATE_ENTRY_SIG", (&mENSComponent)); // Ask to firmware how many tuning blocks are supported and get current coin value pIspctlCom->queuePE(Sensor_Tuning_Status_u16_TotalSubBlockIdsCount_Byte0,0); pIspctlCom->queuePE(Sensor_Tuning_Status_e_Coin_SubBlock_Status_Byte0,0); pIspctlCom->readQueue(); return 0; } case EVT_ISPCTL_LIST_INFO_SIG: { MSG0("PowerUp_STC_GetNbBlockIds-EVT_ISPCTL_LIST_INFO_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_GetNbBlockIds-EVT_ISPCTL_LIST_INFO_SIG", (&mENSComponent)); if(e->type.ispctlInfo.info_id != ISP_READLIST_DONE) break; // Store the Firmware tuning info related data iFwSubBlockIdsCount = (t_uint16)e->type.ispctlInfo.Listvalue[0].pe_data; iStatusCoin = (Coin_te) e->type.ispctlInfo.Listvalue[1].pe_data; if(iFwSubBlockIdsCount==0) { // Firmware does not support tuning MSG0(" Tuning not supported by the firmware\n"); OstTraceFiltStatic0(TRACE_DEBUG, "Tuning not supported by the firmware", (&mENSComponent)); pFwSubBlockId = NULL; SCF_TRANSIT_TO(&COM_SM::SHARED_ControlingISPState); return 0; } else { // Firmware supports tuning: retrieve the supported IDs MSG1(" Tuning supported by the firmware: %d FwSubBlocks supported\n", iFwSubBlockIdsCount); OstTraceFiltStatic1(TRACE_DEBUG, "Tuning supported by the firmware: %d FwSubBlocks supported", (&mENSComponent), iFwSubBlockIdsCount); iStatusCoinRetriesCount = 0; iCurrentFwSubBlockIndex = 0; pFwSubBlockId = new t_uint16[iFwSubBlockIdsCount]; if(pFwSubBlockId==NULL) { DBGT_ERROR(" Failed to allocate %d entries for FwSubBlock IDs\n", iFwSubBlockIdsCount); OstTraceFiltStatic1(TRACE_ERROR, "Failed to allocate %d entries for FwSubBlock IDs", (&mENSComponent), iFwSubBlockIdsCount); DBC_ASSERT(0); return 0; } MSG2(" Allocated pFwSubBlockId=%p (%d entries)\n", pFwSubBlockId, iFwSubBlockIdsCount); OstTraceFiltStatic2(TRACE_DEBUG, "Allocated pFwSubBlockId=0x%x (%d entries)", (&mENSComponent), (t_uint32)pFwSubBlockId, iFwSubBlockIdsCount); SCF_TRANSIT_TO(&CAM_SM::PowerUp_STC_QueryId); } return 0; } case SCF_STATE_EXIT_SIG: { EXIT; return 0; } default: break; } return SCF_STATE_PTR(&COM_SM::SHARED_ControlingISPState_Boot); }
SCF_STATE CAM_SM::CAMERA_LoadingIQSettings_OpModeSetup(s_scf_event const *e) { switch (e->sig) { case SCF_STATE_ENTRY_SIG: { ENTRY; #ifdef CAMERA_ENABLE_OMX_3A_EXTENSION // Don't need to reconfigure the ISP dampers #else // CAMERA_ENABLE_OMX_3A_EXTENSION // Reconfigure the ISP dampers CTuning* pTuning = pOpModeMgr->GetOpModeTuning(); t_isp_dampers_error_code dErr = ISP_DAMPERS_OK; dErr = pIspDampers->SetMappings(pTuning); if(dErr!=ISP_DAMPERS_OK) { DBGT_ERROR("Failed to set ISP dampers mappings: err=%d (%s)\n", dErr, CIspDampers::ErrorCode2String(dErr)); OstTraceFiltStatic1(TRACE_ERROR, "Failed to set ISP dampers mappings: err=%d", (&mENSComponent), dErr); DBC_ASSERT(0); return 0; } dErr = pIspDampers->Configure( pTuning, IQSET_OPMODE_SETUP); /*restoring damper configuration written during loaded state*/ Camera* Cam = (Camera*)&mENSComponent.getProcessingComponent(); for (t_uint8 i = 0; i < 8; i++) { if (Cam->isDamperConfigReqd[i].bIndexToBeConfigured == OMX_TRUE) { Cam->configureDamper(Cam->isDamperConfigReqd[i].nIndex); } } if(dErr!=ISP_DAMPERS_OK) { DBGT_ERROR("Failed to configure ISP dampers: err=%d (%s)\n", dErr, CIspDampers::ErrorCode2String(dErr)); OstTraceFiltStatic1(TRACE_ERROR, "Failed to configure ISP dampers: err=%d", (&mENSComponent), dErr); DBC_ASSERT(0); return 0; } // Configure the Picture Settings t_picture_setting_error_code psErr = PICTURE_SETTING_OK; psErr = pPictureSettings->Configure(pTuning); if(psErr!=PICTURE_SETTING_OK) { DBGT_ERROR("Failed to configure Picture Settings: err=%d\n", psErr); OstTraceFiltStatic1(TRACE_ERROR, "Failed to configure Picture Settings: err=%d", (&mENSComponent), psErr); DBC_ASSERT(0); return 0; } #endif // CAMERA_ENABLE_OMX_3A_EXTENSION pResourceSharerManager->mRSPing.Ping(0); return 0; } case Q_PONG_SIG: { #ifdef CAMERA_ENABLE_OMX_3A_EXTENSION // Don't need to apply tuning data (it is come from upper layer) pIspctlCom->queuePE(DeviceParameters_u32_DeviceId_Byte0, 0); #else // CAMERA_ENABLE_OMX_3A_EXTENSION // Fetch the Op Mode ISP settings CTuning* pTuning = pOpModeMgr->GetOpModeTuning(); t_tuning_param peList[ISPCTL_SIZE_TAB_PE] = {{0,0,0}}; t_tuning_error_code tErr = TUNING_OK; t_sint32 nbPe = ISPCTL_SIZE_TAB_PE; tErr = pTuning->GetParamList( IQSET_OPMODE_SETUP, IQSET_USER_ISP, peList, &nbPe); if(tErr != TUNING_OK) { DBGT_ERROR("CAMERA_LoadingIQSettings_OpModeSetup: failed to visit Op Mode tuning object: err=%d (%s)\n",tErr, CTuning::ErrorCode2String(tErr)); OstTraceFiltStatic1(TRACE_ERROR, "CAMERA_LoadingIQSettings_OpModeSetup: failed to visit Op Mode tuning object: err=%d", (&mENSComponent),tErr); DBC_ASSERT(0); return 0; } // Apply the Op Mode ISP settings for (t_uint16 i=0;i<nbPe;i++) { pIspctlCom->queuePE((t_uint16)peList[i].addr, peList[i].value ); } #endif // CAMERA_ENABLE_OMX_3A_EXTENSION pIspctlCom->processQueue(); return 0; } case SCF_STATE_EXIT_SIG: EXIT; return 0; case EVT_ISPCTL_LIST_INFO_SIG: { MSG0("CAMERA_LoadingIQSettings_OpModeSetup-EVT_ISPCTL_LIST_INFO_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "CAMERA_LoadingIQSettings_OpModeSetup-EVT_ISPCTL_LIST_INFO_SIG", (&mENSComponent)); if (e->type.ispctlInfo.info_id != ISP_WRITELIST_DONE) break; SCF_TRANSIT_TO(&CAM_SM::CAMERA_LoadingIQSettings_ZoomPreRun); return 0; } default: break; } return SCF_STATE_PTR(&CAM_SM::CAMERA_LoadingIQSettings); }
//************************************************************************* OMX_ERRORTYPE CSiaPlatformManager::init(enumCameraSlot slot) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CSiaPlatformManager::init", (mTraceObject)); OMX_ERRORTYPE error=OMX_ErrorNone; #ifdef MMIO_ENABLE_NEW_IF //------------------------------------------------------- // Select camera //------------------------------------------------------- if(slot == ePrimaryCamera) MMIO_Camera::selectCamera(1, MMIO_Camera::eRawBayer); else MMIO_Camera::selectCamera(2, MMIO_Camera::eRawBayer); //------------------------------------------------------- // Init driver //------------------------------------------------------- error = MMIO_Camera::initDriver(); if (error) { MSG0( "ERROR in MMIO_Camera::initDriver!\n"); return error; } //------------------------------------------------------- // Init hardware //------------------------------------------------------- error = MMIO_Camera::initHardware(); if (error) { DBGT_ERROR("ERROR in MMIO_Camera::initHardware !\n"); OstTraceFiltStatic0(TRACE_ERROR, "ERROR in MMIO_Camera::initHardware !", (mTraceObject)); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSiaPlatformManager::init (%d)", (mTraceObject), error); return error; } #else //------------------------------------------------------- // Init board //------------------------------------------------------- if (slot == ePrimaryCamera) error = MMIO_Camera::initBoard(MMIO_Camera::ePrimaryXSD); else error = MMIO_Camera::initBoard(MMIO_Camera::eSecondaryXSD); if (error) { DBGT_ERROR("ERROR in MMIO_Camera::initBoard !\n"); OstTraceFiltStatic0(TRACE_ERROR, "ERROR in MMIO_Camera::initBoard !", (mTraceObject)); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSiaPlatformManager::init (%d)", (mTraceObject), error); return error; } //------------------------------------------------------- // Select Primary/Secondary Camera //------------------------------------------------------- if(slot ==ePrimaryCamera){ error = MMIO_Camera::setPrimaryCameraHWInterface(); if (error) { DBGT_ERROR("ERROR in MMIO_Camera::setPrimaryCameraHWInterface !\n"); OstTraceFiltStatic0(TRACE_ERROR, "ERROR in MMIO_Camera::setPrimaryCameraHWInterface !", (mTraceObject)); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSiaPlatformManager::init (%d)", (mTraceObject), error); return error; } } else { error = MMIO_Camera::setSecondaryCameraHWInterface(); if (error) { DBGT_ERROR("ERROR in MMIO_Camera::setSecondaryCameraHWInterface !\n"); OstTraceFiltStatic0(TRACE_ERROR, "ERROR in MMIO_Camera::setSecondaryCameraHWInterface !", (mTraceObject)); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSiaPlatformManager::init (%d)", (mTraceObject), error); return error; } } //------------------------------------------------------- // PowerOn the sensor //------------------------------------------------------- //error = MMIO_Camera::powerSensor(OMX_TRUE); //if (error) { // MSG0("ERROR in MMIO_Camera::powerSensor(ON) !\n"); // OstTraceFiltStatic0(TRACE_DEBUG, "ERROR in MMIO_Camera::powerSensor(ON) !", (mTraceObject)); // return error; //} #endif //MMIO_ENABLE_NEW_IF //------------------------------------------------------- // Switch ON extClk commented to fix MMIO External clocks are on after exiting from cam application //------------------------------------------------------- //error = MMIO_Camera::setExtClk(OMX_TRUE); //if (error) { // MSG0("ERROR in MMIO_Camera::setExtClk(ON) !\n"); // OstTraceFiltStatic0(TRACE_ERROR, "ERROR in MMIO_Camera::setExtClk(ON) !", (mTraceObject)); // OstTraceFiltStatic1(TRACE_FLOW, "Exit CSiaPlatformManager::init (%d)", (mTraceObject), error); // return error; // } //------------------------------------------------------- // Init MMDSP Timer //------------------------------------------------------- MMIO_Camera::initMMDSPTimer(); OUTR(" ", error); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSiaPlatformManager::init (%d)", (mTraceObject), error); return error; }
// Compare with previous state, and update current and previous cam_flash_err_e CFlashController::configure(t_sw3A_FlashDirective *pFlashDirective) { IN0("\n"); MSG3("CFlashController::configure State=%d Duration=%dus Power=%d%%\n", (int) pFlashDirective->flashState, (int) pFlashDirective->flashDurationUs, (int) pFlashDirective->flashPower); if (mFlashDriver == NULL) { DBGT_ERROR("configure: No valid flash driver.\n"); OstTraceFiltStatic0(TRACE_ERROR, "configure: No valid flash driver.", (mTraceObject)); DBC_ASSERT(0); OUT0("\n"); return CAM_FLASH_ERR_BAD_PRECONDITION; } if (mDriverSupportedFlashModes == 0) { MSG0("CFlash Driver : mDriverSupportedFlashModes 0 \n"); OUT0("\n"); return CAM_FLASH_ERR_NONE; } if((mFlashDirective_pre.flashState != pFlashDirective->flashState)|| (mFlashDirective_pre.flashPower != pFlashDirective->flashPower)|| (mFlashDirective_pre.flashDurationUs != pFlashDirective->flashDurationUs)) { mFlashDirective_pre.flashState = pFlashDirective->flashState; mFlashDirective_pre.flashPower = pFlashDirective->flashPower; mFlashDirective_pre.flashDurationUs = pFlashDirective->flashDurationUs; } else { MSG0("CFlash Driver : mFlashDirective_pre are same \n"); return CAM_FLASH_ERR_NONE; } bool bDoStrobe = false; TFlashMode refDriverMode = FLASH_MODE_NONE; t_uint32 duration = 0; duration = pFlashDirective->flashDurationUs; // flash is always disabled /* FIXME: possibly implement via inhibate(), or prevent flash requests from sw3A when in timenudge mode. if (OMX_TRUE == pOpModeMgr->IsTimeNudgeEnabled()) { flashState = SW3A_FLASH_OFF; } * */ if (mbDisabled) { pFlashDirective->flashState = SW3A_FLASH_OFF; } switch(pFlashDirective->flashState) { case SW3A_FLASH_OFF: refDriverMode = FLASH_MODE_NONE; bDoStrobe = false; break; case SW3A_FLASH_PREFLASH: //#if IMG_CONFIG_PREFLASH_USING_TORCHMODE // refDriverMode = FLASH_MODE_VIDEO_LED; // bDoStrobe = true; // break; //#endif /* IMG_CONFIG_PREFLASH_USING_TORCHMODE*/ /* If pre-flash is not implemented by a torch mode, it is handled as a main flash. */ case SW3A_FLASH_MAINFLASH: refDriverMode = FLASH_MODE_STILL_LED_EXTERNAL_STROBE; duration=0; /*ER: 367887*/ bDoStrobe = false; break; case SW3A_FLASH_PREFLASH_HPLED: case SW3A_FLASH_MAINFLASH_HPLED: refDriverMode = FLASH_MODE_STILL_LED_EXTERNAL_STROBE; bDoStrobe = false; break; case SW3A_FLASH_AFASSIST: refDriverMode = FLASH_MODE_AF_ASSISTANT; bDoStrobe = true; break; case SW3A_FLASH_INDICATOR: refDriverMode = FLASH_MODE_INDICATOR; bDoStrobe = true; break; case SW3A_FLASH_VIDEOLED: refDriverMode = FLASH_MODE_VIDEO_LED; bDoStrobe = true; break; default: DBGT_ERROR("configureFlash: Error: Unknown flash type %d\n", pFlashDirective->flashState); OstTraceFiltStatic1(TRACE_ERROR, "configureFlash: Error: Unknown flash type %d", (mTraceObject), pFlashDirective->flashState); DBC_ASSERT(0); OUT0("\n"); return CAM_FLASH_ERR_BAD_PARAMETER; } if ((refDriverMode != FLASH_MODE_NONE) && ((refDriverMode & mFlashModesSet) == 0)) { // The requested mode is not supported. Skip the configuration. MSG1("Warning: the requested flash mode (0x%08x) is not supported by the flash driver. Discard the configuration.\n", refDriverMode); OstTraceFiltStatic1(TRACE_WARNING, "Warning: the requested flash mode (0x%08x) is not supported by the flash driver. Discard the configuration.", (mTraceObject), refDriverMode); OUT0("\n"); return CAM_FLASH_ERR_NONE; } t_uint32 intensity = 0; t_uint32 timeout = 0; TFlashReturnCode driver_err = FLASH_RET_NONE; TFlashDetails details; MSG2("CFlash Driver : refDriverMode=%d : mFlashDriverMode=%d\n", refDriverMode, mFlashDriverMode); if (refDriverMode != mFlashDriverMode) { MSG0("CFlash Driver : refDriverMode != mFlashDriverMode \n"); cam_flash_err_e cam_err = unConfigure(); if (cam_err != CAM_FLASH_ERR_NONE) { DBGT_ERROR("Error: Could not un-configure the flash driver.\n"); OstTraceFiltStatic0(TRACE_ERROR, "Error: Could not un-configure the flash driver.", (mTraceObject)); OUT0("\n"); return CAM_FLASH_ERR_DRIVER; } if (refDriverMode != FLASH_MODE_NONE) //ER: 406525 { MSG0("CFlash Driver : refDriverMode != FLASH_MODE_NONE \n"); driver_err = mFlashDriver->GetFlashModeDetails(refDriverMode, details, mFlashDriverCamId); if (driver_err != FLASH_RET_NONE) { DBGT_ERROR("Error: Flash details could not be retrieved.\n"); // NB: might not work for NONE mode OstTraceFiltStatic0(TRACE_ERROR, "Error: Flash details could not be retrieved.", (mTraceObject)); // NB: might not work for NONE mode OUT0("\n"); return CAM_FLASH_ERR_DRIVER; } } /* No added value with this check, at least for the time being. driver_err = validateFlashDetails(&details); if (driver_err != FLASH_RET_NONE) { DBGT_ERROR("Error: Invalid flash details.\n"); OstTraceFiltStatic0(TRACE_ERROR, "Error: Invalid flash details.", (mTraceObject)); OUT0("\n"); return CAM_FLASH_ERR_DRIVER; } */ driver_err = mFlashDriver->EnableFlashMode(refDriverMode, NULL, NULL, mFlashDriverCamId); if (driver_err != FLASH_RET_NONE) { DBGT_ERROR("Error: Flash mode could not be enabled.\n"); OstTraceFiltStatic0(TRACE_ERROR, "Error: Flash mode could not be enabled.", (mTraceObject)); OUT0("\n"); return CAM_FLASH_ERR_DRIVER; } mFlashDriverMode = refDriverMode; mFlashDriverModeDetails = details; } if (mFlashDriverMode != FLASH_MODE_NONE) { // Configuring the NONE mode is not allowed by the driver. MSG0("CFlash Driver : computeIntensity \n"); intensity = computeIntensity(pFlashDirective, &mFlashDriverModeDetails); #if (IMG_CONFIG_SW_PLATFORM == 1) if(pFlashDirective->flashDurationUs == 0) { timeout = 0; } else { timeout = mFlashDriverModeDetails.MaxStrobeDuration; } driver_err = mFlashDriver->ConfigureFlashMode(mFlashDriverMode, duration, intensity, timeout, mFlashDriverCamId); //ER 365857 #else driver_err = mFlashDriver->ConfigureFlashMode(mFlashDriverMode, duration, intensity, timeout, mFlashDriverCamId); #endif if (driver_err != FLASH_RET_NONE) { DBGT_ERROR("Error: Flash mode could not be configured.\n"); OstTraceFiltStatic0(TRACE_ERROR, "Error: Flash mode could not be configured.", (mTraceObject)); OUT0("\n"); return CAM_FLASH_ERR_DRIVER; } } if (bDoStrobe) { MSG0("CFlash Driver : bDoStrobe \n"); driver_err = mFlashDriver->Strobe(mFlashDriverMode, true, mFlashDriverCamId); if (driver_err != FLASH_RET_NONE) { DBGT_ERROR("Error: Manual strobe failed.\n"); OstTraceFiltStatic0(TRACE_ERROR, "Error: Manual strobe failed.", (mTraceObject)); OUT0("\n"); return CAM_FLASH_ERR_DRIVER; } } OUT0("\n"); return CAM_FLASH_ERR_NONE; }