/** Call by the ens framework when a command port is sending. Note that Enable/Disable port does NOT hit this function */ WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::doSpecificSendCommand(OMX_COMMANDTYPE eCmd, OMX_U32 nData, OMX_BOOL &bDeferredCmd) //************************************************************************************************************* { switch(eCmd) { case OMX_CommandStateSet: // only transition from idle -> execute and execute --> idle are visible!!! MSG3(" %s.SetState( %s=%lu)\n", GetComponentName(), GetStringOmxState(nData), nData); break; case OMX_CommandFlush: MSG2(" %s.Flush(%lu)\n", GetComponentName(), nData); break; case OMX_CommandPortDisable: MSG2("%s.DisablePort(%lu)\n", GetComponentName(), nData); break; case OMX_CommandPortEnable: MSG2("%s.EnablePort(%lu)\n", GetComponentName(), nData); break; case OMX_CommandMarkBuffer: MSG2("%s.MarkBuffer(%lu)\n", GetComponentName(), nData); break; default: MSG3("%s.Unknow specific command %d- %lu\n", GetComponentName(), eCmd, nData); break; } return OMX_ErrorNone; }
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::doSpecificEventHandler_cb(OMX_EVENTTYPE _event, OMX_U32 nData1, OMX_U32 nData2, OMX_BOOL &deferredEvent) //************************************************************************************************************* { IN0("\n"); switch ((unsigned int)_event) { case OMX_EventCmdComplete: if (nData1 == OMX_CommandStateSet) { //Only idle and executing are trapped! MSG3("OMX_EventCmdComplete %s.%s(%s)\n", GetComponentName(), GetStringOmxCommand(nData1), GetStringOmxState(nData2) ); } else // encapsulate OMX_EventPortSettingsChanged & OMX_EventBufferFlag MSG3("OMX_EventCmdComplete %s.%s(%d)\n", GetComponentName(), GetStringOmxCommand(nData1), (int)nData2); break; case OMX_EventError: MSG1("OMX_EventError %ld\n", nData1); break; case OMX_EventMark: MSG0("OMX_EventMark\n"); break; case OMX_EventPortSettingsChanged: MSG1("OMX_EventPortSettingsChanged(%d)\n", (int)nData1); break; case OMX_EventBufferFlag: if(nData2 == OMX_BUFFERFLAG_EOS) { MSG1("OMX_EventBufferFlag('EOS') on port %ld\n", nData1); } else MSG2("OMX_EventBufferFlag(%ld) on port %ld\n", nData2, nData1); break; case OMX_EventResourcesAcquired: MSG0("OMX_EventResourcesAcquired\n"); break; case OMX_EventComponentResumed: MSG0("OMX_EventComponentResumed\n"); break; case OMX_EventDynamicResourcesAvailable: MSG0("OMX_EventDynamicResourcesAvailable\n"); break; case OMX_EventPortFormatDetected: MSG0("OMX_EventPortFormatDetected\n"); break; case OMX_EventIndexSettingChanged: MSG0("OMX_EventIndexSettingChanged\n"); break; case OMX_EventCmdReceived: if (nData1 == OMX_CommandStateSet) { //Only idle and executing are trapped! MSG3("OMX_EventCmdReceived %s.%s(%s)\n", GetComponentName(), GetStringOmxCommand(nData1), GetStringOmxState(nData2) ); } else MSG3("OMX_EventCmdReceived %s.%s(%ld)\n", GetComponentName(), GetStringOmxCommand(nData1), (long)nData2); break; default: MSG3("unknown OMX_Event(%d, %d, %d)\n", _event, (int)nData1, (int)nData2); break; } // Don't send any more this command because it duplicate OMX_EventBufferFlag messages //((OpenMax_Component*)&mENSComponent)->eventHandler(_event, nData1, nData2) ; OUT0("\n"); return OMX_ErrorNone; }
/* * 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 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; }
SCF_STATE CAM_SM::PowerUp_STC_ReadId(s_scf_event const *e) { switch (e->sig) { case SCF_STATE_ENTRY_SIG: { ENTRY; MSG0("PowerUp_STC_ReadId-SCF_STATE_ENTRY_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_ReadId-SCF_STATE_ENTRY_SIG", (&mENSComponent)); pIspctlCom->queuePE(Sensor_Tuning_Status_u16_CurrentSubBlockIdValue_Byte0,0); pIspctlCom->readQueue(); return 0; } case EVT_ISPCTL_LIST_INFO_SIG: { MSG0("PowerUp_STC_ReadId-EVT_ISPCTL_LIST_INFO_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_ReadId-EVT_ISPCTL_LIST_INFO_SIG", (&mENSComponent)); if (e->type.ispctlInfo.info_id != ISP_READLIST_DONE) break; //#if defined (OSI_DEBUG) for(t_uint16 i=0; i < e->type.ispctlInfo.number_of_pe; i++) { MSG3(" PE[%d] %s = 0x%lX\n", i, pSensor->GetPeName(e->type.ispctlInfo.Listvalue[i].pe_addr), e->type.ispctlInfo.Listvalue[i].pe_data ); //OstTraceFiltStatic3(TRACE_DEBUG, "PE[%d] %s = 0x%lX", (&mENSComponent), i, CXp70::GetPeName(e->type.ispctlInfo.Listvalue[i].pe_addr), e->type.ispctlInfo.Listvalue[i].pe_data ); } //#endif // Store tuning BlockId value pFwSubBlockId[iCurrentFwSubBlockIndex] = (t_uint16)e->type.ispctlInfo.Listvalue[0].pe_data; MSG2(" FwSubBlockId[%d] = ID%d\n", iCurrentFwSubBlockIndex, pFwSubBlockId[iCurrentFwSubBlockIndex]); OstTraceFiltStatic2(TRACE_DEBUG, "FwSubBlockId[%d] = ID%d", (&mENSComponent), iCurrentFwSubBlockIndex, pFwSubBlockId[iCurrentFwSubBlockIndex]); // Another block to be fetched ? iCurrentFwSubBlockIndex++; if(iCurrentFwSubBlockIndex<iFwSubBlockIdsCount) { // Still some tuning blocks IDs are to be fetched MSG0(" Some blocks ID are to be fetched\n"); OstTraceFiltStatic0(TRACE_DEBUG, "Some blocks ID are to be fetched", (&mENSComponent)); SCF_TRANSIT_TO(&CAM_SM::PowerUp_STC_QueryId); } else { // All tuning blocks IDs were fetched MSG1(" All block IDs were fetched: total %d\n", iFwSubBlockIdsCount); OstTraceFiltStatic1(TRACE_DEBUG, "All block IDs were fetched: total %d", (&mENSComponent), iFwSubBlockIdsCount); //#if defined (OSI_DEBUG) for(t_uint16 i=0; i<iFwSubBlockIdsCount; i++) { MSG2(" FwSubBlockId[%d] = ID%d\n", i, pFwSubBlockId[i]); OstTraceFiltStatic2(TRACE_DEBUG, "FwSubBlockId[%d] = ID%d", (&mENSComponent), i, pFwSubBlockId[i]); } //#endif SCF_TRANSIT_TO(&CAM_SM::PowerUp_STC_LoadData); } return 0; } case SCF_STATE_EXIT_SIG: { EXIT; return 0; } default: break; } return SCF_STATE_PTR(&COM_SM::SHARED_ControlingISPState_Boot); }
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::allocateBuffer(OMX_U32 nPortIndex, OMX_U32 nBufferIndex, OMX_U32 nSizeBytes, OMX_U8 **ppData, void **bufferAllocInfo, void **portPrivateInfo) //************************************************************************************************************* { IN0("\n"); MSG3("Allocate buffer PortIndex %lu, nBufferIndex=%lu, nSizeBytes %lu\n", nPortIndex, nBufferIndex, nSizeBytes); OMX_ERRORTYPE err = OMX_ErrorNone; err = allocateBufferHeap(nPortIndex, nBufferIndex, nSizeBytes, ppData, bufferAllocInfo, portPrivateInfo); ++m_NbPortAllocated[nPortIndex]; OUTR("", (err)); return err; }
void openmax_processor::emptyThisBuffer(OMX_BUFFERHEADERTYPE_p buffer, t_uint8 portNb) //******************************************************************************* { //Just wrap to the base component IN0("\n"); Port *pPort=GetPort(portNb); WARNING(pPort); MSG3("%s->emptyThisBuffer[%lu] Header=%p \n", GetComponentName(), buffer->nInputPortIndex, (void *)buffer); WARNING(buffer->nInputPortIndex==portNb); Component::deliverBuffer(portNb, buffer); OUT0("\n"); }
t_fileio_error tuningloader_calfile::process(t_cal_file_info* pCalFileInfo) { bool bCalStatusFound = false; bool bFuseIdFound = false; char cFileLine[128] = ""; char* pString = NULL; // Sanity check if( pCalFileInfo == NULL ) { // Bad parameter MSG3("Bad parameter: pCalFileInfo=%p \n", pCalFileInfo); OUTR(" ", FILEIO_BAD_ARGUMENT); return FILEIO_BAD_ARGUMENT; } pCalFileInfo->iCalStatus[0] = '\0'; pCalFileInfo->Fuse_Id4 =0; while(gets(cFileLine,sizeof(cFileLine))!= NULL) { if(bCalStatusFound == false) { if(strstr(cFileLine,"Success") != NULL) { bCalStatusFound = true; snprintf(pCalFileInfo->iCalStatus, sizeof(pCalFileInfo->iCalStatus)-1, "Success"); } else if(strstr(cFileLine,"Fail") != NULL) { bCalStatusFound = true; snprintf(pCalFileInfo->iCalStatus, sizeof(pCalFileInfo->iCalStatus)-1, "Fail"); } } if(bFuseIdFound == false) { if((pString = strstr(cFileLine,"Fuse_ID[4]")) != NULL) { bFuseIdFound = true; pString +=(sizeof("Fuse_ID[4]=0x") - 0x01); sscanf(pString,"%lx",&(pCalFileInfo->Fuse_Id4)); } } if(bFuseIdFound == true && bCalStatusFound == true) { // Got both Status and fuse id, so no need for further read MSG0("Found Both status and FuseId4 in Calibration file\n"); break; } } OUTR(" ", FILEIO_OK); return FILEIO_OK; }
void openmax_processor::fillThisBuffer(OMX_BUFFERHEADERTYPE_p buffer, t_uint8 portNb) //******************************************************************************* { //Just wrap to the base component IN0("\n"); Port *pPort=GetPort(portNb); WARNING(pPort); MSG3("%s->fillThisBuffer[%lu] Header=%p \n", GetComponentName(), buffer->nOutputPortIndex, buffer); if (buffer->nOutputPortIndex!=portNb) { // Should make more stuff WARNING(buffer->nOutputPortIndex==portNb); } Component::deliverBuffer(portNb, buffer); OUT0("\n"); }
/* * Write method */ void fileio::write(const char* aFileName, const void* aSrcBuffer, t_uint32 aNumBytes) { ASYNC_IN0(""); FILE* theFile = NULL; size_t writtenBytesCount = 0; // Sanity check if( aFileName == NULL || aSrcBuffer == NULL || aNumBytes == 0) { // bad parameter MSG3("Bad parameter: aFileName=%p aSrcBuffer=%p aNumBytes=%ld\n", aFileName, aSrcBuffer, aNumBytes); response.fileIoResponse(FILE_IO_BAD_PARAMETER); ASYNC_OUT0(""); return; } // Open the file MSG1("Opening file '%s' for writing\n", aFileName); theFile = fopen( aFileName, "wb"); if(theFile==NULL) { // could not open the file MSG1("File '%s' open failed\n", aFileName); response.fileIoResponse(FILE_IO_OPEN_FAILED); ASYNC_OUT0(""); return; } // Actual write MSG2("Writing %ld bytes to file '%s'\n", aNumBytes, aFileName); writtenBytesCount = fwrite( aSrcBuffer, 1, (size_t)aNumBytes, theFile); if( writtenBytesCount != aNumBytes ) { // could not write into file MSG0("Write failed\n"); MSG1("Closing file '%s'\n", aFileName); fclose(theFile); response.fileIoResponse(FILE_IO_WRITE_FAILED); ASYNC_OUT0(""); return; } // File sucessfully written MSG1("Closing file '%s'\n", aFileName); fclose(theFile); response.fileIoResponse(FILE_IO_OK); ASYNC_OUT0(""); return; }
/* * Read method */ void fileio::read(const char* aFileName, void* aDestBuffer, t_uint32 aNumBytes) { ASYNC_IN0(""); FILE* theFile = NULL; size_t readBytesCount = 0; // Sanity check if( aFileName == NULL || aDestBuffer == NULL || aNumBytes == 0) { // bad parameter MSG3("Bad parameter: aFileName=%p aDestBuffer=%p aNumBytes=%ld\n", aFileName, aDestBuffer, aNumBytes); response.fileIoResponse(FILE_IO_BAD_PARAMETER); ASYNC_OUT0(""); return; } // Open the file MSG1("Opening file '%s' for reading\n", aFileName); theFile = fopen( aFileName, "rb"); if(theFile==NULL) { // could not open the file MSG1("File '%s' open failed\n", aFileName); response.fileIoResponse(FILE_IO_OPEN_FAILED); ASYNC_OUT0(""); return; } // Read the file MSG2("Reading %ld bytes from file '%s'\n", aNumBytes, aFileName); readBytesCount = fread( aDestBuffer, 1, (size_t)aNumBytes, theFile); if( readBytesCount != aNumBytes ) { // could not read the file MSG2("Read failed, expected %ld bytes, actually got %d bytes\n", aNumBytes, readBytesCount); MSG1("Closing file '%s'\n", aFileName); fclose(theFile); response.fileIoResponse(FILE_IO_READ_FAILED); ASYNC_OUT0(""); return; } // File sucessfully read MSG1("Closing file '%s'\n", aFileName); fclose(theFile); response.fileIoResponse(FILE_IO_OK); ASYNC_OUT0(""); return; }
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::freeBuffer(OMX_U32 nPortIndex, OMX_U32 nBufferIndex, OMX_BOOL bBufferAllocated, void *bufferAllocInfo, void *portPrivateInfo) //************************************************************************************************************* { IN0("\n"); MSG3("freeBuffer nPortIndex %lu- nBufferIndex %lu bBufferAllocated=%s\n", nPortIndex, nBufferIndex, bBufferAllocated==true?"true":"false"); // WOM_BREAKPOINT; OMX_ERRORTYPE err = OMX_ErrorNone; if (m_NbPortAllocated[nPortIndex] > 0) { err = freeBufferHeap(nPortIndex, nBufferIndex, bBufferAllocated, bufferAllocInfo, portPrivateInfo); --m_NbPortAllocated[nPortIndex]; } OUTR("", (err)); return err; }
SCF_STATE CAM_SM::HDRtoZSL(s_scf_event const *e) { COmxCamera *pOMXCam = (COmxCamera*)&mENSComponent; switch (e->sig) { case SCF_STATE_ENTRY_SIG: { ENTRY; MSG0("HDR: CAM_SM::HDRtoZSL- SCF_STATE_ENTRY_SIG\n"); //Restore backup for ZSL pOMXCam->mCameraUserSettings.nFramesBefore = pOMXCam->nFrameBeforeBackUp; pOMXCam->mCameraUserSettings.bFrameLimited = pOMXCam->bFrameLimitedBackUp; pOMXCam->mCameraUserSettings.nFrameLimit = pOMXCam->nFrameLimitBackUp; MSG3("HDR: Backup Restore Values: nFrameBefore = %ld, bFrameLimited = %d, nFrameLimit = %ld\n", pOMXCam->nFrameBeforeBackUp, pOMXCam->bFrameLimitedBackUp, pOMXCam->nFrameLimitBackUp); pOpModeMgr->SetBurstLimited(pOMXCam->mCameraUserSettings.bFrameLimited == OMX_TRUE); pOpModeMgr->SetBurstFrameLimit(pOMXCam->mCameraUserSettings.nFrameLimit); pOpModeMgr->SetFrameBefore(pOMXCam->mCameraUserSettings.nFramesBefore); pOpModeMgr->SetPrepareCapture(OMX_TRUE); pOpModeMgr->UpdateCurrentOpMode(); pResourceSharerManager->mRSPing.Ping(0); return 0; } case Q_PONG_SIG: { MSG0("HDR: Setting force ok\n"); pIspctlCom->writePE(SystemSetup_e_GrabMode_Ctrl_Byte0, GrabMode_e_FORCE_OK); return 0; } case EVT_ISPCTL_INFO_SIG: { MSG0("HDR: CAM_SM::HDRtoZSL - EVT_ISPCTL_INFO_SIG\n"); ((COmxCamera*)&mENSComponent)->eStateZSLHDR = ZSLHDRState_Invalid; pOpModeMgr->captureRequest[CAMERA_PORT_OUT1] = 0; pGrabControl->setStartCapture(CAMERA_PORT_OUT0); pGrabControl->setStartHiddenCapture(CAMERA_PORT_OUT1, (t_uint16)pOpModeMgr->GetFrameBefore()); MSG0("HDR: setting grab mode to normal\n"); SCF_TRANSIT_TO(&CAM_SM::ProcessPendingEvents); return 0; } case SCF_STATE_EXIT_SIG: EXIT; return 0; default: break; } return SCF_STATE_PTR(&CAM_SM::ProcessPendingEvents); }
SCF_STATE CAM_SM::ZSLHDRConfigureCaptureMode(s_scf_event const *e) { COmxCamera *pOMXCam = (COmxCamera*)&mENSComponent; switch (e->sig) { case SCF_STATE_ENTRY_SIG: { ENTRY; MSG0("HDR: CAM_SM::ZSLHDRConfigureCaptureMode- SCF_STATE_ENTRY_SIG\n"); pResourceSharerManager->mRSPing.Ping(0); return 0; } case Q_PONG_SIG: { MSG0("HDR: CAM_SM::ZSLHDRConfigureCaptureMode - Q_PONG_SIG\n"); //Save Backup for ZSL Resume pOMXCam->nFrameBeforeBackUp = pOMXCam->mCameraUserSettings.nFramesBefore; pOMXCam->bFrameLimitedBackUp = pOMXCam->mCameraUserSettings.bFrameLimited; pOMXCam->nFrameLimitBackUp = pOMXCam->mCameraUserSettings.nFrameLimit; MSG3("HDR: Backup Values: nFrameBefore = %ld, bFrameLimited = %d, nFrameLimit = %ld\n", pOMXCam->nFrameBeforeBackUp, pOMXCam->bFrameLimitedBackUp, pOMXCam->nFrameLimitBackUp); //Setting for HDR pOMXCam->mCameraUserSettings.bFrameLimited = OMX_TRUE; pOMXCam->mCameraUserSettings.nFrameLimit = ZSLHDR_MAX_FRAMELIMIT; pOMXCam->mCameraUserSettings.nFramesBefore = 0; pOpModeMgr->SetBurstLimited(pOMXCam->mCameraUserSettings.bFrameLimited == OMX_TRUE); pOpModeMgr->SetBurstFrameLimit(pOMXCam->mCameraUserSettings.nFrameLimit); pOpModeMgr->SetFrameBefore(pOMXCam->mCameraUserSettings.nFramesBefore); pOpModeMgr->SetPrepareCapture(OMX_FALSE); pOpModeMgr->UpdateCurrentOpMode(); MSG0("HDR: eStateZSLHDR = ZSLHDRState_ReadyForCapture\n"); ((COmxCamera*)&mENSComponent)->eStateZSLHDR = ZSLHDRState_ReadyForCapture; SCF_TRANSIT_TO(&CAM_SM::ProcessPendingEvents); return 0; } case SCF_STATE_EXIT_SIG: EXIT; return 0; default: break; } return SCF_STATE_PTR(&CAM_SM::ProcessPendingEvents); }
/** @brief Called when the processing is ready to be stopped */ WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::stop() //************************************************************************************************************* {// Call Deinstantiation of component IN0("\n"); m_pNmfProcWrp->stop(); #if 0 //ER355733 Try to fix ens bug that doesn't reset bufferSupplier type PortVideo* pPort; for (unsigned int Index=0; Index< mENSComponent.getPortCount(); ++Index) { pPort = (PortVideo*)mENSComponent.getPort(Index); if (pPort->getBufferSupplier() !=OMX_BufferSupplyUnspecified) { MSG3("wwwwwwwwwwwwwwwwwwwwwwwwwwww %s.port[%d] reset state(%d) to OMX_BufferSupplyUnspecified\n", GetComponentName(), Index, pPort->getBufferSupplier()); pPort->setBufferSupplier(OMX_BufferSupplyUnspecified); } } #endif OUT0("\n"); return OMX_ErrorNone; }
// 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; }
/** brief Instantiate the nmf component and bind interfaces Called during Loaded to Idle transition */ WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::instantiate() //************************************************************************************************************* { //binding all interfaces OMX_ERRORTYPE omx_error=OMX_ErrorNone; IN0("\n"); // Init Components // Bind of arm nmf components MSG1("OpenMax_Proxy(%s) Instantiating arm nmf component\n", GetComponentName()); openmax_processor *pProcessor=NULL; if (m_pProcessor != NULL) pProcessor = m_pProcessor; else if (m_fnCreateNmfComponent !=NULL) { m_pProcessor= m_fnCreateNmfComponent(); pProcessor = m_pProcessor; } m_pNmfProcWrp = openmax_processor_wrpCreate(pProcessor); m_pNmfProcWrp->priority = m_nmfPriority; if (m_pNmfProcWrp->construct() != NMF_OK) NMF_PANIC("PANIC - Construct Error\n") ; t_nmf_error error ; // bindFromUser --> Asynchronous // getInterface --> Synchronous error = m_pNmfProcWrp->bindFromUser("sendcommand", 2, &mIsendCommand) ; if (error != NMF_OK) NMF_PANIC("PANIC - bindFromUser sendCommand\n") ; #if (SYNCHRONOUS ==0) error = m_pNmfProcWrp->bindFromUser("Param", 2*mENSComponent.getPortCount()+1, &m_IParam) ; // One setparam per port + 1 if (error != NMF_OK) NMF_PANIC("PANIC - bindFromUser Param\n") ; error = m_pNmfProcWrp->bindFromUser("Config", 2*mENSComponent.getPortCount()+1, &m_IConfig) ; // One setparam per port + 1 if (error != NMF_OK) NMF_PANIC("PANIC - bindFromUser Config\n") ; #else //Bind synchronous interfaces //interfaces are binded in a synchronous way error = m_pNmfProcWrp->getInterface("Param", &m_IParam); if (error != NMF_OK) NMF_PANIC("PANIC - getInterface Param\n") ; error = m_pNmfProcWrp->getInterface("Config", &m_IConfig); if (error != NMF_OK) NMF_PANIC("PANIC - getInterface Config\n") ; #endif error = m_pNmfProcWrp->bindFromUser("fsminit", 1 , &mIfsmInit); if (error != NMF_OK) NMF_PANIC("Error: unable to bind fsminit!...\n"); error = EnsWrapper_bindToUser(mENSComponent.getOMXHandle(), m_pNmfProcWrp, "proxy", getEventHandlerCB(), 8); if (error != NMF_OK) NMF_PANIC("Error: unable to bind proxy!...\n"); error = EnsWrapper_bindToUser(mENSComponent.getOMXHandle(), m_pNmfProcWrp, "ToOMXComponent", mConfigCB, 1); if (error != NMF_OK) NMF_PANIC("Error: unable to bind ToOMXComponent!...\n"); char name[20]; //reserve some char for formatting callback name size_t iNbInput =0; size_t iNbOutput=0; PortVideo* pPort; for (unsigned int Index=0; Index< mENSComponent.getPortCount(); ++Index) { pPort = (PortVideo*)mENSComponent.getPort(Index); MSG3("\n %s Port %d : direction =%d\n", GetComponentName(), Index, pPort->getDirection()); //reset port info at this point //NO it's too late! #if 0 if (pPort->getBufferSupplier() !=OMX_BufferSupplyUnspecified) { printf("wwwwwwwwwwwwwwwwwwwwwwwwwwww %s.port[%d] reset state(%d) to OMX_BufferSupplyUnspecified\n", GetComponentName(), Index, pPort->getBufferSupplier()); pPort->setBufferSupplier(OMX_BufferSupplyUnspecified); } #endif switch(pPort->getDirection()) { case OMX_DirInput: //bind emptythisbuffer, emptybufferdone for each input port if (iNbInput < MAX_PORTS_COUNT) { sprintf(name, "emptythisbuffer[%d]", Index); error = m_pNmfProcWrp->bindFromUser(name, pPort->getBufferCountActual(), &mIemptyThisBuffer[Index]); if (error != NMF_OK) NMF_PANIC("PANIC %s->bindFromUser %s\n", GetComponentName(), name) ; sprintf(name, "emptybufferdone[%d]", Index); error = EnsWrapper_bindToUser(mENSComponent.getOMXHandle(), m_pNmfProcWrp, name , this->getEmptyBufferDoneCB(), pPort->getBufferCountActual()); if (error != NMF_OK) NMF_PANIC("PANIC %s->bindToUser %s\n", GetComponentName(), name) ; ++iNbInput; } else { // ReportError( } break; case OMX_DirOutput://bind fillthisbuffer, fillbufferdone for each output port if (iNbOutput < MAX_PORTS_COUNT) { sprintf(name, "fillthisbuffer[%d]", Index); error = m_pNmfProcWrp->bindFromUser(name, pPort->getBufferCountActual(), &mIfillThisBuffer[Index]); if (error != NMF_OK) NMF_PANIC("PANIC %s->bindFromUser %s\n", GetComponentName(), name) ; sprintf(name, "fillbufferdone[%d]", Index); error = EnsWrapper_bindToUser(mENSComponent.getOMXHandle(), m_pNmfProcWrp, name, this->getFillBufferDoneCB(), pPort->getBufferCountActual()); if (error != NMF_OK) NMF_PANIC("PANIC %s->bindToUser %s\n", GetComponentName(), name) ; ++iNbOutput; } else { // ReportError( } break; default: break; } } // Configure the number of ports m_IConfig.setTargetComponent(mENSComponent.getPortCount() , &mENSComponent); OUTR(" ", (omx_error)); return omx_error; }
int thzrecv(Process *proc, void **ptr, port_ent *peptr, int elem_no, long *size, char **typep) { /* This service returns the data part of an IP - if info is needed from the header, you have to back up over the length of the header */ //Process *sptr; IPh *IPptr; //IPh *optr; IP *tptr; int value = 0; Port *cpp; Cnxt *cnp; IIP *IIPptr; IPh *created_IIP_ptr; void *created_ptr; //extern void run(Process * proc); if (peptr -> ret_code == 2) { if (proc -> trace) MSG1("%s Recv from unconnected port\n", proc -> procname); return(2); } cpp = (Port *)peptr -> cpptr; if (proc -> trace) MSG3("%s Recv start %s[%d]\n", proc -> procname, cpp -> port_name, elem_no); if (cpp -> elem_list[elem_no].is_IIP) { IIPptr = cpp -> elem_list[elem_no].gen.IIPptr; auto j = strlen(IIPptr -> datapart); value = thzcrep(proc, &created_ptr, static_cast<int>(j + 1), "OPTIONS"); created_IIP_ptr = (IPh *) created_ptr - 1; memcpy (created_ptr, IIPptr -> datapart, j + 1); cpp -> elem_list[elem_no].closed = TRUE; *ptr = created_ptr; *size = created_IIP_ptr -> IP_size; *typep = created_IIP_ptr -> type; cpp -> elem_list[elem_no].closed = TRUE; if (proc -> trace) MSG1("%s Recv end\n", proc -> procname); return(0); } cnp = (Cnxt *) cpp -> elem_list[elem_no].gen.connxn; if (cnp == 0) return(2); //cnp ->lock.lock(); //cnp -> lock = boost::unique_lock<boost::mutex> (cnp -> mtx); boost::unique_lock<boost::mutex> lock (cnp -> mtx); if (cnp->closed && cnp->first_IPptr == 0) { // connection closed AND drained if (proc -> trace) MSG1("%s Recv end of stream\n", proc -> procname); value = 2; goto retn; } //if (proc -> trace) MSG3("%s Recv start %s[%d]\n", proc -> procname, // cpp -> port_name, elem_no); if (elem_no < 0 || elem_no >= cpp ->elem_count) { MSG2("%s %s RECV Element Number negative or too high\n", proc -> procname, peptr -> port_name); value = 3; goto retn; } if (cpp ->direction != INPUT) { MSG2("%s %s RECV Wrong direction\n", proc -> procname, peptr -> port_name); value = 3; goto retn; } if (cpp -> elem_list[elem_no].closed) { if (proc -> trace) MSG1("%s Recv end no data\n", proc -> procname); value = 1; goto retn; } for (;;) { if (cnp -> first_IPptr != 0) goto X; if (cnp -> nonterm_upstream_proc_count == 0 /* || cpp -> elem_list[elem_no].closed */ ) { if (proc -> trace) MSG1("%s Recv end no data\n", proc -> procname); value = 1; goto retn; } proc -> status = SUSPENDED_ON_RECV; proc -> waiting_cnxt = cnp; if (proc -> trace) MSG1("%s Recv susp\n", proc -> procname); cnp-> buffer_not_empty.wait(lock); if (proc -> trace) MSG1("%s Recv resume\n", proc -> procname); proc -> status = ACTIVE; proc -> waiting_cnxt = 0; } X: IPptr = cnp -> first_IPptr; if ((cnp -> first_IPptr = IPptr -> next_IP) == 0) cnp -> last_IPptr = 0; tptr = (IP *) IPptr; if (tptr -> datapart[IPptr -> IP_size] != guard_value) MSG1("Guard byte corrupted: '%s'\n", proc->procname); if (IPptr -> owner != cnp) MSG1("IP header corrupted: '%s'\n", proc->procname); *ptr = tptr -> datapart; *size = IPptr -> IP_size; *typep = IPptr -> type; IPptr -> next_IP = 0; IPptr -> prev_IP = 0; IPptr -> owner = proc; if (cnp ->IPcount == cnp -> max_IPcount) cnp->buffer_not_full.notify_all(); --cnp -> IPcount; if (proc -> trace) MSG1("%s Recv end\n", proc -> procname); proc -> owned_IPs++; value = 0; retn: proc -> network -> active = TRUE; return(value); }
SCF_STATE CAM_SM::PowerUp_STC_SensorInfo(s_scf_event const *e) { switch (e->sig) { case SCF_STATE_ENTRY_SIG: MSG0("PowerUp_STC_SensorInfo-SCF_STATE_ENTRY_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_SensorInfo-SCF_STATE_ENTRY_SIG", (&mENSComponent)); pIspctlCom->queuePE(SensorInformation_e_Flag_Available_Byte0,0); pIspctlCom->queuePE(SensorInformation_u8_manufacturer_id_Byte0,0); pIspctlCom->queuePE(SensorInformation_u16_model_id_Byte0,0); pIspctlCom->queuePE(SensorInformation_u8_revision_number_Byte0,0); pIspctlCom->queuePE(SensorFrameConstraints_u16_MaxOPXOutputSize_Byte0,0); pIspctlCom->queuePE(SensorFrameConstraints_u16_MaxOPYOutputSize_Byte0,0); pIspctlCom->queuePE(CurrentFrameDimension_u16_NumberofNonActiveLinesAtTopEdge_Byte0,0); pIspctlCom->readQueue(); return 0; case EVT_ISPCTL_LIST_INFO_SIG: { MSG0("PowerUp_STC_SensorInfo-EVT_ISPCTL_LIST_INFO_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_SensorInfo-EVT_ISPCTL_LIST_INFO_SIG", (&mENSComponent)); if (e->type.ispctlInfo.info_id != ISP_READLIST_DONE) break; //#if defined (OSI_DEBUG) for(t_uint16 i=0; i < e->type.ispctlInfo.number_of_pe; i++) { MSG3(" PE[%d] %s = 0x%lX\n", i, pSensor->GetPeName(e->type.ispctlInfo.Listvalue[i].pe_addr), e->type.ispctlInfo.Listvalue[i].pe_data ); //OstTraceFiltStatic3(TRACE_DEBUG, " PE[%d] %s = 0x%lX", (&mENSComponent), i, CXp70::GetPeName(e->type.ispctlInfo.Listvalue[i].pe_addr), e->type.ispctlInfo.Listvalue[i].pe_data ); } //#endif // Store sensor related data t_sensorDesciptor pDesc; // Initialisation to remove Coverity Warning pDesc.manufacturer = 0; pDesc.model = 0; pDesc.revisionNumber = 0; pDesc.Fuse_Id[0] = 0; pDesc.Fuse_Id[1] = 0; pDesc.Fuse_Id[2] = 0; pDesc.Fuse_Id4 = 0; pDesc.model = (t_uint16)e->type.ispctlInfo.Listvalue[2].pe_data; pDesc.manufacturer = (t_uint8) e->type.ispctlInfo.Listvalue[1].pe_data; pDesc.revisionNumber = (t_uint8) e->type.ispctlInfo.Listvalue[3].pe_data; pSensor->SetSensorDescriptor(&pDesc); pSensor->setBayerWidth((t_uint32)e->type.ispctlInfo.Listvalue[4].pe_data); pSensor->setBayerHeight((t_uint32)(e->type.ispctlInfo.Listvalue[5].pe_data + e->type.ispctlInfo.Listvalue[6].pe_data)); pSensor->setNberOfNonActiveLines((t_uint8)e->type.ispctlInfo.Listvalue[6].pe_data); // update VPB1 port settings according to sensor parameters OMX_PARAM_PORTDEFINITIONTYPE mParamPortDefinition; mParamPortDefinition.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE); getOmxIlSpecVersion(&mParamPortDefinition.nVersion); mENSComponent.getPort(CAMERA_PORT_OUT1)->getParameter(OMX_IndexParamPortDefinition,&mParamPortDefinition); if ((mParamPortDefinition.format.video.nFrameWidth != pSensor->getBayerWidth()) || (mParamPortDefinition.format.video.nFrameHeight != pSensor->getBayerHeight())) { mParamPortDefinition.format.video.nFrameWidth = pSensor->getBayerWidth(); mParamPortDefinition.format.video.nFrameHeight = pSensor->getBayerHeight(); mParamPortDefinition.format.video.nSliceHeight = pSensor->getBayerHeight(); mENSComponent.getPort(CAMERA_PORT_OUT1)->setParameter(OMX_IndexParamPortDefinition,&mParamPortDefinition); // notify IL client of update mENSComponent.eventHandler(OMX_EventPortSettingsChanged, mENSComponent.getPort(CAMERA_PORT_OUT1)->getPortIndex(), 0); } SCF_TRANSIT_TO(&CAM_SM::PowerUp_STC_GetNbBlockIds); return 0; } case SCF_STATE_EXIT_SIG: MSG0("PowerUp_STC_SensorInfo-SCF_STATE_EXIT_SIG\n"); OstTraceFiltStatic0(TRACE_DEBUG, "PowerUp_STC_SensorInfo-SCF_STATE_EXIT_SIG", (&mENSComponent)); return 0; default: break; } return SCF_STATE_PTR(&COM_SM::SHARED_ControlingISPState_Boot); }
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); }
void womDemoCpt_processor::process() //************************************************************************************************************* { // Process IMG to Metadata IN0("\n"); const int InputIndex = eInputPort_Img; const int OutputIndex = eOutputPort_Img; _tConvertionConfig Config; int res; int inBufCount; int outBufCount; if (m_bUseBufferSharing==false) { // No buffer sharing //Check that there are at least on input and one ouptut buffer inBufCount = GetPort(InputIndex)->queuedBufferCount(); outBufCount = GetPort(OutputIndex)->queuedBufferCount(); MSG3("%s inBufCount %d, outBufCount %d\n", GetComponentName(), inBufCount, outBufCount); if ((inBufCount==0) || (outBufCount==0)) { OUT0("\n"); return; //No buffer to process } // Input and output buffers are available: can do the processing res=InitProcessingInfo(Config, true, InputIndex, OutputIndex, -1); // Uncomment following lines if you want to get some extradata //OMX_EXTRADATATYPE *pData; //if (GetExtraData(Config.Input.pBufferHdr, OMX_SYMBIAN_CameraExtraDataCaptureParameters, (char*&)pData )==S_OK) //{ //} Config.Output.pBufferHdr->nFilledLen = Config.Input .pBufferHdr->nFilledLen; //Update output size Config.Output.pBufferHdr->nOffset = 0; Config.Output.pBufferHdr->nFlags = Config.Input .pBufferHdr->nFlags; //Update output flags //Now we can call our processing function res= m_fn_UserProcessBuffer(Config); // Call specific processing if (res!=0) { // should implement error handling } if((Config.Input.pBufferHdr->nFlags & WOM_BUFFERFLAG_CALLBACK_MASK)!=0) { //Input buffer is marked with End of stream flag, recopy of the flag is needed portInformation *pPortInfo; /* Uncomment this code if the component sink and don't produce output buffer pPortInfo=GetPortInfo(InputIndex); if (pPortInfo) { m_pIProcessorCB->OmxEventFeedback(OMX_EventBufferFlag, pPortInfo->omxPortIndex, Config.Input.pBufferHdr->nFlags); } */ pPortInfo=GetPortInfo(OutputIndex); if (pPortInfo) { m_pIProcessorCB->OmxEventFeedback(OMX_EventBufferFlag, pPortInfo->omxPortIndex, (Config.Input.pBufferHdr->nFlags & WOM_BUFFERFLAG_CALLBACK_MASK)); } } else { } MSG0("Copy ExtraData\n"); //CopyExtraData(Config); Config.Input .pBufferHdr->nFilledLen = 0; // reset processed buffer //release processed buffer GetPort(InputIndex) ->returnBuffer(Config.Input .pBufferHdr); GetPort(OutputIndex)->returnBuffer(Config.Output.pBufferHdr); // Must add metadata release } else { //Buffer sharing case //Check that there are at least on input and one ouptut buffer inBufCount = GetPort(InputIndex) ->queuedBufferCount(); MSG1("Buffer count: In0 %d\n", inBufCount); if (inBufCount==0) { OUT0("\n"); return; //No buffer to process } // Input 0 and 1 and output buffers are available: can do the processing //No extradata to process res=InitProcessingInfo(Config, true, InputIndex, -1, -1); InitBufferInfo(Config.Output, InputIndex, false); Config.Output.pBufferHdr=Config.Input.pBufferHdr; //Set output buffer header ptr = to input one //Now we can call our processing function res= m_fn_UserProcessBuffer(Config); // Call specific processing if (res!=0) { // should implement error handling } if((Config.Input.pBufferHdr->nFlags & WOM_BUFFERFLAG_CALLBACK_MASK)!=0) { //Input buffer is marked with End of stream flag portInformation *pPortInfo=GetPortInfo(OutputIndex); if (pPortInfo) { MSG2(" womDemoCpt[d] flags=0x%x. Send it to %d\n", (int)pPortInfo->omxPortIndex, (int)Config.Input.pBufferHdr->nFlags); m_pIProcessorCB->OmxEventFeedback(OMX_EventBufferFlag, pPortInfo->omxPortIndex, (Config.Input.pBufferHdr->nFlags & WOM_BUFFERFLAG_CALLBACK_MASK)); } } MSG2("Buffer count: Img0 %p, Out=%p\n", Config.Input .pBufferHdr, Config.Output.pBufferHdr); GetPort(InputIndex) ->returnBuffer(Config.Input .pBufferHdr); } OUT0("\n"); }
static int TT_ProcessRow_(TTRPtr r) { int type,i,bosid,idnr; char *chara, name[5] = {' ',' ',' ',' ','\0'}; /* printf("Row %4d: %4.4s#%d id %2.2d:%3.3d:%d Addr %2.2d:%2.2d\n" ,nline,&(r->nm),r->nr,r->sd1,r->sd2,r->pl,r->sl,r->chn); */ /* We want process only data corresponding to that ROC */ if (r->roc != ttpwork->roc) { MSG3("Changed ROC # %i to %i at line # %i\n",ttpwork->roc,r->roc,nline); return 0; } if (r->sl > 26 || r->sl < 0) { MSG2("Wrong slot number %i in line %i\n",r->sl,nline); return 0; } if (r->chn > 256 || r->chn < 0) { MSG2("Wrong channel number %i in line %i\n",r->chn,nline); return 0; } if (r->typ == 1872) type = 0; /* even - tdc */ else if(r->typ == 1881) type = 1; /* odd - adc */ else if(r->typ == 1877) type = 2; /* even - tdc */ else if(r->typ == 1190) type = 4; /* even - tdc */ else /* unknown */ { MSG2("Unknown board type # %i at line # %i\n",r->typ,nline); return 0; /* skip this junk */ } if (ttpwork->type[slot] == -1 ) ttpwork->type[slot] = type; else if (ttpwork->type[slot] != type) { MSG4("Slot #%i : type # %i changed to %i at line # %i\n", slot,ttpwork->type[slot],type,nline); return(0); /* skip this junk */ } /* calculate 'bosid' */ bosid = r->sd1*256 + r->sd2; /* calculate 'idnr' from 'name' and 'nr' */ chara = (char *)&r->nm; for(i=0; i<4; i++) name[i] = chara[i]; idnr = (bosMgetid_(name) << 16) + r->nr; /*printf("name=>%4.4s< nr=%d -> idnr=0x%08x\n",&r->nm,r->nr,idnr);*/ /* fill the table */ if(type == 0) /* channel# --> 0..7 bits (Lecroy 1872A) */ { ttpwork->idnr[slot][channel] = idnr; ttpwork->name[slot][channel] = r->nm; ttpwork->nr[slot][channel] = r->nr; ttpwork->place[slot][channel] = r->pl; ttpwork->id[slot][channel] = bosid; /* repeat for setting bit 23 */ ttpwork->idnr[slot][128+channel] = idnr; ttpwork->name[slot][128+channel] = r->nm; /* bank name */ ttpwork->nr[slot][128+channel] = r->nr; /* bank# */ ttpwork->place[slot][128+channel] = r->pl; /* place# */ ttpwork->id[slot][128+channel] = bosid; /* id */ } if(type == 1) /* channel# --> 1..7 bits (Lecroy 1881M) */ { int chan = r->chn << 1; ttpwork->idnr[slot][chan] = idnr; ttpwork->name[slot][chan] = r->nm; /* bank name */ ttpwork->nr[slot][chan] = r->nr; /* bank# */ ttpwork->place[slot][chan] = r->pl; /* place# */ ttpwork->id[slot][chan] = bosid; /* id */ /* repeat for setting bit 0 */ ttpwork->idnr[slot][chan+1] = idnr; ttpwork->name[slot][chan+1] = r->nm; /* bank name */ ttpwork->nr[slot][chan+1] = r->nr; /* bank# */ ttpwork->place[slot][chan+1] = r->pl; /* place# */ ttpwork->id[slot][chan+1] = bosid; /* id */ /* printf("slot=%d chan=%d -> name %4.4s\n",slot,chan,&(ttpwork->name[slot][chan])); */ } if(type == 2) /* channel# --> 1..8 bits (Lecroy 1877 with multiplexing) */ { ttpwork->idnr[slot][channel] = idnr; ttpwork->name[slot][channel] = r->nm; ttpwork->nr[slot][channel] = r->nr; ttpwork->id2[slot][r->pl][channel] = bosid; } if(type == 4) /* channel# --> 1..8 bits (CAEN 1190 pipeline) */ { ttpwork->idnr[slot][channel] = idnr; ttpwork->name[slot][channel] = r->nm; ttpwork->nr[slot][channel] = r->nr; ttpwork->id2[slot][r->pl][channel] = bosid; } return(1); }